]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
allow MATERIALFLAG_CAMERA to fade out
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 10 Mar 2012 12:39:29 +0000 (12:39 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 10 Mar 2012 13:06:21 +0000 (14:06 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11752 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=a88e0e48a46d64181a5891114d0ebb19e1424a9f

dpsoftrast.h
gl_rmain.c
shader_glsl.h
shader_hlsl.h

index 69228ef86cdad0318ebdc5ce3987a46ecc66d7f5..eb3df2bae40d5c10b60c8dbdbad305e1eba87515 100644 (file)
@@ -188,7 +188,7 @@ typedef enum shaderpermutation_e
        SHADERPERMUTATION_SHADOWMAPVSDCT = 1<<19, ///< (lightsource) use virtual shadow depth cube texture for shadowmap indexing
        SHADERPERMUTATION_SHADOWMAPORTHO = 1<<20, ///< (lightsource) use orthographic shadowmap projection
        SHADERPERMUTATION_DEFERREDLIGHTMAP = 1<<21, ///< (lightmap) read Texture_ScreenDiffuse/Specular textures and add them on top of lightmapping
-       SHADERPERMUTATION_ALPHAKILL = 1<<22, ///< (deferredgeometry) discard pixel if diffuse texture alpha below 0.5
+       SHADERPERMUTATION_ALPHAKILL = 1<<22, ///< (deferredgeometry) discard pixel if diffuse texture alpha below 0.5, (generic) apply global alpha
        SHADERPERMUTATION_REFLECTCUBE = 1<<23, ///< fake reflections using global cubemap (not HDRI light probe)
        SHADERPERMUTATION_NORMALMAPSCROLLBLEND = 1<<24, ///< (water) counter-direction normalmaps scrolling
        SHADERPERMUTATION_BOUNCEGRID = 1<<25, ///< (lightmap) use Texture_BounceGrid as an additional source of ambient light
index 40fb7a0e1138979ea17cf7b6cde763c1cc30842d..184aa423735a66bf58ad14bf7cd5d503f2b7f41c 100644 (file)
@@ -2172,9 +2172,9 @@ void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting,
                else
                {
                        mode = SHADERMODE_GENERIC;
-                       permutation |= SHADERPERMUTATION_DIFFUSE;
-                       GL_BlendFunc(GL_ONE, GL_ZERO);
-                       blendfuncflags = R_BlendFuncFlags(GL_ONE, GL_ZERO);
+                       permutation |= SHADERPERMUTATION_DIFFUSE | SHADERPERMUTATION_ALPHAKILL;
+                       GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+                       blendfuncflags = R_BlendFuncFlags(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                }
                if (vid.allowalphatocoverage)
                        GL_AlphaToCoverage(false);
index c7b5ebffb698690a7b9952f862f3c9fbf7c009c2..41dac64ef0f84762f7ae4d98eddee39658042fd5 100644 (file)
 "#ifdef USESPECULAR\n"
 "dp_varying mediump vec2 TexCoord2;\n"
 "#endif\n"
+"uniform myhalf Alpha;\n"
 "#ifdef VERTEX_SHADER\n"
 "void main(void)\n"
 "{\n"
 "      dp_FragColor.g = dp_texture2D(Texture_GammaRamps, vec2(dp_FragColor.g, 0)).g;\n"
 "      dp_FragColor.b = dp_texture2D(Texture_GammaRamps, vec2(dp_FragColor.b, 0)).b;\n"
 "#endif\n"
+"#ifdef USEALPHAKILL\n"
+"      dp_FragColor.a *= Alpha;\n"
+"#endif\n"
 "}\n"
 "#endif\n"
 "#else // !MODE_GENERIC\n"
index 8e9ee06405cc3f3e2def9e9b553b12096fa57337..20770d187a3f108f57737ec630042762ffb09831 100644 (file)
 "#ifdef USEGAMMARAMPS\n"
 "uniform sampler Texture_GammaRamps : register(s2),\n"
 "#endif\n"
+"uniform half Alpha : register(c0),\n"
 "out float4 dp_FragColor : COLOR\n"
 ")\n"
 "{\n"
 "      dp_FragColor.g = tex2D(Texture_GammaRamps, vec2(dp_FragColor.g, 0)).g;\n"
 "      dp_FragColor.b = tex2D(Texture_GammaRamps, vec2(dp_FragColor.b, 0)).b;\n"
 "#endif\n"
+"#ifdef USEALPHAKILL\n"
+"      dp_FragColor.a *= Alpha;\n"
+"#endif\n"
 "}\n"
 "#endif\n"
 "#else // !MODE_GENERIC\n"