Panagiotis Christopoulos Charitos 14 年 前
コミット
d0c1e6c65c
80 ファイル変更1292 行追加987 行削除
  1. 15 0
      CMakeLists.txt
  2. 0 1
      build/release/Makefile
  3. 14 1
      src/GfxApi/BufferObjects/BufferObject.cpp
  4. 0 9
      src/GfxApi/BufferObjects/BufferObject.h
  5. 12 0
      src/GfxApi/BufferObjects/Fbo.cpp
  6. 0 9
      src/GfxApi/BufferObjects/Fbo.h
  7. 12 0
      src/GfxApi/BufferObjects/Vao.cpp
  8. 0 9
      src/GfxApi/BufferObjects/Vao.h
  9. 1 1
      src/Math/Axisang.inl.h
  10. 1 1
      src/Math/Euler.inl.h
  11. 268 245
      src/Math/Mat3.inl.h
  12. 11 7
      src/Math/Mat4.h
  13. 262 231
      src/Math/Mat4.inl.h
  14. 7 4
      src/Math/Quat.h
  15. 22 21
      src/Math/Quat.inl.h
  16. 6 4
      src/Math/Transform.h
  17. 12 7
      src/Math/Transform.inl.h
  18. 2 2
      src/Math/Vec2.h
  19. 19 22
      src/Math/Vec2.inl.h
  20. 12 8
      src/Math/Vec3.h
  21. 57 48
      src/Math/Vec3.inl.h
  22. 2 2
      src/Math/Vec4.h
  23. 26 27
      src/Math/Vec4.inl.h
  24. 7 0
      src/Renderer/Bs.cpp
  25. 2 0
      src/Renderer/Bs.h
  26. 7 0
      src/Renderer/Ms.cpp
  27. 1 0
      src/Renderer/Ms.h
  28. 7 0
      src/Renderer/Pps.cpp
  29. 1 0
      src/Renderer/Pps.h
  30. 14 0
      src/Renderer/Smo.cpp
  31. 4 0
      src/Renderer/Smo.h
  32. 9 4
      src/Scene/Camera.cpp
  33. 7 0
      src/Scene/Light.cpp
  34. 1 1
      src/Scene/Light.h
  35. 12 6
      src/Scene/MaterialRuntime.cpp
  36. 46 15
      src/Scene/MaterialRuntime.h
  37. 5 3
      src/Scene/MaterialRuntimeUserDefinedVar.cpp
  38. 17 6
      src/Scene/MaterialRuntimeUserDefinedVar.h
  39. 2 1
      src/Scene/ModelNode.cpp
  40. 7 2
      src/Scene/ModelNode.h
  41. 3 1
      src/Scene/ModelPatchNode.cpp
  42. 1 1
      src/Scene/ModelPatchNode.h
  43. 6 3
      src/Scene/OrthographicCamera.cpp
  44. 7 4
      src/Scene/OrthographicCamera.h
  45. 24 12
      src/Scene/ParticleEmitter.cpp
  46. 4 3
      src/Scene/ParticleEmitter.h
  47. 14 9
      src/Scene/PatchNode.cpp
  48. 10 5
      src/Scene/PatchNode.h
  49. 2 1
      src/Scene/PerspectiveCamera.cpp
  50. 7 4
      src/Scene/PerspectiveCamera.h
  51. 8 5
      src/Scene/RenderableNode.h
  52. 4 2
      src/Scene/Scene.cpp
  53. 29 7
      src/Scene/Scene.h
  54. 11 37
      src/Scene/SceneNode.cpp
  55. 37 11
      src/Scene/SceneNode.h
  56. 38 23
      src/Scene/SkelAnimModelNodeCtrl.cpp
  57. 7 4
      src/Scene/SkelAnimModelNodeCtrl.h
  58. 2 1
      src/Scene/SkinNode.cpp
  59. 2 2
      src/Scene/SkinNode.h
  60. 57 21
      src/Scene/SkinPatchNode.cpp
  61. 2 1
      src/Scene/SkinPatchNode.h
  62. 2 1
      src/Scene/SpotLight.cpp
  63. 4 2
      src/Scene/VisibilityInfo.h
  64. 28 85
      src/Scene/VisibilityTester.cpp
  65. 1 0
      src/Scene/VisibilityTester.h
  66. 2 1
      src/Scripting/Events/Manager.bpi.cpp
  67. 4 2
      src/Scripting/Renderer/Bl.bpi.cpp
  68. 2 1
      src/Scripting/Renderer/Hdr.bpi.cpp
  69. 1 1
      src/Scripting/Renderer/MainRenderer.bpi.cpp
  70. 5 2
      src/Scripting/Renderer/Pps.bpi.cpp
  71. 2 3
      src/Scripting/Renderer/Renderer.bpi.cpp
  72. 14 12
      src/Scripting/Scene/MaterialRuntime.bpi.cpp
  73. 3 2
      src/Scripting/Scene/ModelNode.bpi.cpp
  74. 2 1
      src/Scripting/Scene/ModelPatchNode.bpi.cpp
  75. 6 4
      src/Scripting/Scene/PatchNode.bpi.cpp
  76. 10 6
      src/Scripting/Scene/Scene.bpi.cpp
  77. 2 1
      src/Scripting/Scene/SceneNode.bpi.cpp
  78. 10 5
      src/Scripting/ScriptingCommon.h
  79. 8 4
      src/Scripting/ScriptingEngine.cpp
  80. 1 0
      src/Ui/Painter.h

+ 15 - 0
CMakeLists.txt

@@ -12,6 +12,21 @@ IF(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
 ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
 	ADD_DEFINITIONS("-DPLATFORM_WINDOWS")
 ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
+
+
+FIND_PACKAGE(Subversion)
+IF(Subversion_FOUND)
+	Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} ER)
+	ADD_DEFINITIONS("-DREVISION=${ER_WC_REVISION}")
+ELSE(Subversion_FOUND)
+	ADD_DEFINITIONS("-DREVISION=???")
+ENDIF(Subversion_FOUND)
+
+ADD_DEFINITIONS("-DMATH_INTEL_SIMD -pedantic-errors -pedantic -ansi -Wall -Winline -W -Wwrite-strings -Wno-unused -Wno-long-long -fsingle-precision-constant -msse4")
+
+IF(CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+	ADD_DEFINITIONS("-DBOOST_DISABLE_ASSERTS -mtune=core2 -ffast-math")
+ENDIF(CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
 	
 
 ADD_SUBDIRECTORY(src)

ファイルの差分が大きいため隠しています
+ 0 - 1
build/release/Makefile


+ 14 - 1
src/GfxApi/BufferObjects/BufferObject.cpp

@@ -3,10 +3,23 @@
 #include "GfxApi/GlException.h"
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+BufferObject::~BufferObject()
+{
+	if(isCreated())
+	{
+		deleteBuff();
+	}
+}
+
+
 //==============================================================================
 // create                                                                      =
 //==============================================================================
-void BufferObject::create(GLenum target_, uint sizeInBytes_, const void* dataPtr, GLenum usage_)
+void BufferObject::create(GLenum target_, uint sizeInBytes_,
+	const void* dataPtr, GLenum usage_)
 {
 	ASSERT(!isCreated());
 	// unacceptable usage_

+ 0 - 9
src/GfxApi/BufferObjects/BufferObject.h

@@ -81,15 +81,6 @@ inline BufferObject::BufferObject(GLenum target, uint sizeInBytes, const void* d
 }
 
 
-inline BufferObject::~BufferObject()
-{
-	if(isCreated())
-	{
-		deleteBuff();
-	}
-}
-
-
 inline uint BufferObject::getGlId() const
 {
 	ASSERT(isCreated());

+ 12 - 0
src/GfxApi/BufferObjects/Fbo.cpp

@@ -2,6 +2,18 @@
 #include <boost/lexical_cast.hpp>
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+Fbo::~Fbo()
+{
+	if(isCreated())
+	{
+		destroy();
+	}
+}
+
+
 //==============================================================================
 // checkIfGood                                                                 =
 //==============================================================================

+ 0 - 9
src/GfxApi/BufferObjects/Fbo.h

@@ -68,15 +68,6 @@ inline uint Fbo::getGlId() const
 }
 
 
-inline Fbo::~Fbo()
-{
-	if(isCreated())
-	{
-		destroy();
-	}
-}
-
-
 inline void Fbo::bind(GLenum target_)
 {
 	ASSERT(isCreated());

+ 12 - 0
src/GfxApi/BufferObjects/Vao.cpp

@@ -2,6 +2,18 @@
 #include "Vbo.h"
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+Vao::~Vao()
+{
+	if(isCreated())
+	{
+		destroy();
+	}
+}
+
+
 //==============================================================================
 // attachArrayBufferVbo                                                        =
 //==============================================================================

+ 0 - 9
src/GfxApi/BufferObjects/Vao.h

@@ -78,15 +78,6 @@ inline void Vao::create()
 }
 
 
-inline Vao::~Vao()
-{
-	if(isCreated())
-	{
-		destroy();
-	}
-}
-
-
 inline void Vao::destroy()
 {
 	ASSERT(isCreated());

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

@@ -181,7 +181,7 @@ inline Axisang& Axisang::operator=(const Axisang& b)
 {
 	ang = b.ang;
 	axis = b.axis;
-	return SELF;
+	return *this;
 }
 
 

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

@@ -147,7 +147,7 @@ inline Euler& Euler::operator=(const Euler& b)
 	x() = b.x();
 	y() = b.y();
 	z() = b.z();
-	return SELF;
+	return *this;
 }
 
 

+ 268 - 245
src/Math/Mat3.inl.h

@@ -1,9 +1,6 @@
 #include "Common.inl.h"
 
 
-#define SELF (*this)
-
-
 namespace M {
 
 
@@ -16,7 +13,7 @@ inline Mat3::Mat3(float f)
 {
 	for(int i = 0; i < 9; i++)
 	{
-		SELF[i] = f;
+		(*this)[i] = f;
 	}
 }
 
@@ -25,7 +22,7 @@ inline Mat3::Mat3(float arr [])
 {
 	for(int i = 0; i < 9; i++)
 	{
-		SELF[i] = arr[i];
+		(*this)[i] = arr[i];
 	}
 }
 
@@ -33,15 +30,15 @@ inline Mat3::Mat3(float arr [])
 inline Mat3::Mat3(float m00, float m01, float m02, float m10, float m11,
 	float m12, float m20, float m21, float m22)
 {
-	SELF(0, 0) = m00;
-	SELF(0, 1) = m01;
-	SELF(0, 2) = m02;
-	SELF(1, 0) = m10;
-	SELF(1, 1) = m11;
-	SELF(1, 2) = m12;
-	SELF(2, 0) = m20;
-	SELF(2, 1) = m21;
-	SELF(2, 2) = m22;
+	(*this)(0, 0) = m00;
+	(*this)(0, 1) = m01;
+	(*this)(0, 2) = m02;
+	(*this)(1, 0) = m10;
+	(*this)(1, 1) = m11;
+	(*this)(1, 2) = m12;
+	(*this)(2, 0) = m20;
+	(*this)(2, 1) = m21;
+	(*this)(2, 2) = m22;
 }
 
 // Copy
@@ -49,7 +46,7 @@ inline Mat3::Mat3(const Mat3& b)
 {
 	for(int i = 0; i < 9; i++)
 	{
-		SELF[i] = b[i];
+		(*this)[i] = b[i];
 	}
 }
 
@@ -74,17 +71,17 @@ inline Mat3::Mat3(const Quat& q)
 	yz = q.y() * zs;
 	zz = q.z() * zs;
 
-	SELF(0, 0) = 1.0 - (yy + zz);
-	SELF(0, 1) = xy - wz;
-	SELF(0, 2) = xz + wy;
+	(*this)(0, 0) = 1.0 - (yy + zz);
+	(*this)(0, 1) = xy - wz;
+	(*this)(0, 2) = xz + wy;
 
-	SELF(1, 0) = xy + wz;
-	SELF(1, 1) = 1.0 - (xx + zz);
-	SELF(1, 2) = yz - wx;
+	(*this)(1, 0) = xy + wz;
+	(*this)(1, 1) = 1.0 - (xx + zz);
+	(*this)(1, 2) = yz - wx;
 
-	SELF(2, 0) = xz - wy;
-	SELF(2, 1) = yz + wx;
-	SELF(2, 2) = 1.0 - (xx + yy);
+	(*this)(2, 0) = xz - wy;
+	(*this)(2, 1) = yz + wx;
+	(*this)(2, 2) = 1.0 - (xx + yy);
 }
 
 // Euler
@@ -95,15 +92,15 @@ inline Mat3::Mat3(const Euler& e)
 	sinCos(e.z(), sa, ca);
 	sinCos(e.x(), sb, cb);
 
-	SELF(0, 0) = ch * ca;
-	SELF(0, 1) = sh * sb - ch * sa * cb;
-	SELF(0, 2) = ch * sa * sb + sh * cb;
-	SELF(1, 0) = sa;
-	SELF(1, 1) = ca * cb;
-	SELF(1, 2) = -ca * sb;
-	SELF(2, 0) = -sh * ca;
-	SELF(2, 1) = sh * sa * cb + ch * sb;
-	SELF(2, 2) = -sh * sa * sb + ch * cb;
+	(*this)(0, 0) = ch * ca;
+	(*this)(0, 1) = sh * sb - ch * sa * cb;
+	(*this)(0, 2) = ch * sa * sb + sh * cb;
+	(*this)(1, 0) = sa;
+	(*this)(1, 1) = ca * cb;
+	(*this)(1, 2) = -ca * sb;
+	(*this)(2, 0) = -sh * ca;
+	(*this)(2, 1) = sh * sa * cb + ch * sb;
+	(*this)(2, 2) = -sh * sa * sb + ch * cb;
 }
 
 // Axisang
@@ -116,21 +113,21 @@ inline Mat3::Mat3(const Axisang& axisang)
 	float t = 1.0 - c;
 
 	const Vec3& axis = axisang.getAxis();
-	SELF(0, 0) = c + axis.x() * axis.x() * t;
-	SELF(1, 1) = c + axis.y() * axis.y() * t;
-	SELF(2, 2) = c + axis.z() * axis.z() * t;
+	(*this)(0, 0) = c + axis.x() * axis.x() * t;
+	(*this)(1, 1) = c + axis.y() * axis.y() * t;
+	(*this)(2, 2) = c + axis.z() * axis.z() * t;
 
 	float tmp1 = axis.x() * axis.y() * t;
 	float tmp2 = axis.z() * s;
-	SELF(1, 0) = tmp1 + tmp2;
-	SELF(0, 1) = tmp1 - tmp2;
+	(*this)(1, 0) = tmp1 + tmp2;
+	(*this)(0, 1) = tmp1 - tmp2;
 	tmp1 = axis.x() * axis.z() * t;
 	tmp2 = axis.y() * s;
-	SELF(2, 0) = tmp1 - tmp2;
-	SELF(0, 2) = tmp1 + tmp2;    tmp1 = axis.y() * axis.z() * t;
+	(*this)(2, 0) = tmp1 - tmp2;
+	(*this)(0, 2) = tmp1 + tmp2;    tmp1 = axis.y() * axis.z() * t;
 	tmp2 = axis.x() * s;
-	SELF(2, 1) = tmp1 + tmp2;
-	SELF(1, 2) = tmp1 - tmp2;
+	(*this)(2, 1) = tmp1 + tmp2;
+	(*this)(1, 2) = tmp1 - tmp2;
 }
 
 
@@ -168,9 +165,9 @@ inline Mat3& Mat3::operator=(const Mat3& b)
 {
 	for(int i = 0; i < 9; i++)
 	{
-		SELF[i] = b[i];
+		(*this)[i] = b[i];
 	}
-	return SELF;
+	return (*this);
 }
 
 // +
@@ -179,7 +176,7 @@ inline Mat3 Mat3::operator+(const Mat3& b) const
 	Mat3 c;
 	for(int i = 0; i < 9; i++)
 	{
-		c[i] = SELF[i] + b[i];
+		c[i] = (*this)[i] + b[i];
 	}
 	return c;
 }
@@ -189,9 +186,9 @@ inline Mat3& Mat3::operator+=(const Mat3& b)
 {
 	for(int i = 0; i < 9; i++)
 	{
-		SELF[i] += b[i];
+		(*this)[i] += b[i];
 	}
-	return SELF;
+	return (*this);
 }
 
 // -
@@ -200,7 +197,7 @@ inline Mat3 Mat3::operator-(const Mat3& b) const
 	Mat3 c;
 	for(int i = 0; i < 9; i++)
 	{
-		c[i] = SELF[i] - b[i];
+		c[i] = (*this)[i] - b[i];
 	}
 	return c;
 }
@@ -210,41 +207,41 @@ inline Mat3& Mat3::operator-=(const Mat3& b)
 {
 	for(int i = 0; i < 9; i++)
 	{
-		SELF[i] -= b[i];
+		(*this)[i] -= b[i];
 	}
-	return SELF;
+	return (*this);
 }
 
 // *
 inline Mat3 Mat3::operator*(const Mat3& b) const
 {
 	Mat3 c;
-	c(0, 0) = SELF(0, 0) * b(0, 0) + SELF(0, 1) * b(1, 0) +
-		SELF(0, 2) * b(2, 0);
-	c(0, 1) = SELF(0, 0) * b(0, 1) + SELF(0, 1) * b(1, 1) +
-		SELF(0, 2) * b(2, 1);
-	c(0, 2) = SELF(0, 0) * b(0, 2) + SELF(0, 1) * b(1, 2) +
-		SELF(0, 2) * b(2, 2);
-	c(1, 0) = SELF(1, 0) * b(0, 0) + SELF(1, 1) * b(1, 0) +
-		SELF(1, 2) * b(2, 0);
-	c(1, 1) = SELF(1, 0) * b(0, 1) + SELF(1, 1) * b(1, 1) +
-		SELF(1, 2) * b(2, 1);
-	c(1, 2) = SELF(1, 0) * b(0, 2) + SELF(1, 1) * b(1, 2) +
-		SELF(1, 2) * b(2, 2);
-	c(2, 0) = SELF(2, 0) * b(0, 0) + SELF(2, 1) * b(1, 0) +
-		SELF(2, 2) * b(2, 0);
-	c(2, 1) = SELF(2, 0) * b(0, 1) + SELF(2, 1) * b(1, 1) +
-		SELF(2, 2) * b(2, 1);
-	c(2, 2) = SELF(2, 0) * b(0, 2) + SELF(2, 1) * b(1, 2) +
-		SELF(2, 2) * b(2, 2);
+	c(0, 0) = (*this)(0, 0) * b(0, 0) + (*this)(0, 1) * b(1, 0) +
+		(*this)(0, 2) * b(2, 0);
+	c(0, 1) = (*this)(0, 0) * b(0, 1) + (*this)(0, 1) * b(1, 1) +
+		(*this)(0, 2) * b(2, 1);
+	c(0, 2) = (*this)(0, 0) * b(0, 2) + (*this)(0, 1) * b(1, 2) +
+		(*this)(0, 2) * b(2, 2);
+	c(1, 0) = (*this)(1, 0) * b(0, 0) + (*this)(1, 1) * b(1, 0) +
+		(*this)(1, 2) * b(2, 0);
+	c(1, 1) = (*this)(1, 0) * b(0, 1) + (*this)(1, 1) * b(1, 1) +
+		(*this)(1, 2) * b(2, 1);
+	c(1, 2) = (*this)(1, 0) * b(0, 2) + (*this)(1, 1) * b(1, 2) +
+		(*this)(1, 2) * b(2, 2);
+	c(2, 0) = (*this)(2, 0) * b(0, 0) + (*this)(2, 1) * b(1, 0) +
+		(*this)(2, 2) * b(2, 0);
+	c(2, 1) = (*this)(2, 0) * b(0, 1) + (*this)(2, 1) * b(1, 1) +
+		(*this)(2, 2) * b(2, 1);
+	c(2, 2) = (*this)(2, 0) * b(0, 2) + (*this)(2, 1) * b(1, 2) +
+		(*this)(2, 2) * b(2, 2);
 	return c;
 }
 
 // *=
 inline Mat3& Mat3::operator*=(const Mat3& b)
 {
-	SELF = SELF * b;
-	return SELF;
+	(*this) = (*this) * b;
+	return (*this);
 }
 
 // ==
@@ -252,7 +249,7 @@ inline bool Mat3::operator==(const Mat3& b) const
 {
 	for(int i = 0; i < 9; i++)
 	{
-		if(!isZero(SELF[i]-b[i]))
+		if(!isZero((*this)[i]-b[i]))
 		{
 			return false;
 		}
@@ -265,7 +262,7 @@ inline bool Mat3::operator!=(const Mat3& b) const
 {
 	for(int i = 0; i < 9; i++)
 	{
-		if(!isZero(SELF[i]-b[i]))
+		if(!isZero((*this)[i]-b[i]))
 		{
 			return true;
 		}
@@ -284,7 +281,7 @@ inline Mat3 Mat3::operator+(float f) const
 	Mat3 c;
 	for(uint i = 0; i < 9; i++)
 	{
-		c[i] = SELF[i] + f;
+		c[i] = (*this)[i] + f;
 	}
 	return c;
 }
@@ -300,9 +297,9 @@ inline Mat3& Mat3::operator+=(float f)
 {
 	for(uint i = 0; i < 9; i++)
 	{
-		SELF[i] += f;
+		(*this)[i] += f;
 	}
-	return SELF;
+	return (*this);
 }
 
 // 3x3 - float
@@ -311,7 +308,7 @@ inline Mat3 Mat3::operator-(float f) const
 	Mat3 c;
 	for(uint i = 0; i < 9; i++)
 	{
-		c[i] = SELF[i] - f;
+		c[i] = (*this)[i] - f;
 	}
 	return c;
 }
@@ -332,9 +329,9 @@ inline Mat3& Mat3::operator-=(float f)
 {
 	for(uint i = 0; i < 9; i++)
 	{
-		SELF[i] -= f;
+		(*this)[i] -= f;
 	}
-	return SELF;
+	return (*this);
 }
 
 // 3x3 * float
@@ -343,7 +340,7 @@ inline Mat3 Mat3::operator*(float f) const
 	Mat3 c;
 	for(uint i = 0; i < 9; i++)
 	{
-		c[i] = SELF[i] * f;
+		c[i] = (*this)[i] * f;
 	}
 	return c;
 }
@@ -364,9 +361,9 @@ inline Mat3& Mat3::operator*=(float f)
 {
 	for(uint i = 0; i < 9; i++)
 	{
-		SELF[i] *= f;
+		(*this)[i] *= f;
 	}
-	return SELF;
+	return (*this);
 }
 
 // 3x3 / float
@@ -375,7 +372,7 @@ inline Mat3 Mat3::operator/(float f) const
 	Mat3 c;
 	for(uint i = 0; i < 9; i++)
 	{
-		c[i] = SELF[i] / f;
+		c[i] = (*this)[i] / f;
 	}
 	return c;
 }
@@ -396,9 +393,9 @@ inline Mat3& Mat3::operator/=(float f)
 {
 	for(uint i = 0; i < 9; i++)
 	{
-		SELF[i] /= f;
+		(*this)[i] /= f;
 	}
-	return SELF;
+	return (*this);
 }
 
 
@@ -410,9 +407,9 @@ inline Mat3& Mat3::operator/=(float f)
 inline Vec3 Mat3::operator*(const Vec3& b) const
 {
 	return Vec3(
-		SELF(0, 0) * b.x() + SELF(0, 1) * b.y() + SELF(0, 2) * b.z(),
-		SELF(1, 0) * b.x() + SELF(1, 1) * b.y() + SELF(1, 2) * b.z(),
-		SELF(2, 0) * b.x() + SELF(2, 1) * b.y() + SELF(2, 2) * b.z()
+		(*this)(0, 0) * b.x() + (*this)(0, 1) * b.y() + (*this)(0, 2) * b.z(),
+		(*this)(1, 0) * b.x() + (*this)(1, 1) * b.y() + (*this)(1, 2) * b.z(),
+		(*this)(2, 0) * b.x() + (*this)(2, 1) * b.y() + (*this)(2, 2) * b.z()
 	);
 }
 
