EgtGraphics 1.6x3 :
- aggiunto oggetto MultiGraphics per accelerare visualizzazione Zmap in modifica.
This commit is contained in:
+61
-30
@@ -16,7 +16,9 @@
|
||||
#include "Scene.h"
|
||||
#include "ObjOldGraphics.h"
|
||||
#include "ObjNewGraphics.h"
|
||||
#include "ObjMultiGraphics.h"
|
||||
#include "EGrUtils.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGkFrame3d.h"
|
||||
@@ -35,7 +37,7 @@
|
||||
using namespace std ;
|
||||
|
||||
//------------------------------ Local functions -----------------------------
|
||||
static ObjEGrGraphics* CreateObjEGrGraphics( bool bNewWay) ;
|
||||
static ObjEGrGraphics* CreateObjEGrGraphics( int nCount, bool bNewWay) ;
|
||||
static bool CalcCurveTailMark( const Vector3d& vtRef, const PolyLine& plCrv, PolyLine& plMark) ;
|
||||
static bool CalcCurveTipArrow( const Vector3d& vtRef, const PolyLine& plCrv, PolyLine& plArr) ;
|
||||
static bool CalcConnectingLines( const PolyLine& plCrv, const Vector3d& vtTh, bool bDense, PNTVECTOR& vPnt) ;
|
||||
@@ -171,7 +173,18 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
|
||||
// se non esiste grafica associata, la creo
|
||||
if ( pGeoObj->GetObjGraphics() == nullptr) {
|
||||
// nuova modalità grafica solo per superfici con molti triangoli
|
||||
// oggetto grafico molteplice solo per Zmap che lo richiedono
|
||||
int nCount = 0 ;
|
||||
if ( nGeoType == VOL_ZMAP) {
|
||||
const IVolZmap* pZmap = GetVolZmap( pGeoObj) ;
|
||||
if ( pZmap != nullptr) {
|
||||
switch ( m_nShowZmap) {
|
||||
case ZSM_SURF : nCount = pZmap->GetBlockCount() ; break ;
|
||||
case ZSM_BOTH : nCount = pZmap->GetBlockCount() + 1 ; break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// nuova modalità grafica solo per superfici con molti triangoli o solidi Zmap
|
||||
const int N_MIN_TRIA_NEWWAY = 100 ;
|
||||
bool bNewWay = false ;
|
||||
if ( m_bNewWay) {
|
||||
@@ -188,7 +201,7 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
bNewWay = true ;
|
||||
}
|
||||
}
|
||||
ObjEGrGraphics* pGraphics = CreateObjEGrGraphics( bNewWay) ;
|
||||
ObjEGrGraphics* pGraphics = CreateObjEGrGraphics( nCount, bNewWay) ;
|
||||
if ( pGraphics == nullptr)
|
||||
return false ;
|
||||
pGraphics->SetScene( this) ;
|
||||
@@ -329,36 +342,52 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
const IVolZmap* pZmap = GetVolZmap( pGeoObj) ;
|
||||
if ( pZmap == nullptr)
|
||||
return false ;
|
||||
// recupero il materiale
|
||||
// recupero il materiale
|
||||
Material mMat ;
|
||||
if ( ! iIter.GetCalcMaterial( mMat))
|
||||
mMat.Set( m_colDef) ;
|
||||
// impostazioni iniziali
|
||||
pGraphics->Clear() ;
|
||||
// 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) {
|
||||
TFlags.bFlag[i] = true ;
|
||||
TNrms.vtN[i] = Tria.GetN() ;
|
||||
}
|
||||
pGraphics->AddTriangle( Tria, TFlags, TNrms) ;
|
||||
}
|
||||
pGraphics->EndTriangles() ;
|
||||
// ciclo sui blocchi da aggiornare
|
||||
std::vector<bool> vUpdate ;
|
||||
pZmap->GetBlockInfo( vUpdate) ;
|
||||
int nCount = int( vUpdate.size()) ;
|
||||
for ( int i = 0 ; i < nCount ; ++ i) {
|
||||
// se da non aggiornare, vado oltre
|
||||
if ( ! vUpdate[i])
|
||||
continue ;
|
||||
// imposto indice blocco corrente
|
||||
pGraphics->SetCurrent( i) ;
|
||||
// lo pulisco
|
||||
pGraphics->Clear() ;
|
||||
// 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->GetBlockTriangles( i, lstTria) ;
|
||||
// passo i triangoli alla grafica
|
||||
pGraphics->StartTriangles( int( lstTria.size())) ;
|
||||
for ( const auto& Tria : lstTria) {
|
||||
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() ;
|
||||
}
|
||||
}
|
||||
// visualizzazione spilloni
|
||||
// visualizzazione spilloni (sempre nell'ultimo blocco)
|
||||
if ( m_nShowZmap == ZSM_LINES || m_nShowZmap == ZSM_BOTH) {
|
||||
// imposto indice blocco corrente
|
||||
pGraphics->SetCurrent( nCount) ;
|
||||
// lo pulisco
|
||||
pGraphics->Clear() ;
|
||||
// ciclo sui tre gruppi di spilloni
|
||||
Color vCol[3] = {BLUE, RED, GREEN} ;
|
||||
for ( int k = 0 ; k < 3 ; ++ k) {
|
||||
pGraphics->AddColor( vCol[k]) ;
|
||||
@@ -578,9 +607,11 @@ Scene::DeleteObjGraphicsGroup( int nId)
|
||||
//------------------------------ Local functions -----------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
static ObjEGrGraphics*
|
||||
CreateObjEGrGraphics( bool bNewWay)
|
||||
CreateObjEGrGraphics( int nCount, bool bNewWay)
|
||||
{
|
||||
if ( bNewWay)
|
||||
if ( nCount > 1)
|
||||
return ( new ObjMultiGraphics( nCount, bNewWay)) ;
|
||||
else if ( bNewWay)
|
||||
return ( new ObjNewGraphics) ;
|
||||
else
|
||||
return ( new ObjOldGraphics) ;
|
||||
|
||||
Reference in New Issue
Block a user