Browse Source

Moving to CMake

Panagiotis Christopoulos Charitos 14 years ago
parent
commit
44ff506e1a
100 changed files with 983 additions and 829 deletions
  1. 1 1
      .cproject
  2. 1 1
      .project
  3. 0 1
      build/debug/Makefile
  4. 2 0
      build/debug/gen.cfg.py
  5. 5 0
      src/CMakeLists.txt
  6. 4 0
      src/Collision/CMakeLists.txt
  7. 26 17
      src/Collision/CollisionShape.h
  8. 13 7
      src/Collision/LineSegment.cpp
  9. 13 7
      src/Collision/LineSegment.h
  10. 20 13
      src/Collision/Obb.cpp
  11. 20 10
      src/Collision/Obb.h
  12. 11 4
      src/Collision/Obb.inl.h
  13. 16 10
      src/Collision/Plane.cpp
  14. 29 16
      src/Collision/Plane.h
  15. 12 6
      src/Collision/Ray.cpp
  16. 14 8
      src/Collision/Ray.h
  17. 21 12
      src/Collision/Sphere.cpp
  18. 15 9
      src/Collision/Sphere.h
  19. 17 7
      src/Collision/Sphere.inl.h
  20. 43 40
      src/Core/App.cpp
  21. 4 4
      src/Core/App.h
  22. 13 13
      src/Core/AsyncLoader.cpp
  23. 1 1
      src/Core/Globals.h
  24. 9 9
      src/Core/JobManager.cpp
  25. 1 1
      src/Core/JobManager.h
  26. 27 27
      src/Core/Logger.cpp
  27. 6 7
      src/Core/Logger.h
  28. 14 14
      src/Core/Object.cpp
  29. 1 1
      src/Core/Object.h
  30. 9 9
      src/Core/StdinListener.cpp
  31. 1 1
      src/Core/StdinListener.h
  32. 4 0
      src/Events/CMakeLists.txt
  33. 1 1
      src/Events/Event.cpp
  34. 2 2
      src/Events/Event.h
  35. 13 15
      src/Events/MainRendererPpsHdr.cpp
  36. 0 0
      src/Events/MainRendererPpsHdr.h
  37. 1 1
      src/Events/Manager.cpp
  38. 1 1
      src/Events/Manager.h
  39. 1 1
      src/Events/Manager.inl.h
  40. 4 4
      src/Events/SceneColor.cpp
  41. 1 1
      src/Events/SceneColor.h
  42. 10 10
      src/GfxApi/BufferObjects/BufferObject.cpp
  43. 5 5
      src/GfxApi/BufferObjects/BufferObject.h
  44. 10 10
      src/GfxApi/BufferObjects/Fbo.cpp
  45. 6 6
      src/GfxApi/BufferObjects/Fbo.h
  46. 10 10
      src/GfxApi/BufferObjects/Vao.cpp
  47. 4 4
      src/GfxApi/BufferObjects/Vao.h
  48. 6 0
      src/GfxApi/CMakeLists.txt
  49. 1 1
      src/GfxApi/GlException.h
  50. 12 12
      src/GfxApi/GlStateMachine.cpp
  51. 4 4
      src/GfxApi/GlStateMachine.h
  52. 11 11
      src/Input/Input.cpp
  53. 3 3
      src/Input/Input.h
  54. 18 18
      src/Main.cpp
  55. 1 1
      src/Math/Axisang.h
  56. 10 10
      src/Math/Axisang.inl.h
  57. 4 0
      src/Math/CMakeLists.txt
  58. 6 6
      src/Math/Common.h
  59. 5 6
      src/Math/Common.inl.h
  60. 1 1
      src/Math/Euler.h
  61. 13 13
      src/Math/Euler.inl.h
  62. 67 0
      src/Math/Funcs.cpp
  63. 2 2
      src/Math/Funcs.h
  64. 74 0
      src/Math/Funcs.inl.h
  65. 1 1
      src/Math/Mat3.h
  66. 19 19
      src/Math/Mat3.inl.h
  67. 1 1
      src/Math/Mat4.h
  68. 22 22
      src/Math/Mat4.inl.h
  69. 1 1
      src/Math/Math.h
  70. 0 130
      src/Math/MathFuncs.inl.h
  71. 1 1
      src/Math/Quat.h
  72. 13 13
      src/Math/Quat.inl.h
  73. 1 1
      src/Math/Transform.h
  74. 13 13
      src/Math/Transform.inl.h
  75. 1 1
      src/Math/Vec2.h
  76. 19 19
      src/Math/Vec2.inl.h
  77. 1 1
      src/Math/Vec3.h
  78. 22 22
      src/Math/Vec3.inl.h
  79. 1 1
      src/Math/Vec4.h
  80. 22 22
      src/Math/Vec4.inl.h
  81. 1 1
      src/Misc/Parser.h
  82. 22 22
      src/Misc/Parser.inl.h
  83. 19 19
      src/Misc/PropertyTree.cpp
  84. 1 1
      src/Misc/PropertyTree.h
  85. 1 1
      src/Misc/TestHeader.cpp
  86. 11 11
      src/Misc/map.cpp
  87. 4 4
      src/Misc/map.h
  88. 3 3
      src/Misc/skybox.cpp
  89. 4 4
      src/Misc/skybox.h
  90. 18 18
      src/Physics/PhysCharacter.cpp
  91. 2 2
      src/Physics/PhysCharacter.h
  92. 1 1
      src/Physics/PhysConvertors.h
  93. 25 9
      src/Physics/PhysMasterContainer.cpp
  94. 7 4
      src/Physics/PhysMasterContainer.h
  95. 9 9
      src/Physics/PhysRigidBody.cpp
  96. 1 1
      src/Physics/PhysRigidBody.h
  97. 16 16
      src/Renderer/Bl.cpp
  98. 4 4
      src/Renderer/Bl.h
  99. 13 13
      src/Renderer/Bs.cpp
  100. 3 3
      src/Renderer/Bs.h

+ 1 - 1
.cproject

@@ -21,7 +21,7 @@
 							<option id="cdt.managedbuild.option.gnu.cross.prefix.124248385" name="Prefix"/>
 							<option id="cdt.managedbuild.option.gnu.cross.path.568633506" name="Path"/>
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.2099631" isAbstract="false" osList="all"/>
-							<builder arguments="make -j 4" autoBuildTarget="all" buildPath="${workspace_loc:/anki/build/debug}" cleanBuildTarget="clean" command="nice" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="cdt.managedbuild.toolchain.gnu.cross.base.1593777304.618553305" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelizationNumber="1" superClass="org.eclipse.cdt.build.core.settings.default.builder">
+							<builder arguments="make -j 4" autoBuildTarget="all" buildPath="${workspace_loc:/anki/build}" cleanBuildTarget="clean" command="nice" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="cdt.managedbuild.toolchain.gnu.cross.base.1593777304.618553305" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelizationNumber="1" superClass="org.eclipse.cdt.build.core.settings.default.builder">
 								<outputEntries>
 									<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="build/debug"/>
 								</outputEntries>

+ 1 - 1
.project

@@ -35,7 +35,7 @@
 				</dictionary>
 				<dictionary>
 					<key>org.eclipse.cdt.make.core.buildLocation</key>
-					<value>${workspace_loc:/anki/build/debug}</value>
+					<value>${workspace_loc:/anki/build}</value>
 				</dictionary>
 				<dictionary>
 					<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>

File diff suppressed because it is too large
+ 0 - 1
build/debug/Makefile


+ 2 - 0
build/debug/gen.cfg.py

@@ -3,6 +3,8 @@ sourcePaths.extend(list(walkDir("../../src")))
 
 includePaths = ["./"]
 includePaths.extend(list(sourcePaths))
+includePaths.remove("../../src/Scripting/Events")
+print(includePaths)
 includePaths.extend(["../../extern/include", "../../extern/include/bullet", "/usr/include/python2.6", "/usr/include/freetype2"])
 
 executableName = "anki"

+ 5 - 0
src/CMakeLists.txt

@@ -0,0 +1,5 @@
+PROJECT(ANKI_PROJ)
+
+INCLUDE_DIRECTORIES(${ANKI_PROJ_SOURCE_DIR})
+
+SUBDIRS(Util Math Collision GfxApi Events)

+ 4 - 0
src/Collision/CMakeLists.txt

@@ -0,0 +1,4 @@
+FILE(GLOB COLLISION_SOURCES *.cpp)
+FILE(GLOB COLLISION_HEADERS *.h)
+
+ADD_LIBRARY(Collision ${COLLISION_SOURCES} ${COLLISION_HEADERS})

+ 26 - 17
src/Collision/CollisionShape.h

@@ -1,38 +1,47 @@
-#ifndef COLLISION_SHAPE
-#define COLLISION_SHAPE
+#ifndef COL_COLLISION_SHAPE
+#define COL_COLLISION_SHAPE
 
-#include "Accessors.h"
+#include "Util/Accessors.h"
+
+
+namespace Col {
 
 
 class Plane;
 
 
+/// Collision shape type
+enum CollisionShapeType
+{
+	CST_LINE_SEG,
+	CST_RAY,
+	CST_PLANE,
+	CST_SPHERE,
+	CST_AABB,
+	CST_OBB,
+	CST_NUM
+};
+
+
 /// Abstract class for collision shapes
 class CollisionShape
 {
 	public:
-		enum CollisionShapeType
-		{
-			CST_LINE_SEG,
-			CST_RAY,
-			CST_PLANE,
-			CST_SPHERE,
-			CST_AABB,
-			CST_OBB,
-			CST_NUM
-		};
-
-	CollisionShapeType getType() const {return type;}
+		CollisionShapeType getType() const {return type;}
 
 	public:
 		CollisionShapeType type;
 
 		CollisionShape(CollisionShapeType type_): type(type_) {}
 
-		/// If the bounding volume intersects with the plane then the func returns 0, else it returns the distance. If the
-		/// distance is < 0 then the b.v. lies behind the plane and if > 0 then in front of it
+		/// If the bounding volume intersects with the plane then the func
+		/// returns 0, else it returns the distance. If the distance is < 0
+		/// then the b.v. lies behind the plane and if > 0 then in front of it
 		virtual float testPlane(const Plane&) const = 0;
 };
 
 
+} // end namespace
+
+
 #endif

+ 13 - 7
src/Collision/LineSegment.cpp

@@ -1,11 +1,14 @@
-#include <algorithm>
 #include "LineSegment.h"
 #include "Plane.h"
+#include <algorithm>
+
 
+namespace Col {
 
-//======================================================================================================================
-// getTransformed                                                                                                      =
-//======================================================================================================================
+
+//==============================================================================
+// getTransformed                                                              =
+//==============================================================================
 LineSegment LineSegment::getTransformed(const Transform& transform) const
 {
 	LineSegment out;
@@ -15,9 +18,9 @@ LineSegment LineSegment::getTransformed(const Transform& transform) const
 }
 
 
-//======================================================================================================================
-// testPlane                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// testPlane                                                                   =
+//==============================================================================
 float LineSegment::testPlane(const Plane& plane) const
 {
 	const Vec3& p0 = origin;
@@ -49,3 +52,6 @@ float LineSegment::testPlane(const Plane& plane) const
 		}
 	}
 }
+
+
+} // end namespace

+ 13 - 7
src/Collision/LineSegment.h

@@ -1,8 +1,11 @@
-#ifndef LINE_SEGMENT_H
-#define LINE_SEGMENT_H
+#ifndef COL_LINE_SEGMENT_H
+#define COL_LINE_SEGMENT_H
 
 #include "CollisionShape.h"
-#include "Math.h"
+#include "Math/Math.h"
+
+
+namespace Col {
 
 
 class LineSegment: public CollisionShape
@@ -35,18 +38,21 @@ class LineSegment: public CollisionShape
 };
 
 
-inline LineSegment::LineSegment(const Vec3& origin_, const Vec3& direction):
-	CollisionShape(CST_LINE_SEG),
+inline LineSegment::LineSegment(const Vec3& origin_, const Vec3& direction)
+:	CollisionShape(CST_LINE_SEG),
 	origin(origin_),
 	dir(direction)
 {}
 
 
-inline LineSegment::LineSegment(const LineSegment& b):
-	CollisionShape(CST_LINE_SEG),
+inline LineSegment::LineSegment(const LineSegment& b)
+:	CollisionShape(CST_LINE_SEG),
 	origin(b.origin),
 	dir(b.dir)
 {}
 
 
+} // end namespace
+
+
 #endif

+ 20 - 13
src/Collision/Obb.cpp

@@ -2,9 +2,12 @@
 #include "Plane.h"
 
 
-//======================================================================================================================
-// getTransformed                                                                                                      =
-//======================================================================================================================
+namespace Col {
+
+
+//==============================================================================
+// getTransformed                                                              =
+//==============================================================================
 Obb Obb::getTransformed(const Transform& transform) const
 {
 	Obb out;
@@ -15,9 +18,9 @@ Obb Obb::getTransformed(const Transform& transform) const
 }
 
 
-//======================================================================================================================
-// getCompoundShape                                                                                                    =
-//======================================================================================================================
+//==============================================================================
+// getCompoundShape                                                            =
+//==============================================================================
 Obb Obb::getCompoundShape(const Obb& b) const
 {
 	Obb out;
@@ -40,15 +43,16 @@ Obb Obb::getCompoundShape(const Obb& b) const
 }
 
 
-//======================================================================================================================
-// testPlane                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// testPlane                                                                   =
+//==============================================================================
 float Obb::testPlane(const Plane& plane) const
 {
 	Vec3 xNormal = rotation.getTransposed() * plane.getNormal();
 
 	// maximum extent in direction of plane normal
-	float r = fabs(extends.x() * xNormal.x()) + fabs(extends.y() * xNormal.y()) + fabs(extends.z() * xNormal.z());
+	float r = fabs(extends.x() * xNormal.x()) +
+		fabs(extends.y() * xNormal.y()) + fabs(extends.z() * xNormal.z());
 	// signed distance between box center and plane
 	float d = plane.test(center);
 
@@ -68,9 +72,9 @@ float Obb::testPlane(const Plane& plane) const
 }
 
 
-//======================================================================================================================
-// getExtremePoints                                                                                                    =
-//======================================================================================================================
+//==============================================================================
+// getExtremePoints                                                            =
+//==============================================================================
 void Obb::getExtremePoints(boost::array<Vec3, 8>& points) const
 {
 	// L: left, R: right, T: top, B: bottom, F: front, B: back
@@ -110,3 +114,6 @@ void Obb::getExtremePoints(boost::array<Vec3, 8>& points) const
 		point += center;
 	}
 }
