MCPcopy Create free account
hub / github.com/defold/defold / Matrix4_new

Function Matrix4_new

engine/script/src/script_vmath.cpp:1423–1440  ·  view source on GitHub ↗

creates a new matrix from another existing matrix * * Creates a new matrix with all components set to the * corresponding values from the supplied matrix. I.e. * the function creates a copy of the given matrix. * * @name vmath.matrix4 * @param m1 [type:matrix4] existing matrix * @return m [type:matrix4] matrix which is a copy of the specified matrix * @

Source from the content-addressed store, hash-verified

1421 * ```
1422 */
1423 static int Matrix4_new(lua_State* L)
1424 {
1425 Matrix4 m;
1426 if (lua_gettop(L) == 0)
1427 {
1428 m = Matrix4::identity();
1429 }
1430 else if (lua_gettop(L) == 1)
1431 {
1432 m = *CheckMatrix4(L, -1);
1433 }
1434 else
1435 {
1436 return luaL_error(L, "A %s.%s can only be constructed with empty argument list or from another %s.", SCRIPT_LIB_NAME, SCRIPT_TYPE_NAME_MATRIX4, SCRIPT_TYPE_NAME_MATRIX4);
1437 }
1438 PushMatrix4(L, m);
1439 return 1;
1440 }
1441
1442 /*# creates a frustum matrix
1443 *

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
identityFunction · 0.85
CheckMatrix4Function · 0.85
luaL_errorFunction · 0.85
PushMatrix4Function · 0.85

Tested by

no test coverage detected