Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.opengl.Matrix;

public class Main {
    public static float[] translateModel(float[] animateResult, float[] mvpMatrix) {
        float[] newMatrix = copyMatrix(mvpMatrix);
        if (animateResult != null) {
            Matrix.translateM(newMatrix, 0, animateResult[0], animateResult[1], animateResult[2]);
        }
        return newMatrix;
    }

    public static float[] translateModel(float x, float y, float z, float[] matrix) {
        return translateModel(new float[] { x, y, z }, matrix);
    }

    private static float[] copyMatrix(float[] matrix) {
        float[] copyM = new float[matrix.length];
        for (int i = 0; i < matrix.length; i++) {
            copyM[i] = matrix[i];
        }
        return copyM;
    }
}