diff options
author | numzero <numzer0@yandex.ru> | 2020-11-22 16:43:38 +0300 |
---|---|---|
committer | lhofhansl <larsh@apache.org> | 2020-11-26 12:49:10 -0800 |
commit | 89cc5bf53730d72744d45f92fc11dc9ab6c232c9 (patch) | |
tree | 394d28514400902aa2d95222116ebe8fdd4a4699 /src | |
parent | 095f82692d3d1b8b190178d640f0a166d1851f60 (diff) | |
download | minetest-89cc5bf53730d72744d45f92fc11dc9ab6c232c9.tar.gz minetest-89cc5bf53730d72744d45f92fc11dc9ab6c232c9.tar.bz2 minetest-89cc5bf53730d72744d45f92fc11dc9ab6c232c9.zip |
Don't evaluate things many times
Diffstat (limited to 'src')
-rw-r--r-- | src/client/clouds.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/clouds.cpp b/src/client/clouds.cpp index ccc94cc88..253dee8b9 100644 --- a/src/client/clouds.cpp +++ b/src/client/clouds.cpp @@ -341,14 +341,13 @@ void Clouds::step(float dtime) void Clouds::update(const v3f &camera_p, const video::SColorf &color_diffuse) { + video::SColorf ambient(m_params.color_ambient); + video::SColorf bright(m_params.color_bright); m_camera_pos = camera_p; - m_color.r = MYMIN(MYMAX(color_diffuse.r * m_params.color_bright.getRed(), - m_params.color_ambient.getRed()), 255) / 255.0f; - m_color.g = MYMIN(MYMAX(color_diffuse.g * m_params.color_bright.getGreen(), - m_params.color_ambient.getGreen()), 255) / 255.0f; - m_color.b = MYMIN(MYMAX(color_diffuse.b * m_params.color_bright.getBlue(), - m_params.color_ambient.getBlue()), 255) / 255.0f; - m_color.a = m_params.color_bright.getAlpha() / 255.0f; + m_color.r = core::clamp(color_diffuse.r * bright.r, ambient.r, 1.0f); + m_color.g = core::clamp(color_diffuse.g * bright.g, ambient.g, 1.0f); + m_color.b = core::clamp(color_diffuse.b * bright.b, ambient.b, 1.0f); + m_color.a = bright.a; // is the camera inside the cloud mesh? m_camera_inside_cloud = false; // default |