Browse Source

Refactoring

Panagiotis Christopoulos Charitos 15 years ago
parent
commit
6e1d6f010d

+ 1 - 1
build/debug/Makefile

@@ -657,7 +657,7 @@ Main.o: ../../src//Main.cpp ../../src/Core/Common.h \
  ../../src/Renderer/RendererInitializer.h \
  ../../src/Renderer/RendererInitializer.h \
  ../../src/Renderer/MainRenderer.h ../../src/Renderer/Renderer.h \
  ../../src/Renderer/MainRenderer.h ../../src/Renderer/Renderer.h \
  ../../src/Physics/DebugDrawer.h ../../src/Physics/RigidBody.h \
  ../../src/Physics/DebugDrawer.h ../../src/Physics/RigidBody.h \
- ../../src/Scripting/ScriptingEngine.h
+ ../../src/Scripting/ScriptingEngine.h ../../src/Core/StdinListener.h
 	@echo Compiling ../../src//Main.cpp...
 	@echo Compiling ../../src//Main.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src//Main.cpp -o Main.o
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src//Main.cpp -o Main.o
 
 

+ 1 - 1
build/debug/gen.cfg.py

@@ -11,4 +11,4 @@ compiler = "g++"
 
 
 compilerFlags = "-DDEBUG_ENABLED=1 -DPLATFORM_LINUX -DREVISION=\\\"`svnversion -c ../..`\\\" -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -O0 -g3 -pg -fsingle-precision-constant"
 compilerFlags = "-DDEBUG_ENABLED=1 -DPLATFORM_LINUX -DREVISION=\\\"`svnversion -c ../..`\\\" -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -O0 -g3 -pg -fsingle-precision-constant"
 
 
-linkerFlags = "-rdynamic -L../../extern/lib-x86-64-linux -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -lboost_thread -Wl,-Bdynamic -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem -pg"
+linkerFlags = "-rdynamic -pg -L../../extern/lib-x86-64-linux -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -Wl,-Bdynamic -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem -lboost_thread"

+ 2 - 2
build/release/Makefile

@@ -3,7 +3,7 @@
 CXX = g++
 CXX = g++
 CFLAGS = -DDEBUG_ENABLED=0 -DPLATFORM_LINUX -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -s -msse4 -O3 -mtune=core2 -ffast-math -fsingle-precision-constant
 CFLAGS = -DDEBUG_ENABLED=0 -DPLATFORM_LINUX -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -s -msse4 -O3 -mtune=core2 -ffast-math -fsingle-precision-constant
 PHFLAGS = 
 PHFLAGS = 
-LFLAGS = -rdynamic -L../../extern/lib-x86-64-linux -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -Wl,-Bdynamic -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem
+LFLAGS = -rdynamic -L../../extern/lib-x86-64-linux -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -Wl,-Bdynamic -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem -lboost_thread
 EXECUTABLE = anki
 EXECUTABLE = anki
 INCPATH = -I./ -I../../src/Math/ -I../../src/Util/Tokenizer/ -I../../src/Misc/ -I../../src/ -I../../src/Renderer/ -I../../src/Scene/ -I../../src/Ui/ -I../../src/Resources/ -I../../src/Util/ -I../../src/Scene/Controllers/ -I../../src/Physics/ -I../../src/Renderer/BufferObjects/ -I../../src/Resources/Helpers/ -I../../src/Resources/Core/ -I../../src/Core/ -I../../src/Scripting/ -I../../src/Scripting/Math -I../../src/Scripting/Util -I../../src/Scripting/Core -I../../src/Scripting/Scene -I../../extern/include -I../../extern/include/bullet -I/usr/include/python2.6 
 INCPATH = -I./ -I../../src/Math/ -I../../src/Util/Tokenizer/ -I../../src/Misc/ -I../../src/ -I../../src/Renderer/ -I../../src/Scene/ -I../../src/Ui/ -I../../src/Resources/ -I../../src/Util/ -I../../src/Scene/Controllers/ -I../../src/Physics/ -I../../src/Renderer/BufferObjects/ -I../../src/Resources/Helpers/ -I../../src/Resources/Core/ -I../../src/Core/ -I../../src/Scripting/ -I../../src/Scripting/Math -I../../src/Scripting/Util -I../../src/Scripting/Core -I../../src/Scripting/Scene -I../../extern/include -I../../extern/include/bullet -I/usr/include/python2.6 
 SOURCES = ../../src/Util/Tokenizer//Scanner.cpp ../../src/Misc//collision.cpp ../../src/Misc//skybox.cpp ../../src/Misc//map.cpp ../../src/Misc//memory.cpp ../../src/Misc//TestHeader.cpp ../../src//Main.cpp ../../src/Renderer//Renderer.cpp ../../src/Renderer//Hdr.cpp ../../src/Renderer//Bs.cpp ../../src/Renderer//Sm.cpp ../../src/Renderer//Dbg.cpp ../../src/Renderer//Smo.cpp ../../src/Renderer//Pps.cpp ../../src/Renderer//Ms.cpp ../../src/Renderer//MainRenderer.cpp ../../src/Renderer//Is.cpp ../../src/Renderer//Ssao.cpp ../../src/Renderer//Ez.cpp ../../src/Scene//MeshNode.cpp ../../src/Scene//Camera.cpp ../../src/Scene//SkelModelNode.cpp ../../src/Scene//SkelNode.cpp ../../src/Scene//Light.cpp ../../src/Scene//Scene.cpp ../../src/Scene//SceneNode.cpp ../../src/Scene//ParticleEmitter.cpp ../../src/Ui//Ui.cpp ../../src/Resources//ShaderProg.cpp ../../src/Resources//Mesh.cpp ../../src/Resources//SkelAnim.cpp ../../src/Resources//Script.cpp ../../src/Resources//Skeleton.cpp ../../src/Resources//ParticleEmitterProps.cpp ../../src/Resources//LightProps.cpp ../../src/Resources//Texture.cpp ../../src/Resources//Extension.cpp ../../src/Resources//Material.cpp ../../src/Util//Input.cpp ../../src/Util//Util.cpp ../../src/Scene/Controllers//Controller.cpp ../../src/Scene/Controllers//SkelAnimCtrl.cpp ../../src/Physics//Physics.cpp ../../src/Physics//RigidBody.cpp ../../src/Physics//PhyCharacter.cpp ../../src/Resources/Helpers//Image.cpp ../../src/Resources/Helpers//ShaderPrePreprocessor.cpp ../../src/Resources/Core//RsrcPtr.cpp ../../src/Resources/Core//RsrcContainers.cpp ../../src/Core//App.cpp ../../src/Core//Common.cpp ../../src/Core//StdinListener.cpp ../../src/Scripting//ScriptingEngine.cpp ../../src/Scripting//BoostPythonInterfaces.cpp 
 SOURCES = ../../src/Util/Tokenizer//Scanner.cpp ../../src/Misc//collision.cpp ../../src/Misc//skybox.cpp ../../src/Misc//map.cpp ../../src/Misc//memory.cpp ../../src/Misc//TestHeader.cpp ../../src//Main.cpp ../../src/Renderer//Renderer.cpp ../../src/Renderer//Hdr.cpp ../../src/Renderer//Bs.cpp ../../src/Renderer//Sm.cpp ../../src/Renderer//Dbg.cpp ../../src/Renderer//Smo.cpp ../../src/Renderer//Pps.cpp ../../src/Renderer//Ms.cpp ../../src/Renderer//MainRenderer.cpp ../../src/Renderer//Is.cpp ../../src/Renderer//Ssao.cpp ../../src/Renderer//Ez.cpp ../../src/Scene//MeshNode.cpp ../../src/Scene//Camera.cpp ../../src/Scene//SkelModelNode.cpp ../../src/Scene//SkelNode.cpp ../../src/Scene//Light.cpp ../../src/Scene//Scene.cpp ../../src/Scene//SceneNode.cpp ../../src/Scene//ParticleEmitter.cpp ../../src/Ui//Ui.cpp ../../src/Resources//ShaderProg.cpp ../../src/Resources//Mesh.cpp ../../src/Resources//SkelAnim.cpp ../../src/Resources//Script.cpp ../../src/Resources//Skeleton.cpp ../../src/Resources//ParticleEmitterProps.cpp ../../src/Resources//LightProps.cpp ../../src/Resources//Texture.cpp ../../src/Resources//Extension.cpp ../../src/Resources//Material.cpp ../../src/Util//Input.cpp ../../src/Util//Util.cpp ../../src/Scene/Controllers//Controller.cpp ../../src/Scene/Controllers//SkelAnimCtrl.cpp ../../src/Physics//Physics.cpp ../../src/Physics//RigidBody.cpp ../../src/Physics//PhyCharacter.cpp ../../src/Resources/Helpers//Image.cpp ../../src/Resources/Helpers//ShaderPrePreprocessor.cpp ../../src/Resources/Core//RsrcPtr.cpp ../../src/Resources/Core//RsrcContainers.cpp ../../src/Core//App.cpp ../../src/Core//Common.cpp ../../src/Core//StdinListener.cpp ../../src/Scripting//ScriptingEngine.cpp ../../src/Scripting//BoostPythonInterfaces.cpp 
