Bladeren bron

Use float instead of real

Daniele Bartolini 12 jaren geleden
bovenliggende
commit
7949e9d1af

+ 0 - 1
CMakeLists.txt

@@ -6,7 +6,6 @@ set (CROWN_VERSION_MAJOR 0)
 set (CROWN_VERSION_MINOR 1)
 set (CROWN_VERSION_MICRO 0)
 
-option (CROWN_USE_FLOAT "Whether to use float or double for representing real numbers." ON)
 option (CROWN_BUILD_OPENGL "Whether to build the OpenGL renderer or not." ON)
 option (CROWN_BUILD_OPENGLES "Whether to build the OpenGL|ES 1.0 renderer or not." OFF)
 option (CROWN_BUILD_SAMPLES "Whether to build the samples" ON)

+ 3 - 3
samples/terrain/Terrain.cpp

@@ -232,16 +232,16 @@ void Terrain::WorldToHeight(const Vec3& xyz, uint32_t& x, uint32_t& z) const
 	z = (uint32_t)offsetted.z;
 }
 
-bool Terrain::TraceRay(const Ray& ray, Triangle& result, Triangle& /*tri2*/, real& dist)
+bool Terrain::TraceRay(const Ray& ray, Triangle& result, Triangle& /*tri2*/, float& dist)
 {
 	bool hit = false;
-	real minDist = 9999999.0f;
+	float minDist = 9999999.0f;
 
 	for (uint32_t i = 0; i < mIndexCount; i += 3)
 	{
 		Triangle tri(mVertices[mIndices[i + 0]], mVertices[mIndices[i + 1]], mVertices[mIndices[i + 2]]);
 
-		real ret;
+		float ret;
 		Vec3 int32_tersectionPoint32_t;
 		if (Intersection::test_ray_triangle(ray, tri, ret, int32_tersectionPoint32_t))
 		{

+ 1 - 1
samples/terrain/Terrain.h

@@ -58,7 +58,7 @@ public:
 
 	void		UpdateVertexBuffer(bool recomputeNormals);
 
-	bool		TraceRay(const Ray& ray, Triangle& result, Triangle& tri2, real& dist);
+	bool		TraceRay(const Ray& ray, Triangle& result, Triangle& tri2, float& dist);
 
 	uint32_t	SnapToGrid(const Vec3& vertex);
 

+ 1 - 1
samples/terrain/terrain_main.cpp

@@ -196,7 +196,7 @@ public:
 
 		/* Test for intersection */
 		Triangle tri, tri2;
-		real dist;
+		float dist;
 		if (terrain.TraceRay(ray, tri, tri2, dist))
 		{
 			renderer->set_depth_test(false);

+ 0 - 1
src/Config.h.in

@@ -32,7 +32,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #cmakedefine WINDOWS
 #cmakedefine CROWN_BUILD_OPENGL
 #cmakedefine CROWN_BUILD_OPENGLES
-#cmakedefine CROWN_USE_FLOAT
 #cmakedefine CROWN_DEBUG
 
 // OS peculiarities

+ 2 - 2
src/FPSSystem.h

@@ -62,8 +62,8 @@ private:
 	float			m_camera_speed;
 	float			m_camera_sensibility;
 
-	real 			m_angle_x;
-	real 			m_angle_y;
+	float 			m_angle_x;
+	float 			m_angle_y;
 
 	bool			m_up_pressed	: 1;
 	bool			m_right_pressed	: 1;

+ 2 - 7
src/core/Types.h

@@ -26,19 +26,14 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "Config.h"
 #include <cstddef>
 #include <stdint.h>
 
+#include "Config.h"
+
 namespace crown
 {
 
-#ifdef CROWN_USE_FLOAT
-typedef float					real;
-#else
-typedef double					real;
-#endif
-
 #ifndef NULL
 #ifdef __cplusplus
 #define NULL    0

+ 4 - 4
src/core/bv/Box.h

@@ -55,8 +55,8 @@ public:
 	void			set_max(const Vec3& max);
 
 	Vec3			center() const;
-	real			radius() const;
-	real			volume() const;
+	float			radius() const;
+	float			volume() const;
 
 	/// Adds @a count @a points expanding if necessary.
 	void			add_points(const Vec3* points, uint32_t count);
@@ -219,7 +219,7 @@ inline Vec3 Box::center() const
 }
 
 //-----------------------------------------------------------------------------
-inline real Box::radius() const
+inline float Box::radius() const
 {
 	return (m_max - (m_min + m_max) * 0.5).length();
 }
@@ -317,7 +317,7 @@ inline void Box::transformed(const Mat4& mat, Box& result) const
 }
 
 //-----------------------------------------------------------------------------
-inline real Box::volume() const
+inline float Box::volume() const
 {
 	return (m_max.x - m_min.x) * (m_max.y - m_min.y) * (m_max.z - m_min.z);
 }

+ 9 - 9
src/core/bv/Circle.h

@@ -46,15 +46,15 @@ public:
 					Circle();
 					
 	/// Constructs from @a center and @a radius.
-					Circle(const Vec2& center, real radius);	
+					Circle(const Vec2& center, float radius);	
 					Circle(const Circle& circle);				
 
 	const Vec2&		center() const;							
-	real			radius() const;	
+	float			radius() const;	
 	void			set_center(const Vec2& center);			
-	void			set_radius(real radius);				
+	void			set_radius(float radius);				
 
-	real			area() const;						
+	float			area() const;						
 
 	/// Returns a Rect containing the circle.
 	Rect			to_rect() const;
@@ -62,7 +62,7 @@ public:
 private:
 
 	Vec2			m_center;
-	real			m_radius;
+	float			m_radius;
 };
 
 //-----------------------------------------------------------------------------
@@ -71,7 +71,7 @@ inline Circle::Circle()
 }
 
 //-----------------------------------------------------------------------------
-inline Circle::Circle(const Vec2& center, real radius) : m_center(center), m_radius(radius)
+inline Circle::Circle(const Vec2& center, float radius) : m_center(center), m_radius(radius)
 {
 }
 
@@ -87,7 +87,7 @@ inline const Vec2& Circle::center() const
 }
 
 //-----------------------------------------------------------------------------
-inline real Circle::radius() const
+inline float Circle::radius() const
 {
 	return m_radius;
 }
@@ -99,13 +99,13 @@ inline void Circle::set_center(const Vec2& center)
 }
 
 //-----------------------------------------------------------------------------
-inline void Circle::set_radius(real radius)
+inline void Circle::set_radius(float radius)
 {
 	m_radius = radius;
 }
 
 //-----------------------------------------------------------------------------
-inline real Circle::area() const
+inline float Circle::area() const
 {
 	return m_radius * m_radius * math::PI;
 }

+ 7 - 7
src/core/bv/Rect.cpp

@@ -48,12 +48,12 @@ bool Rect::intersects_rect(const Rect& rect) const
 }
 
 //-----------------------------------------------------------------------------
-void Rect::set_from_center_and_dimensions(Vec2 center, real width, real height)
+void Rect::set_from_center_and_dimensions(Vec2 center, float width, float height)
 {
-	m_min.x = (real)(center.x - width  / 2.0);
-	m_min.y = (real)(center.y - height / 2.0);
-	m_max.x = (real)(center.x + width  / 2.0);
-	m_max.y = (real)(center.y + height / 2.0);
+	m_min.x = (float)(center.x - width  / 2.0);
+	m_min.y = (float)(center.y - height / 2.0);
+	m_max.x = (float)(center.x + width  / 2.0);
+	m_max.y = (float)(center.y + height / 2.0);
 }
 
 //-----------------------------------------------------------------------------
@@ -100,13 +100,13 @@ Vec2 Rect::center() const
 }
 
 //-----------------------------------------------------------------------------
-real Rect::radius() const
+float Rect::radius() const
 {
 	return (m_max - (m_min + m_max) * 0.5).length();
 }
 
 //-----------------------------------------------------------------------------
-real Rect::area() const
+float Rect::area() const
 {
 	return (m_max.x - m_min.x) * (m_max.y - m_min.y);
 }

+ 3 - 3
src/core/bv/Rect.h

@@ -54,8 +54,8 @@ public:
 	void			set_max(const Vec2& max);			
 
 	Vec2			center() const;					
-	real			radius() const;					
-	real			area() const;		
+	float			radius() const;					
+	float			area() const;		
 
 	/// Returns the diagonal of the rect.
 	Vec2			size() const;						
@@ -67,7 +67,7 @@ public:
 	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, real width, real height);	
+	void			set_from_center_and_dimensions(Vec2 center, float width, float height);	
 
 	/// Returns the four vertices of the rect.
 	void			vertices(Vec2 v[4]) const;

+ 12 - 12
src/core/bv/Sphere.h

@@ -45,15 +45,15 @@ public:
 					Sphere();
 
 	/// Constructs from @a center and @a radius.
-					Sphere(const Vec3& center, real radius);
+					Sphere(const Vec3& center, float radius);
 					Sphere(const Sphere& a);
 
 	const Vec3&		center() const;		
-	real			radius() const;	
-	real			volume() const;	
+	float			radius() const;	
+	float			volume() const;	
 
 	void			set_center(const Vec3& center);
-	void			set_radius(real radius);
+	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);	
@@ -67,7 +67,7 @@ public:
 private:
 
 	Vec3			m_center;
-	real			m_radius;
+	float			m_radius;
 };
 
 //-----------------------------------------------------------------------------
@@ -76,7 +76,7 @@ inline Sphere::Sphere()
 }
 
 //-----------------------------------------------------------------------------
-inline Sphere::Sphere(const Vec3& center, real radius) : m_center(center), m_radius(radius)
+inline Sphere::Sphere(const Vec3& center, float radius) : m_center(center), m_radius(radius)
 {
 }
 
@@ -92,13 +92,13 @@ inline const Vec3& Sphere::center() const
 }
 
 //-----------------------------------------------------------------------------
-inline real Sphere::radius() const
+inline float Sphere::radius() const
 {
 	return m_radius;
 }
 
 //-----------------------------------------------------------------------------
-inline real Sphere::volume() const
+inline float Sphere::volume() const
 {
 	return math::FOUR_OVER_THREE_TIMES_PI * m_radius * m_radius * m_radius;
 }
@@ -110,7 +110,7 @@ inline void Sphere::set_center(const Vec3& center)
 }
 
 //-----------------------------------------------------------------------------
-inline void Sphere::set_radius(real radius)
+inline void Sphere::set_radius(float radius)
 {
 	m_radius = radius;
 }
