44 lines
1.0 KiB
GLSL
44 lines
1.0 KiB
GLSL
#version 450 core
|
|
|
|
layout(vertices = 4) out;
|
|
|
|
layout(binding = 0) uniform sampler2D heightTexture;
|
|
uniform float tessellationFactor;
|
|
|
|
layout(std140, binding = 4) uniform GeoUniforms
|
|
{
|
|
mat4 PV;
|
|
mat4 M;
|
|
|
|
float minTessellation;
|
|
float maxTessellation;
|
|
float displacementScale;
|
|
int gridDensity;
|
|
};
|
|
|
|
in VS_OUT {
|
|
vec3 position;
|
|
vec2 texCoord;
|
|
} tc_in[];
|
|
|
|
out TC_OUT {
|
|
vec3 position;
|
|
vec2 texCoord;
|
|
} tc_out[];
|
|
|
|
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) {
|
|
gl_TessLevelOuter[0] = maxTessellation;
|
|
gl_TessLevelOuter[1] = maxTessellation;
|
|
gl_TessLevelOuter[2] = maxTessellation;
|
|
gl_TessLevelOuter[3] = maxTessellation;
|
|
|
|
gl_TessLevelInner[0] = maxTessellation;
|
|
gl_TessLevelInner[1] = maxTessellation;
|
|
}
|
|
} |