JUMBO vecmath completion update
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const std = @import("std");
|
||||
const vm = @import("root");
|
||||
const vm = @import("../root.zig");
|
||||
|
||||
pub const Vector3Int = extern struct {
|
||||
x: i32,
|
||||
@@ -17,7 +17,7 @@ pub const Vector3Int = extern struct {
|
||||
pub const unit_ny = init(0, -1, 0);
|
||||
pub const unit_nz = init(0, 0, -1);
|
||||
|
||||
// --- INIT ----
|
||||
// --- INIT ----------------------------------------------------------------
|
||||
|
||||
pub inline fn init(x: i32, y: i32, z: i32) Vector3Int {
|
||||
return .{ .x = x, .y = y, .z = z };
|
||||
@@ -31,21 +31,13 @@ pub const Vector3Int = extern struct {
|
||||
return @bitCast(array);
|
||||
}
|
||||
|
||||
// --- CONVERSION ---
|
||||
// --- CONVERSION ----------------------------------------------------------
|
||||
|
||||
pub inline fn asArray(self: Vector3Int) Array {
|
||||
return @bitCast(self);
|
||||
}
|
||||
|
||||
pub inline fn asArrayPtr(self: *Vector3Int) *Array {
|
||||
return @ptrCast(self);
|
||||
}
|
||||
|
||||
pub inline fn asArrayConstPtr(self: *const Vector3Int) *const Array {
|
||||
return @ptrCast(self);
|
||||
}
|
||||
|
||||
// --- COMPONENT-WISE ---
|
||||
// --- COMPONENT-WISE ------------------------------------------------------
|
||||
|
||||
pub inline fn add(self: Vector3Int, other: Vector3Int) Vector3Int {
|
||||
return .{ .x = self.x + other.x, .y = self.y + other.y, .z = self.z + other.z };
|
||||
@@ -95,7 +87,7 @@ pub const Vector3Int = extern struct {
|
||||
return .{ .x = @max(self.x, other.x), .y = @max(self.y, other.y), .z = @max(self.z, other.z) };
|
||||
}
|
||||
|
||||
// --- OTHER ---
|
||||
// --- OTHER ---------------------------------------------------------------
|
||||
|
||||
pub inline fn lenSquared(self: Vector3Int) i32 {
|
||||
return self.x * self.x + self.y * self.y + self.z * self.z;
|
||||
|
||||
Reference in New Issue
Block a user