123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <!DOCTYPE html>
- <html lang="zh">
- <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">一个用于操控场景的实用类。</p>
- <h2>导入</h2>
- <p>
- [name] 是一个附加组件,必须显式导入。
- See [link:#manual/introduction/Installation Installation / Addons].
- </p>
- <code>
- import * as SceneUtils from 'three/addons/utils/SceneUtils.js';
- </code>
- <h2>方法</h2>
- <h3>[method:Group createMeshesFromInstancedMesh]( [param:InstancedMesh instancedMesh] )</h3>
- <p>
- instancedMesh -- 实例化网格。
- </p>
- <p>
- 为给定的实例化网格的每个实例,创建一个包含新网格的新物体组(Object Group)。
- </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 -- 材料集的几何形状。 <br />
- materials -- 为物体准备的材料。
- </p>
- <p>
- 创建一个新组,囊括了在材质中定义的每种材质的新网格。请注意,这和为一个网格定义多种材质的材质数组不同。<br />
- 该方法对于同时需要材质和线框绘制的物体非常有用。
- </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>
- <h3>[method:Generator traverseGenerator]( [param:Object3D object] )</h3>
- <p>
- object -- The 3D object to traverse.
- </p>
- <p>
- A generator based version of [page:Object3D.traverse]().
- </p>
- <h3>[method:Generator traverseVisibleGenerator]( [param:Object3D object] )</h3>
- <p>
- object -- The 3D object to traverse.
- </p>
- <p>
- A generator based version of [page:Object3D.traverseVisible]().
- </p>
- <h3>[method:Generator traverseAncestorsGenerator]( [param:Object3D object] )</h3>
- <p>
- object -- The 3D object to traverse.
- </p>
- <p>
- A generator based version of [page:Object3D.traverseAncestors]().
- </p>
- <h2>源代码</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SceneUtils.js examples/jsm/utils/SceneUtils.js]
- </p>
- </body>
- </html>
|