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[0], matrix[1], matrix[2]);

The up vector would be row 2

glm::vec3 up = glm::vec3(matrix[4], matrix[5], matrix[6]);

The forward vector would be row 3

glm::vec3 forward = glm::vec3(matrix[8], matrix[9], matrix[10]);

and the position would be row 4

glm::vec3 position = glm::vec3(matrix[12], matrix[13], matrix[14]);

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?