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