aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl')
-rw-r--r--linden/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl41
1 files changed, 41 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/linden/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
new file mode 100644
index 0000000..1c5234c
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
@@ -0,0 +1,41 @@
1/**
2 * @file sumLightsV.glsl
3 *
4 * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
5 * $License$
6 */
7
8float calcDirectionalLight(vec3 n, vec3 l);
9float calcPointLight(vec3 v, vec3 n, vec4 lp, float la);
10
11vec3 atmosAmbient(vec3 light);
12vec3 atmosAffectDirectionalLight(float lightIntensity);
13vec3 scaleDownLight(vec3 light);
14vec3 scaleUpLight(vec3 light);
15
16vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
17{
18 vec4 col;
19 col.a = color.a;
20
21 // Add windlight lights
22 col.rgb = atmosAffectDirectionalLight(calcDirectionalLight(norm, gl_LightSource[0].position.xyz));
23 col.rgb += atmosAmbient(baseLight.rgb);
24 col.rgb = scaleUpLight(col.rgb);
25
26 // Collect normal lights (need to be divided by two, as we later multiply by 2)
27 col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation);
28 col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation);
29 col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation);
30 col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation);
31 col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation);
32 col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation);
33 col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
34 col.rgb = scaleDownLight(col.rgb);
35
36
37 col.rgb = min(col.rgb*color.rgb, 1.0);
38
39 return col;
40}
41