PLYExporter.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>PLYExporter - 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">PLYExporter</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>An exporter for PLY.</p>
  16. <p>PLY (Polygon or Stanford Triangle Format) is a file format for efficient delivery and
  17. loading of simple, static 3D content in a dense format. Both binary and ascii formats are
  18. supported. PLY can store vertex positions, colors, normals and uv coordinates. No textures
  19. or texture references are saved.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const exporter = new PLYExporter();
  22. const data = exporter.parse( scene, options );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <h2 class="subsection-title">Import</h2>
  27. <p><span translate="no">PLYExporter</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>
  28. <pre><code class="language-js">import { PLYExporter } from 'three/addons/exporters/PLYExporter.js';</code></pre>
  29. <div class="container-overview">
  30. <h2>Constructor</h2>
  31. <h3 class="name name-method" id="PLYExporter" translate="no">new <a href="#PLYExporter">PLYExporter</a><span class="signature">()</span> </h3>
  32. <div class="method">
  33. </div>
  34. </div>
  35. <h2 class="subsection-title">Methods</h2>
  36. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, onDone : <span class="param-type"><a href="PLYExporter.html#~OnDone">PLYExporter~OnDone</a></span>, options : <span class="param-type"><a href="PLYExporter.html#~Options">PLYExporter~Options</a></span> )</span><span class="type-signature"> : string | ArrayBuffer</span> </h3>
  37. <div class="method">
  38. <div class="description">
  39. <p>Parses the given 3D object and generates the PLY output.</p>
  40. <p>If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file.</p>
  41. </div>
  42. <table class="params">
  43. <tbody>
  44. <tr>
  45. <td class="name">
  46. <strong translate="no">object</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The 3D object to export.</p>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="name">
  54. <strong translate="no">onDone</strong>
  55. </td>
  56. <td class="description last">
  57. <p>A callback function that is executed when the export has finished.</p>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td class="name">
  62. <strong translate="no">options</strong>
  63. </td>
  64. <td class="description last">
  65. <p>The export options.</p>
  66. </td>
  67. </tr>
  68. </tbody>
  69. </table>
  70. <dl class="details">
  71. <dt class="tag-returns"><strong>Returns:</strong> The exported PLY.</dt>
  72. </dl>
  73. </div>
  74. <h2 class="subsection-title">Type Definitions</h2>
  75. <h3 class="name name-method" id="~OnDone" translate="no">.<a href="#~OnDone">OnDone</a><span class="signature">( result : <span class="param-type">string | ArrayBuffer</span> )</span> </h3>
  76. <div class="method">
  77. <div class="description">
  78. <p>onDone callback of <code>PLYExporter</code>.</p>
  79. </div>
  80. <table class="params">
  81. <tbody>
  82. <tr>
  83. <td class="name">
  84. <strong translate="no">result</strong>
  85. </td>
  86. <td class="description last">
  87. <p>The generated PLY ascii or binary.</p>
  88. </td>
  89. </tr>
  90. </tbody>
  91. </table>
  92. </div>
  93. <div class="member">
  94. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  95. <div class="description">
  96. <p>Export options of <code>PLYExporter</code>.</p>
  97. </div>
  98. <table class="props">
  99. <tbody>
  100. <tr>
  101. <td class="name">
  102. <strong>binary</strong>
  103. <br>
  104. <span class="param-type">boolean</span>
  105. </td>
  106. <td class="description last">
  107. <p>Whether to export in binary format or ASCII.</p>
  108. <p>Default is <code>false</code>.</p>
  109. </td>
  110. </tr>
  111. <tr>
  112. <td class="name">
  113. <strong>excludeAttributes</strong>
  114. <br>
  115. <span class="param-type">Array.&lt;string></span>
  116. </td>
  117. <td class="description last">
  118. <p>Which properties to explicitly exclude from
  119. the exported PLY file. Valid values are <code>'color'</code>, <code>'normal'</code>, <code>'uv'</code>, and <code>'index'</code>. If triangle
  120. indices are excluded, then a point cloud is exported.</p>
  121. </td>
  122. </tr>
  123. <tr>
  124. <td class="name">
  125. <strong>littleEndian</strong>
  126. <br>
  127. <span class="param-type">boolean</span>
  128. </td>
  129. <td class="description last">
  130. <p>Whether the binary export uses little or big endian.</p>
  131. <p>Default is <code>false</code>.</p>
  132. </td>
  133. </tr>
  134. <tr>
  135. <td class="name">
  136. <strong>customPropertyMapping</strong>
  137. <br>
  138. <span class="param-type">Object.&lt;string, Array.&lt;string>></span>
  139. </td>
  140. <td class="description last">
  141. <p>A mapping that allows
  142. exporting custom buffer attributes as PLY vertex properties. Each entry maps a buffer attribute
  143. name to an array of PLY property names. The number of property names must match the item size
  144. of the buffer attribute. This is the inverse of <code>PLYLoader.setCustomPropertyNameMapping()</code>.</p>
  145. </td>
  146. </tr>
  147. </tbody>
  148. </table>
  149. </div>
  150. <h2 class="subsection-title">Source</h2>
  151. <p>
  152. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/PLYExporter.js" translate="no" target="_blank" rel="noopener">examples/jsm/exporters/PLYExporter.js</a>
  153. </p>
  154. </article>
  155. </section>
  156. <script src="../scripts/linenumber.js"></script>
  157. <script src="../scripts/page.js"></script>
  158. </body>
  159. </html>
粤ICP备19079148号