Пример #1
0
  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();
  }