@@ -424,85 +421,85 @@ inline Vec3 Mat3::operator*(const Vec3& b) const
 // setRows
 inline void Mat3::setRows(const Vec3& a, const Vec3& b, const Vec3& c)
 {
-	SELF(0, 0) = a.x();
-	SELF(0, 1) = a.y();
-	SELF(0, 2) = a.z();
-	SELF(1, 0) = b.x();
-	SELF(1, 1) = b.y();
-	SELF(1, 2) = b.z();
-	SELF(2, 0) = c.x();
-	SELF(2, 1) = c.y();
-	SELF(2, 2) = c.z();
+	(*this)(0, 0) = a.x();
+	(*this)(0, 1) = a.y();
+	(*this)(0, 2) = a.z();
+	(*this)(1, 0) = b.x();
+	(*this)(1, 1) = b.y();
+	(*this)(1, 2) = b.z();
+	(*this)(2, 0) = c.x();
+	(*this)(2, 1) = c.y();
+	(*this)(2, 2) = c.z();
 }
 
 // setColumns
 inline void Mat3::setColumns(const Vec3& a, const Vec3& b, const Vec3& c)
 {
-	SELF(0, 0) = a.x();
-	SELF(1, 0) = a.y();
-	SELF(2, 0) = a.z();
-	SELF(0, 1) = b.x();
-	SELF(1, 1) = b.y();
-	SELF(2, 1) = b.z();
-	SELF(0, 2) = c.x();
-	SELF(1, 2) = c.y();
-	SELF(2, 2) = c.z();
+	(*this)(0, 0) = a.x();
+	(*this)(1, 0) = a.y();
+	(*this)(2, 0) = a.z();
+	(*this)(0, 1) = b.x();
+	(*this)(1, 1) = b.y();
+	(*this)(2, 1) = b.z();
+	(*this)(0, 2) = c.x();
+	(*this)(1, 2) = c.y();
+	(*this)(2, 2) = c.z();
 }
 
 // getRows
 inline void Mat3::getRows(Vec3& a, Vec3& b, Vec3& c) const
 {
-	a.x() = SELF(0, 0);
-	a.y() = SELF(0, 1);
-	a.z() = SELF(0, 2);
-	b.x() = SELF(1, 0);
-	b.y() = SELF(1, 1);
-	b.z() = SELF(1, 2);
-	c.x() = SELF(2, 0);
-	c.y() = SELF(2, 1);
-	c.z() = SELF(2, 2);
+	a.x() = (*this)(0, 0);
+	a.y() = (*this)(0, 1);
+	a.z() = (*this)(0, 2);
+	b.x() = (*this)(1, 0);
+	b.y() = (*this)(1, 1);
+	b.z() = (*this)(1, 2);
+	c.x() = (*this)(2, 0);
+	c.y() = (*this)(2, 1);
+	c.z() = (*this)(2, 2);
 }
 
 // getColumns
 inline void Mat3::getColumns(Vec3& a, Vec3& b, Vec3& c) const
 {
-	a.x() = SELF(0, 0);
-	a.y() = SELF(1, 0);
-	a.z() = SELF(2, 0);
-	b.x() = SELF(0, 1);
-	b.y() = SELF(1, 1);
-	b.z() = SELF(2, 1);
-	c.x() = SELF(0, 2);
-	c.y() = SELF(1, 2);
-	c.z() = SELF(2, 2);
+	a.x() = (*this)(0, 0);
+	a.y() = (*this)(1, 0);
+	a.z() = (*this)(2, 0);
+	b.x() = (*this)(0, 1);
+	b.y() = (*this)(1, 1);
+	b.z() = (*this)(2, 1);
+	c.x() = (*this)(0, 2);
+	c.y() = (*this)(1, 2);
+	c.z() = (*this)(2, 2);
 }
 
 // setRow
 inline void Mat3::setRow(const uint i, const Vec3& v)
 {
-	SELF(i, 0) = v.x();
-	SELF(i, 1) = v.y();
-	SELF(i, 2) = v.z();
+	(*this)(i, 0) = v.x();
+	(*this)(i, 1) = v.y();
+	(*this)(i, 2) = v.z();
 }
 
 // getRow
 inline Vec3 Mat3::getRow(const uint i) const
 {
-	return Vec3(SELF(i, 0), SELF(i, 1), SELF(i, 2));
+	return Vec3((*this)(i, 0), (*this)(i, 1), (*this)(i, 2));
 }
 
 // setColumn
 inline void Mat3::setColumn(const uint i, const Vec3& v)
 {
-	SELF(0, i) = v.x();
-	SELF(1, i) = v.y();
-	SELF(2, i) = v.z();
+	(*this)(0, i) = v.x();
+	(*this)(1, i) = v.y();
+	(*this)(2, i) = v.z();
 }
 
 // getColumn
 inline Vec3 Mat3::getColumn(const uint i) const
 {
-	return Vec3(SELF(0,i), SELF(1,i), SELF(2,i));
+	return Vec3((*this)(0,i), (*this)(1,i), (*this)(2,i));
 }
 
 // getXAxis
@@ -547,15 +544,15 @@ inline void Mat3::setRotationX(float rad)
 	float sintheta, costheta;
 	sinCos(rad, sintheta, costheta);
 
-	SELF(0, 0) = 1.0;
-	SELF(0, 1) = 0.0;
-	SELF(0, 2) = 0.0;
-	SELF(1, 0) = 0.0;
-	SELF(1, 1) = costheta;
-	SELF(1, 2) = -sintheta;
-	SELF(2, 0) = 0.0;
-	SELF(2, 1) = sintheta;
-	SELF(2, 2) = costheta;
+	(*this)(0, 0) = 1.0;
+	(*this)(0, 1) = 0.0;
+	(*this)(0, 2) = 0.0;
+	(*this)(1, 0) = 0.0;
+	(*this)(1, 1) = costheta;
+	(*this)(1, 2) = -sintheta;
+	(*this)(2, 0) = 0.0;
+	(*this)(2, 1) = sintheta;
+	(*this)(2, 2) = costheta;
 }
 
 // setRotationY
@@ -564,15 +561,15 @@ inline void Mat3::setRotationY(float rad)
 	float sintheta, costheta;
 	sinCos(rad, sintheta, costheta);
 
-	SELF(0, 0) = costheta;
-	SELF(0, 1) = 0.0;
-	SELF(0, 2) = sintheta;
-	SELF(1, 0) = 0.0;
-	SELF(1, 1) = 1.0;
-	SELF(1, 2) = 0.0;
-	SELF(2, 0) = -sintheta;
-	SELF(2, 1) = 0.0;
-	SELF(2, 2) = costheta;
+	(*this)(0, 0) = costheta;
+	(*this)(0, 1) = 0.0;
+	(*this)(0, 2) = sintheta;
+	(*this)(1, 0) = 0.0;
+	(*this)(1, 1) = 1.0;
+	(*this)(1, 2) = 0.0;
+	(*this)(2, 0) = -sintheta;
+	(*this)(2, 1) = 0.0;
+	(*this)(2, 2) = costheta;
 }
 
 // loadRotationZ
@@ -581,15 +578,15 @@ inline void Mat3::setRotationZ(float rad)
 	float sintheta, costheta;
 	sinCos(rad, sintheta, costheta);
 
-	SELF(0, 0) = costheta;
-	SELF(0, 1) = -sintheta;
-	SELF(0, 2) = 0.0;
-	SELF(1, 0) = sintheta;
-	SELF(1, 1) = costheta;
-	SELF(1, 2) = 0.0;
-	SELF(2, 0) = 0.0;
-	SELF(2, 1) = 0.0;
-	SELF(2, 2) = 1.0;
+	(*this)(0, 0) = costheta;
+	(*this)(0, 1) = -sintheta;
+	(*this)(0, 2) = 0.0;
+	(*this)(1, 0) = sintheta;
+	(*this)(1, 1) = costheta;
+	(*this)(1, 2) = 0.0;
+	(*this)(2, 0) = 0.0;
+	(*this)(2, 1) = 0.0;
+	(*this)(2, 2) = 1.0;
 }
 
 // rotateXAxis
@@ -609,28 +606,32 @@ inline void Mat3::rotateXAxis(float rad)
 	getColumns(xAxis, yAxis, zAxis);*/
 
 	// zAxis = zAxis*cosa - yAxis*sina;
-	SELF(0, 2) = SELF(0, 2) * cosa - SELF(0, 1) * sina;
-	SELF(1, 2) = SELF(1, 2) * cosa - SELF(1, 1) * sina;
-	SELF(2, 2) = SELF(2, 2) * cosa - SELF(2, 1) * sina;
+	(*this)(0, 2) = (*this)(0, 2) * cosa - (*this)(0, 1) * sina;
+	(*this)(1, 2) = (*this)(1, 2) * cosa - (*this)(1, 1) * sina;
+	(*this)(2, 2) = (*this)(2, 2) * cosa - (*this)(2, 1) * sina;
 
 	// zAxis.normalize();
-	float len = sqrt(SELF(0, 2) * SELF(0, 2) + SELF(1, 2) * SELF(1, 2) +
-		SELF(2, 2) * SELF(2, 2));
-	SELF(0, 2) /= len;
-	SELF(1, 2) /= len;
-	SELF(2, 2) /= len;
+	float len = sqrt((*this)(0, 2) * (*this)(0, 2) +
+		(*this)(1, 2) * (*this)(1, 2) + (*this)(2, 2) * (*this)(2, 2));
+	(*this)(0, 2) /= len;
+	(*this)(1, 2) /= len;
+	(*this)(2, 2) /= len;
 
 	// yAxis = zAxis * xAxis;
-	SELF(0, 1) = SELF(1, 2) * SELF(2, 0) - SELF(2, 2) * SELF(1, 0);
-	SELF(1, 1) = SELF(2, 2) * SELF(0, 0) - SELF(0, 2) * SELF(2, 0);
-	SELF(2, 1) = SELF(0, 2) * SELF(1, 0) - SELF(1, 2) * SELF(0, 0);
+	(*this)(0, 1) = (*this)(1, 2) * (*this)(2, 0) -
+		(*this)(2, 2) * (*this)(1, 0);
+	(*this)(1, 1) = (*this)(2, 2) * (*this)(0, 0) -
+		(*this)(0, 2) * (*this)(2, 0);
+	(*this)(2, 1) = (*this)(0, 2) * (*this)(1, 0) -
+		(*this)(1, 2) * (*this)(0, 0);
 
 	// yAxis.normalize();
-	/*len = invSqrt(SELF(0, 1) * SELF(0, 1) + SELF(1, 1) * SELF(1, 1) +
-		SELF(2, 1) * SELF(2, 1));
-	SELF(0, 1) *= len;
-	SELF(1, 1) *= len;
-	SELF(2, 1) *= len;*/
+	/*len = invSqrt((*this)(0, 1) * (*this)(0, 1) +
+		(*this)(1, 1) * (*this)(1, 1) +
+		(*this)(2, 1) * (*this)(2, 1));
+	(*this)(0, 1) *= len;
+	(*this)(1, 1) *= len;
+	(*this)(2, 1) *= len;*/
 
 	// setColumns(xAxis, yAxis, zAxis);
 
@@ -646,28 +647,31 @@ inline void Mat3::rotateYAxis(float rad)
 	getColumns(xAxis, yAxis, zAxis);*/
 
 	// zAxis = zAxis*cosa + xAxis*sina;
-	SELF(0, 2) = SELF(0, 2)*cosa + SELF(0, 0)*sina;
-	SELF(1, 2) = SELF(1, 2)*cosa + SELF(1, 0)*sina;
-	SELF(2, 2) = SELF(2, 2)*cosa + SELF(2, 0)*sina;
+	(*this)(0, 2) = (*this)(0, 2)*cosa + (*this)(0, 0)*sina;
+	(*this)(1, 2) = (*this)(1, 2)*cosa + (*this)(1, 0)*sina;
+	(*this)(2, 2) = (*this)(2, 2)*cosa + (*this)(2, 0)*sina;
 
 	// zAxis.normalize();
-	float len = sqrt(SELF(0, 2) * SELF(0, 2) + SELF(1, 2) * SELF(1, 2) +
-		SELF(2, 2) * SELF(2, 2));
-	SELF(0, 2) /= len;
-	SELF(1, 2) /= len;
-	SELF(2, 2) /= len;
+	float len = sqrt((*this)(0, 2) * (*this)(0, 2) +
+		(*this)(1, 2) * (*this)(1, 2) + (*this)(2, 2) * (*this)(2, 2));
+	(*this)(0, 2) /= len;
+	(*this)(1, 2) /= len;
+	(*this)(2, 2) /= len;
 
 	// xAxis = (zAxis*yAxis) * -1.0f;
-	SELF(0, 0) = SELF(2, 2) * SELF(1, 1) - SELF(1, 2) * SELF(2, 1);
-	SELF(1, 0) = SELF(0, 2) * SELF(2, 1) - SELF(2, 2) * SELF(0, 1);
-	SELF(2, 0) = SELF(1, 2) * SELF(0, 1) - SELF(0, 2) * SELF(1, 1);
+	(*this)(0, 0) = (*this)(2, 2) * (*this)(1, 1) -
+		(*this)(1, 2) * (*this)(2, 1);
+	(*this)(1, 0) = (*this)(0, 2) * (*this)(2, 1) -
+		(*this)(2, 2) * (*this)(0, 1);
+	(*this)(2, 0) = (*this)(1, 2) * (*this)(0, 1) -
+		(*this)(0, 2) * (*this)(1, 1);
 
 	// xAxis.normalize();
-	/*len = invSqrt(SELF(0, 0) * SELF(0, 0) + SELF(1, 0) * SELF(1, 0) +
-		SELF(2, 0) * SELF(2, 0));
-	SELF(0, 0) *= len;
-	SELF(1, 0) *= len;
-	SELF(2, 0) *= len;*/
+	/*len = invSqrt((*this)(0, 0) * (*this)(0, 0) + (*this)(1, 0) *
+		(*this)(1, 0) + (*this)(2, 0) * (*this)(2, 0));
+	(*this)(0, 0) *= len;
+	(*this)(1, 0) *= len;
+	(*this)(2, 0) *= len;*/
 
 	// setColumns(xAxis, yAxis, zAxis);
 }
@@ -683,28 +687,31 @@ inline void Mat3::rotateZAxis(float rad)
 	getColumns(xAxis, yAxis, zAxis);*/
 
 	// xAxis = xAxis*cosa + yAxis*sina;
-	SELF(0, 0) = SELF(0, 0)*cosa + SELF(0, 1)*sina;
-	SELF(1, 0) = SELF(1, 0)*cosa + SELF(1, 1)*sina;
-	SELF(2, 0) = SELF(2, 0)*cosa + SELF(2, 1)*sina;
+	(*this)(0, 0) = (*this)(0, 0)*cosa + (*this)(0, 1)*sina;
+	(*this)(1, 0) = (*this)(1, 0)*cosa + (*this)(1, 1)*sina;
+	(*this)(2, 0) = (*this)(2, 0)*cosa + (*this)(2, 1)*sina;
 
 	// xAxis.normalize();
-	float len = sqrt(SELF(0, 0) * SELF(0, 0) + SELF(1, 0) * SELF(1, 0) +
-		SELF(2, 0) * SELF(2, 0));
-	SELF(0, 0) /= len;
-	SELF(1, 0) /= len;
-	SELF(2, 0) /= len;
+	float len = sqrt((*this)(0, 0) * (*this)(0, 0) +
+		(*this)(1, 0) * (*this)(1, 0) + (*this)(2, 0) * (*this)(2, 0));
+	(*this)(0, 0) /= len;
+	(*this)(1, 0) /= len;
+	(*this)(2, 0) /= len;
 
 	// yAxis = zAxis*xAxis;
-	SELF(0, 1) = SELF(1, 2) * SELF(2, 0) - SELF(2, 2) * SELF(1, 0);
-	SELF(1, 1) = SELF(2, 2) * SELF(0, 0) - SELF(0, 2) * SELF(2, 0);
-	SELF(2, 1) = SELF(0, 2) * SELF(1, 0) - SELF(1, 2) * SELF(0, 0);
+	(*this)(0, 1) = (*this)(1, 2) * (*this)(2, 0) -
+		(*this)(2, 2) * (*this)(1, 0);
+	(*this)(1, 1) = (*this)(2, 2) * (*this)(0, 0) -
+		(*this)(0, 2) * (*this)(2, 0);
+	(*this)(2, 1) = (*this)(0, 2) * (*this)(1, 0) -
+		(*this)(1, 2) * (*this)(0, 0);
 
 	// yAxis.normalize();
-	/*len = invSqrt(SELF(0, 1) * SELF(0, 1) + SELF(1, 1) * SELF(1, 1) +
-		SELF(2, 1) * SELF(2, 1));
-	SELF(0, 1) *= len;
-	SELF(1, 1) *= len;
-	SELF(2, 1) *= len;*/
+	/*len = invSqrt((*this)(0, 1) * (*this)(0, 1) +
+		(*this)(1, 1) * (*this)(1, 1) + (*this)(2, 1) * (*this)(2, 1));
+	(*this)(0, 1) *= len;
+	(*this)(1, 1) *= len;
+	(*this)(2, 1) *= len;*/
 
 	//setColumns(xAxis, yAxis, zAxis);
 }
@@ -712,30 +719,30 @@ inline void Mat3::rotateZAxis(float rad)
 // transpose
 inline void Mat3::transpose()
 {
-	float temp = SELF(0, 1);
-	SELF(0, 1) = SELF(1, 0);
-	SELF(1, 0) = temp;
-	temp = SELF(0, 2);
-	SELF(0, 2) = SELF(2, 0);
-	SELF(2, 0) = temp;
-	temp = SELF(1, 2);
-	SELF(1, 2) = SELF(2, 1);
-	SELF(2, 1) = temp;
+	float temp = (*this)(0, 1);
+	(*this)(0, 1) = (*this)(1, 0);
+	(*this)(1, 0) = temp;
+	temp = (*this)(0, 2);
+	(*this)(0, 2) = (*this)(2, 0);
+	(*this)(2, 0) = temp;
+	temp = (*this)(1, 2);
+	(*this)(1, 2) = (*this)(2, 1);
+	(*this)(2, 1) = temp;
 }
 
 // transposed
 inline Mat3 Mat3::getTransposed() const
 {
 	Mat3 m3;
-	m3[0] = SELF[0];
-	m3[1] = SELF[3];
-	m3[2] = SELF[6];
-	m3[3] = SELF[1];
-	m3[4] = SELF[4];
-	m3[5] = SELF[7];
-	m3[6] = SELF[2];
-	m3[7] = SELF[5];
-	m3[8] = SELF[8];
+	m3[0] = (*this)[0];
+	m3[1] = (*this)[3];
+	m3[2] = (*this)[6];
+	m3[3] = (*this)[1];
+	m3[4] = (*this)[4];
+	m3[5] = (*this)[7];
+	m3[6] = (*this)[2];
+	m3[7] = (*this)[5];
+	m3[8] = (*this)[8];
 	return m3;
 }
 
@@ -746,10 +753,10 @@ inline void Mat3::reorthogonalize()
 	/*Mat3 correction_m3 =
 	(
 		(Mat3::ident * 3.0f) -
-		(SELF * SELF.transposed())
+		((*this) * (*this).transposed())
 	) * 0.5f;
 
-	SELF = correction_m3 * SELF;*/
+	(*this) = correction_m3 * (*this);*/
 
 	// method 2: Gram-Schmidt method with a twist for zAxis
 	Vec3 xAxis, yAxis, zAxis;
@@ -769,13 +776,15 @@ inline void Mat3::reorthogonalize()
 inline float Mat3::getDet() const
 {
 	/* Accurate method:
-	return SELF(0, 0) * SELF(1, 1) * SELF(2, 2) + SELF(0, 1) * SELF(1, 2) *
-		SELF(2, 0) + SELF(0, 2) * SELF(1, 0) * SELF(2, 1) -
-		SELF(0, 0) * SELF(1, 2) * SELF(2, 1) - SELF(0, 1) * SELF(1, 0) *
-		SELF(2, 2) - SELF(0, 2) * SELF(1, 1) * SELF(2, 0); */
-	return SELF(0, 0)*(SELF(1, 1) * SELF(2, 2) - SELF(1, 2) * SELF(2, 1)) -
-	SELF(0, 1)*(SELF(1, 0) * SELF(2, 2) - SELF(1, 2) * SELF(2, 0)) +
-	SELF(0, 2)*(SELF(0, 1) * SELF(2, 1) - SELF(1, 1) * SELF(2, 0));
+	return (*this)(0, 0) * (*this)(1, 1) * (*this)(2, 2) +
+		(*this)(0, 1) * (*this)(1, 2) * (*this)(2, 0) + (*this)(0, 2) *
+		(*this)(1, 0) * (*this)(2, 1) - (*this)(0, 0) * (*this)(1, 2) *
+		(*this)(2, 1) - (*this)(0, 1) * (*this)(1, 0) *
+		(*this)(2, 2) - (*this)(0, 2) * (*this)(1, 1) * (*this)(2, 0); */
+	return (*this)(0, 0) * ((*this)(1, 1) * (*this)(2, 2) -
+		(*this)(1, 2) * (*this)(2, 1)) - (*this)(0, 1) * ((*this)(1, 0) *
+		(*this)(2, 2) - (*this)(1, 2) * (*this)(2, 0)) + (*this)(0, 2) *
+		((*this)(0, 1) * (*this)(2, 1) - (*this)(1, 1) * (*this)(2, 0));
 }
 
 // getInverse
@@ -785,10 +794,14 @@ inline Mat3 Mat3::getInverse() const
 	Mat3 r;
 
 	// compute determinant
-	float cofactor0 = SELF(1, 1) * SELF(2, 2) - SELF(1, 2) * SELF(2, 1);
-	float cofactor3 = SELF(0, 2) * SELF(2, 1) - SELF(0, 1) * SELF(2, 2);
-	float cofactor6 = SELF(0, 1) * SELF(1, 2) - SELF(0, 2) * SELF(1, 1);
-	float det = SELF(0, 0) * cofactor0 + SELF(1, 0) * cofactor3 + SELF(2, 0) *
+	float cofactor0 = (*this)(1, 1) * (*this)(2, 2) -
+		(*this)(1, 2) * (*this)(2, 1);
+	float cofactor3 = (*this)(0, 2) * (*this)(2, 1) -
+		(*this)(0, 1) * (*this)(2, 2);
+	float cofactor6 = (*this)(0, 1) * (*this)(1, 2) -
+		(*this)(0, 2) * (*this)(1, 1);
+	float det = (*this)(0, 0) * cofactor0 + (*this)(1, 0) * cofactor3 +
+		(*this)(2, 0) *
 		cofactor6;
 
 	ASSERT(!isZero(det)); // Cannot invert det == 0
@@ -799,13 +812,19 @@ inline Mat3 Mat3::getInverse() const
 	r(0, 1) = invDet * cofactor3;
 	r(0, 2) = invDet * cofactor6;
 
-	r(1, 0) = invDet * (SELF(1, 2) * SELF(2, 0) - SELF(1, 0) * SELF(2, 2));
-	r(1, 1) = invDet * (SELF(0, 0) * SELF(2, 2) - SELF(0, 2) * SELF(2, 0));
-	r(1, 2) = invDet * (SELF(0, 2) * SELF(1, 0) - SELF(0, 0) * SELF(1, 2));
+	r(1, 0) = invDet * ((*this)(1, 2) * (*this)(2, 0) -
+		(*this)(1, 0) * (*this)(2, 2));
+	r(1, 1) = invDet * ((*this)(0, 0) * (*this)(2, 2) -
+		(*this)(0, 2) * (*this)(2, 0));
+	r(1, 2) = invDet * ((*this)(0, 2) * (*this)(1, 0) -
+		(*this)(0, 0) * (*this)(1, 2));
 
-	r(2, 0) = invDet * (SELF(1, 0) * SELF(2, 1) - SELF(1, 1) * SELF(2, 0));
-	r(2, 1) = invDet * (SELF(0, 1) * SELF(2, 0) - SELF(0, 0) * SELF(2, 1));
-	r(2, 2) = invDet * (SELF(0, 0) * SELF(1, 1) - SELF(0, 1) * SELF(1, 0));
+	r(2, 0) = invDet * ((*this)(1, 0) * (*this)(2, 1) -
+		(*this)(1, 1) * (*this)(2, 0));
+	r(2, 1) = invDet * ((*this)(0, 1) * (*this)(2, 0) -
+		(*this)(0, 0) * (*this)(2, 1));
+	r(2, 2) = invDet * ((*this)(0, 0) * (*this)(1, 1) -
+		(*this)(0, 1) * (*this)(1, 0));
 
 	return r;
 }
@@ -813,14 +832,14 @@ inline Mat3 Mat3::getInverse() const
 // setIdentity
 inline void Mat3::setIdentity()
 {
-	SELF = getIdentity();
+	(*this) = getIdentity();
 }
 
 // invert
 // see above
 inline void Mat3::invert()
 {
-	SELF = getInverse();
+	(*this) = getInverse();
 }
 
 // getZero
@@ -843,10 +862,14 @@ inline std::ostream& operator<<(std::ostream& s, const Mat3& m)
 	for(int i=0; i<3; i++)
 	{
 		for(int j=0; j<3; j++)
+		{
 			s << m(i, j) << ' ';
+		}
 
 		if(i != 2)
+		{
 			s << "\n";
+		}
 	}
 	return s;
 }

+ 11 - 7
src/Math/Mat4.h

@@ -1,5 +1,5 @@
-#ifndef MAT4_H
-#define MAT4_H
+#ifndef M_MAT4_H
+#define M_MAT4_H
 
 #include "Common.h"
 
@@ -20,8 +20,9 @@ class Mat4
 		/// @{
 		explicit Mat4() {}
 		explicit Mat4(float f);
-		explicit Mat4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13,
-		              float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33);
+		explicit Mat4(float m00, float m01, float m02, float m03, float m10,
+			float m11, float m12, float m13, float m20, float m21, float m22,
+			float m23, float m30, float m31, float m32, float m33);
 		explicit Mat4(const float arr[]);
 		         Mat4(const Mat4& b);
 		explicit Mat4(const Mat3& m3);
