RectAreaLight.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. This light gets emitted uniformly across the face a rectangular plane. This can be
  15. used to simulate things like bright windows or strip lighting.<br /><br />
  16. This light can cast shadows - see the [page:RectAreaLightShadow] page for details.<br /><br />
  17. <em>NOTE:</em> this class is currently under active development and is probably not
  18. production ready yet (as of r83). Check back in a month or two! And feel free to try it out in the meantime.
  19. </div>
  20. <h2>Examples</h2>
  21. <div>
  22. [example:webgl_lights_arealight WebGL / arealight ]<br />
  23. [example:webgl_lights_rectarealight WebGL / rectarealight ]
  24. <code>
  25. var width = 2;
  26. var height = 10;
  27. var rectLight = new THREE.RectAreaLight( 0xffffff, undefined, width, height );
  28. rectLight.matrixAutoUpdate = true;
  29. rectLight.intensity = 70.0;
  30. rectLight.position.set( 5, 5, 0 );
  31. rectLightHelper = new THREE.RectAreaLightHelper( rectLight );
  32. rectLight.add( rectLightHelper );
  33. scene.add(rectLight)
  34. </code>
  35. </div>
  36. <h2>Constructor</h2>
  37. <h3>[name]( [page:Integer color], [page:Float intensity], [page:Float distance], [page:Radians angle], [page:Float penumbra], [page:Float decay] )</h3>
  38. <div>
  39. [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).<br />
  40. [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.<br /><br />
  41. [page:Float width] - (optional) width of the light. Default is 10.<br />
  42. [page:Float height] - (optional) height of the light. Default is 10.
  43. Creates a new [name].
  44. </div>
  45. <h2>Properties</h2>
  46. <div>
  47. See the base [page:Light Light] class for common properties.
  48. </div>
  49. <h3>[property:Boolean castShadow]</h3>
  50. <div>
  51. If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and
  52. requires tweaking to get shadows looking right. See the [page:RectAreaLightShadow] for details.
  53. The default is *false*.<br /><br />
  54. <em>Note:</em> this is not yet implemented for this light type! (r83)
  55. </div>
  56. <h3>[property:Float decay]</h3>
  57. <div>
  58. The amount the light dims along the distance of the light.<br />
  59. In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, decay = 2 leads to
  60. physically realistic light falloff. The default is *1*.<br /><br />
  61. <em>Note:</em> this is not yet implemented for this light type! (r83)
  62. </div>
  63. <h3>[property:Float distance]</h3>
  64. <div>
  65. If non-zero, light will attenuate linearly from maximum intensity at the light's
  66. position down to zero at this distance from the light. Default is *0.0*.<br /><br />
  67. <em>Note:</em> this is not yet implemented for this light type! (r83)
  68. </div>
  69. <h3>[property:Boolean isRectAreaLight]</h3>
  70. <div>
  71. Used to check whether this or derived classes are spot lights. Default is *true*.<br /><br />
  72. You should not change this, as it used internally for optimisation.
  73. </div>
  74. <h3>[property:Vector3 position]</h3>
  75. <div>
  76. This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
  77. </div>
  78. <h3>[property:RectAreaLightShadow shadow]</h3>
  79. <div>
  80. A [page:RectAreaLightShadow] used to calculate shadows for this light.<br /><br />
  81. <em>Note:</em> this is not yet implemented for this light type! (r83)
  82. </div>
  83. <h3>[property:Object3D target]</h3>
  84. <div>
  85. The RectAreaLight points from its [page:.position position] to target.position. The default
  86. position of the target is *(0, 0, 0)*.<br />
  87. *Note*: For the the target's position to be changed to anything other than the default,
  88. it must be added to the [page:Scene scene] using
  89. <code>
  90. scene.add( light.target );
  91. </code>
  92. This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically
  93. updated each frame.<br /><br />
  94. It is also possible to set the target to be another object in the scene (anything with a
  95. [page:Object3D.position position] property), like so:
  96. <code>
  97. var targetObject = new THREE.Object3D();
  98. scene.add(targetObject);
  99. light.target = targetObject;
  100. </code>
  101. The RectAreaLight will now track the target object.
  102. </div>
  103. <h2>Methods</h2>
  104. <div>
  105. See the base [page:Light Light] class for common methods.
  106. </div>
  107. <h3>[method:RectAreaLight copy]( [page:RectAreaLight source] )</h3>
  108. <div>
  109. Copies value of all the properties from the [page:RectAreaLight source] to this
  110. RectAreaLight.
  111. </div>
  112. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  113. </body>
  114. </html>