EgtGraphics :

- modifiche per colore più scuro in wireframe superfici (se sfondo chiaro).
This commit is contained in:
Dario Sassi
2020-11-23 07:20:57 +00:00
parent 6bccbd2575
commit 3a8cdff937
4 changed files with 71 additions and 30 deletions
+29 -5
View File
@@ -194,6 +194,23 @@ ObjOldGraphics::EndTriangles( void)
return true ;
}
//----------------------------------------------------------------------------
static float*
AdjustColor( float fCol[4], bool bDark)
{
if ( ! bDark) {
return fCol ;
}
else {
static float fDarkCol[4] = { fCol[0], fCol[1], fCol[2], fCol[3]} ;
fDarkCol[0] = fCol[0] * 0.6f ;
fDarkCol[1] = fCol[1] * 0.6f ;
fDarkCol[2] = fCol[2] * 0.6f ;
fDarkCol[3] = fCol[3] * 0.6f ;
return fDarkCol ;
}
}
//----------------------------------------------------------------------------
bool
ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bShowAux)
@@ -235,10 +252,18 @@ 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) {
Color colBT, colBB ;
m_pScene->GetBackground( colBT, colBB) ;
int nColMid = ( colBT.GetIntIntensity() + colBB.GetIntIntensity()) / 2 ;
bDark = ( nColMid > 127) ;
}
// ciclo di disegno
bool bStartA = false ;
OGAVECT::iterator iIter ;
for ( iIter = m_ogaVect.begin() ; iIter != m_ogaVect.end() ; ++ iIter) {
for ( auto iIter = m_ogaVect.begin() ; iIter != m_ogaVect.end() ; ++ iIter) {
switch ( iIter->m_nType) {
case OgAtom::START :
glBegin( iIter->m_nMode) ;
@@ -267,7 +292,7 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho
glNormal3fv( iIter->m_fVal) ;
break ;
case OgAtom::COLOR :
glColor4fv( ( bStdCol ? iIter->m_fVal : fSelMarkCol)) ;
glColor4fv( ( bStdCol ? AdjustColor( iIter->m_fVal, bDark) : fSelMarkCol)) ;
break ;
case OgAtom::MAT_A :
glMaterialfv( GL_FRONT, GL_AMBIENT, ( bStdCol ? iIter->m_fVal : fSelMarkCol)) ;
@@ -302,8 +327,7 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho
// ciclo di disegno
bool bStartA = false ;
OGAVECT::iterator iIter ;
for ( iIter = m_ogaVect.begin() ; iIter != m_ogaVect.end() ; ++ iIter) {
for ( auto iIter = m_ogaVect.begin() ; iIter != m_ogaVect.end() ; ++ iIter) {
switch ( iIter->m_nType) {
case OgAtom::START :
glBegin( iIter->m_nMode) ;