terravisor/shaders/tessellation_eval.glsl

26 lines
746 B
Plaintext
Raw Normal View History

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