Procházet zdrojové kódy

Rename Vec* to Vector*, Mat* to Matrix*, Quat to Quaternion

Daniele Bartolini před 12 roky
rodič
revize
2aa28bdfa8
63 změnil soubory, kde provedl 1323 přidání a 1323 odebrání
  1. 10 10
      engine/Android.mk
  2. 16 16
      engine/CMakeLists.txt
  3. 14 14
      engine/Camera.cpp
  4. 17 17
      engine/Camera.h
  5. 6 6
      engine/Crown.h
  6. 8 8
      engine/audio/SoundRenderer.h
  7. 12 12
      engine/audio/al/ALRenderer.cpp
  8. 10 10
      engine/audio/al/ALRenderer.h
  9. 11 11
      engine/audio/sles/SLESRenderer.cpp
  10. 1 1
      engine/audio/sles/SLESRenderer.h
  11. 3 3
      engine/compilers/mesh/MeshCompiler.cpp
  12. 5 5
      engine/compilers/mesh/MeshCompiler.h
  13. 36 36
      engine/core/bv/Box.h
  14. 8 8
      engine/core/bv/Circle.h
  15. 6 6
      engine/core/bv/Frustum.cpp
  16. 5 5
      engine/core/bv/Frustum.h
  17. 11 11
      engine/core/bv/Rect.cpp
  18. 19 19
      engine/core/bv/Rect.h
  19. 13 13
      engine/core/bv/Sphere.h
  20. 48 48
      engine/core/math/Intersection.h
  21. 63 63
      engine/core/math/Matrix3x3.cpp
  22. 41 41
      engine/core/math/Matrix3x3.h
  23. 90 90
      engine/core/math/Matrix4x4.cpp
  24. 50 50
      engine/core/math/Matrix4x4.h
  25. 7 7
      engine/core/math/Plane.cpp
  26. 5 5
      engine/core/math/Plane.h
  27. 8 8
      engine/core/math/Point2.h
  28. 28 28
      engine/core/math/Quaternion.cpp
  29. 14 14
      engine/core/math/Quaternion.h
  30. 13 13
      engine/core/math/Ray.h
  31. 22 22
      engine/core/math/Triangle.h
  32. 5 5
      engine/core/math/Vector2.cpp
  33. 74 74
      engine/core/math/Vector2.h
  34. 6 6
      engine/core/math/Vector3.cpp
  35. 81 81
      engine/core/math/Vector3.h
  36. 7 7
      engine/core/math/Vector4.cpp
  37. 72 72
      engine/core/math/Vector4.h
  38. 3 3
      engine/input/Accelerometer.h
  39. 8 8
      engine/input/Mouse.h
  40. 5 5
      engine/input/Touch.h
  41. 1 1
      engine/lua/LuaAccelerometer.cpp
  42. 1 1
      engine/lua/LuaCamera.cpp
  43. 4 4
      engine/lua/LuaEnvironment.cpp
  44. 4 4
      engine/lua/LuaEnvironment.h
  45. 139 139
      engine/lua/LuaMatrix4x4.cpp
  46. 4 4
      engine/lua/LuaMouse.cpp
  47. 38 38
      engine/lua/LuaQuaternion.cpp
  48. 32 32
      engine/lua/LuaStack.cpp
  49. 12 12
      engine/lua/LuaStack.h
  50. 70 70
      engine/lua/LuaVector2.cpp
  51. 73 73
      engine/lua/LuaVector3.cpp
  52. 3 3
      engine/network/BitMessage.cpp
  53. 3 3
      engine/network/BitMessage.h
  54. 22 22
      engine/renderers/DebugRenderer.cpp
  55. 7 7
      engine/renderers/DebugRenderer.h
  56. 8 8
      engine/renderers/RenderContext.h
  57. 3 3
      engine/renderers/Renderer.h
  58. 5 5
      engine/renderers/gl/GLRenderer.cpp
  59. 1 1
      engine/resource/MaterialResource.h
  60. 3 3
      engine/tests/messages.cpp
  61. 16 16
      samples/terrain/Terrain.cpp
  62. 9 9
      samples/terrain/Terrain.h
  63. 4 4
      samples/terrain/terrain_main.cpp

+ 10 - 10
engine/Android.mk

@@ -46,13 +46,13 @@ LOCAL_SRC_FILES :=\
 	core/json/JSONParser.cpp\
 \
 	core/math/Color4.cpp\
-	core/math/Mat3.cpp\
-	core/math/Mat4.cpp\
+	core/math/Matrix3x3.cpp\
+	core/math/Matrix4x4.cpp\
 	core/math/Plane.cpp\
-	core/math/Quat.cpp\
-	core/math/Vec2.cpp\
-	core/math/Vec3.cpp\
-	core/math/Vec4.cpp\
+	core/math/Quaternion.cpp\
+	core/math/Vector2.cpp\
+	core/math/Vector3.cpp\
+	core/math/Vector4.cpp\
 \
 	core/mem/HeapAllocator.cpp\
 	core/mem/LinearAllocator.cpp\
@@ -91,13 +91,13 @@ LOCAL_SRC_FILES :=\
 	lua/LuaAccelerometer.cpp\
 	lua/LuaDevice.cpp\
 	lua/LuaKeyboard.cpp\
-	lua/LuaMat4.cpp\
+	lua/LuaMatrix4x4.cpp\
 	lua/LuaMath.cpp\
 	lua/LuaMouse.cpp\
-	lua/LuaQuat.cpp\
+	lua/LuaQuaternion.cpp\
 	lua/LuaTouch.cpp\
-	lua/LuaVec2.cpp\
-	lua/LuaVec3.cpp\
+	lua/LuaVector2.cpp\
+	lua/LuaVector3.cpp\
 	lua/LuaWindow.cpp\
 	lua/LuaIntSetting.cpp\
 	lua/LuaFloatSetting.cpp\

+ 16 - 16
engine/CMakeLists.txt

@@ -125,32 +125,32 @@ set (CONTAINERS_HEADERS
 
 set (MATH_SRC
 	core/math/Color4.cpp
-	core/math/Mat3.cpp
-	core/math/Mat4.cpp
+	core/math/Matrix3x3.cpp
+	core/math/Matrix4x4.cpp
 	core/math/Plane.cpp
 	core/math/Point2.cpp
-	core/math/Quat.cpp
-	core/math/Vec2.cpp
-	core/math/Vec3.cpp
-	core/math/Vec4.cpp
+	core/math/Quaternion.cpp
+	core/math/Vector2.cpp
+	core/math/Vector3.cpp
+	core/math/Vector4.cpp
 )
 
 set (MATH_HEADERS
 	core/math/Color4.h
 	core/math/Interpolation.h
 	core/math/Intersection.h
-	core/math/Mat3.h
-	core/math/Mat4.h
+	core/math/Matrix3x3.h
+	core/math/Matrix4x4.h
 	core/math/MathUtils.h
 	core/math/Plane.h
 	core/math/Point2.h
-	core/math/Quat.h
+	core/math/Quaternion.h
 	core/math/Random.h
 	core/math/Ray.h
 	core/math/Triangle.h
-	core/math/Vec2.h
-	core/math/Vec3.h
-	core/math/Vec4.h
+	core/math/Vector2.h
+	core/math/Vector3.h
+	core/math/Vector4.h
 )
 
 set (FILESYSTEM_SRC
@@ -316,10 +316,10 @@ set (LUA_SRC
 	lua/LuaIntSetting.cpp
 	lua/LuaFloatSetting.cpp
 	lua/LuaStringSetting.cpp
-	lua/LuaVec2.cpp
-	lua/LuaVec3.cpp
-	lua/LuaMat4.cpp
-	lua/LuaQuat.cpp
+	lua/LuaVector2.cpp
+	lua/LuaVector3.cpp
+	lua/LuaMatrix4x4.cpp
+	lua/LuaQuaternion.cpp
 	lua/LuaMath.cpp
 	lua/LuaMouse.cpp
 	lua/LuaKeyboard.cpp

+ 14 - 14
engine/Camera.cpp

@@ -32,7 +32,7 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-Camera::Camera(const Vec3& position, float fov, float aspect) :
+Camera::Camera(const Vector3& position, float fov, float aspect) :
 	m_position(position),
 	m_look_at(0, 0, -1),
 	m_up(0, 1, 0),
@@ -52,13 +52,13 @@ Camera::Camera(const Vec3& position, float fov, float aspect) :
 }
 
 //-----------------------------------------------------------------------------
-const Vec3& Camera::position() const
+const Vector3& Camera::position() const
 {
 	return m_position;
 }
 
 //-----------------------------------------------------------------------------
-void Camera::set_position(const Vec3& position)
+void Camera::set_position(const Vector3& position)
 {
 	m_position = position;
 
@@ -66,13 +66,13 @@ void Camera::set_position(const Vec3& position)
 }
 
 //-----------------------------------------------------------------------------
-const Vec3& Camera::look_at() const
+const Vector3& Camera::look_at() const
 {
 	return m_look_at;
 }
 
 //-----------------------------------------------------------------------------
-void Camera::set_look_at(const Vec3& lookat)
+void Camera::set_look_at(const Vector3& lookat)
 {
 	m_look_at = lookat;
 
@@ -82,17 +82,17 @@ void Camera::set_look_at(const Vec3& lookat)
 //-----------------------------------------------------------------------
 void Camera::set_rotation(const float x, const float y)
 {
-	Vec3 right(1, 0, 0);
-	Vec3 look;
+	Vector3 right(1, 0, 0);
+	Vector3 look;
 
 	look.x = 0.0f;
 	look.y = math::sin(x);
 	look.z = -math::cos(x);
 
-	Vec3 up = right.cross(look);
+	Vector3 up = right.cross(look);
 	up.normalize();
 
-	Mat3 m;
+	Matrix3x3 m;
 	m.build_rotation_y(y);
 	look = m * look;
 	m_up = m * up;
@@ -101,7 +101,7 @@ void Camera::set_rotation(const float x, const float y)
 }
 
 //-----------------------------------------------------------------------------
-const Vec3& Camera::up() const
+const Vector3& Camera::up() const
 {
 	return m_up;
 }
@@ -163,13 +163,13 @@ void Camera::set_far_clip_distance(float far)
 }
 
 //-----------------------------------------------------------------------------
-const Mat4& Camera::projection_matrix() const
+const Matrix4x4& Camera::projection_matrix() const
 {
 	return m_projection;
 }
 
 //-----------------------------------------------------------------------------
-const Mat4& Camera::view_matrix() const
+const Matrix4x4& Camera::view_matrix() const
 {
 	return m_view;
 }
@@ -213,7 +213,7 @@ void Camera::move_backward(float meters)
 //-----------------------------------------------------------------------
 void Camera::strafe_left(float meters)
 {
-	Vec3 left = m_up.cross(m_look_at);
+	Vector3 left = m_up.cross(m_look_at);
 	left.normalize();
 
 	set_position(m_position + left * meters);
@@ -222,7 +222,7 @@ void Camera::strafe_left(float meters)
 //-----------------------------------------------------------------------
 void Camera::strafe_right(float meters)
 {
-	Vec3 left = m_up.cross(m_look_at);
+	Vector3 left = m_up.cross(m_look_at);
 	left.normalize();
 
 	set_position(m_position + left * -meters);

+ 17 - 17
engine/Camera.h

@@ -28,9 +28,9 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Types.h"
 #include "Frustum.h"
-#include "Mat4.h"
-#include "Mat3.h"
-#include "Vec3.h"
+#include "Matrix4x4.h"
+#include "Matrix3x3.h"
+#include "Vector3.h"
 
 namespace crown
 {
@@ -42,25 +42,25 @@ public:
 
 	/// Construct the camera placed at the given world-space @a position
 	/// with the given @a fov field of view and @a aspect ratio.
-					Camera(const Vec3& position, float fov, float aspect);
+					Camera(const Vector3& position, float fov, float aspect);
 
 	/// Returns the world-space position of the camera 
-	const Vec3&		position() const;
+	const Vector3&		position() const;
 
 	/// Sets the world-space @a position of the camera
-	void			set_position(const Vec3& position);
+	void			set_position(const Vector3& position);
 
 	/// Returns the lookat-point of the camera
-	const Vec3&		look_at() const;
+	const Vector3&		look_at() const;
 
 	/// Sets the lookat-point of the camera
-	void			set_look_at(const Vec3& lookat);
+	void			set_look_at(const Vector3& lookat);
 
 	/// Sets the rotation of the camera about the world's @a x axis and @a y axis
 	void			set_rotation(const float x, const float y);
 
 	/// Returns the up-vector of the camera
-	const Vec3&		up() const;
+	const Vector3&		up() const;
 
 	/// Returns the field of view of the camera in degrees
 	float			fov() const;
@@ -90,10 +90,10 @@ public:
 	const Frustum&	frustum() const;
 
 	/// Returns the renderer-independent projection matrix used by the camera
-	const Mat4&		projection_matrix() const;
+	const Matrix4x4&		projection_matrix() const;
 
 	/// Returns the renderer-independent view matrix used by the camera
-	const Mat4&		view_matrix() const;
+	const Matrix4x4&		view_matrix() const;
 
 	/// Moves the camera towards look direction by @a meters meters
 	void			move_forward(float meters);
@@ -113,16 +113,16 @@ protected:
 	void			update_view_matrix();
 	void			update_frustum();
 
-	Vec3			m_position;
-	Vec3			m_look_at;
-	Vec3			m_up;
+	Vector3			m_position;
+	Vector3			m_look_at;
+	Vector3			m_up;
 
-	Vec2			m_rot_factor;
+	Vector2			m_rot_factor;
 	float			m_angle_x;
 	float			m_angle_y;
 
-	Mat4			m_view;
-	Mat4			m_projection;
+	Matrix4x4			m_view;
+	Matrix4x4			m_projection;
 
 	Frustum			m_frustum;
 

+ 6 - 6
engine/Crown.h

@@ -36,18 +36,18 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Color4.h"
 #include "Interpolation.h"
 #include "Intersection.h"
-#include "Mat3.h"
-#include "Mat4.h"
+#include "Matrix3x3.h"
+#include "Matrix4x4.h"
 #include "MathUtils.h"
 #include "Plane.h"
 #include "Point2.h"
-#include "Quat.h"
+#include "Quaternion.h"
 #include "Random.h"
 #include "Ray.h"
 #include "Triangle.h"
-#include "Vec2.h"
-#include "Vec3.h"
-#include "Vec4.h"
+#include "Vector2.h"
+#include "Vector3.h"
+#include "Vector4.h"
 
 // Core/Bv
 #include "Box.h"

+ 8 - 8
engine/audio/SoundRenderer.h

@@ -40,7 +40,7 @@ typedef 	Id 		SoundId;
 //-----------------------------------------------------------------------------
 class SoundRendererImpl;
 	class SoundResource;
-class Vec3;
+class Vector3;
 
 //-----------------------------------------------------------------------------
 class SoundRenderer
@@ -65,7 +65,7 @@ public:
 
 	/// Sets listener parameters. @a position affects audibility of sounds, 
 	/// @a velocity affects doppler shift and @a orientation affects how a sound could be heard
-	void					set_listener(const Vec3& pos, const Vec3& vel, const Vec3& or_up, const Vec3& or_at) const;
+	void					set_listener(const Vector3& pos, const Vector3& vel, const Vector3& or_up, const Vector3& or_at) const;
 
 	/// Creates a sound of sound 
 	SoundId					create_sound(SoundResource* resource);
@@ -91,13 +91,13 @@ public:
 	void					set_sound_max_distance(SoundId id, const float max_distance);
 
 	/// Sets sound's @a position. It affects sound audibility
-	void					set_sound_position(SoundId id, const Vec3& pos);
+	void					set_sound_position(SoundId id, const Vector3& pos);
 
 	/// Sets sound's @a velocity. It affects doppler shift
-	void					set_sound_velocity(SoundId id, const Vec3& vel);
+	void					set_sound_velocity(SoundId id, const Vector3& vel);
 
 	/// Sets sound's @a direction. It affects how a sound could be heard
-	void					set_sound_direction(SoundId id, const Vec3& dir);
+	void					set_sound_direction(SoundId id, const Vector3& dir);
 
 	/// Sets sound's @a pitch.
 	void					set_sound_pitch(SoundId id, const float pitch);
@@ -115,13 +115,13 @@ public:
 	float					sound_max_distance(SoundId id) const;
 	
 	/// Returns position of @a id
-	Vec3					sound_position(SoundId id) const;
+	Vector3					sound_position(SoundId id) const;
 
 	/// Returns velocity of @a id
-	Vec3					sound_velocity(SoundId id) const;
+	Vector3					sound_velocity(SoundId id) const;
 
 	/// Returns direction of @a id
-	Vec3					sound_direction(SoundId id) const;
+	Vector3					sound_direction(SoundId id) const;
 
 	/// Returns pitch of @a id
 	float					sound_pitch(SoundId id) const;

+ 12 - 12
engine/audio/al/ALRenderer.cpp

@@ -70,10 +70,10 @@ public:
 		AL_CHECK(alDopplerVelocity(343.0f));
 
 		// Default listener
-		Vec3 pos(0.0f, 0.0f, 0.0f);
-		Vec3 vel(0.0f, 0.0f, 0.0f);
-		Vec3 at(0.0f, 0.0f, -1.0f);
-		Vec3 up(0.0f, 1.0f, 0.0f);
+		Vector3 pos(0.0f, 0.0f, 0.0f);
+		Vector3 vel(0.0f, 0.0f, 0.0f);
+		Vector3 at(0.0f, 0.0f, -1.0f);
+		Vector3 up(0.0f, 1.0f, 0.0f);
 
 		set_listener(pos, vel, at, up);		
 	}
@@ -86,7 +86,7 @@ public:
 	}
 
 	//-----------------------------------------------------------------------------
-	void set_listener(const Vec3& pos, const Vec3& vel, const Vec3& or_up, const Vec3& or_at)
+	void set_listener(const Vector3& pos, const Vector3& vel, const Vector3& or_up, const Vector3& or_at)
 	{
 		AL_CHECK(alListener3f(AL_POSITION, pos.x, pos.y, pos.z));
 		AL_CHECK(alListener3f(AL_VELOCITY, vel.x, vel.y, vel.z));
@@ -160,7 +160,7 @@ uint32_t SoundRenderer::num_sounds()
 }
 
 //-----------------------------------------------------------------------------
-void SoundRenderer::set_listener(const Vec3& pos, const Vec3& vel, const Vec3& or_up, const Vec3& or_at) const
+void SoundRenderer::set_listener(const Vector3& pos, const Vector3& vel, const Vector3& or_up, const Vector3& or_at) const
 {
 	m_impl->set_listener(pos, vel, or_up, or_at);
 }
@@ -230,7 +230,7 @@ void SoundRenderer::set_sound_max_distance(SoundId id, const float max_distance)
 }
 
 //-----------------------------------------------------------------------------
-void SoundRenderer::set_sound_position(SoundId id, const Vec3& pos)
+void SoundRenderer::set_sound_position(SoundId id, const Vector3& pos)
 {
 	CE_ASSERT(m_sounds_id_table.has(id), "Sound does not exists");
 
@@ -238,7 +238,7 @@ void SoundRenderer::set_sound_position(SoundId id, const Vec3& pos)
 }
 
 //-----------------------------------------------------------------------------
-void SoundRenderer::set_sound_velocity(SoundId id, const Vec3& vel)
+void SoundRenderer::set_sound_velocity(SoundId id, const Vector3& vel)
 {
 	CE_ASSERT(m_sounds_id_table.has(id), "Sound does not exists");
 
@@ -246,7 +246,7 @@ void SoundRenderer::set_sound_velocity(SoundId id, const Vec3& vel)
 }
 
 //-----------------------------------------------------------------------------
-void SoundRenderer::set_sound_direction(SoundId id, const Vec3& dir)
+void SoundRenderer::set_sound_direction(SoundId id, const Vector3& dir)
 {
 	CE_ASSERT(m_sounds_id_table.has(id), "Sound does not exists");
 
@@ -294,7 +294,7 @@ float SoundRenderer::sound_max_distance(SoundId id) const
 }
 
 //-----------------------------------------------------------------------------
-Vec3 SoundRenderer::sound_position(SoundId id) const
+Vector3 SoundRenderer::sound_position(SoundId id) const
 {
 	CE_ASSERT(m_sounds_id_table.has(id), "Sound does not exists");
 
@@ -302,7 +302,7 @@ Vec3 SoundRenderer::sound_position(SoundId id) const
 }
 
 //-----------------------------------------------------------------------------
-Vec3 SoundRenderer::sound_velocity(SoundId id) const
+Vector3 SoundRenderer::sound_velocity(SoundId id) const
 {
 	CE_ASSERT(m_sounds_id_table.has(id), "Sound does not exists");
 
@@ -310,7 +310,7 @@ Vec3 SoundRenderer::sound_velocity(SoundId id) const
 }
 
 //-----------------------------------------------------------------------------
-Vec3 SoundRenderer::sound_direction(SoundId id) const
+Vector3 SoundRenderer::sound_direction(SoundId id) const
 {
 	CE_ASSERT(m_sounds_id_table.has(id), "Sound does not exists");
 

+ 10 - 10
engine/audio/al/ALRenderer.h

@@ -31,7 +31,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "SoundResource.h"
 #include "OggDecoder.h"
-#include "Vec3.h"
+#include "Vector3.h"
 #include "Log.h"
 
 namespace crown
@@ -204,19 +204,19 @@ public:
 	}
 
 	//-----------------------------------------------------------------------------
-	void set_position(const Vec3& pos)
+	void set_position(const Vector3& pos)
 	{
 		AL_CHECK(alSource3f(m_id, AL_POSITION, pos.x, pos.y, pos.z));
 	}
 
 	//-----------------------------------------------------------------------------
-	void set_velocity(const Vec3& vel)
+	void set_velocity(const Vector3& vel)
 	{
 		AL_CHECK(alSource3f(m_id, AL_VELOCITY, vel.x, vel.y, vel.z));
 	}
 
 	//-----------------------------------------------------------------------------
-	void set_direction(const Vec3& dir)
+	void set_direction(const Vector3& dir)
 	{
 		AL_CHECK(alSource3f(m_id, AL_DIRECTION, dir.x, dir.y, dir.z));
 	}
@@ -260,12 +260,12 @@ public:
 	}
 
 	//-----------------------------------------------------------------------------
-	Vec3 position() const
+	Vector3 position() const
 	{
 		ALfloat tmp[3];
 		alGetSourcefv(m_id, AL_POSITION, tmp);
 
-		Vec3 pos;
+		Vector3 pos;
 		pos.x = tmp[0];
 		pos.y = tmp[1];
 		pos.z = tmp[2];
@@ -274,12 +274,12 @@ public:
 	}
 
 	//-----------------------------------------------------------------------------
-	Vec3 velocity() const
+	Vector3 velocity() const
 	{
 		ALfloat tmp[3];
 		alGetSourcefv(m_id, AL_VELOCITY, tmp);
 
-		Vec3 vel;
+		Vector3 vel;
 		vel.x = tmp[0];
 		vel.y = tmp[1];
 		vel.z = tmp[2];
@@ -288,12 +288,12 @@ public:
 	}
 
 	//-----------------------------------------------------------------------------
-	Vec3 direction() const
+	Vector3 direction() const
 	{
 		ALfloat tmp[3];
 		alGetSourcefv(m_id, AL_DIRECTION, tmp);
 
-		Vec3 dir;
+		Vector3 dir;
 		dir.x = tmp[0];
 		dir.y = tmp[1];
 		dir.z = tmp[2];

+ 11 - 11
engine/audio/sles/SLESRenderer.cpp

@@ -32,7 +32,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Assert.h"
 #include "SoundRenderer.h"
 #include "SLESRenderer.h"
-#include "Vec3.h"
+#include "Vector3.h"
 
 namespace crown
 {
@@ -227,7 +227,7 @@ bool SoundRenderer::sound_playing(SoundId id)
 }
 
 //-----------------------------------------------------------------------------
-void SoundRenderer::set_listener(const Vec3& /*pos*/, const Vec3& /*vel*/, const Vec3& /*or_up*/, const Vec3& /*or_at*/) const
+void SoundRenderer::set_listener(const Vector3& /*pos*/, const Vector3& /*vel*/, const Vector3& /*or_up*/, const Vector3& /*or_at*/) const
 {
 	Log::w("Stub");
 }
@@ -245,19 +245,19 @@ void SoundRenderer::set_sound_max_distance(SoundId /*id*/,  const float /*max_di
 }
 
 //-----------------------------------------------------------------------------
-void SoundRenderer::set_sound_position(SoundId /*id*/, const Vec3& /*pos*/)
+void SoundRenderer::set_sound_position(SoundId /*id*/, const Vector3& /*pos*/)
 {
 	Log::w("Stub");
 }
 
 //-----------------------------------------------------------------------------
-void SoundRenderer::set_sound_velocity(SoundId /*id*/, const Vec3& /*vel*/)
+void SoundRenderer::set_sound_velocity(SoundId /*id*/, const Vector3& /*vel*/)
 {
 	Log::w("Stub");
 }
 
 //-----------------------------------------------------------------------------
-void SoundRenderer::set_sound_direction(SoundId /*id*/, const Vec3& /*dir*/)
+void SoundRenderer::set_sound_direction(SoundId /*id*/, const Vector3& /*dir*/)
 {
 	Log::w("Stub");
 }
@@ -297,27 +297,27 @@ float SoundRenderer::sound_max_distance(SoundId /*id*/) const
 }
 
 //-----------------------------------------------------------------------------
-Vec3 SoundRenderer::sound_position(SoundId /*id*/) const
+Vector3 SoundRenderer::sound_position(SoundId /*id*/) const
 {
 	Log::w("Stub");
 
-	return Vec3::ZERO;
+	return Vector3::ZERO;
 }
 
 //-----------------------------------------------------------------------------
-Vec3 SoundRenderer::sound_velocity(SoundId /*id*/) const
+Vector3 SoundRenderer::sound_velocity(SoundId /*id*/) const
 {
 	Log::w("Stub");
 
-	return Vec3::ZERO;
+	return Vector3::ZERO;
 }
 
 //-----------------------------------------------------------------------------
-Vec3 SoundRenderer::sound_direction(SoundId /*id*/) const
+Vector3 SoundRenderer::sound_direction(SoundId /*id*/) const
 {
 	Log::w("Stub");
 
-	return Vec3::ZERO;
+	return Vector3::ZERO;
 }
 
 //-----------------------------------------------------------------------------

+ 1 - 1
engine/audio/sles/SLESRenderer.h

@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "SoundResource.h"
 #include "OggDecoder.h"
-#include "Vec3.h"
+#include "Vector3.h"
 #include "Log.h"
 
 namespace crown

+ 3 - 3
engine/compilers/mesh/MeshCompiler.cpp

@@ -117,18 +117,18 @@ size_t MeshCompiler::compile_impl(Filesystem& fs, const char* resource_path)
 		MeshVertex v;
 
 		uint16_t p_idx = position_index[i] * 3;
-		v.position = Vec3(position_array[p_idx], position_array[p_idx + 1], position_array[p_idx + 2]);
+		v.position = Vector3(position_array[p_idx], position_array[p_idx + 1], position_array[p_idx + 2]);
 
 		if (m_has_normal)
 		{
 			uint16_t n_idx = normal_index[i] * 3;
-			v.normal = Vec3(normal_array[n_idx], normal_array[n_idx + 1], normal_array[n_idx + 2]);
+			v.normal = Vector3(normal_array[n_idx], normal_array[n_idx + 1], normal_array[n_idx + 2]);
 		}
 
 		if (m_has_texcoord)
 		{
 			uint16_t t_idx = texcoord_index[i] * 2;
-			v.texcoord = Vec2(texcoord_array[t_idx], texcoord_array[t_idx + 1]);
+			v.texcoord = Vector2(texcoord_array[t_idx], texcoord_array[t_idx + 1]);
 		}
 
 

+ 5 - 5
engine/compilers/mesh/MeshCompiler.h

@@ -28,8 +28,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Compiler.h"
 #include "MeshResource.h"
-#include "Vec3.h"
-#include "Vec2.h"
+#include "Vector3.h"
+#include "Vector2.h"
 #include "List.h"
 
 namespace crown
@@ -37,9 +37,9 @@ namespace crown
 
 struct MeshVertex
 {
-	Vec3 position;
-	Vec3 normal;
-	Vec2 texcoord;
+	Vector3 position;
+	Vector3 normal;
+	Vector2 texcoord;
 
 	bool operator==(const MeshVertex& other)
 	{

+ 36 - 36
engine/core/bv/Box.h

@@ -28,8 +28,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Assert.h"
 #include "Types.h"
-#include "Mat4.h"
-#include "Vec3.h"
+#include "Matrix4x4.h"
+#include "Vector3.h"
 #include "Sphere.h"
 
 namespace crown
@@ -46,35 +46,35 @@ public:
 					Box();
 
 	/// Constructs from @a min and @a max.
-					Box(const Vec3& min, const Vec3& max);			
+					Box(const Vector3& min, const Vector3& max);			
 					Box(const Box& box);
 
-	const Vec3&		min() const;
-	const Vec3&		max() const;
-	void			set_min(const Vec3& min);
-	void			set_max(const Vec3& max);
+	const Vector3&		min() const;
+	const Vector3&		max() const;
+	void			set_min(const Vector3& min);
+	void			set_max(const Vector3& max);
 
-	Vec3			center() const;
+	Vector3			center() const;
 	float			radius() const;
 	float			volume() const;
 
 	/// Adds @a count @a points expanding if necessary.
-	void			add_points(const Vec3* points, uint32_t count);
+	void			add_points(const Vector3* points, uint32_t count);
 
 	/// Adds @a count @a boxes expanding if necessay.
 	void			add_boxes(const Box* boxes, uint32_t count);
 
 	/// Returns whether point @a p is contained in the box.
-	bool			contains_point(const Vec3& p) const;
+	bool			contains_point(const Vector3& p) const;
 
 	/// Returns the @a index -th vertex of the box.
-	Vec3			vertex(uint32_t index) const;		
+	Vector3			vertex(uint32_t index) const;		
 
 	/// Returns the box trasformed according to @a mat matrix into @a result.
-	void			transformed(const Mat4& mat, Box& result) const;	
+	void			transformed(const Matrix4x4& mat, Box& result) const;	
 
 	/// Returns the eight vertices of the box.
-	void			to_vertices(Vec3 v[8]) const;	
+	void			to_vertices(Vector3 v[8]) const;	
 
 	/// Returns as a sphere.						
 	Sphere			to_sphere() const;										
@@ -84,8 +84,8 @@ public:
 
 private:
 
-	Vec3			m_min;
-	Vec3			m_max;
+	Vector3			m_min;
+	Vector3			m_max;
 };
 
 //-----------------------------------------------------------------------------
@@ -99,40 +99,40 @@ inline Box::Box(const Box& box) : m_min(box.m_min), m_max(box.m_max)
 }
 
 //-----------------------------------------------------------------------------
-inline Box::Box(const Vec3& min, const Vec3& max) : m_min(min), m_max(max)
+inline Box::Box(const Vector3& min, const Vector3& max) : m_min(min), m_max(max)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline const Vec3& Box::min() const
+inline const Vector3& Box::min() const
 {
 	return m_min;
 }
 
 //-----------------------------------------------------------------------------
-inline void Box::set_min(const Vec3& min)
+inline void Box::set_min(const Vector3& min)
 {
 	m_min = min;
 }
 
 //-----------------------------------------------------------------------------
-inline const Vec3& Box::max() const
+inline const Vector3& Box::max() const
 {
 	return m_max;
 }
 
 //-----------------------------------------------------------------------------
-inline void Box::set_max(const Vec3& max)
+inline void Box::set_max(const Vector3& max)
 {
 	m_max = max;
 }
 
 //-----------------------------------------------------------------------------
-inline void Box::add_points(const Vec3* points, uint32_t count)
+inline void Box::add_points(const Vector3* points, uint32_t count)
 {
 	for (uint32_t i = 0; i < count; i++)
 	{
-		const Vec3& p = points[i];
+		const Vector3& p = points[i];
 
 		if (p.x < m_min.x)
 		{
@@ -206,14 +206,14 @@ inline void Box::add_boxes(const Box* boxes, uint32_t count)
 }
 
 //-----------------------------------------------------------------------------
-inline bool Box::contains_point(const Vec3& p) const
+inline bool Box::contains_point(const Vector3& p) const
 {
 	return (p.x > m_min.x && p.y > m_min.y && p.z > m_min.z &&
 		p.x < m_max.x && p.y < m_max.y && p.z < m_max.z);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Box::center() const
+inline Vector3 Box::center() const
 {
 	return (m_min + m_max) * 0.5;
 }
@@ -225,7 +225,7 @@ inline float Box::radius() const
 }
 
 //-----------------------------------------------------------------------------
-inline void Box::to_vertices(Vec3 v[8]) const
+inline void Box::to_vertices(Vector3 v[8]) const
 {
 	// 7 ---- 6
 	// |      |
@@ -270,35 +270,35 @@ inline void Box::to_vertices(Vec3 v[8]) const
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Box::vertex(uint32_t index) const
+inline Vector3 Box::vertex(uint32_t index) const
 {
 	CE_ASSERT(index < 8, "Index must be < 8");
 
 	switch (index)
 	{
 		case 0:
-			return Vec3(m_min.x, m_min.y, m_min.z);
+			return Vector3(m_min.x, m_min.y, m_min.z);
 		case 1:
-			return Vec3(m_max.x, m_min.y, m_min.z);
+			return Vector3(m_max.x, m_min.y, m_min.z);
 		case 2:
-			return Vec3(m_max.x, m_min.y, m_max.z);
+			return Vector3(m_max.x, m_min.y, m_max.z);
 		case 3:
-			return Vec3(m_min.x, m_min.y, m_max.z);
+			return Vector3(m_min.x, m_min.y, m_max.z);
 		case 4:
-			return Vec3(m_min.x, m_max.y, m_min.z);
+			return Vector3(m_min.x, m_max.y, m_min.z);
 		case 5:
-			return Vec3(m_max.x, m_max.y, m_min.z);
+			return Vector3(m_max.x, m_max.y, m_min.z);
 		case 6:
-			return Vec3(m_max.x, m_max.y, m_max.z);
+			return Vector3(m_max.x, m_max.y, m_max.z);
 		case 7:
-			return Vec3(m_min.x, m_max.y, m_max.z);
+			return Vector3(m_min.x, m_max.y, m_max.z);
 	}
 }
 
 //-----------------------------------------------------------------------------
-inline void Box::transformed(const Mat4& mat, Box& result) const
+inline void Box::transformed(const Matrix4x4& mat, Box& result) const
 {
-	Vec3 vertices[8];
+	Vector3 vertices[8];
 
 	to_vertices(vertices);
 

+ 8 - 8
engine/core/bv/Circle.h

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
-#include "Vec2.h"
+#include "Vector2.h"
 #include "MathUtils.h"
 
 namespace crown
@@ -46,12 +46,12 @@ public:
 					Circle();
 					
 	/// Constructs from @a center and @a radius.
-					Circle(const Vec2& center, float radius);	
+					Circle(const Vector2& center, float radius);	
 					Circle(const Circle& circle);				
 
-	const Vec2&		center() const;							
+	const Vector2&		center() const;							
 	float			radius() const;	
-	void			set_center(const Vec2& center);			
+	void			set_center(const Vector2& center);			
 	void			set_radius(float radius);				
 
 	float			area() const;						
@@ -61,7 +61,7 @@ public:
 
 private:
 
-	Vec2			m_center;
+	Vector2			m_center;
 	float			m_radius;
 };
 
@@ -71,7 +71,7 @@ inline Circle::Circle()
 }
 
 //-----------------------------------------------------------------------------
-inline Circle::Circle(const Vec2& center, float radius) : m_center(center), m_radius(radius)
+inline Circle::Circle(const Vector2& center, float radius) : m_center(center), m_radius(radius)
 {
 }
 
@@ -81,7 +81,7 @@ inline Circle::Circle(const Circle& circle) : m_center(circle.m_center), m_radiu
 }
 
 //-----------------------------------------------------------------------------
-inline const Vec2& Circle::center() const
+inline const Vector2& Circle::center() const
 {
 	return m_center;
 }
@@ -93,7 +93,7 @@ inline float Circle::radius() const
 }
 
 //-----------------------------------------------------------------------------
-inline void Circle::set_center(const Vec2& center)
+inline void Circle::set_center(const Vector2& center)
 {
 	m_center = center;
 }

+ 6 - 6
engine/core/bv/Frustum.cpp

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Frustum.h"
 #include "Types.h"
 #include "Intersection.h"
-#include "Mat4.h"
+#include "Matrix4x4.h"
 
 namespace crown
 {
@@ -49,7 +49,7 @@ Frustum::Frustum(const Frustum& frustum)
 }
 
 //-----------------------------------------------------------------------------
-bool Frustum::contains_point(const Vec3& point) const
+bool Frustum::contains_point(const Vector3& point) const
 {
 	if (m_planes[FP_LEFT].distance_to_point(point) < 0.0) return false;
 	if (m_planes[FP_RIGHT].distance_to_point(point) < 0.0) return false;
@@ -62,7 +62,7 @@ bool Frustum::contains_point(const Vec3& point) const
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Frustum::vertex(uint32_t index) const
+Vector3 Frustum::vertex(uint32_t index) const
 {
 	CE_ASSERT(index < 8, "Index must be < 8");
 
@@ -75,7 +75,7 @@ Vec3 Frustum::vertex(uint32_t index) const
 	// 6 = Far top right
 	// 7 = Far top left
 
-	Vec3 ip;
+	Vector3 ip;
 
 	switch (index)
 	{
@@ -103,7 +103,7 @@ Vec3 Frustum::vertex(uint32_t index) const
 }
 
 //-----------------------------------------------------------------------------
-void Frustum::from_matrix(const Mat4& m)
+void Frustum::from_matrix(const Matrix4x4& m)
 {
 	// Left plane
 	m_planes[FP_LEFT].n.x		= m.m[3] + m.m[0];
@@ -155,7 +155,7 @@ Box Frustum::to_box() const
 	Box tmp;
 	tmp.zero();
 
-	Vec3 vertices[8];
+	Vector3 vertices[8];
 	vertices[0] = vertex(0);
 	vertices[1] = vertex(1);
 	vertices[2] = vertex(2);

+ 5 - 5
engine/core/bv/Frustum.h

@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Types.h"
 #include "Box.h"
-#include "Vec3.h"
+#include "Vector3.h"
 #include "Plane.h"
 
 namespace crown
@@ -44,7 +44,7 @@ enum FrustumPlane
 	FP_FAR		= 5
 };
 
-class Mat4;
+class Matrix4x4;
 
 class Frustum
 {
@@ -55,13 +55,13 @@ public:
 				Frustum(const Frustum& frustum);
 
 	/// Returns whether @a point is contained into the frustum.
-	bool		contains_point(const Vec3& point) const;	
+	bool		contains_point(const Vector3& point) const;	
 
 	/// Returns one of the eight frustum's corners.
-	Vec3		vertex(uint32_t index) const;			
+	Vector3		vertex(uint32_t index) const;			
 
 	/// Builds the view frustum according to the matrix @a m.
-	void		from_matrix(const Mat4& m);				
+	void		from_matrix(const Matrix4x4& m);				
 
 	/// Returns a Box containing the frustum volume.
 	Box			to_box() const;							

+ 11 - 11
engine/core/bv/Rect.cpp

@@ -33,7 +33,7 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-bool Rect::contains_point(const Vec2& point) const
+bool Rect::contains_point(const Vector2& point) const
 {
 	return (point.x >= m_min.x && point.y >= m_min.y &&
 			point.x <= m_max.x && point.y <= m_max.y);
@@ -48,7 +48,7 @@ bool Rect::intersects_rect(const Rect& rect) const
 }
 
 //-----------------------------------------------------------------------------
-void Rect::set_from_center_and_dimensions(Vec2 center, float width, float height)
+void Rect::set_from_center_and_dimensions(Vector2 center, float width, float height)
 {
 	m_min.x = (float)(center.x - width  / 2.0);
 	m_min.y = (float)(center.y - height / 2.0);
@@ -57,7 +57,7 @@ void Rect::set_from_center_and_dimensions(Vec2 center, float width, float height
 }
 
 //-----------------------------------------------------------------------------
-void Rect::vertices(Vec2 v[4]) const
+void Rect::vertices(Vector2 v[4]) const
 {
 	// 3 ---- 2
 	// |      |
@@ -74,27 +74,27 @@ void Rect::vertices(Vec2 v[4]) const
 }
 
 //-----------------------------------------------------------------------------
-Vec2 Rect::vertex(uint32_t index) const
+Vector2 Rect::vertex(uint32_t index) const
 {
 	CE_ASSERT(index < 4, "Index must be < 4");
 
 	switch (index)
 	{
 		case 0:
-			return Vec2(m_min.x, m_min.y);
+			return Vector2(m_min.x, m_min.y);
 		case 1:
-			return Vec2(m_max.x, m_min.y);
+			return Vector2(m_max.x, m_min.y);
 		case 2:
-			return Vec2(m_max.x, m_max.y);
+			return Vector2(m_max.x, m_max.y);
 		case 3:
-			return Vec2(m_min.x, m_max.y);
+			return Vector2(m_min.x, m_max.y);
 	}
 
-	return Vec2::ZERO;
+	return Vector2::ZERO;
 }
 
 //-----------------------------------------------------------------------------
-Vec2 Rect::center() const
+Vector2 Rect::center() const
 {
 	return (m_min + m_max) * 0.5;
 }
@@ -112,7 +112,7 @@ float Rect::area() const
 }
 
 //-----------------------------------------------------------------------------
-Vec2 Rect::size() const
+Vector2 Rect::size() const
 {
 	return (m_max - m_min);
 }

+ 19 - 19
engine/core/bv/Rect.h

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
-#include "Vec2.h"
+#include "Vector2.h"
 
 namespace crown
 {
@@ -45,35 +45,35 @@ public:
 					Rect();		
 
 	/// Constructs from  @a min and @a max
-					Rect(const Vec2& min, const Vec2& max);		
+					Rect(const Vector2& min, const Vector2& max);		
 					Rect(const Rect& rect);	
 
-	const Vec2&		min() const;					
-	const Vec2&		max() const;					
-	void			set_min(const Vec2& min);				
-	void			set_max(const Vec2& max);			
+	const Vector2&		min() const;					
+	const Vector2&		max() const;					
+	void			set_min(const Vector2& min);				
+	void			set_max(const Vector2& max);			
 
-	Vec2			center() const;					
+	Vector2			center() const;					
 	float			radius() const;					
 	float			area() const;		
 
 	/// Returns the diagonal of the rect.
-	Vec2			size() const;						
+	Vector2			size() const;						
 
 	/// Returns whether @a point point is contained into the rect.
-	bool			contains_point(const Vec2& point) const;
+	bool			contains_point(const Vector2& point) const;
 
 	/// Returns whether the rect intersects @a r.
 	bool			intersects_rect(const Rect& rect) const;	
 
 	/// Sets the Rect from a @a center and a @a width - @a height
-	void			set_from_center_and_dimensions(Vec2 center, float width, float height);	
+	void			set_from_center_and_dimensions(Vector2 center, float width, float height);	
 
 	/// Returns the four vertices of the rect.
-	void			vertices(Vec2 v[4]) const;
+	void			vertices(Vector2 v[4]) const;
 
 	/// Returns the @a index -th vetex of the rect.
-	Vec2			vertex(uint32_t index) const;			
+	Vector2			vertex(uint32_t index) const;			
 
 	/// Returns the equivalent circle.
 	Circle			to_circle() const;
@@ -83,8 +83,8 @@ public:
 
 private:
 
-	Vec2			m_min;
-	Vec2			m_max;
+	Vector2			m_min;
+	Vector2			m_max;
 };
 
 //-----------------------------------------------------------------------------
@@ -93,7 +93,7 @@ inline Rect::Rect()
 }
 
 //-----------------------------------------------------------------------------
-inline Rect::Rect(const Vec2& min, const Vec2& max) : m_min(min), m_max(max)
+inline Rect::Rect(const Vector2& min, const Vector2& max) : m_min(min), m_max(max)
 {
 }
 
@@ -103,25 +103,25 @@ inline Rect::Rect(const Rect& rect) : m_min(rect.m_min), m_max(rect.m_max)
 }
 
 //-----------------------------------------------------------------------------
-inline const Vec2& Rect::min() const
+inline const Vector2& Rect::min() const
 {
 	return m_min;
 }
 
 //-----------------------------------------------------------------------------
-inline const Vec2& Rect::max() const
+inline const Vector2& Rect::max() const
 {
 	return m_max;
 }
 
 //-----------------------------------------------------------------------------
-inline void Rect::set_min(const Vec2& min)
+inline void Rect::set_min(const Vector2& min)
 {
 	m_min = min;
 }
 
 //-----------------------------------------------------------------------------
-inline void Rect::set_max(const Vec2& max)
+inline void Rect::set_max(const Vector2& max)
 {
 	m_max = max;
 }

+ 13 - 13
engine/core/bv/Sphere.h

@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Types.h"
 #include "MathUtils.h"
-#include "Vec3.h"
+#include "Vector3.h"
 
 namespace crown
 {
@@ -45,28 +45,28 @@ public:
 					Sphere();
 
 	/// Constructs from @a center and @a radius.
-					Sphere(const Vec3& center, float radius);
+					Sphere(const Vector3& center, float radius);
 					Sphere(const Sphere& a);
 
-	const Vec3&		center() const;		
+	const Vector3&		center() const;		
 	float			radius() const;	
 	float			volume() const;	
 
-	void			set_center(const Vec3& center);
+	void			set_center(const Vector3& center);
 	void			set_radius(float radius);
 
 	/// Adds @a count @a points to the sphere expanding if necessary.
-	void			add_points(const Vec3* points, uint32_t count);	
+	void			add_points(const Vector3* points, uint32_t count);	
 
 	/// Adds @a count @a spheres expanding if necessary.
 	void			add_spheres(const Sphere* spheres, uint32_t count);	
 
 	/// Returns whether point @a p is contained into the sphere.
-	bool			contains_point(const Vec3& p) const;		
+	bool			contains_point(const Vector3& p) const;		
 
 private:
 
-	Vec3			m_center;
+	Vector3			m_center;
 	float			m_radius;
 };
 
@@ -76,7 +76,7 @@ inline Sphere::Sphere()
 }
 
 //-----------------------------------------------------------------------------
-inline Sphere::Sphere(const Vec3& center, float radius) : m_center(center), m_radius(radius)
+inline Sphere::Sphere(const Vector3& center, float radius) : m_center(center), m_radius(radius)
 {
 }
 
@@ -86,7 +86,7 @@ inline Sphere::Sphere(const Sphere& a) : m_center(a.m_center), m_radius(a.m_radi
 }
 
 //-----------------------------------------------------------------------------
-inline const Vec3& Sphere::center() const
+inline const Vector3& Sphere::center() const
 {
 	return m_center;
 }
@@ -104,7 +104,7 @@ inline float Sphere::volume() const
 }
 
 //-----------------------------------------------------------------------------
