Tranformation Matrix

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Garu
Posts: 5
Joined: Sun Apr 25, 2004 10:34 am

Tranformation Matrix

Post by Garu »

Hi all,

In OpenGL, say i have a transformation of a model matrix M, is there anyway in irrlicht engine we can apply it directly to IAnimatedMeshSceneNode? similar with openGL operation glLoadMatrixd(M). Therefore we don't need to put one by one the translation, rotation and scale of the model.

thanks
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

This is a quick approach (irrlich 0.6):

in ISceneNode.h add a new protected member variable:

Code: Select all

core::matrix4 RelativeTransformation;
still ISceneNode.h add a new public function:

Code: Select all

virtual void setTransformationMatrix(const core::matrix4& mat) {
    RelativeTransformation = mat;
}
and in the getRelativeTransformation() function add the following line directly before the return statement:

Code: Select all

mat *= RelativeTransformation;
[/b]

It's not optimized, but still supports setting the translation, rotation and scale one by one. You could also add a bool to indicate that the matrix is set and, if so, directly return the matrix in getRelativeTransformation() ignoring the translation, rotation and scale.

regards,
jox
Garu
Posts: 5
Joined: Sun Apr 25, 2004 10:34 am

Post by Garu »

thx jox for the reply,

i haven't tried it yet, but currently i'm doing it manually (setting one by one), and the models transorm really strangely. Do you know whether the OpenGL Axis is compatible with irrlicht engine axis? say postive Z axis in openGL is also positive Z axis in irrlicht?

thanks again
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

I'm not sure about the OpenGL and Irrlich Z axis.

1. In what manner do the models transorm strangely?

2. Where and how do you get the OpenGL matrices from?

3. If you set things manually do you use matrix4.getRotationDegrees/Radians()? Because it has a bug in V0.6
(http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2234)
Or where do you get the rot, trans, scale from?

Maybe you have to convert the opengl matrices somehow (create a conversion matrix).

jox
Post Reply