Added Vec4

This commit is contained in:
abux 2026-08-07 12:56:59 +01:00
parent f7e249d645
commit cb90286ae3
2 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,10 @@ pub const Vec2f = Vec(f32, 2);
pub const Vec3 = Vec(i32, 3); pub const Vec3 = Vec(i32, 3);
pub const Vec3f = Vec(f32, 3); pub const Vec3f = Vec(f32, 3);
// --- VEC4 ---
pub const Vec4 = Vec(i32, 4);
pub const Vec4f = Vec(f32, 4);
// --- MAT --- // --- MAT ---
pub const Mat2x2 = Mat(f32, 2, 2); pub const Mat2x2 = Mat(f32, 2, 2);
pub const Mat3x3 = Mat(f32, 3, 3); pub const Mat3x3 = Mat(f32, 3, 3);

View file

@ -141,21 +141,25 @@ pub fn Vec(
pub const up: Self = blk: { pub const up: Self = blk: {
if (Len == 2) break :blk .new(.{ 0, -1 }); if (Len == 2) break :blk .new(.{ 0, -1 });
if (Len == 3) break :blk .new(.{ 0, -1, 0 }); if (Len == 3) break :blk .new(.{ 0, -1, 0 });
if (Len == 4) break :blk .new(.{ 0, -1, 0, 0 });
}; };
pub const down: Self = blk: { pub const down: Self = blk: {
if (Len == 2) break :blk .new(.{ 0, 1 }); if (Len == 2) break :blk .new(.{ 0, 1 });
if (Len == 3) break :blk .new(.{ 0, 1, 0 }); if (Len == 3) break :blk .new(.{ 0, 1, 0 });
if (Len == 4) break :blk .new(.{ 0, 1, 0, 0 });
}; };
pub const left: Self = blk: { pub const left: Self = blk: {
if (Len == 2) break :blk .new(.{ 1, 0 }); if (Len == 2) break :blk .new(.{ 1, 0 });
if (Len == 3) break :blk .new(.{ 1, 0, 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: { pub const right: Self = blk: {
if (Len == 2) break :blk .new(.{ -1, 0 }); if (Len == 2) break :blk .new(.{ -1, 0 });
if (Len == 3) break :blk .new(.{ -1, 0, 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: { pub const forward: Self = blk: {