diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment/waterV.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/environment/waterV.glsl | 30 |
1 files changed, 17 insertions, 13 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..f66ba1d2d9 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -22,8 +22,11 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; void calcAtmospherics(vec3 inPositionEye); @@ -33,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) { @@ -45,8 +48,7 @@ float wave(vec2 v, float t, float f, vec2 d, float s) void main() { //transform vertex - vec4 position = gl_Vertex; - mat4 modelViewProj = gl_ModelViewProjectionMatrix; + mat4 modelViewProj = modelview_projection_matrix; vec4 oPosition; @@ -57,27 +59,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 = modelview_matrix*pos; - calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz); + calcAtmospherics(pos.xyz); //pass wave parameters to pixel shader |