2024-08-14 18:04:06 -04:00
|
|
|
#version 430
|
|
|
|
|
|
|
|
layout(quads, equal_spacing, ccw) in; // Define the type of patch (e.g., quads)
|
|
|
|
|
2024-08-14 19:14:43 -04:00
|
|
|
layout(location = 0) uniform mat4 M;
|
|
|
|
|
|
|
|
layout(std140, binding = 0) uniform SceneUniforms
|
|
|
|
{
|
|
|
|
mat4 PV; //camera projection * view matrix
|
|
|
|
vec4 eye_w; //world-space eye position
|
|
|
|
};
|
|
|
|
|
2024-08-14 18:04:06 -04:00
|
|
|
out vec3 frag_position; // Ensure this matches the input in fragment.glsl
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
// Interpolate the position using the barycentric coordinates from tessellation
|
|
|
|
vec3 pos = mix(mix(gl_in[0].gl_Position.xyz, gl_in[1].gl_Position.xyz, gl_TessCoord.x),
|
|
|
|
mix(gl_in[3].gl_Position.xyz, gl_in[2].gl_Position.xyz, gl_TessCoord.x),
|
|
|
|
gl_TessCoord.y);
|
|
|
|
|
|
|
|
frag_position = pos;
|
|
|
|
|
2024-08-14 19:14:43 -04:00
|
|
|
gl_Position = PV*M*vec4(pos, 1.0);
|
2024-08-14 18:04:06 -04:00
|
|
|
}
|