add TextureUnit param to SetSphereEnvironmentMapping
This commit is contained in:
@@ -359,14 +359,14 @@ void Model::DrawPrimitives()
|
|||||||
// render the diffuse texture with texture unit 1
|
// render the diffuse texture with texture unit 1
|
||||||
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ? mat.diffuse.GetCurrentTexture()->GetTexHandle() : 0 );
|
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ? mat.diffuse.GetCurrentTexture()->GetTexHandle() : 0 );
|
||||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
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
|
// render the additive texture with texture unit 2
|
||||||
if( mat.alpha.GetCurrentTexture() )
|
if( mat.alpha.GetCurrentTexture() )
|
||||||
{
|
{
|
||||||
DISPLAY->SetTexture( TextureUnit_2, mat.alpha.GetCurrentTexture() ? mat.alpha.GetCurrentTexture()->GetTexHandle() : 0 );
|
DISPLAY->SetTexture( TextureUnit_2, mat.alpha.GetCurrentTexture() ? mat.alpha.GetCurrentTexture()->GetTexHandle() : 0 );
|
||||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
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->SetTextureMode( TextureUnit_2, TextureMode_Add );
|
||||||
DISPLAY->SetTextureFiltering( TextureUnit_2, true );
|
DISPLAY->SetTextureFiltering( TextureUnit_2, true );
|
||||||
}
|
}
|
||||||
@@ -382,16 +382,15 @@ void Model::DrawPrimitives()
|
|||||||
/* go */
|
/* go */
|
||||||
DrawMesh( i );
|
DrawMesh( i );
|
||||||
|
|
||||||
// Turn off Environment mapping on tex unit 0. Is there a better way to reset?
|
// Turn off environment mapping on tex unit 0.
|
||||||
DISPLAY->SetTexture( TextureUnit_1, 0 );
|
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, 0 );
|
||||||
DISPLAY->SetSphereEnvironmentMapping( 0 );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// render the diffuse texture
|
// render the diffuse texture
|
||||||
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ? mat.diffuse.GetCurrentTexture()->GetTexHandle() : 0 );
|
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ? mat.diffuse.GetCurrentTexture()->GetTexHandle() : 0 );
|
||||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
||||||
DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped );
|
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, mat.diffuse.m_bSphereMapped );
|
||||||
DrawMesh( i );
|
DrawMesh( i );
|
||||||
|
|
||||||
// render the additive texture
|
// render the additive texture
|
||||||
@@ -400,7 +399,7 @@ void Model::DrawPrimitives()
|
|||||||
DISPLAY->SetTexture( TextureUnit_1, mat.alpha.GetCurrentTexture() ? mat.alpha.GetCurrentTexture()->GetTexHandle() : 0 );
|
DISPLAY->SetTexture( TextureUnit_1, mat.alpha.GetCurrentTexture() ? mat.alpha.GetCurrentTexture()->GetTexHandle() : 0 );
|
||||||
Actor::SetTextureRenderStates(); // set Actor-specified render states
|
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
|
// UGLY: This overrides the Actor's BlendMode
|
||||||
DISPLAY->SetBlendMode( BLEND_ADD );
|
DISPLAY->SetBlendMode( BLEND_ADD );
|
||||||
DISPLAY->SetTextureFiltering( TextureUnit_1, true );
|
DISPLAY->SetTextureFiltering( TextureUnit_1, true );
|
||||||
@@ -420,11 +419,11 @@ void Model::DrawPrimitives()
|
|||||||
static const float shininess = 1;
|
static const float shininess = 1;
|
||||||
DISPLAY->SetMaterial( emissive, ambient, diffuse, specular, shininess );
|
DISPLAY->SetMaterial( emissive, ambient, diffuse, specular, shininess );
|
||||||
DISPLAY->ClearAllTextures();
|
DISPLAY->ClearAllTextures();
|
||||||
DISPLAY->SetSphereEnvironmentMapping( false );
|
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, false );
|
||||||
DrawMesh( i );
|
DrawMesh( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
DISPLAY->SetSphereEnvironmentMapping( false );
|
DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, false );
|
||||||
DISPLAY->SetBlendMode( BLEND_NORMAL );
|
DISPLAY->SetBlendMode( BLEND_NORMAL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ public:
|
|||||||
const RageColor &specular,
|
const RageColor &specular,
|
||||||
const RageVector3 &dir ) = 0;
|
const RageVector3 &dir ) = 0;
|
||||||
|
|
||||||
virtual void SetSphereEnvironmentMapping( bool b ) = 0;
|
virtual void SetSphereEnvironmentMapping( TextureUnit tu, bool b ) = 0;
|
||||||
|
|
||||||
virtual RageCompiledGeometry* CreateCompiledGeometry() = 0;
|
virtual RageCompiledGeometry* CreateCompiledGeometry() = 0;
|
||||||
virtual void DeleteCompiledGeometry( RageCompiledGeometry* p ) = 0;
|
virtual void DeleteCompiledGeometry( RageCompiledGeometry* p ) = 0;
|
||||||
|
|||||||
@@ -1527,9 +1527,9 @@ RageMatrix RageDisplay_D3D::GetOrthoMatrix( float l, float r, float b, float t,
|
|||||||
return m;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
const RageColor &specular,
|
const RageColor &specular,
|
||||||
const RageVector3 &dir );
|
const RageVector3 &dir );
|
||||||
|
|
||||||
void SetSphereEnvironmentMapping( bool b );
|
void SetSphereEnvironmentMapping( TextureUnit tu, bool b );
|
||||||
|
|
||||||
RageCompiledGeometry* CreateCompiledGeometry();
|
RageCompiledGeometry* CreateCompiledGeometry();
|
||||||
void DeleteCompiledGeometry( RageCompiledGeometry* p );
|
void DeleteCompiledGeometry( RageCompiledGeometry* p );
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
const RageColor &specular,
|
const RageColor &specular,
|
||||||
const RageVector3 &dir ) { }
|
const RageVector3 &dir ) { }
|
||||||
|
|
||||||
void SetSphereEnvironmentMapping( bool b ) { }
|
void SetSphereEnvironmentMapping( TextureUnit tu, bool b ) { }
|
||||||
|
|
||||||
RageCompiledGeometry* CreateCompiledGeometry();
|
RageCompiledGeometry* CreateCompiledGeometry();
|
||||||
void DeleteCompiledGeometry( RageCompiledGeometry* p );
|
void DeleteCompiledGeometry( RageCompiledGeometry* p );
|
||||||
|
|||||||
@@ -2222,8 +2222,11 @@ bool RageDisplay_OGL::SupportsPerVertexMatrixScale()
|
|||||||
return GLExt.glGenBuffersARB && g_bTextureMatrixShader != 0;
|
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 )
|
if( b )
|
||||||
{
|
{
|
||||||
glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP );
|
glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP );
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public:
|
|||||||
const RageColor &specular,
|
const RageColor &specular,
|
||||||
const RageVector3 &dir );
|
const RageVector3 &dir );
|
||||||
|
|
||||||
void SetSphereEnvironmentMapping( bool b );
|
void SetSphereEnvironmentMapping( TextureUnit tu, bool b );
|
||||||
|
|
||||||
RageCompiledGeometry* CreateCompiledGeometry();
|
RageCompiledGeometry* CreateCompiledGeometry();
|
||||||
void DeleteCompiledGeometry( RageCompiledGeometry* p );
|
void DeleteCompiledGeometry( RageCompiledGeometry* p );
|
||||||
|
|||||||
Reference in New Issue
Block a user