@babylonjs/loaders 5.0.0-beta.6 → 5.0.0-beta.8-snapshot

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. package/package.json +20 -198
  2. package/OBJ/index.d.ts +0 -4
  3. package/OBJ/index.js +0 -5
  4. package/OBJ/index.js.map +0 -1
  5. package/OBJ/mtlFileLoader.d.ts +0 -40
  6. package/OBJ/mtlFileLoader.js +0 -222
  7. package/OBJ/mtlFileLoader.js.map +0 -1
  8. package/OBJ/objFileLoader.d.ts +0 -133
  9. package/OBJ/objFileLoader.js +0 -301
  10. package/OBJ/objFileLoader.js.map +0 -1
  11. package/OBJ/objLoadingOptions.d.ts +0 -43
  12. package/OBJ/objLoadingOptions.js +0 -2
  13. package/OBJ/objLoadingOptions.js.map +0 -1
  14. package/OBJ/solidParser.d.ts +0 -153
  15. package/OBJ/solidParser.js +0 -700
  16. package/OBJ/solidParser.js.map +0 -1
  17. package/STL/index.d.ts +0 -1
  18. package/STL/index.js +0 -2
  19. package/STL/index.js.map +0 -1
  20. package/STL/stlFileLoader.d.ts +0 -71
  21. package/STL/stlFileLoader.js +0 -240
  22. package/STL/stlFileLoader.js.map +0 -1
  23. package/glTF/1.0/glTFBinaryExtension.d.ts +0 -13
  24. package/glTF/1.0/glTFBinaryExtension.js +0 -62
  25. package/glTF/1.0/glTFBinaryExtension.js.map +0 -1
  26. package/glTF/1.0/glTFLoader.d.ts +0 -106
  27. package/glTF/1.0/glTFLoader.js +0 -1697
  28. package/glTF/1.0/glTFLoader.js.map +0 -1
  29. package/glTF/1.0/glTFLoaderInterfaces.d.ts +0 -412
  30. package/glTF/1.0/glTFLoaderInterfaces.js +0 -96
  31. package/glTF/1.0/glTFLoaderInterfaces.js.map +0 -1
  32. package/glTF/1.0/glTFLoaderUtils.d.ts +0 -62
  33. package/glTF/1.0/glTFLoaderUtils.js +0 -233
  34. package/glTF/1.0/glTFLoaderUtils.js.map +0 -1
  35. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +0 -10
  36. package/glTF/1.0/glTFMaterialsCommonExtension.js +0 -128
  37. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +0 -1
  38. package/glTF/1.0/index.d.ts +0 -5
  39. package/glTF/1.0/index.js +0 -6
  40. package/glTF/1.0/index.js.map +0 -1
  41. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +0 -36
  42. package/glTF/2.0/Extensions/EXT_lights_image_based.js +0 -111
  43. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +0 -1
  44. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +0 -27
  45. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +0 -80
  46. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +0 -1
  47. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +0 -27
  48. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +0 -43
  49. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +0 -1
  50. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +0 -21
  51. package/glTF/2.0/Extensions/EXT_texture_webp.js +0 -33
  52. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +0 -1
  53. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +0 -32
  54. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +0 -56
  55. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +0 -1
  56. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +0 -31
  57. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +0 -102
  58. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +0 -1
  59. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +0 -28
  60. package/glTF/2.0/Extensions/KHR_lights_punctual.js +0 -82
  61. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +0 -1
  62. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +0 -31
  63. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +0 -87
  64. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +0 -1
  65. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +0 -30
  66. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +0 -46
  67. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +0 -1
  68. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +0 -34
  69. package/glTF/2.0/Extensions/KHR_materials_ior.js +0 -55
  70. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +0 -1
  71. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +0 -30
  72. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +0 -73
  73. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +0 -1
  74. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +0 -31
  75. package/glTF/2.0/Extensions/KHR_materials_sheen.js +0 -77
  76. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +0 -1
  77. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +0 -30
  78. package/glTF/2.0/Extensions/KHR_materials_specular.js +0 -67
  79. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +0 -1
  80. package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +0 -31
  81. package/glTF/2.0/Extensions/KHR_materials_translucency.js +0 -77
  82. package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +0 -1
  83. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +0 -30
  84. package/glTF/2.0/Extensions/KHR_materials_transmission.js +0 -278
  85. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +0 -1
  86. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +0 -30
  87. package/glTF/2.0/Extensions/KHR_materials_unlit.js +0 -66
  88. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +0 -1
  89. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +0 -76
  90. package/glTF/2.0/Extensions/KHR_materials_variants.js +0 -244
  91. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +0 -1
  92. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +0 -31
  93. package/glTF/2.0/Extensions/KHR_materials_volume.js +0 -79
  94. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +0 -1
  95. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +0 -19
  96. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +0 -22
  97. package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +0 -1
  98. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +0 -21
  99. package/glTF/2.0/Extensions/KHR_texture_basisu.js +0 -33
  100. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +0 -1
  101. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +0 -25
  102. package/glTF/2.0/Extensions/KHR_texture_transform.js +0 -54
  103. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +0 -1
  104. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +0 -29
  105. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +0 -47
  106. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +0 -1
  107. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +0 -38
  108. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +0 -217
  109. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +0 -1
  110. package/glTF/2.0/Extensions/MSFT_lod.d.ts +0 -75
  111. package/glTF/2.0/Extensions/MSFT_lod.js +0 -334
  112. package/glTF/2.0/Extensions/MSFT_lod.js.map +0 -1
  113. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +0 -14
  114. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +0 -37
  115. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +0 -1
  116. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +0 -14
  117. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +0 -37
  118. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +0 -1
  119. package/glTF/2.0/Extensions/index.d.ts +0 -26
  120. package/glTF/2.0/Extensions/index.js +0 -27
  121. package/glTF/2.0/Extensions/index.js.map +0 -1
  122. package/glTF/2.0/glTFLoader.d.ts +0 -355
  123. package/glTF/2.0/glTFLoader.js +0 -2184
  124. package/glTF/2.0/glTFLoader.js.map +0 -1
  125. package/glTF/2.0/glTFLoaderExtension.d.ts +0 -152
  126. package/glTF/2.0/glTFLoaderExtension.js +0 -2
  127. package/glTF/2.0/glTFLoaderExtension.js.map +0 -1
  128. package/glTF/2.0/glTFLoaderInterfaces.d.ts +0 -212
  129. package/glTF/2.0/glTFLoaderInterfaces.js +0 -2
  130. package/glTF/2.0/glTFLoaderInterfaces.js.map +0 -1
  131. package/glTF/2.0/index.d.ts +0 -4
  132. package/glTF/2.0/index.js +0 -5
  133. package/glTF/2.0/index.js.map +0 -1
  134. package/glTF/glTFFileLoader.d.ts +0 -364
  135. package/glTF/glTFFileLoader.js +0 -865
  136. package/glTF/glTFFileLoader.js.map +0 -1
  137. package/glTF/glTFValidation.d.ts +0 -29
  138. package/glTF/glTFValidation.js +0 -122
  139. package/glTF/glTFValidation.js.map +0 -1
  140. package/glTF/index.d.ts +0 -5
  141. package/glTF/index.js +0 -6
  142. package/glTF/index.js.map +0 -1
  143. package/index.d.ts +0 -3
  144. package/index.js.map +0 -1
  145. package/legacy/legacy-glTF.d.ts +0 -2
  146. package/legacy/legacy-glTF.js +0 -19
  147. package/legacy/legacy-glTF.js.map +0 -1
  148. package/legacy/legacy-glTF1.d.ts +0 -2
  149. package/legacy/legacy-glTF1.js +0 -15
  150. package/legacy/legacy-glTF1.js.map +0 -1
  151. package/legacy/legacy-glTF1FileLoader.d.ts +0 -2
  152. package/legacy/legacy-glTF1FileLoader.js +0 -3
  153. package/legacy/legacy-glTF1FileLoader.js.map +0 -1
  154. package/legacy/legacy-glTF2.d.ts +0 -2
  155. package/legacy/legacy-glTF2.js +0 -33
  156. package/legacy/legacy-glTF2.js.map +0 -1
  157. package/legacy/legacy-glTF2FileLoader.d.ts +0 -2
  158. package/legacy/legacy-glTF2FileLoader.js +0 -3
  159. package/legacy/legacy-glTF2FileLoader.js.map +0 -1
  160. package/legacy/legacy-glTFFileLoader.d.ts +0 -3
  161. package/legacy/legacy-glTFFileLoader.js +0 -4
  162. package/legacy/legacy-glTFFileLoader.js.map +0 -1
  163. package/legacy/legacy-objFileLoader.d.ts +0 -1
  164. package/legacy/legacy-objFileLoader.js +0 -13
  165. package/legacy/legacy-objFileLoader.js.map +0 -1
  166. package/legacy/legacy-stlFileLoader.d.ts +0 -1
  167. package/legacy/legacy-stlFileLoader.js +0 -13
  168. package/legacy/legacy-stlFileLoader.js.map +0 -1
  169. package/legacy/legacy.d.ts +0 -6
  170. package/legacy/legacy.js +0 -7
  171. package/legacy/legacy.js.map +0 -1
  172. package/readme.md +0 -24
