Browse Source

HemisphereLight: Convert to ES6 class

Mr.doob 4 years ago
parent
commit
7b518cae5c
1 changed files with 11 additions and 14 deletions
  1. 11 14
      src/lights/HemisphereLight.js

+ 11 - 14
src/lights/HemisphereLight.js

@@ -2,26 +2,24 @@ import { Light } from './Light.js';
 import { Color } from '../math/Color.js';
 import { Object3D } from '../core/Object3D.js';
 
-function HemisphereLight( skyColor, groundColor, intensity ) {
+class HemisphereLight extends Light {
 
-	Light.call( this, skyColor, intensity );
+	constructor( skyColor, groundColor, intensity ) {
 
-	this.type = 'HemisphereLight';
+		super( skyColor, intensity );
 
-	this.position.copy( Object3D.DefaultUp );
-	this.updateMatrix();
+		Object.defineProperty( this, 'isHemisphereLight', { value: true } );
 
-	this.groundColor = new Color( groundColor );
+		this.type = 'HemisphereLight';
 
-}
-
-HemisphereLight.prototype = Object.assign( Object.create( Light.prototype ), {
+		this.position.copy( Object3D.DefaultUp );
+		this.updateMatrix();
 
-	constructor: HemisphereLight,
+		this.groundColor = new Color( groundColor );
 
-	isHemisphereLight: true,
+	}
 
-	copy: function ( source ) {
+	copy( source ) {
 
 		Light.prototype.copy.call( this, source );
 
@@ -31,7 +29,6 @@ HemisphereLight.prototype = Object.assign( Object.create( Light.prototype ), {
 
 	}
 
-} );
-
+}
 
 export { HemisphereLight };