summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-28 01:42:01 +0100
committerskal <pascal.massimino@gmail.com>2026-01-28 01:42:01 +0100
commit7c66176026ef142d3dde9a8df30f46d37bf1c52f (patch)
tree00127fb4742e099596e8c5298a15cc1aae5f7a04 /src
parentbc7411f855b1580e4cfbd067106222e98e59d49f (diff)
update SESSION_NOTES
Diffstat (limited to 'src')
-rw-r--r--src/gpu/shader.wgsl43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/gpu/shader.wgsl b/src/gpu/shader.wgsl
index 4e0ec11..371e27f 100644
--- a/src/gpu/shader.wgsl
+++ b/src/gpu/shader.wgsl
@@ -1,14 +1,39 @@
+struct Uniforms {
+ audio_peak : f32,
+};
+
+@group(0) @binding(0) var<uniform> uniforms : Uniforms;
+
@vertex
-fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4<f32> {
- var pos = array<vec2<f32>, 3>(
- vec2<f32>(-1.0, -1.0),
- vec2<f32>( 3.0, -1.0),
- vec2<f32>(-1.0, 3.0)
- );
- return vec4<f32>(pos[i], 0.0, 1.0);
+fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<f32> {
+ let num_sides = 7.0;
+ let angle = f32(vertex_index) * 2.0 * PI / num_sides;
+
+ // Base size and pulsating scale based on audio peak
+ let base_scale = 0.5;
+ let pulse_scale = 0.2 * uniforms.audio_peak;
+ let scale = base_scale + pulse_scale;
+
+ let x = scale * cos(angle);
+ let y = scale * sin(angle);
+
+ // Vertices for a heptagon (fan from center)
+ if (vertex_index == 0) { return vec4<f32>(0.0, 0.0, 0.0, 1.0); } // Center
+ else if (vertex_index == 1) { return vec4<f32>(x, y, 0.0, 1.0); } // First point
+ else { // Subsequent points connect to the center and previous point
+ let prev_angle = f32(vertex_index - 1) * 2.0 * PI / num_sides;
+ let prev_x = scale * cos(prev_angle);
+ let prev_y = scale * sin(prev_angle);
+ return vec4<f32>(prev_x, prev_y, 0.0, 1.0);
+ }
}
@fragment
fn fs_main() -> @location(0) vec4<f32> {
- return vec4<f32>(0.0, 0.0, 0.0, 1.0);
-}
+ // Simple color, maybe with a hue shift based on audio peak
+ let hue = uniforms.audio_peak * 0.5; // Adjust as needed for desired color range
+ let r = sin(hue + 0.0) * 0.5 + 0.5;
+ let g = sin(hue + 2.0) * 0.5 + 0.5;
+ let b = sin(hue + 4.0) * 0.5 + 0.5;
+ return vec4<f32>(r, g, b, 1.0);
+} \ No newline at end of file