diff options
author | x2048 <codeforsmile@gmail.com> | 2023-01-06 22:33:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-06 22:33:25 +0100 |
commit | 6d45c243f85942b20dab58753e735ec89a68f710 (patch) | |
tree | bfe6207d73d1b111af82ea9e5794bdaac4ce26e3 /src/script/lua_api/l_object.cpp | |
parent | 2715cc8bf68a2cc8cd583cd5b0bb732ee13a1b49 (diff) | |
download | minetest-6d45c243f85942b20dab58753e735ec89a68f710.tar.xz |
Add dynamic exposure correction (#12959)
* Add uniform for frame delta time
* Adjust exposure in logarithmic (EV) space
* Add network support and LUA API
* Add testing mod
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r-- | src/script/lua_api/l_object.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 0a3e05907..fc2c1254b 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -2297,8 +2297,20 @@ int ObjectRef::l_set_lighting(lua_State *L) getfloatfield(L, -1, "intensity", lighting.shadow_intensity); } lua_pop(L, 1); // shadows + getfloatfield(L, -1, "saturation", lighting.saturation); + lua_getfield(L, 2, "exposure"); + if (lua_istable(L, -1)) { + lighting.exposure.luminance_min = getfloatfield_default(L, -1, "luminance_min", lighting.exposure.luminance_min); + lighting.exposure.luminance_max = getfloatfield_default(L, -1, "luminance_max", lighting.exposure.luminance_max); + lighting.exposure.exposure_correction = getfloatfield_default(L, -1, "exposure_correction", lighting.exposure.exposure_correction); + lighting.exposure.speed_dark_bright = getfloatfield_default(L, -1, "speed_dark_bright", lighting.exposure.speed_dark_bright); + lighting.exposure.speed_bright_dark = getfloatfield_default(L, -1, "speed_bright_dark", lighting.exposure.speed_bright_dark); + lighting.exposure.center_weight_power = getfloatfield_default(L, -1, "center_weight_power", lighting.exposure.center_weight_power); + } + lua_pop(L, 1); // exposure + getServer(L)->setLighting(player, lighting); return 0; } @@ -2321,6 +2333,20 @@ int ObjectRef::l_get_lighting(lua_State *L) lua_setfield(L, -2, "shadows"); lua_pushnumber(L, lighting.saturation); lua_setfield(L, -2, "saturation"); + lua_newtable(L); // "exposure" + lua_pushnumber(L, lighting.exposure.luminance_min); + lua_setfield(L, -2, "luminance_min"); + lua_pushnumber(L, lighting.exposure.luminance_max); + lua_setfield(L, -2, "luminance_max"); + lua_pushnumber(L, lighting.exposure.exposure_correction); + lua_setfield(L, -2, "exposure_correction"); + lua_pushnumber(L, lighting.exposure.speed_dark_bright); + lua_setfield(L, -2, "speed_dark_bright"); + lua_pushnumber(L, lighting.exposure.speed_bright_dark); + lua_setfield(L, -2, "speed_bright_dark"); + lua_pushnumber(L, lighting.exposure.center_weight_power); + lua_setfield(L, -2, "center_weight_power"); + lua_setfield(L, -2, "exposure"); return 1; } |