26 lines
523 B
WebGPU Shading Language
26 lines
523 B
WebGPU Shading Language
struct Uniforms {
|
|
camera: vec2f,
|
|
zooms: vec2f
|
|
}
|
|
@group(0) @binding(0) var<uniform> uniforms : Uniforms;
|
|
|
|
struct VertexOutput {
|
|
@location(0) color: vec4f,
|
|
@builtin(position) pos: vec4f
|
|
}
|
|
|
|
@vertex
|
|
fn vs_main(
|
|
@location(0) pos: vec2f,
|
|
@location(1) color: vec4f
|
|
) -> VertexOutput {
|
|
var out: VertexOutput;
|
|
out.color = color;
|
|
out.pos = vec4f((pos - uniforms.camera) * uniforms.zooms, 0, 1);
|
|
return out;
|
|
}
|
|
|
|
@fragment
|
|
fn fs_main(v: VertexOutput) -> @location(0) vec4f {
|
|
return v.color;
|
|
} |