TriangleBatch.setTriangles(getMeshAsTrianglesVertices(batchIndex, TriangleBatch .getTriangles())); if (tris == null || tris.length != (batch.getIndexBuffer() .capacity() / 3)) tris = new Triangle[batch.getIndexBuffer().capacity() / 3];  for (int i = 0, tLength = tris.length; i < tLength; i++) { Triangle t = tris[i]; if (t == null) { t = new Triangle(TriangleBatch.getTriangles()[i * 3 + 0], TriangleBatch.getTriangles()[i * 3 + 1], TriangleBatch .getTriangles()[i * 3 + 2]); tris[i] = t; } else { t.set(0, TriangleBatch.getTriangles()[i * 3 + 0]); t.set(1, TriangleBatch.getTriangles()[i * 3 + 1]); t.set(2, TriangleBatch.getTriangles()[i * 3 + 2]); } t.calculateCenter(); t.setIndex(i); } return tris;
if (batch != null) return batch.getMeshAsTriangles(tris); else return tris;
    public Triangle[] getMeshAsTriangles(int batchIndex, Triangle[] tris) {        TriangleBatch batch = getBatch(batchIndex);        TriangleBatch.setTriangles(getMeshAsTrianglesVertices(batchIndex, TriangleBatch                .getTriangles()));        if (tris == null                || tris.length != (batch.getIndexBuffer()                        .capacity() / 3))            tris = new Triangle[batch.getIndexBuffer().capacity() / 3];        for (int i = 0, tLength = tris.length; i < tLength; i++) {            Triangle t = tris[i];            if (t == null) {                t = new Triangle(TriangleBatch.getTriangles()[i * 3 + 0],                        TriangleBatch.getTriangles()[i * 3 + 1], TriangleBatch                                .getTriangles()[i * 3 + 2]);                tris[i] = t;            } else {                t.set(0, TriangleBatch.getTriangles()[i * 3 + 0]);                t.set(1, TriangleBatch.getTriangles()[i * 3 + 1]);                t.set(2, TriangleBatch.getTriangles()[i * 3 + 2]);            }            t.calculateCenter();            t.setIndex(i);        }        return tris;    }