@@ -78,9 +79,11 @@ class Mat4
 
 		/// @name Other
 		/// @{
-		void  setRows(const Vec4& a, const Vec4& b, const Vec4& c, const Vec4& d);
+		void  setRows(const Vec4& a, const Vec4& b, const Vec4& c,
+			const Vec4& d);
 		void  setRow(uint i, const Vec4& v);
-		void  setColumns(const Vec4& a, const Vec4& b, const Vec4& c, const Vec4& d);
+		void  setColumns(const Vec4& a, const Vec4& b, const Vec4& c,
+			const Vec4& d);
 		void  setColumn(uint i, const Vec4& v);
 		void  setRotationPart(const Mat3& m3);
 		void  setTranslationPart(const Vec4& v4);
@@ -95,7 +98,8 @@ class Mat4
 		Mat4  getInverseTransformation() const;
 		Mat4  lerp(const Mat4& b, float t) const;
 		void  setIdentity();
-		/// 12 muls, 27 adds. Something like m4 = m0 * m1 but without touching the 4rth row and allot faster
+		/// 12 muls, 27 adds. Something like m4 = m0 * m1 but without touching
+		/// the 4rth row and allot faster
 		static Mat4 combineTransformations(const Mat4& m0, const Mat4& m1);
 		static const Mat4& getIdentity();
 		static const Mat4& getZero();

+ 262 - 231
src/Math/Mat4.inl.h

@@ -1,9 +1,6 @@
 #include "Common.inl.h"
 
 
-#define SELF (*this)
-
-
 namespace M {
 
 
@@ -22,7 +19,7 @@ inline Mat4::Mat4(const Mat4& b)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] = b[i];
+			(*this)[i] = b[i];
 		}
 	#endif
 }
@@ -38,7 +35,7 @@ inline Mat4::Mat4(const float f)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] = f;
+			(*this)[i] = f;
 		}
 	#endif
 }
@@ -48,88 +45,90 @@ inline Mat4::Mat4(const float arr_[])
 {
 	for(int i = 0; i < 16; i++)
 	{
-		SELF[i] = arr_[i];
+		(*this)[i] = arr_[i];
 	}
 }
 
 // many floats
-inline Mat4::Mat4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20,
-                  float m21, float m22, float m23, float m30, float m31, float m32, float m33)
+inline Mat4::Mat4(float m00, float m01, float m02, float m03, float m10,
+	float m11, float m12, float m13, float m20, float m21, float m22,
+	float m23, float m30, float m31, float m32, float m33)
 {
-	SELF(0, 0) = m00;
-	SELF(0, 1) = m01;
-	SELF(0, 2) = m02;
-	SELF(0, 3) = m03;
-	SELF(1, 0) = m10;
-	SELF(1, 1) = m11;
-	SELF(1, 2) = m12;
-	SELF(1, 3) = m13;
-	SELF(2, 0) = m20;
-	SELF(2, 1) = m21;
-	SELF(2, 2) = m22;
-	SELF(2, 3) = m23;
-	SELF(3, 0) = m30;
-	SELF(3, 1) = m31;
-	SELF(3, 2) = m32;
-	SELF(3, 3) = m33;
+	(*this)(0, 0) = m00;
+	(*this)(0, 1) = m01;
+	(*this)(0, 2) = m02;
+	(*this)(0, 3) = m03;
+	(*this)(1, 0) = m10;
+	(*this)(1, 1) = m11;
+	(*this)(1, 2) = m12;
+	(*this)(1, 3) = m13;
+	(*this)(2, 0) = m20;
+	(*this)(2, 1) = m21;
+	(*this)(2, 2) = m22;
+	(*this)(2, 3) = m23;
+	(*this)(3, 0) = m30;
+	(*this)(3, 1) = m31;
+	(*this)(3, 2) = m32;
+	(*this)(3, 3) = m33;
 }
 
 // Mat3
 inline Mat4::Mat4(const Mat3& m3)
 {
-	SELF(0, 0) = m3(0, 0);
-	SELF(0, 1) = m3(0, 1);
-	SELF(0, 2) = m3(0, 2);
-	SELF(1, 0) = m3(1, 0);
-	SELF(1, 1) = m3(1, 1);
-	SELF(1, 2) = m3(1, 2);
-	SELF(2, 0) = m3(2, 0);
-	SELF(2, 1) = m3(2, 1);
-	SELF(2, 2) = m3(2, 2);
-	SELF(3, 0) = SELF(3, 1) = SELF(3, 2) = SELF(0, 3) = SELF(1, 3) = SELF(2, 3) = 0.0;
-	SELF(3, 3) = 1.0;
+	(*this)(0, 0) = m3(0, 0);
+	(*this)(0, 1) = m3(0, 1);
+	(*this)(0, 2) = m3(0, 2);
+	(*this)(1, 0) = m3(1, 0);
+	(*this)(1, 1) = m3(1, 1);
+	(*this)(1, 2) = m3(1, 2);
+	(*this)(2, 0) = m3(2, 0);
+	(*this)(2, 1) = m3(2, 1);
+	(*this)(2, 2) = m3(2, 2);
+	(*this)(3, 0) = (*this)(3, 1) = (*this)(3, 2) = (*this)(0, 3) =
+		(*this)(1, 3) = (*this)(2, 3) = 0.0;
+	(*this)(3, 3) = 1.0;
 }
 
 // Vec3
 inline Mat4::Mat4(const Vec3& v)
 {
-	SELF(0, 0) = 1.0;
-	SELF(0, 1) = 0.0;
-	SELF(0, 2) = 0.0;
-	SELF(0, 3) = v.x();
-	SELF(1, 0) = 0.0;
-	SELF(1, 1) = 1.0;
-	SELF(1, 2) = 0.0;
-	SELF(1, 3) = v.y();
-	SELF(2, 0) = 0.0;
-	SELF(2, 1) = 0.0;
-	SELF(2, 2) = 1.0;
-	SELF(2, 3) = v.z();
-	SELF(3, 0) = 0.0;
-	SELF(3, 1) = 0.0;
-	SELF(3, 2) = 0.0;
-	SELF(3, 3) = 1.0;
+	(*this)(0, 0) = 1.0;
+	(*this)(0, 1) = 0.0;
+	(*this)(0, 2) = 0.0;
+	(*this)(0, 3) = v.x();
+	(*this)(1, 0) = 0.0;
+	(*this)(1, 1) = 1.0;
+	(*this)(1, 2) = 0.0;
+	(*this)(1, 3) = v.y();
+	(*this)(2, 0) = 0.0;
+	(*this)(2, 1) = 0.0;
+	(*this)(2, 2) = 1.0;
+	(*this)(2, 3) = v.z();
+	(*this)(3, 0) = 0.0;
+	(*this)(3, 1) = 0.0;
+	(*this)(3, 2) = 0.0;
+	(*this)(3, 3) = 1.0;
 }
 
 // vec4
 inline Mat4::Mat4(const Vec4& v)
 {
-	SELF(0, 0) = 1.0;
-	SELF(0, 1) = 0.0;
-	SELF(0, 2) = 0.0;
-	SELF(0, 3) = v.x();
-	SELF(1, 0) = 0.0;
-	SELF(1, 1) = 1.0;
-	SELF(1, 2) = 0.0;
-	SELF(1, 3) = v.y();
-	SELF(2, 0) = 0.0;
-	SELF(2, 1) = 0.0;
-	SELF(2, 2) = 1.0;
-	SELF(2, 3) = v.z();
-	SELF(3, 0) = 0.0;
-	SELF(3, 1) = 0.0;
-	SELF(3, 2) = 0.0;
-	SELF(3, 3) = v.w();
+	(*this)(0, 0) = 1.0;
+	(*this)(0, 1) = 0.0;
+	(*this)(0, 2) = 0.0;
+	(*this)(0, 3) = v.x();
+	(*this)(1, 0) = 0.0;
+	(*this)(1, 1) = 1.0;
+	(*this)(1, 2) = 0.0;
+	(*this)(1, 3) = v.y();
+	(*this)(2, 0) = 0.0;
+	(*this)(2, 1) = 0.0;
+	(*this)(2, 2) = 1.0;
+	(*this)(2, 3) = v.z();
+	(*this)(3, 0) = 0.0;
+	(*this)(3, 1) = 0.0;
+	(*this)(3, 2) = 0.0;
+	(*this)(3, 3) = v.w();
 }
 
 // Vec3, Mat3
@@ -137,8 +136,8 @@ inline Mat4::Mat4(const Vec3& transl, const Mat3& rot)
 {
 	setRotationPart(rot);
 	setTranslationPart(transl);
-	SELF(3, 0) = SELF(3, 1) = SELF(3, 2) = 0.0;
-	SELF(3, 3) = 1.0;
+	(*this)(3, 0) = (*this)(3, 1) = (*this)(3, 2) = 0.0;
+	(*this)(3, 3) = 1.0;
 }
 
 // Vec3, Mat3, float
@@ -155,14 +154,14 @@ inline Mat4::Mat4(const Vec3& translate, const Mat3& rotate, float scale)
 
 	setTranslationPart(translate);
 
-	SELF(3, 0) = SELF(3, 1) = SELF(3, 2) = 0.0;
-	SELF(3, 3) = 1.0;
+	(*this)(3, 0) = (*this)(3, 1) = (*this)(3, 2) = 0.0;
+	(*this)(3, 3) = 1.0;
 }
 
 // Transform
 inline Mat4::Mat4(const Transform& t)
 {
-	SELF = Mat4(t.getOrigin(), t.getRotation(), t.getScale());
+	(*this) = Mat4(t.getOrigin(), t.getRotation(), t.getScale());
 }
 
 
@@ -217,10 +216,10 @@ inline Mat4& Mat4::operator=(const Mat4& b)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] = b[i];
+			(*this)[i] = b[i];
 		}
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // +
@@ -235,7 +234,7 @@ inline Mat4 Mat4::operator+(const Mat4& b) const
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			c[i] = SELF[i] + b[i];
+			c[i] = (*this)[i] + b[i];
 		}
 	#endif
 	return c;
@@ -252,10 +251,10 @@ inline Mat4& Mat4::operator+=(const Mat4& b)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] += b[i];
+			(*this)[i] += b[i];
 		}
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // -
@@ -270,7 +269,7 @@ inline Mat4 Mat4::operator-(const Mat4& b) const
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			c[i] = SELF[i] - b[i];
+			c[i] = (*this)[i] - b[i];
 		}
 	#endif
 	return c;
@@ -287,10 +286,10 @@ inline Mat4& Mat4::operator-=(const Mat4& b)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] -= b[i];
+			(*this)[i] -= b[i];
 		}
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // *
@@ -312,7 +311,8 @@ inline Mat4 Mat4::operator*(const Mat4& b) const
 		{
 			for(int j = 0; j < 4; j++)
 			{
-				c(i, j) = SELF(i, 0) * b(0, j) + SELF(i, 1) * b(1, j) + SELF(i, 2) * b(2, j) + SELF(i, 3) * b(3, j);
+				c(i, j) = (*this)(i, 0) * b(0, j) + (*this)(i, 1) * b(1, j) +
+					(*this)(i, 2) * b(2, j) + (*this)(i, 3) * b(3, j);
 			}
 		}
 	#endif
@@ -322,8 +322,8 @@ inline Mat4 Mat4::operator*(const Mat4& b) const
 // *=
 inline Mat4& Mat4::operator*=(const Mat4& b)
 {
-	SELF = SELF * b;
-	return SELF;
+	(*this) = (*this) * b;
+	return (*this);
 }
 
 // ==
@@ -331,7 +331,7 @@ inline bool Mat4::operator==(const Mat4& b) const
 {
 	for(int i = 0; i < 16; i++)
 	{
-		if(!isZero(SELF[i] - b[i]))
+		if(!isZero((*this)[i] - b[i]))
 		{
 			return false;
 		}
@@ -344,7 +344,7 @@ inline bool Mat4::operator!=(const Mat4& b) const
 {
 	for(int i = 0; i < 16; i++)
 	{
-		if(!isZero(SELF[i]-b[i]))
+		if(!isZero((*this)[i]-b[i]))
 		{
 			return true;
 		}
@@ -370,7 +370,7 @@ inline Mat4 Mat4::operator+(float f) const
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			c[i] = SELF[i] + f;
+			c[i] = (*this)[i] + f;
 		}
 	#endif
 	return c;
@@ -395,10 +395,10 @@ inline Mat4& Mat4::operator+=(float f)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] += f;
+			(*this)[i] += f;
 		}
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // 4x4 - float
@@ -415,7 +415,7 @@ inline Mat4 Mat4::operator-(float f) const
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			r[i] = SELF[i] - f;
+			r[i] = (*this)[i] - f;
 		}
 	#endif
 	return r;
@@ -454,10 +454,10 @@ inline Mat4& Mat4::operator-=(float f)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] -= f;
+			(*this)[i] -= f;
 		}
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // 4x4 * float
@@ -474,7 +474,7 @@ inline Mat4 Mat4::operator*(float f) const
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			r[i] = SELF[i] * f;
+			r[i] = (*this)[i] * f;
 		}
 	#endif
 	return r;
@@ -499,10 +499,10 @@ inline Mat4& Mat4::operator*=(float f)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] *= f;
+			(*this)[i] *= f;
 		}
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // 4x4 / float
@@ -519,7 +519,7 @@ inline Mat4 Mat4::operator/(float f) const
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			r[i] = SELF[i] / f;
+			r[i] = (*this)[i] / f;
 		}
 	#endif
 	return r;
@@ -558,10 +558,10 @@ inline Mat4& Mat4::operator/=(float f)
 	#else
 		for(int i = 0; i < 16; i++)
 		{
-			SELF[i] /= f;
+			(*this)[i] /= f;
 		}
 	#endif
-	return SELF;
+	return (*this);
 }
 
 
@@ -580,10 +580,14 @@ inline Vec4 Mat4::operator*(const Vec4& b) const
 		}
 		return v;
 	#else
-		return Vec4(SELF(0, 0) * b.x() + SELF(0, 1) * b.y() + SELF(0, 2) * b.z() + SELF(0, 3) * b.w(),
-		            SELF(1, 0) * b.x() + SELF(1, 1) * b.y() + SELF(1, 2) * b.z() + SELF(1, 3) * b.w(),
-		            SELF(2, 0) * b.x() + SELF(2, 1) * b.y() + SELF(2, 2) * b.z() + SELF(2, 3) * b.w(),
-		            SELF(3, 0) * b.x() + SELF(3, 1) * b.y() + SELF(3, 2) * b.z() + SELF(3, 3) * b.w());
+		return Vec4((*this)(0, 0) * b.x() + (*this)(0, 1) * b.y() +
+			(*this)(0, 2) * b.z() + (*this)(0, 3) * b.w(),
+			(*this)(1, 0) * b.x() + (*this)(1, 1) * b.y() +
+			(*this)(1, 2) * b.z() + (*this)(1, 3) * b.w(),
+			(*this)(2, 0) * b.x() + (*this)(2, 1) * b.y() +
+			(*this)(2, 2) * b.z() + (*this)(2, 3) * b.w(),
+			(*this)(3, 0) * b.x() + (*this)(3, 1) * b.y() +
+			(*this)(3, 2) * b.z() + (*this)(3, 3) * b.w());
 	#endif
 }
 
@@ -593,7 +597,8 @@ inline Vec4 Mat4::operator*(const Vec4& b) const
 //==============================================================================
 
 // setRows
-inline void Mat4::setRows(const Vec4& a, const Vec4& b, const Vec4& c, const Vec4& d)
+inline void Mat4::setRows(const Vec4& a, const Vec4& b, const Vec4& c,
+	const Vec4& d)
 {
 	#if defined(MATH_INTEL_SIMD)
 		arrMm[0] = a.getMm();
@@ -601,22 +606,22 @@ inline void Mat4::setRows(const Vec4& a, const Vec4& b, const Vec4& c, const Vec
 		arrMm[2] = c.getMm();
 		arrMm[3] = d.getMm();
 	#else
-		SELF(0, 0) = a.x();
-		SELF(0, 1) = a.y();
-		SELF(0, 2) = a.z();
-		SELF(0, 3) = a.w();
-		SELF(1, 0) = b.x();
-		SELF(1, 1) = b.y();
-		SELF(1, 2) = b.z();
-		SELF(1, 3) = b.w();
-		SELF(2, 0) = c.x();
-		SELF(2, 1) = c.y();
-		SELF(2, 2) = c.z();
-		SELF(2, 3) = c.w();
-		SELF(3, 0) = d.x();
-		SELF(3, 1) = d.y();
-		SELF(3, 2) = d.z();
-		SELF(3, 3) = d.w();
+		(*this)(0, 0) = a.x();
+		(*this)(0, 1) = a.y();
+		(*this)(0, 2) = a.z();
+		(*this)(0, 3) = a.w();
+		(*this)(1, 0) = b.x();
+		(*this)(1, 1) = b.y();
+		(*this)(1, 2) = b.z();
+		(*this)(1, 3) = b.w();
+		(*this)(2, 0) = c.x();
+		(*this)(2, 1) = c.y();
+		(*this)(2, 2) = c.z();
+		(*this)(2, 3) = c.w();
+		(*this)(3, 0) = d.x();
+		(*this)(3, 1) = d.y();
+		(*this)(3, 2) = d.z();
+		(*this)(3, 3) = d.w();
 	#endif
 }
 
@@ -626,41 +631,42 @@ inline void Mat4::setRow(uint i, const Vec4& v)
 	#if defined(MATH_INTEL_SIMD)
 		arrMm[i] = v.getMm();
 	#else
-		SELF(i, 0) = v.x();
-		SELF(i, 1) = v.y();
-		SELF(i, 2) = v.z();
-		SELF(i, 3) = v.w();
+		(*this)(i, 0) = v.x();
+		(*this)(i, 1) = v.y();
+		(*this)(i, 2) = v.z();
+		(*this)(i, 3) = v.w();
 	#endif
 }
 
 // setColumns
-inline void Mat4::setColumns(const Vec4& a, const Vec4& b, const Vec4& c, const Vec4& d)
+inline void Mat4::setColumns(const Vec4& a, const Vec4& b, const Vec4& c,
+	const Vec4& d)
 {
-	SELF(0, 0) = a.x();
-	SELF(1, 0) = a.y();
-	SELF(2, 0) = a.z();
-	SELF(3, 0) = a.w();
-	SELF(0, 1) = b.x();
-	SELF(1, 1) = b.y();
-	SELF(2, 1) = b.z();
-	SELF(3, 1) = b.w();
-	SELF(0, 2) = c.x();
-	SELF(1, 2) = c.y();
-	SELF(2, 2) = c.z();
-	SELF(3, 2) = c.w();
-	SELF(0, 3) = d.x();
-	SELF(1, 3) = d.y();
-	SELF(2, 3) = d.z();
-	SELF(3, 3) = d.w();
+	(*this)(0, 0) = a.x();
+	(*this)(1, 0) = a.y();
+	(*this)(2, 0) = a.z();
+	(*this)(3, 0) = a.w();
+	(*this)(0, 1) = b.x();
+	(*this)(1, 1) = b.y();
+	(*this)(2, 1) = b.z();
+	(*this)(3, 1) = b.w();
+	(*this)(0, 2) = c.x();
+	(*this)(1, 2) = c.y();
+	(*this)(2, 2) = c.z();
+	(*this)(3, 2) = c.w();
+	(*this)(0, 3) = d.x();
+	(*this)(1, 3) = d.y();
+	(*this)(2, 3) = d.z();
+	(*this)(3, 3) = d.w();
 }
 
 // setColumn
 inline void Mat4::setColumn(uint i, const Vec4& v)
 {
-	SELF(0, i) = v.x();
-	SELF(1, i) = v.y();
-	SELF(2, i) = v.z();
-	SELF(3, i) = v.w();
+	(*this)(0, i) = v.x();
+	(*this)(1, i) = v.y();
+	(*this)(2, i) = v.z();
+	(*this)(3, i) = v.w();
 }
 
 // transpose
@@ -669,24 +675,24 @@ inline void Mat4::transpose()
 	#if defined(MATH_INTEL_SIMD)
 		_MM_TRANSPOSE4_PS(arrMm[0], arrMm[1], arrMm[2], arrMm[3]);
 	#else
-		float tmp = SELF(0, 1);
-		SELF(0, 1) = SELF(1, 0);
-		SELF(1, 0) = tmp;
-		tmp = SELF(0, 2);
-		SELF(0, 2) = SELF(2, 0);
-		SELF(2, 0) = tmp;
-		tmp = SELF(0, 3);
-		SELF(0, 3) = SELF(3, 0);
-		SELF(3, 0) = tmp;
-		tmp = SELF(1, 2);
-		SELF(1, 2) = SELF(2, 1);
-		SELF(2, 1) = tmp;
-		tmp = SELF(1, 3);
-		SELF(1, 3) = SELF(3, 1);
-		SELF(3, 1) = tmp;
-		tmp = SELF(2, 3);
-		SELF(2, 3) = SELF(3, 2);
-		SELF(3, 2) = tmp;
+		float tmp = (*this)(0, 1);
+		(*this)(0, 1) = (*this)(1, 0);
+		(*this)(1, 0) = tmp;
+		tmp = (*this)(0, 2);
+		(*this)(0, 2) = (*this)(2, 0);
+		(*this)(2, 0) = tmp;
+		tmp = (*this)(0, 3);
+		(*this)(0, 3) = (*this)(3, 0);
+		(*this)(3, 0) = tmp;
+		tmp = (*this)(1, 2);
+		(*this)(1, 2) = (*this)(2, 1);
+		(*this)(2, 1) = tmp;
+		tmp = (*this)(1, 3);
+		(*this)(1, 3) = (*this)(3, 1);
+		(*this)(3, 1) = tmp;
+		tmp = (*this)(2, 3);
+		(*this)(2, 3) = (*this)(3, 2);
+		(*this)(3, 2) = tmp;
 	#endif
 }
 
