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