You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.5 KiB

2 years ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
<h1>[name]</h1>
<p class="desc">A class containing useful utility functions for scene manipulation.</p>
<h2>Methods</h2>
<h3>[method:Group createMeshesFromInstancedMesh]( [param:InstancedMesh instancedMesh] )</h3>
<p>
instancedMesh -- The instanced mesh.
</p>
<p>
Creates a new group object that contains a new mesh for each instance of the given instanced mesh.
</p>
<h3>[method:Group createMeshesFromMultiMaterialMesh]( [param:Mesh mesh] )</h3>
<p>
mesh -- A mesh with multiple materials.
</p>
<p>
Converts the given multi-material mesh into an instance of [page:Group] holding for each material a separate mesh.
</p>
<h3>[method:Group createMultiMaterialObject]( [param:BufferGeometry geometry], [param:Array materials] )</h3>
<p>
geometry -- The geometry for the set of materials. <br />
materials -- The materials for the object.
</p>
<p>
Creates a new Group that contains a new mesh for each material defined in materials. Beware that this is not the same as an array of materials which defines multiple materials for 1 mesh.<br />
This is mostly useful for objects that need both a material and a wireframe implementation.
</p>
<h3>[method:undefined sortInstancedMesh]( [param:InstancedMesh mesh], [param:Function compareFn] )</h3>
<p>
mesh -- InstancedMesh in which instances will be sorted. <br />
compareFn -- Comparator function defining the sort order.
</p>
<p>
Sorts the instances within an [page:InstancedMesh], according to a user-defined
callback. The callback will be provided with two arguments, <i>indexA</i>
and <i>indexB</i>, and must return a numerical value. See
[link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description Array.prototype.sort]
for more information on sorting callbacks and their return values.
</p>
<p>
Because of the high performance cost, three.js does not sort
[page:InstancedMesh] instances automatically. Manually sorting may be
helpful to improve display of alpha blended materials (back to front),
and to reduce overdraw in opaque materials (front to back).
</p>
<h2>Source</h2>
<p>
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SceneUtils.js examples/jsm/utils/SceneUtils.js]
</p>
</body>
</html>