From 849b6e5b3b94073e2308134e13300f9c7611f6cd Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Tue, 28 May 2013 20:52:01 -0400 Subject: [PATCH] Propagate glow to ActorFrames' children --- src/Actor.cpp | 15 +++++++++++++++ src/Actor.h | 2 ++ src/ActorFrame.cpp | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/src/Actor.cpp b/src/Actor.cpp index 93115e06d8..44c531ba2b 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -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; diff --git a/src/Actor.h b/src/Actor.h index ac30557190..629a8ba2d4 100644 --- a/src/Actor.h +++ b/src/Actor.h @@ -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; diff --git a/src/ActorFrame.cpp b/src/ActorFrame.cpp index 7aabc238d2..2c85749365 100644 --- a/src/ActorFrame.cpp +++ b/src/ActorFrame.cpp @@ -247,12 +247,18 @@ void ActorFrame::DrawPrimitives() vector subs = m_SubActors; ActorUtil::SortByZPosition( subs ); for( unsigned i=0; iSetInternalGlow(m_pTempState->glow); subs[i]->Draw(); + } } else { for( unsigned i=0; iSetInternalGlow(m_pTempState->glow); m_SubActors[i]->Draw(); + } } }