summaryrefslogtreecommitdiff
path: root/maths.hpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-01-21 22:18:48 +1100
committerquou <quou@disroot.org>2025-01-21 22:30:05 +1100
commit00c5ea3c0f4ad3b22726d92c23db8a4c37a3b0c9 (patch)
tree5faff5710a93dd5af8c390bd1b18a7985cf9f2c8 /maths.hpp
parent3d6c0450f8a5d46dfced510bad7d0a3792c3359b (diff)
add m3f and more
Diffstat (limited to 'maths.hpp')
-rw-r--r--maths.hpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/maths.hpp b/maths.hpp
index e9b2fa8..57a9b29 100644
--- a/maths.hpp
+++ b/maths.hpp
@@ -486,6 +486,7 @@ struct m4f {
m4f();
m4f(float d);
+ m4f(const v4f& r0, const v4f& r1, const v4f& r2, const v4f& r3);
static m4f identity();
static m4f screenspace(float hw, float hh);
@@ -503,8 +504,8 @@ struct m4f {
static m4f pers(float fov, float asp, float n, float f);
static m4f orth(float l, float r, float b, float t, float n, float f);
- static v4f transform(m4f m, v4f v);
- static AABB transform(m4f m, AABB aabb);
+ static v4f transform(const m4f& m, const v4f& v);
+ static AABB transform(const m4f& m, const AABB& aabb);
m4f inverse() const;
m4f transposed() const;
@@ -518,5 +519,15 @@ inline static v4f make_color(uint32_t rgb, uint8_t a) {
(float)a / 255.0f);
}
+struct m3f {
+ float m[3][3];
+
+ m3f();
+ m3f(float d);
+ m3f(const v3f& r0, const v3f& r1, const v3f& r3);
+
+ static v3f transform(const m3f& m, const v3f& v);
+ v3f operator*(const v3f& other) const;
+};
#endif