Skeleton.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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. 使用一个[page:Bone bones]数组来创建一个可以由[page:SkinnedMesh]使用的骨架。
  13. </p>
  14. <h2>代码示例</h2>
  15. <code>
  16. // Create a simple "arm"
  17. const bones = [];
  18. const shoulder = new THREE.Bone();
  19. const elbow = new THREE.Bone();
  20. const hand = new THREE.Bone();
  21. shoulder.add( elbow );
  22. elbow.add( hand );
  23. bones.push( shoulder );
  24. bones.push( elbow );
  25. bones.push( hand );
  26. shoulder.position.y = -5;
  27. elbow.position.y = 0;
  28. hand.position.y = 5;
  29. const armSkeleton = new THREE.Skeleton( bones );
  30. </code>
  31. <p>
  32. 请查看[page:SkinnedMesh]页面,来查看其在标准的[page:BufferGeometry]中使用的示例。
  33. </p>
  34. <h2>构造器</h2>
  35. <h3>[name]( [param:Array bones], [param:Array boneInverses] )</h3>
  36. <p>
  37. [page:Array bones] —— 包含有一组[page:Bone bone]的数组,默认值是一个空数组。<br/>
  38. [page:Array boneInverses] —— (可选) 包含[page:Matrix4 Matrix4]的数组。<br /><br />
  39. 创建一个新的[name].
  40. </p>
  41. <h2>属性</h2>
  42. <h3>[property:Array bones]</h3>
  43. <p>
  44. 包含有一组[page:Bone bone]的数组。请注意,这是一份原始数组的拷贝,不是引用,所以你可以在不对当前数组造成影响的情况下,修改原始数组。
  45. </p>
  46. <h3>[property:Array boneInverses]</h3>
  47. <p>
  48. 包含有一组[page:Matrix4 Matrix4],表示每个独立骨骼[page:Matrix4 matrixWorld]矩阵的逆矩阵。
  49. </p>
  50. <h3>[property:Float32Array boneMatrices]</h3>
  51. <p>
  52. 当使用顶点纹理时,数组缓冲区保存着骨骼数据。
  53. </p>
  54. <h3>[property:DataTexture boneTexture]</h3>
  55. <p>
  56. 当使用顶点纹理时,[page:DataTexture]保存着骨骼数据。
  57. </p>
  58. <h2>方法</h2>
  59. <h3>[method:Skeleton clone]()</h3>
  60. <p>
  61. 返回一个当前Skeleton对象的克隆。
  62. </p>
  63. <h3>[method:undefined calculateInverses]()</h3>
  64. <p>如果没有在构造器中提供,生成[page:.boneInverses boneInverses]数组。
  65. </p>
  66. <h3>[method:this computeBoneTexture]()</h3>
  67. <p>Computes an instance of [page:DataTexture] in order to pass the bone data more efficiently to the shader. The texture is assigned to [page:.boneTexture boneTexture].</p>
  68. <h3>[method:undefined pose]()</h3>
  69. <p>返回骨架的基础姿势。</p>
  70. <h3>[method:undefined update]()</h3>
  71. <p>
  72. 在改变骨骼后,更新[page:Float32Array boneMatrices] 和 [page:DataTexture boneTexture]的值。
  73. 如果骨架被用于[page:SkinnedMesh],则它将会被[page:WebGLRenderer]自动调用。
  74. </p>
  75. <h3>[method:Bone getBoneByName]( [param:String name] )</h3>
  76. <p>
  77. name —— 匹配Bone对象中.name属性的字符串。<br /><br />
  78. 在骨架中的骨骼数组中遍览,并返回第一个能够和name匹配上的骨骼对象。<br />
  79. </p>
  80. <h3>[method:undefined dispose]()</h3>
  81. <p>
  82. Can be used if an instance of [name] becomes obsolete in an application. The method will free internal resources.
  83. </p>
  84. <h2>源代码</h2>
  85. <p>
  86. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  87. </p>
  88. </body>
  89. </html>