diff --git a/math/mat4x4.hpp b/math/mat4x4.hpp index bcddf1f..60a9fa2 100644 --- a/math/mat4x4.hpp +++ b/math/mat4x4.hpp @@ -152,6 +152,23 @@ inline constexpr vec<3, T> operator* #undef c } +template +inline constexpr vec<4, T> operator* +( + mat<4, 4, T> const& m, + vec<4, T> const& v +) +{ +#define c(i) ( \ + m[i][0] * v[0] \ + + m[i][1] * v[1] \ + + m[i][2] * v[2] \ + + m[i][3] * v[3]) + + return vec<4, T>(c(0), c(1), c(2), c(3)); +#undef c +} + template inline constexpr mat<4, 4, T> transpose(mat<4, 4, T> const& m) {