Ver Fonte

LightProbe: Remove `fromJSON()`. (#32415)

Michael Herzog há 1 mês atrás
pai
commit
2a11e57726
2 ficheiros alterados com 3 adições e 16 exclusões
  1. 0 15
      src/lights/LightProbe.js
  2. 3 1
      src/loaders/ObjectLoader.js

+ 0 - 15
src/lights/LightProbe.js

@@ -60,21 +60,6 @@ class LightProbe extends Light {
 
 	}
 
-	/**
-	 * Deserializes the light prove from the given JSON.
-	 *
-	 * @param {Object} json - The JSON holding the serialized light probe.
-	 * @return {LightProbe} A reference to this light probe.
-	 */
-	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 );

+ 3 - 1
src/loaders/ObjectLoader.js

@@ -62,6 +62,7 @@ import * as Geometries from '../geometries/Geometries.js';
 import { getTypedArray, error, warn } from '../utils.js';
 import { Box3 } from '../math/Box3.js';
 import { Sphere } from '../math/Sphere.js';
+import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js';
 
 /**
  * A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
@@ -920,7 +921,8 @@ class ObjectLoader extends Loader {
 
 			case 'LightProbe':
 
-				object = new LightProbe().fromJSON( data );
+				const sh = new SphericalHarmonics3().fromArray( data.sh );
+				object = new LightProbe( sh, data.intensity );
 
 				break;
 

粤ICP备19079148号