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

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

Introduction

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

Prototype

public float[] getValues() 

Source Link

Usage

From source file:es.eucm.ead.engine.canvas.GdxCanvas.java

License:Open Source License

/**
 * Creates a {@link Matrix4} compatible with Gdx
 *
 * @param m matrix//from w w  w  .j a va2  s.  c  om
 * @param dst destination matrix
 * @return the compatible matrix
 */
public Matrix4 convertMatrix(Matrix m, Matrix4 dst) {
    float[] val = dst.getValues();

    float[] mat = m.getFlatMatrix();

    val[0] = mat[0];
    val[1] = mat[1];
    val[2] = mat[2];
    val[3] = 0;
    val[4] = mat[3];
    val[5] = mat[4];
    val[6] = mat[5];
    val[7] = 0;
    val[8] = 0;
    val[9] = 0;
    val[10] = 1;
    val[11] = 0;
    val[12] = mat[6];
    val[13] = mat[7];
    val[14] = 0;
    val[15] = mat[8];
    return dst;
}

From source file:MeshBoneUtil.Utils.java

License:Open Source License

public static Matrix4 mulMat(Matrix4 mat_in, float factor) {
    Matrix4 ret_mat = mat_in.cpy();
    float val[] = ret_mat.getValues();

    for (int i = 0; i < 16; i++) {
        val[i] *= factor;
    }// w  ww  .j  a v  a2s  .  c  om

    ret_mat.set(val);

    return ret_mat;
}

From source file:net.mwplay.cocostudio.ui.particleutil.CCParticleActor.java

License:Apache License

private void transformPoint(Vector3 v) {
    //transformVector(point->x, point->y, point->z, 1.0f, point)
    // MathUtil::transformVec4(m, x, y, z, w, (float*)dst);
    float w = 1;/*  www. ja  v a 2 s .  c om*/
    Matrix4 m4 = this.getStage().getCamera().combined;
    //m4.inv();
    float[] m = m4.getValues();
    v.x = v.x * m[0] + v.y * m[4] + v.z * m[8] + w * m[12];
    v.y = v.x * m[1] + v.y * m[5] + v.z * m[9] + w * m[13];
    v.z = v.x * m[2] + v.y * m[6] + v.z * m[10] + w * m[14];
}