30 lines
869 B
WebGPU Shading Language
30 lines
869 B
WebGPU Shading Language
struct Uniforms {
|
|
resolution: vec2<f32>, // viewport size (pixels)
|
|
origin: vec2<f32>, // start point (pixels)
|
|
|
|
len0: f32, // first horizontal segment (to the right)
|
|
len2: f32, // last horizontal segment (to the right)
|
|
drop: f32, // vertical drop between segments
|
|
|
|
thickness: f32, // inner half-width
|
|
border: f32, // border thickness
|
|
|
|
border_color: vec4<f32>,
|
|
color_start: vec4<f32>,
|
|
color_end: vec4<f32>,
|
|
};
|
|
|
|
@group(0) @binding(0)
|
|
var<uniform> U: Uniforms;
|
|
|
|
struct VertexOutput {
|
|
@builtin(position) position : vec4<f32>,
|
|
@location(0) uv : vec2<f32>,
|
|
};
|
|
|
|
@fragment
|
|
fn fragment(mesh: VertexOutput) -> @location(0) vec4<f32> {
|
|
let u = clamp(mesh.uv.x, 0.0, 1.0);
|
|
return vec4<f32>(mesh.position.x / 1000.0, mesh.position.y / 1000.0, 0.0, 1.0);
|
|
}
|