@@ -694,82 +700,83 @@ inline void Mat4::transpose()
 inline Mat4 Mat4::getTransposed() const
 {
 	Mat4 m4;
-	m4[0] = SELF[0];
-	m4[1] = SELF[4];
-	m4[2] = SELF[8];
-	m4[3] = SELF[12];
-	m4[4] = SELF[1];
-	m4[5] = SELF[5];
-	m4[6] = SELF[9];
-	m4[7] = SELF[13];
-	m4[8] = SELF[2];
-	m4[9] = SELF[6];
-	m4[10] = SELF[10];
-	m4[11] = SELF[14];
-	m4[12] = SELF[3];
-	m4[13] = SELF[7];
-	m4[14] = SELF[11];
-	m4[15] = SELF[15];
+	m4[0] = (*this)[0];
+	m4[1] = (*this)[4];
+	m4[2] = (*this)[8];
+	m4[3] = (*this)[12];
+	m4[4] = (*this)[1];
+	m4[5] = (*this)[5];
+	m4[6] = (*this)[9];
+	m4[7] = (*this)[13];
+	m4[8] = (*this)[2];
+	m4[9] = (*this)[6];
+	m4[10] = (*this)[10];
+	m4[11] = (*this)[14];
+	m4[12] = (*this)[3];
+	m4[13] = (*this)[7];
+	m4[14] = (*this)[11];
+	m4[15] = (*this)[15];
 	return m4;
 }
 
 // setRotationPart
 inline void Mat4::setRotationPart(const Mat3& m3)
 {
-	SELF(0, 0) = m3(0, 0);
-	SELF(0, 1) = m3(0, 1);
-	SELF(0, 2) = m3(0, 2);
-	SELF(1, 0) = m3(1, 0);
-	SELF(1, 1) = m3(1, 1);
-	SELF(1, 2) = m3(1, 2);
-	SELF(2, 0) = m3(2, 0);
-	SELF(2, 1) = m3(2, 1);
-	SELF(2, 2) = m3(2, 2);
+	(*this)(0, 0) = m3(0, 0);
+	(*this)(0, 1) = m3(0, 1);
+	(*this)(0, 2) = m3(0, 2);
+	(*this)(1, 0) = m3(1, 0);
+	(*this)(1, 1) = m3(1, 1);
+	(*this)(1, 2) = m3(1, 2);
+	(*this)(2, 0) = m3(2, 0);
+	(*this)(2, 1) = m3(2, 1);
+	(*this)(2, 2) = m3(2, 2);
 }
 
 // getRotationPart
 inline Mat3 Mat4::getRotationPart() const
 {
 	Mat3 m3;
-	m3(0, 0) = SELF(0, 0);
-	m3(0, 1) = SELF(0, 1);
-	m3(0, 2) = SELF(0, 2);
-	m3(1, 0) = SELF(1, 0);
-	m3(1, 1) = SELF(1, 1);
-	m3(1, 2) = SELF(1, 2);
-	m3(2, 0) = SELF(2, 0);
-	m3(2, 1) = SELF(2, 1);
-	m3(2, 2) = SELF(2, 2);
+	m3(0, 0) = (*this)(0, 0);
+	m3(0, 1) = (*this)(0, 1);
+	m3(0, 2) = (*this)(0, 2);
+	m3(1, 0) = (*this)(1, 0);
+	m3(1, 1) = (*this)(1, 1);
+	m3(1, 2) = (*this)(1, 2);
+	m3(2, 0) = (*this)(2, 0);
+	m3(2, 1) = (*this)(2, 1);
+	m3(2, 2) = (*this)(2, 2);
 	return m3;
 }
 
 // setTranslationPart
 inline void Mat4::setTranslationPart(const Vec4& v)
 {
-	SELF(0, 3) = v.x();
-	SELF(1, 3) = v.y();
-	SELF(2, 3) = v.z();
-	SELF(3, 3) = v.w();
+	(*this)(0, 3) = v.x();
+	(*this)(1, 3) = v.y();
+	(*this)(2, 3) = v.z();
+	(*this)(3, 3) = v.w();
 }
 
 // setTranslationPart
 inline void Mat4::setTranslationPart(const Vec3& v)
 {
-	SELF(0, 3) = v.x();
-	SELF(1, 3) = v.y();
-	SELF(2, 3) = v.z();
+	(*this)(0, 3) = v.x();
+	(*this)(1, 3) = v.y();
+	(*this)(2, 3) = v.z();
 }
 
 // getTranslationPart
 inline Vec3 Mat4::getTranslationPart() const
 {
-	return Vec3(SELF(0, 3), SELF(1, 3), SELF(2, 3));
+	return Vec3((*this)(0, 3), (*this)(1, 3), (*this)(2, 3));
 }
 
 // getIdentity
 inline const Mat4& Mat4::getIdentity()
 {
-	static Mat4 ident(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
+	static Mat4 ident(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
+		0.0, 0.0, 0.0, 0.0, 1.0);
 	return ident;
 }
 
@@ -783,19 +790,31 @@ inline const Mat4& Mat4::getZero()
 // Determinant
 inline float Mat4::getDet() const
 {
-	return
-	SELF(0, 3) * SELF(1, 2) * SELF(2, 1) * SELF(3, 0) - SELF(0, 2) * SELF(1, 3) * SELF(2, 1) * SELF(3, 0) -
-	SELF(0, 3) * SELF(1, 1) * SELF(2, 2) * SELF(3, 0) + SELF(0, 1) * SELF(1, 3) * SELF(2, 2) * SELF(3, 0) +
-	SELF(0, 2) * SELF(1, 1) * SELF(2, 3) * SELF(3, 0) - SELF(0, 1) * SELF(1, 2) * SELF(2, 3) * SELF(3, 0) -
-	SELF(0, 3) * SELF(1, 2) * SELF(2, 0) * SELF(3, 1) + SELF(0, 2) * SELF(1, 3) * SELF(2, 0) * SELF(3, 1) +
-	SELF(0, 3) * SELF(1, 0) * SELF(2, 2) * SELF(3, 1) - SELF(0, 0) * SELF(1, 3) * SELF(2, 2) * SELF(3, 1) -
-	SELF(0, 2) * SELF(1, 0) * SELF(2, 3) * SELF(3, 1) + SELF(0, 0) * SELF(1, 2) * SELF(2, 3) * SELF(3, 1) +
-	SELF(0, 3) * SELF(1, 1) * SELF(2, 0) * SELF(3, 2) - SELF(0, 1) * SELF(1, 3) * SELF(2, 0) * SELF(3, 2) -
-	SELF(0, 3) * SELF(1, 0) * SELF(2, 1) * SELF(3, 2) + SELF(0, 0) * SELF(1, 3) * SELF(2, 1) * SELF(3, 2) +
-	SELF(0, 1) * SELF(1, 0) * SELF(2, 3) * SELF(3, 2) - SELF(0, 0) * SELF(1, 1) * SELF(2, 3) * SELF(3, 2) -
-	SELF(0, 2) * SELF(1, 1) * SELF(2, 0) * SELF(3, 3) + SELF(0, 1) * SELF(1, 2) * SELF(2, 0) * SELF(3, 3) +
-	SELF(0, 2) * SELF(1, 0) * SELF(2, 1) * SELF(3, 3) - SELF(0, 0) * SELF(1, 2) * SELF(2, 1) * SELF(3, 3) -
-	SELF(0, 1) * SELF(1, 0) * SELF(2, 2) * SELF(3, 3) + SELF(0, 0) * SELF(1, 1) * SELF(2, 2) * SELF(3, 3);
+	const Mat4& t = *this;
+	return t(0, 3) * t(1, 2) * t(2, 1) * t(3, 0) -
+		t(0, 2) * t(1, 3) * t(2, 1) * t(3, 0) -
+		t(0, 3) * t(1, 1) * t(2, 2) * t(3, 0) +
+		t(0, 1) * t(1, 3) * t(2, 2) * t(3, 0) +
+		t(0, 2) * t(1, 1) * t(2, 3) * t(3, 0) -
+		t(0, 1) * t(1, 2) * t(2, 3) * t(3, 0) -
+		t(0, 3) * t(1, 2) * t(2, 0) * t(3, 1) +
+		t(0, 2) * t(1, 3) * t(2, 0) * t(3, 1) +
+		t(0, 3) * t(1, 0) * t(2, 2) * t(3, 1) -
+		t(0, 0) * t(1, 3) * t(2, 2) * t(3, 1) -
+		t(0, 2) * t(1, 0) * t(2, 3) * t(3, 1) +
+		t(0, 0) * t(1, 2) * t(2, 3) * t(3, 1) +
+		t(0, 3) * t(1, 1) * t(2, 0) * t(3, 2) -
+		t(0, 1) * t(1, 3) * t(2, 0) * t(3, 2) -
+		t(0, 3) * t(1, 0) * t(2, 1) * t(3, 2) +
+		t(0, 0) * t(1, 3) * t(2, 1) * t(3, 2) +
+		t(0, 1) * t(1, 0) * t(2, 3) * t(3, 2) -
+		t(0, 0) * t(1, 1) * t(2, 3) * t(3, 2) -
+		t(0, 2) * t(1, 1) * t(2, 0) * t(3, 3) +
+		t(0, 1) * t(1, 2) * t(2, 0) * t(3, 3) +
+		t(0, 2) * t(1, 0) * t(2, 1) * t(3, 3) -
+		t(0, 0) * t(1, 2) * t(2, 1) * t(3, 3) -
+		t(0, 1) * t(1, 0) * t(2, 2) * t(3, 3) +
+		t(0, 0) * t(1, 1) * t(2, 2) * t(3, 3);
 }
 
 // getInverse
@@ -803,7 +822,7 @@ inline Mat4 Mat4::getInverse() const
 {
 	/// @todo test this
 	/*#if !defined(MATH_INTEL_SIMD)
-		Mat4 r(SELF);
+		Mat4 r((*this));
 		__m128 minor0, minor1, minor2, minor3;
 		__m128 det, tmp1;
 
@@ -829,7 +848,8 @@ inline Mat4 Mat4::getInverse() const
 		minor3 = _mm_sub_ps(_mm_mul_ps(r.arrMm[0], tmp1), minor3);
 		minor3 = _mm_shuffle_ps(minor3, minor3, 0x4E);
 
-		tmp1 = _mm_mul_ps(_mm_shuffle_ps(r.arrMm[1], r.arrMm[1], 0x4E), r.arrMm[3]);
+		tmp1 = _mm_mul_ps(_mm_shuffle_ps(r.arrMm[1], r.arrMm[1], 0x4E),
+			r.arrMm[3]);
 		tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1);
 		r.arrMm[2] = _mm_shuffle_ps(r.arrMm[2], r.arrMm[2], 0x4E);
 		minor0 = _mm_add_ps(_mm_mul_ps(r.arrMm[2], tmp1), minor0);
@@ -868,7 +888,8 @@ inline Mat4 Mat4::getInverse() const
 		det = _mm_add_ps(_mm_shuffle_ps(det, det, 0x4E), det);
 		det = _mm_add_ss(_mm_shuffle_ps(det, det, 0xB1), det);
 		tmp1 = _mm_rcp_ss(det);
-		det = _mm_sub_ss(_mm_add_ss(tmp1, tmp1), _mm_mul_ss(det, _mm_mul_ss(tmp1, tmp1)));
+		det = _mm_sub_ss(_mm_add_ss(tmp1, tmp1),
+			_mm_mul_ss(det, _mm_mul_ss(tmp1, tmp1)));
 		det = _mm_shuffle_ps(det, det, 0x00);
 
 		// Mul and store
@@ -885,7 +906,7 @@ inline Mat4 Mat4::getInverse() const
 	#else*/
 		float tmp[12];
 		float det;
-		const Mat4& in = SELF;
+		const Mat4& in = (*this);
 		Mat4 m4;
 
 		tmp[0] = in(2, 2) * in(3, 3);
@@ -948,7 +969,8 @@ inline Mat4 Mat4::getInverse() const
 		m4(3, 3) = tmp[10] * in(2, 2) + tmp[4] * in(0, 2) + tmp[9] * in(1, 2);
 		m4(3, 3)-= tmp[8] * in(1, 2) + tmp[11] * in(2, 2) + tmp[5] * in(0, 2);
 
-		det = SELF(0, 0) * m4(0, 0) + SELF(1, 0) * m4(0, 1) + SELF(2, 0) * m4(0, 2) + SELF(3, 0) * m4(0, 3);
+		det = (*this)(0, 0) * m4(0, 0) + (*this)(1, 0) * m4(0, 1) +
+			(*this)(2, 0) * m4(0, 2) + (*this)(3, 0) * m4(0, 3);
 
 		ASSERT(!isZero(det)); // Cannot invert, det == 0
 		det = 1.0 / det;
@@ -960,7 +982,7 @@ inline Mat4 Mat4::getInverse() const
 // invert
 inline void Mat4::invert()
 {
-	SELF = getInverse();
+	(*this) = getInverse();
 }
 
 
@@ -976,13 +998,13 @@ inline Mat4 Mat4::getInverseTransformation() const
 // lerp
 inline Mat4 Mat4::lerp(const Mat4& b, float t) const
 {
-	return (SELF * (1.0 - t)) + (b * t);
+	return ((*this) * (1.0 - t)) + (b * t);
 }
 
 // setIdentity
 inline void Mat4::setIdentity()
 {
-	SELF = getIdentity();
+	(*this) = getIdentity();
 }
 
 // combineTransformations
@@ -990,13 +1012,17 @@ inline Mat4 Mat4::combineTransformations(const Mat4& m0, const Mat4& m1)
 {
 	/*
 	The clean code is:
-	Mat3 rot = m0.getRotationPart() * m1.getRotationPart();  // combine the rotations
-	Vec3 tra = (m1.getTranslationPart()).Transformed(m0.getTranslationPart(), m0.getRotationPart(), 1.0);
+	Mat3 rot = m0.getRotationPart() * m1.getRotationPart(); // combine the
+	                                                        // rotations
+	Vec3 tra = (m1.getTranslationPart()).Transformed(m0.getTranslationPart(),
+		m0.getRotationPart(), 1.0);
 	return Mat4(tra, rot);
 	and the optimized:
 	*/
+
+	// one of the 2 mat4 doesnt represent transformation
 	ASSERT(isZero(m0(3, 0) + m0(3, 1) + m0(3, 2) + m0(3, 3)-1.0) &&
-	       isZero(m1(3, 0) + m1(3, 1) + m1(3, 2) + m1(3, 3)-1.0)); // one of the 2 mat4 doesnt represent transformation
+		isZero(m1(3, 0) + m1(3, 1) + m1(3, 2) + m1(3, 3)-1.0));
 
 	Mat4 m4;
 
@@ -1010,9 +1036,14 @@ inline Mat4 Mat4::combineTransformations(const Mat4& m0, const Mat4& m1)
 	m4(2, 1) = m0(2, 0) * m1(0, 1) + m0(2, 1) * m1(1, 1) + m0(2, 2) * m1(2, 1);
 	m4(2, 2) = m0(2, 0) * m1(0, 2) + m0(2, 1) * m1(1, 2) + m0(2, 2) * m1(2, 2);
 
-	m4(0, 3) = m0(0, 0) * m1(0, 3) + m0(0, 1) * m1(1, 3) + m0(0, 2) * m1(2, 3) + m0(0, 3);
-	m4(1, 3) = m0(1, 0) * m1(0, 3) + m0(1, 1) * m1(1, 3) + m0(1, 2) * m1(2, 3) + m0(1, 3);
-	m4(2, 3) = m0(2, 0) * m1(0, 3) + m0(2, 1) * m1(1, 3) + m0(2, 2) * m1(2, 3) + m0(2, 3);
+	m4(0, 3) = m0(0, 0) * m1(0, 3) + m0(0, 1) * m1(1, 3) +
+		m0(0, 2) * m1(2, 3) + m0(0, 3);
+
+	m4(1, 3) = m0(1, 0) * m1(0, 3) + m0(1, 1) * m1(1, 3) +
+		m0(1, 2) * m1(2, 3) + m0(1, 3);
+
+	m4(2, 3) = m0(2, 0) * m1(0, 3) + m0(2, 1) * m1(1, 3) +
+		m0(2, 2) * m1(2, 3) + m0(2, 3);
 
 	m4(3, 0) = m4(3, 1) = m4(3, 2) = 0.0;
 	m4(3, 3) = 1.0;

+ 7 - 4
src/Math/Quat.h

@@ -1,5 +1,5 @@
-#ifndef QUAT_H
-#define QUAT_H
+#ifndef M_QUAT_H
+#define M_QUAT_H
 
 #include "Common.h"
 
@@ -48,7 +48,9 @@ class Quat
 
 		/// @name Other
 		/// @{
-		void  setFrom2Vec3(const Vec3& v0, const Vec3& v1); ///< calculates a quat from v0 to v1
+
+		/// Calculates a quat from v0 to v1
+		void  setFrom2Vec3(const Vec3& v0, const Vec3& v1);
 		float getLength() const;
 		Quat  getInverted() const;
 		void  invert();
@@ -57,7 +59,8 @@ class Quat
 		void  normalize();
 		Quat  getNormalized() const;
 		float dot(const Quat& b) const;
-		Quat  slerp(const Quat& q1, float t) const; ///< returns slerp(this, q1, t)
+		/// Returns slerp(this, q1, t)
+		Quat  slerp(const Quat& q1, float t) const;
 		Quat  getRotated(const Quat& b) const; ///< The same as Quat * Quat
 		void  rotate(const Quat& b); ///< @see getRotated
 		void  setIdentity();

+ 22 - 21
src/Math/Quat.inl.h

@@ -1,8 +1,6 @@
 #include "Common.inl.h"
 
 
-#define ME (*this)
-
 namespace M {
 
 
@@ -134,7 +132,7 @@ inline Quat::Quat(const Axisang& axisang)
 	float lengthsq = axisang.getAxis().getLengthSquared();
 	if(isZero(lengthsq))
 	{
-		ME = getIdentity();
+		(*this) = getIdentity();
 		return;
 	}
 
@@ -209,16 +207,15 @@ inline Quat& Quat::operator=(const Quat& b)
 	y() = b.y();
 	z() = b.z();
 	w() = b.w();
-	return SELF;
+	return *this;
 }
 
 // *
 inline Quat Quat::operator *(const Quat& b) const
 {
-	return Quat(
-		 x() * b.w() + y() * b.z() - z() * b.y() + w() * b.x(),
+	return Quat(x() * b.w() + y() * b.z() - z() * b.y() + w() * b.x(),
 		-x() * b.z() + y() * b.w() + z() * b.x() + w() * b.y(),
-		 x() * b.y() - y() * b.x() + z() * b.w() + w() * b.z(),
+		x() * b.y() - y() * b.x() + z() * b.w() + w() * b.z(),
 		-x() * b.x() - y() * b.y() - z() * b.z() + w() * b.w()
 	);
 }
@@ -226,20 +223,22 @@ inline Quat Quat::operator *(const Quat& b) const
 // *=
 inline Quat& Quat::operator *=(const Quat& b)
 {
-	ME = ME * b;
-	return ME;
+	(*this) = (*this) * b;
+	return (*this);
 }
 
 // ==
 inline bool Quat::operator ==(const Quat& b) const
 {
-	return isZero(x() - b.x()) && isZero(y() - b.y()) && isZero(z() - b.z()) && isZero(w() - b.w());
+	return isZero(x() - b.x()) && isZero(y() - b.y()) && isZero(z() - b.z()) &&
+		isZero(w() - b.w());
 }
 
 // !=
 inline bool Quat::operator !=(const Quat& b) const
 {
-	return !(isZero(x() - b.x()) && isZero(y() - b.y()) && isZero(z() - b.z()) && isZero(w() - b.w()));
+	return !(isZero(x() - b.x()) && isZero(y() - b.y()) &&
+		isZero(z() - b.z()) && isZero(w() - b.w()));
 }
 
 
@@ -264,13 +263,13 @@ inline Quat Quat::getConjugated() const
 // Normalized
 inline Quat Quat::getNormalized() const
 {
-	return Quat(Vec4(ME).getNormalized());
+	return Quat(Vec4((*this)).getNormalized());
 }
 
 // normalize
 inline void Quat::normalize()
 {
-	ME = getNormalized();
+	(*this) = getNormalized();
 }
 
 // getLength
@@ -294,14 +293,14 @@ inline Quat Quat::getInverted() const
 // invert
 inline void Quat::invert()
 {
-	ME = getInverted();
+	(*this) = getInverted();
 }
 
 // CalcFromVecVec
 inline void Quat::setFrom2Vec3(const Vec3& from, const Vec3& to)
 {
 	Vec3 axis(from.cross(to));
-	ME = Quat(axis.x(), axis.y(), axis.z(), from.dot(to));
+	(*this) = Quat(axis.x(), axis.y(), axis.z(), from.dot(to));
 	normalize();
 	w() += 1.0;
 
@@ -309,11 +308,11 @@ inline void Quat::setFrom2Vec3(const Vec3& from, const Vec3& to)
 	{
 		if(from.z() * from.z() > from.x() * from.x())
 		{
-			ME = Quat(0.0, from.z(), -from.y(), 0.0);
+			(*this) = Quat(0.0, from.z(), -from.y(), 0.0);
 		}
 		else
 		{
-			ME = Quat(from.y(), -from.x(), 0.0, 0.0);
+			(*this) = Quat(from.y(), -from.x(), 0.0, 0.0);
 		}
 	}
 	normalize();
@@ -322,13 +321,13 @@ inline void Quat::setFrom2Vec3(const Vec3& from, const Vec3& to)
 // getRotated
 inline Quat Quat::getRotated(const Quat& b) const
 {
-	return ME * b;
+	return (*this) * b;
 }
 
 // rotate
 inline void Quat::rotate(const Quat& b)
 {
-	ME = getRotated(b);
+	(*this) = getRotated(b);
 }
 
 // dot
@@ -340,9 +339,10 @@ inline float Quat::dot(const Quat& b) const
 // SLERP
 inline Quat Quat::slerp(const Quat& q1_, float t) const
 {
-	const Quat& q0 = ME;
+	const Quat& q0 = (*this);
 	Quat q1(q1_);
-	float cosHalfTheta = q0.w() * q1.w() + q0.x() * q1.x() + q0.y() * q1.y() + q0.z() * q1.z();
+	float cosHalfTheta = q0.w() * q1.w() + q0.x() * q1.x() + q0.y() * q1.y() +
+		q0.z() * q1.z();
 	if(cosHalfTheta < 0.0)
 	{
 		q1 = Quat(-Vec4(q1)); // quat changes
@@ -391,4 +391,5 @@ inline std::ostream& operator<<(std::ostream& s, const Quat& q)
 	return s;
 }
 
+
 } // end namespace

+ 6 - 4
src/Math/Transform.h

@@ -1,5 +1,5 @@
-#ifndef TRANSFORM_H
-#define TRANSFORM_H
+#ifndef M_TRANSFORM_H
+#define M_TRANSFORM_H
 
 #include "Common.h"
 
@@ -16,7 +16,8 @@ class Transform
 		explicit Transform();
 		         Transform(const Transform& b);
 		explicit Transform(const Mat4& m4);
-		explicit Transform(const Vec3& origin, const Mat3& rotation_, float scale_);
+		explicit Transform(const Vec3& origin, const Mat3& rotation_,
+			float scale_);
 		/// @}
 
 		/// @name Accessors
@@ -43,7 +44,8 @@ class Transform
 		/// @{
 		void setIdentity();
 		static const Transform& getIdentity();
-		static Transform combineTransformations(const Transform& a, const Transform& b); ///< @see M::combineTransformations
+		static Transform combineTransformations(const Transform& a,
+			const Transform& b); ///< @see M::combineTransformations
 		/// @}
 		
 	private:

+ 12 - 7
src/Math/Transform.inl.h

@@ -16,8 +16,8 @@ inline Transform::Transform()
 {}
 
 // Copy
-inline Transform::Transform(const Transform& b):
-	origin(b.origin),
+inline Transform::Transform(const Transform& b)
+:	origin(b.origin),
 	rotation(b.rotation),
 	scale(b.scale)
 {}
@@ -31,8 +31,9 @@ inline Transform::Transform(const Mat4& m4)
 }
 
 // Vec3, Quat, float
-inline Transform::Transform(const Vec3& origin, const Mat3& rotation_, float scale_):
-	origin(origin),
+inline Transform::Transform(const Vec3& origin, const Mat3& rotation_,
+	float scale_)
+:	origin(origin),
 	rotation(rotation_),
 	scale(scale_)
 {}
@@ -120,11 +121,15 @@ inline const Transform& Transform::getIdentity()
 }
 
 // combineTransformations
-inline Transform Transform::combineTransformations(const Transform& a, const Transform& b)
+inline Transform Transform::combineTransformations(const Transform& a,
+	const Transform& b)
 {
 	Transform out;
-	M::combineTransformations(a.origin, a.rotation, a.scale, b.origin, b.rotation, b.scale,
-	                          out.origin, out.rotation, out.scale);
+
+	M::combineTransformations(a.origin, a.rotation, a.scale,
+		b.origin, b.rotation, b.scale,
+		out.origin, out.rotation, out.scale);
+
 	return out;
 }
 

+ 2 - 2
src/Math/Vec2.h

@@ -1,5 +1,5 @@
-#ifndef VEC2_H
-#define VEC2_H
+#ifndef M_VEC2_H
+#define M_VEC2_H
 
 #include "Common.h"
 

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

@@ -1,9 +1,6 @@
 #include "Common.inl.h"
 
 
-#define ME (*this)
-
-
 namespace M {
 
 
@@ -103,7 +100,7 @@ inline Vec2& Vec2::operator=(const Vec2& b)
 {
 	x() = b.x();
 	y() = b.y();
-	return SELF;
+	return *this;
 }
 
 // +
@@ -117,7 +114,7 @@ inline Vec2& Vec2::operator+=(const Vec2& b)
 {
 	x() += b.x();
 	y() += b.y();
-	return ME;
+	return (*this);
 }
 
 // -
@@ -131,7 +128,7 @@ inline Vec2& Vec2::operator-=(const Vec2& b)
 {
 	x() -= b.x();
 	y() -= b.y();
-	return ME;
+	return (*this);
 }
 
 // *
@@ -145,7 +142,7 @@ inline Vec2& Vec2::operator*=(const Vec2& b)
 {
 	x() *= b.x();
 	y() *= b.y();
-	return ME;
+	return (*this);
 }
 
 // /
@@ -159,7 +156,7 @@ inline Vec2& Vec2::operator/=(const Vec2& b)
 {
 	x() /= b.x();
 	y() /= b.y();
-	return ME;
+	return (*this);
 }
 
 // negative
@@ -188,7 +185,7 @@ inline bool Vec2::operator!=(const Vec2& b) const
 // vec2 + float
 inline Vec2 Vec2::operator+(float f) const
 {
-	return ME + Vec2(f);
+	return (*this) + Vec2(f);
 }
 
 // float + vec2
@@ -200,14 +197,14 @@ inline Vec2 operator+(float f, const Vec2& v2)
 // vec2 += float
 inline Vec2& Vec2::operator+=(float f)
 {
-	ME += Vec2(f);
-	return ME;
+	(*this) += Vec2(f);
+	return (*this);
 }
 
 // vec2 - float
 inline Vec2 Vec2::operator-(float f) const
 {
-	return ME - Vec2(f);
+	return (*this) - Vec2(f);
 }
 
 // float - vec2
@@ -219,14 +216,14 @@ inline Vec2 operator-(float f, const Vec2& v2)
 // vec2 -= float
 inline Vec2& Vec2::operator-=(float f)
 {
-	ME -= Vec2(f);
-	return ME;
+	(*this) -= Vec2(f);
+	return (*this);
 }
 
 // vec2 * float
 inline Vec2 Vec2::operator*(float f) const
 {
-	return ME * Vec2(f);
+	return (*this) * Vec2(f);
 }
 
 // float * vec2
@@ -238,14 +235,14 @@ inline Vec2 operator*(float f, const Vec2& v2)
 // vec2 *= float
 inline Vec2& Vec2::operator*=(float f)
 {
-	ME *= Vec2(f);
-	return ME;
+	(*this) *= Vec2(f);
+	return (*this);
 }
 
 // vec2 / float
 inline Vec2 Vec2::operator/(float f) const
 {
-	return ME / Vec2(f);
+	return (*this) / Vec2(f);
 }
 
 // float / vec2
@@ -257,8 +254,8 @@ inline Vec2 operator/(float f, const Vec2& v2)
 // vec2 /= float
 inline Vec2& Vec2::operator/=(float f)
 {
-	ME /= Vec2(f);
-	return ME;
+	(*this) /= Vec2(f);
+	return (*this);
 }
 
 //==============================================================================
@@ -274,13 +271,13 @@ inline float Vec2::getLength() const
 // normalize
 inline void Vec2::normalize()
 {
-	ME /= getLength();
+	(*this) /= getLength();
 }
 
 // Normalized (return the normalized)
 inline Vec2 Vec2::getNormalized() const
 {
-	return ME / getLength();
+	return (*this) / getLength();
 }
 
 // dot

+ 12 - 8
src/Math/Vec3.h

@@ -1,5 +1,5 @@
-#ifndef VEC3_H
-#define VEC3_H
+#ifndef M_VEC3_H
+#define M_VEC3_H
 
 #include "Common.h"
 
@@ -78,20 +78,24 @@ class Vec3
 		void normalize();
 		Vec3 getNormalized() const;
 		Vec3 getProjection(const Vec3& toThis) const;
-		/// Returns q * this * q.Conjucated() aka returns a rotated this. 18 muls, 12 adds
+		/// Returns q * this * q.Conjucated() aka returns a rotated this.
+		/// 18 muls, 12 adds
 		Vec3 getRotated(const Quat& q) const;
 		void rotate(const Quat& q);
 		Vec3 lerp(const Vec3& v1, float t) const; ///< Return lerp(this, v1, t)
 		/// @}
 
 		/// @name Transformations
-		/// The faster way is by far the Mat4 * Vec3 or the getTransformed(Vec3, Mat3)
-		/**@{*/
-		Vec3 getTransformed(const Vec3& translate, const Mat3& rotate, float scale) const;
+		/// The faster way is by far the Mat4 * Vec3 or the
+		/// getTransformed(Vec3, Mat3)
+		/// @{
+		Vec3 getTransformed(const Vec3& translate, const Mat3& rotate,
+			float scale) const;
 		void transform(const Vec3& translate, const Mat3& rotate, float scale);
 		Vec3 getTransformed(const Vec3& translate, const Mat3& rotate) const;
 		void transform(const Vec3& translate, const Mat3& rotate);
-		Vec3 getTransformed(const Vec3& translate, const Quat& rotate, float scale) const;
+		Vec3 getTransformed(const Vec3& translate, const Quat& rotate,
+			float scale) const;
 		void transform(const Vec3& translate, const Quat& rotate, float scale);
 		Vec3 getTransformed(const Vec3& translate, const Quat& rotate) const;
 		void transform(const Vec3& translate, const Quat& rotate);
@@ -99,7 +103,7 @@ class Vec3
 		void transform(const Mat4& transform);
 		Vec3 getTransformed(const Transform& transform) const;
 		void transform(const Transform& transform);
-		/**@}*/
+		/// @}
 
 	private:
 		/// @name Data

+ 57 - 48
src/Math/Vec3.inl.h

@@ -1,9 +1,6 @@
 #include "Common.inl.h"
 
 
-#define SELF (*this)
-
-
 namespace M {
 
 
@@ -126,7 +123,7 @@ inline Vec3& Vec3::operator=(const Vec3& b)
 	arr[0] = b.arr[0];
 	arr[1] = b.arr[1];
 	arr[2] = b.arr[2];
-	return SELF;
+	return (*this);
 }
 
 // +
@@ -141,7 +138,7 @@ inline Vec3& Vec3::operator+=(const Vec3& b)
 	x() += b.x();
 	y() += b.y();
 	z() += b.z();
-	return SELF;
+	return (*this);
 }
 
 // -
@@ -156,7 +153,7 @@ inline Vec3& Vec3::operator-=(const Vec3& b)
 	x() -= b.x();
 	y() -= b.y();
 	z() -= b.z();
-	return SELF;
+	return (*this);
 }
 
 // *
@@ -171,7 +168,7 @@ inline Vec3& Vec3::operator*=(const Vec3& b)
 	x() *= b.x();
 	y() *= b.y();
 	z() *= b.z();
-	return SELF;
+	return (*this);
 }
 
 // /
