MeshSurfaceSampler constructor
MeshSurfaceSampler(
- 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) {
console.warn('THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry.');
geometry = geometry.toNonIndexed();
}
this.geometry = geometry;
randomFunction = three.Math.random;
positionAttribute = this.geometry.getAttribute('position');
colorAttribute = this.geometry.getAttribute('color');
weightAttribute = null;
distribution = null;
}