Example usage for com.badlogic.gdx.graphics Mesh getMaxVertices

List of usage examples for com.badlogic.gdx.graphics Mesh getMaxVertices

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Mesh getMaxVertices.

Prototype

public int getMaxVertices() 

Source Link

Usage

From source file:com.lyeeedar.Roguelike3D.Graphics.Models.Shapes.java

License:Open Source License

public static void translateMesh(Mesh mesh, float x, float y, float z) {
    final int vertexSize = mesh.getVertexAttributes().vertexSize / 4;
    float[] newPos = new float[mesh.getMaxVertices() * vertexSize];
    mesh.getVertices(newPos);/*from  ww w . j a v a 2  s  .  c om*/

    int positionOffset = mesh.getVertexAttributes().getOffset(Usage.Position);

    for (int i = 0; i < mesh.getMaxVertices(); i++) {
        newPos[(i * vertexSize) + 0 + positionOffset] += x;
        newPos[(i * vertexSize) + 1 + positionOffset] += y;
        newPos[(i * vertexSize) + 2 + positionOffset] += z;
    }
    mesh.setVertices(newPos);
}