1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00
This commit is contained in:
Lars Mueller 2025-05-31 03:12:09 +02:00
parent 8bf38e3a71
commit ebb1ead848
3 changed files with 17 additions and 10 deletions

View file

@ -35,13 +35,20 @@ read_globals = {
string = {fields = {"split", "trim"}},
table = {fields = {"copy", "getn", "indexof", "insert_all", "key_value_swap"}},
math = {fields = {"hypot", "round"}},
-- Busted-style unit testing
"describe",
"it",
assert = {fields = {"same", "equals"}},
}
-- Busted-style unit testing
local bustitute = {
read_globals = {
"describe",
"it",
assert = {fields = {"same", "equals"}},
},
}
files["mods/unittests/matrix4.lua"] = bustitute
files["mods/unittests/rotation.lua"] = bustitute
globals = {
"aborted",
"minetest",

View file

@ -55,7 +55,7 @@ it("copy", function()
end)
it("unpack", function()
assert.equals(mat1, Matrix4.new(mat1:unpack()))
assert.equals(mat1, Matrix4.new(mat1:unpack()))
end)
describe("transform", function()

View file

@ -44,7 +44,7 @@ inline core::matrix4 &LuaMatrix4::create(lua_State *L)
int LuaMatrix4::l_identity(lua_State *L)
{
create(L) = core::IdentityMatrix;
create(L) = core::matrix4();
return 1;
}
@ -69,7 +69,7 @@ int LuaMatrix4::l_translation(lua_State *L)
{
v3f translation = readParam<v3f>(L, 1);
core::matrix4 &matrix = create(L);
matrix = core::IdentityMatrix;
matrix = core::matrix4();
matrix.setTranslation(translation);
return 1;
}
@ -86,7 +86,7 @@ int LuaMatrix4::l_scale(lua_State *L)
{
v3f scale = readParam<v3f>(L, 1);
core::matrix4 &matrix = create(L);
matrix = core::IdentityMatrix;
matrix = core::matrix4();
matrix.setScale(scale);
return 1;
}
@ -96,7 +96,7 @@ int LuaMatrix4::l_reflection(lua_State *L)
v3f normal = readParam<v3f>(L, 1);
normal.normalize();
core::matrix4 &matrix = create(L);
matrix = core::IdentityMatrix;
matrix = core::matrix4();
// TODO move to CMatrix4
f32 factor = 2.0f / normal.getLengthSQ();
auto subtract_scaled_row = [&](int i, f32 scalar) {