Daniele Bartolini пре 10 година
родитељ
комит
a9097853cc
1 измењених фајлова са 19 додато и 23 уклоњено
  1. 19 23
      src/lua/lua_math.cpp

+ 19 - 23
src/lua/lua_math.cpp

@@ -125,36 +125,32 @@ static int math_fmod(lua_State* L)
 	return 1;
 }
 
-static int math_ray_oobb_intersection(lua_State* L)
+static int math_ray_obb_intersection(lua_State* L)
 {
 	LuaStack stack(L);
-	OBB oobb;
-	oobb.tm = stack.get_matrix4x4(3);
-	oobb.aabb.min = stack.get_vector3(4) * -0.5;
-	oobb.aabb.max = stack.get_vector3(4) * 0.5;
-	stack.push_float(ray_oobb_intersection(stack.get_vector3(1), stack.get_vector3(2), oobb));
+	stack.push_float(ray_obb_intersection(stack.get_vector3(1), stack.get_vector3(2), stack.get_matrix4x4(3), stack.get_vector3(4)));
 	return 1;
 }
 
 void load_math(LuaEnvironment& env)
 {
-	env.load_module_function("Math", "to_rad",                math_to_rad);
-	env.load_module_function("Math", "to_deg",                math_to_deg);
-	env.load_module_function("Math", "next_pow_2",            math_next_pow_2);
-	env.load_module_function("Math", "is_pow_2",              math_is_pow_2);
-	env.load_module_function("Math", "ceil",                  math_ceil);
-	env.load_module_function("Math", "floor",                 math_floor);
-	env.load_module_function("Math", "sqrt",                  math_sqrt);
-	env.load_module_function("Math", "inv_sqrt",              math_inv_sqrt);
-	env.load_module_function("Math", "sin",                   math_sin);
-	env.load_module_function("Math", "cos",                   math_cos);
-	env.load_module_function("Math", "asin",                  math_asin);
-	env.load_module_function("Math", "acos",                  math_acos);
-	env.load_module_function("Math", "tan",                   math_tan);
-	env.load_module_function("Math", "atan2",                 math_atan2);
-	env.load_module_function("Math", "abs",                   math_abs);
-	env.load_module_function("Math", "fmod",                  math_fmod);
-	env.load_module_function("Math", "ray_oobb_intersection", math_ray_oobb_intersection);
+	env.load_module_function("Math", "to_rad",               math_to_rad);
+	env.load_module_function("Math", "to_deg",               math_to_deg);
+	env.load_module_function("Math", "next_pow_2",           math_next_pow_2);
+	env.load_module_function("Math", "is_pow_2",             math_is_pow_2);
+	env.load_module_function("Math", "ceil",                 math_ceil);
+	env.load_module_function("Math", "floor",                math_floor);
+	env.load_module_function("Math", "sqrt",                 math_sqrt);
+	env.load_module_function("Math", "inv_sqrt",             math_inv_sqrt);
+	env.load_module_function("Math", "sin",                  math_sin);
+	env.load_module_function("Math", "cos",                  math_cos);
+	env.load_module_function("Math", "asin",                 math_asin);
+	env.load_module_function("Math", "acos",                 math_acos);
+	env.load_module_function("Math", "tan",                  math_tan);
+	env.load_module_function("Math", "atan2",                math_atan2);
+	env.load_module_function("Math", "abs",                  math_abs);
+	env.load_module_function("Math", "fmod",                 math_fmod);
+	env.load_module_function("Math", "ray_obb_intersection", math_ray_obb_intersection);
 }
 
 } // namespace crown