terravisor/shaders/tessellation_ctrl.glsl

31 lines
1.1 KiB
Plaintext
Raw Normal View History

2024-08-15 13:53:52 -04:00
#version 450 core
2024-08-15 13:53:52 -04:00
layout(vertices = 4) out;
2024-08-15 13:53:52 -04:00
in VS_OUT {
vec3 position;
vec2 texCoord;
} tc_in[];
2024-08-15 00:56:29 -04:00
2024-08-15 13:53:52 -04:00
out TC_OUT {
vec3 position;
vec2 texCoord;
} tc_out[];
2024-08-15 00:56:29 -04:00
2024-08-16 00:15:26 -04:00
uniform float tessellationFactor = 64.0f;
2024-08-15 13:53:52 -04:00
void main() {
// Pass through position and texture coordinates to the tessellation evaluation shader
tc_out[gl_InvocationID].position = tc_in[gl_InvocationID].position;
tc_out[gl_InvocationID].texCoord = tc_in[gl_InvocationID].texCoord;
// Set tessellation levels
if (gl_InvocationID == 0) {
2024-08-15 13:53:52 -04:00
gl_TessLevelOuter[0] = tessellationFactor; // Level of tessellation along one edge
gl_TessLevelOuter[1] = tessellationFactor; // Level of tessellation along another edge
gl_TessLevelOuter[2] = tessellationFactor; // Level of tessellation along the other edge
gl_TessLevelOuter[3] = tessellationFactor; // Level of tessellation along the other edge
gl_TessLevelInner[0] = tessellationFactor; // Level of tessellation for the inner part
gl_TessLevelInner[1] = tessellationFactor; // Level of tessellation for the inner part
}
2024-08-15 13:53:52 -04:00
}