Browse Source

Updated JSONLoader to allow material-less data.

Mr.doob 12 years ago
parent
commit
70dbf95491
1 changed files with 13 additions and 8 deletions
  1. 13 8
      src/loaders/JSONLoader.js

+ 13 - 8
src/loaders/JSONLoader.js

@@ -419,17 +419,22 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 
 
 	};
 	};
 
 
-	var materials = this.initMaterials( json.materials, texturePath );
+	if ( json.materials === undefined ) {
 
 
-	if ( this.needsTangents( materials ) ) {
+		return { geometry: geometry };
 
 
-		geometry.computeTangents();
+	} else {
 
 
-	}
+		var materials = this.initMaterials( json.materials, texturePath );
 
 
-	return {
-		geometry: geometry,
-		materials: materials
-	};
+		if ( this.needsTangents( materials ) ) {
+
+			geometry.computeTangents();
+
+		}
+
+		return { geometry: geometry, materials: materials };
+
+	}
 
 
 };
 };