make internal diffuse apply to bmt attributes
diffuse from BitmapText attributes were not receiving internal diffuse from their parent ActorFrames. This change waits until after the draw cycle to reset the internal diffuse and glow, so any color applications separate from generic diffuse can use the internal diffuse when desired.
This commit is contained in:
+8
-3
@@ -288,7 +288,7 @@ void Actor::Draw()
|
|||||||
|
|
||||||
this->PreDraw();
|
this->PreDraw();
|
||||||
ASSERT( m_pTempState != NULL );
|
ASSERT( m_pTempState != NULL );
|
||||||
if( m_pTempState->diffuse[0].a != 0 || m_pTempState->diffuse[1].a != 0 || m_pTempState->diffuse[2].a != 0 || m_pTempState->diffuse[3].a != 0 || m_pTempState->glow.a != 0 ) // This Actor is not fully transparent
|
if( m_pTempState->diffuse[0].a > 0 || m_pTempState->diffuse[1].a > 0 || m_pTempState->diffuse[2].a > 0 || m_pTempState->diffuse[3].a > 0 || m_pTempState->glow.a > 0 ) // This Actor is not fully transparent
|
||||||
{
|
{
|
||||||
// call the most-derived versions
|
// call the most-derived versions
|
||||||
this->BeginDraw();
|
this->BeginDraw();
|
||||||
@@ -296,9 +296,16 @@ void Actor::Draw()
|
|||||||
this->EndDraw();
|
this->EndDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->PostDraw();
|
||||||
m_pTempState = NULL;
|
m_pTempState = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Actor::PostDraw() // reset internal diffuse and glow
|
||||||
|
{
|
||||||
|
m_internalDiffuse = RageColor(1, 1, 1, 1);
|
||||||
|
m_internalGlow.a = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Actor::PreDraw() // calculate actor properties
|
void Actor::PreDraw() // calculate actor properties
|
||||||
{
|
{
|
||||||
// Somthing below may set m_pTempState to tempState
|
// Somthing below may set m_pTempState to tempState
|
||||||
@@ -468,7 +475,6 @@ void Actor::PreDraw() // calculate actor properties
|
|||||||
{
|
{
|
||||||
tempState.diffuse[i] *= m_internalDiffuse;
|
tempState.diffuse[i] *= m_internalDiffuse;
|
||||||
}
|
}
|
||||||
m_internalDiffuse = RageColor(1, 1, 1, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_internalGlow.a > 0 )
|
if( m_internalGlow.a > 0 )
|
||||||
@@ -481,7 +487,6 @@ void Actor::PreDraw() // calculate actor properties
|
|||||||
|
|
||||||
// Blend using Screen mode
|
// Blend using Screen mode
|
||||||
tempState.glow = tempState.glow + m_internalGlow - m_internalGlow * tempState.glow;
|
tempState.glow = tempState.glow + m_internalGlow - m_internalGlow * tempState.glow;
|
||||||
m_internalGlow.a = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -244,6 +244,8 @@ public:
|
|||||||
virtual bool EarlyAbortDraw() const { return false; }
|
virtual bool EarlyAbortDraw() const { return false; }
|
||||||
/** @brief Calculate values that may be needed for drawing. */
|
/** @brief Calculate values that may be needed for drawing. */
|
||||||
virtual void PreDraw();
|
virtual void PreDraw();
|
||||||
|
/** @brief Reset internal diffuse and glow. */
|
||||||
|
virtual void PostDraw();
|
||||||
/** @brief Start the drawing and push the transform on the world matrix stack. */
|
/** @brief Start the drawing and push the transform on the world matrix stack. */
|
||||||
virtual void BeginDraw();
|
virtual void BeginDraw();
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -658,6 +658,15 @@ void BitmapText::DrawPrimitives()
|
|||||||
iEnd = i + attr.length*4;
|
iEnd = i + attr.length*4;
|
||||||
iEnd = min( iEnd, m_aVertices.size() );
|
iEnd = min( iEnd, m_aVertices.size() );
|
||||||
for( ; i < iEnd; i += 4 )
|
for( ; i < iEnd; i += 4 )
|
||||||
|
{
|
||||||
|
if( m_internalDiffuse != RageColor(1, 1, 1, 1) )
|
||||||
|
{
|
||||||
|
m_aVertices[i+0].c = attr.diffuse[0] * m_internalDiffuse;
|
||||||
|
m_aVertices[i+1].c = attr.diffuse[2] * m_internalDiffuse;
|
||||||
|
m_aVertices[i+2].c = attr.diffuse[3] * m_internalDiffuse;
|
||||||
|
m_aVertices[i+3].c = attr.diffuse[1] * m_internalDiffuse;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_aVertices[i+0].c = attr.diffuse[0]; // top left
|
m_aVertices[i+0].c = attr.diffuse[0]; // top left
|
||||||
m_aVertices[i+1].c = attr.diffuse[2]; // bottom left
|
m_aVertices[i+1].c = attr.diffuse[2]; // bottom left
|
||||||
@@ -666,6 +675,7 @@ void BitmapText::DrawPrimitives()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// apply jitter to verts
|
// apply jitter to verts
|
||||||
vector<RageVector3> vGlyphJitter;
|
vector<RageVector3> vGlyphJitter;
|
||||||
@@ -729,8 +739,17 @@ void BitmapText::DrawPrimitives()
|
|||||||
iEnd = i + attr.length*4;
|
iEnd = i + attr.length*4;
|
||||||
iEnd = min( iEnd, m_aVertices.size() );
|
iEnd = min( iEnd, m_aVertices.size() );
|
||||||
for( ; i < iEnd; ++i )
|
for( ; i < iEnd; ++i )
|
||||||
|
{
|
||||||
|
if( m_internalGlow.a > 0 )
|
||||||
|
{
|
||||||
|
m_aVertices[i].c = attr.glow * m_internalGlow;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_aVertices[i].c = attr.glow;
|
m_aVertices[i].c = attr.glow;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Draw glow using the base texture and the glow texture. Otherwise,
|
/* Draw glow using the base texture and the glow texture. Otherwise,
|
||||||
* glow looks too tame on BitmapText that has a stroke. - Chris Danford */
|
* glow looks too tame on BitmapText that has a stroke. - Chris Danford */
|
||||||
/* This doesn't work well if the font is using an invisible stroke, as
|
/* This doesn't work well if the font is using an invisible stroke, as
|
||||||
|
|||||||
Reference in New Issue
Block a user