2
0

RectAreaLight.js 843 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { Light } from './Light.js';
  2. /**
  3. * @author abelnation / http://github.com/abelnation
  4. */
  5. function RectAreaLight( color, intensity, width, height ) {
  6. Light.call( this, color, intensity );
  7. this.type = 'RectAreaLight';
  8. this.width = ( width !== undefined ) ? width : 10;
  9. this.height = ( height !== undefined ) ? height : 10;
  10. }
  11. RectAreaLight.prototype = Object.assign( Object.create( Light.prototype ), {
  12. constructor: RectAreaLight,
  13. isRectAreaLight: true,
  14. copy: function ( source ) {
  15. Light.prototype.copy.call( this, source );
  16. this.width = source.width;
  17. this.height = source.height;
  18. return this;
  19. },
  20. toJSON: function ( meta ) {
  21. var data = Light.prototype.toJSON.call( this, meta );
  22. data.object.width = this.width;
  23. data.object.height = this.height;
  24. return data;
  25. }
  26. } );
  27. export { RectAreaLight };