1 | <!DOCTYPE html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <meta charset="utf-8" />
|
---|
5 | <script src="../../list.js"></script>
|
---|
6 | <script src="../../page.js"></script>
|
---|
7 | <link type="text/css" rel="stylesheet" href="../../page.css" />
|
---|
8 | </head>
|
---|
9 | <body>
|
---|
10 | <h1>[name]</h1>
|
---|
11 |
|
---|
12 | <div class="desc">
|
---|
13 | Base class for geometries.<br />
|
---|
14 | A geometry holds all data necessary to describe a 3D model.
|
---|
15 | </div>
|
---|
16 |
|
---|
17 |
|
---|
18 | <h2>Example</h2>
|
---|
19 |
|
---|
20 | <code>var geometry = new THREE.Geometry();
|
---|
21 |
|
---|
22 | geometry.vertices.push( new THREE.Vector3( -10, 10, 0 ) );
|
---|
23 | geometry.vertices.push( new THREE.Vector3( -10, -10, 0 ) );
|
---|
24 | geometry.vertices.push( new THREE.Vector3( 10, -10, 0 ) );
|
---|
25 |
|
---|
26 | geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );
|
---|
27 |
|
---|
28 | geometry.computeBoundingSphere();
|
---|
29 | </code>
|
---|
30 |
|
---|
31 | <h2>Constructor</h2>
|
---|
32 |
|
---|
33 |
|
---|
34 | <h3>[name]()</h3>
|
---|
35 | <div>
|
---|
36 | The constructor takes no arguments.
|
---|
37 | </div>
|
---|
38 |
|
---|
39 |
|
---|
40 | <h2>Properties</h2>
|
---|
41 |
|
---|
42 | <h3>.[page:Integer id]</h3>
|
---|
43 | <div>
|
---|
44 | Unique number of this geometry instance
|
---|
45 | </div>
|
---|
46 |
|
---|
47 | <h3>.[page:String name]</h3>
|
---|
48 | <div>
|
---|
49 | Name for this geometry. Default is an empty string.
|
---|
50 | </div>
|
---|
51 |
|
---|
52 | <h3>.[page:Array vertices]</h3>
|
---|
53 | <div>
|
---|
54 | Array of [page:Vector3 vertices].<br />
|
---|
55 | The array of vertices holds every position of points in the model.<br />
|
---|
56 | To signal an update in this array, [page:Geometry Geometry.verticesNeedUpdate] needs to be set to true.
|
---|
57 | </div>
|
---|
58 |
|
---|
59 | <h3>.[page:Array colors]</h3>
|
---|
60 | <div>
|
---|
61 | Array of vertex [page:Color colors], matching number and order of vertices.<br />
|
---|
62 | Used in [page:ParticleSystem] and [page:Line].<br />
|
---|
63 | [page:Mesh Meshes] use per-face-use-of-vertex colors embedded directly in faces.<br />
|
---|
64 | To signal an update in this array, [page:Geometry Geometry.colorsNeedUpdate] needs to be set to true.
|
---|
65 | </div>
|
---|
66 |
|
---|
67 | <h3>.[page:Array faces]</h3>
|
---|
68 | <div>
|
---|
69 | Array of [page:Face3 triangles].<br />
|
---|
70 | The array of faces describe how each vertex in the model is connected with each other.<br />
|
---|
71 | To signal an update in this array, [page:Geometry Geometry.elementsNeedUpdate] needs to be set to true.
|
---|
72 | </div>
|
---|
73 |
|
---|
74 | <h3>.[page:Array faceVertexUvs]</h3>
|
---|
75 | <div>
|
---|
76 | Array of face [page:UV] layers.<br />
|
---|
77 | Each UV layer is an array of [page:UV]s matching the order and number of vertices in faces.<br />
|
---|
78 | To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.
|
---|
79 | </div>
|
---|
80 |
|
---|
81 | <h3>.[page:Array morphTargets]</h3>
|
---|
82 | <div>
|
---|
83 | Array of morph targets. Each morph target is a Javascript object:
|
---|
84 | <code>{ name: "targetName", vertices: [ new THREE.Vector3(), ... ] }</code>
|
---|
85 | Morph vertices match number and order of primary vertices.
|
---|
86 | </div>
|
---|
87 |
|
---|
88 | <h3>.[page:Array morphColors]</h3>
|
---|
89 | <div>
|
---|
90 | Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object:
|
---|
91 | <code>morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }</code>
|
---|
92 | Morph colors can match either the number and order of faces (face colors) or the number of vertices (vertex colors).
|
---|
93 | </div>
|
---|
94 |
|
---|
95 | <h3>.[page:Array morphNormals]</h3>
|
---|
96 | <div>
|
---|
97 | Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:
|
---|
98 | <code>morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] }</code>
|
---|
99 | </div>
|
---|
100 |
|
---|
101 | <h3>.[page:Array skinWeights]</h3>
|
---|
102 | <div>
|
---|
103 | Array of skinning weights, matching number and order of vertices.
|
---|
104 | </div>
|
---|
105 |
|
---|
106 | <h3>.[page:Array skinIndices]</h3>
|
---|
107 | <div>
|
---|
108 | Array of skinning indices, matching number and order of vertices.
|
---|
109 | </div>
|
---|
110 |
|
---|
111 | <h3>.[page:Object boundingBox]</h3>
|
---|
112 | <div>
|
---|
113 | Bounding box.
|
---|
114 | <code>{ min: new THREE.Vector3(), max: new THREE.Vector3() }</code>
|
---|
115 | </div>
|
---|
116 |
|
---|
117 | <h3>.[page:Object boundingSphere]</h3>
|
---|
118 | <div>
|
---|
119 | Bounding sphere.
|
---|
120 | <code>{ radius: float }</code>
|
---|
121 | </div>
|
---|
122 |
|
---|
123 | <h3>.[page:Boolean hasTangents]</h3>
|
---|
124 | <div>
|
---|
125 | True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents].
|
---|
126 | </div>
|
---|
127 |
|
---|
128 | <h3>.[page:Boolean dynamic]</h3>
|
---|
129 | <div>
|
---|
130 | Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).<br/>
|
---|
131 | Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.<br/>
|
---|
132 | Defaults to true.
|
---|
133 | </div>
|
---|
134 |
|
---|
135 | <h3>.[page:Boolean verticesNeedUpdate]</h3>
|
---|
136 | <div>
|
---|
137 | Set to *true* if the vertices array has been updated.
|
---|
138 | </div>
|
---|
139 |
|
---|
140 | <h3>.[page:Boolean elementsNeedUpdate]</h3>
|
---|
141 | <div>
|
---|
142 | Set to *true* if the faces array has been updated.
|
---|
143 | </div>
|
---|
144 |
|
---|
145 | <h3>.[page:Boolean uvsNeedUpdate]</h3>
|
---|
146 | <div>
|
---|
147 | Set to *true* if the uvs array has been updated.
|
---|
148 | </div>
|
---|
149 |
|
---|
150 | <h3>.[page:Boolean normalsNeedUpdate]</h3>
|
---|
151 | <div>
|
---|
152 | Set to *true* if the normals array has been updated.
|
---|
153 | </div>
|
---|
154 |
|
---|
155 | <h3>.[page:Boolean tangentsNeedUpdate]</h3>
|
---|
156 | <div>
|
---|
157 | Set to *true* if the tangents in the faces has been updated.
|
---|
158 | </div>
|
---|
159 |
|
---|
160 | <h3>.[page:Boolean colorsNeedUpdate]</h3>
|
---|
161 | <div>
|
---|
162 | Set to *true* if the colors array has been updated.
|
---|
163 | </div>
|
---|
164 |
|
---|
165 | <h3>.[page:Boolean lineDistancesNeedUpdate]</h3>
|
---|
166 | <div>
|
---|
167 | Set to *true* if the linedistances array has been updated.
|
---|
168 | </div>
|
---|
169 |
|
---|
170 | <h3>.[page:Boolean buffersNeedUpdate]</h3>
|
---|
171 | <div>
|
---|
172 | Set to *true* if an array has changed in length.
|
---|
173 | </div>
|
---|
174 |
|
---|
175 | <h3>.[page:array lineDistances]</h3>
|
---|
176 | <div>
|
---|
177 | An array containing distances between vertices for Line geometries.
|
---|
178 | This is required for LinePieces/LineDashedMaterial to render correctly.
|
---|
179 | Line distances can also be generated with computeLineDistances.
|
---|
180 | </div>
|
---|
181 |
|
---|
182 | <h2>Methods</h2>
|
---|
183 |
|
---|
184 | <h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
|
---|
185 |
|
---|
186 | <h3>.applyMatrix( [page:Matrix4 matrix] )</h3>
|
---|
187 | <div>
|
---|
188 | Bakes matrix transform directly into vertex coordinates.
|
---|
189 | </div>
|
---|
190 |
|
---|
191 | <h3>.computeCentroids()</h3>
|
---|
192 | <div>
|
---|
193 | Computes centroids for all faces.
|
---|
194 | </div>
|
---|
195 |
|
---|
196 | <h3>.computeFaceNormals()</h3>
|
---|
197 | <div>
|
---|
198 | Computes face normals.
|
---|
199 | </div>
|
---|
200 |
|
---|
201 | <h3>.computeVertexNormals()</h3>
|
---|
202 | <div>
|
---|
203 | Computes vertex normals by averaging face normals.<br />
|
---|
204 | Face normals must be existing / computed beforehand.
|
---|
205 | </div>
|
---|
206 |
|
---|
207 | <h3>.computeMorphNormals()</h3>
|
---|
208 | <div>
|
---|
209 | Computes morph normals.
|
---|
210 | </div>
|
---|
211 |
|
---|
212 | <h3>.computeTangents()</h3>
|
---|
213 | <div>
|
---|
214 | Computes vertex tangents.<br />
|
---|
215 | Based on [link:http://www.terathon.com/code/tangent.html]<br />
|
---|
216 | Geometry must have vertex [page:UV UVs] (layer 0 will be used).
|
---|
217 | </div>
|
---|
218 |
|
---|
219 | <h3>.computeBoundingBox()</h3>
|
---|
220 | <div>
|
---|
221 | Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
|
---|
222 | </div>
|
---|
223 |
|
---|
224 | <h3>.computeBoundingSphere()</h3>
|
---|
225 | <div>
|
---|
226 | Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
|
---|
227 | </div>
|
---|
228 |
|
---|
229 | <div>Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are *null*.</div>
|
---|
230 |
|
---|
231 | <h3>.mergeVertices()</h3>
|
---|
232 | <div>
|
---|
233 | Checks for duplicate vertices using hashmap.<br />
|
---|
234 | Duplicated vertices are removed and faces' vertices are updated.
|
---|
235 | </div>
|
---|
236 |
|
---|
237 | <h3>.clone()</h3>
|
---|
238 | <div>
|
---|
239 | Creates a new clone of the Geometry.
|
---|
240 | </div>
|
---|
241 |
|
---|
242 | <h3>.dispose()</h3>
|
---|
243 | <div>
|
---|
244 | Removes The object from memory. <br />
|
---|
245 | Don't forget to call this method when you remove a geometry because it can cause memory leaks.
|
---|
246 | </div>
|
---|
247 |
|
---|
248 | <h3>.computeLineDistances()</h3>
|
---|
249 | <div>
|
---|
250 | Compute distances between vertices for Line geometries.
|
---|
251 | </div>
|
---|
252 |
|
---|
253 |
|
---|
254 | <h2>Source</h2>
|
---|
255 |
|
---|
256 | [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
---|
257 | </body>
|
---|
258 | </html>
|
---|