2
0

DirectionalLight.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Object3D] &rarr; [page:Light] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">
  14. Affects objects using [page:MeshLambertMaterial] or [page:MeshPhongMaterial].
  15. </div>
  16. <h2>Example</h2>
  17. <div>[example:canvas_morphtargets_horse morphtargets / horse ]</div>
  18. <div>[example:misc_controls_fly controls / fly ]</div>
  19. <div>[example:misc_lights_test lights / test ]</div>
  20. <div>[example:vr_cubes cubes ]</div>
  21. <div>[example:webgl_effects_parallaxbarrier effects / parallaxbarrier ]</div>
  22. <div>[example:webgl_effects_stereo effects / stereo ]</div>
  23. <div>[example:webgl_geometry_extrude_splines geometry / extrude / splines ]</div>
  24. <div>[example:webgl_materials_bumpmap materials / bumpmap ]</div>
  25. <div>[example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection ]</div>
  26. <code>// White directional light at half intensity shining from the top.
  27. var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
  28. directionalLight.position.set( 0, 1, 0 );
  29. scene.add( directionalLight );</code>
  30. <h2>Constructor</h2>
  31. <h3>[name]([page:Integer hex], [page:Float intensity])</h3>
  32. <div>
  33. [page:Integer hex] -- Numeric value of the RGB component of the color. <br />
  34. [page:Float intensity] -- Numeric value of the light's strength/intensity.
  35. </div>
  36. <div>
  37. Creates a light that shines from a specific direction not from a specific position. This light will behave
  38. as though it is infinitely far away and the rays produced from it are all parallel. The best
  39. analogy would be a light source that acts like the sun: the sun is so far away that all sunlight
  40. hitting objects comes from the same angle.
  41. </div>
  42. <h2>Properties</h2>
  43. <h3>[property:Object3D target]</h3>
  44. <div>
  45. Target used for shadow camera orientation.
  46. </div>
  47. <h3>[property:Float intensity]</h3>
  48. <div>
  49. Light's intensity.<br />
  50. Default — *1.0*.
  51. </div>
  52. <h3>[property:Boolean onlyShadow]</h3>
  53. <div>
  54. If set to *true* light will only cast shadow but not contribute any lighting (as if *intensity* was 0 but cheaper to compute).<br />
  55. Default — *false*.
  56. </div>
  57. <h3>[property:Boolean castShadow]</h3>
  58. <div>
  59. If set to true light will cast dynamic shadows. Warning: This is expensive and requires tweaking to get shadows looking right.<br />
  60. Default — *false*.
  61. </div>
  62. <h3>[property:Float shadowCameraNear]</h3>
  63. <div>
  64. Orthographic shadow camera frustum parameter.<br />
  65. Default — *50*.
  66. </div>
  67. <h3>[property:Float shadowCameraFar]</h3>
  68. <div>
  69. Orthographic shadow camera frustum parameter.<br />
  70. Default — *5000*.
  71. </div>
  72. <h3>[property:Float shadowCameraLeft]</h3>
  73. <div>
  74. Orthographic shadow camera frustum parameter.<br />
  75. Default — *-500*.
  76. </div>
  77. <h3>[property:Float shadowCameraRight]</h3>
  78. <div>
  79. Orthographic shadow camera frustum parameter.<br />
  80. Default — *500*.
  81. </div>
  82. <h3>[property:Float shadowCameraTop]</h3>
  83. <div>
  84. Orthographic shadow camera frustum parameter.<br />
  85. Default — *500*.
  86. </div>
  87. <h3>[property:Float shadowCameraBottom]</h3>
  88. <div>
  89. Orthographic shadow camera frustum parameter.<br />
  90. Default — *-500*.
  91. </div>
  92. <h3>[property:Boolean shadowCameraVisible]</h3>
  93. <div>
  94. Show debug shadow camera frustum.<br />
  95. Default — *false*.
  96. </div>
  97. <h3>[property:Float shadowBias]</h3>
  98. <div>
  99. Shadow map bias, how much to add or subtract from the normalized depth when deciding whether a surface is in shadow.<br />
  100. Default — *0*.
  101. </div>
  102. <h3>[property:Integer shadowMapWidth]</h3>
  103. <div>
  104. Shadow map texture width in pixels.<br />
  105. Default — *512*.
  106. </div>
  107. <h3>[property:Integer shadowMapHeight]</h3>
  108. <div>
  109. Shadow map texture height in pixels.<br />
  110. Default — *512*.
  111. </div>
  112. <h3>[property:Vector2 shadowMapSize]</h3>
  113. <div>
  114. The shadowMapWidth and shadowMapHeight stored in a [page:Vector2 THREE.Vector2]. Set internally during rendering.
  115. </div>
  116. <h3>[property:OrthographicCamera shadowCamera]</h3>
  117. <div>
  118. The shadow's view of the world. Computed internally during rendering from the shadowCamera* settings.
  119. </div>
  120. <h3>[property:Matrix4 shadowMatrix]</h3>
  121. <div>
  122. Model to shadow camera space, to compute location and depth in shadow map. Computed internally during rendering.
  123. </div>
  124. <h3>[property:WebGLRenderTarget shadowMap]</h3>
  125. <div>
  126. The depth map generated using the shadowCamera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.
  127. </div>
  128. <h2>Methods</h2>
  129. <h3>[method:DirectionalLight clone]()</h3>
  130. <div>
  131. It returns a clone of DirectionalLight.
  132. </div>
  133. <h3>[method:JSON toJSON]()</h3>
  134. <div>
  135. Return DirectionalLight data in JSON format.
  136. </div>
  137. <h2>Source</h2>
  138. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  139. </body>
  140. </html>