X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fwater.vs;h=c8ac51bcefa266db568a8c12b23ad7895c2bdf1a;hb=dfee9022b3513fddec36f7ea70867ee5961a44da;hp=dd8b661fd61ee1b403285a0c8bae73962a6c11e4;hpb=1f1d636056450dcd23cce55c0795ec6276272531;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/water.vs b/shaders/water.vs index dd8b661..c8ac51b 100644 --- a/shaders/water.vs +++ b/shaders/water.vs @@ -2,12 +2,20 @@ uniform mat4 uPv; uniform mat4x3 uMdl; +uniform vec4 uDepthBounds; -out vec2 aUv; +out vec4 aUv; +out vec3 aCo; +out float aDepth; void main() { vec3 world_pos = uMdl * vec4( a_co, 1.0 ); gl_Position = uPv * vec4(world_pos,1.0); - aUv = vec2(world_pos[0],world_pos[2])*0.15; + + vec2 depth_coords = (world_pos.xz-uDepthBounds.xy)*uDepthBounds.zw; + aUv = vec4(world_pos.xz*0.01,depth_coords); + aCo = world_pos; + + aDepth = gl_Position.z; }