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