EgtGraphics 1.6v8 :

- migliorata velocità di visualizzazione oggetti con triangoli su nuova e vecchia grafica.
This commit is contained in:
Dario Sassi
2016-10-31 09:17:51 +00:00
parent cde25533e7
commit 527f077461
5 changed files with 39 additions and 19 deletions
+16 -6
View File
@@ -20,6 +20,10 @@
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGKTriangle3d.h"
//----------------------------------------------------------------------------
const int VECT_HEAP = 20 ;
//----------------------------------------------------------------------------
ObjOldGraphics::~ObjOldGraphics( void)
{
@@ -38,7 +42,7 @@ ObjOldGraphics::Reset( void)
void
ObjOldGraphics::Clear( void)
{
m_ogaList.clear() ;
m_ogaVect.clear() ;
m_bValid = false ;
m_nCurrMode = GL_NONE ;
}
@@ -100,6 +104,8 @@ ObjOldGraphics::AddLines( const PNTVECTOR& vPnt, bool bAux)
// modo corrente deve essere nullo
if ( m_nCurrMode != GL_NONE)
return false ;
// riservo memoria per vettore
m_ogaVect.reserve( VECT_HEAP + vPnt.size()) ;
// start
AddStart( GL_LINES, bAux) ;
// inserisco i vertici + aggiorno bbox
@@ -122,6 +128,8 @@ ObjOldGraphics::AddPolyLine( const PolyLine& PL, bool bAux)
// modo corrente deve essere nullo
if ( m_nCurrMode != GL_NONE)
return false ;
// riservo memoria per vettore
m_ogaVect.reserve( VECT_HEAP + PL.GetPointNbr()) ;
// start
AddStart( GL_LINE_STRIP, bAux) ;
// inserisco i nuovi vertici + aggiorno bbox
@@ -145,6 +153,8 @@ ObjOldGraphics::StartTriangles( int nNum, bool bAux)
// modo corrente deve essere nullo
if ( m_nCurrMode != GL_NONE)
return false ;
// riservo memoria per vettore
m_ogaVect.reserve( VECT_HEAP + 3 * nNum) ;
// inizio emissione triangoli
AddStart( GL_TRIANGLES, bAux) ;
m_nCurrMode = GL_TRIANGLES ;
@@ -189,7 +199,7 @@ bool
ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux)
{
// se vuoto non faccio alcunché
if ( m_ogaList.size() == 0)
if ( m_ogaVect.size() == 0)
return true ;
// gestione stato di visualizzazione
@@ -227,8 +237,8 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho
// ciclo di disegno
bool bStartA = false ;
OGALIST::iterator iIter ;
for ( iIter = m_ogaList.begin() ; iIter != m_ogaList.end() ; ++ iIter) {
OGAVECT::iterator iIter ;
for ( iIter = m_ogaVect.begin() ; iIter != m_ogaVect.end() ; ++ iIter) {
switch ( iIter->m_nType) {
case OgAtom::START :
glBegin( iIter->m_nMode) ;
@@ -292,8 +302,8 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho
// ciclo di disegno
bool bStartA = false ;
OGALIST::iterator iIter ;
for ( iIter = m_ogaList.begin() ; iIter != m_ogaList.end() ; ++ iIter) {
OGAVECT::iterator iIter ;
for ( iIter = m_ogaVect.begin() ; iIter != m_ogaVect.end() ; ++ iIter) {
switch ( iIter->m_nType) {
case OgAtom::START :
glBegin( iIter->m_nMode) ;