]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
set TEXF_ALPHA on shader stages only if necessary
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 29 Aug 2011 20:20:38 +0000 (20:20 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 29 Aug 2011 20:20:38 +0000 (20:20 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11310 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index 8a27c672446216e335e302f6e29343e346f257c0..81a669e31bef1bf5e97e5791754dc7ad9d324623 100644 (file)
@@ -1969,7 +1969,23 @@ void Mod_LoadQ3Shaders(void)
                                                        shader.textureblendalpha = true;
                                                }
                                        }
-                                       layer->texflags = TEXF_ALPHA;
+                                       layer->texflags = 0;
+                                       if (layer->alphatest)
+                                               layer->texflags |= TEXF_ALPHA;
+                                       switch(layer->blendfunc[0])
+                                       {
+                                               case GL_SRC_ALPHA:
+                                               case GL_ONE_MINUS_SRC_ALPHA:
+                                                       layer->texflags |= TEXF_ALPHA;
+                                                       break;
+                                       }
+                                       switch(layer->blendfunc[1])
+                                       {
+                                               case GL_SRC_ALPHA:
+                                               case GL_ONE_MINUS_SRC_ALPHA:
+                                                       layer->texflags |= TEXF_ALPHA;
+                                                       break;
+                                       }
                                        if (!(shader.surfaceparms & Q3SURFACEPARM_NOMIPMAPS))
                                                layer->texflags |= TEXF_MIPMAP;
                                        if (!(shader.textureflags & Q3TEXTUREFLAG_NOPICMIP))