+
+
+} // end namespace

+ 20 - 10
src/Collision/Obb.h

@@ -1,9 +1,12 @@
-#ifndef OBB_H
-#define OBB_H
+#ifndef COL_OBB_H
+#define COL_OBB_H
 
-#include <boost/array.hpp>
 #include "CollisionShape.h"
-#include "Math.h"
+#include "Math/Math.h"
+#include <boost/array.hpp>
+
+
+namespace Col {
 
 
 /// Object oriented bounding box
@@ -26,7 +29,8 @@ class Obb: public CollisionShape
 
 		Obb getTransformed(const Transform& transform) const;
 
-		/// Get a collision shape that includes this and the given. Its not very accurate
+		/// Get a collision shape that includes this and the given. Its not
+		/// very accurate
 		Obb getCompoundShape(const Obb& b) const;
 
 		/// @see CollisionShape::testPlane
@@ -41,7 +45,9 @@ class Obb: public CollisionShape
 		/// @{
 		Vec3 center;
 		Mat3 rotation;
-		Vec3 extends; ///< With identity rotation this points to max (front, right, top in our case)
+		/// With identity rotation this points to max (front, right, top in
+		/// our case)
+		Vec3 extends;
 		/// @}
 
 		/// Get extreme points in 3D space
@@ -49,22 +55,26 @@ class Obb: public CollisionShape
 };
 
 
-inline Obb::Obb(const Obb& b):
-	CollisionShape(CST_OBB),
+inline Obb::Obb(const Obb& b)
+:	CollisionShape(CST_OBB),
 	center(b.center),
 	rotation(b.rotation),
 	extends(b.extends)
 {}
 
 
-inline Obb::Obb(const Vec3& center_, const Mat3& rotation_, const Vec3& extends_):
-	CollisionShape(CST_OBB),
+inline Obb::Obb(const Vec3& center_, const Mat3& rotation_,
+	const Vec3& extends_)
+:	CollisionShape(CST_OBB),
 	center(center_),
 	rotation(rotation_),
 	extends(extends_)
 {}
 
 
+} // end namespace
+
+
 #include "Obb.inl.h"
 
 

+ 11 - 4
src/Collision/Obb.inl.h

@@ -2,9 +2,12 @@
 #include <boost/range/iterator_range.hpp>
 
 
-//======================================================================================================================
-// set                                                                                                                 =
-//======================================================================================================================
+namespace Col {
+
+
+//==============================================================================
+// set                                                                         =
+//==============================================================================
 template<typename Container>
 void Obb::set(const Container& container)
 {
@@ -14,7 +17,8 @@ void Obb::set(const Container& container)
 	Vec3 max(container.front());
 
 	// for all the Vec3s calc the max and min
-	BOOST_FOREACH(const Vec3& v, boost::make_iterator_range(container.begin() + 1, container.end()))
+	BOOST_FOREACH(const Vec3& v,
+		boost::make_iterator_range(container.begin() + 1, container.end()))
 	{
 		for(int j = 0; j < 3; j++)
 		{
@@ -34,3 +38,6 @@ void Obb::set(const Container& container)
 	rotation = Mat3::getIdentity();
 	extends = max - center;
 }
+
+
+} // end namespace

+ 16 - 10
src/Collision/Plane.cpp

@@ -1,10 +1,13 @@
 #include "Plane.h"
-#include "Assert.h"
+#include "Util/Assert.h"
 
 
-//======================================================================================================================
-// setFrom3Points                                                                                                      =
-//======================================================================================================================
+namespace Col {
+
+
+//==============================================================================
+// setFrom3Points                                                              =
+//==============================================================================
 void Plane::setFrom3Points(const Vec3& p0, const Vec3& p1, const Vec3& p2)
 {
 	// get plane vectors
@@ -21,9 +24,9 @@ void Plane::setFrom3Points(const Vec3& p0, const Vec3& p1, const Vec3& p2)
 }
 
 
-//======================================================================================================================
-// setFromPlaneEquation                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// setFromPlaneEquation                                                        =
+//==============================================================================
 void Plane::setFromPlaneEquation(float a, float b, float c, float d)
 {
 	// normalize for cheap distance checks
@@ -46,9 +49,9 @@ void Plane::setFromPlaneEquation(float a, float b, float c, float d)
 }
 
 
-//======================================================================================================================
-// getTransformed                                                                                                      =
-//======================================================================================================================
+//==============================================================================
+// getTransformed                                                              =
+//==============================================================================
 Plane Plane::getTransformed(const Transform& trf) const
 {
 	Plane plane;
@@ -62,3 +65,6 @@ Plane Plane::getTransformed(const Transform& trf) const
 
 	return plane;
 }
+
+
+} // end namespace

+ 29 - 16
src/Collision/Plane.h

@@ -1,8 +1,11 @@
-#ifndef PLANE_H
-#define PLANE_H
+#ifndef COL_PLANE_H
+#define COL_PLANE_H
 
 #include "CollisionShape.h"
-#include "Math.h"
+#include "Math/Math.h"
+
+
+namespace Col {
 
 
 /// Plane collision shape
@@ -38,16 +41,17 @@ class Plane: public CollisionShape
 		/// Return the transformed
 		Plane getTransformed(const Transform& trf) const;
 
-		/// It gives the distance between a point and a plane. if returns >0 then the point lies in front of the plane,
-		/// if <0 then it is behind and if =0 then it is co-planar
+		/// It gives the distance between a point and a plane. if returns >0
+		/// then the point lies in front of the plane, if <0 then it is behind
+		/// and if =0 then it is co-planar
 		float test(const Vec3& point) const {return normal.dot(point) - offset;}
 
 		/// Get the distance from a point to this plane
 		float getDistance(const Vec3& point) const {return fabs(test(point));}
 
-		/// Returns the perpedicular point of a given point in this plane. Plane's normal and returned-point are
-		/// perpedicular
-		Vec3 getClosestPoint(const Vec3& point) const {return point - normal * test(point);}
+		/// Returns the perpedicular point of a given point in this plane.
+		/// Plane's normal and returned-point are perpedicular
+		Vec3 getClosestPoint(const Vec3& point) const;
 
 		/// Do nothing
 		float testPlane(const Plane&) const {return 0.0;}
@@ -67,32 +71,41 @@ class Plane: public CollisionShape
 };
 
 
-inline Plane::Plane(const Plane& b):
-	CollisionShape(CST_PLANE),
+inline Plane::Plane(const Plane& b)
+:	CollisionShape(CST_PLANE),
 	normal(b.normal),
 	offset(b.offset)
 {}
 
 
-inline Plane::Plane(const Vec3& normal_, float offset_):
-	CollisionShape(CST_PLANE),
+inline Plane::Plane(const Vec3& normal_, float offset_)
+:	CollisionShape(CST_PLANE),
 	normal(normal_),
 	offset(offset_)
 {}
 
 
-inline Plane::Plane(const Vec3& p0, const Vec3& p1, const Vec3& p2):
-	CollisionShape(CST_PLANE)
+inline Plane::Plane(const Vec3& p0, const Vec3& p1, const Vec3& p2)
+:	CollisionShape(CST_PLANE)
 {
 	setFrom3Points(p0, p1, p2);
 }
 
 
-inline Plane::Plane(float a, float b, float c, float d):
-	CollisionShape(CST_PLANE)
+inline Plane::Plane(float a, float b, float c, float d)
+:	CollisionShape(CST_PLANE)
 {
 	setFromPlaneEquation(a, b, c, d);
 }
 
 
+inline Vec3 Plane::getClosestPoint(const Vec3& point) const
+{
+	return point - normal * test(point);
+}
+
+
+} // end namespace
+
+
 #endif

+ 12 - 6
src/Collision/Ray.cpp

@@ -2,9 +2,12 @@
 #include "Plane.h"
 
 
-//======================================================================================================================
-// getTransformed                                                                                                      =
-//======================================================================================================================
+namespace Col {
+
+
+//==============================================================================
+// getTransformed                                                              =
+//==============================================================================
 Ray Ray::getTransformed(const Transform& transform) const
 {
 	Ray out;
@@ -14,9 +17,9 @@ Ray Ray::getTransformed(const Transform& transform) const
 }
 
 
-//======================================================================================================================
-// testPlane                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// testPlane                                                                   =
+//==============================================================================
 float Ray::testPlane(const Plane& plane) const
 {
 	float dist = plane.test(origin);
@@ -45,3 +48,6 @@ float Ray::testPlane(const Plane& plane) const
 		}
 	}
 }
+
+
+} // end namespace

+ 14 - 8
src/Collision/Ray.h

@@ -1,9 +1,12 @@
-#ifndef RAY_H
-#define RAY_H
+#ifndef COL_RAY_H
+#define COL_RAY_H
 
 #include "CollisionShape.h"
-#include "Math.h"
-#include "Accessors.h"
+#include "Math/Math.h"
+#include "Util/Accessors.h"
+
+
+namespace Col {
 
 
 class Plane;
@@ -40,18 +43,21 @@ class Ray: public CollisionShape
 };
 
 
-inline Ray::Ray(const Ray& other):
-	CollisionShape(CST_RAY),
+inline Ray::Ray(const Ray& other)
+:	CollisionShape(CST_RAY),
 	origin(other.origin),
 	dir(other.dir)
 {}
 
 
-inline Ray::Ray(const Vec3& origin_, const Vec3& direction_):
-	CollisionShape(CST_RAY),
+inline Ray::Ray(const Vec3& origin_, const Vec3& direction_)
+:	CollisionShape(CST_RAY),
 	origin(origin_),
 	dir(direction_)
 {}
 
 
+} // end namespace
+
+
 #endif

+ 21 - 12
src/Collision/Sphere.cpp

@@ -2,21 +2,25 @@
 #include "Plane.h"
 
 
-//======================================================================================================================
-// getTransformed                                                                                                      =
-//======================================================================================================================
+namespace Col {
+
+
+//==============================================================================
+// getTransformed                                                              =
+//==============================================================================
 Sphere Sphere::getTransformed(const Transform& transform) const
 {
 	Sphere newSphere;
-	newSphere.center = center.getTransformed(transform.getOrigin(), transform.getRotation(), transform.getScale());
+	newSphere.center = center.getTransformed(transform.getOrigin(),
+		transform.getRotation(), transform.getScale());
 	newSphere.radius = radius * transform.getScale();
 	return newSphere;
 }
 
 
-//======================================================================================================================
-// getCompoundShape                                                                                                   =
-//======================================================================================================================
+//==============================================================================
+// getCompoundShape                                                            =
+//==============================================================================
 Sphere Sphere::getCompoundShape(const Sphere& b) const
 {
 	const Sphere& a = *this;
@@ -43,11 +47,13 @@ Sphere Sphere::getCompoundShape(const Sphere& b) const
 	{
 		float l = sqrt(lenSqr);
 		float t = (l + b.radius - a.radius) / (2.0 * l);
-		return Sphere(a.center + t * centerDiff, (l + a.radius + b.radius) / 2.0);
+		return Sphere(a.center + t * centerDiff, (l + a.radius + b.radius) /
+			2.0);
 	}
 	*/
 
-	Vec3 c = b.getCenter() - a.getCenter(); // vector from one center to the other
+	Vec3 c = b.getCenter() - a.getCenter(); // Vector from one center to the
+	                                        // other
 	float cLen = c.getLength();
 
 	if(cLen + b.getRadius() < a.getRadius())
@@ -68,9 +74,9 @@ Sphere Sphere::getCompoundShape(const Sphere& b) const
 }
 
 
-//======================================================================================================================
-// testPlane                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// testPlane                                                                   =
+//==============================================================================
 float Sphere::testPlane(const Plane& plane) const
 {
 	float dist = plane.test(center);
@@ -88,3 +94,6 @@ float Sphere::testPlane(const Plane& plane) const
 		return 0.0;
 	}
 }
+
+
+} // end namespace

+ 15 - 9
src/Collision/Sphere.h

@@ -1,8 +1,11 @@
-#ifndef SPHERE_H
-#define SPHERE_H
+#ifndef COL_SPHERE_H
+#define COL_SPHERE_H
 
 #include "CollisionShape.h"
-#include "Math.h"
+#include "Math/Math.h"
+
+
+namespace Col {
 
 
 class Plane;
@@ -34,8 +37,8 @@ class Sphere: public CollisionShape
 
 		Sphere getTransformed(const Transform& transform) const;
 
-		/// Get the sphere that includes this sphere and the given. See a drawing in the docs dir for more info about the
-		/// algorithm
+		/// Get the sphere that includes this sphere and the given. See a
+		/// drawing in the docs dir for more info about the algorithm
 		Sphere getCompoundShape(const Sphere& b) const;
 
 		/// @see CollisionShape::testPlane
@@ -51,20 +54,23 @@ class Sphere: public CollisionShape
 };
 
 
