Browse Source

Allow multiple spaces for vertex position/color definitions.
(https://forum.babylonjs.com/t/invisible-imported-obj-file-with-mtl/1523/9)

Brian Zinn 6 năm trước cách đây
mục cha
commit
2b4429de3f
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      loaders/src/OBJ/objFileLoader.ts

+ 3 - 2
loaders/src/OBJ/objFileLoader.ts

@@ -847,9 +847,10 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
             if (line.length === 0 || line.charAt(0) === '#') {
                 continue;
 
-                //Get information about one position possible for the vertices
+            //Get information about one position possible for the vertices
             } else if (this.vertexPattern.test(line)) {
-                result = line.split(' ');
+                result = line.match(/\S+/g)!;  // match will return non-null due to passing regex pattern
+
                 //Value of result with line: "v 1.0 2.0 3.0"
                 // ["v", "1.0", "2.0", "3.0"]
                 //Create a Vector3 with the position x, y, z