| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Rhino3dmLoader - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="Loader.html">Loader</a> → </p>
- <h1 translate="no">Rhino3dmLoader</h1>
- <section>
- <header>
- <div class="class-description"><p>A loader for Rhinoceros 3D files and objects.</p>
- <p>Rhinoceros is a 3D modeler used to create, edit, analyze, document, render,
- animate, and translate NURBS curves, surfaces, breps, extrusions, point clouds,
- as well as polygon meshes and SubD objects. <code>rhino3dm.js</code> is compiled to WebAssembly
- from the open source geometry library <code>openNURBS</code>. The loader currently uses
- <code>rhino3dm.js 8.4.0</code>.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const loader = new Rhino3dmLoader();
- loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.0.1' );
- const object = await loader.loadAsync( 'models/3dm/Rhino_Logo.3dm' );
- scene.add( object );
- </code></pre></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">Rhino3dmLoader</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
- <pre><code class="language-js">import { Rhino3dmLoader } from 'three/addons/loaders/3DMLoader.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="Rhino3dmLoader" translate="no">new <a href="#Rhino3dmLoader">Rhino3dmLoader</a><span class="signature">( manager : <span class="param-type"><a href="LoadingManager.html">LoadingManager</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new Rhino 3DM loader.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>manager</strong>
- </td>
- <td class="description last">
- <p>The loading manager.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="debug" translate="no">.<a href="#debug">debug</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Prints debug messages to the browser console.</p>
- </div>
- </div>
- <h3 class="name name-method" id="decodeObjects" translate="no">.<a href="#decodeObjects">decodeObjects</a><span class="signature">( buffer : <span class="param-type">ArrayBuffer</span>, url : <span class="param-type">string</span> )</span><span class="type-signature"> : Promise.<<a href="Object3D.html">Object3D</a>></span> </h3>
- <div class="method">
- <div class="description">
- <p>Decodes the 3DM asset data with a Web Worker.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>buffer</strong>
- </td>
- <td class="description last">
- <p>The raw 3DM asset data as an array buffer.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>url</strong>
- </td>
- <td class="description last">
- <p>The asset URL.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolved with the decoded 3D object.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Frees internal resources. This method should be called
- when the loader is no longer required.</p>
- </div>
- </div>
- <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"><a href="global.html#onProgressCallback">onProgressCallback</a></span>, onError : <span class="param-type"><a href="global.html#onErrorCallback">onErrorCallback</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Starts loading from the given URL and passes the loaded 3DM asset
- to the <code>onLoad()</code> callback.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>url</strong>
- </td>
- <td class="description last">
- <p>The path/URL of the file to be loaded. This can also be a data URI.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>onLoad</strong>
- </td>
- <td class="description last">
- <p>Executed when the loading process has been finished.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>onProgress</strong>
- </td>
- <td class="description last">
- <p>Executed while the loading is in progress.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>onError</strong>
- </td>
- <td class="description last">
- <p>Executed when errors occur.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( data : <span class="param-type">ArrayBuffer</span>, onLoad : <span class="param-type">function</span>, onError : <span class="param-type"><a href="global.html#onErrorCallback">onErrorCallback</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Parses the given 3DM data and passes the loaded 3DM asset
- to the <code>onLoad()</code> callback.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>data</strong>
- </td>
- <td class="description last">
- <p>The raw 3DM asset data as an array buffer.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>onLoad</strong>
- </td>
- <td class="description last">
- <p>Executed when the loading process has been finished.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>onError</strong>
- </td>
- <td class="description last">
- <p>Executed when errors occur.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#parse">Loader#parse</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setLibraryPath" translate="no">.<a href="#setLibraryPath">setLibraryPath</a><span class="signature">( path : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Rhino3dmLoader.html">Rhino3dmLoader</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Path to a folder containing the JS and WASM libraries.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>path</strong>
- </td>
- <td class="description last">
- <p>The library path to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this loader.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setWorkerLimit" translate="no">.<a href="#setWorkerLimit">setWorkerLimit</a><span class="signature">( workerLimit : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Rhino3dmLoader.html">Rhino3dmLoader</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the maximum number of Web Workers to be used during decoding.
- A lower limit may be preferable if workers are also for other
- tasks in the application.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>workerLimit</strong>
- </td>
- <td class="description last">
- <p>The worker limit.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this loader.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/3DMLoader.js" translate="no" target="_blank" rel="noopener">examples/jsm/loaders/3DMLoader.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|