-inline Sphere::Sphere(const Sphere& b):
-	CollisionShape(CST_SPHERE),
+inline Sphere::Sphere(const Sphere& b)
+:	CollisionShape(CST_SPHERE),
 	center(b.center),
 	radius(b.radius)
 {}
 
 
-inline Sphere::Sphere(const Vec3& center_, float radius_):
-	CollisionShape(CST_SPHERE),
+inline Sphere::Sphere(const Vec3& center_, float radius_)
+:	CollisionShape(CST_SPHERE),
 	center(center_),
 	radius(radius_)
 {}
 
 
+} // end namespace
+
+
 #include "Sphere.inl.h"
 
 

+ 17 - 7
src/Collision/Sphere.inl.h

@@ -1,11 +1,14 @@
 #include <boost/foreach.hpp>
 #include <boost/range/iterator_range.hpp>
-#include "Assert.h"
+#include "Util/Assert.h"
 
 
-//======================================================================================================================
-// set                                                                                                                 =
-//======================================================================================================================
+namespace Col {
+
+
+//==============================================================================
+// set                                                                         =
+//==============================================================================
 template<typename Container>
 void Sphere::set(const Container& container)
 {
@@ -15,7 +18,8 @@ void Sphere::set(const Container& container)
 	Vec3 max(container.front());
 
 	// for all the Vec3 calc the max and min
-	BOOST_FOREACH(const Vec3& v, boost::make_iterator_range(container.begin() + 1, container.end()))
+	BOOST_FOREACH(const Vec3& v,
+		boost::make_iterator_range(container.begin() + 1, container.end()))
 	{
 		for(int j = 0; j < 3; j++)
 		{
@@ -32,8 +36,11 @@ void Sphere::set(const Container& container)
 
 	center = (min + max) * 0.5; // average
 
-	float maxDist = (container.front() - center).getLengthSquared(); // max distance between center and the vec3 arr
-	BOOST_FOREACH(const Vec3& v, boost::make_iterator_range(container.begin() + 1, container.end()))
+	// max distance between center and the vec3 arr
+	float maxDist = (container.front() - center).getLengthSquared();
+
+	BOOST_FOREACH(const Vec3& v,
+		boost::make_iterator_range(container.begin() + 1, container.end()))
 	{
 		float dist = (v - center).getLengthSquared();
 		if(dist > maxDist)
@@ -44,3 +51,6 @@ void Sphere::set(const Container& container)
 
 	radius = M::sqrt(maxDist);
 }
+
+
+} // end namespace

+ 43 - 40
src/Core/App.cpp

@@ -12,13 +12,15 @@
 #include "StdinListener.h"
 #include "Input.h"
 #include "Logger.h"
-#include "Globals.h"
+#include "Core/Globals.h"
 #include "JobManager.h"
+#include "PhyDbgDrawer.h"
+#include "Scene.h"
 
 
-//======================================================================================================================
-// handleMessageHanlderMsgs                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// handleMessageHanlderMsgs                                                    =
+//==============================================================================
 void App::handleMessageHanlderMsgs(const char* file, int line, const char* func, const char* msg)
 {
 	if(boost::find_first(msg, "Warning") || boost::find_first(msg, "Error"))
@@ -32,9 +34,9 @@ void App::handleMessageHanlderMsgs(const char* file, int line, const char* func,
 }
 
 
-//======================================================================================================================
-// parseCommandLineArgs                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// parseCommandLineArgs                                                        =
+//==============================================================================
 void App::parseCommandLineArgs(int argc, char* argv[])
 {
 	for(int i = 1; i < argc; i++)
@@ -57,9 +59,9 @@ void App::parseCommandLineArgs(int argc, char* argv[])
 }
 
 
-//======================================================================================================================
-// init                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// init                                                                        =
+//==============================================================================
 void App::init(int argc, char* argv[])
 {
 	windowW = 1280;
@@ -109,6 +111,7 @@ void App::init(int argc, char* argv[])
 	initWindow();
 	initRenderer();
 	JobManagerSingleton::getInstance().init(4);
+	SceneSingleton::getInstance().getPhysMasterContainer().setDebugDrawer(new PhyDbgDrawer);
 
 	// other
 	activeCam = NULL;
@@ -118,9 +121,9 @@ void App::init(int argc, char* argv[])
 }
 
 
-//======================================================================================================================
-// initWindow                                                                                                          =
-//======================================================================================================================
+//==============================================================================
+// initWindow                                                                  =
+//==============================================================================
 void App::initWindow()
 {
 	INFO("SDL window initializing...");
@@ -173,9 +176,9 @@ void App::initWindow()
 }
 
 
-//======================================================================================================================
-// initDirs                                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// initDirs                                                                    =
+//==============================================================================
 void App::initDirs()
 {
 	settingsPath = boost::filesystem::path(getenv("HOME")) / ".anki";
@@ -197,9 +200,9 @@ void App::initDirs()
 }
 
 
-//======================================================================================================================
-// initRenderer                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// initRenderer                                                                =
+//==============================================================================
 void App::initRenderer()
 {
 	RendererInitializer initializer;
@@ -227,9 +230,9 @@ void App::initRenderer()
 }
 
 
-//======================================================================================================================
-// togleFullScreen                                                                                                     =
-//======================================================================================================================
+//==============================================================================
+// togleFullScreen                                                             =
+//==============================================================================
 void App::togleFullScreen()
 {
 	//SDL_WM_ToggleFullScreen(mainSurf);
@@ -238,9 +241,9 @@ void App::togleFullScreen()
 }
 
 
-//======================================================================================================================
-// swapBuffers                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// swapBuffers                                                                 =
+//==============================================================================
 void App::swapBuffers()
 {
 	//SDL_GL_SwapBuffers();
@@ -248,9 +251,9 @@ void App::swapBuffers()
 }
 
 
-//======================================================================================================================
-// quit                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// quit                                                                     =
+//==============================================================================
 void App::quit(int code)
 {
 	SDL_FreeSurface(iconImage);
@@ -261,9 +264,9 @@ void App::quit(int code)
 }
 
 
-//======================================================================================================================
-// printAppInfo                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// printAppInfo                                                                =
+//==============================================================================
 #if !defined(REVISION)
 	#define REVISION "unknown"
 #endif
@@ -295,9 +298,9 @@ void App::printAppInfo()
 }
 
 
-//======================================================================================================================
-// getDesktopWidth                                                                                                     =
-//======================================================================================================================
+//==============================================================================
+// getDesktopWidth                                                             =
+//==============================================================================
 uint App::getDesktopWidth() const
 {
 	SDL_DisplayMode mode;
@@ -307,9 +310,9 @@ uint App::getDesktopWidth() const
 }
 
 
-//======================================================================================================================
-// getDesktopHeight                                                                                                    =
-//======================================================================================================================
+//==============================================================================
+// getDesktopHeight                                                            =
+//==============================================================================
 uint App::getDesktopHeight() const
 {
 	SDL_DisplayMode mode;
@@ -319,9 +322,9 @@ uint App::getDesktopHeight() const
 }
 
 
-//======================================================================================================================
-// execStdinScpripts                                                                                                   =
-//======================================================================================================================
+//==============================================================================
+// execStdinScpripts                                                           =
+//==============================================================================
 void App::execStdinScpripts()
 {
 	while(1)

+ 4 - 4
src/Core/App.h

@@ -3,10 +3,10 @@
 
 #include <SDL/SDL.h>
 #include <boost/filesystem.hpp>
-#include "StdTypes.h"
-#include "Accessors.h"
-#include "Exception.h"
-#include "Singleton.h"
+#include "Util/StdTypes.h"
+#include "Util/Accessors.h"
+#include "Util/Exception.h"
+#include "Util/Singleton.h"
 
 
 class StdinListener;

+ 13 - 13
src/Core/AsyncLoader.cpp

@@ -1,12 +1,12 @@
 #include "AsyncLoader.h"
 #include "Logger.h"
 #include "App.h"
-#include "Globals.h"
+#include "Core/Globals.h"
 
 
-//======================================================================================================================
-// start                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// start                                                                       =
+//==============================================================================
 void AsyncLoader::start()
 {
 	INFO("Starting async loader thread...");
@@ -14,9 +14,9 @@ void AsyncLoader::start()
 }
 
 
-//======================================================================================================================
-// load                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// load                                                                        =
+//==============================================================================
 void AsyncLoader::load(const char* filename, LoadCallback loadCallback, void* storage)
 {
 	INFO("New load request for \"" << filename << "\"");
@@ -29,9 +29,9 @@ void AsyncLoader::load(const char* filename, LoadCallback loadCallback, void* st
 }
 
 
-//======================================================================================================================
-// workingFunc                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// workingFunc                                                                 =
+//==============================================================================
 void AsyncLoader::workingFunc()
 {
 	/*glContext = SDL_GL_CreateContext(AppSingleton::getInstance().getWindowId());
@@ -81,9 +81,9 @@ void AsyncLoader::workingFunc()
 }
 
 
-//======================================================================================================================
-// pollForFinished                                                                                                     =
-//======================================================================================================================
+//==============================================================================
+// pollForFinished                                                             =
+//==============================================================================
 bool AsyncLoader::pollForFinished(std::string& filename, void* buff, bool& ok)
 {
 	boost::mutex::scoped_lock lock(mutexResp);

+ 1 - 1
src/Core/Globals.h

@@ -1,7 +1,7 @@
 #ifndef GLOBALS_H
 #define GLOBALS_H
 
-#include "Singleton.h"
+#include "Util/Singleton.h"
 
 
 typedef Singleton<class Logger> LoggerSingleton;

+ 9 - 9
src/Core/JobManager.cpp

@@ -1,9 +1,9 @@
 #include "JobManager.h"
 
 
-//======================================================================================================================
-// assignNewJob                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// assignNewJob                                                                =
+//==============================================================================
 void WorkerThread::assignNewJob(JobCallback job_, void* jobParams_)
 {
 	boost::mutex::scoped_lock lock(mutex);
@@ -15,9 +15,9 @@ void WorkerThread::assignNewJob(JobCallback job_, void* jobParams_)
 }
 
 
-//======================================================================================================================
-// workingFunc                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// workingFunc                                                                 =
+//==============================================================================
 void WorkerThread::workingFunc()
 {
 	while(1)
@@ -45,9 +45,9 @@ void WorkerThread::workingFunc()
 }
 
 
-//======================================================================================================================
-// init                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// init                                                                        =
+//==============================================================================
 void JobManager::init(uint threadsNum)
 {
 	barrier.reset(new boost::barrier(threadsNum + 1));

+ 1 - 1
src/Core/JobManager.h

@@ -4,7 +4,7 @@
 #include <boost/thread.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/scoped_ptr.hpp>
-#include "Accessors.h"
+#include "Util/Accessors.h"
 
 
 class JobManager;

+ 27 - 27
src/Core/Logger.cpp

@@ -2,18 +2,18 @@
 #include "Logger.h"
 
 
-//======================================================================================================================
-// operator<< [const void*]                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// operator<< [const void*]                                                    =
+//==============================================================================
 Logger& Logger::operator<<(const void* val)
 {
 	return appendUsingLexicalCast(val);
 }
 
 
-//======================================================================================================================
-// operator<< [const char*]                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// operator<< [const char*]                                                    =
+//==============================================================================
 Logger& Logger::operator<<(const char* val)
 {
 	append(val, strlen(val));
@@ -21,9 +21,9 @@ Logger& Logger::operator<<(const char* val)
 }
 
 
-//======================================================================================================================
-// operator<< [std::string]                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// operator<< [std::string]                                                    =
+//==============================================================================
 Logger& Logger::operator<<(const std::string& val)
 {
 	append(val.c_str(), val.length());
@@ -31,9 +31,9 @@ Logger& Logger::operator<<(const std::string& val)
 }
 
 
-//======================================================================================================================
-// operator<< [Logger& (*funcPtr)(Logger&)]                                                                            =
-//======================================================================================================================
+//==============================================================================
+// operator<< [Logger& (*funcPtr)(Logger&)]                                    =
+//==============================================================================
 Logger& Logger::operator<<(Logger& (*funcPtr)(Logger&))
 {
 	if(funcPtr == endl)
@@ -50,9 +50,9 @@ Logger& Logger::operator<<(Logger& (*funcPtr)(Logger&))
 }
 
 
-//======================================================================================================================
-// operator<< [LoggerSender]                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// operator<< [LoggerSender]                                                   =
+//==============================================================================
 Logger& Logger::operator<<(const LoggerSender& sender)
 {
 	file = sender.file;
@@ -62,9 +62,9 @@ Logger& Logger::operator<<(const LoggerSender& sender)
 }
 
 
-//======================================================================================================================
-// write                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// write                                                                       =
+//==============================================================================
 void Logger::write(const char* file_, int line_, const char* func_, const char* msg)
 {
 	file = file_;
@@ -75,9 +75,9 @@ void Logger::write(const char* file_, int line_, const char* func_, const char*
 }
 
 
-//======================================================================================================================
-// execCommonConstructionCode                                                                                          =
-//======================================================================================================================
+//==============================================================================
+// execCommonConstructionCode                                                  =
+//==============================================================================
 void Logger::execCommonConstructionCode()
 {
 	sptr = &streamBuf[0];
@@ -87,9 +87,9 @@ void Logger::execCommonConstructionCode()
 }
 
 
-//======================================================================================================================
-// append                                                                                                              =
-//======================================================================================================================
+//==============================================================================
+// append                                                                      =
+//==============================================================================
 void Logger::append(const char* cstr, int len)
 {
 	if(len > STREAM_SIZE - 1)
@@ -117,9 +117,9 @@ void Logger::append(const char* cstr, int len)
 }
 
 
-//======================================================================================================================
-// realFlush                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// realFlush                                                                   =
+//==============================================================================
 void Logger::realFlush()
 {
 	*sptr = '\0';

+ 6 - 7
src/Core/Logger.h

@@ -5,7 +5,6 @@
 #include <boost/signals2.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/thread/mutex.hpp>
-#include "Singleton.h"
 
 
 /// The logger singleton class. The logger cannot print errors or throw exceptions, it has to recover somehow. Its
@@ -100,9 +99,9 @@ class Logger
 };
 
 
-//======================================================================================================================
-// Inlines                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// Inlines                                                                     =
+//==============================================================================
 
 inline Logger::LoggerSender Logger::setSender(const char* file, int line, const char* func)
 {
@@ -128,9 +127,9 @@ Logger& Logger::appendUsingLexicalCast(const Type& val)
 }
 
 
-//======================================================================================================================
-// Macros                                                                                                              =
-//======================================================================================================================
+//==============================================================================
+// Macros                                                                      =
+//==============================================================================
 
 #define LOGGER_MESSAGE(x) \
 	do \

+ 14 - 14
src/Core/Object.cpp

@@ -2,13 +2,13 @@
 #include <boost/foreach.hpp>
 
 #include "Object.h"
-#include "Assert.h"
-#include "Exception.h"
+#include "Util/Assert.h"
+#include "Util/Exception.h"
 
 
-//======================================================================================================================
-// Constructor                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// Constructor                                                                 =
+//==============================================================================
 Object::Object(Object* parent):
 	objParent(NULL)
 {
@@ -19,9 +19,9 @@ Object::Object(Object* parent):
 }
 
 
-//======================================================================================================================
-// Destructor                                                                                                          =
-//======================================================================================================================
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
 Object::~Object()
 {
 	if(objParent != NULL)
@@ -37,9 +37,9 @@ Object::~Object()
 }
 
 
-//======================================================================================================================
-// addChild                                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// addChild                                                                    =
+//==============================================================================
 void Object::addChild(Object* child)
 {
 	ASSERT(child != NULL);
@@ -50,9 +50,9 @@ void Object::addChild(Object* child)
 }
 
 
-//======================================================================================================================
-// removeChild                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// removeChild                                                                 =
+//==============================================================================
 void Object::removeChild(Object* child)
 {
 	ASSERT(child != NULL);

+ 1 - 1
src/Core/Object.h

@@ -1,7 +1,7 @@
 #ifndef OBJECT_H
 #define OBJECT_H
 
-#include "Vec.h"
+#include "Util/Vec.h"
 
 
 /// A class for automatic garbage collection. Cause we -the programmers- get bored when it comes to deallocation. Dont

+ 9 - 9
src/Core/StdinListener.cpp

@@ -1,9 +1,9 @@
 #include "StdinListener.h"
 
 
-//======================================================================================================================
-// workingFunc                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// workingFunc                                                                 =
+//==============================================================================
 void StdinListener::workingFunc()
 {
 	char buff[512];
@@ -22,9 +22,9 @@ void StdinListener::workingFunc()
 }
 
 
-//======================================================================================================================
-// getLine                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// getLine                                                                     =
+//==============================================================================
 std::string StdinListener::getLine()
 {
 	std::string ret;
@@ -39,9 +39,9 @@ std::string StdinListener::getLine()
 }
 
 
-//======================================================================================================================
-// start                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// start                                                                       =
+//==============================================================================
 void StdinListener::start()
 {
 	thrd = boost::thread(&StdinListener::workingFunc, this);

+ 1 - 1
src/Core/StdinListener.h

@@ -5,7 +5,7 @@
 #include <boost/thread/mutex.hpp>
 #include <string>
 #include <queue>
-#include "Singleton.h"
+#include "Util/Singleton.h"
 
 
 /// The listener of the stdin.

+ 4 - 0
src/Events/CMakeLists.txt

@@ -0,0 +1,4 @@
+FILE(GLOB EVENTS_SOURCES *.cpp)
+FILE(GLOB EVENTS_HEADERS *.h)
+
+ADD_LIBRARY(Events ${EVENTS_SOURCES} ${EVENTS_HEADERS})

+ 1 - 1
src/Events/Event.cpp

@@ -1,5 +1,5 @@
 #include "Event.h"
-#include "Assert.h"
+#include "Util/Assert.h"
 
 
 namespace Event {

+ 2 - 2
src/Events/Event.h

@@ -1,8 +1,8 @@
 #ifndef EVENT_H
 #define EVENT_H
 
-#include "StdTypes.h"
-#include "Accessors.h"
+#include "Util/StdTypes.h"
+#include "Util/Accessors.h"
 
 
 namespace Event {

+ 13 - 15
src/Events/EventMainRendererPpsHdr.cpp → src/Events/MainRendererPpsHdr.cpp

@@ -1,6 +1,6 @@
-#include "EventMainRendererPpsHdr.h"
-#include "MainRenderer.h"
-#include "Globals.h"
+#include "MainRendererPpsHdr.h"
+#include "Renderer/MainRenderer.h"
+#include "Core/Globals.h"
 
 
 namespace Event {
@@ -17,12 +17,10 @@ MainRendererPpsHdr::MainRendererPpsHdr(float startTime, float duration,
 	finalData.blurringIterationsNum = blurringIterationsNum_;
 	finalData.blurringDist = blurringDist_;
 
-	originalData.exposure = MainRendererSingleton::getInstance().getPps().
-		getHdr().getExposure();
-	originalData.blurringIterationsNum = MainRendererSingleton::getInstance().
-		getPps().getHdr().getBlurringIterationsNum();
-	originalData.blurringDist = MainRendererSingleton::getInstance().getPps().
-		getHdr().getBlurringDist();
+	const Hdr& hdr = MainRendererSingleton::getInstance().getPps().getHdr();
+	originalData.exposure = hdr.getExposure();
+	originalData.blurringIterationsNum = hdr.getBlurringIterationsNum();
+	originalData.blurringDist = hdr.getBlurringDist();
 }
 
 
@@ -56,15 +54,15 @@ void MainRendererPpsHdr::updateSp(float /*prevUpdateTime*/, float crntTime)
 	float d = crntTime - getStartTime(); // delta
 	float dp = d / getDuration(); // delta as percentage
 
-	MainRendererSingleton::getInstance().getPps().getHdr().setExposure(
-		interpolate(originalData.exposure, finalData.exposure, dp));
+	Hdr& hdr = MainRendererSingleton::getInstance().getPps().getHdr();
 
-	MainRendererSingleton::getInstance().getPps().getHdr().
-		setBlurringIterationsNum(interpolate(originalData.blurringIterationsNum,
+	hdr.setExposure(interpolate(originalData.exposure, finalData.exposure, dp));
+
+	hdr.setBlurringIterationsNum(interpolate(originalData.blurringIterationsNum,
 		finalData.blurringIterationsNum, dp));
 
-	MainRendererSingleton::getInstance().getPps().getHdr().setBlurringDist(
-		interpolate(originalData.blurringDist, finalData.blurringDist, dp));
+	hdr.setBlurringDist(interpolate(originalData.blurringDist,
+		finalData.blurringDist, dp));
 }
 
 

+ 0 - 0
src/Events/EventMainRendererPpsHdr.h → src/Events/MainRendererPpsHdr.h


+ 1 - 1
src/Events/EventManager.cpp → src/Events/Manager.cpp

@@ -1,4 +1,4 @@
-#include "EventManager.h"
+#include "Manager.h"
 #include <boost/foreach.hpp>
 
 

+ 1 - 1
src/Events/EventManager.h → src/Events/Manager.h

@@ -39,7 +39,7 @@ class Manager
 } // end namespace
 
 
-#include "EventManager.inl.h"
+#include "Manager.inl.h"
 
 
 #endif

+ 1 - 1
src/Events/EventManager.inl.h → src/Events/Manager.inl.h

@@ -1,4 +1,4 @@
-#include "EventManager.h"
+#include "Manager.h"
 
 
 namespace Event {

+ 4 - 4
src/Events/EventSceneColor.cpp → src/Events/SceneColor.cpp

@@ -1,7 +1,7 @@
-#include "EventSceneColor.h"
-#include "Scene.h"
-#include "Globals.h"
-#include "Logger.h"
+#include "SceneColor.h"
+#include "Scene/Scene.h"
+#include "Core/Globals.h"
+#include "Core/Logger.h"
 
 
 namespace Event {

+ 1 - 1
src/Events/EventSceneColor.h → src/Events/SceneColor.h

@@ -2,7 +2,7 @@
 #define EVENT_SCENE_COLOR_H
 
 #include "Event.h"
-#include "Math.h"
+#include "Math/Math.h"
 
 
 namespace Event {

+ 10 - 10
src/GfxApi/BufferObjects/BufferObject.cpp

@@ -1,11 +1,11 @@
 #include <cstring>
 #include "BufferObject.h"
-#include "GlException.h"
+#include "GfxApi/GlException.h"
 
 
-//======================================================================================================================
-// create                                                                                                              =
-//======================================================================================================================
+//==============================================================================
+// create                                                                      =
+//==============================================================================
 void BufferObject::create(GLenum target_, uint sizeInBytes_, const void* dataPtr, GLenum usage_)
 {
 	ASSERT(!isCreated());
@@ -35,9 +35,9 @@ void BufferObject::create(GLenum target_, uint sizeInBytes_, const void* dataPtr
 }
 
 
-//======================================================================================================================
-// write                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// write                                                                       =
+//==============================================================================
 void BufferObject::write(void* buff)
 {
 	ASSERT(isCreated());
@@ -50,9 +50,9 @@ void BufferObject::write(void* buff)
 }
 
 
-//======================================================================================================================
-// write                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// write                                                                       =
+//==============================================================================
 void BufferObject::write(void* buff, size_t offset, size_t size)
 {
 	ASSERT(isCreated());

+ 5 - 5
src/GfxApi/BufferObjects/BufferObject.h

@@ -2,8 +2,8 @@
 #define BUFFER_OBJECT_H
 
 #include <GL/glew.h>
-#include "Assert.h"
-#include "StdTypes.h"
+#include "Util/Assert.h"
+#include "Util/StdTypes.h"
 
 
 /// A wrapper for OpenGL buffer objects (vertex arrays, texture buffers etc) to prevent us from making idiotic errors
@@ -70,9 +70,9 @@ class BufferObject
 };
 
 
-//======================================================================================================================
-// Inlines                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// Inlines                                                                     =
+//==============================================================================
 
 inline BufferObject::BufferObject(GLenum target, uint sizeInBytes, const void* dataPtr, GLenum usage):
 	glId(0)

+ 10 - 10
src/GfxApi/BufferObjects/Fbo.cpp

@@ -1,10 +1,10 @@
+#include "Fbo.h"
 #include <boost/lexical_cast.hpp>
-#include <Fbo.h>
 
 
-//======================================================================================================================
-// checkIfGood                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// checkIfGood                                                                 =
+//==============================================================================
 void Fbo::checkIfGood() const
 {
 	ASSERT(isCreated());
@@ -19,9 +19,9 @@ void Fbo::checkIfGood() const
 }
 
 
-//======================================================================================================================
-// setNumOfColorAttachements                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// setNumOfColorAttachements                                                   =
+//==============================================================================
 void Fbo::setNumOfColorAttachements(uint num) const
 {
 	ASSERT(isCreated());
@@ -45,9 +45,9 @@ void Fbo::setNumOfColorAttachements(uint num) const
 }
 
 
-//======================================================================================================================
-// getCurrentFbo                                                                                                       =
-//======================================================================================================================
+//==============================================================================
+// getCurrentFbo                                                               =
+//==============================================================================
 uint Fbo::getCurrentFbo()
 {
 	int fboGlId;

+ 6 - 6
src/GfxApi/BufferObjects/Fbo.h

@@ -2,9 +2,9 @@
 #define FBO_H
 
 #include <GL/glew.h>
-#include "Assert.h"
-#include "StdTypes.h"
-#include "Exception.h"
+#include "Util/Assert.h"
+#include "Util/StdTypes.h"
+#include "Util/Exception.h"
 
 
 /// The class is actually a wrapper to avoid common mistakes
@@ -50,9 +50,9 @@ class Fbo
 };
 
 
-//======================================================================================================================
-// Inlines                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// Inlines                                                                     =
+//==============================================================================
 
 inline void Fbo::create()
 {

+ 10 - 10
src/GfxApi/BufferObjects/Vao.cpp

@@ -1,10 +1,10 @@
-#include "Vao.h"
+#include "GfxApi/BufferObjects/Vao.h"
 #include "Vbo.h"
 
 
-//======================================================================================================================
-// attachArrayBufferVbo                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// attachArrayBufferVbo                                                        =
+//==============================================================================
 void Vao::attachArrayBufferVbo(const Vbo& vbo, uint attribVarLocation, GLint size, GLenum type,
 		                       GLboolean normalized, GLsizei stride, const GLvoid* pointer)
 {
@@ -27,9 +27,9 @@ void Vao::attachArrayBufferVbo(const Vbo& vbo, uint attribVarLocation, GLint siz
 }
 
 
-//======================================================================================================================
-// attachArrayBufferVbo                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// attachArrayBufferVbo                                                        =
+//==============================================================================
 void Vao::attachArrayBufferVbo(const Vbo& vbo, const SProgAttribVar& attribVar, GLint size, GLenum type,
 		                       GLboolean normalized, GLsizei stride, const GLvoid* pointer)
 {
@@ -37,9 +37,9 @@ void Vao::attachArrayBufferVbo(const Vbo& vbo, const SProgAttribVar& attribVar,
 }
 
 
-//======================================================================================================================
-// attachElementArrayBufferVbo                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// attachElementArrayBufferVbo                                                 =
+//==============================================================================
 void Vao::attachElementArrayBufferVbo(const Vbo& vbo)
 {
 	ASSERT(isCreated());

+ 4 - 4
src/GfxApi/BufferObjects/Vao.h

@@ -2,10 +2,10 @@
 #define VAO_H
 
 #include <GL/glew.h>
-#include "StdTypes.h"
-#include "ShaderProg.h"
-#include "Object.h"
-#include "GlException.h"
+#include "Util/StdTypes.h"
+#include "Resources/ShaderProg.h"
+#include "Core/Object.h"
+#include "GfxApi/GlException.h"
 
 
 class Vbo;

+ 6 - 0
src/GfxApi/CMakeLists.txt

@@ -0,0 +1,6 @@
+FILE(GLOB_RECURSE GFX_API_SOURCES *.cpp)
+FILE(GLOB_RECURSE GFX_API_HEADERS *.h)
+
+INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/BufferObjects")
+
+ADD_LIBRARY(GfxApi ${GFX_API_SOURCES} ${GFX_API_HEADERS})

+ 1 - 1
src/Misc/GlException.h → src/GfxApi/GlException.h

@@ -3,7 +3,7 @@
 
 #include <string>
 #include <GL/glew.h>
-#include "Exception.h"
+#include "Util/Exception.h"
 
 
 /// The function throws an exception if there is an OpenGL error. Use it with the ON_GL_FAIL_THROW_EXCEPTION macro

+ 12 - 12
src/GfxApi/GlStateMachine.cpp

@@ -1,9 +1,9 @@
 #include "GlStateMachine.h"
 
 
-//======================================================================================================================
-// Statics                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// Statics                                                                     =
+//==============================================================================
 
 GLenum GlStateMachine::flagEnums[] =
 {
@@ -14,9 +14,9 @@ GLenum GlStateMachine::flagEnums[] =
 };
 
 
-//======================================================================================================================
-// enable                                                                                                              =
-//======================================================================================================================
+//==============================================================================
+// enable                                                                      =
+//==============================================================================
 void GlStateMachine::enable(GLenum glFlag, bool enable)
 {
 	ASSERT(flags.find(glFlag) != flags.end());
@@ -38,9 +38,9 @@ void GlStateMachine::enable(GLenum glFlag, bool enable)
 }
 
 
-//======================================================================================================================
-// isEnabled                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// isEnabled                                                                   =
+//==============================================================================
 bool GlStateMachine::isEnabled(GLenum glFlag)
 {
 	ASSERT(flags.find(glFlag) != flags.end());
@@ -50,9 +50,9 @@ bool GlStateMachine::isEnabled(GLenum glFlag)
 }
 
 
-//======================================================================================================================
-// sync                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// sync                                                                        =
+//==============================================================================
 void GlStateMachine::sync()
 {
 	sProgGlId = getCurrentProgramGlId();

+ 4 - 4
src/GfxApi/GlStateMachine.h

@@ -3,7 +3,7 @@
 
 #include <GL/glew.h>
 #include <boost/unordered_map.hpp>
-#include "Assert.h"
+#include "Util/Assert.h"
 
 
 /// Access the GL state machine.
@@ -38,9 +38,9 @@ class GlStateMachine
 };
 
 
-//======================================================================================================================
-// Inlines                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// Inlines                                                                     =
+//==============================================================================
 
 inline void GlStateMachine::useShaderProg(GLuint id)
 {

+ 11 - 11
src/Input/Input.cpp

@@ -1,13 +1,13 @@
 #include "Input.h"
 #include <SDL/SDL.h>
 #include "App.h"
-#include "Logger.h"
-#include "Globals.h"
+#include "Core/Logger.h"
+#include "Core/Globals.h"
 
 
-//======================================================================================================================
-// init                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// init                                                                        =
+//==============================================================================
 void Input::init()
 {
 	INFO("Initializing input...");
@@ -18,9 +18,9 @@ void Input::init()
 }
 
 
-//======================================================================================================================
-// reset                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// reset                                                                       =
+//==============================================================================
 void Input::reset(void)
 {
 	memset(&keys[0], 0, keys.size() * sizeof(short));
@@ -30,9 +30,9 @@ void Input::reset(void)
 }
 
 
-//======================================================================================================================
-// handleEvents                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// handleEvents                                                                =
+//==============================================================================
 void Input::handleEvents()
 {
 	if(hideCursor)

+ 3 - 3
src/Input/Input.h

@@ -3,9 +3,9 @@
 
 #include <SDL/SDL_scancode.h>
 #include <boost/array.hpp>
-#include "Math.h"
-#include "Singleton.h"
-#include "Accessors.h"
+#include "Math/Math.h"
+#include "Util/Singleton.h"
+#include "Util/Accessors.h"
 
 
 /// Handle the SDL input

+ 18 - 18
src/Main.cpp

@@ -5,7 +5,7 @@
 #include "Input.h"
 #include "PerspectiveCamera.h"
 #include "OrthographicCamera.h"
-#include "Math.h"
+#include "Math/Math.h"
 #include "Renderer.h"
 #include "UiPainter.h"
 #include "App.h"
@@ -33,18 +33,18 @@
 #include "ModelNode.h"
 #include "SkelAnimModelNodeCtrl.h"
 #include "Model.h"
-#include "Logger.h"
+#include "Core/Logger.h"
 #include "Util.h"
 #include "HighRezTimer.h"
 #include "SkinNode.h"
 #include "Skin.h"
 #include "MaterialRuntime.h"
-#include "Globals.h"
+#include "Core/Globals.h"
 #include "UiFtFontLoader.h"
 #include "UiFont.h"
-#include "EventManager.h"
-#include "EventSceneColor.h"
-#include "EventMainRendererPpsHdr.h"
+#include "Events/Manager.h"
+#include "Events/SceneColor.h"
+#include "Events/MainRendererPpsHdr.h"
 
 
 // map (hard coded)
@@ -118,9 +118,9 @@ void initPhysics()
 
 
 
-//======================================================================================================================
-// init                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// init                                                                        =
+//==============================================================================
 void init()
 {
 	INFO("Other init...");
@@ -255,9 +255,9 @@ void init()
 }
 
 
-//======================================================================================================================
-//                                                                                                                     =
-//======================================================================================================================
+//==============================================================================
+//                                                                             =
+//==============================================================================
 void mainLoopExtra()
 {
 	InputSingleton::getInstance().handleEvents();
@@ -351,9 +351,9 @@ void mainLoopExtra()
 }
 
 
-//======================================================================================================================
-// mainLoop                                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// mainLoop                                                                    =
+//==============================================================================
 void mainLoop()
 {
 	INFO("Entering main loop");
@@ -444,9 +444,9 @@ void mainLoop()
 }
 
 
-//======================================================================================================================
-// main                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// main                                                                        =
+//==============================================================================
 int main(int argc, char* argv[])
 {
 	/*std::stringstream ss("lala\n\n\n\n1a");

+ 1 - 1
src/Math/Axisang.h

@@ -1,7 +1,7 @@
 #ifndef AXISANG_H
 #define AXISANG_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 10 - 10
src/Math/Axisang.inl.h

@@ -1,12 +1,12 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // Default
 inline Axisang::Axisang():
@@ -132,9 +132,9 @@ inline Axisang::Axisang(const Mat3& m3)
 }
 
 
-//======================================================================================================================
-// Accessors                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                   =
+//==============================================================================
 
 inline float Axisang::getAngle() const
 {
@@ -167,9 +167,9 @@ inline void Axisang::setAxis(const Vec3& a)
 }
 
 
-//======================================================================================================================
-// Operators with same                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// Operators with same                                                         =
+//==============================================================================
 
 // =
 inline Axisang& Axisang::operator=(const Axisang& b)

+ 4 - 0
src/Math/CMakeLists.txt

@@ -0,0 +1,4 @@
+FILE(GLOB MATH_SOURCES *.cpp)
+FILE(GLOB MATH_HEADERS *.h)
+
+ADD_LIBRARY(Math ${MATH_SOURCES} ${MATH_HEADERS})

+ 6 - 6
src/Math/MathCommon.h → src/Math/Common.h

@@ -1,16 +1,16 @@
 /// @file
 /// For Internal use in math lib
 
-#ifndef MATH_COMMON_H
-#define MATH_COMMON_H
+#ifndef M_COMMON_H
+#define M_COMMON_H
 
-#include <iostream>
-#include <boost/array.hpp>
-#include "StdTypes.h"
-#include "Accessors.h"
+#include "Util/StdTypes.h"
+#include "Util/Accessors.h"
 #if defined(MATH_INTEL_SIMD)
 	#include <smmintrin.h>
 #endif
+#include <iostream>
+#include <boost/array.hpp>
 
 
 // Forward delcs

+ 5 - 6
src/Math/MathCommon.inl.h → src/Math/Common.inl.h

@@ -1,7 +1,5 @@
-/**
- * @file
- * For Internal use in math lib
- */
+/// @file
+/// For Internal use in math lib
 
 #include "Vec2.h"
 #include "Vec3.h"
@@ -11,7 +9,8 @@
 #include "Euler.h"
 #include "Mat3.h"
 #include "Mat4.h"
-#include "MathFuncs.h"
+#include "Funcs.h"
 #include "Transform.h"
 
-#include "Assert.h"
+#include "Util/Assert.h"
+#include <cmath>

+ 1 - 1
src/Math/Euler.h

@@ -1,7 +1,7 @@
 #ifndef EULER_H
 #define EULER_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 13 - 13
src/Math/Euler.inl.h

@@ -1,12 +1,12 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // Default
 inline Euler::Euler()
@@ -90,9 +90,9 @@ inline Euler::Euler(const Mat3& m3)
 }
 
 
-//======================================================================================================================
-// Accessors                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                   =
+//==============================================================================
 
 inline float& Euler::operator [](uint i)
 {
@@ -135,9 +135,9 @@ inline float Euler::z() const
 }
 
 
-//======================================================================================================================
-// Operators with same                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// Operators with same                                                         =
+//==============================================================================
 
 // =
 inline Euler& Euler::operator=(const Euler& b)
@@ -149,9 +149,9 @@ inline Euler& Euler::operator=(const Euler& b)
 }
 
 
-//======================================================================================================================
-// Print                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// Print                                                                       =
+//==============================================================================
 
 inline std::ostream& operator<<(std::ostream& s, const Euler& e)
 {

+ 67 - 0
src/Math/Funcs.cpp

@@ -0,0 +1,67 @@
+#include "Funcs.h"
+
+
+namespace M {
+
+
+
+//==============================================================================
+// polynomialSinQuadrant                                                       =
+//==============================================================================
+static float polynomialSinQuadrant(float a)
+{
+	return a * (1.0 + a * a * (-0.16666 + a * a *
+		(0.0083143 - a * a * 0.00018542)));
+}
+
+
+//==============================================================================
+// sinCos                                                                      =
+//==============================================================================
+void sinCos(float a, float& sina, float& cosa)
+{
+	bool negative = false;
+	if(a < 0.0)
+	{
+		a = -a;
+		negative = true;
+	}
+	const float kTwoOverPi = 1.0 / (PI/2.0);
+	float floatA = kTwoOverPi * a;
+	int intA = (int)floatA;
+
+	const float k_rational_half_pi = 201 / 128.0;
+	const float kRemainderHalfPi = 4.8382679e-4;
+
+	floatA = (a - k_rational_half_pi * intA) - kRemainderHalfPi * intA;
+
+	float floatAMinusHalfPi = (floatA - k_rational_half_pi) - kRemainderHalfPi;
+
+	switch(intA & 3)
+	{
+		case 0: // 0 - Pi/2
+			sina = polynomialSinQuadrant(floatA);
+			cosa = polynomialSinQuadrant(-floatAMinusHalfPi);
+			break;
+		case 1: // Pi/2 - Pi
+			sina = polynomialSinQuadrant(-floatAMinusHalfPi);
+			cosa = polynomialSinQuadrant(-floatA);
+			break;
+		case 2: // Pi - 3Pi/2
+			sina = polynomialSinQuadrant(-floatA);
+			cosa = polynomialSinQuadrant(floatAMinusHalfPi);
+			break;
+		case 3: // 3Pi/2 - 2Pi
+			sina = polynomialSinQuadrant(floatAMinusHalfPi);
+			cosa = polynomialSinQuadrant(floatA);
+			break;
+	};
+
+	if(negative)
+	{
+		sina = -sina;
+	}
+}
+
+
+} // end namespace

+ 2 - 2
src/Math/MathFuncs.h → src/Math/Funcs.h

@@ -1,7 +1,7 @@
 #ifndef MATH_FUNCS_H
 #define MATH_FUNCS_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {
@@ -32,7 +32,7 @@ extern void combineTransformations(const Vec3& t0, const Mat3& r0, // in 0
 } // end namespace
 
 
-#include "MathFuncs.inl.h"
+#include "Funcs.inl.h"
 
 
 #endif

+ 74 - 0
src/Math/Funcs.inl.h

@@ -0,0 +1,74 @@
+#include "Common.inl.h"
+
+
+namespace M {
+
+
+//==============================================================================
+// Small funcs                                                                 =
+//==============================================================================
+inline float sqrt(float f)
+{
+	#if defined(MATH_INTEL_SIMD)
+		__m128 mm = _mm_set_ss(f);
+		mm = _mm_sqrt_ss(mm);
+		float o;
+		_mm_store_ss(&o, mm);
+		return o;
+	#else
+		return ::sqrtf(f);
+	#endif
+}
+
+
+inline float toRad(float degrees)
+{
+	return degrees * (PI / 180.0);
+}
+
+
+inline float toDegrees(float rad)
+{
+	return rad * (180.0 / PI);
+}
+
+
+inline float sin(float rad)
+{
+	return ::sin(rad);
+}
+
+
+inline float cos(float rad)
+{
+	return ::cos(rad);
+}
+
+
+inline bool isZero(float f)
+{
+	return fabs(f) < EPSILON;
+}
+
+
+//  combineTransformations
+//  mat4(t0,r0,s0)*mat4(t1,r1,s1) == mat4(tf,rf,sf)
+inline void combineTransformations(const Vec3& t0, const Mat3& r0, float s0,
+                                   const Vec3& t1, const Mat3& r1, float s1,
+                                   Vec3& tf, Mat3& rf, float& sf)
+{
+	tf = t1.getTransformed(t0, r0, s0);
+	rf = r0 * r1;
+	sf = s0 * s1;
+}
+
+
+//  combineTransformations as the above but without scale
+inline void combineTransformations(const Vec3& t0, const Mat3& r0, const Vec3& t1, const Mat3& r1, Vec3& tf, Mat3& rf)
+{
+	tf = t1.getTransformed(t0, r0);
+	rf = r0 * r1;
+}
+
+
+} // end namespace

+ 1 - 1
src/Math/Mat3.h

@@ -1,7 +1,7 @@
 #ifndef MAT3_H
 #define MAT3_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 19 - 19
src/Math/Mat3.inl.h

@@ -1,4 +1,4 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 #define SELF (*this)
@@ -7,9 +7,9 @@
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // constructor [float]
 inline Mat3::Mat3(float f)
@@ -132,9 +132,9 @@ inline Mat3::Mat3(const Axisang& axisang)
 }
 
 
-//======================================================================================================================
-// Accessors                                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                    =
+//==============================================================================
 
 inline float& Mat3::operator()(const uint i, const uint j)
 {
@@ -157,9 +157,9 @@ inline const float& Mat3::operator[](const uint i) const
 }
 
 
-//======================================================================================================================
-// Operators with same                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// Operators with same                                                         =
+//==============================================================================
 
 // =
 inline Mat3& Mat3::operator=(const Mat3& b)
@@ -263,9 +263,9 @@ inline bool Mat3::operator!=(const Mat3& b) const
 }
 
 
-//======================================================================================================================
-// Operators with float                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// Operators with float                                                        =
+//==============================================================================
 
 // 3x3 + float
 inline Mat3 Mat3::operator+(float f) const
@@ -391,9 +391,9 @@ inline Mat3& Mat3::operator/=(float f)
 }
 
 
-//======================================================================================================================
-// Operators with other                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// Operators with other                                                        =
+//==============================================================================
 
 // 3x3 * vec3 (cross products with rows)
 inline Vec3 Mat3::operator*(const Vec3& b) const
@@ -406,9 +406,9 @@ inline Vec3 Mat3::operator*(const Vec3& b) const
 }
 
 
-//======================================================================================================================
-// Other                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// Other                                                                       =
+//==============================================================================
 
 // setRows
 inline void Mat3::setRows(const Vec3& a, const Vec3& b, const Vec3& c)

+ 1 - 1
src/Math/Mat4.h

@@ -1,7 +1,7 @@
 #ifndef MAT4_H
 #define MAT4_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 22 - 22
src/Math/Mat4.inl.h

@@ -1,4 +1,4 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 #define SELF (*this)
@@ -7,9 +7,9 @@
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // Copy
 inline Mat4::Mat4(const Mat4& b)
@@ -166,9 +166,9 @@ inline Mat4::Mat4(const Transform& t)
 }
 
 
-//======================================================================================================================
-// Accessors                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                   =
+//==============================================================================
 
 inline float& Mat4::operator()(const uint i, const uint j)
 {
@@ -202,9 +202,9 @@ inline const float& Mat4::operator[](const uint i) const
 	}
 #endif
 
-//======================================================================================================================
-// Operators with same                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// Operators with same                                                         =
+//==============================================================================
 
 // =
 inline Mat4& Mat4::operator=(const Mat4& b)
@@ -352,9 +352,9 @@ inline bool Mat4::operator!=(const Mat4& b) const
 	return false;
 }
 
-//======================================================================================================================
-// Operators with float                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// Operators with float                                                        =
+//==============================================================================
 
 // 4x4 + float
 inline Mat4 Mat4::operator+(float f) const
@@ -565,9 +565,9 @@ inline Mat4& Mat4::operator/=(float f)
 }
 
 
-//======================================================================================================================
-// Operators with other                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// Operators with other                                                        =
+//==============================================================================
 
 // Mat4 * Vec4
 inline Vec4 Mat4::operator*(const Vec4& b) const
@@ -588,9 +588,9 @@ inline Vec4 Mat4::operator*(const Vec4& b) const
 }
 
 
-//======================================================================================================================
-// Misc methods                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Misc methods                                                                =
+//==============================================================================
 
 // setRows
 inline void Mat4::setRows(const Vec4& a, const Vec4& b, const Vec4& c, const Vec4& d)
@@ -1021,9 +1021,9 @@ inline Mat4 Mat4::combineTransformations(const Mat4& m0, const Mat4& m1)
 }
 
 
-//======================================================================================================================
-// Print                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// Print                                                                       =
+//==============================================================================
 inline std::ostream& operator<<(std::ostream& s, const Mat4& m)
 {
 	for(int i = 0; i < 4; i++)

+ 1 - 1
src/Math/Math.h

@@ -11,7 +11,7 @@
 #include "Euler.h"
 #include "Mat3.h"
 #include "Mat4.h"
-#include "MathFuncs.h"
+#include "Funcs.h"
 #include "Transform.h"
 
 

+ 0 - 130
src/Math/MathFuncs.inl.h

@@ -1,130 +0,0 @@
-#include "MathCommon.inl.h"
-
-
-namespace M {
-
-
-// polynomialSinQuadrant
-/// Used in sinCos
-inline static float polynomialSinQuadrant(float a)
-{
-	return a * (1.0 + a * a * (-0.16666 + a * a * (0.0083143 - a * a * 0.00018542)));
-}
-
-
-// Sine and Cosine
-inline void sinCos(float a, float& sina, float& cosa)
-{
-	bool negative = false;
-	if(a < 0.0)
-	{
-		a = -a;
-		negative = true;
-	}
-	const float kTwoOverPi = 1.0 / (PI/2.0);
-	float floatA = kTwoOverPi * a;
-	int intA = (int)floatA;
-
-	const float k_rational_half_pi = 201 / 128.0;
-	const float kRemainderHalfPi = 4.8382679e-4;
-
-	floatA = (a - k_rational_half_pi * intA) - kRemainderHalfPi * intA;
-
-	float floatAMinusHalfPi = (floatA - k_rational_half_pi) - kRemainderHalfPi;
-
-	switch(intA & 3)
-	{
-		case 0: // 0 - Pi/2
-			sina = polynomialSinQuadrant(floatA);
-			cosa = polynomialSinQuadrant(-floatAMinusHalfPi);
-			break;
-		case 1: // Pi/2 - Pi
-			sina = polynomialSinQuadrant(-floatAMinusHalfPi);
-			cosa = polynomialSinQuadrant(-floatA);
-			break;
-		case 2: // Pi - 3Pi/2
-			sina = polynomialSinQuadrant(-floatA);
-			cosa = polynomialSinQuadrant(floatAMinusHalfPi);
-			break;
-		case 3: // 3Pi/2 - 2Pi
-			sina = polynomialSinQuadrant(floatAMinusHalfPi);
-			cosa = polynomialSinQuadrant(floatA);
-			break;
-	};
-
-	if(negative)
-		sina = -sina;
-
-	/*RASSERT_THROW_EXCEPTION(!isZero(M::sin(a) - sina));
-	RASSERT_THROW_EXCEPTION(!isZero(M::cos(a) - cosa));*/
-}
-
-
-//======================================================================================================================
-// Small funcs                                                                                                         =
-//======================================================================================================================
-inline float sqrt(float f)
-{
-	#if defined(MATH_INTEL_SIMD)
-		__m128 mm = _mm_set_ss(f);
-		mm = _mm_sqrt_ss(mm);
-		float o;
-		_mm_store_ss(&o, mm);
-		return o;
-	#else
-		return ::sqrtf(f);
-	#endif
-}
-
-
-inline float toRad(float degrees)
-{
-	return degrees * (PI / 180.0);
-}
-
-
-inline float toDegrees(float rad)
-{
-	return rad * (180.0 / PI);
-}
-
-
-inline float sin(float rad)
-{
-	return ::sin(rad);
-}
-
-
-inline float cos(float rad)
-{
-	return ::cos(rad);
-}
-
-
-inline bool isZero(float f)
-{
-	return fabs(f) < EPSILON;
-}
-
-
-//  combineTransformations
-//  mat4(t0,r0,s0)*mat4(t1,r1,s1) == mat4(tf,rf,sf)
-inline void combineTransformations(const Vec3& t0, const Mat3& r0, float s0,
-                                   const Vec3& t1, const Mat3& r1, float s1,
-                                   Vec3& tf, Mat3& rf, float& sf)
-{
-	tf = t1.getTransformed(t0, r0, s0);
-	rf = r0 * r1;
-	sf = s0 * s1;
-}
-
-
-//  combineTransformations as the above but without scale
-inline void combineTransformations(const Vec3& t0, const Mat3& r0, const Vec3& t1, const Mat3& r1, Vec3& tf, Mat3& rf)
-{
-	tf = t1.getTransformed(t0, r0);
-	rf = r0 * r1;
-}
-
-
-} // end namespace

+ 1 - 1
src/Math/Quat.h

@@ -1,7 +1,7 @@
 #ifndef QUAT_H
 #define QUAT_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 13 - 13
src/Math/Quat.inl.h

@@ -1,4 +1,4 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 #define ME (*this)
@@ -6,9 +6,9 @@
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // Default
 inline Quat::Quat()
@@ -152,9 +152,9 @@ inline Quat::Quat(const Axisang& axisang)
 }
 
 
-//======================================================================================================================
-// Accessors                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                   =
+//==============================================================================
 
 inline float Quat::x() const
 {
@@ -198,9 +198,9 @@ inline float& Quat::w()
 }
 
 
-//======================================================================================================================
-// Operators with same                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// Operators with same                                                         =
+//==============================================================================
 
 // =
 inline Quat& Quat::operator=(const Quat& b)
@@ -243,9 +243,9 @@ inline bool Quat::operator !=(const Quat& b) const
 }
 
 
-//======================================================================================================================
-// Other                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// Other                                                                       =
+//==============================================================================
 
 // conjugate
 inline void Quat::conjugate()

+ 1 - 1
src/Math/Transform.h

@@ -1,7 +1,7 @@
 #ifndef TRANSFORM_H
 #define TRANSFORM_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 13 - 13
src/Math/Transform.inl.h

@@ -1,4 +1,4 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 #define ME (*this)
@@ -7,9 +7,9 @@
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // Default
 inline Transform::Transform()
@@ -38,9 +38,9 @@ inline Transform::Transform(const Vec3& origin, const Mat3& rotation_, float sca
 {}
 
 
-//======================================================================================================================
-// Accessors                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                   =
+//==============================================================================
 
 inline const Vec3& Transform::getOrigin() const
 {
@@ -88,9 +88,9 @@ inline void Transform::setScale(float s)
 }
 
 
-//======================================================================================================================
-// Operators with same                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// Operators with same                                                         =
+//==============================================================================
 
 // =
 inline Transform& Transform::operator=(const Transform& b)
@@ -102,9 +102,9 @@ inline Transform& Transform::operator=(const Transform& b)
 }
 
 
-//======================================================================================================================
-// Other                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// Other                                                                       =
+//==============================================================================
 
 // setIdentity
 inline void Transform::setIdentity()

+ 1 - 1
src/Math/Vec2.h

@@ -1,7 +1,7 @@
 #ifndef VEC2_H
 #define VEC2_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 19 - 19
src/Math/Vec2.inl.h

@@ -1,4 +1,4 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 #define ME (*this)
@@ -7,9 +7,9 @@
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // default
 inline Vec2::Vec2()
@@ -59,9 +59,9 @@ inline Vec2::Vec2(const Vec4& v4)
 }
 
 
-//======================================================================================================================
-// Accessors                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                   =
+//==============================================================================
 
 inline float& Vec2::x()
 {
@@ -94,9 +94,9 @@ inline float Vec2::operator[](uint i) const
 }
 
 
-//======================================================================================================================
-// Operators with same                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// Operators with same                                                         =
+//==============================================================================
 
 // =
 inline Vec2& Vec2::operator=(const Vec2& b)
@@ -181,9 +181,9 @@ inline bool Vec2::operator!=(const Vec2& b) const
 }
 
 
-//======================================================================================================================
-// Operators with float                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// Operators with float                                                        =
+//==============================================================================
 
 // vec2 + float
 inline Vec2 Vec2::operator+(float f) const
@@ -261,9 +261,9 @@ inline Vec2& Vec2::operator/=(float f)
 	return ME;
 }
 
-//======================================================================================================================
-// Misc methods                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Misc methods                                                                =
+//==============================================================================
 
 // getLength
 inline float Vec2::getLength() const
@@ -290,9 +290,9 @@ inline float Vec2::dot(const Vec2& b) const
 }
 
 
-//======================================================================================================================
-// Print                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// Print                                                                       =
+//==============================================================================
 inline std::ostream& operator<<(std::ostream& s, const Vec2& v)
 {
 	s << v.x() << ' ' << v.y();

+ 1 - 1
src/Math/Vec3.h

@@ -1,7 +1,7 @@
 #ifndef VEC3_H
 #define VEC3_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 22 - 22
src/Math/Vec3.inl.h

@@ -1,4 +1,4 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 #define SELF (*this)
@@ -7,9 +7,9 @@
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // Default
 inline Vec3::Vec3()
@@ -71,9 +71,9 @@ inline Vec3::Vec3(const Quat& q)
 	z() = q.z();
 }
 
-//======================================================================================================================
-// Accessors                                                                                                                    =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                            =
+//==============================================================================
 
 inline float& Vec3::x()
 {
@@ -116,9 +116,9 @@ inline float Vec3::operator[](uint i) const
 }
 
 
-//======================================================================================================================
-// Operators with same type                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// Operators with same type                                                    =
+//==============================================================================
 
 // =
 inline Vec3& Vec3::operator=(const Vec3& b)
@@ -208,9 +208,9 @@ inline bool Vec3::operator!=(const Vec3& b) const
 }
 
 
