1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix last performance-type-promotion-in-math-fn problems

This commit is contained in:
Loic Blot 2018-04-04 07:42:40 +02:00
parent a90d27e1e2
commit 8e0b80aa36
No known key found for this signature in database
GPG key ID: EFAA458E8C153987
11 changed files with 59 additions and 42 deletions

View file

@ -3131,9 +3131,9 @@ PointedThing Game::updatePointedThing(
// Modify final color a bit with time
u32 timer = porting::getTimeMs() % 5000;
float timerf = (float) (irr::core::PI * ((timer / 2500.0) - 0.5));
float sin_r = 0.08 * sin(timerf);
float sin_g = 0.08 * sin(timerf + irr::core::PI * 0.5);
float sin_b = 0.08 * sin(timerf + irr::core::PI);
float sin_r = 0.08f * std::sin(timerf);
float sin_g = 0.08f * std::sin(timerf + irr::core::PI * 0.5f);
float sin_b = 0.08f * std::sin(timerf + irr::core::PI);
c.setRed(core::clamp(core::round32(c.getRed() * (0.8 + sin_r)), 0, 255));
c.setGreen(core::clamp(core::round32(c.getGreen() * (0.8 + sin_g)), 0, 255));
c.setBlue(core::clamp(core::round32(c.getBlue() * (0.8 + sin_b)), 0, 255));