| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>SceneOptimizer - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <h1 translate="no">SceneOptimizer</h1>
- <section>
- <header>
- <div class="class-description"><p>This class can be used to optimized scenes by converting
- individual meshes into <a href="BatchedMesh.html">BatchedMesh</a>. This component
- is an experimental attempt to implement auto-batching in three.js.</p></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <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>
- <pre><code class="language-js">import { SceneOptimizer } from 'three/addons/utils/SceneOptimizer.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <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>
- <div class="method">
- <div class="description">
- <p>Constructs a new scene optimizer.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>scene</strong>
- </td>
- <td class="description last">
- <p>The scene to optimize.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>options</strong>
- </td>
- <td class="description last">
- <p>The configuration options.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="disposeMeshes" translate="no">.<a href="#disposeMeshes">disposeMeshes</a><span class="signature">( meshesToRemove : <span class="param-type">Set.<<a href="Mesh.html">Mesh</a>></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Removes the given array of meshes from the scene.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>meshesToRemove</strong>
- </td>
- <td class="description last">
- <p>The meshes to remove.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Removes empty nodes from all descendants of the given 3D object.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The 3D object to process.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Performs the auto-baching by identifying groups of meshes in the scene
- that can be represented as a single <a href="BatchedMesh.html">BatchedMesh</a>. The method modifies
- the scene by adding instances of <code>BatchedMesh</code> and removing the now redundant
- individual meshes.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The optimized scene.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Performs the auto-instancing by identifying groups of meshes in the scene
- that can be represented as a single <a href="InstancedMesh.html">InstancedMesh</a>. The method modifies
- the scene by adding instances of <code>InstancedMesh</code> and removing the now redundant
- individual meshes.</p>
- <p>This method is not yet implemented.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The optimized scene.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Type Definitions</h2>
- <div class="member">
- <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
- <div class="description">
- <p>Constructor options of <code>SceneOptimizer</code>.</p>
- </div>
- <table class="props">
- <tbody>
- <tr>
- <td class="name">
- <strong>debug</strong>
- <br>
- <span class="param-type">boolean</span>
- </td>
- <td class="description last">
- <p>Whether to enable debug mode or not.</p>
- <p>Default is <code>false</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <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>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|