| import { Light } from './Light.js'; |
| import { PerspectiveCamera } from '../cameras/PerspectiveCamera.js'; |
| import { LightShadow } from './LightShadow.js'; |
|
|
| |
| |
| |
|
|
|
|
| function PointLight( color, intensity, distance, decay ) { |
|
|
| Light.call( this, color, intensity ); |
|
|
| this.type = 'PointLight'; |
|
|
| Object.defineProperty( this, 'power', { |
| get: function () { |
|
|
| |
| |
| return this.intensity * 4 * Math.PI; |
|
|
| }, |
| set: function ( power ) { |
|
|
| |
| |
| this.intensity = power / ( 4 * Math.PI ); |
|
|
| } |
| } ); |
|
|
| this.distance = ( distance !== undefined ) ? distance : 0; |
| this.decay = ( decay !== undefined ) ? decay : 1; |
|
|
| this.shadow = new LightShadow( new PerspectiveCamera( 90, 1, 0.5, 500 ) ); |
|
|
| } |
|
|
| PointLight.prototype = Object.assign( Object.create( Light.prototype ), { |
|
|
| constructor: PointLight, |
|
|
| isPointLight: true, |
|
|
| copy: function ( source ) { |
|
|
| Light.prototype.copy.call( this, source ); |
|
|
| this.distance = source.distance; |
| this.decay = source.decay; |
|
|
| this.shadow = source.shadow.clone(); |
|
|
| return this; |
|
|
| } |
|
|
| } ); |
|
|
|
|
| export { PointLight }; |
|
|