-//======================================================================================================================
-// Operators with float                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// Operators with float                                                        =
+//==============================================================================
 
 // Vec3 + float
 inline Vec3 Vec3::operator+(float f) const
@@ -289,9 +289,9 @@ inline Vec3& Vec3::operator/=(float f)
 }
 
 
-//======================================================================================================================
-// Misc methods                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Misc methods                                                                =
+//==============================================================================
 
 // dot
 inline float Vec3::dot(const Vec3& b) const
@@ -370,9 +370,9 @@ inline Vec3 Vec3::lerp(const Vec3& v1, float t) const
 }
 
 
-//======================================================================================================================
-// Transformations                                                                                                     =
-//======================================================================================================================
+//==============================================================================
+// Transformations                                                             =
+//==============================================================================
 
 // Mat3
 inline Vec3 Vec3::getTransformed(const Vec3& translate, const Mat3& rotate, float scale) const
@@ -448,9 +448,9 @@ inline void Vec3::transform(const Transform& transform)
 	SELF = getTransformed(transform);
 }
 
-//======================================================================================================================
-// Print                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// Print                                                                       =
+//==============================================================================
 inline std::ostream& operator<<(std::ostream& s, const Vec3& v)
 {
 	s << v.x() << ' ' << v.y() << ' ' << v.z();

+ 1 - 1
src/Math/Vec4.h

@@ -1,7 +1,7 @@
 #ifndef VEC4_H
 #define VEC4_H
 
-#include "MathCommon.h"
+#include "Common.h"
 
 
 namespace M {

+ 22 - 22
src/Math/Vec4.inl.h

@@ -1,4 +1,4 @@
-#include "MathCommon.inl.h"
+#include "Common.inl.h"
 
 
 #define SELF (*this)
@@ -7,9 +7,9 @@
 namespace M {
 
 
-//======================================================================================================================
-// Constructors                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Constructors                                                                =
+//==============================================================================
 
 // default
 inline Vec4::Vec4()
@@ -106,9 +106,9 @@ inline Vec4::Vec4(const Quat& q)
 #endif
 
 
-//======================================================================================================================
-// Accessors                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// Accessors                                                                   =
+//==============================================================================
 
 inline float& Vec4::operator[](uint i)
 {
@@ -173,9 +173,9 @@ inline float Vec4::w() const
 #endif
 
 
-//======================================================================================================================
-// Operators with same                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// Operators with same                                                         =
+//==============================================================================
 
 // =
 inline Vec4& Vec4::operator=(const Vec4& b)
@@ -308,9 +308,9 @@ inline bool Vec4::operator!=(const Vec4& b) const
 }
 
 
-//======================================================================================================================
-// Operators with float                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// Operators with float                                                        =
+//==============================================================================
 
 // Vec4 + float
 inline Vec4 Vec4::operator+(float f) const
@@ -389,9 +389,9 @@ inline Vec4& Vec4::operator/=(float f)
 }
 
 
-//======================================================================================================================
-// Operators with other                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// Operators with other                                                        =
+//==============================================================================
 
 // Vec4 * mat4
 inline Vec4 Vec4::operator*(const Mat4& m4) const
@@ -405,9 +405,9 @@ inline Vec4 Vec4::operator*(const Mat4& m4) const
 }
 
 
-//======================================================================================================================
-// Misc methods                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// Misc methods                                                                =
+//==============================================================================
 
 // dot
 inline float Vec4::dot(const Vec4& b) const
@@ -440,9 +440,9 @@ inline void Vec4::normalize()
 }
 
 
