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 * * `
| 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 | * |
nothing calls this directly
no test coverage detected