aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl')
-rw-r--r--linden/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl34
1 files changed, 34 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/linden/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
new file mode 100644
index 0000000..3e8fdfb
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
@@ -0,0 +1,34 @@
1/**
2 * @file lightFuncV.glsl
3 *
4 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
5 * $License$
6 */
7
8
9float calcDirectionalLight(vec3 n, vec3 l)
10{
11 float a = max(dot(n,l),0.0);
12 return a;
13}
14
15float calcPointLight(vec3 v, vec3 n, vec4 lp, float la)
16{
17 //get light vector
18 vec3 lv = lp.xyz-v;
19
20 //get distance
21 float d = length(lv);
22
23 //normalize light vector
24 lv *= 1.0/d;
25
26 //distance attenuation
27 float da = clamp(1.0/(la * d), 0.0, 1.0);
28
29 //angular attenuation
30 da *= calcDirectionalLight(n, lv);
31
32 return da;
33}
34