terravisor/shaders/tessellation_eval.glsl

18 lines
557 B
GLSL

#version 430
layout(quads, equal_spacing, ccw) in; // Define the type of patch (e.g., quads)
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;
gl_Position = vec4(pos, 1.0);
}