1 import { Object3D } from '../core/Object3D';
2 import { Color } from '../math/Color';
5 * @author mrdoob / http://mrdoob.com/
6 * @author alteredq / http://alteredqualia.com/
9 function Light( color, intensity ) {
11 Object3D.call( this );
15 this.color = new Color( color );
16 this.intensity = intensity !== undefined ? intensity : 1;
18 this.receiveShadow = undefined;
22 Light.prototype = Object.assign( Object.create( Object3D.prototype ), {
28 copy: function ( source ) {
30 Object3D.prototype.copy.call( this, source );
32 this.color.copy( source.color );
33 this.intensity = source.intensity;
39 toJSON: function ( meta ) {
41 var data = Object3D.prototype.toJSON.call( this, meta );
43 data.object.color = this.color.getHex();
44 data.object.intensity = this.intensity;
46 if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();
48 if ( this.distance !== undefined ) data.object.distance = this.distance;
49 if ( this.angle !== undefined ) data.object.angle = this.angle;
50 if ( this.decay !== undefined ) data.object.decay = this.decay;
51 if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;
53 if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();