summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment/waterV.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterV.glsl18
1 files changed, 10 insertions, 8 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
index 610c06fbbc..831a7de0ea 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -24,6 +24,7 @@
*/
+attribute vec3 position;
void calcAtmospherics(vec3 inPositionEye);
@@ -45,7 +46,6 @@ float wave(vec2 v, float t, float f, vec2 d, float s)
void main()
{
//transform vertex
- vec4 position = gl_Vertex;
mat4 modelViewProj = gl_ModelViewProjectionMatrix;
vec4 oPosition;
@@ -57,27 +57,29 @@ void main()
float d = length(oEyeVec.xy);
float ld = min(d, 2560.0);
- position.xy = eyeVec.xy + oEyeVec.xy/d*ld;
+ vec3 lpos = position;
+ lpos.xy = eyeVec.xy + oEyeVec.xy/d*ld;
view.xyz = oEyeVec;
d = clamp(ld/1536.0-0.5, 0.0, 1.0);
d *= d;
- oPosition = position;
+ oPosition = vec4(lpos, 1.0);
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;
+ vec3 v = lpos;
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;
+ vec4 pos;
+ pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+ pos.w = 1.0;
+ pos = gl_ModelViewMatrix*pos;
- calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
+ calcAtmospherics(pos.xyz);
//pass wave parameters to pixel shader