Example usage for com.badlogic.gdx.math Matrix4 rotateRad

List of usage examples for com.badlogic.gdx.math Matrix4 rotateRad

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Matrix4 rotateRad.

Prototype

public Matrix4 rotateRad(Vector3 axis, float radians) 

Source Link

Document

Postmultiplies this matrix with a (counter-clockwise) rotation matrix.

Usage

From source file:ta.shape3D.mesh.MeshTA.java

License:Apache License

/**
 * draw all triangles of the Mesh in the OpenGL environment.
 * @param rendu the renderer which is used for drawing triangle, you don't need to call the begin() method of this renderer
 * before using this method.//  ww w .  j  a v a 2s. c  o  m
 * @param rendu 
 * @param projectionMatrix The projection matrix in which the mesh will be represented 
 */
final public void render(ImmediateModeRenderer20 rendu, Matrix4 projectionMatrix) {
    projectionMatrix.translate(tX, tY, tZ);
    projectionMatrix.rotateRad(Vector3.X, rX);
    projectionMatrix.rotateRad(Vector3.Y, rY);
    projectionMatrix.rotateRad(Vector3.Z, rZ);
    projectionMatrix.scale(scaleX, scaleY, scaleZ);
    if (image != null) {
        Gdx.gl20.glEnable(GL20.GL_TEXTURE_2D);
        Gdx.gl20.glBindTexture(image.glTarget, image.getTextureObjectHandle());
    }
    rendu.begin(projectionMatrix, GL20.GL_TRIANGLES);
    for (Triangle3D t : triangles) {
        t.render(rendu);
    }
    rendu.end();
    Gdx.gl20.glDisable(GL20.GL_TEXTURE_BINDING_2D);
    for (MeshTA m : sousMesh) {
        m.render(rendu, projectionMatrix);
    }
    projectionMatrix.scale(1 / scaleX, 1 / scaleY, 1 / scaleZ);
    projectionMatrix.rotateRad(Vector3.X, -rX);
    projectionMatrix.rotateRad(Vector3.Y, -rY);
    projectionMatrix.rotateRad(Vector3.Z, -rZ);
    projectionMatrix.translate(-tX, -tY, -tZ);
}