RectAreaLight.html 4.6 KB

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