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

@@ -44,6 +44,14 @@ pub const Vector2x8 = struct {
// --- CONVERSION ----------------------------------------------------------
pub inline fn withZ(self: Vector2x8, z: vm.f32x8) vm.Vector3x8 {
return .{ .x = self.x, .y = self.y, .z = z };
}
pub inline fn withZW(self: Vector2x8, z: vm.f32x8, w: vm.f32x8) vm.Vector4x8 {
return .{ .x = self.x, .y = self.y, .z = z, .w = w };
}
pub inline fn asArrayOfVectors(self: Vector2x8) [8]vm.Vector2 {
const vector: @Vector(16, f32) = self.x ++ self.y;
return @bitCast(@as([16]f32, @shuffle(f32, vector, undefined, [_]i32{