Skeleton.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p class="desc">
  12. Use an array of [page:Bone bones] to create a skeleton that can be used by
  13. a [page:SkinnedMesh].
  14. </p>
  15. <h2>Code Example</h2>
  16. <code>
  17. // Create a simple "arm"
  18. const bones = [];
  19. const shoulder = new THREE.Bone();
  20. const elbow = new THREE.Bone();
  21. const hand = new THREE.Bone();
  22. shoulder.add( elbow );
  23. elbow.add( hand );
  24. bones.push( shoulder );
  25. bones.push( elbow );
  26. bones.push( hand );
  27. shoulder.position.y = -5;
  28. elbow.position.y = 0;
  29. hand.position.y = 5;
  30. const armSkeleton = new THREE.Skeleton( bones );
  31. </code>
  32. <p>
  33. See the [page:SkinnedMesh] page for an example of usage with standard
  34. [page:BufferGeometry].
  35. </p>
  36. <h2>Constructor</h2>
  37. <h3>[name]( [param:Array bones], [param:Array boneInverses] )</h3>
  38. <p>
  39. [page:Array bones] - The array of [page:Bone bones]. Default is an empty
  40. array.<br />
  41. [page:Array boneInverses] - (optional) An array of [page:Matrix4 Matrix4s].<br /><br />
  42. Creates a new [name].
  43. </p>
  44. <h2>Properties</h2>
  45. <h3>[property:Array bones]</h3>
  46. <p>
  47. The array of [page:bone bones]. Note this is a copy of the original array,
  48. not a reference, so you can modify the original array without effecting
  49. this one.
  50. </p>
  51. <h3>[property:Array boneInverses]</h3>
  52. <p>
  53. An array of [page:Matrix4 Matrix4s] that represent the inverse of the
  54. [page:Matrix4 matrixWorld] of the individual bones.
  55. </p>
  56. <h3>[property:Float32Array boneMatrices]</h3>
  57. <p>The array buffer holding the bone data when using a vertex texture.</p>
  58. <h3>[property:DataTexture boneTexture]</h3>
  59. <p>
  60. The [page:DataTexture] holding the bone data when using a vertex texture.
  61. </p>
  62. <h2>Methods</h2>
  63. <h3>[method:Skeleton clone]()</h3>
  64. <p>Returns a clone of this Skeleton object.</p>
  65. <h3>[method:undefined calculateInverses]()</h3>
  66. <p>
  67. Generates the [page:.boneInverses boneInverses] array if not provided in
  68. the constructor.
  69. </p>
  70. <h3>[method:this computeBoneTexture]()</h3>
  71. <p>
  72. Computes an instance of [page:DataTexture] in order to pass the bone data
  73. more efficiently to the shader. The texture is assigned to
  74. [page:.boneTexture boneTexture].
  75. </p>
  76. <h3>[method:undefined pose]()</h3>
  77. <p>Returns the skeleton to the base pose.</p>
  78. <h3>[method:undefined update]()</h3>
  79. <p>
  80. Updates the [page:Float32Array boneMatrices] and [page:DataTexture boneTexture]
  81. after changing the bones. This is called automatically by the
  82. [page:WebGLRenderer] if the skeleton is used with a [page:SkinnedMesh].
  83. </p>
  84. <h3>[method:Bone getBoneByName]( [param:String name] )</h3>
  85. <p>
  86. name -- String to match to the Bone's .name property. <br /><br />
  87. Searches through the skeleton's bone array and returns the first with a
  88. matching name.<br />
  89. </p>
  90. <h3>[method:undefined dispose]()</h3>
  91. <p>
  92. Frees the GPU-related resources allocated by this instance. Call this
  93. method whenever this instance is no longer used in your app.
  94. </p>
  95. <h2>Source</h2>
  96. <p>
  97. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  98. </p>
  99. </body>
  100. </html>