BufferAttribute.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">
  13. This class stores data for an attribute associated with a [page:BufferGeometry]. See that page for details and a usage example. This class is used to store builtin attributes such as vertex position, normals, color, etc., but can also be used in your code to store custom attributes in a [page:BufferGeometry].
  14. </div>
  15. <h2>Constructor</h2>
  16. <h3>[name]([page:Array array], [page:Integer itemSize])</h3>
  17. <div>
  18. Instantiates this attribute with data from the associated buffer. The array can either be a regular Array or a Typed Array.
  19. itemSize gives the number of values of the array that should be associated with a particular vertex.
  20. </div>
  21. <h2>Properties</h2>
  22. <h3>[property:Array array]</h3>
  23. <div>
  24. Stores the data associated with this attribute; can be an Array or a Typed Array. This element should have <code>itemSize * numVertices</code> elements, where numVertices is the number of vertices in the associated [page:BufferGeometry geometry].
  25. </div>
  26. <h3>[property:Integer itemSize]</h3>
  27. <div>
  28. Records how many items of the array are associated with a particular vertex. For instance, if this
  29. attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
  30. </div>
  31. <h3>[property:Integer length]</h3>
  32. <div>
  33. Gives the total number of elements in the array.
  34. </div>
  35. <h3>[property:Boolean needsUpdate]</h3>
  36. <div>
  37. Flag to indicate that this attribute has changed and should be re-send to the GPU. Set this to true when you modify the value of the array.
  38. </div>
  39. <h3>[property:Integer version]</h3>
  40. <div>
  41. A version number, incremented every time the needsUpdate property is set to true.
  42. </div>
  43. <h2>Methods</h2>
  44. <h3>[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] ) </h3>
  45. <div>
  46. Copies itemSize values in the array from the vertex at index2 to the vertex at index1.
  47. </div>
  48. <h3>[method:null set] ( [page:Array value] ) </h3>
  49. <div>
  50. Sets the associated array with values from the passed array.
  51. </div>
  52. <h3>[method:null setX]( index, x ) </h3>
  53. <div>
  54. Sets the value of the array at <code>index * itemSize</code> to x
  55. </div>
  56. <h3>[method:null setY]( index, y ) </h3>
  57. <div>
  58. Sets the value of the array at <code>index * itemSize + 1</code> to y
  59. </div>
  60. <h3>[method:null setZ]( index, z ) </h3>
  61. <div>
  62. Sets the value of the array at <code>index * itemSize + 2</code> to z
  63. </div>
  64. <h3>[method:null setXY]( index, x, y ) </h3>
  65. <div>
  66. Sets the value of the array at <code>index * itemSize</code> to x and
  67. sets the value of the array at <code>index * itemSize + 1</code> to y
  68. </div>
  69. <h3>[method:null setXYZ]( index, x, y, z ) </h3>
  70. <div>
  71. Sets the value of the array at <code>index * itemSize</code> to x,
  72. the value of the array at <code>index * itemSize + 1</code> to y, and
  73. the value of the array at <code>index * itemSize + 2</code> to z.
  74. </div>
  75. <h3>[method:null setXYZW]( index, x, y, z, w ) </h3>
  76. <div>
  77. Sets the value of the array at <code>index * itemSize</code> to x,
  78. the value of the array at <code>index * itemSize + 1</code> to y,
  79. the value of the array at <code>index * itemSize + 2</code> to z, and
  80. the value of the array at <code>index * itemSize + 3</code> to w.
  81. </div>
  82. <h3>[method:BufferAttribute clone]() </h3>
  83. <div>
  84. Copies this attribute.
  85. </div>
  86. <h2>Source</h2>
  87. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  88. </body>
  89. </html>