[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu3dkit-discuss] hpr or phr??
From: |
Philippe C.D. Robert |
Subject: |
Re: [Gnu3dkit-discuss] hpr or phr?? |
Date: |
Fri, 12 Jul 2002 08:58:03 +0200 |
Hi,
On Friday, July 12, 2002, at 12:08 AM, Brent Gulanowski wrote:
Hi Phillipe,
I'm having a dog of a time getting my rotations to make sense. As far
as I can discern, G3DTransform applies itself to the MODELVIEW matrix
directly,
and then its up to opengl to discern the rotations. I'm a novice here
of course, but it seems that the rotations get put into place along the
global X, Y and Z axes in that order (based on my tests). Are not the
hpr (heading pitch roll) usually associated with the *local* Y, X and Z
axes in that order?
The transformation *matrix* is applied to the modelview matrix, not the
G3DTransform! Using a scene graph implies that these matrices get
pushed/popped if needed, they are applied by the node who 'owns' them,
so if you only have a transformation on a shape, it is applied to its
local system, if you add one to the parent group node, the
transformation is multiplied to the existing modelview matrix (BTW every
graph node has a transformation matrix, normally it is the identity,
though). Well, at least this is how you can imagine it, in fact this
happens the other way around when traversing, so obviously you (the
3DKit) have to take care from which side you multiply the matrices, and
whether you use the transposed matrix or not...:-)
If this is not the case then I somehow somewhen introduced a sever bug!
The problem is that in my editor, the user will have a base rotation
for their point of view (say, from the left or looking to the right)
and then they are applying a local-z or roll rotation to an object in
those terms, so I have to apply them correctly. Because it seems that
opengl applies them in a different order, I'm trying to figure out how
to use different combinations depending on both the user's location and
the relative rotation. Working in global coordinates is giving me a
headache.
The problem here is that GL uses a modeview matrix whereas the model and
the view is not really the same thing. Have a look at the G3DCamera
class to see how this works.
-Phil
--
Philippe C.D. Robert
http://www.nice.ch/~phip