add TextureUnit param to SetSphereEnvironmentMapping

This commit is contained in:
Glenn Maynard
2007-02-13 06:04:30 +00:00
parent a9fd52cce0
commit 5600e93d3a
7 changed files with 18 additions and 16 deletions
+8 -9
View File
@@ -359,14 +359,14 @@ void Model::DrawPrimitives()
// render the diffuse texture with texture unit 1
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ? mat.diffuse.GetCurrentTexture()->GetTexHandle() : 0 );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped );
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, mat.diffuse.m_bSphereMapped );
// render the additive texture with texture unit 2
if( mat.alpha.GetCurrentTexture() )
{
DISPLAY->SetTexture( TextureUnit_2, mat.alpha.GetCurrentTexture() ? mat.alpha.GetCurrentTexture()->GetTexHandle() : 0 );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped );
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_2, mat.alpha.m_bSphereMapped );
DISPLAY->SetTextureMode( TextureUnit_2, TextureMode_Add );
DISPLAY->SetTextureFiltering( TextureUnit_2, true );
}
@@ -382,16 +382,15 @@ void Model::DrawPrimitives()
/* go */
DrawMesh( i );
// Turn off Environment mapping on tex unit 0. Is there a better way to reset?
DISPLAY->SetTexture( TextureUnit_1, 0 );
DISPLAY->SetSphereEnvironmentMapping( 0 );
// Turn off environment mapping on tex unit 0.
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, 0 );
}
else
{
// render the diffuse texture
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ? mat.diffuse.GetCurrentTexture()->GetTexHandle() : 0 );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped );
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, mat.diffuse.m_bSphereMapped );
DrawMesh( i );
// render the additive texture
@@ -400,7 +399,7 @@ void Model::DrawPrimitives()
DISPLAY->SetTexture( TextureUnit_1, mat.alpha.GetCurrentTexture() ? mat.alpha.GetCurrentTexture()->GetTexHandle() : 0 );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped );
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, mat.alpha.m_bSphereMapped );
// UGLY: This overrides the Actor's BlendMode
DISPLAY->SetBlendMode( BLEND_ADD );
DISPLAY->SetTextureFiltering( TextureUnit_1, true );
@@ -420,11 +419,11 @@ void Model::DrawPrimitives()
static const float shininess = 1;
DISPLAY->SetMaterial( emissive, ambient, diffuse, specular, shininess );
DISPLAY->ClearAllTextures();
DISPLAY->SetSphereEnvironmentMapping( false );
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, false );
DrawMesh( i );
}
DISPLAY->SetSphereEnvironmentMapping( false );
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, false );
DISPLAY->SetBlendMode( BLEND_NORMAL );
}
}
+1 -1
View File
@@ -255,7 +255,7 @@ public:
const RageColor &specular,
const RageVector3 &dir ) = 0;
virtual void SetSphereEnvironmentMapping( bool b ) = 0;
virtual void SetSphereEnvironmentMapping( TextureUnit tu, bool b ) = 0;
virtual RageCompiledGeometry* CreateCompiledGeometry() = 0;
virtual void DeleteCompiledGeometry( RageCompiledGeometry* p ) = 0;
+2 -2
View File
@@ -1527,9 +1527,9 @@ RageMatrix RageDisplay_D3D::GetOrthoMatrix( float l, float r, float b, float t,
return m;
}
void RageDisplay_D3D::SetSphereEnvironmentMapping( bool b )
void RageDisplay_D3D::SetSphereEnvironmentMapping( TextureUnit tu, bool b )
{
g_bSphereMapping[g_currentTextureUnit] = b;
g_bSphereMapping[tu] = b;
}
/*
+1 -1
View File
@@ -64,7 +64,7 @@ public:
const RageColor &specular,
const RageVector3 &dir );
void SetSphereEnvironmentMapping( bool b );
void SetSphereEnvironmentMapping( TextureUnit tu, bool b );
RageCompiledGeometry* CreateCompiledGeometry();
void DeleteCompiledGeometry( RageCompiledGeometry* p );
+1 -1
View File
@@ -61,7 +61,7 @@ public:
const RageColor &specular,
const RageVector3 &dir ) { }
void SetSphereEnvironmentMapping( bool b ) { }
void SetSphereEnvironmentMapping( TextureUnit tu, bool b ) { }
RageCompiledGeometry* CreateCompiledGeometry();
void DeleteCompiledGeometry( RageCompiledGeometry* p );
+4 -1
View File
@@ -2222,8 +2222,11 @@ bool RageDisplay_OGL::SupportsPerVertexMatrixScale()
return GLExt.glGenBuffersARB && g_bTextureMatrixShader != 0;
}
void RageDisplay_OGL::SetSphereEnvironmentMapping( bool b )
void RageDisplay_OGL::SetSphereEnvironmentMapping( TextureUnit tu, bool b )
{
if( !SetTextureUnit( tu ) )
return;
if( b )
{
glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP );
+1 -1
View File
@@ -74,7 +74,7 @@ public:
const RageColor &specular,
const RageVector3 &dir );
void SetSphereEnvironmentMapping( bool b );
void SetSphereEnvironmentMapping( TextureUnit tu, bool b );
RageCompiledGeometry* CreateCompiledGeometry();
void DeleteCompiledGeometry( RageCompiledGeometry* p );