This commit is contained in:
2026-07-05 10:14:01 -04:00
parent 50fa0f5258
commit 53a4a5b9c5
8 changed files with 35 additions and 65 deletions

View File

@@ -1,4 +1,3 @@
// math.js
export function mat4Identity() {
return new Float32Array([
1, 0, 0, 0,
@@ -46,6 +45,8 @@ export function mat4Multiply(out, a, b) {
out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
// TODO We only use this in-place for this prototype. Update the signature to enforce this
return out;
}
@@ -106,7 +107,7 @@ export function mat4Translate(out, a, v) {
out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
} else {
// We only use this in-place for this prototype
// TODO We only use this in-place for this prototype. Update the signature to enforce this
}
return out;
}
@@ -125,6 +126,7 @@ export function mat4RotateY(out, a, rad) {
out[13] = a[13];
out[14] = a[14];
out[15] = a[15];
// TODO We only use this in-place for this prototype. Update the signature to enforce this
}
out[0] = a00 * c - a20 * s;
@@ -152,6 +154,8 @@ export function mat4RotateX(out, a, rad) {
out[13] = a[13];
out[14] = a[14];
out[15] = a[15];
// TODO We only use this in-place for this prototype.
// update the signature to enforce this
}
out[4] = a10 * c + a20 * s;