fix "glow pass on models doesn't obey glow alpha"
This commit is contained in:
+12
-26
@@ -539,34 +539,12 @@ void Model::DrawPrimitives()
|
|||||||
const RageCompiledGeometry* TempGeometry = m_pTempGeometry ? m_pTempGeometry : m_pGeometry->m_pGeometry;
|
const RageCompiledGeometry* TempGeometry = m_pTempGeometry ? m_pTempGeometry : m_pGeometry->m_pGeometry;
|
||||||
|
|
||||||
// apply material
|
// apply material
|
||||||
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 emissive = m_pTempState->glow;
|
||||||
RageColor ambient = m_pTempState->glow;
|
RageColor ambient = RageColor(0,0,0,0);
|
||||||
RageColor diffuse = m_pTempState->glow;
|
RageColor diffuse = RageColor(0,0,0,0);
|
||||||
RageColor specular = m_pTempState->glow;
|
RageColor specular = RageColor(0,0,0,0);
|
||||||
float shininess = 1;
|
float shininess = 1;
|
||||||
|
|
||||||
DISPLAY->SetMaterial(
|
DISPLAY->SetMaterial(
|
||||||
emissive,
|
emissive,
|
||||||
ambient,
|
ambient,
|
||||||
@@ -574,6 +552,14 @@ void Model::DrawPrimitives()
|
|||||||
specular,
|
specular,
|
||||||
shininess );
|
shininess );
|
||||||
DISPLAY->ClearAllTextures();
|
DISPLAY->ClearAllTextures();
|
||||||
|
|
||||||
|
if( pMesh->nMaterialIndex != -1 )
|
||||||
|
{
|
||||||
|
msMaterial& mat = m_Materials[ pMesh->nMaterialIndex ];
|
||||||
|
DISPLAY->SetTexture( 0, mat.diffuse.ani.GetCurrentTexture() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply mesh-specific bone (if any)
|
// apply mesh-specific bone (if any)
|
||||||
|
|||||||
@@ -981,7 +981,6 @@ public:
|
|||||||
glVertexPointer(3, GL_FLOAT, 0, &m_vPosition[0]);
|
glVertexPointer(3, GL_FLOAT, 0, &m_vPosition[0]);
|
||||||
|
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
glColor4f(1,1,1,1);
|
|
||||||
|
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glTexCoordPointer(2, GL_FLOAT, 0, &m_vTexture[0]);
|
glTexCoordPointer(2, GL_FLOAT, 0, &m_vTexture[0]);
|
||||||
@@ -1189,7 +1188,6 @@ void RageCompiledGeometryHWOGL::Draw( int iMeshIndex ) const
|
|||||||
AssertNoGLError();
|
AssertNoGLError();
|
||||||
|
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
glColor4f(1,1,1,1);
|
|
||||||
|
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
GLExt::glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nTextureCoords );
|
GLExt::glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nTextureCoords );
|
||||||
@@ -1535,11 +1533,26 @@ void RageDisplay_OGL::SetMaterial(
|
|||||||
float shininess
|
float 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_EMISSION, emissive );
|
||||||
glMaterialfv( GL_FRONT, GL_AMBIENT, ambient );
|
glMaterialfv( GL_FRONT, GL_AMBIENT, ambient );
|
||||||
glMaterialfv( GL_FRONT, GL_DIFFUSE, diffuse );
|
glMaterialfv( GL_FRONT, GL_DIFFUSE, diffuse );
|
||||||
glMaterialfv( GL_FRONT, GL_SPECULAR, specular );
|
glMaterialfv( GL_FRONT, GL_SPECULAR, specular );
|
||||||
glMaterialf( GL_FRONT, GL_SHININESS, shininess );
|
glMaterialf( GL_FRONT, GL_SHININESS, shininess );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glColor4fv( emissive + ambient + diffuse );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::SetLighting( bool b )
|
void RageDisplay_OGL::SetLighting( bool b )
|
||||||
|
|||||||
Reference in New Issue
Block a user