소스 검색

Adding a new value in the shaders

Panagiotis Christopoulos Charitos 14 년 전
부모
커밋
58d5ed789d
8개의 변경된 파일17개의 추가작업 그리고 13개의 파일을 삭제
  1. 0 1
      build/debug/Makefile
  2. 0 1
      build/release/Makefile
  3. 1 1
      build/release/gen.cfg.py
  4. 2 1
      shaders/DpGeneric.glsl
  5. 7 2
      shaders/MsMpGeneric.glsl
  6. 4 4
      src/Core/App.cpp
  7. 2 2
      src/Resources/Material/Material.cpp
  8. 1 1
      src/Resources/Texture/Texture.cpp

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
build/debug/Makefile


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
build/release/Makefile


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

@@ -9,6 +9,6 @@ executableName = "anki"
 
 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"

+ 2 - 1
shaders/DpGeneric.glsl

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

+ 7 - 2
shaders/MsMpGeneric.glsl

@@ -118,9 +118,12 @@ void main()
 #if defined(ENVIRONMENT_MAPPING)
 	uniform sampler2D environmentMap;
 #endif
+uniform float shininess = 50.0;
 uniform vec3 diffuseCol = 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 vTangent;
@@ -190,8 +193,10 @@ void main()
 
 		#if defined(ALPHA_TESTING)
 			vec4 _diffCol4_ = texture2D(diffuseMap, _superTexCoords_);
-			if(_diffCol4_.a == 0.0)
+			if(_diffCol4_.a < alphaTestingTolerance)
+			{
 				discard;
+			}
 			_diffColl_ = _diffCol4_.rgb;
 		#else // no alpha
 			_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.exposure = 4.0;
 	initializer.pps.ssao.blurringIterationsNum = 2;
-	initializer.pps.ssao.enabled = false;
+	initializer.pps.ssao.enabled = true;
 	initializer.pps.ssao.renderingQuality = 0.5;
 	initializer.mainRendererQuality = 1.0;
 	MainRendererSingleton::getInstance().init(initializer);
@@ -265,11 +265,11 @@ void App::quit(int code)
 void App::printAppInfo()
 {
 	std::stringstream msg;
-	msg << "App info: NDEBUG ";
+	msg << "App info: Build: ";
 	#if defined(NDEBUG)
-		msg << "on, ";
+		msg << "release, ";
 	#else
-		msg << "off, ";
+		msg << "debug, ";
 	#endif
 	msg << "platform ";
 	#if defined(PLATFORM_LINUX)

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

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

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

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

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.