File: shadowcasting_fragment.glsl

package info (click to toggle)
openmw 0.47.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,276 kB
  • sloc: cpp: 249,935; xml: 1,978; sh: 1,327; python: 63; makefile: 26
file content (31 lines) | stat: -rw-r--r-- 776 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#version 120

#if @useGPUShader4
    #extension GL_EXT_gpu_shader4: require
#endif

uniform sampler2D diffuseMap;
varying vec2 diffuseMapUV;

varying float alphaPassthrough;

uniform bool useDiffuseMapForShadowAlpha;
uniform bool alphaTestShadows;

#include "alpha.glsl"

void main()
{
    gl_FragData[0].rgb = vec3(1.0);
    if (useDiffuseMapForShadowAlpha)
        gl_FragData[0].a = texture2D(diffuseMap, diffuseMapUV).a * alphaPassthrough;
    else
        gl_FragData[0].a = alphaPassthrough;

    alphaTest();

    // Prevent translucent things casting shadow (including the player using an invisibility effect).
    // This replaces alpha blending, which obviously doesn't work with depth buffers
    if (alphaTestShadows && gl_FragData[0].a <= 0.5)
        discard;
}