Browse Source

ColladaLoader2: Handle undefined samplers.

Mr.doob 9 years ago
parent
commit
75580e83dd
1 changed files with 15 additions and 6 deletions
  1. 15 6
      examples/js/loaders/ColladaLoader2.js

+ 15 - 6
examples/js/loaders/ColladaLoader2.js

@@ -495,14 +495,23 @@ THREE.ColladaLoader.prototype = {
 			function getTexture( sid ) {
 
 				var sampler = effect.profile.samplers[ sid ];
-				var surface = effect.profile.surfaces[ sampler.source ];
 
-				var texture = new THREE.Texture( getImage( surface.init_from ) );
-				texture.wrapS = THREE.RepeatWrapping;
-				texture.wrapT = THREE.RepeatWrapping;
-				texture.needsUpdate = true;
+				if ( sampler !== undefined ) {
 
-				return texture;
+					var surface = effect.profile.surfaces[ sampler.source ];
+
+					var texture = new THREE.Texture( getImage( surface.init_from ) );
+					texture.wrapS = THREE.RepeatWrapping;
+					texture.wrapT = THREE.RepeatWrapping;
+					texture.needsUpdate = true;
+
+					return texture;
+
+				}
+
+				console.error( 'ColladaLoder: Undefined sampler', sid );
+
+				return;
 
 			}