Make neon pulsing smoother

This commit is contained in:
Grinch_ 2021-10-20 18:27:16 +06:00
parent 6e1ce024ab
commit cb0e77b696
2 changed files with 16 additions and 21 deletions

View File

@ -183,12 +183,10 @@ Neon::Neon()
CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, &center, up.x, up.y, right.x, right.y, 180, data->m_Color.r, CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, &center, up.x, up.y, right.x, right.y, 180, data->m_Color.r,
data->m_Color.g, data->m_Color.b, 2.0f, false, 1.0f, 0, true); data->m_Color.g, data->m_Color.b, 2.0f, false, 1.0f, 0, true);
if (CTimer::m_snTimeInMilliseconds - data->m_nTimer > 150)
{
data->m_nTimer = CTimer::m_snTimeInMilliseconds;
if (data->m_bPulsing) if (data->m_bPulsing)
{ {
size_t delta = CTimer::m_snTimeInMilliseconds - CTimer::m_snPreviousTimeInMilliseconds;
if (data->m_fVal < 0.0f) if (data->m_fVal < 0.0f)
{ {
data->m_bIncrement = true; data->m_bIncrement = true;
@ -201,12 +199,11 @@ Neon::Neon()
if (data->m_bIncrement) if (data->m_bIncrement)
{ {
data->m_fVal += 0.1f; data->m_fVal += 0.0003f * delta;
} }
else else
{ {
data->m_fVal -= 0.1f; data->m_fVal -= 0.0003f * delta;
}
} }
} }
} }

View File

@ -10,7 +10,6 @@ private:
CRGBA m_Color; CRGBA m_Color;
bool m_bNeonInstalled; bool m_bNeonInstalled;
float m_fVal; float m_fVal;
uint m_nTimer;
bool m_bIncrement; bool m_bIncrement;
bool m_bPulsing; bool m_bPulsing;
@ -18,7 +17,6 @@ private:
{ {
m_bNeonInstalled = false; m_bNeonInstalled = false;
m_fVal = 0.0; m_fVal = 0.0;
m_nTimer = 0;
m_bIncrement = true; m_bIncrement = true;
} }
}; };