MaterialReferenceNode.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>MaterialReferenceNode - 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> → <a href="ReferenceNode.html">ReferenceNode</a> → </p>
  13. <h1 translate="no">MaterialReferenceNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This node is a special type of reference node which is intended
  17. for linking material properties with node values.</p>
  18. <p>When changing <code>material.opacity</code>, the node value of <code>opacityNode</code> will
  19. automatically be updated.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const opacityNode = materialReference( 'opacity', 'float', material );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <div class="container-overview">
  26. <h2>Constructor</h2>
  27. <h3 class="name name-method" id="MaterialReferenceNode" translate="no">new <a href="#MaterialReferenceNode">MaterialReferenceNode</a><span class="signature">( property : <span class="param-type">string</span>, inputType : <span class="param-type">string</span>, material : <span class="param-type"><a href="Material.html">Material</a></span> )</span> </h3>
  28. <div class="method">
  29. <div class="description">
  30. <p>Constructs a new material reference node.</p>
  31. </div>
  32. <table class="params">
  33. <tbody>
  34. <tr>
  35. <td class="name">
  36. <strong>property</strong>
  37. </td>
  38. <td class="description last">
  39. <p>The name of the property the node refers to.</p>
  40. </td>
  41. </tr>
  42. <tr>
  43. <td class="name">
  44. <strong>inputType</strong>
  45. </td>
  46. <td class="description last">
  47. <p>The uniform type that should be used to represent the property value.</p>
  48. </td>
  49. </tr>
  50. <tr>
  51. <td class="name">
  52. <strong>material</strong>
  53. </td>
  54. <td class="description last">
  55. <p>The material the property belongs to. When no material is set,
  56. the node refers to the material of the current rendered object.</p>
  57. <p>Default is <code>null</code>.</p>
  58. </td>
  59. </tr>
  60. </tbody>
  61. </table>
  62. </div>
  63. </div>
  64. <h2 class="subsection-title">Properties</h2>
  65. <div class="member">
  66. <h3 class="name" id="isMaterialReferenceNode" translate="no">.<a href="#isMaterialReferenceNode">isMaterialReferenceNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  67. <div class="description">
  68. <p>This flag can be used for type testing.</p>
  69. <p>Default is <code>true</code>.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="Material.html">Material</a></span> </h3>
  74. <div class="description">
  75. <p>The material the property belongs to. When no material is set,
  76. the node refers to the material of the current rendered object.</p>
  77. <p>Default is <code>null</code>.</p>
  78. </div>
  79. </div>
  80. <h2 class="subsection-title">Methods</h2>
  81. <h3 class="name name-method" id="updateReference" translate="no">.<a href="#updateReference">updateReference</a><span class="signature">( state : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a> | <a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : Object</span> </h3>
  82. <div class="method">
  83. <div class="description">
  84. <p>Updates the reference based on the given state. The state is only evaluated
  85. <a href="MaterialReferenceNode.html#material">MaterialReferenceNode#material</a> is not set.</p>
  86. </div>
  87. <table class="params">
  88. <tbody>
  89. <tr>
  90. <td class="name">
  91. <strong>state</strong>
  92. </td>
  93. <td class="description last">
  94. <p>The current state.</p>
  95. </td>
  96. </tr>
  97. </tbody>
  98. </table>
  99. <dl class="details">
  100. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="ReferenceNode.html#updateReference">ReferenceNode#updateReference</a></dt>
  101. </dl>
  102. <dl class="details">
  103. <dt class="tag-returns"><strong>Returns:</strong> The updated reference.</dt>
  104. </dl>
  105. </div>
  106. <h2 class="subsection-title">Source</h2>
  107. <p>
  108. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/MaterialReferenceNode.js" translate="no" target="_blank" rel="noopener">src/nodes/accessors/MaterialReferenceNode.js</a>
  109. </p>
  110. </article>
  111. </section>
  112. <script src="../scripts/linenumber.js"></script>
  113. <script src="../scripts/page.js"></script>
  114. </body>
  115. </html>
粤ICP备19079148号