EgtGraphics :
- aggiunta gestione flag ShowZmap (solo surf, solo linee, entrambe).
This commit is contained in:
@@ -117,6 +117,10 @@ class Scene : public IEGrScene
|
||||
{ m_bShowTriaAdvanced = bAdvanced ; }
|
||||
virtual bool GetShowTriaAdvanced( void)
|
||||
{ return m_bShowTriaAdvanced ; }
|
||||
virtual void SetShowZmap( int nMode)
|
||||
{ m_nShowZmap = nMode ; }
|
||||
virtual int GetShowZmap( void)
|
||||
{ return m_nShowZmap ; }
|
||||
// Geometry
|
||||
virtual bool SetExtension( const BBox3d& b3Ext) ;
|
||||
virtual bool UpdateExtension( void) ;
|
||||
@@ -263,6 +267,7 @@ class Scene : public IEGrScene
|
||||
int m_nShowMode ; // modo di visualizzazione (wireframe, hiddenline, shading)
|
||||
bool m_bShowCurveDirection ; // flag di visualizzazione direzione curve
|
||||
bool m_bShowTriaAdvanced ; // flag per abilitare la visualizzazione avanzata dei triangoli
|
||||
int m_nShowZmap ; // modo visualizzazione Zmap (1=surf, 2=spilloni, 3=entrambi)
|
||||
// Selection
|
||||
bool m_bSelect ; // flag di selezione attiva
|
||||
int m_nObjFilterForSelect ; // tipi di oggetti che possono essere selezionati
|
||||
|
||||
@@ -68,6 +68,7 @@ Scene::Scene( void)
|
||||
m_nShowMode = SM_WIREFRAME ;
|
||||
m_bShowCurveDirection = false ;
|
||||
m_bShowTriaAdvanced = true ;
|
||||
m_nShowZmap = ZSM_SURF ;
|
||||
// Selezione
|
||||
m_bSelect = false ;
|
||||
m_nObjFilterForSelect = GEO_ZERODIM | GEO_CURVE | GEO_SURF | GEO_VOLUME | GEO_EXTRA ;
|
||||
|
||||
+43
-38
@@ -335,45 +335,50 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
mMat.Set( m_colDef) ;
|
||||
// impostazioni iniziali
|
||||
pGraphics->Clear() ;
|
||||
pGraphics->AddColor( siObj.colObj) ; // per wireframe
|
||||
pGraphics->AddMaterial( mMat.GetAmbient(), mMat.GetDiffuse(),
|
||||
mMat.GetSpecular(), mMat.GetShininess()) ;
|
||||
pGraphics->AddBackMaterial( GetSurfBackColor( mMat.GetDiffuse())) ;
|
||||
// recupero la geometria
|
||||
TRIA3DLIST lstTria ;
|
||||
pZmap->GetAllTriangles( lstTria) ;
|
||||
// passo i triangoli alla grafica
|
||||
pGraphics->StartTriangles( int( lstTria.size())) ;
|
||||
for ( const auto& Tria : lstTria) {
|
||||
TriFlags3d TFlags ;
|
||||
TriNormals3d TNrms ;
|
||||
for ( int i = 0 ; i < 3 ; ++i) {
|
||||
// i triangoli sono sempre parte di un quadrilatero -> terzo lato da non visualizzare
|
||||
TFlags.bFlag[i] = ( i != 2 ? true : false) ;
|
||||
TNrms.vtN[i] = Tria.GetN() ;
|
||||
}
|
||||
pGraphics->AddTriangle( Tria, TFlags, TNrms) ;
|
||||
}
|
||||
pGraphics->EndTriangles() ;
|
||||
// visualizzazione superficie
|
||||
if ( m_nShowZmap != ZSM_LINES) {
|
||||
pGraphics->AddColor( siObj.colObj) ; // per wireframe
|
||||
pGraphics->AddMaterial( mMat.GetAmbient(), mMat.GetDiffuse(),
|
||||
mMat.GetSpecular(), mMat.GetShininess()) ;
|
||||
pGraphics->AddBackMaterial( GetSurfBackColor( mMat.GetDiffuse())) ;
|
||||
// recupero la geometria
|
||||
TRIA3DLIST lstTria ;
|
||||
pZmap->GetAllTriangles( lstTria) ;
|
||||
// passo i triangoli alla grafica
|
||||
pGraphics->StartTriangles( int( lstTria.size())) ;
|
||||
for ( const auto& Tria : lstTria) {
|
||||
TriFlags3d TFlags ;
|
||||
TriNormals3d TNrms ;
|
||||
for ( int i = 0 ; i < 3 ; ++i) {
|
||||
// i triangoli sono sempre parte di un quadrilatero -> terzo lato da non visualizzare
|
||||
TFlags.bFlag[i] = ( i != 2 ? true : false) ;
|
||||
TNrms.vtN[i] = Tria.GetN() ;
|
||||
}
|
||||
pGraphics->AddTriangle( Tria, TFlags, TNrms) ;
|
||||
}
|
||||
pGraphics->EndTriangles() ;
|
||||
}
|
||||
// visualizzazione spilloni
|
||||
pGraphics->AddColor( BLUE) ;
|
||||
POLYLINELIST lstPL ;
|
||||
for ( int i = 0 ; ; ++ i) {
|
||||
bool bOutBreak = false ;
|
||||
for ( int j = 0 ; ; ++ j) {
|
||||
lstPL.clear() ;
|
||||
if ( pZmap->GetDexelLines( 1, j, i, lstPL)) {
|
||||
for ( const auto& PL : lstPL)
|
||||
pGraphics->AddPolyLine( PL) ;
|
||||
}
|
||||
else {
|
||||
if ( j == 0)
|
||||
bOutBreak = true ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( bOutBreak)
|
||||
break ;
|
||||
if ( m_nShowZmap == ZSM_LINES || m_nShowZmap == ZSM_BOTH) {
|
||||
pGraphics->AddColor( BLUE) ;
|
||||
POLYLINELIST lstPL ;
|
||||
for ( int i = 0 ; ; ++ i) {
|
||||
bool bOutBreak = false ;
|
||||
for ( int j = 0 ; ; ++ j) {
|
||||
lstPL.clear() ;
|
||||
if ( pZmap->GetDexelLines( 1, j, i, lstPL)) {
|
||||
for ( const auto& PL : lstPL)
|
||||
pGraphics->AddPolyLine( PL) ;
|
||||
}
|
||||
else {
|
||||
if ( j == 0)
|
||||
bOutBreak = true ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( bOutBreak)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se testo
|
||||
|
||||
Reference in New Issue
Block a user