]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - shader_glsl.h
Implement GPU-side corona fading
[xonotic/darkplaces.git] / shader_glsl.h
index 3e150a2291cf47e4bdb144c8fc4a6a6d7d867630..1f5803c07045bad0eff82940f5c90e9618add50e 100644 (file)
@@ -2,7 +2,7 @@
 "// written by Forest 'LordHavoc' Hale\n",
 "// shadowmapping enhancements by Lee 'eihrul' Salzman\n",
 "\n",
-"#ifdef USESKELETAL\n",
+"#if defined(USESKELETAL) || defined(USEOCCLUDE)\n",
 "#  ifdef GL_ARB_uniform_buffer_object\n",
 "#    extension GL_ARB_uniform_buffer_object : enable\n",
 "#  endif\n",
 "#ifdef USENORMALMAPSCROLLBLEND\n",
 "uniform highp vec2 NormalmapScrollBlend;\n",
 "#endif\n",
+"#ifdef USEOCCLUDE\n",
+"uniform occludeQuery {\n",
+"    uint visiblepixels;\n",
+"    uint allpixels;\n",
+"};\n",
+"#endif\n",
 "void main(void)\n",
 "{\n",
 "#ifdef USEOFFSETMAPPING\n",
 "      ScreenTexCoord = mix(SafeScreenTexCoord, ScreenTexCoord, f);\n",
 "      color.rgb = mix(color.rgb, cast_myhalf3(dp_texture2D(Texture_Reflection, ScreenTexCoord)) * ReflectColor.rgb, ReflectColor.a);\n",
 "#endif\n",
+"#ifdef USEOCCLUDE\n",
+"   color.rgb *= clamp(float(visiblepixels) / float(allpixels), 0.0, 1.0);\n",
+"#endif\n",
 "\n",
 "      dp_FragColor = vec4(color);\n",
 "}\n",