MeshSurfaceSampler constructor

MeshSurfaceSampler(
  1. dynamic mesh
)

Implementation

MeshSurfaceSampler(mesh) {
  var geometry = mesh.geometry;

  if (!geometry.isBufferGeometry || geometry.attributes.position.itemSize != 3) {
    throw ('THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.');
  }

  if (geometry.index) {
    print('THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry.');

    geometry = geometry.toNonIndexed();
  }

  this.geometry = geometry;
  randomFunction = Math.random;

  positionAttribute = this.geometry.getAttribute('position');
  colorAttribute = this.geometry.getAttribute('color');
  weightAttribute = null;

  distribution = null;
}