SampleNode.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SampleNode - 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">SampleNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Class representing a node that samples a value using a provided callback function.</p></div>
  17. </header>
  18. <article>
  19. <div class="container-overview">
  20. <h2>Constructor</h2>
  21. <h3 class="name name-method" id="SampleNode" translate="no">new <a href="#SampleNode">SampleNode</a><span class="signature">( callback : <span class="param-type">function</span>, uvNode : <span class="param-type"><a href="Node.html">Node</a>.&lt;vec2></span> )</span> </h3>
  22. <div class="method">
  23. <div class="description">
  24. <p>Creates an instance of SampleNode.</p>
  25. </div>
  26. <table class="params">
  27. <tbody>
  28. <tr>
  29. <td class="name">
  30. <strong>callback</strong>
  31. </td>
  32. <td class="description last">
  33. <p>The function to be called when sampling. Should accept a UV node and return a value.</p>
  34. </td>
  35. </tr>
  36. <tr>
  37. <td class="name">
  38. <strong>uvNode</strong>
  39. </td>
  40. <td class="description last">
  41. <p>The UV node to be used in the texture sampling.</p>
  42. <p>Default is <code>null</code>.</p>
  43. </td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. </div>
  48. </div>
  49. <h2 class="subsection-title">Properties</h2>
  50. <div class="member">
  51. <h3 class="name" id="isSampleNode" translate="no">.<a href="#isSampleNode">isSampleNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  52. <div class="description">
  53. <p>This flag can be used for type testing.</p>
  54. <p>Default is <code>true</code>.</p>
  55. </div>
  56. </div>
  57. <div class="member">
  58. <h3 class="name" id="uvNode" translate="no">.<a href="#uvNode">uvNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;(vec2|vec3)></span> </h3>
  59. <div class="description">
  60. <p>Represents the texture coordinates.</p>
  61. <p>Default is <code>null</code>.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id=".type" translate="no">.<a href="#.type">type</a><span class="type-signature"> : string</span> <span class="type-signature">(readonly) </span></h3>
  66. <div class="description">
  67. <p>Returns the type of the node.</p>
  68. </div>
  69. </div>
  70. <h2 class="subsection-title">Methods</h2>
  71. <h3 class="name name-method" id="sample" translate="no">.<a href="#sample">sample</a><span class="signature">( uv : <span class="param-type"><a href="Node.html">Node</a>.&lt;vec2></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  72. <div class="method">
  73. <div class="description">
  74. <p>Calls the callback function with the provided UV node.</p>
  75. </div>
  76. <table class="params">
  77. <tbody>
  78. <tr>
  79. <td class="name">
  80. <strong>uv</strong>
  81. </td>
  82. <td class="description last">
  83. <p>The UV node or value to be passed to the callback.</p>
  84. </td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. <dl class="details">
  89. <dt class="tag-returns"><strong>Returns:</strong> The result of the callback function.</dt>
  90. </dl>
  91. </div>
  92. <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">()</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  93. <div class="method">
  94. <div class="description">
  95. <p>Sets up the node by sampling with the default UV accessor.</p>
  96. </div>
  97. <dl class="details">
  98. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#setup">Node#setup</a></dt>
  99. </dl>
  100. <dl class="details">
  101. <dt class="tag-returns"><strong>Returns:</strong> The result of the callback function when called with the UV node.</dt>
  102. </dl>
  103. </div>
  104. <h2 class="subsection-title">Source</h2>
  105. <p>
  106. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/SampleNode.js" translate="no" target="_blank" rel="noopener">src/nodes/utils/SampleNode.js</a>
  107. </p>
  108. </article>
  109. </section>
  110. <script src="../scripts/linenumber.js"></script>
  111. <script src="../scripts/page.js"></script>
  112. </body>
  113. </html>
粤ICP备19079148号