RageTexture is a wrapper around RageDisplay's textures; RageDisplay

itself doesn't use it.  Don't pass in RageTexture to SetTexture;
use RageDisplay's native texture handles.
This commit is contained in:
Glenn Maynard
2006-07-23 03:19:49 +00:00
parent 26173fd639
commit d0bcf2052d
11 changed files with 26 additions and 32 deletions
+1 -1
View File
@@ -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];
+8 -8
View File
@@ -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
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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;
+5 -8
View File
@@ -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()
+1 -1
View File
@@ -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();
-2
View File
@@ -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"
+1 -1
View File
@@ -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() { }
+4 -5
View File
@@ -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
{
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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.