X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FShaders%2FDeclarationsImpl.glsl;h=d3b16429f76195b47791d88138ca1d2398e39162;hp=e13307e2ca7a510b7cb35397c2aa0bab6bdaa8f2;hb=b17e5bae1a46be4042d3cd3530ff45e43b32613a;hpb=12d71ad6a5b8aa8eef3429f619b1eaa089f1a051 diff --git a/src/Shaders/DeclarationsImpl.glsl b/src/Shaders/DeclarationsImpl.glsl index e13307e..d3b1642 100644 --- a/src/Shaders/DeclarationsImpl.glsl +++ b/src/Shaders/DeclarationsImpl.glsl @@ -15,6 +15,21 @@ // This file includes implementation of common functions and properties accessors +#if defined(FRAGMENT_SHADER) +#if defined(OCC_WRITE_WEIGHT_OIT_COVERAGE) +//! Output color and coverage for accumulation by OIT algorithm. +void occSetFragColor (in vec4 theColor) +{ + float aWeight = theColor.a * clamp (1e+2 * pow (1.0 - gl_FragCoord.z * occOitDepthFactor, 3.0), 1e-2, 1e+2); + occFragCoverage.r = theColor.a * aWeight; + occFragColor = vec4 (theColor.rgb * theColor.a * aWeight, theColor.a); +} +#else +//! Output color. +void occSetFragColor (in vec4 theColor) { occFragColor = theColor; } +#endif +#endif + #if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0) // arrays of light sources uniform THE_PREC_ENUM ivec2 occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types