From 5db2224f93a0f76c707d1c7e9f142e552ac46cf9 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 8 Mar 2023 21:26:42 -0500 Subject: [PATCH] matrix multiplcation with vector --- include/blt/math/matrix.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/blt/math/matrix.h b/include/blt/math/matrix.h index 0358615..874e4c0 100644 --- a/include/blt/math/matrix.h +++ b/include/blt/math/matrix.h @@ -216,6 +216,18 @@ namespace blt { return mat; } + inline vec4 operator*(const mat4x4& left, const vec4& right){ + vec4 ret{0,0,0,0}; + + for (int m = 0; m < 4; m++) { + for (int n = 0; n < 4; n++) { + ret[m] = ret[m] + left.m(m, n) * right[n]; + } + } + + return ret; + } + // multiplies the const c with each element in the mat4x4 v inline mat4x4 operator*(float c, const mat4x4& v) { mat4x4 mat{};