EgtGraphics 1.5g2 :

- prevista grafica ausiliaria per curve, visualizzabile da flag.
This commit is contained in:
Dario Sassi
2014-07-28 16:18:06 +00:00
parent 100a05a518
commit 8f53f1959d
8 changed files with 181 additions and 82 deletions
+21 -7
View File
@@ -81,7 +81,7 @@ ObjNewGraphics::AddBackMaterial( const Color& colAmbDiff)
//----------------------------------------------------------------------------
bool
ObjNewGraphics::AddPoint( const Point3d& ptP)
ObjNewGraphics::AddPoint( const Point3d& ptP, bool bAux)
{
if ( m_pScene == nullptr || ! m_pScene->MakeCurrent())
return false ;
@@ -107,7 +107,7 @@ ObjNewGraphics::AddPoint( const Point3d& ptP)
glEnableClientState( GL_VERTEX_ARRAY) ;
glBindVertexArray( 0) ;
// aggiungo i dati in lista
AddVerts( GL_POINTS, nCount, nVaoId, nVboId) ;
AddVerts( GL_POINTS, nCount, nVaoId, nVboId, bAux) ;
// dichiaro valida la grafica
m_bValid = true ;
@@ -116,7 +116,7 @@ ObjNewGraphics::AddPoint( const Point3d& ptP)
//----------------------------------------------------------------------------
bool
ObjNewGraphics::AddPolyLine( const PolyLine& PL)
ObjNewGraphics::AddPolyLine( const PolyLine& PL, bool bAux)
{
if ( m_pScene == nullptr || ! m_pScene->MakeCurrent())
return false ;
@@ -147,7 +147,7 @@ ObjNewGraphics::AddPolyLine( const PolyLine& PL)
glEnableClientState( GL_VERTEX_ARRAY) ;
glBindVertexArray( 0) ;
// aggiungo i dati in lista
AddVerts( GL_LINE_STRIP, nCount, nVaoId, nVboId) ;
AddVerts( GL_LINE_STRIP, nCount, nVaoId, nVboId, bAux) ;
// dichiaro valida la grafica
m_bValid = true ;
@@ -156,7 +156,7 @@ ObjNewGraphics::AddPolyLine( const PolyLine& PL)
//----------------------------------------------------------------------------
bool
ObjNewGraphics::StartTriangles( int nNum)
ObjNewGraphics::StartTriangles( int nNum, bool bAux)
{
if ( m_pScene == nullptr || ! m_pScene->MakeCurrent())
return false ;
@@ -180,7 +180,7 @@ ObjNewGraphics::StartTriangles( int nNum)
// 3 float per le coordinate e 3 per la normale
glBufferData( GL_ARRAY_BUFFER, 6 * nNum * SIZEV3F, NULL, GL_STATIC_DRAW) ;
// aggiungo i dati in lista
AddVerts( GL_TRIANGLES, 0, nVaoId, nVboId) ;
AddVerts( GL_TRIANGLES, 0, nVaoId, nVboId, bAux) ;
// dichiaro modo triangoli
m_nCurrMode = GL_TRIANGLES ;
return true ;
@@ -235,7 +235,7 @@ ObjNewGraphics::EndTriangles( void)
//----------------------------------------------------------------------------
bool
ObjNewGraphics::Draw( int nStat, int nMark)
ObjNewGraphics::Draw( int nStat, int nMark, bool bShowAux)
{
if ( m_pScene == nullptr || ! m_pScene->MakeCurrent())
return false ;
@@ -263,6 +263,13 @@ ObjNewGraphics::Draw( int nStat, int nMark)
glBindVertexArray( 0) ;
}
break ;
case NgAtom::VERTS_A :
if ( bShowAux && iIter->m_nCount > 0 && iIter->m_nVaoId != 0) {
glBindVertexArray( iIter->m_nVaoId) ;
glDrawArrays( iIter->m_nMode, 0, iIter->m_nCount) ;
glBindVertexArray( 0) ;
}
break ;
case NgAtom::COLOR :
glColor4fv( iIter->m_fCol) ;
break ;
@@ -308,6 +315,13 @@ ObjNewGraphics::Draw( int nStat, int nMark)
glBindVertexArray( 0) ;
}
break ;
case NgAtom::VERTS_A :
if ( bShowAux && iIter->m_nCount > 0 && iIter->m_nVaoId != 0) {
glBindVertexArray( iIter->m_nVaoId) ;
glDrawArrays( iIter->m_nMode, 0, iIter->m_nCount) ;
glBindVertexArray( 0) ;
}
break ;
// non si impostano i colori, si usa quello di marcatura
}
}