Julien Moreau-Mathis 9 years ago
parent
commit
5f708c9a47
1 changed files with 7 additions and 11 deletions
  1. 7 11
      loaders/OBJ/babylon.objFileLoader.js

+ 7 - 11
loaders/OBJ/babylon.objFileLoader.js

@@ -1,3 +1,4 @@
+
 var BABYLON;
 (function (BABYLON) {
     /**
@@ -209,14 +210,7 @@ var BABYLON;
             //The complete path to the mtl file
             var pathOfFile = BABYLON.Tools.BaseUrl + rootUrl + url;
             // Loads through the babylon tools to allow fileInput search.
-            //BABYLON.Tools.LoadFile(pathOfFile, 
-            //    onSuccess, 
-            //    null, 
-            //    null, 
-            //    false, 
-            //    () => { console.warn("Error - Unable to load " + pathOfFile); }, 
-            //    true /* synchronous call */);
-            BABYLON.Tools.LoadFile(pathOfFile, onSuccess, null, null, false, function () { console.warn("Error - Unable to load " + pathOfFile); });
+            BABYLON.Tools.LoadFile(pathOfFile, onSuccess, null, null, false, function () { console.warn("Error - Unable to load " + pathOfFile); }, true /* synchronous call */);
         };
         OBJFileLoader.prototype.importMesh = function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons) {
             //get the meshes from OBJ file
@@ -360,12 +354,13 @@ var BABYLON;
                     unwrappedNormalsForBabylon.push(wrappedNormalsForBabylon[l].x, wrappedNormalsForBabylon[l].y, wrappedNormalsForBabylon[l].z);
                     unwrappedUVForBabylon.push(wrappedUvsForBabylon[l].x, wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON
                 }
-                // Reset arrays for the next new meshes
+				// Reset arrays for the next new meshes
                 wrappedPositionForBabylon = [];
                 wrappedNormalsForBabylon = [];
                 wrappedUvsForBabylon = [];
                 tuplePosNorm = [];
                 curPositionInIndices = 0;
+                
             };
             /**
              * Create triangles from polygons by recursion
@@ -510,7 +505,7 @@ var BABYLON;
                     indicesForBabylon = [];
                     unwrappedPositionsForBabylon = [];
                     unwrappedNormalsForBabylon = [];
-                    unwrappedUVForBabylon = [];
+                    unwrappedUVForBabylon = [];  
                 }
             };
             //Main function
@@ -690,8 +685,9 @@ var BABYLON;
                 //Push the name of the material to an array
                 //This is indispensable for the importMesh function
                 materialToUse.push(meshesFromObj[j].materialName);
-                var vertexData = new BABYLON.VertexData(); //The container for the values
                 //Set the data for the babylonMesh
+                
+                var vertexData = new BABYLON.VertexData(); //The container for the values
                 vertexData.positions = handledMesh.positions;
                 vertexData.normals = handledMesh.normals;
                 vertexData.uvs = handledMesh.uvs;