USDZExporter.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>USDZExporter - 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. <h1 translate="no">USDZExporter</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>An exporter for USDZ.</p></div>
  16. <h2>Code Example</h2>
  17. <div translate="no"><pre><code class="language-js">const exporter = new USDZExporter();
  18. const arraybuffer = await exporter.parseAsync( scene );
  19. </code></pre></div>
  20. </header>
  21. <article>
  22. <h2 class="subsection-title">Import</h2>
  23. <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>
  24. <pre><code class="language-js">import { USDZExporter } from 'three/addons/exporters/USDZExporter.js';</code></pre>
  25. <div class="container-overview">
  26. <h2>Constructor</h2>
  27. <h3 class="name name-method" id="USDZExporter" translate="no">new <a href="#USDZExporter">USDZExporter</a><span class="signature">()</span> </h3>
  28. <div class="method">
  29. <div class="description">
  30. <p>Constructs a new USDZ exporter.</p>
  31. </div>
  32. </div>
  33. </div>
  34. <h2 class="subsection-title">Properties</h2>
  35. <div class="member">
  36. <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>
  37. <div class="description">
  38. <p>A reference to a texture utils module.<br/>Default is <code>null</code>.</p>
  39. </div>
  40. </div>
  41. <h2 class="subsection-title">Methods</h2>
  42. <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>
  43. <div class="method">
  44. <div class="description">
  45. <p>Parse the given 3D object and generates the USDZ output.</p>
  46. </div>
  47. <table class="params">
  48. <tbody>
  49. <tr>
  50. <td class="name"><code>scene</code></td>
  51. <td class="description last"><p>The 3D object to export.</p></td>
  52. </tr>
  53. <tr>
  54. <td class="name"><code>onDone</code></td>
  55. <td class="description last"><p>A callback function that is executed when the export has finished.</p></td>
  56. </tr>
  57. <tr>
  58. <td class="name"><code>onError</code></td>
  59. <td class="description last"><p>A callback function that is executed when an error happens.</p></td>
  60. </tr>
  61. <tr>
  62. <td class="name"><code>options</code></td>
  63. <td class="description last"><p>The export options.</p></td>
  64. </tr>
  65. </tbody>
  66. </table>
  67. </div>
  68. <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.&lt;ArrayBuffer></span> <span class="type-signature">(async) </span></h3>
  69. <div class="method">
  70. <div class="description">
  71. <p>Async version of <a href="USDZExporter.html#parse">USDZExporter#parse</a>.</p>
  72. </div>
  73. <table class="params">
  74. <tbody>
  75. <tr>
  76. <td class="name"><code>scene</code></td>
  77. <td class="description last"><p>The 3D object to export.</p></td>
  78. </tr>
  79. <tr>
  80. <td class="name"><code>options</code></td>
  81. <td class="description last"><p>The export options.</p></td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. <dl class="details">
  86. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolved with the exported USDZ data.</dt>
  87. </dl>
  88. </div>
  89. <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>
  90. <div class="method">
  91. <div class="description">
  92. <p>Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.</p>
  93. <p>Depending on whether you use <a href="WebGLRenderer.html">WebGLRenderer</a> or <a href="WebGPURenderer.html">WebGPURenderer</a>, you must inject the
  94. corresponding texture utils <a href="WebGLTextureUtils.html">WebGLTextureUtils</a> or <a href="WebGPUTextureUtils.html">WebGPUTextureUtils</a>.</p>
  95. </div>
  96. <table class="params">
  97. <tbody>
  98. <tr>
  99. <td class="name"><code>utils</code></td>
  100. <td class="description last"><p>The texture utils.</p></td>
  101. </tr>
  102. </tbody>
  103. </table>
  104. </div>
  105. <h2 class="subsection-title">Type Definitions</h2>
  106. <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>
  107. <div class="method">
  108. <div class="description">
  109. <p>onDone callback of <code>USDZExporter</code>.</p>
  110. </div>
  111. <table class="params">
  112. <tbody>
  113. <tr>
  114. <td class="name"><code>result</code></td>
  115. <td class="description last"><p>The generated USDZ.</p></td>
  116. </tr>
  117. </tbody>
  118. </table>
  119. </div>
  120. <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>
  121. <div class="method">
  122. <div class="description">
  123. <p>onError callback of <code>USDZExporter</code>.</p>
  124. </div>
  125. <table class="params">
  126. <tbody>
  127. <tr>
  128. <td class="name"><code>error</code></td>
  129. <td class="description last"><p>The error object.</p></td>
  130. </tr>
  131. </tbody>
  132. </table>
  133. </div>
  134. <div class="member">
  135. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  136. <div class="description">
  137. <p>Export options of <code>USDZExporter</code>.</p>
  138. </div>
  139. <h5 class="subsection-title">Properties:</h5>
  140. <table class="props">
  141. <thead>
  142. <tr>
  143. <th>Name</th>
  144. <th>Type</th>
  145. <th>Attributes</th>
  146. <th>Default</th>
  147. <th class="last">Description</th>
  148. </tr>
  149. </thead>
  150. <tbody>
  151. <tr>
  152. <td class="name"><code>maxTextureSize</code></td>
  153. <td class="type">
  154. <span class="param-type">number</span>
  155. </td>
  156. <td class="attributes">
  157. &lt;optional><br>
  158. </td>
  159. <td class="default">
  160. 1024
  161. </td>
  162. <td class="description last"><p>The maximum texture size that is going to be exported.</p></td>
  163. </tr>
  164. <tr>
  165. <td class="name"><code>includeAnchoringProperties</code></td>
  166. <td class="type">
  167. <span class="param-type">boolean</span>
  168. </td>
  169. <td class="attributes">
  170. &lt;optional><br>
  171. </td>
  172. <td class="default">
  173. true
  174. </td>
  175. <td class="description last"><p>Whether to include anchoring properties or not.</p></td>
  176. </tr>
  177. <tr>
  178. <td class="name"><code>onlyVisible</code></td>
  179. <td class="type">
  180. <span class="param-type">boolean</span>
  181. </td>
  182. <td class="attributes">
  183. &lt;optional><br>
  184. </td>
  185. <td class="default">
  186. true
  187. </td>
  188. <td class="description last"><p>Export only visible 3D objects.</p></td>
  189. </tr>
  190. <tr>
  191. <td class="name"><code>ar</code></td>
  192. <td class="type">
  193. <span class="param-type">Object</span>
  194. </td>
  195. <td class="attributes">
  196. &lt;optional><br>
  197. </td>
  198. <td class="default">
  199. </td>
  200. <td class="description last"><p>If <code>includeAnchoringProperties</code> is set to <code>true</code>, the anchoring type and alignment
  201. can be configured via <code>ar.anchoring.type</code> and <code>ar.planeAnchoring.alignment</code>.</p></td>
  202. </tr>
  203. <tr>
  204. <td class="name"><code>quickLookCompatible</code></td>
  205. <td class="type">
  206. <span class="param-type">boolean</span>
  207. </td>
  208. <td class="attributes">
  209. &lt;optional><br>
  210. </td>
  211. <td class="default">
  212. false
  213. </td>
  214. <td class="description last"><p>Whether to make the exported USDZ compatible to QuickLook
  215. which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback).</p></td>
  216. </tr>
  217. </tbody>
  218. </table>
  219. </div>
  220. <h2 class="subsection-title">Source</h2>
  221. <p>
  222. <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>
  223. </p>
  224. </article>
  225. </section>
  226. <script src="../scripts/linenumber.js"></script>
  227. <script src="../scripts/page.js"></script>
  228. </body>
  229. </html>
粤ICP备19079148号