GLBufferAttribute.html 3.7 KB

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