@@ -128,7 +128,7 @@ class ObjectLoader extends Loader {
128128 const textures = this . parseTextures ( json . textures , images ) ;
129129 const materials = this . parseMaterials ( json . materials , textures ) ;
130130
131- const object = this . parseObject ( json . object , geometries , materials , animations ) ;
131+ const object = this . parseObject ( json . object , geometries , materials , animations , textures ) ;
132132 const skeletons = this . parseSkeletons ( json . skeletons , object ) ;
133133
134134 this . bindSkeletons ( object , skeletons ) ;
@@ -784,7 +784,7 @@ class ObjectLoader extends Loader {
784784
785785 }
786786
787- parseObject ( data , geometries , materials , animations ) {
787+ parseObject ( data , geometries , materials , animations , textures ) {
788788
789789 let object ;
790790
@@ -836,6 +836,18 @@ class ObjectLoader extends Loader {
836836
837837 }
838838
839+ function getTexture ( uuid ) {
840+
841+ if ( textures [ uuid ] === undefined ) {
842+
843+ console . warn ( 'THREE.ObjectLoader: Undefined texture' , uuid ) ;
844+
845+ }
846+
847+ return textures [ uuid ] ;
848+
849+ }
850+
839851 let geometry , material ;
840852
841853 switch ( data . type ) {
@@ -850,10 +862,16 @@ class ObjectLoader extends Loader {
850862
851863 object . background = new Color ( data . background ) ;
852864
865+ } else {
866+
867+ object . background = getTexture ( data . background ) ;
868+
853869 }
854870
855871 }
856872
873+ if ( data . environment !== undefined ) object . environment = getTexture ( data . environment ) ;
874+
857875 if ( data . fog !== undefined ) {
858876
859877 if ( data . fog . type === 'Fog' ) {
@@ -1069,7 +1087,7 @@ class ObjectLoader extends Loader {
10691087
10701088 for ( let i = 0 ; i < children . length ; i ++ ) {
10711089
1072- object . add ( this . parseObject ( children [ i ] , geometries , materials , animations ) ) ;
1090+ object . add ( this . parseObject ( children [ i ] , geometries , materials , animations , textures ) ) ;
10731091
10741092 }
10751093
0 commit comments