Unclearness in com.jme.image.Texture.setMatrix documentation

http://www.jmonkeyengine.com/doc/com/jme/image/Texture.html#setMatrix(com.jme.math.Matrix4f)



Reads:



| setMatrix

|

| public void setMatrix(Matrix4f matrix)

|

|    Parameters:

|        matrix - The matrix to set on this Texture. If null, rotation, scale and/or translation will be used.



It does not tell exactly, what to do if matrix is not null, but the sentence can be

logically extented to be read as:

"if matrix is not null, rotation, scale and translation are ignored".



According to jME2_0_1-Stable/src/com/jme/scene/state/jogl/JOGLTextureState.java

line 1350 ff. this logic is not true:



            matRecord.switchMode(GL.GL_TEXTURE); 

            if (doMatrix) {

                record.tmp_matrixBuffer.rewind();

                texture.getMatrix().fillFloatBuffer(record.tmp_matrixBuffer,

                        true);

                record.tmp_matrixBuffer.rewind();

                gl.glLoadMatrixf(record.tmp_matrixBuffer); // TODO Check for fl$

            } else { 

                gl.glLoadIdentity();

            }

            if (doTrans) {

                gl.glTranslatef(texture.getTranslation().x, texture

                        .getTranslation().y, texture.getTranslation().z);

            if (doRot) {

                Vector3f vRot = record.tmp_rotation1;

                float rot = texture.getRotation().toAngleAxis(vRot)

                        * FastMath.RAD_TO_DEG; 

                gl.glRotatef(rot, vRot.x, vRot.y, vRot.z);

            }

            if (doScale)

                gl.glScalef(texture.getScale().x, texture.getScale().y,

                        texture.getScale().z);



BTW: What a pitty, VRML/X3D would use



    glTranslatef(-center[0], -center[1], 0.0f);

    glScalef(scale[0], scale[1], 1.0f);

    glRotatef(RAD2DEG(rotation), 0.0f, 0.0f, 1.0f);

    glTranslatef(center[0], center[1], 0.0f);

    glTranslatef(translation[0], translation[1], 0.0f);



so if jME would use



            if (doScale)

                gl.glScalef(texture.getScale().x, texture.getScale().y,

                        texture.getScale().z);



            if (doRot) {

                Vector3f vRot = record.tmp_rotation1;

                float rot = texture.getRotation().toAngleAxis(vRot)

                        * FastMath.RAD_TO_DEG; 

                gl.glRotatef(rot, vRot.x, vRot.y, vRot.z);

            }



          if (doTrans) {

                gl.glTranslatef(texture.getTranslation().x, texture

                        .getTranslation().y, texture.getTranslation().z);



it would be much more easier, to use the data of VRML/X3D files…