-//======================================================================================================================
-// Print                                                                                                               =
-//======================================================================================================================
+//==============================================================================
+// Print                                                                       =
+//==============================================================================
 inline std::ostream& operator<<(std::ostream& s, const Vec4& v)
 {
 	s << v.x() << ' ' << v.y() << ' ' << v.z() << ' ' << v.w();

+ 1 - 1
src/Misc/Parser.h

@@ -2,7 +2,7 @@
 #define PARSER_H
 
 #include <boost/lexical_cast.hpp>
-#include "Exception.h"
+#include "Util/Exception.h"
 #include "Scanner.h"
 
 

+ 22 - 22
src/Misc/Parser.inl.h

@@ -1,14 +1,14 @@
 #include <cstring>
 #include "Parser.h"
-#include "Exception.h"
+#include "Util/Exception.h"
 
 
 namespace Parser {
 
 
-//======================================================================================================================
-// parseArrOfNumbers                                                                                                   =
-//======================================================================================================================
+//==============================================================================
+// parseArrOfNumbers                                                           =
+//==============================================================================
 template <typename Type>
 void parseArrOfNumbers(Scanner::Scanner& scanner, bool bracket, bool signs, uint size, Type* arr)
 {
@@ -79,9 +79,9 @@ void parseArrOfNumbers(Scanner::Scanner& scanner, bool bracket, bool signs, uint
 }
 
 
-//======================================================================================================================
-// parseNumber                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// parseNumber                                                                 =
+//==============================================================================
 template <typename Type>
 void parseNumber(Scanner::Scanner& scanner, bool sign, Type& out)
 {
@@ -133,9 +133,9 @@ void parseNumber(Scanner::Scanner& scanner, bool sign, Type& out)
 }
 
 
-//======================================================================================================================
-// parseMathVector                                                                                                     =
-//======================================================================================================================
+//==============================================================================
+// parseMathVector                                                             =
+//==============================================================================
 template <typename Type>
 void parseMathVector(Scanner::Scanner& scanner, Type& out)
 {
@@ -172,9 +172,9 @@ void parseMathVector(Scanner::Scanner& scanner, Type& out)
 }
 
 
-//======================================================================================================================
-// parseBool                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// parseBool                                                                   =
+//==============================================================================
 inline bool parseBool(Scanner::Scanner& scanner)
 {
 	const char* errMsg = "identifier true or false";
@@ -200,9 +200,9 @@ inline bool parseBool(Scanner::Scanner& scanner)
 }
 
 
-//======================================================================================================================
-// parseIdentifier                                                                                                     =
-//======================================================================================================================
+//==============================================================================
+// parseIdentifier                                                             =
+//==============================================================================
 inline std::string parseIdentifier(Scanner::Scanner& scanner, const char* expectedIdentifier)
 {
 	const Scanner::Token* token = &scanner.getNextToken();
@@ -227,18 +227,18 @@ inline std::string parseIdentifier(Scanner::Scanner& scanner, const char* expect
 }
 
 
-//======================================================================================================================
-// isIdentifier                                                                                                        =
-//======================================================================================================================
+//==============================================================================
+// isIdentifier                                                                =
+//==============================================================================
 inline bool isIdentifier(const Scanner::Token* token, const char* str)
 {
 	return token->getCode() == Scanner::TC_IDENTIFIER && !strcmp(token->getValue().getString(), str);
 }
 
 
-//======================================================================================================================
-// parseString                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// parseString                                                                 =
+//==============================================================================
 inline std::string parseString(Scanner::Scanner& scanner)
 {
 	const Scanner::Token* token = &scanner.getNextToken();

+ 19 - 19
src/Misc/PropertyTree.cpp

@@ -1,13 +1,13 @@
 #include <boost/property_tree/ptree.hpp>
 #include "PropertyTree.h"
-#include "Exception.h"
+#include "Util/Exception.h"
 
 
 namespace PropertyTree {
 
-//======================================================================================================================
-// getBool                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// getBool                                                                     =
+//==============================================================================
 bool getBool(const boost::property_tree::ptree& pt, const char* tag)
 {
 	std::string str = pt.get<std::string>(tag);
@@ -26,9 +26,9 @@ bool getBool(const boost::property_tree::ptree& pt, const char* tag)
 }
 
 
-//======================================================================================================================
-// getBoolOptional                                                                                                     =
-//======================================================================================================================
+//==============================================================================
+// getBoolOptional                                                             =
+//==============================================================================
 extern boost::optional<bool> getBoolOptional(const boost::property_tree::ptree& pt, const char* tag)
 {
 	boost::optional<std::string> str = pt.get_optional<std::string>(tag);
@@ -51,18 +51,18 @@ extern boost::optional<bool> getBoolOptional(const boost::property_tree::ptree&
 }
 
 
-//======================================================================================================================
-// getFloat                                                                                                            =
-//======================================================================================================================
+//==============================================================================
+// getFloat                                                                    =
+//==============================================================================
 float getFloat(const boost::property_tree::ptree& pt)
 {
 	return pt.get<float>("float");
 }
 
 
-//======================================================================================================================
-// getVec2                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// getVec2                                                                     =
+//==============================================================================
 Vec2 getVec2(const boost::property_tree::ptree& pt)
 {
 	const boost::property_tree::ptree& tree = pt.get_child("vec2");
@@ -70,9 +70,9 @@ Vec2 getVec2(const boost::property_tree::ptree& pt)
 }
 
 
-//======================================================================================================================
-// getVec3                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// getVec3                                                                     =
+//==============================================================================
 Vec3 getVec3(const boost::property_tree::ptree& pt)
 {
 	const boost::property_tree::ptree& tree = pt.get_child("vec3");
@@ -80,9 +80,9 @@ Vec3 getVec3(const boost::property_tree::ptree& pt)
 }
 
 
-//======================================================================================================================
-// getVec4                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// getVec4                                                                     =
+//==============================================================================
 Vec4 getVec4(const boost::property_tree::ptree& pt)
 {
 	const boost::property_tree::ptree& tree = pt.get_child("vec4");

+ 1 - 1
src/Misc/PropertyTree.h

@@ -3,7 +3,7 @@
 
 #include <boost/optional.hpp>
 #include <boost/property_tree/ptree_fwd.hpp>
-#include "Math.h"
+#include "Math/Math.h"
 
 
 namespace PropertyTree {

+ 1 - 1
src/Misc/TestHeader.cpp

@@ -1,4 +1,4 @@
-#include "Math.h"
+#include "Math/Math.h"
 
 
 

+ 11 - 11
src/Misc/map.cpp

@@ -10,7 +10,7 @@
 
 
 =======================================================================================================================================
-CreateRoot                                                                                                             =
+CreateRoot                                                                     =
 =======================================================================================================================================
 
 void octree_t::CreateRoot(const Vec<Mesh*>& meshes)
@@ -73,7 +73,7 @@ void octree_t::CreateRoot(const Vec<Mesh*>& meshes)
 
 
 =======================================================================================================================================
-GetFacesNum                                                                                                            =
+GetFacesNum                                                                    =
 =======================================================================================================================================
 
 uint octree_t::node_t::GetFacesNum() const
@@ -89,9 +89,9 @@ uint octree_t::node_t::GetFacesNum() const
 
 
 =======================================================================================================================================
-IsSubdivHeuristicMet                                                                                                   =
+IsSubdivHeuristicMet                                                           =
 returns true when the used difined heuristic is met that sais that we can subdivide the node. Long story short it returns true when   =
-we can subdivide the node further                                                                                      =
+we can subdivide the node further                                              =
 =======================================================================================================================================
 
 bool octree_t::IsSubdivHeuristicMet(node_t* node) const
@@ -105,8 +105,8 @@ bool octree_t::IsSubdivHeuristicMet(node_t* node) const
 
 
 =======================================================================================================================================
-SubdivideNode                                                                                                          =
-subdivides the node and creates max 8 children and then subdivides the children                                        =
+SubdivideNode                                                                  =
+subdivides the node and creates max 8 children and then subdivides the children=
 =======================================================================================================================================
 
 void octree_t::SubdivideNode(node_t* node)
@@ -125,7 +125,7 @@ void octree_t::SubdivideNode(node_t* node)
 
 
 =======================================================================================================================================
-CreateTree                                                                                                             =
+CreateTree                                                                     =
 =======================================================================================================================================
 
 void octree_t::CreateTree(const Vec<Mesh*>& meshes)
@@ -137,9 +137,9 @@ void octree_t::CreateTree(const Vec<Mesh*>& meshes)
 
 
 =======================================================================================================================================
-CheckNodeAgainstFrustum                                                                                                =
+CheckNodeAgainstFrustum                                                        =
 the func checks the node and returns if its inside the cameras fruntum. It returns 0 if the cube is not inside, 1 if partialy         =
-inside and 2 if totaly inside                                                                                          =
+inside and 2 if totaly inside                                                  =
 =======================================================================================================================================
 
 uint octree_t::CheckNodeAgainstFrustum(node_t* node, const Camera& cam) const
@@ -172,14 +172,14 @@ uint octree_t::CheckNodeAgainstFrustum(node_t* node, const Camera& cam) const
 
 
 =======================================================================================================================================
-map                                                                                                                    =
+map                                                                            =
 =======================================================================================================================================
 
 
 
 
 =======================================================================================================================================
-load                                                                                                                   =
+load                                                                           =
 =======================================================================================================================================
 
 bool map_t::load(const char* filename)

+ 4 - 4
src/Misc/map.h

@@ -3,8 +3,8 @@
 #define _MAP_H_
 
 #include "collision.h"
-#include "Vec.h"
-#include "RsrcPtr.h"
+#include "Util/Vec.h"
+#include "Resources/RsrcPtr.h"
 
 class Mesh;
 class Camera;
@@ -12,7 +12,7 @@ class Camera;
 
 
 =======================================================================================================================================
-octree_t                                                                                                               =
+octree_t                                                                       =
 =======================================================================================================================================
 
 class octree_t
@@ -56,7 +56,7 @@ class octree_t
 
 
 =======================================================================================================================================
-map_t                                                                                                                  =
+map_t                                                                          =
 =======================================================================================================================================
 
 class map_t

+ 3 - 3
src/Misc/skybox.cpp

@@ -1,6 +1,6 @@
 #include "skybox.h"
 #include "Renderer.h"
-#include "Math.h"
+#include "Math/Math.h"
 #include "Camera.h"
 #include "Scene.h"
 #include "App.h"
@@ -27,7 +27,7 @@
 
 /*
 =======================================================================================================================================
-load                                                                                                                   =
+load                                                                           =
 =======================================================================================================================================
 */
 bool Skybox::load(const char* filenames[6])
@@ -48,7 +48,7 @@ bool Skybox::load(const char* filenames[6])
 
 /*
 =======================================================================================================================================
-render                                                                                                                 =
+render                                                                         =
 =======================================================================================================================================
 */
 void Skybox::Render(const Mat3& /*rotation*/)

+ 4 - 4
src/Misc/skybox.h

@@ -1,10 +1,10 @@
 #ifndef _SKYBOX_H_
 #define _SKYBOX_H_
 
-#include "Texture.h"
-#include "Math.h"
-#include "RsrcPtr.h"
-#include "ShaderProg.h"
+#include "Resources/Texture.h"
+#include "Math/Math.h"
+#include "Resources/RsrcPtr.h"
+#include "Resources/ShaderProg.h"
 
 class Skybox
 {

+ 18 - 18
src/Physics/PhysCharacter.cpp

@@ -12,9 +12,9 @@
 namespace Phys {
 
 
-//======================================================================================================================
-// Contructor                                                                                                          =
-//======================================================================================================================
+//==============================================================================
+// Contructor                                                                  =
+//==============================================================================
 inline Character::Initializer::Initializer():
 	characterHeight(2.0),
 	characterWidth(0.75),
@@ -26,9 +26,9 @@ inline Character::Initializer::Initializer():
 {}
 
 
-//======================================================================================================================
-// Contructor                                                                                                          =
-//======================================================================================================================
+//==============================================================================
+// Contructor                                                                  =
+//==============================================================================
 Character::Character(MasterContainer& masterContainer_, const Initializer& init):
 	masterContainer(masterContainer_)
 {
@@ -63,9 +63,9 @@ Character::Character(MasterContainer& masterContainer_, const Initializer& init)
 }
 
 
-//======================================================================================================================
-// Destructor                                                                                                          =
-//======================================================================================================================
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
 Character::~Character()
 {
 	masterContainer.characters.erase(std::find(masterContainer.characters.begin(),
@@ -80,9 +80,9 @@ Character::~Character()
 }
 
 
-//======================================================================================================================
-// rotate                                                                                                              =
-//======================================================================================================================
+//==============================================================================
+// rotate                                                                      =
+//==============================================================================
 void Character::rotate(float angle)
 {
 	btMatrix3x3 rot = ghostObject->getWorldTransform().getBasis();
@@ -91,9 +91,9 @@ void Character::rotate(float angle)
 }
 
 
-//======================================================================================================================
-// moveForward                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// moveForward                                                                 =
+//==============================================================================
 void Character::moveForward(float distance)
 {
 	btVector3 forward = -ghostObject->getWorldTransform().getBasis().getColumn(2);
@@ -101,9 +101,9 @@ void Character::moveForward(float distance)
 }
 
 
-//======================================================================================================================
-// jump                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// jump                                                                        =
+//==============================================================================
 void Character::jump()
 {
 	character->jump();

+ 2 - 2
src/Physics/PhysCharacter.h

@@ -2,8 +2,8 @@
 #define PHYS_CHARACTER_H
 
 #include "PhysMasterContainer.h"
-#include "Math.h"
-#include "Object.h"
+#include "Math/Math.h"
+#include "Core/Object.h"
 
 
 class btPairCachingGhostObject;

+ 1 - 1
src/Physics/PhysConvertors.h

@@ -3,7 +3,7 @@
 
 #include <btBulletCollisionCommon.h>
 #include <btBulletDynamicsCommon.h>
-#include "Math.h"
+#include "Math/Math.h"
 
 
 inline Vec3 toAnki(const btVector3& v)

+ 25 - 9
src/Physics/PhysMasterContainer.cpp

@@ -7,9 +7,9 @@
 namespace Phys {
 
 
-//======================================================================================================================
-// Constructor                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// Constructor                                                                 =
+//==============================================================================
 MasterContainer::MasterContainer():
 	defaultContactProcessingThreshold(BT_LARGE_FLOAT)
 {
@@ -19,16 +19,32 @@ MasterContainer::MasterContainer():
 	sol = new btSequentialImpulseConstraintSolver;
 	dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, sol, collisionConfiguration);
 	dynamicsWorld->setGravity(btVector3(0,-10, 0));
+}
+
 
-	/*debugDrawer = new PhyDbgDrawer;
-	dynamicsWorld->setDebugDrawer(debugDrawer);
-	dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe);*/
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+MasterContainer::~MasterContainer()
+{
+	/// @todo
+}
+
+
+//==============================================================================
+// setDebugDrawer                                                              =
+//==============================================================================
+void MasterContainer::setDebugDrawer(btIDebugDraw* newDebugDrawer)
+{
+	debugDrawer.reset(newDebugDrawer);
+	dynamicsWorld->setDebugDrawer(debugDrawer.get());
+	debugDrawer->setDebugMode(btIDebugDraw::DBG_DrawWireframe);
 }
 
 
-//======================================================================================================================
-// update                                                                                                              =
-//======================================================================================================================
+//==============================================================================
+// update                                                                      =
+//==============================================================================
 void MasterContainer::update(float prevUpdateTime, float crntTime)
 {
 	dynamicsWorld->stepSimulation(crntTime - prevUpdateTime);

+ 7 - 4
src/Physics/PhysMasterContainer.h

@@ -1,13 +1,14 @@
 #ifndef PHYS_MASTER_CONTAINER_H
 #define PHYS_MASTER_CONTAINER_H
 
+#include "PhysConvertors.h"
+#include "Util/Vec.h"
+#include <boost/scoped_ptr.hpp>
 #include <btBulletCollisionCommon.h>
 #include <btBulletDynamicsCommon.h>
-#include "PhysConvertors.h"
-#include "PhyDbgDrawer.h" ///< @todo Remove this crap from here. Its Renderer's stuff
-#include "Vec.h"
 
 
+class btIDebugDraw;
 namespace Phys {
 class Character;
 class RigidBody;
@@ -35,10 +36,12 @@ class MasterContainer
 
 	public:
 		MasterContainer();
+		~MasterContainer();
 
 		/// @name Accessors
 		/// @{
 		btDiscreteDynamicsWorld& getWorld() {return *dynamicsWorld;}
+		void setDebugDrawer(btIDebugDraw* newDebugDrawer);
 		/// @}
 
 		/// Time as always in sec
@@ -50,7 +53,7 @@ class MasterContainer
 		btCollisionDispatcher* dispatcher; ///< Contains the algorithms of collision
 		btBroadphaseInterface* broadphase;
 		btSequentialImpulseConstraintSolver* sol;
-		PhyDbgDrawer* debugDrawer; ///< @todo Remove this crap from here. Its Renderer's stuff
+		boost::scoped_ptr<btIDebugDraw> debugDrawer; ///< Keep here for garbage collection
 		float defaultContactProcessingThreshold;
 		Vec<Character*> characters;
 };

+ 9 - 9
src/Physics/PhysRigidBody.cpp

@@ -7,9 +7,9 @@
 namespace Phys {
 
 
-//======================================================================================================================
-// Constructor                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// Constructor                                                                 =
+//==============================================================================
 RigidBody::Initializer::Initializer():
 	mass(0.0),
 	startTrf(Transform::getIdentity()),
@@ -20,9 +20,9 @@ RigidBody::Initializer::Initializer():
 {}
 
 
-//======================================================================================================================
-// Constructor                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// Constructor                                                                 =
+//==============================================================================
 RigidBody::RigidBody(MasterContainer& masterContainer_, const Initializer& init):
   btRigidBody(btRigidBody::btRigidBodyConstructionInfo(0.0, NULL, NULL, btVector3(0.0, 0.0, 0.0))), // dummy init
   masterContainer(masterContainer_)
@@ -63,9 +63,9 @@ RigidBody::RigidBody(MasterContainer& masterContainer_, const Initializer& init)
 }
 
 
-//======================================================================================================================
-// Destructor                                                                                                          =
-//======================================================================================================================
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
 RigidBody::~RigidBody()
 {
 	masterContainer.dynamicsWorld->removeRigidBody(this);

+ 1 - 1
src/Physics/PhysRigidBody.h

@@ -4,7 +4,7 @@
 #include <boost/scoped_ptr.hpp>
 #include <btBulletDynamicsCommon.h>
 #include <btBulletCollisionCommon.h>
-#include "Math.h"
+#include "Math/Math.h"
 
 
 class SceneNode;

+ 16 - 16
src/Renderer/Bl.cpp

@@ -1,20 +1,20 @@
 #include "Bl.h"
 #include "RendererInitializer.h"
 #include "Renderer.h"
-#include "ShaderProg.h"
+#include "Resources/ShaderProg.h"
 
 
-//======================================================================================================================
-// Constructor                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// Constructor                                                                 =
+//==============================================================================
 Bl::Bl(Renderer& r_):
 	RenderingPass(r_)
 {}
 
 
-//======================================================================================================================
-// init                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// init                                                                        =
+//==============================================================================
 void Bl::init(const RendererInitializer& initializer)
 {
 	enabled = initializer.pps.bl.enabled;
@@ -78,9 +78,9 @@ void Bl::init(const RendererInitializer& initializer)
 }
 
 
-//======================================================================================================================
-// runSideBlur                                                                                                         =
-//======================================================================================================================
+//==============================================================================
+// runSideBlur                                                                 =
+//==============================================================================
 void Bl::runSideBlur()
 {
 	if(sideBlurFactor == 0.0)
@@ -101,9 +101,9 @@ void Bl::runSideBlur()
 }
 
 
-//======================================================================================================================
-// runBlur                                                                                                             =
-//======================================================================================================================
+//==============================================================================
+// runBlur                                                                     =
+//==============================================================================
 void Bl::runBlur()
 {
 	GlStateMachineSingleton::getInstance().disable(GL_BLEND);
@@ -135,9 +135,9 @@ void Bl::runBlur()
 }
 
 
-//======================================================================================================================
-// run                                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// run                                                                         =
+//==============================================================================
 void Bl::run()
 {
 	if(!enabled)

+ 4 - 4
src/Renderer/Bl.h

@@ -2,10 +2,10 @@
 #define BL_H
 
 #include "RenderingPass.h"
-#include "Accessors.h"
-#include "Texture.h"
-#include "RsrcPtr.h"
-#include "Fbo.h"
+#include "Util/Accessors.h"
+#include "Resources/Texture.h"
+#include "Resources/RsrcPtr.h"
+#include "GfxApi/BufferObjects/Fbo.h"
 
 
 class ShaderProg;

+ 13 - 13
src/Renderer/Bs.cpp

@@ -3,16 +3,16 @@
 #include "Renderer.h"
 #include "App.h"
 #include "Scene.h"
-#include "ShaderProg.h"
+#include "Resources/ShaderProg.h"
 #include "Model.h"
 #include "ModelNode.h"
 #include "Material.h"
 #include "Mesh.h"
 
 
-//======================================================================================================================
-// createFbo                                                                                                           =
-//======================================================================================================================
+//==============================================================================
+// createFbo                                                                   =
+//==============================================================================
 void Bs::createFbo()
 {
 	try
@@ -38,9 +38,9 @@ void Bs::createFbo()
 }
 
 
-//======================================================================================================================
-// createRefractFbo                                                                                                    =
-//======================================================================================================================
+//==============================================================================
+// createRefractFbo                                                            =
+//==============================================================================
 void Bs::createRefractFbo()
 {
 	try
@@ -65,9 +65,9 @@ void Bs::createRefractFbo()
 }
 
 
-//======================================================================================================================
-// init                                                                                                                =
-//======================================================================================================================
+//==============================================================================
+// init                                                                        =
+//==============================================================================
 void Bs::init(const RendererInitializer& /*initializer*/)
 {
 	createFbo();
@@ -77,9 +77,9 @@ void Bs::init(const RendererInitializer& /*initializer*/)
 }
 
 
-//======================================================================================================================
-// run                                                                                                                 =
-//======================================================================================================================
+//==============================================================================
+// run                                                                         =
+//==============================================================================
 void Bs::run()
 {
 	/*Renderer::setViewport(0, 0, r.getWidth(), r.getHeight());

+ 3 - 3
src/Renderer/Bs.h

@@ -2,9 +2,9 @@
 #define BS_H
 
 #include "RenderingPass.h"
-#include "Fbo.h"
-#include "RsrcPtr.h"
-#include "Texture.h"
+#include "GfxApi/BufferObjects/Fbo.h"
+#include "Resources/RsrcPtr.h"
+#include "Resources/Texture.h"
 
 
 class ShaderProg;

Some files were not shown because too many files changed in this diff