USDZExporter.html 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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" rel="noopener">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.</p>
  39. <p>Default is <code>null</code>.</p>
  40. </div>
  41. </div>
  42. <h2 class="subsection-title">Methods</h2>
  43. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( scene : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, onDone : <span class="param-type"><a href="USDZExporter.html#~OnDone">USDZExporter~OnDone</a></span>, onError : <span class="param-type"><a href="USDZExporter.html#~OnError">USDZExporter~OnError</a></span>, options : <span class="param-type"><a href="USDZExporter.html#~Options">USDZExporter~Options</a></span> )</span> </h3>
  44. <div class="method">
  45. <div class="description">
  46. <p>Parse the given 3D object and generates the USDZ output.</p>
  47. </div>
  48. <table class="params">
  49. <tbody>
  50. <tr>
  51. <td class="name">
  52. <strong>scene</strong>
  53. </td>
  54. <td class="description last">
  55. <p>The 3D object to export.</p>
  56. </td>
  57. </tr>
  58. <tr>
  59. <td class="name">
  60. <strong>onDone</strong>
  61. </td>
  62. <td class="description last">
  63. <p>A callback function that is executed when the export has finished.</p>
  64. </td>
  65. </tr>
  66. <tr>
  67. <td class="name">
  68. <strong>onError</strong>
  69. </td>
  70. <td class="description last">
  71. <p>A callback function that is executed when an error happens.</p>
  72. </td>
  73. </tr>
  74. <tr>
  75. <td class="name">
  76. <strong>options</strong>
  77. </td>
  78. <td class="description last">
  79. <p>The export options.</p>
  80. </td>
  81. </tr>
  82. </tbody>
  83. </table>
  84. </div>
  85. <h3 class="name name-method" id="parseAsync" translate="no">.<a href="#parseAsync">parseAsync</a><span class="signature">( scene : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, options : <span class="param-type"><a href="USDZExporter.html#~Options">USDZExporter~Options</a></span> )</span><span class="type-signature"> : Promise.&lt;ArrayBuffer></span> <span class="type-signature">(async) </span></h3>
  86. <div class="method">
  87. <div class="description">
  88. <p>Async version of <a href="USDZExporter.html#parse">USDZExporter#parse</a>.</p>
  89. </div>
  90. <table class="params">
  91. <tbody>
  92. <tr>
  93. <td class="name">
  94. <strong>scene</strong>
  95. </td>
  96. <td class="description last">
  97. <p>The 3D object to export.</p>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td class="name">
  102. <strong>options</strong>
  103. </td>
  104. <td class="description last">
  105. <p>The export options.</p>
  106. </td>
  107. </tr>
  108. </tbody>
  109. </table>
  110. <dl class="details">
  111. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolved with the exported USDZ data.</dt>
  112. </dl>
  113. </div>
  114. <h3 class="name name-method" id="setTextureUtils" translate="no">.<a href="#setTextureUtils">setTextureUtils</a><span class="signature">( utils : <span class="param-type"><a href="WebGLTextureUtils.html">WebGLTextureUtils</a> | <a href="WebGPUTextureUtils.html">WebGPUTextureUtils</a></span> )</span> </h3>
  115. <div class="method">
  116. <div class="description">
  117. <p>Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.</p>
  118. <p>Depending on whether you use <a href="WebGLRenderer.html">WebGLRenderer</a> or <a href="WebGPURenderer.html">WebGPURenderer</a>, you must inject the
  119. corresponding texture utils <a href="WebGLTextureUtils.html">WebGLTextureUtils</a> or <a href="WebGPUTextureUtils.html">WebGPUTextureUtils</a>.</p>
  120. </div>
  121. <table class="params">
  122. <tbody>
  123. <tr>
  124. <td class="name">
  125. <strong>utils</strong>
  126. </td>
  127. <td class="description last">
  128. <p>The texture utils.</p>
  129. </td>
  130. </tr>
  131. </tbody>
  132. </table>
  133. </div>
  134. <h2 class="subsection-title">Type Definitions</h2>
  135. <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>
  136. <div class="method">
  137. <div class="description">
  138. <p>onDone callback of <code>USDZExporter</code>.</p>
  139. </div>
  140. <table class="params">
  141. <tbody>
  142. <tr>
  143. <td class="name">
  144. <strong>result</strong>
  145. </td>
  146. <td class="description last">
  147. <p>The generated USDZ.</p>
  148. </td>
  149. </tr>
  150. </tbody>
  151. </table>
  152. </div>
  153. <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>
  154. <div class="method">
  155. <div class="description">
  156. <p>onError callback of <code>USDZExporter</code>.</p>
  157. </div>
  158. <table class="params">
  159. <tbody>
  160. <tr>
  161. <td class="name">
  162. <strong>error</strong>
  163. </td>
  164. <td class="description last">
  165. <p>The error object.</p>
  166. </td>
  167. </tr>
  168. </tbody>
  169. </table>
  170. </div>
  171. <div class="member">
  172. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  173. <div class="description">
  174. <p>Export options of <code>USDZExporter</code>.</p>
  175. </div>
  176. <table class="props">
  177. <tbody>
  178. <tr>
  179. <td class="name">
  180. <strong>maxTextureSize</strong>
  181. <br>
  182. <span class="param-type">number</span>
  183. </td>
  184. <td class="description last">
  185. <p>The maximum texture size that is going to be exported.</p>
  186. <p>Default is <code>1024</code>.</p>
  187. </td>
  188. </tr>
  189. <tr>
  190. <td class="name">
  191. <strong>includeAnchoringProperties</strong>
  192. <br>
  193. <span class="param-type">boolean</span>
  194. </td>
  195. <td class="description last">
  196. <p>Whether to include anchoring properties or not.</p>
  197. <p>Default is <code>true</code>.</p>
  198. </td>
  199. </tr>
  200. <tr>
  201. <td class="name">
  202. <strong>onlyVisible</strong>
  203. <br>
  204. <span class="param-type">boolean</span>
  205. </td>
  206. <td class="description last">
  207. <p>Export only visible 3D objects.</p>
  208. <p>Default is <code>true</code>.</p>
  209. </td>
  210. </tr>
  211. <tr>
  212. <td class="name">
  213. <strong>ar</strong>
  214. <br>
  215. <span class="param-type">Object</span>
  216. </td>
  217. <td class="description last">
  218. <p>If <code>includeAnchoringProperties</code> is set to <code>true</code>, the anchoring type and alignment
  219. can be configured via <code>ar.anchoring.type</code> and <code>ar.planeAnchoring.alignment</code>.</p>
  220. </td>
  221. </tr>
  222. <tr>
  223. <td class="name">
  224. <strong>quickLookCompatible</strong>
  225. <br>
  226. <span class="param-type">boolean</span>
  227. </td>
  228. <td class="description last">
  229. <p>Whether to make the exported USDZ compatible to QuickLook
  230. which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback).</p>
  231. <p>Default is <code>false</code>.</p>
  232. </td>
  233. </tr>
  234. </tbody>
  235. </table>
  236. </div>
  237. <h2 class="subsection-title">Source</h2>
  238. <p>
  239. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/USDZExporter.js" translate="no" target="_blank" rel="noopener">examples/jsm/exporters/USDZExporter.js</a>
  240. </p>
  241. </article>
  242. </section>
  243. <script src="../scripts/linenumber.js"></script>
  244. <script src="../scripts/page.js"></script>
  245. </body>
  246. </html>
粤ICP备19079148号