diff --git a/EgtGraphics.rc b/EgtGraphics.rc index 8d8eec5..b82830a 100644 Binary files a/EgtGraphics.rc and b/EgtGraphics.rc differ diff --git a/SceneGeom.cpp b/SceneGeom.cpp index c489c98..232021e 100644 --- a/SceneGeom.cpp +++ b/SceneGeom.cpp @@ -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 diff --git a/SceneSelect.cpp b/SceneSelect.cpp index 64cabb5..c35049b 100644 --- a/SceneSelect.cpp +++ b/SceneSelect.cpp @@ -237,7 +237,7 @@ Scene::GetPointFromSelect( int nSelId, const Point3d& ptView, Point3d& ptSel, in { // recupera il punto di mira proiettato sull'oggetto appena selezionato // (va eseguito subito dopo la Select da cui si è derivato l'Id) - // è simile a GetSelectedSnapPoint + // è simile a FindSelectedSnapPoint // verifico parametri di ritorno if ( &ptSel == nullptr || &nAux == nullptr)