@@ -186,7 +183,7 @@ inline Vec3& Vec3::operator/=(const Vec3& b)
 	x() /= b.x();
 	y() /= b.y();
 	z() /= b.z();
-	return SELF;
+	return (*this);
 }
 
 // negative
@@ -215,7 +212,7 @@ inline bool Vec3::operator!=(const Vec3& b) const
 // Vec3 + float
 inline Vec3 Vec3::operator+(float f) const
 {
-	return SELF + Vec3(f);
+	return (*this) + Vec3(f);
 }
 
 // float + Vec3
@@ -227,14 +224,14 @@ inline Vec3 operator+(float f, const Vec3& v)
 // Vec3 += float
 inline Vec3& Vec3::operator+=(float f)
 {
-	SELF += Vec3(f);
-	return SELF;
+	(*this) += Vec3(f);
+	return (*this);
 }
 
 // Vec3 - float
 inline Vec3 Vec3::operator-(float f) const
 {
-	return SELF - Vec3(f);
+	return (*this) - Vec3(f);
 }
 
 // float - Vec3
@@ -246,14 +243,14 @@ inline Vec3 operator-(float f, const Vec3& v)
 // Vec3 -= float
 inline Vec3& Vec3::operator-=(float f)
 {
-	SELF -= Vec3(f);
-	return SELF;
+	(*this) -= Vec3(f);
+	return (*this);
 }
 
 // Vec3 * float
 inline Vec3 Vec3::operator*(float f) const
 {
-	return SELF * Vec3(f);
+	return (*this) * Vec3(f);
 }
 
 // float * Vec3
@@ -265,14 +262,14 @@ inline Vec3 operator*(float f, const Vec3& v)
 // Vec3 *= float
 inline Vec3& Vec3::operator*=(float f)
 {
-	SELF *= Vec3(f);
-	return SELF;
+	(*this) *= Vec3(f);
+	return (*this);
 }
 
 // Vec3 / float
 inline Vec3 Vec3::operator/(float f) const
 {
-	return SELF / Vec3(f);
+	return (*this) / Vec3(f);
 }
 
 // float / Vec3
@@ -284,8 +281,8 @@ inline Vec3 operator/(float f, const Vec3& v)
 // Vec3 /= float
 inline Vec3& Vec3::operator/=(float f)
 {
-	SELF /= Vec3(f);
-	return SELF;
+	(*this) /= Vec3(f);
+	return (*this);
 }
 
 
@@ -302,7 +299,9 @@ inline float Vec3::dot(const Vec3& b) const
 // cross prod
 inline Vec3 Vec3::cross(const Vec3& b) const
 {
-	return Vec3(y() * b.z() - z() * b.y(), z() * b.x() - x() * b.z(), x() * b.y() - y() * b.x());
+	return Vec3(y() * b.z() - z() * b.y(),
+		z() * b.x() - x() * b.z(),
+		x() * b.y() - y() * b.x());
 }
 
 // getLength
@@ -320,25 +319,25 @@ inline float Vec3::getLengthSquared() const
 // getDistanceSquared
 inline float Vec3::getDistanceSquared(const Vec3& b) const
 {
-	return (SELF - b).getLengthSquared();
+	return ((*this) - b).getLengthSquared();
 }
 
 // normalize
 inline void Vec3::normalize()
 {
-	SELF /= getLength();
+	(*this) /= getLength();
 }
 
 // getNormalized
 inline Vec3 Vec3::getNormalized() const
 {
-	return SELF / getLength();
+	return (*this) / getLength();
 }
 
 // getProjection
 inline Vec3 Vec3::getProjection(const Vec3& toThis) const
 {
-	return toThis * (SELF.dot(toThis) / (toThis.dot(toThis)));
+	return toThis * ((*this).dot(toThis) / (toThis.dot(toThis)));
 }
 
 // getRotated
@@ -354,19 +353,19 @@ inline Vec3 Vec3::getRotated(const Quat& q) const
 							   pmult*y + vmult*q.y + crossmult*(q.z*x - q.x*z),
 	               pmult*z + vmult*q.z + crossmult*(q.x*y - q.y*x));*/
 	Vec3 qXyz(q);
-	return SELF + qXyz.cross(qXyz.cross(SELF) + SELF * q.w()) * 2.0;
+	return (*this) + qXyz.cross(qXyz.cross((*this)) + (*this) * q.w()) * 2.0;
 }
 
 // rotate
 inline void Vec3::rotate(const Quat& q)
 {
-	SELF = getRotated(q);
+	(*this) = getRotated(q);
 }
 
 // lerp
 inline Vec3 Vec3::lerp(const Vec3& v1, float t) const
 {
-	return (SELF * (1.0 - t)) + (v1 * t);
+	return ((*this) * (1.0 - t)) + (v1 * t);
 }
 
 
@@ -375,39 +374,44 @@ inline Vec3 Vec3::lerp(const Vec3& v1, float t) const
 //==============================================================================
 
 // Mat3
-inline Vec3 Vec3::getTransformed(const Vec3& translate, const Mat3& rotate, float scale) const
+inline Vec3 Vec3::getTransformed(const Vec3& translate, const Mat3& rotate,
+	float scale) const
 {
-	return (rotate * (SELF * scale)) + translate;
+	return (rotate * ((*this) * scale)) + translate;
 }
 
 // Mat3
-inline void Vec3::transform(const Vec3& translate, const Mat3& rotate, float scale)
+inline void Vec3::transform(const Vec3& translate, const Mat3& rotate,
+	float scale)
 {
-	SELF = getTransformed(translate, rotate, scale);
+	(*this) = getTransformed(translate, rotate, scale);
 }
 
 // Mat3 no scale
-inline Vec3 Vec3::getTransformed(const Vec3& translate, const Mat3& rotate) const
+inline Vec3 Vec3::getTransformed(const Vec3& translate,
+	const Mat3& rotate) const
 {
-	return (rotate * SELF) + translate;
+	return (rotate * (*this)) + translate;
 }
 
 // Mat3 no scale
 inline void Vec3::transform(const Vec3& translate, const Mat3& rotate)
 {
-	SELF = getTransformed(translate, rotate);
+	(*this) = getTransformed(translate, rotate);
 }
 
 // Quat
-inline Vec3 Vec3::getTransformed(const Vec3& translate, const Quat& rotate, float scale) const
+inline Vec3 Vec3::getTransformed(const Vec3& translate, const Quat& rotate,
+	float scale) const
 {
-	return (SELF * scale).getRotated(rotate) + translate;
+	return ((*this) * scale).getRotated(rotate) + translate;
 }
 
 // Quat
-inline void Vec3::transform(const Vec3& translate, const Quat& rotate, float scale)
+inline void Vec3::transform(const Vec3& translate, const Quat& rotate,
+	float scale)
 {
-	SELF = getTransformed(translate, rotate, scale);
+	(*this) = getTransformed(translate, rotate, scale);
 }
 
 // Mat4
@@ -415,17 +419,20 @@ inline Vec3 Vec3::getTransformed(const Mat4& transform) const
 {
 	#if defined(MATH_INTEL_SIMD)
 		Vec3 out;
-		Vec4 v4(SELF, 1.0);
+		Vec4 v4((*this), 1.0);
 		for(int i = 0; i < 3; i++)
 		{
-			_mm_store_ss(&out[i], _mm_dp_ps(transform.getMm(i), v4.getMm(), 0xF1));
+			_mm_store_ss(&out[i], _mm_dp_ps(transform.getMm(i), v4.getMm(),
+				0xF1));
 		}
 		return out;
 	#else
-		return Vec3(
-			transform(0, 0) * x() + transform(0, 1) * y() + transform(0, 2) * z() + transform(0, 3),
-			transform(1, 0) * x() + transform(1, 1) * y() + transform(1, 2) * z() + transform(1, 3),
-			transform(2, 0) * x() + transform(2, 1) * y() + transform(2, 2) * z() + transform(2, 3)
+		return Vec3(transform(0, 0) * x() + transform(0, 1) * y() +
+			transform(0, 2) * z() + transform(0, 3),
+			transform(1, 0) * x() + transform(1, 1) * y() +
+			transform(1, 2) * z() + transform(1, 3),
+			transform(2, 0) * x() + transform(2, 1) * y() +
+			transform(2, 2) * z() + transform(2, 3)
 		);
 	#endif
 }
@@ -433,19 +440,20 @@ inline Vec3 Vec3::getTransformed(const Mat4& transform) const
 // Mat4
 inline void Vec3::transform(const Mat4& transform)
 {
-	SELF = getTransformed(transform);
+	(*this) = getTransformed(transform);
 }
 
 // Transform
 inline Vec3 Vec3::getTransformed(const Transform& transform) const
 {
-	return (transform.getRotation() * (SELF * transform.getScale())) + transform.getOrigin();
+	return (transform.getRotation() * ((*this) * transform.getScale())) +
+		transform.getOrigin();
 }
 
 // Transform
 inline void Vec3::transform(const Transform& transform)
 {
-	SELF = getTransformed(transform);
+	(*this) = getTransformed(transform);
 }
 
 //==============================================================================
@@ -457,4 +465,5 @@ inline std::ostream& operator<<(std::ostream& s, const Vec3& v)
 	return s;
 }
 
+
 } // end namespace

+ 2 - 2
src/Math/Vec4.h

@@ -1,5 +1,5 @@
-#ifndef VEC4_H
-#define VEC4_H
+#ifndef M_VEC4_H
+#define M_VEC4_H
 
 #include "Common.h"
 

+ 26 - 27
src/Math/Vec4.inl.h

@@ -1,9 +1,6 @@
 #include "Common.inl.h"
 
 
-#define SELF (*this)
-
-
 namespace M {
 
 
@@ -188,7 +185,7 @@ inline Vec4& Vec4::operator=(const Vec4& b)
 		z() = b.z();
 		w() = b.w();
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // +
@@ -212,7 +209,7 @@ inline Vec4& Vec4::operator+=(const Vec4& b)
 		z() += b.z();
 		w() += b.w();
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // -
@@ -236,7 +233,7 @@ inline Vec4& Vec4::operator-=(const Vec4& b)
 		z() -= b.z();
 		w() -= b.w();
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // *
@@ -260,7 +257,7 @@ inline Vec4& Vec4::operator*=(const Vec4& b)
 		z() *= b.z();
 		w() *= b.w();
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // /
@@ -284,7 +281,7 @@ inline Vec4& Vec4::operator/=(const Vec4& b)
 		z() /= b.z();
 		w() /= b.w();
 	#endif
-	return SELF;
+	return (*this);
 }
 
 // negative
@@ -296,15 +293,17 @@ inline Vec4 Vec4::operator-() const
 // ==
 inline bool Vec4::operator==(const Vec4& b) const
 {
-	Vec4 sub = SELF - b;
-	return isZero(sub.x()) && isZero(sub.y()) && isZero(sub.z()) && isZero(sub.w());
+	Vec4 sub = (*this) - b;
+	return isZero(sub.x()) && isZero(sub.y()) && isZero(sub.z()) &&
+		isZero(sub.w());
 }
 
 // !=
 inline bool Vec4::operator!=(const Vec4& b) const
 {
-	Vec4 sub = SELF - b;
-	return !(isZero(sub.x()) && isZero(sub.y()) && isZero(sub.z()) && isZero(sub.w()));
+	Vec4 sub = (*this) - b;
+	return !(isZero(sub.x()) && isZero(sub.y()) && isZero(sub.z()) &&
+		isZero(sub.w()));
 }
 
 
@@ -315,7 +314,7 @@ inline bool Vec4::operator!=(const Vec4& b) const
 // Vec4 + float
 inline Vec4 Vec4::operator+(float f) const
 {
-	return SELF + Vec4(f);
+	return (*this) + Vec4(f);
 }
 
 // float + Vec4
@@ -327,14 +326,14 @@ inline Vec4 operator+(float f, const Vec4& v4)
 // Vec4 += float
 inline Vec4& Vec4::operator+=(float f)
 {
-	SELF += Vec4(f);
-	return SELF;
+	(*this) += Vec4(f);
+	return (*this);
 }
 
 // Vec4 - float
 inline Vec4 Vec4::operator-(float f) const
 {
-	return SELF - Vec4(f);
+	return (*this) - Vec4(f);
 }
 
 // float - Vec4
@@ -346,14 +345,14 @@ inline Vec4 operator-(float f, const Vec4& v4)
 // Vec4 -= float
 inline Vec4& Vec4::operator-=(float f)
 {
-	SELF -= Vec4(f);
-	return SELF;
+	(*this) -= Vec4(f);
+	return (*this);
 }
 
 // Vec4 * float
 inline Vec4 Vec4::operator*(float f) const
 {
-	return SELF * Vec4(f);
+	return (*this) * Vec4(f);
 }
 
 // float * Vec4
@@ -365,14 +364,14 @@ inline Vec4 operator*(float f, const Vec4& v4)
 // Vec4 *= float
 inline Vec4& Vec4::operator*=(float f)
 {
-	SELF *= Vec4(f);
-	return SELF;
+	(*this) *= Vec4(f);
+	return (*this);
 }
 
 // Vec4 / float
 inline Vec4 Vec4::operator/(float f) const
 {
-	return SELF / Vec4(f);
+	return (*this) / Vec4(f);
 }
 
 // float / Vec4
@@ -384,8 +383,8 @@ inline Vec4 operator/(float f, const Vec4& v4)
 // Vec4 /= float
 inline Vec4& Vec4::operator/=(float f)
 {
-	SELF /= Vec4(f);
-	return SELF;
+	(*this) /= Vec4(f);
+	return (*this);
 }
 
 
@@ -424,19 +423,19 @@ inline float Vec4::dot(const Vec4& b) const
 // getLength
 inline float Vec4::getLength() const
 {
-	return M::sqrt(dot(SELF));
+	return M::sqrt(dot((*this)));
 }
 
 // getNormalized
 inline Vec4 Vec4::getNormalized() const
 {
-	return SELF / getLength();
+	return (*this) / getLength();
 }
 
 // normalize
 inline void Vec4::normalize()
 {
-	SELF /= getLength();
+	(*this) /= getLength();
 }
 
 

+ 7 - 0
src/Renderer/Bs.cpp

@@ -9,6 +9,13 @@
 #include "Resources/Mesh.h"
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+Bs::~Bs()
+{}
+
+
 //==============================================================================
 // createFbo                                                                   =
 //==============================================================================

+ 2 - 0
src/Renderer/Bs.h

