From 4ad69d966f0640daae34c677eead5b689cbfac2e Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Mon, 17 Aug 2026 19:31:31 -0700 Subject: debug physics --- src/shader/debug.wgsl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/shader/debug.wgsl (limited to 'src/shader/debug.wgsl') diff --git a/src/shader/debug.wgsl b/src/shader/debug.wgsl new file mode 100644 index 0000000..256b969 --- /dev/null +++ b/src/shader/debug.wgsl @@ -0,0 +1,28 @@ +struct Camera { + scale: vec2f, + centre: vec2f, +}; + +@group(0) @binding(0) var camera: Camera; + +struct VertexOutput { + @builtin(position) clip_position: vec4f, + @location(0) color: vec4f, +}; + +@vertex +fn vs_main( + @location(0) world: vec2f, + @location(1) color: vec4f, +) -> VertexOutput { + var out: VertexOutput; + out.clip_position = vec4f((world - camera.centre) * camera.scale, 0.0, 1.0); + out.color = color; + + return out; +} + +@fragment +fn fs_main(in: VertexOutput) -> @location(0) vec4f { + return in.color; +} -- cgit v1.3.1