Make neon pulsing smoother
This commit is contained in:
parent
6e1ce024ab
commit
cb0e77b696
35
src/neon.cpp
35
src/neon.cpp
@ -183,30 +183,27 @@ Neon::Neon()
|
|||||||
CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, ¢er, up.x, up.y, right.x, right.y, 180, data->m_Color.r,
|
CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, ¢er, 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)
|
if (data->m_bPulsing)
|
||||||
{
|
{
|
||||||
data->m_nTimer = CTimer::m_snTimeInMilliseconds;
|
size_t delta = CTimer::m_snTimeInMilliseconds - CTimer::m_snPreviousTimeInMilliseconds;
|
||||||
|
|
||||||
if (data->m_bPulsing)
|
if (data->m_fVal < 0.0f)
|
||||||
{
|
{
|
||||||
if (data->m_fVal < 0.0f)
|
data->m_bIncrement = true;
|
||||||
{
|
}
|
||||||
data->m_bIncrement = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data->m_fVal > 0.3f)
|
if (data->m_fVal > 0.3f)
|
||||||
{
|
{
|
||||||
data->m_bIncrement = false;
|
data->m_bIncrement = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user