GLBufferAttribute.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. <p class="desc">
  13. This buffer attribute class does not construct a VBO. Instead, it uses
  14. whatever VBO is passed in constructor and can later be altered via the
  15. *buffer* property.<br /><br />
  16. It is required to pass additional params alongside the VBO. Those are:
  17. the GL context, the GL data type, the number of components per vertex,
  18. the number of bytes per component, and the number of vertices.<br /><br />
  19. The most common use case for this class is when some kind of GPGPU
  20. calculation interferes or even produces the VBOs in question.
  21. </p>
  22. <h2>Constructor</h2>
  23. <h3>[name]( [param:WebGLBuffer buffer], [param:GLenum type], [param:Integer itemSize], [param:Integer elementSize], [param:Integer count] )</h3>
  24. <p>
  25. *buffer* — Must be a <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer" target="_blank">WebGLBuffer</a>.
  26. <br />
  27. *type* — One of <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types" target="_blank">WebGL Data Types</a>.
  28. <br />
  29. *itemSize* — The number of values of the array that should be associated with
  30. a particular vertex. For instance, if this
  31. attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
  32. <br />
  33. *elementSize* — 1, 2 or 4. The corresponding size (in bytes) for the given "type" param.
  34. <ul>
  35. <li>gl.FLOAT: 4</li>
  36. <li>gl.UNSIGNED_SHORT: 2</li>
  37. <li>gl.SHORT: 2</li>
  38. <li>gl.UNSIGNED_INT: 4</li>
  39. <li>gl.INT: 4</li>
  40. <li>gl.BYTE: 1</li>
  41. <li>gl.UNSIGNED_BYTE: 1</li>
  42. </ul>
  43. *count* — The expected number of vertices in VBO.
  44. </p>
  45. <h2>Properties</h2>
  46. <h3>[property:WebGLBuffer buffer]</h3>
  47. <p>
  48. The current <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer" target="_blank">WebGLBuffer</a> instance.
  49. </p>
  50. <h3>[property:Integer count]</h3>
  51. <p>
  52. The expected number of vertices in VBO.
  53. </p>
  54. <h3>[property:Integer itemSize]</h3>
  55. <p>
  56. How many values make up each item (vertex).
  57. </p>
  58. <h3>[property:Integer elementSize]</h3>
  59. <p>
  60. Stores the corresponding size in bytes for the current *type* property value.
  61. </p>
  62. <p>
  63. See above (constructor) for a list of known type sizes.
  64. </p>
  65. <h3>[property:GLenum type]</h3>
  66. <p>
  67. A <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types" target="_blank">WebGL Data Type</a>
  68. describing the underlying VBO contents.
  69. </p>
  70. <p>
  71. Set this property together with *elementSize*. The recommended way is
  72. using the *setType* method.
  73. </p>
  74. <h3>[property:Boolean isGLBufferAttribute]</h3>
  75. <p>
  76. Read-only. Always *true*.
  77. </p>
  78. <h2>Methods</h2>
  79. <h3>[method:null setBuffer]( buffer ) </h3>
  80. <p>Sets the *buffer* property.</p>
  81. <h3>[method:null setType]( type, elementSize ) </h3>
  82. <p>Sets the both *type* and *elementSize* properties.</p>
  83. <h3>[method:null setItemSize]( itemSize ) </h3>
  84. <p>Sets the *itemSize* property.</p>
  85. <h3>[method:null setCount]( count ) </h3>
  86. <p>Sets the *count* property.</p>
  87. <h3>[property:Integer version]</h3>
  88. <p>
  89. A version number, incremented every time the needsUpdate property is set to true.
  90. </p>
  91. <h3>[property:Boolean needsUpdate]</h3>
  92. <p>
  93. Default is *false*. Setting this to true increments [page:GLBufferAttribute.version version].
  94. </p>
  95. <h2>Source</h2>
  96. <p>
  97. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  98. </p>
  99. </body>
  100. </html>