summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-01-28 23:58:50 -0800
committerTofu Linden <tofu.linden@lindenlab.com>2010-01-28 23:58:50 -0800
commit817d1d755b72b531b4107a259e618131fad94c50 (patch)
tree33e2498b375c35002c13f4332deff2f46ac5a780 /indra/newview/app_settings/shaders
parentc086f06be69e156c49a61bec1d13062cc50cfd09 (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')
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl2
2 files changed, 6 insertions, 2 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;
}
diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
index e5bf76db55..4577b4be55 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
@@ -7,7 +7,7 @@
float calcDirectionalLight(vec3 n, vec3 l);
float calcPointLight(vec3 v, vec3 n, vec4 lp, float la);
-float calcPointLight2(vec3 v, vec3 n, vec4 lp, vec3 ln, float la);
+float calcPointLight2(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_omnidirectional);
vec3 atmosAmbient(vec3 light);
vec3 atmosAffectDirectionalLight(float lightIntensity);