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/sprite.vert | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/spheres/shaders/sprite.vert (limited to 'examples/spheres/shaders/sprite.vert') diff --git a/examples/spheres/shaders/sprite.vert b/examples/spheres/shaders/sprite.vert new file mode 100644 index 0000000..13e1c73 --- /dev/null +++ b/examples/spheres/shaders/sprite.vert @@ -0,0 +1,23 @@ +#version 450 +#extension GL_GOOGLE_include_directive : require +// A soft disc per body: of every system from `first` for `count` systems, +// at `radius` pixels, coloured by body. Six vertices make each quad. +layout(location = 0) out vec2 corner; +layout(location = 1) out vec4 color; + +#include "SkyView.glsl" + +layout(set = 0, binding = 0) readonly buffer Bodies { vec4 bodies[]; }; + +const vec2 corners[6] = vec2[](vec2(-1, -1), vec2(1, -1), vec2(1, 1), vec2(-1, -1), vec2(1, 1), vec2(-1, 1)); +// Match main.zig's palette. +const vec3 palette[3] = vec3[](vec3(0.40, 0.85, 1.0), vec3(1.0, 0.45, 0.82), vec3(1.0, 0.80, 0.35)); + +void main() { + uint sprite = uint(gl_VertexIndex) / 6u; + uint index = 3u * u.first + sprite; + vec2 at = (bodies[index].xy - u.center) / u.per_pixel + corners[uint(gl_VertexIndex) % 6u] * u.radius; + gl_Position = vec4(at * 2.0 / u.size, 0.0, 1.0); + corner = corners[uint(gl_VertexIndex) % 6u]; + color = vec4(palette[index % 3u], 1.0) * u.alpha; +} -- cgit v1.3