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

set_sky improvements, set_sun, set_moon and set_stars

This commit is contained in:
Jordach 2019-08-21 21:47:45 +01:00 committed by sfan5
parent 580e7e8eb9
commit 946c03c69b
19 changed files with 1525 additions and 400 deletions

View file

@ -335,6 +335,28 @@ video::SColor read_ARGB8(lua_State *L, int index)
return color;
}
bool is_color_table(lua_State *L, int index)
{
// Check whole table in case of missing ColorSpec keys:
// This check does not remove the checked value from the stack.
// Only update the value if we know we have a valid ColorSpec key pair.
if (!lua_istable(L, index))
return false;
bool is_color_table = false;
lua_getfield(L, index, "r");
if (!is_color_table)
is_color_table = lua_isnumber(L, -1);
lua_getfield(L, index, "g");
if (!is_color_table)
is_color_table = lua_isnumber(L, -1);
lua_getfield(L, index, "b");
if (!is_color_table)
is_color_table = lua_isnumber(L, -1);
lua_pop(L, 3); // b, g, r values
return is_color_table;
}
aabb3f read_aabb3f(lua_State *L, int index, f32 scale)
{
aabb3f box;