@@ -657,7 +657,7 @@ Main.o: ../../src//Main.cpp ../../src/Core/Common.h \
  ../../src/Renderer/RendererInitializer.h \
  ../../src/Renderer/RendererInitializer.h \
  ../../src/Renderer/MainRenderer.h ../../src/Renderer/Renderer.h \
  ../../src/Renderer/MainRenderer.h ../../src/Renderer/Renderer.h \
  ../../src/Physics/DebugDrawer.h ../../src/Physics/RigidBody.h \
  ../../src/Physics/DebugDrawer.h ../../src/Physics/RigidBody.h \
- ../../src/Scripting/ScriptingEngine.h
+ ../../src/Scripting/ScriptingEngine.h ../../src/Core/StdinListener.h
 	@echo Compiling ../../src//Main.cpp...
 	@echo Compiling ../../src//Main.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src//Main.cpp -o Main.o
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src//Main.cpp -o Main.o
 
 

+ 1 - 1
build/release/gen.cfg.py

@@ -11,4 +11,4 @@ compiler = "g++"
 
 
 compilerFlags = "-DDEBUG_ENABLED=0 -DPLATFORM_LINUX -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -s -msse4 -O3 -mtune=core2 -ffast-math -fsingle-precision-constant"
 compilerFlags = "-DDEBUG_ENABLED=0 -DPLATFORM_LINUX -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -s -msse4 -O3 -mtune=core2 -ffast-math -fsingle-precision-constant"
 
 
-linkerFlags = "-rdynamic -L../../extern/lib-x86-64-linux -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -Wl,-Bdynamic -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem"
+linkerFlags = "-rdynamic -L../../extern/lib-x86-64-linux -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -Wl,-Bdynamic -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem -lboost_thread"

+ 0 - 2
shaders/BsBpSphere.glsl

@@ -19,8 +19,6 @@ void main()
 
 
 #pragma anki fragShaderBegins
 #pragma anki fragShaderBegins
 
 
-#pragma anki include "shaders/pack.glsl"
-
 uniform sampler2D ppsPrePassFai;
 uniform sampler2D ppsPrePassFai;
 uniform sampler2D noiseMap;
 uniform sampler2D noiseMap;
 //varying vec2 texCoords_v2f;
 //varying vec2 texCoords_v2f;

+ 29 - 29
shaders/IsLpGeneric.glsl

@@ -11,8 +11,8 @@ attribute vec3 viewVector;
 #pragma anki attribute position 0
 #pragma anki attribute position 0
 attribute vec2 position; ///< the vert coords are {1.0,1.0}, {0.0,1.0}, {0.0,0.0}, {1.0,0.0}
 attribute vec2 position; ///< the vert coords are {1.0,1.0}, {0.0,1.0}, {0.0,0.0}, {1.0,0.0}
 
 
-varying vec2 texCoords;
-varying vec3 vpos;
+varying vec2 vTexCoords;
+varying vec3 vPosition;
 
 
 
 
 //======================================================================================================================
 //======================================================================================================================
@@ -20,8 +20,8 @@ varying vec3 vpos;
 //======================================================================================================================
 //======================================================================================================================
 void main()
 void main()
 {
 {
-	vpos = viewVector;
-	texCoords = position;
+	vPosition = viewVector;
+	vTexCoords = position;
 	vec2 _vertPosNdc_ = position * 2.0 - 1.0;
 	vec2 _vertPosNdc_ = position * 2.0 - 1.0;
 	gl_Position = vec4(_vertPosNdc_, 0.0, 1.0);
 	gl_Position = vec4(_vertPosNdc_, 0.0, 1.0);
 }
 }
@@ -37,7 +37,7 @@ void main()
 uniform sampler2D msNormalFai, msDiffuseFai, msSpecularFai, msDepthFai;
 uniform sampler2D msNormalFai, msDiffuseFai, msSpecularFai, msDepthFai;
 uniform vec2 planes; ///< for the calculation of frag pos in view space	
 uniform vec2 planes; ///< for the calculation of frag pos in view space	
 uniform vec3 lightPos; ///< Light pos in eye space
 uniform vec3 lightPos; ///< Light pos in eye space
-uniform float lightInvRadius; ///< An opt
+uniform float lightRadius;
 uniform vec3 lightDiffuseCol;
 uniform vec3 lightDiffuseCol;
 uniform vec3 lightSpecularCol;
 uniform vec3 lightSpecularCol;
 #if defined(SPOT_LIGHT_ENABLED)
 #if defined(SPOT_LIGHT_ENABLED)
@@ -51,8 +51,8 @@ uniform vec3 lightSpecularCol;
 /*
 /*
  * Varyings
  * Varyings
  */
  */
-varying vec2 texCoords;
-varying vec3 vpos; ///< for the calculation of frag pos in view space
+varying vec2 vTexCoords;
+varying vec3 vPosition; ///< for the calculation of frag pos in view space
 
 
 
 
 //======================================================================================================================
 //======================================================================================================================
