Daniele Bartolini 10 ani în urmă
părinte
comite
458f23d726

+ 1 - 3
src/core/math/aabb.h

@@ -5,12 +5,10 @@
 
 #pragma once
 
-#include "error.h"
 #include "math_types.h"
+#include "vector3.h"
 #include "matrix4x4.h"
 #include "sphere.h"
-#include "types.h"
-#include "vector3.h"
 
 namespace crown
 {

+ 0 - 1
src/core/math/frustum.h

@@ -5,7 +5,6 @@
 
 #pragma once
 
-#include "types.h"
 #include "math_types.h"
 #include "vector3.h"
 #include "plane.h"

+ 0 - 1
src/core/math/intersection.h

@@ -6,7 +6,6 @@
 #pragma once
 
 #include "math_types.h"
-#include "sphere.h"
 
 namespace crown
 {

+ 1 - 2
src/core/math/matrix3x3.h

@@ -7,7 +7,6 @@
 
 #include "math_types.h"
 #include "vector3.h"
-#include "error.h"
 #include "quaternion.h"
 
 namespace crown
@@ -16,7 +15,7 @@ namespace crown
 /// Functions to manipulate Matrix3x3
 ///
 /// @ingroup Math
-const Matrix3x3 IDENTITY = { {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} };
+const Matrix3x3 IDENTITY = { {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f} };
 
 inline Matrix3x3 matrix3x3(const Vector3& x, const Vector3& y, const Vector3& z)
 {

+ 3 - 4
src/core/math/matrix4x4.h

@@ -6,10 +6,9 @@
 #pragma once
 
 #include "math_types.h"
-#include "matrix3x3.h"
-#include "quaternion.h"
 #include "vector4.h"
-#include "types.h"
+#include "quaternion.h"
+#include "matrix3x3.h"
 
 namespace crown
 {
@@ -17,7 +16,7 @@ namespace crown
 /// Functions to manipulate Matrix4x4.
 ///
 /// @ingroup Math
-const Matrix4x4 MATRIX4X4_IDENTITY = { {1.0, 0.0, 0.0, 0.0 }, {0.0, 1.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0 }, { 0.0, 0.0, 0.0, 1.0 } };
+const Matrix4x4 MATRIX4X4_IDENTITY = { {1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, { 0.0f, 0.0f, 1.0f, 0.0f}, { 0.0f, 0.0f, 0.0f, 1.0f} };
 
 inline Matrix4x4 matrix4x4(float r1c1, float r2c1, float r3c1, float r4c1,
 	float r1c2, float r2c2, float r3c2, float r4c2,

+ 1 - 2
src/core/math/sphere.h

@@ -5,9 +5,8 @@
 
 #pragma once
 
-#include "types.h"
-#include "math_utils.h"
 #include "math_types.h"
+#include "math_utils.h"
 #include "vector3.h"
 
 namespace crown

+ 3 - 4
src/core/math/vector2.h

@@ -5,10 +5,9 @@
 
 #pragma once
 
-#include "error.h"
-#include "types.h"
-#include "math_utils.h"
 #include "math_types.h"
+#include "math_utils.h"
+#include "error.h"
 
 namespace crown
 {
@@ -49,7 +48,7 @@ inline Vector2& operator*=(Vector2& a, float k)
 
 inline Vector2& operator/=(Vector2& a, float k)
 {
-	CE_ASSERT(k != (float)0.0, "Division by zero");
+	CE_ASSERT(k != 0.0f, "Division by zero");
 	float inv = 1.0f / k;
 	a.x *= inv;
 	a.y *= inv;

+ 14 - 17
src/core/math/vector3.h

@@ -5,11 +5,10 @@
 
 #pragma once
 
-#include "error.h"
-#include "types.h"
+#include "math_types.h"
 #include "math_utils.h"
 #include "vector2.h"
-#include "math_types.h"
+#include "error.h"
 
 namespace crown
 {
@@ -17,19 +16,16 @@ namespace crown
 /// Functions to manipulate Vector3.
 ///
 /// @ingroup Math
-const Vector3 VECTOR3_ZERO     = { 0, 0, 0 };
-const Vector3 VECTOR3_XAXIS    = { 1, 0, 0 };
-const Vector3 VECTOR3_YAXIS    = { 0, 1, 0 };
-const Vector3 VECTOR3_ZAXIS    = { 0, 0, 1 };
-const Vector3 VECTOR3_FORWARD  = { 0, 0, 1 };
-const Vector3 VECTOR3_BACKWARD = { 0, 0, -1 };
-const Vector3 VECTOR3_LEFT     = { -1, 0, 0 };
-const Vector3 VECTOR3_RIGHT    = { 1, 0, 0 };
-const Vector3 VECTOR3_UP       = { 0, 1, 0 };
-const Vector3 VECTOR3_DOWN     = { 0, -1, 0 };
-
-/// Returns the Vector2 portion of @a a. (i.e. truncates z)
-Vector2 to_vector2(const Vector3& a);
+const Vector3 VECTOR3_ZERO     = { 0.0f, 0.0f, 0.0f };
+const Vector3 VECTOR3_XAXIS    = { 1.0f, 0.0f, 0.0f };
+const Vector3 VECTOR3_YAXIS    = { 0.0f, 1.0f, 0.0f };
+const Vector3 VECTOR3_ZAXIS    = { 0.0f, 0.0f, 1.0f };
+const Vector3 VECTOR3_FORWARD  = { 0.0f, 0.0f, 1.0f };
+const Vector3 VECTOR3_BACKWARD = { 0.0f, 0.0f, -1.0f };
+const Vector3 VECTOR3_LEFT     = { -1.0f, 0.0f, 0.0f };
+const Vector3 VECTOR3_RIGHT    = { 1.0f, 0.0f, 0.0f };
+const Vector3 VECTOR3_UP       = { 0.0f, 1.0f, 0.0f };
+const Vector3 VECTOR3_DOWN     = { 0.0f, -1.0f, 0.0f };
 
 inline Vector3 vector3(float x, float y, float z)
 {
@@ -66,7 +62,7 @@ inline Vector3& operator*=(Vector3& a, float k)
 
 inline Vector3& operator/=(Vector3& a, float k)
 {
-	CE_ASSERT(k != (float)0.0, "Division by zero");
+	CE_ASSERT(k != 0.0f, "Division by zero");
 	float inv = 1.0f / k;
 	a.x *= inv;
 	a.y *= inv;
@@ -189,6 +185,7 @@ inline const float* to_float_ptr(const Vector3& a)
 	return &a.x;
 }
 
+/// Returns the Vector2 portion of @a a. (i.e. truncates z)
 inline Vector2 to_vector2(const Vector3& a)
 {
 	return vector2(a.x, a.y);

+ 8 - 8
src/core/math/vector4.h

@@ -5,10 +5,10 @@
 
 #pragma once
 
-#include "error.h"
-#include "types.h"
+#include "math_types.h"
 #include "math_utils.h"
 #include "vector3.h"
+#include "error.h"
 
 namespace crown
 {
@@ -16,11 +16,11 @@ namespace crown
 /// Functions to manipulate Vector4.
 ///
 /// @ingroup Math
-const Vector4 VECTOR4_ZERO  = { 0, 0, 0, 0 };
-const Vector4 VECTOR4_XAXIS = { 1, 0, 0, 0 };
-const Vector4 VECTOR4_YAXIS = { 0, 1, 0, 0 };
-const Vector4 VECTOR4_ZAXIS = { 0, 0, 1, 0 };
-const Vector4 VECTOR4_WAXIS = { 0, 0, 0, 1 };
+const Vector4 VECTOR4_ZERO  = { 0.0f, 0.0f, 0.0f, 0.0f };
+const Vector4 VECTOR4_XAXIS = { 1.0f, 0.0f, 0.0f, 0.0f };
+const Vector4 VECTOR4_YAXIS = { 0.0f, 1.0f, 0.0f, 0.0f };
+const Vector4 VECTOR4_ZAXIS = { 0.0f, 0.0f, 1.0f, 0.0f };
+const Vector4 VECTOR4_WAXIS = { 0.0f, 0.0f, 0.0f, 1.0f };
 
 /// Returns the Vector3 portion of @a a. (i.e. truncates w)
 Vector3 to_vector3(const Vector4& a);
@@ -74,7 +74,7 @@ inline Vector4& operator*=(Vector4& a, float k)
 
 inline Vector4& operator/=(Vector4& a, float k)
 {
-	CE_ASSERT(k != (float)0.0, "Division by zero");
+	CE_ASSERT(k != 0.0f, "Division by zero");
 	float inv = 1.0f / k;
 	a.x *= inv;
 	a.y *= inv;