PointLight.html 4.5 KB

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