SceneOptimizer.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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">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">Scene</span>, options : <span class="param-type">SceneOptimizer~Options</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"><code>scene</code></td>
  34. <td class="description last"><p>The scene to optimize.</p></td>
  35. </tr>
  36. <tr>
  37. <td class="name"><code>options</code></td>
  38. <td class="description last"><p>The configuration options.</p></td>
  39. </tr>
  40. </tbody>
  41. </table>
  42. </div>
  43. </div>
  44. <h2 class="subsection-title">Methods</h2>
  45. <h3 class="name name-method" id="disposeMeshes" translate="no">.<a href="#disposeMeshes">disposeMeshes</a><span class="signature">( meshesToRemove : <span class="param-type">Set.&lt;Mesh></span> )</span> </h3>
  46. <div class="method">
  47. <div class="description">
  48. <p>Removes the given array of meshes from the scene.</p>
  49. </div>
  50. <table class="params">
  51. <tbody>
  52. <tr>
  53. <td class="name"><code>meshesToRemove</code></td>
  54. <td class="description last"><p>The meshes to remove.</p></td>
  55. </tr>
  56. </tbody>
  57. </table>
  58. </div>
  59. <h3 class="name name-method" id="removeEmptyNodes" translate="no">.<a href="#removeEmptyNodes">removeEmptyNodes</a><span class="signature">( object : <span class="param-type">Object3D</span> )</span> </h3>
  60. <div class="method">
  61. <div class="description">
  62. <p>Removes empty nodes from all descendants of the given 3D object.</p>
  63. </div>
  64. <table class="params">
  65. <tbody>
  66. <tr>
  67. <td class="name"><code>object</code></td>
  68. <td class="description last"><p>The 3D object to process.</p></td>
  69. </tr>
  70. </tbody>
  71. </table>
  72. </div>
  73. <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>
  74. <div class="method">
  75. <div class="description">
  76. <p>Performs the auto-baching by identifying groups of meshes in the scene
  77. that can be represented as a single <a href="BatchedMesh.html">BatchedMesh</a>. The method modifies
  78. the scene by adding instances of <code>BatchedMesh</code> and removing the now redundant
  79. individual meshes.</p>
  80. </div>
  81. <dl class="details">
  82. <dt class="tag-returns"><strong>Returns:</strong> The optimized scene.</dt>
  83. </dl>
  84. </div>
  85. <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>
  86. <div class="method">
  87. <div class="description">
  88. <p>Performs the auto-instancing by identifying groups of meshes in the scene
  89. that can be represented as a single <a href="InstancedMesh.html">InstancedMesh</a>. The method modifies
  90. the scene by adding instances of <code>InstancedMesh</code> and removing the now redundant
  91. individual meshes.</p>
  92. <p>This method is not yet implemented.</p>
  93. </div>
  94. <dl class="details">
  95. <dt class="tag-returns"><strong>Returns:</strong> The optimized scene.</dt>
  96. </dl>
  97. </div>
  98. <h2 class="subsection-title">Type Definitions</h2>
  99. <div class="member">
  100. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  101. <div class="description">
  102. <p>Constructor options of <code>SceneOptimizer</code>.</p>
  103. </div>
  104. <h5 class="subsection-title">Properties:</h5>
  105. <table class="props">
  106. <thead>
  107. <tr>
  108. <th>Name</th>
  109. <th>Type</th>
  110. <th>Attributes</th>
  111. <th>Default</th>
  112. <th class="last">Description</th>
  113. </tr>
  114. </thead>
  115. <tbody>
  116. <tr>
  117. <td class="name"><code>debug</code></td>
  118. <td class="type">
  119. <span class="param-type">boolean</span>
  120. </td>
  121. <td class="attributes">
  122. &lt;optional><br>
  123. </td>
  124. <td class="default">
  125. false
  126. </td>
  127. <td class="description last"><p>Whether to enable debug mode or not.</p></td>
  128. </tr>
  129. </tbody>
  130. </table>
  131. </div>
  132. <h2 class="subsection-title">Source</h2>
  133. <p>
  134. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SceneOptimizer.js" target="_blank" rel="noopener" translate="no">examples/jsm/utils/SceneOptimizer.js</a>
  135. </p>
  136. </article>
  137. </section>
  138. <script src="../scripts/linenumber.js"></script>
  139. <script src="../scripts/page.js"></script>
  140. </body>
  141. </html>
粤ICP备19079148号