BufferGeometryUtils.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  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. <p class="desc">
  12. A class containing utility functions for [page:BufferGeometry BufferGeometry] instances.
  13. </p>
  14. <h2>Methods</h2>
  15. <h3>[method:BufferGeometry mergeBufferGeometries]( [param:Array geometries], [param:Boolean useGroups] )</h3>
  16. <p>
  17. geometries -- Array of [page:BufferGeometry BufferGeometry] instances.<br />
  18. useGroups -- Whether groups should be generated for the merged geometry or not.<br /><br />
  19. Merges a set of geometries into a single instance. All geometries must have compatible attributes.
  20. If merge does not succeed, the method returns null.
  21. </p>
  22. <h3>[method:BufferAttribute mergeBufferAttributes]( [param:Array attributes] )</h3>
  23. <p>
  24. attributes -- Array of [page:BufferAttribute BufferAttribute] instances.<br /><br />
  25. Merges a set of attributes into a single instance. All attributes must have compatible properties
  26. and types, and [page:InterleavedBufferAttribute InterleavedBufferAttributes] are not supported. If merge does not succeed, the method
  27. returns null.
  28. </p>
  29. <h3>[method:InterleavedBufferAttribute interleaveAttributes]( [param:Array attributes] )</h3>
  30. <p>
  31. attributes -- Array of [page:BufferAttribute BufferAttribute] instances.<br /><br />
  32. Interleaves a set of attributes and returns a new array of corresponding attributes that share
  33. a single InterleavedBuffer instance. All attributes must have compatible types. If merge does not
  34. succeed, the method returns null.
  35. </p>
  36. <h3>[method:Number estimateBytesUsed]( [param:BufferGeometry geometry] )</h3>
  37. <p>
  38. geometry -- Instance of [page:BufferGeometry BufferGeometry] to estimate the memory use of.<br /><br />
  39. Returns the amount of bytes used by all attributes to represent the geometry.
  40. </p>
  41. <h3>[method:BufferGeometry mergeGroups]( [param:BufferGeometry geometry] )</h3>
  42. <p>
  43. geometry -- Instance of [page:BufferGeometry BufferGeometry] to merge the groups of.<br /><br />
  44. Merges the [page:BufferGeometry.groups groups] for the given geometry.
  45. </p>
  46. <h3>[method:BufferGeometry mergeVertices]( [param:BufferGeometry geometry], [param:Number tolerance] )</h3>
  47. <p>
  48. geometry -- Instance of [page:BufferGeometry BufferGeometry] to merge the vertices of.<br />
  49. tolerance -- The maximum allowable difference between vertex attributes to merge. Defaults to 1e-4.<br /><br />
  50. Returns a new [page:BufferGeometry BufferGeometry] with vertices for which all similar vertex attributes
  51. (within tolerance) are merged.
  52. </p>
  53. <h3>[method:BufferGeometry toTrianglesDrawMode]( [param:BufferGeometry geometry], [param:TrianglesDrawMode drawMode] )</h3>
  54. <p>
  55. geometry -- Instance of [page:BufferGeometry BufferGeometry].<br />
  56. drawMode -- The draw mode of the given geometry.<br /><br />
  57. Returns a new indexed [page:BufferGeometry BufferGeometry] based on the [page:DrawModes THREE.TrianglesDrawMode] draw mode. This mode
  58. corresponds to the *gl.TRIANGLES* WebGL primitive.
  59. </p>
  60. <h3>[method:Object computeMorphedAttributes]( [param:Mesh | Line | Points object] )</h3>
  61. <p>
  62. object -- Instance of [page:Mesh Mesh] | [page:Line Line] | [page:Points Points].<br /><br />
  63. Returns the current attributes (Position and Normal) of a morphed/skinned [page:Object3D Object3D] whose geometry is a
  64. [page:BufferGeometry BufferGeometry], together with the original ones: An Object with 4 properties:
  65. `positionAttribute`, `normalAttribute`, `morphedPositionAttribute` and `morphedNormalAttribute`.
  66. Helpful for Raytracing or Decals (i.e. a [page:DecalGeometry DecalGeometry] applied to a morphed Object
  67. with a [page:BufferGeometry BufferGeometry] will use the original BufferGeometry, not the morphed/skinned one,
  68. generating an incorrect result.
  69. Using this function to create a shadow Object3D the DecalGeometry can be correctly generated).
  70. </p>
  71. <h2>Source</h2>
  72. <p>
  73. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/BufferGeometryUtils.js examples/jsm/utils/BufferGeometryUtils.js]
  74. </p>
  75. </body>
  76. </html>