/** * Creates a flat disk (circle) at the origin flat along the Z. Usually, a higher sample number creates a better * looking cylinder, but at the cost of more vertex information. * * @param name * The name of the disk. * @param shellSamples * The number of shell samples. * @param radialSamples * The number of radial samples. * @param radius * The radius of the disk. */ public Disk(final String name, final int shellSamples, final int radialSamples, final double radius) { super(name); _shellSamples = shellSamples; _radialSamples = radialSamples; _radius = radius; final int radialless = radialSamples - 1; final int shellLess = shellSamples - 1; // allocate vertices final int verts = 1 + radialSamples * shellLess; _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(verts)); _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(verts)); _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(verts), 0); final int tris = radialSamples * (2 * shellLess - 1); _meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); setGeometryData(shellLess); setIndexData(radialless, shellLess); }
_meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); setGeometryData(); setIndexData();