Example usage for com.badlogic.gdx.graphics.g3d.model MeshPart MeshPart

List of usage examples for com.badlogic.gdx.graphics.g3d.model MeshPart MeshPart

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g3d.model MeshPart MeshPart.

Prototype

public MeshPart(final String id, final Mesh mesh, final int offset, final int size, final int type) 

Source Link

Document

Construct a new MeshPart and set all its values.

Usage

From source file:com.mbrlabs.mundus.commons.terrain.Terrain.java

License:Apache License

public void init() {
    final int numVertices = this.vertexResolution * vertexResolution;
    final int numIndices = (this.vertexResolution - 1) * (vertexResolution - 1) * 6;

    mesh = new Mesh(true, numVertices, numIndices, attribs);
    this.vertices = new float[numVertices * stride];
    mesh.setIndices(buildIndices());//from  w  w  w. ja v  a 2 s  .co m
    buildVertices();
    mesh.setVertices(vertices);

    MeshPart meshPart = new MeshPart(null, mesh, 0, numIndices, GL20.GL_TRIANGLES);
    meshPart.update();
    ModelBuilder mb = new ModelBuilder();
    mb.begin();
    mb.part(meshPart, material);
    model = mb.end();
    modelInstance = new ModelInstance(model);
    modelInstance.transform = transform;
}