src/systems/geometry.js
function toBufferGeometry (geometry, doBuffer) {
  var bufferGeometry;
  if (!doBuffer) { return geometry; }

  bufferGeometry = new THREE.BufferGeometry().fromGeometry(geometry);
  bufferGeometry.metadata = {type: geometry.type, parameters: geometry.parameters || {}};
  geometry.dispose();  // Dispose no longer needed non-buffer geometry.
  return bufferGeometry;
}
function toBufferGeometry (geometry, doBuffer) {
  var bufferGeometry;
  if (!doBuffer) { return geometry; }

  bufferGeometry = new THREE.BufferGeometry().fromGeometry(geometry);
  bufferGeometry.metadata = {type: geometry.type, parameters: geometry.parameters || {}};
  geometry.dispose();  // Dispose no longer needed non-buffer geometry.
  return bufferGeometry;
}
function toBufferGeometry ( geometry , doBuffer ) { var bufferGeometry ; if ( ! doBuffer ) { return geometry ; } bufferGeometry = new THREE . BufferGeometry ( ) . fromGeometry ( geometry ) ; bufferGeometry . metadata = { type : geometry . type , parameters : geometry . parameters || { } } ; geometry . dispose ( ) ; // Dispose no longer needed non-buffer geometry. return bufferGeometry ; }
Transform geometry to BufferGeometry if `doBuffer`.

@param {object} geometry
@param {boolean} doBuffer
@returns {object} Geometry.
Transform geometry to BufferGeometry if doBuffer .