diff options
| author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-06 14:47:43 +0100 |
|---|---|---|
| committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-06 14:47:43 +0100 |
| commit | 3c47d1faf1abb38ad05036de65bea3b7e21f683f (patch) | |
| tree | 2a33d4ee90d0287436c63a5f8fa90cf8fd1d6ef6 /indra/newview/app_settings/shaders/class1/lighting | |
| parent | 20c660569df71f677065b5f5f66477ebbd6b35b6 (diff) | |
| parent | a63c59be9e7df57143ddd04e44263c232f420a21 (diff) | |
another hairy merge from viewer-trunk :(
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/lighting')
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl | 9 |
1 files changed, 7 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 3e8fdfb3e4..da49e59b89 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl @@ -12,7 +12,8 @@ float calcDirectionalLight(vec3 n, vec3 l) return a; } -float calcPointLight(vec3 v, vec3 n, vec4 lp, float la) + +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight) { //get light vector vec3 lv = lp.xyz-v; @@ -26,9 +27,13 @@ float calcPointLight(vec3 v, vec3 n, vec4 lp, float la) //distance attenuation float da = clamp(1.0/(la * d), 0.0, 1.0); + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 + //angular attenuation da *= calcDirectionalLight(n, lv); - + return da; } |
