Browse Source

Adding a new value in the shaders

Panagiotis Christopoulos Charitos 14 years ago
parent
commit
58d5ed789d

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


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


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

@@ -9,6 +9,6 @@ executableName = "anki"
 
 
 compiler = "g++-4.5"
 compiler = "g++-4.5"
 
 
-compilerFlags = "-DDEBUG_ENABLED=0 -DPLATFORM_LINUX -DMATH_INTEL_SIMD -DNDEBUG -DBOOST_DISABLE_ASSERTS -DREVISION=\\\"`svnversion -c ../..`\\\" -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -fsingle-precision-constant -msse4 -O3 -mtune=core2 -ffast-math -flto"
+compilerFlags = "-DPLATFORM_LINUX -DMATH_INTEL_SIMD -DNDEBUG -DBOOST_DISABLE_ASSERTS -DREVISION=\\\"`svnversion -c ../..`\\\" -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -fsingle-precision-constant -msse4 -O3 -mtune=core2 -ffast-math -flto"
 
 
 linkerFlags = "-rdynamic -flto -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"
 linkerFlags = "-rdynamic -flto -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 - 1
shaders/DpGeneric.glsl

@@ -25,13 +25,14 @@ void main()
 
 
 #if defined(ALPHA_TESTING)
 #if defined(ALPHA_TESTING)
 	uniform sampler2D diffuseMap;
 	uniform sampler2D diffuseMap;
+	uniform float alphaTestingTolerance = 0.5; ///< Below this value the pixels are getting discarded 
 	in vec2 vTexCoords;
 	in vec2 vTexCoords;
 #endif
 #endif
 
 
 void main()
 void main()
 {
 {
 	#if defined(ALPHA_TESTING)
 	#if defined(ALPHA_TESTING)
-		if(texture2D(diffuseMap, vTexCoords).a == 0.0)
+		if(texture2D(diffuseMap, vTexCoords).a < alphaTestingTolerance)
 		{
 		{
 			discard;
 			discard;
 		}
 		}

+ 7 - 2
shaders/MsMpGeneric.glsl

@@ -118,9 +118,12 @@ void main()
 #if defined(ENVIRONMENT_MAPPING)
 #if defined(ENVIRONMENT_MAPPING)
 	uniform sampler2D environmentMap;
 	uniform sampler2D environmentMap;
 #endif
 #endif
+uniform float shininess = 50.0;
 uniform vec3 diffuseCol = vec3(1.0, 0.0, 1.0);
 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;
+#if defined(ALPHA_TESTING)
+	uniform float alphaTestingTolerance = 0.5; ///< Below this value the pixels are getting discarded 
+#endif
 
 
 in vec3 vNormal;
 in vec3 vNormal;
 in vec3 vTangent;
 in vec3 vTangent;
@@ -190,8 +193,10 @@ void main()
 
 
 		#if defined(ALPHA_TESTING)
 		#if defined(ALPHA_TESTING)
 			vec4 _diffCol4_ = texture2D(diffuseMap, _superTexCoords_);
 			vec4 _diffCol4_ = texture2D(diffuseMap, _superTexCoords_);
-			if(_diffCol4_.a == 0.0)
+			if(_diffCol4_.a < alphaTestingTolerance)
+			{
 				discard;
 				discard;
+			}
 			_diffColl_ = _diffCol4_.rgb;
 			_diffColl_ = _diffCol4_.rgb;
 		#else // no alpha
 		#else // no alpha
 			_diffColl_ = texture2D(diffuseMap, _superTexCoords_).rgb;
 			_diffColl_ = texture2D(diffuseMap, _superTexCoords_).rgb;

+ 4 - 4
src/Core/App.cpp

@@ -214,7 +214,7 @@ void App::initRenderer()
 	initializer.pps.hdr.blurringIterationsNum = 2;
 	initializer.pps.hdr.blurringIterationsNum = 2;
 	initializer.pps.hdr.exposure = 4.0;
 	initializer.pps.hdr.exposure = 4.0;
 	initializer.pps.ssao.blurringIterationsNum = 2;
 	initializer.pps.ssao.blurringIterationsNum = 2;
-	initializer.pps.ssao.enabled = false;
+	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;
 	MainRendererSingleton::getInstance().init(initializer);
 	MainRendererSingleton::getInstance().init(initializer);
@@ -265,11 +265,11 @@ void App::quit(int code)
 void App::printAppInfo()
 void App::printAppInfo()
 {
 {
 	std::stringstream msg;
 	std::stringstream msg;
-	msg << "App info: NDEBUG ";
+	msg << "App info: Build: ";
 	#if defined(NDEBUG)
 	#if defined(NDEBUG)
-		msg << "on, ";
+		msg << "release, ";
 	#else
 	#else
-		msg << "off, ";
+		msg << "debug, ";
 	#endif
 	#endif
 	msg << "platform ";
 	msg << "platform ";
 	#if defined(PLATFORM_LINUX)
 	#if defined(PLATFORM_LINUX)

+ 2 - 2
src/Resources/Material/Material.cpp

@@ -50,13 +50,13 @@ Material::PreprocDefines Material::msGenericDefines[] =
 	{"PARALLAX_MAPPING", 'p'},
 	{"PARALLAX_MAPPING", 'p'},
 	{"ENVIRONMENT_MAPPING", 'e'},
 	{"ENVIRONMENT_MAPPING", 'e'},
 	{"ALPHA_TESTING", 'a'},
 	{"ALPHA_TESTING", 'a'},
-	{NULL, NULL}
+	{0, 0}
 };
 };
 
 
 Material::PreprocDefines Material::dpGenericDefines[] =
 Material::PreprocDefines Material::dpGenericDefines[] =
 {
 {
 	{"ALPHA_TESTING", 'a'},
 	{"ALPHA_TESTING", 'a'},
-	{NULL, NULL}
+	{0, 0}
 };
 };
 
 
 
 

+ 1 - 1
src/Resources/Texture/Texture.cpp

@@ -14,7 +14,7 @@
 //======================================================================================================================
 //======================================================================================================================
 int Texture::textureUnitsNum = -1;
 int Texture::textureUnitsNum = -1;
 bool Texture::mipmappingEnabled = true;
 bool Texture::mipmappingEnabled = true;
-bool Texture::compressionEnabled = false;
+bool Texture::compressionEnabled = true;
 int Texture::anisotropyLevel = 8;
 int Texture::anisotropyLevel = 8;
 
 
 
 

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