DonkeyKong64 grind crash
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_sfd.vs
1 layout (location=0) in vec3 a_co;
2 layout (location=1) in vec4 a_norm;
3 layout (location=2) in vec2 a_uv;
4
5 #include "motion_vectors_vs.glsl"
6
7 uniform mat4x3 uMdl;
8 uniform mat4 uPv;
9 uniform mat4 uPvmPrev;
10 uniform vec3 uInfo;
11
12 out vec2 aUv;
13 out vec4 aNorm;
14 out vec3 aCo;
15 out vec3 aWorldCo;
16
17 void main()
18 {
19 float w = ((a_norm.w)-0.5)*2.0 + fract(uInfo.z) - 0.0;
20 float c = -cos(w*0.6);
21 float s = -sin(w*0.6);
22 float r = 0.2;
23
24 float w1 = clamp( w*4.0 - a_co.y*10.0, -1.0, 1.0 ) * (3.14159265*0.5);
25 float c1 = cos(w1);
26 float s1 = sin(w1);
27
28 float yoff = step(0.01,fract(uInfo.z))*-0.5;
29
30 mat4x3 mlocal;
31 mlocal[0] = vec3(c1, s1,0.0);
32 mlocal[1] = vec3(-s1,c1,0.0);
33 mlocal[2] = vec3(0.0,0.0,1.0);
34 mlocal[3] = vec3(c*r,uInfo.y*0.875 + s*r,uInfo.x*0.5);
35
36 vec3 local_pos0 = mlocal * vec4( a_co, 1.0 );
37 vec3 world_pos0 = uMdl * vec4( local_pos0, 1.0 );
38
39 vec4 vproj0 = uPv * vec4( world_pos0, 1.0 );
40 vec4 vproj1 = uPvmPrev * vec4( local_pos0, 1.0 );
41
42 vs_motion_out( vproj0, vproj1 );
43
44 gl_Position = vproj0;
45
46 aUv = a_uv + vec2( floor(uInfo.z+0.5)*(1.0/64.0), yoff );
47 aNorm = vec4( mat3(uMdl) * mat3(mlocal) * a_norm.xyz, a_norm.w );
48 aCo = a_co;
49 aWorldCo = world_pos0;
50 }