EgtGraphics 1.9a1 :
- gestione Zmap con 2 colori dipendenti da Flag.
This commit is contained in:
+60
-11
@@ -179,7 +179,7 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
const IVolZmap* pZmap = GetVolZmap( pGeoObj) ;
|
||||
if ( pZmap != nullptr) {
|
||||
if ( ( m_nShowZmap & ZSM_SURF) != 0)
|
||||
nCount += pZmap->GetBlockCount() ;
|
||||
nCount += 2 * pZmap->GetBlockCount() ;
|
||||
if ( ( m_nShowZmap & ZSM_LINES) != 0 || ( m_nShowZmap & ZSM_NORMALS) != 0)
|
||||
nCount += 1 ;
|
||||
}
|
||||
@@ -350,19 +350,35 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
Material mMat ;
|
||||
if ( ! iIter.GetCalcMaterial( mMat))
|
||||
mMat.Set( m_colDef) ;
|
||||
// secondo materiale per parti lavorate (tonalità spostata di 45 deg)
|
||||
Color cCol2 = siObj.colObj ;
|
||||
Material mMat2( mMat) ;
|
||||
// se richiesto diverso
|
||||
if (( m_nShowZmap & ZSM_COLORS) != 0) {
|
||||
HSV hsv = GetHSVFromColor( siObj.colObj) ;
|
||||
hsv.dHue += ANG_RIGHT / 2 ;
|
||||
cCol2 = GetColorFromHSV( hsv) ;
|
||||
mMat2.Set( cCol2) ;
|
||||
}
|
||||
// ciclo sui blocchi da aggiornare
|
||||
INTVECTOR vnModif ;
|
||||
TRIA3DLISTVECTOR vlTria ;
|
||||
nCount = pZmap->GetBlockCount() ;
|
||||
pZmap->GetTriangles( false, vnModif, vlTria) ;
|
||||
//int nT = 0 ;
|
||||
for ( int i = 0 ; i < nCount ; ++ i) {
|
||||
// se blocco non modificato, vado oltre
|
||||
if ( vnModif[i] < 0)
|
||||
continue ;
|
||||
//++ nT ;
|
||||
// imposto indice blocco corrente
|
||||
pGraphics->SetCurrent( i) ;
|
||||
// conto i triangoli per tipo (Flag == 0 e altri)
|
||||
int nTri0 = 0 ; int nTri1 = 0 ;
|
||||
for ( const auto& Tria : vlTria[vnModif[i]]) {
|
||||
if ( Tria.GetFlag() == 0)
|
||||
++ nTri0 ;
|
||||
else
|
||||
++ nTri1 ;
|
||||
}
|
||||
// imposto indice blocco corrente (con Flag == 0 --> materiale principale)
|
||||
pGraphics->SetCurrent( 2 * i) ;
|
||||
// lo pulisco
|
||||
pGraphics->Clear() ;
|
||||
pGraphics->AddColor( siObj.colObj) ; // per wireframe
|
||||
@@ -371,8 +387,33 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
pGraphics->AddBackMaterial( GetSurfBackColor( mMat.GetDiffuse())) ;
|
||||
// recupero la geometria
|
||||
// passo i triangoli alla grafica
|
||||
pGraphics->StartTriangles( int( vlTria[vnModif[i]].size())) ;
|
||||
pGraphics->StartTriangles( nTri0) ;
|
||||
for ( const auto& Tria : vlTria[vnModif[i]]) {
|
||||
if ( Tria.GetFlag() != 0)
|
||||
continue ;
|
||||
TriFlags3d TFlags ;
|
||||
TriNormals3d TNrms ;
|
||||
for ( int j = 0 ; j < 3 ; ++ j) {
|
||||
TFlags.bFlag[j] = true ;
|
||||
TNrms.vtN[j] = Tria.GetN() ;
|
||||
}
|
||||
pGraphics->AddTriangle( Tria, TFlags, TNrms) ;
|
||||
}
|
||||
pGraphics->EndTriangles() ;
|
||||
// imposto indice blocco corrente (con Flag ! 0 --> materiale 2)
|
||||
pGraphics->SetCurrent( 2 * i + 1) ;
|
||||
// lo pulisco
|
||||
pGraphics->Clear() ;
|
||||
pGraphics->AddColor( cCol2) ; // per wireframe
|
||||
pGraphics->AddMaterial( mMat2.GetAmbient(), mMat2.GetDiffuse(),
|
||||
mMat2.GetSpecular(), mMat2.GetShininess()) ;
|
||||
pGraphics->AddBackMaterial( GetSurfBackColor( mMat2.GetDiffuse())) ;
|
||||
// recupero la geometria
|
||||
// passo i triangoli alla grafica
|
||||
pGraphics->StartTriangles( nTri1) ;
|
||||
for ( const auto& Tria : vlTria[vnModif[i]]) {
|
||||
if ( Tria.GetFlag() == 0)
|
||||
continue ;
|
||||
TriFlags3d TFlags ;
|
||||
TriNormals3d TNrms ;
|
||||
for ( int j = 0 ; j < 3 ; ++ j) {
|
||||
@@ -383,13 +424,11 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
}
|
||||
pGraphics->EndTriangles() ;
|
||||
}
|
||||
//string sLog = "Blocchi=" + ToString( nT) ;
|
||||
//LOG_INFO( GetEGrLogger(), sLog.c_str())
|
||||
}
|
||||
// visualizzazione spilloni e normali (sempre nell'ultimo blocco)
|
||||
if ( ( m_nShowZmap & ZSM_LINES) != 0 || ( m_nShowZmap & ZSM_NORMALS) != 0) {
|
||||
// imposto indice blocco corrente
|
||||
pGraphics->SetCurrent( nCount) ;
|
||||
pGraphics->SetCurrent( 2 * nCount) ;
|
||||
// lo pulisco
|
||||
pGraphics->Clear() ;
|
||||
// ciclo sui tre gruppi di spilloni
|
||||
@@ -400,13 +439,21 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
pGraphics->AddColor( vCol[k]) ;
|
||||
pGraphics->AddMaterial( vCol[k], vCol[k], vCol[k], 10) ;
|
||||
pGraphics->AddBackMaterial( vCol[k]) ;
|
||||
PNTVECTOR vPnt ;
|
||||
for ( int i = 0 ; ; ++ i) {
|
||||
bool bOutBreak = false ;
|
||||
for ( int j = 0 ; ; ++ j) {
|
||||
POLYLINELIST lstPL ;
|
||||
if ( pZmap->GetDexelLines( k, j, i, lstPL)) {
|
||||
for ( const auto& PL : lstPL)
|
||||
pGraphics->AddPolyLine( PL) ;
|
||||
for ( const auto& PL : lstPL) {
|
||||
Point3d ptS, ptE ;
|
||||
bool Found = PL.GetFirstLine( ptS, ptE) ;
|
||||
while ( Found) {
|
||||
vPnt.emplace_back( ptS) ;
|
||||
vPnt.emplace_back( ptE) ;
|
||||
Found = PL.GetNextLine( ptS, ptE) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( j == 0)
|
||||
@@ -417,6 +464,8 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
if ( bOutBreak)
|
||||
break ;
|
||||
}
|
||||
if ( vPnt.size() > 0)
|
||||
pGraphics->AddLines( vPnt) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user