| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>USDZExporter - 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>
- <h1 translate="no">USDZExporter</h1>
- <section>
- <header>
- <div class="class-description"><p>An exporter for USDZ.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const exporter = new USDZExporter();
- const arraybuffer = await exporter.parseAsync( scene );
- </code></pre></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">USDZExporter</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
- <pre><code class="language-js">import { USDZExporter } from 'three/addons/exporters/USDZExporter.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="USDZExporter" translate="no">new <a href="#USDZExporter">USDZExporter</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new USDZ exporter.</p>
- </div>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="textureUtils" translate="no">.<a href="#textureUtils">textureUtils</a><span class="type-signature"> : <a href="WebGLTextureUtils.html">WebGLTextureUtils</a> | <a href="WebGPUTextureUtils.html">WebGPUTextureUtils</a></span> </h3>
- <div class="description">
- <p>A reference to a texture utils module.<br/>Default is <code>null</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( scene : <span class="param-type">Object3D</span>, onDone : <span class="param-type">USDZExporter~OnDone</span>, onError : <span class="param-type">USDZExporter~OnError</span>, options : <span class="param-type">USDZExporter~Options</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Parse the given 3D object and generates the USDZ output.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>scene</code></td>
- <td class="description last"><p>The 3D object to export.</p></td>
- </tr>
- <tr>
- <td class="name"><code>onDone</code></td>
- <td class="description last"><p>A callback function that is executed when the export has finished.</p></td>
- </tr>
- <tr>
- <td class="name"><code>onError</code></td>
- <td class="description last"><p>A callback function that is executed when an error happens.</p></td>
- </tr>
- <tr>
- <td class="name"><code>options</code></td>
- <td class="description last"><p>The export options.</p></td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="parseAsync" translate="no">.<a href="#parseAsync">parseAsync</a><span class="signature">( scene : <span class="param-type">Object3D</span>, options : <span class="param-type">USDZExporter~Options</span> )</span><span class="type-signature"> : Promise.<ArrayBuffer></span> <span class="type-signature">(async) </span></h3>
- <div class="method">
- <div class="description">
- <p>Async version of <a href="USDZExporter.html#parse">USDZExporter#parse</a>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>scene</code></td>
- <td class="description last"><p>The 3D object to export.</p></td>
- </tr>
- <tr>
- <td class="name"><code>options</code></td>
- <td class="description last"><p>The export options.</p></td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolved with the exported USDZ data.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setTextureUtils" translate="no">.<a href="#setTextureUtils">setTextureUtils</a><span class="signature">( utils : <span class="param-type">WebGLTextureUtils | WebGPUTextureUtils</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.</p>
- <p>Depending on whether you use <a href="WebGLRenderer.html">WebGLRenderer</a> or <a href="WebGPURenderer.html">WebGPURenderer</a>, you must inject the
- corresponding texture utils <a href="WebGLTextureUtils.html">WebGLTextureUtils</a> or <a href="WebGPUTextureUtils.html">WebGPUTextureUtils</a>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>utils</code></td>
- <td class="description last"><p>The texture utils.</p></td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Type Definitions</h2>
- <h3 class="name name-method" id="~OnDone" translate="no">.<a href="#~OnDone">OnDone</a><span class="signature">( result : <span class="param-type">ArrayBuffer</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>onDone callback of <code>USDZExporter</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>result</code></td>
- <td class="description last"><p>The generated USDZ.</p></td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="~OnError" translate="no">.<a href="#~OnError">OnError</a><span class="signature">( error : <span class="param-type">Error</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>onError callback of <code>USDZExporter</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>error</code></td>
- <td class="description last"><p>The error object.</p></td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="member">
- <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
- <div class="description">
- <p>Export options of <code>USDZExporter</code>.</p>
- </div>
- <h5 class="subsection-title">Properties:</h5>
- <table class="props">
- <thead>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Attributes</th>
- <th>Default</th>
- <th class="last">Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="name"><code>maxTextureSize</code></td>
- <td class="type">
- <span class="param-type">number</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- 1024
- </td>
- <td class="description last"><p>The maximum texture size that is going to be exported.</p></td>
- </tr>
- <tr>
- <td class="name"><code>includeAnchoringProperties</code></td>
- <td class="type">
- <span class="param-type">boolean</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- true
- </td>
- <td class="description last"><p>Whether to include anchoring properties or not.</p></td>
- </tr>
- <tr>
- <td class="name"><code>onlyVisible</code></td>
- <td class="type">
- <span class="param-type">boolean</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- true
- </td>
- <td class="description last"><p>Export only visible 3D objects.</p></td>
- </tr>
- <tr>
- <td class="name"><code>ar</code></td>
- <td class="type">
- <span class="param-type">Object</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- </td>
- <td class="description last"><p>If <code>includeAnchoringProperties</code> is set to <code>true</code>, the anchoring type and alignment
- can be configured via <code>ar.anchoring.type</code> and <code>ar.planeAnchoring.alignment</code>.</p></td>
- </tr>
- <tr>
- <td class="name"><code>quickLookCompatible</code></td>
- <td class="type">
- <span class="param-type">boolean</span>
- </td>
- <td class="attributes">
- <optional><br>
- </td>
- <td class="default">
- false
- </td>
- <td class="description last"><p>Whether to make the exported USDZ compatible to QuickLook
- which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback).</p></td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/USDZExporter.js" target="_blank" rel="noopener" translate="no">examples/jsm/exporters/USDZExporter.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|