From 34e019a212725f6c7c8f87e7d546ffd27c975cc4 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 15 May 2022 02:37:47 -0700 Subject: [PATCH] examples/gkurve: use equadistant triangles for easier debugging Signed-off-by: Stephen Gutekanst --- examples/gkurve/main.zig | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/gkurve/main.zig b/examples/gkurve/main.zig index 118da372..c14f7d00 100644 --- a/examples/gkurve/main.zig +++ b/examples/gkurve/main.zig @@ -14,10 +14,11 @@ pub const Vertex = struct { uv: @Vector(2, f32), }; // Simple triangle +const triangle_half_height = 250*@sqrt(0.75); pub const vertices = [_]Vertex{ - .{ .pos = .{ 0, 250, 0, 1 }, .uv = .{ 0.5, 1 } }, - .{ .pos = .{ -250, -250, 0, 1 }, .uv = .{ 0, 0 } }, - .{ .pos = .{ 250, -250, 0, 1 }, .uv = .{ 1, 0 } }, + .{ .pos = .{ 0, triangle_half_height, 0, 1 }, .uv = .{ 0.5, 1 } }, + .{ .pos = .{ -250, -triangle_half_height, 0, 1 }, .uv = .{ 0, 0 } }, + .{ .pos = .{ 250, -triangle_half_height, 0, 1 }, .uv = .{ 1, 0 } }, }; // TODO: Need to ask Ayush about this, ideally we have a square window in this example because it @@ -222,9 +223,9 @@ pub fn update(app: *App, engine: *mach.Engine) !bool { // TODO: // Use better positioning system const ubos = [_]VertexUniform{ - .{ .mat = zm.mul(zm.translation(250, 250, 0), proj) }, + .{ .mat = zm.mul(zm.translation(250, triangle_half_height, 0), proj) }, .{ .mat = zm.mul(zm.translation(-250, 0, 0), proj) }, - .{ .mat = zm.mul(zm.translation(250, -250, 0), proj) }, + .{ .mat = zm.mul(zm.translation(250, -triangle_half_height, 0), proj) }, }; encoder.writeBuffer(app.vertex_uniform_buffer, 0, VertexUniform, &ubos); }