Object3DNode.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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">Object3D</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"><code>scope</code></td>
  39. <td class="description last"><p>The node represents a different type of transformation depending on the scope.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>object3d</code></td>
  43. <td class="description last"><p>The 3D object.<br/>Default is <code>null</code>.</p></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="object3d" translate="no">.<a href="#object3d">object3d</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  52. <div class="description">
  53. <p>The 3D object.<br/>Default is <code>null</code>.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="scope" translate="no">.<a href="#scope">scope</a><span class="type-signature"> : 'position' | 'viewPosition' | 'direction' | 'scale' | 'worldMatrix'</span> </h3>
  58. <div class="description">
  59. <p>The node reports a different type of transformation depending on the scope.</p>
  60. </div>
  61. </div>
  62. <div class="member">
  63. <h3 class="name" id="uniformNode" translate="no">.<a href="#uniformNode">uniformNode</a><span class="type-signature"> : <a href="UniformNode.html">UniformNode</a></span> </h3>
  64. <div class="description">
  65. <p>Holds the value of the node as a uniform.</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="updateType" translate="no">.<a href="#updateType">updateType</a><span class="type-signature"> : string</span> </h3>
  70. <div class="description">
  71. <p>Overwritten since this type of node is updated per object.<br/>Default is <code>'object'</code>.</p>
  72. </div>
  73. <dl class="details">
  74. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#updateType">Node#updateType</a></dt>
  75. </dl>
  76. </div>
  77. <h2 class="subsection-title">Methods</h2>
  78. <h3 class="name name-method" id="generate" translate="no">.<a href="#generate">generate</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : string</span> </h3>
  79. <div class="method">
  80. <div class="description">
  81. <p>Generates the code snippet of the uniform node. The node type of the uniform
  82. node also depends on the selected scope.</p>
  83. </div>
  84. <table class="params">
  85. <tbody>
  86. <tr>
  87. <td class="name"><code>builder</code></td>
  88. <td class="description last"><p>The current node builder.</p></td>
  89. </tr>
  90. </tbody>
  91. </table>
  92. <dl class="details">
  93. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#generate">Node#generate</a></dt>
  94. </dl>
  95. <dl class="details">
  96. <dt class="tag-returns"><strong>Returns:</strong> The generated code snippet.</dt>
  97. </dl>
  98. </div>
  99. <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>
  100. <div class="method">
  101. <div class="description">
  102. <p>Overwritten since the node type is inferred from the scope.</p>
  103. </div>
  104. <dl class="details">
  105. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  106. </dl>
  107. <dl class="details">
  108. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  109. </dl>
  110. </div>
  111. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( frame : <span class="param-type">NodeFrame</span> )</span> </h3>
  112. <div class="method">
  113. <div class="description">
  114. <p>Updates the uniform value depending on the scope.</p>
  115. </div>
  116. <table class="params">
  117. <tbody>
  118. <tr>
  119. <td class="name"><code>frame</code></td>
  120. <td class="description last"><p>The current node frame.</p></td>
  121. </tr>
  122. </tbody>
  123. </table>
  124. <dl class="details">
  125. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#update">Node#update</a></dt>
  126. </dl>
  127. </div>
  128. <h2 class="subsection-title">Source</h2>
  129. <p>
  130. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/Object3DNode.js" target="_blank" rel="noopener" translate="no">src/nodes/accessors/Object3DNode.js</a>
  131. </p>
  132. </article>
  133. </section>
  134. <script src="../scripts/linenumber.js"></script>
  135. <script src="../scripts/page.js"></script>
  136. </body>
  137. </html>
粤ICP备19079148号