RectAreaLight.js 783 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { Light } from './Light.js';
  2. function RectAreaLight( color, intensity, width, height ) {
  3. Light.call( this, color, intensity );
  4. this.type = 'RectAreaLight';
  5. this.width = ( width !== undefined ) ? width : 10;
  6. this.height = ( height !== undefined ) ? height : 10;
  7. }
  8. RectAreaLight.prototype = Object.assign( Object.create( Light.prototype ), {
  9. constructor: RectAreaLight,
  10. isRectAreaLight: true,
  11. copy: function ( source ) {
  12. Light.prototype.copy.call( this, source );
  13. this.width = source.width;
  14. this.height = source.height;
  15. return this;
  16. },
  17. toJSON: function ( meta ) {
  18. const data = Light.prototype.toJSON.call( this, meta );
  19. data.object.width = this.width;
  20. data.object.height = this.height;
  21. return data;
  22. }
  23. } );
  24. export { RectAreaLight };
粤ICP备19079148号