Explorar el Código

Merge branch 'master' of github.com:taylor001/crown

Daniele Bartolini hace 10 años
padre
commit
47f637d1ad
Se han modificado 2 ficheros con 11 adiciones y 0 borrados
  1. 3 0
      docs/lua_api.txt
  2. 8 0
      src/lua/lua_math.cpp

+ 3 - 0
docs/lua_api.txt

@@ -210,6 +210,9 @@ Matrix4x4
 	**from_axes** (x, y, z, t) : Matrix4x4
 		Returns a new matrix from *x*, *y*, *z* and *t*.
 
+	**copy** (m) : Matrix4x4
+		Returns a copy of the matrix *m*.
+
 	**add** (a, b) : Matrix4x4
 		Adds the matrix *a* to *b* and returns the result.
 

+ 8 - 0
src/lua/lua_math.cpp

@@ -452,6 +452,13 @@ static int matrix4x4_from_axes(lua_State* L)
 	return 1;
 }
 
+static int matrix4x4_copy(lua_State* L)
+{
+	LuaStack stack(L);
+	stack.push_matrix4x4(stack.get_matrix4x4(1));
+	return 1;
+}
+
 static int matrix4x4_add(lua_State* L)
 {
 	LuaStack stack(L);
@@ -956,6 +963,7 @@ void load_math(LuaEnvironment& env)
 	env.load_module_function("Matrix4x4", "from_translation",            matrix4x4_from_translation);
 	env.load_module_function("Matrix4x4", "from_quaternion_translation", matrix4x4_from_quaternion_translation);
 	env.load_module_function("Matrix4x4", "from_axes",                   matrix4x4_from_axes);
+	env.load_module_function("Matrix4x4", "copy",                        matrix4x4_copy);
 	env.load_module_function("Matrix4x4", "add",                         matrix4x4_add);
 	env.load_module_function("Matrix4x4", "subtract",                    matrix4x4_subtract);
 	env.load_module_function("Matrix4x4", "multiply",                    matrix4x4_multiply);