blob: 256b969adc2beb3e6fcb1fac47790f917d101df1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
}
|