Kaynağa Gözat

SpotLightShadow: Convert to ES6 class

Mr.doob 4 yıl önce
ebeveyn
işleme
31545b9d56
1 değiştirilmiş dosya ile 9 ekleme ve 12 silme
  1. 9 12
      src/lights/SpotLightShadow.js

+ 9 - 12
src/lights/SpotLightShadow.js

@@ -2,21 +2,19 @@ import { LightShadow } from './LightShadow.js';
 import { MathUtils } from '../math/MathUtils.js';
 import { PerspectiveCamera } from '../cameras/PerspectiveCamera.js';
 
-function SpotLightShadow() {
+class SpotLightShadow extends LightShadow {
 
-	LightShadow.call( this, new PerspectiveCamera( 50, 1, 0.5, 500 ) );
+	constructor() {
 
-	this.focus = 1;
+		super( new PerspectiveCamera( 50, 1, 0.5, 500 ) );
 
-}
-
-SpotLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), {
+		Object.defineProperty( this, 'isSpotLightShadow', { value: true } );
 
-	constructor: SpotLightShadow,
+		this.focus = 1;
 
-	isSpotLightShadow: true,
+	}
 
-	updateMatrices: function ( light ) {
+	updateMatrices( light ) {
 
 		const camera = this.camera;
 
@@ -33,11 +31,10 @@ SpotLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype
 
 		}
 
-		LightShadow.prototype.updateMatrices.call( this, light );
+		super.updateMatrices( light );
 
 	}
 
-} );
-
+}
 
 export { SpotLightShadow };