DirectionalLightHelper.html 5.1 KB

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