eliminate extra fmodf for each rendered tap
This commit is contained in:
@@ -362,9 +362,12 @@ void NoteDisplay::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor )
|
void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor )
|
||||||
{
|
{
|
||||||
|
/* -inf ... inf */
|
||||||
float fSongBeat = GAMESTATE->m_fSongBeat;
|
float fSongBeat = GAMESTATE->m_fSongBeat;
|
||||||
float fPercentIntoAnimation = fmodf(fSongBeat,fAnimationLengthInBeats) / fAnimationLengthInBeats;
|
/* -len ... +len */
|
||||||
|
float fPercentIntoAnimation = fmodf( fSongBeat, fAnimationLengthInBeats );
|
||||||
|
/* -1 ... 1 */
|
||||||
|
fPercentIntoAnimation /= fAnimationLengthInBeats;
|
||||||
|
|
||||||
if( bVivid )
|
if( bVivid )
|
||||||
{
|
{
|
||||||
@@ -374,10 +377,16 @@ void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAni
|
|||||||
const float fFraction = fNoteBeatFraction - 0.25f/fAnimationLengthInBeats;
|
const float fFraction = fNoteBeatFraction - 0.25f/fAnimationLengthInBeats;
|
||||||
const float fInterval = 1.f / fAnimationLengthInBeats;
|
const float fInterval = 1.f / fAnimationLengthInBeats;
|
||||||
fPercentIntoAnimation += Quantize(fFraction,fInterval);
|
fPercentIntoAnimation += Quantize(fFraction,fInterval);
|
||||||
}
|
|
||||||
|
|
||||||
// just in case somehow we're majorly negative with the subtraction
|
// just in case somehow we're majorly negative with the subtraction
|
||||||
wrap( fPercentIntoAnimation, 1.f );
|
wrap( fPercentIntoAnimation, 1.f );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* 0 ... 1, wrapped */
|
||||||
|
if( fPercentIntoAnimation < 0 )
|
||||||
|
fPercentIntoAnimation += 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
float fLengthSeconds = actorToSet.GetAnimationLengthSeconds();
|
float fLengthSeconds = actorToSet.GetAnimationLengthSeconds();
|
||||||
actorToSet.SetSecondsIntoAnimation( fPercentIntoAnimation*fLengthSeconds );
|
actorToSet.SetSecondsIntoAnimation( fPercentIntoAnimation*fLengthSeconds );
|
||||||
|
|||||||
Reference in New Issue
Block a user