1
0
Fork 0

include/Spectre/Math/Matrix4.inl: in matrix vector multiplication. for some reason g++ was not happy with calling the constructor. this works.

This commit is contained in:
Henrik Hautakoski 2019-05-31 16:30:16 +02:00
parent 6b8c766702
commit 77804b8620

View file

@ -34,7 +34,7 @@ inline Matrix4<T>::Matrix4(
}
template<typename T>
inline Matrix4<T>::Matrix4(T *a)
inline Matrix4<T>::Matrix4(T *a)
{
// Note. array is passed as row-major
m[0][0] = a[0]; m[1][0] = a[1]; m[2][0] = a[2]; m[3][0] = a[3];
@ -138,11 +138,11 @@ inline Matrix4<T>& operator*=(Matrix4<T>& a, const Matrix4<T>& b)
template <typename T>
inline Vector3<T> operator*(const Matrix4<T>& mat, const Vector3<T>& vec)
{
return Vextor3<T>(
mat.m[0][0] * vec.x + mat.m[1][0] * vec.y + mat[2][0] * vec.z,
mat.m[0][1] * vec.x + mat.m[1][1] * vec.y + mat[2][1] * vec.z,
mat.m[0][2] * vec.x + mat.m[1][2] * vec.y + mat[2][2] * vec.z,
);
Vector3<T> r;
r.x = mat.m[0][0] * vec.x + mat.m[1][0] * vec.y + mat[2][0] * vec.z;
r.y = mat.m[0][1] * vec.x + mat.m[1][1] * vec.y + mat[2][1] * vec.z;
r.z = mat.m[0][2] * vec.x + mat.m[1][2] * vec.y + mat[2][2] * vec.z;
return r;
}