Does anyone know the matrix layout for glm? I know it's laid out linearly in memory, i'm wondering where the basis vectors are.
To my knowledge it looks like this
Xx, Xy, Xz, 0
Yx, Yy, Yz, 0
Zx, Zy, Zz, 0
Tx, Ty, Tz, 1
So, assuming a linear array of memory
flat* matrix = glm::value_ptr(mat);
The right vector would be row 1
glm::vec3 right = glm::vec3(matrix, matrix, matrix);
The up vector would be row 2
glm::vec3 up = glm::vec3(matrix, matrix, matrix);
The forward vector would be row 3
glm::vec3 forward = glm::vec3(matrix, matrix, matrix);
and the position would be row 4
glm::vec3 position = glm::vec3(matrix, matrix, matrix);
Also, how would one go from a 4x4 matrix to a quaternion?
Right now my assumption is
glm::quat a = glm::quat_cast(mat);
Can anyone please shed some light on weather or not i'm doing this right?