]> git.xonotic.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)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 20 Jan 2011 06:37:30 +0000 (07:37 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10708 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=0ae75d25abe8396429aa8c6bfe7521090e36527f

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)
                {