Skeleton.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">
  13. Use an array of [page:Bone bones] to create a skeleton that can be used by a
  14. [page:SkinnedMesh].
  15. </div>
  16. <h2>Example</h2>
  17. <div>
  18. <code>
  19. // Create a simple "arm"
  20. var bones = [];
  21. var shoulder = new THREE.Bone();
  22. var elbow = new THREE.Bone();
  23. var hand = new THREE.Bone();
  24. shoulder.add( elbow );
  25. elbow.add( hand );
  26. bones.push( shoulder );
  27. bones.push( elbow );
  28. bones.push( hand );
  29. shoulder.position.y = -5;
  30. elbow.position.y = 0;
  31. hand.position.y = 5;
  32. var armSkeleton = new THREE.Skeleton( bones );
  33. </code>
  34. See the [page:SkinnedMesh] page for an example of usage with standard [page:BufferGeometry].
  35. </div>
  36. <h2>Constructor</h2>
  37. <h3>[name]( [page:Array bones], [page:Array boneInverses] )</h3>
  38. <div>
  39. [page:Array bones] - The array of [page:Bone bones]. Default is an empty array.<br/>
  40. [page:Array boneInverses] - (optional) An array of [page:Matrix4 Matrix4s].<br /><br />
  41. Creates a new [name].
  42. </div>
  43. <h2>Properties</h2>
  44. <h3>[property:Array bones]</h3>
  45. <div>
  46. The array of [page:bone bones]. Note this is a copy of the original array, not a reference,
  47. so you can modify the original array without effecting this one.
  48. </div>
  49. <h3>[property:Array boneInverses]</h3>
  50. <div>
  51. An array of [page:Matrix4 Matrix4s] that represent the inverse of the [page:Matrix4 matrixWorld]
  52. of the individual bones.
  53. </div>
  54. <h3>[property:Float32Array boneMatrices]</h3>
  55. <div>
  56. The array buffer holding the bone data when using a vertex texture.
  57. </div>
  58. <h3>[property:DataTexture boneTexture]</h3>
  59. <div>
  60. The [page:DataTexture] holding the bone data when using a vertex texture.
  61. </div>
  62. <h2>Methods</h2>
  63. <h3>[method:Skeleton clone]()</h3>
  64. <div>
  65. Returns a clone of this Skeleton object.
  66. </div>
  67. <h3>[method:null calculateInverses]()</h3>
  68. <div>Generates the [page:.boneInverses boneInverses] array if not provided in the constructor.</div>
  69. <h3>[method:null pose]()</h3>
  70. <div>Returns the skeleton to the base pose.</div>
  71. <h3>[method:null update]()</h3>
  72. <div>
  73. Updates the [page:Float32Array boneMatrices] and [page:DataTexture boneTexture] after changing the bones.
  74. This is called automatically by the [page:WebGLRenderer] if the skeleton is used with a [page:SkinnedMesh].
  75. </div>
  76. <h2>Source</h2>
  77. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  78. </body>
  79. </html>