RangeNode.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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">Node.&lt;any></span>, maxNode : <span class="param-type">Node.&lt;any></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"><code>minNode</code></td>
  37. <td class="description last"><p>A node defining the lower bound of the range.<br/>Default is <code>float()</code>.</p></td>
  38. </tr>
  39. <tr>
  40. <td class="name"><code>maxNode</code></td>
  41. <td class="description last"><p>A node defining the upper bound of the range.<br/>Default is <code>float()</code>.</p></td>
  42. </tr>
  43. </tbody>
  44. </table>
  45. </div>
  46. </div>
  47. <h2 class="subsection-title">Properties</h2>
  48. <div class="member">
  49. <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>
  50. <div class="description">
  51. <p>A node defining the upper bound of the range.<br/>Default is <code>float()</code>.</p>
  52. </div>
  53. </div>
  54. <div class="member">
  55. <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>
  56. <div class="description">
  57. <p>A node defining the lower bound of the range.<br/>Default is <code>float()</code>.</p>
  58. </div>
  59. </div>
  60. <h2 class="subsection-title">Methods</h2>
  61. <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : string</span> </h3>
  62. <div class="method">
  63. <div class="description">
  64. <p>This method is overwritten since the node type is inferred from range definition.</p>
  65. </div>
  66. <table class="params">
  67. <tbody>
  68. <tr>
  69. <td class="name"><code>builder</code></td>
  70. <td class="description last"><p>The current node builder.</p></td>
  71. </tr>
  72. </tbody>
  73. </table>
  74. <dl class="details">
  75. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  76. </dl>
  77. <dl class="details">
  78. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  79. </dl>
  80. </div>
  81. <h3 class="name name-method" id="getVectorLength" translate="no">.<a href="#getVectorLength">getVectorLength</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : number</span> </h3>
  82. <div class="method">
  83. <div class="description">
  84. <p>Returns the vector length which is computed based on the range definition.</p>
  85. </div>
  86. <table class="params">
  87. <tbody>
  88. <tr>
  89. <td class="name"><code>builder</code></td>
  90. <td class="description last"><p>The current node builder.</p></td>
  91. </tr>
  92. </tbody>
  93. </table>
  94. <dl class="details">
  95. <dt class="tag-returns"><strong>Returns:</strong> The vector length.</dt>
  96. </dl>
  97. </div>
  98. <h2 class="subsection-title">Source</h2>
  99. <p>
  100. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/geometry/RangeNode.js" target="_blank" rel="noopener" translate="no">src/nodes/geometry/RangeNode.js</a>
  101. </p>
  102. </article>
  103. </section>
  104. <script src="../scripts/linenumber.js"></script>
  105. <script src="../scripts/page.js"></script>
  106. </body>
  107. </html>
粤ICP备19079148号