Complete all Vulkan wrappers. Maybe worth it.
This commit is contained in:
@@ -109,9 +109,9 @@ pub const Matrix4x4 = extern struct {
|
||||
const rotation_k = Vector4.init(2 * (xz + yw), 2 * (yz - xw), (1 - 2 * (xx + yy)), 0);
|
||||
|
||||
return .initVector4(
|
||||
Vector4.mulScalar(rotation_i, scale.getX()),
|
||||
Vector4.mulScalar(rotation_j, scale.getY()),
|
||||
Vector4.mulScalar(rotation_k, scale.getZ()),
|
||||
.mulScalar(rotation_i, scale.getX()),
|
||||
.mulScalar(rotation_j, scale.getY()),
|
||||
.mulScalar(rotation_k, scale.getZ()),
|
||||
translation.asVector4(1),
|
||||
);
|
||||
}
|
||||
@@ -130,47 +130,47 @@ pub const Matrix4x4 = extern struct {
|
||||
|
||||
pub inline fn add(self: Matrix4x4, other: Matrix4x4) Matrix4x4 {
|
||||
return .initVector4(
|
||||
Vector4.add(self.i, other.i),
|
||||
Vector4.add(self.j, other.j),
|
||||
Vector4.add(self.k, other.k),
|
||||
Vector4.add(self.t, other.t),
|
||||
.add(self.i, other.i),
|
||||
.add(self.j, other.j),
|
||||
.add(self.k, other.k),
|
||||
.add(self.t, other.t),
|
||||
);
|
||||
}
|
||||
|
||||
pub inline fn sub(self: Matrix4x4, other: Matrix4x4) Matrix4x4 {
|
||||
return .initVector4(
|
||||
Vector4.sub(self.i, other.i),
|
||||
Vector4.sub(self.j, other.j),
|
||||
Vector4.sub(self.k, other.k),
|
||||
Vector4.sub(self.t, other.t),
|
||||
.sub(self.i, other.i),
|
||||
.sub(self.j, other.j),
|
||||
.sub(self.k, other.k),
|
||||
.sub(self.t, other.t),
|
||||
);
|
||||
}
|
||||
|
||||
pub inline fn negate(self: Matrix4x4) Matrix4x4 {
|
||||
return .initVector4(
|
||||
Vector4.negate(self.i),
|
||||
Vector4.negate(self.j),
|
||||
Vector4.negate(self.k),
|
||||
Vector4.negate(self.t),
|
||||
.negate(self.i),
|
||||
.negate(self.j),
|
||||
.negate(self.k),
|
||||
.negate(self.t),
|
||||
);
|
||||
}
|
||||
|
||||
pub inline fn mulScalar(self: Matrix4x4, scalar: f32) Matrix4x4 {
|
||||
return .initVector4(
|
||||
Vector4.mulScalar(self.i, scalar),
|
||||
Vector4.mulScalar(self.j, scalar),
|
||||
Vector4.mulScalar(self.k, scalar),
|
||||
Vector4.mulScalar(self.t, scalar),
|
||||
.mulScalar(self.i, scalar),
|
||||
.mulScalar(self.j, scalar),
|
||||
.mulScalar(self.k, scalar),
|
||||
.mulScalar(self.t, scalar),
|
||||
);
|
||||
}
|
||||
|
||||
pub inline fn divScalar(self: Matrix4x4, scalar: f32) Matrix4x4 {
|
||||
const inv_scalar = 1 / scalar;
|
||||
return .initVector4(
|
||||
Vector4.mulScalar(self.i, inv_scalar),
|
||||
Vector4.mulScalar(self.j, inv_scalar),
|
||||
Vector4.mulScalar(self.k, inv_scalar),
|
||||
Vector4.mulScalar(self.t, inv_scalar),
|
||||
.mulScalar(self.i, inv_scalar),
|
||||
.mulScalar(self.j, inv_scalar),
|
||||
.mulScalar(self.k, inv_scalar),
|
||||
.mulScalar(self.t, inv_scalar),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user