SkinningNode.html 12 KB

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