merge SetTextureMode functions
This commit is contained in:
@@ -203,9 +203,10 @@ public:
|
|||||||
virtual void ClearAllTextures() = 0;
|
virtual void ClearAllTextures() = 0;
|
||||||
virtual int GetNumTextureUnits() = 0;
|
virtual int GetNumTextureUnits() = 0;
|
||||||
virtual void SetTexture( TextureUnit tu, unsigned iTexture ) = 0;
|
virtual void SetTexture( TextureUnit tu, unsigned iTexture ) = 0;
|
||||||
virtual void SetTextureModeModulate() = 0;
|
virtual void SetTextureMode( TextureMode tm ) = 0;
|
||||||
virtual void SetTextureModeGlow() = 0;
|
void SetTextureModeModulate() { SetTextureMode( TextureMode_Modulate ); }
|
||||||
virtual void SetTextureModeAdd() = 0;
|
void SetTextureModeGlow() { SetTextureMode( TextureMode_Glow ); }
|
||||||
|
void SetTextureModeAdd() { SetTextureMode( TextureMode_Add ); }
|
||||||
virtual void SetTextureWrapping( bool b ) = 0;
|
virtual void SetTextureWrapping( bool b ) = 0;
|
||||||
virtual int GetMaxTextureSize() const = 0;
|
virtual int GetMaxTextureSize() const = 0;
|
||||||
virtual void SetTextureFiltering( bool b ) = 0;
|
virtual void SetTextureFiltering( bool b ) = 0;
|
||||||
|
|||||||
@@ -1155,46 +1155,42 @@ void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture )
|
|||||||
SetPalette( iTexture );
|
SetPalette( iTexture );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void RageDisplay_D3D::SetTextureModeModulate()
|
|
||||||
|
void RageDisplay_D3D::SetTextureMode( TextureMode tm )
|
||||||
{
|
{
|
||||||
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
|
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Use D3DTA_CURRENT instead of diffuse so that multitexturing works
|
switch( tm )
|
||||||
// properly. For stage 0, D3DTA_CURRENT is the diffuse color.
|
{
|
||||||
|
case TextureMode_Modulate:
|
||||||
|
// Use D3DTA_CURRENT instead of diffuse so that multitexturing works
|
||||||
|
// properly. For stage 0, D3DTA_CURRENT is the diffuse color.
|
||||||
|
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG2, D3DTA_CURRENT );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG2, D3DTA_CURRENT );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_MODULATE );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_MODULATE );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
||||||
}
|
break;
|
||||||
|
case TextureMode_Add:
|
||||||
void RageDisplay_D3D::SetTextureModeGlow()
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||||||
{
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG2, D3DTA_CURRENT );
|
||||||
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_ADD );
|
||||||
return;
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
||||||
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG2, D3DTA_CURRENT );
|
break;
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
|
case TextureMode_Glow:
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_COLORARG2, D3DTA_CURRENT );
|
||||||
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
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 );
|
||||||
void RageDisplay_D3D::SetTextureModeAdd()
|
g_pd3dDevice->SetTextureStageState( g_currentTextureUnit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
||||||
{
|
break;
|
||||||
if( g_currentTextureUnit >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
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_MODULATE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_D3D::SetTextureFiltering( bool b )
|
void RageDisplay_D3D::SetTextureFiltering( bool b )
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ public:
|
|||||||
void ClearAllTextures();
|
void ClearAllTextures();
|
||||||
int GetNumTextureUnits();
|
int GetNumTextureUnits();
|
||||||
void SetTexture( TextureUnit tu, unsigned iTexture );
|
void SetTexture( TextureUnit tu, unsigned iTexture );
|
||||||
void SetTextureModeModulate();
|
void SetTextureMode( TextureMode tm );
|
||||||
void SetTextureModeGlow();
|
|
||||||
void SetTextureModeAdd();
|
|
||||||
void SetTextureWrapping( bool b );
|
void SetTextureWrapping( bool b );
|
||||||
int GetMaxTextureSize() const;
|
int GetMaxTextureSize() const;
|
||||||
void SetTextureFiltering( bool b);
|
void SetTextureFiltering( bool b);
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ public:
|
|||||||
void ClearAllTextures() { }
|
void ClearAllTextures() { }
|
||||||
int GetNumTextureUnits() { return 1; }
|
int GetNumTextureUnits() { return 1; }
|
||||||
void SetTexture( TextureUnit tu, unsigned iTexture ) { }
|
void SetTexture( TextureUnit tu, unsigned iTexture ) { }
|
||||||
void SetTextureModeModulate() { }
|
void SetTextureMode( TextureMode tm ) { }
|
||||||
void SetTextureModeGlow() { }
|
|
||||||
void SetTextureModeAdd() { }
|
|
||||||
void SetTextureWrapping( bool b ) { }
|
void SetTextureWrapping( bool b ) { }
|
||||||
int GetMaxTextureSize() const { return 2048; }
|
int GetMaxTextureSize() const { return 2048; }
|
||||||
void SetTextureFiltering( bool b) { }
|
void SetTextureFiltering( bool b) { }
|
||||||
|
|||||||
@@ -1411,37 +1411,38 @@ void RageDisplay_OGL::SetTexture( TextureUnit tu, unsigned iTexture )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::SetTextureModeModulate()
|
void RageDisplay_OGL::SetTextureMode( TextureMode tm )
|
||||||
{
|
{
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
switch( tm )
|
||||||
}
|
|
||||||
|
|
||||||
void RageDisplay_OGL::SetTextureModeGlow()
|
|
||||||
{
|
|
||||||
if( !GLExt.m_bARB_texture_env_combine && !GLExt.m_bEXT_texture_env_combine )
|
|
||||||
{
|
{
|
||||||
/* This is changing blend state, instead of texture state, which isn't
|
case TextureMode_Modulate:
|
||||||
* great, but it's better than doing nothing. */
|
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
break;
|
||||||
return;
|
case TextureMode_Add:
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD );
|
||||||
|
break;
|
||||||
|
case TextureMode_Glow:
|
||||||
|
if( !GLExt.m_bARB_texture_env_combine && !GLExt.m_bEXT_texture_env_combine )
|
||||||
|
{
|
||||||
|
/* This is changing blend state, instead of texture state, which isn't
|
||||||
|
* great, but it's better than doing nothing. */
|
||||||
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Source color is the diffuse color only: */
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_COMBINE_RGB_EXT), GL_REPLACE );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_SOURCE0_RGB_EXT), GL_PRIMARY_COLOR_EXT );
|
||||||
|
|
||||||
|
/* Source alpha is texture alpha * diffuse alpha: */
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_COMBINE_ALPHA_EXT), GL_MODULATE );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_OPERAND0_ALPHA_EXT), GL_SRC_ALPHA );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_SOURCE0_ALPHA_EXT), GL_PRIMARY_COLOR_EXT );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_OPERAND1_ALPHA_EXT), GL_SRC_ALPHA );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_SOURCE1_ALPHA_EXT), GL_TEXTURE );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Source color is the diffuse color only: */
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT );
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_COMBINE_RGB_EXT), GL_REPLACE );
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_SOURCE0_RGB_EXT), GL_PRIMARY_COLOR_EXT );
|
|
||||||
|
|
||||||
/* Source alpha is texture alpha * diffuse alpha: */
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_COMBINE_ALPHA_EXT), GL_MODULATE );
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_OPERAND0_ALPHA_EXT), GL_SRC_ALPHA );
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_SOURCE0_ALPHA_EXT), GL_PRIMARY_COLOR_EXT );
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_OPERAND1_ALPHA_EXT), GL_SRC_ALPHA );
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_SOURCE1_ALPHA_EXT), GL_TEXTURE );
|
|
||||||
}
|
|
||||||
|
|
||||||
void RageDisplay_OGL::SetTextureModeAdd()
|
|
||||||
{
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::SetTextureFiltering( bool b )
|
void RageDisplay_OGL::SetTextureFiltering( bool b )
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ public:
|
|||||||
void ClearAllTextures();
|
void ClearAllTextures();
|
||||||
int GetNumTextureUnits();
|
int GetNumTextureUnits();
|
||||||
void SetTexture( TextureUnit tu, unsigned iTexture );
|
void SetTexture( TextureUnit tu, unsigned iTexture );
|
||||||
void SetTextureModeModulate();
|
void SetTextureMode( TextureMode tm );
|
||||||
void SetTextureModeGlow();
|
|
||||||
void SetTextureModeAdd();
|
|
||||||
void SetTextureWrapping( bool b );
|
void SetTextureWrapping( bool b );
|
||||||
int GetMaxTextureSize() const;
|
int GetMaxTextureSize() const;
|
||||||
void SetTextureFiltering( bool b);
|
void SetTextureFiltering( bool b);
|
||||||
|
|||||||
Reference in New Issue
Block a user