Weiter gearbeitet

This commit is contained in:
2026-06-16 07:03:08 +02:00
parent a80269e681
commit a369647e9c
531 changed files with 8327 additions and 1381 deletions

View File

@@ -0,0 +1,29 @@
layout(vertices = 3) out;
in vec3 vWorldPos[];
in vec3 vNormal[];
out vec3 tcWorldPos[];
out vec3 tcNormal[];
uniform float m_TessellationLevel;
uniform vec3 g_CameraPosition;
void main() {
tcWorldPos[gl_InvocationID] = vWorldPos[gl_InvocationID];
tcNormal[gl_InvocationID] = vNormal[gl_InvocationID];
if (gl_InvocationID == 0) {
vec3 center = (vWorldPos[0] + vWorldPos[1] + vWorldPos[2]) / 3.0;
float dist = distance(g_CameraPosition, center);
// Maximum subdivision close-up, falls to 1 at 64 m
float level = mix(m_TessellationLevel, 1.0, clamp(dist / 64.0, 0.0, 1.0));
level = max(1.0, level);
gl_TessLevelOuter[0] = level;
gl_TessLevelOuter[1] = level;
gl_TessLevelOuter[2] = level;
gl_TessLevelInner[0] = level;
}
}