EgtGraphics 1.6h2 :

- modifiche per gestire Region.
This commit is contained in:
Dario Sassi
2015-08-07 10:46:20 +00:00
parent 9e858f9f4c
commit f9cedf70a6
3 changed files with 34 additions and 8 deletions
+33 -7
View File
@@ -27,6 +27,7 @@
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkGdbFunct.h"
@@ -172,8 +173,12 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
// nuova modalità grafica solo per superfici con molti triangoli
const int N_MIN_TRIA_NEWWAY = 100 ;
bool bNewWay = false ;
if ( m_bNewWay && nGeoType == SRF_TRIMESH) {
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
if ( m_bNewWay && ( nGeoType & GEO_SURF) != 0) {
const ISurfTriMesh* pSTM = nullptr ;
switch ( nGeoType) {
case SRF_TRIMESH : pSTM = GetSurfTriMesh( pGeoObj) ; break ;
case SRF_FLATRGN : pSTM = GetSurfFlatRegion( pGeoObj)->GetAuxSurf() ; break ;
}
if ( pSTM != nullptr && pSTM->GetTriangleNum() > N_MIN_TRIA_NEWWAY)
bNewWay = true ;
}
@@ -268,10 +273,14 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
pGraphics->AddPolyLine( PL) ;
}
}
// se superficie trimesh
else if ( nGeoType == SRF_TRIMESH) {
// recupero la superficie
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
// se superficie
else if ( ( nGeoType & GEO_SURF) != 0) {
// recupero la trimesh da visualizzare
const ISurfTriMesh* pSTM = nullptr ;
switch (nGeoType) {
case SRF_TRIMESH : pSTM = GetSurfTriMesh( pGeoObj) ; break ;
case SRF_FLATRGN : pSTM = GetSurfFlatRegion( pGeoObj)->GetAuxSurf() ; break ;
}
if ( pSTM == nullptr)
return false ;
// recupero il materiale
@@ -284,8 +293,8 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
pGraphics->AddMaterial( mMat.GetAmbient(), mMat.GetDiffuse(),
mMat.GetSpecular(), mMat.GetShininess()) ;
pGraphics->AddBackMaterial( GetSurfBackColor( mMat.GetDiffuse())) ;
pGraphics->StartTriangles( pSTM->GetTriangleNum()) ;
// ciclo sui triangoli della superficie
pGraphics->StartTriangles( pSTM->GetTriangleNum()) ;
Triangle3d Tria ;
TriFlags3d TFlags ;
TriNormals3d TNrms ;
@@ -308,6 +317,23 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
}
pGraphics->EndTriangles() ;
}
// se superficie FlatRegion
else if ( nGeoType == SRF_FLATRGN) {
// recupero la superficie
const ISurfFlatRegion* pSFR = GetSurfFlatRegion( pGeoObj) ;
if ( pSFR == nullptr)
return false ;
// recupero il materiale
Material mMat ;
if ( ! iIter.GetCalcMaterial( mMat))
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())) ;
}
// se testo
else if ( nGeoType == EXT_TEXT) {
// recupero il testo