From 0ae75d25abe8396429aa8c6bfe7521090e36527f Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 18 Jan 2011 08:51:05 +0000 Subject: [PATCH] fix wateralpha git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10708 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 010818f5..e8f90ad3 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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) { -- 2.39.2