layout (location=0) in vec3 a_co; layout (location=1) in vec4 a_norm; layout (location=2) in vec2 a_uv; #include "motion_vectors_vs.glsl" uniform mat4x3 uMdl; uniform mat4 uPv; uniform mat4 uPvmPrev; uniform vec3 uInfo; out vec2 aUv; out vec4 aNorm; out vec3 aCo; out vec3 aWorldCo; void main() { float w = ((a_norm.w)-0.5)*2.0 + fract(uInfo.z) - 0.0; float c = -cos(w*0.6); float s = -sin(w*0.6); float r = 0.2; float w1 = clamp( w*4.0 - a_co.y*10.0, -1.0, 1.0 ) * (3.14159265*0.5); float c1 = cos(w1); float s1 = sin(w1); float yoff = step(0.01,fract(uInfo.z))*-0.5; mat4x3 mlocal; mlocal[0] = vec3(c1, s1,0.0); mlocal[1] = vec3(-s1,c1,0.0); mlocal[2] = vec3(0.0,0.0,1.0); mlocal[3] = vec3(c*r,uInfo.y*0.875 + s*r,uInfo.x*0.5); vec3 local_pos0 = mlocal * vec4( a_co, 1.0 ); vec3 world_pos0 = uMdl * vec4( local_pos0, 1.0 ); vec4 vproj0 = uPv * vec4( world_pos0, 1.0 ); vec4 vproj1 = uPvmPrev * vec4( local_pos0, 1.0 ); vs_motion_out( vproj0, vproj1 ); gl_Position = vproj0; aUv = a_uv + vec2( floor(uInfo.z+0.5)*(1.0/64.0), yoff ); aNorm = vec4( mat3(uMdl) * mat3(mlocal) * a_norm.xyz, a_norm.w ); aCo = a_co; aWorldCo = world_pos0; }