ColorEnvironment.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ColorEnvironment - 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">ColorEnvironment</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class represents a scene with a uniform color that can be used as
  17. input for <a href="PMREMGenerator.html#fromScene">PMREMGenerator#fromScene</a>. The resulting PMREM represents
  18. uniform ambient lighting and can be used for Image Based Lighting by
  19. assigning it to <a href="Scene.html#environment">Scene#environment</a>.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const environment = new ColorEnvironment( 0x00ff00 );
  22. const pmremGenerator = new THREE.PMREMGenerator( renderer );
  23. const envMap = pmremGenerator.fromScene( environment ).texture;
  24. scene.environment = envMap;
  25. </code></pre></div>
  26. </header>
  27. <article>
  28. <h2 class="subsection-title">Import</h2>
  29. <p><span translate="no">ColorEnvironment</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>
  30. <pre><code class="language-js">import { ColorEnvironment } from 'three/addons/environments/ColorEnvironment.js';</code></pre>
  31. <div class="container-overview">
  32. <h2>Constructor</h2>
  33. <h3 class="name name-method" id="ColorEnvironment" translate="no">new <a href="#ColorEnvironment">ColorEnvironment</a><span class="signature">( color : <span class="param-type">number | <a href="Color.html">Color</a></span> )</span> </h3>
  34. <div class="method">
  35. <div class="description">
  36. <p>Constructs a new color environment.</p>
  37. </div>
  38. <table class="params">
  39. <tbody>
  40. <tr>
  41. <td class="name">
  42. <strong translate="no">color</strong>
  43. </td>
  44. <td class="description last">
  45. <p>The color of the environment.</p>
  46. <p>Default is <code>16777215</code>.</p>
  47. </td>
  48. </tr>
  49. </tbody>
  50. </table>
  51. </div>
  52. </div>
  53. <h2 class="subsection-title">Methods</h2>
  54. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  55. <div class="method">
  56. <div class="description">
  57. <p>Frees internal resources. This method should be called
  58. when the environment is no longer required.</p>
  59. </div>
  60. </div>
  61. <h2 class="subsection-title">Source</h2>
  62. <p>
  63. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/environments/ColorEnvironment.js" translate="no" target="_blank" rel="noopener">examples/jsm/environments/ColorEnvironment.js</a>
  64. </p>
  65. </article>
  66. </section>
  67. <script src="../scripts/linenumber.js"></script>
  68. <script src="../scripts/page.js"></script>
  69. </body>
  70. </html>
粤ICP备19079148号