@@ -63,13 +63,13 @@ varying vec3 vpos; ///< for the calculation of frag pos in view space
  */
  */
 vec3 getFragPosVSpace()
 vec3 getFragPosVSpace()
 {
 {
-	float _depth_ = texture2D(msDepthFai, texCoords).r;
+	float _depth_ = texture2D(msDepthFai, vTexCoords).r;
 
 
 	if(_depth_ == 1.0)
 	if(_depth_ == 1.0)
 		discard;
 		discard;
 
 
 	vec3 _fragPosVspace_;
 	vec3 _fragPosVspace_;
-	vec3 _vposn_ = normalize(vpos);
+	vec3 _vposn_ = normalize(vPosition);
 	_fragPosVspace_.z = -planes.y / (planes.x + _depth_);
 	_fragPosVspace_.z = -planes.y / (planes.x + _depth_);
 	_fragPosVspace_.xy = _vposn_.xy * (_fragPosVspace_.z / _vposn_.z);
 	_fragPosVspace_.xy = _vposn_.xy * (_fragPosVspace_.z / _vposn_.z);
 	return _fragPosVspace_;
 	return _fragPosVspace_;
@@ -85,7 +85,7 @@ vec3 getFragPosVSpace()
  */
  */
 float getAttenuation(in float _fragLightDist_)
 float getAttenuation(in float _fragLightDist_)
 {
 {
-	return clamp(1.0 - lightInvRadius * sqrt(_fragLightDist_), 0.0, 1.0);
+	return clamp(1.0 - sqrt(_fragLightDist_) / lightRadius, 0.0, 1.0);
 	//return 1.0 - _fragLightDist_ * _inv_light_radius;
 	//return 1.0 - _fragLightDist_ * _inv_light_radius;
 }
 }
 
 
@@ -153,7 +153,7 @@ vec3 doPhong(in vec3 _fragPosVspace_, out float _fragLightDist_)
 	/*
 	/*
 	 * Read the normal
 	 * Read the normal
 	 */
 	 */
-	vec3 _normal_ = unpackNormal(texture2D(msNormalFai, texCoords).rg);
+	vec3 _normal_ = unpackNormal(texture2D(msNormalFai, vTexCoords).rg);
 
 
 	/*
 	/*
 	 * Lambert term
 	 * Lambert term
@@ -167,14 +167,14 @@ vec3 doPhong(in vec3 _fragPosVspace_, out float _fragLightDist_)
 	/*
 	/*
 	 * Diffuce
 	 * Diffuce
 	 */
 	 */
-	vec3 _diffuse_ = texture2D(msDiffuseFai, texCoords).rgb;
-	_diffuse_ = (_diffuse * lightDiffuseCol);
+	vec3 _diffuse_ = texture2D(msDiffuseFai, vTexCoords).rgb;
+	_diffuse_ *= lightDiffuseCol;
 	vec3 _color_ = _diffuse_ * _lambertTerm_;
 	vec3 _color_ = _diffuse_ * _lambertTerm_;
 
 
 	/*
 	/*
 	 * Specular
 	 * Specular
 	 */
 	 */
-	vec4 _specularMix_ = texture2D(msSpecularFai, texCoords); // the MS specular FAI has the color and the shininess
+	vec4 _specularMix_ = texture2D(msSpecularFai, vTexCoords); // the MS specular FAI has the color and the shininess
 	vec3 _specular_ = _specularMix_.xyz;
 	vec3 _specular_ = _specularMix_.xyz;
 	float _shininess_ = _specularMix_.w;
 	float _shininess_ = _specularMix_.w;
 
 
@@ -214,24 +214,24 @@ void main()
 	 * Spot light
 	 * Spot light
 	 */
 	 */
 	#elif defined(SPOT_LIGHT_ENABLED)
 	#elif defined(SPOT_LIGHT_ENABLED)
-		vec4 _texCoords2_ = texProjectionMat * vec4(fragPosVspace, 1.0);
-		vec3 _texCoords3_ = _texCoords2_.xyz / _texCoords2_.w;
-
-		if(_texCoords2_.w > 0.0 &&
-		   _texCoords3_.x > 0.0 &&
-		   _texCoords3_.x < 1.0 &&
-		   _texCoords3_.y > 0.0 &&
-		   _texCoords3_.y < 1.0 &&
-		   _texCoords2_.w < 1.0/lightInvRadius)
+		vec4 _vTexCoords2_ = texProjectionMat * vec4(fragPosVspace, 1.0);
+		vec3 _vTexCoords3_ = _vTexCoords2_.xyz / _vTexCoords2_.w;
+
+		if(_vTexCoords2_.w > 0.0 &&
+		   _vTexCoords3_.x > 0.0 &&
+		   _vTexCoords3_.x < 1.0 &&
+		   _vTexCoords3_.y > 0.0 &&
+		   _vTexCoords3_.y < 1.0 &&
+		   _vTexCoords2_.w < lightRadius)
 		{
 		{
 			/*
 			/*
 			 * Get shadow
 			 * Get shadow
 			 */
 			 */
 			#if defined(SHADOW_ENABLED)
 			#if defined(SHADOW_ENABLED)
 				#if defined(PCF_ENABLED)
 				#if defined(PCF_ENABLED)
-					float _shadowCol_ =  shadow2D(shadowMap, _texCoords3_).r;
+					float _shadowCol_ = pcfLow(_vTexCoords3_);
 				#else
 				#else
-					float _shadowCol_ = pcfOff(_texCoords3_);
+					float _shadowCol_ = shadow2D(shadowMap, _vTexCoords3_).r;
 				#endif
 				#endif
 
 
 				if(_shadowCol_ == 0.0)
 				if(_shadowCol_ == 0.0)
@@ -241,13 +241,13 @@ void main()
 			float _fragLightDist_;
 			float _fragLightDist_;
 			vec3 _color_ = doPhong(fragPosVspace, _fragLightDist_);
 			vec3 _color_ = doPhong(fragPosVspace, _fragLightDist_);
 
 
-			vec3 _lightTexCol_ = texture2DProj(lightTex, _texCoords2_.xyz).rgb;
+			vec3 _lightTexCol_ = texture2DProj(lightTex, _vTexCoords2_.xyz).rgb;
 			float _att_ = getAttenuation(_fragLightDist_);
 			float _att_ = getAttenuation(_fragLightDist_);
 
 
 			#if defined(SHADOW_ENABLED)
 			#if defined(SHADOW_ENABLED)
 				gl_FragData[0] = vec4(_lightTexCol_ * _color_ * (_shadowCol_ * _att_), 1.0);
 				gl_FragData[0] = vec4(_lightTexCol_ * _color_ * (_shadowCol_ * _att_), 1.0);
 			#else
 			#else
-				gl_FragData[0] = vec4(_color_ * _texel_ * _att_, 1.0);
+				gl_FragData[0] = vec4(_lightTexCol_ * _color_ * _att_, 1.0);
 			#endif
 			#endif
 		}
 		}
 		else
 		else
@@ -264,7 +264,7 @@ void main()
 	
 	
 	//gl_FragData[0] = gl_FragData[0] - gl_FragData[0] + vec4(1, 0, 1, 1);
 	//gl_FragData[0] = gl_FragData[0] - gl_FragData[0] + vec4(1, 0, 1, 1);
 	/*#if defined(SPOT_LIGHT_ENABLED)
 	/*#if defined(SPOT_LIGHT_ENABLED)
-	gl_FragData[0] = gl_FragData[0] - gl_FragData[0] + vec4(texture2D(msDepthFai, texCoords).r);
-	//gl_FragData[0] = vec4(texture2D(msDepthFai, texCoords).rg), 1.0);
+	gl_FragData[0] = gl_FragData[0] - gl_FragData[0] + vec4(texture2D(msDepthFai, vTexCoords).r);
+	//gl_FragData[0] = vec4(texture2D(msDepthFai, vTexCoords).rg), 1.0);
 	#endif*/
 	#endif*/
 }
 }

+ 33 - 33
shaders/MsMpGeneric.glsl

@@ -58,11 +58,11 @@ uniform mat4 modelViewProjectionMat;
 /*
 /*
  * Varyings
  * Varyings
  */
  */
-varying vec3 normal_v2f;
-varying vec2 texCoords_v2f;
-varying vec3 tangent_v2f;
-varying float w_v2f;
-varying vec3 vertPosEyeSpace_v2f; ///< For env mapping. AKA view_vector
+varying vec3 vNormal;
+varying vec2 vTexCoords;
+varying vec3 vTangent;
+varying float vTangentW;
+varying vec3 vVertPosViewSpace; ///< For env mapping. AKA view_vector
 
 
 
 
 
 
@@ -75,26 +75,26 @@ void main()
 
 
 	// if we have hardware skinning then:
 	// if we have hardware skinning then:
 	#if defined(HARDWARE_SKINNING)
 	#if defined(HARDWARE_SKINNING)
-		mat3 _rot;
-		vec3 _tsl;
+		mat3 _rot_;
+		vec3 _tsl_;
 
 
-		HWSkinning(_rot, _tsl);
+		HWSkinning(_rot_, _tsl_);
 
 
-		normal_v2f = normalMat * (_rot * normal);
+		vNormal = normalMat * (_rot_ * normal);
 
 
 		#if NEEDS_TANGENT
 		#if NEEDS_TANGENT
-			tangent_v2f = normalMat * (_rot * vec3(tangent));
+			vTangent = normalMat * (_rot_ * vec3(tangent));
 		#endif
 		#endif
 
 
-		vec3 pos_lspace = (_rot * position) + _tsl;
-		gl_Position =  modelViewProjectionMat * vec4(pos_lspace, 1.0);
+		vec3 _posLocalSpace_ = (_rot_ * position) + _tsl_;
+		gl_Position =  modelViewProjectionMat * vec4(_posLocalSpace_, 1.0);
 
 
 	// if DONT have hardware skinning
 	// if DONT have hardware skinning
 	#else
 	#else
-		normal_v2f = normalMat * normal;
+		vNormal = normalMat * normal;
 
 
 		#if NEEDS_TANGENT
 		#if NEEDS_TANGENT
-			tangent_v2f = normalMat * vec3(tangent);
+			vTangent = normalMat * vec3(tangent);
 		#endif
 		#endif
 
 
 		gl_Position = modelViewProjectionMat * vec4(position, 1.0);
 		gl_Position = modelViewProjectionMat * vec4(position, 1.0);
@@ -104,17 +104,17 @@ void main()
 	// calculate the rest
 	// calculate the rest
 
 
 	#if NEEDS_TEX_MAPPING
 	#if NEEDS_TEX_MAPPING
