mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Compare fragLightVec square to LightCutoffSquareRadius
This commit is contained in:
parent
84f810bdc0
commit
bab29a0d3e
3 changed files with 6 additions and 2 deletions
|
@ -53,6 +53,10 @@ float getLightCutoffRadius(Light l) {
|
|||
return l._attenuation.y;
|
||||
}
|
||||
|
||||
float getLightCutoffSquareRadius(Light l) {
|
||||
return getLightCutoffRadius(l) * getLightCutoffRadius(l);
|
||||
}
|
||||
|
||||
float getLightCutoffIntensity(Light l) {
|
||||
return l._attenuation.z;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void main(void) {
|
|||
vec3 fragLightVec = getLightPosition(light) - fragPos.xyz;
|
||||
|
||||
// Kill if too far from the light center
|
||||
if (dot(fragLightVec, fragLightVec) > getLightCutoffRadius(light)) {
|
||||
if (dot(fragLightVec, fragLightVec) > getLightCutoffSquareRadius(light)) {
|
||||
discard;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void main(void) {
|
|||
vec3 fragLightVec = getLightPosition(light) - fragPos.xyz;
|
||||
|
||||
// Kill if too far from the light center
|
||||
if (dot(fragLightVec, fragLightVec) > getLightCutoffRadius(light)) {
|
||||
if (dot(fragLightVec, fragLightVec) > getLightCutoffSquareRadius(light)) {
|
||||
discard;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue