Prechádzať zdrojové kódy

Work on the new coding style

Panagiotis Christopoulos Charitos 16 rokov pred
rodič
commit
55f37eee4c
100 zmenil súbory, kde vykonal 1657 pridanie a 1662 odobranie
  1. 333 337
      build/debug/Makefile
  2. 2 2
      shaders/bs_bp_volfog.glsl
  3. 2 2
      shaders/bs_refract.glsl
  4. 2 2
      shaders/dbg.glsl
  5. 2 2
      shaders/dp_generic.glsl
  6. 5 5
      shaders/dp_hw_skinning.glsl
  7. 2 2
      shaders/final.glsl
  8. 10 10
      shaders/hw_skinning.glsl
  9. 2 2
      shaders/is_ap.glsl
  10. 2 2
      shaders/is_lp_generic.glsl
  11. 4 0
      shaders/ms_mp_dn.glsl
  12. 22 22
      shaders/ms_mp_generic.glsl
  13. 2 2
      shaders/ms_mp_skybox.glsl
  14. 2 2
      shaders/pps.glsl
  15. 2 2
      shaders/pps_hdr_generic.glsl
  16. 2 2
      shaders/pps_lscatt.glsl
  17. 2 2
      shaders/pps_ssao.glsl
  18. 2 2
      shaders/pps_ssao_blur.glsl
  19. 6 6
      shaders/simple_texturing.glsl
  20. 2 2
      shaders/txt.glsl
  21. 13 0
      src/controllers/Controller.cpp
  22. 6 6
      src/controllers/Controller.h
  23. 20 0
      src/controllers/LightPropsScriptCtrl.h
  24. 36 0
      src/controllers/MeshSkelNodeCtrl.h
  25. 2 7
      src/controllers/README
  26. 39 39
      src/controllers/SkelAnimCtrl.cpp
  27. 36 0
      src/controllers/SkelAnimCtrl.h
  28. 18 0
      src/controllers/TrfScriptCtrl.h
  29. 0 13
      src/controllers/controller.cpp
  30. 0 20
      src/controllers/light_script_ctrl.h
  31. 0 36
      src/controllers/mesh_skel_ctrl.h
  32. 0 36
      src/controllers/skel_anim_ctrl.h
  33. 0 18
      src/controllers/trf_ctrl.h
  34. 78 78
      src/main.cpp
  35. 32 0
      src/math/Axisang.h
  36. 11 11
      src/math/Axisang.inl.h
  37. 8 8
      src/math/Euler.h
  38. 14 14
      src/math/Euler.inl.h
  39. 0 32
      src/math/axisang.h
  40. 2 2
      src/math/forward_decls.h
  41. 2 2
      src/math/gmath.h
  42. 2 2
      src/math/m_dflt_header.h
  43. 4 4
      src/math/m_misc.h
  44. 7 7
      src/math/m_misc.inl.h
  45. 3 3
      src/math/mat3.h
  46. 20 20
      src/math/mat3.inl.h
  47. 1 1
      src/math/mat4.h
  48. 2 2
      src/math/mat4.inl.h
  49. 3 3
      src/math/quat.h
  50. 15 15
      src/math/quat.inl.h
  51. 1 1
      src/math/vec2.h
  52. 5 5
      src/math/vec2.inl.h
  53. 1 1
      src/math/vec3.h
  54. 5 5
      src/math/vec3.inl.h
  55. 1 1
      src/math/vec4.h
  56. 5 5
      src/math/vec4.inl.h
  57. 8 8
      src/renderer/r_bs.cpp
  58. 7 7
      src/renderer/r_bs2.cpp
  59. 15 15
      src/renderer/r_dbg.cpp
  60. 48 48
      src/renderer/r_is.cpp
  61. 9 9
      src/renderer/r_is_shadows.cpp
  62. 10 10
      src/renderer/r_ms.cpp
  63. 6 6
      src/renderer/r_ms_earlyz.cpp
  64. 2 2
      src/renderer/r_pps.cpp
  65. 3 3
      src/renderer/r_pps_hdr.cpp
  66. 4 4
      src/renderer/r_pps_lscatt.cpp
  67. 5 5
      src/renderer/r_pps_ssao.cpp
  68. 15 15
      src/renderer/r_private.h
  69. 11 11
      src/renderer/renderer.cpp
  70. 9 9
      src/renderer/renderer.h
  71. 2 2
      src/renderer2/r_is.cpp
  72. 8 8
      src/renderer2/r_ms.cpp
  73. 16 16
      src/renderer2/renderer.hpp
  74. 1 1
      src/resources/LightProps.h
  75. 12 12
      src/resources/Material.cpp
  76. 9 9
      src/resources/Material.h
  77. 2 2
      src/resources/ShaderParser.cpp
  78. 82 82
      src/scene/Camera.cpp
  79. 88 0
      src/scene/Camera.h
  80. 21 21
      src/scene/Light.cpp
  81. 70 0
      src/scene/Light.h
  82. 18 18
      src/scene/MeshNode.cpp
  83. 34 0
      src/scene/MeshNode.h
  84. 53 53
      src/scene/Node.cpp
  85. 73 0
      src/scene/Node.h
  86. 50 50
      src/scene/Scene.cpp
  87. 59 0
      src/scene/Scene.h
  88. 14 14
      src/scene/SkelModelNode.cpp
  89. 28 0
      src/scene/SkelModelNode.h
  90. 17 17
      src/scene/SkelNode.cpp
  91. 27 0
      src/scene/SkelNode.h
  92. 0 88
      src/scene/camera.h
  93. 0 70
      src/scene/light.h
  94. 0 34
      src/scene/mesh_node.h
  95. 0 73
      src/scene/node.h
  96. 0 59
      src/scene/scene.h
  97. 0 28
      src/scene/skel_model_node.h
  98. 0 27
      src/scene/skel_node.h
  99. 17 17
      src/tokenizer/Scanner.cpp
  100. 4 4
      src/tokenizer/Scanner.h

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 333 - 337
build/debug/Makefile


+ 2 - 2
shaders/bs_bp_volfog.glsl

@@ -1,11 +1,11 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 void main()
 {
 	gl_Position = ftransform();
 }
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki include "shaders/linear_depth.glsl"
 

+ 2 - 2
shaders/bs_refract.glsl

@@ -1,9 +1,9 @@
 //
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/simple_vert.glsl"
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki uniform fai 0
 uniform sampler2D fai;

+ 2 - 2
shaders/dbg.glsl

@@ -1,4 +1,4 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 void main()
 {
@@ -6,7 +6,7 @@ void main()
 	gl_FrontColor = gl_Color;
 }
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 void main()
 {

+ 2 - 2
shaders/dp_generic.glsl

@@ -1,5 +1,5 @@
 //
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/hw_skinning.glsl"
 
@@ -27,7 +27,7 @@ void main()
 	#endif
 }
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 uniform sampler2D diffuse_map;
 varying vec2 tex_coords_v2f;

+ 5 - 5
shaders/dp_hw_skinning.glsl

@@ -1,9 +1,9 @@
 #define _HW_SKINNING_
 
-#pragma anki uniform skinning_rotations 0
-#pragma anki uniform skinning_translations 1
-#pragma anki attribute vert_weight_bones_num 0
-#pragma anki attribute vert_weight_bone_ids 1
-#pragma anki attribute vert_weight_weights 2
+#pragma anki uniform skinningRotations 0
+#pragma anki uniform skinningTranslations 1
+#pragma anki attribute vertWeightBonesNum 0
+#pragma anki attribute vertWeightBoneIds 1
+#pragma anki attribute vertWeightWeights 2
 
 #pragma anki include "shaders/dp_generic.glsl"

+ 2 - 2
shaders/final.glsl

@@ -1,8 +1,8 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/simple_vert.glsl"
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki uniform raster_image 0
 uniform sampler2D raster_image;

+ 10 - 10
shaders/hw_skinning.glsl

@@ -1,13 +1,13 @@
 
 // hardware skinning data
-attribute float vert_weight_bones_num;
-attribute vec4  vert_weight_bone_ids;
-attribute vec4  vert_weight_weights;
+attribute float vertWeightBonesNum;
+attribute vec4  vertWeightBoneIds;
+attribute vec4  vertWeightWeights;
 
 const int MAX_BONES_PER_MESH = 60;
 
-uniform mat3 skinning_rotations[ MAX_BONES_PER_MESH ];
-uniform vec3 skinning_translations[ MAX_BONES_PER_MESH ];
+uniform mat3 skinningRotations[ MAX_BONES_PER_MESH ];
+uniform vec3 skinningTranslations[ MAX_BONES_PER_MESH ];
 
 
 void HWSkinning( out mat3 _rot, out vec3 _tsl )
@@ -15,12 +15,12 @@ void HWSkinning( out mat3 _rot, out vec3 _tsl )
 	_rot = mat3( 0.0 );
 	_tsl = vec3( 0.0 );
 
-	for( int i=0; i<int(vert_weight_bones_num); i++ )
+	for( int i=0; i<int(vertWeightBonesNum); i++ )
 	{
-		int bone_id = int( vert_weight_bone_ids[i] );
-		float weight = vert_weight_weights[i];
+		int bone_id = int( vertWeightBoneIds[i] );
+		float weight = vertWeightWeights[i];
 
-		_rot += skinning_rotations[bone_id] * weight;
-		_tsl += skinning_translations[bone_id] * weight;
+		_rot += skinningRotations[bone_id] * weight;
+		_tsl += skinningTranslations[bone_id] * weight;
 	}
 }

+ 2 - 2
shaders/is_ap.glsl

@@ -1,8 +1,8 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/simple_vert.glsl"
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki uniform ambient_color 0
 uniform vec3 ambient_color;

+ 2 - 2
shaders/is_lp_generic.glsl

@@ -1,4 +1,4 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki attribute view_vector 1
 attribute vec3 view_vector;
@@ -18,7 +18,7 @@ void main()
 }
 
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki include "shaders/pack.glsl"
 

+ 4 - 0
shaders/ms_mp_dn.glsl

@@ -2,3 +2,7 @@
 #define _NORMAL_MAPPING_
 
 #pragma anki include "shaders/ms_mp_generic.glsl"
+
+
+
+

+ 22 - 22
shaders/ms_mp_generic.glsl

@@ -13,7 +13,7 @@
 #endif
 
 
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 /**
  * This a generic shader to fill the deferred shading buffers. You can always build your own if you dont need to write in all the
@@ -24,7 +24,7 @@
 // attributes
 attribute vec3 position;
 attribute vec3 normal;
-attribute vec2 tex_coords;
+attribute vec2 texCoords;
 attribute vec4 tangent;
 
 // uniforms
@@ -34,7 +34,7 @@ uniform mat3 N_mat;
 
 // varyings
 varying vec3 normal_v2f;
-varying vec2 tex_coords_v2f;
+varying vec2 texCoords_v2f;
 varying vec3 tangent_v2f;
 varying float w_v2f;
 varying vec3 vert_pos_eye_space_v2f; ///< For env mapping. AKA view_vector
@@ -79,7 +79,7 @@ void main()
 	// calculate the rest
 
 	#if NEEDS_TEX_MAPPING
-		tex_coords_v2f = tex_coords;
+		texCoords_v2f = texCoords;
 	#endif
 
 
@@ -94,7 +94,7 @@ void main()
 }
 
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 /**
  * Note: The process of calculating the diffuse color for the diffuse MSFAI is divided into two parts. The first happens before the
@@ -125,7 +125,7 @@ uniform float shininess;
 varying vec3 normal_v2f;
 varying vec3 tangent_v2f;
 varying float w_v2f;
-varying vec2 tex_coords_v2f;
+varying vec2 texCoords_v2f;
 varying vec3 eye;
 varying vec3 vert_pos_eye_space_v2f;
 
@@ -140,7 +140,7 @@ void main()
 {
 	//===================================================================================================================================
 	// Paralax Mapping Calculations                                                                                                     =
-	// The code below reads the height map, makes some calculations and returns a new tex_coords                                        =
+	// The code below reads the height map, makes some calculations and returns a new texCoords                                        =
 	//===================================================================================================================================
 	#if defined( _PARALLAX_MAPPING_ )
 		/*const float _scale = 0.04;
@@ -148,34 +148,34 @@ void main()
 
 		vec3 _norm_eye = normalize( eye );
 
-		float _h = texture2D( height_map, tex_coords_v2f ).r;
+		float _h = texture2D( height_map, texCoords_v2f ).r;
 		float _height = _scale * _h - _bias;
 
-		vec2 _super_tex_coords_v2f = _height * _norm_eye.xy + tex_coords_v2f;*/
+		vec2 _super_texCoords_v2f = _height * _norm_eye.xy + texCoords_v2f;*/
 
-		vec2 _super_tex_coords = tex_coords_v2f;
+		vec2 _super_texCoords = texCoords_v2f;
 		const float maxStepCount = 100.0;
-		float nSteps = maxStepCount * length(_super_tex_coords);
+		float nSteps = maxStepCount * length(_super_texCoords);
 
 		vec3 dir = vert_pos_eye_space_v2f;
 		dir.xy /= 8.0;
 		dir /= -nSteps * dir.z;
 
-		float diff0, diff1 = 1.0 - texture2D( height_map, _super_tex_coords ).a;
+		float diff0, diff1 = 1.0 - texture2D( height_map, _super_texCoords ).a;
 		if( diff1 > 0.0 )
 		{
 			do 
 			{
-				_super_tex_coords += dir.xy;
+				_super_texCoords += dir.xy;
 
 				diff0 = diff1;
-				diff1 = texture2D(height_map, _super_tex_coords ).w;
+				diff1 = texture2D(height_map, _super_texCoords ).w;
 			} while( diff1 > 0.0 );
 
-			_super_tex_coords.xy += (diff1 / (diff0 - diff1)) * dir.xy;
+			_super_texCoords.xy += (diff1 / (diff0 - diff1)) * dir.xy;
 		}
 	#else
-		#define _super_tex_coords tex_coords_v2f
+		#define _super_texCoords texCoords_v2f
 	#endif
 
 
@@ -187,11 +187,11 @@ void main()
 	#if defined( _DIFFUSE_MAPPING_ )
 
 		#if defined( _GRASS_LIKE_ )
-			vec4 _diff_color4 = texture2D( diffuse_map, _super_tex_coords );
+			vec4 _diff_color4 = texture2D( diffuse_map, _super_texCoords );
 			if( _diff_color4.a == 0.0 ) discard;
 			_diff_color = _diff_color4.rgb;
 		#else
-			_diff_color = texture2D( diffuse_map, _super_tex_coords ).rgb;
+			_diff_color = texture2D( diffuse_map, _super_texCoords ).rgb;
 		#endif
 
 		_diff_color *= diffuse_color.rgb;
@@ -211,7 +211,7 @@ void main()
 
 		mat3 _tbn_mat = mat3(_t,_b,_n);
 
-		vec3 _n_at_tangentspace = ( texture2D( normal_map, _super_tex_coords ).rgb - 0.5 ) * 2.0;
+		vec3 _n_at_tangentspace = ( texture2D( normal_map, _super_texCoords ).rgb - 0.5 ) * 2.0;
 
 		vec3 _new_normal = normalize( _tbn_mat * _n_at_tangentspace );
 	#else
@@ -231,9 +231,9 @@ void main()
 		                                      // ...results and its allready computed
 		_r.z += 1.0;
 		float _m = 2.0 * length(_r);
-		vec2 _sem_tex_coords = _r.xy/_m + 0.5;
+		vec2 _sem_texCoords = _r.xy/_m + 0.5;
 
-		vec3 _sem_col = texture2D( environment_map, _sem_tex_coords ).rgb;
+		vec3 _sem_col = texture2D( environment_map, _sem_texCoords ).rgb;
 		_diff_color = _diff_color + _sem_col; // blend existing color with the SEM texture map
 	#endif
 
@@ -244,7 +244,7 @@ void main()
 
 	// has specular map
 	#if defined( _SPECULAR_MAPPING_ )
-		vec4 _specular = vec4(texture2D( specular_map, _super_tex_coords ).rgb * specular_color, shininess);
+		vec4 _specular = vec4(texture2D( specular_map, _super_texCoords ).rgb * specular_color, shininess);
 	// no specular map
 	#else
 		vec4 _specular = vec4(specular_color, shininess);

+ 2 - 2
shaders/ms_mp_skybox.glsl

@@ -1,4 +1,4 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 varying vec2 txtr_coords;
 
@@ -8,7 +8,7 @@ void main()
 	gl_Position = ftransform();
 }
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki uniform colormap 0
 uniform sampler2D colormap;

+ 2 - 2
shaders/pps.glsl

@@ -1,8 +1,8 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/simple_vert.glsl"
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki include "shaders/photoshop_filters.glsl"
 #pragma anki include "shaders/median_filter.glsl"

+ 2 - 2
shaders/pps_hdr_generic.glsl

@@ -1,8 +1,8 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/simple_vert.glsl"
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki include "shaders/median_filter.glsl"
 

+ 2 - 2
shaders/pps_lscatt.glsl

@@ -1,8 +1,8 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/simple_vert.glsl"
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 const int SAMPLES_NUM = 100;
 

+ 2 - 2
shaders/pps_ssao.glsl

@@ -1,8 +1,8 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/simple_vert.glsl"
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki include "shaders/linear_depth.glsl"
 #pragma anki include "shaders/pack.glsl"

+ 2 - 2
shaders/pps_ssao_blur.glsl

@@ -1,8 +1,8 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 #pragma anki include "shaders/simple_vert.glsl"
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki include "shaders/median_filter.glsl"
 

+ 6 - 6
shaders/simple_texturing.glsl

@@ -1,25 +1,25 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 attribute vec3 position;
 attribute vec3 normal;
-//attribute vec2 tex_coords;
+//attribute vec2 texCoords;
 
-//varying vec2 tex_coords_v2f;
+//varying vec2 texCoords_v2f;
 varying vec3 normal_v2f;
 
 void main()
 {
-	//tex_coords_v2f = tex_coords;
+	//texCoords_v2f = texCoords;
 	normal_v2f = gl_NormalMatrix * normal;
 	gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
 }
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki include "shaders/pack.glsl"
 
 uniform sampler2D diffuse_map, noise_map;
-//varying vec2 tex_coords_v2f;
+//varying vec2 texCoords_v2f;
 varying vec3 normal_v2f;
 
 void main()

+ 2 - 2
shaders/txt.glsl

@@ -1,4 +1,4 @@
-#pragma anki vert_shader_begins
+#pragma anki vertShaderBegins
 
 varying vec2 tex_coords;
 
@@ -9,7 +9,7 @@ void main(void)
 	gl_Position = ftransform();
 }
 
-#pragma anki frag_shader_begins
+#pragma anki fragShaderBegins
 
 #pragma anki uniform font_map 0
 uniform sampler2D font_map;

+ 13 - 0
src/controllers/Controller.cpp

@@ -0,0 +1,13 @@
+#include "Controller.h"
+#include "Scene.h"
+
+Controller::Controller( Type type_ ): 
+	type(type_) 
+{
+	scene::registerController( this );
+}
+
+Controller::~Controller()
+{
+	scene::unregisterController( this );
+}

+ 6 - 6
src/controllers/controller.h → src/controllers/Controller.h

@@ -5,10 +5,10 @@
 
 
 /// Scenegraph node controller (A)
-class controller_t
+class Controller
 {
 	public:
-		enum type_e
+		enum Type
 		{ 
 			CT_SKEL_ANIM, 
 			CT_SKEL,
@@ -18,12 +18,12 @@ class controller_t
 			CT_LIGHT
 		};
 	
-	PROPERTY_R( type_e, type, GetType ) ///< Once the type is set nothing can change it
+	PROPERTY_R( Type, type, getType ) ///< Once the type is set nothing can change it
 
 	public:
-		controller_t( type_e type_ );
-		virtual ~controller_t();
-		virtual void Update( float time ) = 0;
+		Controller( Type type_ );
+		virtual ~Controller();
+		virtual void update( float time ) = 0;
 };
 
 

+ 20 - 0
src/controllers/LightPropsScriptCtrl.h

@@ -0,0 +1,20 @@
+#ifndef _LIGHT_SCRIPT_CTRL_H_
+#define _LIGHT_SCRIPT_CTRL_H_
+
+#include "common.h"
+#include "Controller.h"
+
+
+class Light;
+
+
+class LightPropsScriptCtrl: public Controller
+{
+	public:
+		Light* light;
+		
+		LightPropsScriptCtrl( Light* light_ ): controller(CT_LIGHT), light(light_) {}
+		void update( float ) { /* ToDo */ }
+}
+
+#endif

+ 36 - 0
src/controllers/MeshSkelNodeCtrl.h

@@ -0,0 +1,36 @@
+#ifndef _MESH_SKEL_CTRL_H_
+#define _MESH_SKEL_CTRL_H_
+
+#include "common.h"
+#include "Controller.h"
+
+
+class MeshNode;
+class SkelNode;
+class Mesh;
+
+
+/**
+ * Skeleton controller
+ * It controls a mesh node using a skeleton node and the skeleton node's controllers
+ */
+class MeshSkelNodeCtrl: public Controller
+{
+	public:
+		SkelNode* skelNode;
+		MeshNode* meshNode;
+
+		MeshSkelNodeCtrl( SkelNode* skel_node_, MeshNode* mesh_node_ ):
+			Controller( CT_SKEL ),
+			skelNode( skel_node_ ),
+			meshNode( mesh_node_ ) 
+		{}
+		/**
+		 * Do nothing! We use HW skinning so its not necessary to update anything in the meshNode. 
+		 * The skelNode's controllers provide us with sufficient data to do the trick.
+		 */
+		void update( float ) {}
+};
+
+
+#endif

+ 2 - 7
src/controllers/README

@@ -2,13 +2,8 @@ The controllers are part of the scene node objects. The control the node's behav
 
 They have an input (script, animation, etc) and they control a scene node. The naming convention of the controllers is:
 
-<what the controller controls>_<the input of the contoller>_ctrl_t
+<what the controller controls><the input of the contoller>Ctrl
 
 For Example:
 
-script_trf_ctrl_t
-path_trf_ctrl_t
-anim_skel_ctrl_t
-skel_mesh_ctrl_t
-script_light_ctrl_t
-
+MeshSkelNodeCtrl A Mesh is controlled by a SkelNode 

+ 39 - 39
src/controllers/skel_anim_ctrl.cpp → src/controllers/SkelAnimCtrl.cpp

@@ -1,28 +1,28 @@
-#include "skel_anim_ctrl.h"
+#include "SkelAnimCtrl.h"
 #include "SkelAnim.h"
-#include "skel_node.h"
+#include "SkelNode.h"
 #include "Skeleton.h"
 #include "renderer.h"
 
 
 //=====================================================================================================================================
-// skel_anim_ctrl_t                                                                                                             =
+// SkelAnimCtrl                                                                                                             =
 //=====================================================================================================================================
-skel_anim_ctrl_t::skel_anim_ctrl_t( skel_node_t* skel_node_ ):
-	controller_t(CT_SKEL_ANIM),
-	skel_node( skel_node_ )
+SkelAnimCtrl::SkelAnimCtrl( SkelNode* skel_node_ ):
+	Controller(CT_SKEL_ANIM),
+	skelNode( skel_node_ )
 {
-	heads.resize( skel_node->skeleton->bones.size() );
-	tails.resize( skel_node->skeleton->bones.size() );
-	bone_rotations.resize( skel_node->skeleton->bones.size() );
-	Boneranslations.resize( skel_node->skeleton->bones.size() );
+	heads.resize( skelNode->skeleton->bones.size() );
+	tails.resize( skelNode->skeleton->bones.size() );
+	boneRotations.resize( skelNode->skeleton->bones.size() );
+	boneTranslations.resize( skelNode->skeleton->bones.size() );
 }
 
 
 //=====================================================================================================================================
-// Interpolate                                                                                                                        =
+// interpolate                                                                                                                        =
 //=====================================================================================================================================
