private void setIndexData() { // generate connectivity for (int radialCount0 = _radialSamples - 1, radialCount1 = 0; radialCount1 < _radialSamples; radialCount0 = radialCount1++) { final int i00 = 2 * radialCount0; final int i01 = 2 * radialCount1; final int i10 = i00 + 1; final int i11 = i01 + 1; _meshData.getIndices().put(i00); _meshData.getIndices().put(i10); _meshData.getIndices().put(i11); _meshData.getIndices().put(i00); _meshData.getIndices().put(i11); _meshData.getIndices().put(i01); } }
/** * Sets the correct indices array for the box. */ private void setIndexData() { if (_meshData.getIndices() == null) { _meshData.setIndexBuffer(BufferUtils.createByteBuffer(36)); for (int i = 0; i < 6; i++) { _meshData.getIndices().put(i * 4 + 0); _meshData.getIndices().put(i * 4 + 1); _meshData.getIndices().put(i * 4 + 3); _meshData.getIndices().put(i * 4 + 1); _meshData.getIndices().put(i * 4 + 2); _meshData.getIndices().put(i * 4 + 3); } } }
private void setIndexData(final int radialless, final int shellLess) { // generate connectivity for (int radialCount0 = radialless, radialCount1 = 0; radialCount1 < _radialSamples; radialCount0 = radialCount1++) { _meshData.getIndices().put(0); _meshData.getIndices().put(1 + shellLess * radialCount0); _meshData.getIndices().put(1 + shellLess * radialCount1); for (int iS = 1; iS < shellLess; iS++) { final int i00 = iS + shellLess * radialCount0; final int i01 = iS + shellLess * radialCount1; final int i10 = i00 + 1; final int i11 = i01 + 1; _meshData.getIndices().put(i00); _meshData.getIndices().put(i10); _meshData.getIndices().put(i11); _meshData.getIndices().put(i00); _meshData.getIndices().put(i11); _meshData.getIndices().put(i01); } } }
/** * Sets the correct indices array for the box. */ private void setIndexData() { if (_meshData.getIndices() == null) { _meshData.setIndexBuffer(BufferUtils.createByteBuffer(36)); for (int i = 0; i < 6; i++) { _meshData.getIndices().put(i * 4 + 0); _meshData.getIndices().put(i * 4 + 1); _meshData.getIndices().put(i * 4 + 3); _meshData.getIndices().put(i * 4 + 1); _meshData.getIndices().put(i * 4 + 2); _meshData.getIndices().put(i * 4 + 3); } } }
/** * <code>setIndexData</code> sets the indices into the list of vertices, defining all triangles that constitute the * box. */ private void setIndexData() { if (_meshData.getIndices() == null) { final byte[] indices = { 2, 1, 0, 3, 2, 0, 6, 5, 4, 7, 6, 4, 10, 9, 8, 11, 10, 8, 14, 13, 12, 15, 14, 12, 18, 17, 16, 19, 18, 16, 22, 21, 20, 23, 22, 20 }; final ByteBuffer buf = BufferUtils.createByteBuffer(indices.length); buf.put(indices); buf.rewind(); _meshData.setIndexBuffer(buf); } }
/** * Marks the indices as dirty in this MeshData. Also calls {@link #markBuffersDirty()} * * @throws Ardor3DException * if buffer is not found */ public void markIndicesDirty() { final AbstractBufferData<?> data = getIndices(); data.markDirty(); markBuffersDirty(); }
/** * * <code>setIndexData</code> sets the indices into the list of vertices, defining all triangles that constitute the * box. * */ private void setIndexData() { _meshData.setIndexMode(IndexMode.TriangleStrip); if (_meshData.getIndices() == null) { final byte[] indices = new byte[] { 2, 3, 6, 7, 5, 3, 0, 2, 1, 6, 4, 5, 1, 0 }; final ByteBuffer buf = BufferUtils.createByteBuffer(indices.length); buf.put(indices); buf.rewind(); _meshData.setIndexBuffer(buf); } }
/** * * <code>setIndexData</code> sets the indices into the list of vertices, defining all triangles that constitute the * box. * */ private void setIndexData() { _meshData.setIndexMode(IndexMode.TriangleStrip); if (_meshData.getIndices() == null) { final byte[] indices = new byte[] { 2, 3, 6, 7, 5, 3, 0, 2, 1, 6, 4, 5, 1, 0 }; final ByteBuffer buf = BufferUtils.createByteBuffer(indices.length); buf.put(indices); buf.rewind(); _meshData.setIndexBuffer(buf); } }
private void setIndexData() { if (_meshData.getIndices() == null) { final IndexBufferData<?> buff = BufferUtils.createIndexBufferData(180, 48 - 1); final int[] data = new int[] { 0, 4, 1, 1, 4, 5, 1, 5, 3, 3, 5, 7, 3, 7, 2, 2, 7, 6, 2, 6, 0, 0, 6, 4, 4, 6, 5, 5, 6, 7 }; for (int i = 0; i < 6; i++) { for (int n = 0; n < 30; n++) { buff.put(30 * i + n, 8 * i + data[n]); } } _meshData.setIndices(buff); } }
private void setIndexData() { if (_meshData.getIndices() == null) { final IndexBufferData<?> buff = BufferUtils.createIndexBufferData(180, 48 - 1); final int[] data = new int[] { 0, 4, 1, 1, 4, 5, 1, 5, 3, 3, 5, 7, 3, 7, 2, 2, 7, 6, 2, 6, 0, 0, 6, 4, 4, 6, 5, 5, 6, 7 }; for (int i = 0; i < 6; i++) { for (int n = 0; n < 30; n++) { buff.put(30 * i + n, 8 * i + data[n]); } } _meshData.setIndices(buff); } }
private void allocateVertices() { final int verts = (2 * (_axisSamples + 1) * (_radialSamples + 1) + _radialSamples * 4); _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(_meshData.getTextureBuffer(0), verts), 0); final int tris = (4 * _radialSamples * (1 + _axisSamples)); if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * tris) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); } setGeometryData(); setIndexData(); }
private void allocateVertices() { final int verts = (2 * (_axisSamples + 1) * (_radialSamples + 1) + _radialSamples * 4); _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(_meshData.getTextureBuffer(0), verts), 0); final int tris = (4 * _radialSamples * (1 + _axisSamples)); if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * tris) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); } setGeometryData(); setIndexData(); }
private void allocateVertices() { // allocate vertices final int verts = _axisSamples * (_radialSamples + 1) + (_closed ? 2 : 0); _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); // allocate normals if requested _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); // allocate texture coordinates _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(verts), 0); final int count = ((_closed ? 2 : 0) + 2 * (_axisSamples - 1)) * _radialSamples; if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * count) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * count, verts - 1)); } setGeometryData(); setIndexData(); }
private void allocateVertices() { // allocate vertices final int verts = _axisSamples * (_radialSamples + 1) + (_closed ? 2 : 0); _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); // allocate normals if requested _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); // allocate texture coordinates _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(verts), 0); final int count = ((_closed ? 2 : 0) + 2 * (_axisSamples - 1)) * _radialSamples; if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * count) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * count, verts - 1)); } setGeometryData(); setIndexData(); }
private void recreateBuffers() { // determine vert quantity - first the sphere caps final int sampleLines = (2 * sphereSamples - 1 + axisSamples); final int verts = (radialSamples + 1) * sampleLines + 2; _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); // allocate normals _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); // allocate texture coordinates _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(verts), 0); // determine tri quantity final int tris = 2 * radialSamples * sampleLines; if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * tris) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); } setGeometryData(); setIndexData(); }
private void recreateBuffers() { // determine vert quantity - first the sphere caps final int sampleLines = (2 * sphereSamples - 1 + axisSamples); final int verts = (radialSamples + 1) * sampleLines + 2; _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); // allocate normals _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); // allocate texture coordinates _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(verts), 0); // determine tri quantity final int tris = 2 * radialSamples * sampleLines; if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * tris) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); } setGeometryData(); setIndexData(); }
private void setIndexData() { final IndexBufferData<?> indices = _meshData.getIndices(); indices.getBuffer().rewind(); indices.put(4).put(0).put(2); indices.put(4).put(2).put(1); indices.put(4).put(1).put(3); indices.put(4).put(3).put(0); indices.put(5).put(2).put(0); indices.put(5).put(1).put(2); indices.put(5).put(3).put(1); indices.put(5).put(0).put(3); }
private void setIndexData() { final IndexBufferData<?> indices = _meshData.getIndices(); indices.getBuffer().rewind(); indices.put(4).put(0).put(2); indices.put(4).put(2).put(1); indices.put(4).put(1).put(3); indices.put(4).put(3).put(0); indices.put(5).put(2).put(0); indices.put(5).put(1).put(2); indices.put(5).put(3).put(1); indices.put(5).put(0).put(3); }
public void visit(final Spatial spatial) { if (spatial instanceof Mesh) { final Mesh mesh = (Mesh) spatial; _deleter.deleteVBOs(mesh.getMeshData().getVertexCoords()); _deleter.deleteVBOs(mesh.getMeshData().getIndices()); _deleter.deleteVBOs(mesh.getMeshData().getInterleavedData()); _deleter.deleteVBOs(mesh.getMeshData().getNormalCoords()); _deleter.deleteVBOs(mesh.getMeshData().getTangentCoords()); for (final FloatBufferData coords : mesh.getMeshData().getTextureCoords()) { _deleter.deleteVBOs(coords); } _deleter.deleteVBOs(mesh.getMeshData().getColorCoords()); _deleter.deleteVBOs(mesh.getMeshData().getFogCoords()); } } }
private void setIndexData() { final IndexBufferData<?> indices = _meshData.getIndices(); indices.getBuffer().rewind(); indices.put(9).put(5).put(10).put(6); indices.put(4).put(0).put(5).put(1).put(6).put(2); indices.put(2).put(3).put(6).put(7).put(10).put(11); indices.put(11).put(15).put(10).put(14).put(9).put(13); indices.put(13).put(12).put(9).put(8).put(5).put(4); _meshData.setIndexLengths(new int[] { 4, 6, 6, 6, 6 }); _meshData.setIndexMode(IndexMode.TriangleStrip); _meshData.markIndicesDirty(); }