diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-01-31 02:51:16 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-01-31 02:51:16 +0000 |
| commit | bc0958cc863083b4082161bf12456fdf28ab1c77 (patch) | |
| tree | f970782f232d86325f14a36b83125791f24335af /gfx/gl/shaders/networkCurve.tesc | |
| parent | Initial commit using tesselation shader to create curves (diff) | |
| download | ilt-bc0958cc863083b4082161bf12456fdf28ab1c77.tar.bz2 ilt-bc0958cc863083b4082161bf12456fdf28ab1c77.tar.xz ilt-bc0958cc863083b4082161bf12456fdf28ab1c77.zip | |
Rename shader source in keeping with glsl expectations
Swaps name/type of generated files to match class names and source
files.
Diffstat (limited to 'gfx/gl/shaders/networkCurve.tesc')
| -rw-r--r-- | gfx/gl/shaders/networkCurve.tesc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gfx/gl/shaders/networkCurve.tesc b/gfx/gl/shaders/networkCurve.tesc new file mode 100644 index 0000000..4221e64 --- /dev/null +++ b/gfx/gl/shaders/networkCurve.tesc @@ -0,0 +1,43 @@ +#version 460 core + +layout(vertices = 1) out; +flat in ivec3 apos[]; +flat in ivec3 bpos[]; +flat in ivec3 cpos[]; +flat in float reps[]; +flat in float aangle[]; +flat in float bangle[]; +flat in float radius[]; + +flat out ivec3 c_apos[]; +flat out ivec3 c_bpos[]; +flat out ivec3 c_cpos[]; +flat out float c_reps[]; +flat out float c_aangle[]; +flat out float c_bangle[]; +flat out float c_radius[]; + +int +min2pow(float target) +{ + int x = 1; + while (x < target) { + x <<= 1; + } + return x; +} + +void +main() +{ + c_apos[gl_InvocationID] = apos[gl_InvocationID]; + c_bpos[gl_InvocationID] = bpos[gl_InvocationID]; + c_cpos[gl_InvocationID] = cpos[gl_InvocationID]; + c_reps[gl_InvocationID] = reps[gl_InvocationID]; + c_aangle[gl_InvocationID] = aangle[gl_InvocationID]; + c_bangle[gl_InvocationID] = bangle[gl_InvocationID]; + c_radius[gl_InvocationID] = radius[gl_InvocationID]; + + gl_TessLevelOuter[0] = 1; + gl_TessLevelOuter[1] = min2pow(reps[gl_InvocationID]); +} |
