VOXLoader.html 4.3 KB

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