Geometry.html 8.1 KB

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