diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 0578e665e4..483ecc14b3 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -539,41 +539,27 @@ void Model::DrawPrimitives() const RageCompiledGeometry* TempGeometry = m_pTempGeometry ? m_pTempGeometry : m_pGeometry->m_pGeometry; // apply material + RageColor emissive = m_pTempState->glow; + RageColor ambient = RageColor(0,0,0,0); + RageColor diffuse = RageColor(0,0,0,0); + RageColor specular = RageColor(0,0,0,0); + float shininess = 1; + + DISPLAY->SetMaterial( + emissive, + ambient, + diffuse, + specular, + shininess ); + DISPLAY->ClearAllTextures(); + if( pMesh->nMaterialIndex != -1 ) { msMaterial& mat = m_Materials[ pMesh->nMaterialIndex ]; - - RageColor Emissive = mat.Emissive; - RageColor Ambient = mat.Ambient; - RageColor Diffuse = mat.Diffuse; - - Emissive = m_pTempState->glow; - Ambient = m_pTempState->glow; - Diffuse = m_pTempState->glow; - - DISPLAY->SetMaterial( - Emissive, - Ambient, - Diffuse, - mat.Specular, - mat.fShininess ); - DISPLAY->ClearAllTextures(); DISPLAY->SetTexture( 0, mat.diffuse.ani.GetCurrentTexture() ); } else { - RageColor emissive = m_pTempState->glow; - RageColor ambient = m_pTempState->glow; - RageColor diffuse = m_pTempState->glow; - RageColor specular = m_pTempState->glow; - float shininess = 1; - DISPLAY->SetMaterial( - emissive, - ambient, - diffuse, - specular, - shininess ); - DISPLAY->ClearAllTextures(); } // apply mesh-specific bone (if any) diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index eeb79bc466..f33d10f69c 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -981,7 +981,6 @@ public: glVertexPointer(3, GL_FLOAT, 0, &m_vPosition[0]); glDisableClientState(GL_COLOR_ARRAY); - glColor4f(1,1,1,1); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, &m_vTexture[0]); @@ -1189,7 +1188,6 @@ void RageCompiledGeometryHWOGL::Draw( int iMeshIndex ) const AssertNoGLError(); glDisableClientState(GL_COLOR_ARRAY); - glColor4f(1,1,1,1); glEnableClientState(GL_TEXTURE_COORD_ARRAY); GLExt::glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nTextureCoords ); @@ -1535,11 +1533,26 @@ void RageDisplay_OGL::SetMaterial( float shininess ) { - glMaterialfv( GL_FRONT, GL_EMISSION, emissive ); - glMaterialfv( GL_FRONT, GL_AMBIENT, ambient ); - glMaterialfv( GL_FRONT, GL_DIFFUSE, diffuse ); - glMaterialfv( GL_FRONT, GL_SPECULAR, specular ); - glMaterialf( GL_FRONT, GL_SHININESS, shininess ); + // TRICKY: If lighting is off, then setting the material + // will have no effect. Even if lighting is off, we still + // want Models to have basic color and transparency. + // We can do this fake lighting by setting the vertex color. + + GLboolean bLighting; + glGetBooleanv( GL_LIGHTING, &bLighting ); + + if( bLighting ) + { + glMaterialfv( GL_FRONT, GL_EMISSION, emissive ); + glMaterialfv( GL_FRONT, GL_AMBIENT, ambient ); + glMaterialfv( GL_FRONT, GL_DIFFUSE, diffuse ); + glMaterialfv( GL_FRONT, GL_SPECULAR, specular ); + glMaterialf( GL_FRONT, GL_SHININESS, shininess ); + } + else + { + glColor4fv( emissive + ambient + diffuse ); + } } void RageDisplay_OGL::SetLighting( bool b )