InstanceNode.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>InstanceNode - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → </p>
  13. <h1 translate="no">InstanceNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This node implements the vertex shader logic which is required
  17. when rendering 3D objects via instancing. The code makes sure
  18. vertex positions, normals and colors can be modified via instanced
  19. data.</p></div>
  20. </header>
  21. <article>
  22. <div class="container-overview">
  23. <h2>Constructor</h2>
  24. <h3 class="name name-method" id="InstanceNode" translate="no">new <a href="#InstanceNode">InstanceNode</a><span class="signature">( count : <span class="param-type">number</span>, instanceMatrix : <span class="param-type"><a href="InstancedBufferAttribute.html">InstancedBufferAttribute</a> | <a href="StorageInstancedBufferAttribute.html">StorageInstancedBufferAttribute</a></span>, instanceColor : <span class="param-type"><a href="InstancedBufferAttribute.html">InstancedBufferAttribute</a> | <a href="StorageInstancedBufferAttribute.html">StorageInstancedBufferAttribute</a></span> )</span> </h3>
  25. <div class="method">
  26. <div class="description">
  27. <p>Constructs a new instance node.</p>
  28. </div>
  29. <table class="params">
  30. <tbody>
  31. <tr>
  32. <td class="name">
  33. <strong>count</strong>
  34. </td>
  35. <td class="description last">
  36. <p>The number of instances.</p>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="name">
  41. <strong>instanceMatrix</strong>
  42. </td>
  43. <td class="description last">
  44. <p>Instanced buffer attribute representing the instance transformations.</p>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td class="name">
  49. <strong>instanceColor</strong>
  50. </td>
  51. <td class="description last">
  52. <p>Instanced buffer attribute representing the instance colors.</p>
  53. <p>Default is <code>null</code>.</p>
  54. </td>
  55. </tr>
  56. </tbody>
  57. </table>
  58. </div>
  59. </div>
  60. <h2 class="subsection-title">Properties</h2>
  61. <div class="member">
  62. <h3 class="name" id="buffer" translate="no">.<a href="#buffer">buffer</a><span class="type-signature"> : <a href="InstancedInterleavedBuffer.html">InstancedInterleavedBuffer</a></span> </h3>
  63. <div class="description">
  64. <p>A reference to a buffer that is used by <code>instanceMatrixNode</code>.</p>
  65. </div>
  66. </div>
  67. <div class="member">
  68. <h3 class="name" id="bufferColor" translate="no">.<a href="#bufferColor">bufferColor</a><span class="type-signature"> : <a href="InstancedBufferAttribute.html">InstancedBufferAttribute</a></span> </h3>
  69. <div class="description">
  70. <p>A reference to a buffer that is used by <code>instanceColorNode</code>.</p>
  71. </div>
  72. </div>
  73. <div class="member">
  74. <h3 class="name" id="count" translate="no">.<a href="#count">count</a><span class="type-signature"> : number</span> </h3>
  75. <div class="description">
  76. <p>The number of instances.</p>
  77. </div>
  78. </div>
  79. <div class="member">
  80. <h3 class="name" id="instanceColor" translate="no">.<a href="#instanceColor">instanceColor</a><span class="type-signature"> : <a href="InstancedBufferAttribute.html">InstancedBufferAttribute</a></span> </h3>
  81. <div class="description">
  82. <p>Instanced buffer attribute representing the color of instances.</p>
  83. </div>
  84. </div>
  85. <div class="member">
  86. <h3 class="name" id="instanceColorNode" translate="no">.<a href="#instanceColorNode">instanceColorNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  87. <div class="description">
  88. <p>The node that represents the instance color data.</p>
  89. <p>Default is <code>null</code>.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="instanceMatrix" translate="no">.<a href="#instanceMatrix">instanceMatrix</a><span class="type-signature"> : <a href="InstancedBufferAttribute.html">InstancedBufferAttribute</a></span> </h3>
  94. <div class="description">
  95. <p>Instanced buffer attribute representing the transformation of instances.</p>
  96. </div>
  97. </div>
  98. <div class="member">
  99. <h3 class="name" id="instanceMatrixNode" translate="no">.<a href="#instanceMatrixNode">instanceMatrixNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  100. <div class="description">
  101. <p>The node that represents the instance matrix data.</p>
  102. </div>
  103. </div>
  104. <div class="member">
  105. <h3 class="name" id="isStorageColor" translate="no">.<a href="#isStorageColor">isStorageColor</a><span class="type-signature"> : boolean</span> </h3>
  106. <div class="description">
  107. <p>Tracks whether the color data is provided via a storage buffer.</p>
  108. </div>
  109. </div>
  110. <div class="member">
  111. <h3 class="name" id="isStorageMatrix" translate="no">.<a href="#isStorageMatrix">isStorageMatrix</a><span class="type-signature"> : boolean</span> </h3>
  112. <div class="description">
  113. <p>Tracks whether the matrix data is provided via a storage buffer.</p>
  114. </div>
  115. </div>
  116. <div class="member">
  117. <h3 class="name" id="previousInstanceMatrixNode" translate="no">.<a href="#previousInstanceMatrixNode">previousInstanceMatrixNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  118. <div class="description">
  119. <p>The previous instance matrices. Required for computing motion vectors.</p>
  120. <p>Default is <code>null</code>.</p>
  121. </div>
  122. </div>
  123. <div class="member">
  124. <h3 class="name" id="updateType" translate="no">.<a href="#updateType">updateType</a><span class="type-signature"> : string</span> </h3>
  125. <div class="description">
  126. <p>The update type is set to <code>frame</code> since an update
  127. of instanced buffer data must be checked per frame.</p>
  128. <p>Default is <code>'frame'</code>.</p>
  129. </div>
  130. <dl class="details">
  131. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#updateType">Node#updateType</a></dt>
  132. </dl>
  133. </div>
  134. <h2 class="subsection-title">Methods</h2>
  135. <h3 class="name name-method" id="getPreviousInstancedPosition" translate="no">.<a href="#getPreviousInstancedPosition">getPreviousInstancedPosition</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  136. <div class="method">
  137. <div class="description">
  138. <p>Computes the transformed/instanced vertex position of the previous frame.</p>
  139. </div>
  140. <table class="params">
  141. <tbody>
  142. <tr>
  143. <td class="name">
  144. <strong>builder</strong>
  145. </td>
  146. <td class="description last">
  147. <p>The current node builder.</p>
  148. </td>
  149. </tr>
  150. </tbody>
  151. </table>
  152. <dl class="details">
  153. <dt class="tag-returns"><strong>Returns:</strong> The instanced position from the previous frame.</dt>
  154. </dl>
  155. </div>
  156. <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span> </h3>
  157. <div class="method">
  158. <div class="description">
  159. <p>Setups the internal buffers and nodes and assigns the transformed vertex data
  160. to predefined node variables for accumulation. That follows the same patterns
  161. like with morph and skinning nodes.</p>
  162. </div>
  163. <table class="params">
  164. <tbody>
  165. <tr>
  166. <td class="name">
  167. <strong>builder</strong>
  168. </td>
  169. <td class="description last">
  170. <p>The current node builder.</p>
  171. </td>
  172. </tr>
  173. </tbody>
  174. </table>
  175. <dl class="details">
  176. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#setup">Node#setup</a></dt>
  177. </dl>
  178. </div>
  179. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( frame : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a></span> )</span> </h3>
  180. <div class="method">
  181. <div class="description">
  182. <p>Checks if the internal buffers require an update.</p>
  183. </div>
  184. <table class="params">
  185. <tbody>
  186. <tr>
  187. <td class="name">
  188. <strong>frame</strong>
  189. </td>
  190. <td class="description last">
  191. <p>The current node frame.</p>
  192. </td>
  193. </tr>
  194. </tbody>
  195. </table>
  196. <dl class="details">
  197. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#update">Node#update</a></dt>
  198. </dl>
  199. </div>
  200. <h2 class="subsection-title">Source</h2>
  201. <p>
  202. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/InstanceNode.js" translate="no" target="_blank" rel="noopener">src/nodes/accessors/InstanceNode.js</a>
  203. </p>
  204. </article>
  205. </section>
  206. <script src="../scripts/linenumber.js"></script>
  207. <script src="../scripts/page.js"></script>
  208. </body>
  209. </html>
粤ICP备19079148号