matrix multiplcation with vector

v1
Brett 2023-03-08 21:26:42 -05:00
parent 409e814815
commit 5db2224f93
1 changed files with 12 additions and 0 deletions

View File

@ -216,6 +216,18 @@ namespace blt {
return mat; 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 // multiplies the const c with each element in the mat4x4 v
inline mat4x4 operator*(float c, const mat4x4& v) { inline mat4x4 operator*(float c, const mat4x4& v) {
mat4x4 mat{}; mat4x4 mat{};