turn off sphere mapping on tex unit 0 after rendering

This commit is contained in:
Chris Danford
2005-01-21 06:14:20 +00:00
parent 663bd5d8b7
commit a3ed21da36
+10 -6
View File
@@ -352,14 +352,14 @@ void Model::DrawPrimitives()
{
// render the diffuse texture
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
DISPLAY->SetSphereEnironmentMapping( mat.diffuse.m_bSphereMapped );
DISPLAY->SetSphereEnivronmentMapping( mat.diffuse.m_bSphereMapped );
DrawMesh( i );
// render the additive texture
if( mat.alpha.GetCurrentTexture() )
{
DISPLAY->SetTexture( 0, mat.alpha.GetCurrentTexture() );
DISPLAY->SetSphereEnironmentMapping( mat.alpha.m_bSphereMapped );
DISPLAY->SetSphereEnivronmentMapping( mat.alpha.m_bSphereMapped );
// UGLY: This overrides the Actor's BlendMode
DISPLAY->SetBlendMode( BLEND_ADD );
DISPLAY->SetTextureFiltering( true );
@@ -370,19 +370,23 @@ void Model::DrawPrimitives()
{
// render the diffuse texture with texture unit 1
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
DISPLAY->SetSphereEnironmentMapping( mat.diffuse.m_bSphereMapped );
DISPLAY->SetSphereEnivronmentMapping( mat.diffuse.m_bSphereMapped );
// render the additive texture with texture unit 2
if( mat.alpha.GetCurrentTexture() )
{
DISPLAY->SetTexture( 1, mat.alpha.GetCurrentTexture() );
DISPLAY->SetSphereEnironmentMapping( mat.alpha.m_bSphereMapped );
DISPLAY->SetSphereEnivronmentMapping( mat.alpha.m_bSphereMapped );
DISPLAY->SetTextureModeAdd();
DISPLAY->SetTextureFiltering( true );
}
/* go */
DrawMesh( i );
// Turn off Environment mapping on tex unit 0. Is there a better way to reset?
DISPLAY->SetTexture( 0, NULL );
DISPLAY->SetSphereEnivronmentMapping( 0 );
}
}
else
@@ -394,11 +398,11 @@ void Model::DrawPrimitives()
static const float shininess = 1;
DISPLAY->SetMaterial( emissive, ambient, diffuse, specular, shininess );
DISPLAY->ClearAllTextures();
DISPLAY->SetSphereEnironmentMapping( false );
DISPLAY->SetSphereEnivronmentMapping( false );
DrawMesh( i );
}
DISPLAY->SetSphereEnironmentMapping( false );
DISPLAY->SetSphereEnivronmentMapping( false );
DISPLAY->SetBlendMode( BLEND_NORMAL );
DISPLAY->TexturePopMatrix();
}