File size: 665 Bytes
2b7aae2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js';
import { Light } from './Light.js';

class LightProbe extends Light {
	constructor(sh = new SphericalHarmonics3(), intensity = 1) {
		super(undefined, intensity);

		this.sh = sh;
	}

	copy(source) {
		super.copy(source);

		this.sh.copy(source.sh);

		return this;
	}

	fromJSON(json) {
		this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();
		this.sh.fromArray(json.sh);

		return this;
	}

	toJSON(meta) {
		const data = super.toJSON(meta);

		data.object.sh = this.sh.toArray();

		return data;
	}
}

LightProbe.prototype.isLightProbe = true;

export { LightProbe };