]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix wateralpha
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 18 Jan 2011 08:51:05 +0000 (08:51 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 18 Jan 2011 08:51:05 +0000 (08:51 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10708 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 010818f5481cd7d9b5cca2331bd6457781a41163..e8f90ad3409b30195abb942a383cc87be8d0c495 100644 (file)
@@ -5392,8 +5392,18 @@ void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting,
                        mode = SHADERMODE_WATER;
                        if (rsurface.texture->r_water_waterscroll[0] && rsurface.texture->r_water_waterscroll[1])
                                permutation |= SHADERPERMUTATION_NORMALMAPSCROLLBLEND;
-                       GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-                       allow_colormod = R_BlendFuncAllowsColormod(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+                       if((r_wateralpha.value < 1) && (rsurface.texture->currentmaterialflags & MATERIALFLAG_WATERALPHA))
+                       {
+                               // this is the right thing to do for wateralpha
+                               GL_BlendFunc(GL_ONE, GL_ZERO);
+                               allow_colormod = R_BlendFuncAllowsColormod(GL_ONE, GL_ZERO);
+                       }
+                       else
+                       {
+                               // this is the right thing to do for entity alpha
+                               GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+                               allow_colormod = R_BlendFuncAllowsColormod(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+                       }
                }
                else if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFRACTION)
                {