Propagate glow to ActorFrames' children

This commit is contained in:
Devin J. Pohly
2013-05-28 20:52:01 -04:00
parent 7c3a9eb427
commit 849b6e5b3b
3 changed files with 23 additions and 0 deletions
+15
View File
@@ -91,6 +91,7 @@ void Actor::InitState()
m_baseRotation = RageVector3( 0, 0, 0 );
m_baseScale = RageVector3( 1, 1, 1 );
m_fBaseAlpha = 1;
m_internalGlow = RageColor( 0, 0, 0, 0 );
m_start.Init();
m_current.Init();
@@ -186,6 +187,7 @@ Actor::Actor( const Actor &cpy ):
CPY( m_baseRotation );
CPY( m_baseScale );
CPY( m_fBaseAlpha );
CPY( m_internalGlow );
CPY( m_size );
@@ -458,6 +460,19 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
tempState.diffuse[i].a *= m_fBaseAlpha;
}
if( m_internalGlow.a > 0 )
{
if( m_pTempState != &tempState )
{
m_pTempState = &tempState;
tempState = m_current;
}
// Blend using Screen mode
tempState.glow = tempState.glow + m_internalGlow - m_internalGlow * tempState.glow;
m_internalGlow.a = 0;
}
if( m_pTempState->pos.x != 0 || m_pTempState->pos.y != 0 || m_pTempState->pos.z != 0 )
{
RageMatrix m;
+2
View File
@@ -343,6 +343,7 @@ public:
void SetBaseRotationZ( float rot ) { m_baseRotation.z = rot; }
void SetBaseRotation( const RageVector3 &rot ) { m_baseRotation = rot; }
virtual void SetBaseAlpha( float fAlpha ) { m_fBaseAlpha = fAlpha; }
void SetInternalGlow( const RageColor &c ) { m_internalGlow = c; }
/**
* @brief Retrieve the general zoom factor, using the x coordinate of the Actor.
@@ -636,6 +637,7 @@ protected:
RageVector3 m_baseRotation;
RageVector3 m_baseScale;
float m_fBaseAlpha;
RageColor m_internalGlow;
RageVector2 m_size;
TweenState m_current;
+6
View File
@@ -247,12 +247,18 @@ void ActorFrame::DrawPrimitives()
vector<Actor*> subs = m_SubActors;
ActorUtil::SortByZPosition( subs );
for( unsigned i=0; i<subs.size(); i++ )
{
subs[i]->SetInternalGlow(m_pTempState->glow);
subs[i]->Draw();
}
}
else
{
for( unsigned i=0; i<m_SubActors.size(); i++ )
{
m_SubActors[i]->SetInternalGlow(m_pTempState->glow);
m_SubActors[i]->Draw();
}
}
}