@@ -16,6 +16,8 @@ class Bs: public RenderingPass
 {
 	public:
 		Bs(Renderer& r_): RenderingPass(r_) {}
+		~Bs();
+
 		void init(const RendererInitializer& initializer);
 		void run();
 

+ 7 - 0
src/Renderer/Ms.cpp

@@ -15,6 +15,13 @@ Ms::Ms(Renderer& r_):
 {}
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+Ms::~Ms()
+{}
+
+
 //==============================================================================
 // init                                                                        =
 //==============================================================================

+ 1 - 0
src/Renderer/Ms.h

@@ -13,6 +13,7 @@ class Ms: public RenderingPass
 {
 	public:
 		Ms(Renderer& r_);
+		~Ms();
 
 		/// @name Accessors
 		/// @{

+ 7 - 0
src/Renderer/Pps.cpp

@@ -16,6 +16,13 @@ Pps::Pps(Renderer& r_):
 {}
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+Pps::~Pps()
+{}
+
+
 //==============================================================================
 // init                                                                        =
 //==============================================================================

+ 1 - 0
src/Renderer/Pps.h

@@ -20,6 +20,7 @@ class Pps: private RenderingPass
 {
 	public:
 		Pps(Renderer& r_);
+		~Pps();
 		void init(const RendererInitializer& initializer);
 		void runPrePass();
 		void runPostPass();

+ 14 - 0
src/Renderer/Smo.cpp

@@ -15,6 +15,20 @@
 const float THRESHOLD = 0.2;
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+Smo::Geom::~Geom()
+{}
+
+
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+Smo::~Smo()
+{}
+
+
 //==============================================================================
 // init                                                                        =
 //==============================================================================

+ 4 - 0
src/Renderer/Smo.h

@@ -19,6 +19,7 @@ class Smo: public RenderingPass
 {
 	public:
 		Smo(Renderer& r_): RenderingPass(r_) {}
+		~Smo();
 		void init(const RendererInitializer& initializer);
 		void run(const PointLight& light);
 		void run(const SpotLight& light);
@@ -27,6 +28,9 @@ class Smo: public RenderingPass
 		/// @todo
 		struct Geom
 		{
+			Geom() {}
+			~Geom();
+
 			RsrcPtr<Mesh> mesh;
 			Vao vao;
 		};

+ 9 - 4
src/Scene/Camera.cpp

@@ -22,7 +22,8 @@ void Camera::updateWSpaceFrustumPlanes()
 {
 	for(uint i = 0; i < FP_NUM; i++)
 	{
-		wspaceFrustumPlanes[i] = lspaceFrustumPlanes[i].getTransformed(getWorldTransform());
+		wspaceFrustumPlanes[i] =
+			lspaceFrustumPlanes[i].getTransformed(getWorldTransform());
 	}
 }
 
@@ -71,7 +72,9 @@ bool Camera::insideFrustum(const Camera& cam) const
 		}
 		if(failed == pointsNum)
 		{
-			return false; // if all points are behind the plane then the cam is not in frustum
+			// if all points are behind the plane then the cam is not in
+			// frustum
+			return false;
 		}
 	}
 
@@ -88,11 +91,13 @@ void Camera::updateViewMatrix()
 	 * The point at which the camera looks:
 	 * Vec3 viewpoint = translationLspace + z_axis;
 	 * as we know the up vector, we can easily use gluLookAt:
-	 * gluLookAt(translationLspace.x, translationLspace.x, translationLspace.z, z_axis.x, z_axis.y, z_axis.z, y_axis.x,
+	 * gluLookAt(translationLspace.x, translationLspace.x,
+	 *           translationLspace.z, z_axis.x, z_axis.y, z_axis.z, y_axis.x,
 	 *           y_axis.y, y_axis.z);
 	*/
 
-	// The view matrix is: Mview = camera.world_transform.Inverted(). Bus instead of inverting we do the following:
+	// The view matrix is: Mview = camera.world_transform.Inverted().
+	// But instead of inverting we do the following:
 	Mat3 camInvertedRot = getWorldTransform().getRotation().getTransposed();
 	camInvertedRot *= 1.0 / getWorldTransform().getScale();
 	Vec3 camInvertedTsl = -(camInvertedRot * getWorldTransform().getOrigin());

+ 7 - 0
src/Scene/Light.cpp

@@ -2,6 +2,13 @@
 #include "Resources/LightRsrc.h"
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+Light::~Light()
+{}
+
+
 //==============================================================================
 // init                                                                        =
 //==============================================================================

+ 1 - 1
src/Scene/Light.h

@@ -34,7 +34,7 @@ class Light: public SceneNode, public VisibilityInfo
 		};
 
 		Light(LightType type, bool compoundFlag, SceneNode* parent = NULL);
-		~Light() {}
+		~Light();
 
 		/// @name Accessors
 		/// @{

+ 12 - 6
src/Scene/MaterialRuntime.cpp

@@ -26,12 +26,15 @@ MaterialRuntime::MaterialRuntime(const Material& mtl_):
 //==============================================================================
 // getUserDefinedVarByName                                                     =
 //==============================================================================
-MaterialRuntimeUserDefinedVar& MaterialRuntime::getUserDefinedVarByName(const char* name)
+MaterialRuntimeUserDefinedVar& MaterialRuntime::getUserDefinedVarByName(
+	const char* name)
 {
-	CharPtrHashMap<MaterialRuntimeUserDefinedVar*>::iterator it = userDefVarsHashMap.find(name);
+	CharPtrHashMap<MaterialRuntimeUserDefinedVar*>::iterator it =
+		userDefVarsHashMap.find(name);
 	if(it == userDefVarsHashMap.end())
 	{
-		throw EXCEPTION("Cannot get user defined variable with name \"" + name + '\"');
+		throw EXCEPTION("Cannot get user defined variable with name \"" +
+			name + '\"');
 	}
 	return *(it->second);
 }
@@ -40,12 +43,15 @@ MaterialRuntimeUserDefinedVar& MaterialRuntime::getUserDefinedVarByName(const ch
 //==============================================================================
 // getUserDefinedVarByName                                                     =
 //==============================================================================
-const MaterialRuntimeUserDefinedVar& MaterialRuntime::getUserDefinedVarByName(const char* name) const
+const MaterialRuntimeUserDefinedVar& MaterialRuntime::getUserDefinedVarByName(
+	const char* name) const
 {
-	CharPtrHashMap<MaterialRuntimeUserDefinedVar*>::const_iterator it = userDefVarsHashMap.find(name);
+	CharPtrHashMap<MaterialRuntimeUserDefinedVar*>::const_iterator it =
+		userDefVarsHashMap.find(name);
 	if(it == userDefVarsHashMap.end())
 	{
-		throw EXCEPTION("Cannot get user defined variable with name \"" + name + '\"');
+		throw EXCEPTION("Cannot get user defined variable with name \"" +
+			name + '\"');
 	}
 	return *(it->second);
 }

+ 46 - 15
src/Scene/MaterialRuntime.h

@@ -14,24 +14,29 @@ class MaterialRuntime: private MaterialProps
 {
 	public:
 		/// A type
-		typedef boost::ptr_vector<MaterialRuntimeUserDefinedVar> MaterialRuntimeUserDefinedVarContainer;
+		typedef boost::ptr_vector<MaterialRuntimeUserDefinedVar>
+			MaterialRuntimeUserDefinedVarContainer;
 
 		/// The one and only contructor
 		MaterialRuntime(const Material& mtl);
 
 		/// @name Accessors
 		/// @{
-		GETTER_RW(MaterialRuntimeUserDefinedVarContainer, userDefVars, getUserDefinedVars)
+		GETTER_RW(MaterialRuntimeUserDefinedVarContainer, userDefVars,
+			getUserDefinedVars)
 
-		/// Find MaterialRuntimeUserDefinedVar variable. On failure it throws an exception
+		/// Find MaterialRuntimeUserDefinedVar variable. On failure it throws
+		/// an exception
 		/// @param[in] name The name of the var
 		/// @return It returns a MaterialRuntimeUserDefinedVar
 		/// @exception Exception
-		MaterialRuntimeUserDefinedVar& getUserDefinedVarByName(const char* name);
+		MaterialRuntimeUserDefinedVar& getUserDefinedVarByName(
+			const char* name);
 
 		/// The const version of getUserDefinedVarByName
 		/// @see getUserDefinedVarByName
-		const MaterialRuntimeUserDefinedVar& getUserDefinedVarByName(const char* name) const;
+		const MaterialRuntimeUserDefinedVar& getUserDefinedVarByName(
+			const char* name) const;
 
 		/// Get the resource
 		const Material& getMaterial() const {return mtl;}
@@ -49,23 +54,30 @@ class MaterialRuntime: private MaterialProps
 		Type& getUserDefVarValue(const char* name);
 
 		GETTER_SETTER_BY_VAL(bool, castsShadowFlag, castsShadow, setCastsShadow)
-		GETTER_SETTER_BY_VAL(bool, renderInBlendingStageFlag, renderInBlendingStage, setRenderInBlendingStage)
-		GETTER_SETTER_BY_VAL(int, blendingSfactor, getBlendingSfactor, setBlendingSfactor)
-		GETTER_SETTER_BY_VAL(int, blendingDfactor, getBlendingDfactor, setBlendingDfactor)
-		GETTER_SETTER_BY_VAL(bool, depthTesting, isDepthTestingEnabled, setDepthTestingEnabled)
-		GETTER_SETTER_BY_VAL(bool, wireframe, isWireframeEnabled, setWireframeEnabled)
-
-		const SProgAttribVar* getStdAttribVar(Material::StdAttribVars id) const {return mtl.getStdAttribVar(id);}
-		const SProgUniVar* getStdUniVar(Material::StdUniVars id) const {return mtl.getStdUniVar(id);}
+		GETTER_SETTER_BY_VAL(bool, renderInBlendingStageFlag,
+			renderInBlendingStage, setRenderInBlendingStage)
+		GETTER_SETTER_BY_VAL(int, blendingSfactor, getBlendingSfactor,
+			setBlendingSfactor)
+		GETTER_SETTER_BY_VAL(int, blendingDfactor, getBlendingDfactor,
+			setBlendingDfactor)
+		GETTER_SETTER_BY_VAL(bool, depthTesting, isDepthTestingEnabled,
+			setDepthTestingEnabled)
+		GETTER_SETTER_BY_VAL(bool, wireframe, isWireframeEnabled,
+			setWireframeEnabled)
+
+		const SProgAttribVar* getStdAttribVar(
+			Material::StdAttribVars id) const;
+		const SProgUniVar* getStdUniVar(Material::StdUniVars id) const;
 		const ShaderProg& getShaderProg() const {return mtl.getShaderProg();}
 		/// @}
 
-		bool isBlendingEnabled() const {return blendingSfactor != GL_ONE || blendingDfactor != GL_ZERO;}
+		bool isBlendingEnabled() const;
 
 	private:
 		const Material& mtl; ///< The resource
 		MaterialRuntimeUserDefinedVarContainer userDefVars;
-		CharPtrHashMap<MaterialRuntimeUserDefinedVar*> userDefVarsHashMap; ///< For fast finding the variables
+		/// For fast finding the variables
+		CharPtrHashMap<MaterialRuntimeUserDefinedVar*> userDefVarsHashMap;
 };
 
 
@@ -90,4 +102,23 @@ void MaterialRuntime::setUserDefVarValue(const char* name, const Type& value)
 }
 
 
+inline const SProgAttribVar* MaterialRuntime::getStdAttribVar(
+	Material::StdAttribVars id) const
+{
+	return mtl.getStdAttribVar(id);
+}
+
+
+inline const SProgUniVar* MaterialRuntime::getStdUniVar(
+	Material::StdUniVars id) const
+{
+	return mtl.getStdUniVar(id);
+}
+
+
+inline bool MaterialRuntime::isBlendingEnabled() const
+{
+	return blendingSfactor != GL_ONE || blendingDfactor != GL_ZERO;
+}
+
 #endif

+ 5 - 3
src/Scene/MaterialRuntimeUserDefinedVar.cpp

@@ -5,7 +5,8 @@
 // ConstructVisitor::operator() <RsrcPtr<Texture> >                            =
 //==============================================================================
 template <>
-void MaterialRuntimeUserDefinedVar::ConstructVisitor::operator()<RsrcPtr<Texture> >(const RsrcPtr<Texture>& x) const
+void MaterialRuntimeUserDefinedVar::ConstructVisitor::
+	operator()<RsrcPtr<Texture> >(const RsrcPtr<Texture>& x) const
 {
 	udvr.data = &x;
 }
@@ -14,8 +15,9 @@ void MaterialRuntimeUserDefinedVar::ConstructVisitor::operator()<RsrcPtr<Texture
 //==============================================================================
 // Constructor                                                                 =
 //==============================================================================
-MaterialRuntimeUserDefinedVar::MaterialRuntimeUserDefinedVar(const MtlUserDefinedVar& rsrc_):
-	rsrc(rsrc_)
+MaterialRuntimeUserDefinedVar::MaterialRuntimeUserDefinedVar(
+	const MtlUserDefinedVar& rsrc_)
+:	rsrc(rsrc_)
 {
 	// Initialize the data using a visitor
 	boost::apply_visitor(ConstructVisitor(*this), rsrc.getDataVariant());

+ 17 - 6
src/Scene/MaterialRuntimeUserDefinedVar.h

@@ -4,14 +4,16 @@
 #include "Resources/MtlUserDefinedVar.h"
 
 
-/// This holds a copy of the MtlUserDefinedVar's data in order to be changed inside the main loop
+/// This holds a copy of the MtlUserDefinedVar's data in order to be changed
+/// inside the main loop
 class MaterialRuntimeUserDefinedVar
 {
 	friend class ConstructVisitor;
 
 	public:
 		/// The data union. The Texture resource is read-only at runtime
-		typedef boost::variant<float, Vec2, Vec3, Vec4, const RsrcPtr<Texture>*, MtlUserDefinedVar::Fai> DataVariant;
+		typedef boost::variant<float, Vec2, Vec3, Vec4,
+			const RsrcPtr<Texture>*, MtlUserDefinedVar::Fai> DataVariant;
 
 		/// The one and only constructor
 		MaterialRuntimeUserDefinedVar(const MtlUserDefinedVar& rsrc);
@@ -25,12 +27,14 @@ class MaterialRuntimeUserDefinedVar
 		GETTER_RW(DataVariant, data, getDataVariant)
 
 		/// Get the value of the variant
-		/// @exception boost::exception when you try to get the incorrect data type
+		/// @exception boost::exception when you try to get the incorrect data
+		/// type
 		template<typename Type>
 		const Type& get() const {return boost::get<Type>(data);}
 
 		/// Get the value of the variant
-		/// @exception boost::exception when you try to get the incorrect data type
+		/// @exception boost::exception when you try to get the incorrect data
+		/// type
 		template<typename Type>
 		Type& get() {return boost::get<Type>(data);}
 
@@ -45,9 +49,10 @@ class MaterialRuntimeUserDefinedVar
 			public:
 				MaterialRuntimeUserDefinedVar& udvr;
 
-				ConstructVisitor(MaterialRuntimeUserDefinedVar& udvr_): udvr(udvr_) {}
+				ConstructVisitor(MaterialRuntimeUserDefinedVar& udvr_);
 
-				/// Template method that applies to all DataVariant values except texture resource
+				/// Template method that applies to all DataVariant values
+				/// except texture resource
 				template<typename Type>
 				void operator()(const Type& x) const {udvr.data = x;}
 		};
@@ -57,4 +62,10 @@ class MaterialRuntimeUserDefinedVar
 };
 
 
+inline MaterialRuntimeUserDefinedVar::ConstructVisitor::ConstructVisitor(
+	MaterialRuntimeUserDefinedVar& udvr_)
+:	udvr(udvr_)
+{}
+
+
 #endif

+ 2 - 1
src/Scene/ModelNode.cpp

@@ -31,5 +31,6 @@ void ModelNode::init(const char* filename)
 void ModelNode::moveUpdate()
 {
 	// Update bounding shape
-	visibilityShapeWSpace = model->getVisibilityShape().getTransformed(getWorldTransform());
+	visibilityShapeWSpace = model->getVisibilityShape().getTransformed(
+		getWorldTransform());
 }

+ 7 - 2
src/Scene/ModelNode.h

@@ -17,14 +17,14 @@ class Model;
 class ModelNode: public SceneNode
 {
 	public:
-		ModelNode(SceneNode* parent = NULL): SceneNode(SNT_MODEL, true, parent) {}
+		ModelNode(SceneNode* parent = NULL);
 		virtual ~ModelNode();
 
 		/// @name Accessors
 		/// @{
 		GETTER_RW(Vec<ModelPatchNode*>, patches, getModelPatchNodes)
 		const Model& getModel() const {return *model;}
-		const Col::Obb& getVisibilityShapeWSpace() const {return visibilityShapeWSpace;}
+		GETTER_R(Col::Obb, visibilityShapeWSpace, getVisibilityShapeWSpace)
 		/// @}
 
 		/// Initialize the node
@@ -43,4 +43,9 @@ class ModelNode: public SceneNode
 };
 
 
+inline ModelNode::ModelNode(SceneNode* parent = NULL)
+:	SceneNode(SNT_MODEL, true, parent)
+{}
+
+
 #endif

+ 3 - 1
src/Scene/ModelPatchNode.cpp

@@ -31,5 +31,7 @@ ModelPatchNode::ModelPatchNode(const ModelPatch& modelPatch_, ModelNode* parent)
 //==============================================================================
 void ModelPatchNode::moveUpdate()
 {
-	visibilityShapeWSpace = modelPatch.getMesh().getVisibilityShape().getTransformed(getWorldTransform());
+	visibilityShapeWSpace =
+		modelPatch.getMesh().getVisibilityShape().getTransformed(
+		getWorldTransform());
 }

+ 1 - 1
src/Scene/ModelPatchNode.h

@@ -14,7 +14,7 @@ class ModelPatchNode: public PatchNode
 	public:
 		ModelPatchNode(const ModelPatch& modelPatch, ModelNode* parent);
 
-		const Col::Obb& getVisibilityShapeWSpace() const {return visibilityShapeWSpace;}
+		GETTER_R(Col::Obb, visibilityShapeWSpace, getVisibilityShapeWSpace)
 
 		virtual void moveUpdate(); ///< Update the visibility shape
 		virtual void frameUpdate(float /*prevUpdateTime*/, float /*crntTime*/) {}

+ 6 - 3
src/Scene/OrthographicCamera.cpp

@@ -4,7 +4,8 @@
 //==============================================================================
 // setAll                                                                      =
 //==============================================================================
-void OrthographicCamera::setAll(float left_, float right_, float top_, float bottom_, float zNear_, float zFar_)
+void OrthographicCamera::setAll(float left_, float right_, float top_,
+	float bottom_, float zNear_, float zFar_)
 {
 	left = left_;
 	right = right_;
@@ -34,7 +35,8 @@ void OrthographicCamera::calcLSpaceFrustumPlanes()
 //==============================================================================
 // ortho                                                                       =
 //==============================================================================
-Mat4 OrthographicCamera::ortho(float left, float right, float bottom, float top, float near, float far)
+Mat4 OrthographicCamera::ortho(float left, float right, float bottom,
+	float top, float near, float far)
 {
 	float difx = right - left;
 	float dify = top - bottom;
@@ -78,7 +80,8 @@ void OrthographicCamera::calcProjectionMatrix()
 //==============================================================================
 // getExtremePoints                                                            =
 //==============================================================================
-void OrthographicCamera::getExtremePoints(Vec3* pointsArr, uint& pointsNum) const
+void OrthographicCamera::getExtremePoints(Vec3* pointsArr,
+	uint& pointsNum) const
 {
 	pointsArr[0] = Vec3(right, top, -zNear);
 	pointsArr[1] = Vec3(left, top, -zNear);

+ 7 - 4
src/Scene/OrthographicCamera.h

@@ -25,7 +25,8 @@ class OrthographicCamera: public Camera
 		void setBottom(float f);
 		/// @}
 
-		void setAll(float left, float right, float top, float bottom, float znear, float zfar);
+		void setAll(float left, float right, float top, float bottom,
+			float znear, float zfar);
 
 		/// It returns an orthographic projection matrix
 		/// @param left left vertical clipping plane
@@ -35,7 +36,8 @@ class OrthographicCamera: public Camera
 		/// @param near nearer distance of depth clipping plane
 		/// @param far farther distance of depth clipping plane
 		/// @return A 4x4 projection matrix
-		static Mat4 ortho(float left, float right, float bottom, float top, float near, float far);
+		static Mat4 ortho(float left, float right, float bottom, float top,
+			float near, float far);
 
 	private:
 		/// @name Data
@@ -57,8 +59,9 @@ class OrthographicCamera: public Camera
 };
 
 
-inline OrthographicCamera::OrthographicCamera(bool compoundFlag, SceneNode* parent):
-	Camera(CT_ORTHOGRAPHIC, compoundFlag, parent)
+inline OrthographicCamera::OrthographicCamera(bool compoundFlag,
+	SceneNode* parent)
+:	Camera(CT_ORTHOGRAPHIC, compoundFlag, parent)
 {
 	name = "OrthographicCamera:" + name;
 }

+ 24 - 12
src/Scene/ParticleEmitter.cpp

@@ -9,7 +9,8 @@
 #include "Util/Util.h"
 
 
-btTransform ParticleEmitter::startingTrf(toBt(Mat3::getIdentity()), btVector3(10000000.0, 10000000.0, 10000000.0));
+btTransform ParticleEmitter::startingTrf(toBt(Mat3::getIdentity()),
+	btVector3(10000000.0, 10000000.0, 10000000.0));
 
 
 //==============================================================================
@@ -24,7 +25,8 @@ ParticleEmitter::~ParticleEmitter()
 //==============================================================================
 float ParticleEmitter::getRandom(float initial, float deviation)
 {
-	return (deviation == 0.0) ?  initial : initial + Util::randFloat(deviation) * 2.0 - deviation;
+	return (deviation == 0.0) ?  initial :
+		initial + Util::randFloat(deviation) * 2.0 - deviation;
 }
 
 
@@ -71,7 +73,9 @@ void ParticleEmitter::init(const char* filename)
 
 		particles.push_back(particle);
 
-		float mass = particleMass + Util::randFloat(particleMassDeviation) * 2.0 - particleMassDeviation;
+		float mass = particleMass +
+			Util::randFloat(particleMassDeviation) * 2.0 -
+			particleMassDeviation;
 
 		Phys::RigidBody::Initializer init;
 		init.mass = mass;
@@ -79,8 +83,10 @@ void ParticleEmitter::init(const char* filename)
 		init.shape = collShape.get();
 		init.sceneNode = particle;
 		init.group = Phys::MasterContainer::CG_PARTICLE;
-		init.mask = Phys::MasterContainer::CG_ALL ^ Phys::MasterContainer::CG_PARTICLE;
-		Phys::RigidBody* body = new Phys::RigidBody(SceneSingleton::getInstance().getPhysMasterContainer(), init);
+		init.mask =
+			Phys::MasterContainer::CG_ALL ^ Phys::MasterContainer::CG_PARTICLE;
+		Phys::RigidBody* body = new Phys::RigidBody(
+			SceneSingleton::getInstance().getPhysMasterContainer(), init);
 
 		body->forceActivationState(DISABLE_SIMULATION);
 
@@ -94,7 +100,8 @@ void ParticleEmitter::init(const char* filename)
 //==============================================================================
 void ParticleEmitter::frameUpdate(float prevUpdateTime, float crntTime)
 {
-	// Opt: We dont have to make extra calculations if the ParticleEmitter's rotation is the identity
+	// Opt: We dont have to make extra calculations if the ParticleEmitter's
+	// rotation is the identity
 	bool identRot = getWorldTransform().getRotation() == Mat3::getIdentity();
 
 	// deactivate the dead particles
@@ -133,7 +140,8 @@ void ParticleEmitter::frameUpdate(float prevUpdateTime, float crntTime)
 			//INFO("Reiniting " << i);
 
 			// life
-			p.setTimeOfDeath(getRandom(crntTime + particleLife, particleLifeDeviation));
+			p.setTimeOfDeath(getRandom(crntTime + particleLife,
+				particleLifeDeviation));
 
 			//cout << "Time of death " << p.timeOfDeath << endl;
 			//cout << "Particle life " << p.timeOfDeath - crntTime << endl;
@@ -150,7 +158,8 @@ void ParticleEmitter::frameUpdate(float prevUpdateTime, float crntTime)
 			// force
 			if(forceFlag)
 			{
-				Vec3 forceDir = getRandom(forceDirection, forceDirectionDeviation);
+				Vec3 forceDir = getRandom(forceDirection,
+					forceDirectionDeviation);
 				forceDir.normalize();
 
 				if(!identRot)
@@ -159,18 +168,21 @@ void ParticleEmitter::frameUpdate(float prevUpdateTime, float crntTime)
 					forceDir = getWorldTransform().getRotation() * forceDir;
 				}
 
-				float forceMag = getRandom(forceMagnitude, forceMagnitudeDeviation);
+				float forceMag = getRandom(forceMagnitude,
+					forceMagnitudeDeviation);
+
 				p.getRigidBody().applyCentralForce(toBt(forceDir * forceMag));
 			}
 
 			// gravity
 			if(!worldGravFlag)
 			{
-				p.getRigidBody().setGravity(toBt(getRandom(gravity, gravityDeviation)));
+				p.getRigidBody().setGravity(toBt(getRandom(gravity,
+					gravityDeviation)));
 			}
 
-			// starting pos
-			Vec3 pos = getRandom(startingPos, startingPosDeviation); // in local space
+			// Starting pos. In local space
+			Vec3 pos = getRandom(startingPos, startingPosDeviation);
 
 			if(identRot)
 			{

+ 4 - 3
src/Scene/ParticleEmitter.h

@@ -13,7 +13,8 @@ class btCollisionShape;
 class Particle;
 
 
-/// The particle emitter scene node. This scene node emitts @ref ParticleEmitter:Particle particle nodes in space.
+/// The particle emitter scene node. This scene node emitts
+/// @ref ParticleEmitter:Particle particle nodes in space.
 class ParticleEmitter: public SceneNode, public ParticleEmitterRsrc
 {
 	public:
@@ -37,8 +38,8 @@ class ParticleEmitter: public SceneNode, public ParticleEmitterRsrc
 };
 
 
-inline ParticleEmitter::ParticleEmitter():
-	SceneNode(SNT_PARTICLE_EMITTER, false, NULL)
+inline ParticleEmitter::ParticleEmitter()
+:	SceneNode(SNT_PARTICLE_EMITTER, false, NULL)
 {}
 
 

+ 14 - 9
src/Scene/PatchNode.cpp

@@ -18,32 +18,37 @@ PatchNode::PatchNode(const ModelPatch& modelPatch, SceneNode* parent):
 //==============================================================================
 // createVao                                                                   =
 //==============================================================================
-void PatchNode::createVao(const Material& mtl, const boost::array<const Vbo*, Mesh::VBOS_NUM>& vbos, Vao& vao)
+void PatchNode::createVao(const Material& mtl, const boost::array<const Vbo*,
+	Mesh::VBOS_NUM>& vbos, Vao& vao)
 {
 	vao.create();
 
 	if(mtl.getStdAttribVar(Material::SAV_POSITION) != NULL)
 	{
-		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_POSITIONS], *mtl.getStdAttribVar(Material::SAV_POSITION),
-		                         3, GL_FLOAT, GL_FALSE, 0, NULL);
+		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_POSITIONS],
+			*mtl.getStdAttribVar(Material::SAV_POSITION),
+			3, GL_FLOAT, GL_FALSE, 0, NULL);
 	}
 
 	if(mtl.getStdAttribVar(Material::SAV_NORMAL) != NULL)
 	{
-		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_NORMALS], *mtl.getStdAttribVar(Material::SAV_NORMAL),
-		                         3, GL_FLOAT, GL_FALSE, 0, NULL);
+		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_NORMALS],
+			*mtl.getStdAttribVar(Material::SAV_NORMAL),
+			3, GL_FLOAT, GL_FALSE, 0, NULL);
 	}
 
 	if(mtl.getStdAttribVar(Material::SAV_TANGENT) != NULL)
 	{
-		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_TANGENTS], *mtl.getStdAttribVar(Material::SAV_TANGENT),
-		                         4, GL_FLOAT, GL_FALSE, 0, NULL);
+		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_TANGENTS],
+			*mtl.getStdAttribVar(Material::SAV_TANGENT),
+			4, GL_FLOAT, GL_FALSE, 0, NULL);
 	}
 
 	if(mtl.getStdAttribVar(Material::SAV_TEX_COORDS) != NULL)
 	{
-		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_TEX_COORDS], *mtl.getStdAttribVar(Material::SAV_TEX_COORDS),
-		                         2, GL_FLOAT, GL_FALSE, 0, NULL);
+		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_TEX_COORDS],
+			*mtl.getStdAttribVar(Material::SAV_TEX_COORDS),
+			2, GL_FLOAT, GL_FALSE, 0, NULL);
 	}
 
 	vao.attachElementArrayBufferVbo(*vbos[Mesh::VBO_VERT_INDECES]);

+ 10 - 5
src/Scene/PatchNode.h

@@ -14,8 +14,8 @@
 class Material;
 
 
-/// Inherited by ModelPatchNode and SkinPatchNode. It contains common code, the derived classes are responsible to
-/// initialize the VAOs
+/// Inherited by ModelPatchNode and SkinPatchNode. It contains common code,
+/// the derived classes are responsible to initialize the VAOs
 class PatchNode: public RenderableNode
 {
 	public:
@@ -42,13 +42,18 @@ class PatchNode: public RenderableNode
 
 	protected:
 		const ModelPatch& rsrc;
-		Vao dpVao; /// VAO for depth passes. All VBOs could be attached except for the vert weights
-		Vao cpVao; /// VAO for MS and BS. All VBOs could be attached except for the vert weights
+		/// VAO for depth passes. All VBOs could be attached except for the
+		/// vert weights
+		Vao dpVao;
+		/// VAO for MS and BS. All VBOs could be attached except for the
+		/// vert weights
+		Vao cpVao;
 		boost::scoped_ptr<MaterialRuntime> cpMtlRun;
 		boost::scoped_ptr<MaterialRuntime> dpMtlRun;
 
 		/// Create a VAO given a material and an array of VBOs
-		static void createVao(const Material& material, const boost::array<const Vbo*, Mesh::VBOS_NUM>& vbos, Vao& vao);
+		static void createVao(const Material& material,
+			const boost::array<const Vbo*, Mesh::VBOS_NUM>& vbos, Vao& vao);
 };
 
 

+ 2 - 1
src/Scene/PerspectiveCamera.cpp

@@ -4,7 +4,8 @@
 //==============================================================================
 // setAll                                                                      =
 //==============================================================================
-void PerspectiveCamera::setAll(float fovx_, float fovy_, float znear_, float zfar_)
+void PerspectiveCamera::setAll(float fovx_, float fovy_, float znear_,
+	float zfar_)
 {
 	fovX = fovx_;
 	fovY = fovy_;

+ 7 - 4
src/Scene/PerspectiveCamera.h

@@ -25,8 +25,9 @@ class PerspectiveCamera: public Camera
 		/// @name Data
 		/// @{
 
-		/// fovX is the angle in the y axis (imagine the cam positioned in the default OGL pos) Note that fovX > fovY
-		/// (most of the time) and aspectRatio = fovX/fovY
+		/// fovX is the angle in the y axis (imagine the cam positioned in
+		/// the default OGL pos) Note that fovX > fovY (most of the time) and
+		/// aspectRatio = fovX/fovY
 		float fovX;
 		float fovY; /// @see fovX
 		/// @}
@@ -42,12 +43,14 @@ class PerspectiveCamera: public Camera
 };
 
 
