GLBufferAttribute.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. 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:WebGLRenderingContext gl], [param:WebGLBuffer buffer], [param:GLenum type], [param:Integer itemSize], [param:Integer count], [param:Boolean normalized] )</h3>
  24. <p>
  25. gl — Must be a [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext].
  26. <br />
  27. buffer — Must be a [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer].
  28. <br />
  29. type — One of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types].
  30. <br />
  31. itemSize — The number of values of the array that should be associated with
  32. a particular vertex. For instance, if this
  33. attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
  34. <br />
  35. count — The expected number of vertices in VBO.
  36. <br /><br />
  37. normalized — (optional) Applies to integer data only. Indicates how the underlying data
  38. in the buffer maps to the values in the GLSL code. For instance, if [page:TypedArray array] is an instance
  39. of UInt16Array, and [page:Boolean normalized] is true, the values 0 - +65535 in the array
  40. data will be mapped to 0.0f - +1.0f in the GLSL attribute. An Int16Array (signed) would map
  41. from -32767 - +32767 to -1.0f - +1.0f. If [page:Boolean normalized] is false, the values
  42. will be converted to floats unmodified, i.e. 32767 becomes 32767.0f.
  43. </p>
  44. <h2>Properties</h2>
  45. <h3>[property:WebGLBuffer buffer]</h3>
  46. <p>
  47. The current <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer" target="_blank">WebGLBuffer</a> instance.
  48. </p>
  49. <h3>[property:Integer count]</h3>
  50. <p>
  51. The expected number of vertices in VBO.
  52. </p>
  53. <h3>[property:Boolean normalized]</h3>
  54. <p>
  55. Indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
  56. See the constructor above for details.
  57. </p>
  58. <h3>[property:Integer itemSize]</h3>
  59. <p>
  60. How many values make up each item (vertex).
  61. </p>
  62. <h3>[property:Integer elementSize]</h3>
  63. <p>
  64. Stores the corresponding size in bytes for the current *type* property value.
  65. </p>
  66. <p>
  67. <b>Don't touch</b>.
  68. </p>
  69. <h3>[property:GLenum type]</h3>
  70. <p>
  71. A <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Standard_WebGL_1_constants" target="_blank">WebGL Data Type</a> describing the underlying VBO contents.
  72. </p>
  73. <p>
  74. Setting this is only allowed with *setType*.
  75. </p>
  76. <h3>[property:Boolean isGLBufferAttribute]</h3>
  77. <p>
  78. Should be *true*.
  79. </p>
  80. <h2>Methods</h2>
  81. <h3>[method:null setBuffer]( buffer ) </h3>
  82. <p>Sets the *buffer* property.</p>
  83. <h3>[method:null setType]( type ) </h3>
  84. <p>Sets the *type* property.</p>
  85. <h3>[method:null setItemSize]( itemSize ) </h3>
  86. <p>Sets the *itemSize* property.</p>
  87. <h3>[method:null setCount]( count ) </h3>
  88. <p>Sets the *count* property.</p>
  89. <h2>Source</h2>
  90. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  91. </body>
  92. </html>