Add abs and sign to int vectors
This commit is contained in:
@@ -162,6 +162,14 @@ pub const Vector2Int = extern struct {
|
||||
return .{ .vector = @mod(self.vector, scalar_vector) };
|
||||
}
|
||||
|
||||
pub inline fn abs(self: Vector2Int) Vector2Int {
|
||||
return .{ .vector = @intCast(@abs(self.vector)) };
|
||||
}
|
||||
|
||||
pub inline fn sign(self: Vector2Int) Vector2Int {
|
||||
return .{ .vector = std.math.sign(self.vector) };
|
||||
}
|
||||
|
||||
// --- SWIZZLE ---
|
||||
|
||||
pub inline fn swizzle2(self: Vector2Int, comptime mask: [2]Mask) Vector2Int {
|
||||
|
||||
@@ -174,6 +174,14 @@ pub const Vector3Int = extern struct {
|
||||
return .{ .vector = @mod(self.vector, scalar_vector) };
|
||||
}
|
||||
|
||||
pub inline fn abs(self: Vector3Int) Vector3Int {
|
||||
return .{ .vector = @intCast(@abs(self.vector)) };
|
||||
}
|
||||
|
||||
pub inline fn sign(self: Vector3Int) Vector3Int {
|
||||
return .{ .vector = std.math.sign(self.vector) };
|
||||
}
|
||||
|
||||
// --- SWIZZLE ---
|
||||
|
||||
pub inline fn swizzle2(self: Vector3Int, comptime mask: [2]Mask) Vector2Int {
|
||||
|
||||
Reference in New Issue
Block a user