MaterialReferenceNode.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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">Material</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"><code>property</code></td>
  36. <td class="description last"><p>The name of the property the node refers to.</p></td>
  37. </tr>
  38. <tr>
  39. <td class="name"><code>inputType</code></td>
  40. <td class="description last"><p>The uniform type that should be used to represent the property value.</p></td>
  41. </tr>
  42. <tr>
  43. <td class="name"><code>material</code></td>
  44. <td class="description last"><p>The material the property belongs to. When no material is set,
  45. the node refers to the material of the current rendered object.<br/>Default is <code>null</code>.</p></td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. <h2 class="subsection-title">Properties</h2>
  52. <div class="member">
  53. <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>
  54. <div class="description">
  55. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  56. </div>
  57. </div>
  58. <div class="member">
  59. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="Material.html">Material</a></span> </h3>
  60. <div class="description">
  61. <p>The material the property belongs to. When no material is set,
  62. the node refers to the material of the current rendered object.<br/>Default is <code>null</code>.</p>
  63. </div>
  64. </div>
  65. <h2 class="subsection-title">Methods</h2>
  66. <h3 class="name name-method" id="updateReference" translate="no">.<a href="#updateReference">updateReference</a><span class="signature">( state : <span class="param-type">NodeFrame | NodeBuilder</span> )</span><span class="type-signature"> : Object</span> </h3>
  67. <div class="method">
  68. <div class="description">
  69. <p>Updates the reference based on the given state. The state is only evaluated
  70. <a href="MaterialReferenceNode.html#material">MaterialReferenceNode#material</a> is not set.</p>
  71. </div>
  72. <table class="params">
  73. <tbody>
  74. <tr>
  75. <td class="name"><code>state</code></td>
  76. <td class="description last"><p>The current state.</p></td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. <dl class="details">
  81. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="ReferenceNode.html#updateReference">ReferenceNode#updateReference</a></dt>
  82. </dl>
  83. <dl class="details">
  84. <dt class="tag-returns"><strong>Returns:</strong> The updated reference.</dt>
  85. </dl>
  86. </div>
  87. <h2 class="subsection-title">Source</h2>
  88. <p>
  89. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/MaterialReferenceNode.js" target="_blank" rel="noopener" translate="no">src/nodes/accessors/MaterialReferenceNode.js</a>
  90. </p>
  91. </article>
  92. </section>
  93. <script src="../scripts/linenumber.js"></script>
  94. <script src="../scripts/page.js"></script>
  95. </body>
  96. </html>
粤ICP备19079148号