|
@@ -128,7 +128,7 @@ class ObjectLoader extends Loader {
|
|
|
const textures = this.parseTextures( json.textures, images );
|
|
|
const materials = this.parseMaterials( json.materials, textures );
|
|
|
|
|
|
- const object = this.parseObject( json.object, geometries, materials, animations );
|
|
|
+ const object = this.parseObject( json.object, geometries, materials, animations, textures );
|
|
|
const skeletons = this.parseSkeletons( json.skeletons, object );
|
|
|
|
|
|
this.bindSkeletons( object, skeletons );
|
|
@@ -784,7 +784,7 @@ class ObjectLoader extends Loader {
|
|
|
|
|
|
}
|
|
|
|
|
|
- parseObject( data, geometries, materials, animations ) {
|
|
|
+ parseObject( data, geometries, materials, animations, textures ) {
|
|
|
|
|
|
let object;
|
|
|
|
|
@@ -836,6 +836,18 @@ class ObjectLoader extends Loader {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function getTexture( uuid ) {
|
|
|
+
|
|
|
+ if ( textures[ uuid ] === undefined ) {
|
|
|
+
|
|
|
+ console.warn( 'THREE.ObjectLoader: Undefined texture', uuid );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return textures[ uuid ];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
let geometry, material;
|
|
|
|
|
|
switch ( data.type ) {
|
|
@@ -850,10 +862,16 @@ class ObjectLoader extends Loader {
|
|
|
|
|
|
object.background = new Color( data.background );
|
|
|
|
|
|
+ } else {
|
|
|
+
|
|
|
+ object.background = getTexture( data.background );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if ( data.environment !== undefined ) object.environment = getTexture( data.environment );
|
|
|
+
|
|
|
if ( data.fog !== undefined ) {
|
|
|
|
|
|
if ( data.fog.type === 'Fog' ) {
|
|
@@ -1069,7 +1087,7 @@ class ObjectLoader extends Loader {
|
|
|
|
|
|
for ( let i = 0; i < children.length; i ++ ) {
|
|
|
|
|
|
- object.add( this.parseObject( children[ i ], geometries, materials, animations ) );
|
|
|
+ object.add( this.parseObject( children[ i ], geometries, materials, animations, textures ) );
|
|
|
|
|
|
}
|
|
|
|