1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Make bloom parameters server-controlled (#15231)

This commit is contained in:
grorp 2024-10-09 15:08:03 +02:00 committed by GitHub
parent 13f533d490
commit 6ac4447134
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 95 additions and 66 deletions

View file

@ -2649,6 +2649,14 @@ int ObjectRef::l_set_lighting(lua_State *L)
lighting.volumetric_light_strength = rangelim(lighting.volumetric_light_strength, 0.0f, 1.0f);
}
lua_pop(L, 1); // volumetric_light
lua_getfield(L, 2, "bloom");
if (lua_istable(L, -1)) {
lighting.bloom_intensity = getfloatfield_default(L, -1, "intensity", lighting.bloom_intensity);
lighting.bloom_strength_factor = getfloatfield_default(L, -1, "strength_factor", lighting.bloom_strength_factor);
lighting.bloom_radius = getfloatfield_default(L, -1, "radius", lighting.bloom_radius);
}
lua_pop(L, 1); // bloom
}
getServer(L)->setLighting(player, lighting);
@ -2693,6 +2701,14 @@ int ObjectRef::l_get_lighting(lua_State *L)
lua_pushnumber(L, lighting.volumetric_light_strength);
lua_setfield(L, -2, "strength");
lua_setfield(L, -2, "volumetric_light");
lua_newtable(L); // "bloom"
lua_pushnumber(L, lighting.bloom_intensity);
lua_setfield(L, -2, "intensity");
lua_pushnumber(L, lighting.bloom_strength_factor);
lua_setfield(L, -2, "strength_factor");
lua_pushnumber(L, lighting.bloom_radius);
lua_setfield(L, -2, "radius");
lua_setfield(L, -2, "bloom");
return 1;
}