summaryrefslogtreecommitdiff
path: root/maths.hpp
diff options
context:
space:
mode:
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