/** * Creates an octahedron with center at the origin. The lenght sides are given. * * @param name * The name of the octahedron. * @param sideLength * The length of each side of the octahedron. */ public Octahedron(final String name, final double sideLength) { super(name); _sideLength = sideLength; // allocate vertices _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(NUM_POINTS)); _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(NUM_POINTS)); _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(NUM_POINTS), 0); _meshData.setIndices(BufferUtils.createIndexBufferData(3 * NUM_TRIS, NUM_POINTS - 1)); setVertexData(); setNormalData(); setTextureData(); setIndexData(); }
/** * Creates an octahedron with center at the origin. The lenght sides are given. * * @param name * The name of the octahedron. * @param sideLength * The length of each side of the octahedron. */ public Octahedron(final String name, final double sideLength) { super(name); _sideLength = sideLength; // allocate vertices _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(NUM_POINTS)); _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(NUM_POINTS)); _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(NUM_POINTS), 0); _meshData.setIndices(BufferUtils.createIndexBufferData(3 * NUM_TRIS, NUM_POINTS - 1)); setVertexData(); setNormalData(); setTextureData(); setIndexData(); }