PDA

View Full Version : glm toolkit - matrix decompose



OptimisticMonkey
06-13-2011, 09:01 AM
I am a glm noob....

I am trying to get a normal matrix from my modelview matrix for lighting.

Right now I am using glm::inverseTranspose and it works.

Would it be more efficient to just apply the rotation part for the model view matrix, since I am only using rotation, translation, and uniform scaling?

Is there a faster function in glm to decompose the model viewmatrix into the rotation part?

Thanks for any advice / feedback

Alfonse Reinheart
06-13-2011, 11:49 AM
Would it be more efficient to just apply the rotation part for the model view matrix, since I am only using rotation, translation, and uniform scaling?

Yes. Though you should note that you're doing it for future reference, just in case you start using a non-uniform scale.


Is there a faster function in glm to decompose the model viewmatrix into the rotation part?

You can pull the 3x3 matrix from a 4x4 matrix with the 3x3 matrix's constructor. Just like the GLSL spec says you can.

OptimisticMonkey
06-13-2011, 02:57 PM
Thanks Alfonse - That was exactly what I was looking for :-)