add glow modes
This commit is contained in:
@@ -690,6 +690,13 @@ void Actor::Command( CString sCommandString )
|
|||||||
/* Add left/right/top/bottom for alpha if needed. */
|
/* Add left/right/top/bottom for alpha if needed. */
|
||||||
else if( sName=="diffusealpha" ) { for(int i = 0; i < 4; ++i) { RageColor c = GetDiffuses( i ); c.a = fParam(1); SetDiffuses( i, c ); } }
|
else if( sName=="diffusealpha" ) { for(int i = 0; i < 4; ++i) { RageColor c = GetDiffuses( i ); c.a = fParam(1); SetDiffuses( i, c ); } }
|
||||||
else if( sName=="glow" ) SetGlow( RageColor(fParam(1),fParam(2),fParam(3),fParam(4)) );
|
else if( sName=="glow" ) SetGlow( RageColor(fParam(1),fParam(2),fParam(3),fParam(4)) );
|
||||||
|
else if( sName=="glowmode" ) {
|
||||||
|
if(!sParam(1).CompareNoCase("whiten"))
|
||||||
|
SetGlowMode( GLOW_WHITEN );
|
||||||
|
else if(!sParam(1).CompareNoCase("brighten"))
|
||||||
|
SetGlowMode( GLOW_BRIGHTEN );
|
||||||
|
else ASSERT(0);
|
||||||
|
}
|
||||||
else if( sName=="rotationx" ) SetRotationX( fParam(1) );
|
else if( sName=="rotationx" ) SetRotationX( fParam(1) );
|
||||||
else if( sName=="rotationy" ) SetRotationY( fParam(1) );
|
else if( sName=="rotationy" ) SetRotationY( fParam(1) );
|
||||||
else if( sName=="rotationz" ) SetRotationZ( fParam(1) );
|
else if( sName=="rotationz" ) SetRotationZ( fParam(1) );
|
||||||
@@ -770,6 +777,7 @@ void Actor::TweenState::Init()
|
|||||||
for(int i=0; i<4; i++)
|
for(int i=0; i<4; i++)
|
||||||
diffuse[i] = RageColor( 1, 1, 1, 1 );
|
diffuse[i] = RageColor( 1, 1, 1, 1 );
|
||||||
glow = RageColor( 1, 1, 1, 0 );
|
glow = RageColor( 1, 1, 1, 0 );
|
||||||
|
glowmode = GLOW_WHITEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::TweenState::MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween )
|
void Actor::TweenState::MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween )
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public:
|
|||||||
RageVector3 scale;
|
RageVector3 scale;
|
||||||
RageColor diffuse[4];
|
RageColor diffuse[4];
|
||||||
RageColor glow;
|
RageColor glow;
|
||||||
|
GlowMode glowmode;
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween );
|
static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween );
|
||||||
@@ -132,6 +133,8 @@ public:
|
|||||||
virtual RageColor GetDiffuses( int i ) { return DestTweenState().diffuse[i]; };
|
virtual RageColor GetDiffuses( int i ) { return DestTweenState().diffuse[i]; };
|
||||||
virtual void SetGlow( RageColor c ) { DestTweenState().glow = c; };
|
virtual void SetGlow( RageColor c ) { DestTweenState().glow = c; };
|
||||||
virtual RageColor GetGlow() { return DestTweenState().glow; };
|
virtual RageColor GetGlow() { return DestTweenState().glow; };
|
||||||
|
virtual void SetGlowMode( GlowMode m ) { DestTweenState().glowmode = m; };
|
||||||
|
virtual GlowMode GetGlowMode() { return DestTweenState().glowmode; };
|
||||||
|
|
||||||
|
|
||||||
virtual void BeginTweening( float time, TweenType tt = TWEEN_LINEAR );
|
virtual void BeginTweening( float time, TweenType tt = TWEEN_LINEAR );
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ void BitmapText::DrawPrimitives()
|
|||||||
/* render the glow pass */
|
/* render the glow pass */
|
||||||
if( m_temp.glow.a > 0.0001f )
|
if( m_temp.glow.a > 0.0001f )
|
||||||
{
|
{
|
||||||
DISPLAY->SetTextureModeGlow();
|
DISPLAY->SetTextureModeGlow(m_temp.glowmode);
|
||||||
|
|
||||||
for( unsigned i=0; i<verts.size(); i++ )
|
for( unsigned i=0; i<verts.size(); i++ )
|
||||||
verts[i].c = m_temp.glow;
|
verts[i].c = m_temp.glow;
|
||||||
|
|||||||
@@ -913,13 +913,18 @@ void RageDisplay::SetBlendMode(int src, int dst)
|
|||||||
glBlendFunc( GLenum(src), GLenum(dst) );
|
glBlendFunc( GLenum(src), GLenum(dst) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay::SetTextureModeGlow()
|
void RageDisplay::SetTextureModeGlow(GlowMode m)
|
||||||
{
|
{
|
||||||
if(!m_oglspecs->EXT_texture_env_combine) {
|
if(m == GLOW_WHITEN && !m_oglspecs->EXT_texture_env_combine)
|
||||||
|
m = GLOW_BRIGHTEN; /* we can't do GLOW_WHITEN */
|
||||||
|
|
||||||
|
switch(m)
|
||||||
|
{
|
||||||
|
case GLOW_BRIGHTEN:
|
||||||
SetBlendMode( GL_SRC_ALPHA, GL_ONE );
|
SetBlendMode( GL_SRC_ALPHA, GL_ONE );
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
case GLOW_WHITEN:
|
||||||
/* Source color is the diffuse color only: */
|
/* Source color is the diffuse color only: */
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
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_COMBINE_RGB_EXT), GL_REPLACE);
|
||||||
@@ -931,6 +936,8 @@ void RageDisplay::SetTextureModeGlow()
|
|||||||
glTexEnvi(GL_TEXTURE_ENV, GLenum(GL_SOURCE0_ALPHA_EXT), GL_PRIMARY_COLOR_EXT);
|
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_OPERAND1_ALPHA_EXT), GL_SRC_ALPHA);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GLenum(GL_SOURCE1_ALPHA_EXT), GL_TEXTURE);
|
glTexEnvi(GL_TEXTURE_ENV, GLenum(GL_SOURCE1_ALPHA_EXT), GL_TEXTURE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay::SetBlendModeNormal()
|
void RageDisplay::SetBlendModeNormal()
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
void SetTexture( RageTexture* pTexture );
|
void SetTexture( RageTexture* pTexture );
|
||||||
|
|
||||||
void SetTextureModeModulate();
|
void SetTextureModeModulate();
|
||||||
void SetTextureModeGlow();
|
void SetTextureModeGlow(GlowMode m = GLOW_WHITEN );
|
||||||
void SetBlendModeNormal();
|
void SetBlendModeNormal();
|
||||||
void SetBlendModeAdd();
|
void SetBlendModeAdd();
|
||||||
bool ZBufferEnabled() const;
|
bool ZBufferEnabled() const;
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ void Sprite::DrawPrimitives()
|
|||||||
//////////////////////
|
//////////////////////
|
||||||
if( m_temp.glow.a > 0.0001f )
|
if( m_temp.glow.a > 0.0001f )
|
||||||
{
|
{
|
||||||
DISPLAY->SetTextureModeGlow();
|
DISPLAY->SetTextureModeGlow(m_temp.glowmode);
|
||||||
v[0].c = v[1].c = v[2].c = v[3].c = m_temp.glow;
|
v[0].c = v[1].c = v[2].c = v[3].c = m_temp.glow;
|
||||||
DISPLAY->DrawQuad( v );
|
DISPLAY->DrawQuad( v );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user