-inline void Sphere::set_center(const Vec3& center)
+inline void Sphere::set_center(const Vector3& center)
 {
 	m_center = center;
 }
@@ -116,11 +116,11 @@ inline void Sphere::set_radius(float radius)
 }
 
 //-----------------------------------------------------------------------------
-inline void Sphere::add_points(const Vec3* points, uint32_t count)
+inline void Sphere::add_points(const Vector3* points, uint32_t count)
 {
 	for (uint32_t i = 0; i < count; i++)
 	{
-		const Vec3& p = points[i];
+		const Vector3& p = points[i];
 
 		float dist = (p - m_center).squared_length();
 
@@ -151,7 +151,7 @@ inline void Sphere::add_spheres(const Sphere* spheres, uint32_t count)
 }
 
 //-----------------------------------------------------------------------------
-inline bool Sphere::contains_point(const Vec3& p) const
+inline bool Sphere::contains_point(const Vector3& p) const
 {
 	float dist = (p - m_center).squared_length();
 	return (dist < m_radius * m_radius);

+ 48 - 48
engine/core/math/Intersection.h

@@ -82,29 +82,29 @@ class Intersection
 {
 public:
 
-	static bool test_ray_plane(const Ray& r, const Plane& p, float& distance, Vec3& inttersectionPoint_t);
-	static bool test_ray_sphere(const Ray& r, const Sphere& s, float& distance, Vec3& intersectionPoint);
-	static bool test_ray_box(const Ray& r, const Box& b, float& distance, Vec3& intersectionPoint);
-	static bool test_ray_triangle(const Ray& r, const Triangle& t, float& distance, Vec3& intersectionPoint);
+	static bool test_ray_plane(const Ray& r, const Plane& p, float& distance, Vector3& inttersectionPoint_t);
+	static bool test_ray_sphere(const Ray& r, const Sphere& s, float& distance, Vector3& intersectionPoint);
+	static bool test_ray_box(const Ray& r, const Box& b, float& distance, Vector3& intersectionPoint);
+	static bool test_ray_triangle(const Ray& r, const Triangle& t, float& distance, Vector3& intersectionPoint);
 
-	static bool test_plane_3(const Plane& p1, const Plane& p2, const Plane& p3, Vec3& ip);
+	static bool test_plane_3(const Plane& p1, const Plane& p2, const Plane& p3, Vector3& ip);
 
 	static bool test_static_sphere_plane(const Sphere& s, const Plane& p);
 	static bool test_static_sphere_sphere(const Sphere& a, const Sphere& b);
-	static bool test_dynamic_sphere_plane(const Sphere& s, const Vec3& d, const Plane& p, float& it, Vec3& intersectionPoint);
-	static bool test_dynamic_sphere_triangle(const Sphere& s, const Vec3& d, const Triangle& tri, float& it, Vec3& intersectionPoint);
-	static bool test_dynamic_sphere_sphere(const Sphere& s1, const Vec3& d1, const Sphere& s2, const Vec3& d2, float& it, Vec3& intersectionPoint);
+	static bool test_dynamic_sphere_plane(const Sphere& s, const Vector3& d, const Plane& p, float& it, Vector3& intersectionPoint);
+	static bool test_dynamic_sphere_triangle(const Sphere& s, const Vector3& d, const Triangle& tri, float& it, Vector3& intersectionPoint);
+	static bool test_dynamic_sphere_sphere(const Sphere& s1, const Vector3& d1, const Sphere& s2, const Vector3& d2, float& it, Vector3& intersectionPoint);
 
 	static bool test_static_box_box(const Box& b1, const Box& b2);
-	static bool test_dynamic_box_box(const Box& b1, const Vec3& v1, const Box& b2, const Vec3& v2, float& it);
+	static bool test_dynamic_box_box(const Box& b1, const Vector3& v1, const Box& b2, const Vector3& v2, float& it);
 
 	static bool test_frustum_sphere(const Frustum& f, const Sphere& s);
 	static bool test_frustum_box(const Frustum& f, const Box& box);
 
-	static bool test_circle_circle(const Circle& c1, const Circle& c2, Vec2& penetration);
-	static bool test_dynamic_circle_circle(const Circle& c1, const Vec2& d1, const Circle& c2, const Vec2& d2, float& it);
-	static bool test_rect_rect(const Rect& r1, const Rect& r2, Vec2& penetration);
-	static bool test_circle_rect(const Circle& c1, const Rect& r2, Vec2& penetration);
+	static bool test_circle_circle(const Circle& c1, const Circle& c2, Vector2& penetration);
+	static bool test_dynamic_circle_circle(const Circle& c1, const Vector2& d1, const Circle& c2, const Vector2& d2, float& it);
+	static bool test_rect_rect(const Rect& r1, const Rect& r2, Vector2& penetration);
+	static bool test_circle_rect(const Circle& c1, const Rect& r2, Vector2& penetration);
 
 private:
 
@@ -113,7 +113,7 @@ private:
 };
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_ray_plane(const Ray& r, const Plane& p, float& distance, Vec3& intersectionPoint)
+inline bool Intersection::test_ray_plane(const Ray& r, const Plane& p, float& distance, Vector3& intersectionPoint)
 {
 	float nd = r.direction().dot(p.n);
 	float orpn = r.origin().dot(p.n);
@@ -133,9 +133,9 @@ inline bool Intersection::test_ray_plane(const Ray& r, const Plane& p, float& di
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_ray_sphere(const Ray& r, const Sphere& s, float& distance, Vec3& intersectionPoint)
+inline bool Intersection::test_ray_sphere(const Ray& r, const Sphere& s, float& distance, Vector3& intersectionPoint)
 {
-	Vec3 v = s.center() - r.origin();
+	Vector3 v = s.center() - r.origin();
 	float b = v.dot(r.direction());
 	float det = (s.radius() * s.radius()) - v.dot(v) + (b * b);
 
@@ -151,7 +151,7 @@ inline bool Intersection::test_ray_sphere(const Ray& r, const Sphere& s, float&
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_ray_box(const Ray& r, const Box& b, float& /*distance*/, Vec3& /*intersectionPoint*/)
+inline bool Intersection::test_ray_box(const Ray& r, const Box& b, float& /*distance*/, Vector3& /*intersectionPoint*/)
 {
 	if (r.origin().x < b.min().x)
 	{
@@ -208,7 +208,7 @@ inline bool Intersection::test_ray_box(const Ray& r, const Box& b, float& /*dist
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_ray_triangle(const Ray& r, const Triangle& t, float& distance, Vec3& intersectionPoint)
+inline bool Intersection::test_ray_triangle(const Ray& r, const Triangle& t, float& distance, Vector3& intersectionPoint)
 {
 	if (Intersection::test_ray_plane(r, t.to_plane(), distance, intersectionPoint))
 	{
@@ -222,11 +222,11 @@ inline bool Intersection::test_ray_triangle(const Ray& r, const Triangle& t, flo
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_plane_3(const Plane& p1, const Plane& p2, const Plane& p3, Vec3& ip)
+inline bool Intersection::test_plane_3(const Plane& p1, const Plane& p2, const Plane& p3, Vector3& ip)
 {
-	const Vec3& n1 = p1.n;
-	const Vec3& n2 = p2.n;
-	const Vec3& n3 = p3.n;
+	const Vector3& n1 = p1.n;
+	const Vector3& n2 = p2.n;
+	const Vector3& n3 = p3.n;
 
 	float den = -n1.cross(n2).dot(n3);
 
@@ -235,7 +235,7 @@ inline bool Intersection::test_plane_3(const Plane& p1, const Plane& p2, const P
 		return false;
 	}
 
-	Vec3 res = p1.d * n2.cross(n3) + p2.d * n3.cross(n1) + p3.d * n1.cross(n2);
+	Vector3 res = p1.d * n2.cross(n3) + p2.d * n3.cross(n1) + p3.d * n1.cross(n2);
 	ip = res / den;
 
 	return true;
@@ -260,9 +260,9 @@ inline bool Intersection::test_static_sphere_sphere(const Sphere& a, const Spher
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_dynamic_sphere_plane(const Sphere& s, const Vec3& d, const Plane& p, float& it, Vec3& intersectionPoint)
+inline bool Intersection::test_dynamic_sphere_plane(const Sphere& s, const Vector3& d, const Plane& p, float& it, Vector3& intersectionPoint)
 {
-	const Vec3& sphereCenter = s.center();
+	const Vector3& sphereCenter = s.center();
 	const float sphereRadius = s.radius();
 
 	float t0;	// Time at which the sphere int32_tersects the plane remaining at the front side of the plane
@@ -308,7 +308,7 @@ inline bool Intersection::test_dynamic_sphere_plane(const Sphere& s, const Vec3&
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Vec3& d, const Triangle& tri, float& it, Vec3& intersectionPoint)
+inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Vector3& d, const Triangle& tri, float& it, Vector3& intersectionPoint)
 {
 	Plane triPlane = tri.to_plane();
 
@@ -370,8 +370,8 @@ inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Ve
 	}
 
 	// Check for collisions against the edges
-	Vec3 edge;
-	Vec3 centerToVertex;
+	Vector3 edge;
+	Vector3 centerToVertex;
 	float edgeDotVelocity;
 	float edgeDotCenterToVertex;
 	float edgeSquaredLength;
@@ -458,17 +458,17 @@ inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Ve
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_dynamic_sphere_sphere(const Sphere& s1, const Vec3& d1, const Sphere& s2, const Vec3& d2, float& it, Vec3& /*intersectionPoint*/)
+inline bool Intersection::test_dynamic_sphere_sphere(const Sphere& s1, const Vector3& d1, const Sphere& s2, const Vector3& d2, float& it, Vector3& /*intersectionPoint*/)
 {
 	// s1 == static sphere
 	// s2 == moving sphere
-	Vec3 d = d2 - d1;
+	Vector3 d = d2 - d1;
 	d.normalize();
 
-	const Vec3& cs = s1.center();
-	const Vec3& cm = s2.center();
+	const Vector3& cs = s1.center();
+	const Vector3& cm = s2.center();
 
-	Vec3 e = cs - cm;
+	Vector3 e = cs - cm;
 	float r = s1.radius() + s2.radius();
 
 	// If ||e|| < r, int32_tersection occurs at t = 0
@@ -523,16 +523,16 @@ inline bool Intersection::test_static_box_box(const Box& b1, const Box& b2)
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_dynamic_box_box(const Box& b1, const Vec3& v1, const Box& b2, const Vec3& v2, float& it)
+inline bool Intersection::test_dynamic_box_box(const Box& b1, const Vector3& v1, const Box& b2, const Vector3& v2, float& it)
 {
 	// b1 == static box
 	// b2 == moving box
-	Vec3 d = v2 - v1;
+	Vector3 d = v2 - v1;
 
 	// Start time of int32_tersection aint64_t each axis
-	Vec3 tEnterXYZ(0.0, 0.0, 0.0);
+	Vector3 tEnterXYZ(0.0, 0.0, 0.0);
 	// Stop time of int32_tersection aint64_t each axis
-	Vec3 tLeaveXYZ(1.0, 1.0, 1.0);
+	Vector3 tLeaveXYZ(1.0, 1.0, 1.0);
 
 	// If the resulting displacement equals zero, then fallback to static int32_tersection test
 	if (math::equals(d.x, (float)0.0))
@@ -653,9 +653,9 @@ inline bool Intersection::test_frustum_box(const Frustum& f, const Box& b)
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_circle_circle(const Circle& c1, const Circle& c2, Vec2& penetration)
+inline bool Intersection::test_circle_circle(const Circle& c1, const Circle& c2, Vector2& penetration)
 {
-	Vec2 distance = c1.center() - c2.center();
+	Vector2 distance = c1.center() - c2.center();
 	float distanceLen2 = distance.squared_length();
 	float radiusSum = c1.radius() + c2.radius();
 	if (distanceLen2 > radiusSum*radiusSum)
@@ -665,7 +665,7 @@ inline bool Intersection::test_circle_circle(const Circle& c1, const Circle& c2,
 
 	if (distanceLen2 < 0.001)
 	{
-		penetration = Vec2(c1.radius(), 0.0);
+		penetration = Vector2(c1.radius(), 0.0);
 	}
 	else
 	{
@@ -676,17 +676,17 @@ inline bool Intersection::test_circle_circle(const Circle& c1, const Circle& c2,
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_dynamic_circle_circle(const Circle& c1, const Vec2& d1, const Circle& c2, const Vec2& d2, float& it)
+inline bool Intersection::test_dynamic_circle_circle(const Circle& c1, const Vector2& d1, const Circle& c2, const Vector2& d2, float& it)
 {
 	// c1 == static circle
 	// c2 == moving circle
-	Vec2 d = d2 - d1;
+	Vector2 d = d2 - d1;
 	d.normalize();
 
-	const Vec2& cs = c1.center();
-	const Vec2& cm = c2.center();
+	const Vector2& cs = c1.center();
+	const Vector2& cm = c2.center();
 
-	Vec2 e = cs - cm;
+	Vector2 e = cs - cm;
 	float r = c1.radius() + c2.radius();
 
 	// If ||e|| < r, int32_tersection occurs at t = 0
@@ -720,7 +720,7 @@ inline bool Intersection::test_dynamic_circle_circle(const Circle& c1, const Vec
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_rect_rect(const Rect& r1, const Rect& r2, Vec2& penetration)
+inline bool Intersection::test_rect_rect(const Rect& r1, const Rect& r2, Vector2& penetration)
 {
 	//x
 	float min1MinusMax2 = r1.min().x - r2.max().x;
@@ -777,7 +777,7 @@ inline bool Intersection::test_rect_rect(const Rect& r1, const Rect& r2, Vec2& p
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_circle_rect(const Circle& c1, const Rect& r2, Vec2& penetration)
+inline bool Intersection::test_circle_rect(const Circle& c1, const Rect& r2, Vector2& penetration)
 {
 	bool circleIsAtRight;
 	if (c1.center().x > (r2.min().x + r2.max().x) / 2)
@@ -828,7 +828,7 @@ inline bool Intersection::test_circle_rect(const Circle& c1, const Rect& r2, Vec
 	//}
 	else
 	{
-		penetration += Vec2(c1.radius(), c1.radius());
+		penetration += Vector2(c1.radius(), c1.radius());
 		float len = math::sqrt(penetration.squared_length());
 		if (len > c1.radius())
 		{

+ 63 - 63
engine/core/math/Mat3.cpp → engine/core/math/Matrix3x3.cpp

@@ -25,25 +25,25 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "Assert.h"
-#include "Mat3.h"
+#include "Matrix3x3.h"
 #include "Types.h"
-#include "Mat4.h"
+#include "Matrix4x4.h"
 #include "MathUtils.h"
-#include "Quat.h"
-#include "Vec3.h"
+#include "Quaternion.h"
+#include "Vector3.h"
 
 namespace crown
 {
 
-const Mat3 Mat3::IDENTITY = Mat3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
+const Matrix3x3 Matrix3x3::IDENTITY = Matrix3x3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
 
 //-----------------------------------------------------------------------------
-Mat3::Mat3()
+Matrix3x3::Matrix3x3()
 {
 }
 
 //-----------------------------------------------------------------------------
-Mat3::Mat3(float r1c1, float r2c1, float r3c1, float r1c2, float r2c2, float r3c2,
+Matrix3x3::Matrix3x3(float r1c1, float r2c1, float r3c1, float r1c2, float r2c2, float r3c2,
 	float r1c3, float r2c3, float r3c3)
 {
 	m[0] = r1c1;
@@ -58,7 +58,7 @@ Mat3::Mat3(float r1c1, float r2c1, float r3c1, float r1c2, float r2c2, float r3c
 }
 
 //-----------------------------------------------------------------------------
-Mat3::Mat3(const float v[9])
+Matrix3x3::Matrix3x3(const float v[9])
 {
 	m[0] = v[0];
 	m[1] = v[1];
@@ -72,7 +72,7 @@ Mat3::Mat3(const float v[9])
 }
 
 //-----------------------------------------------------------------------------
-Mat3::Mat3(const Mat3& a)
+Matrix3x3::Matrix3x3(const Matrix3x3& a)
 {
 	m[0] = a.m[0];
 	m[1] = a.m[1];
@@ -86,7 +86,7 @@ Mat3::Mat3(const Mat3& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::operator=(const Mat3& a)
+Matrix3x3& Matrix3x3::operator=(const Matrix3x3& a)
 {
 	m[0] = a.m[0];
 	m[1] = a.m[1];
@@ -102,7 +102,7 @@ Mat3& Mat3::operator=(const Mat3& a)
 }
 
 //-----------------------------------------------------------------------------
-float Mat3::operator[](uint32_t i) const
+float Matrix3x3::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 9, "Index must be < 9");
 
@@ -110,7 +110,7 @@ float Mat3::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-float& Mat3::operator[](uint32_t i)
+float& Matrix3x3::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 9, "Index must be < 9");
 
@@ -118,7 +118,7 @@ float& Mat3::operator[](uint32_t i)
 }
 
 //-----------------------------------------------------------------------------
-float Mat3::operator()(uint32_t row, uint32_t column) const
+float Matrix3x3::operator()(uint32_t row, uint32_t column) const
 {
 	CE_ASSERT(row < 3 && column < 3, "Row and column must be < 3");
 
@@ -126,9 +126,9 @@ float Mat3::operator()(uint32_t row, uint32_t column) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat3::operator+(const Mat3& a) const
+Matrix3x3 Matrix3x3::operator+(const Matrix3x3& a) const
 {
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	tmp.m[0] = m[0] + a.m[0];
 	tmp.m[1] = m[1] + a.m[1];
@@ -144,7 +144,7 @@ Mat3 Mat3::operator+(const Mat3& a) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::operator+=(const Mat3& a)
+Matrix3x3& Matrix3x3::operator+=(const Matrix3x3& a)
 {
 	m[0] = m[0] + a.m[0];
 	m[1] = m[1] + a.m[1];
@@ -160,9 +160,9 @@ Mat3& Mat3::operator+=(const Mat3& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat3::operator-(const Mat3& a) const
+Matrix3x3 Matrix3x3::operator-(const Matrix3x3& a) const
 {
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	tmp.m[0] = m[0] - a.m[0];
 	tmp.m[1] = m[1] - a.m[1];
@@ -178,7 +178,7 @@ Mat3 Mat3::operator-(const Mat3& a) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::operator-=(const Mat3& a)
+Matrix3x3& Matrix3x3::operator-=(const Matrix3x3& a)
 {
 	m[0] = m[0] - a.m[0];
 	m[1] = m[1] - a.m[1];
@@ -194,9 +194,9 @@ Mat3& Mat3::operator-=(const Mat3& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat3::operator*(float k) const
+Matrix3x3 Matrix3x3::operator*(float k) const
 {
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	tmp.m[0] = m[0] * k;
 	tmp.m[1] = m[1] * k;
@@ -212,7 +212,7 @@ Mat3 Mat3::operator*(float k) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::operator*=(float k)
+Matrix3x3& Matrix3x3::operator*=(float k)
 {
 	m[0] *= k;
 	m[1] *= k;
@@ -228,9 +228,9 @@ Mat3& Mat3::operator*=(float k)
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat3::operator/(float k) const
+Matrix3x3 Matrix3x3::operator/(float k) const
 {
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	k = (float)1.0 / k;
 
@@ -248,7 +248,7 @@ Mat3 Mat3::operator/(float k) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::operator/=(float k)
+Matrix3x3& Matrix3x3::operator/=(float k)
 {
 	k = (float)1.0 / k;
 
@@ -266,9 +266,9 @@ Mat3& Mat3::operator/=(float k)
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat3::operator*(const Vec3& v) const
+Vector3 Matrix3x3::operator*(const Vector3& v) const
 {
-	Vec3 tmp;
+	Vector3 tmp;
 
 	tmp.x = m[0] * v.x + m[3] * v.y + m[6] * v.z;
 	tmp.y = m[1] * v.x + m[4] * v.y + m[7] * v.z;
@@ -278,9 +278,9 @@ Vec3 Mat3::operator*(const Vec3& v) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat3::operator*(const Mat3& a) const
+Matrix3x3 Matrix3x3::operator*(const Matrix3x3& a) const
 {
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	tmp.m[0] = m[0] * a.m[0] + m[3] * a.m[1] + m[6] * a.m[2];
 	tmp.m[1] = m[1] * a.m[0] + m[4] * a.m[1] + m[7] * a.m[2];
@@ -298,9 +298,9 @@ Mat3 Mat3::operator*(const Mat3& a) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::operator*=(const Mat3& a)
+Matrix3x3& Matrix3x3::operator*=(const Matrix3x3& a)
 {
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	tmp.m[0] = m[0] * a.m[0] + m[3] * a.m[1] + m[6] * a.m[2];
 	tmp.m[1] = m[1] * a.m[0] + m[4] * a.m[1] + m[7] * a.m[2];
@@ -320,13 +320,13 @@ Mat3& Mat3::operator*=(const Mat3& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat3 operator*(float k, const Mat3& a)
+Matrix3x3 operator*(float k, const Matrix3x3& a)
 {
 	return a * k;
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::build_rotation_x(float radians)
+void Matrix3x3::build_rotation_x(float radians)
 {
 	m[0] = 1.0;
 	m[1] = 0.0;
@@ -340,7 +340,7 @@ void Mat3::build_rotation_x(float radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::build_rotation_y(float radians)
+void Matrix3x3::build_rotation_y(float radians)
 {
 	m[0] = math::cos(radians);
 	m[1] = 0.0;
@@ -354,7 +354,7 @@ void Mat3::build_rotation_y(float radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::build_rotation_z(float radians)
+void Matrix3x3::build_rotation_z(float radians)
 {
 	m[0] = math::cos(radians);
 	m[1] = math::sin(radians);
@@ -368,7 +368,7 @@ void Mat3::build_rotation_z(float radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::build_rotation(const Vec3& n, float radians)
+void Matrix3x3::build_rotation(const Vector3& n, float radians)
 {
 	float a = (float)1.0 - math::cos(radians);
 	float sin_a = math::sin(radians);
@@ -386,7 +386,7 @@ void Mat3::build_rotation(const Vec3& n, float radians)
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::transpose()
+Matrix3x3& Matrix3x3::transpose()
 {
 	float tmp;
 
@@ -406,9 +406,9 @@ Mat3& Mat3::transpose()
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat3::get_transposed() const
+Matrix3x3 Matrix3x3::get_transposed() const
 {
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	tmp.m[0] = m[0];
 	tmp.m[1] = m[3];
@@ -424,7 +424,7 @@ Mat3 Mat3::get_transposed() const
 }
 
 //-----------------------------------------------------------------------------
-float Mat3::get_determinant() const
+float Matrix3x3::get_determinant() const
 {
 	float det;
 
@@ -436,9 +436,9 @@ float Mat3::get_determinant() const
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::invert()
+Matrix3x3& Matrix3x3::invert()
 {
-	Mat3 mat;
+	Matrix3x3 mat;
 	float det;
 
 	mat.m[0] = (m[4] * m[8] - m[7] * m[5]);
@@ -469,40 +469,40 @@ Mat3& Mat3::invert()
 }
 
 //-----------------------------------------------------------------------------
-inline Mat3 Mat3::get_inverted() const
+inline Matrix3x3 Matrix3x3::get_inverted() const
 {
-	Mat3 tmp(*this);
+	Matrix3x3 tmp(*this);
 
 	return tmp.invert();
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::load_identity()
+void Matrix3x3::load_identity()
 {
 	m[0] = m[4] = m[8] = 1.0;
 	m[1] = m[2] = m[3] = m[5] = m[6] = m[7] = 0.0;
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat3::x() const
+Vector3 Matrix3x3::x() const
 {
-	return Vec3(m[0], m[1], m[2]);
+	return Vector3(m[0], m[1], m[2]);
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat3::y() const
+Vector3 Matrix3x3::y() const
 {
-	return Vec3(m[3], m[4], m[5]);
+	return Vector3(m[3], m[4], m[5]);
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat3::z() const
+Vector3 Matrix3x3::z() const
 {
-	return Vec3(m[6], m[7], m[8]);
+	return Vector3(m[6], m[7], m[8]);
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::set_x(const Vec3& x)
+void Matrix3x3::set_x(const Vector3& x)
 {
 	m[0] = x.x;
 	m[1] = x.y;
@@ -510,7 +510,7 @@ void Mat3::set_x(const Vec3& x)
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::set_y(const Vec3& y)
+void Matrix3x3::set_y(const Vector3& y)
 {
 	m[3] = y.x;
 	m[4] = y.y;
@@ -518,7 +518,7 @@ void Mat3::set_y(const Vec3& y)
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::set_z(const Vec3& z)
+void Matrix3x3::set_z(const Vector3& z)
 {
 	m[6] = z.x;
 	m[7] = z.y;
@@ -526,9 +526,9 @@ void Mat3::set_z(const Vec3& z)
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat3::get_scale() const
+Vector3 Matrix3x3::get_scale() const
 {
-	Vec3 tmp;
+	Vector3 tmp;
 
 	tmp.x = m[0];
 	tmp.y = m[4];
@@ -538,7 +538,7 @@ Vec3 Mat3::get_scale() const
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::set_scale(const Vec3& scale)
+void Matrix3x3::set_scale(const Vector3& scale)
 {
 	m[0] = scale.x;
 	m[4] = scale.y;
@@ -546,21 +546,21 @@ void Mat3::set_scale(const Vec3& scale)
 }
 
 //-----------------------------------------------------------------------------
-float* Mat3::to_float_ptr()
+float* Matrix3x3::to_float_ptr()
 {
 	return &m[0];
 }
 
 //-----------------------------------------------------------------------------
-const float* Mat3::to_float_ptr() const
+const float* Matrix3x3::to_float_ptr() const
 {
 	return &m[0];
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat3::to_mat4() const
+Matrix4x4 Matrix3x3::to_mat4() const
 {
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	tmp.m[0] = m[0];
 	tmp.m[1] = m[1];
@@ -583,9 +583,9 @@ Mat4 Mat3::to_mat4() const
 }
 
 //-----------------------------------------------------------------------------
-Quat Mat3::to_quat() const
+Quaternion Matrix3x3::to_quat() const
 {
-	Quat tmp;
+	Quaternion tmp;
 
 	float fourWSquaredMinusOne = m[0] + m[4] + m[8];
 	float fourXSquaredMinusOne = m[0] - m[4] - m[8];

+ 41 - 41
engine/core/math/Mat3.h → engine/core/math/Matrix3x3.h

@@ -31,9 +31,9 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class Mat4;
-class Quat;
-class Vec3;
+class Matrix4x4;
+class Quaternion;
+class Vector3;
 
 /// Column major 3x3 matrix.
 /// 
@@ -55,7 +55,7 @@ class Vec3;
 /// 2 | Xy  Yy  Zy |
 /// 3 [ Xz  Yz  Zz ]
 ///     1   2   3
-class Mat3
+class Matrix3x3
 {
 
 public:
@@ -63,17 +63,17 @@ public:
 	float				m[9];
 
 	/// Does nothing for efficiency.
-						Mat3();			
+						Matrix3x3();			
 
 	/// Constructs from a set of float
-						Mat3(float r1c1, float r2c1, float r3c1, float r1c2, float r2c2, float r3c2, float r1c3, float r2c3, float r3c3);
+						Matrix3x3(float r1c1, float r2c1, float r3c1, float r1c2, float r2c2, float r3c2, float r1c3, float r2c3, float r3c3);
 	
 	/// Constructs from the @a v array
-						Mat3(const float v[9]);						
-						Mat3(const Mat3& a);	
+						Matrix3x3(const float v[9]);						
+						Matrix3x3(const Matrix3x3& a);	
 
 	/// Assignment operator (copies the data)
-	Mat3&				operator=(const Mat3& a);					
+	Matrix3x3&			operator=(const Matrix3x3& a);					
 
 	/// Random access by index
 	float				operator[](uint32_t i) const;		
@@ -84,20 +84,20 @@ public:
 	/// Random access by row/column pair
 	float				operator()(uint32_t row, uint32_t column) const;	
 
-	Mat3				operator+(const Mat3& a) const;				
-	Mat3&				operator+=(const Mat3& a);					
-	Mat3				operator-(const Mat3& a) const;				
-	Mat3&				operator-=(const Mat3& a);					
-	Mat3				operator*(float k) const;					
-	Mat3&				operator*=(float k);						
-	Mat3				operator/(float k) const;					
-	Mat3&				operator/=(float k);							
-	Vec3				operator*(const Vec3& v) const;			
-	Mat3				operator*(const Mat3& a) const;				
-	Mat3&				operator*=(const Mat3& a);			
+	Matrix3x3			operator+(const Matrix3x3& a) const;				
+	Matrix3x3&			operator+=(const Matrix3x3& a);					
+	Matrix3x3			operator-(const Matrix3x3& a) const;				
+	Matrix3x3&			operator-=(const Matrix3x3& a);					
+	Matrix3x3			operator*(float k) const;					
+	Matrix3x3&			operator*=(float k);						
+	Matrix3x3			operator/(float k) const;					
+	Matrix3x3&			operator/=(float k);							
+	Vector3				operator*(const Vector3& v) const;			
+	Matrix3x3			operator*(const Matrix3x3& a) const;				
+	Matrix3x3&			operator*=(const Matrix3x3& a);			
 
 	/// For simmetry
-	friend Mat3			operator*(float k, const Mat3& a);			
+	friend Matrix3x3		operator*(float k, const Matrix3x3& a);			
 
 	/// Builds a rotation matrix about the X axis of @a radians radians
 	void				build_rotation_x(float radians);			
@@ -109,40 +109,40 @@ public:
 	void				build_rotation_z(float radians);	
 
 	/// Builds a rotation matrix about an arbitrary axis of "radians" radians			
-	void				build_rotation(const Vec3& n, float radians);
+	void				build_rotation(const Vector3& n, float radians);
 
-	Mat3&				transpose();								
-	Mat3				get_transposed() const;						
+	Matrix3x3&			transpose();								
+	Matrix3x3			get_transposed() const;						
 	float				get_determinant() const;					
-	Mat3&				invert();									
-	Mat3				get_inverted() const;						
+	Matrix3x3&			invert();									
+	Matrix3x3			get_inverted() const;						
 
 	/// Builds the identity matrix
 	void				load_identity();							
 
-	/// Returns a Vec3 containing the matrix's x base vector.
-	Vec3				x() const;
+	/// Returns a Vector3 containing the matrix's x base vector.
+	Vector3				x() const;
 
-	/// Returns a Vec3 containing the matrix's y base vector.
-	Vec3				y() const;
+	/// Returns a Vector3 containing the matrix's y base vector.
+	Vector3				y() const;
 
-	/// Returns a Vec3 containing the matrix's z base vector.
-	Vec3				z() const;
+	/// Returns a Vector3 containing the matrix's z base vector.
+	Vector3				z() const;
 
 	/// Sets the matrix's x base vector.
-	void				set_x(const Vec3& x);
+	void				set_x(const Vector3& x);
 
 	/// Sets the matrix's y base vector.
-	void				set_y(const Vec3& y);
+	void				set_y(const Vector3& y);
 
 	/// Sets the matrix's z base vector.
-	void				set_z(const Vec3& z);
+	void				set_z(const Vector3& z);
 
-	/// Returns a Vec3 containing the matrix's scale portion
-	Vec3				get_scale() const;	
+	/// Returns a Vector3 containing the matrix's scale portion
+	Vector3				get_scale() const;	
 
 	/// Fills the matrix's scale portion with the values contained in @a scale				
-	void				set_scale(const Vec3& scale);				
+	void				set_scale(const Vector3& scale);				
 
 	/// Returns the pointer to the matrix's data
 	float*				to_float_ptr();				
@@ -151,12 +151,12 @@ public:
 	const float*		to_float_ptr() const;
 
 	/// Returns a 4x4 matrix according to the matrix's rotation portion						
-	Mat4				to_mat4() const;
+	Matrix4x4			to_mat4() const;
 
 	/// Returns a quaternion according to the matrix's rotation portion							
-	Quat				to_quat() const;							
+	Quaternion			to_quat() const;							
 
-	static const Mat3	IDENTITY;
+	static const Matrix3x3	IDENTITY;
 };
 
 } // namespace crown

+ 90 - 90
engine/core/math/Mat4.cpp → engine/core/math/Matrix4x4.cpp

@@ -25,26 +25,26 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "Assert.h"
-#include "Mat3.h"
+#include "Matrix3x3.h"
 #include "Types.h"
-#include "Mat4.h"
+#include "Matrix4x4.h"
 #include "MathUtils.h"
-#include "Quat.h"
-#include "Vec3.h"
-#include "Vec4.h"
+#include "Quaternion.h"
+#include "Vector3.h"
+#include "Vector4.h"
 
 namespace crown
 {
 
-const Mat4 Mat4::IDENTITY = Mat4(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 = Matrix4x4(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);
 
 //-----------------------------------------------------------------------------
-Mat4::Mat4()
+Matrix4x4::Matrix4x4()
 {
 }
 
 //-----------------------------------------------------------------------------
-Mat4::Mat4(float r1c1, float r2c1, float r3c1, float r4c1, float r1c2, float r2c2, float r3c2, float r4c2,
+Matrix4x4::Matrix4x4(float r1c1, float r2c1, float r3c1, float r4c1, float r1c2, float r2c2, float r3c2, float r4c2,
 	float r1c3, float r2c3, float r3c3, float r4c3, float r1c4, float r2c4, float r3c4, float r4c4)
 {
 	m[0] = r1c1;
@@ -66,7 +66,7 @@ Mat4::Mat4(float r1c1, float r2c1, float r3c1, float r4c1, float r1c2, float r2c
 }
 
 //-----------------------------------------------------------------------------
-Mat4::Mat4(const float v[16])
+Matrix4x4::Matrix4x4(const float v[16])
 {
 	m[0] = v[0];
 	m[1] = v[1];
@@ -87,7 +87,7 @@ Mat4::Mat4(const float v[16])
 }
 
 //-----------------------------------------------------------------------------
-Mat4::Mat4(const Mat4& a)
+Matrix4x4::Matrix4x4(const Matrix4x4& a)
 {
 	m[0] = a.m[0];
 	m[1] = a.m[1];
@@ -108,7 +108,7 @@ Mat4::Mat4(const Mat4& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::operator=(const Mat4& a)
+Matrix4x4& Matrix4x4::operator=(const Matrix4x4& a)
 {
 	m[0] = a.m[0];
 	m[1] = a.m[1];
@@ -131,7 +131,7 @@ Mat4& Mat4::operator=(const Mat4& a)
 }
 
 //-----------------------------------------------------------------------------
-float Mat4::operator[](uint32_t i) const
+float Matrix4x4::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 16, "Index must be < 16");
 
@@ -139,7 +139,7 @@ float Mat4::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-float& Mat4::operator[](uint32_t i)
+float& Matrix4x4::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 16, "Index must be < 16");
 
@@ -147,7 +147,7 @@ float& Mat4::operator[](uint32_t i)
 }
 
 //-----------------------------------------------------------------------------
-float Mat4::operator()(uint32_t row, uint32_t column) const
+float Matrix4x4::operator()(uint32_t row, uint32_t column) const
 {
 	CE_ASSERT(row < 4 && column < 4, "Row and column must be < 4");
 
@@ -155,9 +155,9 @@ float Mat4::operator()(uint32_t row, uint32_t column) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat4::operator+(const Mat4& a) const
+Matrix4x4 Matrix4x4::operator+(const Matrix4x4& a) const
 {
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	tmp.m[0] = m[0] + a.m[0];
 	tmp.m[1] = m[1] + a.m[1];
@@ -180,7 +180,7 @@ Mat4 Mat4::operator+(const Mat4& a) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::operator+=(const Mat4& a)
+Matrix4x4& Matrix4x4::operator+=(const Matrix4x4& a)
 {
 	m[0] = m[0] + a.m[0];
 	m[1] = m[1] + a.m[1];
@@ -203,9 +203,9 @@ Mat4& Mat4::operator+=(const Mat4& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat4::operator-(const Mat4& a) const
+Matrix4x4 Matrix4x4::operator-(const Matrix4x4& a) const
 {
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	tmp.m[0] = m[0] - a.m[0];
 	tmp.m[1] = m[1] - a.m[1];
@@ -228,7 +228,7 @@ Mat4 Mat4::operator-(const Mat4& a) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::operator-=(const Mat4& a)
+Matrix4x4& Matrix4x4::operator-=(const Matrix4x4& a)
 {
 	m[0] = m[0] - a.m[0];
 	m[1] = m[1] - a.m[1];
@@ -251,9 +251,9 @@ Mat4& Mat4::operator-=(const Mat4& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat4::operator*(float k) const
+Matrix4x4 Matrix4x4::operator*(float k) const
 {
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	tmp.m[0] = m[0] * k;
 	tmp.m[1] = m[1] * k;
@@ -276,7 +276,7 @@ Mat4 Mat4::operator*(float k) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::operator*=(float k)
+Matrix4x4& Matrix4x4::operator*=(float k)
 {
 	m[0] *= k;
 	m[1] *= k;
@@ -299,9 +299,9 @@ Mat4& Mat4::operator*=(float k)
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat4::operator/(float k) const
+Matrix4x4 Matrix4x4::operator/(float k) const
 {
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	k = (float)1.0 / k;
 
@@ -326,7 +326,7 @@ Mat4 Mat4::operator/(float k) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::operator/=(float k)
+Matrix4x4& Matrix4x4::operator/=(float k)
 {
 	k = (float)1.0 / k;
 
@@ -351,9 +351,9 @@ Mat4& Mat4::operator/=(float k)
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat4::operator*(const Vec3& v) const
+Vector3 Matrix4x4::operator*(const Vector3& v) const
 {
-	Vec3 tmp;
+	Vector3 tmp;
 
 	tmp.x = m[0] * v.x + m[4] * v.y + m[8] * v.z + m[12];
 	tmp.y = m[1] * v.x + m[5] * v.y + m[9] * v.z + m[13];
@@ -363,9 +363,9 @@ Vec3 Mat4::operator*(const Vec3& v) const
 }
 
 //-----------------------------------------------------------------------------
-Vec4 Mat4::operator*(const Vec4& v) const
+Vector4 Matrix4x4::operator*(const Vector4& v) const
 {
-	Vec4 tmp;
+	Vector4 tmp;
 
 	tmp.x = m[0] * v.x + m[4] * v.y + m[8] * v.z + m[12] * v.w;
 	tmp.y = m[1] * v.x + m[5] * v.y + m[9] * v.z + m[13] * v.w;
@@ -376,9 +376,9 @@ Vec4 Mat4::operator*(const Vec4& v) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat4::operator*(const Mat4& a) const
+Matrix4x4 Matrix4x4::operator*(const Matrix4x4& a) const
 {
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	tmp.m[0] = m[0] * a.m[0] + m[4] * a.m[1] + m[8] * a.m[2] + m[12] * a.m[3];
 	tmp.m[1] = m[1] * a.m[0] + m[5] * a.m[1] + m[9] * a.m[2] + m[13] * a.m[3];
@@ -404,9 +404,9 @@ Mat4 Mat4::operator*(const Mat4& a) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::operator*=(const Mat4& a)
+Matrix4x4& Matrix4x4::operator*=(const Matrix4x4& a)
 {
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	tmp.m[0] = m[0] * a.m[0] + m[4] * a.m[1] + m[8] * a.m[2] + m[12] * a.m[3];
 	tmp.m[1] = m[1] * a.m[0] + m[5] * a.m[1] + m[9] * a.m[2] + m[13] * a.m[3];
@@ -433,13 +433,13 @@ Mat4& Mat4::operator*=(const Mat4& a)
 	return *this;
 }
 
-Mat4 operator*(float k, const Mat4& a)
+Matrix4x4 operator*(float k, const Matrix4x4& a)
 {
 	return a * k;
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_rotation_x(float radians)
+void Matrix4x4::build_rotation_x(float radians)
 {
 	m[0] = 1.0;
 	m[1] = 0.0;
@@ -460,7 +460,7 @@ void Mat4::build_rotation_x(float radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_rotation_y(float radians)
+void Matrix4x4::build_rotation_y(float radians)
 {
 	m[0] = math::cos(radians);
 	m[1] = 0.0;
@@ -481,7 +481,7 @@ void Mat4::build_rotation_y(float radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_rotation_z(float radians)
+void Matrix4x4::build_rotation_z(float radians)
 {
 	m[0] = math::cos(radians);
 	m[1] = math::sin(radians);
@@ -502,7 +502,7 @@ void Mat4::build_rotation_z(float radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_rotation(const Vec3& n, float radians)
+void Matrix4x4::build_rotation(const Vector3& n, float radians)
 {
 	float a = (float)1.0 - math::cos(radians);
 	float sin_a = math::sin(radians);
@@ -527,7 +527,7 @@ void Mat4::build_rotation(const Vec3& n, float radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_perspective_rh(float fovy, float aspect, float near, float far)
+void Matrix4x4::build_projection_perspective_rh(float fovy, float aspect, float near, float far)
 {
 	double top, right;
 
@@ -553,7 +553,7 @@ void Mat4::build_projection_perspective_rh(float fovy, float aspect, float near,
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_perspective_lh(float fovy, float aspect, float near, float far)
+void Matrix4x4::build_projection_perspective_lh(float fovy, float aspect, float near, float far)
 {
 	double top, right;
 
@@ -579,7 +579,7 @@ void Mat4::build_projection_perspective_lh(float fovy, float aspect, float near,
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_ortho_rh(float width, float height, float near, float far)
+void Matrix4x4::build_projection_ortho_rh(float width, float height, float near, float far)
 {
 	m[0] = (float)2.0 / width;
 	m[1] = 0.0;
@@ -600,7 +600,7 @@ void Mat4::build_projection_ortho_rh(float width, float height, float near, floa
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_ortho_lh(float width, float height, float near, float far)
+void Matrix4x4::build_projection_ortho_lh(float width, float height, float near, float far)
 {
 	m[0] = (float)2.0 / width;
 	m[1] = 0.0;
@@ -621,7 +621,7 @@ void Mat4::build_projection_ortho_lh(float width, float height, float near, floa
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_ortho_2d_rh(float width, float height, float near, float far)
+void Matrix4x4::build_projection_ortho_2d_rh(float width, float height, float near, float far)
 {
 	m[0] = (float)2.0 / width;
 	m[1] = 0.0;
@@ -642,7 +642,7 @@ void Mat4::build_projection_ortho_2d_rh(float width, float height, float near, f
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::transpose()
+Matrix4x4& Matrix4x4::transpose()
 {
 	float tmp;
 
@@ -674,9 +674,9 @@ Mat4& Mat4::transpose()
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat4::get_transposed() const
+Matrix4x4 Matrix4x4::get_transposed() const
 {
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	tmp.m[0] = m[0];
 	tmp.m[1] = m[4];
@@ -699,13 +699,13 @@ Mat4 Mat4::get_transposed() const
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_look_at_rh(const Vec3& pos, const Vec3& target, const Vec3& up)
+void Matrix4x4::build_look_at_rh(const Vector3& pos, const Vector3& target, const Vector3& up)
 {
-	Vec3 zAxis =  pos - target;
+	Vector3 zAxis =  pos - target;
 	zAxis.normalize();
 
-	Vec3 xAxis = up.cross(zAxis);
-	Vec3 yAxis = zAxis.cross(xAxis);
+	Vector3 xAxis = up.cross(zAxis);
+	Vector3 yAxis = zAxis.cross(xAxis);
 
 	m[0] = xAxis.x;
 	m[1] = yAxis.x;
@@ -726,13 +726,13 @@ void Mat4::build_look_at_rh(const Vec3& pos, const Vec3& target, const Vec3& up)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_look_at_lh(const Vec3& pos, const Vec3& target, const Vec3& up)
+void Matrix4x4::build_look_at_lh(const Vector3& pos, const Vector3& target, const Vector3& up)
 {
-	Vec3 zAxis =  target - pos;
+	Vector3 zAxis =  target - pos;
 	zAxis.normalize();
 
-	Vec3 xAxis = up.cross(zAxis);
-	Vec3 yAxis = zAxis.cross(xAxis);
+	Vector3 xAxis = up.cross(zAxis);
+	Vector3 yAxis = zAxis.cross(xAxis);
 
 	m[0] = xAxis.x;
 	m[1] = yAxis.x;
@@ -753,13 +753,13 @@ void Mat4::build_look_at_lh(const Vec3& pos, const Vec3& target, const Vec3& up)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_viewpoint_billboard(const Vec3& pos, const Vec3& target, const Vec3& up)
+void Matrix4x4::build_viewpoint_billboard(const Vector3& pos, const Vector3& target, const Vector3& up)
 {
-	Vec3 zAxis = target - pos;
+	Vector3 zAxis = target - pos;
 	zAxis.normalize();
 
-	Vec3 xAxis = up.cross(zAxis).normalize();
-	Vec3 yAxis = zAxis.cross(xAxis).normalize();
+	Vector3 xAxis = up.cross(zAxis).normalize();
+	Vector3 yAxis = zAxis.cross(xAxis).normalize();
 
 	m[0] = xAxis.x;
 	m[1] = xAxis.y;
@@ -780,13 +780,13 @@ void Mat4::build_viewpoint_billboard(const Vec3& pos, const Vec3& target, const
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_axis_billboard(const Vec3& pos, const Vec3& target, const Vec3& axis)
+void Matrix4x4::build_axis_billboard(const Vector3& pos, const Vector3& target, const Vector3& axis)
 {
-	Vec3 zAxis = target - pos;
+	Vector3 zAxis = target - pos;
 
-	Vec3 xAxis = axis.cross(zAxis).normalize();
+	Vector3 xAxis = axis.cross(zAxis).normalize();
 	zAxis = axis.cross(xAxis).normalize();
-	const Vec3& yAxis = axis;
+	const Vector3& yAxis = axis;
 
 	m[0] = xAxis.x;
 	m[1] = xAxis.y;
@@ -807,7 +807,7 @@ void Mat4::build_axis_billboard(const Vec3& pos, const Vec3& target, const Vec3&
 }
 
 //-----------------------------------------------------------------------------
-float Mat4::get_determinant() const
+float Matrix4x4::get_determinant() const
 {
 	float det;
 
@@ -827,9 +827,9 @@ float Mat4::get_determinant() const
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::invert()
+Matrix4x4& Matrix4x4::invert()
 {
-	Mat4 mat;
+	Matrix4x4 mat;
 	float det;
 
 	float m01m06_m05m02 = m[1] * m[6] - m[5] * m[2];
@@ -893,40 +893,40 @@ Mat4& Mat4::invert()
 }
 
 //-----------------------------------------------------------------------------
-inline Mat4 Mat4::get_inverted() const
+inline Matrix4x4 Matrix4x4::get_inverted() const
 {
-	Mat4 tmp(*this);
+	Matrix4x4 tmp(*this);
 
 	return tmp.invert();
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::load_identity()
+void Matrix4x4::load_identity()
 {
 	m[0] = m[5] = m[10] = m[15] = 1.0;
 	m[1] = m[2] = m[3] = m[4] = m[6] = m[7] = m[8] = m[9] = m[11] = m[12] = m[13] = m[14] = 0.0;
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat4::x() const
+Vector3 Matrix4x4::x() const
 {
-	return Vec3(m[0], m[1], m[2]);
+	return Vector3(m[0], m[1], m[2]);
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat4::y() const
+Vector3 Matrix4x4::y() const
 {
-	return Vec3(m[4], m[5], m[6]);
+	return Vector3(m[4], m[5], m[6]);
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat4::z() const
+Vector3 Matrix4x4::z() const
 {
-	return Vec3(m[8], m[9], m[10]);
+	return Vector3(m[8], m[9], m[10]);
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::set_x(const Vec3& x)
+void Matrix4x4::set_x(const Vector3& x)
 {
 	m[0] = x.x;
 	m[1] = x.y;
@@ -934,7 +934,7 @@ void Mat4::set_x(const Vec3& x)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::set_y(const Vec3& y)
+void Matrix4x4::set_y(const Vector3& y)
 {
 	m[4] = y.x;
 	m[5] = y.y;
@@ -942,7 +942,7 @@ void Mat4::set_y(const Vec3& y)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::set_z(const Vec3& z)
+void Matrix4x4::set_z(const Vector3& z)
 {
 	m[8] = z.x;
 	m[9] = z.y;
@@ -950,9 +950,9 @@ void Mat4::set_z(const Vec3& z)
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat4::translation() const
+Vector3 Matrix4x4::translation() const
 {
-	Vec3 tmp;
+	Vector3 tmp;
 
 	tmp.x = m[12];
 	tmp.y = m[13];
@@ -962,7 +962,7 @@ Vec3 Mat4::translation() const
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::set_translation(const Vec3& trans)
+void Matrix4x4::set_translation(const Vector3& trans)
 {
 	m[12] = trans.x;
 	m[13] = trans.y;
@@ -970,9 +970,9 @@ void Mat4::set_translation(const Vec3& trans)
 }
 
 //-----------------------------------------------------------------------------
-Vec3 Mat4::get_scale() const
+Vector3 Matrix4x4::get_scale() const
 {
-	Vec3 tmp;
+	Vector3 tmp;
 
 	tmp.x = m[0];
 	tmp.y = m[5];
@@ -982,7 +982,7 @@ Vec3 Mat4::get_scale() const
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::set_scale(const Vec3& scale)
+void Matrix4x4::set_scale(const Vector3& scale)
 {
 	m[0] = scale.x;
 	m[5] = scale.y;
@@ -990,21 +990,21 @@ void Mat4::set_scale(const Vec3& scale)
 }
 
 //-----------------------------------------------------------------------------
-float* Mat4::to_float_ptr()
+float* Matrix4x4::to_float_ptr()
 {
 	return &m[0];
 }
 
 //-----------------------------------------------------------------------------
-const float* Mat4::to_float_ptr() const
+const float* Matrix4x4::to_float_ptr() const
 {
 	return &m[0];
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat4::to_mat3() const
+Matrix3x3 Matrix4x4::to_mat3() const
 {
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	tmp.m[0] = m[0];
 	tmp.m[1] = m[1];
@@ -1020,9 +1020,9 @@ Mat3 Mat4::to_mat3() const
 }
 
 //-----------------------------------------------------------------------------
-Quat Mat4::to_quat() const
+Quaternion Matrix4x4::to_quat() const
 {
-	Quat tmp;
+	Quaternion tmp;
 	float fourWSquaredMinusOne = m[0] + m[5] + m[10];
 	float fourXSquaredMinusOne = m[0] - m[5] - m[10];
 	float fourYSquaredMinusOne = -m[0] + m[5] - m[10];

+ 50 - 50
engine/core/math/Mat4.h → engine/core/math/Matrix4x4.h

@@ -31,10 +31,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class Mat3;
-class Quat;
-class Vec3;
-class Vec4;
+class Matrix3x3;
+class Quaternion;
+class Vector3;
+class Vector4;
 
 /// Column-major 4x4 matrix.
 /// 
@@ -58,7 +58,7 @@ class Vec4;
 /// 3 | Xz  Yz  Zz  Tz |
 /// 4 [ 0   0   0   1  ]
 ///     1   2   3   4
-class Mat4
+class Matrix4x4
 {
 
 public:
@@ -66,17 +66,17 @@ public:
 	float				m[16];
 
 	/// Does nothing for efficiency.
-						Mat4();	
+						Matrix4x4();	
 
 	/// Constructs from a set of float
-						Mat4(float r1c1, float r2c1, float r3c1, float r4c1, float r1c2, float r2c2, float r3c2, float r4c2, float r1c3, float r2c3, float r3c3, float r4c3, float r1c4, float r2c4, float r3c4, float r4c4);
+						Matrix4x4(float r1c1, float r2c1, float r3c1, float r4c1, float r1c2, float r2c2, float r3c2, float r4c2, float r1c3, float r2c3, float r3c3, float r4c3, float r1c4, float r2c4, float r3c4, float r4c4);
 	
 	/// Contructs from the @a v array
-						Mat4(const float v[16]);						
-						Mat4(const Mat4& a);					
+						Matrix4x4(const float v[16]);						
+						Matrix4x4(const Matrix4x4& a);					
 
 	/// Assignment operator (copies the data)
-	Mat4&				operator=(const Mat4& a);					
+	Matrix4x4&			operator=(const Matrix4x4& a);					
 
 	/// Random access by index
 	float				operator[](uint32_t i) const;
@@ -86,21 +86,21 @@ public:
 
 	float				operator()(uint32_t row, uint32_t column) const;	//!< Random access by row/column pair
 
-	Mat4				operator+(const Mat4& a) const;
-	Mat4&				operator+=(const Mat4& a);					
-	Mat4				operator-(const Mat4& a) const;				
-	Mat4&				operator-=(const Mat4& a);					
-	Mat4				operator*(float k) const;				
-	Mat4&				operator*=(float k);							
-	Mat4				operator/(float k) const;					
-	Mat4&				operator/=(float k);							
-	Vec3				operator*(const Vec3& v) const;				
-	Vec4				operator*(const Vec4& v) const;				
-	Mat4				operator*(const Mat4& a) const;			
-	Mat4&				operator*=(const Mat4& a);
+	Matrix4x4			operator+(const Matrix4x4& a) const;
+	Matrix4x4&			operator+=(const Matrix4x4& a);					
+	Matrix4x4			operator-(const Matrix4x4& a) const;				
+	Matrix4x4&			operator-=(const Matrix4x4& a);					
+	Matrix4x4			operator*(float k) const;				
+	Matrix4x4&			operator*=(float k);							
+	Matrix4x4			operator/(float k) const;					
+	Matrix4x4&			operator/=(float k);							
+	Vector3				operator*(const Vector3& v) const;				
+	Vector4				operator*(const Vector4& v) const;				
+	Matrix4x4			operator*(const Matrix4x4& a) const;			
+	Matrix4x4&			operator*=(const Matrix4x4& a);
 
 	/// For simmetry
-	friend Mat4			operator*(float k, const Mat4& a);			
+	friend Matrix4x4	operator*(float k, const Matrix4x4& a);			
 
 	/// Builds a rotation matrix about the X axis of @a radians radians
 	void				build_rotation_x(float radians);
@@ -112,7 +112,7 @@ public:
 	void				build_rotation_z(float radians);		
 
 	/// Builds a rotation matrix about an arbitrary axis of "radians" radians		
-	void				build_rotation(const Vec3& n, float radians);
+	void				build_rotation(const Vector3& n, float radians);
 
 	/// Builds a perspetive projection matrix suited to Right-Handed coordinate systems
 	void				build_projection_perspective_rh(float fovy, float aspect, float near, float far);
@@ -130,55 +130,55 @@ public:
 	void				build_projection_ortho_2d_rh(float width, float height, float near, float far);	
 
 	/// Builds a "Righ-Handed look-at" matrix from a position, a target, and an up vector
-	void				build_look_at_rh(const Vec3& pos, const Vec3& target, const Vec3& up);
+	void				build_look_at_rh(const Vector3& pos, const Vector3& target, const Vector3& up);
 
 	/// Builds a "Left-Handed look-at" matrix from a position, a target, and an up vector	
-	void				build_look_at_lh(const Vec3& pos, const Vec3& target, const Vec3& up);
+	void				build_look_at_lh(const Vector3& pos, const Vector3& target, const Vector3& up);
 
 	/// Builds a "Viewpoint-Oriented billboard" matrix which can be used to make an object face a specific point in space	
-	void				build_viewpoint_billboard(const Vec3& pos, const Vec3& target, const Vec3& up);	
+	void				build_viewpoint_billboard(const Vector3& pos, const Vector3& target, const Vector3& up);	
 
 	/// Builds a "Arbitrary-Axis billboard" matrix which can be used to make an object face a specific point in space
-	void				build_axis_billboard(const Vec3& pos, const Vec3& target, const Vec3& axis);	
+	void				build_axis_billboard(const Vector3& pos, const Vector3& target, const Vector3& axis);	
 
-	Mat4&				transpose();								
-	Mat4				get_transposed() const;						
+	Matrix4x4&			transpose();								
+	Matrix4x4			get_transposed() const;						
 	float				get_determinant() const;					
-	Mat4&				invert();									
-	Mat4				get_inverted() const;						
+	Matrix4x4&			invert();									
+	Matrix4x4			get_inverted() const;						
 
 	/// Builds the identity matrix
 	void				load_identity();							
 
-	/// Returns a Vec3 containing the matrix's x base vector.
-	Vec3				x() const;
+	/// Returns a Vector3 containing the matrix's x base vector.
+	Vector3				x() const;
 
-	/// Returns a Vec3 containing the matrix's y base vector.
-	Vec3				y() const;
+	/// Returns a Vector3 containing the matrix's y base vector.
+	Vector3				y() const;
 
-	/// Returns a Vec3 containing the matrix's z base vector.
-	Vec3				z() const;
+	/// Returns a Vector3 containing the matrix's z base vector.
+	Vector3				z() const;
 
 	/// Sets the matrix's x base vector.
-	void				set_x(const Vec3& x);
+	void				set_x(const Vector3& x);
 
 	/// Sets the matrix's y base vector.
-	void				set_y(const Vec3& y);
+	void				set_y(const Vector3& y);
 
 	/// Sets the matrix's z base vector.
-	void				set_z(const Vec3& z);
+	void				set_z(const Vector3& z);
 
-	/// Returns a Vec3 containing the matrix's translation portion
-	Vec3				translation() const;	
+	/// Returns a Vector3 containing the matrix's translation portion
+	Vector3				translation() const;	
 
 	/// Fills the matrix's translation portion values contained in @a trans				
-	void				set_translation(const Vec3& trans);			
+	void				set_translation(const Vector3& trans);			
 
-	/// Returns a Vec3 containing the matrix's scale portion
-	Vec3				get_scale() const;
+	/// Returns a Vector3 containing the matrix's scale portion
+	Vector3				get_scale() const;
 
 	/// Fills the matrix's scale portion with the values contained in @a scale							
-	void				set_scale(const Vec3& scale);				
+	void				set_scale(const Vector3& scale);				
 
 	/// Returns the pointer to the matrix's data
 	float*				to_float_ptr();
@@ -187,12 +187,12 @@ public:
 	const float*		to_float_ptr() const;
 
 	/// Returns a 3x3 matrix according to the matrix's rotation portion						
-	Mat3				to_mat3() const;
+	Matrix3x3			to_mat3() const;
 
 	/// Returns a quaternion according to the matrix's rotation portion							
-	Quat				to_quat() const;							
+	Quaternion			to_quat() const;							
 
-	static const Mat4	IDENTITY;
+	static const Matrix4x4	IDENTITY;
 };
 
 } // namespace crown

+ 7 - 7
engine/core/math/Plane.cpp

@@ -31,10 +31,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-const Plane Plane::ZERO = Plane(Vec3::ZERO, 0.0);
-const Plane	Plane::XAXIS = Plane(Vec3::XAXIS, 0.0);
-const Plane	Plane::YAXIS = Plane(Vec3::YAXIS, 0.0);
-const Plane	Plane::ZAXIS = Plane(Vec3::ZAXIS, 0.0);
+const Plane Plane::ZERO = Plane(Vector3::ZERO, 0.0);
+const Plane	Plane::XAXIS = Plane(Vector3::XAXIS, 0.0);
+const Plane	Plane::YAXIS = Plane(Vector3::YAXIS, 0.0);
+const Plane	Plane::ZAXIS = Plane(Vector3::ZAXIS, 0.0);
 
 //-----------------------------------------------------------------------------
 Plane::Plane()
@@ -47,7 +47,7 @@ Plane::Plane(const Plane& p) : n(p.n), d(p.d)
 }
 
 //-----------------------------------------------------------------------------
-Plane::Plane(const Vec3& normal, float dist) : n(normal), d(dist)
+Plane::Plane(const Vector3& normal, float dist) : n(normal), d(dist)
 {
 }
 
@@ -70,13 +70,13 @@ Plane& Plane::normalize()
 }
 
 //-----------------------------------------------------------------------------
-float Plane::distance_to_point(const Vec3& p) const
+float Plane::distance_to_point(const Vector3& p) const
 {
 	return n.dot(p) + d;
 }
 
 //-----------------------------------------------------------------------------
-bool Plane::contains_point(const Vec3& p) const
+bool Plane::contains_point(const Vector3& p) const
 {
 	return math::equals(n.dot(p) + d, (float)0.0);
 }

+ 5 - 5
engine/core/math/Plane.h

@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Types.h"
 #include "Sphere.h"
-#include "Vec3.h"
+#include "Vector3.h"
 
 namespace crown
 {
@@ -41,7 +41,7 @@ class Plane
 {
 public:
 
-	Vec3				n;
+	Vector3				n;
 	float				d;
 
 public:
@@ -51,16 +51,16 @@ public:
 						Plane(const Plane& p);
 
 	/// Constructs from a normal and distance factor						
-						Plane(const Vec3& normal, float dist);		
+						Plane(const Vector3& normal, float dist);		
 
 	/// Normalizes the plane
 	Plane&				normalize();							
 
 	/// Returns the signed distance between point @a p and the plane
-	float				distance_to_point(const Vec3& p) const;	
+	float				distance_to_point(const Vector3& p) const;	
 
 	/// Returns whether the plane contains the point @a p	
-	bool				contains_point(const Vec3& p) const;		
+	bool				contains_point(const Vector3& p) const;		
 
 	static const Plane	ZERO;
 	static const Plane	XAXIS;

+ 8 - 8
engine/core/math/Point2.h

@@ -29,8 +29,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Assert.h"
 #include "Types.h"
 #include "MathUtils.h"
-#include "Vec2.h"
-#include "Vec3.h"
+#include "Vector2.h"
+#include "Vector3.h"
 
 namespace crown
 {
@@ -83,8 +83,8 @@ public:
 
 	int32_t*				to_int_ptr();						//! Returns the point32_ter to the point32_t's data
 	const int32_t*			to_int_ptr() const;					//! Returns the point32_ter to the point32_t's data
-	Vec2					to_vec2() const;					//! Returns a vector from this point32_t
-	Vec3					to_vec3() const;					//! Returns a vector from this point32_t
+	Vector2					to_vec2() const;					//! Returns a vector from this point32_t
+	Vector3					to_vec3() const;					//! Returns a vector from this point32_t
 
 	static const Point2		ZERO;
 	static const Point2		ONE;
@@ -290,15 +290,15 @@ inline const int32_t* Point2::to_int_ptr() const
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Point2::to_vec2() const
+inline Vector2 Point2::to_vec2() const
 {
-	return Vec2((float)x, (float)y);
+	return Vector2((float)x, (float)y);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Point2::to_vec3() const
+inline Vector3 Point2::to_vec3() const
 {
-	return Vec3((float)x, (float)y, 0.0);
+	return Vector3((float)x, (float)y, 0.0);
 }
 
 } // namespace crown

+ 28 - 28
engine/core/math/Quat.cpp → engine/core/math/Quaternion.cpp

@@ -24,37 +24,37 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Mat3.h"
-#include "Mat4.h"
+#include "Matrix3x3.h"
+#include "Matrix4x4.h"
 #include "Types.h"
 #include "MathUtils.h"
-#include "Quat.h"
-#include "Vec3.h"
+#include "Quaternion.h"
+#include "Vector3.h"
 
 namespace crown
 {
 
 //-----------------------------------------------------------------------------
-Quat::Quat()
+Quaternion::Quaternion()
 {
 }
 
 //-----------------------------------------------------------------------------
-Quat::Quat(const Vec3& axis, float angle)
+Quaternion::Quaternion(const Vector3& axis, float angle)
 {
 	v = axis * math::sin(angle * 0.5);
 	w = math::cos(angle * 0.5);
 }
 
 //-----------------------------------------------------------------------------
-void Quat::negate()
+void Quaternion::negate()
 {
 	w = -w;
 	v.negate();
 }
 
 //-----------------------------------------------------------------------------
-void Quat::load_identity()
+void Quaternion::load_identity()
 {
 	w = 1.0;
 	v.x = 0.0;
@@ -63,37 +63,37 @@ void Quat::load_identity()
 }
 
 //-----------------------------------------------------------------------------
-float Quat::length() const
+float Quaternion::length() const
 {
 	return math::sqrt(w * w + v.x * v.x + v.y * v.y + v.z * v.z);
 }
 
 //-----------------------------------------------------------------------------
-void Quat::conjugate()
+void Quaternion::conjugate()
 {
 	v = -v;
 }
 
 //-----------------------------------------------------------------------------
-Quat Quat::get_conjugate() const
+Quaternion Quaternion::get_conjugate() const
 {
-	return Quat(-v, w);
+	return Quaternion(-v, w);
 }
 
 //-----------------------------------------------------------------------------
-Quat Quat::get_inverse() const
+Quaternion Quaternion::get_inverse() const
 {
 	return get_conjugate() * (1.0 / length());
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Quat::to_mat3() const
+Matrix3x3 Quaternion::to_mat3() const
 {
 	const float& x = v.x;
 	const float& y = v.y;
 	const float& z = v.z;
 
-	Mat3 tmp;
+	Matrix3x3 tmp;
 
 	tmp.m[0] = (float)(1.0 - 2.0*y*y - 2.0*z*z);
 	tmp.m[1] = (float)(2.0*x*y + 2.0*w*z);
@@ -109,13 +109,13 @@ Mat3 Quat::to_mat3() const
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Quat::to_mat4() const
+Matrix4x4 Quaternion::to_mat4() const
 {
 	const float& x = v.x;
 	const float& y = v.y;
 	const float& z = v.z;
 
-	Mat4 tmp;
+	Matrix4x4 tmp;
 
 	tmp.m[0] = (float)(1.0 - 2.0*y*y - 2.0*z*z);
 	tmp.m[1] = (float)(2.0*x*y + 2.0*w*z);
@@ -138,9 +138,9 @@ Mat4 Quat::to_mat4() const
 }
 
 //-----------------------------------------------------------------------------
-Quat Quat::operator*(const Quat& b) const
+Quaternion Quaternion::operator*(const Quaternion& b) const
 {
-	Quat tmp;
+	Quaternion tmp;
 
 	tmp.w = w * b.w - v.dot(b.v);
 	tmp.v = w * b.v + b.w * v + b.v.cross(v);
@@ -149,9 +149,9 @@ Quat Quat::operator*(const Quat& b) const
 }
 
 //-----------------------------------------------------------------------------
-Quat Quat::operator*(const float& k) const
+Quaternion Quaternion::operator*(const float& k) const
 {
-	Quat tmp;
+	Quaternion tmp;
 
 	tmp.w = w * k;
 	tmp.v = v * k;
@@ -160,9 +160,9 @@ Quat Quat::operator*(const float& k) const
 }
 
 //-----------------------------------------------------------------------------
-Quat Quat::power(float exp)
+Quaternion Quaternion::power(float exp)
 {
-	Quat tmp;
+	Quaternion tmp;
 
 	if (math::abs(w) < 0.9999)
 	{
@@ -183,21 +183,21 @@ Quat Quat::power(float exp)
 }
 
 /*
-The geometric interpretation of the Quat dot product is similar to the interpretation of
-the vector dot product; the larger the absolute value of the Quat dot product axb, the more
+The geometric interpretation of the Quaternion dot product is similar to the interpretation of
+the vector dot product; the larger the absolute value of the Quaternion dot product axb, the more
 "similar" the angular displacements represented by a and b.
 */
 //-----------------------------------------------------------------------------
-float dot(const Quat& a, const Quat& b)
+float dot(const Quaternion& a, const Quaternion& b)
 {
 	return a.w * b.w + a.v.dot(b.v);
 }
 
 // Spherical Linear interpolation
 //-----------------------------------------------------------------------------
-Quat slerp(const Quat& start, const Quat& end, float t)
+Quaternion slerp(const Quaternion& start, const Quaternion& end, float t)
 {
-	Quat delta = end * start.get_inverse();
+	Quaternion delta = end * start.get_inverse();
 	delta = delta.power(t);
 
 	return delta * start;

+ 14 - 14
engine/core/math/Quat.h → engine/core/math/Quaternion.h

@@ -27,13 +27,13 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
-#include "Vec3.h"
+#include "Vector3.h"
 
 namespace crown
 {
 
-class Mat3;
-class Mat4;
+class Matrix3x3;
+class Matrix4x4;
 
 /// Quaternion.
 ///
@@ -46,20 +46,20 @@ class Mat4;
 /// p' = (ba)p(ba)^-1 where p is the point and (ba) the concatenation of two successive rotations
 /// In this case, the point p is first rotated by the quaternion a and then by the quaternion b.
 /// The transformation order is reversed.
-class Quat
+class Quaternion
 {
 public:
 
-	Vec3		v;
+	Vector3		v;
 	float		w;
 
 public:
 
 	/// Does nothing
-				Quat();
+				Quaternion();
 
 	/// Builds the quaternion from an @a axis and a @a angle.							
-				Quat(const Vec3& axis, float angle);	
+				Quaternion(const Vector3& axis, float angle);	
 
 	/// Negates the quaternion.
 	void		negate();
@@ -74,21 +74,21 @@ public:
 	void		conjugate();
 
 	/// Returns the quaternion's conjugate.
-	Quat		get_conjugate() const;
+	Quaternion	get_conjugate() const;
 
 	/// Quaternion's inverse				
-	Quat		get_inverse() const;
+	Quaternion	get_inverse() const;
 
-	Mat3		to_mat3() const;
-	Mat4		to_mat4() const;
+	Matrix3x3	to_mat3() const;
+	Matrix4x4	to_mat4() const;
 
 	/// Cross product
-	Quat		operator*(const Quat& b) const;
+	Quaternion	operator*(const Quaternion& b) const;
 
 	/// Multiplication by a scalar		
-	Quat		operator*(const float& k) const;
+	Quaternion	operator*(const float& k) const;
 
-	Quat		power(float exp);
+	Quaternion	power(float exp);
 };
 
 } // namespace crown

+ 13 - 13
engine/core/math/Ray.h

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
-#include "Vec3.h"
+#include "Vector3.h"
 
 namespace crown
 {
@@ -43,19 +43,19 @@ public:
 					Ray();
 
 	/// Constructs from @a origin and @a direction
-					Ray(const Vec3& origin, const Vec3& direction);
+					Ray(const Vector3& origin, const Vector3& direction);
 					Ray(const Ray& ray);
 
-	const Vec3&		origin() const;
-	const Vec3&		direction() const;
+	const Vector3&		origin() const;
+	const Vector3&		direction() const;
 
-	void			set_origin(const Vec3& origin);
-	void			set_direction(const Vec3& direction);
+	void			set_origin(const Vector3& origin);
+	void			set_direction(const Vector3& direction);
 
 private:
 
-	Vec3			m_origin;
-	Vec3			m_direction;
+	Vector3			m_origin;
+	Vector3			m_direction;
 };
 
 //-----------------------------------------------------------------------------
@@ -64,7 +64,7 @@ inline Ray::Ray()
 }
 
 //-----------------------------------------------------------------------------
-inline Ray::Ray(const Vec3& origin, const Vec3& direction) : m_origin(origin), m_direction(direction)
+inline Ray::Ray(const Vector3& origin, const Vector3& direction) : m_origin(origin), m_direction(direction)
 {
 }
 
@@ -74,25 +74,25 @@ inline Ray::Ray(const Ray& ray) : m_origin(ray.m_origin), m_direction(ray.m_dire
 }
 
 //-----------------------------------------------------------------------------
-inline const Vec3& Ray::origin() const
+inline const Vector3& Ray::origin() const
 {
 	return m_origin;
 }
 
 //-----------------------------------------------------------------------------
-inline const Vec3& Ray::direction() const
+inline const Vector3& Ray::direction() const
 {
 	return m_direction;
 }
 
 //-----------------------------------------------------------------------------
-inline void Ray::set_origin(const Vec3& origin)
+inline void Ray::set_origin(const Vector3& origin)
 {
 	m_origin = origin;
 }
 
 //-----------------------------------------------------------------------------
-inline void Ray::set_direction(const Vec3& direction)
+inline void Ray::set_direction(const Vector3& direction)
 {
 	m_direction = direction;
 }

+ 22 - 22
engine/core/math/Triangle.h

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "Vec3.h"
+#include "Vector3.h"
 #include "Plane.h"
 #include "MathUtils.h"
 
@@ -43,19 +43,19 @@ public:
 
 	/// Does nothing for efficiency.
 				Triangle();
-				Triangle(const Vec3& v1, const Vec3& v2, const Vec3& v3);
+				Triangle(const Vector3& v1, const Vector3& v2, const Vector3& v3);
 				~Triangle();
 
 	float		area() const;
 
 	/// Returns the center of gravity (a.k.a. "centroid").
-	Vec3		centroid() const;
+	Vector3		centroid() const;
 
 	/// Returns the barycentric coordinates of point @a p in respect to the triangle.
-	Vec3		barycentric_coords(const Vec3& p) const;
+	Vector3		barycentric_coords(const Vector3& p) const;
 
 	/// Returns whether the triangle contains the @a p point.
-	bool		contains_point(const Vec3& p) const;
+	bool		contains_point(const Vector3& p) const;
 
 	/// Returns the plane containing the triangle.
 	Plane		to_plane() const;
@@ -63,7 +63,7 @@ public:
 private:
 
 	// Vertices in CCW order
-	Vec3		m_vertex[3];
+	Vector3		m_vertex[3];
 
 	friend class Intersection;
 };
@@ -74,7 +74,7 @@ inline Triangle::Triangle()
 }
 
 //-----------------------------------------------------------------------------
-inline Triangle::Triangle(const Vec3& v1, const Vec3& v2, const Vec3& v3)
+inline Triangle::Triangle(const Vector3& v1, const Vector3& v2, const Vector3& v3)
 {
 	m_vertex[0] = v1;
 	m_vertex[1] = v2;
@@ -93,23 +93,23 @@ inline float Triangle::area() const
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Triangle::centroid() const
+inline Vector3 Triangle::centroid() const
 {
 	return (m_vertex[0] + m_vertex[1] + m_vertex[2]) * math::ONE_OVER_THREE;
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Triangle::barycentric_coords(const Vec3& p) const
+inline Vector3 Triangle::barycentric_coords(const Vector3& p) const
 {
-	Vec3 e1 = m_vertex[2] - m_vertex[1];
-	Vec3 e2 = m_vertex[0] - m_vertex[2];
-	Vec3 e3 = m_vertex[1] - m_vertex[0];
+	Vector3 e1 = m_vertex[2] - m_vertex[1];
+	Vector3 e2 = m_vertex[0] - m_vertex[2];
+	Vector3 e3 = m_vertex[1] - m_vertex[0];
 
-	Vec3 d1 = p - m_vertex[0];
-	Vec3 d2 = p - m_vertex[1];
-	Vec3 d3 = p - m_vertex[2];
+	Vector3 d1 = p - m_vertex[0];
+	Vector3 d2 = p - m_vertex[1];
+	Vector3 d3 = p - m_vertex[2];
 
-	Vec3 n = e1.cross(e2) / e1.cross(e2).length();
+	Vector3 n = e1.cross(e2) / e1.cross(e2).length();
 
 	// Signed areas
 	float at = (float)(e1.cross(e2).dot(n) * 0.5);
@@ -120,13 +120,13 @@ inline Vec3 Triangle::barycentric_coords(const Vec3& p) const
 
 	float oneOverAt = (float)(1.0 / at);
 
-	return Vec3(at1 * oneOverAt, at2 * oneOverAt, at3 * oneOverAt);
+	return Vector3(at1 * oneOverAt, at2 * oneOverAt, at3 * oneOverAt);
 }
 
 //-----------------------------------------------------------------------------
-inline bool Triangle::contains_point(const Vec3& p) const
+inline bool Triangle::contains_point(const Vector3& p) const
 {
-	Vec3 bc = barycentric_coords(p);
+	Vector3 bc = barycentric_coords(p);
 
 	if (bc.x < 0.0 || bc.y < 0.0 || bc.z < 0.0)
 	{
@@ -139,10 +139,10 @@ inline bool Triangle::contains_point(const Vec3& p) const
 //-----------------------------------------------------------------------------
 inline Plane Triangle::to_plane() const
 {
-	Vec3 e1 = m_vertex[2] - m_vertex[1];
-	Vec3 e2 = m_vertex[1] - m_vertex[0];
+	Vector3 e1 = m_vertex[2] - m_vertex[1];
+	Vector3 e2 = m_vertex[1] - m_vertex[0];
 
-	Vec3 n = e2.cross(e1).normalize();
+	Vector3 n = e2.cross(e1).normalize();
 	float d = -n.dot(m_vertex[0]);
 
 	return Plane(n, d);

+ 5 - 5
engine/core/math/Vec2.cpp → engine/core/math/Vector2.cpp

@@ -24,15 +24,15 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Vec2.h"
+#include "Vector2.h"
 
 namespace crown
 {
 
-const Vec2 Vec2::ZERO	= Vec2(0.0, 0.0);
-const Vec2 Vec2::ONE	= Vec2(1.0, 1.0);
-const Vec2 Vec2::XAXIS	= Vec2(1.0, 0.0);
-const Vec2 Vec2::YAXIS	= Vec2(0.0, 1.0);
+const Vector2 Vector2::ZERO	= Vector2(0.0, 0.0);
+const Vector2 Vector2::ONE	= Vector2(1.0, 1.0);
+const Vector2 Vector2::XAXIS	= Vector2(1.0, 0.0);
+const Vector2 Vector2::YAXIS	= Vector2(0.0, 1.0);
 
 } // namespace crown
 

+ 74 - 74
engine/core/math/Vec2.h → engine/core/math/Vector2.h

@@ -34,24 +34,24 @@ namespace crown
 {
 
 /// 2D column vector.
-class Vec2
+class Vector2
 {
 public:
 
 	float				x, y;
 
 	/// Does nothing for efficiency.
-						Vec2();		
+						Vector2();		
 
 	/// Initializes all the components to val							
-						Vec2(float val);	
+						Vector2(float val);	
 
 	/// Constructs from two components						
-						Vec2(float nx, float ny);
+						Vector2(float nx, float ny);
 
 	/// Constructs from array
-						Vec2(const float v[2]);
-						Vec2(const Vec2& a);					
+						Vector2(const float v[2]);
+						Vector2(const Vector2& a);					
 
 	/// Random access by index
 	float				operator[](uint32_t i) const;
@@ -59,29 +59,29 @@ public:
 	/// Random access by index			
 	float&				operator[](uint32_t i);					
 
-	Vec2				operator+(const Vec2& a) const;			
-	Vec2&				operator+=(const Vec2& a);				
-	Vec2 				operator-(const Vec2& a) const;			
-	Vec2&				operator-=(const Vec2& a);				
-	Vec2				operator*(float k) const;				
-	Vec2&				operator*=(float k);						
-	Vec2				operator/(float k) const;				
-	Vec2&				operator/=(float k);
+	Vector2				operator+(const Vector2& a) const;			
+	Vector2&			operator+=(const Vector2& a);				
+	Vector2 			operator-(const Vector2& a) const;			
+	Vector2&			operator-=(const Vector2& a);				
+	Vector2				operator*(float k) const;				
+	Vector2&			operator*=(float k);						
+	Vector2				operator/(float k) const;				
+	Vector2&			operator/=(float k);
 
 	/// Dot product						
-	float				dot(const Vec2& a) const;				
+	float				dot(const Vector2& a) const;				
 
 	/// For simmetry
-	friend Vec2			operator*(float k, const Vec2& a);		
+	friend Vector2		operator*(float k, const Vector2& a);		
 
-	bool				operator==(const Vec2& other) const;	
-	bool				operator!=(const Vec2& other) const;
+	bool				operator==(const Vector2& other) const;	
+	bool				operator!=(const Vector2& other) const;
 
 	/// Returns whether all the components of this vector are smaller than all of the @a other vector	
-	bool				operator<(const Vec2& other) const;		
+	bool				operator<(const Vector2& other) const;		
 
 	/// Returns whether all the components of this vector are greater than all of the @a other vector
-	bool				operator>(const Vec2& other) const;		
+	bool				operator>(const Vector2& other) const;		
 
 	/// Returns the vector's length
 	float				length() const;
@@ -95,22 +95,22 @@ public:
 	float				get_angle_2d() const;
 
 	/// Normalizes the vector
-	Vec2&				normalize();
+	Vector2&			normalize();
 
 	/// Returns the normalized vector							
-	Vec2				get_normalized() const;
+	Vector2				get_normalized() const;
 
 	/// Negates the vector (i.e. builds the inverse)					
-	Vec2&				negate();
+	Vector2&			negate();
 
 	/// Negates the vector (i.e. builds the inverse)								
-	Vec2				operator-() const;						
+	Vector2				operator-() const;						
 
 	/// Returns the distance
-	float				get_distance_to(const Vec2& a) const;
+	float				get_distance_to(const Vector2& a) const;
 
 	/// Returns the angle in radian	
-	float				get_angle_between(const Vec2& a) const;
+	float				get_angle_between(const Vector2& a) const;
 
 	/// Sets all components to zero
 	void				zero();
@@ -119,41 +119,41 @@ public:
 	float*				to_float_ptr();	
 
 	/// Returns the pointer to the vector's data						
-	const float*			to_float_ptr() const;					
+	const float*		to_float_ptr() const;					
 
-	static const Vec2	ZERO;
-	static const Vec2	ONE;
-	static const Vec2	XAXIS;
-	static const Vec2	YAXIS;
+	static const Vector2	ZERO;
+	static const Vector2	ONE;
+	static const Vector2	XAXIS;
+	static const Vector2	YAXIS;
 };
 
 //-----------------------------------------------------------------------------
-inline Vec2::Vec2()
+inline Vector2::Vector2()
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2::Vec2(float val) : x(val), y(val)
+inline Vector2::Vector2(float val) : x(val), y(val)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2::Vec2(float nx, float ny) : x(nx), y(ny)
+inline Vector2::Vector2(float nx, float ny) : x(nx), y(ny)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2::Vec2(const float a[2]) : x(a[0]), y(a[1])
+inline Vector2::Vector2(const float a[2]) : x(a[0]), y(a[1])
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2::Vec2(const Vec2& a) : x(a.x), y(a.y)
+inline Vector2::Vector2(const Vector2& a) : x(a.x), y(a.y)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec2::operator[](uint32_t i) const
+inline float Vector2::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 2, "Index must be < 2");
 
@@ -161,7 +161,7 @@ inline float Vec2::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-inline float& Vec2::operator[](uint32_t i)
+inline float& Vector2::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 2, "Index must be < 2");
 
@@ -169,13 +169,13 @@ inline float& Vec2::operator[](uint32_t i)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec2::operator+(const Vec2& a) const
+inline Vector2 Vector2::operator+(const Vector2& a) const
 {
-	return Vec2(x + a.x, y + a.y);
+	return Vector2(x + a.x, y + a.y);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2& Vec2::operator+=(const Vec2& a)
+inline Vector2& Vector2::operator+=(const Vector2& a)
 {
 	x += a.x;
 	y += a.y;
@@ -184,13 +184,13 @@ inline Vec2& Vec2::operator+=(const Vec2& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec2::operator-(const Vec2& a) const
+inline Vector2 Vector2::operator-(const Vector2& a) const
 {
-	return Vec2(x - a.x, y - a.y);
+	return Vector2(x - a.x, y - a.y);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2& Vec2::operator-=(const Vec2& a)
+inline Vector2& Vector2::operator-=(const Vector2& a)
 {
 	x -= a.x;
 	y -= a.y;
@@ -199,13 +199,13 @@ inline Vec2& Vec2::operator-=(const Vec2& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec2::operator*(float k) const
+inline Vector2 Vector2::operator*(float k) const
 {
-	return Vec2(x * k, y * k);
+	return Vector2(x * k, y * k);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2& Vec2::operator*=(float k)
+inline Vector2& Vector2::operator*=(float k)
 {
 	x *= k;
 	y *= k;
@@ -214,17 +214,17 @@ inline Vec2& Vec2::operator*=(float k)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec2::operator/(float k) const
+inline Vector2 Vector2::operator/(float k) const
 {
 	CE_ASSERT(k != (float)0.0, "Division by zero");
 
 	float inv = (float)(1.0 / k);
 
-	return Vec2(x * inv, y * inv);
+	return Vector2(x * inv, y * inv);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2& Vec2::operator/=(float k)
+inline Vector2& Vector2::operator/=(float k)
 {
 	CE_ASSERT(k != (float)0.0, "Division by zero");
 
@@ -237,49 +237,49 @@ inline Vec2& Vec2::operator/=(float k)
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec2::dot(const Vec2& a) const
+inline float Vector2::dot(const Vector2& a) const
 {
 	return x * a.x + y * a.y;
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec2::operator==(const Vec2& other) const
+inline bool Vector2::operator==(const Vector2& other) const
 {
 	return math::equals(x, other.x) && math::equals(y, other.y);
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec2::operator!=(const Vec2& other) const
+inline bool Vector2::operator!=(const Vector2& other) const
 {
 	return !math::equals(x, other.x) || !math::equals(y, other.y);
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec2::operator<(const Vec2& other) const
+inline bool Vector2::operator<(const Vector2& other) const
 {
 	return ((x < other.x) && (y < other.y));
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec2::operator>(const Vec2& other) const
+inline bool Vector2::operator>(const Vector2& other) const
 {
 	return ((x > other.x) && (y > other.y));
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec2::length() const
+inline float Vector2::length() const
 {
 	return math::sqrt(x * x + y * y);
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec2::squared_length() const
+inline float Vector2::squared_length() const
 {
 	return x * x + y * y;
 }
 
 //-----------------------------------------------------------------------------
-inline void Vec2::set_length(float len)
+inline void Vector2::set_length(float len)
 {
 	normalize();
 
@@ -288,19 +288,19 @@ inline void Vec2::set_length(float len)
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec2::get_angle() const
+inline float Vector2::get_angle() const
 {
 	return math::atan2(y, x);
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec2::get_angle_2d() const
+inline float Vector2::get_angle_2d() const
 {
 	return math::atan2(-y, x);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2& Vec2::normalize()
+inline Vector2& Vector2::normalize()
 {
 	float len = length();
 
@@ -316,15 +316,15 @@ inline Vec2& Vec2::normalize()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec2::get_normalized() const
+inline Vector2 Vector2::get_normalized() const
 {
-	Vec2 tmp(x, y);
+	Vector2 tmp(x, y);
 
 	return tmp.normalize();
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2& Vec2::negate()
+inline Vector2& Vector2::negate()
 {
 	x = -x;
 	y = -y;
@@ -333,44 +333,44 @@ inline Vec2& Vec2::negate()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec2::operator-() const
+inline Vector2 Vector2::operator-() const
 {
-	return Vec2(-x, -y);
+	return Vector2(-x, -y);
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec2::get_distance_to(const Vec2& a) const
+inline float Vector2::get_distance_to(const Vector2& a) const
 {
 	return (*this - a).length();
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec2::get_angle_between(const Vec2& a) const
+inline float Vector2::get_angle_between(const Vector2& a) const
 {
 	return math::acos(this->dot(a) / (this->length() * a.length()));
 }
 
 //-----------------------------------------------------------------------------
-inline void Vec2::zero()
+inline void Vector2::zero()
 {
 	x = 0.0;
 	y = 0.0;
 }
 
 //-----------------------------------------------------------------------------
-inline float* Vec2::to_float_ptr()
+inline float* Vector2::to_float_ptr()
 {
 	return &x;
 }
 
 //-----------------------------------------------------------------------------
-inline const float* Vec2::to_float_ptr() const
+inline const float* Vector2::to_float_ptr() const
 {
 	return &x;
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 get_projected_parallel(const Vec2& v, const Vec2& n)
+inline Vector2 get_projected_parallel(const Vector2& v, const Vector2& n)
 {
 	float n_len_q;
 	n_len_q = n.length();
@@ -380,13 +380,13 @@ inline Vec2 get_projected_parallel(const Vec2& v, const Vec2& n)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 get_projected_perpendicular(const Vec2& v, const Vec2& n)
+inline Vector2 get_projected_perpendicular(const Vector2& v, const Vector2& n)
 {
 	return v - get_projected_parallel(v, n);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 operator*(float k, const Vec2& a)
+inline Vector2 operator*(float k, const Vector2& a)
 {
 	return a * k;
 }

+ 6 - 6
engine/core/math/Vec3.cpp → engine/core/math/Vector3.cpp

@@ -24,16 +24,16 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Vec3.h"
+#include "Vector3.h"
 
 namespace crown
 {
 
-const Vec3 Vec3::ZERO	= Vec3(0.0, 0.0, 0.0);
-const Vec3 Vec3::ONE	= Vec3(1.0, 1.0, 1.0);
-const Vec3 Vec3::XAXIS	= Vec3(1.0, 0.0, 0.0);
-const Vec3 Vec3::YAXIS	= Vec3(0.0, 1.0, 0.0);
-const Vec3 Vec3::ZAXIS	= Vec3(0.0, 0.0, 1.0);
+const Vector3 Vector3::ZERO	= Vector3(0.0, 0.0, 0.0);
+const Vector3 Vector3::ONE	= Vector3(1.0, 1.0, 1.0);
+const Vector3 Vector3::XAXIS	= Vector3(1.0, 0.0, 0.0);
+const Vector3 Vector3::YAXIS	= Vector3(0.0, 1.0, 0.0);
+const Vector3 Vector3::ZAXIS	= Vector3(0.0, 0.0, 1.0);
 
 } // namespace crown
 

+ 81 - 81
engine/core/math/Vec3.h → engine/core/math/Vector3.h

@@ -29,30 +29,30 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Assert.h"
 #include "Types.h"
 #include "MathUtils.h"
-#include "Vec2.h"
+#include "Vector2.h"
 
 namespace crown
 {
 
 /// 3D column vector.
-class Vec3
+class Vector3
 {
 public:
 
 	float				x, y, z;
 
 	/// Does nothing for efficiency.
-						Vec3();	
+						Vector3();	
 
 	/// Initializes all the components to val								
-						Vec3(float val);	
+						Vector3(float val);	
 
 	/// Constructs from three components						
-						Vec3(float nx, float ny, float nz);
+						Vector3(float nx, float ny, float nz);
 						
 	/// Constructs from array		
-						Vec3(const float v[3]);					
-						Vec3(const Vec3& a);	
+						Vector3(const float v[3]);					
+						Vector3(const Vector3& a);	
 
 	/// Random access by index
 	float				operator[](uint32_t i) const;
@@ -60,32 +60,32 @@ public:
 	/// Random access by index			
 	float&				operator[](uint32_t i);					
 
-	Vec3				operator+(const Vec3& a) const;			
-	Vec3&				operator+=(const Vec3& a);				
-	Vec3 				operator-(const Vec3& a) const;			
-	Vec3&				operator-=(const Vec3& a);				
-	Vec3				operator*(float k) const;				
-	Vec3&				operator*=(float k);						
-	Vec3				operator/(float k) const;				
-	Vec3&				operator/=(float k);
+	Vector3				operator+(const Vector3& a) const;			
+	Vector3&			operator+=(const Vector3& a);				
+	Vector3 			operator-(const Vector3& a) const;			
+	Vector3&			operator-=(const Vector3& a);				
+	Vector3				operator*(float k) const;				
+	Vector3&			operator*=(float k);						
+	Vector3				operator/(float k) const;				
+	Vector3&			operator/=(float k);
 
 	/// Dot product						
-	float				dot(const Vec3& a) const;
+	float				dot(const Vector3& a) const;
 
 	/// Cross product				
-	Vec3				cross(const Vec3& a) const;				
+	Vector3				cross(const Vector3& a) const;				
 
 	/// For simmetry
-	friend Vec3			operator*(float k, const Vec3& a);		
+	friend Vector3		operator*(float k, const Vector3& a);		
 
-	bool				operator==(const Vec3& other) const;	
-	bool				operator!=(const Vec3& other) const;
+	bool				operator==(const Vector3& other) const;	
+	bool				operator!=(const Vector3& other) const;
 
 	/// Returns whether all the components of this vector are smaller than all of the "other" vector	
-	bool				operator<(const Vec3& other) const;
+	bool				operator<(const Vector3& other) const;
 
 	/// Returns whether all the components of this vector are greater than all of the "other" vector		
-	bool				operator>(const Vec3& other) const;		
+	bool				operator>(const Vector3& other) const;		
 
 	/// Returns the vector's length
 	float				length() const;	
@@ -97,22 +97,22 @@ public:
 	void				set_length(float len);
 
 	/// Normalizes the vector					
-	Vec3&				normalize();
+	Vector3&			normalize();
 
 	/// Returns the normalized vector							
-	Vec3				get_normalized() const;		
+	Vector3				get_normalized() const;		
 
 	/// Negates the vector (i.e. builds the inverse)			
-	Vec3&				negate();
+	Vector3&			negate();
 
 	/// Negates the vector (i.e. builds the inverse)								
-	Vec3				operator-() const;						
+	Vector3				operator-() const;						
 
 	/// Returns the distance
-	float				get_distance_to(const Vec3& a) const;	
+	float				get_distance_to(const Vector3& a) const;	
 
 	/// Returns the angle in radians
-	float				get_angle_between(const Vec3& a) const;	
+	float				get_angle_between(const Vector3& a) const;	
 
 	/// Sets all components to zero
 	void				zero();									
@@ -121,45 +121,45 @@ public:
 	float*				to_float_ptr();	
 
 	/// Returns the pointer to the vector's data						
-	const float*			to_float_ptr() const;
+	const float*		to_float_ptr() const;
 
-	/// Returns a Vec2 with only x and y coordinates					
-	Vec2				to_vec2() const;						
+	/// Returns a Vector2 with only x and y coordinates					
+	Vector2				to_vec2() const;						
 
-	static const Vec3	ZERO;
-	static const Vec3	ONE;
-	static const Vec3	XAXIS;
-	static const Vec3	YAXIS;
-	static const Vec3	ZAXIS;
+	static const Vector3	ZERO;
+	static const Vector3	ONE;
+	static const Vector3	XAXIS;
+	static const Vector3	YAXIS;
+	static const Vector3	ZAXIS;
 };
 
 //-----------------------------------------------------------------------------
-inline Vec3::Vec3()
+inline Vector3::Vector3()
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3::Vec3(float val) : x(val), y(val), z(val)
+inline Vector3::Vector3(float val) : x(val), y(val), z(val)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3::Vec3(float nx, float ny, float nz) : x(nx), y(ny), z(nz)
+inline Vector3::Vector3(float nx, float ny, float nz) : x(nx), y(ny), z(nz)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3::Vec3(const float v[3]) : x(v[0]), y(v[1]), z(v[2])
+inline Vector3::Vector3(const float v[3]) : x(v[0]), y(v[1]), z(v[2])
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3::Vec3(const Vec3& a) : x(a.x), y(a.y), z(a.z)
+inline Vector3::Vector3(const Vector3& a) : x(a.x), y(a.y), z(a.z)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec3::operator[](uint32_t i) const
+inline float Vector3::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 3, "Index must be < 3");
 
@@ -167,7 +167,7 @@ inline float Vec3::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-inline float& Vec3::operator[](uint32_t i)
+inline float& Vector3::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 3, "Index must be < 3");
 
@@ -175,13 +175,13 @@ inline float& Vec3::operator[](uint32_t i)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::operator+(const Vec3& a) const
+inline Vector3 Vector3::operator+(const Vector3& a) const
 {
-	return Vec3(x + a.x, y + a.y, z + a.z);
+	return Vector3(x + a.x, y + a.y, z + a.z);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3& Vec3::operator+=(const Vec3& a)
+inline Vector3& Vector3::operator+=(const Vector3& a)
 {
 	x += a.x;
 	y += a.y;
@@ -191,13 +191,13 @@ inline Vec3& Vec3::operator+=(const Vec3& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::operator-(const Vec3& a) const
+inline Vector3 Vector3::operator-(const Vector3& a) const
 {
-	return Vec3(x - a.x, y - a.y, z - a.z);
+	return Vector3(x - a.x, y - a.y, z - a.z);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3& Vec3::operator-=(const Vec3& a)
+inline Vector3& Vector3::operator-=(const Vector3& a)
 {
 	x -= a.x;
 	y -= a.y;
@@ -207,13 +207,13 @@ inline Vec3& Vec3::operator-=(const Vec3& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::operator*(float k) const
+inline Vector3 Vector3::operator*(float k) const
 {
-	return Vec3(x * k, y * k, z * k);
+	return Vector3(x * k, y * k, z * k);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3& Vec3::operator*=(float k)
+inline Vector3& Vector3::operator*=(float k)
 {
 	x *= k;
 	y *= k;
@@ -223,17 +223,17 @@ inline Vec3& Vec3::operator*=(float k)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::operator/(float k) const
+inline Vector3 Vector3::operator/(float k) const
 {
 	CE_ASSERT(k != (float)0.0, "Division by zero");
 
 	float inv = (float)(1.0 / k);
 
-	return Vec3(x * inv, y * inv, z * inv);
+	return Vector3(x * inv, y * inv, z * inv);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3& Vec3::operator/=(float k)
+inline Vector3& Vector3::operator/=(float k)
 {
 	CE_ASSERT(k != (float)0.0, "Division by zero");
 
@@ -247,61 +247,61 @@ inline Vec3& Vec3::operator/=(float k)
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec3::dot(const Vec3& a) const
+inline float Vector3::dot(const Vector3& a) const
 {
 	return x * a.x + y * a.y + z * a.z;
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::cross(const Vec3& a) const
+inline Vector3 Vector3::cross(const Vector3& a) const
 {
-	return Vec3(y * a.z - z * a.y, z * a.x - x * a.z, x * a.y - y * a.x);
+	return Vector3(y * a.z - z * a.y, z * a.x - x * a.z, x * a.y - y * a.x);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 operator*(float k, const Vec3& a)
+inline Vector3 operator*(float k, const Vector3& a)
 {
 	return a * k;
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec3::operator==(const Vec3& other) const
+inline bool Vector3::operator==(const Vector3& other) const
 {
 	return math::equals(x, other.x) && math::equals(y, other.y) && math::equals(z, other.z);
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec3::operator!=(const Vec3& other) const
+inline bool Vector3::operator!=(const Vector3& other) const
 {
 	return !math::equals(x, other.x) || !math::equals(y, other.y) || !math::equals(z, other.z);
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec3::operator<(const Vec3& other) const
+inline bool Vector3::operator<(const Vector3& other) const
 {
 	return ((x < other.x) && (y < other.y) && (z < other.z));
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec3::operator>(const Vec3& other) const
+inline bool Vector3::operator>(const Vector3& other) const
 {
 	return ((x > other.x) && (y > other.y) && (z > other.z));
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec3::length() const
+inline float Vector3::length() const
 {
 	return math::sqrt(x * x + y * y + z * z);
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec3::squared_length() const
+inline float Vector3::squared_length() const
 {
 	return x * x + y * y + z * z;
 }
 
 //-----------------------------------------------------------------------------
-inline void Vec3::set_length(float len)
+inline void Vector3::set_length(float len)
 {
 	normalize();
 
@@ -311,7 +311,7 @@ inline void Vec3::set_length(float len)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3& Vec3::normalize()
+inline Vector3& Vector3::normalize()
 {
 	float len = length();
 
@@ -330,15 +330,15 @@ inline Vec3& Vec3::normalize()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::get_normalized() const
+inline Vector3 Vector3::get_normalized() const
 {
-	Vec3 tmp(x, y, z);
+	Vector3 tmp(x, y, z);
 
 	return tmp.normalize();
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3& Vec3::negate()
+inline Vector3& Vector3::negate()
 {
 	x = -x;
 	y = -y;
@@ -348,25 +348,25 @@ inline Vec3& Vec3::negate()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::operator-() const
+inline Vector3 Vector3::operator-() const
 {
-	return Vec3(-x, -y, -z);
+	return Vector3(-x, -y, -z);
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec3::get_distance_to(const Vec3& a) const
+inline float Vector3::get_distance_to(const Vector3& a) const
 {
 	return (*this - a).length();
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec3::get_angle_between(const Vec3& a) const
+inline float Vector3::get_angle_between(const Vector3& a) const
 {
 	return math::acos(this->dot(a) / (this->length() * a.length()));
 }
 
 //-----------------------------------------------------------------------------
-inline void Vec3::zero()
+inline void Vector3::zero()
 {
 	x = 0.0;
 	y = 0.0;
@@ -374,26 +374,26 @@ inline void Vec3::zero()
 }
 
 //-----------------------------------------------------------------------------
-inline float* Vec3::to_float_ptr()
+inline float* Vector3::to_float_ptr()
 {
 	return &x;
 }
 
 //-----------------------------------------------------------------------------
-inline const float* Vec3::to_float_ptr() const
+inline const float* Vector3::to_float_ptr() const
 {
 	return &x;
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec3::to_vec2() const
+inline Vector2 Vector3::to_vec2() const
 {
-	return Vec2(x, y);
+	return Vector2(x, y);
 }
 
 //-----------------------------------------------------------------------------
 /// Returns the parallel portion of "v" projected onto "n"
-inline Vec3 get_projected_parallel(const Vec3& v, const Vec3& n)
+inline Vector3 get_projected_parallel(const Vector3& v, const Vector3& n)
 {
 	float n_len_q;
 	n_len_q = n.length();
@@ -404,7 +404,7 @@ inline Vec3 get_projected_parallel(const Vec3& v, const Vec3& n)
 
 //-----------------------------------------------------------------------------
 /// Returns the perpendicular portion of "v" projected onto "n"
-inline Vec3 get_projected_perpendicular(const Vec3& v, const Vec3& n)
+inline Vector3 get_projected_perpendicular(const Vector3& v, const Vector3& n)
 {
 	return v - get_projected_parallel(v, n);
 }

+ 7 - 7
engine/core/math/Vec4.cpp → engine/core/math/Vector4.cpp

@@ -24,18 +24,18 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Vec4.h"
+#include "Vector4.h"
 #include "Types.h"
 
 namespace crown
 {
 
-const Vec4 Vec4::ZERO	= Vec4(0.0, 0.0, 0.0, 0.0);
-const Vec4 Vec4::ONE	= Vec4(1.0, 1.0, 1.0, 1.0);
-const Vec4 Vec4::XAXIS	= Vec4(1.0, 0.0, 0.0, 0.0);
-const Vec4 Vec4::YAXIS	= Vec4(0.0, 1.0, 0.0, 0.0);
-const Vec4 Vec4::ZAXIS	= Vec4(0.0, 0.0, 1.0, 0.0);
-const Vec4 Vec4::WAXIS	= Vec4(0.0, 0.0, 0.0, 1.0);
+const Vector4 Vector4::ZERO	= Vector4(0.0, 0.0, 0.0, 0.0);
+const Vector4 Vector4::ONE	= Vector4(1.0, 1.0, 1.0, 1.0);
+const Vector4 Vector4::XAXIS	= Vector4(1.0, 0.0, 0.0, 0.0);
+const Vector4 Vector4::YAXIS	= Vector4(0.0, 1.0, 0.0, 0.0);
+const Vector4 Vector4::ZAXIS	= Vector4(0.0, 0.0, 1.0, 0.0);
+const Vector4 Vector4::WAXIS	= Vector4(0.0, 0.0, 0.0, 1.0);
 
 } // namespace crown
 

+ 72 - 72
engine/core/math/Vec4.h → engine/core/math/Vector4.h

@@ -34,24 +34,24 @@ namespace crown
 {
 
 /// 4D column vector.
-class Vec4
+class Vector4
 {
 public:
 
 	float				x, y, z, w;
 
 	/// Does nothing for efficiency.
-						Vec4();	
+						Vector4();	
 
 	/// Initializes all the components to val						
-						Vec4(float val);
+						Vector4(float val);
 
 	/// Constructs from four components								
-						Vec4(float nx, float ny, float nz, float nw);
+						Vector4(float nx, float ny, float nz, float nw);
 
 	/// Constructs from array	
-						Vec4(const float v[4]);						
-						Vec4(const Vec4& a);
+						Vector4(const float v[4]);						
+						Vector4(const Vector4& a);
 
 	/// Random access by index
 	float				operator[](uint32_t i) const;	
@@ -59,29 +59,29 @@ public:
 	/// Random access by index
 	float&				operator[](uint32_t i);						
 
-	Vec4				operator+(const Vec4& a) const;				
-	Vec4&				operator+=(const Vec4& a);					
-	Vec4 				operator-(const Vec4& a) const;				
-	Vec4&				operator-=(const Vec4& a);					
-	Vec4				operator*(float k) const;					
-	Vec4&				operator*=(float k);							
-	Vec4				operator/(float k) const;					
-	Vec4&				operator/=(float k);
+	Vector4				operator+(const Vector4& a) const;				
+	Vector4&			operator+=(const Vector4& a);					
+	Vector4 			operator-(const Vector4& a) const;				
+	Vector4&			operator-=(const Vector4& a);					
+	Vector4				operator*(float k) const;					
+	Vector4&			operator*=(float k);							
+	Vector4				operator/(float k) const;					
+	Vector4&			operator/=(float k);
 
 	/// Dot product							
-	float				dot(const Vec4& a) const;					
+	float				dot(const Vector4& a) const;					
 
 	/// For simmetry
-	friend Vec4			operator*(float k, const Vec4& a);			
+	friend Vector4		operator*(float k, const Vector4& a);			
 
-	bool				operator==(const Vec4& other) const;		
-	bool				operator!=(const Vec4& other) const;
+	bool				operator==(const Vector4& other) const;		
+	bool				operator!=(const Vector4& other) const;
 
 	/// Returns whether all the components of this vector are smaller than all of the @a other vector	
-	bool				operator<(const Vec4& other) const;	
+	bool				operator<(const Vector4& other) const;	
 
 	/// Returns whether all the components of this vector are greater than all of the @a other vector		
-	bool				operator>(const Vec4& other) const;			
+	bool				operator>(const Vector4& other) const;			
 
 	/// Returns the vector's length
 	float				length() const;	
@@ -93,22 +93,22 @@ public:
 	void				set_length(float len);
 
 	/// Normalizes the vector						
-	Vec4&				normalize();
+	Vector4&			normalize();
 
 	/// Returns the normalized vector								
-	Vec4				get_normalized() const;
+	Vector4				get_normalized() const;
 
 	/// Negates the vector (i.e. builds the inverse)						
-	Vec4&				negate();	
+	Vector4&			negate();	
 
 	/// Negates the vector (i.e. builds the inverse)								
-	Vec4				operator-() const;							
+	Vector4				operator-() const;							
 
 	/// Returns the distance
-	float				get_distance_to(const Vec4& a) const;
+	float				get_distance_to(const Vector4& a) const;
 
 	/// Returns the angle in radians		
-	float				get_angle_between(const Vec4& a) const;		
+	float				get_angle_between(const Vector4& a) const;		
 
 	/// Sets all components to zero
 	void				zero();										
@@ -117,43 +117,43 @@ public:
 	float*				to_float_ptr();	
 
 	/// Returns the pointer to the vector's data							
-	const float*			to_float_ptr() const;						
-
-	static const Vec4	ZERO;
-	static const Vec4	ONE;
-	static const Vec4	XAXIS;
-	static const Vec4	YAXIS;
-	static const Vec4	ZAXIS;
-	static const Vec4	WAXIS;
+	const float*		to_float_ptr() const;						
+
+	static const Vector4	ZERO;
+	static const Vector4	ONE;
+	static const Vector4	XAXIS;
+	static const Vector4	YAXIS;
+	static const Vector4	ZAXIS;
+	static const Vector4	WAXIS;
 };
 
 //-----------------------------------------------------------------------------
-inline Vec4::Vec4()
+inline Vector4::Vector4()
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4::Vec4(float val) : x(val), y(val), z(val), w(val)
+inline Vector4::Vector4(float val) : x(val), y(val), z(val), w(val)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4::Vec4(float nx, float ny, float nz, float nw) : x(nx), y(ny), z(nz), w(nw)
+inline Vector4::Vector4(float nx, float ny, float nz, float nw) : x(nx), y(ny), z(nz), w(nw)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4::Vec4(const float a[4]) : x(a[0]), y(a[1]), z(a[2]), w(a[3])
+inline Vector4::Vector4(const float a[4]) : x(a[0]), y(a[1]), z(a[2]), w(a[3])
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4::Vec4(const Vec4& a) : x(a.x), y(a.y), z(a.z), w(a.w)
+inline Vector4::Vector4(const Vector4& a) : x(a.x), y(a.y), z(a.z), w(a.w)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec4::operator[](uint32_t i) const
+inline float Vector4::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 4, "Index must be < 4");
 
@@ -161,7 +161,7 @@ inline float Vec4::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-inline float& Vec4::operator[](uint32_t i)
+inline float& Vector4::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 4, "Index must be < 4");
 
@@ -169,13 +169,13 @@ inline float& Vec4::operator[](uint32_t i)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 Vec4::operator+(const Vec4& a) const
+inline Vector4 Vector4::operator+(const Vector4& a) const
 {
-	return Vec4(x + a.x, y + a.y, z + a.z, w + a.w);
+	return Vector4(x + a.x, y + a.y, z + a.z, w + a.w);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4& Vec4::operator+=(const Vec4& a)
+inline Vector4& Vector4::operator+=(const Vector4& a)
 {
 	x += a.x;
 	y += a.y;
@@ -186,13 +186,13 @@ inline Vec4& Vec4::operator+=(const Vec4& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 Vec4::operator-(const Vec4& a) const
+inline Vector4 Vector4::operator-(const Vector4& a) const
 {
-	return Vec4(x - a.x, y - a.y, z - a.z, w - a.w);
+	return Vector4(x - a.x, y - a.y, z - a.z, w - a.w);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4& Vec4::operator-=(const Vec4& a)
+inline Vector4& Vector4::operator-=(const Vector4& a)
 {
 	x -= a.x;
 	y -= a.y;
@@ -203,13 +203,13 @@ inline Vec4& Vec4::operator-=(const Vec4& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 Vec4::operator*(float k) const
+inline Vector4 Vector4::operator*(float k) const
 {
-	return Vec4(x * k, y * k, z * k, w * k);
+	return Vector4(x * k, y * k, z * k, w * k);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4& Vec4::operator*=(float k)
+inline Vector4& Vector4::operator*=(float k)
 {
 	x *= k;
 	y *= k;
@@ -220,17 +220,17 @@ inline Vec4& Vec4::operator*=(float k)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 Vec4::operator/(float k) const
+inline Vector4 Vector4::operator/(float k) const
 {
 	CE_ASSERT(k != (float)0.0, "Division by zero");
 
 	float inv = (float)(1.0 / k);
 
-	return Vec4(x * inv, y * inv, z * inv, w * inv);
+	return Vector4(x * inv, y * inv, z * inv, w * inv);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4& Vec4::operator/=(float k)
+inline Vector4& Vector4::operator/=(float k)
 {
 	CE_ASSERT(k != (float)0.0, "Division by zero");
 
@@ -245,55 +245,55 @@ inline Vec4& Vec4::operator/=(float k)
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec4::dot(const Vec4& a) const
+inline float Vector4::dot(const Vector4& a) const
 {
 	return x * a.x + y * a.y + z * a.z + w * a.w;
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 operator*(float k, const Vec4& a)
+inline Vector4 operator*(float k, const Vector4& a)
 {
 	return a * k;
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec4::operator==(const Vec4& other) const
+inline bool Vector4::operator==(const Vector4& other) const
 {
 	return math::equals(x, other.x) && math::equals(y, other.y) && math::equals(z, other.z) && math::equals(w, other.w);
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec4::operator!=(const Vec4& other) const
+inline bool Vector4::operator!=(const Vector4& other) const
 {
 	return !math::equals(x, other.x) || !math::equals(y, other.y) || !math::equals(z, other.z) || !math::equals(w, other.w);
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec4::operator<(const Vec4& other) const
+inline bool Vector4::operator<(const Vector4& other) const
 {
 	return ((x < other.x) && (y < other.y) && (z < other.z) && (w < other.w));
 }
 
 //-----------------------------------------------------------------------------
-inline bool Vec4::operator>(const Vec4& other) const
+inline bool Vector4::operator>(const Vector4& other) const
 {
 	return ((x > other.x) && (y > other.y) && (z > other.z) && (w > other.w));
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec4::length() const
+inline float Vector4::length() const
 {
 	return math::sqrt(x * x + y * y + z * z + w * w);
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec4::squared_length() const
+inline float Vector4::squared_length() const
 {
 	return x * x + y * y + z * z + w * w;
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4& Vec4::normalize()
+inline Vector4& Vector4::normalize()
 {
 	float len = length();
 
@@ -313,15 +313,15 @@ inline Vec4& Vec4::normalize()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 Vec4::get_normalized() const
+inline Vector4 Vector4::get_normalized() const
 {
-	Vec4 tmp(x, y, z, w);
+	Vector4 tmp(x, y, z, w);
 
 	return tmp.normalize();
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4& Vec4::negate()
+inline Vector4& Vector4::negate()
 {
 	x = -x;
 	y = -y;
@@ -332,25 +332,25 @@ inline Vec4& Vec4::negate()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 Vec4::operator-() const
+inline Vector4 Vector4::operator-() const
 {
-	return Vec4(-x, -y, -z, -w);
+	return Vector4(-x, -y, -z, -w);
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec4::get_distance_to(const Vec4& a) const
+inline float Vector4::get_distance_to(const Vector4& a) const
 {
 	return (*this - a).length();
 }
 
 //-----------------------------------------------------------------------------
-inline float Vec4::get_angle_between(const Vec4& a) const
+inline float Vector4::get_angle_between(const Vector4& a) const
 {
 	return math::acos(this->dot(a) / (this->length() * a.length()));
 }
 
 //-----------------------------------------------------------------------------
-inline void Vec4::zero()
+inline void Vector4::zero()
 {
 	x = 0.0;
 	y = 0.0;
@@ -359,13 +359,13 @@ inline void Vec4::zero()
 }
 
 //-----------------------------------------------------------------------------
-inline float* Vec4::to_float_ptr()
+inline float* Vector4::to_float_ptr()
 {
 	return &x;
 }
 
 //-----------------------------------------------------------------------------
-inline const float* Vec4::to_float_ptr() const
+inline const float* Vector4::to_float_ptr() const
 {
 	return &x;
 }

+ 3 - 3
engine/input/Accelerometer.h

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
-#include "Vec3.h"
+#include "Vector3.h"
 
 namespace crown
 {
@@ -43,14 +43,14 @@ struct Accelerometer
 
 	/// Returns the orientation of the accelerometer.
 	/// FIXME NEED MORE DOCUMENTATION
-	const Vec3& orientation() const
+	const Vector3& orientation() const
 	{
 		return m_orientation;
 	}
 
 public:
 
-	Vec3			m_orientation;
+	Vector3			m_orientation;
 };
 
 } // namespace crown

+ 8 - 8
engine/input/Mouse.h

@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include <cstring>
 #include "Types.h"
-#include "Vec2.h"
+#include "Vector2.h"
 
 namespace crown
 {
@@ -88,9 +88,9 @@ public:
 	/// Coordinates in window space have the origin at the
 	/// upper-left corner of the window. +X extends from left
 	/// to right and +Y extends from top to bottom.
-	Vec2 cursor_xy()
+	Vector2 cursor_xy()
 	{
-		return Vec2(m_x, m_y);
+		return Vector2(m_x, m_y);
 	}
 
 	/// Sets the position of the cursor in window space.
@@ -98,7 +98,7 @@ public:
 	/// Coordinates in window space have the origin at the
 	/// upper-left corner of the window. +X extends from left
 	/// to right and +Y extends from top to bottom.
-	void set_cursor_xy(const Vec2& position)
+	void set_cursor_xy(const Vector2& position)
 	{
 		m_x = (uint16_t) position.x;
 		m_y = (uint16_t) position.y;
@@ -113,9 +113,9 @@ public:
 	/// Relative coordinates are mapped to a float varying
 	/// from 0.0 to 1.0 where 0.0 is the origin and 1.0 the
 	/// maximum extent of the cosidered axis.
-	Vec2 cursor_relative_xy()
+	Vector2 cursor_relative_xy()
 	{
-		return Vec2(m_x / m_width, m_y / m_height);
+		return Vector2(m_x / m_width, m_y / m_height);
 	}
 
 	/// Sets the relative position of the cursor in window space.
@@ -127,9 +127,9 @@ public:
 	/// Relative coordinates are mapped to a float varying
 	/// from 0.0 to 1.0 where 0.0 is the origin and 1.0 the
 	/// maximum extent of the cosidered axis.
-	void set_cursor_relative_xy(const Vec2& position)
+	void set_cursor_relative_xy(const Vector2& position)
 	{
-		set_cursor_xy(Vec2(position.x * (float) m_width, position.y * (float) m_height));
+		set_cursor_xy(Vector2(position.x * (float) m_width, position.y * (float) m_height));
 	}
 
 	//-----------------------------------------------------------------------------

+ 5 - 5
engine/input/Touch.h

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
-#include "Vec2.h"
+#include "Vector2.h"
 
 namespace crown
 {
@@ -63,11 +63,11 @@ struct Touch
 	/// Coordinates in window space have the origin at the
 	/// upper-left corner of the window. +X extends from left
 	/// to right and +Y extends from top to bottom.
-	Vec2 touch_xy(uint16_t id) const
+	Vector2 touch_xy(uint16_t id) const
 	{
 		const PointerData& data = m_pointers[id];
 
-		return Vec2(data.x, data.y);
+		return Vector2(data.x, data.y);
 	}
 
 	/// Returns the relative position of the pointer @a id in window space.
@@ -79,11 +79,11 @@ struct Touch
 	/// Relative coordinates are mapped to a float varying
 	/// from 0.0 to 1.0 where 0.0 is the origin and 1.0 the
 	/// maximum extent of the cosidered axis.
-	Vec2 touch_relative_xy(uint16_t id)
+	Vector2 touch_relative_xy(uint16_t id)
 	{
 		const PointerData& data = m_pointers[id];
 
-		return Vec2(data.relative_x, data.relative_y);
+		return Vector2(data.relative_x, data.relative_y);
 	}
 
 public:

+ 1 - 1
engine/lua/LuaAccelerometer.cpp

@@ -37,7 +37,7 @@ CE_EXPORT int accelerometer_orientation(lua_State* L)
 {
 	LuaStack stack(L);
 
-	stack.push_vec3(device()->accelerometer()->orientation());
+	stack.push_vector3(device()->accelerometer()->orientation());
 
 	return 1;
 }

+ 1 - 1
engine/lua/LuaCamera.cpp

@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "Camera.h"
-#include "Vec2.h"
+#include "Vector2.h"
 #include "LuaStack.h"
 #include "LuaEnvironment.h"
 

+ 4 - 4
engine/lua/LuaEnvironment.cpp

@@ -46,10 +46,10 @@ CE_EXPORT int luaopen_libcrown(lua_State* /*L*/)
 	load_float_setting(*env);
 	load_string_setting(*env);
 
-	load_vec2(*env);
-	load_vec3(*env);
-	load_mat4(*env);
-	load_quat(*env);
+	load_vector2(*env);
+	load_vector3(*env);
+	load_matrix4x4(*env);
+	load_quaternion(*env);
 	load_math(*env);
 	load_window(*env);
 	load_mouse(*env);

+ 4 - 4
engine/lua/LuaEnvironment.h

@@ -96,10 +96,10 @@ void load_int_setting(LuaEnvironment& env);
 void load_float_setting(LuaEnvironment& env);
 void load_string_setting(LuaEnvironment& env);
 
-void load_vec2(LuaEnvironment& env);
-void load_vec3(LuaEnvironment& env);
-void load_mat4(LuaEnvironment& env);
-void load_quat(LuaEnvironment& env);
+void load_vector2(LuaEnvironment& env);
+void load_vector3(LuaEnvironment& env);
+void load_matrix4x4(LuaEnvironment& env);
+void load_quaternion(LuaEnvironment& env);
 void load_math(LuaEnvironment& env);
 void load_mouse(LuaEnvironment& env);
 void load_keyboard(LuaEnvironment& env);

+ 139 - 139
engine/lua/LuaMat4.cpp → engine/lua/LuaMatrix4x4.cpp

@@ -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

+ 4 - 4
engine/lua/LuaMouse.cpp

@@ -82,7 +82,7 @@ CE_EXPORT int mouse_cursor_xy(lua_State* L)
 {
 	LuaStack stack(L);
 
-	stack.push_vec2(device()->mouse()->cursor_xy());
+	stack.push_vector2(device()->mouse()->cursor_xy());
 
 	return 1;
 }
@@ -92,7 +92,7 @@ CE_EXPORT int mouse_set_cursor_xy(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& xy = stack.get_vec2(1);
+	Vector2& xy = stack.get_vector2(1);
 
 	device()->mouse()->set_cursor_xy(xy);
 
@@ -104,7 +104,7 @@ CE_EXPORT int mouse_cursor_relative_xy(lua_State* L)
 {
 	LuaStack stack(L);
 
-	stack.push_vec2(device()->mouse()->cursor_relative_xy());
+	stack.push_vector2(device()->mouse()->cursor_relative_xy());
 
 	return 1;
 }
@@ -114,7 +114,7 @@ CE_EXPORT int mouse_set_cursor_relative_xy(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& xy = stack.get_vec2(1);
+	Vector2& xy = stack.get_vector2(1);
 
 	device()->mouse()->set_cursor_relative_xy(xy);
 

+ 38 - 38
engine/lua/LuaQuat.cpp → engine/lua/LuaQuaternion.cpp

@@ -24,8 +24,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Quat.h"
-#include "Vec3.h"
+#include "Quaternion.h"
+#include "Vector3.h"
 #include "LuaStack.h"
 #include "LuaEnvironment.h"
 
@@ -34,24 +34,24 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat(lua_State* L)
+CE_EXPORT int quaternion(lua_State* L)
 {
 	LuaStack stack(L);
 
 	float w = stack.get_float(1);
-	Vec3& v = stack.get_vec3(2);
+	Vector3& v = stack.get_vector3(2);
 
-	stack.push_quat(Quat(v, w));
+	stack.push_quaternion(Quaternion(v, w));
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat_negate(lua_State* L)
+CE_EXPORT int quaternion_negate(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Quat& q = stack.get_quat(1);
+	Quaternion& q = stack.get_quaternion(1);
 
 	q.negate();
 
@@ -59,11 +59,11 @@ CE_EXPORT int quat_negate(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat_load_identity(lua_State* L)
+CE_EXPORT int quaternion_load_identity(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Quat& q = stack.get_quat(1);
+	Quaternion& q = stack.get_quaternion(1);
 
 	q.load_identity();
 
@@ -71,11 +71,11 @@ CE_EXPORT int quat_load_identity(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat_length(lua_State* L)
+CE_EXPORT int quaternion_length(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Quat& q = stack.get_quat(1);
+	Quaternion& q = stack.get_quaternion(1);
 
 	stack.push_float(q.length());
 
@@ -83,80 +83,80 @@ CE_EXPORT int quat_length(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat_conjugate(lua_State* L)
+CE_EXPORT int quaternion_conjugate(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Quat& q = stack.get_quat(1);
+	Quaternion& q = stack.get_quaternion(1);
 
-	stack.push_quat(q.get_conjugate());
+	stack.push_quaternion(q.get_conjugate());
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat_inverse(lua_State* L)
+CE_EXPORT int quaternion_inverse(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Quat& q = stack.get_quat(1);
+	Quaternion& q = stack.get_quaternion(1);
 
-	stack.push_quat(q.get_inverse());
+	stack.push_quaternion(q.get_inverse());
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat_cross(lua_State* L)
+CE_EXPORT int quaternion_cross(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Quat& q1 = stack.get_quat(1);
-	Quat& q2 = stack.get_quat(2);
+	Quaternion& q1 = stack.get_quaternion(1);
+	Quaternion& q2 = stack.get_quaternion(2);
 
-	stack.push_quat(q1 * q2);
+	stack.push_quaternion(q1 * q2);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat_multiply(lua_State* L)
+CE_EXPORT int quaternion_multiply(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Quat& q = stack.get_quat(1);
+	Quaternion& q = stack.get_quaternion(1);
 	float k = stack.get_float(2);
 
-	stack.push_quat(q * k);
+	stack.push_quaternion(q * k);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int quat_power(lua_State* L)
+CE_EXPORT int quaternion_power(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Quat& q = stack.get_quat(1);
+	Quaternion& q = stack.get_quaternion(1);
 	float k = stack.get_float(2);
 
-	stack.push_quat(q.power(k));
+	stack.push_quaternion(q.power(k));
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-void load_quat(LuaEnvironment& env)
+void load_quaternion(LuaEnvironment& env)
 {
-	env.load_module_function("Quat", "new",				quat);
-	env.load_module_function("Quat", "negate",			quat_negate);
-	env.load_module_function("Quat", "load_identity",	quat_load_identity);
-	env.load_module_function("Quat", "length",			quat_length);
-	env.load_module_function("Quat", "conjugate",		quat_conjugate);
-	env.load_module_function("Quat", "inverse",			quat_inverse);
-	env.load_module_function("Quat", "cross",			quat_cross);
-	env.load_module_function("Quat", "mul",				quat_multiply);
-	env.load_module_function("Quat", "pow",				quat_power);
+	env.load_module_function("Quaternion", "new",			quaternion);
+	env.load_module_function("Quaternion", "negate",		quaternion_negate);
+	env.load_module_function("Quaternion", "load_identity",	quaternion_load_identity);
+	env.load_module_function("Quaternion", "length",		quaternion_length);
+	env.load_module_function("Quaternion", "conjugate",		quaternion_conjugate);
+	env.load_module_function("Quaternion", "inverse",		quaternion_inverse);
+	env.load_module_function("Quaternion", "cross",			quaternion_cross);
+	env.load_module_function("Quaternion", "mul",			quaternion_multiply);
+	env.load_module_function("Quaternion", "pow",			quaternion_power);
 }
 
-} //namespace crown
+} //namespace crown

+ 32 - 32
engine/lua/LuaStack.cpp

@@ -26,134 +26,134 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "LuaStack.h"
 #include "Assert.h"
-#include "Vec2.h"
-#include "Vec3.h"
-#include "Mat4.h"
-#include "Quat.h"
+#include "Vector2.h"
+#include "Vector3.h"
+#include "Matrix4x4.h"
+#include "Quaternion.h"
 
 namespace crown
 {
 
 static const uint32_t 	LUA_VEC2_BUFFER_SIZE = 4096;
-static Vec2 			g_vec2_buffer[LUA_VEC2_BUFFER_SIZE];
+static Vector2 			g_vec2_buffer[LUA_VEC2_BUFFER_SIZE];
 static uint32_t 		g_vec2_used = 0;
 
 static const uint32_t 	LUA_VEC3_BUFFER_SIZE = 4096;
-static Vec3 			g_vec3_buffer[LUA_VEC3_BUFFER_SIZE];
+static Vector3 			g_vec3_buffer[LUA_VEC3_BUFFER_SIZE];
 static uint32_t 		g_vec3_used = 0;
 
 static const uint32_t 	LUA_MAT4_BUFFER_SIZE = 4096;
-static Mat4 			g_mat4_buffer[LUA_MAT4_BUFFER_SIZE];
+static Matrix4x4 			g_mat4_buffer[LUA_MAT4_BUFFER_SIZE];
 static uint32_t 		g_mat4_used = 0;
 
 static const uint32_t 	LUA_QUAT_BUFFER_SIZE = 4096;
-static Quat 			g_quat_buffer[LUA_QUAT_BUFFER_SIZE];
+static Quaternion 			g_quat_buffer[LUA_QUAT_BUFFER_SIZE];
 static uint32_t 		g_quat_used = 0;
 
 //-----------------------------------------------------------------------------
-static Vec2* next_vec2(const Vec2& v)
+static Vector2* next_vec2(const Vector2& v)
 {
-	CE_ASSERT(g_vec2_used < LUA_VEC2_BUFFER_SIZE, "Maximum number of Vec2 reached");
+	CE_ASSERT(g_vec2_used < LUA_VEC2_BUFFER_SIZE, "Maximum number of Vector2 reached");
 
 	return &(g_vec2_buffer[g_vec2_used++] = v);
 }
 
 //-----------------------------------------------------------------------------
-static Vec3* next_vec3(const Vec3& v)
+static Vector3* next_vec3(const Vector3& v)
 {
-	CE_ASSERT(g_vec3_used < LUA_VEC3_BUFFER_SIZE, "Maximum number of Vec3 reached");
+	CE_ASSERT(g_vec3_used < LUA_VEC3_BUFFER_SIZE, "Maximum number of Vector3 reached");
 
 	return &(g_vec3_buffer[g_vec3_used++] = v);
 }
 
 //-----------------------------------------------------------------------------
-static Mat4* next_mat4(const Mat4& m)
+static Matrix4x4* next_mat4(const Matrix4x4& m)
 {
-	CE_ASSERT(g_mat4_used < LUA_MAT4_BUFFER_SIZE, "Maximum number of Mat4 reached");
+	CE_ASSERT(g_mat4_used < LUA_MAT4_BUFFER_SIZE, "Maximum number of Matrix4x4 reached");
 
 	return &(g_mat4_buffer[g_mat4_used++] = m);
 }
 
 //-----------------------------------------------------------------------------
-static Quat* next_quat(const Quat& q)
+static Quaternion* next_quat(const Quaternion& q)
 {
-	CE_ASSERT(g_quat_used < LUA_QUAT_BUFFER_SIZE, "Maximum number of Quat reached");
+	CE_ASSERT(g_quat_used < LUA_QUAT_BUFFER_SIZE, "Maximum number of Quaternion reached");
 
 	return &(g_quat_buffer[g_quat_used++] = q);
 }
 
 //-----------------------------------------------------------------------------
-Vec2& LuaStack::get_vec2(int32_t index)
+Vector2& LuaStack::get_vector2(int32_t index)
 {
 	void* v = lua_touserdata(m_state, index);
 
 	if (v < &g_vec2_buffer[0] || v > &g_vec2_buffer[LUA_VEC2_BUFFER_SIZE-1])
 	{
-		luaL_typerror(m_state, index, "Vec2");
+		luaL_typerror(m_state, index, "Vector2");
 	}
 
-	return *(Vec2*)v;
+	return *(Vector2*)v;
 }
 
 //-----------------------------------------------------------------------------
-Vec3& LuaStack::get_vec3(int32_t index)
+Vector3& LuaStack::get_vector3(int32_t index)
 {
 	void* v = lua_touserdata(m_state, index);
 
 	if (v < &g_vec3_buffer[0] || v > &g_vec3_buffer[LUA_VEC3_BUFFER_SIZE-1])
 	{
-		luaL_typerror(m_state, index, "Vec3");
+		luaL_typerror(m_state, index, "Vector3");
 	}
 
-	return *(Vec3*)v;
+	return *(Vector3*)v;
 }
 
 //-----------------------------------------------------------------------------
-Mat4& LuaStack::get_mat4(int32_t index)
+Matrix4x4& LuaStack::get_matrix4x4(int32_t index)
 {
 	void* m = lua_touserdata(m_state, index);
 
 	if (m < &g_mat4_buffer[0] || m > &g_mat4_buffer[LUA_MAT4_BUFFER_SIZE-1])
 	{
-		luaL_typerror(m_state, index, "Mat4");
+		luaL_typerror(m_state, index, "Matrix4x4");
 	}
 
-	return *(Mat4*)m;
+	return *(Matrix4x4*)m;
 }
 
 //-----------------------------------------------------------------------------
-Quat& LuaStack::get_quat(int32_t index)
+Quaternion& LuaStack::get_quaternion(int32_t index)
 {
 	void* q = lua_touserdata(m_state, index);
 
 	if (q < &g_quat_buffer[0] || q > &g_quat_buffer[LUA_QUAT_BUFFER_SIZE-1])
 	{
-		luaL_typerror(m_state, index, "Quat");
+		luaL_typerror(m_state, index, "Quaternion");
 	}
 
-	return *(Quat*)q;
+	return *(Quaternion*)q;
 }
 
 //-----------------------------------------------------------------------------
-void LuaStack::push_vec2(const Vec2& v)
+void LuaStack::push_vector2(const Vector2& v)
 {
 	lua_pushlightuserdata(m_state, next_vec2(v));
 }
 
 //-----------------------------------------------------------------------------
-void LuaStack::push_vec3(const Vec3& v)
+void LuaStack::push_vector3(const Vector3& v)
 {
 	lua_pushlightuserdata(m_state, next_vec3(v));
 }
 
 //-----------------------------------------------------------------------------
-void LuaStack::push_mat4(const Mat4& m)
+void LuaStack::push_matrix4x4(const Matrix4x4& m)
 {
 	lua_pushlightuserdata(m_state, next_mat4(m));
 }
 
 //-----------------------------------------------------------------------------
-void LuaStack::push_quat(const Quat& q)
+void LuaStack::push_quaternion(const Quaternion& q)
 {
 	lua_pushlightuserdata(m_state, next_quat(q));
 }

+ 12 - 12
engine/lua/LuaStack.h

@@ -32,10 +32,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class Vec2;
-class Vec3;
-class Mat4;
-class Quat;
+class Vector2;
+class Vector3;
+class Matrix4x4;
+class Quaternion;
 
 class LuaStack
 {
@@ -142,14 +142,14 @@ public:
 		return lua_touserdata(m_state, index);	
 	}
 
-	Vec2& get_vec2(int32_t index);
-	Vec3& get_vec3(int32_t index);
-	Mat4& get_mat4(int32_t index);
-	Quat& get_quat(int32_t index);
-	void push_vec2(const Vec2& v);
-	void push_vec3(const Vec3& v);
-	void push_mat4(const Mat4& m);
-	void push_quat(const Quat& q);
+	Vector2& get_vector2(int32_t index);
+	Vector3& get_vector3(int32_t index);
+	Matrix4x4& get_matrix4x4(int32_t index);
+	Quaternion& get_quaternion(int32_t index);
+	void push_vector2(const Vector2& v);
+	void push_vector3(const Vector3& v);
+	void push_matrix4x4(const Matrix4x4& m);
+	void push_quaternion(const Quaternion& q);
 
 private:
 

+ 70 - 70
engine/lua/LuaVec2.cpp → engine/lua/LuaVector2.cpp

@@ -24,7 +24,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Vec2.h"
+#include "Vector2.h"
 #include "LuaStack.h"
 #include "LuaEnvironment.h"
 
@@ -32,24 +32,24 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2(lua_State* L)
+CE_EXPORT int vector2(lua_State* L)
 {
 	LuaStack stack(L);
 
 	float x = stack.get_float(1);
 	float y = stack.get_float(2);
 
-	stack.push_vec2(Vec2(x, y));
+	stack.push_vector2(Vector2(x, y));
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_values(lua_State* L)
+CE_EXPORT int vector2_values(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 
 	stack.push_float(a.x);
 	stack.push_float(a.y);
@@ -58,64 +58,64 @@ CE_EXPORT int vec2_values(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_add(lua_State* L)
+CE_EXPORT int vector2_add(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
-	Vec2& b = stack.get_vec2(2);
+	Vector2& a = stack.get_vector2(1);
+	Vector2& b = stack.get_vector2(2);
 
-	stack.push_vec2(a + b);
+	stack.push_vector2(a + b);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_subtract(lua_State* L)
+CE_EXPORT int vector2_subtract(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
-	Vec2& b = stack.get_vec2(2);
+	Vector2& a = stack.get_vector2(1);
+	Vector2& b = stack.get_vector2(2);
 
-	stack.push_vec2(a - b);
+	stack.push_vector2(a - b);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_multiply(lua_State* L)
+CE_EXPORT int vector2_multiply(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 	float k = stack.get_float(2);
 
-	stack.push_vec2(a * k);
+	stack.push_vector2(a * k);
 
 	return 1;
 }			
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_divide(lua_State* L)
+CE_EXPORT int vector2_divide(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 	float k = stack.get_float(2);
 
-	stack.push_vec2(a / k);
+	stack.push_vector2(a / k);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_dot(lua_State* L)
+CE_EXPORT int vector2_dot(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec2& a = stack.get_vec2(1);
-	Vec2& b = stack.get_vec2(2);
+	Vector2& a = stack.get_vector2(1);
+	Vector2& b = stack.get_vector2(2);
 
 	stack.push_float(a.dot(b));
 
@@ -123,12 +123,12 @@ CE_EXPORT int vec2_dot(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_equals(lua_State* L)
+CE_EXPORT int vector2_equals(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec2& a = stack.get_vec2(1);
-	Vec2& b = stack.get_vec2(2);
+	Vector2& a = stack.get_vector2(1);
+	Vector2& b = stack.get_vector2(2);
 
 	stack.push_bool(a == b);
 
@@ -136,12 +136,12 @@ CE_EXPORT int vec2_equals(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_lower(lua_State* L)
+CE_EXPORT int vector2_lower(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec2& a = stack.get_vec2(1);
-	Vec2& b = stack.get_vec2(2);
+	Vector2& a = stack.get_vector2(1);
+	Vector2& b = stack.get_vector2(2);
 
 	stack.push_bool(a < b);
 
@@ -149,12 +149,12 @@ CE_EXPORT int vec2_lower(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_greater(lua_State* L)
+CE_EXPORT int vector2_greater(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec2& a = stack.get_vec2(1);
-	Vec2& b = stack.get_vec2(2);
+	Vector2& a = stack.get_vector2(1);
+	Vector2& b = stack.get_vector2(2);
 	
 	stack.push_bool(a > b);
 
@@ -162,11 +162,11 @@ CE_EXPORT int vec2_greater(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_length(lua_State* L)
+CE_EXPORT int vector2_length(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 
 	stack.push_float(a.length());
 
@@ -174,11 +174,11 @@ CE_EXPORT int vec2_length(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_squared_length(lua_State* L)
+CE_EXPORT int vector2_squared_length(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 
 	stack.push_float(a.squared_length());
 
@@ -186,11 +186,11 @@ CE_EXPORT int vec2_squared_length(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_set_length(lua_State* L)
+CE_EXPORT int vector2_set_length(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 	float len = stack.get_float(2);
 
 	a.set_length(len);
@@ -199,36 +199,36 @@ CE_EXPORT int vec2_set_length(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_normalize(lua_State* L)
+CE_EXPORT int vector2_normalize(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 
-	stack.push_vec2(a.normalize());
+	stack.push_vector2(a.normalize());
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_negate(lua_State* L)
+CE_EXPORT int vector2_negate(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 
-	stack.push_vec2(a.negate());
+	stack.push_vector2(a.negate());
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_get_distance_to(lua_State* L)
+CE_EXPORT int vector2_get_distance_to(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec2& a = stack.get_vec2(1);
-	Vec2& b = stack.get_vec2(2);
+	Vector2& a = stack.get_vector2(1);
+	Vector2& b = stack.get_vector2(2);
 
 	stack.push_float(a.get_distance_to(b));
 
@@ -236,12 +236,12 @@ CE_EXPORT int vec2_get_distance_to(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_get_angle_between(lua_State* L)
+CE_EXPORT int vector2_get_angle_between(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec2& a = stack.get_vec2(1);
-	Vec2& b = stack.get_vec2(2);
+	Vector2& a = stack.get_vector2(1);
+	Vector2& b = stack.get_vector2(2);
 
 	stack.push_float(a.get_angle_between(b));
 
@@ -249,11 +249,11 @@ CE_EXPORT int vec2_get_angle_between(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec2_zero(lua_State* L)
+CE_EXPORT int vector2_zero(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec2& a = stack.get_vec2(1);
+	Vector2& a = stack.get_vector2(1);
 
 	a.zero();
 
@@ -261,26 +261,26 @@ CE_EXPORT int vec2_zero(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-void load_vec2(LuaEnvironment& env)
+void load_vector2(LuaEnvironment& env)
 {
-	env.load_module_function("Vec2", "new",					vec2);
-	env.load_module_function("Vec2", "val",					vec2_values);
-	env.load_module_function("Vec2", "add",					vec2_add);
-	env.load_module_function("Vec2", "sub",					vec2_subtract);
-	env.load_module_function("Vec2", "mul",					vec2_multiply);
-	env.load_module_function("Vec2", "div",					vec2_divide);
-	env.load_module_function("Vec2", "dot",					vec2_dot);
-	env.load_module_function("Vec2", "equals",				vec2_equals);
-	env.load_module_function("Vec2", "lower",				vec2_lower);
-	env.load_module_function("Vec2", "greater",				vec2_greater);
-	env.load_module_function("Vec2", "length",				vec2_length);
-	env.load_module_function("Vec2", "squared_length",		vec2_squared_length);
-	env.load_module_function("Vec2", "set_length",			vec2_set_length);
-	env.load_module_function("Vec2", "normalize",			vec2_normalize);
-	env.load_module_function("Vec2", "negate",				vec2_negate);
-	env.load_module_function("Vec2", "get_distance_to",		vec2_get_distance_to);
-	env.load_module_function("Vec2", "get_angle_between",	vec2_get_angle_between);
-	env.load_module_function("Vec2", "zero",				vec2_zero);
+	env.load_module_function("Vector2", "new",					vector2);
+	env.load_module_function("Vector2", "val",					vector2_values);
+	env.load_module_function("Vector2", "add",					vector2_add);
+	env.load_module_function("Vector2", "sub",					vector2_subtract);
+	env.load_module_function("Vector2", "mul",					vector2_multiply);
+	env.load_module_function("Vector2", "div",					vector2_divide);
+	env.load_module_function("Vector2", "dot",					vector2_dot);
+	env.load_module_function("Vector2", "equals",				vector2_equals);
+	env.load_module_function("Vector2", "lower",				vector2_lower);
+	env.load_module_function("Vector2", "greater",				vector2_greater);
+	env.load_module_function("Vector2", "length",				vector2_length);
+	env.load_module_function("Vector2", "squared_length",		vector2_squared_length);
+	env.load_module_function("Vector2", "set_length",			vector2_set_length);
+	env.load_module_function("Vector2", "normalize",			vector2_normalize);
+	env.load_module_function("Vector2", "negate",				vector2_negate);
+	env.load_module_function("Vector2", "get_distance_to",		vector2_get_distance_to);
+	env.load_module_function("Vector2", "get_angle_between",	vector2_get_angle_between);
+	env.load_module_function("Vector2", "zero",					vector2_zero);
 }
 
 } // namespace crown

+ 73 - 73
engine/lua/LuaVec3.cpp → engine/lua/LuaVector3.cpp

@@ -24,7 +24,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Vec3.h"
+#include "Vector3.h"
 #include "LuaStack.h"
 #include "LuaEnvironment.h"
 
@@ -32,7 +32,7 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3(lua_State* L)
+CE_EXPORT int vector3(lua_State* L)
 {
 	LuaStack stack(L);
 
@@ -40,17 +40,17 @@ CE_EXPORT int vec3(lua_State* L)
 	float y = stack.get_float(2);
 	float z = stack.get_float(3);
 
-	stack.push_vec3(Vec3(x, y, z));
+	stack.push_vector3(Vector3(x, y, z));
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_values(lua_State* L)
+CE_EXPORT int vector3_values(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 
 	stack.push_float(a.x);
 	stack.push_float(a.y);
@@ -60,64 +60,64 @@ CE_EXPORT int vec3_values(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_add(lua_State* L)
+CE_EXPORT int vector3_add(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
-	stack.push_vec3(a + b);
+	stack.push_vector3(a + b);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_subtract(lua_State* L)
+CE_EXPORT int vector3_subtract(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
-	stack.push_vec3(a - b);
+	stack.push_vector3(a - b);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_multiply(lua_State* L)
+CE_EXPORT int vector3_multiply(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 	float b = stack.get_float(2);
 
-	stack.push_vec3(a * b);
+	stack.push_vector3(a * b);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_divide(lua_State* L)
+CE_EXPORT int vector3_divide(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 	float b = stack.get_float(2);
 
-	stack.push_vec3(a / b);
+	stack.push_vector3(a / b);
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_dot(lua_State* L)
+CE_EXPORT int vector3_dot(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
 	stack.push_float(a.dot(b));
 
@@ -125,25 +125,25 @@ CE_EXPORT int vec3_dot(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_cross(lua_State* L)
+CE_EXPORT int vector3_cross(lua_State* L)
 {
 	LuaStack stack(L);
 	
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
-	stack.push_vec3(a.cross(b));
+	stack.push_vector3(a.cross(b));
 
 	return 1;
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_equals(lua_State* L)
+CE_EXPORT int vector3_equals(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
 	stack.push_bool(a == b);
 
@@ -151,12 +151,12 @@ CE_EXPORT int vec3_equals(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_lower(lua_State* L)
+CE_EXPORT int vector3_lower(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
 	stack.push_bool(a < b);
 
@@ -164,12 +164,12 @@ CE_EXPORT int vec3_lower(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_greater(lua_State* L)
+CE_EXPORT int vector3_greater(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
 	stack.push_bool(a > b);
 
@@ -177,11 +177,11 @@ CE_EXPORT int vec3_greater(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_length(lua_State* L)
+CE_EXPORT int vector3_length(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 
 	stack.push_float(a.length());
 
@@ -189,11 +189,11 @@ CE_EXPORT int vec3_length(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_squared_length(lua_State* L)
+CE_EXPORT int vector3_squared_length(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 
 	stack.push_float(a.squared_length());
 
@@ -201,11 +201,11 @@ CE_EXPORT int vec3_squared_length(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_set_length(lua_State* L)
+CE_EXPORT int vector3_set_length(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 	float len = stack.get_float(2);
 
 	a.set_length(len);
@@ -214,11 +214,11 @@ CE_EXPORT int vec3_set_length(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_normalize(lua_State* L)
+CE_EXPORT int vector3_normalize(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 
 	a.normalize();
 
@@ -226,11 +226,11 @@ CE_EXPORT int vec3_normalize(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_negate(lua_State* L)
+CE_EXPORT int vector3_negate(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 
 	a.negate();
 
@@ -238,12 +238,12 @@ CE_EXPORT int vec3_negate(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_get_distance_to(lua_State* L)
+CE_EXPORT int vector3_get_distance_to(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
 	stack.push_float(a.get_distance_to(b));
 
@@ -251,12 +251,12 @@ CE_EXPORT int vec3_get_distance_to(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_get_angle_between(lua_State* L)
+CE_EXPORT int vector3_get_angle_between(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
-	Vec3& b = stack.get_vec3(2);
+	Vector3& a = stack.get_vector3(1);
+	Vector3& b = stack.get_vector3(2);
 
 	stack.push_float(a.get_angle_between(b));
 
@@ -264,11 +264,11 @@ CE_EXPORT int vec3_get_angle_between(lua_State* L)
 }
 
 //-----------------------------------------------------------------------------
-CE_EXPORT int vec3_zero(lua_State* L)
+CE_EXPORT int vector3_zero(lua_State* L)
 {
 	LuaStack stack(L);
 
-	Vec3& a = stack.get_vec3(1);
+	Vector3& a = stack.get_vector3(1);
 
 	a.zero();
 
@@ -276,27 +276,27 @@ CE_EXPORT int vec3_zero(lua_State* L)
 }	
 
 //-----------------------------------------------------------------------------
-void load_vec3(LuaEnvironment& env)
+void load_vector3(LuaEnvironment& env)
 {
-	env.load_module_function("Vec3", "new", 				vec3);
-	env.load_module_function("Vec3", "val", 				vec3_values);
-	env.load_module_function("Vec3", "add", 				vec3_add);
-	env.load_module_function("Vec3", "sub", 				vec3_subtract);
-	env.load_module_function("Vec3", "mul", 				vec3_multiply);
-	env.load_module_function("Vec3", "div", 				vec3_divide);
-	env.load_module_function("Vec3", "dot", 				vec3_dot);
-	env.load_module_function("Vec3", "cross", 				vec3_cross);
-	env.load_module_function("Vec3", "equals", 				vec3_equals);
-	env.load_module_function("Vec3", "lower", 				vec3_lower);
-	env.load_module_function("Vec3", "greater", 			vec3_greater);
-	env.load_module_function("Vec3", "length", 				vec3_length);
-	env.load_module_function("Vec3", "squared_length", 		vec3_squared_length);
-	env.load_module_function("Vec3", "set_length", 			vec3_set_length);
-	env.load_module_function("Vec3", "normalize", 			vec3_normalize);
-	env.load_module_function("Vec3", "negate", 				vec3_negate);
-	env.load_module_function("Vec3", "get_distance_to", 	vec3_get_distance_to);
-	env.load_module_function("Vec3", "get_angle_between", 	vec3_get_angle_between);
-	env.load_module_function("Vec3", "zero", 				vec3_zero);	
+	env.load_module_function("Vector3", "new", 				vector3);
+	env.load_module_function("Vector3", "val", 				vector3_values);
+	env.load_module_function("Vector3", "add", 				vector3_add);
+	env.load_module_function("Vector3", "sub", 				vector3_subtract);
+	env.load_module_function("Vector3", "mul", 				vector3_multiply);
+	env.load_module_function("Vector3", "div", 				vector3_divide);
+	env.load_module_function("Vector3", "dot", 				vector3_dot);
+	env.load_module_function("Vector3", "cross", 			vector3_cross);
+	env.load_module_function("Vector3", "equals", 			vector3_equals);
+	env.load_module_function("Vector3", "lower", 			vector3_lower);
+	env.load_module_function("Vector3", "greater", 			vector3_greater);
+	env.load_module_function("Vector3", "length", 			vector3_length);
+	env.load_module_function("Vector3", "squared_length", 	vector3_squared_length);
+	env.load_module_function("Vector3", "set_length", 		vector3_set_length);
+	env.load_module_function("Vector3", "normalize", 		vector3_normalize);
+	env.load_module_function("Vector3", "negate", 			vector3_negate);
+	env.load_module_function("Vector3", "get_distance_to", 	vector3_get_distance_to);
+	env.load_module_function("Vector3", "get_angle_between",vector3_get_angle_between);
+	env.load_module_function("Vector3", "zero", 			vector3_zero);	
 }
 
 } // namespace crown

+ 3 - 3
engine/network/BitMessage.cpp

@@ -440,7 +440,7 @@ void BitMessage::write_float(float f)
 }
 
 //---------------------------------------------------------------------------------------------
-void BitMessage::write_vec3(const Vec3& v)
+void BitMessage::write_vec3(const Vector3& v)
 {
 	write_float(v.x);
 	write_float(v.y);
@@ -646,9 +646,9 @@ float BitMessage::read_float() const
 }
 
 //---------------------------------------------------------------------------------------------
-Vec3 BitMessage::read_vec3() const
+Vector3 BitMessage::read_vec3() const
 {
-	Vec3 v;
+	Vector3 v;
 	
 	v.x = read_float();
 	v.y = read_float();

+ 3 - 3
engine/network/BitMessage.h

@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Types.h"
 #include "Allocator.h"
-#include "Vec3.h"
+#include "Vector3.h"
 #include "NetAddress.h"
 
 namespace crown
@@ -84,7 +84,7 @@ public:
 	void				write_uint16(int32_t c);
 	void				write_int32(int32_t c);
 	void				write_float(float f);
-	void				write_vec3(const Vec3& v);
+	void				write_vec3(const Vector3& v);
 	void				write_string(const char* s, int32_t max_len = -1, bool make_7_bit = true);
 	void				write_data(const void* data, int32_t length);
 	void				write_netaddr(const os::NetAddress addr);
@@ -100,7 +100,7 @@ public:
 	int32_t				read_uint16() const;
 	int32_t				read_int32() const;
 	float				read_float() const;
-	Vec3				read_vec3() const;
+	Vector3				read_vec3() const;
 	int32_t				read_string(char* buffer, int32_t buffer_size) const;
 	int32_t				read_data(void* data, int32_t length) const;
 	void				read_netaddr(os::NetAddress* addr) const;

+ 22 - 22
engine/renderers/DebugRenderer.cpp

@@ -44,7 +44,7 @@ DebugRenderer::~DebugRenderer()
 }
 
 //-----------------------------------------------------------------------------
-void DebugRenderer::add_line(const Vec3& start, const Vec3& end, const Color4& color, bool depth_write)
+void DebugRenderer::add_line(const Vector3& start, const Vector3& end, const Color4& color, bool depth_write)
 {
 	if (m_lines_count >= MAX_DEBUG_LINES)
 	{
@@ -64,7 +64,7 @@ void DebugRenderer::add_line(const Vec3& start, const Vec3& end, const Color4& c
 }
 
 //-----------------------------------------------------------------------------
-void DebugRenderer::add_sphere(const Vec3& center, const float radius, const Color4& color, bool depth_write)
+void DebugRenderer::add_sphere(const Vector3& center, const float radius, const Color4& color, bool depth_write)
 {
 	const uint32_t deg_step = 15;
 
@@ -74,8 +74,8 @@ void DebugRenderer::add_sphere(const Vec3& center, const float radius, const Col
 		float rad_0 = math::deg_to_rad(deg);
 		float rad_1 = math::deg_to_rad(deg + deg_step);
 
-		Vec3 start(math::cos(rad_0) * radius, 0, -math::sin(rad_0) * radius);
-		Vec3 end  (math::cos(rad_1) * radius, 0, -math::sin(rad_1) * radius);
+		Vector3 start(math::cos(rad_0) * radius, 0, -math::sin(rad_0) * radius);
+		Vector3 end  (math::cos(rad_1) * radius, 0, -math::sin(rad_1) * radius);
 
 		add_line(center + start, center + end, color, depth_write);
 	}
@@ -86,8 +86,8 @@ void DebugRenderer::add_sphere(const Vec3& center, const float radius, const Col
 		float rad_0 = math::deg_to_rad(deg);
 		float rad_1 = math::deg_to_rad(deg + deg_step);
 
-		Vec3 start(math::cos(rad_0) * radius, math::sin(rad_0) * radius, 0);
-		Vec3 end  (math::cos(rad_1) * radius, math::sin(rad_1) * radius, 0);
+		Vector3 start(math::cos(rad_0) * radius, math::sin(rad_0) * radius, 0);
+		Vector3 end  (math::cos(rad_1) * radius, math::sin(rad_1) * radius, 0);
 
 		add_line(center + start, center + end, color, depth_write);
 	}
@@ -98,37 +98,37 @@ void DebugRenderer::add_sphere(const Vec3& center, const float radius, const Col
 		float rad_0 = math::deg_to_rad(deg);
 		float rad_1 = math::deg_to_rad(deg + deg_step);
 
-		Vec3 start(0, math::sin(rad_0) * radius, -math::cos(rad_0) * radius);
-		Vec3 end  (0, math::sin(rad_1) * radius, -math::cos(rad_1) * radius);
+		Vector3 start(0, math::sin(rad_0) * radius, -math::cos(rad_0) * radius);
+		Vector3 end  (0, math::sin(rad_1) * radius, -math::cos(rad_1) * radius);
 
 		add_line(center + start, center + end, color, depth_write);
 	}
 }
 
 //-----------------------------------------------------------------------------
-void DebugRenderer::add_box(const Vec3& min, const Vec3& max, const Color4& color, bool depth_write)
+void DebugRenderer::add_box(const Vector3& min, const Vector3& max, const Color4& color, bool depth_write)
 {
 	// Back lines
-	add_line(min                      , Vec3(max.x, min.y, min.z), color, depth_write);
-	add_line(Vec3(max.x, min.y, min.z), Vec3(max.x, max.y, min.z), color, depth_write);
-	add_line(Vec3(max.x, max.y, min.z), Vec3(min.x, max.y, min.z), color, depth_write);
-	add_line(Vec3(min.x, max.y, min.z), min                      , color, depth_write);
+	add_line(min                      , Vector3(max.x, min.y, min.z), color, depth_write);
+	add_line(Vector3(max.x, min.y, min.z), Vector3(max.x, max.y, min.z), color, depth_write);
+	add_line(Vector3(max.x, max.y, min.z), Vector3(min.x, max.y, min.z), color, depth_write);
+	add_line(Vector3(min.x, max.y, min.z), min                      , color, depth_write);
 
 	// Front lines
-	add_line(Vec3(min.x, min.y, max.z), Vec3(max.x, min.y, max.z), color, depth_write);
-	add_line(Vec3(max.x, min.y, max.z), Vec3(max.x, max.y, max.z), color, depth_write);
-	add_line(Vec3(max.x, max.y, max.z), Vec3(min.x, max.y, max.z), color, depth_write);
-	add_line(Vec3(min.x, max.y, max.z), Vec3(min.x, min.y, max.z), color, depth_write);
+	add_line(Vector3(min.x, min.y, max.z), Vector3(max.x, min.y, max.z), color, depth_write);
+	add_line(Vector3(max.x, min.y, max.z), Vector3(max.x, max.y, max.z), color, depth_write);
+	add_line(Vector3(max.x, max.y, max.z), Vector3(min.x, max.y, max.z), color, depth_write);
+	add_line(Vector3(min.x, max.y, max.z), Vector3(min.x, min.y, max.z), color, depth_write);
 
 	// Connect back and front vertices
-	add_line(min                      , Vec3(min.x, min.y, max.z), color, depth_write);
-	add_line(Vec3(max.x, min.y, min.z), Vec3(max.x, min.y, max.z), color, depth_write);
-	add_line(Vec3(max.x, max.y, min.z), Vec3(max.x, max.y, max.z), color, depth_write);
-	add_line(Vec3(min.x, max.y, min.z), Vec3(min.x, max.y, max.z), color, depth_write);
+	add_line(min                      , Vector3(min.x, min.y, max.z), color, depth_write);
+	add_line(Vector3(max.x, min.y, min.z), Vector3(max.x, min.y, max.z), color, depth_write);
+	add_line(Vector3(max.x, max.y, min.z), Vector3(max.x, max.y, max.z), color, depth_write);
+	add_line(Vector3(min.x, max.y, min.z), Vector3(min.x, max.y, max.z), color, depth_write);
 }
 
 //-----------------------------------------------------------------------------
-void DebugRenderer::add_pose(const Mat4& pose, bool depth_write)
+void DebugRenderer::add_pose(const Matrix4x4& pose, bool depth_write)
 {
 	add_line(pose.translation(), pose.translation() + pose.x(), Color4::RED, depth_write);
 	add_line(pose.translation(), pose.translation() + pose.y(), Color4::GREEN, depth_write);

+ 7 - 7
engine/renderers/DebugRenderer.h

@@ -27,9 +27,9 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
-#include "Vec3.h"
+#include "Vector3.h"
 #include "Color4.h"
-#include "Mat4.h"
+#include "Matrix4x4.h"
 
 namespace crown
 {
@@ -49,16 +49,16 @@ public:
 				DebugRenderer(Renderer& renderer);
 				~DebugRenderer();
 
-	void		add_line(const Vec3& start, const Vec3& end, const Color4& color, bool depth_write);
+	void		add_line(const Vector3& start, const Vector3& end, const Color4& color, bool depth_write);
 
 	/// Total cost: 72 lines
-	void		add_sphere(const Vec3& center, const float radius, const Color4& color, bool depth_write);
+	void		add_sphere(const Vector3& center, const float radius, const Color4& color, bool depth_write);
 
 	/// Total cost: 12 lines
-	void		add_box(const Vec3& min, const Vec3& max, const Color4& color, bool depth_write);
+	void		add_box(const Vector3& min, const Vector3& max, const Color4& color, bool depth_write);
 
 	/// Total cost: 3 lines
-	void		add_pose(const Mat4& pose, bool depth_write);
+	void		add_pose(const Matrix4x4& pose, bool depth_write);
 
 private:
 
@@ -70,7 +70,7 @@ private:
 
 	uint32_t	m_lines_count;
 
-	Vec3		m_lines[MAX_DEBUG_LINES * 2];
+	Vector3		m_lines[MAX_DEBUG_LINES * 2];
 	Color4		m_colors[MAX_DEBUG_LINES * 2];
 	bool		m_depth_writes[MAX_DEBUG_LINES * 2];
 

+ 8 - 8
engine/renderers/RenderContext.h

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Color4.h"
-#include "Mat4.h"
+#include "Matrix4x4.h"
 #include "IdTable.h"
 #include "CommandBuffer.h"
 #include "ConstantBuffer.h"
@@ -131,7 +131,7 @@ struct RenderState
 	{
 		m_flags = STATE_NONE;
 
-		pose = Mat4::IDENTITY;
+		pose = Matrix4x4::IDENTITY;
 		program.id = INVALID_ID;
 		vb.id = INVALID_ID;
 		ib.id = INVALID_ID;
@@ -147,7 +147,7 @@ public:
 
 	uint64_t		m_flags;
 
-	Mat4			pose;
+	Matrix4x4			pose;
 	GPUProgramId	program;
 	VertexBufferId	vb;
 	IndexBufferId	ib;
@@ -188,7 +188,7 @@ struct RenderContext
 		m_state.m_flags = flags;
 	}
 
-	void set_pose(const Mat4& pose)
+	void set_pose(const Matrix4x4& pose)
 	{
 		m_state.pose = pose;
 	}
@@ -240,14 +240,14 @@ struct RenderContext
 		m_clears[layer].m_depth = depth;
 	}
 
-	void set_layer_view(uint8_t layer, const Mat4& view)
+	void set_layer_view(uint8_t layer, const Matrix4x4& view)
 	{
 		CE_ASSERT(layer < MAX_RENDER_LAYERS, "Layer out of bounds");
 
 		m_view_matrices[layer] = view;
 	}
 
-	void set_layer_projection(uint8_t layer, const Mat4& projection)
+	void set_layer_projection(uint8_t layer, const Matrix4x4& projection)
 	{
 		CE_ASSERT(layer < MAX_RENDER_LAYERS, "Layer out of bounds");
 
@@ -315,8 +315,8 @@ public:
 
 	// Per-layer data
 	RenderTargetId m_targets[MAX_RENDER_LAYERS];
-	Mat4 m_view_matrices[MAX_RENDER_LAYERS];
-	Mat4 m_projection_matrices[MAX_RENDER_LAYERS];
+	Matrix4x4 m_view_matrices[MAX_RENDER_LAYERS];
+	Matrix4x4 m_projection_matrices[MAX_RENDER_LAYERS];
 	ViewRect m_viewports[MAX_RENDER_LAYERS];
 	ViewRect m_scissors[MAX_RENDER_LAYERS];
 

+ 3 - 3
engine/renderers/Renderer.h

@@ -569,7 +569,7 @@ public:
 		m_submit->set_state(flags);
 	}
 
-	inline void set_pose(const Mat4& pose)
+	inline void set_pose(const Matrix4x4& pose)
 	{
 		m_submit->set_pose(pose);
 	}
@@ -609,12 +609,12 @@ public:
 		m_submit->set_layer_clear(layer, flags, color, depth);
 	}
 
-	inline void set_layer_view(uint8_t layer, const Mat4& view)
+	inline void set_layer_view(uint8_t layer, const Matrix4x4& view)
 	{
 		m_submit->set_layer_view(layer, view);
 	}
 
-	inline void set_layer_projection(uint8_t layer, const Mat4& projection)
+	inline void set_layer_projection(uint8_t layer, const Matrix4x4& projection)
 	{
 		m_submit->set_layer_projection(layer, projection);
 	}

+ 5 - 5
engine/renderers/gl/GLRenderer.cpp

@@ -40,9 +40,9 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Types.h"
 #include "GLRenderer.h"
 #include "Log.h"
-#include "Vec4.h"
-#include "Mat3.h"
-#include "Mat4.h"
+#include "Vector4.h"
+#include "Matrix3x3.h"
+#include "Matrix4x4.h"
 #include "Device.h"
 #include "Hash.h"
 #include "StringUtils.h"
@@ -309,8 +309,8 @@ public:
 				for (uint8_t uniform = 0; uniform < gpu_program.m_num_stock_uniforms; uniform++)
 				{
 					const GLint& uniform_location = gpu_program.m_stock_uniform_locations[uniform];
-					const Mat4& view = context.m_view_matrices[layer];
-					const Mat4& projection = context.m_projection_matrices[layer];
+					const Matrix4x4& view = context.m_view_matrices[layer];
+					const Matrix4x4& projection = context.m_projection_matrices[layer];
 
 					switch (gpu_program.m_stock_uniforms[uniform])
 					{

+ 1 - 1
engine/resource/MaterialResource.h

@@ -29,7 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Types.h"
 #include "TextureResource.h"
 #include "Resource.h"
-#include "Vec3.h"
+#include "Vector3.h"
 #include "Color4.h"
 #include "Bundle.h"
 #include "Allocator.h"

+ 3 - 3
engine/tests/messages.cpp

@@ -1,6 +1,6 @@
 #include <cstdio>
 
-#include "Vec3.h"
+#include "Vector3.h"
 #include "OS.h"
 #include "NetAddress.h"
 #include "BitMessage.h"
@@ -220,8 +220,8 @@ void test_vec3()
   	network::BitMessage m = network::BitMessage(allocator);
 	
 	
-	Vec3 v(0.525f, 0.432f, 0.234f);
-	Vec3 res;
+	Vector3 v(0.525f, 0.432f, 0.234f);
+	Vector3 res;
 	
 	m.init(12);
 	m.write_vec3(v);

+ 16 - 16
samples/terrain/Terrain.cpp

@@ -29,7 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Renderer.h"
 #include "MathUtils.h"
 #include "Log.h"
-#include "Vec2.h"
+#include "Vector2.h"
 #include "Interpolation.h"
 
 namespace crown
@@ -86,11 +86,11 @@ void Terrain::CreateTerrain(uint32_t xSize, uint32_t zSize, uint32_t tilePerMete
 	}
 
 	// Construct drawing data
-	mVertices = (Vec3*)m_allocator.allocate(heightsCount * sizeof(Vec3));		// There are as many vertices as heights
+	mVertices = (Vector3*)m_allocator.allocate(heightsCount * sizeof(Vector3));		// There are as many vertices as heights
 	mVertexCount = heightsCount;
-	mNormals = (Vec3*)m_allocator.allocate(heightsCount * sizeof(Vec3));		// Same as vertices
+	mNormals = (Vector3*)m_allocator.allocate(heightsCount * sizeof(Vector3));		// Same as vertices
 	mNormalCount = heightsCount;
-	mTexCoords = (Vec2*)m_allocator.allocate(heightsCount * sizeof(Vec2));				// Same as vertices
+	mTexCoords = (Vector2*)m_allocator.allocate(heightsCount * sizeof(Vector2));				// Same as vertices
 	mTexCoordCount = heightsCount;
 	mIndices = (uint16_t*)m_allocator.allocate(mTilesInSizeX * mTilesInSizeZ * 6 * sizeof(uint16_t));	//
 	mIndexCount = mTilesInSizeX * mTilesInSizeZ * 6;
@@ -170,9 +170,9 @@ void Terrain::UpdateVertexBuffer(bool recomputeNormals)
 	{
 		for (uint32_t i = 0; i < mIndexCount; i += 3)
 		{
-			Vec3 normal;
-			Vec3 v1;
-			Vec3 v2;
+			Vector3 normal;
+			Vector3 v1;
+			Vector3 v2;
 
 			v1 = mVertices[mIndices[i + 0]] - mVertices[mIndices[i + 1]];
 			v2 = mVertices[mIndices[i + 2]] - mVertices[mIndices[i + 1]];
@@ -196,7 +196,7 @@ float Terrain::GetHeightAt(uint32_t x, uint32_t z) const
 	return mHeights[z * mVerticesInSizeX + x];
 }
 
-float Terrain::GetHeightAt(const Vec3& xyz) const
+float Terrain::GetHeightAt(const Vector3& xyz) const
 {
 	uint32_t x, z;
 
@@ -214,7 +214,7 @@ void Terrain::SetHeightAt(uint32_t x, uint32_t z, float height)
 	mHeights[z * mVerticesInSizeX + x] = math::clamp_to_range(mMinHeight, mMaxHeight, mHeights[z * mVerticesInSizeX + x]);
 }
 
-void Terrain::SetHeightAt(const Vec3& xyz, float height)
+void Terrain::SetHeightAt(const Vector3& xyz, float height)
 {
 	uint32_t x, z;
 
@@ -223,9 +223,9 @@ void Terrain::SetHeightAt(const Vec3& xyz, float height)
 	SetHeightAt(x + 0, z + 0, height);
 }
 
-void Terrain::WorldToHeight(const Vec3& xyz, uint32_t& x, uint32_t& z) const
+void Terrain::WorldToHeight(const Vector3& xyz, uint32_t& x, uint32_t& z) const
 {
-	Vec3 offsetted = xyz + Vec3(-mOffsetX, 0.0f, mOffsetZ);
+	Vector3 offsetted = xyz + Vector3(-mOffsetX, 0.0f, mOffsetZ);
 	offsetted.z = (float)mSizeZ - offsetted.z;
 
 	x = (uint32_t)offsetted.x;
@@ -242,7 +242,7 @@ bool Terrain::TraceRay(const Ray& ray, Triangle& result, Triangle& /*tri2*/, flo
 		Triangle tri(mVertices[mIndices[i + 0]], mVertices[mIndices[i + 1]], mVertices[mIndices[i + 2]]);
 
 		float ret;
-		Vec3 int32_tersectionPoint32_t;
+		Vector3 int32_tersectionPoint32_t;
 		if (Intersection::test_ray_triangle(ray, tri, ret, int32_tersectionPoint32_t))
 		{
 			if (ret < minDist)
@@ -259,15 +259,15 @@ bool Terrain::TraceRay(const Ray& ray, Triangle& result, Triangle& /*tri2*/, flo
 	return hit;
 }
 
-uint32_t Terrain::SnapToGrid(const Vec3& vertex)
+uint32_t Terrain::SnapToGrid(const Vector3& vertex)
 {
 	float minDist = 9999999.0f;
 	uint32_t indexToSnapped;
 	// Find the snapped point32_t to input vertex
 	for (uint32_t i = 0; i < mVertexCount; i++)
 	{
-		Vec3 tmp = mVertices[i];
-		Vec3 vertex2 = vertex;
+		Vector3 tmp = mVertices[i];
+		Vector3 vertex2 = vertex;
 		tmp.y = vertex2.y = 0.0f;
 
 		if (tmp.get_distance_to(vertex2) < minDist)
@@ -367,7 +367,7 @@ void Terrain::ApplyBrush(uint32_t x, uint32_t z, float scale)
 	}
 }
 
-void Terrain::ApplyBrush(const Vec3& xyz, float scale)
+void Terrain::ApplyBrush(const Vector3& xyz, float scale)
 {
 	uint32_t x, z;
 

+ 9 - 9
samples/terrain/Terrain.h

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "Vec3.h"
+#include "Vector3.h"
 #include "Triangle.h"
 #include "Intersection.h"
 #include "Ray.h"
@@ -49,24 +49,24 @@ public:
 	void		CreateTerrain(uint32_t xSize, uint32_t zSize, uint32_t tilePerMeter, float initialHeight);
 
 	float		GetHeightAt(uint32_t x, uint32_t z) const;
-	float		GetHeightAt(const Vec3& xyz) const;
+	float		GetHeightAt(const Vector3& xyz) const;
 
 	void		SetHeightAt(uint32_t x, uint32_t z, float height);
-	void		SetHeightAt(const Vec3& xyz, float height);
+	void		SetHeightAt(const Vector3& xyz, float height);
 
-	void		WorldToHeight(const Vec3& xyz, uint32_t& x, uint32_t& z) const;
+	void		WorldToHeight(const Vector3& xyz, uint32_t& x, uint32_t& z) const;
 
 	void		UpdateVertexBuffer(bool recomputeNormals);
 
 	bool		TraceRay(const Ray& ray, Triangle& result, Triangle& tri2, float& dist);
 
-	uint32_t	SnapToGrid(const Vec3& vertex);
+	uint32_t	SnapToGrid(const Vector3& vertex);
 
 	void		BuildBrush(uint32_t width, uint32_t height, float smooth);
 	float		GaussDist(float x, float y, float sigma);
 
 	void		ApplyBrush(uint32_t x, uint32_t z, float scale);
-	void		ApplyBrush(const Vec3& xyz, float scale);
+	void		ApplyBrush(const Vector3& xyz, float scale);
 
 	void		PlotCircle(int32_t xx, int32_t yy, int32_t radius, int32_t i);
 
@@ -91,13 +91,13 @@ private:
 	float			mMaxHeight;
 
 	uint32_t		mVertexCount;
-	Vec3*			mVertices;
+	Vector3*			mVertices;
 
 	uint32_t		mNormalCount;
-	Vec3*			mNormals;
+	Vector3*			mNormals;
 
 	uint32_t		mTexCoordCount;
-	Vec2*			mTexCoords;
+	Vector2*			mTexCoords;
 
 	uint32_t		mIndexCount;
 	uint16_t*		mIndices;

+ 4 - 4
samples/terrain/terrain_main.cpp

@@ -80,7 +80,7 @@ public:
 	//{
 	//	crown::Renderer* renderer = crown::device()->renderer();
 	//	
-	//	Vec3 start = Vec3(0.0f, 10.0f, 0.0f);
+	//	Vector3 start = Vector3(0.0f, 10.0f, 0.0f);
 
 	//	// Add a movable camera
 	//	cam = CE_NEW(m_allocator, Camera)(start, 90.0f, 1.6f);
@@ -141,7 +141,7 @@ public:
 	//	/* Render the terrain */
 	//	renderer->set_ambient_light(Color4(0.5f, 0.5f, 0.5f, 1.0f));
 
-	//	renderer->set_matrix(MT_MODEL, Mat4::IDENTITY);
+	//	renderer->set_matrix(MT_MODEL, Matrix4x4::IDENTITY);
 
 	//	if (device()->is_loaded(grass))
 	//	{
@@ -157,7 +157,7 @@ public:
 	//	if (terrain.TraceRay(ray, tri, tri2, dist))
 	//	{
 	//		renderer->set_depth_test(false);
-	//		Vec3 intersectionPoint = ray.origin() + (ray.direction() * dist);
+	//		Vector3 intersectionPoint = ray.origin() + (ray.direction() * dist);
 	//		if (mouseLeftPressed)
 	//		{
 	//			terrain.ApplyBrush(intersectionPoint, 0.09f);
@@ -177,7 +177,7 @@ public:
 	//HeapAllocator m_allocator;
 	//FPSSystem* system;
 	//Camera* cam;
-	//Mat4 ortho;
+	//Matrix4x4 ortho;
 	//Terrain terrain;
 
 	//// Resources