]> 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)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 10 Mar 2012 12:39:29 +0000 (12:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11752 d7cf8633-e32d-0410-b094-e92efae38249

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 3c5177aeee37d434c78869af829a439e27e2d56c..256b5e446412417f8cbc989932d60da99a644ddb 100644 (file)
@@ -2182,9 +2182,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 722fc3d667dc2d8570c479de9dd06949ac3c50e6..1833bdf30b37263f886e00cd81537f1c82ed4864 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"