RangeNode.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>RangeNode - 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">RangeNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p><code>RangeNode</code> generates random instanced attribute data in a defined range.
  17. An exemplary use case for this utility node is to generate random per-instance
  18. colors:</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">const material = new MeshBasicNodeMaterial();
  21. material.colorNode = range( new Color( 0x000000 ), new Color( 0xFFFFFF ) );
  22. const mesh = new InstancedMesh( geometry, material, count );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="RangeNode" translate="no">new <a href="#RangeNode">RangeNode</a><span class="signature">( minNode : <span class="param-type"><a href="Node.html">Node</a>.&lt;<a href="global.html#any">any</a>></span>, maxNode : <span class="param-type"><a href="Node.html">Node</a>.&lt;<a href="global.html#any">any</a>></span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new range node.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>minNode</strong>
  38. </td>
  39. <td class="description last">
  40. <p>A node defining the lower bound of the range.</p>
  41. <p>Default is <code>float()</code>.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>maxNode</strong>
  47. </td>
  48. <td class="description last">
  49. <p>A node defining the upper bound of the range.</p>
  50. <p>Default is <code>float()</code>.</p>
  51. </td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. <h2 class="subsection-title">Properties</h2>
  58. <div class="member">
  59. <h3 class="name" id="maxNode" translate="no">.<a href="#maxNode">maxNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;<a href="global.html#any">any</a>></span> </h3>
  60. <div class="description">
  61. <p>A node defining the upper bound of the range.</p>
  62. <p>Default is <code>float()</code>.</p>
  63. </div>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="minNode" translate="no">.<a href="#minNode">minNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;<a href="global.html#any">any</a>></span> </h3>
  67. <div class="description">
  68. <p>A node defining the lower bound of the range.</p>
  69. <p>Default is <code>float()</code>.</p>
  70. </div>
  71. </div>
  72. <h2 class="subsection-title">Methods</h2>
  73. <h3 class="name name-method" id="getConstNode" translate="no">.<a href="#getConstNode">getConstNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  74. <div class="method">
  75. <div class="description">
  76. <p>Returns a constant node from the given node by traversing it.</p>
  77. </div>
  78. <table class="params">
  79. <tbody>
  80. <tr>
  81. <td class="name">
  82. <strong>node</strong>
  83. </td>
  84. <td class="description last">
  85. <p>The node to traverse.</p>
  86. </td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. <dl class="details">
  91. <dt class="tag-returns"><strong>Returns:</strong> The constant node, if found.</dt>
  92. </dl>
  93. </div>
  94. <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
  95. <div class="method">
  96. <div class="description">
  97. <p>This method is overwritten since the node type is inferred from range definition.</p>
  98. </div>
  99. <table class="params">
  100. <tbody>
  101. <tr>
  102. <td class="name">
  103. <strong>builder</strong>
  104. </td>
  105. <td class="description last">
  106. <p>The current node builder.</p>
  107. </td>
  108. </tr>
  109. </tbody>
  110. </table>
  111. <dl class="details">
  112. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  113. </dl>
  114. <dl class="details">
  115. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  116. </dl>
  117. </div>
  118. <h3 class="name name-method" id="getVectorLength" translate="no">.<a href="#getVectorLength">getVectorLength</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : number</span> </h3>
  119. <div class="method">
  120. <div class="description">
  121. <p>Returns the vector length which is computed based on the range definition.</p>
  122. </div>
  123. <table class="params">
  124. <tbody>
  125. <tr>
  126. <td class="name">
  127. <strong>builder</strong>
  128. </td>
  129. <td class="description last">
  130. <p>The current node builder.</p>
  131. </td>
  132. </tr>
  133. </tbody>
  134. </table>
  135. <dl class="details">
  136. <dt class="tag-returns"><strong>Returns:</strong> The vector length.</dt>
  137. </dl>
  138. </div>
  139. <h2 class="subsection-title">Source</h2>
  140. <p>
  141. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/geometry/RangeNode.js" translate="no" target="_blank" rel="noopener">src/nodes/geometry/RangeNode.js</a>
  142. </p>
  143. </article>
  144. </section>
  145. <script src="../scripts/linenumber.js"></script>
  146. <script src="../scripts/page.js"></script>
  147. </body>
  148. </html>
粤ICP备19079148号