From 8f3ac8859b55a520fa61ef0764331ba8ec773794 Mon Sep 17 00:00:00 2001 From: Don McCurdy Date: Fri, 20 Dec 2019 13:00:31 -0800 Subject: [PATCH] MeshSurfaceSampler: Accept Mesh as parameter, not BufferGeometry --- docs/examples/en/math/MeshSurfaceSampler.html | 8 ++++---- docs/examples/zh/math/MeshSurfaceSampler.html | 6 +++--- examples/jsm/math/MeshSurfaceSampler.js | 4 +++- examples/webgl_instancing_scatter.html | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/examples/en/math/MeshSurfaceSampler.html b/docs/examples/en/math/MeshSurfaceSampler.html index d1d8b8310f..c637436b94 100644 --- a/docs/examples/en/math/MeshSurfaceSampler.html +++ b/docs/examples/en/math/MeshSurfaceSampler.html @@ -17,8 +17,8 @@

Example

- // Create a sampler for a BufferGeometry surface. - var sampler = new THREE.MeshSurfaceSampler( surfaceGeometry ) + // Create a sampler for a Mesh surface. + var sampler = new THREE.MeshSurfaceSampler( surfaceMesh ) .setWeightAttribute( 'color' ) .build(); @@ -52,9 +52,9 @@

Constructor

-

[name]( [param:BufferGeometry geometry] )

+

[name]( [param:Mesh mesh] )

- [page:BufferGeometry geometry] — Surface geometry from which to sample. + [page:Mesh mesh] — Surface mesh from which to sample.

Creates a new [name]. If the input geometry is indexed, a non-indexed copy is made. After construction, the sampler is not able to return samples until [page:MeshSurfaceSampler.build build] is called. diff --git a/docs/examples/zh/math/MeshSurfaceSampler.html b/docs/examples/zh/math/MeshSurfaceSampler.html index d1d8b8310f..9d18603223 100644 --- a/docs/examples/zh/math/MeshSurfaceSampler.html +++ b/docs/examples/zh/math/MeshSurfaceSampler.html @@ -18,7 +18,7 @@ // Create a sampler for a BufferGeometry surface. - var sampler = new THREE.MeshSurfaceSampler( surfaceGeometry ) + var sampler = new THREE.MeshSurfaceSampler( surfaceMesh ) .setWeightAttribute( 'color' ) .build(); @@ -52,9 +52,9 @@

Constructor

-

[name]( [param:BufferGeometry geometry] )

+

[name]( [param:Mesh mesh] )

- [page:BufferGeometry geometry] — Surface geometry from which to sample. + [page:Mesh mesh] — Surface mesh from which to sample.

Creates a new [name]. If the input geometry is indexed, a non-indexed copy is made. After construction, the sampler is not able to return samples until [page:MeshSurfaceSampler.build build] is called. diff --git a/examples/jsm/math/MeshSurfaceSampler.js b/examples/jsm/math/MeshSurfaceSampler.js index a0c7e7364a..20850525aa 100644 --- a/examples/jsm/math/MeshSurfaceSampler.js +++ b/examples/jsm/math/MeshSurfaceSampler.js @@ -20,7 +20,9 @@ var MeshSurfaceSampler = ( function () { var _face = new Triangle(); - function MeshSurfaceSampler ( geometry ) { + function MeshSurfaceSampler ( mesh ) { + + var geometry = mesh.geometry; if ( ! geometry.isBufferGeometry || geometry.attributes.position.itemSize !== 3 ) { diff --git a/examples/webgl_instancing_scatter.html b/examples/webgl_instancing_scatter.html index ff8a7d6253..0b28603fe0 100644 --- a/examples/webgl_instancing_scatter.html +++ b/examples/webgl_instancing_scatter.html @@ -181,7 +181,7 @@ console.time( '.build()' ); - sampler = new MeshSurfaceSampler( surface.geometry ) + sampler = new MeshSurfaceSampler( surface ) .setWeightAttribute( api.distribution === 'weighted' ? 'uv' : null ) .build(); -- GitLab