mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Apply review.
This commit is contained in:
parent
3e5f6036ac
commit
24a33e7a19
2 changed files with 18 additions and 27 deletions
|
@ -9050,7 +9050,6 @@ child will follow movement and rotation of that bone.
|
||||||
* Currently, bloom `intensity` and `strength_factor` affect volumetric
|
* Currently, bloom `intensity` and `strength_factor` affect volumetric
|
||||||
lighting `strength` and vice versa. This behavior is to be changed
|
lighting `strength` and vice versa. This behavior is to be changed
|
||||||
in the future, do not rely on it.
|
in the future, do not rely on it.
|
||||||
* `vision_effects`: is a table that controls vision effects
|
|
||||||
* `color_transform_matrix`: is a matrix with default value (identity matrix):
|
* `color_transform_matrix`: is a matrix with default value (identity matrix):
|
||||||
```lua
|
```lua
|
||||||
{ {1.0, 0.0, 0.0}, -- r
|
{ {1.0, 0.0, 0.0}, -- r
|
||||||
|
@ -9060,6 +9059,7 @@ child will follow movement and rotation of that bone.
|
||||||
|
|
||||||
* Work as `transformed_color_RGB = color_transform_matrix * color_RGB`
|
* Work as `transformed_color_RGB = color_transform_matrix * color_RGB`
|
||||||
* Can be used for creation color blind effect, base for night vision effect etc.
|
* Can be used for creation color blind effect, base for night vision effect etc.
|
||||||
|
* Request client with protocol version 49 or higger.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- example of night vision like transform
|
-- example of night vision like transform
|
||||||
|
|
|
@ -2695,12 +2695,7 @@ int ObjectRef::l_set_lighting(lua_State *L)
|
||||||
}
|
}
|
||||||
lua_pop(L, 1); // bloom
|
lua_pop(L, 1); // bloom
|
||||||
|
|
||||||
lua_getfield(L, 2, "vision_effects");
|
lua_getfield(L, 2, "color_transform_matrix");
|
||||||
if (!lua_isnoneornil(L, -1)) {
|
|
||||||
if (!lua_istable(L, -1))
|
|
||||||
throw LuaError("vision_effects is not a table");
|
|
||||||
|
|
||||||
lua_getfield(L, 3, "color_transform_matrix");
|
|
||||||
|
|
||||||
// if none or nil, keep color transform matrix unchanged
|
// if none or nil, keep color transform matrix unchanged
|
||||||
if (!lua_isnoneornil(L, -1)) {
|
if (!lua_isnoneornil(L, -1)) {
|
||||||
|
@ -2725,8 +2720,6 @@ int ObjectRef::l_set_lighting(lua_State *L)
|
||||||
}
|
}
|
||||||
lua_pop(L, 1); // color_transform_matrix
|
lua_pop(L, 1); // color_transform_matrix
|
||||||
}
|
}
|
||||||
lua_pop(L, 1); // vision_effects
|
|
||||||
}
|
|
||||||
|
|
||||||
getServer(L)->setLighting(player, lighting);
|
getServer(L)->setLighting(player, lighting);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2778,7 +2771,6 @@ int ObjectRef::l_get_lighting(lua_State *L)
|
||||||
lua_pushnumber(L, lighting.bloom_radius);
|
lua_pushnumber(L, lighting.bloom_radius);
|
||||||
lua_setfield(L, -2, "radius");
|
lua_setfield(L, -2, "radius");
|
||||||
lua_setfield(L, -2, "bloom");
|
lua_setfield(L, -2, "bloom");
|
||||||
lua_newtable(L); // "vision_effects"
|
|
||||||
lua_newtable(L); // "color_transform_matrix"
|
lua_newtable(L); // "color_transform_matrix"
|
||||||
// Create the nested table structure {{a, b, c}, {d, e, f}, {g, h, i}}
|
// Create the nested table structure {{a, b, c}, {d, e, f}, {g, h, i}}
|
||||||
for (int row = 0; row < 3; row++) {
|
for (int row = 0; row < 3; row++) {
|
||||||
|
@ -2790,7 +2782,6 @@ int ObjectRef::l_get_lighting(lua_State *L)
|
||||||
lua_rawseti(L, -2, row + 1); // Set inner table in the outer matrix table
|
lua_rawseti(L, -2, row + 1); // Set inner table in the outer matrix table
|
||||||
}
|
}
|
||||||
lua_setfield(L, -2, "color_transform_matrix");
|
lua_setfield(L, -2, "color_transform_matrix");
|
||||||
lua_setfield(L, -2, "vision_effects");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue