Index: ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.vs =================================================================== --- ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.vs +++ ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.vs @@ -6,7 +6,8 @@ uniform mat4 shadowTransform; uniform float repeatScale; uniform float windAngle; -uniform float waviness; // "Wildness" of the reflections and refractions; choose based on texture +// "Wildness" of the reflections and refractions; choose based on texture +uniform float waviness; uniform vec3 sunDir; #if USE_SHADOW_SAMPLER && USE_SHADOW_PCF @@ -16,16 +17,15 @@ uniform float time; uniform float mapSize; -varying float moddedTime; - uniform mat4 transform; +uniform vec3 cameraPos; + +varying float moddedTime; varying vec3 worldPos; varying float waterDepth; varying vec2 waterInfo; -uniform vec3 cameraPos; - varying vec3 v; varying vec4 normalCoords; @@ -46,34 +46,35 @@ void main() { - worldPos = vec3(a_vertex.x,15.0,a_vertex.z); + worldPos = a_vertex; waterInfo = a_waterInfo; waterDepth = a_waterInfo.g; - WindCosSin = vec2(cos(-windAngle),sin(-windAngle)); + WindCosSin = vec2(cos(-windAngle), sin(-windAngle)); float newX = a_vertex.x * WindCosSin.x - a_vertex.z * WindCosSin.y; float newY = a_vertex.x * WindCosSin.y + a_vertex.z * WindCosSin.x; - normalCoords = vec4(newX,newY,time,0.0); + normalCoords = vec4(newX, newY, time, 0.0); normalCoords.xy *= repeatScale; - reflectionCoords = (reflectionMatrix * vec4(a_vertex, 1.0)).rga; // projective texturing + // Projective texturing + reflectionCoords = (reflectionMatrix * vec4(a_vertex, 1.0)).rga; refractionCoords = (refractionMatrix * vec4(a_vertex, 1.0)).rga; losCoords = (losMatrix * vec4(a_vertex, 1.0)).rg; - #if USE_SHADOW && USE_SHADOWS_ON_WATER - v_shadow = shadowTransform * vec4(a_vertex, 1.0); - #if USE_SHADOW_SAMPLER && USE_SHADOW_PCF - v_shadow.xy *= shadowScale.xy; - #endif - #endif +#if USE_SHADOW && USE_SHADOWS_ON_WATER + v_shadow = shadowTransform * vec4(a_vertex, 1.0); +#if USE_SHADOW_SAMPLER && USE_SHADOW_PCF + v_shadow.xy *= shadowScale.xy; +#endif +#endif v = normalize(cameraPos - worldPos); moddedTime = mod(time * 60.0, 8.0) / 8.0; // Fix the waviness for local wind strength - fwaviness = waviness * ((0.15+a_waterInfo.r/1.15)); + fwaviness = waviness * (0.15 + a_waterInfo.r / 1.15); gl_Position = transform * vec4(a_vertex, 1.0); }