BVHLoader.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>BVHLoader - 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="Loader.html">Loader</a> → </p>
  13. <h1 translate="no">BVHLoader</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A loader for the BVH format.</p>
  17. <p>Imports BVH files and outputs a single <a href="Skeleton.html">Skeleton</a> and <a href="AnimationClip.html">AnimationClip</a>.
  18. The loader only supports BVH files containing a single root right now.</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">const loader = new BVHLoader();
  21. const result = await loader.loadAsync( 'models/bvh/pirouette.bvh' );
  22. // visualize skeleton
  23. const skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] );
  24. scene.add( result.skeleton.bones[ 0 ] );
  25. scene.add( skeletonHelper );
  26. // play animation clip
  27. mixer = new THREE.AnimationMixer( result.skeleton.bones[ 0 ] );
  28. mixer.clipAction( result.clip ).play();
  29. </code></pre></div>
  30. </header>
  31. <article>
  32. <h2 class="subsection-title">Import</h2>
  33. <p><span translate="no">BVHLoader</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  34. <pre><code class="language-js">import { BVHLoader } from 'three/addons/loaders/BVHLoader.js';</code></pre>
  35. <div class="container-overview">
  36. <h2>Constructor</h2>
  37. <h3 class="name name-method" id="BVHLoader" translate="no">new <a href="#BVHLoader">BVHLoader</a><span class="signature">( manager : <span class="param-type">LoadingManager</span> )</span> </h3>
  38. <div class="method">
  39. <div class="description">
  40. <p>Constructs a new BVH loader.</p>
  41. </div>
  42. <table class="params">
  43. <tbody>
  44. <tr>
  45. <td class="name"><code>manager</code></td>
  46. <td class="description last"><p>The loading manager.</p></td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. </div>
  51. </div>
  52. <h2 class="subsection-title">Properties</h2>
  53. <div class="member">
  54. <h3 class="name" id="animateBonePositions" translate="no">.<a href="#animateBonePositions">animateBonePositions</a><span class="type-signature"> : boolean</span> </h3>
  55. <div class="description">
  56. <p>Whether to animate bone positions or not.<br/>Default is <code>true</code>.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <h3 class="name" id="animateBoneRotations" translate="no">.<a href="#animateBoneRotations">animateBoneRotations</a><span class="type-signature"> : boolean</span> </h3>
  61. <div class="description">
  62. <p>Whether to animate bone rotations or not.<br/>Default is <code>true</code>.</p>
  63. </div>
  64. </div>
  65. <h2 class="subsection-title">Methods</h2>
  66. <h3 class="name name-method" id="load" translate="no">.<a href="#load">load</a><span class="signature">( url : <span class="param-type">string</span>, onLoad : <span class="param-type">function</span>, onProgress : <span class="param-type">onProgressCallback</span>, onError : <span class="param-type">onErrorCallback</span> )</span> </h3>
  67. <div class="method">
  68. <div class="description">
  69. <p>Starts loading from the given URL and passes the loaded BVH asset
  70. to the <code>onLoad()</code> callback.</p>
  71. </div>
  72. <table class="params">
  73. <tbody>
  74. <tr>
  75. <td class="name"><code>url</code></td>
  76. <td class="description last"><p>The path/URL of the file to be loaded. This can also be a data URI.</p></td>
  77. </tr>
  78. <tr>
  79. <td class="name"><code>onLoad</code></td>
  80. <td class="description last"><p>Executed when the loading process has been finished.</p></td>
  81. </tr>
  82. <tr>
  83. <td class="name"><code>onProgress</code></td>
  84. <td class="description last"><p>Executed while the loading is in progress.</p></td>
  85. </tr>
  86. <tr>
  87. <td class="name"><code>onError</code></td>
  88. <td class="description last"><p>Executed when errors occur.</p></td>
  89. </tr>
  90. </tbody>
  91. </table>
  92. <dl class="details">
  93. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
  94. </dl>
  95. </div>
  96. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( text : <span class="param-type">string</span> )</span><span class="type-signature"> : Object</span> </h3>
  97. <div class="method">
  98. <div class="description">
  99. <p>Parses the given BVH data and returns the resulting data.</p>
  100. </div>
  101. <table class="params">
  102. <tbody>
  103. <tr>
  104. <td class="name"><code>text</code></td>
  105. <td class="description last"><p>The raw BVH data as a string.</p></td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <dl class="details">
  110. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#parse">Loader#parse</a></dt>
  111. </dl>
  112. <dl class="details">
  113. <dt class="tag-returns"><strong>Returns:</strong> An object representing the parsed asset.</dt>
  114. </dl>
  115. </div>
  116. <h2 class="subsection-title">Source</h2>
  117. <p>
  118. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/BVHLoader.js" target="_blank" rel="noopener" translate="no">examples/jsm/loaders/BVHLoader.js</a>
  119. </p>
  120. </article>
  121. </section>
  122. <script src="../scripts/linenumber.js"></script>
  123. <script src="../scripts/page.js"></script>
  124. </body>
  125. </html>
粤ICP备19079148号