From 9bd77e54943d954291b5faef287ccca5dcebd7a4 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 00:15:15 -0300 Subject: examples: micscope and spheres come home, as they were, building Both lived outside any repository, beside sketchbook, with manifests that pointed at ../01-drat-meout/lib/sketchbook, which no longer exists. They are copied into examples/micscope and examples/spheres (their sources, shaders, tests, test material and web icons; not their caches, builds, packages, state files or .gitignore, which the root's covers), their manifests depend on "../.." as the other examples do, and their READMEs link sketchbook there. Nothing else changed: both build against today's library and pass their own zig build test (micscope 62/62 steps, 11/11 tests, its transport, record, render and tuner scripts; spheres 75/75 steps, 3/3 tests, its play script). The originals are untouched. micscope's test/reference.flac (3.7 MiB, CC BY-SA 3.0, credited in its test/README.md) is the rendering reference its render script opens. The README lists both examples. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- examples/spheres/shaders/advance.comp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/spheres/shaders/advance.comp (limited to 'examples/spheres/shaders/advance.comp') diff --git a/examples/spheres/shaders/advance.comp b/examples/spheres/shaders/advance.comp new file mode 100644 index 0000000..e1e8789 --- /dev/null +++ b/examples/spheres/shaders/advance.comp @@ -0,0 +1,32 @@ +#version 450 +#extension GL_GOOGLE_include_directive : require +// After synth.comp: where the block's phases ended, wrapped, for the next +// block to start from; and the voices and coupling it ended on, to glide +// from. (The coupling pushes phases without moving them on, so the phases +// need nothing from it.) +layout(local_size_x = 1) in; + +#include "SynthParams.glsl" + +layout(set = 1, binding = 0) buffer Voices { vec4 voices[]; }; +layout(set = 1, binding = 1) buffer Phases { vec4 phases[]; }; + +const float TAU = 6.28318530718; + +void main() { + float count = float(u.count); + for (int i = 0; i < 3; i++) { + vec4 from = voices[i]; + vec4 to = voices[3 + i]; + vec4 phase = phases[i]; + float wc0 = TAU * from.x / u.rate; + float wc1 = TAU * to.x / u.rate; + // As synth.comp's glide at n = count. + float c = phase.x + 0.5 * (wc0 + wc1) * count; + float m = phase.y + 0.5 * (wc0 * from.y + wc1 * to.y) * count; + float fm = phase.z + (c - phase.x) + to.z / max(to.y, 1e-3) * (sin(m) - sin(phase.y)); + phases[i] = vec4(mod(c, TAU), mod(m, TAU), mod(fm, TAU), 0.0); + voices[i] = to; + voices[6 + i] = voices[9 + i]; + } +} -- cgit v1.3