2 #ifndef _YI_GL2_MATRIX_UTILITIES_H_ 3 #define _YI_GL2_MATRIX_UTILITIES_H_ 8 #include <glm/mat4x4.hpp> 21 static glm::vec3
TransformVector(
const glm::mat4 &rMat4x4,
const glm::vec3 &rV);
28 static glm::vec3
ProjectVector(
const glm::vec3 &A,
const glm::vec3 &normalizedB);
35 template <
typename valType>
36 static bool SafeInverse(glm::tmat4x4<valType>
const &m, glm::tmat4x4<valType> &mOut);
46 const float fV0 = rV[0];
47 const float fV1 = rV[1];
48 const float fV2 = rV[2];
49 vOut[0] = (rMat4x4[0][0] * fV0 + rMat4x4[1][0] * fV1 + rMat4x4[2][0] * fV2 + rMat4x4[3][0]);
50 vOut[1] = (rMat4x4[0][1] * fV0 + rMat4x4[1][1] * fV1 + rMat4x4[2][1] * fV2 + rMat4x4[3][1]);
51 vOut[2] = (rMat4x4[0][2] * fV0 + rMat4x4[1][2] * fV1 + rMat4x4[2][2] * fV2 + rMat4x4[3][2]);
58 return glm::dot(A, normalizedB) / glm::dot(normalizedB, normalizedB) * normalizedB;
65 #endif // _YI_GL2_MATRIX_UTILITIES_H_
static bool SafeInverse(glm::tmat4x4< valType > const &m, glm::tmat4x4< valType > &mOut)
Definition: YiMatrixUtilities.h:15
static glm::vec3 TransformVector(const glm::mat4 &rMat4x4, const glm::vec3 &rV)
Definition: YiMatrixUtilities.h:42
static glm::vec3 ProjectVector(const glm::vec3 &A, const glm::vec3 &normalizedB)
Definition: YiMatrixUtilities.h:56