-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
/
SceneUtils.html
102 lines (88 loc) · 3.28 KB
/
SceneUtils.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!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>