Add widening/shortening vector dimensions

This commit is contained in:
2026-01-04 17:13:31 +01:00
parent ed6391e97a
commit 7e8103565d
12 changed files with 102 additions and 6 deletions

View File

@@ -40,6 +40,14 @@ pub const Vector4 = extern struct {
return @bitCast(self);
}
pub inline fn dropW(self: Vector4) vm.Vector3 {
return .{ .x = self.x, .y = self.y, .z = self.z };
}
pub inline fn dropZW(self: Vector4) vm.Vector2 {
return .{ .x = self.x, .y = self.y };
}
// --- COMPONENT-WISE ------------------------------------------------------
pub inline fn add(self: Vector4, other: Vector4) Vector4 {