|
@@ -1,44 +1,40 @@
|
|
import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js';
|
|
import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js';
|
|
import { Light } from './Light.js';
|
|
import { Light } from './Light.js';
|
|
|
|
|
|
-function LightProbe( sh, intensity ) {
|
|
|
|
|
|
+class LightProbe extends Light {
|
|
|
|
|
|
- Light.call( this, undefined, intensity );
|
|
|
|
|
|
+ constructor( sh = new SphericalHarmonics3(), intensity = 1 ) {
|
|
|
|
|
|
- this.type = 'LightProbe';
|
|
|
|
|
|
+ super( undefined, intensity );
|
|
|
|
|
|
- this.sh = ( sh !== undefined ) ? sh : new SphericalHarmonics3();
|
|
|
|
|
|
+ Object.defineProperty( this, 'isLightProbe', { value: true } );
|
|
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-LightProbe.prototype = Object.assign( Object.create( Light.prototype ), {
|
|
|
|
|
|
+ this.sh = sh;
|
|
|
|
|
|
- constructor: LightProbe,
|
|
|
|
-
|
|
|
|
- isLightProbe: true,
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- copy: function ( source ) {
|
|
|
|
|
|
+ copy( source ) {
|
|
|
|
|
|
- Light.prototype.copy.call( this, source );
|
|
|
|
|
|
+ super.copy( source );
|
|
|
|
|
|
this.sh.copy( source.sh );
|
|
this.sh.copy( source.sh );
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- fromJSON: function ( json ) {
|
|
|
|
|
|
+ fromJSON( json ) {
|
|
|
|
|
|
this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();
|
|
this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();
|
|
this.sh.fromArray( json.sh );
|
|
this.sh.fromArray( json.sh );
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- toJSON: function ( meta ) {
|
|
|
|
|
|
+ toJSON( meta ) {
|
|
|
|
|
|
- const data = Light.prototype.toJSON.call( this, meta );
|
|
|
|
|
|
+ const data = super.toJSON( meta );
|
|
|
|
|
|
data.object.sh = this.sh.toArray();
|
|
data.object.sh = this.sh.toArray();
|
|
|
|
|
|
@@ -46,6 +42,6 @@ LightProbe.prototype = Object.assign( Object.create( Light.prototype ), {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-} );
|
|
|
|
|
|
+}
|
|
|
|
|
|
export { LightProbe };
|
|
export { LightProbe };
|