EgtGraphics 1.6b5 :

- modifiche per gestione superfici trasparenti
- migliorata gestione colore da padre.
This commit is contained in:
Dario Sassi
2015-02-17 22:45:57 +00:00
parent 1fa95f539f
commit 6526f7ab9f
11 changed files with 170 additions and 56 deletions
+10 -2
View File
@@ -105,6 +105,7 @@ ObjNewGraphics::AddPoint( const Point3d& ptP, bool bAux)
glBufferData( GL_ARRAY_BUFFER, 1 * SIZEV3F, NULL, GL_STATIC_DRAW) ;
Vert3f v3V( ptP) ;
glBufferSubData( GL_ARRAY_BUFFER, 0, SIZEV3F, &v3V) ;
m_b3Loc.Add( ptP) ;
int nCount = 1 ;
glVertexPointer( 3, GL_FLOAT, 0, ((void*)(0))) ;
glEnableClientState( GL_VERTEX_ARRAY) ;
@@ -143,6 +144,7 @@ ObjNewGraphics::AddLines( const PNTVECTOR& vPnt, bool bAux)
for ( int i = 0 ; i < nCount ; ++ i) {
v3V.Set( vPnt[i]) ;
glBufferSubData( GL_ARRAY_BUFFER, i * SIZEV3F, SIZEV3F, &v3V) ;
m_b3Loc.Add( vPnt[i]) ;
}
glVertexPointer( 3, GL_FLOAT, 0, ((void*)(0))) ;
glEnableClientState( GL_VERTEX_ARRAY) ;
@@ -182,6 +184,7 @@ ObjNewGraphics::AddPolyLine( const PolyLine& PL, bool bAux)
for ( bool bFound = PL.GetFirstPoint( ptP) ; bFound ; bFound = PL.GetNextPoint( ptP)) {
v3V.Set( ptP) ;
glBufferSubData( GL_ARRAY_BUFFER, nCount * SIZEV3F, SIZEV3F, &v3V) ;
m_b3Loc.Add( ptP) ;
++ nCount ;
}
glVertexPointer( 3, GL_FLOAT, 0, ((void*)(0))) ;
@@ -238,10 +241,11 @@ ObjNewGraphics::AddTriangle( const Triangle3d& Tria, const TriFlags3d& TFlags, c
return false ;
// recupero il conteggio dei vertici
int nCount = m_ngaList.back().m_nCount ;
// emetto i vertici e le normali del triangolo
// emetto i flag, le normali e i vertici del triangolo + aggiorno bbox
for ( int i = 0 ; i < 3 ; ++ i) {
Vert3f v3V( Tria.GetP( i)) ;
glBufferSubData( GL_ARRAY_BUFFER, nCount * SIZEVNF, SIZEV3F, &v3V) ;
m_b3Loc.Add( Tria.GetP( i)) ;
Vert3f v3N( TNrms.vtN[i]) ;
glBufferSubData( GL_ARRAY_BUFFER, nCount * SIZEVNF + SIZEV3F, SIZEV3F, &v3N) ;
unsigned char cFlag = ( TFlags.bFlag[i] ? 1 : 0) ;
@@ -280,7 +284,7 @@ ObjNewGraphics::EndTriangles( void)
//----------------------------------------------------------------------------
bool
ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bShowAux)
ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux)
{
if ( ! m_bValid || m_pScene == nullptr || ! m_pScene->MakeCurrent())
return false ;
@@ -305,15 +309,19 @@ ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bShowAux)
if ( nMark == GDB_MK_ON) {
bStdCol = false ;
Color colMark = ( ( GetScene() != nullptr) ? GetScene()->GetMark() : Color( 192, 192, 0)) ;
colMark.SetAlpha( nAlpha) ;
colMark.GetFloat( fSelMarkCol) ;
Color colMarkBack = GetSurfBackColor( colMark) ;
colMarkBack.SetAlpha( nAlpha) ;
colMarkBack.GetFloat( fSelMarkBackCol) ;
}
else if ( nStat == GDB_ST_SEL) {
bStdCol = false ;
Color colSelSurf = ( ( GetScene() != nullptr) ? GetScene()->GetSelSurf() : Color( 255, 255, 192)) ;
colSelSurf.SetAlpha( nAlpha) ;
colSelSurf.GetFloat( fSelMarkCol) ;
Color colSelSurfBack = GetSurfBackColor( colSelSurf) ;
colSelSurfBack.SetAlpha( nAlpha) ;
colSelSurfBack.GetFloat( fSelMarkBackCol) ;
}
}