diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index db0561d018..2c9db53dc7 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -327,7 +327,7 @@ void BitmapText::DrawChars() while( end < iEndGlyph && m_pTextures[end] == m_pTextures[start] ) end++; DISPLAY->ClearAllTextures(); - DISPLAY->SetTexture( TextureUnit_1, m_pTextures[start] ); + DISPLAY->SetTexture( TextureUnit_1, m_pTextures[start]->GetTexHandle() ); // don't bother setting texture render states for text. We never go outside of 0..1. //Actor::SetTextureRenderStates(); RageSpriteVertex &start_vertex = m_aVertices[start*4]; diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 65e099c126..0365fe760b 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -367,14 +367,14 @@ void Model::DrawPrimitives() if( bUseMultitexture ) { // render the diffuse texture with texture unit 1 - DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ); + DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture()->GetTexHandle() ); Actor::SetTextureRenderStates(); // set Actor-specified render states DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped ); // render the additive texture with texture unit 2 if( mat.alpha.GetCurrentTexture() ) { - DISPLAY->SetTexture( TextureUnit_2, mat.alpha.GetCurrentTexture() ); + DISPLAY->SetTexture( TextureUnit_2, mat.alpha.GetCurrentTexture()->GetTexHandle() ); Actor::SetTextureRenderStates(); // set Actor-specified render states DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped ); DISPLAY->SetTextureModeAdd(); @@ -382,24 +382,24 @@ void Model::DrawPrimitives() } else { - DISPLAY->SetTexture( TextureUnit_2, NULL ); + DISPLAY->SetTexture( TextureUnit_2, 0 ); // set current texture back to 0 or else texture transform applied above // isn't used. Why?!? - DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ); + DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture()->GetTexHandle() ); } /* go */ DrawMesh( i ); // Turn off Environment mapping on tex unit 0. Is there a better way to reset? - DISPLAY->SetTexture( TextureUnit_1, NULL ); + DISPLAY->SetTexture( TextureUnit_1, 0 ); DISPLAY->SetSphereEnvironmentMapping( 0 ); } else { // render the diffuse texture - DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ); + DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture()->GetTexHandle() ); Actor::SetTextureRenderStates(); // set Actor-specified render states DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped ); DrawMesh( i ); @@ -407,7 +407,7 @@ void Model::DrawPrimitives() // render the additive texture if( mat.alpha.GetCurrentTexture() ) { - DISPLAY->SetTexture( TextureUnit_1, mat.alpha.GetCurrentTexture() ); + DISPLAY->SetTexture( TextureUnit_1, mat.alpha.GetCurrentTexture()->GetTexHandle() ); Actor::SetTextureRenderStates(); // set Actor-specified render states DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped ); @@ -463,7 +463,7 @@ void Model::DrawPrimitives() if( pMesh->nMaterialIndex != -1 ) { msMaterial& mat = m_Materials[ pMesh->nMaterialIndex ]; - DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ); + DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture()->GetTexHandle() ); Actor::SetTextureRenderStates(); // set Actor-specified render states } else diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 59d32ec7e0..818daf9148 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -473,7 +473,7 @@ void NoteDisplay::DrawHoldTopCap( const TapNote& tn, int iCol, int iRow, bool bI RageTexture* pTexture = pSprTopCap->GetTexture(); const RectF *pRect = pSprTopCap->GetCurrentTextureCoordRect(); DISPLAY->ClearAllTextures(); - DISPLAY->SetTexture( TextureUnit_1, pTexture ); + DISPLAY->SetTexture( TextureUnit_1, pTexture->GetTexHandle() ); DISPLAY->SetBlendMode( BLEND_NORMAL ); DISPLAY->SetCullMode( CULL_NONE ); DISPLAY->SetTextureWrapping(false); @@ -562,7 +562,7 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, int iRow, bool bIsB RageTexture* pTexture = pSprBody->GetTexture(); const RectF *pRect = pSprBody->GetCurrentTextureCoordRect(); DISPLAY->ClearAllTextures(); - DISPLAY->SetTexture( TextureUnit_1, pTexture ); + DISPLAY->SetTexture( TextureUnit_1, pTexture->GetTexHandle() ); DISPLAY->SetBlendMode( BLEND_NORMAL ); DISPLAY->SetCullMode( CULL_NONE ); DISPLAY->SetTextureWrapping( true ); @@ -660,7 +660,7 @@ void NoteDisplay::DrawHoldBottomCap( const TapNote& tn, int iCol, int iRow, bool RageTexture* pTexture = pBottomCap->GetTexture(); const RectF *pRect = pBottomCap->GetCurrentTextureCoordRect(); DISPLAY->ClearAllTextures(); - DISPLAY->SetTexture( TextureUnit_1, pTexture ); + DISPLAY->SetTexture( TextureUnit_1, pTexture->GetTexHandle() ); DISPLAY->SetBlendMode( BLEND_NORMAL ); DISPLAY->SetCullMode( CULL_NONE ); DISPLAY->SetTextureWrapping(false); diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index df27085162..386895d953 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -185,7 +185,7 @@ public: virtual void DeleteTexture( unsigned uTexHandle ) = 0; virtual void ClearAllTextures() = 0; virtual int GetNumTextureUnits() = 0; - virtual void SetTexture( TextureUnit tu, RageTexture* pTexture ) = 0; + virtual void SetTexture( TextureUnit tu, unsigned iTexture ) = 0; virtual void SetTextureModeModulate() = 0; virtual void SetTextureModeGlow() = 0; virtual void SetTextureModeAdd() = 0; diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index 9ca21ea8df..1c823253cf 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -5,8 +5,6 @@ #include "RageLog.h" #include "RageTimer.h" #include "RageException.h" -#include "RageTexture.h" -#include "RageTextureManager.h" #include "RageMath.h" #include "RageTypes.h" #include "RageSurface.h" @@ -1078,7 +1076,7 @@ void RageDisplay_D3D::DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, void RageDisplay_D3D::ClearAllTextures() { FOREACH_ENUM2( TextureUnit, i ) - SetTexture( i, NULL ); + SetTexture( i, 0 ); g_currentTextureUnit = TextureUnit_1; } @@ -1087,7 +1085,7 @@ int RageDisplay_D3D::GetNumTextureUnits() return g_DeviceCaps.MaxSimultaneousTextures; } -void RageDisplay_D3D::SetTexture( TextureUnit tu, RageTexture* pTexture ) +void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture ) { g_currentTextureUnit = tu; @@ -1095,7 +1093,7 @@ void RageDisplay_D3D::SetTexture( TextureUnit tu, RageTexture* pTexture ) if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported return; - if( pTexture == NULL ) + if( iTexture == 0 ) { g_pd3dDevice->SetTexture( g_currentTextureUnit, NULL ); @@ -1105,8 +1103,7 @@ void RageDisplay_D3D::SetTexture( TextureUnit tu, RageTexture* pTexture ) } else { - unsigned uTexHandle = pTexture->GetTexHandle(); - IDirect3DTexture8* pTex = (IDirect3DTexture8*)uTexHandle; + IDirect3DTexture8* pTex = (IDirect3DTexture8*) iTexture; g_pd3dDevice->SetTexture( g_currentTextureUnit, pTex ); // Intentionally commented out. Don't mess with texture stage state when just setting the texture. @@ -1114,7 +1111,7 @@ void RageDisplay_D3D::SetTexture( TextureUnit tu, RageTexture* pTexture ) //g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_MODULATE ); // Set palette (if any) - SetPalette(uTexHandle); + SetPalette( iTexture ); } } void RageDisplay_D3D::SetTextureModeModulate() diff --git a/stepmania/src/RageDisplay_D3D.h b/stepmania/src/RageDisplay_D3D.h index ca388bd9df..32a37425bb 100644 --- a/stepmania/src/RageDisplay_D3D.h +++ b/stepmania/src/RageDisplay_D3D.h @@ -35,7 +35,7 @@ public: void DeleteTexture( unsigned uTexHandle ); void ClearAllTextures(); int GetNumTextureUnits(); - void SetTexture( TextureUnit tu, RageTexture* pTexture ); + void SetTexture( TextureUnit tu, unsigned iTexture ); void SetTextureModeModulate(); void SetTextureModeGlow(); void SetTextureModeAdd(); diff --git a/stepmania/src/RageDisplay_Null.cpp b/stepmania/src/RageDisplay_Null.cpp index aef9f9fc7f..e4789b933d 100644 --- a/stepmania/src/RageDisplay_Null.cpp +++ b/stepmania/src/RageDisplay_Null.cpp @@ -5,8 +5,6 @@ #include "RageUtil.h" #include "RageLog.h" #include "RageTimer.h" -#include "RageTexture.h" -#include "RageTextureManager.h" #include "RageMath.h" #include "RageTypes.h" #include "RageUtil.h" diff --git a/stepmania/src/RageDisplay_Null.h b/stepmania/src/RageDisplay_Null.h index 157604dc17..8a633298df 100644 --- a/stepmania/src/RageDisplay_Null.h +++ b/stepmania/src/RageDisplay_Null.h @@ -32,7 +32,7 @@ public: void DeleteTexture( unsigned uTexHandle ) { } void ClearAllTextures() { } int GetNumTextureUnits() { return 1; } - void SetTexture( TextureUnit tu, RageTexture* pTexture ) { } + void SetTexture( TextureUnit tu, unsigned iTexture ) { } void SetTextureModeModulate() { } void SetTextureModeGlow() { } void SetTextureModeAdd() { } diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 2ef35c1b42..96ec8442ba 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -35,7 +35,6 @@ #include "RageLog.h" #include "RageTimer.h" #include "RageException.h" -#include "RageTexture.h" #include "RageTextureManager.h" #include "RageMath.h" #include "RageTypes.h" @@ -1362,7 +1361,7 @@ void RageDisplay_OGL::DrawLineStripInternal( const RageSpriteVertex v[], int iNu void RageDisplay_OGL::ClearAllTextures() { FOREACH_ENUM2( TextureUnit, i ) - SetTexture( i, NULL ); + SetTexture( i, 0 ); // HACK: Reset the active texture to 0. // TODO: Change all texture functions to take a stage number. @@ -1378,7 +1377,7 @@ int RageDisplay_OGL::GetNumTextureUnits() return g_iMaxTextureUnits; } -void RageDisplay_OGL::SetTexture( TextureUnit tu, RageTexture* pTexture ) +void RageDisplay_OGL::SetTexture( TextureUnit tu, unsigned iTexture ) { if( GLExt.glActiveTextureARB == NULL ) { @@ -1401,10 +1400,10 @@ void RageDisplay_OGL::SetTexture( TextureUnit tu, RageTexture* pTexture ) } } - if( pTexture ) + if( iTexture ) { glEnable( GL_TEXTURE_2D ); - glBindTexture( GL_TEXTURE_2D, pTexture->GetTexHandle() ); + glBindTexture( GL_TEXTURE_2D, iTexture ); } else { diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index c93e99e1b8..d5664b8557 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -40,7 +40,7 @@ public: void DeleteTexture( unsigned uTexHandle ); void ClearAllTextures(); int GetNumTextureUnits(); - void SetTexture( TextureUnit tu, RageTexture* pTexture ); + void SetTexture( TextureUnit tu, unsigned iTexture ); void SetTextureModeModulate(); void SetTextureModeGlow(); void SetTextureModeAdd(); diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 69880b1175..54becc2f99 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -462,7 +462,7 @@ void Sprite::DrawTexture( const TweenState *state ) v[3].p = RageVector3( croppedQuadVerticies.right, croppedQuadVerticies.top, 0 ); // top right DISPLAY->ClearAllTextures(); - DISPLAY->SetTexture( TextureUnit_1, m_pTexture ); + DISPLAY->SetTexture( TextureUnit_1, m_pTexture? m_pTexture->GetTexHandle():0 ); // Must call this after setting the texture or else texture // parameters have no effect.