Replace RageFastSin and RageFastCos with standard library versions because the standard library is faster. Use fmod in spline evaluation.

This commit is contained in:
Kyzentun Keeslala
2016-02-07 15:35:05 -07:00
parent 9f57dd6caf
commit acda44238d
10 changed files with 71 additions and 135 deletions
+8 -8
View File
@@ -470,7 +470,7 @@ void Actor::PreDraw() // calculate actor properties
ssprintf("PercentThroughEffect: %f", fPercentThroughEffect) );
bool bBlinkOn = fPercentThroughEffect > 0.5f;
float fPercentBetweenColors = RageFastSin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f;
float fPercentBetweenColors = std::sin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f;
ASSERT_M( fPercentBetweenColors >= 0 && fPercentBetweenColors <= 1,
ssprintf("PercentBetweenColors: %f, PercentThroughEffect: %f", fPercentBetweenColors, fPercentThroughEffect) );
float fOriginalAlpha = tempState.diffuse[0].a;
@@ -516,15 +516,15 @@ void Actor::PreDraw() // calculate actor properties
break;
case rainbow:
tempState.diffuse[0] = RageColor(
RageFastCos( fPercentBetweenColors*2*PI ) * 0.5f + 0.5f,
RageFastCos( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f,
RageFastCos( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f,
std::cos( fPercentBetweenColors*2*PI ) * 0.5f + 0.5f,
std::cos( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f,
std::cos( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f,
fOriginalAlpha );
for( int i=1; i<NUM_DIFFUSE_COLORS; i++ )
tempState.diffuse[i] = tempState.diffuse[0];
break;
case wag:
tempState.rotation += m_vEffectMagnitude * RageFastSin( fPercentThroughEffect * 2.0f * PI );
tempState.rotation += m_vEffectMagnitude * std::sin( fPercentThroughEffect * 2.0f * PI );
break;
case spin:
// nothing needs to be here
@@ -536,13 +536,13 @@ void Actor::PreDraw() // calculate actor properties
break;
case bounce:
{
float fPercentOffset = RageFastSin( fPercentThroughEffect*PI );
float fPercentOffset = std::sin( fPercentThroughEffect*PI );
tempState.pos += m_vEffectMagnitude * fPercentOffset;
}
break;
case bob:
{
float fPercentOffset = RageFastSin( fPercentThroughEffect*PI*2 );
float fPercentOffset = std::sin( fPercentThroughEffect*PI*2 );
tempState.pos += m_vEffectMagnitude * fPercentOffset;
}
break;
@@ -550,7 +550,7 @@ void Actor::PreDraw() // calculate actor properties
{
float fMinZoom = m_vEffectMagnitude[0];
float fMaxZoom = m_vEffectMagnitude[1];
float fPercentOffset = RageFastSin( fPercentThroughEffect*PI );
float fPercentOffset = std::sin( fPercentThroughEffect*PI );
float fZoom = SCALE( fPercentOffset, 0.f, 1.f, fMinZoom, fMaxZoom );
tempState.scale *= fZoom;