PointLight.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Object3D] &rarr; [page:Light] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. A light that gets emitted from a single point in all directions. A common use case for this
  14. is to replicate the light emitted from a bare lightbulb.<br /><br />
  15. This light can cast shadows - see [page:PointLightShadow] page for details.
  16. </p>
  17. <h2>Code Example</h2>
  18. <code>
  19. const light = new THREE.PointLight( 0xff0000, 1, 100 );
  20. light.position.set( 50, 50, 50 );
  21. scene.add( light );
  22. </code>
  23. <h2>Examples</h2>
  24. <p>
  25. [example:webgl_lights_pointlights lights / pointlights ]<br />
  26. [example:webgl_effects_anaglyph effects / anaglyph ]<br />
  27. [example:webgl_geometry_text geometry / text ]<br />
  28. [example:webgl_lensflares lensflares ]
  29. </p>
  30. <h2>Constructor</h2>
  31. <h3>[name]( [param:Integer color], [param:Float intensity], [param:Number distance], [param:Float decay] )</h3>
  32. <p>
  33. [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).<br />
  34. [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.<br />
  35. [page:Number distance] - Maximum range of the light. Default is 0 (no limit).<br />
  36. [page:Float decay] - The amount the light dims along the distance of the light. Default is 2.<br /><br />
  37. Creates a new [name].
  38. </p>
  39. <h2>Properties</h2>
  40. <p>
  41. See the base [page:Light Light] class for common properties.
  42. </p>
  43. <h3>[property:Boolean castShadow]</h3>
  44. <p>
  45. If set to `true` light will cast dynamic shadows. *Warning*: This is expensive and
  46. requires tweaking to get shadows looking right. See the [page:PointLightShadow] for details.
  47. The default is `false`.
  48. </p>
  49. <h3>[property:Float decay]</h3>
  50. <p>
  51. The amount the light dims along the distance of the light. Default is `2`.<br />
  52. In context of physically-correct rendering the default value should not be changed.
  53. </p>
  54. <h3>[property:Float distance]</h3>
  55. <p>
  56. `Default mode` — When distance is zero, light does not attenuate. When distance is
  57. non-zero, light will attenuate linearly from maximum intensity at the light's position down to
  58. zero at this distance from the light.
  59. </p>
  60. <p>
  61. `[page:WebGLRenderer.physicallyCorrectLights Physically correct] mode` — When distance
  62. is zero, light will attenuate according to inverse-square law to infinite distance. When
  63. distance is non-zero, light will attenuate according to inverse-square law until near the
  64. distance cutoff, where it will then attenuate quickly and smoothly to 0. Inherently, cutoffs
  65. are not physically correct.
  66. </p>
  67. <p>
  68. Default is `0.0`.
  69. </p>
  70. <h3>[property:Float intensity]</h3>
  71. <p>
  72. The light's intensity. Default is `1`.<br />
  73. In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, intensity is the luminous
  74. intensity of the light measured in candela (cd).<br /><br />
  75. Changing the intensity will also change the light's power.
  76. </p>
  77. <h3>[property:Float power]</h3>
  78. <p>
  79. The light's power.<br />
  80. In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, power is the luminous
  81. power of the light measured in lumens (lm). <br /><br />
  82. Changing the power will also change the light's intensity.
  83. </p>
  84. <h3>[property:PointLightShadow shadow]</h3>
  85. <p>
  86. A [page:PointLightShadow] used to calculate shadows for this light.<br /><br />
  87. The lightShadow's [page:LightShadow.camera camera]
  88. is set to a [page:PerspectiveCamera] with [page:PerspectiveCamera.fov fov] of 90,
  89. [page:PerspectiveCamera.aspect aspect] of 1, [page:PerspectiveCamera.near near]
  90. clipping plane at 0.5 and [page:PerspectiveCamera.far far] clipping plane at 500.
  91. </p>
  92. <h2>Methods</h2>
  93. <p>
  94. See the base [page:Light Light] class for common methods.
  95. </p>
  96. <h3>[method:undefined dispose]()</h3>
  97. <p>
  98. Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
  99. </p>
  100. <h3>[method:this copy]( [param:PointLight source] )</h3>
  101. <p>
  102. Copies value of all the properties from the [page:PointLight source] to this
  103. PointLight.
  104. </p>
  105. <h2>Source</h2>
  106. <p>
  107. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  108. </p>
  109. </body>
  110. </html>