diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/app_settings/shaders/class3/environment | |
parent | README.txt (diff) | |
download | meta-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')
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 @@ | |||
1 | vec4 getScatter(vec3 viewVec, vec3 lightDir); | ||
2 | |||
3 | varying vec3 lightd; | ||
4 | varying vec3 viewVec; | ||
5 | |||
6 | void 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 @@ | |||
1 | varying vec3 lightd; | ||
2 | varying vec3 viewVec; | ||
3 | |||
4 | void 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 @@ | |||
1 | uniform sampler2D scatterMap; | ||
2 | |||
3 | //for per-pixel scatter | ||
4 | vec4 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 | |||
15 | void applyScatter(inout vec3 color, vec4 haze) | ||
16 | { | ||
17 | color.rgb = haze.rgb + haze.a * color.rgb; | ||
18 | } | ||
19 | |||
20 | //for per-vertex scatter | ||
21 | void 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 | |||
2 | vec2 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 | |||
13 | void default_scatter(vec3 viewVec, vec3 lightDir) | ||
14 | { | ||
15 | gl_TexCoord[5].xy = getScatterCoord(viewVec, lightDir); | ||
16 | } | ||