-inline PerspectiveCamera::PerspectiveCamera(bool compoundFlag, SceneNode* parent):
-	Camera(CT_PERSPECTIVE, compoundFlag, parent)
+inline PerspectiveCamera::PerspectiveCamera(bool compoundFlag,
+	SceneNode* parent)
+:	Camera(CT_PERSPECTIVE, compoundFlag, parent)
 {
 	name = "PerspectiveCamera:" + name;
 }
 
+
 inline void PerspectiveCamera::setFovX(float fovx_)
 {
 	fovX = fovx_;

+ 8 - 5
src/Scene/RenderableNode.h

@@ -17,9 +17,12 @@ class RenderableNode: public SceneNode
 
 		virtual const Vao& getCpVao() const = 0; ///< Get color pass VAO
 		virtual const Vao& getDpVao() const = 0; ///< Get depth pass VAO
-		virtual uint getVertIdsNum() const = 0;  ///< Get vert ids number for rendering
-		virtual const Material& getCpMtl() const = 0;  ///< Get color pass material
-		virtual const Material& getDpMtl() const = 0;  ///< Get depth pass material
+		/// Get vert ids number for rendering
+		virtual uint getVertIdsNum() const = 0;
+		/// Get color pass material
+		virtual const Material& getCpMtl() const = 0;
+		/// Get depth pass material
+		virtual const Material& getDpMtl() const = 0;
 		virtual MaterialRuntime& getCpMtlRun() = 0;
 		virtual MaterialRuntime& getDpMtlRun() = 0;
 		virtual const MaterialRuntime& getCpMtlRun() const = 0;
@@ -27,8 +30,8 @@ class RenderableNode: public SceneNode
 };
 
 
-inline RenderableNode::RenderableNode(SceneNode* parent):
-	SceneNode(SNT_RENDERABLE, false, parent)
+inline RenderableNode::RenderableNode(SceneNode* parent)
+:	SceneNode(SNT_RENDERABLE, false, parent)
 {}
 
 

+ 4 - 2
src/Scene/Scene.cpp

@@ -94,13 +94,15 @@ void Scene::unregisterNode(SceneNode* node)
 //==============================================================================
 void Scene::registerController(Controller* controller)
 {
-	ASSERT(std::find(controllers.begin(), controllers.end(), controller) == controllers.end());
+	ASSERT(std::find(controllers.begin(), controllers.end(), controller) ==
+		controllers.end());
 	controllers.push_back(controller);
 }
 
 void Scene::unregisterController(Controller* controller)
 {
-	Vec<Controller*>::iterator it = std::find(controllers.begin(), controllers.end(), controller);
+	Vec<Controller*>::iterator it = std::find(controllers.begin(),
+		controllers.end(), controller);
 	ASSERT(it != controllers.end());
 	controllers.erase(it);
 }

+ 29 - 7
src/Scene/Scene.h

@@ -34,7 +34,8 @@ class Scene
 		Scene();
 		~Scene() {}
 
-		void registerNode(SceneNode* node); ///< Put a node in the appropriate containers
+		/// Put a node in the appropriate containers
+		void registerNode(SceneNode* node);
 		void unregisterNode(SceneNode* node);
 		void registerController(Controller* controller);
 		void unregisterController(Controller* controller);
@@ -46,14 +47,15 @@ class Scene
 		/// @name Accessors
 		/// @{
 		GETTER_SETTER(Vec3, ambientCol, getAmbientCol, setAmbientCol)
-		Phys::MasterContainer& getPhysMasterContainer() {return *physMasterContainer;}
-		const Phys::MasterContainer& getPhysMasterContainer() const {return *physMasterContainer;}
-		const VisibilityTester& getVisibilityTester() const {return *visibilityTester;}
+		Phys::MasterContainer& getPhysMasterContainer();
+		const Phys::MasterContainer& getPhysMasterContainer() const;
+		const VisibilityTester& getVisibilityTester() const;
 
 		GETTER_RW(Types<SceneNode>::Container, nodes, getAllNodes)
 		GETTER_RW(Types<Light>::Container, lights, getLights)
 		GETTER_RW(Types<Camera>::Container, cameras, getCameras)
-		GETTER_RW(Types<ParticleEmitter>::Container, particleEmitters, getParticleEmitters)
+		GETTER_RW(Types<ParticleEmitter>::Container, particleEmitters,
+			getParticleEmitters)
 		GETTER_RW(Types<ModelNode>::Container, modelNodes, getModelNodes)
 		GETTER_RW(Types<SkinNode>::Container, skinNodes, getSkinNodes)
 		GETTER_RW(Types<Controller>::Container, controllers, getControllers)
@@ -72,7 +74,8 @@ class Scene
 		/// @}
 
 		Vec3 ambientCol; ///< The global ambient color
-		boost::scoped_ptr<Phys::MasterContainer> physMasterContainer; ///< Connection with Bullet wrapper
+		/// Connection with Bullet wrapper
+		boost::scoped_ptr<Phys::MasterContainer> physMasterContainer;
 		boost::scoped_ptr<VisibilityTester> visibilityTester;
 
 		/// Adds a node in a container
@@ -96,10 +99,29 @@ inline void Scene::putBackNode(ContainerType& container, Type* x)
 template<typename ContainerType, typename Type>
 inline void Scene::eraseNode(ContainerType& container, Type* x)
 {
-	typename ContainerType::iterator it = std::find(container.begin(), container.end(), x);
+	typename ContainerType::iterator it =
+		std::find(container.begin(), container.end(), x);
 	ASSERT(it != container.end());
 	container.erase(it);
 }
 
 
+inline Phys::MasterContainer& Scene::getPhysMasterContainer()
+{
+	return *physMasterContainer;
+}
+
+
+inline const Phys::MasterContainer& Scene::getPhysMasterContainer() const
+{
+	return *physMasterContainer;
+}
+
+
+inline const VisibilityTester& Scene::getVisibilityTester() const
+{
+	return *visibilityTester;
+}
+
+
 #endif

+ 11 - 37
src/Scene/SceneNode.cpp

@@ -15,8 +15,9 @@ uint SceneNode::uid = 0;
 //==============================================================================
 // Constructor                                                                 =
 //==============================================================================
-SceneNode::SceneNode(SceneNodeType type_, bool compoundFlag_, SceneNode* parent):
-	Object(parent),
+SceneNode::SceneNode(SceneNodeType type_, bool compoundFlag_,
+	SceneNode* parent)
+:	Object(parent),
 	type(type_),
 	compoundFlag(compoundFlag_)
 {
@@ -56,52 +57,21 @@ void SceneNode::updateWorldTransform()
 		}
 		else
 		{
-			worldTransform = Transform::combineTransformations(parent->getWorldTransform(), localTransform);
+			worldTransform = Transform::combineTransformations(
+				parent->getWorldTransform(), localTransform);
 		}
 	}
 	else // else copy
 	{
 		worldTransform = localTransform;
 	}
-
-
-	// transform the bvolume
-	/*if(bvolumeLspace != NULL)
-	{
-		DEBUG_ERR(bvolumeLspace->type!=bvolume_t::BSPHERE && bvolumeLspace->type!=bvolume_t::AABB && bvolumeLspace->type!=bvolume_t::OBB);
-
-		switch(bvolumeLspace->type)
-		{
-			case bvolume_t::BSPHERE:
-			{
-				bsphere_t sphere = static_cast<bsphere_t*>(bvolumeLspace)->Transformed(translationWspace, rotationWspace, scaleWspace);
-				*static_cast<bsphere_t*>(bvolumeLspace) = sphere;
-				break;
-			}
-
-			case bvolume_t::AABB:
-			{
-				aabb_t aabb = static_cast<aabb_t*>(bvolumeLspace)->Transformed(translationWspace, rotationWspace, scaleWspace);
-				*static_cast<aabb_t*>(bvolumeLspace) = aabb;
-				break;
-			}
-
-			case bvolume_t::OBB:
-			{
-				obb_t obb = static_cast<obb_t*>(bvolumeLspace)->Transformed(translationWspace, rotationWspace, scaleWspace);
-				*static_cast<obb_t*>(bvolumeLspace) = obb;
-				break;
-			}
-
-			default:
-				FATAL("What the fuck");
-		}
-	}*/
 }
 
 
 //==============================================================================
 // Move(s)                                                                     =
+//==============================================================================
+
 //==============================================================================
 void SceneNode::moveLocalX(float distance)
 {
@@ -109,12 +79,16 @@ void SceneNode::moveLocalX(float distance)
 	getLocalTransform().getOrigin() += x_axis * distance;
 }
 
+
+//==============================================================================
 void SceneNode::moveLocalY(float distance)
 {
 	Vec3 y_axis = localTransform.getRotation().getColumn(1);
 	getLocalTransform().getOrigin() += y_axis * distance;
 }
 
+
+//==============================================================================
 void SceneNode::moveLocalZ(float distance)
 {
 	Vec3 z_axis = localTransform.getRotation().getColumn(2);

+ 37 - 11
src/Scene/SceneNode.h

@@ -30,14 +30,17 @@ class SceneNode: public Object
 			SNT_RENDERABLE
 		};
 		
-		explicit SceneNode(SceneNodeType type_, bool compoundFlag, SceneNode* parent);
+		explicit SceneNode(SceneNodeType type_, bool compoundFlag,
+			SceneNode* parent);
 		virtual ~SceneNode();
 		virtual void init(const char*) = 0; ///< init using a script file
 
 		/// @name Accessors
 		/// @{
-		GETTER_SETTER(Transform, localTransform, getLocalTransform, setLocalTransform)
-		GETTER_SETTER(Transform, worldTransform, getWorldTransform, setWorldTransform)
+		GETTER_SETTER(Transform, localTransform, getLocalTransform,
+			setLocalTransform)
+		GETTER_SETTER(Transform, worldTransform, getWorldTransform,
+			setWorldTransform)
 		GETTER_R(Transform, prevWorldTransform, getPrevWorldTransform)
 
 		GETTER_R_BY_VAL(SceneNodeType, type, getSceneNodeType)
@@ -53,12 +56,13 @@ class SceneNode: public Object
 		/// @}
 
 		/// @name Updates
-		/// Two separate updates for the main loop. The update happens anyway and the updateTrf only when the node is
-		/// being moved
+		/// Two separate updates for the main loop. The update happens anyway
+		/// and the updateTrf only when the node is being moved
 		/// @{
 
 		/// This is called every frame
-		virtual void frameUpdate(float /*prevUpdateTime*/, float /*crntTime*/) = 0;
+		virtual void frameUpdate(float /*prevUpdateTime*/,
+			float /*crntTime*/) = 0;
 
 		/// This is called if the node moved
 		virtual void moveUpdate() = 0;
@@ -66,9 +70,9 @@ class SceneNode: public Object
 
 		/// @name Mess with the local transform
 		/// @{
-		void rotateLocalX(float angDegrees) {getLocalTransform().getRotation().rotateXAxis(angDegrees);}
-		void rotateLocalY(float angDegrees) {getLocalTransform().getRotation().rotateYAxis(angDegrees);}
-		void rotateLocalZ(float angDegrees) {getLocalTransform().getRotation().rotateZAxis(angDegrees);}
+		void rotateLocalX(float angDegrees);
+		void rotateLocalY(float angDegrees);
+		void rotateLocalZ(float angDegrees);
 		void moveLocalX(float distance);
 		void moveLocalY(float distance);
 		void moveLocalZ(float distance);
@@ -84,11 +88,15 @@ class SceneNode: public Object
 
 	private:
 		Transform localTransform; ///< The transformation in local space
-		Transform worldTransform; ///< The transformation in world space (local combined with parent's transformation)
+		/// The transformation in world space (local combined with parent's
+		/// transformation)
+		Transform worldTransform;
 		Transform prevWorldTransform;
 
 		SceneNodeType type;
-		bool compoundFlag; ///< This means that the children will inherit the world transform of this node
+		/// This means that the children will inherit the world transform of
+		/// this node
+		bool compoundFlag;
 
 		static uint uid; ///< Unique identifier
 
@@ -100,4 +108,22 @@ class SceneNode: public Object
 };
 
 
+inline void SceneNode::rotateLocalX(float angDegrees)
+{
+	getLocalTransform().getRotation().rotateXAxis(angDegrees);
+}
+
+
+inline void SceneNode::rotateLocalY(float angDegrees)
+{
+	getLocalTransform().getRotation().rotateYAxis(angDegrees);
+}
+
+
+inline void SceneNode::rotateLocalZ(float angDegrees)
+{
+	getLocalTransform().getRotation().rotateZAxis(angDegrees);
+}
+
+
 #endif

+ 38 - 23
src/Scene/SkelAnimModelNodeCtrl.cpp

@@ -23,12 +23,13 @@ SkelAnimModelNodeCtrl::SkelAnimModelNodeCtrl(SkinNode& skinNode_):
 // interpolate                                                                 =
 //==============================================================================
 void SkelAnimModelNodeCtrl::interpolate(const SkelAnim& animation, float frame,
-                                        Vec<Vec3>& boneTranslations, Vec<Mat3>& boneRotations)
+	Vec<Vec3>& boneTranslations, Vec<Mat3>& boneRotations)
 {
 	ASSERT(frame < animation.getFramesNum());
 
-	// calculate the t (used in slerp and lerp) using the keyframs and the frame and
-	// calc the lPose and rPose witch indicate the pose IDs in witch the frame lies between
+	// calculate the t (used in slerp and lerp) using the keyframs and the
+	// frame and calc the lPose and rPose witch indicate the pose IDs in witch
+	// the frame lies between
 	const Vec<uint>& keyframes = animation.getKeyframes();
 	float t = 0.0;
 	uint lPose = 0, rPose = 0;
@@ -44,7 +45,8 @@ void SkelAnimModelNodeCtrl::interpolate(const SkelAnim& animation, float frame,
 		{
 			lPose = j-1;
 			rPose = j;
-			t = (frame - (float)keyframes[lPose]) / float(keyframes[rPose] - keyframes[lPose]);
+			t = (frame - (float)keyframes[lPose]) / float(keyframes[rPose] -
+				keyframes[lPose]);
 			break;
 		}
 	}
@@ -58,7 +60,8 @@ void SkelAnimModelNodeCtrl::interpolate(const SkelAnim& animation, float frame,
 		Mat3& localRot = boneRotations[i];
 		Vec3& localTransl = boneTranslations[i];
 
-		// if the bone has animations then slerp and lerp to find the rotation and translation
+		// if the bone has animations then slerp and lerp to find the rotation
+		// and translation
 		if(banim.getBonePoses().size() != 0)
 		{
 			const BonePose& lBpose = banim.getBonePoses()[lPose];
@@ -88,7 +91,7 @@ void SkelAnimModelNodeCtrl::interpolate(const SkelAnim& animation, float frame,
 // updateBoneTransforms                                                        =
 //==============================================================================
 void SkelAnimModelNodeCtrl::updateBoneTransforms(const Skeleton& skeleton,
-                                                 Vec<Vec3>& boneTranslations, Vec<Mat3>& boneRotations)
+	Vec<Vec3>& boneTranslations, Vec<Mat3>& boneRotations)
 {
 	uint queue[128];
 	uint head = 0, tail = 0;
@@ -111,21 +114,24 @@ void SkelAnimModelNodeCtrl::updateBoneTransforms(const Skeleton& skeleton,
 		// bone.final_transform = MA * ANIM * MAi
 		// where MA is bone matrix at armature space and ANIM the interpolated transformation.
 		combineTransformations(boneTranslations[boneId], boneRotations[boneId],
-		                       boned.getTslSkelSpaceInv(), boned.getRotSkelSpaceInv(),
-		                       boneTranslations[boneId], boneRotations[boneId]);
+			boned.getTslSkelSpaceInv(), boned.getRotSkelSpaceInv(),
+			boneTranslations[boneId], boneRotations[boneId]);
 
 		combineTransformations(boned.getTslSkelSpace(), boned.getRotSkelSpace(),
-		                       boneTranslations[boneId], boneRotations[boneId],
-		                       boneTranslations[boneId], boneRotations[boneId]);
+			boneTranslations[boneId], boneRotations[boneId],
+			boneTranslations[boneId], boneRotations[boneId]);
 
 		// and finaly add the parent's transform
 		if(boned.getParent())
 		{
 			// bone.final_final_transform = parent.transf * bone.final_transform
-			combineTransformations(boneTranslations[boned.getParent()->getPos()],
-			                       boneRotations[boned.getParent()->getPos()],
-			                       boneTranslations[boneId], boneRotations[boneId],
-			                       boneTranslations[boneId], boneRotations[boneId]);
+			combineTransformations(
+				boneTranslations[boned.getParent()->getPos()],
+				boneRotations[boned.getParent()->getPos()],
+				boneTranslations[boneId],
+				boneRotations[boneId],
+				boneTranslations[boneId],
+				boneRotations[boneId]);
 		}
 
 		// now add the bone's childes
@@ -140,8 +146,9 @@ void SkelAnimModelNodeCtrl::updateBoneTransforms(const Skeleton& skeleton,
 //==============================================================================
 // deform                                                                      =
 //==============================================================================
-void SkelAnimModelNodeCtrl::deform(const Skeleton& skeleton, const Vec<Vec3>& boneTranslations,
-                                   const Vec<Mat3>& boneRotations, Vec<Vec3>& heads, Vec<Vec3>& tails)
+void SkelAnimModelNodeCtrl::deform(const Skeleton& skeleton,
+	const Vec<Vec3>& boneTranslations, const Vec<Mat3>& boneRotations,
+	Vec<Vec3>& heads, Vec<Vec3>& tails)
 {
 	for(uint i = 0; i < skeleton.getBones().size(); i++)
 	{
@@ -160,7 +167,8 @@ void SkelAnimModelNodeCtrl::deform(const Skeleton& skeleton, const Vec<Vec3>& bo
 void SkelAnimModelNodeCtrl::update(float)
 {
 	frame += step;
-	if(frame > skelAnim->getFramesNum()) // if the crnt is finished then play the next or loop the crnt
+	// if the crnt is finished then play the next or loop the crnt
+	if(frame > skelAnim->getFramesNum())
 	{
 		frame = 0.0;
 	}
@@ -170,18 +178,25 @@ void SkelAnimModelNodeCtrl::update(float)
 		return;
 	}
 
-	interpolate(*skelAnim, frame, skinNode.getBoneTranslations(), skinNode.getBoneRotations());
-	updateBoneTransforms(skinNode.getSkin().getSkeleton(), skinNode.getBoneTranslations(), skinNode.getBoneRotations());
+	interpolate(*skelAnim, frame, skinNode.getBoneTranslations(),
+		skinNode.getBoneRotations());
+
+	updateBoneTransforms(skinNode.getSkin().getSkeleton(),
+		skinNode.getBoneTranslations(), skinNode.getBoneRotations());
 
 	if(MainRendererSingleton::getInstance().getDbg().isEnabled() &&
-	   MainRendererSingleton::getInstance().getDbg().isShowSkeletonsEnabled())
+		MainRendererSingleton::getInstance().getDbg().isShowSkeletonsEnabled())
 	{
-		deform(skinNode.getSkin().getSkeleton(), skinNode.getBoneTranslations(), skinNode.getBoneRotations(),
-		       skinNode.getHeads(), skinNode.getTails());
+		deform(skinNode.getSkin().getSkeleton(),
+			skinNode.getBoneTranslations(), skinNode.getBoneRotations(),
+			skinNode.getHeads(), skinNode.getTails());
 	}
 
+	const SkinsDeformer& sd =
+		MainRendererSingleton::getInstance().getSkinsDeformer();
+
 	BOOST_FOREACH(SkinPatchNode* skinPatchNode, skinNode.getPatcheNodes())
 	{
-		MainRendererSingleton::getInstance().getSkinsDeformer().deform(*skinPatchNode);
+		sd.deform(*skinPatchNode);
 	}
 }

+ 7 - 4
src/Scene/SkelAnimModelNodeCtrl.h

@@ -43,13 +43,16 @@ class SkelAnimModelNodeCtrl: public Controller
 		/// @param[in] frame Frame
 		/// @param[out] translations Translations vector
 		/// @param[out] rotations Rotations vector
-		static void interpolate(const SkelAnim& animation, float frame, Vec<Vec3>& translations, Vec<Mat3>& rotations);
+		static void interpolate(const SkelAnim& animation, float frame,
+			Vec<Vec3>& translations, Vec<Mat3>& rotations);
 
-		static void updateBoneTransforms(const Skeleton& skel, Vec<Vec3>& translations, Vec<Mat3>& rotations);
+		static void updateBoneTransforms(const Skeleton& skel,
+			Vec<Vec3>& translations, Vec<Mat3>& rotations);
 
 		/// Now with HW skinning it deforms only the debug skeleton
-		static void deform(const Skeleton& skel, const Vec<Vec3>& translations, const Vec<Mat3>& rotations,
-		                   Vec<Vec3>& heads, Vec<Vec3>& tails);
+		static void deform(const Skeleton& skel, const Vec<Vec3>& translations,
+			const Vec<Mat3>& rotations,
+			Vec<Vec3>& heads, Vec<Vec3>& tails);
 		/// @}
 };
 

+ 2 - 1
src/Scene/SkinNode.cpp

@@ -31,5 +31,6 @@ void SkinNode::init(const char* filename)
 void SkinNode::moveUpdate()
 {
 	visibilityShapeWSpace.set(tails);
-	visibilityShapeWSpace = visibilityShapeWSpace.getTransformed(getWorldTransform());
+	visibilityShapeWSpace = visibilityShapeWSpace.getTransformed(
+		getWorldTransform());
 }

+ 2 - 2
src/Scene/SkinNode.h

@@ -33,8 +33,8 @@ class SkinNode: public SceneNode
 
 		void init(const char* filename);
 
-		/// Update boundingShapeWSpace from bone tails (not heads as well cause its faster that way). The tails come
-		/// from the previous frame
+		/// Update boundingShapeWSpace from bone tails (not heads as well
+		/// cause its faster that way). The tails come from the previous frame
 		void moveUpdate();
 
 		void frameUpdate(float /*prevUpdateTime*/, float /*crntTime*/) {}

+ 57 - 21
src/Scene/SkinPatchNode.cpp

@@ -30,51 +30,87 @@ SkinPatchNode::SkinPatchNode(const ModelPatch& modelPatch_, SkinNode* parent):
 	// Positions
 	if(mesh.getVbo(Mesh::VBO_VERT_POSITIONS).isCreated())
 	{
-		tfVbos[TFV_POSITIONS].create(GL_ARRAY_BUFFER, mesh.getVbo(Mesh::VBO_VERT_POSITIONS).getSizeInBytes(),
-		                             NULL, GL_STATIC_DRAW);
+		tfVbos[TFV_POSITIONS].create(GL_ARRAY_BUFFER,
+			mesh.getVbo(Mesh::VBO_VERT_POSITIONS).getSizeInBytes(),
+			NULL,
+			GL_STATIC_DRAW);
 
 		vboArr[Mesh::VBO_VERT_POSITIONS] = &tfVbos[TFV_POSITIONS];
 
-		tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_POSITIONS), SkinsDeformer::TFSPA_POSITION, 3,
-		                           GL_FLOAT, false, 0, NULL);
+		tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_POSITIONS),
+			SkinsDeformer::TFSPA_POSITION,
+			3,
+			GL_FLOAT,
+			false,
+			0,
+			NULL);
 	}
 
 	// Normals
 	if(mesh.getVbo(Mesh::VBO_VERT_NORMALS).isCreated())
 	{
-		tfVbos[TFV_NORMALS].create(GL_ARRAY_BUFFER, mesh.getVbo(Mesh::VBO_VERT_NORMALS).getSizeInBytes(),
-	                               NULL, GL_STATIC_DRAW);
+		tfVbos[TFV_NORMALS].create(GL_ARRAY_BUFFER,
+			mesh.getVbo(Mesh::VBO_VERT_NORMALS).getSizeInBytes(),
+			NULL,
+			GL_STATIC_DRAW);
 
 		vboArr[Mesh::VBO_VERT_NORMALS] = &tfVbos[TFV_NORMALS];
 
-		tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_NORMALS), SkinsDeformer::TFSPA_NORMAL, 3,
-		                           GL_FLOAT, false, 0, NULL);
+		tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_NORMALS),
+			SkinsDeformer::TFSPA_NORMAL,
+			3,
+			GL_FLOAT,
+			false,
+			0,
+			NULL);
 	}
 
 	// Tangents
 	if(mesh.getVbo(Mesh::VBO_VERT_TANGENTS).isCreated())
 	{
-		tfVbos[TFV_TANGENTS].create(GL_ARRAY_BUFFER, mesh.getVbo(Mesh::VBO_VERT_TANGENTS).getSizeInBytes(),
-		                            NULL, GL_STATIC_DRAW);
+		tfVbos[TFV_TANGENTS].create(GL_ARRAY_BUFFER,
+			mesh.getVbo(Mesh::VBO_VERT_TANGENTS).getSizeInBytes(),
+			NULL,
+			GL_STATIC_DRAW);
 
 		vboArr[Mesh::VBO_VERT_TANGENTS] = &tfVbos[TFV_TANGENTS];
 
-		tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_TANGENTS), SkinsDeformer::TFSPA_TANGENT, 4,
-		                           GL_FLOAT, false, 0, NULL);
+		tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_TANGENTS),
+			SkinsDeformer::TFSPA_TANGENT,
+			4,
+			GL_FLOAT,
+			false,
+			0,
+			NULL);
 	}
 
 	// Attach some extra stuff to the tfVao
 	ASSERT(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS).isCreated());
 