-		texCoords_v2f = texCoords;
+		vTexCoords = texCoords;
 	#endif
 	#endif
 
 
 
 
 	#if NEEDS_TANGENT
 	#if NEEDS_TANGENT
-		w_v2f = tangent.w;
+		vTangentW = tangent.w;
 	#endif
 	#endif
 
 
 
 
 	#if defined(ENVIRONMENT_MAPPING) || defined(PARALLAX_MAPPING)
 	#if defined(ENVIRONMENT_MAPPING) || defined(PARALLAX_MAPPING)
-		vertPosEyeSpace_v2f = vec3(modelViewMat * vec4(position, 1.0));
+		vVertPosViewSpace = vec3(modelViewMat * vec4(position, 1.0));
 	#endif
 	#endif
 }
 }
 
 
@@ -152,11 +152,11 @@ uniform vec3 diffuseCol = vec3(1.0, 0.0, 1.0);
 uniform vec3 specularCol = vec3(1.0, 0.0, 1.0);
 uniform vec3 specularCol = vec3(1.0, 0.0, 1.0);
 uniform float shininess = 50.0;
 uniform float shininess = 50.0;
 
 
-varying vec3 normal_v2f;
-varying vec3 tangent_v2f;
-varying float w_v2f;
-varying vec2 texCoords_v2f;
-varying vec3 vertPosEyeSpace_v2f;
+varying vec3 vNormal;
+varying vec3 vTangent;
+varying float vTangentW;
+varying vec2 vTexCoords;
+varying vec3 vVertPosViewSpace;
 // @todo 
 // @todo 
 varying vec3 eye;
 varying vec3 eye;
 
 
@@ -177,16 +177,16 @@ void main()
 
 
 		vec3 _norm_eye = normalize(eye);
 		vec3 _norm_eye = normalize(eye);
 
 
-		float _h = texture2D(heightMap, texCoords_v2f).r;
+		float _h = texture2D(heightMap, vTexCoords).r;
 		float _height = _scale * _h - _bias;
 		float _height = _scale * _h - _bias;
 
 
-		vec2 superTexCoords_v2f = _height * _norm_eye.xy + texCoords_v2f;*/
+		vec2 superTexCoords_v2f = _height * _norm_eye.xy + vTexCoords;*/
 
 
-		vec2 superTexCoords = texCoords_v2f;
+		vec2 superTexCoords = vTexCoords;
 		const float maxStepCount = 100.0;
 		const float maxStepCount = 100.0;
 		float nSteps = maxStepCount * length(superTexCoords);
 		float nSteps = maxStepCount * length(superTexCoords);
 
 
-		vec3 dir = vertPosEyeSpace_v2f;
+		vec3 dir = vVertPosViewSpace;
 		dir.xy /= 8.0;
 		dir.xy /= 8.0;
 		dir /= -nSteps * dir.z;
 		dir /= -nSteps * dir.z;
 
 
@@ -204,7 +204,7 @@ void main()
 			superTexCoords.xy += (diff1 / (diff0 - diff1)) * dir.xy;
 			superTexCoords.xy += (diff1 / (diff0 - diff1)) * dir.xy;
 		}
 		}
 	#else
 	#else
-		#define superTexCoords texCoords_v2f
+		#define superTexCoords vTexCoords
 	#endif
 	#endif
 
 
 
 
@@ -235,9 +235,9 @@ void main()
 	 * Either use a normap map and make some calculations or use the vertex normal
 	 * Either use a normap map and make some calculations or use the vertex normal
 	 */
 	 */
 	#if defined(NORMAL_MAPPING)
 	#if defined(NORMAL_MAPPING)
-		vec3 _n = normalize(normal_v2f);
-		vec3 _t = normalize(tangent_v2f);
-		vec3 _b = cross(_n, _t) * w_v2f;
+		vec3 _n = normalize(vNormal);
+		vec3 _t = normalize(vTangent);
+		vec3 _b = cross(_n, _t) * vTangentW;
 
 
 		mat3 tbnMat = mat3(_t,_b,_n);
 		mat3 tbnMat = mat3(_t,_b,_n);
 
 
@@ -245,7 +245,7 @@ void main()
 
 
 		vec3 newNormal = normalize(tbnMat * nAtTangentspace);
 		vec3 newNormal = normalize(tbnMat * nAtTangentspace);
 	#else
 	#else
-		vec3 newNormal = normalize(normal_v2f);
+		vec3 newNormal = normalize(vNormal);
 	#endif
 	#endif
 
 
 
 
@@ -253,9 +253,9 @@ void main()
 	 * Diffuse Calculations (Part II)
 	 * Diffuse Calculations (Part II)
 	 * If SEM is enabled make some calculations and combine colors of SEM and the _diff_color
 	 * If SEM is enabled make some calculations and combine colors of SEM and the _diff_color
 	 */
 	 */
-	// if SEM enabled make some aditional calculations using the vertPosEyeSpace_v2f, environmentMap and the newNormal
+	// if SEM enabled make some aditional calculations using the vVertPosViewSpace, environmentMap and the newNormal
 	#if defined(ENVIRONMENT_MAPPING)
 	#if defined(ENVIRONMENT_MAPPING)
-		vec3 _u = normalize(vertPosEyeSpace_v2f);
+		vec3 _u = normalize(vVertPosViewSpace);
 		
 		
 		/*
 		/*
 		 * In case of normal mapping I could play with vertex's normal but this gives better results and its allready
 		 * In case of normal mapping I could play with vertex's normal but this gives better results and its allready

+ 20 - 77
shaders/PpsHdr.glsl

@@ -9,113 +9,56 @@
 
 
 #pragma anki fragShaderBegins
 #pragma anki fragShaderBegins
 
 
-#pragma anki include "shaders/median_filter.glsl"
-
+uniform sampler2D fai; ///< Its the IS FAI
 varying vec2 texCoords;
 varying vec2 texCoords;
 
 
-uniform sampler2D fai; ///< Its the IS FAI
 
 
 void main()
 void main()
 {
 {
-	//gl_FragData[0].rgb = texture2D( fai, texCoords).rgb;return;
+	//gl_FragData[0].rgb = texture2D(fai, texCoords).rgb;return;
 
 
-	/*if( texCoords.x*R_W > textureSize(fai,0).x/2 )
-		gl_FragData[0].rgb = vec3( 1, 0, 0 );
+	/*if(texCoords.x*R_W > textureSize(fai,0).x/2)
+		gl_FragData[0].rgb = vec3(1, 0, 0);
 	else
 	else
-		gl_FragData[0].rgb = vec3( 0, 1, 0 );
+		gl_FragData[0].rgb = vec3(0, 1, 0);
 	return;*/
 	return;*/
 
 
-	#if defined( _PPS_HDR_PASS_0_ ) || defined( _PPS_HDR_PASS_1_ )
-		vec3 color = texture2D( fai, texCoords ).rgb;
-		//float luminance = dot( vec3(0.30, 0.59, 0.11), color );
+	#if defined(_PPS_HDR_PASS_0_) || defined(_PPS_HDR_PASS_1_)
+		vec3 color = texture2D(fai, texCoords).rgb;
+		//float luminance = dot(vec3(0.30, 0.59, 0.11), color);
 
 
 		const float additionalOffset = 2.0;
 		const float additionalOffset = 2.0;
 
 
-		#if defined( _PPS_HDR_PASS_0_ )
+		#if defined(_PPS_HDR_PASS_0_)
 			const float offset = 1.0 / IS_FAI_WIDTH * additionalOffset;
 			const float offset = 1.0 / IS_FAI_WIDTH * additionalOffset;
 		#else
 		#else
 			const float offset = 1.0 / PASS0_HEIGHT * additionalOffset;
 			const float offset = 1.0 / PASS0_HEIGHT * additionalOffset;
 		#endif
 		#endif
 
 
 		const int SAMPLES_NUM = 6;
 		const int SAMPLES_NUM = 6;
