Object3DNode.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Object3DNode - 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">Object3DNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This node can be used to access transformation related metrics of 3D objects.
  17. Depending on the selected scope, a different metric is represented as a uniform
  18. in the shader. The following scopes are supported:</p>
  19. <ul>
  20. <li><code>POSITION</code>: The object's position in world space.</li>
  21. <li><code>VIEW_POSITION</code>: The object's position in view/camera space.</li>
  22. <li><code>DIRECTION</code>: The object's direction in world space.</li>
  23. <li><code>SCALE</code>: The object's scale in world space.</li>
  24. <li><code>WORLD_MATRIX</code>: The object's matrix in world space.</li>
  25. </ul></div>
  26. </header>
  27. <article>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="Object3DNode" translate="no">new <a href="#Object3DNode">Object3DNode</a><span class="signature">( scope : <span class="param-type">'position' | 'viewPosition' | 'direction' | 'scale' | 'worldMatrix'</span>, object3d : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new object 3D node.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name">
  39. <strong>scope</strong>
  40. </td>
  41. <td class="description last">
  42. <p>The node represents a different type of transformation depending on the scope.</p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td class="name">
  47. <strong>object3d</strong>
  48. </td>
  49. <td class="description last">
  50. <p>The 3D object.</p>
  51. <p>Default is <code>null</code>.</p>
  52. </td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. </div>
  57. </div>
  58. <h2 class="subsection-title">Properties</h2>
  59. <div class="member">
  60. <h3 class="name" id="object3d" translate="no">.<a href="#object3d">object3d</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  61. <div class="description">
  62. <p>The 3D object.</p>
  63. <p>Default is <code>null</code>.</p>
  64. </div>
  65. </div>
  66. <div class="member">
  67. <h3 class="name" id="scope" translate="no">.<a href="#scope">scope</a><span class="type-signature"> : 'position' | 'viewPosition' | 'direction' | 'scale' | 'worldMatrix'</span> </h3>
  68. <div class="description">
  69. <p>The node reports a different type of transformation depending on the scope.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="uniformNode" translate="no">.<a href="#uniformNode">uniformNode</a><span class="type-signature"> : <a href="UniformNode.html">UniformNode</a></span> </h3>
  74. <div class="description">
  75. <p>Holds the value of the node as a uniform.</p>
  76. </div>
  77. </div>
  78. <div class="member">
  79. <h3 class="name" id="updateType" translate="no">.<a href="#updateType">updateType</a><span class="type-signature"> : string</span> </h3>
  80. <div class="description">
  81. <p>Overwritten since this type of node is updated per object.</p>
  82. <p>Default is <code>'object'</code>.</p>
  83. </div>
  84. <dl class="details">
  85. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#updateType">Node#updateType</a></dt>
  86. </dl>
  87. </div>
  88. <h2 class="subsection-title">Methods</h2>
  89. <h3 class="name name-method" id="generate" translate="no">.<a href="#generate">generate</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
  90. <div class="method">
  91. <div class="description">
  92. <p>Generates the code snippet of the uniform node. The node type of the uniform
  93. node also depends on the selected scope.</p>
  94. </div>
  95. <table class="params">
  96. <tbody>
  97. <tr>
  98. <td class="name">
  99. <strong>builder</strong>
  100. </td>
  101. <td class="description last">
  102. <p>The current node builder.</p>
  103. </td>
  104. </tr>
  105. </tbody>
  106. </table>
  107. <dl class="details">
  108. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#generate">Node#generate</a></dt>
  109. </dl>
  110. <dl class="details">
  111. <dt class="tag-returns"><strong>Returns:</strong> The generated code snippet.</dt>
  112. </dl>
  113. </div>
  114. <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">()</span><span class="type-signature"> : 'mat4' | 'vec3' | 'float'</span> </h3>
  115. <div class="method">
  116. <div class="description">
  117. <p>Overwritten since the node type is inferred from the scope.</p>
  118. </div>
  119. <dl class="details">
  120. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  121. </dl>
  122. <dl class="details">
  123. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  124. </dl>
  125. </div>
  126. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( frame : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a></span> )</span> </h3>
  127. <div class="method">
  128. <div class="description">
  129. <p>Updates the uniform value depending on the scope.</p>
  130. </div>
  131. <table class="params">
  132. <tbody>
  133. <tr>
  134. <td class="name">
  135. <strong>frame</strong>
  136. </td>
  137. <td class="description last">
  138. <p>The current node frame.</p>
  139. </td>
  140. </tr>
  141. </tbody>
  142. </table>
  143. <dl class="details">
  144. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#update">Node#update</a></dt>
  145. </dl>
  146. </div>
  147. <h2 class="subsection-title">Source</h2>
  148. <p>
  149. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/Object3DNode.js" translate="no" target="_blank" rel="noopener">src/nodes/accessors/Object3DNode.js</a>
  150. </p>
  151. </article>
  152. </section>
  153. <script src="../scripts/linenumber.js"></script>
  154. <script src="../scripts/page.js"></script>
  155. </body>
  156. </html>
粤ICP备19079148号