DirectionalLight.js 722 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { Light } from './Light.js';
  2. import { DirectionalLightShadow } from './DirectionalLightShadow.js';
  3. import { Object3D } from '../core/Object3D.js';
  4. class DirectionalLight extends Light {
  5. constructor( color, intensity ) {
  6. super( color, intensity );
  7. this.type = 'DirectionalLight';
  8. this.position.copy( Object3D.DefaultUp );
  9. this.updateMatrix();
  10. this.target = new Object3D();
  11. this.shadow = new DirectionalLightShadow();
  12. }
  13. dispose() {
  14. this.shadow.dispose();
  15. }
  16. copy( source ) {
  17. super.copy( source );
  18. this.target = source.target.clone();
  19. this.shadow = source.shadow.clone();
  20. return this;
  21. }
  22. }
  23. DirectionalLight.prototype.isDirectionalLight = true;
  24. export { DirectionalLight };