@@ -122,7 +122,7 @@ inline void Sphere::add_points(const Vec3* points, uint32_t count)
 	{
 		const Vec3& p = points[i];
 
-		real dist = (p - m_center).squared_length();
+		float dist = (p - m_center).squared_length();
 
 		if (dist >= m_radius * m_radius)
 		{
@@ -138,7 +138,7 @@ inline void Sphere::add_spheres(const Sphere* spheres, uint32_t count)
 	{
 		const Sphere& s = spheres[i];
 
-		real dist = (s.m_center - m_center).squared_length();
+		float dist = (s.m_center - m_center).squared_length();
 
 		if (dist < (s.m_radius + m_radius) * (s.m_radius + m_radius))
 		{
@@ -153,7 +153,7 @@ inline void Sphere::add_spheres(const Sphere* spheres, uint32_t count)
 //-----------------------------------------------------------------------------
 inline bool Sphere::contains_point(const Vec3& p) const
 {
-	real dist = (p - m_center).squared_length();
+	float dist = (p - m_center).squared_length();
 	return (dist < m_radius * m_radius);
 }
 

+ 21 - 21
src/core/math/Interpolation.h

@@ -35,60 +35,60 @@ namespace interpolation
 
 /// Returns the linear interpolated value between @a p0 and @a p1 at time @a t
 template <typename T>
-static T	linear(const T& p0, const T& p1, real t);
+static T	linear(const T& p0, const T& p1, float t);
 
 /// Returns the cosine interpolated value between @a p0 and @a p1 at time @a t
 template <typename T>
-static T	cosine(const T& p0, const T& p1, real t);
+static T	cosine(const T& p0, const T& p1, float t);
 
 /// Returns the cubic interpolated value between @a p0 and @a p1 at time @a t
 template <typename T>
-static T	cubic(const T& p0, const T& p1, real t);
+static T	cubic(const T& p0, const T& p1, float t);
 
 /// Bezier interpolation
 template <typename T>
-static T	bezier(const T& p1, const T& p2, const T& p3, const T& p4, real t);
+static T	bezier(const T& p1, const T& p2, const T& p3, const T& p4, float t);
 
 /// Catmull-Rom interpolation
 template <typename T>
-static T	catmull_rom(const T& p0, const T& p1, const T& p2, const T& p3, real t);
+static T	catmull_rom(const T& p0, const T& p1, const T& p2, const T& p3, float t);
 
 //-----------------------------------------------------------------------------
 template <typename T>
-inline T linear(const T& p0, const T& p1, real t)
+inline T linear(const T& p0, const T& p1, float t)
 {
 	return p0 + (t * (p1 - p0));
 }
 
 //-----------------------------------------------------------------------------
 template <typename T>
-inline T cosine(const T& p0, const T& p1, real t)
+inline T cosine(const T& p0, const T& p1, float t)
 {
-	real f = t * math::PI;
-	real g = (1.0 - math::cos(f)) * 0.5;
+	float f = t * math::PI;
+	float g = (1.0 - math::cos(f)) * 0.5;
 
 	return p0 + (g * (p1 - p0));
 }
 
 //-----------------------------------------------------------------------------
 template <typename T>
-inline T cubic(const T& p0, const T& p1, real t)
+inline T cubic(const T& p0, const T& p1, float t)
 {
-	real tt = t * t;
-	real ttt = tt * t;
+	float tt = t * t;
+	float ttt = tt * t;
 
 	return p0 * (2.0 * ttt - 3.0 * tt + 1.0) + p1 * (3.0 * tt  - 2.0 * ttt);
 }
 
 //-----------------------------------------------------------------------------
 template <typename T>
-inline T bezier(const T& p0, const T& p1, const T& p2, const T& p3, real t)
+inline T bezier(const T& p0, const T& p1, const T& p2, const T& p3, float t)
 {
-	real u = 1.0 - t;
-	real tt = t * t ;
-	real uu = u * u;
-	real uuu = uu * u;
-	real ttt = tt * t;
+	float u = 1.0 - t;
+	float tt = t * t ;
+	float uu = u * u;
+	float uuu = uu * u;
+	float ttt = tt * t;
 
 	T tmp = (uuu * p0) +
 			(3 * uu * t * p1) +
@@ -100,10 +100,10 @@ inline T bezier(const T& p0, const T& p1, const T& p2, const T& p3, real t)
 
 //-----------------------------------------------------------------------------
 template <typename T>
-inline T catmull_rom(const T& p0, const T& p1, const T& p2, const T& p3, real t)
+inline T catmull_rom(const T& p0, const T& p1, const T& p2, const T& p3, float t)
 {
-	real tt = t * t;
-	real ttt = tt * t;
+	float tt = t * t;
+	float ttt = tt * t;
 
 	T tmp = (2.0 * p1) +
 			((-p0 + p2) * t) +

+ 64 - 64
src/core/math/Intersection.h

@@ -82,27 +82,27 @@ class Intersection
 {
 public:
 
-	static bool test_ray_plane(const Ray& r, const Plane& p, real& distance, Vec3& inttersectionPoint_t);
-	static bool test_ray_sphere(const Ray& r, const Sphere& s, real& distance, Vec3& intersectionPoint);
-	static bool test_ray_box(const Ray& r, const Box& b, real& distance, Vec3& intersectionPoint);
-	static bool test_ray_triangle(const Ray& r, const Triangle& t, real& distance, Vec3& intersectionPoint);
+	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_plane_3(const Plane& p1, const Plane& p2, const Plane& p3, Vec3& 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, real& it, Vec3& intersectionPoint);
-	static bool test_dynamic_sphere_triangle(const Sphere& s, const Vec3& d, const Triangle& tri, real& it, Vec3& intersectionPoint);
-	static bool test_dynamic_sphere_sphere(const Sphere& s1, const Vec3& d1, const Sphere& s2, const Vec3& d2, real& it, Vec3& intersectionPoint);
+	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_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, real& it);
+	static bool test_dynamic_box_box(const Box& b1, const Vec3& v1, const Box& b2, const Vec3& 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, real& it);
+	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);
 
@@ -113,14 +113,14 @@ private:
 };
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_ray_plane(const Ray& r, const Plane& p, real& distance, Vec3& intersectionPoint)
+inline bool Intersection::test_ray_plane(const Ray& r, const Plane& p, float& distance, Vec3& intersectionPoint)
 {
-	real nd = r.direction().dot(p.n);
-	real orpn = r.origin().dot(p.n);
+	float nd = r.direction().dot(p.n);
+	float orpn = r.origin().dot(p.n);
 
 	if (nd < 0.0)
 	{
-		real dist = (-p.d - orpn) / nd;
+		float dist = (-p.d - orpn) / nd;
 		if (dist > 0.0)
 		{
 			distance = dist;
@@ -133,11 +133,11 @@ inline bool Intersection::test_ray_plane(const Ray& r, const Plane& p, real& dis
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_ray_sphere(const Ray& r, const Sphere& s, real& distance, Vec3& intersectionPoint)
+inline bool Intersection::test_ray_sphere(const Ray& r, const Sphere& s, float& distance, Vec3& intersectionPoint)
 {
 	Vec3 v = s.center() - r.origin();
-	real b = v.dot(r.direction());
-	real det = (s.radius() * s.radius()) - v.dot(v) + (b * b);
+	float b = v.dot(r.direction());
+	float det = (s.radius() * s.radius()) - v.dot(v) + (b * b);
 
 	if (det < 0.0 || b < s.radius())
 	{
@@ -151,7 +151,7 @@ inline bool Intersection::test_ray_sphere(const Ray& r, const Sphere& s, real& d
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_ray_box(const Ray& r, const Box& b, real& /*distance*/, Vec3& /*intersectionPoint*/)
+inline bool Intersection::test_ray_box(const Ray& r, const Box& b, float& /*distance*/, Vec3& /*intersectionPoint*/)
 {
 	if (r.origin().x < b.min().x)
 	{
@@ -208,7 +208,7 @@ inline bool Intersection::test_ray_box(const Ray& r, const Box& b, real& /*dista
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_ray_triangle(const Ray& r, const Triangle& t, real& distance, Vec3& intersectionPoint)
+inline bool Intersection::test_ray_triangle(const Ray& r, const Triangle& t, float& distance, Vec3& intersectionPoint)
 {
 	if (Intersection::test_ray_plane(r, t.to_plane(), distance, intersectionPoint))
 	{
@@ -228,9 +228,9 @@ inline bool Intersection::test_plane_3(const Plane& p1, const Plane& p2, const P
 	const Vec3& n2 = p2.n;
 	const Vec3& n3 = p3.n;
 
-	real den = -n1.cross(n2).dot(n3);
+	float den = -n1.cross(n2).dot(n3);
 
-	if (math::equals(den, (real)0.0))
+	if (math::equals(den, (float)0.0))
 	{
 		return false;
 	}
@@ -255,21 +255,21 @@ inline bool Intersection::test_static_sphere_plane(const Sphere& s, const Plane&
 //-----------------------------------------------------------------------------
 inline bool Intersection::test_static_sphere_sphere(const Sphere& a, const Sphere& b)
 {
-	real dist = (b.center() - a.center()).squared_length();
+	float dist = (b.center() - a.center()).squared_length();
 	return (dist < (b.radius() + a.radius()) * (b.radius() + a.radius()));
 }
 
 //-----------------------------------------------------------------------------
-inline bool Intersection::test_dynamic_sphere_plane(const Sphere& s, const Vec3& d, const Plane& p, real& it, Vec3& intersectionPoint)
+inline bool Intersection::test_dynamic_sphere_plane(const Sphere& s, const Vec3& d, const Plane& p, float& it, Vec3& intersectionPoint)
 {
 	const Vec3& sphereCenter = s.center();
-	const real sphereRadius = s.radius();
+	const float sphereRadius = s.radius();
 
-	real t0;	// Time at which the sphere int32_tersects the plane remaining at the front side of the plane
-	real t1;	// Time at which the sphere int32_tersects the plane remaining at the back side of the plane
+	float t0;	// Time at which the sphere int32_tersects the plane remaining at the front side of the plane
+	float t1;	// Time at which the sphere int32_tersects the plane remaining at the back side of the plane
 
-	real sphereToPlaneDistance = p.distance_to_point(sphereCenter);
-	real planeNormalDotVelocity = p.n.dot(d);
+	float sphereToPlaneDistance = p.distance_to_point(sphereCenter);
+	float planeNormalDotVelocity = p.n.dot(d);
 
 	if (planeNormalDotVelocity > 0.0)
 	{
@@ -308,12 +308,12 @@ 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, real& it, Vec3& intersectionPoint)
+inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Vec3& d, const Triangle& tri, float& it, Vec3& intersectionPoint)
 {
 	Plane triPlane = tri.to_plane();
 
 	// Test against the plane containing the triangle
-	real spherePlaneIt;
+	float spherePlaneIt;
 	if (!test_dynamic_sphere_plane(s, d, triPlane, spherePlaneIt, intersectionPoint))
 	{
 		return false;
@@ -332,8 +332,8 @@ inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Ve
 	// Sweep test
 	// Check for collision against the vertices
 	bool collisionFound = false;
-	real a, b, c;
-	real x1, x2;
+	float a, b, c;
+	float x1, x2;
 
 	// v1
 	a = d.dot(d);
@@ -372,10 +372,10 @@ inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Ve
 	// Check for collisions against the edges
 	Vec3 edge;
 	Vec3 centerToVertex;
-	real edgeDotVelocity;
-	real edgeDotCenterToVertex;
-	real edgeSquaredLength;
-	real velocitySquaredLength;
+	float edgeDotVelocity;
+	float edgeDotCenterToVertex;
+	float edgeSquaredLength;
+	float velocitySquaredLength;
 
 	velocitySquaredLength = d.squared_length();
 
@@ -394,7 +394,7 @@ inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Ve
 
 	if (math::solve_quadratic_equation(a, b, c, x1, x2))
 	{
-		real f0 = (edgeDotVelocity * x1 - edgeDotCenterToVertex) / edgeSquaredLength;
+		float f0 = (edgeDotVelocity * x1 - edgeDotCenterToVertex) / edgeSquaredLength;
 
 		if (f0 >= 0.0 && f0 <= 1.0)
 		{
@@ -419,7 +419,7 @@ inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Ve
 
 	if (math::solve_quadratic_equation(a, b, c, x1, x2))
 	{
-		real f0 = (edgeDotVelocity * x1 - edgeDotCenterToVertex) / edgeSquaredLength;
+		float f0 = (edgeDotVelocity * x1 - edgeDotCenterToVertex) / edgeSquaredLength;
 
 		if (f0 >= 0.0 && f0 <= 1.0)
 		{
@@ -444,7 +444,7 @@ inline bool Intersection::test_dynamic_sphere_triangle(const Sphere& s, const Ve
 
 	if (math::solve_quadratic_equation(a, b, c, x1, x2))
 	{
-		real f0 = (edgeDotVelocity * x1 - edgeDotCenterToVertex) / edgeSquaredLength;
+		float f0 = (edgeDotVelocity * x1 - edgeDotCenterToVertex) / edgeSquaredLength;
 
 		if (f0 >= 0.0 && f0 <= 1.0)
 		{
@@ -458,7 +458,7 @@ 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, real& it, Vec3& /*intersectionPoint*/)
+inline bool Intersection::test_dynamic_sphere_sphere(const Sphere& s1, const Vec3& d1, const Sphere& s2, const Vec3& d2, float& it, Vec3& /*intersectionPoint*/)
 {
 	// s1 == static sphere
 	// s2 == moving sphere
@@ -469,7 +469,7 @@ inline bool Intersection::test_dynamic_sphere_sphere(const Sphere& s1, const Vec
 	const Vec3& cm = s2.center();
 
 	Vec3 e = cs - cm;
-	real r = s1.radius() + s2.radius();
+	float r = s1.radius() + s2.radius();
 
 	// If ||e|| < r, int32_tersection occurs at t = 0
 	if (e.length() < r)
@@ -479,8 +479,8 @@ inline bool Intersection::test_dynamic_sphere_sphere(const Sphere& s1, const Vec
 	}
 
 	// it == Intersection Time
-	real ed = e.dot(d);
-	real squared = (ed * ed) + (r * r) - e.dot(e);
+	float ed = e.dot(d);
+	float squared = (ed * ed) + (r * r) - e.dot(e);
 
 	// If the value inside the square root is neg, then no int32_tersection
 	if (squared < 0.0)
@@ -488,8 +488,8 @@ inline bool Intersection::test_dynamic_sphere_sphere(const Sphere& s1, const Vec
 		return false;
 	}
 
-	real t = ed - math::sqrt(squared);
-	real l = (d2 - d1).length();
+	float t = ed - math::sqrt(squared);
+	float l = (d2 - d1).length();
 
 	// If t < 0 || t > l, then non int32_tersection in the considered period of time
 	if (t < 0.0 || t > l)
@@ -523,7 +523,7 @@ 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, real& it)
+inline bool Intersection::test_dynamic_box_box(const Box& b1, const Vec3& v1, const Box& b2, const Vec3& v2, float& it)
 {
 	// b1 == static box
 	// b2 == moving box
@@ -535,7 +535,7 @@ inline bool Intersection::test_dynamic_box_box(const Box& b1, const Vec3& v1, co
 	Vec3 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, (real)0.0))
+	if (math::equals(d.x, (float)0.0))
 	{
 		if (b1.min().x > b2.max().x || b1.max().x < b2.min().x)
 		{
@@ -543,7 +543,7 @@ inline bool Intersection::test_dynamic_box_box(const Box& b1, const Vec3& v1, co
 		}
 	}
 
-	if (math::equals(d.y, (real)0.0))
+	if (math::equals(d.y, (float)0.0))
 	{
 		if (b1.min().y > b2.max().y || b1.max().y < b2.min().y)
 		{
@@ -551,7 +551,7 @@ inline bool Intersection::test_dynamic_box_box(const Box& b1, const Vec3& v1, co
 		}
 	}
 
-	if (math::equals(d.z, (real)0.0))
+	if (math::equals(d.z, (float)0.0))
 	{
 		if (b1.min().z > b2.max().z || b1.max().z < b2.min().z)
 		{
@@ -560,15 +560,15 @@ inline bool Intersection::test_dynamic_box_box(const Box& b1, const Vec3& v1, co
 	}
 
 	// Otherwise, compute the enter/leave times aint64_t each axis
-	real oneOverD = (real)(1.0 / d.x);
+	float oneOverD = (float)(1.0 / d.x);
 	tEnterXYZ.x = (b1.min().x - b2.max().x) * oneOverD;
 	tLeaveXYZ.x = (b1.max().x - b2.min().x) * oneOverD;
 
-	oneOverD = (real)(1.0 / d.y);
+	oneOverD = (float)(1.0 / d.y);
 	tEnterXYZ.y = (b1.min().y - b2.max().y) * oneOverD;
 	tLeaveXYZ.y = (b1.max().y - b2.min().y) * oneOverD;
 
-	oneOverD = (real)(1.0 / d.z);
+	oneOverD = (float)(1.0 / d.z);
 	tEnterXYZ.z = (b1.min().z - b2.max().z) * oneOverD;
 	tLeaveXYZ.z = (b1.max().z - b2.min().z) * oneOverD;
 
@@ -588,8 +588,8 @@ inline bool Intersection::test_dynamic_box_box(const Box& b1, const Vec3& v1, co
 		math::swap(tLeaveXYZ.z, tEnterXYZ.z);
 	}
 
-	real tEnter = math::max(tEnterXYZ.x, math::max(tEnterXYZ.y, tEnterXYZ.z));
-	real tLeave = math::min(tLeaveXYZ.x, math::min(tLeaveXYZ.y, tLeaveXYZ.z));
+	float tEnter = math::max(tEnterXYZ.x, math::max(tEnterXYZ.y, tEnterXYZ.z));
+	float tLeave = math::min(tLeaveXYZ.x, math::min(tLeaveXYZ.y, tLeaveXYZ.z));
 
 	// If tEnter > 1, then there is no int32_tersection in the period
 	// of time cosidered
@@ -656,8 +656,8 @@ 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)
 {
 	Vec2 distance = c1.center() - c2.center();
-	real distanceLen2 = distance.squared_length();
-	real radiusSum = c1.radius() + c2.radius();
+	float distanceLen2 = distance.squared_length();
+	float radiusSum = c1.radius() + c2.radius();
 	if (distanceLen2 > radiusSum*radiusSum)
 	{
 		return false;
@@ -676,7 +676,7 @@ 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, real& it)
+inline bool Intersection::test_dynamic_circle_circle(const Circle& c1, const Vec2& d1, const Circle& c2, const Vec2& d2, float& it)
 {
 	// c1 == static circle
 	// c2 == moving circle
@@ -687,7 +687,7 @@ inline bool Intersection::test_dynamic_circle_circle(const Circle& c1, const Vec
 	const Vec2& cm = c2.center();
 
 	Vec2 e = cs - cm;
-	real r = c1.radius() + c2.radius();
+	float r = c1.radius() + c2.radius();
 
 	// If ||e|| < r, int32_tersection occurs at t = 0
 	if (e.length() < r)
@@ -697,8 +697,8 @@ inline bool Intersection::test_dynamic_circle_circle(const Circle& c1, const Vec
 	}
 
 	// it == Intersection Time
-	real ed = e.dot(d);
-	real squared = (ed * ed) + (r * r) - e.dot(e);
+	float ed = e.dot(d);
+	float squared = (ed * ed) + (r * r) - e.dot(e);
 
 	// If the value inside the square root is neg, then no int32_tersection
 	if (squared < 0.0)
@@ -706,8 +706,8 @@ inline bool Intersection::test_dynamic_circle_circle(const Circle& c1, const Vec
 		return false;
 	}
 
-	real t = ed - math::sqrt(squared);
-	real l = (d2 - d1).length();
+	float t = ed - math::sqrt(squared);
+	float l = (d2 - d1).length();
 
 	// If t < 0 || t > l, then non int32_tersection in the considered period of time
 	if (t < 0.0 || t > l)
@@ -723,8 +723,8 @@ 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)
 {
 	//x
-	real min1MinusMax2 = r1.min().x - r2.max().x;
-	real min2MinusMax1 = r2.min().x - r1.max().x;
+	float min1MinusMax2 = r1.min().x - r2.max().x;
+	float min2MinusMax1 = r2.min().x - r1.max().x;
 
 	if (min1MinusMax2 > min2MinusMax1)
 	{
@@ -829,7 +829,7 @@ inline bool Intersection::test_circle_rect(const Circle& c1, const Rect& r2, Vec
 	else
 	{
 		penetration += Vec2(c1.radius(), c1.radius());
-		real len = math::sqrt(penetration.squared_length());
+		float len = math::sqrt(penetration.squared_length());
 		if (len > c1.radius())
 		{
 			return false;

+ 34 - 34
src/core/math/Mat3.cpp

@@ -43,8 +43,8 @@ Mat3::Mat3()
 }
 
 //-----------------------------------------------------------------------------
-Mat3::Mat3(real r1c1, real r2c1, real r3c1, real r1c2, real r2c2, real r3c2,
-	real r1c3, real r2c3, real r3c3)
+Mat3::Mat3(float r1c1, float r2c1, float r3c1, float r1c2, float r2c2, float r3c2,
+	float r1c3, float r2c3, float r3c3)
 {
 	m[0] = r1c1;
 	m[1] = r2c1;
@@ -58,7 +58,7 @@ Mat3::Mat3(real r1c1, real r2c1, real r3c1, real r1c2, real r2c2, real r3c2,
 }
 
 //-----------------------------------------------------------------------------
-Mat3::Mat3(const real v[9])
+Mat3::Mat3(const float v[9])
 {
 	m[0] = v[0];
 	m[1] = v[1];
@@ -102,7 +102,7 @@ Mat3& Mat3::operator=(const Mat3& a)
 }
 
 //-----------------------------------------------------------------------------
-real Mat3::operator[](uint32_t i) const
+float Mat3::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 9, "Index must be < 9");
 
@@ -110,7 +110,7 @@ real Mat3::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-real& Mat3::operator[](uint32_t i)
+float& Mat3::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 9, "Index must be < 9");
 
@@ -118,7 +118,7 @@ real& Mat3::operator[](uint32_t i)
 }
 
 //-----------------------------------------------------------------------------
-real Mat3::operator()(uint32_t row, uint32_t column) const
+float Mat3::operator()(uint32_t row, uint32_t column) const
 {
 	CE_ASSERT(row < 3 && column < 3, "Row and column must be < 3");
 
@@ -194,7 +194,7 @@ Mat3& Mat3::operator-=(const Mat3& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat3::operator*(real k) const
+Mat3 Mat3::operator*(float k) const
 {
 	Mat3 tmp;
 
@@ -212,7 +212,7 @@ Mat3 Mat3::operator*(real k) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::operator*=(real k)
+Mat3& Mat3::operator*=(float k)
 {
 	m[0] *= k;
 	m[1] *= k;
@@ -228,11 +228,11 @@ Mat3& Mat3::operator*=(real k)
 }
 
 //-----------------------------------------------------------------------------
-Mat3 Mat3::operator/(real k) const
+Mat3 Mat3::operator/(float k) const
 {
 	Mat3 tmp;
 
-	k = (real)1.0 / k;
+	k = (float)1.0 / k;
 
 	tmp.m[0] = m[0] * k;
 	tmp.m[1] = m[1] * k;
@@ -248,9 +248,9 @@ Mat3 Mat3::operator/(real k) const
 }
 
 //-----------------------------------------------------------------------------
-Mat3& Mat3::operator/=(real k)
+Mat3& Mat3::operator/=(float k)
 {
-	k = (real)1.0 / k;
+	k = (float)1.0 / k;
 
 	m[0] *= k;
 	m[1] *= k;
@@ -320,13 +320,13 @@ Mat3& Mat3::operator*=(const Mat3& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat3 operator*(real k, const Mat3& a)
+Mat3 operator*(float k, const Mat3& a)
 {
 	return a * k;
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::build_rotation_x(real radians)
+void Mat3::build_rotation_x(float radians)
 {
 	m[0] = 1.0;
 	m[1] = 0.0;
@@ -340,7 +340,7 @@ void Mat3::build_rotation_x(real radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::build_rotation_y(real radians)
+void Mat3::build_rotation_y(float radians)
 {
 	m[0] = math::cos(radians);
 	m[1] = 0.0;
@@ -354,7 +354,7 @@ void Mat3::build_rotation_y(real radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::build_rotation_z(real radians)
+void Mat3::build_rotation_z(float radians)
 {
 	m[0] = math::cos(radians);
 	m[1] = math::sin(radians);
@@ -368,11 +368,11 @@ void Mat3::build_rotation_z(real radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat3::build_rotation(const Vec3& n, real radians)
+void Mat3::build_rotation(const Vec3& n, float radians)
 {
-	real a = (real)1.0 - math::cos(radians);
-	real sin_a = math::sin(radians);
-	real cos_a = math::cos(radians);
+	float a = (float)1.0 - math::cos(radians);
+	float sin_a = math::sin(radians);
+	float cos_a = math::cos(radians);
 
 	m[0] = n.x * n.x * a + cos_a;
 	m[1] = n.x * n.y * a + n.z * sin_a;
@@ -388,7 +388,7 @@ void Mat3::build_rotation(const Vec3& n, real radians)
 //-----------------------------------------------------------------------------
 Mat3& Mat3::transpose()
 {
-	real tmp;
+	float tmp;
 
 	tmp = m[1];
 	m[1] = m[3];
@@ -424,9 +424,9 @@ Mat3 Mat3::get_transposed() const
 }
 
 //-----------------------------------------------------------------------------
-real Mat3::get_determinant() const
+float Mat3::get_determinant() const
 {
-	real det;
+	float det;
 
 	det =	m[0] * (m[4] * m[8] - m[7] * m[5]) -
 			m[3] * (m[1] * m[8] - m[7] * m[2]) +
@@ -439,14 +439,14 @@ real Mat3::get_determinant() const
 Mat3& Mat3::invert()
 {
 	Mat3 mat;
-	real det;
+	float det;
 
 	mat.m[0] = (m[4] * m[8] - m[7] * m[5]);
 	mat.m[1] = (m[1] * m[8] - m[7] * m[2]);
 	mat.m[2] = (m[1] * m[5] - m[4] * m[2]);
 
 	det = m[0] * mat.m[0] - m[3] * mat.m[1] + m[6] * mat.m[2];
-	det = (real)1.0 / det;
+	det = (float)1.0 / det;
 
 	mat.m[3] = (m[3] * m[8] - m[6] * m[5]);
 	mat.m[4] = (m[0] * m[8] - m[6] * m[2]);
@@ -504,13 +504,13 @@ void Mat3::set_scale(const Vec3& scale)
 }
 
 //-----------------------------------------------------------------------------
-real* Mat3::to_float_ptr()
+float* Mat3::to_float_ptr()
 {
 	return &m[0];
 }
 
 //-----------------------------------------------------------------------------
-const real* Mat3::to_float_ptr() const
+const float* Mat3::to_float_ptr() const
 {
 	return &m[0];
 }
@@ -545,11 +545,11 @@ Quat Mat3::to_quat() const
 {
 	Quat tmp;
 
-	real fourWSquaredMinusOne = m[0] + m[4] + m[8];
-	real fourXSquaredMinusOne = m[0] - m[4] - m[8];
-	real fourYSquaredMinusOne = -m[0] + m[4] - m[8];
-	real fourZSquaredMinusOne = -m[0] - m[4] + m[8];
-	real fourMaxSquaredMinusOne = fourWSquaredMinusOne;
+	float fourWSquaredMinusOne = m[0] + m[4] + m[8];
+	float fourXSquaredMinusOne = m[0] - m[4] - m[8];
+	float fourYSquaredMinusOne = -m[0] + m[4] - m[8];
+	float fourZSquaredMinusOne = -m[0] - m[4] + m[8];
+	float fourMaxSquaredMinusOne = fourWSquaredMinusOne;
 	uint32_t index = 0;
 
 	if (fourXSquaredMinusOne > fourMaxSquaredMinusOne)
@@ -570,8 +570,8 @@ Quat Mat3::to_quat() const
 		index = 3;
 	}
 
-	real biggest = math::sqrt(fourMaxSquaredMinusOne + (real)1.0) * (real)0.5;
-	real mult = (real)0.25 / biggest;
+	float biggest = math::sqrt(fourMaxSquaredMinusOne + (float)1.0) * (float)0.5;
+	float mult = (float)0.25 / biggest;
 
 	switch (index)
 	{

+ 19 - 19
src/core/math/Mat3.h

@@ -60,60 +60,60 @@ class Mat3
 
 public:
 
-	real				m[9];
+	float				m[9];
 
 	/// Does nothing for efficiency.
 						Mat3();			
 
-	/// Constructs from a set of real
-						Mat3(real r1c1, real r2c1, real r3c1, real r1c2, real r2c2, real r3c2, real r1c3, real r2c3, real r3c3);
+	/// 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);
 	
 	/// Constructs from the @a v array
-						Mat3(const real v[9]);						
+						Mat3(const float v[9]);						
 						Mat3(const Mat3& a);	
 
 	/// Assignment operator (copies the data)
 	Mat3&				operator=(const Mat3& a);					
 
 	/// Random access by index
-	real				operator[](uint32_t i) const;		
+	float				operator[](uint32_t i) const;		
 
 	/// Random access by index			
-	real&				operator[](uint32_t i);							
+	float&				operator[](uint32_t i);							
 
 	/// Random access by row/column pair
-	real				operator()(uint32_t row, uint32_t column) const;	
+	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*(real k) const;					
-	Mat3&				operator*=(real k);						
-	Mat3				operator/(real k) const;					
-	Mat3&				operator/=(real k);							
+	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);			
 
 	/// For simmetry
-	friend Mat3			operator*(real k, const Mat3& a);			
+	friend Mat3			operator*(float k, const Mat3& a);			
 
 	/// Builds a rotation matrix about the X axis of @a radians radians
-	void				build_rotation_x(real radians);			
+	void				build_rotation_x(float radians);			
 
 	/// Builds a rotation matrix about the Y axis of @a radians radians	
-	void				build_rotation_y(real radians);	
+	void				build_rotation_y(float radians);	
 
 	/// Builds a rotation matrix about the Z axis of @a radians radians			
-	void				build_rotation_z(real radians);	
+	void				build_rotation_z(float radians);	
 
 	/// Builds a rotation matrix about an arbitrary axis of "radians" radians			
-	void				build_rotation(const Vec3& n, real radians);
+	void				build_rotation(const Vec3& n, float radians);
 
 	Mat3&				transpose();								
 	Mat3				get_transposed() const;						
-	real				get_determinant() const;					
+	float				get_determinant() const;					
 	Mat3&				invert();									
 	Mat3				get_inverted() const;						
 
@@ -127,10 +127,10 @@ public:
 	void				set_scale(const Vec3& scale);				
 
 	/// Returns the pointer to the matrix's data
-	real*				to_float_ptr();				
+	float*				to_float_ptr();				
 
 	/// Returns the pointer to the matrix's data				
-	const real*			to_float_ptr() const;
+	const float*			to_float_ptr() const;
 
 	/// Returns a 4x4 matrix according to the matrix's rotation portion						
 	Mat4				to_mat4() const;

+ 87 - 87
src/core/math/Mat4.cpp

@@ -44,8 +44,8 @@ Mat4::Mat4()
 }
 
 //-----------------------------------------------------------------------------
-Mat4::Mat4(real r1c1, real r2c1, real r3c1, real r4c1, real r1c2, real r2c2, real r3c2, real r4c2,
-	real r1c3, real r2c3, real r3c3, real r4c3, real r1c4, real r2c4, real r3c4, real r4c4)
+Mat4::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)
 {
 	m[0] = r1c1;
 	m[1] = r2c1;
@@ -66,7 +66,7 @@ Mat4::Mat4(real r1c1, real r2c1, real r3c1, real r4c1, real r1c2, real r2c2, rea
 }
 
 //-----------------------------------------------------------------------------
-Mat4::Mat4(const real v[16])
+Mat4::Mat4(const float v[16])
 {
 	m[0] = v[0];
 	m[1] = v[1];
@@ -131,7 +131,7 @@ Mat4& Mat4::operator=(const Mat4& a)
 }
 
 //-----------------------------------------------------------------------------
-real Mat4::operator[](uint32_t i) const
+float Mat4::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 16, "Index must be < 16");
 
@@ -139,7 +139,7 @@ real Mat4::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-real& Mat4::operator[](uint32_t i)
+float& Mat4::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 16, "Index must be < 16");
 
@@ -147,7 +147,7 @@ real& Mat4::operator[](uint32_t i)
 }
 
 //-----------------------------------------------------------------------------
-real Mat4::operator()(uint32_t row, uint32_t column) const
+float Mat4::operator()(uint32_t row, uint32_t column) const
 {
 	CE_ASSERT(row < 4 && column < 4, "Row and column must be < 4");
 
@@ -251,7 +251,7 @@ Mat4& Mat4::operator-=(const Mat4& a)
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat4::operator*(real k) const
+Mat4 Mat4::operator*(float k) const
 {
 	Mat4 tmp;
 
@@ -276,7 +276,7 @@ Mat4 Mat4::operator*(real k) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::operator*=(real k)
+Mat4& Mat4::operator*=(float k)
 {
 	m[0] *= k;
 	m[1] *= k;
@@ -299,11 +299,11 @@ Mat4& Mat4::operator*=(real k)
 }
 
 //-----------------------------------------------------------------------------
-Mat4 Mat4::operator/(real k) const
+Mat4 Mat4::operator/(float k) const
 {
 	Mat4 tmp;
 
-	k = (real)1.0 / k;
+	k = (float)1.0 / k;
 
 	tmp.m[0] = m[0] * k;
 	tmp.m[1] = m[1] * k;
@@ -326,9 +326,9 @@ Mat4 Mat4::operator/(real k) const
 }
 
 //-----------------------------------------------------------------------------
-Mat4& Mat4::operator/=(real k)
+Mat4& Mat4::operator/=(float k)
 {
-	k = (real)1.0 / k;
+	k = (float)1.0 / k;
 
 	m[0] *= k;
 	m[1] *= k;
@@ -433,13 +433,13 @@ Mat4& Mat4::operator*=(const Mat4& a)
 	return *this;
 }
 
-Mat4 operator*(real k, const Mat4& a)
+Mat4 operator*(float k, const Mat4& a)
 {
 	return a * k;
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_rotation_x(real radians)
+void Mat4::build_rotation_x(float radians)
 {
 	m[0] = 1.0;
 	m[1] = 0.0;
@@ -460,7 +460,7 @@ void Mat4::build_rotation_x(real radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_rotation_y(real radians)
+void Mat4::build_rotation_y(float radians)
 {
 	m[0] = math::cos(radians);
 	m[1] = 0.0;
@@ -481,7 +481,7 @@ void Mat4::build_rotation_y(real radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_rotation_z(real radians)
+void Mat4::build_rotation_z(float radians)
 {
 	m[0] = math::cos(radians);
 	m[1] = math::sin(radians);
@@ -502,11 +502,11 @@ void Mat4::build_rotation_z(real radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_rotation(const Vec3& n, real radians)
+void Mat4::build_rotation(const Vec3& n, float radians)
 {
-	real a = (real)1.0 - math::cos(radians);
-	real sin_a = math::sin(radians);
-	real cos_a = math::cos(radians);
+	float a = (float)1.0 - math::cos(radians);
+	float sin_a = math::sin(radians);
+	float cos_a = math::cos(radians);
 
 	m[0] = n.x * n.x * a + cos_a;
 	m[1] = n.x * n.y * a + n.z * sin_a;
@@ -527,71 +527,71 @@ void Mat4::build_rotation(const Vec3& n, real radians)
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_perspective_rh(real fovy, real aspect, real near, real far)
+void Mat4::build_projection_perspective_rh(float fovy, float aspect, float near, float far)
 {
 	double top, right;
 
-	top = math::tan((real)((double)fovy / 360.0 * math::PI)) * (double)near;
+	top = math::tan((float)((double)fovy / 360.0 * math::PI)) * (double)near;
 	right = top * aspect;
 
-	m[0] = (real)(near / right);
+	m[0] = (float)(near / right);
 	m[1] = 0.0;
 	m[2] = 0.0;
 	m[3] = 0.0;
 	m[4] = 0.0;
-	m[5] = (real)(near / top);
+	m[5] = (float)(near / top);
 	m[6] = 0.0;
 	m[7] = 0.0;
 	m[8] = 0.0;
 	m[9] = 0.0;
-	m[10] = (real)((far + near) / (near - far));
+	m[10] = (float)((far + near) / (near - far));
 	m[11] = -1.0;
 	m[12] = 0.0;
 	m[13] = 0.0;
-	m[14] = (real)((2.0 * far * near) / (near - far));
+	m[14] = (float)((2.0 * far * near) / (near - far));
 	m[15] = 0.0;
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_perspective_lh(real fovy, real aspect, real near, real far)
+void Mat4::build_projection_perspective_lh(float fovy, float aspect, float near, float far)
 {
 	double top, right;
 
-	top = math::tan((real)((double)fovy / 360.0 * math::PI)) * (double)near;
+	top = math::tan((float)((double)fovy / 360.0 * math::PI)) * (double)near;
 	right = top * aspect;
 
-	m[0] = (real)(near / right);
+	m[0] = (float)(near / right);
 	m[1] = 0.0;
 	m[2] = 0.0;
 	m[3] = 0.0;
 	m[4] = 0.0;
-	m[5] = (real)(near / top);
+	m[5] = (float)(near / top);
 	m[6] = 0.0;
 	m[7] = 0.0;
 	m[8] = 0.0;
 	m[9] = 0.0;
-	m[10] = (real)(far / (far - near));
+	m[10] = (float)(far / (far - near));
 	m[11] = 1.0;
 	m[12] = 0.0;
 	m[13] = 0.0;
-	m[14] = (real)((far * near) / (near - far));
+	m[14] = (float)((far * near) / (near - far));
 	m[15] = 0.0;
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_ortho_rh(real width, real height, real near, real far)
+void Mat4::build_projection_ortho_rh(float width, float height, float near, float far)
 {
-	m[0] = (real)2.0 / width;
+	m[0] = (float)2.0 / width;
 	m[1] = 0.0;
 	m[2] = 0.0;
 	m[3] = 0.0;
 	m[4] = 0.0;
-	m[5] = (real)2.0 / height;
+	m[5] = (float)2.0 / height;
 	m[6] = 0.0;
 	m[7] = 0.0;
 	m[8] = 0.0;
 	m[9] = 0.0;
-	m[10] = (real)2 / (near - far);
+	m[10] = (float)2 / (near - far);
 	m[11] = 0.0;
 	m[12] = 0.0;
 	m[13] = 0.0;
@@ -600,51 +600,51 @@ void Mat4::build_projection_ortho_rh(real width, real height, real near, real fa
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_ortho_lh(real width, real height, real near, real far)
+void Mat4::build_projection_ortho_lh(float width, float height, float near, float far)
 {
-	m[0] = (real)2.0 / width;
+	m[0] = (float)2.0 / width;
 	m[1] = 0.0;
 	m[2] = 0.0;
 	m[3] = 0.0;
 	m[4] = 0.0;
-	m[5] = (real)2.0 / height;
+	m[5] = (float)2.0 / height;
 	m[6] = 0.0;
 	m[7] = 0.0;
 	m[8] = 0.0;
 	m[9] = 0.0;
-	m[10] = (real)2 / (far - near);
+	m[10] = (float)2 / (far - near);
 	m[11] = 0.0;
 	m[12] = 0.0;
 	m[13] = 0.0;
 	m[14] = near / (near - far);
-	m[15] = (real)1.0;
+	m[15] = (float)1.0;
 }
 
 //-----------------------------------------------------------------------------
-void Mat4::build_projection_ortho_2d_rh(real width, real height, real near, real far)
+void Mat4::build_projection_ortho_2d_rh(float width, float height, float near, float far)
 {
-	m[0] = (real)2.0 / width;
+	m[0] = (float)2.0 / width;
 	m[1] = 0.0;
 	m[2] = 0.0;
 	m[3] = 0.0;
 	m[4] = 0.0;
-	m[5] = (real)-2.0 / height;
+	m[5] = (float)-2.0 / height;
 	m[6] = 0.0;
 	m[7] = 0.0;
 	m[8] = 0.0;
 	m[9] = 0.0;
-	m[10] = (real)2.0 / (near - far);
+	m[10] = (float)2.0 / (near - far);
 	m[11] = 0.0;
-	m[12] = (real)-1.0 + (m[0] * (real)0.375);		// Add 0.375 to acheive
-	m[13] =  (real)1.0 + (m[5] * (real)0.375);		// pixel-perfect 2d drawing
+	m[12] = (float)-1.0 + (m[0] * (float)0.375);		// Add 0.375 to acheive
+	m[13] =  (float)1.0 + (m[5] * (float)0.375);		// pixel-perfect 2d drawing
 	m[14] = near / (near - far);
-	m[15] = (real)1.0;
+	m[15] = (float)1.0;
 }
 
 //-----------------------------------------------------------------------------
 Mat4& Mat4::transpose()
 {
-	real tmp;
+	float tmp;
 
 	tmp = m[1];
 	m[1] = m[4];
@@ -807,16 +807,16 @@ void Mat4::build_axis_billboard(const Vec3& pos, const Vec3& target, const Vec3&
 }
 
 //-----------------------------------------------------------------------------
-real Mat4::get_determinant() const
+float Mat4::get_determinant() const
 {
-	real det;
+	float det;
 
-	real m02m07_m06m03 = m[2] * m[7] - m[6] * m[3];
-	real m02m11_m10m03 = m[2] * m[11] - m[10] * m[3];
-	real m02m15_m14m03 = m[2] * m[15] - m[14] * m[3];
-	real m06m11_m10m07 = m[6] * m[11] - m[10] * m[7];
-	real m06m15_m14m07 = m[6] * m[15] - m[14] * m[7];
-	real m10m15_m14m11 = m[10] * m[15] - m[14] * m[11];
+	float m02m07_m06m03 = m[2] * m[7] - m[6] * m[3];
+	float m02m11_m10m03 = m[2] * m[11] - m[10] * m[3];
+	float m02m15_m14m03 = m[2] * m[15] - m[14] * m[3];
+	float m06m11_m10m07 = m[6] * m[11] - m[10] * m[7];
+	float m06m15_m14m07 = m[6] * m[15] - m[14] * m[7];
+	float m10m15_m14m11 = m[10] * m[15] - m[14] * m[11];
 
 	det = 	+ m[0] * (m[5] * m10m15_m14m11 - m[9] * m06m15_m14m07 + m[13] * m06m11_m10m07)
 			- m[4] * (m[1] * m10m15_m14m11 - m[9] * m02m15_m14m03 + m[13] * m02m11_m10m03)
@@ -830,26 +830,26 @@ real Mat4::get_determinant() const
 Mat4& Mat4::invert()
 {
 	Mat4 mat;
-	real det;
-
-	real m01m06_m05m02 = m[1] * m[6] - m[5] * m[2];
-	real m01m07_m05m03 = m[1] * m[7] - m[5] * m[3];
-	real m01m10_m09m02 = m[1] * m[10] - m[9] * m[2];
-	real m01m11_m09m03 = m[1] * m[11] - m[9] * m[3];
-	real m01m14_m13m02 = m[1] * m[14] - m[13] * m[2];
-	real m01m15_m13m03 = m[1] * m[15] - m[13] * m[3];
-	real m02m07_m06m03 = m[2] * m[7] - m[6] * m[3];
-	real m02m11_m10m03 = m[2] * m[11] - m[10] * m[3];
-	real m02m15_m14m03 = m[2] * m[15] - m[14] * m[3];
-	real m05m10_m09m06 = m[5] * m[10] - m[9] * m[6];
-	real m05m11_m09m07 = m[5] * m[11] - m[9] * m[7];
-	real m05m14_m13m06 = m[5] * m[14] - m[13] * m[6];
-	real m05m15_m13m07 = m[5] * m[15] - m[13] * m[7];
-	real m06m11_m10m07 = m[6] * m[11] - m[10] * m[7];
-	real m06m15_m14m07 = m[6] * m[15] - m[14] * m[7];
-	real m09m14_m13m10 = m[9] * m[14] - m[13] * m[10];
-	real m09m15_m13m11 = m[9] * m[15] - m[13] * m[11];
-	real m10m15_m14m11 = m[10] * m[15] - m[14] * m[11];
+	float det;
+
+	float m01m06_m05m02 = m[1] * m[6] - m[5] * m[2];
+	float m01m07_m05m03 = m[1] * m[7] - m[5] * m[3];
+	float m01m10_m09m02 = m[1] * m[10] - m[9] * m[2];
+	float m01m11_m09m03 = m[1] * m[11] - m[9] * m[3];
+	float m01m14_m13m02 = m[1] * m[14] - m[13] * m[2];
+	float m01m15_m13m03 = m[1] * m[15] - m[13] * m[3];
+	float m02m07_m06m03 = m[2] * m[7] - m[6] * m[3];
+	float m02m11_m10m03 = m[2] * m[11] - m[10] * m[3];
+	float m02m15_m14m03 = m[2] * m[15] - m[14] * m[3];
+	float m05m10_m09m06 = m[5] * m[10] - m[9] * m[6];
+	float m05m11_m09m07 = m[5] * m[11] - m[9] * m[7];
+	float m05m14_m13m06 = m[5] * m[14] - m[13] * m[6];
+	float m05m15_m13m07 = m[5] * m[15] - m[13] * m[7];
+	float m06m11_m10m07 = m[6] * m[11] - m[10] * m[7];
+	float m06m15_m14m07 = m[6] * m[15] - m[14] * m[7];
+	float m09m14_m13m10 = m[9] * m[14] - m[13] * m[10];
+	float m09m15_m13m11 = m[9] * m[15] - m[13] * m[11];
+	float m10m15_m14m11 = m[10] * m[15] - m[14] * m[11];
 
 	mat.m[0] = (+ m[5] * m10m15_m14m11 - m[9] * m06m15_m14m07 + m[13] * m06m11_m10m07);
 	mat.m[1] = (+ m[1] * m10m15_m14m11 - m[9] * m02m15_m14m03 + m[13] * m02m11_m10m03);
@@ -857,7 +857,7 @@ Mat4& Mat4::invert()
 	mat.m[3] = (+ m[1] * m06m11_m10m07 - m[5] * m02m11_m10m03 + m[9] * m02m07_m06m03);
 
 	det = m[0] * mat.m[0] - m[4] * mat.m[1] + m[8] * mat.m[2] - m[12] * mat.m[3];
-	det = (real)1.0 / det;
+	det = (float)1.0 / det;
 
 	mat.m[4] = (+ m[4] * m10m15_m14m11 - m[8] * m06m15_m14m07 + m[12] * m06m11_m10m07);
 	mat.m[5] = (+ m[0] * m10m15_m14m11 - m[8] * m02m15_m14m03 + m[12] * m02m11_m10m03);
@@ -948,13 +948,13 @@ void Mat4::set_scale(const Vec3& scale)
 }
 
 //-----------------------------------------------------------------------------
-real* Mat4::to_float_ptr()
+float* Mat4::to_float_ptr()
 {
 	return &m[0];
 }
 
 //-----------------------------------------------------------------------------
-const real* Mat4::to_float_ptr() const
+const float* Mat4::to_float_ptr() const
 {
 	return &m[0];
 }
@@ -981,11 +981,11 @@ Mat3 Mat4::to_mat3() const
 Quat Mat4::to_quat() const
 {
 	Quat tmp;
-	real fourWSquaredMinusOne = m[0] + m[5] + m[10];
-	real fourXSquaredMinusOne = m[0] - m[5] - m[10];
-	real fourYSquaredMinusOne = -m[0] + m[5] - m[10];
-	real fourZSquaredMinusOne = -m[0] - m[5] + m[10];
-	real fourMaxSquaredMinusOne = fourWSquaredMinusOne;
+	float fourWSquaredMinusOne = m[0] + m[5] + m[10];
+	float fourXSquaredMinusOne = m[0] - m[5] - m[10];
+	float fourYSquaredMinusOne = -m[0] + m[5] - m[10];
+	float fourZSquaredMinusOne = -m[0] - m[5] + m[10];
+	float fourMaxSquaredMinusOne = fourWSquaredMinusOne;
 	uint32_t index = 0;
 
 	if (fourXSquaredMinusOne > fourMaxSquaredMinusOne)
@@ -1006,8 +1006,8 @@ Quat Mat4::to_quat() const
 		index = 3;
 	}
 
-	real biggest = math::sqrt(fourMaxSquaredMinusOne + (real)1.0) * (real)0.5;
-	real mult = (real)0.25 / biggest;
+	float biggest = math::sqrt(fourMaxSquaredMinusOne + (float)1.0) * (float)0.5;
+	float mult = (float)0.25 / biggest;
 
 	switch (index)
 	{

+ 24 - 24
src/core/math/Mat4.h

@@ -63,71 +63,71 @@ class Mat4
 
 public:
 
-	real				m[16];
+	float				m[16];
 
 	/// Does nothing for efficiency.
 						Mat4();	
 
-	/// Constructs from a set of real
-						Mat4(real r1c1, real r2c1, real r3c1, real r4c1, real r1c2, real r2c2, real r3c2, real r4c2, real r1c3, real r2c3, real r3c3, real r4c3, real r1c4, real r2c4, real r3c4, real r4c4);
+	/// 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);
 	
 	/// Contructs from the @a v array
-						Mat4(const real v[16]);						
+						Mat4(const float v[16]);						
 						Mat4(const Mat4& a);					
 
 	/// Assignment operator (copies the data)
 	Mat4&				operator=(const Mat4& a);					
 
 	/// Random access by index
-	real				operator[](uint32_t i) const;
+	float				operator[](uint32_t i) const;
 
 	/// Random access by index					
-	real&				operator[](uint32_t i);							
+	float&				operator[](uint32_t i);							
 
-	real				operator()(uint32_t row, uint32_t column) const;	//!< Random access by row/column pair
+	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*(real k) const;				
-	Mat4&				operator*=(real k);							
-	Mat4				operator/(real k) const;					
-	Mat4&				operator/=(real k);							
+	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);
 
 	/// For simmetry
-	friend Mat4			operator*(real k, const Mat4& a);			
+	friend Mat4			operator*(float k, const Mat4& a);			
 
 	/// Builds a rotation matrix about the X axis of @a radians radians
-	void				build_rotation_x(real radians);
+	void				build_rotation_x(float radians);
 
 	/// Builds a rotation matrix about the Y axis of "radians" radians	
-	void				build_rotation_y(real radians);	
+	void				build_rotation_y(float radians);	
 
 	/// Builds a rotation matrix about the Z axis of @a radians radians			
-	void				build_rotation_z(real radians);		
+	void				build_rotation_z(float radians);		
 
 	/// Builds a rotation matrix about an arbitrary axis of "radians" radians		
-	void				build_rotation(const Vec3& n, real radians);
+	void				build_rotation(const Vec3& n, float radians);
 
 	/// Builds a perspetive projection matrix suited to Right-Handed coordinate systems
-	void				build_projection_perspective_rh(real fovy, real aspect, real near, real far);
+	void				build_projection_perspective_rh(float fovy, float aspect, float near, float far);
 
 	/// Builds a perspective projection matrix suited to Left-Handed coordinate systems	
-	void				build_projection_perspective_lh(real fovy, real aspect, real near, real far);
+	void				build_projection_perspective_lh(float fovy, float aspect, float near, float far);
 
 	/// Builds an orthographic projection matrix suited to Right-Handed coordinate systems	
-	void				build_projection_ortho_rh(real width, real height, real near, real far);
+	void				build_projection_ortho_rh(float width, float height, float near, float far);
 
 	/// Builds an orthographic projection matrix suited to Left-Handed coordinate systems		
-	void				build_projection_ortho_lh(real width, real height, real near, real far);	
+	void				build_projection_ortho_lh(float width, float height, float near, float far);	
 
 	/// Builds a 2d orthographic projection matrix suited to Right-Handed coordinate systems	
-	void				build_projection_ortho_2d_rh(real width, real height, real near, real far);	
+	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);
@@ -143,7 +143,7 @@ public:
 
 	Mat4&				transpose();								
 	Mat4				get_transposed() const;						
-	real				get_determinant() const;					
+	float				get_determinant() const;					
 	Mat4&				invert();									
 	Mat4				get_inverted() const;						
 
@@ -163,10 +163,10 @@ public:
 	void				set_scale(const Vec3& scale);				
 
 	/// Returns the pointer to the matrix's data
-	real*				to_float_ptr();
+	float*				to_float_ptr();
 
 	/// Returns the pointer to the matrix's data								
-	const real*			to_float_ptr() const;
+	const float*			to_float_ptr() const;
 
 	/// Returns a 3x3 matrix according to the matrix's rotation portion						
 	Mat3				to_mat3() const;

+ 45 - 45
src/core/math/MathUtils.h

@@ -41,22 +41,22 @@ namespace math
 {
 
 // Constants
-const real		PI							= (real)3.1415926535897932;
-const real		TWO_PI						= PI * (real)2.0;
-const real		HALF_PI						= PI * (real)0.5;
-const real		ONEFOURTH_PI				= PI * (real)0.25;
+const float		PI							= (float)3.1415926535897932;
+const float		TWO_PI						= PI * (float)2.0;
+const float		HALF_PI						= PI * (float)0.5;
+const float		ONEFOURTH_PI				= PI * (float)0.25;
 
-const real		DEG_TO_RAD					= PI / (real)180.0;
-const real		RAD_TO_DEG					= (real)1.0 / DEG_TO_RAD;
+const float		DEG_TO_RAD					= PI / (float)180.0;
+const float		RAD_TO_DEG					= (float)1.0 / DEG_TO_RAD;
 
-const real		FOUR_OVER_THREE				= (real)(4.0 / 3.0);
-const real		FOUR_OVER_THREE_TIMES_PI	= FOUR_OVER_THREE * PI;
+const float		FOUR_OVER_THREE				= (float)(4.0 / 3.0);
+const float		FOUR_OVER_THREE_TIMES_PI	= FOUR_OVER_THREE * PI;
 
-const real		ONE_OVER_THREE				= (real)(1.0 / 3.0);
-const real		ONE_OVER_255				= (real)(1.0 / 255.0);
+const float		ONE_OVER_THREE				= (float)(1.0 / 3.0);
+const float		ONE_OVER_255				= (float)(1.0 / 255.0);
 
-const float		FLOAT_PRECISION				= (real)1.0e-7f;
-const double	DOUBLE_PRECISION			= (real)1.0e-9;
+const float		FLOAT_PRECISION				= (float)1.0e-7f;
+const double	DOUBLE_PRECISION			= (float)1.0e-9;
 
 bool			equals(float a, float b, float precision = FLOAT_PRECISION);
 bool			equals(double a, double b, double precision = DOUBLE_PRECISION);
@@ -86,10 +86,10 @@ template <typename T> T		clamp_to_range(const T& min, const T& max, const T& val
 template <typename T> void	swap(T& a, T& b);				
 
 /// Returns @a deg in radians
-real			deg_to_rad(real deg);
+float			deg_to_rad(float deg);
 
 /// Returns @a rad in degrees
-real			rad_to_deg(real rad);
+float			rad_to_deg(float rad);
 
 /// Returns the nearest power of two to @a x
 uint32_t		next_pow_2(uint32_t x);
@@ -98,43 +98,43 @@ uint32_t		next_pow_2(uint32_t x);
 bool			is_pow_2(uint32_t x);	
 
 /// Returns the smallest integral value that is not less than @a x
-real			ceil(real x);		
+float			ceil(float x);		
 
 /// Returns the largest integral value that is not greater than @a x			
-real			floor(real x);	
+float			floor(float x);	
 
 /// Returns the square root of @a x				
-real			sqrt(real x);	
+float			sqrt(float x);	
 
 /// Returns the inverse square root of @a x				
-real			inv_sqrt(real x);
+float			inv_sqrt(float x);
 
 /// Returns the sine of @a x				
-real			sin(real x);	
+float			sin(float x);	
 
 /// Returns the cosine of @a x				
-real			cos(real x);
+float			cos(float x);
 
 /// Returns the arc sine of @a x					
-real			asin(real x);	
+float			asin(float x);	
 
 /// Returns the arc cosine of @a x				
-real			acos(real x);	
+float			acos(float x);	
 
 /// Returns the tangent of @a x				
-real			tan(real x);		
+float			tan(float x);		
 
 /// Returns the arc tangent of @a y/@a x			
-real			atan2(real y, real x);	
+float			atan2(float y, float x);	
 
 /// Returns the absolute value of @a x		
-real			abs(real x);			
+float			abs(float x);			
 
-/// Returns the realing-point remainder of numerator/denominator		
-real			fmod(real n, real d);			
+/// Returns the floating-point remainder of numerator/denominator		
+float			fmod(float n, float d);			
 
 /// Returns true if there are solutions and puts them in 'x1' and 'x2' (x1 <= x2)
-bool			solve_quadratic_equation(real a, real b, real c, real& x1, real& x2);
+bool			solve_quadratic_equation(float a, float b, float c, float& x1, float& x2);
 
 //-----------------------------------------------------------------------------
 inline bool equals(float a, float b, float precision)
@@ -216,13 +216,13 @@ inline void swap(T& a, T& b)
 }
 
 //-----------------------------------------------------------------------------
-inline real deg_to_rad(real deg)
+inline float deg_to_rad(float deg)
 {
 	return deg * DEG_TO_RAD;
 }
 
 //-----------------------------------------------------------------------------
-inline real rad_to_deg(real rad)
+inline float rad_to_deg(float rad)
 {
 	return rad * RAD_TO_DEG;
 }
@@ -248,83 +248,83 @@ inline bool is_pow_2(uint32_t x)
 }
 
 //-----------------------------------------------------------------------------
-inline real ceil(real x)
+inline float ceil(float x)
 {
 	return ceilf(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real floor(real x)
+inline float floor(float x)
 {
 	return floorf(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real sqrt(real x)
+inline float sqrt(float x)
 {
 	return sqrtf(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real inv_sqrt(real x)
+inline float inv_sqrt(float x)
 {
 	return 1.0 / sqrt(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real sin(real x)
+inline float sin(float x)
 {
 	return sinf(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real cos(real x)
+inline float cos(float x)
 {
 	return cosf(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real asin(real x)
+inline float asin(float x)
 {
 	return asinf(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real acos(real x)
+inline float acos(float x)
 {
 	return acosf(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real tan(real x)
+inline float tan(float x)
 {
 	return tanf(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real atan2(real y, real x)
+inline float atan2(float y, float x)
 {
 	return atan2f(y, x);
 }
 
 //-----------------------------------------------------------------------------
-inline real abs(real x)
+inline float abs(float x)
 {
 	return fabs(x);
 }
 
 //-----------------------------------------------------------------------------
-inline real fmod(real n, real d)
+inline float fmod(float n, float d)
 {
 	return ::fmod(n, d);
 }
 
 //-----------------------------------------------------------------------------
-inline bool solve_quadratic_equation(real a, real b, real c, real& x1, real& x2)
+inline bool solve_quadratic_equation(float a, float b, float c, float& x1, float& x2)
 {
-	real delta = (b * b) - (4.0 * a * c);
+	float delta = (b * b) - (4.0 * a * c);
 
-	// If the equation has no real solutions
+	// If the equation has no float solutions
 	if (delta < 0.0)
 	{
 		return false;

+ 6 - 6
src/core/math/Plane.cpp

@@ -47,21 +47,21 @@ Plane::Plane(const Plane& p) : n(p.n), d(p.d)
 }
 
 //-----------------------------------------------------------------------------
-Plane::Plane(const Vec3& normal, real dist) : n(normal), d(dist)
+Plane::Plane(const Vec3& normal, float dist) : n(normal), d(dist)
 {
 }
 
 //-----------------------------------------------------------------------------
 Plane& Plane::normalize()
 {
-	real len = n.length();
+	float len = n.length();
 
-	if (math::equals(len, (real)0.0))
+	if (math::equals(len, (float)0.0))
 	{
 		return *this;
 	}
 
-	len = (real)1.0 / len;
+	len = (float)1.0 / len;
 
 	n *= len;
 	d *= len;
@@ -70,7 +70,7 @@ Plane& Plane::normalize()
 }
 
 //-----------------------------------------------------------------------------
-real Plane::distance_to_point(const Vec3& p) const
+float Plane::distance_to_point(const Vec3& p) const
 {
 	return n.dot(p) + d;
 }
@@ -78,7 +78,7 @@ real Plane::distance_to_point(const Vec3& p) const
 //-----------------------------------------------------------------------------
 bool Plane::contains_point(const Vec3& p) const
 {
-	return math::equals(n.dot(p) + d, (real)0.0);
+	return math::equals(n.dot(p) + d, (float)0.0);
 }
 
 } // namespace crown

+ 3 - 3
src/core/math/Plane.h

@@ -42,7 +42,7 @@ class Plane
 public:
 
 	Vec3				n;
-	real				d;
+	float				d;
 
 public:
 
@@ -51,13 +51,13 @@ public:
 						Plane(const Plane& p);
 
 	/// Constructs from a normal and distance factor						
-						Plane(const Vec3& normal, real dist);		
+						Plane(const Vec3& normal, float dist);		
 
 	/// Normalizes the plane
 	Plane&				normalize();							
 
 	/// Returns the signed distance between point @a p and the plane
-	real				distance_to_point(const Vec3& p) const;	
+	float				distance_to_point(const Vec3& p) const;	
 
 	/// Returns whether the plane contains the point @a p	
 	bool				contains_point(const Vec3& p) const;		

+ 9 - 9
src/core/math/Point2.h

@@ -70,12 +70,12 @@ public:
 	bool					operator<(const Point2& other) const;	//! Returns whether all the components of this point32_t are smaller than all of the "other" point32_t
 	bool					operator>(const Point2& other) const;	//! Returns whether all the components of this point32_t are greater than all of the "other" point32_t
 
-	real					length() const;						//! Returns the point32_t's length
+	float					length() const;						//! Returns the point32_t's length
 	int32_t					squared_length() const;				//! Returns the point32_t's squared length
 	void					negate();							//! Negates the point32_t (i.e. builds the inverse)
 
-	real					get_distance_to(const Point2& a);	//!< Returns the distance
-	real					get_angle_between(const Point2& a);	//!< Returns the angle in radians
+	float					get_distance_to(const Point2& a);	//!< Returns the distance
+	float					get_angle_between(const Point2& a);	//!< Returns the angle in radians
 
 	Point2					operator-() const;					//! Negates the point32_t (i.e. builds the inverse)
 
@@ -235,9 +235,9 @@ inline bool Point2::operator>(const Point2& other) const
 }
 
 //-----------------------------------------------------------------------------
-inline real Point2::length() const
+inline float Point2::length() const
 {
-	return math::acos((real)(x * x + y * y));
+	return math::acos((float)(x * x + y * y));
 }
 
 //-----------------------------------------------------------------------------
@@ -254,13 +254,13 @@ inline void Point2::negate()
 }
 
 //-----------------------------------------------------------------------------
-inline real Point2::get_distance_to(const Point2& a)
+inline float Point2::get_distance_to(const Point2& a)
 {
 	return (*this - a).length();
 }
 
 //-----------------------------------------------------------------------------
-inline real Point2::get_angle_between(const Point2& a)
+inline float Point2::get_angle_between(const Point2& a)
 {
 	return math::acos(this->dot(a) / (this->length() * a.length()));
 }
@@ -292,13 +292,13 @@ inline const int32_t* Point2::to_int_ptr() const
 //-----------------------------------------------------------------------------
 inline Vec2 Point2::to_vec2() const
 {
-	return Vec2((real)x, (real)y);
+	return Vec2((float)x, (float)y);
 }
 
 //-----------------------------------------------------------------------------
 inline Vec3 Point2::to_vec3() const
 {
-	return Vec3((real)x, (real)y, 0.0);
+	return Vec3((float)x, (float)y, 0.0);
 }
 
 } // namespace crown

+ 37 - 37
src/core/math/Quat.cpp

@@ -40,10 +40,10 @@ Quat::Quat()
 }
 
 //-----------------------------------------------------------------------------
-Quat::Quat(real angle, const Vec3& v)
+Quat::Quat(float angle, const Vec3& v)
 {
-	this->w = math::cos((real)(angle * 0.5));
-	this->v = v * math::sin((real)(angle * 0.5));
+	this->w = math::cos((float)(angle * 0.5));
+	this->v = v * math::sin((float)(angle * 0.5));
 }
 
 //-----------------------------------------------------------------------------
@@ -63,7 +63,7 @@ void Quat::load_identity()
 }
 
 //-----------------------------------------------------------------------------
-real Quat::length() const
+float Quat::length() const
 {
 	return math::sqrt(w * w + v.x * v.x + v.y * v.y + v.z * v.z);
 }
@@ -83,26 +83,26 @@ Quat Quat::get_conjugate() const
 //-----------------------------------------------------------------------------
 Quat Quat::get_inverse() const
 {
-	return get_conjugate() * ((real)(1.0 / length()));
+	return get_conjugate() * ((float)(1.0 / length()));
 }
 
 //-----------------------------------------------------------------------------
 Mat3 Quat::to_mat3() const
 {
 	Mat3 tmp;
-	real x = v.x;
-	real y = v.y;
-	real z = v.z;
-
-	tmp.m[0] = (real)(1.0 - 2.0*y*y - 2.0*z*z);
-	tmp.m[1] = (real)(2.0*x*y + 2.0*w*z);
-	tmp.m[2] = (real)(2.0*x*z - 2.0*w*y);
-	tmp.m[3] = (real)(2.0*x*y - 2.0*w*z);
-	tmp.m[4] = (real)(1.0 - 2.0*x*x - 2.0*z*z);
-	tmp.m[5] = (real)(2.0*y*z + 2.0*w*x);
-	tmp.m[6] = (real)(2.0*x*z + 2.0*w*y);
-	tmp.m[7] = (real)(2.0*y*z - 2.0*w*x);
-	tmp.m[8] = (real)(1.0 - 2.0*x*x - 2.0*y*y);
+	float x = v.x;
+	float y = v.y;
+	float z = v.z;
+
+	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);
+	tmp.m[2] = (float)(2.0*x*z - 2.0*w*y);
+	tmp.m[3] = (float)(2.0*x*y - 2.0*w*z);
+	tmp.m[4] = (float)(1.0 - 2.0*x*x - 2.0*z*z);
+	tmp.m[5] = (float)(2.0*y*z + 2.0*w*x);
+	tmp.m[6] = (float)(2.0*x*z + 2.0*w*y);
+	tmp.m[7] = (float)(2.0*y*z - 2.0*w*x);
+	tmp.m[8] = (float)(1.0 - 2.0*x*x - 2.0*y*y);
 
 	return tmp;
 }
@@ -111,21 +111,21 @@ Mat3 Quat::to_mat3() const
 Mat4 Quat::to_mat4() const
 {
 	Mat4 tmp;
-	real x = v.x;
-	real y = v.y;
-	real z = v.z;
+	float x = v.x;
+	float y = v.y;
+	float z = v.z;
 
-	tmp.m[0] = (real)(1.0 - 2.0*y*y - 2.0*z*z);
-	tmp.m[1] = (real)(2.0*x*y + 2.0*w*z);
-	tmp.m[2] = (real)(2.0*x*z - 2.0*w*y);
+	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);
+	tmp.m[2] = (float)(2.0*x*z - 2.0*w*y);
 	tmp.m[3] = 0;
-	tmp.m[4] = (real)(2.0*x*y - 2.0*w*z);
-	tmp.m[5] = (real)(1.0 - 2.0*x*x - 2.0*z*z);
-	tmp.m[6] = (real)(2.0*y*z + 2.0*w*x);
+	tmp.m[4] = (float)(2.0*x*y - 2.0*w*z);
+	tmp.m[5] = (float)(1.0 - 2.0*x*x - 2.0*z*z);
+	tmp.m[6] = (float)(2.0*y*z + 2.0*w*x);
 	tmp.m[7] = 0.0;
-	tmp.m[8] = (real)(2.0*x*z + 2.0*w*y);
-	tmp.m[9] = (real)(2.0*y*z - 2.0*w*x);
-	tmp.m[10] = (real)(1.0 - 2.0*x*x - 2.0*y*y);
+	tmp.m[8] = (float)(2.0*x*z + 2.0*w*y);
+	tmp.m[9] = (float)(2.0*y*z - 2.0*w*x);
+	tmp.m[10] = (float)(1.0 - 2.0*x*x - 2.0*y*y);
 	tmp.m[11] = 0.0;
 	tmp.m[12] = 0.0;
 	tmp.m[13] = 0.0;
@@ -147,7 +147,7 @@ Quat Quat::operator*(const Quat& b) const
 }
 
 //-----------------------------------------------------------------------------
-Quat Quat::operator*(const real& k) const
+Quat Quat::operator*(const float& k) const
 {
 	Quat tmp;
 
@@ -158,16 +158,16 @@ Quat Quat::operator*(const real& k) const
 }
 
 //-----------------------------------------------------------------------------
-Quat Quat::power(real exp)
+Quat Quat::power(float exp)
 {
 	Quat tmp;
 
 	if (math::abs(w) < 0.9999)
 	{
-		real alpha = math::acos(w); // alpha = theta/2
-		real newAlpha = alpha * exp;
+		float alpha = math::acos(w); // alpha = theta/2
+		float newAlpha = alpha * exp;
 		tmp.w = math::cos(newAlpha);
-		real mult = math::sin(newAlpha) / math::sin(alpha);
+		float mult = math::sin(newAlpha) / math::sin(alpha);
 		tmp.v.x = v.x * mult;
 		tmp.v.y = v.y * mult;
 		tmp.v.z = v.z * mult;
@@ -186,14 +186,14 @@ the vector dot product; the larger the absolute value of the Quat dot product ax
 "similar" the angular displacements represented by a and b.
 */
 //-----------------------------------------------------------------------------
-real dot(const Quat& a, const Quat& b)
+float dot(const Quat& a, const Quat& b)
 {
 	return a.w * b.w + a.v.dot(b.v);
 }
 
 // Spherical Linear intERPolation
 //-----------------------------------------------------------------------------
-Quat slerp(const Quat& start, const Quat& end, real t)
+Quat slerp(const Quat& start, const Quat& end, float t)
 {
 	Quat delta = end * start.get_inverse();
 	delta = delta.power(t);

+ 5 - 5
src/core/math/Quat.h

@@ -51,14 +51,14 @@ class Quat
 public:
 
 	Vec3		v;
-	real		w;
+	float		w;
 
 public:
 
 				Quat();
 
 	/// Builds the quaternion from an angle and a vector								
-				Quat(real angle, const Vec3& v);	
+				Quat(float angle, const Vec3& v);	
 
 	/// Negates the quaternion
 	void		negate();
@@ -67,7 +67,7 @@ public:
 	void		load_identity();
 
 	/// Returns the quaternion's length					
-	real		length() const;		
+	float		length() const;		
 
 	/// Conjugates the quaternion				
 	void		conjugate();
@@ -85,9 +85,9 @@ public:
 	Quat		operator*(const Quat& b) const;
 
 	/// Multiplication by a scalar		
-	Quat		operator*(const real& k) const;		
+	Quat		operator*(const float& k) const;		
 
-	Quat		power(real exp);
+	Quat		power(float exp);
 };
 
 } // namespace crown

+ 9 - 9
src/core/math/Triangle.h

@@ -46,7 +46,7 @@ public:
 				Triangle(const Vec3& v1, const Vec3& v2, const Vec3& v3);
 				~Triangle();
 
-	real		area() const;
+	float		area() const;
 
 	/// Returns the center of gravity (a.k.a. "centroid").
 	Vec3		centroid() const;
@@ -87,9 +87,9 @@ inline Triangle::~Triangle()
 }
 
 //-----------------------------------------------------------------------------
-inline real Triangle::area() const
+inline float Triangle::area() const
 {
-	return ((m_vertex[1] - m_vertex[0]).cross(m_vertex[2] - m_vertex[0])).length() * (real)0.5;
+	return ((m_vertex[1] - m_vertex[0]).cross(m_vertex[2] - m_vertex[0])).length() * (float)0.5;
 }
 
 //-----------------------------------------------------------------------------
@@ -112,13 +112,13 @@ inline Vec3 Triangle::barycentric_coords(const Vec3& p) const
 	Vec3 n = e1.cross(e2) / e1.cross(e2).length();
 
 	// Signed areas
-	real at = (real)(e1.cross(e2).dot(n) * 0.5);
+	float at = (float)(e1.cross(e2).dot(n) * 0.5);
 
-	real at1 = (real)(e1.cross(d3).dot(n) * 0.5);
-	real at2 = (real)(e2.cross(d1).dot(n) * 0.5);
-	real at3 = (real)(e3.cross(d2).dot(n) * 0.5);
+	float at1 = (float)(e1.cross(d3).dot(n) * 0.5);
+	float at2 = (float)(e2.cross(d1).dot(n) * 0.5);
+	float at3 = (float)(e3.cross(d2).dot(n) * 0.5);
 
-	real oneOverAt = (real)(1.0 / at);
+	float oneOverAt = (float)(1.0 / at);
 
 	return Vec3(at1 * oneOverAt, at2 * oneOverAt, at3 * oneOverAt);
 }
@@ -143,7 +143,7 @@ inline Plane Triangle::to_plane() const
 	Vec3 e2 = m_vertex[1] - m_vertex[0];
 
 	Vec3 n = e2.cross(e1).normalize();
-	real d = -n.dot(m_vertex[0]);
+	float d = -n.dot(m_vertex[0]);
 
 	return Plane(n, d);
 }

+ 48 - 48
src/core/math/Vec2.h

@@ -38,41 +38,41 @@ class Vec2
 {
 public:
 
-	real				x, y;
+	float				x, y;
 
 	/// Does nothing for efficiency.
 						Vec2();		
 
 	/// Initializes all the components to val							
-						Vec2(real val);	
+						Vec2(float val);	
 
 	/// Constructs from two components						
-						Vec2(real nx, real ny);
+						Vec2(float nx, float ny);
 
 	/// Constructs from array
-						Vec2(const real v[2]);
+						Vec2(const float v[2]);
 						Vec2(const Vec2& a);					
 
 	/// Random access by index
-	real				operator[](uint32_t i) const;
+	float				operator[](uint32_t i) const;
 
 	/// Random access by index			
-	real&				operator[](uint32_t i);					
+	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*(real k) const;				
-	Vec2&				operator*=(real k);						
-	Vec2				operator/(real k) const;				
-	Vec2&				operator/=(real k);
+	Vec2				operator*(float k) const;				
+	Vec2&				operator*=(float k);						
+	Vec2				operator/(float k) const;				
+	Vec2&				operator/=(float k);
 
 	/// Dot product						
-	real				dot(const Vec2& a) const;				
+	float				dot(const Vec2& a) const;				
 
 	/// For simmetry
-	friend Vec2			operator*(real k, const Vec2& a);		
+	friend Vec2			operator*(float k, const Vec2& a);		
 
 	bool				operator==(const Vec2& other) const;	
 	bool				operator!=(const Vec2& other) const;
@@ -84,15 +84,15 @@ public:
 	bool				operator>(const Vec2& other) const;		
 
 	/// Returns the vector's length
-	real				length() const;
+	float				length() const;
 
 	/// Returns the vector's squared length							
-	real				squared_length() const;
+	float				squared_length() const;
 
 	/// Sets the vector's length					
-	void				set_length(real len);					
-	real				get_angle() const;
-	real				get_angle_2d() const;
+	void				set_length(float len);					
+	float				get_angle() const;
+	float				get_angle_2d() const;
 
 	/// Normalizes the vector
 	Vec2&				normalize();
@@ -107,19 +107,19 @@ public:
 	Vec2				operator-() const;						
 
 	/// Returns the distance
-	real				get_distance_to(const Vec2& a) const;
+	float				get_distance_to(const Vec2& a) const;
 
 	/// Returns the angle in radian	
-	real				get_angle_between(const Vec2& a) const;
+	float				get_angle_between(const Vec2& a) const;
 
 	/// Sets all components to zero
 	void				zero();
 
 	/// Returns the pointer to the vector's data
-	real*				to_float_ptr();	
+	float*				to_float_ptr();	
 
 	/// Returns the pointer to the vector's data						
-	const real*			to_float_ptr() const;					
+	const float*			to_float_ptr() const;					
 
 	static const Vec2	ZERO;
 	static const Vec2	ONE;
@@ -133,17 +133,17 @@ inline Vec2::Vec2()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2::Vec2(real val) : x(val), y(val)
+inline Vec2::Vec2(float val) : x(val), y(val)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2::Vec2(real nx, real ny) : x(nx), y(ny)
+inline Vec2::Vec2(float nx, float ny) : x(nx), y(ny)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2::Vec2(const real a[2]) : x(a[0]), y(a[1])
+inline Vec2::Vec2(const float a[2]) : x(a[0]), y(a[1])
 {
 }
 
@@ -153,7 +153,7 @@ inline Vec2::Vec2(const Vec2& a) : x(a.x), y(a.y)
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec2::operator[](uint32_t i) const
+inline float Vec2::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 2, "Index must be < 2");
 
@@ -161,7 +161,7 @@ inline real Vec2::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-inline real& Vec2::operator[](uint32_t i)
+inline float& Vec2::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 2, "Index must be < 2");
 
@@ -199,13 +199,13 @@ inline Vec2& Vec2::operator-=(const Vec2& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec2::operator*(real k) const
+inline Vec2 Vec2::operator*(float k) const
 {
 	return Vec2(x * k, y * k);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2& Vec2::operator*=(real k)
+inline Vec2& Vec2::operator*=(float k)
 {
 	x *= k;
 	y *= k;
@@ -214,21 +214,21 @@ inline Vec2& Vec2::operator*=(real k)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 Vec2::operator/(real k) const
+inline Vec2 Vec2::operator/(float k) const
 {
-	CE_ASSERT(k != (real)0.0, "Division by zero");
+	CE_ASSERT(k != (float)0.0, "Division by zero");
 
-	real inv = (real)(1.0 / k);
+	float inv = (float)(1.0 / k);
 
 	return Vec2(x * inv, y * inv);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2& Vec2::operator/=(real k)
+inline Vec2& Vec2::operator/=(float k)
 {
-	CE_ASSERT(k != (real)0.0, "Division by zero");
+	CE_ASSERT(k != (float)0.0, "Division by zero");
 
-	real inv = (real)(1.0 / k);
+	float inv = (float)(1.0 / k);
 
 	x *= inv;
 	y *= inv;
@@ -237,7 +237,7 @@ inline Vec2& Vec2::operator/=(real k)
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec2::dot(const Vec2& a) const
+inline float Vec2::dot(const Vec2& a) const
 {
 	return x * a.x + y * a.y;
 }
@@ -267,19 +267,19 @@ inline bool Vec2::operator>(const Vec2& other) const
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec2::length() const
+inline float Vec2::length() const
 {
 	return math::sqrt(x * x + y * y);
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec2::squared_length() const
+inline float Vec2::squared_length() const
 {
 	return x * x + y * y;
 }
 
 //-----------------------------------------------------------------------------
-inline void Vec2::set_length(real len)
+inline void Vec2::set_length(float len)
 {
 	normalize();
 
@@ -288,13 +288,13 @@ inline void Vec2::set_length(real len)
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec2::get_angle() const
+inline float Vec2::get_angle() const
 {
 	return math::atan2(y, x);
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec2::get_angle_2d() const
+inline float Vec2::get_angle_2d() const
 {
 	return math::atan2(-y, x);
 }
@@ -302,9 +302,9 @@ inline real Vec2::get_angle_2d() const
 //-----------------------------------------------------------------------------
 inline Vec2& Vec2::normalize()
 {
-	real len = length();
+	float len = length();
 
-	if (math::equals(len, (real)0.0))
+	if (math::equals(len, (float)0.0))
 	{
 		return *this;
 	}
@@ -339,13 +339,13 @@ inline Vec2 Vec2::operator-() const
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec2::get_distance_to(const Vec2& a) const
+inline float Vec2::get_distance_to(const Vec2& a) const
 {
 	return (*this - a).length();
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec2::get_angle_between(const Vec2& a) const
+inline float Vec2::get_angle_between(const Vec2& a) const
 {
 	return math::acos(this->dot(a) / (this->length() * a.length()));
 }
@@ -358,13 +358,13 @@ inline void Vec2::zero()
 }
 
 //-----------------------------------------------------------------------------
-inline real* Vec2::to_float_ptr()
+inline float* Vec2::to_float_ptr()
 {
 	return &x;
 }
 
 //-----------------------------------------------------------------------------
-inline const real* Vec2::to_float_ptr() const
+inline const float* Vec2::to_float_ptr() const
 {
 	return &x;
 }
@@ -372,7 +372,7 @@ inline const real* Vec2::to_float_ptr() const
 //-----------------------------------------------------------------------------
 inline Vec2 get_projected_parallel(const Vec2& v, const Vec2& n)
 {
-	real n_len_q;
+	float n_len_q;
 	n_len_q = n.length();
 	n_len_q = n_len_q * n_len_q;
 
@@ -386,7 +386,7 @@ inline Vec2 get_projected_perpendicular(const Vec2& v, const Vec2& n)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec2 operator*(real k, const Vec2& a)
+inline Vec2 operator*(float k, const Vec2& a)
 {
 	return a * k;
 }

+ 45 - 45
src/core/math/Vec3.h

@@ -39,44 +39,44 @@ class Vec3
 {
 public:
 
-	real				x, y, z;
+	float				x, y, z;
 
 	/// Does nothing for efficiency.
 						Vec3();	
 
 	/// Initializes all the components to val								
-						Vec3(real val);	
+						Vec3(float val);	
 
 	/// Constructs from three components						
-						Vec3(real nx, real ny, real nz);
+						Vec3(float nx, float ny, float nz);
 						
 	/// Constructs from array		
-						Vec3(const real v[3]);					
+						Vec3(const float v[3]);					
 						Vec3(const Vec3& a);	
 
 	/// Random access by index
-	real				operator[](uint32_t i) const;
+	float				operator[](uint32_t i) const;
 
 	/// Random access by index			
-	real&				operator[](uint32_t i);					
+	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*(real k) const;				
-	Vec3&				operator*=(real k);						
-	Vec3				operator/(real k) const;				
-	Vec3&				operator/=(real k);
+	Vec3				operator*(float k) const;				
+	Vec3&				operator*=(float k);						
+	Vec3				operator/(float k) const;				
+	Vec3&				operator/=(float k);
 
 	/// Dot product						
-	real				dot(const Vec3& a) const;
+	float				dot(const Vec3& a) const;
 
 	/// Cross product				
 	Vec3				cross(const Vec3& a) const;				
 
 	/// For simmetry
-	friend Vec3			operator*(real k, const Vec3& a);		
+	friend Vec3			operator*(float k, const Vec3& a);		
 
 	bool				operator==(const Vec3& other) const;	
 	bool				operator!=(const Vec3& other) const;
@@ -88,13 +88,13 @@ public:
 	bool				operator>(const Vec3& other) const;		
 
 	/// Returns the vector's length
-	real				length() const;	
+	float				length() const;	
 
 	/// Returns the vector's squared length						
-	real				squared_length() const;
+	float				squared_length() const;
 
 	/// Sets the vector's length					
-	void				set_length(real len);
+	void				set_length(float len);
 
 	/// Normalizes the vector					
 	Vec3&				normalize();
@@ -109,19 +109,19 @@ public:
 	Vec3				operator-() const;						
 
 	/// Returns the distance
-	real				get_distance_to(const Vec3& a) const;	
+	float				get_distance_to(const Vec3& a) const;	
 
 	/// Returns the angle in radians
-	real				get_angle_between(const Vec3& a) const;	
+	float				get_angle_between(const Vec3& a) const;	
 
 	/// Sets all components to zero
 	void				zero();									
 
 	/// Returns the pointer to the vector's data
-	real*				to_float_ptr();	
+	float*				to_float_ptr();	
 
 	/// Returns the pointer to the vector's data						
-	const real*			to_float_ptr() const;
+	const float*			to_float_ptr() const;
 
 	/// Returns a Vec2 with only x and y coordinates					
 	Vec2				to_vec2() const;						
@@ -139,17 +139,17 @@ inline Vec3::Vec3()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3::Vec3(real val) : x(val), y(val), z(val)
+inline Vec3::Vec3(float val) : x(val), y(val), z(val)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3::Vec3(real nx, real ny, real nz) : x(nx), y(ny), z(nz)
+inline Vec3::Vec3(float nx, float ny, float nz) : x(nx), y(ny), z(nz)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3::Vec3(const real v[3]) : x(v[0]), y(v[1]), z(v[2])
+inline Vec3::Vec3(const float v[3]) : x(v[0]), y(v[1]), z(v[2])
 {
 }
 
@@ -159,7 +159,7 @@ inline Vec3::Vec3(const Vec3& a) : x(a.x), y(a.y), z(a.z)
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec3::operator[](uint32_t i) const
+inline float Vec3::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 3, "Index must be < 3");
 
@@ -167,7 +167,7 @@ inline real Vec3::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-inline real& Vec3::operator[](uint32_t i)
+inline float& Vec3::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 3, "Index must be < 3");
 
@@ -207,13 +207,13 @@ inline Vec3& Vec3::operator-=(const Vec3& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::operator*(real k) const
+inline Vec3 Vec3::operator*(float k) const
 {
 	return Vec3(x * k, y * k, z * k);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3& Vec3::operator*=(real k)
+inline Vec3& Vec3::operator*=(float k)
 {
 	x *= k;
 	y *= k;
@@ -223,21 +223,21 @@ inline Vec3& Vec3::operator*=(real k)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 Vec3::operator/(real k) const
+inline Vec3 Vec3::operator/(float k) const
 {
-	CE_ASSERT(k != (real)0.0, "Division by zero");
+	CE_ASSERT(k != (float)0.0, "Division by zero");
 
-	real inv = (real)(1.0 / k);
+	float inv = (float)(1.0 / k);
 
 	return Vec3(x * inv, y * inv, z * inv);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3& Vec3::operator/=(real k)
+inline Vec3& Vec3::operator/=(float k)
 {
-	CE_ASSERT(k != (real)0.0, "Division by zero");
+	CE_ASSERT(k != (float)0.0, "Division by zero");
 
-	real inv = (real)(1.0 / k);
+	float inv = (float)(1.0 / k);
 
 	x *= inv;
 	y *= inv;
@@ -247,7 +247,7 @@ inline Vec3& Vec3::operator/=(real k)
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec3::dot(const Vec3& a) const
+inline float Vec3::dot(const Vec3& a) const
 {
 	return x * a.x + y * a.y + z * a.z;
 }
@@ -259,7 +259,7 @@ inline Vec3 Vec3::cross(const Vec3& a) const
 }
 
 //-----------------------------------------------------------------------------
-inline Vec3 operator*(real k, const Vec3& a)
+inline Vec3 operator*(float k, const Vec3& a)
 {
 	return a * k;
 }
@@ -289,19 +289,19 @@ inline bool Vec3::operator>(const Vec3& other) const
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec3::length() const
+inline float Vec3::length() const
 {
 	return math::sqrt(x * x + y * y + z * z);
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec3::squared_length() const
+inline float Vec3::squared_length() const
 {
 	return x * x + y * y + z * z;
 }
 
 //-----------------------------------------------------------------------------
-inline void Vec3::set_length(real len)
+inline void Vec3::set_length(float len)
 {
 	normalize();
 
@@ -313,14 +313,14 @@ inline void Vec3::set_length(real len)
 //-----------------------------------------------------------------------------
 inline Vec3& Vec3::normalize()
 {
-	real len = length();
+	float len = length();
 
-	if (math::equals(len, (real)0.0))
+	if (math::equals(len, (float)0.0))
 	{
 		return *this;
 	}
 
-	len = (real)(1.0 / len); 
+	len = (float)(1.0 / len); 
 
 	x *= len;
 	y *= len;
@@ -354,13 +354,13 @@ inline Vec3 Vec3::operator-() const
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec3::get_distance_to(const Vec3& a) const
+inline float Vec3::get_distance_to(const Vec3& a) const
 {
 	return (*this - a).length();
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec3::get_angle_between(const Vec3& a) const
+inline float Vec3::get_angle_between(const Vec3& a) const
 {
 	return math::acos(this->dot(a) / (this->length() * a.length()));
 }
@@ -374,13 +374,13 @@ inline void Vec3::zero()
 }
 
 //-----------------------------------------------------------------------------
-inline real* Vec3::to_float_ptr()
+inline float* Vec3::to_float_ptr()
 {
 	return &x;
 }
 
 //-----------------------------------------------------------------------------
-inline const real* Vec3::to_float_ptr() const
+inline const float* Vec3::to_float_ptr() const
 {
 	return &x;
 }
@@ -395,7 +395,7 @@ inline Vec2 Vec3::to_vec2() const
 /// Returns the parallel portion of "v" projected onto "n"
 inline Vec3 get_projected_parallel(const Vec3& v, const Vec3& n)
 {
-	real n_len_q;
+	float n_len_q;
 	n_len_q = n.length();
 	n_len_q = n_len_q * n_len_q;
 

+ 43 - 43
src/core/math/Vec4.h

@@ -38,41 +38,41 @@ class Vec4
 {
 public:
 
-	real				x, y, z, w;
+	float				x, y, z, w;
 
 	/// Does nothing for efficiency.
 						Vec4();	
 
 	/// Initializes all the components to val						
-						Vec4(real val);
+						Vec4(float val);
 
 	/// Constructs from four components								
-						Vec4(real nx, real ny, real nz, real nw);
+						Vec4(float nx, float ny, float nz, float nw);
 
 	/// Constructs from array	
-						Vec4(const real v[4]);						
+						Vec4(const float v[4]);						
 						Vec4(const Vec4& a);
 
 	/// Random access by index
-	real				operator[](uint32_t i) const;	
+	float				operator[](uint32_t i) const;	
 
 	/// Random access by index
-	real&				operator[](uint32_t i);						
+	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*(real k) const;					
-	Vec4&				operator*=(real k);							
-	Vec4				operator/(real k) const;					
-	Vec4&				operator/=(real k);
+	Vec4				operator*(float k) const;					
+	Vec4&				operator*=(float k);							
+	Vec4				operator/(float k) const;					
+	Vec4&				operator/=(float k);
 
 	/// Dot product							
-	real				dot(const Vec4& a) const;					
+	float				dot(const Vec4& a) const;					
 
 	/// For simmetry
-	friend Vec4			operator*(real k, const Vec4& a);			
+	friend Vec4			operator*(float k, const Vec4& a);			
 
 	bool				operator==(const Vec4& other) const;		
 	bool				operator!=(const Vec4& other) const;
@@ -84,13 +84,13 @@ public:
 	bool				operator>(const Vec4& other) const;			
 
 	/// Returns the vector's length
-	real				length() const;	
+	float				length() const;	
 
 	/// Returns the vector's squared length							
-	real				squared_length() const;
+	float				squared_length() const;
 
 	/// Sets the vector's length						
-	void				set_length(real len);
+	void				set_length(float len);
 
 	/// Normalizes the vector						
 	Vec4&				normalize();
@@ -105,19 +105,19 @@ public:
 	Vec4				operator-() const;							
 
 	/// Returns the distance
-	real				get_distance_to(const Vec4& a) const;
+	float				get_distance_to(const Vec4& a) const;
 
 	/// Returns the angle in radians		
-	real				get_angle_between(const Vec4& a) const;		
+	float				get_angle_between(const Vec4& a) const;		
 
 	/// Sets all components to zero
 	void				zero();										
 
 	/// Returns the pointer to the vector's data
-	real*				to_float_ptr();	
+	float*				to_float_ptr();	
 
 	/// Returns the pointer to the vector's data							
-	const real*			to_float_ptr() const;						
+	const float*			to_float_ptr() const;						
 
 	static const Vec4	ZERO;
 	static const Vec4	ONE;
@@ -133,17 +133,17 @@ inline Vec4::Vec4()
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4::Vec4(real val) : x(val), y(val), z(val), w(val)
+inline Vec4::Vec4(float val) : x(val), y(val), z(val), w(val)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4::Vec4(real nx, real ny, real nz, real nw) : x(nx), y(ny), z(nz), w(nw)
+inline Vec4::Vec4(float nx, float ny, float nz, float nw) : x(nx), y(ny), z(nz), w(nw)
 {
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4::Vec4(const real a[4]) : x(a[0]), y(a[1]), z(a[2]), w(a[3])
+inline Vec4::Vec4(const float a[4]) : x(a[0]), y(a[1]), z(a[2]), w(a[3])
 {
 }
 
@@ -153,7 +153,7 @@ inline Vec4::Vec4(const Vec4& a) : x(a.x), y(a.y), z(a.z), w(a.w)
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec4::operator[](uint32_t i) const
+inline float Vec4::operator[](uint32_t i) const
 {
 	CE_ASSERT(i < 4, "Index must be < 4");
 
@@ -161,7 +161,7 @@ inline real Vec4::operator[](uint32_t i) const
 }
 
 //-----------------------------------------------------------------------------
-inline real& Vec4::operator[](uint32_t i)
+inline float& Vec4::operator[](uint32_t i)
 {
 	CE_ASSERT(i < 4, "Index must be < 4");
 
@@ -203,13 +203,13 @@ inline Vec4& Vec4::operator-=(const Vec4& a)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 Vec4::operator*(real k) const
+inline Vec4 Vec4::operator*(float k) const
 {
 	return Vec4(x * k, y * k, z * k, w * k);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4& Vec4::operator*=(real k)
+inline Vec4& Vec4::operator*=(float k)
 {
 	x *= k;
 	y *= k;
@@ -220,21 +220,21 @@ inline Vec4& Vec4::operator*=(real k)
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 Vec4::operator/(real k) const
+inline Vec4 Vec4::operator/(float k) const
 {
-	CE_ASSERT(k != (real)0.0, "Division by zero");
+	CE_ASSERT(k != (float)0.0, "Division by zero");
 
-	real inv = (real)(1.0 / k);
+	float inv = (float)(1.0 / k);
 
 	return Vec4(x * inv, y * inv, z * inv, w * inv);
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4& Vec4::operator/=(real k)
+inline Vec4& Vec4::operator/=(float k)
 {
-	CE_ASSERT(k != (real)0.0, "Division by zero");
+	CE_ASSERT(k != (float)0.0, "Division by zero");
 
-	real inv = (real)(1.0 / k);
+	float inv = (float)(1.0 / k);
 
 	x *= inv;
 	y *= inv;
@@ -245,13 +245,13 @@ inline Vec4& Vec4::operator/=(real k)
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec4::dot(const Vec4& a) const
+inline float Vec4::dot(const Vec4& a) const
 {
 	return x * a.x + y * a.y + z * a.z + w * a.w;
 }
 
 //-----------------------------------------------------------------------------
-inline Vec4 operator*(real k, const Vec4& a)
+inline Vec4 operator*(float k, const Vec4& a)
 {
 	return a * k;
 }
@@ -281,13 +281,13 @@ inline bool Vec4::operator>(const Vec4& other) const
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec4::length() const
+inline float Vec4::length() const
 {
 	return math::sqrt(x * x + y * y + z * z + w * w);
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec4::squared_length() const
+inline float Vec4::squared_length() const
 {
 	return x * x + y * y + z * z + w * w;
 }
@@ -295,14 +295,14 @@ inline real Vec4::squared_length() const
 //-----------------------------------------------------------------------------
 inline Vec4& Vec4::normalize()
 {
-	real len = length();
+	float len = length();
 
-	if (math::equals(len, (real)0.0))
+	if (math::equals(len, (float)0.0))
 	{
 		return *this;
 	}
 
-	len = (real)(1.0 / len);
+	len = (float)(1.0 / len);
 
 	x *= len;
 	y *= len;
@@ -338,13 +338,13 @@ inline Vec4 Vec4::operator-() const
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec4::get_distance_to(const Vec4& a) const
+inline float Vec4::get_distance_to(const Vec4& a) const
 {
 	return (*this - a).length();
 }
 
 //-----------------------------------------------------------------------------
-inline real Vec4::get_angle_between(const Vec4& a) const
+inline float Vec4::get_angle_between(const Vec4& a) const
 {
 	return math::acos(this->dot(a) / (this->length() * a.length()));
 }
@@ -359,13 +359,13 @@ inline void Vec4::zero()
 }
 
 //-----------------------------------------------------------------------------
-inline real* Vec4::to_float_ptr()
+inline float* Vec4::to_float_ptr()
 {
 	return &x;
 }
 
 //-----------------------------------------------------------------------------
-inline const real* Vec4::to_float_ptr() const
+inline const float* Vec4::to_float_ptr() const
 {
 	return &x;
 }

+ 2 - 2
src/input/Mouse.h

@@ -96,7 +96,7 @@ public:
 	/// upper-left corner of the window. +X extends from left
 	/// to right and +Y extends from top to bottom.
 	/// @note
-	/// Relative coordinates are mapped to a real varying
+	/// 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() const;
@@ -107,7 +107,7 @@ public:
 	/// upper-left corner of the window. +X extends from left
 	/// to right and +Y extends from top to bottom.
 	/// @note
-	/// Relative coordinates are mapped to a real varying
+	/// 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);

+ 1 - 1
src/input/Touch.h

@@ -89,7 +89,7 @@ public:
 	/// upper-left corner of the window. +X extends from left
 	/// to right and +Y extends from top to bottom.
 	/// @note
-	/// Relative coordinates are mapped to a real varying
+	/// 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);

+ 9 - 9
src/network/BitMessage.cpp

@@ -340,7 +340,7 @@ void BitMessage::write_bits(int32_t value, int32_t num_bits)
 	}
 
 	// check for value overflows
-	// this should be an error really, as it can go unnoticed and cause either bandwidth or corrupted data transmitted
+	// this should be an error floatly, as it can go unnoticed and cause either bandwidth or corrupted data transmitted
 	if (num_bits != 32) 
 	{
 		if (num_bits > 0) 
@@ -434,7 +434,7 @@ void BitMessage::write_int32(int32_t c)
 }
 
 //---------------------------------------------------------------------------------------------
-void BitMessage::write_real(real f)
+void BitMessage::write_float(float f)
 {
 	write_bits(*reinterpret_cast<int32_t *>(&f), 32);  
 }
@@ -442,9 +442,9 @@ void BitMessage::write_real(real f)
 //---------------------------------------------------------------------------------------------
 void BitMessage::write_vec3(const Vec3& v)
 {
-	write_real(v.x);
-	write_real(v.y);
-	write_real(v.z);
+	write_float(v.x);
+	write_float(v.y);
+	write_float(v.z);
 }
 
 //---------------------------------------------------------------------------------------------
@@ -638,7 +638,7 @@ int32_t BitMessage::read_int32() const
 }
 
 //---------------------------------------------------------------------------------------------
-real BitMessage::read_real() const
+float BitMessage::read_float() const
 {
 	float value;
 	*reinterpret_cast<int*>(&value) = read_bits(32);
@@ -650,9 +650,9 @@ Vec3 BitMessage::read_vec3() const
 {
 	Vec3 v;
 	
-	v.x = read_real();
-	v.y = read_real();
-	v.z = read_real();
+	v.x = read_float();
+	v.y = read_float();
+	v.z = read_float();
 	
 	return v;
 }

+ 2 - 2
src/network/BitMessage.h

@@ -82,7 +82,7 @@ public:
 	void				write_int16(int32_t c);
 	void				write_uint16(int32_t c);
 	void				write_int32(int32_t c);
-	void				write_real(real f);
+	void				write_float(float f);
 	void				write_vec3(const Vec3& 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);
@@ -98,7 +98,7 @@ public:
 	int32_t				read_int16() const;
 	int32_t				read_uint16() const;
 	int32_t				read_int32() const;
-	real				read_real() const;
+	float				read_float() const;
 	Vec3				read_vec3() const;
 	int32_t				read_string(char* buffer, int32_t buffer_size) const;
 	int32_t				read_data(void* data, int32_t length) const;

+ 6 - 6
tests/messages.cpp

@@ -174,7 +174,7 @@ void test_int32()
 	
 }
 
-void test_real()
+void test_float()
 {
   	uint32_t bits_written;
 	uint32_t rem_write_bits;
@@ -184,19 +184,19 @@ void test_real()
 	MallocAllocator allocator;
   	network::BitMessage m = network::BitMessage(allocator);
 
-	real res;
+	float res;
 	
 	m.init(4);
-	m.write_real(4.5342f);
+	m.write_float(4.5342f);
 	bits_written = m.get_num_bits_written();
 	rem_write_bits = m.get_remaining_write_bits();
 	
-	res = m.read_real();
+	res = m.read_float();
 	bits_read = m.get_num_bits_read();
 	rem_read_bits = m.get_remaining_read_bits();
 	
 	printf("-----------------------------\n");
-	printf("start write and read for REAL\n");
+	printf("start write and read for float\n");
 	printf("value = %f\n", res);
 	printf("bits written = %d\n", bits_written);
 	printf("remaining write bits = %d\n", rem_write_bits);
@@ -361,7 +361,7 @@ int main()
 	test_int16();
 	test_uint16();
 	test_int32();
-	test_real();
+	test_float();
 	test_vec3();
 	test_string();
 	test_data();

+ 1 - 1
tools/editors/fontgen/fontgen.cpp

@@ -148,7 +148,7 @@ Image* BuildFontImage(const char* ttfFont, ushort ttfSize, ushort ttfResolution)
 
 	// Additional spacing between characters to avoid artifacts
 	uint glyphSpacing = 3;
-	uint glyphPerRow = (uint)(Math::Ceil(Math::Sqrt((real)(glyphCount * maxGlyphHeight / maxGlyphWidth))));
+	uint glyphPerRow = (uint)(Math::Ceil(Math::Sqrt((float)(glyphCount * maxGlyphHeight / maxGlyphWidth))));
 
 	uint bufferWidth = glyphPerRow * (maxGlyphWidth + glyphSpacing);
 	uint bufferHeight = (uint)Math::Ceil((float) glyphCount / glyphPerRow) * (maxGlyphHeight + glyphSpacing);