UNPKG

722 BJavaScriptView Raw
1import { Light } from './Light.js';
2import { DirectionalLightShadow } from './DirectionalLightShadow.js';
3import { Object3D } from '../core/Object3D.js';
4
5class DirectionalLight extends Light {
6
7 constructor( color, intensity ) {
8
9 super( color, intensity );
10
11 this.type = 'DirectionalLight';
12
13 this.position.copy( Object3D.DefaultUp );
14 this.updateMatrix();
15
16 this.target = new Object3D();
17
18 this.shadow = new DirectionalLightShadow();
19
20 }
21
22 dispose() {
23
24 this.shadow.dispose();
25
26 }
27
28 copy( source ) {
29
30 super.copy( source );
31
32 this.target = source.target.clone();
33 this.shadow = source.shadow.clone();
34
35 return this;
36
37 }
38
39}
40
41DirectionalLight.prototype.isDirectionalLight = true;
42
43export { DirectionalLight };