Example usage for com.badlogic.gdx.graphics.g3d.utils ModelBuilder part

List of usage examples for com.badlogic.gdx.graphics.g3d.utils ModelBuilder part

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g3d.utils ModelBuilder part.

Prototype

public void part(final MeshPart meshpart, final Material material) 

Source Link

Document

Adds the specified MeshPart to the current Node.

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());/*  w ww  . j a va2s.  c  o 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;
}