/** Clears the data being built up until now, including the vertices, indices and all parts. Must be called in between the call * to #begin and #end. Any builder calls made from the last call to #begin up until now are practically discarded. The state * (e.g. UV region, color, vertex transform) will remain unchanged. */ public void clear () { this.vertices.clear(); this.indices.clear(); this.parts.clear(); this.vindex = 0; this.lastIndex = -1; this.istart = 0; this.part = null; }
/** Clears the data being built up until now, including the vertices, indices and all parts. Must be called in between the call * to #begin and #end. Any builder calls made from the last call to #begin up until now are practically discarded. The state * (e.g. UV region, color, vertex transform) will remain unchanged. */ public void clear () { this.vertices.clear(); this.indices.clear(); this.parts.clear(); this.vindex = 0; this.lastIndex = -1; this.istart = 0; this.part = null; }
@Override public void addMesh (Mesh mesh, int indexOffset, int numIndices) { if (!attributes.equals(mesh.getVertexAttributes())) throw new GdxRuntimeException("Vertex attributes do not match"); if (numIndices <= 0) return; // silently ignore an empty mesh part // FIXME don't triple copy, instead move the copy to jni int numFloats = mesh.getNumVertices() * stride; tmpVertices.clear(); tmpVertices.ensureCapacity(numFloats); tmpVertices.size = numFloats; mesh.getVertices(tmpVertices.items); tmpIndices.clear(); tmpIndices.ensureCapacity(numIndices); tmpIndices.size = numIndices; mesh.getIndices(indexOffset, numIndices, tmpIndices.items, 0); addMesh(tmpVertices.items, tmpIndices.items, 0, numIndices); }
@Override public void addMesh (Mesh mesh, int indexOffset, int numIndices) { if (!attributes.equals(mesh.getVertexAttributes())) throw new GdxRuntimeException("Vertex attributes do not match"); if (numIndices <= 0) return; // silently ignore an empty mesh part // FIXME don't triple copy, instead move the copy to jni int numFloats = mesh.getNumVertices() * stride; tmpVertices.clear(); tmpVertices.ensureCapacity(numFloats); tmpVertices.size = numFloats; mesh.getVertices(tmpVertices.items); tmpIndices.clear(); tmpIndices.ensureCapacity(numIndices); tmpIndices.size = numIndices; mesh.getIndices(indexOffset, numIndices, tmpIndices.items, 0); addMesh(tmpVertices.items, tmpIndices.items, 0, numIndices); }
this.attributes = attributes; this.vertices.clear(); this.indices.clear(); this.parts.clear(); this.vindex = 0;
this.attributes = attributes; this.vertices.clear(); this.indices.clear(); this.parts.clear(); this.vindex = 0;
originalIndices.clear(); originalIndices.ensureCapacity(pointCount); short[] originalIndicesArray = originalIndices.items;
originalIndices.clear(); originalIndices.ensureCapacity(pointCount); short[] originalIndicesArray = originalIndices.items;
originalIndices.clear(); originalIndices.ensureCapacity(pointCount); short[] originalIndicesArray = originalIndices.items;
originalIndices.clear(); originalIndices.ensureCapacity(pointCount); short[] originalIndicesArray = originalIndices.items;
/** End building the mesh and returns the mesh * @param mesh The mesh to receive the built vertices and indices, must have the same attributes and must be big enough to hold * the data, any existing data will be overwritten. */ public Mesh end (Mesh mesh) { endpart(); if (attributes == null) throw new GdxRuntimeException("Call begin() first"); if (!attributes.equals(mesh.getVertexAttributes())) throw new GdxRuntimeException("Mesh attributes don't match"); if ((mesh.getMaxVertices() * stride) < vertices.size) throw new GdxRuntimeException("Mesh can't hold enough vertices: " + mesh.getMaxVertices() + " * " + stride + " < " + vertices.size); if (mesh.getMaxIndices() < indices.size) throw new GdxRuntimeException("Mesh can't hold enough indices: " + mesh.getMaxIndices() + " < " + indices.size); 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; }
/** End building the mesh and returns the mesh * @param mesh The mesh to receive the built vertices and indices, must have the same attributes and must be big enough to hold * the data, any existing data will be overwritten. */ public Mesh end (Mesh mesh) { endpart(); if (attributes == null) throw new GdxRuntimeException("Call begin() first"); if (!attributes.equals(mesh.getVertexAttributes())) throw new GdxRuntimeException("Mesh attributes don't match"); if ((mesh.getMaxVertices() * stride) < vertices.size) throw new GdxRuntimeException("Mesh can't hold enough vertices: " + mesh.getMaxVertices() + " * " + stride + " < " + vertices.size); if (mesh.getMaxIndices() < indices.size) throw new GdxRuntimeException("Mesh can't hold enough indices: " + mesh.getMaxIndices() + " < " + indices.size); 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; }
tmpIndices.clear(); tmpIndices.ensureCapacity(divisionsU * 2); tmpIndices.size = s;
tmpIndices.clear(); tmpIndices.ensureCapacity(divisionsU * 2); tmpIndices.size = s;
triangles.clear(); if (count < 6) return triangles; triangles.ensureCapacity(count);
triangles.clear(); if (count < 6) return triangles; triangles.ensureCapacity(count);
/** Clears the data being built up until now, including the vertices, indices and all parts. Must be called in between the call * to #begin and #end. Any builder calls made from the last call to #begin up until now are practically discarded. The state * (e.g. UV region, color, vertex transform) will remain unchanged. */ public void clear () { this.vertices.clear(); this.indices.clear(); this.parts.clear(); this.vindex = 0; this.lastIndex = -1; this.istart = 0; this.part = null; }
@Override public void addMesh (Mesh mesh, int indexOffset, int numIndices) { if (!attributes.equals(mesh.getVertexAttributes())) throw new GdxRuntimeException("Vertex attributes do not match"); if (numIndices <= 0) return; // silently ignore an empty mesh part // FIXME don't triple copy, instead move the copy to jni int numFloats = mesh.getNumVertices() * stride; tmpVertices.clear(); tmpVertices.ensureCapacity(numFloats); tmpVertices.size = numFloats; mesh.getVertices(tmpVertices.items); tmpIndices.clear(); tmpIndices.ensureCapacity(numIndices); tmpIndices.size = numIndices; mesh.getIndices(indexOffset, numIndices, tmpIndices.items, 0); addMesh(tmpVertices.items, tmpIndices.items, 0, numIndices); }