From 00c5ea3c0f4ad3b22726d92c23db8a4c37a3b0c9 Mon Sep 17 00:00:00 2001 From: quou Date: Tue, 21 Jan 2025 22:18:48 +1100 Subject: add m3f and more --- maths.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'maths.hpp') 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 -- cgit v1.2.3-54-g00ecf