mirror of https://github.com/OpenMW/openmw.git
Switch shadow map rendering to a specialised, simplified shader.
parent
ce15369bbd
commit
474770eca8
@ -0,0 +1,17 @@
|
||||
#version 120
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
varying vec2 diffuseMapUV;
|
||||
|
||||
varying float alphaPassthrough;
|
||||
|
||||
uniform bool useDiffuseMapForShadowAlpha;
|
||||
|
||||
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;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
#version 120
|
||||
|
||||
varying vec2 diffuseMapUV;
|
||||
|
||||
varying float alphaPassthrough;
|
||||
|
||||
uniform int colorMode;
|
||||
uniform bool useDiffuseMapForShadowAlpha;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
vec4 viewPos = (gl_ModelViewMatrix * gl_Vertex);
|
||||
gl_ClipVertex = viewPos;
|
||||
|
||||
if (useDiffuseMapForShadowAlpha)
|
||||
diffuseMapUV = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
else
|
||||
diffuseMapUV = vec2(0.0); // Avoid undefined behaviour if running on hardware predating the concept of dynamically uniform expressions
|
||||
|
||||
if (colorMode == 2)
|
||||
alphaPassthrough = gl_Color.a;
|
||||
else
|
||||
// This is uniform, so if it's too low, we might be able to put the position/clip vertex outside the view frustum and skip the fragment shader and rasteriser
|
||||
alphaPassthrough = gl_FrontMaterial.diffuse.a;
|
||||
}
|
Loading…
Reference in New Issue