@Override public void ensureRectangleIndices (int numRectangles) { if (primitiveType == GL20.GL_POINTS) ensureIndices(4 * numRectangles); else if (primitiveType == GL20.GL_LINES) ensureIndices(8 * numRectangles); else // GL_TRIANGLES ensureIndices(6 * numRectangles); }
@Override public void ensureRectangleIndices (int numRectangles) { if (primitiveType == GL20.GL_POINTS) ensureIndices(4 * numRectangles); else if (primitiveType == GL20.GL_LINES) ensureIndices(8 * numRectangles); else // GL_TRIANGLES ensureIndices(6 * numRectangles); }
@Override public void ensureTriangleIndices (int numTriangles) { if (primitiveType == GL20.GL_LINES) ensureIndices(6 * numTriangles); else if (primitiveType == GL20.GL_TRIANGLES || primitiveType == GL20.GL_POINTS) ensureIndices(3 * numTriangles); else throw new GdxRuntimeException("Incorrect primtive type"); }
@Override public void ensureTriangleIndices (int numTriangles) { if (primitiveType == GL20.GL_LINES) ensureIndices(6 * numTriangles); else if (primitiveType == GL20.GL_TRIANGLES || primitiveType == GL20.GL_POINTS) ensureIndices(3 * numTriangles); else throw new GdxRuntimeException("Incorrect primtive type"); }
@Override public void ensureCapacity (int numVertices, int numIndices) { ensureVertices(numVertices); ensureIndices(numIndices); }
@Override public void ensureCapacity (int numVertices, int numIndices) { ensureVertices(numVertices); ensureIndices(numIndices); }
@Override public void index (final short value1, final short value2) { ensureIndices(2); indices.add(value1); indices.add(value2); }
@Override public void index (final short value1, final short value2) { ensureIndices(2); indices.add(value1); indices.add(value2); }
@Override public void addMesh (float[] vertices, short[] indices) { final short offset = (short)(lastIndex + 1); final int numVertices = vertices.length / stride; ensureVertices(numVertices); for (int v = 0; v < vertices.length; v += stride) addVertex(vertices, v); ensureIndices(indices.length); for (int i = 0; i < indices.length; ++i) index((short)(indices[i] + offset)); }
@Override public void index (final short value1, final short value2, final short value3) { ensureIndices(3); indices.add(value1); indices.add(value2); indices.add(value3); }
@Override public void index (final short value1, final short value2, final short value3) { ensureIndices(3); indices.add(value1); indices.add(value2); indices.add(value3); }
@Override public void addMesh (float[] vertices, short[] indices) { final short offset = (short)(lastIndex + 1); final int numVertices = vertices.length / stride; ensureVertices(numVertices); for (int v = 0; v < vertices.length; v += stride) addVertex(vertices, v); ensureIndices(indices.length); for (int i = 0; i < indices.length; ++i) index((short)(indices[i] + offset)); }
@Override public void index (final short value1, final short value2, final short value3, final short value4) { ensureIndices(4); indices.add(value1); indices.add(value2); indices.add(value3); indices.add(value4); }
@Override public void index (final short value1, final short value2, final short value3, final short value4) { ensureIndices(4); indices.add(value1); indices.add(value2); indices.add(value3); indices.add(value4); }
@Override public void index (short value1, short value2, short value3, short value4, short value5, short value6) { ensureIndices(6); indices.add(value1); indices.add(value2); indices.add(value3); indices.add(value4); indices.add(value5); indices.add(value6); }
@Override public void index (short value1, short value2, short value3, short value4, short value5, short value6) { ensureIndices(6); indices.add(value1); indices.add(value2); indices.add(value3); indices.add(value4); indices.add(value5); indices.add(value6); }
@Override public void index (short value1, short value2, short value3, short value4, short value5, short value6, short value7, short value8) { ensureIndices(8); indices.add(value1); indices.add(value2); indices.add(value3); indices.add(value4); indices.add(value5); indices.add(value6); indices.add(value7); indices.add(value8); }
@Override public void index (short value1, short value2, short value3, short value4, short value5, short value6, short value7, short value8) { ensureIndices(8); indices.add(value1); indices.add(value2); indices.add(value3); indices.add(value4); indices.add(value5); indices.add(value6); indices.add(value7); indices.add(value8); }
@Override public void addMesh (float[] vertices, short[] indices, int indexOffset, int numIndices) { if (indicesMap == null) indicesMap = new IntIntMap(numIndices); else { indicesMap.clear(); indicesMap.ensureCapacity(numIndices); } ensureIndices(numIndices); final int numVertices = vertices.length / stride; ensureVertices(numVertices < numIndices ? numVertices : numIndices); for (int i = 0; i < numIndices; i++) { final int sidx = indices[indexOffset + i]; int didx = indicesMap.get(sidx, -1); if (didx < 0) { addVertex(vertices, sidx * stride); indicesMap.put(sidx, didx = lastIndex); } index((short)didx); } }
@Override public void addMesh (float[] vertices, short[] indices, int indexOffset, int numIndices) { if (indicesMap == null) indicesMap = new IntIntMap(numIndices); else { indicesMap.clear(); indicesMap.ensureCapacity(numIndices); } ensureIndices(numIndices); final int numVertices = vertices.length / stride; ensureVertices(numVertices < numIndices ? numVertices : numIndices); for (int i = 0; i < numIndices; i++) { final int sidx = indices[indexOffset + i]; int didx = indicesMap.get(sidx, -1); if (didx < 0) { addVertex(vertices, sidx * stride); indicesMap.put(sidx, didx = lastIndex); } index((short)didx); } }