fromArray
This commit is contained in:
@@ -39,12 +39,17 @@ pub fn Matrix(rows: comptime_int, cols: comptime_int, T: type) type {
|
|||||||
fn array(self: Self) [self.rows]T {
|
fn array(self: Self) [self.rows]T {
|
||||||
return @bitCast(self.mat);
|
return @bitCast(self.mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn fromArray(a: [rows]T) Self {
|
||||||
|
return .{ .mat = @bitCast(a) };
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const get = if (cols == 1) vector.get else @compileError("Not a vector");
|
pub const get = if (cols == 1) vector.get else @compileError("Not a vector");
|
||||||
pub const swizzle = if (cols == 1) vector.swizzle else @compileError("Not a vector");
|
pub const swizzle = if (cols == 1) vector.swizzle else @compileError("Not a vector");
|
||||||
pub const dot = if (cols == 1) vector.dot else @compileError("Not a vector");
|
pub const dot = if (cols == 1) vector.dot else @compileError("Not a vector");
|
||||||
pub const array = if (cols == 1) vector.array else @compileError("Not a vector");
|
pub const array = if (cols == 1) vector.array else @compileError("Not a vector");
|
||||||
|
pub const fromArray = if (cols == 1) vector.fromArray else @compileError("Not a vector");
|
||||||
|
|
||||||
pub fn splat(s: T) Self {
|
pub fn splat(s: T) Self {
|
||||||
var result: Self = .{ .mat = undefined };
|
var result: Self = .{ .mat = undefined };
|
||||||
|
|||||||
Reference in New Issue
Block a user