@@ -1 +0,0 @@
1
- {"version":3,"file":"solidParser.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/OBJ/solidParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAgBpE;;GAEG;AACH;IA2DI;;;;;OAKG;IACH,qBAAmB,aAAuB,EAAE,kBAA+B,EAAE,cAAiC;QAjCtG,eAAU,GAAmB,EAAE,CAAC,CAA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CAAC;IAC1D,wFAAwF;IAC1E,wBAAY,GAAG,wCAAwC,CAAC;IACtE,4GAA4G;IAC9F,wBAAY,GAAG,kDAAkD,CAAC;IAChF,mGAAmG;IACrF,wBAAY,GAAG,0CAA0C,CAAC;IACxE,qHAAqH;IACvG,wBAAY,GAAG,qDAAqD,CAAC;IAswBvF,kBAAC;CAAA,AAnyBD,IAmyBC;SAnyBY,WAAW","sourcesContent":["import { AssetContainer } from \"@babylonjs/core/assetContainer\";\r\nimport { VertexBuffer } from \"@babylonjs/core/Buffers/buffer\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { Color3, Color4 } from \"@babylonjs/core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { FloatArray, IndicesArray, Nullable } from \"@babylonjs/core/types\";\r\nimport { OBJLoadingOptions } from \"./objLoadingOptions\";\r\n\r\ntype MeshObject = {\r\n name: string;\r\n indices?: Array<number>;\r\n positions?: Array<number>;\r\n normals?: Array<number>;\r\n colors?: Array<number>;\r\n uvs?: Array<number>;\r\n materialName: string;\r\n directMaterial?: Nullable<Material>;\r\n};\r\n\r\n/**\r\n * Class used to load mesh data from OBJ content\r\n */\r\nexport class SolidParser {\r\n // Descriptor\r\n /** Object descriptor */\r\n public static ObjectDescriptor = /^o/;\r\n /** Group descriptor */\r\n public static GroupDescriptor = /^g/;\r\n /** Material lib descriptor */\r\n public static MtlLibGroupDescriptor = /^mtllib /;\r\n /** Use a material descriptor */\r\n public static UseMtlDescriptor = /^usemtl /;\r\n /** Smooth descriptor */\r\n public static SmoothDescriptor = /^s /;\r\n\r\n // Patterns\r\n /** Pattern used to detect a vertex */\r\n public static VertexPattern = /v(\\s+[\\d|\\.|\\+|\\-|e|E]+){3,7}/;\r\n /** Pattern used to detect a normal */\r\n public static NormalPattern = /vn(\\s+[\\d|\\.|\\+|\\-|e|E]+)( +[\\d|\\.|\\+|\\-|e|E]+)( +[\\d|\\.|\\+|\\-|e|E]+)/;\r\n /** Pattern used to detect a UV set */\r\n public static UVPattern = /vt(\\s+[\\d|\\.|\\+|\\-|e|E]+)( +[\\d|\\.|\\+|\\-|e|E]+)/;\r\n /** Pattern used to detect a first kind of face (f vertex vertex vertex) */\r\n public static FacePattern1 = /f\\s+(([\\d]{1,}[\\s]?){3,})+/;\r\n /** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */\r\n public static FacePattern2 = /f\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */\r\n public static FacePattern3 = /f\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/\r\n public static FacePattern4 = /f\\s+((([\\d]{1,}\\/\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */\r\n public static FacePattern5 = /f\\s+(((-[\\d]{1,}\\/-[\\d]{1,}\\/-[\\d]{1,}[\\s]?){3,})+)/;\r\n\r\n private _loadingOptions: OBJLoadingOptions;\r\n private _positions: Array<Vector3> = []; //values for the positions of vertices\r\n private _normals: Array<Vector3> = []; //Values for the normals\r\n private _uvs: Array<Vector2> = []; //Values for the textures\r\n private _colors: Array<Color4> = [];\r\n private _meshesFromObj: Array<MeshObject> = []; //[mesh] Contains all the obj meshes\r\n private _handledMesh: MeshObject; //The current mesh of meshes array\r\n private _indicesForBabylon: Array<number> = []; //The list of indices for VertexData\r\n private _wrappedPositionForBabylon: Array<Vector3> = []; //The list of position in vectors\r\n private _wrappedUvsForBabylon: Array<Vector2> = []; //Array with all value of uvs to match with the indices\r\n private _wrappedColorsForBabylon: Array<Color4> = []; // Array with all color values to match with the indices\r\n private _wrappedNormalsForBabylon: Array<Vector3> = []; //Array with all value of normals to match with the indices\r\n private _tuplePosNorm: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }> = []; //Create a tuple with indice of Position, Normal, UV [pos, norm, uvs]\r\n private _curPositionInIndices = 0;\r\n private _hasMeshes: Boolean = false; //Meshes are defined in the file\r\n private _unwrappedPositionsForBabylon: Array<number> = []; //Value of positionForBabylon w/o Vector3() [x,y,z]\r\n private _unwrappedColorsForBabylon: Array<number> = []; // Value of colorForBabylon w/o Color4() [r,g,b,a]\r\n private _unwrappedNormalsForBabylon: Array<number> = []; //Value of normalsForBabylon w/o Vector3() [x,y,z]\r\n private _unwrappedUVForBabylon: Array<number> = []; //Value of uvsForBabylon w/o Vector3() [x,y,z]\r\n private _triangles: Array<string> = []; //Indices from new triangles coming from polygons\r\n private _materialNameFromObj: string = \"\"; //The name of the current material\r\n private _objMeshName: string = \"\"; //The name of the current obj mesh\r\n private _increment: number = 1; //Id for meshes created by the multimaterial\r\n private _isFirstMaterial: boolean = true;\r\n private _grayColor = new Color4(0.5, 0.5, 0.5, 1);\r\n private _materialToUse: string[];\r\n private _babylonMeshesArray: Array<Mesh>;\r\n\r\n /**\r\n * Creates a new SolidParser\r\n * @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)\r\n * @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)\r\n * @param loadingOptions defines the loading options to use\r\n */\r\n public constructor(materialToUse: string[], babylonMeshesArray: Array<Mesh>, loadingOptions: OBJLoadingOptions) {\r\n this._materialToUse = materialToUse;\r\n this._babylonMeshesArray = babylonMeshesArray;\r\n this._loadingOptions = loadingOptions;\r\n }\r\n\r\n /**\r\n * Search for obj in the given array.\r\n * This function is called to check if a couple of data already exists in an array.\r\n *\r\n * If found, returns the index of the founded tuple index. Returns -1 if not found\r\n * @param arr Array<{ normals: Array<number>, idx: Array<number> }>\r\n * @param obj Array<number>\r\n * @returns {boolean}\r\n */\r\n private _isInArray(arr: Array<{ normals: Array<number>; idx: Array<number> }>, obj: Array<number>) {\r\n if (!arr[obj[0]]) { arr[obj[0]] = { normals: [], idx: [] }; }\r\n var idx = arr[obj[0]].normals.indexOf(obj[1]);\r\n\r\n return idx === -1 ? -1 : arr[obj[0]].idx[idx];\r\n }\r\n\r\n private _isInArrayUV(arr: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }>, obj: Array<number>) {\r\n if (!arr[obj[0]]) { arr[obj[0]] = { normals: [], idx: [], uv: [] }; }\r\n var idx = arr[obj[0]].normals.indexOf(obj[1]);\r\n\r\n if (idx != 1 && (obj[2] === arr[obj[0]].uv[idx])) {\r\n return arr[obj[0]].idx[idx];\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * This function set the data for each triangle.\r\n * Data are position, normals and uvs\r\n * If a tuple of (position, normal) is not set, add the data into the corresponding array\r\n * If the tuple already exist, add only their indice\r\n *\r\n * @param indicePositionFromObj Integer The index in positions array\r\n * @param indiceUvsFromObj Integer The index in uvs array\r\n * @param indiceNormalFromObj Integer The index in normals array\r\n * @param positionVectorFromOBJ Vector3 The value of position at index objIndice\r\n * @param textureVectorFromOBJ Vector3 The value of uvs\r\n * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale\r\n */\r\n private _setData(indicePositionFromObj: number, indiceUvsFromObj: number, indiceNormalFromObj: number, positionVectorFromOBJ: Vector3, textureVectorFromOBJ: Vector2, normalsVectorFromOBJ: Vector3, positionColorsFromOBJ?: Color4) {\r\n //Check if this tuple already exists in the list of tuples\r\n var _index: number;\r\n if (this._loadingOptions.optimizeWithUV) {\r\n _index = this._isInArrayUV(\r\n this._tuplePosNorm,\r\n [\r\n indicePositionFromObj,\r\n indiceNormalFromObj,\r\n indiceUvsFromObj\r\n ]\r\n );\r\n }\r\n else {\r\n _index = this._isInArray(\r\n this._tuplePosNorm,\r\n [\r\n indicePositionFromObj,\r\n indiceNormalFromObj\r\n ]\r\n );\r\n }\r\n\r\n //If it not exists\r\n if (_index === -1) {\r\n //Add an new indice.\r\n //The array of indices is only an array with his length equal to the number of triangles - 1.\r\n //We add vertices data in this order\r\n this._indicesForBabylon.push(this._wrappedPositionForBabylon.length);\r\n //Push the position of vertice for Babylon\r\n //Each element is a Vector3(x,y,z)\r\n this._wrappedPositionForBabylon.push(positionVectorFromOBJ);\r\n //Push the uvs for Babylon\r\n //Each element is a Vector3(u,v)\r\n this._wrappedUvsForBabylon.push(textureVectorFromOBJ);\r\n //Push the normals for Babylon\r\n //Each element is a Vector3(x,y,z)\r\n this._wrappedNormalsForBabylon.push(normalsVectorFromOBJ);\r\n\r\n if (positionColorsFromOBJ !== undefined) {\r\n //Push the colors for Babylon\r\n //Each element is a BABYLON.Color4(r,g,b,a)\r\n this._wrappedColorsForBabylon.push(positionColorsFromOBJ);\r\n }\r\n\r\n //Add the tuple in the comparison list\r\n this._tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);\r\n this._tuplePosNorm[indicePositionFromObj].idx.push(this._curPositionInIndices++);\r\n if (this._loadingOptions.optimizeWithUV) { this._tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj); }\r\n } else {\r\n //The tuple already exists\r\n //Add the index of the already existing tuple\r\n //At this index we can get the value of position, normal, color and uvs of vertex\r\n this._indicesForBabylon.push(_index);\r\n }\r\n }\r\n\r\n /**\r\n * Transform Vector() and BABYLON.Color() objects into numbers in an array\r\n */\r\n private _unwrapData() {\r\n //Every array has the same length\r\n for (var l = 0; l < this._wrappedPositionForBabylon.length; l++) {\r\n //Push the x, y, z values of each element in the unwrapped array\r\n this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[l].x, this._wrappedPositionForBabylon[l].y, this._wrappedPositionForBabylon[l].z);\r\n this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[l].x, this._wrappedNormalsForBabylon[l].y, this._wrappedNormalsForBabylon[l].z);\r\n this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON\r\n if (this._loadingOptions.importVertexColors) {\r\n //Push the r, g, b, a values of each element in the unwrapped array\r\n this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[l].r, this._wrappedColorsForBabylon[l].g, this._wrappedColorsForBabylon[l].b, this._wrappedColorsForBabylon[l].a);\r\n }\r\n }\r\n // Reset arrays for the next new meshes\r\n this._wrappedPositionForBabylon = [];\r\n this._wrappedNormalsForBabylon = [];\r\n this._wrappedUvsForBabylon = [];\r\n this._wrappedColorsForBabylon = [];\r\n this._tuplePosNorm = [];\r\n this._curPositionInIndices = 0;\r\n }\r\n\r\n /**\r\n * Create triangles from polygons\r\n * It is important to notice that a triangle is a polygon\r\n * We get 5 patterns of face defined in OBJ File :\r\n * facePattern1 = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]\r\n * facePattern2 = [\"1/1\",\"2/2\",\"3/3\",\"4/4\",\"5/5\",\"6/6\"]\r\n * facePattern3 = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"4/4/4\",\"5/5/5\",\"6/6/6\"]\r\n * facePattern4 = [\"1//1\",\"2//2\",\"3//3\",\"4//4\",\"5//5\",\"6//6\"]\r\n * facePattern5 = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-4/-4/-4\",\"-5/-5/-5\",\"-6/-6/-6\"]\r\n * Each pattern is divided by the same method\r\n * @param face Array[String] The indices of elements\r\n * @param v Integer The variable to increment\r\n */\r\n private _getTriangles(faces: Array<string>, v: number) {\r\n //Work for each element of the array\r\n for (var faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {\r\n //Add on the triangle variable the indexes to obtain triangles\r\n this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n }\r\n\r\n //Result obtained after 2 iterations:\r\n //Pattern1 => triangle = [\"1\",\"2\",\"3\",\"1\",\"3\",\"4\"];\r\n //Pattern2 => triangle = [\"1/1\",\"2/2\",\"3/3\",\"1/1\",\"3/3\",\"4/4\"];\r\n //Pattern3 => triangle = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"1/1/1\",\"3/3/3\",\"4/4/4\"];\r\n //Pattern4 => triangle = [\"1//1\",\"2//2\",\"3//3\",\"1//1\",\"3//3\",\"4//4\"];\r\n //Pattern5 => triangle = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-1/-1/-1\",\"-3/-3/-3\",\"-4/-4/-4\"];\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 1\r\n * In this pattern we get vertice positions\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern1(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n //For each element in the triangles array.\r\n //This var could contains 1 to an infinity of triangles\r\n for (var k = 0; k < this._triangles.length; k++) {\r\n // Set position indice\r\n var indicePositionFromObj = parseInt(this._triangles[k]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n 0, 0, // In the pattern 1, normals and uvs are not defined\r\n this._positions[indicePositionFromObj], // Get the vectors data\r\n Vector2.Zero(), Vector3.Up(), // Create default vectors\r\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles = [];\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 2\r\n * In this pattern we get vertice positions and uvsu\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern2(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n for (var k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1/1\"\r\n //Split the data for getting position and uv\r\n var point = this._triangles[k].split(\"/\"); // [\"1\", \"1\"]\r\n //Set position indice\r\n var indicePositionFromObj = parseInt(point[0]) - 1;\r\n //Set uv indice\r\n var indiceUvsFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n 0, //Default value for normals\r\n this._positions[indicePositionFromObj], //Get the values for each element\r\n this._uvs[indiceUvsFromObj],\r\n Vector3.Up(), //Default value for normals\r\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined\r\n );\r\n }\r\n\r\n //Reset variable for the next line\r\n this._triangles = [];\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 3\r\n * In this pattern we get vertice positions, uvs and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern3(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n\r\n for (var k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1/1/1\"\r\n //Split the data for getting position, uv, and normals\r\n var point = this._triangles[k].split(\"/\"); // [\"1\", \"1\", \"1\"]\r\n // Set position indice\r\n var indicePositionFromObj = parseInt(point[0]) - 1;\r\n // Set uv indice\r\n var indiceUvsFromObj = parseInt(point[1]) - 1;\r\n // Set normal indice\r\n var indiceNormalFromObj = parseInt(point[2]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj,\r\n this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj], this._normals[indiceNormalFromObj] //Set the vector for each component\r\n );\r\n\r\n }\r\n //Reset variable for the next line\r\n this._triangles = [];\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 4\r\n * In this pattern we get vertice positions and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern4(face: Array<string>, v: number) {\r\n this._getTriangles(face, v);\r\n\r\n for (var k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1//1\"\r\n //Split the data for getting position and normals\r\n var point = this._triangles[k].split(\"//\"); // [\"1\", \"1\"]\r\n // We check indices, and normals\r\n var indicePositionFromObj = parseInt(point[0]) - 1;\r\n var indiceNormalFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n 1, //Default value for uv\r\n indiceNormalFromObj,\r\n this._positions[indicePositionFromObj], //Get each vector of data\r\n Vector2.Zero(),\r\n this._normals[indiceNormalFromObj],\r\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles = [];\r\n }\r\n\r\n /*\r\n * Create triangles and push the data for each polygon for the pattern 3\r\n * In this pattern we get vertice positions, uvs and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern5(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n\r\n for (var k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"-1/-1/-1\"\r\n //Split the data for getting position, uv, and normals\r\n var point = this._triangles[k].split(\"/\"); // [\"-1\", \"-1\", \"-1\"]\r\n // Set position indice\r\n var indicePositionFromObj = this._positions.length + parseInt(point[0]);\r\n // Set uv indice\r\n var indiceUvsFromObj = this._uvs.length + parseInt(point[1]);\r\n // Set normal indice\r\n var indiceNormalFromObj = this._normals.length + parseInt(point[2]);\r\n\r\n this._setData(\r\n indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj,\r\n this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj], this._normals[indiceNormalFromObj], //Set the vector for each component\r\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined\r\n );\r\n\r\n }\r\n //Reset variable for the next line\r\n this._triangles = [];\r\n }\r\n\r\n private _addPreviousObjMesh() {\r\n //Check if it is not the first mesh. Otherwise we don't have data.\r\n if (this._meshesFromObj.length > 0) {\r\n //Get the previous mesh for applying the data about the faces\r\n //=> in obj file, faces definition append after the name of the mesh\r\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\r\n\r\n //Set the data into Array for the mesh\r\n this._unwrapData();\r\n\r\n // Reverse tab. Otherwise face are displayed in the wrong sens\r\n this._indicesForBabylon.reverse();\r\n //Set the information for the mesh\r\n //Slice the array to avoid rewriting because of the fact this is the same var which be rewrited\r\n this._handledMesh.indices = this._indicesForBabylon.slice();\r\n this._handledMesh.positions = this._unwrappedPositionsForBabylon.slice();\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();\r\n\r\n if (this._loadingOptions.importVertexColors) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();\r\n }\r\n\r\n //Reset the array for the next mesh\r\n this._indicesForBabylon = [];\r\n this._unwrappedPositionsForBabylon = [];\r\n this._unwrappedColorsForBabylon = [];\r\n this._unwrappedNormalsForBabylon = [];\r\n this._unwrappedUVForBabylon = [];\r\n }\r\n }\r\n\r\n private _optimizeNormals(mesh: AbstractMesh): void {\r\n const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = mesh.getVerticesData(VertexBuffer.NormalKind);\r\n const mapVertices: { [key: string]: number[] } = {};\r\n\r\n if (!positions || !normals) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < positions.length / 3; i++) {\r\n const x = positions[i * 3 + 0];\r\n const y = positions[i * 3 + 1];\r\n const z = positions[i * 3 + 2];\r\n const key = x + \"_\" + y + \"_\" + z;\r\n\r\n let lst = mapVertices[key];\r\n if (!lst) {\r\n lst = [];\r\n mapVertices[key] = lst;\r\n }\r\n lst.push(i);\r\n }\r\n\r\n const normal = new Vector3();\r\n for (const key in mapVertices) {\r\n const lst = mapVertices[key];\r\n if (lst.length < 2) {\r\n continue;\r\n }\r\n\r\n const v0Idx = lst[0];\r\n for (let i = 1; i < lst.length; ++i) {\r\n const vIdx = lst[i];\r\n normals[v0Idx * 3 + 0] += normals[vIdx * 3 + 0];\r\n normals[v0Idx * 3 + 1] += normals[vIdx * 3 + 1];\r\n normals[v0Idx * 3 + 2] += normals[vIdx * 3 + 2];\r\n }\r\n\r\n normal.copyFromFloats(normals[v0Idx * 3 + 0], normals[v0Idx * 3 + 1], normals[v0Idx * 3 + 2]);\r\n normal.normalize();\r\n\r\n for (let i = 0; i < lst.length; ++i) {\r\n const vIdx = lst[i];\r\n normals[vIdx * 3 + 0] = normal.x;\r\n normals[vIdx * 3 + 1] = normal.y;\r\n normals[vIdx * 3 + 2] = normal.z;\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normals);\r\n }\r\n\r\n /**\r\n * Function used to parse an OBJ string\r\n * @param meshesNames defines the list of meshes to load (all if not defined)\r\n * @param data defines the OBJ string\r\n * @param scene defines the hosting scene\r\n * @param assetContainer defines the asset container to load data in\r\n * @param onFileToLoadFound defines a callback that will be called if a MTL file is found\r\n */\r\n public parse(\r\n meshesNames: any, data: string, scene: Scene, assetContainer: Nullable<AssetContainer>, onFileToLoadFound: (fileToLoad: string) => void): void {\r\n // Split the file into lines\r\n var lines = data.split('\\n');\r\n // Look at each line\r\n for (var i = 0; i < lines.length; i++) {\r\n var line = lines[i].trim().replace(/\\s\\s/g, \" \");\r\n var result;\r\n\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === '#') {\r\n continue;\r\n\r\n //Get information about one position possible for the vertices\r\n } else if (SolidParser.VertexPattern.test(line)) {\r\n result = line.match(/[^ ]+/g)!; // match will return non-null due to passing regex pattern\r\n\r\n // Value of result with line: \"v 1.0 2.0 3.0\"\r\n // [\"v\", \"1.0\", \"2.0\", \"3.0\"]\r\n // Create a Vector3 with the position x, y, z\r\n this._positions.push(new Vector3(\r\n parseFloat(result[1]),\r\n parseFloat(result[2]),\r\n parseFloat(result[3])\r\n ));\r\n\r\n if (this._loadingOptions.importVertexColors) {\r\n if (result.length >= 7) {\r\n const r = parseFloat(result[4]);\r\n const g = parseFloat(result[5]);\r\n const b = parseFloat(result[6]);\r\n\r\n this._colors.push(new Color4(\r\n r > 1 ? r / 255 : r,\r\n g > 1 ? g / 255 : g,\r\n b > 1 ? b / 255 : b,\r\n (result.length === 7 || result[7] === undefined) ? 1 : parseFloat(result[7])\r\n ));\r\n } else {\r\n // TODO: maybe push NULL and if all are NULL to skip (and remove grayColor var).\r\n this._colors.push(this._grayColor);\r\n }\r\n }\r\n\r\n } else if ((result = SolidParser.NormalPattern.exec(line)) !== null) {\r\n //Create a Vector3 with the normals x, y, z\r\n //Value of result\r\n // [\"vn 1.0 2.0 3.0\", \"1.0\", \"2.0\", \"3.0\"]\r\n //Add the Vector in the list of normals\r\n this._normals.push(new Vector3(\r\n parseFloat(result[1]),\r\n parseFloat(result[2]),\r\n parseFloat(result[3])\r\n ));\r\n\r\n } else if ((result = SolidParser.UVPattern.exec(line)) !== null) {\r\n //Create a Vector2 with the normals u, v\r\n //Value of result\r\n // [\"vt 0.1 0.2 0.3\", \"0.1\", \"0.2\"]\r\n //Add the Vector in the list of uvs\r\n this._uvs.push(new Vector2(\r\n parseFloat(result[1]) * this._loadingOptions.UVScaling.x,\r\n parseFloat(result[2]) * this._loadingOptions.UVScaling.y\r\n ));\r\n\r\n //Identify patterns of faces\r\n //Face could be defined in different type of pattern\r\n } else if ((result = SolidParser.FacePattern3.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1/1/1 2/2/2 3/3/3\", \"1/1/1 2/2/2 3/3/3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern3(\r\n result[1].trim().split(\" \"), // [\"1/1/1\", \"2/2/2\", \"3/3/3\"]\r\n 1\r\n );\r\n\r\n } else if ((result = SolidParser.FacePattern4.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1//1 2//2 3//3\", \"1//1 2//2 3//3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern4(\r\n result[1].trim().split(\" \"), // [\"1//1\", \"2//2\", \"3//3\"]\r\n 1\r\n );\r\n\r\n } else if ((result = SolidParser.FacePattern5.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f -1/-1/-1 -2/-2/-2 -3/-3/-3\", \"-1/-1/-1 -2/-2/-2 -3/-3/-3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern5(\r\n result[1].trim().split(\" \"), // [\"-1/-1/-1\", \"-2/-2/-2\", \"-3/-3/-3\"]\r\n 1\r\n );\r\n\r\n } else if ((result = SolidParser.FacePattern2.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1/1 2/2 3/3\", \"1/1 2/2 3/3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern2(\r\n result[1].trim().split(\" \"), // [\"1/1\", \"2/2\", \"3/3\"]\r\n 1\r\n );\r\n\r\n } else if ((result = SolidParser.FacePattern1.exec(line)) !== null) {\r\n //Value of result\r\n //[\"f 1 2 3\", \"1 2 3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern1(\r\n result[1].trim().split(\" \"), // [\"1\", \"2\", \"3\"]\r\n 1\r\n );\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analysed, create a new Object with all data for creating a babylonMesh\r\n } else if (SolidParser.GroupDescriptor.test(line) || SolidParser.ObjectDescriptor.test(line)) {\r\n // Create a new mesh corresponding to the name of the group.\r\n // Definition of the mesh\r\n var objMesh: MeshObject = {\r\n name: line.substring(2).trim(), //Set the name of the current obj mesh\r\n indices: undefined,\r\n positions: undefined,\r\n normals: undefined,\r\n uvs: undefined,\r\n colors: undefined,\r\n materialName: \"\"\r\n };\r\n this._addPreviousObjMesh();\r\n\r\n //Push the last mesh created with only the name\r\n this._meshesFromObj.push(objMesh);\r\n\r\n //Set this variable to indicate that now meshesFromObj has objects defined inside\r\n this._hasMeshes = true;\r\n this._isFirstMaterial = true;\r\n this._increment = 1;\r\n //Keyword for applying a material\r\n } else if (SolidParser.UseMtlDescriptor.test(line)) {\r\n //Get the name of the material\r\n this._materialNameFromObj = line.substring(7).trim();\r\n\r\n //If this new material is in the same mesh\r\n\r\n if (!this._isFirstMaterial || !this._hasMeshes) {\r\n //Set the data for the previous mesh\r\n this._addPreviousObjMesh();\r\n //Create a new mesh\r\n var objMesh: MeshObject =\r\n //Set the name of the current obj mesh\r\n {\r\n name: (this._objMeshName || \"mesh\") + \"_mm\" + this._increment.toString(), //Set the name of the current obj mesh\r\n indices: undefined,\r\n positions: undefined,\r\n normals: undefined,\r\n uvs: undefined,\r\n colors: undefined,\r\n materialName: this._materialNameFromObj\r\n };\r\n this._increment++;\r\n //If meshes are already defined\r\n this._meshesFromObj.push(objMesh);\r\n this._hasMeshes = true;\r\n }\r\n //Set the material name if the previous line define a mesh\r\n\r\n if (this._hasMeshes && this._isFirstMaterial) {\r\n //Set the material name to the previous mesh (1 material per mesh)\r\n this._meshesFromObj[this._meshesFromObj.length - 1].materialName = this._materialNameFromObj;\r\n this._isFirstMaterial = false;\r\n }\r\n // Keyword for loading the mtl file\r\n } else if (SolidParser.MtlLibGroupDescriptor.test(line)) {\r\n // Get the name of mtl file\r\n onFileToLoadFound(line.substring(7).trim());\r\n\r\n // Apply smoothing\r\n } else if (SolidParser.SmoothDescriptor.test(line)) {\r\n // smooth shading => apply smoothing\r\n // Today I don't know it work with babylon and with obj.\r\n // With the obj file an integer is set\r\n } else {\r\n //If there is another possibility\r\n console.log(\"Unhandled expression at line : \" + line);\r\n }\r\n }\r\n\r\n // At the end of the file, add the last mesh into the meshesFromObj array\r\n if (this._hasMeshes) {\r\n // Set the data for the last mesh\r\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\r\n\r\n //Reverse indices for displaying faces in the good sense\r\n this._indicesForBabylon.reverse();\r\n //Get the good array\r\n this._unwrapData();\r\n //Set array\r\n this._handledMesh.indices = this._indicesForBabylon;\r\n this._handledMesh.positions = this._unwrappedPositionsForBabylon;\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon;\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon;\r\n\r\n if (this._loadingOptions.importVertexColors) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon;\r\n }\r\n }\r\n\r\n // If any o or g keyword not found, create a mesh with a random id\r\n if (!this._hasMeshes) {\r\n let newMaterial: Nullable<StandardMaterial> = null;\r\n if (this._indicesForBabylon.length) {\r\n // reverse tab of indices\r\n this._indicesForBabylon.reverse();\r\n //Get positions normals uvs\r\n this._unwrapData();\r\n } else {\r\n // There is no indices in the file. We will have to switch to point cloud rendering\r\n for (var pos of this._positions) {\r\n this._unwrappedPositionsForBabylon.push(pos.x, pos.y, pos.z);\r\n }\r\n\r\n if (this._normals.length) {\r\n for (var normal of this._normals) {\r\n this._unwrappedNormalsForBabylon.push(normal.x, normal.y, normal.z);\r\n }\r\n }\r\n\r\n if (this._uvs.length) {\r\n for (var uv of this._uvs) {\r\n this._unwrappedUVForBabylon.push(uv.x, uv.y);\r\n }\r\n }\r\n\r\n if (this._colors.length) {\r\n for (var color of this._colors) {\r\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\r\n }\r\n }\r\n\r\n if (!this._materialNameFromObj) {\r\n // Create a material with point cloud on\r\n newMaterial = new StandardMaterial(Geometry.RandomId(), scene);\r\n\r\n newMaterial.pointsCloud = true;\r\n\r\n this._materialNameFromObj = newMaterial.name;\r\n\r\n if (!this._normals.length) {\r\n newMaterial.disableLighting = true;\r\n newMaterial.emissiveColor = Color3.White();\r\n }\r\n }\r\n }\r\n\r\n //Set data for one mesh\r\n this._meshesFromObj.push({\r\n name: Geometry.RandomId(),\r\n indices: this._indicesForBabylon,\r\n positions: this._unwrappedPositionsForBabylon,\r\n colors: this._unwrappedColorsForBabylon,\r\n normals: this._unwrappedNormalsForBabylon,\r\n uvs: this._unwrappedUVForBabylon,\r\n materialName: this._materialNameFromObj,\r\n directMaterial: newMaterial\r\n });\r\n }\r\n\r\n //Set data for each mesh\r\n for (var j = 0; j < this._meshesFromObj.length; j++) {\r\n\r\n //check meshesNames (stlFileLoader)\r\n if (meshesNames && this._meshesFromObj[j].name) {\r\n if (meshesNames instanceof Array) {\r\n if (meshesNames.indexOf(this._meshesFromObj[j].name) === -1) {\r\n continue;\r\n }\r\n }\r\n else {\r\n if (this._meshesFromObj[j].name !== meshesNames) {\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n //Get the current mesh\r\n //Set the data with VertexBuffer for each mesh\r\n this._handledMesh = this._meshesFromObj[j];\r\n //Create a Mesh with the name of the obj mesh\r\n\r\n scene._blockEntityCollection = !!assetContainer;\r\n var babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);\r\n babylonMesh._parentContainer = assetContainer;\r\n scene._blockEntityCollection = false;\r\n\r\n //Push the name of the material to an array\r\n //This is indispensable for the importMesh function\r\n this._materialToUse.push(this._meshesFromObj[j].materialName);\r\n\r\n if (this._handledMesh.positions?.length === 0) {\r\n //Push the mesh into an array\r\n this._babylonMeshesArray.push(babylonMesh);\r\n continue;\r\n }\r\n\r\n var vertexData: VertexData = new VertexData(); //The container for the values\r\n //Set the data for the babylonMesh\r\n vertexData.uvs = this._handledMesh.uvs as FloatArray;\r\n vertexData.indices = this._handledMesh.indices as IndicesArray;\r\n vertexData.positions = this._handledMesh.positions as FloatArray;\r\n if (this._loadingOptions.computeNormals) {\r\n let normals: Array<number> = new Array<number>();\r\n VertexData.ComputeNormals(this._handledMesh.positions, this._handledMesh.indices, normals);\r\n vertexData.normals = normals;\r\n } else {\r\n vertexData.normals = this._handledMesh.normals as FloatArray;\r\n }\r\n if (this._loadingOptions.importVertexColors) {\r\n vertexData.colors = this._handledMesh.colors as FloatArray;\r\n }\r\n //Set the data from the VertexBuffer to the current Mesh\r\n vertexData.applyToMesh(babylonMesh);\r\n if (this._loadingOptions.invertY) {\r\n babylonMesh.scaling.y *= -1;\r\n }\r\n if (this._loadingOptions.optimizeNormals) {\r\n this._optimizeNormals(babylonMesh);\r\n }\r\n\r\n //Push the mesh into an array\r\n this._babylonMeshesArray.push(babylonMesh);\r\n\r\n if (this._handledMesh.directMaterial) {\r\n babylonMesh.material = this._handledMesh.directMaterial;\r\n }\r\n }\r\n }\r\n}"]}
package/STL/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./stlFileLoader";
package/STL/index.js DELETED
@@ -1,2 +0,0 @@
1
- export * from "./stlFileLoader.js";
2
- //# sourceMappingURL=index.js.map
package/STL/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/STL/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./stlFileLoader\";"]}
@@ -1,71 +0,0 @@
1
- import { Nullable } from "@babylonjs/core/types";
2
- import { Skeleton } from "@babylonjs/core/Bones/skeleton";
3
- import { IParticleSystem } from "@babylonjs/core/Particles/IParticleSystem";
4
- import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh";
5
- import { ISceneLoaderPlugin, ISceneLoaderPluginExtensions } from "@babylonjs/core/Loading/sceneLoader";
6
- import { AssetContainer } from "@babylonjs/core/assetContainer";
7
- import { Scene } from "@babylonjs/core/scene";
8
- /**
9
- * STL file type loader.
10
- * This is a babylon scene loader plugin.
11
- */
12
- export declare class STLFileLoader implements ISceneLoaderPlugin {
13
- /** @hidden */
14
- solidPattern: RegExp;
15
- /** @hidden */
16
- facetsPattern: RegExp;
17
- /** @hidden */
18
- normalPattern: RegExp;
19
- /** @hidden */
20
- vertexPattern: RegExp;
21
- /**
22
- * Defines the name of the plugin.
23
- */
24
- name: string;
25
- /**
26
- * Defines the extensions the stl loader is able to load.
27
- * force data to come in as an ArrayBuffer
28
- * we'll convert to string if it looks like it's an ASCII .stl
29
- */
30
- extensions: ISceneLoaderPluginExtensions;
31
- /**
32
- * Defines if Y and Z axes are swapped or not when loading an STL file.
33
- * The default is false to maintain backward compatibility. When set to
34
- * true, coordinates from the STL file are used without change.
35
- */
36
- static DO_NOT_ALTER_FILE_COORDINATES: boolean;
37
- /**
38
- * Import meshes into a scene.
39
- * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
40
- * @param scene The scene to import into
41
- * @param data The data to import
42
- * @param rootUrl The root url for scene and resources
43
- * @param meshes The meshes array to import into
44
- * @param particleSystems The particle systems array to import into
45
- * @param skeletons The skeletons array to import into
46
- * @param onError The callback when import fails
47
- * @returns True if successful or false otherwise
48
- */
49
- importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<IParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
50
- /**
51
- * Load into a scene.
52
- * @param scene The scene to load into
53
- * @param data The data to import
54
- * @param rootUrl The root url for scene and resources
55
- * @param onError The callback when import fails
56
- * @returns true if successful or false otherwise
57
- */
58
- load(scene: Scene, data: any, rootUrl: string): boolean;
59
- /**
60
- * Load into an asset container.
61
- * @param scene The scene to load into
62
- * @param data The data to import
63
- * @param rootUrl The root url for scene and resources
64
- * @param onError The callback when import fails
65
- * @returns The loaded asset container
66
- */
67
- loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
68
- private _isBinary;
69
- private _parseBinary;
70
- private _parseASCII;
71
- }
@@ -1,240 +0,0 @@
1
- import { Tools } from "@babylonjs/core/Misc/tools.js";
2
- import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
3
- import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
4
- import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader.js";
5
- import { AssetContainer } from "@babylonjs/core/assetContainer.js";
6
- /**
7
- * STL file type loader.
8
- * This is a babylon scene loader plugin.
9
- */
10
- var STLFileLoader = /** @class */ (function () {
11
- function STLFileLoader() {
12
- /** @hidden */
13
- this.solidPattern = /solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g;
14
- /** @hidden */
15
- this.facetsPattern = /facet([\s\S]*?)endfacet/g;
16
- /** @hidden */
17
- this.normalPattern = /normal[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g;
18
- /** @hidden */
19
- this.vertexPattern = /vertex[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g;
20
- /**
21
- * Defines the name of the plugin.
22
- */
23
- this.name = "stl";
24
- /**
25
- * Defines the extensions the stl loader is able to load.
26
- * force data to come in as an ArrayBuffer
27
- * we'll convert to string if it looks like it's an ASCII .stl
28
- */
29
- this.extensions = {
30
- ".stl": { isBinary: true },
31
- };
32
- }
33
- /**
34
- * Import meshes into a scene.
35
- * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
36
- * @param scene The scene to import into
37
- * @param data The data to import
38
- * @param rootUrl The root url for scene and resources
39
- * @param meshes The meshes array to import into
40
- * @param particleSystems The particle systems array to import into
41
- * @param skeletons The skeletons array to import into
42
- * @param onError The callback when import fails
43
- * @returns True if successful or false otherwise
44
- */
45
- STLFileLoader.prototype.importMesh = function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons) {
46
- var matches;
47
- if (typeof data !== "string") {
48
- if (this._isBinary(data)) {
49
- // binary .stl
50
- var babylonMesh = new Mesh("stlmesh", scene);
51
- this._parseBinary(babylonMesh, data);
52
- if (meshes) {
53
- meshes.push(babylonMesh);
54
- }
55
- return true;
56
- }
57
- // ASCII .stl
58
- // convert to string
59
- var array_buffer = new Uint8Array(data);
60
- var str = '';
61
- for (var i = 0; i < data.byteLength; i++) {
62
- str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian
63
- }
64
- data = str;
65
- }
66
- //if arrived here, data is a string, containing the STLA data.
67
- while (matches = this.solidPattern.exec(data)) {
68
- var meshName = matches[1];
69
- var meshNameFromEnd = matches[3];
70
- if (meshName != meshNameFromEnd) {
71
- Tools.Error("Error in STL, solid name != endsolid name");
72
- return false;
73
- }
74
- // check meshesNames
75
- if (meshesNames && meshName) {
76
- if (meshesNames instanceof Array) {
77
- if (!meshesNames.indexOf(meshName)) {
78
- continue;
79
- }
80
- }
81
- else {
82
- if (meshName !== meshesNames) {
83
- continue;
84
- }
85
- }
86
- }
87
- // stl mesh name can be empty as well
88
- meshName = meshName || "stlmesh";
89
- var babylonMesh = new Mesh(meshName, scene);
90
- this._parseASCII(babylonMesh, matches[2]);
91
- if (meshes) {
92
- meshes.push(babylonMesh);
93
- }
94
- }
95
- return true;
96
- };
97
- /**
98
- * Load into a scene.
99
- * @param scene The scene to load into
100
- * @param data The data to import
101
- * @param rootUrl The root url for scene and resources
102
- * @param onError The callback when import fails
103
- * @returns true if successful or false otherwise
104
- */
105
- STLFileLoader.prototype.load = function (scene, data, rootUrl) {
106
- var result = this.importMesh(null, scene, data, rootUrl, null, null, null);
107
- return result;
108
- };
109
- /**
110
- * Load into an asset container.
111
- * @param scene The scene to load into
112
- * @param data The data to import
113
- * @param rootUrl The root url for scene and resources
114
- * @param onError The callback when import fails
115
- * @returns The loaded asset container
116
- */
117
- STLFileLoader.prototype.loadAssetContainer = function (scene, data, rootUrl, onError) {
118
- var container = new AssetContainer(scene);
119
- scene._blockEntityCollection = true;
120
- this.importMesh(null, scene, data, rootUrl, container.meshes, null, null);
121
- scene._blockEntityCollection = false;
122
- return container;
123
- };
124
- STLFileLoader.prototype._isBinary = function (data) {
125
- // check if file size is correct for binary stl
126
- var faceSize, nFaces, reader;
127
- reader = new DataView(data);
128
- // A Binary STL header is 80 bytes, if the data size is not great than
129
- // that then it's not a binary STL.
130
- if (reader.byteLength <= 80) {
131
- return false;
132
- }
133
- faceSize = (32 / 8 * 3) + ((32 / 8 * 3) * 3) + (16 / 8);
134
- nFaces = reader.getUint32(80, true);
135
- if (80 + (32 / 8) + (nFaces * faceSize) === reader.byteLength) {
136
- return true;
137
- }
138
- // check characters higher than ASCII to confirm binary
139
- var fileLength = reader.byteLength;
140
- for (var index = 0; index < fileLength; index++) {
141
- if (reader.getUint8(index) > 127) {
142
- return true;
143
- }
144
- }
145
- return false;
146
- };
147
- STLFileLoader.prototype._parseBinary = function (mesh, data) {
148
- var reader = new DataView(data);
149
- var faces = reader.getUint32(80, true);
150
- var dataOffset = 84;
151
- var faceLength = 12 * 4 + 2;
152
- var offset = 0;
153
- var positions = new Float32Array(faces * 3 * 3);
154
- var normals = new Float32Array(faces * 3 * 3);
155
- var indices = new Uint32Array(faces * 3);
156
- var indicesCount = 0;
157
- for (var face = 0; face < faces; face++) {
158
- var start = dataOffset + face * faceLength;
159
- var normalX = reader.getFloat32(start, true);
160
- var normalY = reader.getFloat32(start + 4, true);
161
- var normalZ = reader.getFloat32(start + 8, true);
162
- for (var i = 1; i <= 3; i++) {
163
- var vertexstart = start + i * 12;
164
- // ordering is intentional to match ascii import
165
- positions[offset] = reader.getFloat32(vertexstart, true);
166
- normals[offset] = normalX;
167
- if (!STLFileLoader.DO_NOT_ALTER_FILE_COORDINATES) {
168
- positions[offset + 2] = reader.getFloat32(vertexstart + 4, true);
169
- positions[offset + 1] = reader.getFloat32(vertexstart + 8, true);
170
- normals[offset + 2] = normalY;
171
- normals[offset + 1] = normalZ;
172
- }
173
- else {
174
- positions[offset + 1] = reader.getFloat32(vertexstart + 4, true);
175
- positions[offset + 2] = reader.getFloat32(vertexstart + 8, true);
176
- normals[offset + 1] = normalY;
177
- normals[offset + 2] = normalZ;
178
- }
179
- offset += 3;
180
- }
181
- indices[indicesCount] = indicesCount++;
182
- indices[indicesCount] = indicesCount++;
183
- indices[indicesCount] = indicesCount++;
184
- }
185
- mesh.setVerticesData(VertexBuffer.PositionKind, positions);
186
- mesh.setVerticesData(VertexBuffer.NormalKind, normals);
187
- mesh.setIndices(indices);
188
- mesh.computeWorldMatrix(true);
189
- };
190
- STLFileLoader.prototype._parseASCII = function (mesh, solidData) {
191
- var positions = [];
192
- var normals = [];
193
- var indices = [];
194
- var indicesCount = 0;
195
- //load facets, ignoring loop as the standard doesn't define it can contain more than vertices
196
- var matches;
197
- while (matches = this.facetsPattern.exec(solidData)) {
198
- var facet = matches[1];
199
- //one normal per face
200
- var normalMatches = this.normalPattern.exec(facet);
201
- this.normalPattern.lastIndex = 0;
202
- if (!normalMatches) {
203
- continue;
204
- }
205
- var normal = [Number(normalMatches[1]), Number(normalMatches[5]), Number(normalMatches[3])];
206
- var vertexMatch;
207
- while (vertexMatch = this.vertexPattern.exec(facet)) {
208
- if (!STLFileLoader.DO_NOT_ALTER_FILE_COORDINATES) {
209
- positions.push(Number(vertexMatch[1]), Number(vertexMatch[5]), Number(vertexMatch[3]));
210
- normals.push(normal[0], normal[1], normal[2]);
211
- }
212
- else {
213
- positions.push(Number(vertexMatch[1]), Number(vertexMatch[3]), Number(vertexMatch[5]));
214
- // Flipping the second and third component because inverted
215
- // when normal was declared.
216
- normals.push(normal[0], normal[2], normal[1]);
217
- }
218
- }
219
- indices.push(indicesCount++, indicesCount++, indicesCount++);
220
- this.vertexPattern.lastIndex = 0;
221
- }
222
- this.facetsPattern.lastIndex = 0;
223
- mesh.setVerticesData(VertexBuffer.PositionKind, positions);
224
- mesh.setVerticesData(VertexBuffer.NormalKind, normals);
225
- mesh.setIndices(indices);
226
- mesh.computeWorldMatrix(true);
227
- };
228
- /**
229
- * Defines if Y and Z axes are swapped or not when loading an STL file.
230
- * The default is false to maintain backward compatibility. When set to
231
- * true, coordinates from the STL file are used without change.
232
- */
233
- STLFileLoader.DO_NOT_ALTER_FILE_COORDINATES = false;
234
- return STLFileLoader;
235
- }());
236
- export { STLFileLoader };
237
- if (SceneLoader) {
238
- SceneLoader.RegisterPlugin(new STLFileLoader());
239
- }
240
- //# sourceMappingURL=stlFileLoader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stlFileLoader.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/STL/stlFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAI9D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAoD,MAAM,qCAAqC,CAAC;AACpH,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGhE;;;GAGG;AACH;IAAA;QAEI,cAAc;QACP,iBAAY,GAAG,yCAAyC,CAAC;QAEhE,cAAc;QACP,kBAAa,GAAG,0BAA0B,CAAC;QAClD,cAAc;QACP,kBAAa,GAAG,yJAAyJ,CAAC;QACjL,cAAc;QACP,kBAAa,GAAG,yJAAyJ,CAAC;QAEjL;;WAEG;QACI,SAAI,GAAG,KAAK,CAAC;QAEpB;;;;WAIG;QACI,eAAU,GAAiC;YAC9C,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC7B,CAAC;IAyPN,CAAC;IAhPG;;;;;;;;;;;OAWG;IACI,kCAAU,GAAjB,UAAkB,WAAgB,EAAE,KAAY,EAAE,IAAS,EAAE,OAAe,EAAE,MAAgC,EAAE,eAA4C,EAAE,SAA+B;QACzL,IAAI,OAAO,CAAC;QAEZ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAE1B,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;gBACtB,cAAc;gBACd,IAAI,WAAW,GAAG,IAAI,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;gBAC7C,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI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C;QAC3D,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAtPD;;;;OAIG;IACW,2CAA6B,GAAG,KAAK,CAAC;IAkPxD,oBAAC;CAAA,AAjRD,IAiRC;SAjRY,aAAa;AAmR1B,IAAI,WAAW,EAAE;IACb,WAAW,CAAC,cAAc,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;CACnD","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\nimport { VertexBuffer } from \"@babylonjs/core/Buffers/buffer\";\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton\";\nimport { IParticleSystem } from \"@babylonjs/core/Particles/IParticleSystem\";\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\nimport { SceneLoader, ISceneLoaderPlugin, ISceneLoaderPluginExtensions } from \"@babylonjs/core/Loading/sceneLoader\";\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\nimport { Scene } from \"@babylonjs/core/scene\";\n\n/**\n * STL file type loader.\n * This is a babylon scene loader plugin.\n */\nexport class STLFileLoader implements ISceneLoaderPlugin {\n\n /** @hidden */\n public solidPattern = /solid (\\S*)([\\S\\s]*?)endsolid[ ]*(\\S*)/g;\n\n /** @hidden */\n public facetsPattern = /facet([\\s\\S]*?)endfacet/g;\n /** @hidden */\n public normalPattern = /normal[\\s]+([\\-+]?[0-9]+\\.?[0-9]*([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+/g;\n /** @hidden */\n public vertexPattern = /vertex[\\s]+([\\-+]?[0-9]+\\.?[0-9]*([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+/g;\n\n /**\n * Defines the name of the plugin.\n */\n public name = \"stl\";\n\n /**\n * Defines the extensions the stl loader is able to load.\n * force data to come in as an ArrayBuffer\n * we'll convert to string if it looks like it's an ASCII .stl\n */\n public extensions: ISceneLoaderPluginExtensions = {\n \".stl\": { isBinary: true },\n };\n\n /**\n * Defines if Y and Z axes are swapped or not when loading an STL file.\n * The default is false to maintain backward compatibility. When set to\n * true, coordinates from the STL file are used without change.\n */\n public static DO_NOT_ALTER_FILE_COORDINATES = false;\n\n /**\n * Import meshes into a scene.\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\n * @param scene The scene to import into\n * @param data The data to import\n * @param rootUrl The root url for scene and resources\n * @param meshes The meshes array to import into\n * @param particleSystems The particle systems array to import into\n * @param skeletons The skeletons array to import into\n * @param onError The callback when import fails\n * @returns True if successful or false otherwise\n */\n public importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<IParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean {\n var matches;\n\n if (typeof data !== \"string\") {\n\n if (this._isBinary(data)) {\n // binary .stl\n var babylonMesh = new Mesh(\"stlmesh\", scene);\n this._parseBinary(babylonMesh, data);\n if (meshes) {\n meshes.push(babylonMesh);\n }\n return true;\n }\n\n // ASCII .stl\n\n // convert to string\n var array_buffer = new Uint8Array(data);\n var str = '';\n for (var i = 0; i < data.byteLength; i++) {\n str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian\n }\n data = str;\n }\n\n //if arrived here, data is a string, containing the STLA data.\n\n while (matches = this.solidPattern.exec(data)) {\n var meshName = matches[1];\n var meshNameFromEnd = matches[3];\n if (meshName != meshNameFromEnd) {\n Tools.Error(\"Error in STL, solid name != endsolid name\");\n return false;\n }\n\n // check meshesNames\n if (meshesNames && meshName) {\n if (meshesNames instanceof Array) {\n if (!meshesNames.indexOf(meshName)) {\n continue;\n }\n } else {\n if (meshName !== meshesNames) {\n continue;\n }\n }\n }\n\n // stl mesh name can be empty as well\n meshName = meshName || \"stlmesh\";\n\n var babylonMesh = new Mesh(meshName, scene);\n this._parseASCII(babylonMesh, matches[2]);\n if (meshes) {\n meshes.push(babylonMesh);\n }\n }\n\n return true;\n\n }\n\n /**\n * Load into a scene.\n * @param scene The scene to load into\n * @param data The data to import\n * @param rootUrl The root url for scene and resources\n * @param onError The callback when import fails\n * @returns true if successful or false otherwise\n */\n public load(scene: Scene, data: any, rootUrl: string): boolean {\n var result = this.importMesh(null, scene, data, rootUrl, null, null, null);\n return result;\n }\n\n /**\n * Load into an asset container.\n * @param scene The scene to load into\n * @param data The data to import\n * @param rootUrl The root url for scene and resources\n * @param onError The callback when import fails\n * @returns The loaded asset container\n */\n public loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer {\n var container = new AssetContainer(scene);\n scene._blockEntityCollection = true;\n this.importMesh(null, scene, data, rootUrl, container.meshes, null, null);\n scene._blockEntityCollection = false;\n return container;\n }\n\n private _isBinary(data: any) {\n\n // check if file size is correct for binary stl\n var faceSize, nFaces, reader;\n reader = new DataView(data);\n\n // A Binary STL header is 80 bytes, if the data size is not great than\n // that then it's not a binary STL.\n if (reader.byteLength <= 80) {\n return false;\n }\n\n faceSize = (32 / 8 * 3) + ((32 / 8 * 3) * 3) + (16 / 8);\n nFaces = reader.getUint32(80, true);\n\n if (80 + (32 / 8) + (nFaces * faceSize) === reader.byteLength) {\n return true;\n }\n\n // check characters higher than ASCII to confirm binary\n var fileLength = reader.byteLength;\n for (var index = 0; index < fileLength; index++) {\n if (reader.getUint8(index) > 127) {\n return true;\n }\n }\n\n return false;\n }\n\n private _parseBinary(mesh: Mesh, data: ArrayBuffer) {\n\n var reader = new DataView(data);\n var faces = reader.getUint32(80, true);\n\n var dataOffset = 84;\n var faceLength = 12 * 4 + 2;\n\n var offset = 0;\n\n var positions = new Float32Array(faces * 3 * 3);\n var normals = new Float32Array(faces * 3 * 3);\n var indices = new Uint32Array(faces * 3);\n var indicesCount = 0;\n\n for (var face = 0; face < faces; face++) {\n\n var start = dataOffset + face * faceLength;\n var normalX = reader.getFloat32(start, true);\n var normalY = reader.getFloat32(start + 4, true);\n var normalZ = reader.getFloat32(start + 8, true);\n\n for (var i = 1; i <= 3; i++) {\n\n var vertexstart = start + i * 12;\n\n // ordering is intentional to match ascii import\n positions[offset] = reader.getFloat32(vertexstart, true);\n normals[offset] = normalX;\n\n if (!STLFileLoader.DO_NOT_ALTER_FILE_COORDINATES) {\n\n positions[offset + 2] = reader.getFloat32(vertexstart + 4, true);\n positions[offset + 1] = reader.getFloat32(vertexstart + 8, true);\n\n normals[offset + 2] = normalY;\n normals[offset + 1] = normalZ;\n }\n else {\n\n positions[offset + 1] = reader.getFloat32(vertexstart + 4, true);\n positions[offset + 2] = reader.getFloat32(vertexstart + 8, true);\n\n normals[offset + 1] = normalY;\n normals[offset + 2] = normalZ;\n }\n\n offset += 3;\n }\n indices[indicesCount] = indicesCount++;\n indices[indicesCount] = indicesCount++;\n indices[indicesCount] = indicesCount++;\n }\n\n mesh.setVerticesData(VertexBuffer.PositionKind, positions);\n mesh.setVerticesData(VertexBuffer.NormalKind, normals);\n mesh.setIndices(indices);\n mesh.computeWorldMatrix(true);\n }\n\n private _parseASCII(mesh: Mesh, solidData: string) {\n\n var positions = [];\n var normals = [];\n var indices = [];\n var indicesCount = 0;\n\n //load facets, ignoring loop as the standard doesn't define it can contain more than vertices\n var matches;\n while (matches = this.facetsPattern.exec(solidData)) {\n var facet = matches[1];\n //one normal per face\n var normalMatches = this.normalPattern.exec(facet);\n this.normalPattern.lastIndex = 0;\n if (!normalMatches) {\n continue;\n }\n var normal = [Number(normalMatches[1]), Number(normalMatches[5]), Number(normalMatches[3])];\n\n var vertexMatch;\n while (vertexMatch = this.vertexPattern.exec(facet)) {\n\n if (!STLFileLoader.DO_NOT_ALTER_FILE_COORDINATES) {\n\n positions.push(Number(vertexMatch[1]), Number(vertexMatch[5]), Number(vertexMatch[3]));\n normals.push(normal[0], normal[1], normal[2]);\n }\n else {\n\n positions.push(Number(vertexMatch[1]), Number(vertexMatch[3]), Number(vertexMatch[5]));\n\n // Flipping the second and third component because inverted\n // when normal was declared.\n normals.push(normal[0], normal[2], normal[1]);\n }\n }\n indices.push(indicesCount++, indicesCount++, indicesCount++);\n this.vertexPattern.lastIndex = 0;\n }\n\n this.facetsPattern.lastIndex = 0;\n mesh.setVerticesData(VertexBuffer.PositionKind, positions);\n mesh.setVerticesData(VertexBuffer.NormalKind, normals);\n mesh.setIndices(indices);\n mesh.computeWorldMatrix(true);\n }\n}\n\nif (SceneLoader) {\n SceneLoader.RegisterPlugin(new STLFileLoader());\n}"]}
@@ -1,13 +0,0 @@
1
- import { GLTFLoaderExtension } from "./glTFLoader";
2
- import { Scene } from "@babylonjs/core/scene";
3
- import { IGLTFLoaderData } from "../glTFFileLoader";
4
- import { IGLTFRuntime } from "./glTFLoaderInterfaces";
5
- /** @hidden */
6
- export declare class GLTFBinaryExtension extends GLTFLoaderExtension {
7
- private _bin;
8
- constructor();
9
- loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
10
- loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
11
- loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
12
- loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
13
- }
@@ -1,62 +0,0 @@
1
- import { __extends } from "tslib";
2
- import { GLTFLoaderExtension } from "./glTFLoader.js";
3
- import { GLTFUtils } from "./glTFLoaderUtils.js";
4
- import { EComponentType } from "./glTFLoaderInterfaces.js";
5
- import { GLTFLoader, GLTFLoaderBase } from "./glTFLoader.js";
6
- var BinaryExtensionBufferName = "binary_glTF";
7
- /** @hidden */
8
- var GLTFBinaryExtension = /** @class */ (function (_super) {
9
- __extends(GLTFBinaryExtension, _super);
10
- function GLTFBinaryExtension() {
11
- return _super.call(this, "KHR_binary_glTF") || this;
12
- }
13
- GLTFBinaryExtension.prototype.loadRuntimeAsync = function (scene, data, rootUrl, onSuccess, onError) {
14
- var extensionsUsed = data.json.extensionsUsed;
15
- if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {
16
- return false;
17
- }
18
- this._bin = data.bin;
19
- onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));
20
- return true;
21
- };
22
- GLTFBinaryExtension.prototype.loadBufferAsync = function (gltfRuntime, id, onSuccess, onError) {
23
- if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {
24
- return false;
25
- }
26
- if (id !== BinaryExtensionBufferName) {
27
- return false;
28
- }
29
- this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, function (error) { return onError(error.message); });
30
- return true;
31
- };
32
- GLTFBinaryExtension.prototype.loadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {
33
- var texture = gltfRuntime.textures[id];
34
- var source = gltfRuntime.images[texture.source];
35
- if (!source.extensions || !(this.name in source.extensions)) {
36
- return false;
37
- }
38
- var sourceExt = source.extensions[this.name];
39
- var bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];
40
- var buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
41
- onSuccess(buffer);
42
- return true;
43
- };
44
- GLTFBinaryExtension.prototype.loadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {
45
- var shader = gltfRuntime.shaders[id];
46
- if (!shader.extensions || !(this.name in shader.extensions)) {
47
- return false;
48
- }
49
- var binaryExtensionShader = shader.extensions[this.name];
50
- var bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];
51
- var shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
52
- setTimeout(function () {
53
- var shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);
54
- onSuccess(shaderString);
55
- });
56
- return true;
57
- };
58
- return GLTFBinaryExtension;
59
- }(GLTFLoaderExtension));
60
- export { GLTFBinaryExtension };
61
- GLTFLoader.RegisterExtension(new GLTFBinaryExtension());
62
- //# sourceMappingURL=glTFBinaryExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glTFBinaryExtension.js","sourceRoot":"","sources":["../../../../sourceES6/loaders/src/glTF/1.0/glTFBinaryExtension.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EAA2D,cAAc,EAAe,MAAM,wBAAwB,CAAC;AAC9H,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG1D,IAAM,yBAAyB,GAAG,aAAa,CAAC;AAahD,cAAc;AACd;IAAyC,uCAAmB;IAGxD;eACI,kBAAM,iBAAiB,CAAC;IAC5B,CAAC;IAEM,8CAAgB,GAAvB,UAAwB,KAAY,EAAE,IAAqB,EAAE,OAAe,EAAE,SAA8C,EAAE,OAAkC;QAC5J,IAAI,cAAc,GAAS,IAAI,CAAC,IAAK,CAAC,cAAc,CAAC;QACrD,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;Y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";\r\nimport { IGLTFLoaderData } from \"../glTFFileLoader\";\r\nimport { IGLTFRuntime, IGLTFTexture, IGLTFImage, IGLTFBufferView, EComponentType, IGLTFShader } from \"./glTFLoaderInterfaces\";\r\nimport { GLTFLoader, GLTFLoaderBase } from \"./glTFLoader\";\r\nimport { IDataBuffer } from '@babylonjs/core/Misc/dataReader';\r\n\r\nconst BinaryExtensionBufferName = \"binary_glTF\";\r\n\r\ninterface IGLTFBinaryExtensionShader {\r\n bufferView: string;\r\n}\r\n\r\ninterface IGLTFBinaryExtensionImage {\r\n bufferView: string;\r\n mimeType: string;\r\n height: number;\r\n width: number;\r\n}\r\n\r\n/** @hidden */\r\nexport class GLTFBinaryExtension extends GLTFLoaderExtension {\r\n private _bin: IDataBuffer;\r\n\r\n public constructor() {\r\n super(\"KHR_binary_glTF\");\r\n }\r\n\r\n public loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean {\r\n var extensionsUsed = (<any>data.json).extensionsUsed;\r\n if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {\r\n return false;\r\n }\r\n\r\n this._bin = data.bin;\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n return true;\r\n }\r\n\r\n public loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean {\r\n if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {\r\n return false;\r\n }\r\n\r\n if (id !== BinaryExtensionBufferName) {\r\n return false;\r\n }\r\n\r\n this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, (error) => onError(error.message));\r\n return true;\r\n }\r\n\r\n public loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean {\r\n var texture: IGLTFTexture = gltfRuntime.textures[id];\r\n var source: IGLTFImage = gltfRuntime.images[texture.source];\r\n if (!source.extensions || !(this.name in source.extensions)) {\r\n return false;\r\n }\r\n\r\n var sourceExt: IGLTFBinaryExtensionImage = source.extensions[this.name];\r\n var bufferView: IGLTFBufferView = gltfRuntime.bufferViews[sourceExt.bufferView];\r\n var buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n onSuccess(buffer);\r\n return true;\r\n }\r\n\r\n public loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean {\r\n var shader: IGLTFShader = gltfRuntime.shaders[id];\r\n if (!shader.extensions || !(this.name in shader.extensions)) {\r\n return false;\r\n }\r\n\r\n var binaryExtensionShader: IGLTFBinaryExtensionShader = shader.extensions[this.name];\r\n var bufferView: IGLTFBufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];\r\n var shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n\r\n setTimeout(() => {\r\n var shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);\r\n onSuccess(shaderString);\r\n });\r\n\r\n return true;\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(new GLTFBinaryExtension());"]}