summaryrefslogtreecommitdiff
path: root/frontend/_wasm/mathlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/_wasm/mathlib.h')
-rw-r--r--frontend/_wasm/mathlib.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/frontend/_wasm/mathlib.h b/frontend/_wasm/mathlib.h
index bc84b72..93ddbbd 100644
--- a/frontend/_wasm/mathlib.h
+++ b/frontend/_wasm/mathlib.h
@@ -86,6 +86,13 @@ struct Mat4x4 {
return result;
}
+ Mat4x4 translateByVec2(Vector2 v) {
+ Mat4x4 result = copy();
+ result.m[12] += v.x;
+ result.m[13] += v.y;
+ return result;
+ }
+
Mat4x4 rotate2D(float angle) {
Mat4x4 result = copy();
result.m[0] = cos(angle);
@@ -112,4 +119,12 @@ struct Mat4x4 {
result.m[13] = -(top + bottom) / (top - bottom);
return result;
}
-}; \ No newline at end of file
+
+ void print() {
+ printf("[ ");
+ for (int idx = 0; idx < 16; idx++) {
+ printf("%d, ", idx);
+ }
+ printf(" ]\n");
+ }
+};