|
@@ -2,9 +2,10 @@
|
|
|
<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" />
|
|
|
+ <base href="../../" />
|
|
|
+ <script src="list.js"></script>
|
|
|
+ <script src="page.js"></script>
|
|
|
+ <link type="text/css" rel="stylesheet" href="page.css" />
|
|
|
</head>
|
|
|
<body>
|
|
|
<h1>[name]</h1>
|
|
@@ -17,11 +18,13 @@
|
|
|
|
|
|
<h2>Example</h2>
|
|
|
|
|
|
- <code>var geometry = new THREE.Geometry()
|
|
|
+ <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.vertices.push(
|
|
|
+ new THREE.Vector3( -10, 10, 0 ),
|
|
|
+ new THREE.Vector3( -10, -10, 0 ),
|
|
|
+ new THREE.Vector3( 10, -10, 0 )
|
|
|
+ );
|
|
|
|
|
|
geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );
|
|
|
|
|
@@ -33,274 +36,261 @@
|
|
|
|
|
|
<h3>[name]()</h3>
|
|
|
<div>
|
|
|
- todo
|
|
|
+ The constructor takes no arguments.
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<h2>Properties</h2>
|
|
|
|
|
|
- <h3>.[page:Integer id]</h3>
|
|
|
+ <h3>[property:Integer id]</h3>
|
|
|
<div>
|
|
|
- Unique number of this geometry instance
|
|
|
+ Unique number for this geometry instance.
|
|
|
</div>
|
|
|
-
|
|
|
- <h3>.[page:String name]</h3>
|
|
|
+
|
|
|
+ <h3>[property:String name]</h3>
|
|
|
<div>
|
|
|
Name for this geometry. Default is an empty string.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.[page:Array vertices]</h3>
|
|
|
+ <h3>[property:Array vertices]</h3>
|
|
|
<div>
|
|
|
Array of [page:Vector3 vertices].<br />
|
|
|
- The array of vertices hold every position of points of the model.<br />
|
|
|
+ The array of vertices holds every position of points in 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>
|
|
|
+ <h3>[property:Array colors]</h3>
|
|
|
<div>
|
|
|
Array of vertex [page:Color colors], matching number and order of vertices.<br />
|
|
|
- Used in [page:ParticleSystem], [page:Line] and [page:Ribbon].<br />
|
|
|
+ Used in [page:Points] 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 normals]</h3>
|
|
|
+ <h3>[property:Array faces]</h3>
|
|
|
<div>
|
|
|
- Array of vertex [page:Vector3 normals], matching number and order of vertices.<br />
|
|
|
- [link:http://en.wikipedia.org/wiki/Normal_(geometry) Normal vectors] are nessecary for lighting <br />
|
|
|
- To signal an update in this array, [page:Geometry Geometry.normalsNeedUpdate] needs to be set to true.
|
|
|
- </div>
|
|
|
-
|
|
|
- <h3>.[page:Array faces]</h3>
|
|
|
- <div>
|
|
|
- Array of [page:Face3 triangles] or/and [page:Face4 quads].<br />
|
|
|
+ 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 faceUvs]</h3>
|
|
|
- <div>
|
|
|
- Array of face [page:UV] layers.<br />
|
|
|
- Each UV layer is an array of [page:UV] matching order and number of faces.<br />
|
|
|
- To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.
|
|
|
- </div>
|
|
|
-
|
|
|
- <h3>.[page:Array faceVertexUvs]</h3>
|
|
|
+ <h3>[property: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 />
|
|
|
+ Each UV layer is an array of [page:UV]s matching the 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>
|
|
|
+ <h3>[property: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>
|
|
|
+ <h3>[property: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>
|
|
|
+ <h3>[property:Array skinWeights]</h3>
|
|
|
<div>
|
|
|
- Array of skinning weights, matching number and order of vertices.
|
|
|
+ Array of [page:Vector4 Vector4s] representing the skinning weights as used in a [page:SkinnedMesh],
|
|
|
+ The weights match the number and order of vertices in the geometry. The weighted values
|
|
|
+ are typically between the values of 0 and 1 and affect the amount that the individuals bones affect
|
|
|
+ a given vertex.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.[page:Array skinIndices]</h3>
|
|
|
+ <h3>[property:Array skinIndices]</h3>
|
|
|
<div>
|
|
|
- Array of skinning indices, matching number and order of vertices.
|
|
|
+ Array of [page:Vector4 Vector4s] representing the indices of individual bones in the [page:Skeleton.bones] array,
|
|
|
+ The indices match the number and order of vertices in the geometry.
|
|
|
+ <code>
|
|
|
+ // e.g.
|
|
|
+ geometry.skinIndices[15] = new THREE.Vector4( 0, 5, 9, 0 );
|
|
|
+ geometry.skinWeights[15] = new THREE.Vector4( 0.2, 0.5, 0.3, 0 );
|
|
|
+
|
|
|
+ // corresponds with the following vertex
|
|
|
+ geometry.vertices[15];
|
|
|
+
|
|
|
+ // these bones will be used like so:
|
|
|
+ skeleton.bones[0]; // weight of 0.2
|
|
|
+ skeleton.bones[5]; // weight of 0.5
|
|
|
+ skeleton.bones[9]; // weight of 0.3
|
|
|
+ skeleton.bones[0]; // weight of 0
|
|
|
+ </code>
|
|
|
</div>
|
|
|
|
|
|
- <h3>.[page:Object boundingBox]</h3>
|
|
|
+ <h3>[property:Object boundingBox]</h3>
|
|
|
<div>
|
|
|
Bounding box.
|
|
|
<code>{ min: new THREE.Vector3(), max: new THREE.Vector3() }</code>
|
|
|
</div>
|
|
|
|
|
|
- <h3>.[page:Object boundingSphere]</h3>
|
|
|
+ <h3>[property: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>
|
|
|
+ <h3>[property: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>
|
|
|
+
|
|
|
+ <h3>[property:Boolean verticesNeedUpdate]</h3>
|
|
|
<div>
|
|
|
Set to *true* if the vertices array has been updated.
|
|
|
</div>
|
|
|
-
|
|
|
- <h3>.[page:Boolean elementsNeedUpdate]</h3>
|
|
|
+
|
|
|
+ <h3>[property:Boolean elementsNeedUpdate]</h3>
|
|
|
<div>
|
|
|
Set to *true* if the faces array has been updated.
|
|
|
</div>
|
|
|
-
|
|
|
- <h3>.[page:Boolean uvsNeedUpdate]</h3>
|
|
|
+
|
|
|
+ <h3>[property:Boolean uvsNeedUpdate]</h3>
|
|
|
<div>
|
|
|
Set to *true* if the uvs array has been updated.
|
|
|
</div>
|
|
|
-
|
|
|
- <h3>.[page:Boolean normalsNeedUpdate]</h3>
|
|
|
+
|
|
|
+ <h3>[property: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>
|
|
|
+
|
|
|
+ <h3>[property:Boolean colorsNeedUpdate]</h3>
|
|
|
<div>
|
|
|
Set to *true* if the colors array has been updated.
|
|
|
</div>
|
|
|
-
|
|
|
- <h3>.[page:Boolean lineDistancesNeedUpdate]</h3>
|
|
|
+
|
|
|
+ <h3>[property: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>
|
|
|
+ <h3>[property:array lineDistances]</h3>
|
|
|
<div>
|
|
|
- todo
|
|
|
- </div>
|
|
|
+ An array containing distances between vertices for Line geometries.
|
|
|
+ This is required for LinePieces/LineDashedMaterial to render correctly.
|
|
|
+ Line distances can also be generated with computeLineDistances.
|
|
|
+ </div>
|
|
|
|
|
|
<h2>Methods</h2>
|
|
|
|
|
|
- <h3>.applyMatrix( [page:Matrix4 matrix] )</h3>
|
|
|
- <div>
|
|
|
- Bakes matrix transform directly into vertex coordinates.
|
|
|
- </div>
|
|
|
+ <h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
|
|
|
|
|
|
- <h3>.computeCentroids()</h3>
|
|
|
+ <h3>[method:null applyMatrix]( [page:Matrix4 matrix] )</h3>
|
|
|
<div>
|
|
|
- Computes centroids for all faces.
|
|
|
+ Bakes matrix transform directly into vertex coordinates.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.computeFaceNormals()</h3>
|
|
|
+ <h3>[method:null center] ()</h3>
|
|
|
<div>
|
|
|
- Computes face normals.
|
|
|
+ Center the geometry based on the bounding box.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.computeVertexNormals()</h3>
|
|
|
+ <h3>[method:Geometry rotateX] ( [page:Float radians] )</h3>
|
|
|
<div>
|
|
|
- Computes vertex normals by averaging face normals.<br />
|
|
|
- Face normals must be existing / computed beforehand.
|
|
|
+ Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop
|
|
|
+ Use [page:Object3D.rotation] for typical real-time mesh rotation.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.computeMorphNormals()</h3>
|
|
|
+ <h3>[method:Geometry rotateY] ( [page:Float radians] )</h3>
|
|
|
<div>
|
|
|
- Computes morph normals.
|
|
|
+ Rotate the geometry about the Y axis. This is typically done as a one time operation, and not during a loop
|
|
|
+ Use [page:Object3D.rotation] for typical real-time mesh rotation.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.computeTangents()</h3>
|
|
|
+ <h3>[method:Geometry rotateZ] ( [page:Float radians] )</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).
|
|
|
+ Rotate the geometry about the Z axis. This is typically done as a one time operation, and not during a loop
|
|
|
+ Use [page:Object3D.rotation] for typical real-time mesh rotation.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.computeBoundingBox()</h3>
|
|
|
+ <h3>[method:Geometry translate] ( [page:Float x], [page:Float y], [page:Float z] )</h3>
|
|
|
<div>
|
|
|
- Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
|
|
|
+ Translate the geometry. This is typically done as a one time operation, and not during a loop
|
|
|
+ Use [page:Object3D.position] for typical real-time mesh translation.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.computeBoundingSphere()</h3>
|
|
|
+ <h3>[method:Geometry scale] ( [page:Float x], [page:Float y], [page:Float z] )</h3>
|
|
|
<div>
|
|
|
- Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
|
|
|
+ Scale the geometry data. This is typically done as a one time operation, and not during a loop
|
|
|
+ Use [page:Object3D.scale] for typical real-time mesh scaling.
|
|
|
</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>
|
|
|
+ <h3>[method:Geometry lookAt] ( [page:Vector3 vector] )</h3>
|
|
|
<div>
|
|
|
- Checks for duplicate vertices using hashmap.<br />
|
|
|
- Duplicated vertices are removed and faces' vertices are updated.
|
|
|
+ vector - A world vector to look at.<br />
|
|
|
</div>
|
|
|
-
|
|
|
- <h3>.clone()</h3>
|
|
|
<div>
|
|
|
- Creates a new clone of the Geometry.
|
|
|
+ Rotates the geometry to face point in space. This is typically done as a one time operation, and not during a loop
|
|
|
+ Use [page:Object3D.lookAt] for typical real-time mesh usage.
|
|
|
</div>
|
|
|
-
|
|
|
- <h3>.dispose()</h3>
|
|
|
+
|
|
|
+ <h3>[method:null computeFaceNormals]()</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.
|
|
|
+ Computes face normals.
|
|
|
</div>
|
|
|
|
|
|
-
|
|
|
- <h3>.dispatchEvent([page:todo event]) [page:todo]</h3>
|
|
|
+ <h3>[method:null computeVertexNormals]()</h3>
|
|
|
<div>
|
|
|
- event -- todo
|
|
|
+ Computes vertex normals by averaging face normals.<br />
|
|
|
+ Face normals must be existing / computed beforehand.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:null computeMorphNormals]()</h3>
|
|
|
<div>
|
|
|
- todo
|
|
|
+ Computes morph normals.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.hasEventListener([page:todo type], [page:todo listener]) [page:todo]</h3>
|
|
|
+ <h3>[method:null computeBoundingBox]()</h3>
|
|
|
<div>
|
|
|
- type -- todo <br />
|
|
|
- listener -- todo
|
|
|
+ Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:null computeBoundingSphere]()</h3>
|
|
|
<div>
|
|
|
- todo
|
|
|
+ Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.removeEventListener([page:todo type], [page:todo listener]) [page:todo]</h3>
|
|
|
+ <div>Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are *null*.</div>
|
|
|
+
|
|
|
+ <h3>[method:null merge]( [page:Geometry geometry], [page:Matrix4 matrix], [page:Integer materialIndexOffset] )</h3>
|
|
|
+ <div>Merge two geometries or geometry and geometry from object (using object's transform)</div>
|
|
|
+
|
|
|
+ <h3>[method:null mergeVertices]()</h3>
|
|
|
<div>
|
|
|
- type -- todo <br />
|
|
|
- listener -- todo
|
|
|
+ Checks for duplicate vertices using hashmap.<br />
|
|
|
+ Duplicated vertices are removed and faces' vertices are updated.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:null normalize]()</h3>
|
|
|
<div>
|
|
|
- todo
|
|
|
+ Normalize the geometry. <br />
|
|
|
+ Make the geometry centered and has a bounding sphere whose raidus equals to 1.0.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.computeLineDistances() [page:todo]</h3>
|
|
|
+ <h3>[method:Geometry clone]()</h3>
|
|
|
<div>
|
|
|
- todo
|
|
|
+ Creates a new clone of the Geometry.
|
|
|
</div>
|
|
|
|
|
|
- <h3>.addEventListener([page:todo type], [page:todo listener]) [page:todo]</h3>
|
|
|
+ <h3>[method:null dispose]()</h3>
|
|
|
<div>
|
|
|
- type -- todo <br />
|
|
|
- listener -- todo
|
|
|
+ Removes The object from memory. <br />
|
|
|
+ Don't forget to call this method when you remove a geometry because it can cause memory leaks.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:null computeLineDistances]()</h3>
|
|
|
<div>
|
|
|
- todo
|
|
|
+ Compute distances between vertices for Line geometries.
|
|
|
</div>
|
|
|
|
|
|
+
|
|
|
<h2>Source</h2>
|
|
|
|
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|