1
0

DRACOExporter.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>DRACOExporter - 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">DRACOExporter</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>An exporter to compress geometry with the Draco library.</p>
  16. <p><a href="https://google.github.io/draco/" target="_blank" rel="noopener">Draco</a> is an open source library for compressing and
  17. decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller,
  18. at the cost of additional decoding time on the client device.</p>
  19. <p>Standalone Draco files have a <code>.drc</code> extension, and contain vertex positions,
  20. normals, colors, and other attributes. Draco files <em>do not</em> contain materials,
  21. textures, animation, or node hierarchies – to use these features, embed Draco geometry
  22. inside of a glTF file. A normal glTF file can be converted to a Draco-compressed glTF file
  23. using <a href="https://github.com/AnalyticalGraphicsInc/gltf-pipeline" target="_blank" rel="noopener">glTF-Pipeline</a>.</p></div>
  24. <h2>Code Example</h2>
  25. <div translate="no"><pre><code class="language-js">const exporter = new DRACOExporter();
  26. const data = exporter.parse( mesh, options );
  27. </code></pre></div>
  28. </header>
  29. <article>
  30. <h2 class="subsection-title">Import</h2>
  31. <p><span translate="no">DRACOExporter</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>
  32. <pre><code class="language-js">import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js';</code></pre>
  33. <div class="container-overview">
  34. <h2>Constructor</h2>
  35. <h3 class="name name-method" id="DRACOExporter" translate="no">new <a href="#DRACOExporter">DRACOExporter</a><span class="signature">()</span> </h3>
  36. <div class="method">
  37. </div>
  38. </div>
  39. <h2 class="subsection-title">Properties</h2>
  40. <div class="member">
  41. <h3 class="name" id=".MESH_EDGEBREAKER_ENCODING" translate="no">.<a href="#.MESH_EDGEBREAKER_ENCODING">MESH_EDGEBREAKER_ENCODING</a><span class="type-signature"> : number</span> <span class="type-signature">(constant) </span></h3>
  42. <div class="description">
  43. <p>Edgebreaker encoding.</p>
  44. <p>Default is <code>1</code>.</p>
  45. </div>
  46. </div>
  47. <div class="member">
  48. <h3 class="name" id=".MESH_SEQUENTIAL_ENCODING" translate="no">.<a href="#.MESH_SEQUENTIAL_ENCODING">MESH_SEQUENTIAL_ENCODING</a><span class="type-signature"> : number</span> <span class="type-signature">(constant) </span></h3>
  49. <div class="description">
  50. <p>Sequential encoding.</p>
  51. <p>Default is <code>0</code>.</p>
  52. </div>
  53. </div>
  54. <h2 class="subsection-title">Methods</h2>
  55. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( object : <span class="param-type"><a href="Mesh.html">Mesh</a> | <a href="Points.html">Points</a></span>, options : <span class="param-type"><a href="DRACOExporter.html#~Options">DRACOExporter~Options</a></span> )</span><span class="type-signature"> : Int8Array</span> </h3>
  56. <div class="method">
  57. <div class="description">
  58. <p>Parses the given mesh or point cloud and generates the Draco output.</p>
  59. </div>
  60. <table class="params">
  61. <tbody>
  62. <tr>
  63. <td class="name">
  64. <strong>object</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The mesh or point cloud to export.</p>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td class="name">
  72. <strong>options</strong>
  73. </td>
  74. <td class="description last">
  75. <p>The export options.</p>
  76. </td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. <dl class="details">
  81. <dt class="tag-returns"><strong>Returns:</strong> The exported Draco.</dt>
  82. </dl>
  83. </div>
  84. <h2 class="subsection-title">Type Definitions</h2>
  85. <div class="member">
  86. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  87. <div class="description">
  88. <p>Export options of <code>DRACOExporter</code>.</p>
  89. </div>
  90. <table class="props">
  91. <tbody>
  92. <tr>
  93. <td class="name">
  94. <strong>decodeSpeed</strong>
  95. <br>
  96. <span class="param-type">number</span>
  97. </td>
  98. <td class="description last">
  99. <p>Indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality).</p>
  100. <p>Default is <code>5</code>.</p>
  101. </td>
  102. </tr>
  103. <tr>
  104. <td class="name">
  105. <strong>encodeSpeed</strong>
  106. <br>
  107. <span class="param-type">number</span>
  108. </td>
  109. <td class="description last">
  110. <p>Indicates how to tune the encoder parameters (0 gives better speed but worst quality).</p>
  111. <p>Default is <code>5</code>.</p>
  112. </td>
  113. </tr>
  114. <tr>
  115. <td class="name">
  116. <strong>encoderMethod</strong>
  117. <br>
  118. <span class="param-type">number</span>
  119. </td>
  120. <td class="description last">
  121. <p>Either sequential (very little compression) or Edgebreaker. Edgebreaker traverses the triangles of the mesh in a deterministic, spiral-like way which provides most of the benefits of this data format.</p>
  122. <p>Default is <code>1</code>.</p>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td class="name">
  127. <strong>quantization</strong>
  128. <br>
  129. <span class="param-type">Array.&lt;number></span>
  130. </td>
  131. <td class="description last">
  132. <p>Indicates the precision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC).</p>
  133. <p>Default is <code>[ 16, 8, 8, 8, 8 ]</code>.</p>
  134. </td>
  135. </tr>
  136. <tr>
  137. <td class="name">
  138. <strong>exportUvs</strong>
  139. <br>
  140. <span class="param-type">boolean</span>
  141. </td>
  142. <td class="description last">
  143. <p>Whether to export UVs or not.</p>
  144. <p>Default is <code>true</code>.</p>
  145. </td>
  146. </tr>
  147. <tr>
  148. <td class="name">
  149. <strong>exportNormals</strong>
  150. <br>
  151. <span class="param-type">boolean</span>
  152. </td>
  153. <td class="description last">
  154. <p>Whether to export normals or not.</p>
  155. <p>Default is <code>true</code>.</p>
  156. </td>
  157. </tr>
  158. <tr>
  159. <td class="name">
  160. <strong>exportColor</strong>
  161. <br>
  162. <span class="param-type">boolean</span>
  163. </td>
  164. <td class="description last">
  165. <p>Whether to export colors or not.</p>
  166. <p>Default is <code>false</code>.</p>
  167. </td>
  168. </tr>
  169. </tbody>
  170. </table>
  171. </div>
  172. <h2 class="subsection-title">Source</h2>
  173. <p>
  174. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/DRACOExporter.js" translate="no" target="_blank" rel="noopener">examples/jsm/exporters/DRACOExporter.js</a>
  175. </p>
  176. </article>
  177. </section>
  178. <script src="../scripts/linenumber.js"></script>
  179. <script src="../scripts/page.js"></script>
  180. </body>
  181. </html>
粤ICP备19079148号