提交 8f3ac885 编写于 作者: D Don McCurdy

MeshSurfaceSampler: Accept Mesh as parameter, not BufferGeometry

上级 e516dbbc
......@@ -17,8 +17,8 @@
<h2>Example</h2>
<code>
// 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 @@
<h2>Constructor</h2>
<h3>[name]( [param:BufferGeometry geometry] )</h3>
<h3>[name]( [param:Mesh mesh] )</h3>
<p>
[page:BufferGeometry geometry] — Surface geometry from which to sample.
[page:Mesh mesh] — Surface mesh from which to sample.
</p>
<p>
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.
......
......@@ -18,7 +18,7 @@
<code>
// 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 @@
<h2>Constructor</h2>
<h3>[name]( [param:BufferGeometry geometry] )</h3>
<h3>[name]( [param:Mesh mesh] )</h3>
<p>
[page:BufferGeometry geometry] — Surface geometry from which to sample.
[page:Mesh mesh] — Surface mesh from which to sample.
</p>
<p>
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.
......
......@@ -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 ) {
......
......@@ -181,7 +181,7 @@
console.time( '.build()' );
sampler = new MeshSurfaceSampler( surface.geometry )
sampler = new MeshSurfaceSampler( surface )
.setWeightAttribute( api.distribution === 'weighted' ? 'uv' : null )
.build();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册