RectAreaLight.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { Light } from './Light';
  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.position.set( 0, 1, 0 );
  9. this.updateMatrix();
  10. this.width = ( width !== undefined ) ? width : 10;
  11. this.height = ( height !== undefined ) ? height : 10;
  12. // TODO (abelnation): distance/decay
  13. // TODO (abelnation): update method for RectAreaLight to update transform to lookat target
  14. // TODO (abelnation): shadows
  15. // this.shadow = new THREE.RectAreaLightShadow( new THREE.PerspectiveCamera( 90, 1, 0.5, 500 ) );
  16. }
  17. // TODO (abelnation): RectAreaLight update when light shape is changed
  18. RectAreaLight.prototype = Object.assign( Object.create( Light.prototype ), {
  19. constructor: RectAreaLight,
  20. isRectAreaLight: true,
  21. copy: function ( source ) {
  22. Light.prototype.copy.call( this, source );
  23. this.width = source.width;
  24. this.height = source.height;
  25. // this.shadow = source.shadow.clone();
  26. return this;
  27. }
  28. } );
  29. export { RectAreaLight };
粤ICP备19079148号