Explorar o código

Updated JSONLoader to allow material-less data.

Mr.doob %!s(int64=12) %!d(string=hai) anos
pai
achega
70dbf95491
Modificáronse 1 ficheiros con 13 adicións e 8 borrados
  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 };
+
+	}
 
 };