0029517: Visualization - introduce AlphaMode property defining alpha value handling...
[occt.git] / src / Shaders / Shaders_DeclarationsImpl_glsl.pxx
index 4ff7592..796b4e7 100644 (file)
@@ -19,18 +19,20 @@ static const char Shaders_DeclarationsImpl_glsl[] =
   "// This file includes implementation of common functions and properties accessors\n"
   "\n"
   "#if defined(FRAGMENT_SHADER)\n"
-  "#if defined(OCC_WRITE_WEIGHT_OIT_COVERAGE)\n"
-  "//! Output color and coverage for accumulation by OIT algorithm.\n"
+  "//! Output color (and coverage for accumulation by OIT algorithm).\n"
   "void occSetFragColor (in vec4 theColor)\n"
   "{\n"
+  "#if defined(OCC_ALPHA_TEST)\n"
+  "  if (theColor.a < occAlphaCutoff) discard;\n"
+  "#endif\n"
+  "#if defined(OCC_WRITE_WEIGHT_OIT_COVERAGE)\n"
   "  float aWeight     = theColor.a * clamp (1e+2 * pow (1.0 - gl_FragCoord.z * occOitDepthFactor, 3.0), 1e-2, 1e+2);\n"
   "  occFragCoverage.r = theColor.a * aWeight;\n"
   "  occFragColor      = vec4 (theColor.rgb * theColor.a * aWeight, theColor.a);\n"
-  "}\n"
   "#else\n"
-  "//! Output color.\n"
-  "void occSetFragColor (in vec4 theColor) { occFragColor = theColor; }\n"
+  "  occFragColor = theColor;\n"
   "#endif\n"
+  "}\n"
   "#endif\n"
   "\n"
   "#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)\n"