DirectionalLightHelper.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>DirectionalLightHelper - 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> → </p>
  13. <h1 translate="no">DirectionalLightHelper</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Helper object to assist with visualizing a <a href="DirectionalLight.html">DirectionalLight</a>'s
  17. effect on the scene. This consists of plane and a line representing the
  18. light's position and direction.</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">const light = new THREE.DirectionalLight( 0xFFFFFF );
  21. scene.add( light );
  22. const helper = new THREE.DirectionalLightHelper( light, 5 );
  23. scene.add( helper );
  24. </code></pre></div>
  25. </header>
  26. <article>
  27. <div class="container-overview">
  28. <h2>Constructor</h2>
  29. <h3 class="name name-method" id="DirectionalLightHelper" translate="no">new <a href="#DirectionalLightHelper">DirectionalLightHelper</a><span class="signature">( light : <span class="param-type">DirectionalLight</span>, size : <span class="param-type">number</span>, color : <span class="param-type">number | Color | string</span> )</span> </h3>
  30. <div class="method">
  31. <div class="description">
  32. <p>Constructs a new directional light helper.</p>
  33. </div>
  34. <table class="params">
  35. <tbody>
  36. <tr>
  37. <td class="name"><code>light</code></td>
  38. <td class="description last"><p>The light to be visualized.</p></td>
  39. </tr>
  40. <tr>
  41. <td class="name"><code>size</code></td>
  42. <td class="description last"><p>The dimensions of the plane.<br/>Default is <code>1</code>.</p></td>
  43. </tr>
  44. <tr>
  45. <td class="name"><code>color</code></td>
  46. <td class="description last"><p>The helper's color. If not set, the helper will take
  47. the color of the light.</p></td>
  48. </tr>
  49. </tbody>
  50. </table>
  51. </div>
  52. </div>
  53. <h2 class="subsection-title">Properties</h2>
  54. <div class="member">
  55. <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : number | <a href="Color.html">Color</a> | string</span> </h3>
  56. <div class="description">
  57. <p>The color parameter passed in the constructor.
  58. If not set, the helper will take the color of the light.</p>
  59. </div>
  60. </div>
  61. <div class="member">
  62. <h3 class="name" id="light" translate="no">.<a href="#light">light</a><span class="type-signature"> : <a href="DirectionalLight.html">DirectionalLight</a></span> </h3>
  63. <div class="description">
  64. <p>The light being visualized.</p>
  65. </div>
  66. </div>
  67. <div class="member">
  68. <h3 class="name" id="lightPlane" translate="no">.<a href="#lightPlane">lightPlane</a><span class="type-signature"> : <a href="Line.html">Line</a></span> </h3>
  69. <div class="description">
  70. <p>Contains the line showing the location of the directional light.</p>
  71. </div>
  72. </div>
  73. <div class="member">
  74. <h3 class="name" id="targetLine" translate="no">.<a href="#targetLine">targetLine</a><span class="type-signature"> : <a href="Line.html">Line</a></span> </h3>
  75. <div class="description">
  76. <p>Represents the target line of the directional light.</p>
  77. </div>
  78. </div>
  79. <h2 class="subsection-title">Methods</h2>
  80. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  81. <div class="method">
  82. <div class="description">
  83. <p>Frees the GPU-related resources allocated by this instance. Call this
  84. method whenever this instance is no longer used in your app.</p>
  85. </div>
  86. </div>
  87. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  88. <div class="method">
  89. <div class="description">
  90. <p>Updates the helper to match the position and direction of the
  91. light being visualized.</p>
  92. </div>
  93. </div>
  94. <h2 class="subsection-title">Source</h2>
  95. <p>
  96. <a href="https://github.com/mrdoob/three.js/blob/master/src/helpers/DirectionalLightHelper.js" target="_blank" rel="noopener" translate="no">src/helpers/DirectionalLightHelper.js</a>
  97. </p>
  98. </article>
  99. </section>
  100. <script src="../scripts/linenumber.js"></script>
  101. <script src="../scripts/page.js"></script>
  102. </body>
  103. </html>
粤ICP备19079148号