开发者

Derive euler rotation from model view matrix

开发者 https://www.devze.com 2023-02-20 19:06 出处:网络
I\'m implementing a widget tool kit wich requires some symbols to be aligned with the Y axis. These symbols are drawn using the model view matrix of the parent objects, causing them to be rotated as

I'm implementing a widget tool kit wich requires some symbols to be aligned with the Y axis.

These symbols are drawn using the model view matrix of the parent objects, causing them to be rotated as well.

The solution would be to apply a counter-rotation before rendering those symbol开发者_如何转开发s, but I have to keep track of every rotation (in my case only on Z axis), in order to apply the correct counter-rotation. Sadly, every rotation "out of control" will cause a misalignment between the real model view matrix rotation and the "global" rotation kept.

How would it possible to derive eurler rotation angles directly from the model view matrix?


Just clear the rotational part (the upper left 3x3) of the modelview matrix to identity. This removes any rotation, yet retains the translation.

0

精彩评论

暂无评论...
验证码 换一张
取 消