-		const float kernel[] = float[]( -1.0 * offset, 1.0 * offset, -2.0 * offset, 2.0 * offset,
+		const float kernel[] = float[](-1.0 * offset, 1.0 * offset, -2.0 * offset, 2.0 * offset,
 				                            -3.0 * offset, 3.0 * offset, -4.0 * offset, 4.0 * offset,
 				                            -3.0 * offset, 3.0 * offset, -4.0 * offset, 4.0 * offset,
-				                            -5.0 * offset, 5.0 * offset, -6.0 * offset, 6.0 * offset );
-
-		for( int i=0; i<SAMPLES_NUM; i++ )
-		{
-			#if defined( _PPS_HDR_PASS_0_ )
-				color += texture2D( fai, texCoords + vec2(kernel[i], 0.0) ).rgb;
-			#else // _PPS_HDR_PASS_1_
-				color += texture2D( fai, texCoords + vec2(0.0, kernel[i]) ).rgb;
-			#endif
-		}
+				                            -5.0 * offset, 5.0 * offset, -6.0 * offset, 6.0 * offset);
 
 
-		const float denominator = 1.0 / (SAMPLES_NUM + 1); // Opt to make sure its const
-		gl_FragData[0].rgb = color * denominator;
-
-
-		/*vec3 color = texture2D( fai, texCoords ).rgb;
-		float luminance = dot( vec3(0.30, 0.59, 0.11), color );
 
 
-		const float maxAdditionalOffset = 1.0;
-		float additionalOffset = luminance * maxAdditionalOffset;
+		/*const float _offset_[3] = float[](0.0, 1.3846153846, 3.2307692308);
+		const float _weight_[3] = float[](0.2255859375, 0.314208984375, 0.06982421875);*/
 
 
-		#if defined( _PPS_HDR_PASS_0_ )
-			float offset = 1.0 / IS_FAI_WIDTH * additionalOffset;
-		#else
-			float offset = 1.0 / PASS0_HEIGHT * additionalOffset;
-		#endif
 
 
-		const int SAMPLES_NUM = 8;
-		float kernel[SAMPLES_NUM] = float[]( -3.0 * offset, -2.0 * offset, -1.0 * offset, 1.0 * offset, 2.0 * offset,
-				                                  3.0 * offset, -4.0 * offset, 4.0 * offset );
-
-		for( int i=0; i<SAMPLES_NUM; i++ )
+		for(int i=0; i<SAMPLES_NUM; i++)
 		{
 		{
-			#if defined( _PPS_HDR_PASS_0_ )
-				color += texture2D( fai, texCoords + vec2(kernel[i], 0.0) ).rgb;
+			#if defined(_PPS_HDR_PASS_0_)
+				color += texture2D(fai, texCoords + vec2(kernel[i], 0.0)).rgb;
 			#else // _PPS_HDR_PASS_1_
 			#else // _PPS_HDR_PASS_1_
-				color += texture2D( fai, texCoords + vec2(0.0, kernel[i]) ).rgb;
+				color += texture2D(fai, texCoords + vec2(0.0, kernel[i])).rgb;
 			#endif
 			#endif
 		}
 		}
 
 
 		const float denominator = 1.0 / (SAMPLES_NUM + 1); // Opt to make sure its const
 		const float denominator = 1.0 / (SAMPLES_NUM + 1); // Opt to make sure its const
-		gl_FragData[0].rgb = color * denominator;*/
-
-	/*	vec3 color = texture2D( fai, texCoords ).rgb;
-		float luminance = dot( vec3(0.30, 0.59, 0.11), color );
-
-		#if defined( _PPS_HDR_PASS_0_ )
-			const float OFFSET = 1.0 / IS_FAI_WIDTH;
-		#else
-			const float OFFSET = 1.0 / PASS0_HEIGHT;
-		#endif
-
-		const float MAX_SAMPLES_NUM = 50.0;
-		float samplesNum = MAX_SAMPLES_NUM * luminance;
-		float samplesNumDiv2 = samplesNum/2.0;
-
-		int i = 0;
-		for( float s=-samplesNumDiv2; s<=samplesNumDiv2; s += 1.0 )
-		{
-			++ i;
-			#if defined( _PPS_HDR_PASS_0_ )
-				color += texture2D( fai, texCoords + vec2( s * OFFSET, 0.0 ) ).rgb;
-			#else // _PPS_HDR_PASS_1_
-				color += texture2D( fai, texCoords + vec2( 0.0, s * OFFSET ) ).rgb;
-			#endif
-		}
-
-		gl_FragData[0].rgb = color / ( i + 1.0 );*/
-
-
-		//gl_FragData[0].rgb = vec3( dot( vec3(0.30, 0.59, 0.11), gl_FragData[0].rgb ) );
-
-
+		gl_FragData[0].rgb = color * denominator;
 	#else // _PPS_HDR_PASS_2_
 	#else // _PPS_HDR_PASS_2_
-		//vec3 color = MedianFilterRGB( fai, texCoords );
-		vec3 color = texture2D( fai, texCoords ).rgb;
+		//vec3 color = MedianFilterRGB(fai, texCoords);
+		vec3 color = texture2D(fai, texCoords).rgb;
 
 
 		float Y = dot(vec3(0.30, 0.59, 0.11), color); // AKA luminance
 		float Y = dot(vec3(0.30, 0.59, 0.11), color); // AKA luminance
 		const float exposure = 4.0;
 		const float exposure = 4.0;

+ 3 - 3
shaders/PpsSsao.glsl

@@ -5,7 +5,7 @@
 #pragma anki fragShaderBegins
 #pragma anki fragShaderBegins
 
 
 #pragma anki include "shaders/linear_depth.glsl"
 #pragma anki include "shaders/linear_depth.glsl"
-#pragma anki include "shaders/pack.glsl"
+#pragma anki include "shaders/Pack.glsl"
 
 
 uniform vec2 camerarange;  // = vec2( znear, zfar )
 uniform vec2 camerarange;  // = vec2( znear, zfar )
 uniform sampler2D msDepthFai;
 uniform sampler2D msDepthFai;
@@ -49,7 +49,7 @@ void main(void)
 	// current fragment coords in screen space
 	// current fragment coords in screen space
 	vec3 ep = vec3( texCoords.xy, currentPixelDepth );
 	vec3 ep = vec3( texCoords.xy, currentPixelDepth );
 	// get the normal of current fragment
 	// get the normal of current fragment
-	vec3 norm = UnpackNormal(currentPixelSample.xy);
+	vec3 norm = unpackNormal(currentPixelSample.xy);
 
 
 	float bl = 0.0;
 	float bl = 0.0;
 	// adjust for the depth ( not shure if this is good..)
 	// adjust for the depth ( not shure if this is good..)
@@ -70,7 +70,7 @@ void main(void)
 		vec4 occluderFragment = texture2D(msNormalFai,se.xy);
 		vec4 occluderFragment = texture2D(msNormalFai,se.xy);
 
 
 		// get the normal of the occluder fragment
 		// get the normal of the occluder fragment
-		occNorm = UnpackNormal(occluderFragment.xy);
+		occNorm = unpackNormal(occluderFragment.xy);
 
 
 		// if depthDifference is negative = occluder is behind current fragment
 		// if depthDifference is negative = occluder is behind current fragment
 		depthDifference = currentPixelDepth - ReadFromTexAndLinearizeDepth( msDepthFai, se.xy, camerarange.x, camerarange.y );;
 		depthDifference = currentPixelDepth - ReadFromTexAndLinearizeDepth( msDepthFai, se.xy, camerarange.x, camerarange.y );;

+ 6 - 3
src/Core/App.cpp

@@ -8,6 +8,7 @@
 #include "ScriptingEngine.h"
 #include "ScriptingEngine.h"
 #include "StdinListener.h"
 #include "StdinListener.h"
 
 
+
 bool App::isCreated = false;
 bool App::isCreated = false;
 
 
 
 
@@ -32,7 +33,6 @@ void App::parseCommandLineArgs(int argc, char* argv[])
 			FATAL("Incorrect command line argument \"" << arg << "\"");
 			FATAL("Incorrect command line argument \"" << arg << "\"");
 		}
 		}
 	}
 	}
-
 }
 }
 
 
 
 
@@ -76,11 +76,14 @@ App::App(int argc, char* argv[], Object* parent):
 
 
 	// create the subsystems. WATCH THE ORDER
 	// create the subsystems. WATCH THE ORDER
 	scriptingEngine = new ScriptingEngine(this);
 	scriptingEngine = new ScriptingEngine(this);