-void skel_anim_ctrl_t::Interpolate( SkelAnim* animation, float frame )
+void SkelAnimCtrl::interpolate( SkelAnim* animation, float frame )
 {
 	DEBUG_ERR( frame >= animation->frames_num );
 
@@ -50,13 +50,13 @@ void skel_anim_ctrl_t::Interpolate( SkelAnim* animation, float frame )
 
 
 	// now for all bones update bone's poses
-	DEBUG_ERR( bone_rotations.size()<1 );
-	for( uint i=0; i<bone_rotations.size(); i++ )
+	DEBUG_ERR( boneRotations.size()<1 );
+	for( uint i=0; i<boneRotations.size(); i++ )
 	{
 		const SkelAnim::BoneAnim& banim = animation->bones[i];
 
-		mat3_t& local_rot = bone_rotations[i];
-		vec3_t& local_transl = Boneranslations[i];
+		mat3_t& local_rot = boneRotations[i];
+		vec3_t& local_transl = boneTranslations[i];
 
 		// if the bone has animations then slerp and lerp to find the rotation and translation
 		if( banim.keyframes.size() != 0 )
@@ -85,41 +85,41 @@ void skel_anim_ctrl_t::Interpolate( SkelAnim* animation, float frame )
 
 
 //=====================================================================================================================================
-// UpdateBoneTransforms                                                                                                               =
+// updateBoneTransforms                                                                                                               =
 //=====================================================================================================================================
-void skel_anim_ctrl_t::UpdateBoneTransforms()
+void SkelAnimCtrl::updateBoneTransforms()
 {
 	uint queue[ 128 ];
 	uint head = 0, tail = 0;
 
 	// put the roots
-	for( uint i=0; i<skel_node->skeleton->bones.size(); i++ )
-		if( skel_node->skeleton->bones[i].parent == NULL )
+	for( uint i=0; i<skelNode->skeleton->bones.size(); i++ )
+		if( skelNode->skeleton->bones[i].parent == NULL )
 			queue[tail++] = i; // queue push
 
 	// loop
 	while( head != tail ) // while queue not empty
 	{
 		uint bone_id = queue[head++]; // queue pop
-		const Skeleton::Bone& boned = skel_node->skeleton->bones[bone_id];
+		const Skeleton::Bone& boned = skelNode->skeleton->bones[bone_id];
 
 		// bone.final_transform = MA * ANIM * MAi
 		// where MA is bone matrix at armature space and ANIM the interpolated transformation.
-		CombineTransformations( Boneranslations[bone_id], bone_rotations[bone_id],
+		CombineTransformations( boneTranslations[bone_id], boneRotations[bone_id],
 		                        boned.tslSkelSpaceInv, boned.rotSkelSpaceInv,
-		                        Boneranslations[bone_id], bone_rotations[bone_id] );
+		                        boneTranslations[bone_id], boneRotations[bone_id] );
 
 		CombineTransformations( boned.tslSkelSpace, boned.rotSkelSpace,
-		                        Boneranslations[bone_id], bone_rotations[bone_id],
-		                        Boneranslations[bone_id], bone_rotations[bone_id] );
+		                        boneTranslations[bone_id], boneRotations[bone_id],
+		                        boneTranslations[bone_id], boneRotations[bone_id] );
 
 		// and finaly add the parent's transform
 		if( boned.parent )
 		{
 			// bone.final_final_transform = parent.transf * bone.final_transform
-			CombineTransformations( Boneranslations[boned.parent->id], bone_rotations[boned.parent->id],
-		                          Boneranslations[bone_id], bone_rotations[bone_id],
-		                          Boneranslations[bone_id], bone_rotations[bone_id] );
+			CombineTransformations( boneTranslations[boned.parent->id], boneRotations[boned.parent->id],
+		                          boneTranslations[bone_id], boneRotations[bone_id],
+		                          boneTranslations[bone_id], boneRotations[bone_id] );
 		}
 
 		// now add the bone's childes
@@ -130,16 +130,16 @@ void skel_anim_ctrl_t::UpdateBoneTransforms()
 
 
 //=====================================================================================================================================
-// Deform                                                                                                                             =
+// deform                                                                                                                             =
 //=====================================================================================================================================
-void skel_anim_ctrl_t::Deform()
+void SkelAnimCtrl::deform()
 {
-	Skeleton* skeleton = skel_node->skeleton;
+	Skeleton* skeleton = skelNode->skeleton;
 
 	for( uint i=0; i<skeleton->bones.size(); i++ )
 	{
-		const mat3_t& rot = bone_rotations[ i ];
-		const vec3_t& transl = Boneranslations[ i ];
+		const mat3_t& rot = boneRotations[ i ];
+		const vec3_t& transl = boneTranslations[ i ];
 
 		heads[i] = skeleton->bones[i].head.GetTransformed( transl, rot );
 		tails[i] = skeleton->bones[i].tail.GetTransformed( transl, rot );
@@ -148,20 +148,20 @@ void skel_anim_ctrl_t::Deform()
 
 
 //=====================================================================================================================================
-// Update                                                                                                                             =
+// update                                                                                                                             =
 //=====================================================================================================================================
-void skel_anim_ctrl_t::Update( float )
+void SkelAnimCtrl::update( float )
 {
 	frame += step;
-	if( frame > skel_anim->frames_num ) // if the crnt is finished then play the next or loop the crnt
+	if( frame > skelAnim->frames_num ) // if the crnt is finished then play the next or loop the crnt
 	{
 		frame = 0.0;
 	}
 
-	Interpolate( skel_anim, frame );
-	UpdateBoneTransforms();
+	interpolate( skelAnim, frame );
+	updateBoneTransforms();
 	if( r::dbg::show_skeletons )
 	{
-		Deform();
+		deform();
 	}
 }

+ 36 - 0
src/controllers/SkelAnimCtrl.h

@@ -0,0 +1,36 @@
+#ifndef _SKEL_ANIM_CTRL_H_
+#define _SKEL_ANIM_CTRL_H_
+
+#include "common.h"
+#include "Controller.h"
+#include "gmath.h"
+
+class Skeleton;
+class SkelAnim;
+class SkelNode;
+
+
+/// Skeleton animation controller
+class SkelAnimCtrl: public Controller
+{
+	private:
+		void interpolate( SkelAnim* animation, float frame );
+		void updateBoneTransforms();
+		void deform();
+
+	public:
+		SkelAnim*  skelAnim; ///< Skeleton animation resource
+		SkelNode*  skelNode;
+		Vec<vec3_t> heads;
+		Vec<vec3_t> tails;
+		Vec<mat3_t> boneRotations;
+		Vec<vec3_t> boneTranslations;
+		float step;
+		float frame;
+
+		SkelAnimCtrl( SkelNode* skel_node_ );
+		void update( float time );
+};
+
+
+#endif

+ 18 - 0
src/controllers/TrfScriptCtrl.h

@@ -0,0 +1,18 @@
+#ifndef _TRF_SCRIPT_CTRL_H_
+#define _TRF_SCRIPT_CTRL_H_
+
+#include "common.h"
+#include "Controller.h"
+
+
+/// Transformation controlled by a script
+class TrfScriptCtrl: public Controller
+{
+	public:
+		Node* node;
+	
+		TrfScriptCtrl( Node* node_ ): Controller( CT_TRF ), node(node_) {}
+		void Update( float ) { /* ToDo */ }
+};
+
+#endif

+ 0 - 13
src/controllers/controller.cpp

@@ -1,13 +0,0 @@
-#include "controller.h"
-#include "scene.h"
-
-controller_t::controller_t( type_e type_ ): 
-	type(type_) 
-{
-	scene::RegisterController( this );
-}
-
-controller_t::~controller_t()
-{
-	scene::UnregisterController( this );
-}

+ 0 - 20
src/controllers/light_script_ctrl.h

@@ -1,20 +0,0 @@
-#ifndef _LIGHT_SCRIPT_CTRL_H_
-#define _LIGHT_SCRIPT_CTRL_H_
-
-#include "common.h"
-#include "controller.h"
-
-
-class light_t;
-
-
-class light_script_ctrl_t: public controller_t
-{
-	public:
-		light_t* light;
-		
-		light_controller_t( light_t* light_ ): controller(CT_LIGHT), light(light_) {}
-		void Update( float ) { /* ToDo */ }
-}
-
-#endif

+ 0 - 36
src/controllers/mesh_skel_ctrl.h

@@ -1,36 +0,0 @@
-#ifndef _MESH_SKEL_CTRL_H_
-#define _MESH_SKEL_CTRL_H_
-
-#include "common.h"
-#include "controller.h"
-
-
-class mesh_node_t;
-class skel_node_t;
-class Mesh;
-
-
-/**
- * Skeleton controller
- * It controls a mesh node using a skeleton node and the skeleton node's controllers
- */
-class mesh_skel_ctrl_t: public controller_t
-{
-	public:
-		skel_node_t* skel_node;
-		mesh_node_t* mesh_node;
-
-		mesh_skel_ctrl_t( skel_node_t* skel_node_, mesh_node_t* mesh_node_ ):
-			controller_t( CT_SKEL ),
-			skel_node( skel_node_ ),
-			mesh_node( mesh_node_ ) 
-		{}
-		/**
-		 * Do nothing! We use HW skinning so its not necessary to update anything in the mesh_node. 
-		 * The skel_node's controllers provide us with sufficient data to do the trick.
-		 */
-		void Update( float ) {}
-};
-
-
-#endif

+ 0 - 36
src/controllers/skel_anim_ctrl.h

@@ -1,36 +0,0 @@
-#ifndef _SKEL_ANIM_CTRL_H_
-#define _SKEL_ANIM_CTRL_H_
-
-#include "common.h"
-#include "controller.h"
-#include "gmath.h"
-
-class Skeleton;
-class SkelAnim;
-class skel_node_t;
-
-
-/// Skeleton animation controller
-class skel_anim_ctrl_t: public controller_t
-{
-	private:
-		void Interpolate( SkelAnim* animation, float frame );
-		void UpdateBoneTransforms();
-		void Deform();
-
-	public:
-		SkelAnim*  skel_anim; ///< Skeleton animation resource
-		skel_node_t*  skel_node;
-		Vec<vec3_t> heads;
-		Vec<vec3_t> tails;
-		Vec<mat3_t> bone_rotations;
-		Vec<vec3_t> Boneranslations;
-		float step;
-		float frame;
-
-		skel_anim_ctrl_t( skel_node_t* skel_node_ );
-		void Update( float time );
-};
-
-
-#endif

+ 0 - 18
src/controllers/trf_ctrl.h

@@ -1,18 +0,0 @@
-#ifndef _TRF_SCRIPT_CTRL_H_
-#define _TRF_SCRIPT_CTRL_H_
-
-#include "common.h"
-#include "controller.h"
-
-
-/// Transform controller
-class trf_script_ctrl_t: public controller_t
-{
-	public:
-		node_t* node;
-	
-		trf_script_ctrl_t( node_t* node_ ): controller_t( CT_TRF ), node(node_) {}
-		void Update( float ) { /* ToDo */ }
-};
-
-#endif

+ 78 - 78
src/main.cpp

@@ -5,7 +5,7 @@
 #include "common.h"
 
 #include "input.h"
-#include "camera.h"
+#include "Camera.h"
 #include "gmath.h"
 #include "renderer.h"
 #include "ui.h"
@@ -13,21 +13,21 @@
 #include "particles.h"
 #include "Texture.h"
 #include "Mesh.h"
-#include "light.h"
+#include "Light.h"
 #include "collision.h"
 #include "Material.h"
 #include "Resource.h"
-#include "scene.h"
+#include "Scene.h"
 #include "Scanner.h"
 #include "skybox.h"
 #include "map.h"
-#include "mesh_node.h"
-#include "skel_model_node.h"
-#include "mesh_node.h"
+#include "MeshNode.h"
+#include "SkelModelNode.h"
+#include "MeshNode.h"
 #include "SkelAnim.h"
-#include "mesh_skel_ctrl.h"
-#include "skel_anim_ctrl.h"
-#include "skel_node.h"
+#include "MeshSkelNodeCtrl.h"
+#include "SkelAnimCtrl.h"
+#include "SkelNode.h"
 #include "LightProps.h"
 #include "btBulletCollisionCommon.h"
 #include "btBulletDynamicsCommon.h"
@@ -35,16 +35,16 @@
 
 
 // map (hard coded)
-camera_t* main_cam;
-mesh_node_t* floor__,* sarge,* horse;
-skel_model_node_t* imp;
-point_light_t* point_lights[10];
-spot_light_t* spot_lights[2];
+Camera* main_cam;
+MeshNode* floor__,* sarge,* horse;
+skelModelNode* imp;
+PointLight* point_lights[10];
+SpotLight* spot_lights[2];
 
-class floor_t: public camera_t
+class floor_t: public Camera
 {
 	public:
-		void Render()
+		void render()
 		{
 			r::dbg::RenderCube( true, 1.0 );
 		}
@@ -168,7 +168,7 @@ void initPhysics()
 
 
 //=====================================================================================================================================
-// Init                                                                                                                               =
+// init                                                                                                                               =
 //=====================================================================================================================================
 void Init()
 {
@@ -177,7 +177,7 @@ void Init()
 	initPhysics();
 
 	srand( unsigned(time(NULL)) );
-	MathSanityChecks();
+	mathSanityChecks();
 
 	app::InitWindow();
 	uint ticks = app::GetTicks();
@@ -186,48 +186,48 @@ void Init()
 	ui::Init();
 
 	// camera
-	main_cam = new camera_t( r::aspect_ratio*ToRad(60.0), ToRad(60.0), 0.5, 100.0 );
-	main_cam->MoveLocalY( 3.0 );
-	main_cam->MoveLocalZ( 5.7 );
-	main_cam->MoveLocalX( -0.3 );
+	main_cam = new Camera( r::aspect_ratio*ToRad(60.0), ToRad(60.0), 0.5, 100.0 );
+	main_cam->moveLocalY( 3.0 );
+	main_cam->moveLocalZ( 5.7 );
+	main_cam->moveLocalX( -0.3 );
 
 	// lights
-	point_lights[0] = new point_light_t();
-	point_lights[0]->Init( "maps/temple/light0.light" );
-	point_lights[0]->SetLocalTransformation( vec3_t( -1.0, 2.4, 1.0 ), mat3_t::GetIdentity(), 1.0 );
-	point_lights[1] = new point_light_t();
-	point_lights[1]->Init( "maps/temple/light1.light" );
-	point_lights[1]->SetLocalTransformation( vec3_t( 2.5, 1.4, 1.0 ), mat3_t::GetIdentity(), 1.0 );
-
-	spot_lights[0] = new spot_light_t();
-	spot_lights[0]->Init( "maps/temple/light2.light" );
-	spot_lights[0]->SetLocalTransformation( vec3_t( 1.3, 4.3, 3.0 ), mat3_t( euler_t(ToRad(-20), ToRad(20), 0.0) ), 1.0 );
-	spot_lights[1] = new spot_light_t();
-	spot_lights[1]->Init( "maps/temple/light3.light" );
-	spot_lights[1]->SetLocalTransformation( vec3_t( -2.3, 6.3, 2.9 ), mat3_t( euler_t(ToRad(-70), ToRad(-20), 0.0) ), 1.0 );
+	point_lights[0] = new PointLight();
+	point_lights[0]->init( "maps/temple/light0.light" );
+	point_lights[0]->setLocalTransformation( vec3_t( -1.0, 2.4, 1.0 ), mat3_t::GetIdentity(), 1.0 );
+	point_lights[1] = new PointLight();
+	point_lights[1]->init( "maps/temple/light1.light" );
+	point_lights[1]->setLocalTransformation( vec3_t( 2.5, 1.4, 1.0 ), mat3_t::GetIdentity(), 1.0 );
+
+	spot_lights[0] = new SpotLight();
+	spot_lights[0]->init( "maps/temple/light2.light" );
+	spot_lights[0]->setLocalTransformation( vec3_t( 1.3, 4.3, 3.0 ), mat3_t( Euler(ToRad(-20), ToRad(20), 0.0) ), 1.0 );
+	spot_lights[1] = new SpotLight();
+	spot_lights[1]->init( "maps/temple/light3.light" );
+	spot_lights[1]->setLocalTransformation( vec3_t( -2.3, 6.3, 2.9 ), mat3_t( Euler(ToRad(-70), ToRad(-20), 0.0) ), 1.0 );
 
 	// horse
-	horse = new mesh_node_t();
-	horse->Init( "meshes/horse/horse.mesh" );
-	horse->SetLocalTransformation( vec3_t( -2, 0, 1 ), mat3_t( euler_t(-m::PI/2, 0.0, 0.0) ), 0.5 );
+	horse = new MeshNode();
+	horse->init( "meshes/horse/horse.mesh" );
+	horse->setLocalTransformation( vec3_t( -2, 0, 1 ), mat3_t( Euler(-m::PI/2, 0.0, 0.0) ), 0.5 );
 	
 	// sarge
-	sarge = new mesh_node_t();
-	sarge->Init( "meshes/sphere/sphere16.mesh" );
-	//sarge->SetLocalTransformation( vec3_t( 0, -2.8, 1.0 ), mat3_t( euler_t(-m::PI/2, 0.0, 0.0) ), 1.1 );
-	sarge->SetLocalTransformation( vec3_t( 0, 2.0, 2.0 ), mat3_t::GetIdentity(), 0.4 );
+	sarge = new MeshNode();
+	sarge->init( "meshes/sphere/sphere16.mesh" );
+	//sarge->setLocalTransformation( vec3_t( 0, -2.8, 1.0 ), mat3_t( Euler(-m::PI/2, 0.0, 0.0) ), 1.1 );
+	sarge->setLocalTransformation( vec3_t( 0, 2.0, 2.0 ), mat3_t::GetIdentity(), 0.4 );
 	
 	// floor
-	floor__ = new mesh_node_t();
-	floor__->Init( "maps/temple/Cube.019.mesh" );
-	floor__->SetLocalTransformation( vec3_t(0.0, -0.19, 0.0), mat3_t( euler_t(-m::PI/2, 0.0, 0.0) ), 0.8 );
+	floor__ = new MeshNode();
+	floor__->init( "maps/temple/Cube.019.mesh" );
+	floor__->setLocalTransformation( vec3_t(0.0, -0.19, 0.0), mat3_t( Euler(-m::PI/2, 0.0, 0.0) ), 0.8 );
 
 	// imp	
-	imp = new skel_model_node_t();
-	imp->Init( "models/imp/imp.smdl" );
-	imp->SetLocalTransformation( vec3_t( 0.0, 2.11, 0.0 ), mat3_t( euler_t(-m::PI/2, 0.0, 0.0) ), 0.7 );
-	imp->mesh_nodes[0]->mesh_skel_ctrl->skel_node->skel_anim_ctrl->skel_anim = rsrc::skel_anims.load( "models/imp/walk.imp.anim" );
-	imp->mesh_nodes[0]->mesh_skel_ctrl->skel_node->skel_anim_ctrl->step = 0.8;
+	imp = new skelModelNode();
+	imp->init( "models/imp/imp.smdl" );
+	imp->setLocalTransformation( vec3_t( 0.0, 2.11, 0.0 ), mat3_t( Euler(-m::PI/2, 0.0, 0.0) ), 0.7 );
+	imp->meshNodes[0]->meshSkelCtrl->skelNode->skelAnimCtrl->skelAnim = rsrc::skel_anims.load( "models/imp/walk.imp.anim" );
+	imp->meshNodes[0]->meshSkelCtrl->skelNode->skelAnimCtrl->step = 0.8;
 
 
 	//
@@ -248,7 +248,7 @@ void Init()
 //=====================================================================================================================================
 int main( int /*argc*/, char* /*argv*/[] )
 {
-	app::PrintAppInfo();
+	app::printAppInfo();
 
 	Init();
 
@@ -265,7 +265,7 @@ int main( int /*argc*/, char* /*argv*/[] )
 		float scale = 0.01;
 
 		// move the camera
-		static node_t* mover = main_cam;
+		static Node* mover = main_cam;
 
 		if( i::keys[ SDLK_1 ] ) mover = main_cam;
 		if( i::keys[ SDLK_2 ] ) mover = point_lights[0];
@@ -274,52 +274,52 @@ int main( int /*argc*/, char* /*argv*/[] )
 		if( i::keys[ SDLK_5 ] ) mover = spot_lights[1];
 		if( i::keys[ SDLK_m ] == 1 ) i::warp_mouse = !i::warp_mouse;
 
-		if( i::keys[SDLK_a] ) mover->MoveLocalX( -dist );
-		if( i::keys[SDLK_d] ) mover->MoveLocalX( dist );
-		if( i::keys[SDLK_LSHIFT] ) mover->MoveLocalY( dist );
-		if( i::keys[SDLK_SPACE] ) mover->MoveLocalY( -dist );
-		if( i::keys[SDLK_w] ) mover->MoveLocalZ( -dist );
-		if( i::keys[SDLK_s] ) mover->MoveLocalZ( dist );
+		if( i::keys[SDLK_a] ) mover->moveLocalX( -dist );
+		if( i::keys[SDLK_d] ) mover->moveLocalX( dist );
+		if( i::keys[SDLK_LSHIFT] ) mover->moveLocalY( dist );
+		if( i::keys[SDLK_SPACE] ) mover->moveLocalY( -dist );
+		if( i::keys[SDLK_w] ) mover->moveLocalZ( -dist );
+		if( i::keys[SDLK_s] ) mover->moveLocalZ( dist );
 		if( !i::warp_mouse )
 		{
-			if( i::keys[SDLK_UP] ) mover->RotateLocalX( ang );
-			if( i::keys[SDLK_DOWN] ) mover->RotateLocalX( -ang );
-			if( i::keys[SDLK_LEFT] ) mover->RotateLocalY( ang );
-			if( i::keys[SDLK_RIGHT] ) mover->RotateLocalY( -ang );
+			if( i::keys[SDLK_UP] ) mover->rotateLocalX( ang );
+			if( i::keys[SDLK_DOWN] ) mover->rotateLocalX( -ang );
+			if( i::keys[SDLK_LEFT] ) mover->rotateLocalY( ang );
+			if( i::keys[SDLK_RIGHT] ) mover->rotateLocalY( -ang );
 		}
 		else
 		{
 			float accel = 44.0;
-			mover->RotateLocalX( ang * i::mouse_velocity.y * accel );
-			mover->RotateLocalY( -ang * i::mouse_velocity.x * accel );
+			mover->rotateLocalX( ang * i::mouse_velocity.y * accel );
+			mover->rotateLocalY( -ang * i::mouse_velocity.x * accel );
 		}
-		if( i::keys[SDLK_q] ) mover->RotateLocalZ( ang );
-		if( i::keys[SDLK_e] ) mover->RotateLocalZ( -ang );
-		if( i::keys[SDLK_PAGEUP] ) mover->scale_lspace += scale ;
-		if( i::keys[SDLK_PAGEDOWN] ) mover->scale_lspace -= scale ;
+		if( i::keys[SDLK_q] ) mover->rotateLocalZ( ang );
+		if( i::keys[SDLK_e] ) mover->rotateLocalZ( -ang );
+		if( i::keys[SDLK_PAGEUP] ) mover->scaleLspace += scale ;
+		if( i::keys[SDLK_PAGEDOWN] ) mover->scaleLspace -= scale ;
 
-		if( i::keys[SDLK_k] ) main_cam->LookAtPoint( point_lights[0]->translation_wspace );
+		if( i::keys[SDLK_k] ) main_cam->lookAtPoint( point_lights[0]->translationWspace );
 
-		mover->rotation_lspace.Reorthogonalize();
+		mover->rotationLspace.Reorthogonalize();
 
 
-		scene::UpdateAllControllers();
-		scene::UpdateAllWorldStuff();
+		scene::updateAllControllers();
+		scene::updateAllWorldStuff();
 
 		dynamicsWorld->stepSimulation( 1 );
 
 		r::Render( *main_cam );
 
-		//map.octree.root->bounding_box.Render();
+		//map.octree.root->bounding_box.render();
 
 		// print some debug stuff
 		ui::SetColor( vec4_t(1.0, 1.0, 1.0, 1.0) );
 		ui::SetPos( -0.98, 0.95 );
 		ui::SetFontWidth( 0.03 );
-		ui::Printf( "frame:%d time:%dms\n", r::frames_num, app::GetTicks()-ticks_ );
-		//ui::Print( "Movement keys: arrows,w,a,s,d,q,e,shift,space\nSelect objects: keys 1 to 5\n" );
-		ui::Printf( "Mover: Pos(%.2f %.2f %.2f) Angs(%.2f %.2f %.2f)", mover->translation_wspace.x, mover->translation_wspace.y, mover->translation_wspace.z,
-								 ToDegrees(euler_t(mover->rotation_wspace).x), ToDegrees(euler_t(mover->rotation_wspace).y), ToDegrees(euler_t(mover->rotation_wspace).z) );
+		ui::printf( "frame:%d time:%dms\n", r::frames_num, app::GetTicks()-ticks_ );
+		//ui::print( "Movement keys: arrows,w,a,s,d,q,e,shift,space\nSelect objects: keys 1 to 5\n" );
+		ui::printf( "Mover: Pos(%.2f %.2f %.2f) Angs(%.2f %.2f %.2f)", mover->translationWspace.x, mover->translationWspace.y, mover->translationWspace.z,
+								 ToDegrees(Euler(mover->rotationWspace).x), ToDegrees(Euler(mover->rotationWspace).y), ToDegrees(Euler(mover->rotationWspace).z) );
 
 		if( i::keys[SDLK_ESCAPE] ) break;
 		if( i::keys[SDLK_F11] ) app::TogleFullScreen();
@@ -334,7 +334,7 @@ int main( int /*argc*/, char* /*argv*/[] )
 
 		// std stuff follow
 		SDL_GL_SwapBuffers();
-		r::PrintLastError();
+		r::printLastError();
 		if( 1 )
 		{
 			//if( r::frames_num == 10 ) r::TakeScreenshot("gfx/screenshot.tga");

+ 32 - 0
src/math/Axisang.h

@@ -0,0 +1,32 @@
+#ifndef _AXISANG_H_
+#define _AXISANG_H_
+
+#include "common.h"
+#include "forward_decls.h"
+
+
+namespace m {
+
+
+class Axisang
+{
+	public:
+		// data members
+		float ang;
+		vec3_t axis;
+		// constructors & distructors
+		explicit Axisang();
+		         Axisang( const Axisang& b );
+		explicit Axisang( float rad, const vec3_t& axis_ );
+		explicit Axisang( const quat_t& q );
+		explicit Axisang( const mat3_t& m3 );
+};
+
+
+} // end namespace
+
+
+#include "Axisang.inl.h"
+
+
+#endif

+ 11 - 11
src/math/axisang.inl.h → src/math/Axisang.inl.h

@@ -4,25 +4,25 @@ namespace m {
 
 
 // constructor []
-inline axisang_t::axisang_t()
+inline Axisang::Axisang()
 	: ang(0.0), axis()
 {}
 
-// constructor [axisang_t]
-inline axisang_t::axisang_t( const axisang_t& b )
+// constructor [Axisang]
+inline Axisang::Axisang( const Axisang& b )
 	: ang(b.ang), axis(b.axis)
 {}
 
 // constructor [float, axis]
-inline axisang_t::axisang_t( float rad, const vec3_t& axis_ )
+inline Axisang::Axisang( float rad, const vec3_t& axis_ )
 	: ang(rad), axis(axis_)
 {}
 
 // constructor [quat]
-inline axisang_t::axisang_t( const quat_t& q )
+inline Axisang::Axisang( const quat_t& q )
 {
 	ang = 2.0*acos( q.w );
-	float length = Sqrt( 1.0 - q.w*q.w );
+	float length = sqrt( 1.0 - q.w*q.w );
 	if( IsZero(length) )
 		axis = vec3_t(0.0);
 	else
@@ -33,7 +33,7 @@ inline axisang_t::axisang_t( const quat_t& q )
 }
 
 // constructor [mat3]
-inline axisang_t::axisang_t( const mat3_t& m3 )
+inline Axisang::Axisang( const mat3_t& m3 )
 {
 	if( (fabs(m3(0,1)-m3(1,0))< EPSILON)  && (fabs(m3(0,2)-m3(2,0))< EPSILON)  && (fabs(m3(1,2)-m3(2,1))< EPSILON) )
 	{
@@ -48,17 +48,17 @@ inline axisang_t::axisang_t( const mat3_t& m3 )
 		ang = PI;
 		axis.x = (m3(0,0)+1)/2;
 		if( axis.x > 0.0 )
-			axis.x = Sqrt(axis.x);
+			axis.x = sqrt(axis.x);
 		else
 			axis.x = 0;
 		axis.y = (m3(1,1)+1)/2;
 		if( axis.y > 0 )
-			axis.y = Sqrt(axis.y);
+			axis.y = sqrt(axis.y);
 		else
 			axis.y = 0;
 		axis.z = (m3(2,2)+1)/2;
 		if( axis.z > 0 )
-			axis.z = Sqrt(axis.z);
+			axis.z = sqrt(axis.z);
 		else
 			axis.z = 0.0;
 
@@ -79,7 +79,7 @@ inline axisang_t::axisang_t( const mat3_t& m3 )
 		return;
 	}
 
-	float s = Sqrt((m3(2,1) - m3(1,2))*(m3(2,1) - m3(1,2))+(m3(0,2) - m3(2,0))*(m3(0,2) - m3(2,0))+(m3(1,0) - m3(0,1))*(m3(1,0) - m3(0,1)));
+	float s = sqrt((m3(2,1) - m3(1,2))*(m3(2,1) - m3(1,2))+(m3(0,2) - m3(2,0))*(m3(0,2) - m3(2,0))+(m3(1,0) - m3(0,1))*(m3(1,0) - m3(0,1)));
 
 	if( fabs(s) < 0.001 ) s = 1;
 

+ 8 - 8
src/math/euler.h → src/math/Euler.h

@@ -8,7 +8,7 @@
 namespace m {
 
 
-class euler_t
+class Euler
 {
 	public:
 		// data members
@@ -23,20 +23,20 @@ class euler_t
 		float& attitude();
 		float  attitude() const;
 		// constructors & distructors
-		explicit euler_t();
-		explicit euler_t( float x, float y, float z  );
-		         euler_t( const euler_t& b );
-		explicit euler_t( const quat_t& q );
-		explicit euler_t( const mat3_t& m3 );
+		explicit Euler();
+		explicit Euler( float x, float y, float z  );
+		         Euler( const Euler& b );
+		explicit Euler( const quat_t& q );
+		explicit Euler( const mat3_t& m3 );
 		// other
-		void Print() const;
+		void print() const;
 };
 
 
 } // end namespace
 
 
-#include "euler.inl.h"
+#include "Euler.inl.h"
 
 
 #endif

+ 14 - 14
src/math/euler.inl.h → src/math/Euler.inl.h

@@ -5,63 +5,63 @@ namespace m {
 
 
 // accessors
-inline float& euler_t::operator []( uint i )
+inline float& Euler::operator []( uint i )
 {
 	return (&x)[i];
 }
 
-inline float euler_t::operator []( uint i) const
+inline float Euler::operator []( uint i) const
 {
 	return (&x)[i];
 }
 
-inline float& euler_t::bank()
+inline float& Euler::bank()
 {
 	return x;
 }
 
-inline float euler_t::bank() const
+inline float Euler::bank() const
 {
 	return x;
 }
 
-inline float& euler_t::heading()
+inline float& Euler::heading()
 {
 	return y;
 }
 
-inline float euler_t::heading() const
+inline float Euler::heading() const
 {
 	return y;
 }
 
-inline float& euler_t::attitude()
+inline float& Euler::attitude()
 {
 	return z;
 }
 
-inline float euler_t::attitude() const
+inline float Euler::attitude() const
 {
 	return z;
 }
 
 // constructor []
-inline euler_t::euler_t()
+inline Euler::Euler()
 	: x(0.0), y(0.0), z(0.0)
 {}
 
 // constructor [float, float, float]
-inline euler_t::euler_t( float x_, float y_, float z_ )
+inline Euler::Euler( float x_, float y_, float z_ )
 	: x(x_), y(y_), z(z_)
 {}
 
 // constructor [euler]
-inline euler_t::euler_t( const euler_t& b )
+inline Euler::Euler( const Euler& b )
 	: x(b.x), y(b.y), z(b.z)
 {}
 
 // constructor [quat]
-inline euler_t::euler_t( const quat_t& q )
+inline Euler::Euler( const quat_t& q )
 {
 	float test = q.x*q.y + q.z*q.w;
 	if( test > 0.499 )
@@ -88,14 +88,14 @@ inline euler_t::euler_t( const quat_t& q )
 }
 
 // constructor [mat3]
-inline euler_t::euler_t( const mat3_t& m3 )
+inline Euler::Euler( const mat3_t& m3 )
 {
 	float cx, sx;
 	float cy, sy;
 	float cz, sz;
 
 	sy = m3(0,2);
-	cy = Sqrt( 1.0 - sy*sy );
+	cy = sqrt( 1.0 - sy*sy );
 	// normal case
 	if ( !IsZero( cy ) )
 	{

+ 0 - 32
src/math/axisang.h

@@ -1,32 +0,0 @@
-#ifndef _AXISANG_H_
-#define _AXISANG_H_
-
-#include "common.h"
-#include "forward_decls.h"
-
-
-namespace m {
-
-
-class axisang_t
-{
-	public:
-		// data members
-		float ang;
-		vec3_t axis;
-		// constructors & distructors
-		explicit axisang_t();
-		         axisang_t( const axisang_t& b );
-		explicit axisang_t( float rad, const vec3_t& axis_ );
-		explicit axisang_t( const quat_t& q );
-		explicit axisang_t( const mat3_t& m3 );
-};
-
-
-} // end namespace
-
-
-#include "axisang.inl.h"
-
-
-#endif

+ 2 - 2
src/math/forward_decls.h

@@ -6,8 +6,8 @@ namespace m {
 	class vec3_t;
 	class vec4_t;
 	class quat_t;
-	class euler_t;
-	class axisang_t;
+	class Euler;
+	class Axisang;
 	class mat3_t;
 	class mat4_t;
 }

+ 2 - 2
src/math/gmath.h

@@ -7,8 +7,8 @@
 #include "vec3.h"
 #include "vec4.h"
 #include "quat.h"
-#include "axisang.h"
-#include "euler.h"
+#include "Axisang.h"
+#include "Euler.h"
 #include "mat3.h"
 #include "mat4.h"
 #include "m_misc.h"

+ 2 - 2
src/math/m_dflt_header.h

@@ -2,8 +2,8 @@
 #include "vec3.h"
 #include "vec4.h"
 #include "quat.h"
-#include "axisang.h"
-#include "euler.h"
+#include "Axisang.h"
+#include "Euler.h"
 #include "mat3.h"
 #include "mat4.h"
 #include "m_misc.h"

+ 4 - 4
src/math/m_misc.h

@@ -12,10 +12,10 @@ const float PI = 3.14159265358979323846;
 const float EPSILON = 1.0e-6;
 
 
-void  MathSanityChecks();
-void  SinCos( float rad, float& sin_, float& cos_ );
-float InvSqrt( float f );
-float Sqrt( float f );
+void  mathSanityChecks();
+void  sinCos( float rad, float& sin_, float& cos_ );
+float invSqrt( float f );
+float sqrt( float f );
 float ToRad( float degrees );
 float ToDegrees( float rad );
 float Sin( float rad );

+ 7 - 7
src/math/m_misc.inl.h

@@ -4,19 +4,19 @@
 namespace m {
 
 
-// MathSanityChecks
+// mathSanityChecks
 // test if the compiler keeps the correct sizes for the classes
-inline void MathSanityChecks()
+inline void mathSanityChecks()
 {
 	const int fs = sizeof(float); // float size
-	if( sizeof(vec2_t)!=fs*2 || sizeof(vec3_t)!=fs*3 || sizeof(vec4_t)!=fs*4 || sizeof(quat_t)!=fs*4 || sizeof(euler_t)!=fs*3 ||
+	if( sizeof(vec2_t)!=fs*2 || sizeof(vec3_t)!=fs*3 || sizeof(vec4_t)!=fs*4 || sizeof(quat_t)!=fs*4 || sizeof(Euler)!=fs*3 ||
 	    sizeof(mat3_t)!=fs*9 || sizeof(mat4_t)!=fs*16 )
 		FATAL("Your compiler does class alignment. Quiting");
 }
 
 
 // 1/sqrt(f)
-inline float InvSqrt( float f )
+inline float invSqrt( float f )
 {
 #if defined( _DEBUG_ )
 	return 1.0/sqrtf(f);
@@ -49,7 +49,7 @@ inline float InvSqrt( float f )
 
 
 // PolynomialSinQuadrant
-// used in SinCos
+// used in sinCos
 #if !defined(_DEBUG_)
 inline static float PolynomialSinQuadrant(float a)
 {
@@ -59,7 +59,7 @@ inline static float PolynomialSinQuadrant(float a)
 
 
 // Sine and Cosine
-inline void SinCos( float a, float& sina, float& cosa )
+inline void sinCos( float a, float& sina, float& cosa )
 {
 #ifdef _DEBUG_
 	sina = sin(a);
@@ -111,7 +111,7 @@ inline void SinCos( float a, float& sina, float& cosa )
 //=====================================================================================================================================
 // Small funcs                                                                                                                        =
 //=====================================================================================================================================
-inline float Sqrt( float f ) { return 1/InvSqrt(f); }
+inline float sqrt( float f ) { return 1/invSqrt(f); }
 inline float ToRad( float degrees ) { return degrees*(PI/180.0); }
 inline float ToDegrees( float rad ) { return rad*(180.0/PI); }
 inline float Sin( float rad ) { return sin(rad); }

+ 3 - 3
src/math/mat3.h

@@ -31,8 +31,8 @@ class mat3_t
 		explicit mat3_t( float arr [] );
 		         mat3_t( const mat3_t& b );
 		explicit mat3_t( const quat_t& q ); // 12 muls, 12 adds
-		explicit mat3_t( const euler_t& eu );
-		explicit mat3_t( const axisang_t& axisang );
+		explicit mat3_t( const Euler& eu );
+		explicit mat3_t( const Axisang& axisang );
 		// ops with mat3
 		mat3_t  operator + ( const mat3_t& b ) const;
 		mat3_t& operator +=( const mat3_t& b );
@@ -74,7 +74,7 @@ class mat3_t
 		void   Transpose();
 		mat3_t GetTransposed() const;
 		void   Reorthogonalize();
-		void   Print() const;
+		void   print() const;
 		float  Det() const;
 		void   Invert();
 		mat3_t GetInverse() const;

+ 20 - 20
src/math/mat3.inl.h

@@ -89,12 +89,12 @@ inline mat3_t::mat3_t( const quat_t& q )
 }
 
 // constructor [euler]
-inline mat3_t::mat3_t( const euler_t& e )
+inline mat3_t::mat3_t( const Euler& e )
 {
 	float ch, sh, ca, sa, cb, sb;
-  SinCos( e.heading(), sh, ch );
-  SinCos( e.attitude(), sa, ca );
-  SinCos( e.bank(), sb, cb );
+  sinCos( e.heading(), sh, ch );
+  sinCos( e.attitude(), sa, ca );
+  sinCos( e.bank(), sb, cb );
 
   ME(0,0) = ch * ca;
   ME(0,1) = sh*sb - ch*sa*cb;
@@ -108,12 +108,12 @@ inline mat3_t::mat3_t( const euler_t& e )
 }
 
 // constructor [axisang]
-inline mat3_t::mat3_t( const axisang_t& axisang )
+inline mat3_t::mat3_t( const Axisang& axisang )
 {
 	DEBUG_ERR( !IsZero( 1.0-axisang.axis.Length() ) ); // Not normalized axis
 
 	float c, s;
-	SinCos( axisang.ang, s, c );
+	sinCos( axisang.ang, s, c );
 	float t = 1.0 - c;
 
 	const vec3_t& axis = axisang.axis;
@@ -413,7 +413,7 @@ inline vec3_t mat3_t::GetColumn( const uint i ) const
 inline void mat3_t::SetRotationX( float rad )
 {
 	float sintheta, costheta;
-	SinCos( rad, sintheta, costheta );
+	sinCos( rad, sintheta, costheta );
 
 	ME(0,0) = 1.0f;
 	ME(0,1) = 0.0f;
@@ -430,7 +430,7 @@ inline void mat3_t::SetRotationX( float rad )
 inline void mat3_t::SetRotationY( float rad )
 {
 	float sintheta, costheta;
-	SinCos( rad, sintheta, costheta );
+	sinCos( rad, sintheta, costheta );
 
 	ME(0,0) = costheta;
 	ME(0,1) = 0.0f;
@@ -447,7 +447,7 @@ inline void mat3_t::SetRotationY( float rad )
 inline void mat3_t::SetRotationZ( float rad )
 {
 	float sintheta, costheta;
-	SinCos( rad, sintheta, costheta );
+	sinCos( rad, sintheta, costheta );
 
 	ME(0,0) = costheta;
 	ME(0,1) = -sintheta;
@@ -468,7 +468,7 @@ from the vector from colomn 0*/
 inline void mat3_t::RotateXAxis( float rad )
 {
 	float sina, cosa;
-	SinCos( rad, sina, cosa );
+	sinCos( rad, sina, cosa );
 
 	/*vec3_t x_axis, y_axis, z_axis;
 	GetColumns( x_axis, y_axis, z_axis );*/
@@ -479,7 +479,7 @@ inline void mat3_t::RotateXAxis( float rad )
 	ME(2,2) = ME(2,2)*cosa - ME(2,1)*sina;
 
 	// z_axis.Normalize();
-	float len = InvSqrt( ME(0,2)*ME(0,2) + ME(1,2)*ME(1,2) + ME(2,2)*ME(2,2) );
+	float len = invSqrt( ME(0,2)*ME(0,2) + ME(1,2)*ME(1,2) + ME(2,2)*ME(2,2) );
 	ME(0,2) *= len;
 	ME(1,2) *= len;
 	ME(2,2) *= len;
@@ -490,7 +490,7 @@ inline void mat3_t::RotateXAxis( float rad )
 	ME(2,1) = ME(0,2)*ME(1,0) - ME(1,2)*ME(0,0);
 
 	// y_axis.Normalize();
-	/*len = InvSqrt( ME(0,1)*ME(0,1) + ME(1,1)*ME(1,1) + ME(2,1)*ME(2,1) );
+	/*len = invSqrt( ME(0,1)*ME(0,1) + ME(1,1)*ME(1,1) + ME(2,1)*ME(2,1) );
 	ME(0,1) *= len;
 	ME(1,1) *= len;
 	ME(2,1) *= len;*/
@@ -503,7 +503,7 @@ inline void mat3_t::RotateXAxis( float rad )
 inline void mat3_t::RotateYAxis( float rad )
 {
 	float sina, cosa;
-	SinCos( rad, sina, cosa );
+	sinCos( rad, sina, cosa );
 
 	/*vec3_t x_axis, y_axis, z_axis;
 	GetColumns( x_axis, y_axis, z_axis );*/
@@ -514,7 +514,7 @@ inline void mat3_t::RotateYAxis( float rad )
 	ME(2,2) = ME(2,2)*cosa + ME(2,0)*sina;
 
 	// z_axis.Normalize();
-	float len = InvSqrt( ME(0,2)*ME(0,2) + ME(1,2)*ME(1,2) + ME(2,2)*ME(2,2) );
+	float len = invSqrt( ME(0,2)*ME(0,2) + ME(1,2)*ME(1,2) + ME(2,2)*ME(2,2) );
 	ME(0,2) *= len;
 	ME(1,2) *= len;
 	ME(2,2) *= len;
@@ -525,7 +525,7 @@ inline void mat3_t::RotateYAxis( float rad )
 	ME(2,0) = ME(1,2)*ME(0,1) - ME(0,2)*ME(1,1);
 
 	// x_axis.Normalize();
-	/*len = InvSqrt( ME(0,0)*ME(0,0) + ME(1,0)*ME(1,0) + ME(2,0)*ME(2,0) );
+	/*len = invSqrt( ME(0,0)*ME(0,0) + ME(1,0)*ME(1,0) + ME(2,0)*ME(2,0) );
 	ME(0,0) *= len;
 	ME(1,0) *= len;
 	ME(2,0) *= len;*/
@@ -538,7 +538,7 @@ inline void mat3_t::RotateYAxis( float rad )
 inline void mat3_t::RotateZAxis( float rad )
 {
 	float sina, cosa;
-	SinCos( rad, sina, cosa );
+	sinCos( rad, sina, cosa );
 
 	/*vec3_t x_axis, y_axis, z_axis;
 	GetColumns( x_axis, y_axis, z_axis );*/
@@ -549,7 +549,7 @@ inline void mat3_t::RotateZAxis( float rad )
 	ME(2,0) = ME(2,0)*cosa + ME(2,1)*sina;
 
 	// x_axis.Normalize();
-	float len = InvSqrt( ME(0,0)*ME(0,0) + ME(1,0)*ME(1,0) + ME(2,0)*ME(2,0) );
+	float len = invSqrt( ME(0,0)*ME(0,0) + ME(1,0)*ME(1,0) + ME(2,0)*ME(2,0) );
 	ME(0,0) *= len;
 	ME(1,0) *= len;
 	ME(2,0) *= len;
@@ -560,7 +560,7 @@ inline void mat3_t::RotateZAxis( float rad )
 	ME(2,1) = ME(0,2)*ME(1,0) - ME(1,2)*ME(0,0);
 
 	// y_axis.Normalize();
-	/*len = InvSqrt( ME(0,1)*ME(0,1) + ME(1,1)*ME(1,1) + ME(2,1)*ME(2,1) );
+	/*len = invSqrt( ME(0,1)*ME(0,1) + ME(1,1)*ME(1,1) + ME(2,1)*ME(2,1) );
 	ME(0,1) *= len;
 	ME(1,1) *= len;
 	ME(2,1) *= len;*/
@@ -624,8 +624,8 @@ inline void mat3_t::Reorthogonalize()
 	SetColumns( x_axis, y_axis, z_axis );
 }
 
-// Print
-inline void mat3_t::Print() const
+// print
+inline void mat3_t::print() const
 {
 	for( int i=0; i<3; i++ )
 	{

+ 1 - 1
src/math/mat4.h

@@ -69,7 +69,7 @@ class mat4_t
 		vec3_t GetTranslationPart() const;
 		void   Transpose();
 		mat4_t GetTransposed() const;
-		void   Print() const;
+		void   print() const;
 		float  Det() const;
 		void   Invert();
 		mat4_t GetInverse() const;

+ 2 - 2
src/math/mat4.inl.h

@@ -515,8 +515,8 @@ inline const mat4_t& mat4_t::GetZero()
 	return zero;
 }
 
-// Print
-inline void mat4_t::Print() const
+// print
+inline void mat4_t::print() const
 {
 	cout << fixed;
 	for( int i=0; i<4; i++ )

+ 3 - 3
src/math/quat.h

@@ -24,8 +24,8 @@ class quat_t
 		explicit quat_t( const vec4_t& v4 );
 		         quat_t( const quat_t& b );
 		explicit quat_t( const mat3_t& m3 );
-		explicit quat_t( const euler_t& eu );
-		explicit quat_t( const axisang_t& axisang );
+		explicit quat_t( const Euler& eu );
+		explicit quat_t( const Axisang& axisang );
 		// ops with same
 		quat_t  operator * ( const quat_t& b ) const;
 		quat_t& operator *=( const quat_t& b );
@@ -40,7 +40,7 @@ class quat_t
 		quat_t Conjugated() const;
 		void   Normalize();
 		quat_t GetNormalized() const;
-		void   Print() const;
+		void   print() const;
 		float  Dot( const quat_t& b ) const;
 		quat_t Slerp( const quat_t& q1, float t ) const; // returns Slerp( this, q1, t )
 		quat_t GetRotated( const quat_t& b ) const;

+ 15 - 15
src/math/quat.inl.h

@@ -47,7 +47,7 @@ inline quat_t::quat_t( const mat3_t& m3 )
 	float trace = m3(0, 0) + m3(1, 1) + m3(2, 2) + 1.0;
 	if( trace > EPSILON )
 	{
-		float s = 0.5 * InvSqrt(trace);
+		float s = 0.5 * invSqrt(trace);
 		w = 0.25 / s;
 		x = ( m3(2, 1) - m3(1, 2) ) * s;
 		y = ( m3(0, 2) - m3(2, 0) ) * s;
@@ -57,7 +57,7 @@ inline quat_t::quat_t( const mat3_t& m3 )
 	{
 		if( m3(0, 0) > m3(1, 1) && m3(0, 0) > m3(2, 2) )
 		{
-			float s = 0.5 * InvSqrt( 1.0 + m3(0, 0) - m3(1, 1) - m3(2, 2) );
+			float s = 0.5 * invSqrt( 1.0 + m3(0, 0) - m3(1, 1) - m3(2, 2) );
 			w = (m3(1, 2) - m3(2, 1) ) * s;
 			x = 0.25 / s;
 			y = (m3(0, 1) + m3(1, 0) ) * s;
@@ -65,7 +65,7 @@ inline quat_t::quat_t( const mat3_t& m3 )
 		}
 		else if( m3(1, 1) > m3(2, 2) )
 		{
-			float s = 0.5 * InvSqrt( 1.0 + m3(1, 1) - m3(0, 0) - m3(2, 2) );
+			float s = 0.5 * invSqrt( 1.0 + m3(1, 1) - m3(0, 0) - m3(2, 2) );
 			w = (m3(0, 2) - m3(2, 0) ) * s;
 			x = (m3(0, 1) + m3(1, 0) ) * s;
 			y = 0.25 / s;
@@ -73,7 +73,7 @@ inline quat_t::quat_t( const mat3_t& m3 )
 		}
 		else
 		{
-			float s = 0.5 * InvSqrt( 1.0 + m3(2, 2) - m3(0, 0) - m3(1, 1) );
+			float s = 0.5 * invSqrt( 1.0 + m3(2, 2) - m3(0, 0) - m3(1, 1) );
 			w = (m3(0, 1) - m3(1, 0) ) * s;
 			x = (m3(0, 2) + m3(2, 0) ) * s;
 			y = (m3(1, 2) + m3(2, 1) ) * s;
@@ -83,16 +83,16 @@ inline quat_t::quat_t( const mat3_t& m3 )
 }
 
 // constructor [euler]
-inline quat_t::quat_t( const euler_t& eu )
+inline quat_t::quat_t( const Euler& eu )
 {
 	float cx, sx;
-	SinCos( eu.heading()*0.5, sx, cx );
+	sinCos( eu.heading()*0.5, sx, cx );
 
 	float cy, sy;
-	SinCos( eu.attitude()*0.5, sy, cy );
+	sinCos( eu.attitude()*0.5, sy, cy );
 
 	float cz, sz;
-	SinCos( eu.bank()*0.5, sz, cz );
+	sinCos( eu.bank()*0.5, sz, cz );
 
 	float cxcy = cx*cy;
 	float sxsy = sx*sy;
@@ -103,7 +103,7 @@ inline quat_t::quat_t( const euler_t& eu )
 }
 
 // constructor [euler]
-inline quat_t::quat_t( const axisang_t& axisang )
+inline quat_t::quat_t( const Axisang& axisang )
 {
 	float lengthsq = axisang.axis.LengthSquared();
 	if( IsZero( lengthsq ) )
@@ -115,9 +115,9 @@ inline quat_t::quat_t( const axisang_t& axisang )
 	float rad = axisang.ang * 0.5;
 
 	float sintheta, costheta;
-	SinCos( rad, sintheta, costheta );
+	sinCos( rad, sintheta, costheta );
 
-	float scalefactor = sintheta * InvSqrt(lengthsq);
+	float scalefactor = sintheta * invSqrt(lengthsq);
 
 	x = scalefactor * axisang.axis.x;
 	y = scalefactor * axisang.axis.y;
@@ -184,7 +184,7 @@ inline void quat_t::Normalize()
 // Length
 inline float quat_t::Length() const
 {
-	return Sqrt( w*w + x*x + y*y + z*z );
+	return sqrt( w*w + x*x + y*y + z*z );
 }
 
 // Invert
@@ -198,8 +198,8 @@ inline void quat_t::Invert()
 	ME = quat_t( -normi*x, -normi*y, -normi*z, normi*w );
 }
 
-// Print
-inline void quat_t::Print() const
+// print
+inline void quat_t::print() const
 {
 	cout << fixed << "(w,x,y,z) = " << w << ' ' << x << ' ' << y << ' ' << z  << '\n' << endl;
 }
@@ -257,7 +257,7 @@ inline quat_t quat_t::Slerp( const quat_t& q1_, float t ) const
 	}
 
 	float half_theta = acos( cos_half_theta );
-	float sin_half_theta = Sqrt(1.0 - cos_half_theta*cos_half_theta);
+	float sin_half_theta = sqrt(1.0 - cos_half_theta*cos_half_theta);
 
 	if( fabs(sin_half_theta) < 0.001 )
 	{

+ 1 - 1
src/math/vec2.h

@@ -55,7 +55,7 @@ class vec2_t
 		void   Normalize();
 		vec2_t GetNormalized() const;
 		float  Dot( const vec2_t& b ) const;
-		void   Print() const;
+		void   print() const;
 };
 
 

+ 5 - 5
src/math/vec2.inl.h

@@ -195,7 +195,7 @@ inline vec2_t& vec2_t::operator /=( float f )
 // Length
 inline float vec2_t::Length() const
 {
-	return Sqrt( x*x + y*y );
+	return sqrt( x*x + y*y );
 }
 
 // set to zero
@@ -207,13 +207,13 @@ inline void vec2_t::SetZero()
 // Normalize
 inline void vec2_t::Normalize()
 {
-	ME *= InvSqrt( x*x + y*y );
+	ME *= invSqrt( x*x + y*y );
 }
 
 // Normalized (return the normalized)
 inline vec2_t vec2_t::GetNormalized() const
 {
-	return ME * InvSqrt( x*x + y*y );
+	return ME * invSqrt( x*x + y*y );
 }
 
 // Dot
@@ -234,8 +234,8 @@ inline vec2_t vec2_t::GetOne()
 	return vec2_t(1.0);
 }
 
-// Print
-inline void vec2_t::Print() const
+// print
+inline void vec2_t::print() const
 {
 	for( int i=0; i<2; i++ )
 		cout << fixed << ME[i] << ' ';

+ 1 - 1
src/math/vec3.h

@@ -60,7 +60,7 @@ class vec3_t
 		vec3_t GetRotated( const quat_t& q ) const; // returns q * this * q.Conjucated() aka returns a rotated this. 18 muls, 12 adds
 		void   Rotate( const quat_t& q );
 		vec3_t Lerp( const vec3_t& v1, float t ) const; // return Lerp( this, v1, t )
-		void   Print() const;
+		void   print() const;
 		// transformations. The faster way is by far the mat4 * vec3 or the Transformed( vec3_t, mat3_t )
 		vec3_t GetTransformed( const vec3_t& translate, const mat3_t& rotate, float scale ) const;
 		void   Transform( const vec3_t& translate, const mat3_t& rotate, float scale );

+ 5 - 5
src/math/vec3.inl.h

@@ -222,7 +222,7 @@ inline vec3_t vec3_t::Cross( const vec3_t& b ) const
 // Length
 inline float vec3_t::Length() const
 {
-	return Sqrt( x*x + y*y + z*z );
+	return sqrt( x*x + y*y + z*z );
 }
 
 // LengthSquared
@@ -240,13 +240,13 @@ inline float vec3_t::DistanceSquared( const vec3_t& b ) const
 // Normalize
 inline void vec3_t::Normalize()
 {
-	ME *= InvSqrt( x*x + y*y + z*z );
+	ME *= invSqrt( x*x + y*y + z*z );
 }
 
 // Normalized (return the normalized)
 inline vec3_t vec3_t::GetNormalized() const
 {
-	return ME * InvSqrt( x*x + y*y + z*z );
+	return ME * invSqrt( x*x + y*y + z*z );
 }
 
 // Project
@@ -277,8 +277,8 @@ inline void vec3_t::Rotate( const quat_t& q )
 	ME = GetRotated(q);
 }
 
-// Print
-inline void vec3_t::Print() const
+// print
+inline void vec3_t::print() const
 {
 	for( int i=0; i<3; i++ )
 		cout << fixed << ME[i] << " ";

+ 1 - 1
src/math/vec4.h

@@ -52,7 +52,7 @@ class vec4_t
 		float  Length() const;
 		vec4_t GetNormalized() const;
 		void   Normalize();
-		void   Print() const;
+		void   print() const;
 		float  Dot( const vec4_t& b ) const;
 };
 

+ 5 - 5
src/math/vec4.inl.h

@@ -231,23 +231,23 @@ inline float vec4_t::Dot( const vec4_t& b ) const
 // Length
 inline float vec4_t::Length() const
 {
-	return Sqrt( x*x + y*y + z*z + w*w );
+	return sqrt( x*x + y*y + z*z + w*w );
 }
 
 // Normalized
 inline vec4_t vec4_t::GetNormalized() const
 {
-	return ME * InvSqrt( x*x +y*y + z*z + w*w );
+	return ME * invSqrt( x*x +y*y + z*z + w*w );
 }
 
 // Normalize
 inline void vec4_t::Normalize()
 {
-	ME *= InvSqrt( x*x +y*y + z*z + w*w );
+	ME *= invSqrt( x*x +y*y + z*z + w*w );
 }
 
-// Print
-inline void vec4_t::Print() const
+// print
+inline void vec4_t::print() const
 {
 	for( int i=0; i<4; i++ )
 		cout << fixed << ME[i] << " ";

+ 8 - 8
src/renderer/r_bs.cpp

@@ -4,13 +4,13 @@
  */
 
 #include "renderer.h"
-#include "camera.h"
-#include "scene.h"
+#include "Camera.h"
+#include "Scene.h"
 #include "Mesh.h"
 #include "r_private.h"
 #include "Resource.h"
 #include "fbo.h"
-#include "mesh_node.h"
+#include "MeshNode.h"
 #include "Material.h"
 
 
@@ -24,7 +24,7 @@ static fbo_t fbo; ///< blending models FBO
 
 
 //=====================================================================================================================================
-// Init                                                                                                                               =
+// init                                                                                                                               =
 //=====================================================================================================================================
 void Init()
 {
@@ -51,7 +51,7 @@ void Init()
 //=====================================================================================================================================
 // RunStage                                                                                                                           =
 //=====================================================================================================================================
-void RunStage( const camera_t& cam )
+void RunStage( const Camera& cam )
 {
 	// OGL stuff
 	r::SetProjectionViewMatrices( cam );
@@ -63,14 +63,14 @@ void RunStage( const camera_t& cam )
 
 
 	// render the meshes
-	for( uint i=0; i<scene::mesh_nodes.size(); i++ )
+	for( uint i=0; i<scene::meshNodes.size(); i++ )
 	{
-		mesh_node_t* mesh_node = scene::mesh_nodes[i];
+		MeshNode* mesh_node = scene::meshNodes[i];
 		if( mesh_node->material->blends && !mesh_node->material->blends )
 		{
 			fbo.Bind();
 			mesh_node->material->setup();
-			mesh_node->Render();
+			mesh_node->render();
 		}
 
 	}

+ 7 - 7
src/renderer/r_bs2.cpp

@@ -4,13 +4,13 @@
  */
 
 #include "renderer.h"
-#include "camera.h"
-#include "scene.h"
+#include "Camera.h"
+#include "Scene.h"
 #include "Mesh.h"
 #include "r_private.h"
 #include "Resource.h"
 #include "fbo.h"
-#include "mesh_node.h"
+#include "MeshNode.h"
 #include "Material.h"
 
 
@@ -77,7 +77,7 @@ void Init2()
 //=====================================================================================================================================
 // RunStage2                                                                                                                          =
 //=====================================================================================================================================
-void RunStage2( const camera_t& cam )
+void RunStage2( const Camera& cam )
 {
 	r::SetProjectionViewMatrices( cam );
 	r::SetViewport( 0, 0, r::w, r::h );
@@ -87,9 +87,9 @@ void RunStage2( const camera_t& cam )
 
 
 	// render the meshes
-	for( uint i=0; i<scene::mesh_nodes.size(); i++ )
+	for( uint i=0; i<scene::meshNodes.size(); i++ )
 	{
-		mesh_node_t* mesh_node = scene::mesh_nodes[i];
+		MeshNode* mesh_node = scene::meshNodes[i];
 		if( mesh_node->material->refracts )
 		{
 			// write to the rFbo
@@ -97,7 +97,7 @@ void RunStage2( const camera_t& cam )
 			glEnable( GL_DEPTH_TEST );
 			glClear( GL_COLOR_BUFFER_BIT );
 			mesh_node->material->setup();
-			mesh_node->Render();
+			mesh_node->render();
 
 			fbo.Bind();
 			glDisable( GL_DEPTH_TEST );

+ 15 - 15
src/renderer/r_dbg.cpp

@@ -1,11 +1,11 @@
 #include "renderer.h"
 #include "r_private.h"
 #include "fbo.h"
-#include "scene.h"
+#include "Scene.h"
 #include "Texture.h"
 #include "fbo.h"
-#include "node.h"
-#include "skel_node.h"
+#include "Node.h"
+#include "SkelNode.h"
 
 
 #include "btBulletCollisionCommon.h"
@@ -124,7 +124,7 @@ static ShaderProg* shdr;
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
 void Init()
@@ -157,7 +157,7 @@ void Init()
 RunStage                                                                                                                              =
 =======================================================================================================================================
 */
-void RunStage( const camera_t& cam )
+void RunStage( const Camera& cam )
 {
 	fbo.Bind();
 
@@ -175,17 +175,17 @@ void RunStage( const camera_t& cam )
 	{
 		if
 		(
-			(scene::nodes[i]->type == node_t::NT_LIGHT && show_lights) ||
-			(scene::nodes[i]->type == node_t::NT_CAMERA && show_cameras)
+			(scene::nodes[i]->type == Node::NT_LIGHT && show_lights) ||
+			(scene::nodes[i]->type == Node::NT_CAMERA && show_cameras)
 		)
 		{
-			scene::nodes[i]->Render();
+			scene::nodes[i]->render();
 		}
-		else if( scene::nodes[i]->type == node_t::NT_SKELETON && show_skeletons )
+		else if( scene::nodes[i]->type == Node::NT_SKELETON && show_skeletons )
 		{
-			skel_node_t* skel_node = static_cast<skel_node_t*>( scene::nodes[i] );
+			SkelNode* skel_node = static_cast<SkelNode*>( scene::nodes[i] );
 			glDisable( GL_DEPTH_TEST );
-			skel_node->Render();
+			skel_node->render();
 			glEnable( GL_DEPTH_TEST );
 		}
 	}
@@ -306,11 +306,11 @@ void RenderSphere( float r, int p )
 				theta3 = j * twopi / p;
 
 				float sintheta1, costheta1;
-				SinCos( theta1, sintheta1, costheta1 );
+				sinCos( theta1, sintheta1, costheta1 );
 				float sintheta2, costheta2;
-				SinCos( theta2, sintheta2, costheta2 );
+				sinCos( theta2, sintheta2, costheta2 );
 				float sintheta3, costheta3;
-				SinCos( theta3, sintheta3, costheta3 );
+				sinCos( theta3, sintheta3, costheta3 );
 
 
 				ex = costheta2 * costheta3;
@@ -422,7 +422,7 @@ static void RenderSun()
 
 
 	vec4_t p = vec4_t( scene::SunPos(), 1.0 );
-	p = main_cam->GetProjectionMatrix() * (main_cam->GetViewMatrix() * p);
+	p = main_cam->getProjectionMatrix() * (main_cam->getViewMatrix() * p);
 	p /= p.w;
 	p = p/2 + 0.5;
 

+ 48 - 48
src/renderer/r_is.cpp

@@ -3,12 +3,12 @@ The file contains functions and vars used for the deferred shading illumination
 */
 
 #include "renderer.h"
-#include "camera.h"
-#include "scene.h"
+#include "Camera.h"
+#include "Scene.h"
 #include "Mesh.h"
-#include "light.h"
+#include "Light.h"
 #include "Resource.h"
-#include "scene.h"
+#include "Scene.h"
 #include "r_private.h"
 #include "fbo.h"
 #include "LightProps.h"
@@ -58,10 +58,10 @@ static void InitSMOUVS()
 	glBindBuffer( GL_ARRAY_BUFFER, 0 );
 }
 
-static void DrawSMOUVS( const point_light_t& light )
+static void DrawSMOUVS( const PointLight& light )
 {
 	const float scale = 1.2;
-	r::MultMatrix( mat4_t( light.translation_wspace, mat3_t::GetIdentity(), light.radius*scale ) );
+	r::MultMatrix( mat4_t( light.translationWspace, mat3_t::GetIdentity(), light.radius*scale ) );
 
 	r::NoShaders();
 
@@ -80,7 +80,7 @@ static void DrawSMOUVS( const point_light_t& light )
 // CalcViewVector                                                                                                                     =
 //=====================================================================================================================================
 /// Calc the view vector that we will use inside the shader to calculate the frag pos in view space
-static void CalcViewVector( const camera_t& cam )
+static void CalcViewVector( const Camera& cam )
 {
 	int _w = r::w;
 	int _h = r::h;
@@ -90,9 +90,9 @@ static void CalcViewVector( const camera_t& cam )
 	for( int i=0; i<4; i++ )
 	{
 		/* Original Code:
-		r::UnProject( pixels[i][0], pixels[i][1], 10, cam.GetViewMatrix(), cam.GetProjectionMatrix(), viewport,
+		r::UnProject( pixels[i][0], pixels[i][1], 10, cam.getViewMatrix(), cam.getProjectionMatrix(), viewport,
 		              view_vectors[i].x, view_vectors[i].y, view_vectors[i].z );
-		view_vectors[i] = cam.GetViewMatrix() * view_vectors[i];
+		view_vectors[i] = cam.getViewMatrix() * view_vectors[i];
 		The original code is the above 3 lines. The optimized follows:*/
 
 		vec3_t vec;
@@ -100,7 +100,7 @@ static void CalcViewVector( const camera_t& cam )
 		vec.y = (2.0*(pixels[i][1]-viewport[1]))/viewport[3] - 1.0;
 		vec.z = 1.0;
 
-		view_vectors[i] = vec.GetTransformed( cam.GetInvProjectionMatrix() );
+		view_vectors[i] = vec.GetTransformed( cam.getInvProjectionMatrix() );
 		// end of optimized code
 	}
 }
@@ -110,10 +110,10 @@ static void CalcViewVector( const camera_t& cam )
 // CalcPlanes                                                                                                                         =
 //=====================================================================================================================================
 /// Calc the planes that we will use inside the shader to calculate the frag pos in view space
-static void CalcPlanes( const camera_t& cam )
+static void CalcPlanes( const Camera& cam )
 {
-	planes.x = -cam.GetZFar() / (cam.GetZFar() - cam.GetZNear());
-	planes.y = -cam.GetZFar() * cam.GetZNear() / (cam.GetZFar() - cam.GetZNear());
+	planes.x = -cam.getZFar() / (cam.getZFar() - cam.getZNear());
+	planes.y = -cam.getZFar() * cam.getZNear() / (cam.getZFar() - cam.getZNear());
 }
 
 
@@ -157,7 +157,7 @@ static void InitStageFBO()
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
 void Init()
@@ -182,7 +182,7 @@ void Init()
 AmbientPass                                                                                                                           =
 =======================================================================================================================================
 */
-static void AmbientPass( const camera_t& /*cam*/, const vec3_t& color )
+static void AmbientPass( const Camera& /*cam*/, const vec3_t& color )
 {
 	glDisable( GL_BLEND );
 
@@ -202,7 +202,7 @@ static void AmbientPass( const camera_t& /*cam*/, const vec3_t& color )
 // SetStencilMask [point light]                                                                                                       =
 //=====================================================================================================================================
 /// Clears the stencil buffer and draws a shape in the stencil buffer (in this case the shape is a UV shpere)
-static void SetStencilMask( const camera_t& cam, const point_light_t& light )
+static void SetStencilMask( const Camera& cam, const PointLight& light )
 {
 	glEnable( GL_STENCIL_TEST );
 	glClear( GL_STENCIL_BUFFER_BIT );
@@ -247,7 +247,7 @@ SetStencilMask [spot light]
 see above                                                                                                                             =
 =======================================================================================================================================
 */
-static void SetStencilMask( const camera_t& cam, const spot_light_t& light )
+static void SetStencilMask( const Camera& cam, const SpotLight& light )
 {
 	glEnable( GL_STENCIL_TEST );
 	glClear( GL_STENCIL_BUFFER_BIT );
@@ -268,10 +268,10 @@ static void SetStencilMask( const camera_t& cam, const spot_light_t& light )
 
 	// render camera's shape to stencil buffer
 	r::NoShaders();
-	const camera_t& lcam = light.camera;
-	float x = lcam.GetZFar() / tan( (PI-lcam.GetFovX())/2 );
-	float y = tan( lcam.GetFovY()/2 ) * lcam.GetZFar();
-	float z = -lcam.GetZFar();
+	const Camera& lcam = light.camera;
+	float x = lcam.getZFar() / tan( (PI-lcam.getFovX())/2 );
+	float y = tan( lcam.getFovY()/2 ) * lcam.getZFar();
+	float z = -lcam.getZFar();
 
 	const int tris_num = 6;
 
@@ -284,7 +284,7 @@ static void SetStencilMask( const camera_t& cam, const spot_light_t& light )
 		{ { x, -y, z }, {-x, -y, z }, {-x,  y, z } }, // front bottom left
 	};
 
-	r::MultMatrix( lcam.transformation_wspace );
+	r::MultMatrix( lcam.transformationWspace );
 	glEnableClientState( GL_VERTEX_ARRAY );
 	glVertexPointer( 3, GL_FLOAT, 0, verts );
 	glDrawArrays( GL_TRIANGLES, 0, tris_num*3 );
@@ -312,14 +312,14 @@ static void SetStencilMask( const camera_t& cam, const spot_light_t& light )
 PointLightPass                                                                                                                        =
 =======================================================================================================================================
 */
-static void PointLightPass( const camera_t& cam, const point_light_t& light )
+static void PointLightPass( const Camera& cam, const PointLight& light )
 {
 	//** make a check wether the point light passes the frustum test **
-	bsphere_t sphere( light.translation_wspace, light.radius );
-	if( !cam.InsideFrustum( sphere ) ) return;
+	bsphere_t sphere( light.translationWspace, light.radius );
+	if( !cam.insideFrustum( sphere ) ) return;
 
 	//** set the scissors **
-	//int n = SetScissors( cam.GetViewMatrix()*light.translation_wspace, light.radius );
+	//int n = SetScissors( cam.getViewMatrix()*light.translationWspace, light.radius );
 	//if( n < 1 ) return;
 
 	//** stencil optimization **
@@ -336,11 +336,11 @@ static void PointLightPass( const camera_t& cam, const point_light_t& light )
 	shader.locTexUnit( shader.GetUniLoc(3), r::ms::depth_fai, 3 );
 	glUniform2fv( shader.GetUniLoc(4), 1, &planes[0] );
 
-	vec3_t light_pos_eye_space = light.translation_wspace.GetTransformed( cam.GetViewMatrix() );
+	vec3_t light_pos_eye_space = light.translationWspace.GetTransformed( cam.getViewMatrix() );
 	glUniform3fv( shader.GetUniLoc(5), 1, &light_pos_eye_space[0] );
 	glUniform1f( shader.GetUniLoc(6), 1.0/light.radius );
-	glUniform3fv( shader.GetUniLoc(7), 1, &vec3_t(light.light_props->getDiffuseColor())[0] );
-	glUniform3fv( shader.GetUniLoc(8), 1, &vec3_t(light.light_props->getSpecularColor())[0] );
+	glUniform3fv( shader.GetUniLoc(7), 1, &vec3_t(light.lightProps->getDiffuseColor())[0] );
+	glUniform3fv( shader.GetUniLoc(8), 1, &vec3_t(light.lightProps->getSpecularColor())[0] );
 
 	//** render quad **
 	glEnableVertexAttribArray( shader.getAttribLoc(0) );
@@ -364,10 +364,10 @@ static void PointLightPass( const camera_t& cam, const point_light_t& light )
 SpotLightPass                                                                                                                         =
 =======================================================================================================================================
 */
-static void SpotLightPass( const camera_t& cam, const spot_light_t& light )
+static void SpotLightPass( const Camera& cam, const SpotLight& light )
 {
 	//** first of all check if the light's camera is inside the frustum **
-	if( !cam.InsideFrustum( light.camera ) ) return;
+	if( !cam.insideFrustum( light.camera ) ) return;
 
 	//** stencil optimization **
 	SetStencilMask( cam, light );
@@ -400,22 +400,22 @@ static void SpotLightPass( const camera_t& cam, const spot_light_t& light )
 	shdr->locTexUnit( shdr->GetUniLoc(2), r::ms::specular_fai, 2 );
 	shdr->locTexUnit( shdr->GetUniLoc(3), r::ms::depth_fai, 3 );
 
-	if( light.light_props->getTexture() == NULL )
-		ERROR( "No texture is attached to the light. light_props name: " << light.light_props->getName() );
+	if( light.lightProps->getTexture() == NULL )
+		ERROR( "No texture is attached to the light. light_props name: " << light.lightProps->getName() );
 
 	// the planes
 	//glUniform2fv( shdr->getUniLoc("planes"), 1, &planes[0] );
 	glUniform2fv( shdr->GetUniLoc(4), 1, &planes[0] );
 
 	// the light params
-	vec3_t light_pos_eye_space = light.translation_wspace.GetTransformed( cam.GetViewMatrix() );
+	vec3_t light_pos_eye_space = light.translationWspace.GetTransformed( cam.getViewMatrix() );
 	glUniform3fv( shdr->GetUniLoc(5), 1, &light_pos_eye_space[0] );
-	glUniform1f( shdr->GetUniLoc(6), 1.0/light.GetDistance() );
-	glUniform3fv( shdr->GetUniLoc(7), 1, &vec3_t(light.light_props->getDiffuseColor())[0] );
-	glUniform3fv( shdr->GetUniLoc(8), 1, &vec3_t(light.light_props->getSpecularColor())[0] );
+	glUniform1f( shdr->GetUniLoc(6), 1.0/light.getDistance() );
+	glUniform3fv( shdr->GetUniLoc(7), 1, &vec3_t(light.lightProps->getDiffuseColor())[0] );
+	glUniform3fv( shdr->GetUniLoc(8), 1, &vec3_t(light.lightProps->getSpecularColor())[0] );
 
 	// set the light texture
-	shdr->locTexUnit( shdr->GetUniLoc(9), *light.light_props->getTexture(), 4 );
+	shdr->locTexUnit( shdr->GetUniLoc(9), *light.lightProps->getTexture(), 4 );
 	// before we render disable anisotropic in the light.texture because it produces artefacts. ToDo: see if this is unececeary in future drivers
 	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
 	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
@@ -426,7 +426,7 @@ static void SpotLightPass( const camera_t& cam, const spot_light_t& light )
 	//const float mBias[] = {0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0};
 	static mat4_t bias_m4( 0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0 );
 	mat4_t tex_projection_mat;
-	tex_projection_mat = bias_m4 * light.camera.GetProjectionMatrix() * light.camera.GetViewMatrix() * cam.transformation_wspace;
+	tex_projection_mat = bias_m4 * light.camera.getProjectionMatrix() * light.camera.getViewMatrix() * cam.transformationWspace;
 	glUniformMatrix4fv( shdr->GetUniLoc(10), 1, true, &tex_projection_mat[0] );
 
 	/*
@@ -434,9 +434,9 @@ static void SpotLightPass( const camera_t& cam, const spot_light_t& light )
 	glActiveTexture( GL_TEXTURE0 );
 	glMatrixMode( GL_TEXTURE );
 	glloadMatrixf( mBias );
-	r::MultMatrix( light.camera.GetProjectionMatrix() );
-	r::MultMatrix( light.camera.GetViewMatrix() );
-	r::MultMatrix( cam.transformation_wspace );
+	r::MultMatrix( light.camera.getProjectionMatrix() );
+	r::MultMatrix( light.camera.getViewMatrix() );
+	r::MultMatrix( cam.transformationWspace );
 	glMatrixMode(GL_MODELVIEW);*/
 
 	// the shadow stuff
@@ -472,7 +472,7 @@ static void SpotLightPass( const camera_t& cam, const spot_light_t& light )
 RunStage                                                                                                                              =
 =======================================================================================================================================
 */
-void RunStage( const camera_t& cam )
+void RunStage( const Camera& cam )
 {
 	// FBO
 	fbo.Bind();
@@ -498,19 +498,19 @@ void RunStage( const camera_t& cam )
 	// for all lights
 	for( uint i=0; i<scene::lights.size(); i++ )
 	{
-		const light_t& light = *scene::lights[i];
+		const Light& light = *scene::lights[i];
 		switch( light.type )
 		{
-			case light_t::LT_POINT:
+			case Light::LT_POINT:
 			{
-				const point_light_t& pointl = static_cast<const point_light_t&>(light);
+				const PointLight& pointl = static_cast<const PointLight&>(light);
 				PointLightPass( cam, pointl );
 				break;
 			}
 
-			case light_t::LT_SPOT:
+			case Light::LT_SPOT:
 			{
-				const spot_light_t& projl = static_cast<const spot_light_t&>(light);
+				const SpotLight& projl = static_cast<const SpotLight&>(light);
 				SpotLightPass( cam, projl );
 				break;
 			}

+ 9 - 9
src/renderer/r_is_shadows.cpp

@@ -1,11 +1,11 @@
 #include "renderer.h"
 #include "Texture.h"
-#include "scene.h"
+#include "Scene.h"
 #include "Resource.h"
 #include "r_private.h"
 #include "fbo.h"
 #include "Material.h"
-#include "mesh_node.h"
+#include "MeshNode.h"
 
 namespace r {
 namespace is {
@@ -30,7 +30,7 @@ Texture shadow_map;
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
 void Init()
@@ -76,7 +76,7 @@ RunPass
 render scene only with depth and store the result in the shadow map                                                                   =
 =======================================================================================================================================
 */
-void RunPass( const camera_t& cam )
+void RunPass( const Camera& cam )
 {
 	// FBO
 	fbo.Bind();
@@ -102,17 +102,17 @@ void RunPass( const camera_t& cam )
 	glEnable( GL_POLYGON_OFFSET_FILL );
 
 	// render all meshes
-	for( uint i=0; i<scene::mesh_nodes.size(); i++ )
+	for( uint i=0; i<scene::meshNodes.size(); i++ )
 	{
-		mesh_node_t* mesh_node = scene::mesh_nodes[i];
+		MeshNode* mesh_node = scene::meshNodes[i];
 		if( mesh_node->material->blends || mesh_node->material->refracts ) continue;
 
 		DEBUG_ERR( mesh_node->material->dp_mtl == NULL );
 
-		//mesh_node->material->dp_mtl->setup();
-		//mesh_node->RenderDepth();
+		//meshNode->material->dp_mtl->setup();
+		//meshNode->renderDepth();
 		mesh_node->material->setup();
-		mesh_node->Render();
+		mesh_node->render();
 	}
 
 	glDisable( GL_POLYGON_OFFSET_FILL );

+ 10 - 10
src/renderer/r_ms.cpp

@@ -3,13 +3,13 @@
  */
 
 #include "renderer.h"
-#include "camera.h"
-#include "scene.h"
+#include "Camera.h"
+#include "Scene.h"
 #include "Mesh.h"
 #include "r_private.h"
 #include "fbo.h"
 #include "Material.h"
-#include "mesh_node.h"
+#include "MeshNode.h"
 
 
 namespace r {
@@ -28,7 +28,7 @@ Texture normal_fai, diffuse_fai, specular_fai, depth_fai;
 
 
 //=====================================================================================================================================
-// Init                                                                                                                               =
+// init                                                                                                                               =
 //=====================================================================================================================================
 void Init()
 {
@@ -70,7 +70,7 @@ void Init()
 	fbo.Unbind();
 
 #if defined( _EARLY_Z_ )
-	r::ms::earlyz::Init();
+	r::ms::earlyz::init();
 #endif
 }
 
@@ -78,7 +78,7 @@ void Init()
 //=====================================================================================================================================
 // RunStage                                                                                                                           =
 //=====================================================================================================================================
-void RunStage( const camera_t& cam )
+void RunStage( const Camera& cam )
 {
 	#if defined( _EARLY_Z_ )
 		// run the early z pass
@@ -94,7 +94,7 @@ void RunStage( const camera_t& cam )
 	r::SetViewport( 0, 0, r::w, r::h );
 
 	//glEnable( GL_DEPTH_TEST );
-	scene::skybox.Render( cam.GetViewMatrix().GetRotationPart() );
+	scene::skybox.Render( cam.getViewMatrix().GetRotationPart() );
 	//glDepthFunc( GL_LEQUAL );
 
 	#if defined( _EARLY_Z_ )
@@ -103,13 +103,13 @@ void RunStage( const camera_t& cam )
 	#endif
 
 	// render the meshes
-	for( uint i=0; i<scene::mesh_nodes.size(); i++ )
+	for( uint i=0; i<scene::meshNodes.size(); i++ )
 	{
-		mesh_node_t* mesh_node = scene::mesh_nodes[i];
+		MeshNode* mesh_node = scene::meshNodes[i];
 		DEBUG_ERR( mesh_node->material == NULL );
 		if( mesh_node->material->blends || mesh_node->material->refracts ) continue;
 		mesh_node->material->setup();
-		mesh_node->Render();
+		mesh_node->render();
 	}
 
 	glPolygonMode( GL_FRONT, GL_FILL ); // the rendering above fucks the polygon mode

+ 6 - 6
src/renderer/r_ms_earlyz.cpp

@@ -5,7 +5,7 @@ The file contains functions and vars used for the deferred shading/material stag
 #include "renderer.h"
 #include "Resource.h"
 #include "Texture.h"
-#include "scene.h"
+#include "Scene.h"
 #include "r_private.h"
 #include "fbo.h"
 
@@ -28,10 +28,10 @@ static ShaderProg* shdr_dp, * shdr_dp_grass; // passes for solid objects and gra
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
-void Init()
+void init()
 {
 	// create FBO
 	fbo.Create();
@@ -61,7 +61,7 @@ void Init()
 RunPass                                                                                                                               =
 =======================================================================================================================================
 */
-void RunPass( const camera_t& cam )
+void RunPass( const Camera& cam )
 {
 	/*// FBO
 	fbo.bind();
@@ -79,11 +79,11 @@ void RunPass( const camera_t& cam )
 
 	// render all meshes
 	for( uint i=0; i<scene::meshes.size(); i++ )
-		RenderDepth<Mesh>( *scene::meshes[i], shdr_dp, shdr_dp_grass );
+		renderDepth<Mesh>( *scene::meshes[i], shdr_dp, shdr_dp_grass );
 
 	// render all smodels
 	for( uint i=0; i<scene::models.size(); i++ )
-		RenderDepth<model_t>( *scene::models[i], shdr_dp, shdr_dp_grass );
+		renderDepth<model_t>( *scene::models[i], shdr_dp, shdr_dp_grass );
 
 	glColorMask( true, true, true, true );
 

+ 2 - 2
src/renderer/r_pps.cpp

@@ -36,7 +36,7 @@ namespace shdr_vars
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
 void Init()
@@ -96,7 +96,7 @@ void Init()
 RunStage                                                                                                                              =
 =======================================================================================================================================
 */
-void RunStage( const camera_t& cam )
+void RunStage( const Camera& cam )
 {
 	if( r::pps::ssao::enabled )
 		r::pps::ssao::RunPass( cam );

+ 3 - 3
src/renderer/r_pps_hdr.cpp

@@ -5,7 +5,7 @@ The file contains functions and vars used for the deferred shading/post-processi
 #include "renderer.h"
 #include "Resource.h"
 #include "Texture.h"
-#include "scene.h"
+#include "Scene.h"
 #include "r_private.h"
 #include "fbo.h"
 
@@ -67,7 +67,7 @@ static void InitFBOs( fbo_t& fbo, Texture& fai, int internal_format )
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
 void Init()
@@ -91,7 +91,7 @@ void Init()
 RunPass                                                                                                                               =
 =======================================================================================================================================
 */
-void RunPass( const camera_t& /*cam*/ )
+void RunPass( const Camera& /*cam*/ )
 {
 	r::SetViewport( 0, 0, wwidth, wheight );
 

+ 4 - 4
src/renderer/r_pps_lscatt.cpp

@@ -1,7 +1,7 @@
 #include "renderer.h"
 #include "Resource.h"
 #include "Texture.h"
-#include "scene.h"
+#include "Scene.h"
 #include "r_private.h"
 #include "fbo.h"
 
@@ -29,7 +29,7 @@ static int is_fai_uni_loc;
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
 void Init()
@@ -73,7 +73,7 @@ void Init()
 RunPass                                                                                                                               =
 =======================================================================================================================================
 */
-void RunPass( const camera_t& cam )
+void RunPass( const Camera& cam )
 {
 	fbo.Bind();
 
@@ -90,7 +90,7 @@ void RunPass( const camera_t& cam )
 
 	// pass the light
 	vec4_t p = vec4_t( scene::SunPos(), 1.0 );
-	p = cam.GetProjectionMatrix() * (cam.GetViewMatrix() * p);
+	p = cam.getProjectionMatrix() * (cam.getViewMatrix() * p);
 	p /= p.w;
 	p = p/2 + 0.5;
 	glUniform2fv( shdr->getUniLoc("light_pos_screen_space"), 1, &p[0] );

+ 5 - 5
src/renderer/r_pps_ssao.cpp

@@ -5,10 +5,10 @@ The file contains functions and vars used for the deferred shading/post-processi
 #include "renderer.h"
 #include "Resource.h"
 #include "Texture.h"
-#include "scene.h"
+#include "Scene.h"
 #include "r_private.h"
 #include "fbo.h"
-#include "camera.h"
+#include "Camera.h"
 
 namespace r {
 namespace pps {
@@ -65,7 +65,7 @@ static void InitBlurFBO()
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
 void Init()
@@ -124,7 +124,7 @@ void Init()
 RunPass                                                                                                                               =
 =======================================================================================================================================
 */
-void RunPass( const camera_t& cam )
+void RunPass( const Camera& cam )
 {
 	fbo.Bind();
 
@@ -135,7 +135,7 @@ void RunPass( const camera_t& cam )
 
 	// fill SSAO FAI
 	shdr_ppp_ssao->bind();
-	glUniform2fv( shdr_ppp_ssao->GetUniLoc(0), 1, &(vec2_t(cam.GetZNear(), cam.GetZFar()))[0] );
+	glUniform2fv( shdr_ppp_ssao->GetUniLoc(0), 1, &(vec2_t(cam.getZNear(), cam.getZFar()))[0] );
 	shdr_ppp_ssao->locTexUnit( shdr_ppp_ssao->GetUniLoc(1), ms::depth_fai, 0 );
 	shdr_ppp_ssao->locTexUnit( shdr_ppp_ssao->GetUniLoc(2), *noise_map, 1 );
 	shdr_ppp_ssao->locTexUnit( shdr_ppp_ssao->GetUniLoc(3), ms::normal_fai, 2 );

+ 15 - 15
src/renderer/r_private.h

@@ -5,7 +5,7 @@ The file contains some externs of funcs and vars that no one else needs to know
 #define _R_PRIVATE_H_
 
 class Texture;
-class camera_t;
+class Camera;
 
 namespace r {
 
@@ -22,7 +22,7 @@ extern float quad_vert_cords [][2];
 namespace ms
 {
 	extern void Init();
-	extern void RunStage( const camera_t& cam );
+	extern void RunStage( const Camera& cam );
 	extern Texture normal_fai, diffuse_fai, specular_fai, depth_fai;
 	const int fbo_attachable_imgs_num = 4;
 
@@ -30,8 +30,8 @@ namespace ms
 	/// EarlyZ depth pass namespace
 	namespace earlyz
 	{
-		extern void Init(); ///< Inits the the earlyz FBO with r::ms::depth_fai
-		extern void RunPass( const camera_t& cam ); ///< Renders the scene's depth in the r::ms:depth_fai
+		extern void init(); ///< Inits the the earlyz FBO with r::ms::depth_fai
+		extern void RunPass( const Camera& cam ); ///< Renders the scene's depth in the r::ms:depth_fai
 	}
 #endif
 }
@@ -40,13 +40,13 @@ namespace ms
 namespace is
 {
 	extern void Init();
-	extern void RunStage( const camera_t& cam );
+	extern void RunStage( const Camera& cam );
 
 	namespace shadows
 	{
 		extern Texture shadow_map;
 		extern int shadow_resolution;
-		extern void RunPass( const camera_t& cam );
+		extern void RunPass( const Camera& cam );
 		extern void Init();
 	}
 }
@@ -55,12 +55,12 @@ namespace is
 namespace pps
 {
 	extern void Init();
-	extern void RunStage( const camera_t& cam );
+	extern void RunStage( const Camera& cam );
 
 	namespace ssao
 	{
 		extern void Init();
-		extern void RunPass( const camera_t& cam );
+		extern void RunPass( const Camera& cam );
 		extern Texture fai;
 		extern Texture blured_fai;
 		extern float rendering_quality;
@@ -69,7 +69,7 @@ namespace pps
 	namespace hdr
 	{
 		extern void Init();
-		extern void RunPass( const camera_t& cam );
+		extern void RunPass( const Camera& cam );
 		extern Texture pass0_fai;
 		extern Texture pass1_fai;
 		extern Texture pass2_fai;
@@ -79,7 +79,7 @@ namespace pps
 	namespace lscatt
 	{
 		extern void Init();
-		extern void RunPass( const camera_t& cam );
+		extern void RunPass( const Camera& cam );
 		extern Texture fai;
 		extern float rendering_quality;
 	}
@@ -89,7 +89,7 @@ namespace pps
 namespace bs
 {
 	extern void Init();
-	extern void RunStage( const camera_t& cam );
+	extern void RunStage( const Camera& cam );
 	extern Texture fai_bs_scene;
 
 	extern Texture r_fai; // ToDo: remove it
@@ -99,17 +99,17 @@ namespace bs
 namespace dbg
 {
 	extern void Init();
-	extern void RunStage( const camera_t& cam );
+	extern void RunStage( const Camera& cam );
 }
 
 
 /*
 =======================================================================================================================================
-RenderDepth                                                                                                                           =
+renderDepth                                                                                                                           =
 =======================================================================================================================================
 */
 /**
-The template function calls t.RenderDepth and sets the state according to t's material. It being used by r::ms::earlyz::RunStage
+The template function calls t.renderDepth and sets the state according to t's material. It being used by r::ms::earlyz::RunStage
 and by r::is::shadow::RunStage. Used like macro
 @param a renderable object
 @param the shader to bind if the t's material IS NOT a grass like material
@@ -159,7 +159,7 @@ void RenderDepth( Type& t )
 
 
 //=====================================================================================================================================
-// Render                                                                                                                             =
+// render                                                                                                                             =
 //=====================================================================================================================================
 /// The template function renders an entity. Used by r::ms::RunStage and r::bs::RunStage. Used like macro
 template <typename Type, bool render_transparent> void Render( Type* t )

+ 11 - 11
src/renderer/renderer.cpp

@@ -3,9 +3,9 @@
 #include <jpeglib.h>
 #include "renderer.h"
 #include "Texture.h"
-#include "scene.h"
+#include "Scene.h"
 #include "r_private.h"
-#include "camera.h"
+#include "Camera.h"
 #include "app.h"
 
 namespace r {
@@ -103,7 +103,7 @@ static void BuildStdShaderPreProcStr()
 
 /*
 =======================================================================================================================================
-Init                                                                                                                                  =
+init                                                                                                                                  =
 =======================================================================================================================================
 */
 void Init()
@@ -183,10 +183,10 @@ void Init()
 
 /*
 =======================================================================================================================================
-Render                                                                                                                                =
+render                                                                                                                                =
 =======================================================================================================================================
 */
-void Render( const camera_t& cam )
+void Render( const Camera& cam )
 {
 	r::ms::RunStage( cam );
 	r::is::RunStage( cam );
@@ -232,10 +232,10 @@ void Render( const camera_t& cam )
 SetProjectionMatrix                                                                                                                   =
 =======================================================================================================================================
 */
-void SetProjectionMatrix( const camera_t& cam )
+void SetProjectionMatrix( const Camera& cam )
 {
 	glMatrixMode( GL_PROJECTION );
-	loadMatrix( cam.GetProjectionMatrix() );
+	loadMatrix( cam.getProjectionMatrix() );
 }
 
 
@@ -244,10 +244,10 @@ void SetProjectionMatrix( const camera_t& cam )
 SetViewMatrix                                                                                                                         =
 =======================================================================================================================================
 */
-void SetViewMatrix( const camera_t& cam )
+void SetViewMatrix( const Camera& cam )
 {
 	glMatrixMode( GL_MODELVIEW );
-	loadMatrix( cam.GetViewMatrix() );
+	loadMatrix( cam.getViewMatrix() );
 }
 
 
@@ -329,10 +329,10 @@ void PrepareNextFrame()
 
 /*
 =======================================================================================================================================
-PrintLastError                                                                                                                        =
+printLastError                                                                                                                        =
 =======================================================================================================================================
 */
-void PrintLastError()
+void printLastError()
 {
 	GLenum errid = glGetError();
 	if( errid != GL_NO_ERROR )

+ 9 - 9
src/renderer/renderer.h

@@ -7,11 +7,11 @@
 #include <GL/glu.h>
 #include "gmath.h"
 #include "ShaderProg.h"
-#include "camera.h"
+#include "Camera.h"
 
 
 
-class camera_t;
+class Camera;
 
 /// renderer namespace
 namespace r { // begin namespace
@@ -34,12 +34,12 @@ extern int  max_anisotropy; ///< Max texture anisotropy. Used in Texture::load
 
 // misc
 extern void TakeScreenshot( const char* filename ); ///< Save the colorbuffer as 24bit uncompressed TGA image
-extern void Init(); ///< Inits the renderer subsystem. Setting OpenGL and executes "r::*::Init" functions among other things
+extern void Init(); ///< Inits the renderer subsystem. Setting OpenGL and executes "r::*::init" functions among other things
 extern void PrepareNextFrame(); ///< Runs before rendering
 extern const uchar* GetLastError(); ///< GetLastError
-extern void PrintLastError(); ///< Prints last OpenGL error
+extern void printLastError(); ///< prints last OpenGL error
 inline const string& GetStdShaderPreprocDefines() { extern string std_shader_preproc_defines; return std_shader_preproc_defines; }
-extern void Render( const camera_t& cam ); ///< The spine function of the renderer
+extern void Render( const Camera& cam ); ///< The spine function of the renderer
 
 extern void SetGLState_Wireframe();
 extern void SetGLState_WireframeDotted();
@@ -60,9 +60,9 @@ extern bool   Unproject( float winX, float winY, float winZ, const mat4_t& model
 extern mat4_t Ortho( float left, float right, float bottom, float top, float near, float far );
 
 // Matrix stuff
-extern void SetProjectionMatrix( const camera_t& cam );
-extern void SetViewMatrix( const camera_t& cam );
-inline void SetProjectionViewMatrices( const camera_t& cam ) { SetProjectionMatrix(cam); SetViewMatrix(cam); }
+extern void SetProjectionMatrix( const Camera& cam );
+extern void SetViewMatrix( const Camera& cam );
+inline void SetProjectionViewMatrices( const Camera& cam ) { SetProjectionMatrix(cam); SetViewMatrix(cam); }
 inline void SetViewport( uint x, uint y, uint w, uint h ) { glViewport(x,y,w,h); }
 
 // externals that have global scope in other namespaces
@@ -94,7 +94,7 @@ namespace is
 namespace bs
 {
 	extern void Init2();
-	extern void RunStage2( const camera_t& cam );
+	extern void RunStage2( const Camera& cam );
 }
 
 /// pre-processing stage namespace

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 2 - 2
src/renderer2/r_is.cpp


+ 8 - 8
src/renderer2/r_ms.cpp

@@ -1,12 +1,12 @@
 /*
 #include "renderer.hpp"
-#include "scene.h"
+#include "Scene.h"
 
 
 //=====================================================================================================================================
-// Init                                                                                                                               =
+// init                                                                                                                               =
 //=====================================================================================================================================
-void renderer_t::material_stage_t::Init()
+void renderer_t::material_stage_t::init()
 {
 	// create FBO
 	fbo.Create();
@@ -50,22 +50,22 @@ void renderer_t::material_stage_t::Run() const
 	fbo.bind();
 
 	glClear( GL_DEPTH_BUFFER_BIT );
-	renderer.matrices.view = renderer.camera->GetViewMatrix();
-	renderer.matrices.projection = renderer.camera->GetProjectionMatrix();
+	renderer.matrices.view = renderer.camera->getViewMatrix();
+	renderer.matrices.projection = renderer.camera->getProjectionMatrix();
 	renderer.SetViewport( 0, 0, renderer.width, renderer.height );
 
 	//glEnable( GL_DEPTH_TEST );
-	scene::skybox.Render( renderer.camera->GetViewMatrix().GetRotationPart() );
+	scene::skybox.render( renderer.camera->getViewMatrix().GetRotationPart() );
 	//glDepthFunc( GL_LEQUAL );
 
 
 	// render the meshes
 	for( uint i=0; i<scene::meshes.size(); i++ )
-		Render<Mesh, false>( scene::meshes[i] );
+		render<Mesh, false>( scene::meshes[i] );
 
 	// render the smodels
 	for( uint i=0; i<scene::smodels.size(); i++ )
-		Render<smodel_t, false>( scene::smodels[i] );
+		render<smodel_t, false>( scene::smodels[i] );
 
 	glPolygonMode( GL_FRONT, GL_FILL ); // the rendering above fucks the polygon mode
 

+ 16 - 16
src/renderer2/renderer.hpp

@@ -6,8 +6,8 @@
 #include "fbo.h"
 #include "texture.h"
 
-class point_light_t;
-class spot_light_t;
+class PointLight;
+class SpotLight;
 
 
 struct renderer_t
@@ -34,7 +34,7 @@ struct renderer_t
 		} fais;
 
 		material_stage_t( renderer_t& r ): knowyourfather_t(r) {}
-		void Init();
+		void init();
 		void Run() const;
 	}; // end MS
 
@@ -48,7 +48,7 @@ struct renderer_t
 			ShaderProg shaderProg;
 
 			ambient_pass_t( renderer_t& r ): knowyourfather_t(r) {}
-			void Init();
+			void init();
 			void Run() const;
 		}; // end AP
 
@@ -59,8 +59,8 @@ struct renderer_t
 			static float smo_uvs_coords [];
 			static uint smo_uvs_vbo_id;
 			static void InitSMOUVS();
-			void DrawSMOUVS( const point_light_t& light );
-			void SetStencilMask( const point_light_t& light ) const;
+			void DrawSMOUVS( const PointLight& light );
+			void SetStencilMask( const PointLight& light ) const;
 
 			struct
 			{
@@ -68,14 +68,14 @@ struct renderer_t
 			} shader_progs;
 
 			point_light_pass_t( renderer_t& r ): knowyourfather_t(r) {}
-			void Init();
-			void Run( const point_light_t& light );
+			void init();
+			void Run( const PointLight& light );
 		}; // end point light pass
 
 		/// spot light pass
 		struct spot_light_pass_t: knowyourfather_t
 		{
-			void SetStencilMask( const spot_light_t& light ) const;
+			void SetStencilMask( const SpotLight& light ) const;
 
 			struct
 			{
@@ -83,8 +83,8 @@ struct renderer_t
 			} shader_progs;
 
 			spot_light_pass_t( renderer_t& r ): knowyourfather_t(r) {}
-			void Init() {}
-			void Run( const spot_light_t& light );
+			void init() {}
+			void Run( const SpotLight& light );
 
 		}; // end spot light pass
 
@@ -101,7 +101,7 @@ struct renderer_t
 		illumination_stage_t( renderer_t& r ): knowyourfather_t(r), ap(r), plp(r), slp(r) {}
 		void CalcViewVector();
 		void CalcPlanes();
-		void Init();
+		void init();
 		void Run() const;
 	}; // end IS
 
@@ -154,7 +154,7 @@ struct renderer_t
 				} fais;
 
 				hdr_pass_t( renderer_t& r ): knowyourfather_t(r) {}
-				void Init() {};
+				void init() {};
 				void Run() const {};
 			}; // end HDR
 
@@ -177,7 +177,7 @@ struct renderer_t
 				} fais;
 
 				ssao_pass_t( renderer_t& r ): knowyourfather_t(r) {}
-				void Init() {};
+				void init() {};
 				void Run() const {};
 			}; // end SSAO
 
@@ -207,7 +207,7 @@ struct renderer_t
 			edgeaa_t eaa;
 
 			postprocessing_stage_t( renderer_t& r ): knowyourfather_t(r), hdr(r), ssao(r), eaa(r) {}
-			void Init() {};
+			void init() {};
 			void Run() const {};
 	}; // end pps
 
@@ -251,7 +251,7 @@ struct renderer_t
 	static void SetViewport( uint x, uint y, uint w, uint h ) { glViewport(x,y,w,h); };
 	static void NoShaders() { ShaderProg::unbind(); }
 	static void DrawQuad();
-	void Init();
+	void init();
 	void Run( camera_t* cam );
 };
 

+ 1 - 1
src/resources/LightProps.h

@@ -17,7 +17,7 @@ class LightProps: public Resource
 	PROPERTY_R( vec3_t, specularCol, getSpecularColor )
 	PROPERTY_R( float, radius, getRadius ) ///< For point lights
 	PROPERTY_R( bool, castsShadow_, castsShadow ) ///< For spot lights
-	PROPERTY_R( float, distance, getDistance ) ///< For spot lights. A.K.A.: camera's zfar
+	PROPERTY_R( float, distance, getDistance ) ///< For spot lights. A.K.A.: camera's zFar
 	PROPERTY_R( float, fovX, getFovX ) ///< For spot lights
 	PROPERTY_R( float, fovY, getFovY ) ///< For spot lights
 		

+ 12 - 12
src/resources/Material.cpp

@@ -72,7 +72,7 @@ bool Material::load( const char* filename )
 		//** SHADER_PROG **
 		if( token->code == Scanner::TC_IDENTIFIER && !strcmp( token->value.string, "SHADER_PROG" ) )
 		{
-			if( shaderProg ) ERROR( "Shader program allready loaded" );
+			if( shaderProg ) ERROR( "Shader program already loaded" );
 
 			token = &scanner.getNextToken();
 			if( token->code != Scanner::TC_STRING )
@@ -222,7 +222,7 @@ bool Material::load( const char* filename )
 			do
 			{
 				// read var type
-				UserDefinedVar::type_e type;
+				UserDefinedVar::Type type;
 				token = &scanner.getNextToken();
 				if( token->code == Scanner::TC_RBRACKET )
 					break;
@@ -240,8 +240,8 @@ bool Material::load( const char* filename )
 					return false;
 				}
 
-				user_defined_vars.push_back( UserDefinedVar() ); // create new var
-				UserDefinedVar& var = user_defined_vars.back();
+				userDefinedVars.push_back( UserDefinedVar() ); // create new var
+				UserDefinedVar& var = userDefinedVars.back();
 				var.type = type;
 
 				// read the name
@@ -352,16 +352,16 @@ bool Material::additionalInit()
 
 	// for all user defined vars get their location
 	shaderProg->bind();
-	for( uint i=0; i<user_defined_vars.size(); i++ )
+	for( uint i=0; i<userDefinedVars.size(); i++ )
 	{
-		int loc = shaderProg->getUniLoc( user_defined_vars[i].name.c_str() );
+		int loc = shaderProg->getUniLoc( userDefinedVars[i].name.c_str() );
 		if( loc == -1 )
 		{
-			MTL_ERROR( "Shader \"" << shaderProg->getName() << "\" and user defined var \"" << user_defined_vars[i].name <<
+			MTL_ERROR( "Shader \"" << shaderProg->getName() << "\" and user defined var \"" << userDefinedVars[i].name <<
 			           "\" do not combine. Incorrect location" );
 			return false;
 		}
-		user_defined_vars[i].uniLoc = loc;
+		userDefinedVars[i].uniLoc = loc;
 	}
 	shaderProg->unbind();
 
@@ -395,10 +395,10 @@ void Material::unload()
 	rsrc::shaders.unload( shaderProg );
 
 	// loop all user defined vars and unload the textures
-	for( uint i=0; i<user_defined_vars.size(); i++ )
+	for( uint i=0; i<userDefinedVars.size(); i++ )
 	{
-		if( user_defined_vars[i].type == UserDefinedVar::VT_TEXTURE )
-			rsrc::textures.unload( user_defined_vars[i].value.texture );
+		if( userDefinedVars[i].type == UserDefinedVar::VT_TEXTURE )
+			rsrc::textures.unload( userDefinedVars[i].value.texture );
 	}
 
 	// the grass map
@@ -455,7 +455,7 @@ void Material::setup()
 	// now loop all the user defined vars and set them
 	uint texture_unit = 0;
 	Vec<UserDefinedVar>::iterator udv;
-	for( udv=user_defined_vars.begin(); udv!=user_defined_vars.end(); udv++ )
+	for( udv=userDefinedVars.begin(); udv!=userDefinedVars.end(); udv++ )
 	{
 		switch( udv->type )
 		{

+ 9 - 9
src/resources/Material.h

@@ -16,7 +16,7 @@ class Material: public Resource
 		class UserDefinedVar
 		{
 			public:
-				enum type_e
+				enum Type
 				{
 					VT_TEXTURE,
 					VT_FLOAT,
@@ -28,20 +28,20 @@ class Material: public Resource
 				struct Value       // unfortunately we cannot use union because of vec3_t and vec4_t
 				{
 					Texture* texture;
-					float      float_;
-					vec2_t     vec2;
-					vec3_t     vec3;
-					vec4_t     vec4;
+					float    float_;
+					vec2_t   vec2;
+					vec3_t   vec3;
+					vec4_t   vec4;
 					Value(): texture(NULL) {}
 				};
 
-				type_e type;
-				Value value;
-				int uniLoc;
+				Type   type;
+				Value  value;
+				int    uniLoc;
 				string name;
 		}; // end class UserDefinedVar
 
-		Vec<UserDefinedVar> user_defined_vars;
+		Vec<UserDefinedVar> userDefinedVars;
 
 
 	//===================================================================================================================================

+ 2 - 2
src/resources/ShaderParser.cpp

@@ -294,8 +294,8 @@ bool ShaderParser::parseFile( const char* filename )
 	
 	//PRINT( "vertShaderBegins.globalLine: " << vertShaderBegins.globalLine )
 	//PRINT( "fragShaderBegins.globalLine: " << fragShaderBegins.globalLine )
-	//PrintSourceLines();
-	//PrintShaderVars();
+	//printSourceLines();
+	//printShaderVars();
 
 	return true;
 }

+ 82 - 82
src/scene/camera.cpp → src/scene/Camera.cpp

@@ -1,39 +1,39 @@
-#include "camera.h"
+#include "Camera.h"
 #include "renderer.h"
 
 
 //=====================================================================================================================================
-// SetAll                                                                                                                             =
+// setAll                                                                                                                             =
 //=====================================================================================================================================
-void camera_t::SetAll( float fovx_, float fovy_, float znear_, float zfar_ )
+void Camera::setAll( float fovx_, float fovy_, float znear_, float zfar_ )
 {
-	fovx = fovx_;
-	fovy = fovy_;
-	znear = znear_;
-	zfar = zfar_;
-	CalcProjectionMatrix();
-	CalcLSpaceFrustumPlanes();
+	fovX = fovx_;
+	fovY = fovy_;
+	zNear = znear_;
+	zFar = zfar_;
+	calcProjectionMatrix();
+	calcLSpaceFrustumPlanes();
 }
 
 
 //=====================================================================================================================================
-// Render                                                                                                                             =
+// render                                                                                                                             =
 //=====================================================================================================================================
-void camera_t::Render()
+void Camera::render()
 {
 	glPushMatrix();
-	r::MultMatrix( transformation_wspace );
+	r::MultMatrix( transformationWspace );
 
-	const float cam_len = 1.0;
-	float tmp0 = cam_len / tan( (PI - fovx)*0.5 ) + 0.001;
-	float tmp1 = cam_len * tan(fovy*0.5) + 0.001;
+	const float camLen = 1.0;
+	float tmp0 = camLen / tan( (PI - fovX)*0.5 ) + 0.001;
+	float tmp1 = camLen * tan(fovY*0.5) + 0.001;
 
 	float points [][3] = {
 		{0.0, 0.0, 0.0}, // 0: eye point
-		{-tmp0, tmp1, -cam_len}, // 1: top left
-		{-tmp0, -tmp1, -cam_len}, // 2: bottom left
-		{tmp0, -tmp1, -cam_len}, // 3: bottom right
-		{tmp0, tmp1, -cam_len}, // 4: top right
+		{-tmp0, tmp1, -camLen}, // 1: top left
+		{-tmp0, -tmp1, -camLen}, // 2: bottom left
+		{tmp0, -tmp1, -camLen}, // 3: bottom right
+		{tmp0, tmp1, -camLen}, // 4: top right
 	};
 
 	//glLineWidth( 2.0 );
@@ -63,67 +63,67 @@ void camera_t::Render()
 
 //	if( !strcmp( camera_data_user_class_t::GetName(), "main_cam") ) return;
 //	//for( uint i=0; i<2; i++ )
-//		wspace_frustum_planes[TOP].Render();
+//		wspaceFrustumPlanes[TOP].render();
 }
 
 
 //=====================================================================================================================================
-// LookAtPoint                                                                                                                        =
+// lookAtPoint                                                                                                                        =
 //=====================================================================================================================================
-void camera_t::LookAtPoint( const vec3_t& point )
+void Camera::lookAtPoint( const vec3_t& point )
 {
 	const vec3_t& j = vec3_t( 0.0, 1.0, 0.0 );
-	vec3_t vdir = (point - translation_lspace).GetNormalized();
+	vec3_t vdir = (point - translationLspace).GetNormalized();
 	vec3_t vup = j - vdir * j.Dot(vdir);
 	vec3_t vside = vdir.Cross( vup );
-	rotation_lspace.SetColumns( vside, vup, -vdir );
+	rotationLspace.SetColumns( vside, vup, -vdir );
 }
 
 
 //=====================================================================================================================================
-// CalcLSpaceFrustumPlanes                                                                                                            =
+// calcLSpaceFrustumPlanes                                                                                                            =
 //=====================================================================================================================================
-void camera_t::CalcLSpaceFrustumPlanes()
+void Camera::calcLSpaceFrustumPlanes()
 {
 	float c, s; // cos & sine
 
-	SinCos( PI+fovx/2, s, c );
+	sinCos( PI+fovX/2, s, c );
 	// right
-	lspace_frustum_planes[FP_RIGHT] = plane_t( vec3_t(c, 0.0, s), 0.0 );
+	lspaceFrustumPlanes[FP_RIGHT] = plane_t( vec3_t(c, 0.0, s), 0.0 );
 	// left
-	lspace_frustum_planes[FP_LEFT] = plane_t( vec3_t(-c, 0.0, s), 0.0 );
+	lspaceFrustumPlanes[FP_LEFT] = plane_t( vec3_t(-c, 0.0, s), 0.0 );
 
-	SinCos( (3*PI-fovy)*0.5, s, c );
+	sinCos( (3*PI-fovY)*0.5, s, c );
 	// top
-	lspace_frustum_planes[FP_TOP] = plane_t( vec3_t(0.0, s, c), 0.0 );
+	lspaceFrustumPlanes[FP_TOP] = plane_t( vec3_t(0.0, s, c), 0.0 );
 	// bottom
-	lspace_frustum_planes[FP_BOTTOM] = plane_t( vec3_t(0.0, -s, c), 0.0 );
+	lspaceFrustumPlanes[FP_BOTTOM] = plane_t( vec3_t(0.0, -s, c), 0.0 );
 
 	// near
-	lspace_frustum_planes[FP_NEAR] = plane_t( vec3_t( 0.0, 0.0, -1.0 ), znear );
+	lspaceFrustumPlanes[FP_NEAR] = plane_t( vec3_t( 0.0, 0.0, -1.0 ), zNear );
 	// far
-	lspace_frustum_planes[FP_FAR] = plane_t( vec3_t( 0.0, 0.0, 1.0 ), -zfar );
+	lspaceFrustumPlanes[FP_FAR] = plane_t( vec3_t( 0.0, 0.0, 1.0 ), -zFar );
 }
 
 
 //=====================================================================================================================================
-// UpdateWSpaceFrustumPlanes                                                                                                          =
+// updateWSpaceFrustumPlanes                                                                                                          =
 //=====================================================================================================================================
-void camera_t::UpdateWSpaceFrustumPlanes()
+void Camera::updateWSpaceFrustumPlanes()
 {
 	for( uint i=0; i<6; i++ )
-		wspace_frustum_planes[i] = lspace_frustum_planes[i].Transformed( translation_wspace, rotation_wspace, scale_wspace );
+		wspaceFrustumPlanes[i] = lspaceFrustumPlanes[i].Transformed( translationWspace, rotationWspace, scaleWspace );
 }
 
 
 //=====================================================================================================================================
-// InsideFrustum                                                                                                                      =
+// insideFrustum                                                                                                                      =
 //=====================================================================================================================================
 /// Check if the volume is inside the frustum cliping planes
-bool camera_t::InsideFrustum( const bvolume_t& bvol ) const
+bool Camera::insideFrustum( const bvolume_t& bvol ) const
 {
 	for( uint i=0; i<6; i++ )
-		if( bvol.PlaneTest( wspace_frustum_planes[i] ) < 0.0 )
+		if( bvol.PlaneTest( wspaceFrustumPlanes[i] ) < 0.0 )
 			return false;
 
 	return true;
@@ -131,29 +131,29 @@ bool camera_t::InsideFrustum( const bvolume_t& bvol ) const
 
 
 //=====================================================================================================================================
-// InsideFrustum                                                                                                                      =
+// insideFrustum                                                                                                                      =
 //=====================================================================================================================================
 /// Check if the given camera is inside the frustum cliping planes. This is used mainly to test if the projected lights are visible
-bool camera_t::InsideFrustum( const camera_t& cam ) const
+bool Camera::insideFrustum( const Camera& cam ) const
 {
 	//** get five points. These points are the tips of the given camera **
 	vec3_t points[5];
 
 	// get 3 sample floats
-	float x = cam.GetZFar() / tan( (PI-cam.GetFovX())/2 );
-	float y = tan( cam.GetFovY()/2 ) * cam.GetZFar();
-	float z = -cam.GetZFar();
+	float x = cam.getZFar() / tan( (PI-cam.getFovX())/2 );
+	float y = tan( cam.getFovY()/2 ) * cam.getZFar();
+	float z = -cam.getZFar();
 
 	// the actual points in local space
 	points[0] = vec3_t( x, y, z ); // top right
 	points[1] = vec3_t( -x, y, z ); // top left
 	points[2] = vec3_t( -x, -y, z ); // bottom left
 	points[3] = vec3_t( x, -y, z ); // bottom right
-	points[4] = vec3_t( cam.translation_wspace ); // eye (allready in world space)
+	points[4] = vec3_t( cam.translationWspace ); // eye (allready in world space)
 
 	// transform them to the given camera's world space (exept the eye)
 	for( uint i=0; i<4; i++ )
-		points[i].Transform( cam.translation_wspace, cam.rotation_wspace, cam.scale_wspace );
+		points[i].Transform( cam.translationWspace, cam.rotationWspace, cam.scaleWspace );
 
 
 	//** the collision code **
@@ -163,7 +163,7 @@ bool camera_t::InsideFrustum( const camera_t& cam ) const
 
 		for( uint j=0; j<5; j++ ) // for the 5 points
 		{
-			if( wspace_frustum_planes[i].Test( points[j] ) < 0.0 )
+			if( wspaceFrustumPlanes[i].Test( points[j] ) < 0.0 )
 				++failed;
 		}
 		if( failed == 5 ) return false; // if all points are behind the plane then the cam is not in frustum
@@ -174,60 +174,60 @@ bool camera_t::InsideFrustum( const camera_t& cam ) const
 
 
 //=====================================================================================================================================
-// CalcProjectionMatrix                                                                                                               =
+// calcProjectionMatrix                                                                                                               =
 //=====================================================================================================================================
-void camera_t::CalcProjectionMatrix()
+void Camera::calcProjectionMatrix()
 {
-	float f = 1.0/tan( fovy*0.5f ); // f = cot(fovy/2)
-
-	projection_mat(0,0) = f*fovy/fovx; // = f/aspect_ratio;
-	projection_mat(0,1) = 0.0;
-	projection_mat(0,2) = 0.0;
-	projection_mat(0,3) = 0.0;
-	projection_mat(1,0) = 0.0;
-	projection_mat(1,1) = f;
-	projection_mat(1,2) = 0.0;
-	projection_mat(1,3) = 0.0;
-	projection_mat(2,0) = 0.0;
-	projection_mat(2,1) = 0.0;
-	projection_mat(2,2) = (zfar+znear) / (znear-zfar);
-	projection_mat(2,3) = (2.0f*zfar*znear) / (znear-zfar);
-	projection_mat(3,0) = 0.0;
-	projection_mat(3,1) = 0.0;
-	projection_mat(3,2) = -1.0;
-	projection_mat(3,3) = 0.0;
-
-	inv_projection_mat = projection_mat.GetInverse();
+	float f = 1.0/tan( fovY*0.5f ); // f = cot(fovY/2)
+
+	projectionMat(0,0) = f*fovY/fovX; // = f/aspect_ratio;
+	projectionMat(0,1) = 0.0;
+	projectionMat(0,2) = 0.0;
+	projectionMat(0,3) = 0.0;
+	projectionMat(1,0) = 0.0;
+	projectionMat(1,1) = f;
+	projectionMat(1,2) = 0.0;
+	projectionMat(1,3) = 0.0;
+	projectionMat(2,0) = 0.0;
+	projectionMat(2,1) = 0.0;
+	projectionMat(2,2) = (zFar+zNear) / (zNear-zFar);
+	projectionMat(2,3) = (2.0f*zFar*zNear) / (zNear-zFar);
+	projectionMat(3,0) = 0.0;
+	projectionMat(3,1) = 0.0;
+	projectionMat(3,2) = -1.0;
+	projectionMat(3,3) = 0.0;
+
+	invProjectionMat = projectionMat.GetInverse();
 }
 
 
 //=====================================================================================================================================
-// UpdateViewMatrix                                                                                                                   =
+// updateViewMatrix                                                                                                                   =
 //=====================================================================================================================================
-void camera_t::UpdateViewMatrix()
+void Camera::updateViewMatrix()
 {
 	/* The point at which the camera looks:
-	vec3_t viewpoint = translation_lspace + z_axis;
+	vec3_t viewpoint = translationLspace + z_axis;
 	as we know the up vector, we can easily use gluLookAt:
-	gluLookAt( translation_lspace.x, translation_lspace.x, translation_lspace.z, z_axis.x, z_axis.y, z_axis.z, y_axis.x, y_axis.y, y_axis.z );
+	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:
-	mat3_t cam_inverted_rot = rotation_wspace.GetTransposed();
-	vec3_t cam_inverted_tsl = -( cam_inverted_rot * translation_wspace );
-	view_mat = mat4_t( cam_inverted_tsl, cam_inverted_rot );
+	mat3_t cam_inverted_rot = rotationWspace.GetTransposed();
+	vec3_t cam_inverted_tsl = -( cam_inverted_rot * translationWspace );
+	viewMat = mat4_t( cam_inverted_tsl, cam_inverted_rot );
 }
 
 
 //=====================================================================================================================================
-// UpdateWorldStuff                                                                                                                   =
+// updateWorldStuff                                                                                                                   =
 //=====================================================================================================================================
-void camera_t::UpdateWorldStuff()
+void Camera::updateWorldStuff()
 {
-	UpdateWorldTransform();
-	UpdateViewMatrix();
-	UpdateWSpaceFrustumPlanes();
+	updateWorldTransform();
+	updateViewMatrix();
+	updateWSpaceFrustumPlanes();
 }
 
 

+ 88 - 0
src/scene/Camera.h

@@ -0,0 +1,88 @@
+#ifndef _CAMERA_H_
+#define _CAMERA_H_
+
+#include "common.h"
+#include "collision.h"
+#include "Node.h"
+
+
+class Camera: public Node
+{
+	public:
+		enum FrustrumPlanes
+		{
+			FP_LEFT = 0,
+			FP_RIGHT,
+			FP_NEAR,
+			FP_TOP,
+			FP_BOTTOM,
+			FP_FAR
+		};
+
+		// 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 aspect_ratio = fovX/fovY
+		// fovX and fovY in rad
+		float fovX, fovY;
+		float zNear, zFar;
+
+		// the frustum planes in local and world space
+		plane_t lspaceFrustumPlanes[6];
+		plane_t wspaceFrustumPlanes[6];
+
+		// matrices
+		mat4_t projectionMat;
+		mat4_t viewMat;
+		/**
+		 * Used in deferred shading for the calculation of view vector (see CalcViewVector). The reason we store this matrix here is
+		 * that we dont want it to be re-calculated all the time but only when the projection params (fovX, fovY, zNear, zFar) change.
+		 * Fortunately the projection params change rarely. Note that the Camera as we all know re-calculates the matreces only when the
+		 * parameteres change!!
+		 */
+		mat4_t invProjectionMat;
+
+		// misc
+		void calcProjectionMatrix();
+		void updateViewMatrix();
+		void calcLSpaceFrustumPlanes();
+		void updateWSpaceFrustumPlanes();
+
+	public:
+		// constructors and destuctors
+		Camera( float fovx_, float fovy_, float znear_, float zfar_ ): Node(NT_CAMERA), fovX(fovx_), fovY(fovy_), zNear(znear_), zFar(zfar_)
+		{
+			calcLSpaceFrustumPlanes();
+			updateWSpaceFrustumPlanes();
+			calcProjectionMatrix();
+		}
+		Camera( const Camera& c ): Node(NT_CAMERA) { memcpy( this, &c, sizeof( Camera ) ); }
+		Camera(): Node(NT_CAMERA) {}
+		~Camera() {}
+
+		// Sets & Gets
+		void setFovX ( float fovx_ )  { fovX=fovx_; calcProjectionMatrix(); calcLSpaceFrustumPlanes(); }
+		void setFovY ( float fovy_ )  { fovY=fovy_; calcProjectionMatrix(); calcLSpaceFrustumPlanes(); }
+		void setZNear( float znear_ ) { zNear=znear_; calcProjectionMatrix(); calcLSpaceFrustumPlanes(); }
+		void setZFar ( float zfar_ )  { zFar=zfar_; calcProjectionMatrix(); calcLSpaceFrustumPlanes(); }
+		void setAll( float fovx_, float fovy_, float znear_, float zfar_ );
+		float getFovX () const { return fovX; }
+		float getFovY () const { return fovY; }
+		float getZNear() const { return zNear; }
+		float getZFar () const { return zFar; }
+		const mat4_t& getProjectionMatrix() const { return projectionMat; }
+		const mat4_t& getViewMatrix() const { return viewMat; }
+		const mat4_t& getInvProjectionMatrix() const { return invProjectionMat; } // see the declaration of invProjectionMat for info
+
+		// misc
+		void lookAtPoint( const vec3_t& point );
+		void updateWorldStuff();
+		void render();
+		void init( const char* ) {}
+		void deinit() {}
+
+		// frustum stuff
+		bool insideFrustum( const bvolume_t& vol ) const;
+		bool insideFrustum( const Camera& cam ) const; // check if another camera is inside our view (used for projected lights)
+};
+
+
+#endif

+ 21 - 21
src/scene/light.cpp → src/scene/Light.cpp

@@ -1,41 +1,41 @@
-#include "light.h"
+#include "Light.h"
 #include "collision.h"
 #include "renderer.h"
 #include "LightProps.h"
 
 
 //=====================================================================================================================================
-// Init [point_light_t]                                                                                                               =
+// init [PointLight]                                                                                                               =
 //=====================================================================================================================================
-void point_light_t::Init( const char* filename )
+void PointLight::init( const char* filename )
 {
-	light_props = rsrc::light_props.load( filename );
-	radius = light_props->getRadius();
+	lightProps = rsrc::light_props.load( filename );
+	radius = lightProps->getRadius();
 }
 
 
 //=====================================================================================================================================
-// Init [spot_light_t]                                                                                                                =
+// init [SpotLight]                                                                                                                =
 //=====================================================================================================================================
-void spot_light_t::Init( const char* filename )
+void SpotLight::init( const char* filename )
 {
-	light_props = rsrc::light_props.load( filename );
-	camera.SetAll( light_props->getFovX(), light_props->getFovY(), 0.2, light_props->getDistance() );
-	castsShadow = light_props->castsShadow();
-	if( light_props->getTexture() == NULL )
+	lightProps = rsrc::light_props.load( filename );
+	camera.setAll( lightProps->getFovX(), lightProps->getFovY(), 0.2, lightProps->getDistance() );
+	castsShadow = lightProps->castsShadow();
+	if( lightProps->getTexture() == NULL )
 	{
-		ERROR( "Light properties \"" << light_props->getName() << "\" do not have a texture" );
+		ERROR( "Light properties \"" << lightProps->getName() << "\" do not have a texture" );
 		return;
 	}
 }
 
 
 //=====================================================================================================================================
-// Deinit                                                                                                                             =
+// deinit                                                                                                                             =
 //=====================================================================================================================================
-void light_t::Deinit()
+void Light::deinit()
 {
-	rsrc::light_props.unload( light_props );
+	rsrc::light_props.unload( lightProps );
 }
 
 
@@ -55,18 +55,18 @@ static void RenderSphere( const mat4_t& tsl, const vec3_t& col )
 
 
 //=====================================================================================================================================
-// Render                                                                                                                             =
+// render                                                                                                                             =
 //=====================================================================================================================================
-void point_light_t::Render()
+void PointLight::render()
 {
-	RenderSphere( transformation_wspace, light_props->getDiffuseColor() );
+	RenderSphere( transformationWspace, lightProps->getDiffuseColor() );
 }
 
 
 //=====================================================================================================================================
-// Render                                                                                                                             =
+// render                                                                                                                             =
 //=====================================================================================================================================
-void spot_light_t::Render()
+void SpotLight::render()
 {
-	RenderSphere( transformation_wspace, light_props->getDiffuseColor() );
+	RenderSphere( transformationWspace, lightProps->getDiffuseColor() );
 }

+ 70 - 0
src/scene/Light.h

@@ -0,0 +1,70 @@
+/*
+LIGHTING MODEL
+
+Final intensity:                If = Ia + Id + Is
+Ambient intensity:              Ia = Al * Am
+Ambient intensity of light:     Al
+Ambient intensity of material:  Am
+Defuse intensity:               Id = Dl * Dm * LambertTerm
+Defuse intensity of light:      Dl
+Defuse intensity of material:   Dm
+LambertTerm:                    max( Normal dot Light, 0.0 )
+Specular intensity:             Is = Sm x Sl x pow( max(R dot E, 0.0), f )
+Specular intensity of light:    Sl
+Specular intensity of material: Sm
+*/
+
+#ifndef _LIGHT_H_
+#define _LIGHT_H_
+
+#include "common.h"
+#include "Texture.h"
+#include "Node.h"
+#include "Camera.h"
+
+class LightProps;
+
+
+/// Light (A)
+class Light: public Node
+{
+	public:
+		enum Type { LT_POINT, LT_SPOT };
+
+		Type type;
+		LightProps* lightProps; ///< Later we will add a controller
+	
+		Light( Type type_ ): Node(NT_LIGHT), type(type_) {}
+		//void init( const char* );
+		void deinit();
+};
+
+
+/// PointLight
+class PointLight: public Light
+{
+	public:
+		float radius;
+
+		PointLight(): Light(LT_POINT) {}
+		void init( const char* );
+		void render();
+};
+
+
+/// SpotLight
+class SpotLight: public Light
+{
+	public:
+		Camera camera;
+		bool castsShadow;
+
+		SpotLight(): Light(LT_SPOT), castsShadow(false) { addChild( &camera ); }
+		float getDistance() const { return camera.getZFar(); }
+		void  setDistance( float d ) { camera.setZFar(d); }
+		void  init( const char* );
+		void  render();
+};
+
+
+#endif

+ 18 - 18
src/scene/mesh_node.cpp → src/scene/MeshNode.cpp

@@ -1,18 +1,18 @@
-#include "mesh_node.h"
+#include "MeshNode.h"
 #include "Resource.h"
 #include "Mesh.h"
 #include "renderer.h"
 #include "Material.h"
-#include "skel_node.h"
+#include "SkelNode.h"
 #include "Skeleton.h"
-#include "mesh_skel_ctrl.h"
-#include "skel_anim_ctrl.h"
+#include "MeshSkelNodeCtrl.h"
+#include "SkelAnimCtrl.h"
 
 
 //=====================================================================================================================================
-// Init                                                                                                                               =
+// init                                                                                                                               =
 //=====================================================================================================================================
-void mesh_node_t::Init( const char* filename )
+void MeshNode::init( const char* filename )
 {
 	mesh = rsrc::meshes.load( filename );
 	material = rsrc::materials.load( mesh->materialName.c_str() );
@@ -26,9 +26,9 @@ void mesh_node_t::Init( const char* filename )
 
 
 //=====================================================================================================================================
-// Deinit                                                                                                                             =
+// deinit                                                                                                                             =
 //=====================================================================================================================================
-void mesh_node_t::Deinit()
+void MeshNode::deinit()
 {
 	rsrc::meshes.unload( mesh );
 	rsrc::materials.unload( material );
@@ -36,25 +36,25 @@ void mesh_node_t::Deinit()
 
 
 //=====================================================================================================================================
-// Render                                                                                                                             =
+// render                                                                                                                             =
 //=====================================================================================================================================
 /// Called in material or blending stages
-void mesh_node_t::Render( Material* mtl ) const
+void MeshNode::render( Material* mtl ) const
 {
 	glPushMatrix();
-	r::MultMatrix( transformation_wspace );
+	r::MultMatrix( transformationWspace );
 
 	// if we have skeleton controller
-	if( mesh_skel_ctrl )
+	if( meshSkelCtrl )
 	{
 		// first the uniforms
-		glUniformMatrix3fv( mtl->uniLocs.skinningRotations, mesh_skel_ctrl->skel_node->skeleton->bones.size(), 1,
-		                    &(mesh_skel_ctrl->skel_node->skel_anim_ctrl->bone_rotations[0])[0] );
-		glUniform3fv( mtl->uniLocs.skinningTranslations, mesh_skel_ctrl->skel_node->skeleton->bones.size(),
-		              &(mesh_skel_ctrl->skel_node->skel_anim_ctrl->Boneranslations[0])[0] );
+		glUniformMatrix3fv( mtl->uniLocs.skinningRotations, meshSkelCtrl->skelNode->skeleton->bones.size(), 1,
+		                    &(meshSkelCtrl->skelNode->skelAnimCtrl->boneRotations[0])[0] );
+		glUniform3fv( mtl->uniLocs.skinningTranslations, meshSkelCtrl->skelNode->skeleton->bones.size(),
+		              &(meshSkelCtrl->skelNode->skelAnimCtrl->boneTranslations[0])[0] );
 
 		// then the attributes
-		DEBUG_ERR( !mtl->hasHWSkinning() );
+		DEBUG_ERR( !mtl->hasHWSkinning() ); // it has skel controller but no skinning
 
 		mesh->vbos.vertWeights.Bind();
 		glEnableVertexAttribArray( mtl->attribLocs.vertWeightBonesNum );
@@ -103,7 +103,7 @@ void mesh_node_t::Render( Material* mtl ) const
 	if( mtl->attribLocs.texCoords != -1 ) glDisableVertexAttribArray( mtl->attribLocs.texCoords );
 	if( mtl->attribLocs.tanget != -1 ) glDisableVertexAttribArray( mtl->attribLocs.tanget );
 
-	if( mesh_skel_ctrl )
+	if( meshSkelCtrl )
 	{
 		glDisableVertexAttribArray( mtl->attribLocs.vertWeightBonesNum );
 		glDisableVertexAttribArray( mtl->attribLocs.vertWeightBoneIds );

+ 34 - 0
src/scene/MeshNode.h

@@ -0,0 +1,34 @@
+#ifndef _MESH_NODE_H_
+#define _MESH_NODE_H_
+
+#include "common.h"
+#include "Node.h"
+#include "Material.h"
+
+class MeshSkelNodeCtrl;
+class Mesh;
+
+
+/// Mesh node
+class MeshNode: public Node
+{
+	private:
+		void render( Material* mtl ) const; ///< Common code for render() and renderDepth()
+
+	public:
+		// resources
+		Mesh* mesh;
+		Material* material;
+		Material* dpMaterial; ///< Depth pass material
+		// controllers
+		MeshSkelNodeCtrl* meshSkelCtrl;
+		// funcs
+		MeshNode(): Node(NT_MESH), meshSkelCtrl(NULL) {}
+		virtual void render() { render(material); }
+		virtual void renderDepth() { render( material->dp_mtl ); }
+		void init( const char* filename );
+		void deinit();
+};
+
+
+#endif

+ 53 - 53
src/scene/node.cpp → src/scene/Node.cpp

@@ -1,93 +1,93 @@
 #include <algorithm>
-#include "node.h"
+#include "Node.h"
 #include "renderer.h"
 #include "collision.h"
-#include "controller.h"
+#include "Controller.h"
 
 
 namespace scene
 {
-	extern void RegisterNode( node_t* );
+	extern void registerNode( Node* );
 }
 
 
 //=====================================================================================================================================
-// CommonConstructorCode                                                                                                              =
+// commonConstructorCode                                                                                                              =
 //=====================================================================================================================================
-void node_t::CommonConstructorCode()
+void Node::commonConstructorCode()
 {
 	parent = NULL;
-	is_group_node = false;
-	translation_lspace = vec3_t( 0.0 );
-	scale_lspace = 1.0;
-	rotation_lspace = mat3_t::GetIdentity();
-	translation_wspace = vec3_t( 0.0 );
-	scale_wspace = 1.0;
-	rotation_wspace = mat3_t::GetIdentity();
-	bvolume_lspace = NULL;
-
-	scene::RegisterNode( this );
+	isGroupNode = false;
+	translationLspace = vec3_t( 0.0 );
+	scaleLspace = 1.0;
+	rotationLspace = mat3_t::GetIdentity();
+	translationWspace = vec3_t( 0.0 );
+	scaleWspace = 1.0;
+	rotationWspace = mat3_t::GetIdentity();
+	bvolumeLspace = NULL;
+
+	scene::registerNode( this );
 }
 
 
 //=====================================================================================================================================
-// ~node_t                                                                                                                            =
+// ~Node                                                                                                                            =
 //=====================================================================================================================================
-node_t::~node_t()
+Node::~Node()
 {
 }
 
 
 //=====================================================================================================================================
-// UpdateWorldTransform                                                                                                               =
+// updateWorldTransform                                                                                                               =
 //=====================================================================================================================================
-void node_t::UpdateWorldTransform()
+void Node::updateWorldTransform()
 {
 	if( parent )
 	{
 		/* the original code:
-		scale_wspace = parent->scale_wspace * scale_lspace;
-		rotation_wspace = parent->rotation_wspace * rotation_lspace;
-		translation_wspace = translation_lspace.Transformed( parent->translation_wspace, parent->rotation_wspace, parent->scale_wspace ); */
-		CombineTransformations( parent->translation_wspace, parent->rotation_wspace, parent->scale_wspace,
-		                        translation_lspace, rotation_lspace, scale_lspace,
-		                        translation_wspace, rotation_wspace, scale_wspace );
+		scaleWspace = parent->scaleWspace * scaleLspace;
+		rotationWspace = parent->rotationWspace * rotationLspace;
+		translationWspace = translationLspace.Transformed( parent->translationWspace, parent->rotationWspace, parent->scaleWspace ); */
+		CombineTransformations( parent->translationWspace, parent->rotationWspace, parent->scaleWspace,
+		                        translationLspace, rotationLspace, scaleLspace,
+		                        translationWspace, rotationWspace, scaleWspace );
 	}
 	else // else copy
 	{
-		scale_wspace = scale_lspace;
-		rotation_wspace = rotation_lspace;
-		translation_wspace = translation_lspace;
+		scaleWspace = scaleLspace;
+		rotationWspace = rotationLspace;
+		translationWspace = translationLspace;
 	}
 
-	transformation_wspace = mat4_t( translation_wspace, rotation_wspace, scale_wspace );
+	transformationWspace = mat4_t( translationWspace, rotationWspace, scaleWspace );
 
 
 	// transform the bvolume
-	/*if( bvolume_lspace != NULL )
+	/*if( bvolumeLspace != NULL )
 	{
-		DEBUG_ERR( bvolume_lspace->type!=bvolume_t::BSPHERE && bvolume_lspace->type!=bvolume_t::AABB && bvolume_lspace->type!=bvolume_t::OBB );
+		DEBUG_ERR( bvolumeLspace->type!=bvolume_t::BSPHERE && bvolumeLspace->type!=bvolume_t::AABB && bvolumeLspace->type!=bvolume_t::OBB );
 
-		switch( bvolume_lspace->type )
+		switch( bvolumeLspace->type )
 		{
 			case bvolume_t::BSPHERE:
 			{
-				bsphere_t sphere = static_cast<bsphere_t*>(bvolume_lspace)->Transformed( translation_wspace, rotation_wspace, scale_wspace );
-				*static_cast<bsphere_t*>(bvolume_wspace) = sphere;
+				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*>(bvolume_lspace)->Transformed( translation_wspace, rotation_wspace, scale_wspace );
-				*static_cast<aabb_t*>(bvolume_wspace) = 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*>(bvolume_lspace)->Transformed( translation_wspace, rotation_wspace, scale_wspace );
-				*static_cast<obb_t*>(bvolume_wspace) = obb;
+				obb_t obb = static_cast<obb_t*>(bvolumeLspace)->Transformed( translationWspace, rotationWspace, scaleWspace );
+				*static_cast<obb_t*>(bvolumeLspace) = obb;
 				break;
 			}
 
@@ -102,33 +102,33 @@ void node_t::UpdateWorldTransform()
 // Move(s)                                                                                                                            =
 // Move the object according to it's local axis                                                                                       =
 //=====================================================================================================================================
-void node_t::MoveLocalX( float distance )
+void Node::moveLocalX( float distance )
 {
-	vec3_t x_axis = rotation_lspace.GetColumn(0);
-	translation_lspace += x_axis * distance;
+	vec3_t x_axis = rotationLspace.GetColumn(0);
+	translationLspace += x_axis * distance;
 }
 
-void node_t::MoveLocalY( float distance )
+void Node::moveLocalY( float distance )
 {
-	vec3_t y_axis = rotation_lspace.GetColumn(1);
-	translation_lspace += y_axis * distance;
+	vec3_t y_axis = rotationLspace.GetColumn(1);
+	translationLspace += y_axis * distance;
 }
 
-void node_t::MoveLocalZ( float distance )
+void Node::moveLocalZ( float distance )
 {
-	vec3_t z_axis = rotation_lspace.GetColumn(2);
-	translation_lspace += z_axis * distance;
+	vec3_t z_axis = rotationLspace.GetColumn(2);
+	translationLspace += z_axis * distance;
 }
 
 
 //=====================================================================================================================================
-// AddChild                                                                                                                           =
+// addChild                                                                                                                           =
 //=====================================================================================================================================
-void node_t::AddChild( node_t* node )
+void Node::addChild( Node* node )
 {
 	if( node->parent != NULL )
 	{
-		ERROR( "Node allready have parent" );
+		ERROR( "Node already has parent" );
 		return;
 	}
 
@@ -138,11 +138,11 @@ void node_t::AddChild( node_t* node )
 
 
 //=====================================================================================================================================
-// RemoveChild                                                                                                                        =
+// removeChild                                                                                                                        =
 //=====================================================================================================================================
-void node_t::RemoveChild( node_t* node )
+void Node::removeChild( Node* node )
 {
-	Vec<node_t*>::iterator it = find( childs.begin(), childs.end(), node );
+	Vec<Node*>::iterator it = find( childs.begin(), childs.end(), node );
 	if( it == childs.end() )
 	{
 		ERROR( "Child not found" );

+ 73 - 0
src/scene/Node.h

@@ -0,0 +1,73 @@
+#ifndef _NODE_H_
+#define _NODE_H_
+
+#include <memory>
+#include "common.h"
+#include "gmath.h"
+
+
+class bvolume_t;
+class Material;
+class Controller;
+
+
+/// Scene Node
+class Node
+{
+	// data
+	public:
+		enum Type
+		{
+			NT_LIGHT,
+			NT_CAMERA,
+			NT_MESH,
+			NT_SKELETON,
+			NT_SKEL_MODEL
+		};
+
+		vec3_t translationLspace;
+		mat3_t rotationLspace;
+		float  scaleLspace;
+
+		vec3_t translationWspace;
+		mat3_t rotationWspace;
+		float  scaleWspace;
+
+		mat4_t transformationWspace;
+
+		Node* parent;
+		Vec<Node*> childs;
+
+		Type type;
+
+		bvolume_t* bvolumeLspace;
+		bvolume_t* bvolumeWspace;
+
+		bool isGroupNode;
+
+	// funcs
+	private:
+		void commonConstructorCode(); ///< Cause we cannot call constructor from other constructor
+		
+	public:
+		Node( Type type_ ): type(type_) { commonConstructorCode(); }
+		Node( Type type_, Node* parent ): type(type_) { commonConstructorCode(); parent->addChild(this); }
+		virtual ~Node();
+		virtual void render() = 0;
+		virtual void init( const char* ) = 0; ///< init using a script
+		virtual void deinit() = 0;
+		virtual void updateWorldStuff() { updateWorldTransform(); } ///< This update happens only when the object gets moved. Override it if you want more
+		void updateWorldTransform();
+		void rotateLocalX( float ang_degrees ) { rotationLspace.RotateXAxis( ang_degrees ); }
+		void rotateLocalY( float ang_degrees ) { rotationLspace.RotateYAxis( ang_degrees ); }
+		void rotateLocalZ( float ang_degrees ) { rotationLspace.RotateZAxis( ang_degrees ); }
+		void moveLocalX( float distance );
+		void moveLocalY( float distance );
+		void moveLocalZ( float distance );
+		void addChild( Node* node );
+		void removeChild( Node* node );
+		void setLocalTransformation( const vec3_t& t, const mat3_t& r, float s ) { translationLspace=t; rotationLspace=r; scaleLspace=s; }
+};
+
+
+#endif

+ 50 - 50
src/scene/scene.cpp → src/scene/Scene.cpp

@@ -1,10 +1,10 @@
 #include <algorithm>
-#include "scene.h"
-#include "skel_node.h"
-#include "camera.h"
-#include "mesh_node.h"
-#include "light.h"
-#include "controller.h"
+#include "Scene.h"
+#include "SkelNode.h"
+#include "Camera.h"
+#include "MeshNode.h"
+#include "Light.h"
+#include "Controller.h"
 #include "Material.h"
 
 namespace scene {
@@ -16,13 +16,13 @@ DATA
 */
 skybox_t skybox;
 
-container_node_t       nodes;
-container_light_t      lights;
-container_camera_t     cameras;
-container_mesh_node_t  mesh_nodes;
-container_skel_node_t  skel_nodes;
+NodeContainer     nodes;
+LightContainer    lights;
+CameraContainer   cameras;
+MeshContainer     meshNodes;
+SkelNodeContainer skelNodes;
 
-Vec<controller_t*>   controllers;
+Vec<Controller*> controllers;
 
 
 //=====================================================================================================================================
@@ -43,27 +43,27 @@ template<typename container_Type, typename Type> static void EraseNode( containe
 
 
 //=====================================================================================================================================
-// RegisterNode                                                                                                                       =
+// registerNode                                                                                                                       =
 //=====================================================================================================================================
-void RegisterNode( node_t* node )
+void registerNode( Node* node )
 {
 	PutBackNode( nodes, node );
 	
 	switch( node->type )
 	{
-		case node_t::NT_LIGHT:
-			PutBackNode( lights, static_cast<light_t*>(node) );
+		case Node::NT_LIGHT:
+			PutBackNode( lights, static_cast<Light*>(node) );
 			break;
-		case node_t::NT_CAMERA:
-			PutBackNode( cameras, static_cast<camera_t*>(node) );
+		case Node::NT_CAMERA:
+			PutBackNode( cameras, static_cast<Camera*>(node) );
 			break;
-		case node_t::NT_MESH:
-			PutBackNode( mesh_nodes, static_cast<mesh_node_t*>(node) );
+		case Node::NT_MESH:
+			PutBackNode( meshNodes, static_cast<MeshNode*>(node) );
 			break;
-		case node_t::NT_SKELETON:
-			PutBackNode( skel_nodes, static_cast<skel_node_t*>(node) );
+		case Node::NT_SKELETON:
+			PutBackNode( skelNodes, static_cast<SkelNode*>(node) );
 			break;
-		case node_t::NT_SKEL_MODEL:
+		case Node::NT_SKEL_MODEL:
 			// ToDo
 			break;
 	};
@@ -71,27 +71,27 @@ void RegisterNode( node_t* node )
 
 
 //=====================================================================================================================================
-// UnregisterNode                                                                                                                     =
+// unregisterNode                                                                                                                     =
 //=====================================================================================================================================
-void UnregisterNode( node_t* node )
+void unregisterNode( Node* node )
 {
 	EraseNode( nodes, node );
 	
 	switch( node->type )
 	{
-		case node_t::NT_LIGHT:
-			EraseNode( lights, static_cast<light_t*>(node) );
+		case Node::NT_LIGHT:
+			EraseNode( lights, static_cast<Light*>(node) );
 			break;
-		case node_t::NT_CAMERA:
-			EraseNode( cameras, static_cast<camera_t*>(node) );
+		case Node::NT_CAMERA:
+			EraseNode( cameras, static_cast<Camera*>(node) );
 			break;
-		case node_t::NT_MESH:
-			EraseNode( mesh_nodes, static_cast<mesh_node_t*>(node) );
+		case Node::NT_MESH:
+			EraseNode( meshNodes, static_cast<MeshNode*>(node) );
 			break;
-		case node_t::NT_SKELETON:
-			EraseNode( skel_nodes, static_cast<skel_node_t*>(node) );
+		case Node::NT_SKELETON:
+			EraseNode( skelNodes, static_cast<SkelNode*>(node) );
 			break;
-		case node_t::NT_SKEL_MODEL:
+		case Node::NT_SKEL_MODEL:
 			// ToDo
 			break;
 	};
@@ -101,27 +101,27 @@ void UnregisterNode( node_t* node )
 //=====================================================================================================================================
 // Register and Unregister controllers                                                                                                =
 //=====================================================================================================================================
-void RegisterController( controller_t* controller )
+void registerController( Controller* controller )
 {
 	DEBUG_ERR( std::find( controllers.begin(), controllers.end(), controller ) != controllers.end() );
 	controllers.push_back( controller );
 }
 
-void UnregisterController( controller_t* controller )
+void unregisterController( Controller* controller )
 {
-	Vec<controller_t*>::iterator it = std::find( controllers.begin(), controllers.end(), controller );
+	Vec<Controller*>::iterator it = std::find( controllers.begin(), controllers.end(), controller );
 	DEBUG_ERR( it == controllers.end() );
 	controllers.erase( it );
 }
 
 
 //=====================================================================================================================================
-// UpdateAllWorldStuff                                                                                                                =
+// updateAllWorldStuff                                                                                                                =
 //=====================================================================================================================================
-void UpdateAllWorldStuff()
+void updateAllWorldStuff()
 {
 	DEBUG_ERR( nodes.size() > 1024 );
-	node_t* queue [1024];
+	Node* queue [1024];
 	uint head = 0, tail = 0;
 	uint num = 0;
 
@@ -134,9 +134,9 @@ void UpdateAllWorldStuff()
 	// loop
 	while( head != tail ) // while queue not empty
 	{
-		node_t* obj = queue[head++]; // queue pop
+		Node* obj = queue[head++]; // queue pop
 
-		obj->UpdateWorldStuff();
+		obj->updateWorldStuff();
 		++num;
 
 		for( uint i=0; i<obj->childs.size(); i++ )
@@ -148,20 +148,20 @@ void UpdateAllWorldStuff()
 
 
 //=====================================================================================================================================
-// UpdateAllControllers                                                                                                               =
+// updateAllControllers                                                                                                               =
 //=====================================================================================================================================
-void UpdateAllControllers()
+void updateAllControllers()
 {
-	/*for( container_node_t::iterator it=nodes.begin(); it!=nodes.end(); it++ )
+	/*for( NodeContainer::iterator it=nodes.begin(); it!=nodes.end(); it++ )
 	{
-		node_t* node = (*it);
-		for( Vec<controller_t*>::iterator it1=node->controllers.begin(); it1!=node->controllers.end(); it1++ )
-			(*it1)->Update( 0.0 );
+		Node* node = (*it);
+		for( Vec<Controller*>::iterator it1=node->controllers.begin(); it1!=node->controllers.end(); it1++ )
+			(*it1)->update( 0.0 );
 	}*/
 
-	for( Vec<controller_t*>::iterator it=controllers.begin(); it!=controllers.end(); it++ )
+	for( Vec<Controller*>::iterator it=controllers.begin(); it!=controllers.end(); it++ )
 	{
-		(*it)->Update( 0.0 );
+		(*it)->update( 0.0 );
 	}
 }
 

+ 59 - 0
src/scene/Scene.h

@@ -0,0 +1,59 @@
+#ifndef _SCENE_H_
+#define _SCENE_H_
+
+#include "common.h"
+#include "skybox.h"
+
+
+class Node;
+class Light;
+class Camera;
+class MeshNode;
+class SkelNode;
+class Controller;
+
+
+namespace scene {
+
+// misc
+extern skybox_t skybox;
+inline vec3_t GetAmbientColor() { return vec3_t( 0.1, 0.05, 0.05 )*1; }
+inline vec3_t SunPos() { return vec3_t( 0.0, 1.0, -1.0 ) * 50.0; }
+
+// funcs
+extern void registerNode( Node* node );
+extern void unregisterNode( Node* node );
+extern void registerController( Controller* controller );
+extern void unregisterController( Controller* controller );
+
+extern void updateAllWorldStuff();
+extern void updateAllControllers();
+
+
+// Container
+/// entities container class
+template<typename Type> class Container: public Vec<Type*>
+{
+}; // end class Container
+
+
+
+// typedefs
+typedef Container<Node> NodeContainer;
+typedef Container<Light> LightContainer;
+typedef Container<Camera> CameraContainer;
+typedef Container<MeshNode> MeshContainer;
+typedef Container<SkelNode> SkelNodeContainer;
+
+// containers
+extern NodeContainer      nodes;
+extern LightContainer     lights;
+extern CameraContainer    cameras;
+extern MeshContainer      meshNodes;
+extern SkelNodeContainer  skelNodes;
+
+extern Vec<Controller*> controllers;
+
+
+} // end namespace
+#endif

+ 14 - 14
src/scene/skel_model_node.cpp → src/scene/SkelModelNode.cpp

@@ -1,10 +1,10 @@
-#include "skel_model_node.h"
+#include "SkelModelNode.h"
 #include "parser.h"
-#include "skel_node.h"
-#include "mesh_skel_ctrl.h"
+#include "SkelNode.h"
+#include "MeshSkelNodeCtrl.h"
 
-/// Create a skel_node and N mesh_nodes that have a mesh_skel_ctrl
-void skel_model_node_t::Init( const char* filename )
+/// Create a skelNode and N meshNodes that have a meshSkelCtrl
+void skelModelNode::init( const char* filename )
 {
 	Scanner scanner;
 	if( !scanner.loadFile( filename ) ) return;
@@ -26,9 +26,9 @@ void skel_model_node_t::Init( const char* filename )
 		return;
 	}
 	
-	skel_node = new skel_node_t;
-	skel_node->Init( token->value.string );
-	AddChild( skel_node );
+	skelNode = new SkelNode;
+	skelNode->init( token->value.string );
+	addChild( skelNode );
 	
 	//** MESHES **
 	token = &scanner.getNextToken();
@@ -45,9 +45,9 @@ void skel_model_node_t::Init( const char* filename )
 		return;
 	}
 			
-	mesh_nodes.resize( token->value.int_ );
+	meshNodes.resize( token->value.int_ );
 			
-	for( uint i=0; i<mesh_nodes.size(); ++i )
+	for( uint i=0; i<meshNodes.size(); ++i )
 	{
 		token = &scanner.getNextToken();
 		if( token->code != Scanner::TC_STRING )
@@ -56,9 +56,9 @@ void skel_model_node_t::Init( const char* filename )
 			return;
 		}
 				
-		mesh_nodes[i] = new mesh_node_t;
-		mesh_nodes[i]->Init( token->value.string );
-		skel_node->AddChild( mesh_nodes[i] );
-		mesh_nodes[i]->mesh_skel_ctrl = new mesh_skel_ctrl_t( skel_node, mesh_nodes[i] );
+		meshNodes[i] = new MeshNode;
+		meshNodes[i]->init( token->value.string );
+		skelNode->addChild( meshNodes[i] );
+		meshNodes[i]->meshSkelCtrl = new MeshSkelNodeCtrl( skelNode, meshNodes[i] );
 	}
 }

+ 28 - 0
src/scene/SkelModelNode.h

@@ -0,0 +1,28 @@
+#ifndef _SKEL_MODEL_NODE_H_
+#define _SKEL_MODEL_NODE_H_
+
+#include "common.h"
+#include "MeshNode.h" 
+
+
+class MeshNode;
+class SkelNode;
+
+
+/** 
+ * Skeleton model scene node
+ * It is just a group node with a derived init
+ */
+class skelModelNode: public Node
+{
+	public:
+		Vec<MeshNode*> meshNodes;
+		SkelNode*   skelNode;
+		
+		skelModelNode(): Node(NT_SKEL_MODEL), skelNode(NULL) { isGroupNode = true; }
+		void init( const char* filename );
+		void deinit() {} ///< Do nothing because it loads no resources
+		void render() {} ///< Do nothing
+};
+
+#endif

+ 17 - 17
src/scene/skel_node.cpp → src/scene/SkelNode.cpp

@@ -1,46 +1,46 @@
-#include "skel_node.h"
+#include "SkelNode.h"
 #include "renderer.h"
 #include "SkelAnim.h"
 #include "Skeleton.h"
-#include "skel_anim_ctrl.h"
+#include "SkelAnimCtrl.h"
 
 
 //=====================================================================================================================================
-// skel_node_t                                                                                                                        =
+// SkelNode                                                                                                                        =
 //=====================================================================================================================================
-skel_node_t::skel_node_t(): 
-	node_t( NT_SKELETON ),
-	skel_anim_ctrl( NULL )
+SkelNode::SkelNode(): 
+	Node( NT_SKELETON ),
+	skelAnimCtrl( NULL )
 {
 }
 
 
 //=====================================================================================================================================
-// Init                                                                                                                               =
+// init                                                                                                                               =
 //=====================================================================================================================================
-void skel_node_t::Init( const char* filename )
+void SkelNode::init( const char* filename )
 {
 	skeleton = rsrc::skeletons.load( filename );
-	skel_anim_ctrl = new skel_anim_ctrl_t( this );
+	skelAnimCtrl = new SkelAnimCtrl( this );
 }
 
 
 //=====================================================================================================================================
-// Deinit                                                                                                                             =
+// deinit                                                                                                                             =
 //=====================================================================================================================================
-void skel_node_t::Deinit()
+void SkelNode::deinit()
 {
 	rsrc::skeletons.unload( skeleton );
 }
 
 
 //=====================================================================================================================================
-// Render                                                                                                                             =
+// render                                                                                                                             =
 //=====================================================================================================================================
-void skel_node_t::Render()
+void SkelNode::render()
 {
 	glPushMatrix();
-	r::MultMatrix( transformation_wspace );
+	r::MultMatrix( transformationWspace );
 
 	//glPointSize( 4.0f );
 	//glLineWidth( 2.0f );
@@ -49,13 +49,13 @@ void skel_node_t::Render()
 	{
 		glColor3fv( &vec3_t( 1.0, 1.0, 1.0 )[0] );
 		glBegin( GL_POINTS );
-			glVertex3fv( &skel_anim_ctrl->heads[i][0] );
+			glVertex3fv( &skelAnimCtrl->heads[i][0] );
 		glEnd();
 
 		glBegin( GL_LINES );
-			glVertex3fv( &skel_anim_ctrl->heads[i][0] );
+			glVertex3fv( &skelAnimCtrl->heads[i][0] );
 			glColor3fv( &vec3_t( 1.0, 0.0, 0.0 )[0] );
-			glVertex3fv( &skel_anim_ctrl->tails[i][0] );
+			glVertex3fv( &skelAnimCtrl->tails[i][0] );
 		glEnd();
 	}
 

+ 27 - 0
src/scene/SkelNode.h

@@ -0,0 +1,27 @@
+#ifndef _SKEL_NODE_H_
+#define _SKEL_NODE_H_
+
+#include "common.h"
+#include "Node.h"
+#include "Controller.h"
+#include "gmath.h"
+
+class Skeleton;
+class SkelAnimCtrl;
+
+
+/// Skeleton node
+class SkelNode: public Node
+{
+	public:
+		Skeleton* skeleton; ///< The skeleton resource
+		SkelAnimCtrl* skelAnimCtrl; ///< Hold the controller here as well
+
+		SkelNode();
+		void render();
+		void init( const char* filename );
+		void deinit();
+};
+
+
+#endif

+ 0 - 88
src/scene/camera.h

@@ -1,88 +0,0 @@
-#ifndef _CAMERA_H_
-#define _CAMERA_H_
-
-#include "common.h"
-#include "collision.h"
-#include "node.h"
-
-
-class camera_t: public node_t
-{
-	public:
-		enum frustrum_planes_e
-		{
-			FP_LEFT = 0,
-			FP_RIGHT,
-			FP_NEAR,
-			FP_TOP,
-			FP_BOTTOM,
-			FP_FAR
-		};
-
-		// 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 aspect_ratio = fovx/fovy
-		// fovx and fovy in rad
-		float fovx, fovy;
-		float znear, zfar;
-
-		// the frustum planes in local and world space
-		plane_t lspace_frustum_planes[6];
-		plane_t wspace_frustum_planes[6];
-
-		// matrices
-		mat4_t projection_mat;
-		mat4_t view_mat;
-		/**
-		 * Used in deferred shading for the calculation of view vector (see CalcViewVector). The reason we store this matrix here is
-		 * that we dont want it to be re-calculated all the time but only when the projection params (fovx, fovy, znear, zfar) change.
-		 * Fortunately the projection params change rarely. Note that the camera_t as we all know re-calculates the matreces only when the
-		 * parameteres change!!
-		 */
-		mat4_t inv_projection_mat;
-
-		// misc
-		void CalcProjectionMatrix();
-		void UpdateViewMatrix();
-		void CalcLSpaceFrustumPlanes();
-		void UpdateWSpaceFrustumPlanes();
-
-	public:
-		// constructors and destuctors
-		camera_t( float fovx_, float fovy_, float znear_, float zfar_ ): node_t(NT_CAMERA), fovx(fovx_), fovy(fovy_), znear(znear_), zfar(zfar_)
-		{
-			CalcLSpaceFrustumPlanes();
-			UpdateWSpaceFrustumPlanes();
-			CalcProjectionMatrix();
-		}
-		camera_t( const camera_t& c ): node_t(NT_CAMERA) { memcpy( this, &c, sizeof( camera_t ) ); }
-		camera_t(): node_t(NT_CAMERA) {}
-		~camera_t() {}
-
-		// Sets & Gets
-		void SetFovX ( float fovx_ )  { fovx=fovx_; CalcProjectionMatrix(); CalcLSpaceFrustumPlanes(); }
-		void SetFovY ( float fovy_ )  { fovy=fovy_; CalcProjectionMatrix(); CalcLSpaceFrustumPlanes(); }
-		void SetZNear( float znear_ ) { znear=znear_; CalcProjectionMatrix(); CalcLSpaceFrustumPlanes(); }
-		void SetZFar ( float zfar_ )  { zfar=zfar_; CalcProjectionMatrix(); CalcLSpaceFrustumPlanes(); }
-		void SetAll( float fovx_, float fovy_, float znear_, float zfar_ );
-		float GetFovX () const { return fovx; }
-		float GetFovY () const { return fovy; }
-		float GetZNear() const { return znear; }
-		float GetZFar () const { return zfar; }
-		const mat4_t& GetProjectionMatrix() const { return projection_mat; }
-		const mat4_t& GetViewMatrix() const { return view_mat; }
-		const mat4_t& GetInvProjectionMatrix() const { return inv_projection_mat; } // see the declaration of inv_projection_mat for info
-
-		// misc
-		void LookAtPoint( const vec3_t& point );
-		void UpdateWorldStuff();
-		void Render();
-		void Init( const char* ) {}
-		void Deinit() {}
-
-		// frustum stuff
-		bool InsideFrustum( const bvolume_t& vol ) const;
-		bool InsideFrustum( const camera_t& cam ) const; // check if another camera is inside our view (used for projected lights)
-};
-
-
-#endif

+ 0 - 70
src/scene/light.h

@@ -1,70 +0,0 @@
-/*
-LIGHTING MODEL
-
-Final intensity:                If = Ia + Id + Is
-Ambient intensity:              Ia = Al * Am
-Ambient intensity of light:     Al
-Ambient intensity of material:  Am
-Defuse intensity:               Id = Dl * Dm * LambertTerm
-Defuse intensity of light:      Dl
-Defuse intensity of material:   Dm
-LambertTerm:                    max( Normal dot Light, 0.0 )
-Specular intensity:             Is = Sm x Sl x pow( max(R dot E, 0.0), f )
-Specular intensity of light:    Sl
-Specular intensity of material: Sm
-*/
-
-#ifndef _LIGHT_H_
-#define _LIGHT_H_
-
-#include "common.h"
-#include "Texture.h"
-#include "node.h"
-#include "camera.h"
-
-class LightProps;
-
-
-/// light_t (A)
-class light_t: public node_t
-{
-	public:
-		enum type_e { LT_POINT, LT_SPOT };
-
-		type_e type;
-		LightProps* light_props; ///< Later we will add a controller
-	
-		light_t( type_e type_ ): node_t(NT_LIGHT), type(type_) {}
-		//void Init( const char* );
-		void Deinit();
-};
-
-
-/// point_light_t
-class point_light_t: public light_t
-{
-	public:
-		float radius;
-
-		point_light_t(): light_t(LT_POINT) {}
-		void Init( const char* );
-		void Render();
-};
-
-
-/// spot_light_t
-class spot_light_t: public light_t
-{
-	public:
-		camera_t camera;
-		bool castsShadow;
-
-		spot_light_t(): light_t(LT_SPOT), castsShadow(false) { AddChild( &camera ); }
-		float GetDistance() const { return camera.GetZFar(); }
-		void  SetDistance( float d ) { camera.SetZFar(d); }
-		void  Init( const char* );
-		void  Render();
-};
-
-
-#endif

+ 0 - 34
src/scene/mesh_node.h

@@ -1,34 +0,0 @@
-#ifndef _MESH_NODE_H_
-#define _MESH_NODE_H_
-
-#include "common.h"
-#include "node.h"
-#include "Material.h"
-
-class mesh_skel_ctrl_t;
-class Mesh;
-
-
-/// Mesh node
-class mesh_node_t: public node_t
-{
-	private:
-		void Render( Material* mtl ) const; ///< Common code for Render() and RenderDepth()
-
-	public:
-		// resources
-		Mesh* mesh;
-		Material* material;
-		Material* dp_material; ///< Depth pass material
-		// controllers
-		mesh_skel_ctrl_t* mesh_skel_ctrl;
-		// funcs
-		mesh_node_t(): node_t(NT_MESH), mesh_skel_ctrl(NULL) {}
-		virtual void Render() { Render(material); }
-		virtual void RenderDepth() { Render( material->dp_mtl ); }
-		void Init( const char* filename );
-		void Deinit();
-};
-
-
-#endif

+ 0 - 73
src/scene/node.h

@@ -1,73 +0,0 @@
-#ifndef _NODE_H_
-#define _NODE_H_
-
-#include <memory>
-#include "common.h"
-#include "gmath.h"
-
-
-class bvolume_t;
-class Material;
-class controller_t;
-
-
-/// Scene Node
-class node_t
-{
-	// data
-	public:
-		enum type_e
-		{
-			NT_LIGHT,
-			NT_CAMERA,
-			NT_MESH,
-			NT_SKELETON,
-			NT_SKEL_MODEL
-		};
-
-		vec3_t translation_lspace;
-		mat3_t rotation_lspace;
-		float  scale_lspace;
-
-		vec3_t translation_wspace;
-		mat3_t rotation_wspace;
-		float  scale_wspace;
-
-		mat4_t transformation_wspace;
-
-		node_t* parent;
-		Vec<node_t*> childs;
-
-		type_e type;
-
-		bvolume_t* bvolume_lspace;
-		bvolume_t* bvolume_wspace;
-
-		bool is_group_node;
-
-	// funcs
-	private:
-		void CommonConstructorCode(); ///< Cause we cannot call constructor from other constructor
-		
-	public:
-		node_t( type_e type_ ): type(type_) { CommonConstructorCode(); }
-		node_t( type_e type_, node_t* parent ): type(type_) { CommonConstructorCode(); parent->AddChild(this); }
-		virtual ~node_t();
-		virtual void Render() = 0;
-		virtual void Init( const char* ) = 0; ///< Init using a script
-		virtual void Deinit() = 0;
-		virtual void UpdateWorldStuff() { UpdateWorldTransform(); } ///< This update happens only when the object gets moved. Override it if you want more
-		void UpdateWorldTransform();
-		void RotateLocalX( float ang_degrees ) { rotation_lspace.RotateXAxis( ang_degrees ); }
-		void RotateLocalY( float ang_degrees ) { rotation_lspace.RotateYAxis( ang_degrees ); }
-		void RotateLocalZ( float ang_degrees ) { rotation_lspace.RotateZAxis( ang_degrees ); }
-		void MoveLocalX( float distance );
-		void MoveLocalY( float distance );
-		void MoveLocalZ( float distance );
-		void AddChild( node_t* node );
-		void RemoveChild( node_t* node );
-		void SetLocalTransformation( const vec3_t& t, const mat3_t& r, float s ) { translation_lspace=t; rotation_lspace=r; scale_lspace=s; }
-};
-
-
-#endif

+ 0 - 59
src/scene/scene.h

@@ -1,59 +0,0 @@
-#ifndef _SCENE_H_
-#define _SCENE_H_
-
-#include "common.h"
-#include "skybox.h"
-
-
-class node_t;
-class light_t;
-class camera_t;
-class mesh_node_t;
-class skel_node_t;
-class controller_t;
-
-
-namespace scene {
-
-// misc
-extern skybox_t skybox;
-inline vec3_t GetAmbientColor() { return vec3_t( 0.1, 0.05, 0.05 )*1; }
-inline vec3_t SunPos() { return vec3_t( 0.0, 1.0, -1.0 ) * 50.0; }
-
-// funcs
-extern void RegisterNode( node_t* node );
-extern void UnregisterNode( node_t* node );
-extern void RegisterController( controller_t* controller );
-extern void UnregisterController( controller_t* controller );
-
-extern void UpdateAllWorldStuff();
-extern void UpdateAllControllers();
-
-
-// Container
-/// entities container class
-template<typename Type> class container_t: public Vec<Type*>
-{
-}; // end class Container
-
-
-
-// typedefs
-typedef container_t<node_t> container_node_t;
-typedef container_t<light_t> container_light_t;
-typedef container_t<camera_t> container_camera_t;
-typedef container_t<mesh_node_t> container_mesh_node_t;
-typedef container_t<skel_node_t> container_skel_node_t;
-
-// containers
-extern container_node_t       nodes;
-extern container_light_t      lights;
-extern container_camera_t     cameras;
-extern container_mesh_node_t  mesh_nodes;
-extern container_skel_node_t  skel_nodes;
-
-extern Vec<controller_t*>   controllers;
-
-
-} // end namespace
-#endif

+ 0 - 28
src/scene/skel_model_node.h

@@ -1,28 +0,0 @@
-#ifndef _SKEL_MODEL_NODE_H_
-#define _SKEL_MODEL_NODE_H_
-
-#include "common.h"
-#include "mesh_node.h" 
-
-
-class mesh_node_t;
-class skel_node_t;
-
-
-/** 
- * Skeleton model scene node
- * It is just a group node with a derived Init
- */
-class skel_model_node_t: public node_t
-{
-	public:
-		Vec<mesh_node_t*> mesh_nodes;
-		skel_node_t* skel_node;
-		
-		skel_model_node_t(): node_t(NT_SKEL_MODEL), skel_node(NULL) { is_group_node = true; }
-		void Init( const char* filename );
-		void Deinit() {} ///< Do nothing because it loads no resources
-		void Render() {} ///< Do nothing
-};
-
-#endif

+ 0 - 27
src/scene/skel_node.h

@@ -1,27 +0,0 @@
-#ifndef _SKEL_NODE_H_
-#define _SKEL_NODE_H_
-
-#include "common.h"
-#include "node.h"
-#include "controller.h"
-#include "gmath.h"
-
-class Skeleton;
-class skel_anim_ctrl_t;
-
-
-/// Skeleton node
-class skel_node_t: public node_t
-{
-	public:
-		Skeleton* skeleton; ///< The skeleton resource
-		skel_anim_ctrl_t* skel_anim_ctrl; ///< Hold the controller here as well
-
-		skel_node_t();
-		void Render();
-		void Init( const char* filename );
-		void Deinit();
-};
-
-
-#endif

+ 17 - 17
src/tokenizer/Scanner.cpp

@@ -30,7 +30,7 @@ Scanner::Token::Token( const Token& b ): code(b.code), type(b.type)
 			value.string = b.value.string;
 			break;	
 	}
-	memcpy( as_string, b.as_string, Scanner::MAX_SCRIPT_LINE_LEN*sizeof(char) );
+	memcpy( asString, b.asString, Scanner::MAX_SCRIPT_LINE_LEN*sizeof(char) );
 }
 
 
@@ -201,13 +201,13 @@ string Scanner::getTokenInfo( const Token& token )
 			sprintf( token_info_str, "string \"%s\"", token.value.string );
 			break;
 		case TC_CHAR:
-			sprintf( token_info_str, "char '%c' (\"%s\")", token.value.char_, token.as_string );
+			sprintf( token_info_str, "char '%c' (\"%s\")", token.value.char_, token.asString );
 			break;
 		case TC_NUMBER:
 			if( token.type == DT_FLOAT )
-				sprintf( token_info_str, "float %f or %e (\"%s\")", token.value.float_, token.value.float_, token.as_string );
+				sprintf( token_info_str, "float %f or %e (\"%s\")", token.value.float_, token.value.float_, token.asString );
 			else
-				sprintf( token_info_str, "int %lu (\"%s\")", token.value.int_, token.as_string );
+				sprintf( token_info_str, "int %lu (\"%s\")", token.value.int_, token.asString );
 			break;
 		case TC_IDENTIFIER:
 			sprintf( token_info_str, "identifier \"%s\"", token.value.string );
@@ -236,9 +236,9 @@ void Scanner::printTokenInfo( const Token& token )
 
 
 //=====================================================================================================================================
-// getAllPrintAll                                                                                                                     =
+// getAllprintAll                                                                                                                     =
 //=====================================================================================================================================
-void Scanner::getAllPrintAll()
+void Scanner::getAllprintAll()
 {
 	do
 	{
@@ -388,7 +388,7 @@ CHECKERS (bellow only checkers)
 //=====================================================================================================================================
 bool Scanner::checkWord()
 {
-	char* tmp_str = crntToken.as_string;
+	char* tmp_str = crntToken.asString;
 	char ch = *pchar;
 
 	//build the string
@@ -401,9 +401,9 @@ bool Scanner::checkWord()
 	*tmp_str = '\0'; // finalize it
 
 	//check if reserved
-	int len = tmp_str-crntToken.as_string;
+	int len = tmp_str-crntToken.asString;
 	crntToken.code = TC_IDENTIFIER;
-	crntToken.value.string = crntToken.as_string;
+	crntToken.value.string = crntToken.asString;
 	crntToken.type = DT_STR; // not important
 
 	if( len<=7 && len>=2 )
@@ -413,7 +413,7 @@ bool Scanner::checkWord()
 		{
 			if( rw_table[len][x].string == NULL ) break;
 
-			if( strcmp(rw_table[len][x].string, crntToken.as_string ) == 0 )
+			if( strcmp(rw_table[len][x].string, crntToken.asString ) == 0 )
 			{
 				crntToken.code = rw_table[len][x].code;
 				break;
@@ -483,7 +483,7 @@ bool Scanner::checkNumber()
 	long dad = 0;      // digits after dot (for floats)
 	bool exp_sign = 0; // exponent sign in case float is represented in mant/exp format. 0 means positive and 1 negative
 	long exp = 0;      // the exponent in case float is represented in mant/exp format
-	char* tmp_str = crntToken.as_string;
+	char* tmp_str = crntToken.asString;
 	crntToken.type = DT_INT;
 	uint asc;
 
@@ -714,7 +714,7 @@ bool Scanner::checkNumber()
 		}
 
 		*tmp_str = '\0';
-		SERROR( "Bad number suffix \"" << crntToken.as_string << '\"' );
+		SERROR( "Bad number suffix \"" << crntToken.asString << '\"' );
 
 	return false;
 }
@@ -725,7 +725,7 @@ bool Scanner::checkNumber()
 //=====================================================================================================================================
 bool Scanner::checkString()
 {
-	char* tmp_str = crntToken.as_string;
+	char* tmp_str = crntToken.asString;
 	char ch = getNextChar();
 
 	for(;;)
@@ -735,7 +735,7 @@ bool Scanner::checkString()
 		{
 			crntToken.code = TC_ERROR;
 			*tmp_str = '\0';
-			SERROR( "Incorect string ending \"" << crntToken.as_string );
+			SERROR( "Incorect string ending \"" << crntToken.asString );
 			return false;
 		}
 		//Escape Codes
@@ -746,7 +746,7 @@ bool Scanner::checkString()
 			{
 				crntToken.code = TC_ERROR;
 				*tmp_str = '\0';
-				SERROR( "Incorect string ending \"" << crntToken.as_string << '\"' );
+				SERROR( "Incorect string ending \"" << crntToken.asString << '\"' );
 				return false;
 			}
 
@@ -772,7 +772,7 @@ bool Scanner::checkString()
 		{
 			*tmp_str = '\0';
 			crntToken.code = TC_STRING;
-			crntToken.value.string = crntToken.as_string;
+			crntToken.value.string = crntToken.asString;
 			getNextChar();
 			return true;
 		}
@@ -796,7 +796,7 @@ bool Scanner::checkChar()
 {
 	char ch = getNextChar();
 	char ch0 = ch;
-	char* tmp_str = crntToken.as_string;
+	char* tmp_str = crntToken.asString;
 
 	crntToken.code = TC_ERROR;
 	*tmp_str++ = ch;

+ 4 - 4
src/tokenizer/Scanner.h

@@ -103,7 +103,7 @@ class Scanner
 			char   char_;
 			ulong  int_;
 			double float_;
-			char*  string; ///< points to Token::as_string if the token is string
+			char*  string; ///< points to Token::asString if the token is string
 		};
 
 		/// The Token class
@@ -113,7 +113,7 @@ class Scanner
 			TokenDataType  type;
 			TokenDataVal   value;
 
-			char as_string[ MAX_SCRIPT_LINE_LEN ];
+			char asString[ MAX_SCRIPT_LINE_LEN ];
 
 			Token(): code( TC_ERROR ) {}
 			Token( const Token& b );
@@ -164,9 +164,9 @@ class Scanner
 		bool loadIoStream( iostream* iostream_, const char* scriptName_ = "unamed-iostream" ); ///< load a STL iostream to extract tokens
 		void unload();
 
-		static void   printTokenInfo( const Token& token ); ///< Print info of the given token
+		static void   printTokenInfo( const Token& token ); ///< print info of the given token
 		static string getTokenInfo( const Token& token ); ///< Get a string with the info of the given token
-		       void   getAllPrintAll();
+		       void   getAllprintAll();
 
 		const Token& getNextToken(); ///< Get the next token from the file
 		const Token& getCrntToken() const { return crntToken; } ///< Accessor for the current token

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov