Simple and newbie question about transforms, Matrix4f and jME

Hello,



I'm newbie with jME, I have a small app developed with JOGL. It reads a file that defines lines quads, triangles and composed objects (composed objects are another file with lines, quads, triangles, etc, etc) and then display all the defined objects. Very basic, I'm trying to port this to jME. So I was thinking that all the idea of scene graphs could be nice to composed objects, especially because I want to begin moving and interacting with the objects and seems much easier to do it with a framework like jME than by hand…



The point is that composed objects has a 4x4 transformation matrix that is applied to the object, so I can put a composed object anywhere I want to. In OpenGL it's very simple, I just do a glMultMatrixf, then render the object and transformation is done. The point is that I've read in ( http://www.jmonkeyengine.com/jmeforum/index.php?topic=2456.0 ) that jME don't support an equivalent of glMultMatrixf.



That shocked me a little, because was against my little knowledge of OpenGL  :slight_smile: But I'm sure jME has a good reason to be like that  :wink:



Any way, which is the correct approach to do this in jME? Could anybody point me in the right direction?



Thanks

Demi

In jME you need transformation, scale and rotation separated. Assumed you only use uniform scale you can decompose a 4x4 matrix into those components. (I don't have a web link at hand, but it shouldn't be hard to find instruction for it). Note that besides making the decomposition ambiguous non-uniform scale causes unpredictable results in jME's Nodes.



The reason for this separation is that most people can handle it more easily. Additionally composition of a matrix from the components is cheap, while decomposition is more expensive - and for some computation you need the separated rotation/scale…