summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
-rw-r--r--indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl121
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl38
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class2/effects/blurV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/environment/terrainV.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/shinyV.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl57
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/simpleV.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl11
23 files changed, 412 insertions, 150 deletions
diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
index f9f376c2b7..43e19909d4 100644
--- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -31,17 +39,17 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = 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);
+ vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
// vec4 specular = specularColor;
vec4 specular = vec4(1.0);
- vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
+ vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
new file mode 100644
index 0000000000..294a000ab5
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
@@ -0,0 +1,121 @@
+/**
+ * @file alphaNonIndexedNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2DRectShadow shadowMap0;
+uniform sampler2DRectShadow shadowMap1;
+uniform sampler2DRectShadow shadowMap2;
+uniform sampler2DRectShadow shadowMap3;
+uniform sampler2DRect depthMap;
+uniform sampler2D diffuseMap;
+
+uniform mat4 shadow_matrix[6];
+uniform vec4 shadow_clip;
+uniform vec2 screen_res;
+uniform vec2 shadow_res;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+varying vec3 vary_ambient;
+varying vec3 vary_directional;
+varying vec3 vary_fragcoord;
+varying vec3 vary_position;
+varying vec3 vary_pointlight_col;
+
+uniform float shadow_bias;
+
+uniform mat4 inv_proj;
+
+vec4 getPosition(vec2 pos_screen)
+{
+ float depth = texture2DRect(depthMap, pos_screen.xy).a;
+ vec2 sc = pos_screen.xy*2.0;
+ sc /= screen_res;
+ sc -= vec2(1.0,1.0);
+ vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
+ vec4 pos = inv_proj * ndc;
+ pos.xyz /= pos.w;
+ pos.w = 1.0;
+ return pos;
+}
+
+float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
+{
+ stc.xyz /= stc.w;
+ stc.z += shadow_bias;
+
+ float cs = shadow2DRect(shadowMap, stc.xyz).x;
+ float shadow = cs;
+
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs);
+
+ return shadow/5.0;
+}
+
+
+void main()
+{
+ vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
+ frag *= screen_res;
+
+ float shadow = 1.0;
+ vec4 pos = vec4(vary_position, 1.0);
+
+ vec4 spos = pos;
+
+ if (spos.z > -shadow_clip.w)
+ {
+ vec4 lpos;
+
+ if (spos.z < -shadow_clip.z)
+ {
+ lpos = shadow_matrix[3]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap3, lpos, 1.5);
+ shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
+ }
+ else if (spos.z < -shadow_clip.y)
+ {
+ lpos = shadow_matrix[2]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap2, lpos, 1.5);
+ }
+ else if (spos.z < -shadow_clip.x)
+ {
+ lpos = shadow_matrix[1]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap1, lpos, 1.5);
+ }
+ else
+ {
+ lpos = shadow_matrix[0]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap0, lpos, 1.5);
+ }
+ }
+
+ vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy);
+
+ vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, 1.0);
+ vec4 color = diff * col;
+
+ color.rgb = atmosLighting(color.rgb);
+
+ color.rgb = scaleSoftClip(color.rgb);
+
+ color.rgb += diff.rgb * vary_pointlight_col.rgb;
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
index 20121da52d..df4d26997a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
@@ -21,8 +21,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -76,18 +84,18 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position, 1.0)).xyz;
- gl_Position = gl_ProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = projection_matrix * vec4(pos, 1.0);
- vec4 n = gl_Vertex;
- n.xyz += gl_Normal.xyz;
+ vec4 n = vec4(position, 1.0);
+ n.xyz += normal.xyz;
n.xyz = (mat*n).xyz;
n.xyz = normalize(n.xyz-pos.xyz);
@@ -98,8 +106,8 @@ void main()
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -109,23 +117,23 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
gl_FrontColor = col;
gl_FogFragCoord = pos.z;
- pos.xyz = (gl_ModelViewProjectionMatrix * gl_Vertex).xyz;
+ pos.xyz = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index 307ae30098..996203ffd6 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -79,22 +87,22 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz, 1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix * vert;
-
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec4 vert = vec4(position.xyz, 1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(normal_matrix * normal);
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -104,23 +112,23 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = col.rgb*gl_Color.rgb;
+ col.rgb = col.rgb*diffuse_color.rgb;
gl_FrontColor = col;
gl_FogFragCoord = pos.z;
- pos = gl_ModelViewProjectionMatrix * vert;
+ pos = modelview_projection_matrix * vert;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
index 80f386ecb0..3e35675784 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
@@ -23,7 +23,11 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
@@ -79,32 +83,31 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- gl_Position = gl_ProjectionMatrix * pos;
+ gl_Position = projection_matrix * pos;
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -114,17 +117,17 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb;
+ vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), 0.0));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb, 1.0);
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
index 9deff7bb2a..1f5470db3c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
@@ -23,7 +23,9 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 0b31cbefd1..4c92d72f44 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -54,7 +54,10 @@ uniform float sun_wash;
uniform int proj_shadow_idx;
uniform float shadow_fade;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform float size;
+uniform vec3 color;
+uniform float falloff;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -128,9 +131,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
+ vec3 lv = center.xyz-pos.xyz;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -161,7 +164,7 @@ void main()
proj_tc.xyz /= proj_tc.w;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
if (dist_atten <= 0.0)
{
@@ -193,7 +196,7 @@ void main()
vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+ vec3 lcol = color.rgb * plcol.rgb * plcol.a;
lit = da * dist_atten * noise;
@@ -210,7 +213,7 @@ void main()
amb_da = min(amb_da, 1.0-lit);
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+ col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
}
@@ -243,7 +246,7 @@ void main()
stc.y > 0.0)
{
vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
+ col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index d7407332e5..22f52032a5 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -65,7 +65,8 @@ uniform mat3 ssao_effect_mat;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-varying vec4 vary_light;
+uniform vec3 sun_dir;
+
varying vec2 vary_fragcoord;
vec3 vary_PositionEye;
@@ -282,7 +283,7 @@ void main()
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
- float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
+ float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
@@ -309,7 +310,7 @@ void main()
// the old infinite-sky shiny reflection
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnormpersp, vary_light.xyz);
+ float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
index fed238510a..424299269f 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
@@ -22,23 +22,21 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
uniform vec2 screen_res;
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
+
void main()
{
//transform vertex
- gl_Position = ftransform();
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
-
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
- vary_light = gl_MultiTexCoord0;
+ vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 1809cff1e5..146fac56e9 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -48,12 +48,12 @@ uniform float ssao_factor;
uniform float ssao_factor_inv;
varying vec2 vary_fragcoord;
-varying vec4 vary_light;
uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform vec2 shadow_res;
uniform vec2 proj_shadow_res;
+uniform vec3 sun_dir;
uniform float shadow_bias;
uniform float shadow_offset;
@@ -132,10 +132,10 @@ void main()
}*/
float shadow = 1.0;
- float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
+ float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
vec3 shadow_pos = pos.xyz + displace*norm;
- vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
+ vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 681186d6b2..60741771d6 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -47,7 +47,7 @@ uniform float ssao_factor;
uniform float ssao_factor_inv;
varying vec2 vary_fragcoord;
-varying vec4 vary_light;
+uniform vec3 sun_dir;
uniform mat4 inv_proj;
uniform vec2 screen_res;
@@ -184,10 +184,10 @@ void main()
}*/
float shadow = 1.0;
- float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
+ float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
vec3 shadow_pos = pos.xyz + displace*norm;
- vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
+ vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
index e7ab11c6ed..60ba2d7ad4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
@@ -1,5 +1,5 @@
/**
- * @file sunLightF.glsl
+ * @file sunLightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -22,10 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -33,13 +34,8 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vary_light = gl_MultiTexCoord0;
-
- gl_FrontColor = gl_Color;
+ vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
index 3e47ed15fe..4fd4b101ff 100644
--- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
uniform vec2 texelSize;
uniform vec2 blurDirection;
@@ -32,10 +35,10 @@ uniform float blurWidth;
void main(void)
{
// Transform vertex
- gl_Position = ftransform();
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth);
- vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0);
+ vec2 s = vec4(texcoord0,0,1).st - (blurDelta * 3.0);
// for (int i = 0; i < 7; i++) {
// gl_TexCoord[i].st = s + (i * blurDelta);
diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
index 25806cd914..d3c93ab05f 100644
--- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
@@ -22,13 +22,18 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void main(void)
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_MultiTexCoord1;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_TexCoord[1] = vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
index 36d0c99b63..69f4d4ae45 100644
--- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
@@ -22,7 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void calcAtmospherics(vec3 inPositionEye);
@@ -46,24 +56,24 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = ftransform();
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec4 pos = gl_ModelViewMatrix * gl_Vertex;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 pos = modelview_matrix * vec4(position.xyz, 1.0);
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
/// Potentially better without it for water.
pos /= pos.w;
- calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
-
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0));
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0));
gl_FrontColor = color;
// Transform and pass tex coords
- gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ gl_TexCoord[0].xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
- vec4 t = gl_MultiTexCoord1;
+ vec4 t = vec4(texcoord1,0,1);
gl_TexCoord[0].zw = t.xy;
gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
index ad045a3058..55dfab2aa1 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
@@ -23,8 +23,6 @@
* $/LicenseInfo$
*/
-
-
float calcDirectionalLight(vec3 n, vec3 l);
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
index 819b28e4fd..b9eff87a13 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
void calcAtmospherics(vec3 inPositionEye);
@@ -31,23 +36,28 @@ uniform vec4 origin;
varying float vary_texture_index;
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(normal_matrix * 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);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
index abf6e37b7c..b7f7af7885 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
@@ -22,7 +22,15 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
void calcAtmospherics(vec3 inPositionEye);
@@ -32,16 +40,15 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * vert);
-
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
index 44c711701b..4511c4bc91 100644
--- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
@@ -22,8 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
@@ -36,20 +45,20 @@ uniform vec4 origin;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
-
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+
+ vec3 norm = normalize(normal_matrix * 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);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- gl_FrontColor = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0));
+ gl_FrontColor = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0));
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
new file mode 100644
index 0000000000..5f78495ae3
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
@@ -0,0 +1,57 @@
+/**
+ * @file simpleNonIndexedV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+
+ gl_Position = modelview_projection_matrix*vert;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+
+ vec4 pos = (modelview_matrix * vert);
+
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ gl_FrontColor = color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
index b0114763c1..91ee5e016e 100644
--- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -33,18 +41,19 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index c175a834c2..67b5e7fb83 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
//////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -59,12 +62,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
@@ -160,7 +163,7 @@ void main()
// Texture coords
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
gl_TexCoord[0].xy -= 0.5;
gl_TexCoord[0].xy /= cloud_scale.x;
gl_TexCoord[0].xy += 0.5;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index 3a44bb6d26..50fdba64c2 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -23,7 +23,10 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
+attribute vec2 texcoord0;
// SKY ////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -57,12 +60,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
- //vec3 P = gl_Vertex.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
+ //vec3 P = position.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)