LWOLoader.html 5.3 KB

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