BufferAttribute.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. <h2>Methods</h2>
  39. <h3>[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] ) </h3>
  40. <div>
  41. Copies itemSize values in the array from the vertex at index2 to the vertex at index1.
  42. </div>
  43. <h3>[method:null set] ( [page:Array value] ) </h3>
  44. <div>
  45. Sets the associated array with values from the passed array.
  46. </div>
  47. <h3>[method:null setX]( index, x ) </h3>
  48. <div>
  49. Sets the value of the array at <code>index * itemSize</code> to x
  50. </div>
  51. <h3>[method:null setY]( index, y ) </h3>
  52. <div>
  53. Sets the value of the array at <code>index * itemSize + 1</code> to y
  54. </div>
  55. <h3>[method:null setZ]( index, z ) </h3>
  56. <div>
  57. Sets the value of the array at <code>index * itemSize + 2</code> to z
  58. </div>
  59. <h3>[method:null setXY]( index, x, y ) </h3>
  60. <div>
  61. Sets the value of the array at <code>index * itemSize</code> to x and
  62. sets the value of the array at <code>index * itemSize + 1</code> to y
  63. </div>
  64. <h3>[method:null setXYZ]( index, x, y, z ) </h3>
  65. <div>
  66. Sets the value of the array at <code>index * itemSize</code> to x,
  67. the value of the array at <code>index * itemSize + 1</code> to y, and
  68. the value of the array at <code>index * itemSize + 2</code> to z.
  69. </div>
  70. <h3>[method:null setXYZW]( index, x, y, z, w ) </h3>
  71. <div>
  72. Sets the value of the array at <code>index * itemSize</code> to x,
  73. the value of the array at <code>index * itemSize + 1</code> to y,
  74. the value of the array at <code>index * itemSize + 2</code> to z, and
  75. the value of the array at <code>index * itemSize + 3</code> to w.
  76. </div>
  77. <h3>[method:BufferAttribute clone]() </h3>
  78. <div>
  79. Copies this attribute.
  80. </div>
  81. <h2>Source</h2>
  82. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  83. </body>
  84. </html>