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

Function Matrix4_Scale

engine/script/src/script_vmath.cpp:2504–2529  ·  view source on GitHub ↗

creates a new matrix4 from three scale components * * Creates a new matrix4 from three scale components * * @name vmath.matrix4_scale * @param scale_x [type:number] scale along X axis * @param scale_y [type:number] sclae along Y axis * @param scale_z [type:number] scale along Z asis * @return matrix [type:matrix4] new matrix4 * @examples * * `

Source from the content-addressed store, hash-verified

2502 * ```
2503 */
2504 static int Matrix4_Scale(lua_State* L)
2505 {
2506 if (lua_isnumber(L, 1))
2507 {
2508 float x, y, z;
2509 x = (float) luaL_checknumber(L, 1);
2510 if (lua_gettop(L) == 3)
2511 {
2512 y = (float) luaL_checknumber(L, 2);
2513 z = (float) luaL_checknumber(L, 3);
2514 }
2515 else
2516 {
2517 y = x; z = x;
2518 }
2519 PushMatrix4(L, Matrix4::scale(Vector3(x, y, z)));
2520 }
2521 else
2522 {
2523 Vector3* scale = CheckVector3(L, 1);
2524 Matrix4 result = Matrix4::scale(*scale);
2525 PushMatrix4(L, result);
2526 return 1;
2527 }
2528 return luaL_error(L, "First argument should be number or vector3");
2529 }
2530
2531 /*# clamp input value in range [min, max] and return clamped value
2532 *

Callers

nothing calls this directly

Calls 8

lua_isnumberFunction · 0.85
luaL_checknumberFunction · 0.85
lua_gettopFunction · 0.85
PushMatrix4Function · 0.85
CheckVector3Function · 0.85
luaL_errorFunction · 0.85
scaleFunction · 0.50
Vector3Class · 0.50

Tested by

no test coverage detected