diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment')
7 files changed, 53 insertions, 34 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl index c61d5a2a08..5d72390d2d 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl @@ -29,13 +29,18 @@ uniform sampler2D detail0; uniform sampler2D detail1; uniform sampler2D alphaRamp; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + 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, + float a = texture2D(alphaRamp, vary_texcoord1.xy).a; + vec3 color = mix(texture2D(detail1, vary_texcoord2.xy).rgb, + texture2D(detail0, vary_texcoord0.xy).rgb, a); gl_FragColor.rgb = color; - gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a; + gl_FragColor.a = texture2D(alphaRamp, vary_texcoord3.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 04b3033dd8..d4a62db684 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -31,14 +31,22 @@ uniform mat4 texture_matrix3; 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; -attribute vec2 texcoord2; -attribute vec2 texcoord3; +uniform vec4 object_plane_t; +uniform vec4 object_plane_s; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; +ATTRIBUTE vec2 texcoord2; +ATTRIBUTE vec2 texcoord3; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); @@ -61,15 +69,15 @@ void main() //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vec4 pos = modelview_matrix * position; + vec4 pos = modelview_matrix * vec4(position, 1.0); vec3 norm = normalize(normal_matrix * normal); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color); - gl_FrontColor = color; + vertex_color = color; - gl_TexCoord[0] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),texture_matrix0,gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]); - gl_TexCoord[1] = texture_matrix1*vec4(texcoord1,0,1); - gl_TexCoord[2] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),texture_matrix2,gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]); - gl_TexCoord[3] = texture_matrix3*vec4(texcoord3,0,1); + vary_texcoord0 = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),texture_matrix0,object_plane_s,object_plane_t).xy; + vary_texcoord1 = (texture_matrix1*vec4(texcoord1,0,1)).xy; + vary_texcoord2 = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),texture_matrix2,object_plane_s,object_plane_t).xy; + vary_texcoord3 = (texture_matrix3*vec4(texcoord3,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl index 711b42b95e..307b87e086 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl @@ -31,13 +31,18 @@ uniform sampler2D detail0; uniform sampler2D detail1; uniform sampler2D alphaRamp; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + 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, + float a = texture2D(alphaRamp, vary_texcoord1.xy).a; + vec3 color = mix(texture2D(detail1, vary_texcoord2.xy).rgb, + texture2D(detail0, vary_texcoord0.xy).rgb, a); gl_FragColor.rgb = color; - gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a; + gl_FragColor.a = texture2D(alphaRamp, vary_texcoord3.xy).a; } diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl index 72e8e739b3..48eea0bdda 100644 --- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl @@ -33,9 +33,9 @@ uniform float refScale; uniform vec4 waterFogColor; //bigWave is (refCoord.w, view.w); -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; void main() { diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index 4d555b566a..1bb04ceb34 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -50,9 +50,9 @@ uniform float blurMultiplier; uniform vec4 fogCol; //bigWave is (refCoord.w, view.w); -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; void main() { diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index d44690d1fb..e4db326bed 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -24,15 +24,16 @@ */ +VARYING float fog_depth; vec4 applyWaterFog(vec4 color) { // GL_EXP2 Fog - //float fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord); + //float fog = exp(-gl_Fog.density * gl_Fog.density * fog_depth * fog_depth); // GL_EXP Fog - // float fog = exp(-gl_Fog.density * gl_FogFragCoord); + // float fog = exp(-gl_Fog.density * fog_depth); // GL_LINEAR Fog - float fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale; + float fog = (gl_Fog.end - fog_depth) * 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 99433ada7b..f66ba1d2d9 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -26,7 +26,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; void calcAtmospherics(vec3 inPositionEye); @@ -36,9 +36,9 @@ uniform float time; uniform vec3 eyeVec; uniform float waterHeight; -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; float wave(vec2 v, float t, float f, vec2 d, float s) { |