diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-28 23:58:50 -0800 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-28 23:58:50 -0800 |
commit | 7e7331c0e5213ecfe4f563786239e497c197c630 (patch) | |
tree | 4b38d804ab8405092ab4a3d0ea84ca9d2bcd7450 /indra/newview/app_settings/shaders/class1/lighting | |
parent | 5a1cf512e9f7dbb3b95542bba1f5019e4cd4f9cd (diff) |
cheap no-branch goodness for rendering both spotlights and pointlights with the same shader code.
kill already-nerfed quadratic attenuation which it seems we won't be supporting any decade soon.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/lighting')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl index 4525bf80b2..2e41f24afe 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl @@ -47,8 +47,12 @@ float calcPointLight2(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_omnid //distance attenuation float da = clamp(1.0/(la * d), 0.0, 1.0); + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_omnidirectional); + da *= spot*spot; // GL_SPOT_EXPONENT=2 + //angular attenuation - da *= max(dot(-ln, lv),is_omnidirectional) * calcDirectionalLight(n, lv); + da *= calcDirectionalLight(n, lv); return da; } |