diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-08-17 19:31:31 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-08-17 19:31:31 -0700 |
| commit | 4ad69d966f0640daae34c677eead5b689cbfac2e (patch) | |
| tree | e80de1972ac02660b27ef6f46434caa388f41761 /src/shader/debug.wgsl | |
| parent | 7f1b0b16ad51afd46b4f8fe2ba209c4bd94391ba (diff) | |
debug physics
Diffstat (limited to 'src/shader/debug.wgsl')
| -rw-r--r-- | src/shader/debug.wgsl | 28 |
1 files changed, 28 insertions, 0 deletions
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<uniform> 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; +} |
