EgtGraphics 1.6f2 :

- aggiunta possibilità di visualizzazione di UserObj associati ad oggetti geometrici.
This commit is contained in:
Dario Sassi
2015-06-16 07:37:45 +00:00
parent a4582b3fc2
commit accc39b26a
2 changed files with 18 additions and 8 deletions
+18 -8
View File
@@ -164,6 +164,9 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
return false ;
int nGeoType = pGeoObj->GetType() ;
// recupero eventuale parte custom
const IUserObj* pUserObj = iIter.GetUserObj() ;
// se non esiste grafica associata, la creo
if ( pGeoObj->GetObjGraphics() == nullptr) {
// nuova modalità grafica solo per superfici con molti triangoli
@@ -315,15 +318,22 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
pTXT->ApproxWithLines( 0.01, 5, lstPL) ;
pGraphics->Clear() ;
pGraphics->AddColor( siObj.colObj) ;
POLYLINELIST::iterator Iter ;
for ( Iter = lstPL.begin() ; Iter != lstPL.end() ; ++ Iter)
pGraphics->AddPolyLine( *Iter) ;
for ( const auto& PL : lstPL)
pGraphics->AddPolyLine( PL) ;
}
// se esiste parte custom
if ( pUserObj != nullptr) {
POLYLINELIST lstPL ;
if ( pUserObj->GetDrawPolyLines( lstPL)) {
for ( const auto& PL : lstPL)
pGraphics->AddPolyLine( PL, true) ;
}
}
}
// se richiesto, visualizzo la grafica associata
bool bShowAux = false ;
if ( ( nGeoType & GEO_CURVE) != 0 && m_bShowCurveDirection)
if ( (( nGeoType & GEO_CURVE) != 0 || pUserObj != nullptr) && m_bShowCurveDirection)
bShowAux = true ;
// recupero il valore di opacità (solo per le superfici può esserci trasparenza)
@@ -390,15 +400,15 @@ Scene::DrawAlphaSurfVector( void)
[]( const AlphaSurf& a, const AlphaSurf&b) { return a.dZmax < b.dZmax ; }) ;
// eseguo visualizzazione
for ( int i = 0 ; i < int( m_vAlphaSurf.size()) ; ++i) {
for ( const auto& AlphaSurf : m_vAlphaSurf) {
// imposto matrice MODELVIEW
double Matrix[OGLMAT_DIM] ;
FrameToOpenGlMatrix( m_vAlphaSurf[i].frModView, Matrix) ;
FrameToOpenGlMatrix( AlphaSurf.frModView, Matrix) ;
glPushMatrix() ;
glLoadMatrixd( Matrix) ;
// eseguo visualizzazione
bool bOk = m_vAlphaSurf[i].pGraph->Draw( m_vAlphaSurf[i].nStat, m_vAlphaSurf[i].nMark, true,
m_vAlphaSurf[i].nAlpha, m_vAlphaSurf[i].bShowAux) ;
bool bOk = AlphaSurf.pGraph->Draw( AlphaSurf.nStat, AlphaSurf.nMark, true,
AlphaSurf.nAlpha, AlphaSurf.bShowAux) ;
// ripristino matrice
glPopMatrix() ;
// in caso di errore, esco