Skip to content

Commit ab1ed6c

Browse files
committed
DirectionalLight: Convert to ES6 class
1 parent b885bcc commit ab1ed6c

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

src/lights/DirectionalLight.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,36 @@ import { Light } from './Light.js';
22
import { DirectionalLightShadow } from './DirectionalLightShadow.js';
33
import { Object3D } from '../core/Object3D.js';
44

5-
function DirectionalLight( color, intensity ) {
5+
class DirectionalLight extends Light {
66

7-
Light.call( this, color, intensity );
7+
constructor( color, intensity ) {
88

9-
this.type = 'DirectionalLight';
9+
super( color, intensity );
1010

11-
this.position.copy( Object3D.DefaultUp );
12-
this.updateMatrix();
11+
Object.defineProperty( this, 'isDirectionalLight', { value: true } );
1312

14-
this.target = new Object3D();
13+
this.type = 'DirectionalLight';
1514

16-
this.shadow = new DirectionalLightShadow();
15+
this.position.copy( Object3D.DefaultUp );
16+
this.updateMatrix();
1717

18-
}
19-
20-
DirectionalLight.prototype = Object.assign( Object.create( Light.prototype ), {
18+
this.target = new Object3D();
2119

22-
constructor: DirectionalLight,
20+
this.shadow = new DirectionalLightShadow();
2321

24-
isDirectionalLight: true,
22+
}
2523

26-
copy: function ( source ) {
24+
copy( source ) {
2725

28-
Light.prototype.copy.call( this, source );
26+
super.copy( source );
2927

3028
this.target = source.target.clone();
31-
3229
this.shadow = source.shadow.clone();
3330

3431
return this;
3532

3633
}
3734

38-
} );
39-
35+
}
4036

4137
export { DirectionalLight };

0 commit comments

Comments
 (0)