2024-08-22 17:21:34 +01:00
|
|
|
struct Uniforms {
|
2024-09-11 20:20:47 +01:00
|
|
|
camera: vec2f,
|
|
|
|
zooms: vec2f
|
2024-08-22 17:21:34 +01:00
|
|
|
}
|
|
|
|
@group(0) @binding(0) var<uniform> uniforms : Uniforms;
|
|
|
|
|
|
|
|
struct VertexOutput {
|
|
|
|
@location(0) color: vec4f,
|
|
|
|
@builtin(position) pos: vec4f
|
|
|
|
}
|
|
|
|
|
2024-08-18 18:21:17 +01:00
|
|
|
@vertex
|
2024-08-22 17:21:34 +01:00
|
|
|
fn vs_main(
|
2024-08-28 13:09:57 +01:00
|
|
|
@location(0) pos: vec2f,
|
2024-08-22 17:21:34 +01:00
|
|
|
@location(1) color: vec4f
|
|
|
|
) -> VertexOutput {
|
|
|
|
var out: VertexOutput;
|
|
|
|
out.color = color;
|
2024-09-11 20:20:47 +01:00
|
|
|
out.pos = vec4f((pos - uniforms.camera) * uniforms.zooms, 0, 1);
|
2024-08-22 17:21:34 +01:00
|
|
|
return out;
|
2024-08-20 22:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@fragment
|
2024-08-22 17:21:34 +01:00
|
|
|
fn fs_main(v: VertexOutput) -> @location(0) vec4f {
|
|
|
|
return v.color;
|
2024-08-18 18:21:17 +01:00
|
|
|
}
|