Merge pull request #540 from Lunarsong/patch-4
Removed redundant division by w
This commit is contained in:
commit
d6d1d087fd
1 changed files with 2 additions and 3 deletions
|
|
@ -33,12 +33,11 @@ const mat4 biasMat = mat4(
|
||||||
0.5, 0.5, 0.0, 1.0
|
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 shadow = 1.0;
|
||||||
float bias = 0.005;
|
float bias = 0.005;
|
||||||
|
|
||||||
vec4 shadowCoord = P / P.w;
|
|
||||||
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) {
|
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) {
|
||||||
float dist = texture(shadowMap, vec3(shadowCoord.st + offset, cascadeIndex)).r;
|
float dist = texture(shadowMap, vec3(shadowCoord.st + offset, cascadeIndex)).r;
|
||||||
if (shadowCoord.w > 0 && dist < shadowCoord.z - bias) {
|
if (shadowCoord.w > 0 && dist < shadowCoord.z - bias) {
|
||||||
|
|
@ -121,4 +120,4 @@ void main()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue