summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2011-07-26 15:51:44 -0400
committerNyx (Neal Orman) <nyx@lindenlab.com>2011-07-26 15:51:44 -0400
commit60d15f78e17a2203d73d58c3f1c2af941d599277 (patch)
tree58da32e9df5e9727e437efa90e98a0d4d2a3b0e9 /indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
parent85b316e5df41444eafe77964f1a4758ccfd40784 (diff)
parentf79a058f3ce50361b732061ab30f4a1923fba445 (diff)
merge with latest mesh-dev
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl27
1 files changed, 16 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
index d227346163..948a52da5b 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
@@ -5,7 +5,7 @@
* $License$
*/
-#version 120
+
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -35,19 +35,24 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
//get distance
float d = length(lv);
- //normalize light vector
- lv *= 1.0/d;
+ float da = 0.0;
+
+ if (d > 0.0 && la > 0.0 && fa > 0.0)
+ {
+ //normalize light vector
+ lv *= 1.0/d;
- //distance attenuation
- float dist2 = d*d/(la*la);
- float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ //distance attenuation
+ float dist2 = d*d/(la*la);
+ da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
- // spotlight coefficient.
- float spot = max(dot(-ln, lv), is_pointlight);
- da *= spot*spot; // GL_SPOT_EXPONENT=2
+ // spotlight coefficient.
+ float spot = max(dot(-ln, lv), is_pointlight);
+ da *= spot*spot; // GL_SPOT_EXPONENT=2
- //angular attenuation
- da *= calcDirectionalLight(n, lv);
+ //angular attenuation
+ da *= calcDirectionalLight(n, lv);
+ }
return da;
}