MD2Loader.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>MD2Loader - 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">MD2Loader</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A loader for the MD2 format.</p>
  17. <p>The loader represents the animations of the MD2 asset as an array of animation
  18. clips and stores them in the <code>animations</code> property of the geometry.</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">const loader = new MD2Loader();
  21. const geometry = await loader.loadAsync( './models/md2/ogro/ogro.md2' );
  22. const animations = geometry.animations;
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <h2 class="subsection-title">Import</h2>
  27. <p><span translate="no">MD2Loader</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  28. <pre><code class="language-js">import { MD2Loader } from 'three/addons/loaders/MD2Loader.js';</code></pre>
  29. <div class="container-overview">
  30. <h2>Constructor</h2>
  31. <h3 class="name name-method" id="MD2Loader" translate="no">new <a href="#MD2Loader">MD2Loader</a><span class="signature">( manager : <span class="param-type">LoadingManager</span> )</span> </h3>
  32. <div class="method">
  33. <div class="description">
  34. <p>Constructs a new MD2 loader.</p>
  35. </div>
  36. <table class="params">
  37. <tbody>
  38. <tr>
  39. <td class="name"><code>manager</code></td>
  40. <td class="description last"><p>The loading manager.</p></td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </div>
  45. </div>
  46. <h2 class="subsection-title">Methods</h2>
  47. <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>
  48. <div class="method">
  49. <div class="description">
  50. <p>Starts loading from the given URL and passes the loaded MD2 asset
  51. to the <code>onLoad()</code> callback.</p>
  52. </div>
  53. <table class="params">
  54. <tbody>
  55. <tr>
  56. <td class="name"><code>url</code></td>
  57. <td class="description last"><p>The path/URL of the file to be loaded. This can also be a data URI.</p></td>
  58. </tr>
  59. <tr>
  60. <td class="name"><code>onLoad</code></td>
  61. <td class="description last"><p>Executed when the loading process has been finished.</p></td>
  62. </tr>
  63. <tr>
  64. <td class="name"><code>onProgress</code></td>
  65. <td class="description last"><p>Executed while the loading is in progress.</p></td>
  66. </tr>
  67. <tr>
  68. <td class="name"><code>onError</code></td>
  69. <td class="description last"><p>Executed when errors occur.</p></td>
  70. </tr>
  71. </tbody>
  72. </table>
  73. <dl class="details">
  74. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
  75. </dl>
  76. </div>
  77. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( buffer : <span class="param-type">ArrayBuffer</span> )</span><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
  78. <div class="method">
  79. <div class="description">
  80. <p>Parses the given MD2 data and returns a geometry.</p>
  81. </div>
  82. <table class="params">
  83. <tbody>
  84. <tr>
  85. <td class="name"><code>buffer</code></td>
  86. <td class="description last"><p>The raw MD2 data as an array buffer.</p></td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. <dl class="details">
  91. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#parse">Loader#parse</a></dt>
  92. </dl>
  93. <dl class="details">
  94. <dt class="tag-returns"><strong>Returns:</strong> The parsed geometry data.</dt>
  95. </dl>
  96. </div>
  97. <h2 class="subsection-title">Source</h2>
  98. <p>
  99. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/MD2Loader.js" target="_blank" rel="noopener" translate="no">examples/jsm/loaders/MD2Loader.js</a>
  100. </p>
  101. </article>
  102. </section>
  103. <script src="../scripts/linenumber.js"></script>
  104. <script src="../scripts/page.js"></script>
  105. </body>
  106. </html>
粤ICP备19079148号