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;
  this.randomFunction = Math.random;

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

  this.distribution = null;
}