summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowF.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/terrainF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/terrainV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl45
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterF.glsl96
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterV.glsl90
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl46
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightV.glsl89
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl35
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl29
-rwxr-xr-xindra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl13
-rwxr-xr-xindra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl29
-rwxr-xr-xindra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl23
-rwxr-xr-xindra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/shinyF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/shinyV.glsl25
-rwxr-xr-xindra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleV.glsl22
-rwxr-xr-xindra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/transportF.glsl26
51 files changed, 1002 insertions, 206 deletions
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl
index 5731add4d5..b6cc7f7712 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarF.glsl
@@ -1,3 +1,10 @@
+/**
+ * @file avatarF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
void default_lighting();
void main()
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index 1fcc001911..292dbfdab4 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -1,4 +1,9 @@
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color);
+/**
+ * @file avatarSkinV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
attribute vec4 weight; //1
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
index 50f9b0192e..ee3410d732 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
@@ -1,9 +1,13 @@
-void default_scatter(vec3 viewVec, vec3 lightDir);
+/**
+ * @file avatarV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
-vec2 getScatterCoord(vec3 viewVec, vec3 lightDir);
-
-attribute vec4 materialColor;
+void calcAtmospherics(vec3 inPositionEye);
void main()
{
@@ -24,12 +28,16 @@ void main()
norm = normalize(norm);
gl_Position = gl_ProjectionMatrix * pos;
-
+
//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- default_scatter(pos.xyz, gl_LightSource[0].position.xyz);
+ gl_FogFragCoord = length(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, materialColor, gl_Color);
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0,0,0,0));
gl_FrontColor = color;
}
+
+
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl
index 5731add4d5..4d93c19441 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballF.glsl
@@ -1,3 +1,10 @@
+/**
+ * @file eyeballF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
void default_lighting();
void main()
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
index d436b4e00a..b3c988a924 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
@@ -1,7 +1,12 @@
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec3 baseCol);
-void default_scatter(vec3 viewVec, vec3 lightDir);
+/**
+ * @file eyeballV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
-attribute vec4 materialColor;
+vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
void main()
{
@@ -12,9 +17,11 @@ void main()
vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
- vec4 color = calcLighting(pos, norm, materialColor, gl_Color.rgb);
- default_scatter(pos, gl_LightSource[0].position.xyz);
-
+ calcAtmospherics(pos.xyz);
+
+ vec4 specular = vec4(1.0);
+ vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
gl_FrontColor = color;
+
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
index b311afb59c..2019300418 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
@@ -1,3 +1,10 @@
+/**
+ * @file pickAvatarF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
uniform sampler2D diffuseMap;
void main()
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
index b6dcbe1693..12d8f9d2f9 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
@@ -1,4 +1,10 @@
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color);
+/**
+ * @file pickAvatarV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
mat4 getSkinnedTransform();
void main()
@@ -14,4 +20,4 @@ void main()
gl_FrontColor = gl_Color;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_ProjectionMatrix * pos;
-} \ No newline at end of file
+}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
new file mode 100644
index 0000000000..dbdfe1174c
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -0,0 +1,28 @@
+/**
+ * @file glowExtractF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2DRect diffuseMap;
+uniform float minLuminance;
+uniform float maxExtractAlpha;
+uniform vec3 lumWeights;
+uniform vec3 warmthWeights;
+uniform float warmthAmount;
+
+void main()
+{
+ vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy);
+
+ /// CALCULATING LUMINANCE (Using NTSC lum weights)
+ /// http://en.wikipedia.org/wiki/Luma_%28video%29
+ float lum = smoothstep(minLuminance, 1.0, dot(col.rgb, lumWeights ) );
+ float warmth = smoothstep(minLuminance, 1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) );
+
+ gl_FragColor.rgb = col.rgb;
+ gl_FragColor.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
+}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
new file mode 100644
index 0000000000..61dfd2f126
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
@@ -0,0 +1,14 @@
+/**
+ * @file glowExtractV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+void main()
+{
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+ gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
+}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
new file mode 100644
index 0000000000..21c7ad765f
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
@@ -0,0 +1,31 @@
+/**
+ * @file glowF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+uniform sampler2D diffuseMap;
+uniform float glowStrength;
+
+void main()
+{
+
+ vec4 col = vec4(0.0, 0.0, 0.0, 0.0);
+
+ // ATI compiler falls down on array initialization.
+ float kern[8];
+ kern[0] = 0.25; kern[1] = 0.5; kern[2] = 0.8; kern[3] = 1.0;
+ kern[4] = 1.0; kern[5] = 0.8; kern[6] = 0.5; kern[7] = 0.25;
+
+ col += kern[0] * texture2D(diffuseMap, gl_TexCoord[0].xy);
+ col += kern[1] * texture2D(diffuseMap, gl_TexCoord[1].xy);
+ col += kern[2] * texture2D(diffuseMap, gl_TexCoord[2].xy);
+ col += kern[3] * texture2D(diffuseMap, gl_TexCoord[3].xy);
+ col += kern[4] * texture2D(diffuseMap, gl_TexCoord[0].zw);
+ col += kern[5] * texture2D(diffuseMap, gl_TexCoord[1].zw);
+ col += kern[6] * texture2D(diffuseMap, gl_TexCoord[2].zw);
+ col += kern[7] * texture2D(diffuseMap, gl_TexCoord[3].zw);
+
+ gl_FragColor = vec4(col.rgb * glowStrength, col.a);
+}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
new file mode 100644
index 0000000000..13ce7c7854
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
@@ -0,0 +1,22 @@
+/**
+ * @file glowV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+uniform vec2 glowDelta;
+
+void main()
+{
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+ gl_TexCoord[0].xy = gl_MultiTexCoord0.xy + glowDelta*(-3.5);
+ gl_TexCoord[1].xy = gl_MultiTexCoord0.xy + glowDelta*(-2.5);
+ gl_TexCoord[2].xy = gl_MultiTexCoord0.xy + glowDelta*(-1.5);
+ gl_TexCoord[3].xy = gl_MultiTexCoord0.xy + glowDelta*(-0.5);
+ gl_TexCoord[0].zw = gl_MultiTexCoord0.xy + glowDelta*(0.5);
+ gl_TexCoord[1].zw = gl_MultiTexCoord0.xy + glowDelta*(1.5);
+ gl_TexCoord[2].zw = gl_MultiTexCoord0.xy + glowDelta*(2.5);
+ gl_TexCoord[3].zw = gl_MultiTexCoord0.xy + glowDelta*(3.5);
+}
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
index fde370155d..2278c6916d 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
@@ -1,9 +1,13 @@
-void terrain_lighting(inout vec3 color);
-
-uniform sampler2D detail0; //0
-uniform sampler2D detail1; //2
-uniform sampler2D alphaRamp; //1
+/**
+ * @file terrainF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+uniform sampler2D detail0;
+uniform sampler2D detail1;
+uniform sampler2D alphaRamp;
void main()
{
@@ -12,8 +16,6 @@ void main()
texture2D(detail0, gl_TexCoord[0].xy).rgb,
a);
- terrain_lighting(color);
-
gl_FragColor.rgb = color;
gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a;
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
index 3153a80e93..112d669819 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
@@ -1,7 +1,11 @@
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
-void default_scatter(vec3 viewVec, vec3 lightDir);
+/**
+ * @file terrainV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
-attribute vec4 materialColor;
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
{
@@ -25,7 +29,7 @@ void main()
vec4 pos = gl_ModelViewMatrix * gl_Vertex;
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
- vec4 color = calcLighting(pos.xyz, norm, materialColor, gl_Color);
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), gl_Color);
gl_FrontColor = color;
@@ -33,5 +37,4 @@ void main()
gl_TexCoord[1] = gl_TextureMatrix[1]*gl_MultiTexCoord1;
gl_TexCoord[2] = texgen_object(gl_Vertex,gl_MultiTexCoord2,gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]);
gl_TexCoord[3] = gl_TextureMatrix[3]*gl_MultiTexCoord3;
- default_scatter(pos.xyz, gl_LightSource[0].position.xyz);
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl
new file mode 100644
index 0000000000..e2f68e8826
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl
@@ -0,0 +1,23 @@
+/**
+ * @file terrainWaterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+// this class1 shader is just a copy of terrainF
+
+uniform sampler2D detail0;
+uniform sampler2D detail1;
+uniform sampler2D alphaRamp;
+
+void main()
+{
+ float a = texture2D(alphaRamp, gl_TexCoord[1].xy).a;
+ vec3 color = mix(texture2D(detail1, gl_TexCoord[2].xy).rgb,
+ texture2D(detail0, gl_TexCoord[0].xy).rgb,
+ a);
+
+ gl_FragColor.rgb = color;
+ gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a;
+}
diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
new file mode 100644
index 0000000000..f1740a4dcd
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
@@ -0,0 +1,45 @@
+/**
+ * @file underWaterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+uniform sampler2D diffuseMap;
+uniform sampler2D bumpMap;
+uniform sampler2D screenTex;
+
+uniform float refScale;
+uniform vec4 waterFogColor;
+
+//bigWave is (refCoord.w, view.w);
+varying vec4 refCoord;
+varying vec4 littleWave;
+varying vec4 view;
+
+void main()
+{
+ vec4 color;
+
+ //get bigwave normal
+ vec3 wavef = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0;
+
+ //get detail normals
+ vec3 dcol = texture2D(bumpMap, littleWave.xy).rgb*0.75;
+ dcol += texture2D(bumpMap, littleWave.zw).rgb*1.25;
+
+ //interpolate between big waves and little waves (big waves in deep water)
+ wavef = (wavef+dcol)*0.5;
+
+ //crunch normal to range [-1,1]
+ wavef -= vec3(1,1,1);
+
+ //figure out distortion vector (ripply)
+ vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
+ distort = distort+wavef.xy*refScale;
+
+ vec4 fb = texture2D(screenTex, distort);
+
+ gl_FragColor.rgb = mix(waterFogColor.rgb, fb.rgb, waterFogColor.a * 0.001 + 0.999);
+ gl_FragColor.a = fb.a;
+}
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
index f8b8031ce6..1c14381df9 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
@@ -1,22 +1,94 @@
-void water_lighting(inout vec3 diff);
+/**
+ * @file waterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+vec3 scaleSoftClip(vec3 inColor);
+vec3 atmosTransport(vec3 inColor);
-uniform samplerCube environmentMap;
uniform sampler2D diffuseMap;
-uniform sampler2D bumpMap;
+uniform sampler2D bumpMap;
+uniform sampler2D screenTex;
+uniform sampler2D refTex;
+
+uniform float sunAngle;
+uniform float sunAngle2;
+uniform float scaledAngle;
+uniform vec3 lightDir;
+uniform vec3 specular;
+uniform float lightExp;
+uniform float refScale;
+uniform float kd;
+uniform vec2 screenRes;
+uniform vec3 normScale;
+uniform float fresnelScale;
+uniform float fresnelOffset;
+uniform float blurMultiplier;
+uniform vec4 fogCol;
-varying vec4 specular;
+//bigWave is (refCoord.w, view.w);
+varying vec4 refCoord;
+varying vec4 littleWave;
+varying vec4 view;
void main()
{
- vec4 depth = texture2D(diffuseMap, gl_TexCoord[0].xy);
- vec4 diff = texture2D(bumpMap, gl_TexCoord[1].xy);
- vec3 ref = textureCube(environmentMap, gl_TexCoord[2].xyz).rgb;
+ vec3 viewVec = view.xyz;
+ vec4 color;
+
+ float dist = length(viewVec.xy);
+
+ //normalize view vector
+ viewVec = normalize(viewVec);
+
+ //get wave normals
+ vec3 wavef = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0;
+
+ //get detail normals
+ vec3 dcol = texture2D(bumpMap, littleWave.xy).rgb*0.75;
+ dcol += texture2D(bumpMap, littleWave.zw).rgb*1.25;
+
+ //interpolate between big waves and little waves (big waves in deep water)
+ wavef = (wavef + dcol) * 0.5;
+
+ //crunch normal to range [-1,1]
+ wavef -= vec3(1,1,1);
+ wavef = normalize(wavef);
+
+ //get base fresnel components
- diff.rgb *= depth.rgb;
+ float df = dot(viewVec,wavef) * fresnelScale + fresnelOffset;
+
+ vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
+
+ float dist2 = dist;
+ dist = max(dist, 5.0);
+
+ //get reflected color
+ vec2 refdistort = wavef.xy*dot(normScale, vec3(0.333));
+ vec2 refvec = distort+refdistort/dist;
+ vec4 refcol = texture2D(refTex, refvec);
+
+ //get specular component
+ float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0);
+
+ //harden specular
+ spec = pow(spec, lightExp);
+
+ //figure out distortion vector (ripply)
+ vec2 distort2 = distort+wavef.xy*refScale/max(dist*df, 1.0);
- vec3 col = mix(diff.rgb, ref, specular.a)+specular.rgb*diff.rgb;
+ vec4 fb = texture2D(screenTex, distort2);
+
+ //mix with reflection
+ color.rgb = mix(mix(fogCol.rgb, fb.rgb, fogCol.a), refcol.rgb, df);
+ color.rgb += spec * specular;
- water_lighting(col.rgb);
- gl_FragColor.rgb = col.rgb;
- gl_FragColor.a = (gl_Color.a+depth.a)*0.5;
+ color.rgb = atmosTransport(color.rgb);
+ color.rgb = scaleSoftClip(color.rgb);
+ color.a = spec * sunAngle2;
+
+ gl_FragColor = color;
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
new file mode 100644
index 0000000000..59e44fa871
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -0,0 +1,20 @@
+/**
+ * @file waterFogF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+vec4 applyWaterFog(vec4 color)
+{
+ // GL_EXP2 Fog
+ float fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord);
+ // GL_EXP Fog
+ // float fog = exp(-gl_Fog.density * gl_FogFragCoord);
+ // GL_LINEAR Fog
+ // float fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale;
+ fog = clamp(fog, 0.0, 1.0);
+ color.rgb = mix(gl_Fog.color.rgb, color.rgb, fog);
+ return color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
index 873a6fcb34..d332798103 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -1,41 +1,73 @@
-void default_scatter(vec3 viewVec, vec3 lightDir);
-vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec3 baseCol);
-vec2 getScatterCoord(vec3 viewVec, vec3 lightDir);
+/**
+ * @file waterV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
-varying vec4 specular;
+void calcAtmospherics(vec3 inPositionEye);
-vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
+uniform vec2 d1;
+uniform vec2 d2;
+uniform float time;
+uniform vec3 eyeVec;
+uniform float waterHeight;
+
+varying vec4 refCoord;
+varying vec4 littleWave;
+varying vec4 view;
+
+float wave(vec2 v, float t, float f, vec2 d, float s)
{
- vec4 tcoord;
-
- tcoord.x = dot(vpos, tp0);
- tcoord.y = dot(vpos, tp1);
- tcoord.z = tc.z;
- tcoord.w = tc.w;
-
- tcoord = mat * tcoord;
-
- return tcoord;
+ return (dot(d, v)*f + t*s)*f;
}
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[1] = texgen_object(gl_Vertex, gl_MultiTexCoord1, gl_TextureMatrix[1], gl_ObjectPlaneS[1],gl_ObjectPlaneT[1]);
+ vec4 position = gl_Vertex;
+ mat4 modelViewProj = gl_ModelViewProjectionMatrix;
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
- vec4 spec = gl_Color;
- gl_FrontColor.rgb = calcLightingSpecular(pos, norm, gl_Color, spec, vec3(0.0, 0.0, 0.0)).rgb;
- gl_FrontColor.a = gl_Color.a;
- specular = spec;
- specular.a = gl_Color.a*0.5;
- vec3 ref = reflect(pos,norm);
+ vec4 oPosition;
+
+ //get view vector
+ vec3 oEyeVec;
+ oEyeVec.xyz = position.xyz-eyeVec;
+
+ float d = length(oEyeVec.xy);
+ float ld = min(d, 2560.0);
- gl_TexCoord[2] = gl_TextureMatrix[2]*vec4(ref,1);
+ position.xy = eyeVec.xy + oEyeVec.xy/d*ld;
+ view.xyz = oEyeVec;
+
+ d = clamp(ld/1536.0-0.5, 0.0, 1.0);
+ d *= d;
- default_scatter(pos.xyz, gl_LightSource[0].position.xyz);
+ oPosition = position;
+ oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d);
+ oPosition = modelViewProj * oPosition;
+ refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
+
+ //get wave position parameter (create sweeping horizontal waves)
+ vec3 v = position.xyz;
+ v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
+
+ //push position for further horizon effect.
+ position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+ position.w = 1.0;
+ position = position*gl_ModelViewMatrix;
+
+ calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
+
+
+ //pass wave parameters to pixel shader
+ vec2 bigWave = (v.xy) * vec2(0.04,0.04) + d1 * time * 0.055;
+ //get two normal map (detail map) texture coordinates
+ littleWave.xy = (v.xy) * vec2(0.6, 1.2) + d2 * time * 0.05;
+ // littleWave.zw = (v.xy) * vec2(0.07, 0.15) - d1 * time * 0.043;
+ littleWave.zw = (v.xy) * vec2(0.3, 0.6) + d1 * time * 0.1;
+ view.w = bigWave.y;
+ refCoord.w = bigWave.x;
+
+ gl_Position = oPosition;
}
-
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
index 1e342fb51b..328c41652d 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
@@ -1,3 +1,10 @@
+/**
+ * @file highlightF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
uniform sampler2D diffuseMap;
void main()
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
index bb6707b2a9..a9ea6e856a 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
@@ -1,9 +1,14 @@
-attribute vec4 materialColor;
+/**
+ * @file highlightV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = ftransform();
vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
pos = normalize(pos);
float d = dot(pos, normalize(gl_NormalMatrix * gl_Normal));
@@ -11,10 +16,10 @@ void main()
d = 1.0 - d;
d *= d;
- d = min(d, materialColor.a*2.0);
+ d = min(d, gl_Color.a*2.0);
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_FrontColor.rgb = materialColor.rgb;
- gl_FrontColor.a = max(d, materialColor.a);
+ gl_FrontColor.rgb = gl_Color.rgb;
+ gl_FrontColor.a = max(d, gl_Color.a);
}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
index c169fceb88..9ab986be6d 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
@@ -1,31 +1,15 @@
-void applyScatter(inout vec3 color);
+/**
+ * @file lightF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
uniform sampler2D diffuseMap;
void default_lighting()
{
- vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
- //applyScatter(color.rgb);
+ color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
gl_FragColor = color;
}
-void alpha_lighting()
-{
- default_lighting();
-}
-
-void water_lighting(inout vec3 diff)
-{
- applyScatter(diff);
-}
-
-void terrain_lighting(inout vec3 color)
-{
- color.rgb *= gl_Color.rgb;
- applyScatter(color);
-}
-
-vec4 getLightColor()
-{
- return gl_Color;
-} \ No newline at end of file
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
new file mode 100644
index 0000000000..b12cca9126
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
@@ -0,0 +1,15 @@
+/**
+ * @file lightFullbrightF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+uniform sampler2D diffuseMap;
+
+void fullbright_lighting()
+{
+ gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
new file mode 100644
index 0000000000..bc795a7513
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
@@ -0,0 +1,15 @@
+/**
+ * @file lightFullbrightShinyF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+uniform sampler2D diffuseMap;
+uniform samplerCube environmentMap;
+
+void fullbright_shiny_lighting()
+{
+ gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
new file mode 100644
index 0000000000..b13088fb19
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
@@ -0,0 +1,15 @@
+/**
+ * @file lightFullbrightWaterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+uniform sampler2D diffuseMap;
+
+void fullbright_lighting_water()
+{
+ gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl
new file mode 100644
index 0000000000..bbbd9f3dfe
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncSpecularV.glsl
@@ -0,0 +1,46 @@
+/**
+ * @file lightFuncSpecularV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+ float a = max(dot(n,l),0.0);
+ return a;
+}
+
+float calcDirectionalSpecular(vec3 view, vec3 n, vec3 l)
+{
+ return pow(max(dot(reflect(view, n),l), 0.0),8.0);
+}
+
+float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da)
+{
+
+ specular.rgb += calcDirectionalSpecular(view,n,l)*lightCol*da;
+ return max(dot(n,l),0.0);
+}
+
+vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol)
+{
+ //get light vector
+ vec3 lv = l-v;
+
+ //get distance
+ float d = length(lv);
+
+ //normalize light vector
+ lv *= 1.0/d;
+
+ //distance attenuation
+ float da = clamp(1.0/(r * d), 0.0, 1.0);
+
+ //angular attenuation
+
+ da *= calcDirectionalLightSpecular(specular, view, n, lv, lightCol, da);
+
+ return da*lightCol;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
new file mode 100644
index 0000000000..3e8fdfb3e4
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
@@ -0,0 +1,34 @@
+/**
+ * @file lightFuncV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+ float a = max(dot(n,l),0.0);
+ return a;
+}
+
+float calcPointLight(vec3 v, vec3 n, vec4 lp, float la)
+{
+ //get light vector
+ vec3 lv = lp.xyz-v;
+
+ //get distance
+ float d = length(lv);
+
+ //normalize light vector
+ lv *= 1.0/d;
+
+ //distance attenuation
+ float da = clamp(1.0/(la * d), 0.0, 1.0);
+
+ //angular attenuation
+ da *= calcDirectionalLight(n, lv);
+
+ return da;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl
new file mode 100644
index 0000000000..c6f7f8b81b
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl
@@ -0,0 +1,17 @@
+/**
+ * @file lightShinyF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+uniform sampler2D diffuseMap;
+uniform samplerCube environmentMap;
+
+void shiny_lighting()
+{
+ color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl
new file mode 100644
index 0000000000..75f61ccdf1
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl
@@ -0,0 +1,17 @@
+/**
+ * @file lightShinyWaterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+uniform sampler2D diffuseMap;
+uniform samplerCube environmentMap;
+
+void shiny_lighting_water()
+{
+ color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
new file mode 100644
index 0000000000..853212923c
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
@@ -0,0 +1,26 @@
+/**
+ * @file lightV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+float calcDirectionalLight(vec3 n, vec3 l);
+
+// Same as non-specular lighting in lightV.glsl
+vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol)
+{
+ specularColor.rgb = vec3(0.0, 0.0, 0.0);
+ vec4 col;
+ col.a = color.a;
+
+ col.rgb = gl_LightModel.ambient.rgb + baseCol.rgb;
+
+ col.rgb += gl_LightSource[0].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[0].position.xyz);
+ col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
+
+ col.rgb = min(col.rgb*color.rgb, 1.0);
+
+ return col;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
index e3816318a1..8c2813a859 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl
@@ -1,66 +1,11 @@
+/**
+ * @file lightV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
-float calcDirectionalLight(vec3 n, vec3 l)
-{
- float a = max(dot(n,l),0.0);
- return a;
-}
-
-float calcPointLight(vec3 v, vec3 n, vec3 l, float r, float pw)
-{
- //get light vector
- vec3 lv = l-v;
-
- //get distance
- float d = length(lv);
-
- //normalize light vector
- lv *= 1.0/d;
-
- //distance attenuation
- float da = max((r-d)/r, 0.0);
-
- //da = pow(da, pw);
-
- //angular attenuation
- da *= calcDirectionalLight(n, lv);
-
- return da;
-}
-
-float calcDirectionalSpecular(vec3 view, vec3 n, vec3 l)
-{
- float a = max(dot(n,l),0.0);
- return a;
-}
-
-float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da)
-{
-
- specular.rgb += calcDirectionalSpecular(view,n,l)*lightCol*da;
- return calcDirectionalLight(n,l);
-}
-
-vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol)
-{
- //get light vector
- vec3 lv = l-v;
-
- //get distance
- float d = length(lv);
-
- //normalize light vector
- lv *= 1.0/d;
-
- //distance attenuation
- float da = clamp((r-d)/r, 0.0, 1.0);
-
- //da = pow(da, pw);
-
- //angular attenuation
- da *= calcDirectionalLightSpecular(specular, view, n, lv, lightCol, da);
-
- return da*lightCol;
-}
+float calcDirectionalLight(vec3 n, vec3 l);
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
{
@@ -77,23 +22,3 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
return col;
}
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec3 baseLight)
-{
- return calcLighting(pos, norm, color, vec4(baseLight, 1.0));
-}
-
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)
-{
- return calcLighting(pos, norm, color, vec3(0.0,0.0,0.0));
-}
-
-vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol)
-{
- specularColor.rgb = vec3(0.0, 0.0, 0.0);
- return calcLighting(pos, norm, color, baseCol);
-}
-
-vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec3 baseCol)
-{
- return calcLightingSpecular(pos, norm, color, specularColor, vec4(baseCol, 1.0));
-}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
new file mode 100644
index 0000000000..81dff1ef39
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
@@ -0,0 +1,15 @@
+/**
+ * @file lightWaterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+uniform sampler2D diffuseMap;
+
+void default_lighting_water()
+{
+ vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
new file mode 100644
index 0000000000..218585fb86
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl
@@ -0,0 +1,35 @@
+/**
+ * @file sumLightsSpecularV.glsl
+ *
+ * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);
+vec3 atmosAmbient(vec3 light);
+vec3 atmosAffectDirectionalLight(float lightIntensity);
+vec3 atmosGetDiffuseSunlightColor();
+vec3 scaleDownLight(vec3 light);
+
+vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol)
+{
+ vec4 col;
+ col.a = color.a;
+
+
+ vec3 view = normalize(pos);
+
+ /// collect all the specular values from each calcXXXLightSpecular() function
+ vec4 specularSum = vec4(0.0);
+
+ col.rgb = gl_LightSource[1].diffuse.rgb * calcDirectionalLightSpecular(specularColor, view, norm, gl_LightSource[1].position.xyz, gl_LightSource[1].diffuse.rgb, 1.0);
+ col.rgb = scaleDownLight(col.rgb);
+ col.rgb += atmosAmbient(baseCol.rgb);
+ col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, gl_LightSource[0].position.xyz,atmosGetDiffuseSunlightColor() * baseCol.a, 1.0));
+
+ col.rgb = min(col.rgb * color.rgb, 1.0);
+ specularColor.rgb = min(specularColor.rgb * specularSum.rgb, 1.0);
+
+ col.rgb += specularColor.rgb;
+
+ return col;
+}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
new file mode 100644
index 0000000000..e5361033ef
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl
@@ -0,0 +1,29 @@
+/**
+ * @file sumLightsV.glsl
+ *
+ * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+float calcDirectionalLight(vec3 n, vec3 l);
+
+vec3 atmosAmbient(vec3 light);
+vec3 atmosAffectDirectionalLight(float lightIntensity);
+vec3 scaleDownLight(vec3 light);
+
+vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
+{
+ vec4 col;
+ col.a = color.a;
+
+ col.rgb = gl_LightSource[1].diffuse.rgb * calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
+ col.rgb = scaleDownLight(col.rgb);
+ col.rgb += atmosAmbient(baseLight.rgb);
+ col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, gl_LightSource[0].position.xyz));
+
+ col.rgb = min(col.rgb*color.rgb, 1.0);
+
+ return col;
+}
+
+
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl
new file mode 100755
index 0000000000..1b0ffb911a
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file fullbrightF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void fullbright_lighting();
+
+void main()
+{
+ fullbright_lighting();
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl
new file mode 100644
index 0000000000..936c228b4e
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file fullbrightShinyF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void fullbright_shiny_lighting();
+
+void main()
+{
+ fullbright_shiny_lighting();
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
new file mode 100755
index 0000000000..ba2aa024dc
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
@@ -0,0 +1,29 @@
+/**
+ * @file fullbrightShinyV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void calcAtmospherics(vec3 inPositionEye);
+
+uniform vec4 origin;
+
+void main()
+{
+ //transform vertex
+ gl_Position = ftransform();
+
+ vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
+ vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 ref = reflect(pos.xyz, -norm);
+
+ gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = gl_Color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
new file mode 100755
index 0000000000..e64ccb844d
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
@@ -0,0 +1,23 @@
+/**
+ * @file fullbrightV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ gl_Position = ftransform();
+ gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+
+ vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
+
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = gl_Color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl
new file mode 100755
index 0000000000..fd855aa910
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightWaterF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file fullbrightWaterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void fullbright_lighting_water();
+
+void main()
+{
+ fullbright_lighting_water();
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl
index 694213219e..bdb0b05f97 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinyF.glsl
@@ -1,13 +1,13 @@
-void applyScatter(inout vec3 col);
+/**
+ * @file shinyF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
-uniform samplerCube environmentMap;
+void shiny_lighting();
void main()
{
- vec3 ref = textureCube(environmentMap, gl_TexCoord[0].xyz).rgb;
-
- applyScatter(ref);
-
- gl_FragColor.rgb = ref;
- gl_FragColor.a = gl_Color.a;
+ shiny_lighting();
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
index 16fba0154b..c2e1ddf734 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
@@ -1,27 +1,30 @@
-void default_scatter(vec3 viewVec, vec3 lightDir);
+/**
+ * @file shinyV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void calcAtmospherics(vec3 inPositionEye);
uniform vec4 origin;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = ftransform(); //gl_ModelViewProjectionMatrix * gl_Vertex;
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
+ vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+
+ calcAtmospherics(pos.xyz);
gl_FrontColor = gl_Color;
- vec3 ref = reflect(pos, norm);
-
- vec3 d = pos - origin.xyz;
- float dist = dot(normalize(d), ref);
- vec3 e = d + (ref * max(origin.w-dist, 0.0));
-
- ref = e - origin.xyz;
+ vec3 ref = reflect(pos.xyz, -norm);
gl_TexCoord[0] = gl_TextureMatrix[0]*vec4(ref,1.0);
- default_scatter(pos.xyz, gl_LightSource[0].position.xyz);
+ gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl
new file mode 100755
index 0000000000..0a2a5f624b
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/shinyWaterF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file shinyWaterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void shiny_lighting_water();
+
+void main()
+{
+ shiny_lighting_water();
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl
index ce5ab12b74..7dacca4fe1 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleF.glsl
@@ -1,3 +1,10 @@
+/**
+ * @file simpleF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
void default_lighting();
void main()
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
index 2aa3521931..0df89c8fc3 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
@@ -1,20 +1,26 @@
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
-void default_scatter(vec3 viewVec, vec3 lightDir);
+/**
+ * @file simpleV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
-attribute vec4 materialColor;
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = ftransform(); //gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
- default_scatter(pos, gl_LightSource[0].position.xyz);
+ vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+
+ calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos, norm, materialColor, gl_Color);
+ vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl
new file mode 100755
index 0000000000..e066b3d02f
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file simpleWaterF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void default_lighting_water();
+
+void main()
+{
+ default_lighting_water();
+}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl
new file mode 100644
index 0000000000..248c322011
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file atmosphericsF.glsl
+ *
+ * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+vec3 atmosLighting(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
new file mode 100644
index 0000000000..c2c39e2e10
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
@@ -0,0 +1,34 @@
+/**
+ * @file atmosphericsHelpersV.glsl
+ *
+ * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+vec3 atmosAmbient(vec3 light)
+{
+ return gl_LightModel.ambient.rgb + light;
+}
+
+vec3 atmosAffectDirectionalLight(float lightIntensity)
+{
+ return gl_LightSource[0].diffuse.rgb * lightIntensity;
+}
+
+vec3 atmosGetDiffuseSunlightColor()
+{
+ return gl_LightSource[0].diffuse.rgb;
+}
+
+vec3 scaleDownLight(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+
+vec3 scaleUpLight(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
new file mode 100644
index 0000000000..551b643403
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
@@ -0,0 +1,15 @@
+/**
+ * @file atmosphericsV.glsl
+ *
+ * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+void setPositionEye(vec3 v);
+
+void calcAtmospherics(vec3 inPositionEye)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ setPositionEye(inPositionEye);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
new file mode 100644
index 0000000000..c001a4070b
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file atmosphericVarsF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+varying vec3 vary_PositionEye;
+
+vec3 getPositionEye()
+{
+ return vary_PositionEye;
+}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
new file mode 100644
index 0000000000..1b263b0854
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
@@ -0,0 +1,19 @@
+/**
+ * @file atmosphericVarsV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+varying vec3 vary_PositionEye;
+
+
+vec3 getPositionEye()
+{
+ return vary_PositionEye;
+}
+
+void setPositionEye(vec3 v)
+{
+ vary_PositionEye = v;
+}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
new file mode 100644
index 0000000000..c1ffda1596
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
@@ -0,0 +1,19 @@
+/**
+ * @file gammaF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+uniform vec4 gamma;
+
+/// Soft clips the light with a gamma correction
+vec3 scaleSoftClip(vec3 light) {
+ // For compatibility with lower cards. Do nothing.
+ return light;
+}
+
+vec3 fullbrightScaleSoftClip(vec3 light) {
+ return scaleSoftClip(light);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl
new file mode 100644
index 0000000000..7097906fdd
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl
@@ -0,0 +1,26 @@
+/**
+ * @file transportF.glsl
+ *
+ * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+vec3 atmosTransport(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+
+vec3 fullbrightAtmosTransport(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+
+
+vec3 fullbrightShinyAtmosTransport(vec3 light)
+{
+ /* stub function for fallback compatibility on class1 hardware */
+ return light;
+}
+