[oden] Circles work

This commit is contained in:
John Doty 2023-08-25 15:32:35 -07:00
parent 26a3939012
commit 020bb8f124
7 changed files with 83 additions and 51 deletions

View file

@ -31,7 +31,7 @@ struct VertexOutput {
// The circle's coordinate system goes from (-1,-1) to (1,1) but by
// convention we provide ourselves texture coordinates that go from (0,0)
// to (1,1).
out.tex_coords = mix(vec2f(-1.0, -1.0), vec2f(1.0, 1.0), vertex.tex_coords);
out.tex_coords = (vertex.tex_coords * vec2f(2.0,2.0)) - vec2f(1.0,1.0);
// Compute the squared radius of the inner circle, so we don't do it
// per-pixel.
@ -65,7 +65,7 @@ struct VertexOutput {
} else if (tc2.x + tc2.y <= 1.0) {
return in.stroke_color;
} else {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
}
@ -76,7 +76,7 @@ struct VertexOutput {
struct ScreenUniform {
resolution : vec2f,
};
@group(1) @binding(0) // 1.
@group(0) @binding(0) // 1.
var<uniform> screen : ScreenUniform;
const RES = vec2f(320.0, 240.0); // The logical resolution of the screen.