fix D3D texture coord generation

This commit is contained in:
Chris Danford
2005-11-05 03:08:09 +00:00
parent 6199dbacf0
commit 3f6e95b7d8
11 changed files with 118 additions and 97 deletions
+1 -1
View File
@@ -325,7 +325,7 @@ void BitmapText::DrawChars()
while( end < iEndGlyph && m_pTextures[end] == m_pTextures[start] )
end++;
DISPLAY->ClearAllTextures();
DISPLAY->SetTexture( 0, m_pTextures[start] );
DISPLAY->SetTexture( TextureUnit_1, m_pTextures[start] );
// 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];
+1
View File
@@ -33,6 +33,7 @@ static inline void enum_add( T &val, int iAmt )
}
#define FOREACH_ENUM( e, max, var ) for( e var=(e)0; var<max; enum_add<e>( var, +1 ) )
#define FOREACH_ENUM2( e, var ) for( e var=(e)0; var<NUM_##e; enum_add<e>( var, +1 ) )
static const CString EMPTY_STRING;
+8 -8
View File
@@ -366,7 +366,7 @@ void Model::DrawPrimitives()
if( DISPLAY->GetNumTextureUnits() < 2 )
{
// render the diffuse texture
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.diffuse.m_bSphereMapped );
DrawMesh( i );
@@ -374,7 +374,7 @@ void Model::DrawPrimitives()
// render the additive texture
if( mat.alpha.GetCurrentTexture() )
{
DISPLAY->SetTexture( 0, mat.alpha.GetCurrentTexture() );
DISPLAY->SetTexture( TextureUnit_1, mat.alpha.GetCurrentTexture() );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped );
@@ -387,14 +387,14 @@ void Model::DrawPrimitives()
else
{
// render the diffuse texture with texture unit 1
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() );
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( 1, mat.alpha.GetCurrentTexture() );
DISPLAY->SetTexture( TextureUnit_2, mat.alpha.GetCurrentTexture() );
Actor::SetTextureRenderStates(); // set Actor-specified render states
DISPLAY->SetSphereEnvironmentMapping( mat.alpha.m_bSphereMapped );
DISPLAY->SetTextureModeAdd();
@@ -402,18 +402,18 @@ void Model::DrawPrimitives()
}
else
{
DISPLAY->SetTexture( 1, NULL );
DISPLAY->SetTexture( TextureUnit_2, NULL );
// set current texture back to 0 or else texture transform applied above
// isn't used. Why?!?
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() );
}
/* go */
DrawMesh( i );
// Turn off Environment mapping on tex unit 0. Is there a better way to reset?
DISPLAY->SetTexture( 0, NULL );
DISPLAY->SetTexture( TextureUnit_1, NULL );
DISPLAY->SetSphereEnvironmentMapping( 0 );
}
@@ -462,7 +462,7 @@ void Model::DrawPrimitives()
if( pMesh->nMaterialIndex != -1 )
{
msMaterial& mat = m_Materials[ pMesh->nMaterialIndex ];
DISPLAY->SetTexture( 0, mat.diffuse.GetCurrentTexture() );
DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() );
Actor::SetTextureRenderStates(); // set Actor-specified render states
}
else
+3 -3
View File
@@ -476,7 +476,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( 0, pTexture );
DISPLAY->SetTexture( TextureUnit_1, pTexture );
DISPLAY->SetBlendMode( BLEND_NORMAL );
DISPLAY->SetCullMode( CULL_NONE );
DISPLAY->SetTextureWrapping(false);
@@ -565,7 +565,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( 0, pTexture );
DISPLAY->SetTexture( TextureUnit_1, pTexture );
DISPLAY->SetBlendMode( BLEND_NORMAL );
DISPLAY->SetCullMode( CULL_NONE );
DISPLAY->SetTextureWrapping( true );
@@ -663,7 +663,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( 0, pTexture );
DISPLAY->SetTexture( TextureUnit_1, pTexture );
DISPLAY->SetBlendMode( BLEND_NORMAL );
DISPLAY->SetCullMode( CULL_NONE );
DISPLAY->SetTextureWrapping(false);
+7 -2
View File
@@ -8,7 +8,12 @@
const int REFRESH_DEFAULT = 0;
struct RageSurface;
const int MAX_TEXTURE_UNITS = 2;
enum TextureUnit
{
TextureUnit_1,
TextureUnit_2,
NUM_TextureUnit
};
// RageCompiledGeometry holds vertex data in a format that is most efficient
// for the graphics API.
@@ -162,7 +167,7 @@ public:
virtual void DeleteTexture( unsigned uTexHandle ) = 0;
virtual void ClearAllTextures() = 0;
virtual int GetNumTextureUnits() = 0;
virtual void SetTexture( int iTextureUnitIndex, RageTexture* pTexture ) = 0;
virtual void SetTexture( TextureUnit tu, RageTexture* pTexture ) = 0;
virtual void SetTextureModeModulate() = 0;
virtual void SetTextureModeGlow() = 0;
virtual void SetTextureModeAdd() = 0;
+90 -75
View File
@@ -18,6 +18,7 @@
#include "PrefsManager.h"
#include "RageSurface.h"
#include "RageSurfaceUtils.h"
#include "EnumHelper.h"
#if !defined(XBOX)
#include "archutils/Win32/GraphicsWindow.h"
@@ -59,8 +60,9 @@ D3DCAPS8 g_DeviceCaps;
D3DDISPLAYMODE g_DesktopMode;
D3DPRESENT_PARAMETERS g_d3dpp;
int g_ModelMatrixCnt=0;
int g_iCurrentTextureIndex = 0;
TextureUnit g_currentTextureUnit = TextureUnit_1;
static int g_iActualRefreshRateInHz = 60;
static bool g_bSphereMapping[NUM_TextureUnit] = { false, false };
static float g_fZBias = 0;
/* Direct3D doesn't associate a palette with textures.
@@ -783,24 +785,56 @@ void RageDisplay_D3D::SendCurrentMatrices()
RageMatrixMultiply( &m, &m, GetWorldTop() );
g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)&m );
/*
* Direct3D is expecting a 3x3 matrix loaded into the 4x4 in order to transform
* the 2-component texture coordinates. We currently only use translate and scale,
* and ignore the z component entirely, so convert the texture matrix from
* 4x4 to 3x3 by dropping z.
*/
const RageMatrix &tex1 = *GetTextureTop();
const RageMatrix tex2 = RageMatrix
(
tex1.m[0][0], tex1.m[0][1], tex1.m[0][3], 0,
tex1.m[1][0], tex1.m[1][1], tex1.m[1][3], 0,
tex1.m[3][0], tex1.m[3][1], tex1.m[3][3], 0,
0, 0, 0, 0
);
g_pd3dDevice->SetTransform( D3DTS_TEXTURE0, (D3DMATRIX*)&tex2 );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU );
FOREACH_ENUM2( TextureUnit, tu )
{
// Optimization opportunity: Turn off texture transform if not using texture coords.
g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
// If no texture is set for this texture unit, don't bother setting it up.
IDirect3DBaseTexture8* ppTexture = NULL;
g_pd3dDevice->GetTexture( g_currentTextureUnit, &ppTexture );
if( ppTexture == NULL )
continue;
if( g_bSphereMapping[tu] )
{
static const RageMatrix tex = RageMatrix
(
0.50f, 0.0f, 0.0f, 0.0f,
0.0f, -0.50f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.50, -0.50, 0.0f, 1.0f
);
g_pd3dDevice->SetTransform( (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0+tu), (D3DMATRIX*)&tex );
// Tell D3D to use transformed reflection vectors as texture co-ordinate 0
// and then transform this coordinate by the specified texture matrix.
g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACENORMAL );
}
else
{
/*
* Direct3D is expecting a 3x3 matrix loaded into the 4x4 in order to transform
* the 2-component texture coordinates. We currently only use translate and scale,
* and ignore the z component entirely, so convert the texture matrix from
* 4x4 to 3x3 by dropping z.
*/
const RageMatrix &tex1 = *GetTextureTop();
const RageMatrix tex2 = RageMatrix
(
tex1.m[0][0], tex1.m[0][1], tex1.m[0][3], 0,
tex1.m[1][0], tex1.m[1][1], tex1.m[1][3], 0,
tex1.m[3][0], tex1.m[3][1], tex1.m[3][3], 0,
0, 0, 0, 0
);
g_pd3dDevice->SetTransform( D3DTS_TEXTURE0, (D3DMATRIX*)&tex2 );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU );
}
}
}
class RageCompiledGeometrySWD3D : public RageCompiledGeometry
@@ -1030,9 +1064,9 @@ void RageDisplay_D3D::DrawLineStrip( const RageSpriteVertex v[], int iNumVerts,
void RageDisplay_D3D::ClearAllTextures()
{
for( int i=0; i<MAX_TEXTURE_UNITS; i++ )
FOREACH_ENUM2( TextureUnit, i )
SetTexture( i, NULL );
g_iCurrentTextureIndex = 0;
g_currentTextureUnit = TextureUnit_1;
}
int RageDisplay_D3D::GetNumTextureUnits()
@@ -1040,26 +1074,26 @@ int RageDisplay_D3D::GetNumTextureUnits()
return g_DeviceCaps.MaxSimultaneousTextures;
}
void RageDisplay_D3D::SetTexture( int iTextureUnitIndex, RageTexture* pTexture )
void RageDisplay_D3D::SetTexture( TextureUnit tu, RageTexture* pTexture )
{
g_iCurrentTextureIndex = iTextureUnitIndex;
g_currentTextureUnit = tu;
// g_DeviceCaps.MaxSimultaneousTextures = 1;
if( g_iCurrentTextureIndex >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
return;
if( pTexture == NULL )
{
g_pd3dDevice->SetTexture( g_iCurrentTextureIndex, NULL );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLOROP, D3DTOP_DISABLE );
g_pd3dDevice->SetTexture( g_currentTextureUnit, NULL );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_DISABLE );
}
else
{
unsigned uTexHandle = pTexture->GetTexHandle();
IDirect3DTexture8* pTex = (IDirect3DTexture8*)uTexHandle;
g_pd3dDevice->SetTexture( g_iCurrentTextureIndex, pTex );
g_pd3dDevice->SetTexture( g_currentTextureUnit, pTex );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLOROP, D3DTOP_MODULATE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_MODULATE );
// Set palette (if any)
SetPalette(uTexHandle);
@@ -1067,53 +1101,53 @@ void RageDisplay_D3D::SetTexture( int iTextureUnitIndex, RageTexture* pTexture )
}
void RageDisplay_D3D::SetTextureModeModulate()
{
if( g_iCurrentTextureIndex >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
return;
// Use D3DTA_CURRENT instead of diffuse so that multitexturing works
// properly. For stage 0, D3DTA_CURRENT is the diffuse color.
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLORARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLOROP, D3DTOP_MODULATE );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_MODULATE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
}
void RageDisplay_D3D::SetTextureModeGlow()
{
if( g_iCurrentTextureIndex >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
return;
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLORARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
}
void RageDisplay_D3D::SetTextureModeAdd()
{
if( g_iCurrentTextureIndex >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
return;
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLORARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_COLOROP, D3DTOP_ADD );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ALPHAOP, D3DTOP_ADD );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_ADD );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAOP, D3DTOP_ADD );
}
void RageDisplay_D3D::SetTextureFiltering( bool b )
{
if( g_iCurrentTextureIndex >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
return;
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_MINFILTER, b ? D3DTEXF_LINEAR : D3DTEXF_POINT );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_MAGFILTER, b ? D3DTEXF_LINEAR : D3DTEXF_POINT );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_MINFILTER, b ? D3DTEXF_LINEAR : D3DTEXF_POINT );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_MAGFILTER, b ? D3DTEXF_LINEAR : D3DTEXF_POINT );
}
void RageDisplay_D3D::SetBlendMode( BlendMode mode )
@@ -1185,12 +1219,12 @@ void RageDisplay_D3D::ClearZBuffer()
void RageDisplay_D3D::SetTextureWrapping( bool b )
{
if( g_iCurrentTextureIndex >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
return;
int mode = b ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP;
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ADDRESSU, mode );
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_ADDRESSV, mode );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ADDRESSU, mode );
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ADDRESSV, mode );
}
void RageDisplay_D3D::SetMaterial(
@@ -1431,28 +1465,9 @@ RageMatrix RageDisplay_D3D::GetOrthoMatrix( float l, float r, float b, float t,
void RageDisplay_D3D::SetSphereEnvironmentMapping( bool b )
{
if( g_iCurrentTextureIndex >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
return;
// http://www.gamasutra.com/features/20000811/wyatt_03.htm
if( b )
{
static const RageMatrix tex = RageMatrix
(
0.40f, 0.0f, 0.0f, 0.0f,
0.0f, -0.40f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.50, -0.50, 0.0f, 1.0f
);
g_pd3dDevice->SetTransform((D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0+g_iCurrentTextureIndex), (D3DMATRIX*)&tex);
}
// Tell D3D to use transformed reflection vectors as texture co-ordinate 0
// and then transform this coordinate by the specified texture matrix, also
// tell D3D that only the first two coordinates of the output are valid.
g_pd3dDevice->SetTextureStageState( g_iCurrentTextureIndex, D3DTSS_TEXCOORDINDEX, b ? D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR : D3DTSS_TCI_PASSTHRU );
g_bSphereMapping[g_currentTextureUnit] = b;
}
/*
* Copyright (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
+1 -1
View File
@@ -32,7 +32,7 @@ public:
void DeleteTexture( unsigned uTexHandle );
void ClearAllTextures();
int GetNumTextureUnits();
void SetTexture( int iTextureUnitIndex, RageTexture* pTexture );
void SetTexture( TextureUnit tu, RageTexture* pTexture );
void SetTextureModeModulate();
void SetTextureModeGlow();
void SetTextureModeAdd();
+1 -1
View File
@@ -29,7 +29,7 @@ public:
void DeleteTexture( unsigned uTexHandle ) { }
void ClearAllTextures() { }
int GetNumTextureUnits() { return 1; }
void SetTexture( int iTextureUnitIndex, RageTexture* pTexture ) { }
void SetTexture( TextureUnit tu, RageTexture* pTexture ) { }
void SetTextureModeModulate() { }
void SetTextureModeGlow() { }
void SetTextureModeAdd() { }
+4 -4
View File
@@ -1401,7 +1401,7 @@ void RageDisplay_OGL::DrawLineStripInternal( const RageSpriteVertex v[], int iNu
void RageDisplay_OGL::ClearAllTextures()
{
for( int i=0; i<MAX_TEXTURE_UNITS; i++ )
FOREACH_ENUM2( TextureUnit, i )
SetTexture( i, NULL );
// HACK: Reset the active texture to 0.
@@ -1418,17 +1418,17 @@ int RageDisplay_OGL::GetNumTextureUnits()
return g_iMaxTextureUnits;
}
void RageDisplay_OGL::SetTexture( int iTextureUnitIndex, RageTexture* pTexture )
void RageDisplay_OGL::SetTexture( TextureUnit tu, RageTexture* pTexture )
{
if( GLExt.glActiveTextureARB == NULL )
{
// multitexture isn't supported. Ignore all textures except for 0.
if( iTextureUnitIndex != 0 )
if( tu != 0 )
return;
}
else
{
switch( iTextureUnitIndex )
switch( tu )
{
case 0:
GLExt.glActiveTextureARB(GL_TEXTURE0_ARB);
+1 -1
View File
@@ -32,7 +32,7 @@ public:
void DeleteTexture( unsigned uTexHandle );
void ClearAllTextures();
int GetNumTextureUnits();
void SetTexture( int iTextureUnitIndex, RageTexture* pTexture );
void SetTexture( TextureUnit tu, RageTexture* pTexture );
void SetTextureModeModulate();
void SetTextureModeGlow();
void SetTextureModeAdd();
+1 -1
View File
@@ -443,7 +443,7 @@ void Sprite::DrawTexture( const TweenState *state )
v[3].p = RageVector3( croppedQuadVerticies.right, croppedQuadVerticies.top, 0 ); // top right
DISPLAY->ClearAllTextures();
DISPLAY->SetTexture( 0, m_pTexture );
DISPLAY->SetTexture( TextureUnit_1, m_pTexture );
// Must call this after setting the texture or else texture
// parameters have no effect.