Parcourir la source

Merge pull request #606 from seanpaultaylor/next

Adds a simple BillboardTest with back to front object sorting and visibi...
Sean Paul Taylor il y a 13 ans
Parent
commit
17494153dd

+ 9 - 5
gameplay/res/shaders/textured-bumped.frag

@@ -56,13 +56,17 @@ void main()
 
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
+    #if defined(TEXTURE_DISCARD_ALPHA)
+    if (gl_FragColor.a < 0.5)
+        discard;
+    #endif
     gl_FragColor.rgb = getLitPixel();
 
-	// Global color modulation
-	#if defined(MODULATE_COLOR)
-	gl_FragColor *= u_modulateColor;
-	#endif
-	#if defined(MODULATE_ALPHA)
+    // Global color modulation
+    #if defined(MODULATE_COLOR)
+    gl_FragColor *= u_modulateColor;
+    #endif
+    #if defined(MODULATE_ALPHA)
     gl_FragColor.a *= u_modulateAlpha;
     #endif
 }

+ 11 - 7
gameplay/res/shaders/textured-unlit.frag

@@ -25,19 +25,23 @@ void main()
 {
     // Sample the texture for the color
     gl_FragColor = texture2D(u_diffuseTexture, v_texCoord0);
-	#if defined(TEXTURE_LIGHTMAP)
+    #if defined(TEXTURE_DISCARD_ALPHA)
+    if (gl_FragColor.a < 0.5)
+        discard;
+    #endif
+    #if defined(TEXTURE_LIGHTMAP)
     #if defined(TEXCOORD1)
     vec4 lightColor = texture2D(u_lightmapTexture, v_texCoord1);
     #else
     vec4 lightColor = texture2D(u_lightmapTexture, v_texCoord0);
     #endif
     gl_FragColor.rgb *= lightColor.rgb;
-	#endif
-	// Global color modulation
-	#if defined(MODULATE_COLOR)
-	gl_FragColor *= u_modulateColor;
-	#endif
-	#if defined(MODULATE_ALPHA)
+    #endif
+    // Global color modulation
+    #if defined(MODULATE_COLOR)
+    gl_FragColor *= u_modulateColor;
+    #endif
+    #if defined(MODULATE_ALPHA)
     gl_FragColor.a *= u_modulateAlpha;
     #endif
 }

+ 4 - 0
gameplay/res/shaders/textured.frag

@@ -55,6 +55,10 @@ void main()
 
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
+    #if defined(TEXTURE_DISCARD_ALPHA)
+    if (gl_FragColor.a < 0.5)
+        discard;
+    #endif
     gl_FragColor.rgb = getLitPixel();
 	
 	// Global color modulation