From b2ede3f0680edc894a54e28374cb87ab2690afa2 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 16 Feb 2026 14:32:59 +0100 Subject: refactor: remove v2 versioning artifacts, establish Sequence as canonical system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete v1→v2 migration cleanup: rename 29 files (sequence_v2→sequence, effect_v2→effect, 14 effect files, 8 shaders, compiler, docs), update all class names and references across 54 files. Archive v1 timeline. System now uses standard naming with all versioning removed. 30/34 tests passing. Co-Authored-By: Claude Sonnet 4.5 --- workspaces/main/shaders/particle_compute.wgsl | 5 +- workspaces/main/shaders/particle_compute_v2.wgsl | 31 --------- workspaces/main/shaders/particle_render.wgsl | 5 +- workspaces/main/shaders/particle_render_v2.wgsl | 53 -------------- workspaces/main/shaders/rotating_cube.wgsl | 89 ++++++++++++++++++++++++ workspaces/main/shaders/rotating_cube_v2.wgsl | 89 ------------------------ 6 files changed, 95 insertions(+), 177 deletions(-) delete mode 100644 workspaces/main/shaders/particle_compute_v2.wgsl delete mode 100644 workspaces/main/shaders/particle_render_v2.wgsl create mode 100644 workspaces/main/shaders/rotating_cube.wgsl delete mode 100644 workspaces/main/shaders/rotating_cube_v2.wgsl (limited to 'workspaces/main/shaders') diff --git a/workspaces/main/shaders/particle_compute.wgsl b/workspaces/main/shaders/particle_compute.wgsl index ae513c8..d7a24b6 100644 --- a/workspaces/main/shaders/particle_compute.wgsl +++ b/workspaces/main/shaders/particle_compute.wgsl @@ -1,3 +1,4 @@ +// Particle simulation (compute shader) - V2 struct Particle { pos: vec4, vel: vec4, @@ -5,10 +6,10 @@ struct Particle { color: vec4, }; -#include "common_uniforms" +#include "sequence_uniforms" @group(0) @binding(0) var particles: array; -@group(0) @binding(1) var uniforms: CommonUniforms; +@group(0) @binding(1) var uniforms: UniformsSequenceParams; @compute @workgroup_size(64) fn main(@builtin(global_invocation_id) id: vec3) { diff --git a/workspaces/main/shaders/particle_compute_v2.wgsl b/workspaces/main/shaders/particle_compute_v2.wgsl deleted file mode 100644 index 3683826..0000000 --- a/workspaces/main/shaders/particle_compute_v2.wgsl +++ /dev/null @@ -1,31 +0,0 @@ -// Particle simulation (compute shader) - V2 -struct Particle { - pos: vec4, - vel: vec4, - rot: vec4, - color: vec4, -}; - -#include "sequence_v2_uniforms" - -@group(0) @binding(0) var particles: array; -@group(0) @binding(1) var uniforms: UniformsSequenceParams; - -@compute @workgroup_size(64) -fn main(@builtin(global_invocation_id) id: vec3) { - let i = id.x; - if (i >= arrayLength(&particles)) { - return; - } - var p = particles[i]; - let new_pos = p.pos.xyz + p.vel.xyz * 0.016; - p.pos = vec4(new_pos, p.pos.w); - p.vel.y = p.vel.y - 0.01 * (1.0 + uniforms.audio_intensity * 5.0); - p.rot.x = p.rot.x + p.rot.y * 0.016; - if (p.pos.y < -1.5) { - p.pos.y = 1.5; - p.pos.x = (f32(i % 100u) / 50.0) - 1.0 + (uniforms.audio_intensity * 0.5); - p.vel.y = 0.0; - } - particles[i] = p; -} diff --git a/workspaces/main/shaders/particle_render.wgsl b/workspaces/main/shaders/particle_render.wgsl index 6a2b636..dd83220 100644 --- a/workspaces/main/shaders/particle_render.wgsl +++ b/workspaces/main/shaders/particle_render.wgsl @@ -1,3 +1,4 @@ +// Particle rendering (vertex + fragment) - V2 struct Particle { pos: vec4, vel: vec4, @@ -5,10 +6,10 @@ struct Particle { color: vec4, }; -#include "common_uniforms" +#include "sequence_uniforms" @group(0) @binding(0) var particles: array; -@group(0) @binding(1) var uniforms: CommonUniforms; +@group(0) @binding(1) var uniforms: UniformsSequenceParams; struct VSOut { @builtin(position) pos: vec4, diff --git a/workspaces/main/shaders/particle_render_v2.wgsl b/workspaces/main/shaders/particle_render_v2.wgsl deleted file mode 100644 index 8663658..0000000 --- a/workspaces/main/shaders/particle_render_v2.wgsl +++ /dev/null @@ -1,53 +0,0 @@ -// Particle rendering (vertex + fragment) - V2 -struct Particle { - pos: vec4, - vel: vec4, - rot: vec4, - color: vec4, -}; - -#include "sequence_v2_uniforms" - -@group(0) @binding(0) var particles: array; -@group(0) @binding(1) var uniforms: UniformsSequenceParams; - -struct VSOut { - @builtin(position) pos: vec4, - @location(0) color: vec4, - @location(1) uv: vec2, -}; - -@vertex fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VSOut { - let p = particles[ii]; - let size = 0.02 + p.pos.z * 0.01 + uniforms.audio_intensity * 0.02; - var offsets = array, 6>( - vec2(-1, -1), - vec2(1, -1), - vec2(-1, 1), - vec2(-1, 1), - vec2(1, -1), - vec2(1, 1) - ); - let offset = offsets[vi]; - let c = cos(p.rot.x); - let s = sin(p.rot.x); - let rotated_offset = vec2(offset.x * c - offset.y * s, offset.x * s + offset.y * c); - let pos = vec2(p.pos.x + rotated_offset.x * size / uniforms.aspect_ratio, p.pos.y + rotated_offset.y * size); - - // Fade based on lifetime (p.pos.w goes from 1.0 to 0.0) - let lifetime_fade = p.pos.w; - let color_with_fade = vec4(p.color.rgb * (0.5 + 0.5 * uniforms.audio_intensity), p.color.a * lifetime_fade); - - return VSOut(vec4(pos, 0.0, 1.0), color_with_fade, offset); -} - -@fragment fn fs_main(@location(0) color: vec4, @location(1) uv: vec2) -> @location(0) vec4 { - // Calculate distance from center for circular shape - let dist = length(uv); - - // Smooth circular falloff (1.0 at center, 0.0 at edge) - let circle_alpha = smoothstep(1.0, 0.5, dist); - - // Apply circular fade to alpha channel - return vec4(color.rgb, color.a * circle_alpha); -} diff --git a/workspaces/main/shaders/rotating_cube.wgsl b/workspaces/main/shaders/rotating_cube.wgsl new file mode 100644 index 0000000..d7e4cae --- /dev/null +++ b/workspaces/main/shaders/rotating_cube.wgsl @@ -0,0 +1,89 @@ +// Rotating cube shader v2 (simplified, no masking) + +struct Uniforms { + view_proj: mat4x4, + inv_view_proj: mat4x4, + camera_pos_time: vec4, + params: vec4, + resolution: vec2, + aspect_ratio: f32, + _pad: f32, +}; + +struct ObjectData { + model: mat4x4, + inv_model: mat4x4, + color: vec4, + params: vec4, +}; + +@group(0) @binding(0) var uniforms: Uniforms; +@group(0) @binding(1) var object: ObjectData; + +struct VSOut { + @builtin(position) pos: vec4, + @location(0) world_pos: vec3, + @location(1) normal: vec3, +}; + +// Cube vertices (hardcoded) +fn get_cube_vertex(vid: u32) -> vec3 { + let positions = array, 36>( + // Front face + vec3(-1, -1, 1), vec3( 1, -1, 1), vec3( 1, 1, 1), + vec3(-1, -1, 1), vec3( 1, 1, 1), vec3(-1, 1, 1), + // Back face + vec3( 1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1), + vec3( 1, -1, -1), vec3(-1, 1, -1), vec3( 1, 1, -1), + // Right face + vec3( 1, -1, 1), vec3( 1, -1, -1), vec3( 1, 1, -1), + vec3( 1, -1, 1), vec3( 1, 1, -1), vec3( 1, 1, 1), + // Left face + vec3(-1, -1, -1), vec3(-1, -1, 1), vec3(-1, 1, 1), + vec3(-1, -1, -1), vec3(-1, 1, 1), vec3(-1, 1, -1), + // Top face + vec3(-1, 1, 1), vec3( 1, 1, 1), vec3( 1, 1, -1), + vec3(-1, 1, 1), vec3( 1, 1, -1), vec3(-1, 1, -1), + // Bottom face + vec3(-1, -1, -1), vec3( 1, -1, -1), vec3( 1, -1, 1), + vec3(-1, -1, -1), vec3( 1, -1, 1), vec3(-1, -1, 1) + ); + return positions[vid]; +} + +fn get_cube_normal(vid: u32) -> vec3 { + let face_id = vid / 6u; + let normals = array, 6>( + vec3( 0, 0, 1), // Front + vec3( 0, 0, -1), // Back + vec3( 1, 0, 0), // Right + vec3(-1, 0, 0), // Left + vec3( 0, 1, 0), // Top + vec3( 0, -1, 0) // Bottom + ); + return normals[face_id]; +} + +@vertex fn vs_main(@builtin(vertex_index) vid: u32) -> VSOut { + let local_pos = get_cube_vertex(vid); + let local_normal = get_cube_normal(vid); + + let world_pos = object.model * vec4(local_pos, 1.0); + let world_normal = normalize((object.model * vec4(local_normal, 0.0)).xyz); + + let clip_pos = uniforms.view_proj * world_pos; + + return VSOut(clip_pos, world_pos.xyz, world_normal); +} + +@fragment fn fs_main(@location(0) world_pos: vec3, @location(1) normal: vec3) -> @location(0) vec4 { + let N = normalize(normal); + let light_dir = normalize(vec3(1.0, 1.0, 1.0)); + let diffuse = max(dot(N, light_dir), 0.0); + + let ambient = 0.3; + let lighting = ambient + diffuse * 0.7; + + let color = object.color.rgb * lighting; + return vec4(color, 1.0); +} diff --git a/workspaces/main/shaders/rotating_cube_v2.wgsl b/workspaces/main/shaders/rotating_cube_v2.wgsl deleted file mode 100644 index d7e4cae..0000000 --- a/workspaces/main/shaders/rotating_cube_v2.wgsl +++ /dev/null @@ -1,89 +0,0 @@ -// Rotating cube shader v2 (simplified, no masking) - -struct Uniforms { - view_proj: mat4x4, - inv_view_proj: mat4x4, - camera_pos_time: vec4, - params: vec4, - resolution: vec2, - aspect_ratio: f32, - _pad: f32, -}; - -struct ObjectData { - model: mat4x4, - inv_model: mat4x4, - color: vec4, - params: vec4, -}; - -@group(0) @binding(0) var uniforms: Uniforms; -@group(0) @binding(1) var object: ObjectData; - -struct VSOut { - @builtin(position) pos: vec4, - @location(0) world_pos: vec3, - @location(1) normal: vec3, -}; - -// Cube vertices (hardcoded) -fn get_cube_vertex(vid: u32) -> vec3 { - let positions = array, 36>( - // Front face - vec3(-1, -1, 1), vec3( 1, -1, 1), vec3( 1, 1, 1), - vec3(-1, -1, 1), vec3( 1, 1, 1), vec3(-1, 1, 1), - // Back face - vec3( 1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1), - vec3( 1, -1, -1), vec3(-1, 1, -1), vec3( 1, 1, -1), - // Right face - vec3( 1, -1, 1), vec3( 1, -1, -1), vec3( 1, 1, -1), - vec3( 1, -1, 1), vec3( 1, 1, -1), vec3( 1, 1, 1), - // Left face - vec3(-1, -1, -1), vec3(-1, -1, 1), vec3(-1, 1, 1), - vec3(-1, -1, -1), vec3(-1, 1, 1), vec3(-1, 1, -1), - // Top face - vec3(-1, 1, 1), vec3( 1, 1, 1), vec3( 1, 1, -1), - vec3(-1, 1, 1), vec3( 1, 1, -1), vec3(-1, 1, -1), - // Bottom face - vec3(-1, -1, -1), vec3( 1, -1, -1), vec3( 1, -1, 1), - vec3(-1, -1, -1), vec3( 1, -1, 1), vec3(-1, -1, 1) - ); - return positions[vid]; -} - -fn get_cube_normal(vid: u32) -> vec3 { - let face_id = vid / 6u; - let normals = array, 6>( - vec3( 0, 0, 1), // Front - vec3( 0, 0, -1), // Back - vec3( 1, 0, 0), // Right - vec3(-1, 0, 0), // Left - vec3( 0, 1, 0), // Top - vec3( 0, -1, 0) // Bottom - ); - return normals[face_id]; -} - -@vertex fn vs_main(@builtin(vertex_index) vid: u32) -> VSOut { - let local_pos = get_cube_vertex(vid); - let local_normal = get_cube_normal(vid); - - let world_pos = object.model * vec4(local_pos, 1.0); - let world_normal = normalize((object.model * vec4(local_normal, 0.0)).xyz); - - let clip_pos = uniforms.view_proj * world_pos; - - return VSOut(clip_pos, world_pos.xyz, world_normal); -} - -@fragment fn fs_main(@location(0) world_pos: vec3, @location(1) normal: vec3) -> @location(0) vec4 { - let N = normalize(normal); - let light_dir = normalize(vec3(1.0, 1.0, 1.0)); - let diffuse = max(dot(N, light_dir), 0.0); - - let ambient = 0.3; - let lighting = ambient + diffuse * 0.7; - - let color = object.color.rgb * lighting; - return vec4(color, 1.0); -} -- cgit v1.2.3