+	scriptingEngine->exposeVar("app", this);
+	scriptingEngine->execScript("from Anki import *");
 	mainRenderer = new MainRenderer(this);
 	mainRenderer = new MainRenderer(this);
 	scene = new Scene(this);
 	scene = new Scene(this);
 	stdinListener = new StdinListener(this);
 	stdinListener = new StdinListener(this);
-	activeCam = NULL;
 
 
+	// other
+	activeCam = NULL;
 	timerTick = 1000/40; // in ms. 1000/Hz
 	timerTick = 1000/40; // in ms. 1000/Hz
 	time = 0;
 	time = 0;
 }
 }
@@ -273,6 +276,6 @@ void App::execStdinScpripts()
 		if(cmd.length() < 1)
 		if(cmd.length() < 1)
 			break;
 			break;
 
 
-		app->getScriptingEngine().execScript(cmd.c_str());
+		app->getScriptingEngine().execScript(cmd.c_str(), "command line input");
 	}
 	}
 }
 }

+ 18 - 3
src/Core/App.h

@@ -10,6 +10,7 @@
 class ScriptingEngine;
 class ScriptingEngine;
 class StdinListener;
 class StdinListener;
 class Scene;
 class Scene;
+class MainRenderer;
 
 
 
 
 /**
 /**
@@ -23,7 +24,6 @@ class App: public Object
 	PROPERTY_R(filesystem::path, settingsPath, getSettingsPath)
 	PROPERTY_R(filesystem::path, settingsPath, getSettingsPath)
 	PROPERTY_R(filesystem::path, cachePath, getCachePath)
 	PROPERTY_R(filesystem::path, cachePath, getCachePath)
 
 
-	PROPERTY_RW(class MainRenderer*, mainRenderer, setMainRenderer, getMainRenderer) ///< Pointer to the main renderer
 	PROPERTY_RW(class Camera*, activeCam, setActiveCam, getActiveCam) ///< Pointer to the current camera
 	PROPERTY_RW(class Camera*, activeCam, setActiveCam, getActiveCam) ///< Pointer to the current camera
 
 
 	public:
 	public:
@@ -56,6 +56,7 @@ class App: public Object
 		Scene& getScene();
 		Scene& getScene();
 		ScriptingEngine& getScriptingEngine();
 		ScriptingEngine& getScriptingEngine();
 		StdinListener& getStdinLintener();
 		StdinListener& getStdinLintener();
+		MainRenderer& getMainRenderer();
 		/**@}*/
 		/**@}*/
 
 
 		/**
 		/**
@@ -66,14 +67,21 @@ class App: public Object
 	private:
 	private:
 		static bool isCreated; ///< A flag to ensure one @ref App instance
 		static bool isCreated; ///< A flag to ensure one @ref App instance
 		bool terminalColoringEnabled; ///< Terminal coloring for Unix terminals. Default on
 		bool terminalColoringEnabled; ///< Terminal coloring for Unix terminals. Default on
-		Scene* scene;
-		ScriptingEngine* scriptingEngine;
 		uint time;
 		uint time;
 		SDL_WindowID windowId;
 		SDL_WindowID windowId;
 		SDL_GLContext glContext;
 		SDL_GLContext glContext;
 		SDL_Surface* iconImage;
 		SDL_Surface* iconImage;
 		bool fullScreenFlag;
 		bool fullScreenFlag;
+
+		/**
+		 * @name Pointers to serious subsystems
+		 */
+		/**@{*/
+		Scene* scene;
+		ScriptingEngine* scriptingEngine;
+		MainRenderer* mainRenderer;
 		StdinListener* stdinListener;
 		StdinListener* stdinListener;
+		/**@}*/
 
 
 		void parseCommandLineArgs(int argc, char* argv[]);
 		void parseCommandLineArgs(int argc, char* argv[]);
 };
 };
@@ -106,4 +114,11 @@ inline StdinListener& App::getStdinLintener()
 }
 }
 
 
 
 
+inline MainRenderer& App::getMainRenderer()
+{
+	DEBUG_ERR(mainRenderer == NULL);
+	return *mainRenderer;
+}
+
+
 #endif
 #endif

+ 10 - 10
src/Main.cpp

@@ -135,11 +135,11 @@ void init()
 	initializer.pps.ssao.enabled = true;
 	initializer.pps.ssao.enabled = true;
 	initializer.pps.ssao.renderingQuality = 0.5;
 	initializer.pps.ssao.renderingQuality = 0.5;
 	initializer.mainRendererQuality = 1.0;
 	initializer.mainRendererQuality = 1.0;
-	app->getMainRenderer()->init(initializer);
+	app->getMainRenderer().init(initializer);
 	Ui::init();
 	Ui::init();
 
 
 	// camera
 	// camera
-	Camera* cam = new Camera(app->getMainRenderer()->getAspectRatio()*toRad(60.0), toRad(60.0), 0.5, 200.0);
+	Camera* cam = new Camera(app->getMainRenderer().getAspectRatio()*toRad(60.0), toRad(60.0), 0.5, 200.0);
 	cam->moveLocalY(3.0);
 	cam->moveLocalY(3.0);
 	cam->moveLocalZ(5.7);
 	cam->moveLocalZ(5.7);
 	cam->moveLocalX(-0.3);
 	cam->moveLocalX(-0.3);
@@ -315,7 +315,7 @@ void mainLoop()
 		app->getScene().updateAllControllers();
 		app->getScene().updateAllControllers();
 		app->getScene().updateAllWorldStuff();
 		app->getScene().updateAllWorldStuff();
 
 
-		app->getMainRenderer()->render(*app->getActiveCam());
+		app->getMainRenderer().render(*app->getActiveCam());
 
 
 		//map.octree.root->bounding_box.render();
 		//map.octree.root->bounding_box.render();
 
 
@@ -323,30 +323,30 @@ void mainLoop()
 		Ui::setColor(Vec4(1.0, 1.0, 1.0, 1.0));
 		Ui::setColor(Vec4(1.0, 1.0, 1.0, 1.0));
 		Ui::setPos(-0.98, 0.95);
 		Ui::setPos(-0.98, 0.95);
 		Ui::setFontWidth(0.03);
 		Ui::setFontWidth(0.03);
-		//Ui::printf("frame:%d fps:%dms\n", app->getMainRenderer()->getFramesNum(), (App::getTicks()-ticks_));
+		//Ui::printf("frame:%d fps:%dms\n", app->getMainRenderer().getFramesNum(), (App::getTicks()-ticks_));
 		//Ui::print("Movement keys: arrows,w,a,s,d,q,e,shift,space\nSelect objects: keys 1 to 5\n");
 		//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,
 		/*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));*/
 								 toDegrees(Euler(mover->rotationWspace).x), toDegrees(Euler(mover->rotationWspace).y), toDegrees(Euler(mover->rotationWspace).z));*/
 
 
 		if(I::keys[SDL_SCANCODE_ESCAPE]) break;
 		if(I::keys[SDL_SCANCODE_ESCAPE]) break;
 		if(I::keys[SDL_SCANCODE_F11]) app->togleFullScreen();
 		if(I::keys[SDL_SCANCODE_F11]) app->togleFullScreen();
-		if(I::keys[SDL_SCANCODE_F12] == 1)  app->getMainRenderer()->takeScreenshot("gfx/screenshot.jpg");
+		if(I::keys[SDL_SCANCODE_F12] == 1)  app->getMainRenderer().takeScreenshot("gfx/screenshot.jpg");
 
 
 		/*char str[128];
 		/*char str[128];
 		static string scrFile = (app->getSettingsPath() / "capt" / "%06d.jpg").string();
 		static string scrFile = (app->getSettingsPath() / "capt" / "%06d.jpg").string();
-		sprintf(str, scrFile.c_str(), app->getMainRenderer()->getFramesNum());
-		app->getMainRenderer()->takeScreenshot(str);*/
+		sprintf(str, scrFile.c_str(), app->getMainRenderer().getFramesNum());
+		app->getMainRenderer().takeScreenshot(str);*/
 
 
 		// std stuff follow
 		// std stuff follow
 		app->swapBuffers();
 		app->swapBuffers();
 		GL_OK();
 		GL_OK();
-		if(1)
+		if(0)
 		{
 		{
-			//if(R::framesNum == 10) R::takeScreenshot("gfx/screenshot.tga");
+			if(app->getMainRenderer().getFramesNum() == 100) app->getMainRenderer().takeScreenshot("gfx/screenshot.tga");
 			app->waitForNextFrame();
 			app->waitForNextFrame();
 		}
 		}
 		else
 		else
