Debian Codegraph @

tests/manual/tessellation-modes/shaders/quads.tes

raw
1 #version 400 core
2
3 layout( quads, fractional_even_spacing, ccw ) in;
4
5 out EyeSpaceVertex {
6 vec3 position;
7 vec3 normal;
8 } te_out;
9
10 uniform mat4 modelView;
11 uniform mat3 modelViewNormal;
12 uniform mat4 projectionMatrix;
13 uniform mat4 mvp;
14
15 void main()
16 {
17 float u = gl_TessCoord.x;
18 float v = gl_TessCoord.y;
19
20 vec4 p00 = gl_in[0].gl_Position;
21 vec4 p10 = gl_in[1].gl_Position;
22 vec4 p11 = gl_in[2].gl_Position;
23 vec4 p01 = gl_in[3].gl_Position;
24
25 // Linearly interpolate to the vertex position using the
26 // (u,v) barycentric coords
27 vec4 pos = p00 * ( 1.0 - u ) * ( 1.0 - v )
28 + p10 * u * ( 1.0 - v )
29 + p01 * v * ( 1.0 - u )
30 + p11 * u * v;
31
32 // Transform to eye space (for lighting calcs)
33 te_out.position = vec3( modelView * pos );
34
35 // Assume normal points along z
36 te_out.normal = normalize( modelViewNormal * vec3( 0.0, 0.0, 1.0 ) );
37
38 // Transform to clip-space
39 gl_Position = mvp * pos;
40 }