diff options
author | Vitaliy <numzer0@yandex.ru> | 2018-09-16 19:59:42 +0300 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2018-09-16 17:59:42 +0100 |
commit | 79e393cf4b5027eb9071df23f4834aac3f3a689f (patch) | |
tree | be17c63026522fca0808a0a966390a76baf38c13 /src/light.h | |
parent | 220ec79e4a10ea553310b16eb07d0c7a03fedb78 (diff) | |
download | minetest-79e393cf4b5027eb9071df23f4834aac3f3a689f.tar.gz minetest-79e393cf4b5027eb9071df23f4834aac3f3a689f.tar.bz2 minetest-79e393cf4b5027eb9071df23f4834aac3f3a689f.zip |
Light curve: Simplify and improve code, fix darkened daytime sky (#7693)
Diffstat (limited to 'src/light.h')
-rw-r--r-- | src/light.h | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/light.h b/src/light.h index 203bd851e..44082a163 100644 --- a/src/light.h +++ b/src/light.h @@ -63,21 +63,7 @@ inline u8 decode_light(u8 light) // 0.0 <= light <= 1.0 // 0.0 <= return value <= 1.0 -inline float decode_light_f(float light_f) -{ - s32 i = (u32)(light_f * LIGHT_MAX + 0.5); - - if (i <= 0) - return (float)light_decode_table[0] / 255.0; - if (i >= LIGHT_SUN) - return (float)light_decode_table[LIGHT_SUN] / 255.0; - - float v1 = (float)light_decode_table[i - 1] / 255.0; - float v2 = (float)light_decode_table[i] / 255.0; - float f0 = (float)i - 0.5; - float f = light_f * LIGHT_MAX - f0; - return f * v2 + (1.0 - f) * v1; -} +float decode_light_f(float light_f); void set_light_table(float gamma); |