-			if(app->getMainRenderer()->getFramesNum() == 5000) break;
+			if(app->getMainRenderer().getFramesNum() == 5000) break;
 	}while(true);
 	}while(true);
 
 
 	INFO("Exiting main loop (" << App::getTicks()-ticks << ")");
 	INFO("Exiting main loop (" << App::getTicks()-ticks << ")");

+ 1 - 1
src/Misc/skybox.cpp

@@ -69,7 +69,7 @@ void Skybox::Render(const Mat3& rotation)
 	// set the rotation matrix
 	// set the rotation matrix
 	Mat3 tmp(rotation);
 	Mat3 tmp(rotation);
 	tmp.rotateYAxis(rotation_ang);
 	tmp.rotateYAxis(rotation_ang);
-	app->getMainRenderer()->loadMatrix(Mat4(tmp));
+	app->getMainRenderer().loadMatrix(Mat4(tmp));
 
 
 	rotation_ang += 0.0001;
 	rotation_ang += 0.0001;
 	if(rotation_ang >= 2*PI) rotation_ang = 0.0;
 	if(rotation_ang >= 2*PI) rotation_ang = 0.0;

+ 2 - 3
src/Renderer/Hdr.cpp

@@ -25,9 +25,8 @@ void Renderer::Pps::Hdr::initFbos(Fbo& fbo, Texture& fai, int internalFormat)
 
 
 	// create the texes
 	// create the texes
 	fai.createEmpty2D(width, height, internalFormat, GL_RGB, GL_FLOAT);
 	fai.createEmpty2D(width, height, internalFormat, GL_RGB, GL_FLOAT);
-	fai.setTexParameter(GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-	//fai_.setTexParameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-	fai.setTexParameter(GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	fai.setTexParameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+	fai.setTexParameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 
 
 	// attach
 	// attach
 	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fai.getGlId(), 0);
 	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fai.getGlId(), 0);

+ 5 - 5
src/Renderer/Is.cpp

@@ -116,7 +116,7 @@ void Renderer::Is::init()
 	pointLightSProgUniVars.msDepthFai = pointLightSProg->findUniVar("msDepthFai");
 	pointLightSProgUniVars.msDepthFai = pointLightSProg->findUniVar("msDepthFai");
 	pointLightSProgUniVars.planes = pointLightSProg->findUniVar("planes");
 	pointLightSProgUniVars.planes = pointLightSProg->findUniVar("planes");
 	pointLightSProgUniVars.lightPos = pointLightSProg->findUniVar("lightPos");
 	pointLightSProgUniVars.lightPos = pointLightSProg->findUniVar("lightPos");
-	pointLightSProgUniVars.lightInvRadius = pointLightSProg->findUniVar("lightInvRadius");
+	pointLightSProgUniVars.lightRadius = pointLightSProg->findUniVar("lightRadius");
 	pointLightSProgUniVars.lightDiffuseCol = pointLightSProg->findUniVar("lightDiffuseCol");
 	pointLightSProgUniVars.lightDiffuseCol = pointLightSProg->findUniVar("lightDiffuseCol");
 	pointLightSProgUniVars.lightSpecularCol = pointLightSProg->findUniVar("lightSpecularCol");
 	pointLightSProgUniVars.lightSpecularCol = pointLightSProg->findUniVar("lightSpecularCol");
 
 
@@ -131,7 +131,7 @@ void Renderer::Is::init()
 	spotLightNoShadowSProgUniVars.msDepthFai = spotLightNoShadowSProg->findUniVar("msDepthFai");
 	spotLightNoShadowSProgUniVars.msDepthFai = spotLightNoShadowSProg->findUniVar("msDepthFai");
 	spotLightNoShadowSProgUniVars.planes = spotLightNoShadowSProg->findUniVar("planes");
 	spotLightNoShadowSProgUniVars.planes = spotLightNoShadowSProg->findUniVar("planes");
 	spotLightNoShadowSProgUniVars.lightPos = spotLightNoShadowSProg->findUniVar("lightPos");
 	spotLightNoShadowSProgUniVars.lightPos = spotLightNoShadowSProg->findUniVar("lightPos");
-	spotLightNoShadowSProgUniVars.lightInvRadius = spotLightNoShadowSProg->findUniVar("lightInvRadius");
+	spotLightNoShadowSProgUniVars.lightRadius = spotLightNoShadowSProg->findUniVar("lightRadius");
 	spotLightNoShadowSProgUniVars.lightDiffuseCol = spotLightNoShadowSProg->findUniVar("lightDiffuseCol");
 	spotLightNoShadowSProgUniVars.lightDiffuseCol = spotLightNoShadowSProg->findUniVar("lightDiffuseCol");
 	spotLightNoShadowSProgUniVars.lightSpecularCol = spotLightNoShadowSProg->findUniVar("lightSpecularCol");
 	spotLightNoShadowSProgUniVars.lightSpecularCol = spotLightNoShadowSProg->findUniVar("lightSpecularCol");
 	spotLightNoShadowSProgUniVars.lightTex = spotLightNoShadowSProg->findUniVar("lightTex");
 	spotLightNoShadowSProgUniVars.lightTex = spotLightNoShadowSProg->findUniVar("lightTex");
@@ -155,7 +155,7 @@ void Renderer::Is::init()
 	spotLightShadowSProgUniVars.msDepthFai = spotLightShadowSProg->findUniVar("msDepthFai");
 	spotLightShadowSProgUniVars.msDepthFai = spotLightShadowSProg->findUniVar("msDepthFai");
 	spotLightShadowSProgUniVars.planes = spotLightShadowSProg->findUniVar("planes");
 	spotLightShadowSProgUniVars.planes = spotLightShadowSProg->findUniVar("planes");
 	spotLightShadowSProgUniVars.lightPos = spotLightShadowSProg->findUniVar("lightPos");
 	spotLightShadowSProgUniVars.lightPos = spotLightShadowSProg->findUniVar("lightPos");
-	spotLightShadowSProgUniVars.lightInvRadius = spotLightShadowSProg->findUniVar("lightInvRadius");
+	spotLightShadowSProgUniVars.lightRadius = spotLightShadowSProg->findUniVar("lightRadius");
 	spotLightShadowSProgUniVars.lightDiffuseCol = spotLightShadowSProg->findUniVar("lightDiffuseCol");
 	spotLightShadowSProgUniVars.lightDiffuseCol = spotLightShadowSProg->findUniVar("lightDiffuseCol");
 	spotLightShadowSProgUniVars.lightSpecularCol = spotLightShadowSProg->findUniVar("lightSpecularCol");
 	spotLightShadowSProgUniVars.lightSpecularCol = spotLightShadowSProg->findUniVar("lightSpecularCol");
 	spotLightShadowSProgUniVars.lightTex = spotLightShadowSProg->findUniVar("lightTex");
 	spotLightShadowSProgUniVars.lightTex = spotLightShadowSProg->findUniVar("lightTex");
@@ -216,7 +216,7 @@ void Renderer::Is::pointLightPass(const PointLight& light)
 	pointLightSProgUniVars.planes->setVec2(&planes);
 	pointLightSProgUniVars.planes->setVec2(&planes);
 	Vec3 lightPosEyeSpace = light.getWorldTransform().getOrigin().getTransformed(cam.getViewMatrix());
 	Vec3 lightPosEyeSpace = light.getWorldTransform().getOrigin().getTransformed(cam.getViewMatrix());
 	pointLightSProgUniVars.lightPos->setVec3(&lightPosEyeSpace);
 	pointLightSProgUniVars.lightPos->setVec3(&lightPosEyeSpace);
-	pointLightSProgUniVars.lightInvRadius->setFloat(1.0/light.getRadius());
+	pointLightSProgUniVars.lightRadius->setFloat(1.0/light.getRadius());
 	Vec3 ll = light.lightProps->getDiffuseColor();
 	Vec3 ll = light.lightProps->getDiffuseColor();
 	pointLightSProgUniVars.lightDiffuseCol->setVec3(&light.lightProps->getDiffuseColor());
 	pointLightSProgUniVars.lightDiffuseCol->setVec3(&light.lightProps->getDiffuseColor());
 	pointLightSProgUniVars.lightSpecularCol->setVec3(&light.lightProps->getSpecularColor());
 	pointLightSProgUniVars.lightSpecularCol->setVec3(&light.lightProps->getSpecularColor());
