Remove timer from text_glow math

text_glow is part of DrawPrimitives(), and is used just about everywhere, so it is a huge burden taken off the timer to instead increment a counter.
This commit is contained in:
sukibaby
2024-08-07 05:29:57 -07:00
committed by teejusb
parent a0dbb32c2f
commit 2eeee03211
+9 -1
View File
@@ -867,7 +867,15 @@ void NoteField::DrawPrimitives()
ASSERT(GAMESTATE->m_pCurSong != nullptr);
const TimingData &timing = *pTiming;
const RageColor text_glow= RageColor(1,1,1,std::cos(RageTimer::GetTimeSinceStartFast()*2)/2+0.5f);
// Create an oscillating / pulsing glow effect.
// Converts a counter to radians and uses the cosine for a cyclic appearance.
static std::uint_fast16_t iGlowCounter;
static constexpr float fCyclical = 2.0f * 3.14159265f / 360.0f;
iGlowCounter = (iGlowCounter + 1) % 360;
float phase = iGlowCounter * fCyclical;
float glow = std::cos(phase) * 0.5f + 0.5f;
const RageColor text_glow = RageColor(1.0f, 1.0f, 1.0f, glow);
float horiz_align= align_right;
float side_sign= 1;