SkinningNode.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SkinningNode - 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">SkinningNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This node implements the vertex transformation shader logic which is required
  17. for skinning/skeletal animation.</p></div>
  18. </header>
  19. <article>
  20. <div class="container-overview">
  21. <h2>Constructor</h2>
  22. <h3 class="name name-method" id="SkinningNode" translate="no">new <a href="#SkinningNode">SkinningNode</a><span class="signature">( skinnedMesh : <span class="param-type">SkinnedMesh</span> )</span> </h3>
  23. <div class="method">
  24. <div class="description">
  25. <p>Constructs a new skinning node.</p>
  26. </div>
  27. <table class="params">
  28. <tbody>
  29. <tr>
  30. <td class="name"><code>skinnedMesh</code></td>
  31. <td class="description last"><p>The skinned mesh.</p></td>
  32. </tr>
  33. </tbody>
  34. </table>
  35. </div>
  36. </div>
  37. <h2 class="subsection-title">Properties</h2>
  38. <div class="member">
  39. <h3 class="name" id="bindMatrixInverseNode" translate="no">.<a href="#bindMatrixInverseNode">bindMatrixInverseNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;mat4></span> </h3>
  40. <div class="description">
  41. <p>The bind matrix inverse node.</p>
  42. </div>
  43. </div>
  44. <div class="member">
  45. <h3 class="name" id="bindMatrixNode" translate="no">.<a href="#bindMatrixNode">bindMatrixNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;mat4></span> </h3>
  46. <div class="description">
  47. <p>The bind matrix node.</p>
  48. </div>
  49. </div>
  50. <div class="member">
  51. <h3 class="name" id="boneMatricesNode" translate="no">.<a href="#boneMatricesNode">boneMatricesNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  52. <div class="description">
  53. <p>The bind matrices as a uniform buffer node.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="positionNode" translate="no">.<a href="#positionNode">positionNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  58. <div class="description">
  59. <p>The current vertex position in local space.</p>
  60. </div>
  61. </div>
  62. <div class="member">
  63. <h3 class="name" id="previousBoneMatricesNode" translate="no">.<a href="#previousBoneMatricesNode">previousBoneMatricesNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  64. <div class="description">
  65. <p>The previous bind matrices as a uniform buffer node.
  66. Required for computing motion vectors.<br/>Default is <code>null</code>.</p>
  67. </div>
  68. </div>
  69. <div class="member">
  70. <h3 class="name" id="skinIndexNode" translate="no">.<a href="#skinIndexNode">skinIndexNode</a><span class="type-signature"> : <a href="AttributeNode.html">AttributeNode</a></span> </h3>
  71. <div class="description">
  72. <p>The skin index attribute.</p>
  73. </div>
  74. </div>
  75. <div class="member">
  76. <h3 class="name" id="skinWeightNode" translate="no">.<a href="#skinWeightNode">skinWeightNode</a><span class="type-signature"> : <a href="AttributeNode.html">AttributeNode</a></span> </h3>
  77. <div class="description">
  78. <p>The skin weight attribute.</p>
  79. </div>
  80. </div>
  81. <div class="member">
  82. <h3 class="name" id="skinnedMesh" translate="no">.<a href="#skinnedMesh">skinnedMesh</a><span class="type-signature"> : <a href="SkinnedMesh.html">SkinnedMesh</a></span> </h3>
  83. <div class="description">
  84. <p>The skinned mesh.</p>
  85. </div>
  86. </div>
  87. <div class="member">
  88. <h3 class="name" id="toPositionNode" translate="no">.<a href="#toPositionNode">toPositionNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  89. <div class="description">
  90. <p>The result of vertex position in local space.</p>
  91. </div>
  92. </div>
  93. <div class="member">
  94. <h3 class="name" id="updateType" translate="no">.<a href="#updateType">updateType</a><span class="type-signature"> : string</span> </h3>
  95. <div class="description">
  96. <p>The update type overwritten since skinning nodes are updated per object.</p>
  97. </div>
  98. <dl class="details">
  99. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#updateType">Node#updateType</a></dt>
  100. </dl>
  101. </div>
  102. <h2 class="subsection-title">Methods</h2>
  103. <h3 class="name name-method" id="generate" translate="no">.<a href="#generate">generate</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span>, output : <span class="param-type">string</span> )</span><span class="type-signature"> : string</span> </h3>
  104. <div class="method">
  105. <div class="description">
  106. <p>Generates the code snippet of the skinning node.</p>
  107. </div>
  108. <table class="params">
  109. <tbody>
  110. <tr>
  111. <td class="name"><code>builder</code></td>
  112. <td class="description last"><p>The current node builder.</p></td>
  113. </tr>
  114. <tr>
  115. <td class="name"><code>output</code></td>
  116. <td class="description last"><p>The current output.</p></td>
  117. </tr>
  118. </tbody>
  119. </table>
  120. <dl class="details">
  121. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#generate">Node#generate</a></dt>
  122. </dl>
  123. <dl class="details">
  124. <dt class="tag-returns"><strong>Returns:</strong> The generated code snippet.</dt>
  125. </dl>
  126. </div>
  127. <h3 class="name name-method" id="getPreviousSkinnedPosition" translate="no">.<a href="#getPreviousSkinnedPosition">getPreviousSkinnedPosition</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  128. <div class="method">
  129. <div class="description">
  130. <p>Computes the transformed/skinned vertex position of the previous frame.</p>
  131. </div>
  132. <table class="params">
  133. <tbody>
  134. <tr>
  135. <td class="name"><code>builder</code></td>
  136. <td class="description last"><p>The current node builder.</p></td>
  137. </tr>
  138. </tbody>
  139. </table>
  140. <dl class="details">
  141. <dt class="tag-returns"><strong>Returns:</strong> The skinned position from the previous frame.</dt>
  142. </dl>
  143. </div>
  144. <h3 class="name name-method" id="getSkinnedNormal" translate="no">.<a href="#getSkinnedNormal">getSkinnedNormal</a><span class="signature">( boneMatrices : <span class="param-type">Node</span>, normal : <span class="param-type">Node.&lt;vec3></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  145. <div class="method">
  146. <div class="description">
  147. <p>Transforms the given vertex normal via skinning.</p>
  148. </div>
  149. <table class="params">
  150. <tbody>
  151. <tr>
  152. <td class="name"><code>boneMatrices</code></td>
  153. <td class="description last"><p>The bone matrices<br/>Default is <code>this.boneMatricesNode</code>.</p></td>
  154. </tr>
  155. <tr>
  156. <td class="name"><code>normal</code></td>
  157. <td class="description last"><p>The vertex normal in local space.<br/>Default is <code>normalLocal</code>.</p></td>
  158. </tr>
  159. </tbody>
  160. </table>
  161. <dl class="details">
  162. <dt class="tag-returns"><strong>Returns:</strong> The transformed vertex normal.</dt>
  163. </dl>
  164. </div>
  165. <h3 class="name name-method" id="getSkinnedPosition" translate="no">.<a href="#getSkinnedPosition">getSkinnedPosition</a><span class="signature">( boneMatrices : <span class="param-type">Node</span>, position : <span class="param-type">Node.&lt;vec3></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  166. <div class="method">
  167. <div class="description">
  168. <p>Transforms the given vertex position via skinning.</p>
  169. </div>
  170. <table class="params">
  171. <tbody>
  172. <tr>
  173. <td class="name"><code>boneMatrices</code></td>
  174. <td class="description last"><p>The bone matrices<br/>Default is <code>this.boneMatricesNode</code>.</p></td>
  175. </tr>
  176. <tr>
  177. <td class="name"><code>position</code></td>
  178. <td class="description last"><p>The vertex position in local space.<br/>Default is <code>this.positionNode</code>.</p></td>
  179. </tr>
  180. </tbody>
  181. </table>
  182. <dl class="details">
  183. <dt class="tag-returns"><strong>Returns:</strong> The transformed vertex position.</dt>
  184. </dl>
  185. </div>
  186. <h3 class="name name-method" id="needsPreviousBoneMatrices" translate="no">.<a href="#needsPreviousBoneMatrices">needsPreviousBoneMatrices</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : boolean</span> </h3>
  187. <div class="method">
  188. <div class="description">
  189. <p>Returns <code>true</code> if bone matrices from the previous frame are required. Relevant
  190. when computing motion vectors with <a href="VelocityNode.html">VelocityNode</a>.</p>
  191. </div>
  192. <table class="params">
  193. <tbody>
  194. <tr>
  195. <td class="name"><code>builder</code></td>
  196. <td class="description last"><p>The current node builder.</p></td>
  197. </tr>
  198. </tbody>
  199. </table>
  200. <dl class="details">
  201. <dt class="tag-returns"><strong>Returns:</strong> Whether bone matrices from the previous frame are required or not.</dt>
  202. </dl>
  203. </div>
  204. <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  205. <div class="method">
  206. <div class="description">
  207. <p>Setups the skinning node by assigning the transformed vertex data to predefined node variables.</p>
  208. </div>
  209. <table class="params">
  210. <tbody>
  211. <tr>
  212. <td class="name"><code>builder</code></td>
  213. <td class="description last"><p>The current node builder.</p></td>
  214. </tr>
  215. </tbody>
  216. </table>
  217. <dl class="details">
  218. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#setup">Node#setup</a></dt>
  219. </dl>
  220. <dl class="details">
  221. <dt class="tag-returns"><strong>Returns:</strong> The transformed vertex position.</dt>
  222. </dl>
  223. </div>
  224. <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>
  225. <div class="method">
  226. <div class="description">
  227. <p>Updates the state of the skinned mesh by updating the skeleton once per frame.</p>
  228. </div>
  229. <table class="params">
  230. <tbody>
  231. <tr>
  232. <td class="name"><code>frame</code></td>
  233. <td class="description last"><p>The current node frame.</p></td>
  234. </tr>
  235. </tbody>
  236. </table>
  237. <dl class="details">
  238. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#update">Node#update</a></dt>
  239. </dl>
  240. </div>
  241. <h2 class="subsection-title">Source</h2>
  242. <p>
  243. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/SkinningNode.js" target="_blank" rel="noopener" translate="no">src/nodes/accessors/SkinningNode.js</a>
  244. </p>
  245. </article>
  246. </section>
  247. <script src="../scripts/linenumber.js"></script>
  248. <script src="../scripts/page.js"></script>
  249. </body>
  250. </html>
粤ICP备19079148号