ContextNode.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ContextNode - 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">ContextNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This node can be used as a context management component for another node.
  17. <a href="NodeBuilder.html">NodeBuilder</a> performs its node building process in a specific context and
  18. this node allows the modify the context. A typical use case is to overwrite <code>getUV()</code> e.g.:</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">node.context( { getUV: () => customCoord } );
  21. </code></pre></div>
  22. </header>
  23. <article>
  24. <div class="container-overview">
  25. <h2>Constructor</h2>
  26. <h3 class="name name-method" id="ContextNode" translate="no">new <a href="#ContextNode">ContextNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, value : <span class="param-type">Object</span> )</span> </h3>
  27. <div class="method">
  28. <div class="description">
  29. <p>Constructs a new context node.</p>
  30. </div>
  31. <table class="params">
  32. <tbody>
  33. <tr>
  34. <td class="name">
  35. <strong>node</strong>
  36. </td>
  37. <td class="description last">
  38. <p>The node whose context should be modified.</p>
  39. </td>
  40. </tr>
  41. <tr>
  42. <td class="name">
  43. <strong>value</strong>
  44. </td>
  45. <td class="description last">
  46. <p>The modified context data.</p>
  47. <p>Default is <code>{}</code>.</p>
  48. </td>
  49. </tr>
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. <h2 class="subsection-title">Properties</h2>
  55. <div class="member">
  56. <h3 class="name" id="isContextNode" translate="no">.<a href="#isContextNode">isContextNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  57. <div class="description">
  58. <p>This flag can be used for type testing.</p>
  59. <p>Default is <code>true</code>.</p>
  60. </div>
  61. </div>
  62. <div class="member">
  63. <h3 class="name" id="node" translate="no">.<a href="#node">node</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  64. <div class="description">
  65. <p>The node whose context should be modified.</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="value" translate="no">.<a href="#value">value</a><span class="type-signature"> : Object</span> </h3>
  70. <div class="description">
  71. <p>The modified context data.</p>
  72. <p>Default is <code>{}</code>.</p>
  73. </div>
  74. </div>
  75. <h2 class="subsection-title">Methods</h2>
  76. <h3 class="name name-method" id="getMemberType" translate="no">.<a href="#getMemberType">getMemberType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span>, name : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  77. <div class="method">
  78. <div class="description">
  79. <p>This method is overwritten to ensure it returns the member type of <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  80. </div>
  81. <table class="params">
  82. <tbody>
  83. <tr>
  84. <td class="name">
  85. <strong>builder</strong>
  86. </td>
  87. <td class="description last">
  88. <p>The current node builder.</p>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class="name">
  93. <strong>name</strong>
  94. </td>
  95. <td class="description last">
  96. <p>The member name.</p>
  97. </td>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <dl class="details">
  102. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getMemberType">Node#getMemberType</a></dt>
  103. </dl>
  104. <dl class="details">
  105. <dt class="tag-returns"><strong>Returns:</strong> The member type.</dt>
  106. </dl>
  107. </div>
  108. <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>
  109. <div class="method">
  110. <div class="description">
  111. <p>This method is overwritten to ensure it returns the type of <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  112. </div>
  113. <table class="params">
  114. <tbody>
  115. <tr>
  116. <td class="name">
  117. <strong>builder</strong>
  118. </td>
  119. <td class="description last">
  120. <p>The current node builder.</p>
  121. </td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. <dl class="details">
  126. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  127. </dl>
  128. <dl class="details">
  129. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  130. </dl>
  131. </div>
  132. <h3 class="name name-method" id="getScope" translate="no">.<a href="#getScope">getScope</a><span class="signature">()</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  133. <div class="method">
  134. <div class="description">
  135. <p>This method is overwritten to ensure it returns the reference to <a href="ContextNode.html#node">ContextNode#node</a>.</p>
  136. </div>
  137. <dl class="details">
  138. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getScope">Node#getScope</a></dt>
  139. </dl>
  140. <dl class="details">
  141. <dt class="tag-returns"><strong>Returns:</strong> A reference to <a href="ContextNode.html#node">ContextNode#node</a>.</dt>
  142. </dl>
  143. </div>
  144. <h2 class="subsection-title">Source</h2>
  145. <p>
  146. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/core/ContextNode.js" translate="no" target="_blank" rel="noopener">src/nodes/core/ContextNode.js</a>
  147. </p>
  148. </article>
  149. </section>
  150. <script src="../scripts/linenumber.js"></script>
  151. <script src="../scripts/page.js"></script>
  152. </body>
  153. </html>
粤ICP备19079148号