RoomEnvironment.html 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>RoomEnvironment - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → <a href="Scene.html">Scene</a> → </p>
  13. <h1 translate="no">RoomEnvironment</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class represents a scene with a basic room setup that can be used as
  17. input for <a href="PMREMGenerator.html#fromScene">PMREMGenerator#fromScene</a>. The resulting PMREM represents the room's
  18. lighting and can be used for Image Based Lighting by assigning it to <a href="Scene.html#environment">Scene#environment</a>
  19. or directly as an environment map to PBR materials.</p>
  20. <p>The implementation is based on the <a href="https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts" target="_blank" rel="noopener">EnvironmentScene</a>
  21. component from the <code>model-viewer</code> project.</p></div>
  22. <h2>Code Example</h2>
  23. <div translate="no"><pre><code class="language-js">const environment = new RoomEnvironment();
  24. const pmremGenerator = new THREE.PMREMGenerator( renderer );
  25. const envMap = pmremGenerator.fromScene( environment ).texture;
  26. scene.environment = envMap;
  27. </code></pre></div>
  28. </header>
  29. <article>
  30. <h2 class="subsection-title">Import</h2>
  31. <p><span translate="no">RoomEnvironment</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 { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';</code></pre>
  33. <div class="container-overview">
  34. <h2>Constructor</h2>
  35. <h3 class="name name-method" id="RoomEnvironment" translate="no">new <a href="#RoomEnvironment">RoomEnvironment</a><span class="signature">()</span> </h3>
  36. <div class="method">
  37. </div>
  38. </div>
  39. <h2 class="subsection-title">Methods</h2>
  40. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  41. <div class="method">
  42. <div class="description">
  43. <p>Frees internal resources. This method should be called
  44. when the environment is no longer required.</p>
  45. </div>
  46. </div>
  47. <h2 class="subsection-title">Source</h2>
  48. <p>
  49. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/environments/RoomEnvironment.js" translate="no" target="_blank" rel="noopener">examples/jsm/environments/RoomEnvironment.js</a>
  50. </p>
  51. </article>
  52. </section>
  53. <script src="../scripts/linenumber.js"></script>
  54. <script src="../scripts/page.js"></script>
  55. </body>
  56. </html>
粤ICP备19079148号