forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeometry.html
More file actions
294 lines (236 loc) · 7.45 KB
/
Copy pathGeometry.html
File metadata and controls
294 lines (236 loc) · 7.45 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">
Base class for geometries.<br />
A geometry holds all data necessary to describe a 3D model.
</div>
<h2>Example</h2>
<code>var geometry = new THREE.Geometry();
geometry.vertices.push( new THREE.Vector3( -10, 10, 0 ) );
geometry.vertices.push( new THREE.Vector3( -10, -10, 0 ) );
geometry.vertices.push( new THREE.Vector3( 10, -10, 0 ) );
geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );
geometry.computeBoundingSphere();
</code>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
todo
</div>
<h2>Properties</h2>
<h3>.[page:Integer id]</h3>
<div>
Unique number of this geometry instance
</div>
<h3>.[page:String name]</h3>
<div>
Name for this geometry. Default is an empty string.
</div>
<h3>.[page:Array vertices]</h3>
<div>
Array of [page:Vector3 vertices].<br />
The array of vertices hold every position of points of the model.<br />
To signal an update in this array, [page:Geometry Geometry.verticesNeedUpdate] needs to be set to true.
</div>
<h3>.[page:Array colors]</h3>
<div>
Array of vertex [page:Color colors], matching number and order of vertices.<br />
Used in [page:ParticleSystem] and [page:Line].<br />
[page:Mesh Meshes] use per-face-use-of-vertex colors embedded directly in faces.<br />
To signal an update in this array, [page:Geometry Geometry.colorsNeedUpdate] needs to be set to true.
</div>
<h3>.[page:Array faces]</h3>
<div>
Array of [page:Face3 triangles].<br />
The array of faces describe how each vertex in the model is connected with each other.<br />
To signal an update in this array, [page:Geometry Geometry.elementsNeedUpdate] needs to be set to true.
</div>
<h3>.[page:Array faceVertexUvs]</h3>
<div>
Array of face [page:UV] layers.<br />
Each UV layer is an array of [page:UV] matching order and number of vertices in faces.<br />
To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.
</div>
<h3>.[page:Array morphTargets]</h3>
<div>
Array of morph targets. Each morph target is a Javascript object:
<code>{ name: "targetName", vertices: [ new THREE.Vector3(), ... ] }</code>
Morph vertices match number and order of primary vertices.
</div>
<h3>.[page:Array morphColors]</h3>
<div>
Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object:
<code>morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }</code>
Morph colors can match either number and order of faces (face colors) or number of vertices (vertex colors).
</div>
<h3>.[page:Array morphNormals]</h3>
<div>
Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:
<code>morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] }</code>
</div>
<h3>.[page:Array skinWeights]</h3>
<div>
Array of skinning weights, matching number and order of vertices.
</div>
<h3>.[page:Array skinIndices]</h3>
<div>
Array of skinning indices, matching number and order of vertices.
</div>
<h3>.[page:Object boundingBox]</h3>
<div>
Bounding box.
<code>{ min: new THREE.Vector3(), max: new THREE.Vector3() }</code>
</div>
<h3>.[page:Object boundingSphere]</h3>
<div>
Bounding sphere.
<code>{ radius: float }</code>
</div>
<h3>.[page:Boolean hasTangents]</h3>
<div>
True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents].
</div>
<h3>.[page:Boolean dynamic]</h3>
<div>
Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).<br/>
Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.<br/>
Defaults to true.
</div>
<h3>.[page:Boolean verticesNeedUpdate]</h3>
<div>
Set to *true* if the vertices array has been updated.
</div>
<h3>.[page:Boolean elementsNeedUpdate]</h3>
<div>
Set to *true* if the faces array has been updated.
</div>
<h3>.[page:Boolean uvsNeedUpdate]</h3>
<div>
Set to *true* if the uvs array has been updated.
</div>
<h3>.[page:Boolean normalsNeedUpdate]</h3>
<div>
Set to *true* if the normals array has been updated.
</div>
<h3>.[page:Boolean tangentsNeedUpdate]</h3>
<div>
Set to *true* if the tangents in the faces has been updated.
</div>
<h3>.[page:Boolean colorsNeedUpdate]</h3>
<div>
Set to *true* if the colors array has been updated.
</div>
<h3>.[page:Boolean lineDistancesNeedUpdate]</h3>
<div>
Set to *true* if the linedistances array has been updated.
</div>
<h3>.[page:Boolean buffersNeedUpdate]</h3>
<div>
Set to *true* if an array has changed in length.
</div>
<h3>.[page:array morphNormals]</h3>
<div>
todo
</div>
<h3>.[page:array lineDistances]</h3>
<div>
todo
</div>
<h2>Methods</h2>
<h3>.applyMatrix( [page:Matrix4 matrix] )</h3>
<div>
Bakes matrix transform directly into vertex coordinates.
</div>
<h3>.computeCentroids()</h3>
<div>
Computes centroids for all faces.
</div>
<h3>.computeFaceNormals()</h3>
<div>
Computes face normals.
</div>
<h3>.computeVertexNormals()</h3>
<div>
Computes vertex normals by averaging face normals.<br />
Face normals must be existing / computed beforehand.
</div>
<h3>.computeMorphNormals()</h3>
<div>
Computes morph normals.
</div>
<h3>.computeTangents()</h3>
<div>
Computes vertex tangents.<br />
Based on [link:http://www.terathon.com/code/tangent.html]<br />
Geometry must have vertex [page:UV UVs] (layer 0 will be used).
</div>
<h3>.computeBoundingBox()</h3>
<div>
Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
</div>
<h3>.computeBoundingSphere()</h3>
<div>
Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
</div>
<div>Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are *null*.</div>
<h3>.mergeVertices()</h3>
<div>
Checks for duplicate vertices using hashmap.<br />
Duplicated vertices are removed and faces' vertices are updated.
</div>
<h3>.clone()</h3>
<div>
Creates a new clone of the Geometry.
</div>
<h3>.dispose()</h3>
<div>
Removes The object from memory. <br />
Don't forget to call this method when you remove an geometry because it can cuase meomory leaks.
</div>
<h3>.dispatchEvent([page:todo event]) [page:todo]</h3>
<div>
event -- todo
</div>
<div>
todo
</div>
<h3>.hasEventListener([page:todo type], [page:todo listener]) [page:todo]</h3>
<div>
type -- todo <br />
listener -- todo
</div>
<div>
todo
</div>
<h3>.removeEventListener([page:todo type], [page:todo listener]) [page:todo]</h3>
<div>
type -- todo <br />
listener -- todo
</div>
<div>
todo
</div>
<h3>.computeLineDistances() [page:todo]</h3>
<div>
todo
</div>
<h3>.addEventListener([page:todo type], [page:todo listener]) [page:todo]</h3>
<div>
type -- todo <br />
listener -- todo
</div>
<div>
todo
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>