EgtGraphics :
- migliorie alle precedenti modifiche.
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ class ObjEGrGraphics : public IObjGraphics
|
||||
virtual bool StartTriangles( int nNum, bool bAux = false) = 0 ;
|
||||
virtual bool AddTriangle( const Triangle3d& Tria, const TriFlags3d& TFlags, const TriNormals3d& TNrms) = 0 ;
|
||||
virtual bool EndTriangles( void) = 0 ;
|
||||
virtual bool Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool ShowAux) = 0 ;
|
||||
virtual bool Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlpha, bool ShowAux) = 0 ;
|
||||
virtual bool GetLocalBBox( BBox3d& b3Loc) const = 0 ;
|
||||
virtual bool SetCounter( int nCnt) { return false ; }
|
||||
virtual int GetCounter( void) const { return -1 ; }
|
||||
|
||||
@@ -165,13 +165,13 @@ ObjMultiGraphics::EndTriangles( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjMultiGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux)
|
||||
ObjMultiGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlpha, bool bShowAux)
|
||||
{
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < m_vOEGR.size() ; ++ i) {
|
||||
if ( m_vOEGR[i] != nullptr &&
|
||||
m_vOEGR[i]->IsValid() &&
|
||||
! m_vOEGR[i]->Draw( nStat, nMark, bSurfSha, nAlpha, bShowAux))
|
||||
! m_vOEGR[i]->Draw( nStat, nMark, bSurfSha, bSurf, nAlpha, bShowAux))
|
||||
bOk = false ;
|
||||
}
|
||||
return bOk ;
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class ObjMultiGraphics : public ObjEGrGraphics
|
||||
bool StartTriangles( int nNum, bool bAux = false) override ;
|
||||
bool AddTriangle( const Triangle3d& Tria, const TriFlags3d& TFlags, const TriNormals3d& TNrms) override ;
|
||||
bool EndTriangles( void) override ;
|
||||
bool Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux) override ;
|
||||
bool Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlpha, bool bShowAux) override ;
|
||||
bool GetLocalBBox( BBox3d& b3Loc) const override ;
|
||||
bool SetCounter( int nCnt) override ;
|
||||
int GetCounter( void) const override ;
|
||||
|
||||
+2
-2
@@ -308,7 +308,7 @@ AdjustColor( float fCol[4], bool bDark)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux)
|
||||
ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlpha, bool bShowAux)
|
||||
{
|
||||
if ( ! m_bValid || m_pScene == nullptr || ! m_pScene->MakeCurrent())
|
||||
return false ;
|
||||
@@ -352,7 +352,7 @@ ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho
|
||||
|
||||
// determino se devo scurire il colore wireframe
|
||||
bool bDark = false ;
|
||||
if ( bStdCol && ! bSurfSha) {
|
||||
if ( bStdCol && bSurf && ! bSurfSha) {
|
||||
Color colBT, colBB ;
|
||||
m_pScene->GetBackground( colBT, colBB) ;
|
||||
int nColMid = ( colBT.GetIntIntensity() + colBB.GetIntIntensity()) / 2 ;
|
||||
|
||||
+2
-2
@@ -76,12 +76,12 @@ class ObjNewGraphics : public ObjEGrGraphics
|
||||
bool StartTriangles( int nNum, bool bAux = false) override ;
|
||||
bool AddTriangle( const Triangle3d& Tria, const TriFlags3d& TFlags, const TriNormals3d& TNrms) override ;
|
||||
bool EndTriangles( void) override ;
|
||||
bool Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux) override ;
|
||||
bool Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlpha, bool bShowAux) override ;
|
||||
bool GetLocalBBox( BBox3d& b3Loc) const override
|
||||
{ b3Loc = m_b3Loc ; return ! m_b3Loc.IsEmpty() ; }
|
||||
|
||||
public :
|
||||
ObjNewGraphics( void) : m_pScene( nullptr), m_bValid( false) {}
|
||||
ObjNewGraphics( void) : m_pScene( nullptr), m_bValid( false) {}
|
||||
|
||||
private :
|
||||
bool DeleteVaoVbo( void) ;
|
||||
|
||||
+2
-2
@@ -213,7 +213,7 @@ AdjustColor( float fCol[4], bool bDark)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux)
|
||||
ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlpha, bool bShowAux)
|
||||
{
|
||||
// se vuoto non faccio alcunché
|
||||
if ( m_ogaVect.size() == 0)
|
||||
@@ -254,7 +254,7 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho
|
||||
|
||||
// determino se devo scurire il colore wireframe
|
||||
bool bDark = false ;
|
||||
if ( bStdCol && ! bSurfSha) {
|
||||
if ( bStdCol && bSurf && ! bSurfSha) {
|
||||
Color colBT, colBB ;
|
||||
m_pScene->GetBackground( colBT, colBB) ;
|
||||
int nColMid = ( colBT.GetIntIntensity() + colBB.GetIntIntensity()) / 2 ;
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ class ObjOldGraphics : public ObjEGrGraphics
|
||||
bool StartTriangles( int nNum, bool bAux = false) override ;
|
||||
bool AddTriangle( const Triangle3d& Tria, const TriFlags3d& TFlags, const TriNormals3d& TNrms) override ;
|
||||
bool EndTriangles( void) override ;
|
||||
bool Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux) override ;
|
||||
bool Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlpha, bool bShowAux) override ;
|
||||
bool GetLocalBBox( BBox3d& b3Loc) const override
|
||||
{ b3Loc = m_b3Loc ; return ! m_b3Loc.IsEmpty() ; }
|
||||
|
||||
|
||||
@@ -54,12 +54,13 @@ struct AlphaSurf {
|
||||
ObjEGrGraphics* pGraph ;
|
||||
int nStat ;
|
||||
int nMark ;
|
||||
bool bSurf ;
|
||||
int nAlpha ;
|
||||
bool bShowAux ;
|
||||
double dZmin ;
|
||||
double dZmax ;
|
||||
AlphaSurf( const Frame3d& frMV, ObjEGrGraphics* pG, int nS, int nM, int nA, bool bSA, double dZm, double dZM)
|
||||
: frModView( frMV), pGraph( pG), nStat( nS), nMark( nM), nAlpha( nA), bShowAux( bSA), dZmin( dZm), dZmax( dZM) {}
|
||||
AlphaSurf( const Frame3d& frMV, ObjEGrGraphics* pG, int nS, int nM, bool bS, int nA, bool bSA, double dZm, double dZM)
|
||||
: frModView( frMV), pGraph( pG), nStat( nS), nMark( nM), bSurf( bS), nAlpha( nA), bShowAux( bSA), dZmin( dZm), dZmax( dZM) {}
|
||||
} ;
|
||||
typedef std::vector<AlphaSurf> ASURFVECTOR ;
|
||||
|
||||
|
||||
+9
-9
@@ -628,20 +628,20 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
bShowAux = true ;
|
||||
|
||||
// verifico se oggetto con superficie
|
||||
bool bSurf = ( nGeoType & ( GEO_SURF | GEO_VOLUME)) != 0 ||
|
||||
( nGeoType == EXT_TEXT && m_nShowText == TXT_FILL && GetExtText( pGeoObj)->GetAuxSurf() != nullptr) ;
|
||||
bool bSurf = (( nGeoType & ( GEO_SURF | GEO_VOLUME)) != 0) ;
|
||||
bool bGenSurf = ( bSurf || ( nGeoType == EXT_TEXT && m_nShowText == TXT_FILL && GetExtText( pGeoObj)->GetAuxSurf() != nullptr)) ;
|
||||
|
||||
// recupero il valore di opacità (solo per le superfici e i solidi può esserci trasparenza)
|
||||
int nAlpha = siObj.colObj.GetIntAlpha() ;
|
||||
|
||||
// salto in ogni caso le superfici e i solidi completamente trasparenti
|
||||
if ( nAlpha == 0 && bSurf)
|
||||
if ( nAlpha == 0 && bGenSurf)
|
||||
return true ;
|
||||
|
||||
// se hiddenline e non selezione
|
||||
if ( m_nShowMode == SM_HIDDENLINE && ! m_bSelect) {
|
||||
// in prima passata disegno solo le superfici opache
|
||||
if ( nPass == 1 && ( ! bSurf || nAlpha <= ALPHA_LIM))
|
||||
if ( nPass == 1 && ( ! bGenSurf || nAlpha <= ALPHA_LIM))
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
if ( m_nShowMode == SM_SHADING && ! m_bSelect) {
|
||||
// in prima passata disegno solo le superfici opache e metto in un vettore quelle semitrasparenti
|
||||
if ( nPass == 1) {
|
||||
if ( ! bSurf)
|
||||
if ( ! bGenSurf)
|
||||
return true ;
|
||||
else {
|
||||
if ( nAlpha > ALPHA_LIM)
|
||||
@@ -667,13 +667,13 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
b3Box.ToGlob( frModView) ;
|
||||
// inserisco i dati nel vettore
|
||||
m_vAlphaSurf.emplace_back( frModView, pGraphics, siObj.nStat, siObj.nMark,
|
||||
nAlpha, bShowAux, b3Box.GetMin().z, b3Box.GetMax().z) ;
|
||||
bSurf, nAlpha, bShowAux, b3Box.GetMin().z, b3Box.GetMax().z) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// in seconda passata disegno solo dimensioni 0 e curve
|
||||
if ( nPass == 2 && bSurf)
|
||||
if ( nPass == 2 && bGenSurf)
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
}
|
||||
|
||||
// eseguo visualizzazione
|
||||
bool bOk = pGraphics->Draw( siObj.nStat, siObj.nMark, bSurfSha, nAlpha, bShowAux) ;
|
||||
bool bOk = pGraphics->Draw( siObj.nStat, siObj.nMark, bSurfSha, bSurf, nAlpha, bShowAux) ;
|
||||
|
||||
// disabilito textures
|
||||
glDisable( GL_TEXTURE_GEN_S) ;
|
||||
@@ -753,7 +753,7 @@ Scene::DrawAlphaSurfVector( void)
|
||||
glLoadMatrixd( Matrix) ;
|
||||
// eseguo visualizzazione
|
||||
bool bOk = AlphaSurf.pGraph->Draw( AlphaSurf.nStat, AlphaSurf.nMark, true,
|
||||
AlphaSurf.nAlpha, AlphaSurf.bShowAux) ;
|
||||
AlphaSurf.bSurf, AlphaSurf.nAlpha, AlphaSurf.bShowAux) ;
|
||||
// ripristino matrice
|
||||
glPopMatrix() ;
|
||||
// in caso di errore, esco
|
||||
|
||||
Reference in New Issue
Block a user