RectAreaLight.html 4.1 KB

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