examples/gkurve: border rendering, non-linear field

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-05-20 12:26:43 -07:00
parent 58709070dd
commit eae2a090c6
3 changed files with 34 additions and 15 deletions

View file

@ -6,7 +6,7 @@ struct VertexUniform {
struct VertexOut {
@builtin(position) position_clip: vec4<f32>,
@location(0) frag_uv: vec2<f32>,
@location(1) frag_bary: vec3<f32>,
@interpolate(linear) @location(1) frag_bary: vec3<f32>,
@interpolate(flat) @location(2) triangle_index: u32,
}
@ -19,9 +19,9 @@ struct VertexOut {
output.position_clip = ubo.matrix * position;
output.frag_uv = uv;
output.frag_bary = vec3<f32>(
f32(vertex_index % 3u == 1u),
f32(vertex_index % 3u == 2u),
f32(vertex_index % 3u == 0u),
f32(((vertex_index+2u) % 3u * 2u) % 3u),
f32(((vertex_index+2u) % 3u * 2u) & 2u) * 2.0,
0.0,
);
output.triangle_index = vertex_index / 3u;
return output;