From cb90286ae31ac1a5d8c9c29ad0b188a5f36b4321 Mon Sep 17 00:00:00 2001 From: abux Date: Fri, 7 Aug 2026 12:56:59 +0100 Subject: [PATCH] Added Vec4 --- src/root.zig | 4 ++++ src/vec.zig | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/root.zig b/src/root.zig index 6917582..dc8add7 100644 --- a/src/root.zig +++ b/src/root.zig @@ -26,6 +26,10 @@ pub const Vec2f = Vec(f32, 2); pub const Vec3 = Vec(i32, 3); pub const Vec3f = Vec(f32, 3); +// --- VEC4 --- +pub const Vec4 = Vec(i32, 4); +pub const Vec4f = Vec(f32, 4); + // --- MAT --- pub const Mat2x2 = Mat(f32, 2, 2); pub const Mat3x3 = Mat(f32, 3, 3); diff --git a/src/vec.zig b/src/vec.zig index b5ec601..5b94def 100644 --- a/src/vec.zig +++ b/src/vec.zig @@ -141,21 +141,25 @@ pub fn Vec( pub const up: Self = blk: { if (Len == 2) break :blk .new(.{ 0, -1 }); if (Len == 3) break :blk .new(.{ 0, -1, 0 }); + if (Len == 4) break :blk .new(.{ 0, -1, 0, 0 }); }; pub const down: Self = blk: { if (Len == 2) break :blk .new(.{ 0, 1 }); if (Len == 3) break :blk .new(.{ 0, 1, 0 }); + if (Len == 4) break :blk .new(.{ 0, 1, 0, 0 }); }; pub const left: Self = blk: { if (Len == 2) break :blk .new(.{ 1, 0 }); if (Len == 3) break :blk .new(.{ 1, 0, 0 }); + if (Len == 4) break :blk .new(.{ 1, 0, 0, 0 }); }; pub const right: Self = blk: { if (Len == 2) break :blk .new(.{ -1, 0 }); if (Len == 3) break :blk .new(.{ -1, 0, 0 }); + if (Len == 4) break :blk .new(.{ -1, 0, 0, 0 }); }; pub const forward: Self = blk: {