Merge pull request #540 from Lunarsong/patch-4

Removed redundant division by w
This commit is contained in:
Sascha Willems 2019-01-31 20:07:09 +01:00 committed by GitHub
commit d6d1d087fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,12 +33,11 @@ const mat4 biasMat = mat4(
0.5, 0.5, 0.0, 1.0
);
float textureProj(vec4 P, vec2 offset, uint cascadeIndex)
float textureProj(vec4 shadowCoord, vec2 offset, uint cascadeIndex)
{
float shadow = 1.0;
float bias = 0.005;
vec4 shadowCoord = P / P.w;
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) {
float dist = texture(shadowMap, vec3(shadowCoord.st + offset, cascadeIndex)).r;
if (shadowCoord.w > 0 && dist < shadowCoord.z - bias) {
@ -121,4 +120,4 @@ void main()
break;
}
}
}
}