Browse Source

ObjectLoader: Refector (de)serialization of Fog and FogExp2 (#26793)

* marshal fog/fogexp2 .name

* use object literal
ycw 1 year ago
parent
commit
1454e7afc0
3 changed files with 8 additions and 0 deletions
  1. 6 0
      src/loaders/ObjectLoader.js
  2. 1 0
      src/scenes/Fog.js
  3. 1 0
      src/scenes/FogExp2.js

+ 6 - 0
src/loaders/ObjectLoader.js

@@ -785,6 +785,12 @@ class ObjectLoader extends Loader {
 
 
 					}
 					}
 
 
+					if ( data.fog.name !== '' ) {
+
+						object.fog.name = data.fog.name;
+
+					}
+
 				}
 				}
 
 
 				if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
 				if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;

+ 1 - 0
src/scenes/Fog.js

@@ -25,6 +25,7 @@ class Fog {
 
 
 		return {
 		return {
 			type: 'Fog',
 			type: 'Fog',
+			name: this.name,
 			color: this.color.getHex(),
 			color: this.color.getHex(),
 			near: this.near,
 			near: this.near,
 			far: this.far
 			far: this.far

+ 1 - 0
src/scenes/FogExp2.js

@@ -23,6 +23,7 @@ class FogExp2 {
 
 
 		return {
 		return {
 			type: 'FogExp2',
 			type: 'FogExp2',
+			name: this.name,
 			color: this.color.getHex(),
 			color: this.color.getHex(),
 			density: this.density
 			density: this.density
 		};
 		};