GLBufferAttribute.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <!DOCTYPE html>
  2. <html lang="it">
  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. Questa classe di attributi del buffer non costruisce un VBO. Invece,
  13. utilizza qualsiasi VBO che gli viene passato nel costruttore e può essere
  14. successivamente alterato tramite la proprietà `buffer`.<br /><br />
  15. È necessario passare parametri aggiuntivi insieme a VBO. I quali sono:
  16. il contesto GL, il tipo di dati GL, il numero di componenti per vertice,
  17. il numero di byte per componente, e il numero di vertici. <br /><br />
  18. Il caso d'uso più comune per questa classe è quando un qualche tipo di
  19. calcolo GPGPU interferisce o addirittura produce i VBO in questione.
  20. </p>
  21. <h2>Examples</h2>
  22. <p>
  23. [example:webgl_buffergeometry_glbufferattribute Points with custom buffers]<br />
  24. </p>
  25. <h2>Costruttore</h2>
  26. <h3>[name]( [param:WebGLBuffer buffer], [param:GLenum type], [param:Integer itemSize], [param:Integer elementSize], [param:Integer count], [param:Boolean normalized] )</h3>
  27. <p>
  28. `buffer` — Deve essere un [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer WebGLBuffer].
  29. <br />
  30. `type` — Uno dei [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types Tipi di dati WebGL].
  31. <br />
  32. `itemSize` — Il numero dei valori dell'array che devono essere associati con un particolare vertice. Ad esempio,
  33. se questo attributo memorizza un vettore a 3 componenti (come una posizione, una normale, un colore), allora itemSize dovrebbe essere 3.
  34. <br />
  35. `elementSize` — 1, 2 o 4. La dimensione corrispondente (in byte) per il parametro "type" passato.
  36. <ul>
  37. <li>gl.FLOAT: 4</li>
  38. <li>gl.UNSIGNED_SHORT: 2</li>
  39. <li>gl.SHORT: 2</li>
  40. <li>gl.UNSIGNED_INT: 4</li>
  41. <li>gl.INT: 4</li>
  42. <li>gl.BYTE: 1</li>
  43. <li>gl.UNSIGNED_BYTE: 1</li>
  44. </ul>
  45. `count` — Il numero previsto di vertici in VBO.
  46. <br />
  47. `normalized` — (optional) Applies to integer data only.
  48. Indicates how the underlying data in the buffer maps to the values in the
  49. GLSL code. For instance, if [page:WebGLBuffer buffer] contains data of
  50. `gl.UNSIGNED_SHORT`, and [page:Boolean normalized] is true, the values `0 -
  51. +65535` in the buffer data will be mapped to 0.0f - +1.0f in the GLSL
  52. attribute. A `gl.SHORT` (signed) would map from -32768 - +32767 to -1.0f
  53. - +1.0f. If [page:Boolean normalized] is false, the values will be
  54. converted to floats unmodified, i.e. 32767 becomes 32767.0f.
  55. </p>
  56. <h2>Proprietà</h2>
  57. <h3>[property:WebGLBuffer buffer]</h3>
  58. <p>
  59. L'istanza corrente di [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer WebGLBuffer].
  60. </p>
  61. <h3>[property:Integer count]</h3>
  62. <p>
  63. Il numero previsto di vertici in VBO.
  64. </p>
  65. <h3>[property:Integer elementSize]</h3>
  66. <p>
  67. Memorizza la dimensione corrispondente in byte per il valore della proprietà del `type` corrente.
  68. </p>
  69. <p>
  70. Vedi sopra (costruttore) per un elenco di dimensioni di type conosciute.
  71. </p>
  72. <h3>[property:Boolean isGLBufferAttribute]</h3>
  73. <p>
  74. Solo lettura. Sempre `true`.
  75. </p>
  76. <h3>[property:Integer itemSize]</h3>
  77. <p>
  78. Quanti valori compongono ogni elemento (vertice).
  79. </p>
  80. <h3>[property:String name]</h3>
  81. <p>
  82. Un nome opzionale per questa istanza dell'attributo. Il valore predefinito è una stringa vuota.
  83. </p>
  84. <h3>[property:Boolean needsUpdate]</h3>
  85. <p>
  86. Il valore predefinito è `false`. Impostando questo metodo a true incrementa la [page:GLBufferAttribute.version versione].
  87. </p>
  88. <h3>[property:Boolean normalized]</h3>
  89. <p>
  90. Indicates how the underlying data in the buffer maps to the values in the
  91. GLSL shader code. See the constructor above for details.
  92. </p>
  93. <h3>[property:GLenum type]</h3>
  94. <p>
  95. Un [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types WebGL Data Type]
  96. che descrive i contenuti VBO.
  97. </p>
  98. <p>
  99. Imposta questa proprietà insieme a `elementSize`. Il modo consigliato è
  100. di usare il metodo `setType`.
  101. </p>
  102. <h3>[property:Integer version]</h3>
  103. <p>
  104. Un numero di versione, incrementato ogni volta che la proprietà needsUpdate è impostata a true.
  105. </p>
  106. <h2>Metodi</h2>
  107. <h3>[method:this setBuffer]( buffer ) </h3>
  108. <p>Imposta la proprietà `buffer`.</p>
  109. <h3>[method:this setType]( type, elementSize ) </h3>
  110. <p>Imposta entrambe le proprietà `type` e `elementSize`.</p>
  111. <h3>[method:this setItemSize]( itemSize ) </h3>
  112. <p>Imposta la proprietà `itemSize`.</p>
  113. <h3>[method:this setCount]( count ) </h3>
  114. <p>Imposta la proprietà `count`.</p>
  115. <h2>Source</h2>
  116. <p>
  117. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  118. </p>
  119. </body>
  120. </html>
粤ICP备19079148号