SceneOptimizer.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SceneOptimizer - 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">SceneOptimizer</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>This class can be used to optimized scenes by converting
  16. individual meshes into <a href="BatchedMesh.html">BatchedMesh</a>. This component
  17. is an experimental attempt to implement auto-batching in three.js.</p></div>
  18. </header>
  19. <article>
  20. <h2 class="subsection-title">Import</h2>
  21. <p><span translate="no">SceneOptimizer</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>
  22. <pre><code class="language-js">import { SceneOptimizer } from 'three/addons/utils/SceneOptimizer.js';</code></pre>
  23. <div class="container-overview">
  24. <h2>Constructor</h2>
  25. <h3 class="name name-method" id="SceneOptimizer" translate="no">new <a href="#SceneOptimizer">SceneOptimizer</a><span class="signature">( scene : <span class="param-type"><a href="Scene.html">Scene</a></span>, options : <span class="param-type"><a href="SceneOptimizer.html#~Options">SceneOptimizer~Options</a></span> )</span> </h3>
  26. <div class="method">
  27. <div class="description">
  28. <p>Constructs a new scene optimizer.</p>
  29. </div>
  30. <table class="params">
  31. <tbody>
  32. <tr>
  33. <td class="name">
  34. <strong>scene</strong>
  35. </td>
  36. <td class="description last">
  37. <p>The scene to optimize.</p>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td class="name">
  42. <strong>options</strong>
  43. </td>
  44. <td class="description last">
  45. <p>The configuration options.</p>
  46. </td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. </div>
  51. </div>
  52. <h2 class="subsection-title">Methods</h2>
  53. <h3 class="name name-method" id="disposeMeshes" translate="no">.<a href="#disposeMeshes">disposeMeshes</a><span class="signature">( meshesToRemove : <span class="param-type">Set.&lt;<a href="Mesh.html">Mesh</a>></span> )</span> </h3>
  54. <div class="method">
  55. <div class="description">
  56. <p>Removes the given array of meshes from the scene.</p>
  57. </div>
  58. <table class="params">
  59. <tbody>
  60. <tr>
  61. <td class="name">
  62. <strong>meshesToRemove</strong>
  63. </td>
  64. <td class="description last">
  65. <p>The meshes to remove.</p>
  66. </td>
  67. </tr>
  68. </tbody>
  69. </table>
  70. </div>
  71. <h3 class="name name-method" id="removeEmptyNodes" translate="no">.<a href="#removeEmptyNodes">removeEmptyNodes</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span> </h3>
  72. <div class="method">
  73. <div class="description">
  74. <p>Removes empty nodes from all descendants of the given 3D object.</p>
  75. </div>
  76. <table class="params">
  77. <tbody>
  78. <tr>
  79. <td class="name">
  80. <strong>object</strong>
  81. </td>
  82. <td class="description last">
  83. <p>The 3D object to process.</p>
  84. </td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. </div>
  89. <h3 class="name name-method" id="toBatchedMesh" translate="no">.<a href="#toBatchedMesh">toBatchedMesh</a><span class="signature">()</span><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  90. <div class="method">
  91. <div class="description">
  92. <p>Performs the auto-baching by identifying groups of meshes in the scene
  93. that can be represented as a single <a href="BatchedMesh.html">BatchedMesh</a>. The method modifies
  94. the scene by adding instances of <code>BatchedMesh</code> and removing the now redundant
  95. individual meshes.</p>
  96. </div>
  97. <dl class="details">
  98. <dt class="tag-returns"><strong>Returns:</strong> The optimized scene.</dt>
  99. </dl>
  100. </div>
  101. <h3 class="name name-method" id="toInstancingMesh" translate="no">.<a href="#toInstancingMesh">toInstancingMesh</a><span class="signature">()</span><span class="type-signature"> : <a href="Scene.html">Scene</a></span> <span class="type-signature">(abstract) </span></h3>
  102. <div class="method">
  103. <div class="description">
  104. <p>Performs the auto-instancing by identifying groups of meshes in the scene
  105. that can be represented as a single <a href="InstancedMesh.html">InstancedMesh</a>. The method modifies
  106. the scene by adding instances of <code>InstancedMesh</code> and removing the now redundant
  107. individual meshes.</p>
  108. <p>This method is not yet implemented.</p>
  109. </div>
  110. <dl class="details">
  111. <dt class="tag-returns"><strong>Returns:</strong> The optimized scene.</dt>
  112. </dl>
  113. </div>
  114. <h2 class="subsection-title">Type Definitions</h2>
  115. <div class="member">
  116. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  117. <div class="description">
  118. <p>Constructor options of <code>SceneOptimizer</code>.</p>
  119. </div>
  120. <table class="props">
  121. <tbody>
  122. <tr>
  123. <td class="name">
  124. <strong>debug</strong>
  125. <br>
  126. <span class="param-type">boolean</span>
  127. </td>
  128. <td class="description last">
  129. <p>Whether to enable debug mode or not.</p>
  130. <p>Default is <code>false</code>.</p>
  131. </td>
  132. </tr>
  133. </tbody>
  134. </table>
  135. </div>
  136. <h2 class="subsection-title">Source</h2>
  137. <p>
  138. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SceneOptimizer.js" translate="no" target="_blank" rel="noopener">examples/jsm/utils/SceneOptimizer.js</a>
  139. </p>
  140. </article>
  141. </section>
  142. <script src="../scripts/linenumber.js"></script>
  143. <script src="../scripts/page.js"></script>
  144. </body>
  145. </html>
粤ICP备19079148号