aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class3/environment
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/app_settings/shaders/class3/environment
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class3/environment')
-rw-r--r--linden/indra/newview/app_settings/shaders/class3/environment/groundF.glsl12
-rw-r--r--linden/indra/newview/app_settings/shaders/class3/environment/groundV.glsl11
-rw-r--r--linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl25
-rw-r--r--linden/indra/newview/app_settings/shaders/class3/environment/scatterV.glsl16
4 files changed, 64 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class3/environment/groundF.glsl b/linden/indra/newview/app_settings/shaders/class3/environment/groundF.glsl
new file mode 100644
index 0000000..8618dad
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class3/environment/groundF.glsl
@@ -0,0 +1,12 @@
1vec4 getScatter(vec3 viewVec, vec3 lightDir);
2
3varying vec3 lightd;
4varying vec3 viewVec;
5
6void main()
7{
8 vec4 color = gl_Color;
9 vec4 haze = getScatter(viewVec, lightd) * vec4(gl_Fog.color.rgb, 1.0);
10 color.rgb = haze.rgb + haze.a * color.rgb;
11 gl_FragColor = color;
12}
diff --git a/linden/indra/newview/app_settings/shaders/class3/environment/groundV.glsl b/linden/indra/newview/app_settings/shaders/class3/environment/groundV.glsl
new file mode 100644
index 0000000..a6f5270
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class3/environment/groundV.glsl
@@ -0,0 +1,11 @@
1varying vec3 lightd;
2varying vec3 viewVec;
3
4void main()
5{
6 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
7 lightd = gl_LightSource[0].position.xyz;
8 viewVec = (gl_ModelViewMatrix * gl_Vertex).xyz;
9
10 gl_FrontColor = gl_Color;
11}
diff --git a/linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl b/linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl
new file mode 100644
index 0000000..7a9245f
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl
@@ -0,0 +1,25 @@
1uniform sampler2D scatterMap;
2
3//for per-pixel scatter
4vec4 getScatter(vec3 viewVec, vec3 lightDir)
5{
6 vec2 scatterCoord;
7 scatterCoord.x = length(viewVec);
8 vec3 normVec = viewVec / scatterCoord.x;
9 scatterCoord.y = dot(normVec, lightDir)*0.5 + 0.5;
10 scatterCoord.x = scatterCoord.x / gl_Fog.end;
11 scatterCoord.x *= scatterCoord.x; // HACK!! Remove this when we can push the view distance farther out
12 return texture2D(scatterMap, scatterCoord) * vec4(gl_Fog.color.rgb, 1.0);
13}
14
15void applyScatter(inout vec3 color, vec4 haze)
16{
17 color.rgb = haze.rgb + haze.a * color.rgb;
18}
19
20//for per-vertex scatter
21void applyScatter(inout vec3 color)
22{
23 vec4 haze = texture2D(scatterMap, gl_TexCoord[5].xy) * vec4(gl_Fog.color.rgb, 1.0);
24 color.rgb = haze.rgb + haze.a * color.rgb;
25}
diff --git a/linden/indra/newview/app_settings/shaders/class3/environment/scatterV.glsl b/linden/indra/newview/app_settings/shaders/class3/environment/scatterV.glsl
new file mode 100644
index 0000000..c9ebd9e
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class3/environment/scatterV.glsl
@@ -0,0 +1,16 @@
1
2vec2 getScatterCoord(vec3 viewVec, vec3 lightDir)
3{
4 vec2 scatterCoord;
5 scatterCoord.x = length(viewVec);
6 vec3 normVec = normalize(viewVec);
7 scatterCoord.y = dot(normVec, lightDir)*0.5 + 0.5;
8 scatterCoord.x = scatterCoord.x / gl_Fog.end;
9 scatterCoord.x *= scatterCoord.x; // HACK!! Remove this when we can push the view distance farther out
10 return scatterCoord;
11}
12
13void default_scatter(vec3 viewVec, vec3 lightDir)
14{
15 gl_TexCoord[5].xy = getScatterCoord(viewVec, lightDir);
16}