BufferAttribute.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. 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].
  13. </div>
  14. <h2>Constructor</h2>
  15. <h3>[name]([page:Array array], [page:Integer itemSize])</h3>
  16. <div>
  17. Instantiates this attibute with data from the associated buffer. The array can either be a regular Array or a Typed Array.
  18. itemSize gives the number of values of the array that should be associated with a particular vertex.
  19. </div>
  20. <h2>Properties</h2>
  21. <h3>[property:Array array]</h3>
  22. <div>
  23. 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].
  24. </div>
  25. <h3>[property:Integer itemSize]</h3>
  26. <div>
  27. Records how many items of the array are associated with a particular vertex. For instance, if this
  28. attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
  29. </div>
  30. <h3>[property:Integer length]</h3>
  31. <div>
  32. Gives the total number of elements in the array.
  33. </div>
  34. <h3>[property:Boolean needsUpdate]</h3>
  35. <div>
  36. 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.
  37. </div>
  38. <h3>[property:Integer version]</h3>
  39. <div>
  40. A version number, incremented every time the needsUpdate property is set to true.
  41. </div>
  42. <h2>Methods</h2>
  43. <h3>[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] ) </h3>
  44. <div>
  45. Copies itemSize values in the array from the vertex at index2 to the vertex at index1.
  46. </div>
  47. <h3>[method:null set] ( [page:Array value] ) </h3>
  48. <div>
  49. Sets the associated array with values from the passed array.
  50. </div>
  51. <h3>[method:null setX]( index, x ) </h3>
  52. <div>
  53. Sets the value of the array at <code>index * itemSize</code> to x
  54. </div>
  55. <h3>[method:null setY]( index, y ) </h3>
  56. <div>
  57. Sets the value of the array at <code>index * itemSize + 1</code> to y
  58. </div>
  59. <h3>[method:null setZ]( index, z ) </h3>
  60. <div>
  61. Sets the value of the array at <code>index * itemSize + 2</code> to z
  62. </div>
  63. <h3>[method:null setXY]( index, x, y ) </h3>
  64. <div>
  65. Sets the value of the array at <code>index * itemSize</code> to x and
  66. sets the value of the array at <code>index * itemSize + 1</code> to y
  67. </div>
  68. <h3>[method:null setXYZ]( index, x, y, z ) </h3>
  69. <div>
  70. Sets the value of the array at <code>index * itemSize</code> to x,
  71. the value of the array at <code>index * itemSize + 1</code> to y, and
  72. the value of the array at <code>index * itemSize + 2</code> to z.
  73. </div>
  74. <h3>[method:null setXYZW]( index, x, y, z, w ) </h3>
  75. <div>
  76. Sets the value of the array at <code>index * itemSize</code> to x,
  77. the value of the array at <code>index * itemSize + 1</code> to y,
  78. the value of the array at <code>index * itemSize + 2</code> to z, and
  79. the value of the array at <code>index * itemSize + 3</code> to w.
  80. </div>
  81. <h3>[method:BufferAttribute clone]() </h3>
  82. <div>
  83. Copies this attribute.
  84. </div>
  85. <h2>Source</h2>
  86. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  87. </body>
  88. </html>