mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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
This commit is contained in:
parent
2715cc8bf6
commit
6d45c243f8
29 changed files with 567 additions and 71 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue