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

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

Introduction

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

Prototype

public Mesh setIndices(short[] indices, int offset, int count) 

Source Link

Document

Sets the indices of this Mesh.

Usage

From source file:com.esotericsoftware.spine.utils.TwoColorPolygonBatch.java

License:Open Source License

@Override
public void flush() {
    if (vertexIndex == 0)
        return;// w  ww. j  a va  2  s  . com

    totalRenderCalls++;

    lastTexture.bind();
    Mesh mesh = this.mesh;
    mesh.setVertices(vertices, 0, vertexIndex);
    mesh.setIndices(triangles, 0, triangleIndex);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    if (blendSrcFunc != -1)
        Gdx.gl.glBlendFuncSeparate(blendSrcFunc, blendDstFunc, blendSrcFuncAlpha, blendDstFuncAlpha);
    mesh.render(shader, GL20.GL_TRIANGLES, 0, triangleIndex);

    vertexIndex = 0;
    triangleIndex = 0;
}

From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java

License:Apache License

/** End building the mesh and returns the mesh */
public Mesh end() {
    if (this.attributes == null)
        throw new RuntimeException("Call begin() first");
    endpart();//from   w  ww . j ava 2 s.  co  m

    final Mesh mesh = new Mesh(true, vertices.size / stride, indices.size, attributes);
    mesh.setVertices(vertices.items, 0, vertices.size);
    mesh.setIndices(indices.items, 0, indices.size);

    for (MeshPart p : parts)
        p.mesh = mesh;
    parts.clear();

    attributes = null;
    vertices.clear();
    indices.clear();

    return mesh;
}