summaryrefslogtreecommitdiff
path: root/src/light.h
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2014-12-14 21:28:08 +1000
committerCraig Robbins <kde.psych@gmail.com>2014-12-31 02:44:31 +1000
commit3d29be24e089b1c267409f05b897ce3f03e99a07 (patch)
tree56ecebfe323bf37536dcbf44c7a0668f725abc94 /src/light.h
parent2414580754734b62119369255b0e9c462381dc8a (diff)
downloadminetest-3d29be24e089b1c267409f05b897ce3f03e99a07.tar.gz
minetest-3d29be24e089b1c267409f05b897ce3f03e99a07.tar.bz2
minetest-3d29be24e089b1c267409f05b897ce3f03e99a07.zip
Add display_gamma option for client
Diffstat (limited to 'src/light.h')
-rw-r--r--src/light.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/light.h b/src/light.h
index 769ca31ce..f49be4518 100644
--- a/src/light.h
+++ b/src/light.h
@@ -63,7 +63,21 @@ inline u8 undiminish_light(u8 light)
return light + 1;
}
-extern u8 light_decode_table[LIGHT_MAX+1];
+#ifndef SERVER
+
+/**
+ * \internal
+ *
+ * \warning DO NOT USE this directly; it is here simply so that decode_light()
+ * can be inlined.
+ *
+ * Array size is #LIGHTMAX+1
+ *
+ * The array is a lookup table to convert the internal representation of light
+ * (brightness) to the display brightness.
+ *
+ */
+extern const u8 *light_decode_table;
// 0 <= light <= LIGHT_SUN
// 0 <= return value <= 255
@@ -93,6 +107,10 @@ inline float decode_light_f(float light_f)
return f * v2 + (1.0 - f) * v1;
}
+void set_light_table(float gamma);
+
+#endif // ifndef SERVER
+
// 0 <= daylight_factor <= 1000
// 0 <= lightday, lightnight <= LIGHT_SUN
// 0 <= return value <= LIGHT_SUN
@@ -105,15 +123,5 @@ inline u8 blend_light(u32 daylight_factor, u8 lightday, u8 lightnight)
return l;
}
-// 0.0 <= daylight_factor <= 1.0
-// 0 <= lightday, lightnight <= LIGHT_SUN
-// 0 <= return value <= 255
-inline u8 blend_light_f1(float daylight_factor, u8 lightday, u8 lightnight)
-{
- u8 l = ((daylight_factor * decode_light(lightday) +
- (1.0-daylight_factor) * decode_light(lightnight)));
- return l;
-}
-
#endif