@@ -302,7 +302,7 @@ void Renderer::Is::spotLightPass(const SpotLight& light)
 	// the light params
 	// the light params
 	Vec3 lightPosEyeSpace = light.getWorldTransform().getOrigin().getTransformed(cam.getViewMatrix());
 	Vec3 lightPosEyeSpace = light.getWorldTransform().getOrigin().getTransformed(cam.getViewMatrix());
 	uniVars->lightPos->setVec3(&lightPosEyeSpace);
 	uniVars->lightPos->setVec3(&lightPosEyeSpace);
-	uniVars->lightInvRadius->setFloat(1.0/light.getDistance());
+	uniVars->lightRadius->setFloat(light.getDistance());
 	uniVars->lightDiffuseCol->setVec3(&light.lightProps->getDiffuseColor());
 	uniVars->lightDiffuseCol->setVec3(&light.lightProps->getDiffuseColor());
 	uniVars->lightSpecularCol->setVec3(&light.lightProps->getSpecularColor());
 	uniVars->lightSpecularCol->setVec3(&light.lightProps->getSpecularColor());
 	uniVars->lightTex->setTexture(*light.lightProps->getTexture(), 4);
 	uniVars->lightTex->setTexture(*light.lightProps->getTexture(), 4);

+ 2 - 2
src/Renderer/MainRenderer.cpp

@@ -86,8 +86,8 @@ void MainRenderer::render(Camera& cam_)
 	glDisable(GL_DEPTH_TEST);
 	glDisable(GL_DEPTH_TEST);
 	glDisable(GL_BLEND);
 	glDisable(GL_BLEND);
 	sProg->bind();
 	sProg->bind();
-	//sProg->findUniVar("rasterImage")->setTexture(is.fai, 0);
-	sProg->findUniVar("rasterImage")->setTexture(pps.postPassFai, 0);
+	sProg->findUniVar("rasterImage")->setTexture(pps.hdr.pass0Fai, 0);
+	//sProg->findUniVar("rasterImage")->setTexture(pps.postPassFai, 0);
 	drawQuad(0);
 	drawQuad(0);
 }
 }
 
 

+ 2 - 0
src/Renderer/Pps.cpp

@@ -125,6 +125,8 @@ void Renderer::Pps::runPrePass()
 	Renderer::drawQuad(0);
 	Renderer::drawQuad(0);
 
 
 	Fbo::unbind();
 	Fbo::unbind();
+
+	prePassFai.genMipmap();
 }
 }
 
 
 
 

+ 1 - 0
src/Renderer/Renderer.cpp

@@ -49,6 +49,7 @@ void Renderer::init(const RendererInitializer& initializer)
 	height = initializer.height;
 	height = initializer.height;
 
 
 	aspectRatio = float(width)/height;
 	aspectRatio = float(width)/height;
+	framesNum = 0;
 
 
 	// a few sanity checks
 	// a few sanity checks
 	if(width < 10 || height < 10)
 	if(width < 10 || height < 10)

+ 1 - 1
src/Renderer/Renderer.h

@@ -156,7 +156,7 @@ class Renderer: public Object
 					const ShaderProg::UniVar* msDepthFai;
 					const ShaderProg::UniVar* msDepthFai;
 					const ShaderProg::UniVar* planes;
 					const ShaderProg::UniVar* planes;
 					const ShaderProg::UniVar* lightPos;
 					const ShaderProg::UniVar* lightPos;
-					const ShaderProg::UniVar* lightInvRadius;
+					const ShaderProg::UniVar* lightRadius;
 					const ShaderProg::UniVar* lightDiffuseCol;
 					const ShaderProg::UniVar* lightDiffuseCol;
 					const ShaderProg::UniVar* lightSpecularCol;
 					const ShaderProg::UniVar* lightSpecularCol;
 					const ShaderProg::UniVar* lightTex;
 					const ShaderProg::UniVar* lightTex;

+ 2 - 2
src/Resources/Helpers/ShaderPrePreprocessor.cpp

@@ -57,7 +57,7 @@ bool ShaderPrePreprocessor::parseFileForPragmas(const string& filename, int dept
 	// first check the depth
 	// first check the depth
 	if(depth > 99)
 	if(depth > 99)
 	{
 	{
-		ERROR("The include depth is too high. Probably circular includance (Im in file \"" << filename << "\")");
+		ERROR("File \"" << filename << "\": The include depth is too high. Probably circular includance");
 		return false;
 		return false;
 	}
 	}
 
 
@@ -65,7 +65,7 @@ bool ShaderPrePreprocessor::parseFileForPragmas(const string& filename, int dept
 	Vec<string> lines = Util::getFileLines(filename.c_str());
 	Vec<string> lines = Util::getFileLines(filename.c_str());
 	if(lines.size() < 1)
 	if(lines.size() < 1)
 	{
 	{
-		ERROR("Cannot parse file \"" << filename << "\"");
+		ERROR("File \"" << filename << "\": Cannot open or empty");
 		return false;
 		return false;
 	}
 	}
 
 

+ 10 - 3
src/Resources/Texture.cpp

@@ -99,9 +99,6 @@ bool Texture::load(const char* filename)
 	if(mipmappingEnabled)
 	if(mipmappingEnabled)
 		glGenerateMipmap(target);
 		glGenerateMipmap(target);
 
 
-
-	setMipmapLevel(3);
-
 	return GL_OK();
 	return GL_OK();
 }
 }
 
 
@@ -292,3 +289,13 @@ void Texture::setMipmapLevel(uint level)
 	bind(LAST_TEX_UNIT);
 	bind(LAST_TEX_UNIT);
 	setTexParameter(GL_TEXTURE_BASE_LEVEL, int(level));
 	setTexParameter(GL_TEXTURE_BASE_LEVEL, int(level));
 }
 }
+
+
+//======================================================================================================================
+// genMipmap                                                                                                           =
+//======================================================================================================================
+void Texture::genMipmap()
+{
+	bind(LAST_TEX_UNIT);
+	glGenerateMipmap(target);
+}

+ 1 - 0
src/Resources/Texture.h

@@ -40,6 +40,7 @@ class Texture: public Resource
 		void setTexParameter(uint paramName, float value) const;
 		void setTexParameter(uint paramName, float value) const;
 		void setAnisotropy(uint level);
 		void setAnisotropy(uint level);
 		void setMipmapLevel(uint level);
 		void setMipmapLevel(uint level);
+		void genMipmap();
 		int getWidth() const;
 		int getWidth() const;
 		int getHeight() const;
 		int getHeight() const;
 		int getBaseLevel() const;
 		int getBaseLevel() const;

+ 1 - 1
src/Scene/Controllers/SkelAnimCtrl.cpp

@@ -162,6 +162,6 @@ void SkelAnimCtrl::update(float)
 
 
 	interpolate(*skelAnim, frame);
 	interpolate(*skelAnim, frame);
 	updateBoneTransforms();
 	updateBoneTransforms();
-	if(app->getMainRenderer()->dbg.isShowSkeletonsEnabled())
+	if(app->getMainRenderer().dbg.isShowSkeletonsEnabled())
 		deform();
 		deform();
 }
 }

+ 2 - 2
src/Ui/Ui.cpp

@@ -55,7 +55,7 @@ static void SetGL()
 
 
 	glMatrixMode(GL_PROJECTION);
 	glMatrixMode(GL_PROJECTION);
 	glPushMatrix();
 	glPushMatrix();
-	app->getMainRenderer()->loadMatrix(Renderer::ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0));
+	app->getMainRenderer().loadMatrix(Renderer::ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0));
 
 
 	glMatrixMode(GL_MODELVIEW);
 	glMatrixMode(GL_MODELVIEW);
 	glPushMatrix();
 	glPushMatrix();
@@ -179,7 +179,7 @@ void setFontWidth(float w_)
 	// width
 	// width
 	fontW = w_;
 	fontW = w_;
 	// height
 	// height
-	fontH = fontW * app->getMainRenderer()->getAspectRatio();
+	fontH = fontW * app->getMainRenderer().getAspectRatio();
 }
 }