-	tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS), SkinsDeformer::TFSPA_VERT_WEIGHT_BONES_NUM, 1,
-	                           GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(0));
-
-
-	tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS), SkinsDeformer::TFSPA_VERT_WEIGHT_BONE_IDS, 4,
-	                           GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(4));
-
-	tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS),SkinsDeformer::TFSPA_VERT_WEIGHT_WEIGHTS, 4,
-	                           GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(20));
+	tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS),
+		SkinsDeformer::TFSPA_VERT_WEIGHT_BONES_NUM,
+		1,
+		GL_FLOAT,
+		GL_FALSE,
+		sizeof(MeshData::VertexWeight),
+		BUFFER_OFFSET(0));
+
+
+	tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS),
+		SkinsDeformer::TFSPA_VERT_WEIGHT_BONE_IDS,
+		4,
+		GL_FLOAT,
+		GL_FALSE,
+		sizeof(MeshData::VertexWeight),
+		BUFFER_OFFSET(4));
+
+	tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS),
+		SkinsDeformer::TFSPA_VERT_WEIGHT_WEIGHTS,
+		4,
+		GL_FLOAT,
+		GL_FALSE,
+		sizeof(MeshData::VertexWeight),
+		BUFFER_OFFSET(20));
 
 	// Rendering VAOs
 	createVao(rsrc.getCpMtl(), vboArr, cpVao);

+ 2 - 1
src/Scene/SkinPatchNode.h

@@ -34,7 +34,8 @@ class SkinPatchNode: public PatchNode
 		virtual void frameUpdate(float /*prevUpdateTime*/, float /*crntTime*/) {}
 
 	private:
-		boost::array<Vbo, TFV_NUM> tfVbos; ///< VBOs that contain the deformed vertex attributes
+		/// VBOs that contain the deformed vertex attributes
+		boost::array<Vbo, TFV_NUM> tfVbos;
 		Vao tfVao; ///< For TF passes
 };
 

+ 2 - 1
src/Scene/SpotLight.cpp

@@ -12,5 +12,6 @@ void SpotLight::init(const char* filename)
 		throw EXCEPTION("Light data is wrong type");
 	}
 	camera = new PerspectiveCamera(true, this);
-	camera->setAll(lightData->getFovX(), lightData->getFovY(), 0.02, lightData->getDistance());
+	camera->setAll(lightData->getFovX(), lightData->getFovY(), 0.02,
+		lightData->getDistance());
 }

+ 4 - 2
src/Scene/VisibilityInfo.h

@@ -18,8 +18,10 @@ class VisibilityInfo
 	public:
 		/// @name Accessors
 		/// @{
-		GETTER_RW(std::deque<const RenderableNode*>, msRenderableNodes, getVisibleMsRenderableNodes)
-		GETTER_RW(std::deque<const RenderableNode*>, bsRenderableNodes, getVisibleBsRenderableNodes)
+		GETTER_RW(std::deque<const RenderableNode*>, msRenderableNodes,
+			getVisibleMsRenderableNodes)
+		GETTER_RW(std::deque<const RenderableNode*>, bsRenderableNodes,
+			getVisibleBsRenderableNodes)
 		GETTER_RW(Vec<const PointLight*>, pointLights, getVisiblePointLights)
 		GETTER_RW(Vec<SpotLight*>, spotLights, getVisibleSpotLights)
 		/// @}

+ 28 - 85
src/Scene/VisibilityTester.cpp

@@ -12,13 +12,21 @@
 #include "Core/Logger.h"
 
 
+//==============================================================================
+// Destructor                                                                  =
+//==============================================================================
+VisibilityTester::~VisibilityTester()
+{}
+
+
 //==============================================================================
 // CmpDistanceFromOrigin::operator()                                           =
 //==============================================================================
-bool VisibilityTester::CmpDistanceFromOrigin::operator()(const SceneNode* a, const SceneNode* b) const
+bool VisibilityTester::CmpDistanceFromOrigin::operator()(const SceneNode* a,
+	const SceneNode* b) const
 {
 	return (a->getWorldTransform().getOrigin() - o).getLengthSquared() <
-	       (b->getWorldTransform().getOrigin() - o).getLengthSquared();
+		(b->getWorldTransform().getOrigin() - o).getLengthSquared();
 }
 
 
@@ -58,7 +66,8 @@ void VisibilityTester::test(Camera& cam)
 			{
 				PointLight* pointl = static_cast<PointLight*>(light);
 
-				Col::Sphere sphere(pointl->getWorldTransform().getOrigin(), pointl->getRadius());
+				Col::Sphere sphere(pointl->getWorldTransform().getOrigin(),
+					pointl->getRadius());
 				if(cam.insideFrustum(sphere))
 				{
 					cam.getVisiblePointLights().push_back(pointl);
@@ -110,7 +119,8 @@ bool VisibilityTester::test(const Type& tested, const Camera& cam)
 //==============================================================================
 // getRenderableNodes                                                          =
 //==============================================================================
-void VisibilityTester::getRenderableNodes(bool skipShadowless_, const Camera& cam_, VisibilityInfo& storage)
+void VisibilityTester::getRenderableNodes(bool skipShadowless_,
+	const Camera& cam_, VisibilityInfo& storage)
 {
 	cam = &cam_;
 	skipShadowless = skipShadowless_;
@@ -121,97 +131,28 @@ void VisibilityTester::getRenderableNodes(bool skipShadowless_, const Camera& ca
 
 	for(uint i = 0; i < JobManagerSingleton::getInstance().getThreadsNum(); i++)
 	{
-		JobManagerSingleton::getInstance().assignNewJob(i, getRenderableNodesJobCallback, this);
+		JobManagerSingleton::getInstance().assignNewJob(i,
+			getRenderableNodesJobCallback, this);
 	}
 	JobManagerSingleton::getInstance().waitForAllJobsToFinish();
 
-	/*
-	//
-	// ModelNodes
-	//
-	BOOST_FOREACH(ModelNode* node, scene.getModelNodes())
-	{
-		// Skip if the ModeNode is not visible
-		if(!test(*node, *cam))
-		{
-			continue;
-		}
-
-		node->setVisible(true);
-
-		// If visible test every patch individually
-		BOOST_FOREACH(ModelPatchNode* modelPatchNode, node->getModelPatchNodes())
-		{
-			// Skip shadowless
-			if(skipShadowless && !modelPatchNode->getCpMtl().castsShadow())
-			{
-				continue;
-			}
-
-			// Test if visible by main camera
-			if(test(*modelPatchNode, *cam))
-			{
-				if(modelPatchNode->getCpMtl().renderInBlendingStage())
-				{
-					storage.getVisibleBsRenderableNodes().push_back(modelPatchNode);
-				}
-				else
-				{
-					storage.getVisibleMsRenderableNodes().push_back(modelPatchNode);
-				}
-				modelPatchNode->setVisible(true);
-			}
-		}
-	}
-
-	//
-	// SkinNodes
-	//
-	BOOST_FOREACH(SkinNode* node, scene.getSkinNodes())
-	{
-		// Skip if the SkinNode is not visible
-		if(!test(*node, *cam))
-		{
-			continue;
-		}
-
-		node->setVisible(true);
-
-		// Put all the patches into the visible container
-		BOOST_FOREACH(SkinPatchNode* patchNode, node->getPatcheNodes())
-		{
-			// Skip shadowless
-			if(skipShadowless && !patchNode->getCpMtl().castsShadow())
-			{
-				continue;
-			}
-
-			if(patchNode->getCpMtl().renderInBlendingStage())
-			{
-				storage.getVisibleBsRenderableNodes().push_back(patchNode);
-			}
-			else
-			{
-				storage.getVisibleMsRenderableNodes().push_back(patchNode);
-			}
-			patchNode->setVisible(true);
-		}
-	}*/
-
 	//
 	// Sort the renderables from closest to the camera to the farthest
 	//
-	std::sort(storage.getVisibleMsRenderableNodes().begin(), storage.getVisibleMsRenderableNodes().end(),
-	          CmpDistanceFromOrigin(cam->getWorldTransform().getOrigin()));
-	std::sort(storage.getVisibleBsRenderableNodes().begin(), storage.getVisibleBsRenderableNodes().end(),
-	          CmpDistanceFromOrigin(cam->getWorldTransform().getOrigin()));
+	std::sort(storage.getVisibleMsRenderableNodes().begin(),
+		storage.getVisibleMsRenderableNodes().end(),
+		CmpDistanceFromOrigin(cam->getWorldTransform().getOrigin()));
+	std::sort(storage.getVisibleBsRenderableNodes().begin(),
+		storage.getVisibleBsRenderableNodes().end(),
+		CmpDistanceFromOrigin(cam->getWorldTransform().getOrigin()));
 }
 
 
 //==============================================================================
 // getRenderableNodesJobCallback                                               =
 //==============================================================================
-void VisibilityTester::getRenderableNodesJobCallback(void* args, const WorkerThread& workerThread)
+void VisibilityTester::getRenderableNodesJobCallback(void* args,
+	const WorkerThread& workerThread)
 {
 	uint id = workerThread.getId();
 	uint threadsNum = workerThread.getJobManager().getThreadsNum();
@@ -247,10 +188,12 @@ void VisibilityTester::getRenderableNodesJobCallback(void* args, const WorkerThr
 		node->setVisible(true);
 
 		// If visible test every patch individually
-		BOOST_FOREACH(ModelPatchNode* modelPatchNode, node->getModelPatchNodes())
+		BOOST_FOREACH(ModelPatchNode* modelPatchNode,
+			node->getModelPatchNodes())
 		{
 			// Skip shadowless
-			if(visTester->skipShadowless && !modelPatchNode->getCpMtl().castsShadow())
+			if(visTester->skipShadowless &&
+				!modelPatchNode->getCpMtl().castsShadow())
 			{
 				continue;
 			}

+ 1 - 0
src/Scene/VisibilityTester.h

@@ -23,6 +23,7 @@ class VisibilityTester
 	public:
 		/// Constructor
 		VisibilityTester(Scene& scene);
+		~VisibilityTester();
 
 		/// This method:
 		/// - Gets the visible renderable nodes

+ 2 - 1
src/Scripting/Events/Manager.bpi.cpp

@@ -10,7 +10,8 @@ WRAP(EventManager)
 	class_<Event::Manager, noncopyable>("EventManager", no_init)
 		.def("createEvent", &Event::Manager::createEvent<Event::SceneColor>,
 			return_value_policy<reference_existing_object>())
-		.def("createEvent", &Event::Manager::createEvent<Event::MainRendererPpsHdr>,
+		.def("createEvent",
+			&Event::Manager::createEvent<Event::MainRendererPpsHdr>,
 			return_value_policy<reference_existing_object>())
 	;
 }

+ 4 - 2
src/Scripting/Renderer/Bl.bpi.cpp

@@ -8,10 +8,12 @@ WRAP(Bl)
 		.def("isEnabled", (bool (Bl::*)() const)(&Bl::isEnabled))
 		.def("setEnabled", &Bl::setEnabled)
 
-		.def("getBlurringIterationsNum", (uint (Bl::*)() const)(&Bl::getBlurringIterationsNum))
+		.def("getBlurringIterationsNum", (uint (Bl::*)() const)(
+			&Bl::getBlurringIterationsNum))
 		.def("setBlurringIterationsNum", &Bl::setBlurringIterationsNum)
 
-		.def("getSideBlurFactor", (float (Bl::*)() const)(&Bl::getSideBlurFactor))
+		.def("getSideBlurFactor", (float (Bl::*)() const)(
+			&Bl::getSideBlurFactor))
 		.def("setSideBlurFactor", &Bl::setSideBlurFactor)
 	;
 }

+ 2 - 1
src/Scripting/Renderer/Hdr.bpi.cpp

@@ -5,7 +5,8 @@
 WRAP(Hdr)
 {
 	class_<Hdr, noncopyable>("Hdr", no_init)
-		.def("getBlurringIterationsNum", (uint (Hdr::*)() const)(&Hdr::getBlurringIterationsNum))
+		.def("getBlurringIterationsNum", (uint (Hdr::*)() const)(
+			&Hdr::getBlurringIterationsNum))
 		.def("setBlurringIterationsNum", &Hdr::setBlurringIterationsNum)
 
 		.def("getExposure", (float (Hdr::*)() const)(&Hdr::getExposure))

+ 1 - 1
src/Scripting/Renderer/MainRenderer.bpi.cpp

@@ -7,6 +7,6 @@ WRAP(MainRenderer)
 {
 	class_<MainRenderer, bases<Renderer>, noncopyable>("MainRenderer", no_init)
 		.def("getDbg", (Dbg& (MainRenderer::*)())(&MainRenderer::getDbg),
-		     return_value_policy<reference_existing_object>())
+			return_value_policy<reference_existing_object>())
 	;
 }

+ 5 - 2
src/Scripting/Renderer/Pps.bpi.cpp

@@ -7,7 +7,10 @@
 WRAP(Pps)
 {
 	class_<Pps, noncopyable>("Pps", no_init)
-		.def("getHdr", (Hdr& (Pps::*)())(&Pps::getHdr), return_value_policy<reference_existing_object>())
-		.def("getBl", (Bl& (Pps::*)())(&Pps::getBl), return_value_policy<reference_existing_object>())
+		.def("getHdr", (Hdr& (Pps::*)())(&Pps::getHdr),
+			return_value_policy<reference_existing_object>())
+
+		.def("getBl", (Bl& (Pps::*)())(&Pps::getBl),
+			return_value_policy<reference_existing_object>())
 	;
 }

+ 2 - 3
src/Scripting/Renderer/Renderer.bpi.cpp

@@ -7,8 +7,7 @@ WRAP(Renderer)
 	typedef Pps& (Renderer::* getPpsAccessor)();
 
 	class_<Renderer, noncopyable>("Renderer", no_init)
-		//BP_PROPERTY_BASIC_TYPE(uint, Renderer, framesNum, getter__, setter__)
-		//.def("getFramesNum", &Renderer::getFramesNum)
-		.def("getPps", (getPpsAccessor)(&Renderer::getPps), return_value_policy<reference_existing_object>())
+		.def("getPps", (getPpsAccessor)(&Renderer::getPps),
+			return_value_policy<reference_existing_object>())
 	;
 }

+ 14 - 12
src/Scripting/Scene/MaterialRuntime.bpi.cpp

@@ -4,22 +4,24 @@
 
 WRAP(MaterialRuntime)
 {
-	/*class_<MaterialRuntime::MaterialRuntimeUserDefinedVarContainer, noncopyable>("MaterialRuntime::MaterialRuntimeUserDefinedVarContainer", no_init)
-		.def(vector_indexing_suite<MaterialRuntime::MaterialRuntimeUserDefinedVarContainer, true>())
-	;*/
-	//WRAP_CONTAINER(MaterialRuntime::MaterialRuntimeUserDefinedVarContainer)
-
 	class_<MaterialRuntime, noncopyable>("MaterialRuntime", no_init)
 		.def("getUserDefinedVars",
-		     (boost::ptr_vector<MaterialRuntimeUserDefinedVar>& (MaterialRuntime::*)())(&MaterialRuntime::getUserDefinedVars),
-		     return_value_policy<reference_existing_object>())
+			(boost::ptr_vector<MaterialRuntimeUserDefinedVar>&
+			(MaterialRuntime::*)())(&MaterialRuntime::getUserDefinedVars),
+			return_value_policy<reference_existing_object>())
 
-		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*, const float&))(&MaterialRuntime::setUserDefVarValue))
-		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*, const Vec2&))(&MaterialRuntime::setUserDefVarValue))
-		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*, const Vec3&))(&MaterialRuntime::setUserDefVarValue))
-		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*, const MtlUserDefinedVar::Fai&))(&MaterialRuntime::setUserDefVarValue))
+		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*,
+			const float&))(&MaterialRuntime::setUserDefVarValue))
+		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*,
+			const Vec2&))(&MaterialRuntime::setUserDefVarValue))
+		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*,
+			const Vec3&))(&MaterialRuntime::setUserDefVarValue))
+		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*,
+			const MtlUserDefinedVar::Fai&))(
+			&MaterialRuntime::setUserDefVarValue))
 
-		.def("isWireframeEnabled", (bool (MaterialRuntime::*)() const)(&MaterialRuntime::isWireframeEnabled))
+		.def("isWireframeEnabled", (bool (MaterialRuntime::*)() const)(
+			&MaterialRuntime::isWireframeEnabled))
 		.def("setWireframeEnabled", &MaterialRuntime::setWireframeEnabled)
 	;
 }

+ 3 - 2
src/Scripting/Scene/ModelNode.bpi.cpp

@@ -7,7 +7,8 @@ WRAP(ModelNode)
 	WRAP_CONTAINER(Vec<ModelPatchNode*>)
 
 	class_<ModelNode, bases<SceneNode>, noncopyable>("ModelNode", no_init)
-		.def("getModelPatchNodes", (Vec<ModelPatchNode*>& (ModelNode::*)())(&ModelNode::getModelPatchNodes),
-		     return_value_policy<reference_existing_object>())
+		.def("getModelPatchNodes", (Vec<ModelPatchNode*>& (ModelNode::*)())(
+			&ModelNode::getModelPatchNodes),
+			return_value_policy<reference_existing_object>())
 	;
 }

+ 2 - 1
src/Scripting/Scene/ModelPatchNode.bpi.cpp

@@ -4,6 +4,7 @@
 
 WRAP(ModelPatchNode)
 {
-	class_<ModelPatchNode, bases<PatchNode>, noncopyable>("ModelPatchNode", no_init)
+	class_<ModelPatchNode, bases<PatchNode>, noncopyable>("ModelPatchNode",
+		no_init)
 	;
 }

+ 6 - 4
src/Scripting/Scene/PatchNode.bpi.cpp

@@ -5,9 +5,11 @@
 WRAP(PatchNode)
 {
 	class_<PatchNode, noncopyable>("PatchNode", no_init)
-		.def("getCpMtlRun", (MaterialRuntime& (PatchNode::*)())(&PatchNode::getCpMtlRun),
-		     return_value_policy<reference_existing_object>())
-		.def("getDpMtlRun", (MaterialRuntime& (PatchNode::*)())(&PatchNode::getDpMtlRun),
-		     return_value_policy<reference_existing_object>())
+		.def("getCpMtlRun", (MaterialRuntime& (PatchNode::*)())(
+			&PatchNode::getCpMtlRun),
+			return_value_policy<reference_existing_object>())
+		.def("getDpMtlRun", (MaterialRuntime& (PatchNode::*)())(
+			&PatchNode::getDpMtlRun),
+			return_value_policy<reference_existing_object>())
 	;
 }

+ 10 - 6
src/Scripting/Scene/Scene.bpi.cpp

@@ -11,12 +11,16 @@ WRAP(Scene)
 
 	class_<Scene, noncopyable>("Scene", no_init)
 		.def("setAmbientCol", &Scene::setAmbientCol)
-		.def("getAmbientCol", (const Vec3& (Scene::*)() const)(&Scene::getAmbientCol),
-		     return_value_policy<reference_existing_object>())
+		.def("getAmbientCol", (const Vec3& (Scene::*)() const)(&
+			Scene::getAmbientCol),
+			return_value_policy<reference_existing_object>())
 
-		.def("getCameras", (Scene::Types<Camera>::Container& (Scene::*)())(&Scene::getCameras),
-		     return_value_policy<reference_existing_object>())
-		.def("getModelNodes", (Scene::Types<ModelNode>::Container& (Scene::*)())(&Scene::getModelNodes),
-		     return_value_policy<reference_existing_object>())
+		.def("getCameras", (Scene::Types<Camera>::Container& (Scene::*)())(&
+			Scene::getCameras),
+			return_value_policy<reference_existing_object>())
+
+		.def("getModelNodes", (Scene::Types<ModelNode>::Container&
+			(Scene::*)())(&Scene::getModelNodes),
+			return_value_policy<reference_existing_object>())
 	;
 }

+ 2 - 1
src/Scripting/Scene/SceneNode.bpi.cpp

@@ -5,6 +5,7 @@
 WRAP(SceneNode)
 {
 	class_<SceneNode, noncopyable>("SceneNode", no_init)
-		.def("getSceneNodeName", &SceneNode::getSceneNodeName, return_value_policy<copy_const_reference>())
+		.def("getSceneNodeName", &SceneNode::getSceneNodeName,
+			return_value_policy<copy_const_reference>())
 	;
 }

+ 10 - 5
src/Scripting/ScriptingCommon.h

@@ -17,7 +17,8 @@ using namespace boost::python;
 #define WRAP_SINGLETON(x) \
 	WRAP(x) { \
 		class_<x, noncopyable>(#x, no_init) \
-			.def("getInstance", & x ::getInstance, return_value_policy<reference_existing_object>()) \
+			.def("getInstance", & x ::getInstance, \
+				return_value_policy<reference_existing_object>()) \
 			.staticmethod("getInstance") \
 		; \
 	}
@@ -36,20 +37,23 @@ using namespace boost::python;
 // Property for simple types                                                   =
 //==============================================================================
 
-template<typename ClassType, typename RetType, const RetType& (ClassType::* accessor)() const>
+template<typename ClassType, typename RetType,
+	const RetType& (ClassType::* accessor)() const>
 RetType getterSv(const ClassType* t)
 {
 	return (t->*accessor)();
 }
 
 
-template<typename ClassType, typename InType, void (ClassType::* accessor)(const InType&)>
+template<typename ClassType, typename InType,
+	void (ClassType::* accessor)(const InType&)>
 void setterSv(ClassType* t, InType in)
 {
 	(t->*accessor)(in);
 }
 
-/// Boost python property for simple types (int, float etc) that cannot be wrapped by boost::python correctly
+/// Boost python property for simple types (int, float etc) that cannot be
+/// wrapped by boost::python correctly
 #define BP_PROPERTY_BASIC_TYPE(Type__, Class__, var__, getter__, setter__) \
 	.add_property(#var__, &getterSv<Class__, Type__, &Class__::getter__>, \
 	              &setterSv<Class__, Type__, &Class__::setter__>)
@@ -59,7 +63,8 @@ void setterSv(ClassType* t, InType in)
 // Math library stuff                                                          =
 //==============================================================================
 
-template<typename ClassType, typename RetType, RetType (ClassType::* accessor)() const>
+template<typename ClassType, typename RetType,
+	RetType (ClassType::* accessor)() const>
 RetType getM(const ClassType* t)
 {
 	return (t->*accessor)();

+ 8 - 4
src/Scripting/ScriptingEngine.cpp

@@ -5,7 +5,8 @@
 #include "Core/Globals.h"
 
 
-extern "C" void initAnki(); /// Defined in BoostPythonInterfaces.cpp by boost::python
+/// Defined in BoostPythonInterfaces.cpp by boost::python
+extern "C" void initAnki();
 
 
 //==============================================================================
@@ -17,9 +18,11 @@ void ScriptingEngine::init()
 
 	PyImport_AppendInittab((char*)("Anki"), &initAnki);
 	Py_Initialize();
-	mainModule = boost::python::object(boost::python::handle<>(boost::python::borrowed(PyImport_AddModule("__main__"))));
+	mainModule = boost::python::object(boost::python::handle<>(
+		boost::python::borrowed(PyImport_AddModule("__main__"))));
 	mainNamespace = mainModule.attr("__dict__");
-	ankiModule = boost::python::object(boost::python::handle<>(PyImport_ImportModule("Anki")));
+	ankiModule = boost::python::object(
+		boost::python::handle<>(PyImport_ImportModule("Anki")));
 
 	INFO("Scripting engine initialized");
 }
@@ -32,7 +35,8 @@ void ScriptingEngine::execScript(const char* script, const char* scriptName)
 {
 	try
 	{
-		boost::python::handle<>ignored(PyRun_String(script, Py_file_input, mainNamespace.ptr(), mainNamespace.ptr()));
+		boost::python::handle<>ignored(PyRun_String(script, Py_file_input,
+			mainNamespace.ptr(), mainNamespace.ptr()));
 	}
 	catch(boost::python::error_already_set)
 	{

+ 1 - 0
src/Ui/Painter.h

@@ -15,6 +15,7 @@ namespace Ui {
 class Font;
 
 
+/// @todo
 class Painter
 {
 	public:

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません