|
|
@@ -24,8 +24,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
OTHER DEALINGS IN THE SOFTWARE.
|
|
|
*/
|
|
|
|
|
|
-#include "Mat4.h"
|
|
|
-#include "Vec3.h"
|
|
|
+#include "Matrix4x4.h"
|
|
|
+#include "Vector3.h"
|
|
|
#include "LuaStack.h"
|
|
|
#include "LuaEnvironment.h"
|
|
|
#include "OS.h"
|
|
|
@@ -34,7 +34,7 @@ namespace crown
|
|
|
{
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
@@ -55,82 +55,82 @@ CE_EXPORT int mat4(lua_State* L)
|
|
|
float m14 = stack.get_float(15);
|
|
|
float m15 = stack.get_float(16);
|
|
|
|
|
|
- stack.push_mat4(Mat4(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15));
|
|
|
+ stack.push_matrix4x4(Matrix4x4(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15));
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_add(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_add(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Mat4& b = stack.get_mat4(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Matrix4x4& b = stack.get_matrix4x4(2);
|
|
|
|
|
|
- stack.push_mat4(a + b);
|
|
|
+ stack.push_matrix4x4(a + b);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_subtract(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_subtract(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Mat4& b = stack.get_mat4(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Matrix4x4& b = stack.get_matrix4x4(2);
|
|
|
|
|
|
- stack.push_mat4(a - b);
|
|
|
+ stack.push_matrix4x4(a - b);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_multiply(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_multiply(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Mat4& b = stack.get_mat4(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Matrix4x4& b = stack.get_matrix4x4(2);
|
|
|
|
|
|
- stack.push_mat4(a * b);
|
|
|
+ stack.push_matrix4x4(a * b);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_multiply_by_scalar(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_multiply_by_scalar(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float k = stack.get_float(2);
|
|
|
|
|
|
- stack.push_mat4(a * k);
|
|
|
+ stack.push_matrix4x4(a * k);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_divide_by_scalar(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_divide_by_scalar(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float k = stack.get_float(2);
|
|
|
|
|
|
- stack.push_mat4(a / k);
|
|
|
+ stack.push_matrix4x4(a / k);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_rotation_x(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_rotation_x(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float k = stack.get_float(2);
|
|
|
|
|
|
a.build_rotation_x(k);
|
|
|
@@ -139,11 +139,11 @@ CE_EXPORT int mat4_build_rotation_x(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_rotation_y(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_rotation_y(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float k = stack.get_float(2);
|
|
|
|
|
|
a.build_rotation_y(k);
|
|
|
@@ -152,11 +152,11 @@ CE_EXPORT int mat4_build_rotation_y(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_rotation_z(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_rotation_z(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float k = stack.get_float(2);
|
|
|
|
|
|
a.build_rotation_z(k);
|
|
|
@@ -165,12 +165,12 @@ CE_EXPORT int mat4_build_rotation_z(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_rotation(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_rotation(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& d = stack.get_vec3(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& d = stack.get_vector3(2);
|
|
|
float k = stack.get_float(3);
|
|
|
|
|
|
a.build_rotation(d, k);
|
|
|
@@ -179,11 +179,11 @@ CE_EXPORT int mat4_build_rotation(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_projection_perspective_rh(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_projection_perspective_rh(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float fovy = stack.get_float(2);
|
|
|
float aspect = stack.get_float(3);
|
|
|
float near = stack.get_float(4);
|
|
|
@@ -195,11 +195,11 @@ CE_EXPORT int mat4_build_projection_perspective_rh(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_projection_perspective_lh(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_projection_perspective_lh(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float fovy = stack.get_float(2);
|
|
|
float aspect = stack.get_float(3);
|
|
|
float near = stack.get_float(4);
|
|
|
@@ -211,11 +211,11 @@ CE_EXPORT int mat4_build_projection_perspective_lh(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_projection_ortho_rh(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_projection_ortho_rh(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float width = stack.get_float(2);
|
|
|
float height = stack.get_float(3);
|
|
|
float near = stack.get_float(4);
|
|
|
@@ -227,11 +227,11 @@ CE_EXPORT int mat4_build_projection_ortho_rh(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_projection_ortho_lh(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_projection_ortho_lh(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float width = stack.get_float(2);
|
|
|
float height = stack.get_float(3);
|
|
|
float near = stack.get_float(4);
|
|
|
@@ -243,11 +243,11 @@ CE_EXPORT int mat4_build_projection_ortho_lh(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_projection_ortho_2d_rh(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_projection_ortho_2d_rh(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
float width = stack.get_float(2);
|
|
|
float height = stack.get_float(3);
|
|
|
float near = stack.get_float(4);
|
|
|
@@ -259,14 +259,14 @@ CE_EXPORT int mat4_build_projection_ortho_2d_rh(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_look_at_rh(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_look_at_rh(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& pos = stack.get_vec3(2);
|
|
|
- Vec3& target = stack.get_vec3(3);
|
|
|
- Vec3& up = stack.get_vec3(4);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& pos = stack.get_vector3(2);
|
|
|
+ Vector3& target = stack.get_vector3(3);
|
|
|
+ Vector3& up = stack.get_vector3(4);
|
|
|
|
|
|
a.build_look_at_rh(pos, target, up);
|
|
|
|
|
|
@@ -274,14 +274,14 @@ CE_EXPORT int mat4_build_look_at_rh(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_look_at_lh(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_look_at_lh(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& pos = stack.get_vec3(2);
|
|
|
- Vec3& target = stack.get_vec3(3);
|
|
|
- Vec3& up = stack.get_vec3(4);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& pos = stack.get_vector3(2);
|
|
|
+ Vector3& target = stack.get_vector3(3);
|
|
|
+ Vector3& up = stack.get_vector3(4);
|
|
|
|
|
|
a.build_look_at_lh(pos, target, up);
|
|
|
|
|
|
@@ -289,14 +289,14 @@ CE_EXPORT int mat4_build_look_at_lh(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_viewpoint_billboard(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_viewpoint_billboard(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& pos = stack.get_vec3(2);
|
|
|
- Vec3& target = stack.get_vec3(3);
|
|
|
- Vec3& up = stack.get_vec3(4);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& pos = stack.get_vector3(2);
|
|
|
+ Vector3& target = stack.get_vector3(3);
|
|
|
+ Vector3& up = stack.get_vector3(4);
|
|
|
|
|
|
a.build_viewpoint_billboard(pos, target, up);
|
|
|
|
|
|
@@ -304,14 +304,14 @@ CE_EXPORT int mat4_build_viewpoint_billboard(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_build_axis_billboard(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_build_axis_billboard(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& pos = stack.get_vec3(2);
|
|
|
- Vec3& target = stack.get_vec3(3);
|
|
|
- Vec3& up = stack.get_vec3(4);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& pos = stack.get_vector3(2);
|
|
|
+ Vector3& target = stack.get_vector3(3);
|
|
|
+ Vector3& up = stack.get_vector3(4);
|
|
|
|
|
|
a.build_axis_billboard(pos, target, up);
|
|
|
|
|
|
@@ -319,23 +319,23 @@ CE_EXPORT int mat4_build_axis_billboard(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_transpose(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_transpose(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
- stack.push_mat4(a.transpose());
|
|
|
+ stack.push_matrix4x4(a.transpose());
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_determinant(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_determinant(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
stack.push_float(a.get_determinant());
|
|
|
|
|
|
@@ -343,23 +343,23 @@ CE_EXPORT int mat4_determinant(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_invert(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_invert(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
- stack.push_mat4(a.invert());
|
|
|
+ stack.push_matrix4x4(a.invert());
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_load_identity(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_load_identity(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
a.load_identity();
|
|
|
|
|
|
@@ -367,48 +367,48 @@ CE_EXPORT int mat4_load_identity(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_x(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_x(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
- stack.push_vec3(a.x());
|
|
|
+ stack.push_vector3(a.x());
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_y(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_y(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
- stack.push_vec3(a.y());
|
|
|
+ stack.push_vector3(a.y());
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_z(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_z(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
- stack.push_vec3(a.z());
|
|
|
+ stack.push_vector3(a.z());
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_set_x(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_set_x(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& x = stack.get_vec3(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& x = stack.get_vector3(2);
|
|
|
|
|
|
a.set_x(x);
|
|
|
|
|
|
@@ -416,12 +416,12 @@ CE_EXPORT int mat4_set_x(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_set_y(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_set_y(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& y = stack.get_vec3(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& y = stack.get_vector3(2);
|
|
|
|
|
|
a.set_y(y);
|
|
|
|
|
|
@@ -429,12 +429,12 @@ CE_EXPORT int mat4_set_y(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_set_z(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_set_z(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& z = stack.get_vec3(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& z = stack.get_vector3(2);
|
|
|
|
|
|
a.set_z(z);
|
|
|
|
|
|
@@ -442,24 +442,24 @@ CE_EXPORT int mat4_set_z(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_translation(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_translation(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
- stack.push_vec3(a.translation());
|
|
|
+ stack.push_vector3(a.translation());
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_set_translation(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_set_translation(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& trans = stack.get_vec3(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& trans = stack.get_vector3(2);
|
|
|
|
|
|
a.set_translation(trans);
|
|
|
|
|
|
@@ -467,24 +467,24 @@ CE_EXPORT int mat4_set_translation(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_get_scale(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_get_scale(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
- stack.push_vec3(a.get_scale());
|
|
|
+ stack.push_vector3(a.get_scale());
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_set_scale(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_set_scale(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
- Vec3& scale = stack.get_vec3(2);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
+ Vector3& scale = stack.get_vector3(2);
|
|
|
|
|
|
a.set_scale(scale);
|
|
|
|
|
|
@@ -492,11 +492,11 @@ CE_EXPORT int mat4_set_scale(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-CE_EXPORT int mat4_print(lua_State* L)
|
|
|
+CE_EXPORT int matrix4x4_print(lua_State* L)
|
|
|
{
|
|
|
LuaStack stack(L);
|
|
|
|
|
|
- Mat4& a = stack.get_mat4(1);
|
|
|
+ Matrix4x4& a = stack.get_matrix4x4(1);
|
|
|
|
|
|
os::printf("|%.1f|%.1f|%.1f|%.1f|\n", a.m[0], a.m[4], a.m[8], a.m[12]);
|
|
|
os::printf("|%.1f|%.1f|%.1f|%.1f|\n", a.m[1], a.m[5], a.m[9], a.m[13]);
|
|
|
@@ -507,42 +507,42 @@ CE_EXPORT int mat4_print(lua_State* L)
|
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
-void load_mat4(LuaEnvironment& env)
|
|
|
-{
|
|
|
- env.load_module_function("Mat4", "new", mat4);
|
|
|
- env.load_module_function("Mat4", "add", mat4_add);
|
|
|
- env.load_module_function("Mat4", "sub", mat4_subtract);
|
|
|
- env.load_module_function("Mat4", "mul", mat4_multiply);
|
|
|
- env.load_module_function("Mat4", "muls", mat4_multiply_by_scalar);
|
|
|
- env.load_module_function("Mat4", "divs", mat4_divide_by_scalar);
|
|
|
- env.load_module_function("Mat4", "build_rotation_x", mat4_build_rotation_x);
|
|
|
- env.load_module_function("Mat4", "build_rotation_y", mat4_build_rotation_y);
|
|
|
- env.load_module_function("Mat4", "build_rotation_z", mat4_build_rotation_z);
|
|
|
- env.load_module_function("Mat4", "build_rotation", mat4_build_rotation);
|
|
|
- env.load_module_function("Mat4", "build_projection_perspective_rh", mat4_build_projection_perspective_rh);
|
|
|
- env.load_module_function("Mat4", "build_projection_perspective_lh", mat4_build_projection_perspective_lh);
|
|
|
- env.load_module_function("Mat4", "build_projection_ortho_rh", mat4_build_projection_ortho_rh);
|
|
|
- env.load_module_function("Mat4", "build_projection_ortho_lh", mat4_build_projection_ortho_lh);
|
|
|
- env.load_module_function("Mat4", "build_projection_ortho_2d_rh", mat4_build_projection_ortho_2d_rh);
|
|
|
- env.load_module_function("Mat4", "build_look_at_rh", mat4_build_look_at_rh);
|
|
|
- env.load_module_function("Mat4", "build_look_at_lh", mat4_build_look_at_rh);
|
|
|
- env.load_module_function("Mat4", "build_viewpoint_billboard", mat4_build_viewpoint_billboard);
|
|
|
- env.load_module_function("Mat4", "build_axis_billboard", mat4_build_axis_billboard);
|
|
|
- env.load_module_function("Mat4", "transpose", mat4_transpose);
|
|
|
- env.load_module_function("Mat4", "determinant", mat4_determinant);
|
|
|
- env.load_module_function("Mat4", "invert", mat4_invert);
|
|
|
- env.load_module_function("Mat4", "load_identity", mat4_load_identity);
|
|
|
- env.load_module_function("Mat4", "x", mat4_x);
|
|
|
- env.load_module_function("Mat4", "y", mat4_y);
|
|
|
- env.load_module_function("Mat4", "z", mat4_z);
|
|
|
- env.load_module_function("Mat4", "set_x", mat4_set_x);
|
|
|
- env.load_module_function("Mat4", "set_y", mat4_set_y);
|
|
|
- env.load_module_function("Mat4", "set_z", mat4_set_z);
|
|
|
- env.load_module_function("Mat4", "translation", mat4_translation);
|
|
|
- env.load_module_function("Mat4", "set_translation", mat4_set_translation);
|
|
|
- env.load_module_function("Mat4", "get_scale", mat4_get_scale);
|
|
|
- env.load_module_function("Mat4", "set_scale", mat4_set_scale);
|
|
|
- env.load_module_function("Mat4", "print", mat4_print);
|
|
|
+void load_matrix4x4(LuaEnvironment& env)
|
|
|
+{
|
|
|
+ env.load_module_function("Matrix4x4", "new", matrix4x4);
|
|
|
+ env.load_module_function("Matrix4x4", "add", matrix4x4_add);
|
|
|
+ env.load_module_function("Matrix4x4", "sub", matrix4x4_subtract);
|
|
|
+ env.load_module_function("Matrix4x4", "mul", matrix4x4_multiply);
|
|
|
+ env.load_module_function("Matrix4x4", "muls", matrix4x4_multiply_by_scalar);
|
|
|
+ env.load_module_function("Matrix4x4", "divs", matrix4x4_divide_by_scalar);
|
|
|
+ env.load_module_function("Matrix4x4", "build_rotation_x", matrix4x4_build_rotation_x);
|
|
|
+ env.load_module_function("Matrix4x4", "build_rotation_y", matrix4x4_build_rotation_y);
|
|
|
+ env.load_module_function("Matrix4x4", "build_rotation_z", matrix4x4_build_rotation_z);
|
|
|
+ env.load_module_function("Matrix4x4", "build_rotation", matrix4x4_build_rotation);
|
|
|
+ env.load_module_function("Matrix4x4", "build_projection_perspective_rh", matrix4x4_build_projection_perspective_rh);
|
|
|
+ env.load_module_function("Matrix4x4", "build_projection_perspective_lh", matrix4x4_build_projection_perspective_lh);
|
|
|
+ env.load_module_function("Matrix4x4", "build_projection_ortho_rh", matrix4x4_build_projection_ortho_rh);
|
|
|
+ env.load_module_function("Matrix4x4", "build_projection_ortho_lh", matrix4x4_build_projection_ortho_lh);
|
|
|
+ env.load_module_function("Matrix4x4", "build_projection_ortho_2d_rh", matrix4x4_build_projection_ortho_2d_rh);
|
|
|
+ env.load_module_function("Matrix4x4", "build_look_at_rh", matrix4x4_build_look_at_rh);
|
|
|
+ env.load_module_function("Matrix4x4", "build_look_at_lh", matrix4x4_build_look_at_rh);
|
|
|
+ env.load_module_function("Matrix4x4", "build_viewpoint_billboard", matrix4x4_build_viewpoint_billboard);
|
|
|
+ env.load_module_function("Matrix4x4", "build_axis_billboard", matrix4x4_build_axis_billboard);
|
|
|
+ env.load_module_function("Matrix4x4", "transpose", matrix4x4_transpose);
|
|
|
+ env.load_module_function("Matrix4x4", "determinant", matrix4x4_determinant);
|
|
|
+ env.load_module_function("Matrix4x4", "invert", matrix4x4_invert);
|
|
|
+ env.load_module_function("Matrix4x4", "load_identity", matrix4x4_load_identity);
|
|
|
+ env.load_module_function("Matrix4x4", "x", matrix4x4_x);
|
|
|
+ env.load_module_function("Matrix4x4", "y", matrix4x4_y);
|
|
|
+ env.load_module_function("Matrix4x4", "z", matrix4x4_z);
|
|
|
+ env.load_module_function("Matrix4x4", "set_x", matrix4x4_set_x);
|
|
|
+ env.load_module_function("Matrix4x4", "set_y", matrix4x4_set_y);
|
|
|
+ env.load_module_function("Matrix4x4", "set_z", matrix4x4_set_z);
|
|
|
+ env.load_module_function("Matrix4x4", "translation", matrix4x4_translation);
|
|
|
+ env.load_module_function("Matrix4x4", "set_translation", matrix4x4_set_translation);
|
|
|
+ env.load_module_function("Matrix4x4", "get_scale", matrix4x4_get_scale);
|
|
|
+ env.load_module_function("Matrix4x4", "set_scale", matrix4x4_set_scale);
|
|
|
+ env.load_module_function("Matrix4x4", "print", matrix4x4_print);
|
|
|
}
|
|
|
|
|
|
} //namespace crown
|