@babylonjs/loaders 9.27.0 → 9.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OBJ/mtlFileLoader.d.ts +8 -1
- package/OBJ/mtlFileLoader.js +80 -12
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.pure.d.ts +5 -0
- package/OBJ/objFileLoader.pure.js +92 -65
- package/OBJ/objFileLoader.pure.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +6 -0
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/OBJ/solidParser.js +30 -5
- package/OBJ/solidParser.js.map +1 -1
- package/package.json +3 -3
package/OBJ/mtlFileLoader.d.ts
CHANGED
|
@@ -24,8 +24,12 @@ export declare class MTLFileLoader {
|
|
|
24
24
|
* @param data defines the mtl data to parse
|
|
25
25
|
* @param rootUrl defines the rooturl to use in order to load relative dependencies
|
|
26
26
|
* @param assetContainer defines the asset container to store the material in (can be null)
|
|
27
|
+
* @param invertTextureY defines whether referenced textures are inverted on the Y axis
|
|
28
|
+
* @param materialNames defines which materials to load, or all materials if omitted
|
|
29
|
+
* @param trackTextureLoading collects texture loading promises and starts delayed textures when true; defaults to false
|
|
30
|
+
* @returns the texture loading promises, or an empty array when trackTextureLoading is false
|
|
27
31
|
*/
|
|
28
|
-
parseMTL(scene: Scene, data: string | ArrayBuffer, rootUrl: string, assetContainer: Nullable<AssetContainer
|
|
32
|
+
parseMTL(scene: Scene, data: string | ArrayBuffer, rootUrl: string, assetContainer: Nullable<AssetContainer>, invertTextureY?: boolean, materialNames?: ReadonlySet<string>, trackTextureLoading?: boolean): Promise<void>[];
|
|
29
33
|
/**
|
|
30
34
|
* Gets the texture for the material.
|
|
31
35
|
*
|
|
@@ -35,6 +39,9 @@ export declare class MTLFileLoader {
|
|
|
35
39
|
* @param rootUrl The root url to load from
|
|
36
40
|
* @param value The value stored in the mtl
|
|
37
41
|
* @param scene
|
|
42
|
+
* @param assetContainer The asset container to store the texture in
|
|
43
|
+
* @param invertTextureY Whether to invert the texture on the Y axis
|
|
44
|
+
* @param textureLoadPromises The promises to wait for when loading asynchronously
|
|
38
45
|
* @returns The Texture
|
|
39
46
|
*/
|
|
40
47
|
private static _GetTexture;
|
package/OBJ/mtlFileLoader.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
2
2
|
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
3
|
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
|
4
|
+
import { Constants } from "@babylonjs/core/Engines/constants.js";
|
|
5
|
+
import { Deferred } from "@babylonjs/core/Misc/deferred.js";
|
|
4
6
|
/**
|
|
5
7
|
* Class reading and parsing the MTL file bundled with the obj file.
|
|
6
8
|
*/
|
|
@@ -21,10 +23,15 @@ export class MTLFileLoader {
|
|
|
21
23
|
* @param data defines the mtl data to parse
|
|
22
24
|
* @param rootUrl defines the rooturl to use in order to load relative dependencies
|
|
23
25
|
* @param assetContainer defines the asset container to store the material in (can be null)
|
|
26
|
+
* @param invertTextureY defines whether referenced textures are inverted on the Y axis
|
|
27
|
+
* @param materialNames defines which materials to load, or all materials if omitted
|
|
28
|
+
* @param trackTextureLoading collects texture loading promises and starts delayed textures when true; defaults to false
|
|
29
|
+
* @returns the texture loading promises, or an empty array when trackTextureLoading is false
|
|
24
30
|
*/
|
|
25
|
-
parseMTL(scene, data, rootUrl, assetContainer) {
|
|
31
|
+
parseMTL(scene, data, rootUrl, assetContainer, invertTextureY = MTLFileLoader.INVERT_TEXTURE_Y, materialNames, trackTextureLoading = false) {
|
|
32
|
+
const textureLoadPromises = trackTextureLoading ? [] : null;
|
|
26
33
|
if (data instanceof ArrayBuffer) {
|
|
27
|
-
return;
|
|
34
|
+
return textureLoadPromises ?? [];
|
|
28
35
|
}
|
|
29
36
|
//Split the lines from the file
|
|
30
37
|
const lines = data.split("\n");
|
|
@@ -55,12 +62,22 @@ export class MTLFileLoader {
|
|
|
55
62
|
//Add the previous material in the material array.
|
|
56
63
|
this.materials.push(material);
|
|
57
64
|
}
|
|
65
|
+
if (materialNames && !materialNames.has(value)) {
|
|
66
|
+
material = null;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
58
69
|
//Create a new material.
|
|
59
70
|
// value is the name of the material read in the mtl file
|
|
71
|
+
const blockEntityCollection = scene._blockEntityCollection;
|
|
60
72
|
scene._blockEntityCollection = !!assetContainer;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
try {
|
|
74
|
+
material = new StandardMaterial(value, scene);
|
|
75
|
+
material._parentContainer = assetContainer;
|
|
76
|
+
assetContainer?.materials.push(material);
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
scene._blockEntityCollection = blockEntityCollection;
|
|
80
|
+
}
|
|
64
81
|
}
|
|
65
82
|
else if (key === "kd" && material) {
|
|
66
83
|
// Diffuse color (color under white light) using RGB values
|
|
@@ -104,16 +121,16 @@ export class MTLFileLoader {
|
|
|
104
121
|
else if (key === "map_ka" && material) {
|
|
105
122
|
// ambient texture map with a loaded image
|
|
106
123
|
//We must first get the folder of the image
|
|
107
|
-
material.ambientTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
|
|
124
|
+
material.ambientTexture = MTLFileLoader._GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises);
|
|
108
125
|
}
|
|
109
126
|
else if (key === "map_kd" && material) {
|
|
110
127
|
// Diffuse texture map with a loaded image
|
|
111
|
-
material.diffuseTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
|
|
128
|
+
material.diffuseTexture = MTLFileLoader._GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises);
|
|
112
129
|
}
|
|
113
130
|
else if (key === "map_ks" && material) {
|
|
114
131
|
// Specular texture map with a loaded image
|
|
115
132
|
//We must first get the folder of the image
|
|
116
|
-
material.specularTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
|
|
133
|
+
material.specularTexture = MTLFileLoader._GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises);
|
|
117
134
|
}
|
|
118
135
|
else if (key === "map_ns") {
|
|
119
136
|
//Specular
|
|
@@ -133,14 +150,14 @@ export class MTLFileLoader {
|
|
|
133
150
|
bumpMultiplier = values[bumpMultiplierIndex + 1];
|
|
134
151
|
values.splice(bumpMultiplierIndex, 2); // remove
|
|
135
152
|
}
|
|
136
|
-
material.bumpTexture = MTLFileLoader._GetTexture(rootUrl, values.join(" "), scene);
|
|
153
|
+
material.bumpTexture = MTLFileLoader._GetTexture(rootUrl, values.join(" "), scene, assetContainer, invertTextureY, textureLoadPromises);
|
|
137
154
|
if (material.bumpTexture && bumpMultiplier !== null) {
|
|
138
155
|
material.bumpTexture.level = parseFloat(bumpMultiplier);
|
|
139
156
|
}
|
|
140
157
|
}
|
|
141
158
|
else if (key === "map_d" && material) {
|
|
142
159
|
// The dissolve of the material
|
|
143
|
-
material.opacityTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
|
|
160
|
+
material.opacityTexture = MTLFileLoader._GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises);
|
|
144
161
|
//Options for illumination
|
|
145
162
|
}
|
|
146
163
|
else if (key === "illum") {
|
|
@@ -187,6 +204,7 @@ export class MTLFileLoader {
|
|
|
187
204
|
if (material) {
|
|
188
205
|
this.materials.push(material);
|
|
189
206
|
}
|
|
207
|
+
return textureLoadPromises ?? [];
|
|
190
208
|
}
|
|
191
209
|
/**
|
|
192
210
|
* Gets the texture for the material.
|
|
@@ -197,9 +215,12 @@ export class MTLFileLoader {
|
|
|
197
215
|
* @param rootUrl The root url to load from
|
|
198
216
|
* @param value The value stored in the mtl
|
|
199
217
|
* @param scene
|
|
218
|
+
* @param assetContainer The asset container to store the texture in
|
|
219
|
+
* @param invertTextureY Whether to invert the texture on the Y axis
|
|
220
|
+
* @param textureLoadPromises The promises to wait for when loading asynchronously
|
|
200
221
|
* @returns The Texture
|
|
201
222
|
*/
|
|
202
|
-
static _GetTexture(rootUrl, value, scene) {
|
|
223
|
+
static _GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises) {
|
|
203
224
|
if (!value) {
|
|
204
225
|
return null;
|
|
205
226
|
}
|
|
@@ -221,7 +242,54 @@ export class MTLFileLoader {
|
|
|
221
242
|
else {
|
|
222
243
|
url += value;
|
|
223
244
|
}
|
|
224
|
-
|
|
245
|
+
const deferred = textureLoadPromises ? new Deferred() : null;
|
|
246
|
+
if (deferred) {
|
|
247
|
+
// Parsing may throw before returning the array. Observe rejection without changing the original promise returned to the caller.
|
|
248
|
+
// eslint-disable-next-line github/no-then
|
|
249
|
+
void deferred.promise.catch(() => undefined);
|
|
250
|
+
textureLoadPromises.push(deferred.promise);
|
|
251
|
+
}
|
|
252
|
+
let texture;
|
|
253
|
+
const removeFailedTextureFromCache = () => {
|
|
254
|
+
const internalTexture = texture?.getInternalTexture();
|
|
255
|
+
if (!internalTexture) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const texturesCache = scene.getEngine().getLoadedTexturesCache();
|
|
259
|
+
const cacheIndex = texturesCache.indexOf(internalTexture);
|
|
260
|
+
if (cacheIndex !== -1) {
|
|
261
|
+
texturesCache.splice(cacheIndex, 1);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
const blockEntityCollection = scene._blockEntityCollection;
|
|
265
|
+
scene._blockEntityCollection = !!assetContainer;
|
|
266
|
+
try {
|
|
267
|
+
texture = new Texture(url, scene, {
|
|
268
|
+
invertY: invertTextureY,
|
|
269
|
+
onLoad: deferred?.resolve,
|
|
270
|
+
onError: (message, exception) => {
|
|
271
|
+
if (texture) {
|
|
272
|
+
removeFailedTextureFromCache();
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
queueMicrotask(removeFailedTextureFromCache);
|
|
276
|
+
}
|
|
277
|
+
if (deferred) {
|
|
278
|
+
deferred.reject(new Error(`${url}: ${exception?.message || message || "Failed to load texture"}`));
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
texture._parentContainer = assetContainer;
|
|
283
|
+
assetContainer?.textures.push(texture);
|
|
284
|
+
}
|
|
285
|
+
finally {
|
|
286
|
+
scene._blockEntityCollection = blockEntityCollection;
|
|
287
|
+
}
|
|
288
|
+
// A container is not rendered yet, so delayed loading cannot wait for a material bind.
|
|
289
|
+
if (deferred && texture.delayLoadState === Constants.DELAYLOADSTATE_NOTLOADED) {
|
|
290
|
+
texture.delayLoad();
|
|
291
|
+
}
|
|
292
|
+
return texture;
|
|
225
293
|
}
|
|
226
294
|
}
|
|
227
295
|
/**
|
package/OBJ/mtlFileLoader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtlFileLoader.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/mtlFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAInE;;GAEG;AACH,MAAM,OAAO,aAAa;IAA1B;QAMI;;WAEG;QACI,cAAS,GAAuB,EAAE,CAAC;IA+M9C,CAAC;IA7MG;;;;;;;;;;OAUG;IACI,QAAQ,CAAC,KAAY,EAAE,IAA0B,EAAE,OAAe,EAAE,cAAwC;QAC/G,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;YAC9B,OAAO;QACX,CAAC;QAED,+BAA+B;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,kCAAkC;QAClC,MAAM,gBAAgB,GAAG,KAAK,CAAC;QAC/B,uBAAuB;QACvB,IAAI,KAAe,CAAC;QACpB,cAAc;QACd,IAAI,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,CAAC;YACjB,CAAC;QACL,CAAC;QACD,uBAAuB;aAClB,CAAC;YACF,GAAG,IAAI,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1E,CAAC;;AAtND;;GAEG;AACW,8BAAgB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\n\r\nimport { type Scene } from \"core/scene\";\r\nimport { type AssetContainer } from \"core/assetContainer\";\r\n/**\r\n * Class reading and parsing the MTL file bundled with the obj file.\r\n */\r\nexport class MTLFileLoader {\r\n /**\r\n * Invert Y-Axis of referenced textures on load\r\n */\r\n public static INVERT_TEXTURE_Y = true;\r\n\r\n /**\r\n * All material loaded from the mtl will be set here\r\n */\r\n public materials: StandardMaterial[] = [];\r\n\r\n /**\r\n * This function will read the mtl file and create each material described inside\r\n * This function could be improve by adding :\r\n * -some component missing (Ni, Tf...)\r\n * -including the specific options available\r\n *\r\n * @param scene defines the scene the material will be created in\r\n * @param data defines the mtl data to parse\r\n * @param rootUrl defines the rooturl to use in order to load relative dependencies\r\n * @param assetContainer defines the asset container to store the material in (can be null)\r\n */\r\n public parseMTL(scene: Scene, data: string | ArrayBuffer, rootUrl: string, assetContainer: Nullable<AssetContainer>): void {\r\n if (data instanceof ArrayBuffer) {\r\n return;\r\n }\r\n\r\n //Split the lines from the file\r\n const lines = data.split(\"\\n\");\r\n // whitespace char ie: [ \\t\\r\\n\\f]\r\n const delimiterPattern = /\\s+/;\r\n //Array with RGB colors\r\n let color: number[];\r\n //New material\r\n let material: Nullable<StandardMaterial> = null;\r\n\r\n //Look at each line\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i].trim();\r\n\r\n // Blank line or comment\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n }\r\n\r\n //Get the first parameter (keyword)\r\n const pos = line.indexOf(\" \");\r\n let key = pos >= 0 ? line.substring(0, pos) : line;\r\n key = key.toLowerCase();\r\n\r\n //Get the data following the key\r\n const value: string = pos >= 0 ? line.substring(pos + 1).trim() : \"\";\r\n\r\n //This mtl keyword will create the new material\r\n if (key === \"newmtl\") {\r\n //Check if it is the first material.\r\n // Materials specifications are described after this keyword.\r\n if (material) {\r\n //Add the previous material in the material array.\r\n this.materials.push(material);\r\n }\r\n //Create a new material.\r\n // value is the name of the material read in the mtl file\r\n\r\n scene._blockEntityCollection = !!assetContainer;\r\n material = new StandardMaterial(value, scene);\r\n material._parentContainer = assetContainer;\r\n scene._blockEntityCollection = false;\r\n } else if (key === \"kd\" && material) {\r\n // Diffuse color (color under white light) using RGB values\r\n\r\n //value = \"r g b\"\r\n color = value.split(delimiterPattern, 3).map(parseFloat);\r\n //color = [r,g,b]\r\n //Set tghe color into the material\r\n material.diffuseColor = Color3.FromArray(color);\r\n } else if (key === \"ka\" && material) {\r\n // Ambient color (color under shadow) using RGB values\r\n\r\n //value = \"r g b\"\r\n color = value.split(delimiterPattern, 3).map(parseFloat);\r\n //color = [r,g,b]\r\n //Set tghe color into the material\r\n material.ambientColor = Color3.FromArray(color);\r\n } else if (key === \"ks\" && material) {\r\n // Specular color (color when light is reflected from shiny surface) using RGB values\r\n\r\n //value = \"r g b\"\r\n color = value.split(delimiterPattern, 3).map(parseFloat);\r\n //color = [r,g,b]\r\n //Set the color into the material\r\n material.specularColor = Color3.FromArray(color);\r\n } else if (key === \"ke\" && material) {\r\n // Emissive color using RGB values\r\n color = value.split(delimiterPattern, 3).map(parseFloat);\r\n material.emissiveColor = Color3.FromArray(color);\r\n } else if (key === \"ns\" && material) {\r\n //value = \"Integer\"\r\n material.specularPower = parseFloat(value);\r\n } else if (key === \"d\" && material) {\r\n //d is dissolve for current material. It mean alpha for BABYLON\r\n material.alpha = parseFloat(value);\r\n\r\n //Texture\r\n //This part can be improved by adding the possible options of texture\r\n } else if (key === \"map_ka\" && material) {\r\n // ambient texture map with a loaded image\r\n //We must first get the folder of the image\r\n material.ambientTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);\r\n } else if (key === \"map_kd\" && material) {\r\n // Diffuse texture map with a loaded image\r\n material.diffuseTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);\r\n } else if (key === \"map_ks\" && material) {\r\n // Specular texture map with a loaded image\r\n //We must first get the folder of the image\r\n material.specularTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);\r\n } else if (key === \"map_ns\") {\r\n //Specular\r\n //Specular highlight component\r\n //We must first get the folder of the image\r\n //\r\n //Not supported by BABYLON\r\n //\r\n // continue;\r\n } else if (key === \"map_bump\" && material) {\r\n //The bump texture\r\n const values = value.split(delimiterPattern);\r\n const bumpMultiplierIndex = values.indexOf(\"-bm\");\r\n let bumpMultiplier: Nullable<string> = null;\r\n\r\n if (bumpMultiplierIndex >= 0) {\r\n bumpMultiplier = values[bumpMultiplierIndex + 1];\r\n values.splice(bumpMultiplierIndex, 2); // remove\r\n }\r\n\r\n material.bumpTexture = MTLFileLoader._GetTexture(rootUrl, values.join(\" \"), scene);\r\n if (material.bumpTexture && bumpMultiplier !== null) {\r\n material.bumpTexture.level = parseFloat(bumpMultiplier);\r\n }\r\n } else if (key === \"map_d\" && material) {\r\n // The dissolve of the material\r\n material.opacityTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);\r\n\r\n //Options for illumination\r\n } else if (key === \"illum\") {\r\n //Illumination\r\n if (value === \"0\") {\r\n //That mean Kd == Kd\r\n } else if (value === \"1\") {\r\n //Color on and Ambient on\r\n } else if (value === \"2\") {\r\n //Highlight on\r\n } else if (value === \"3\") {\r\n //Reflection on and Ray trace on\r\n } else if (value === \"4\") {\r\n //Transparency: Glass on, Reflection: Ray trace on\r\n } else if (value === \"5\") {\r\n //Reflection: Fresnel on and Ray trace on\r\n } else if (value === \"6\") {\r\n //Transparency: Refraction on, Reflection: Fresnel off and Ray trace on\r\n } else if (value === \"7\") {\r\n //Transparency: Refraction on, Reflection: Fresnel on and Ray trace on\r\n } else if (value === \"8\") {\r\n //Reflection on and Ray trace off\r\n } else if (value === \"9\") {\r\n //Transparency: Glass on, Reflection: Ray trace off\r\n } else if (value === \"10\") {\r\n //Casts shadows onto invisible surfaces\r\n }\r\n } else {\r\n // console.log(\"Unhandled expression at line : \" + i +'\\n' + \"with value : \" + line);\r\n }\r\n }\r\n //At the end of the file, add the last material\r\n if (material) {\r\n this.materials.push(material);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the texture for the material.\r\n *\r\n * If the material is imported from input file,\r\n * We sanitize the url to ensure it takes the texture from aside the material.\r\n *\r\n * @param rootUrl The root url to load from\r\n * @param value The value stored in the mtl\r\n * @param scene\r\n * @returns The Texture\r\n */\r\n private static _GetTexture(rootUrl: string, value: string, scene: Scene): Nullable<Texture> {\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n let url = rootUrl;\r\n // Load from input file.\r\n if (rootUrl === \"file:\") {\r\n let lastDelimiter = value.lastIndexOf(\"\\\\\");\r\n if (lastDelimiter === -1) {\r\n lastDelimiter = value.lastIndexOf(\"/\");\r\n }\r\n\r\n if (lastDelimiter > -1) {\r\n url += value.substring(lastDelimiter + 1);\r\n } else {\r\n url += value;\r\n }\r\n }\r\n // Not from input file.\r\n else {\r\n url += value;\r\n }\r\n\r\n return new Texture(url, scene, false, MTLFileLoader.INVERT_TEXTURE_Y);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"mtlFileLoader.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/mtlFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAA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EAAE,OAAO;gBACzB,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE;oBAC5B,IAAI,OAAO,EAAE,CAAC;wBACV,4BAA4B,EAAE,CAAC;oBACnC,CAAC;yBAAM,CAAC;wBACJ,cAAc,CAAC,4BAA4B,CAAC,CAAC;oBACjD,CAAC;oBACD,IAAI,QAAQ,EAAE,CAAC;wBACX,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,GAAG,KAAK,SAAS,EAAE,OAAO,IAAI,OAAO,IAAI,wBAAwB,EAAE,CAAC,CAAC,CAAC;oBACvG,CAAC;gBACL,CAAC;aACJ,CAAC,CAAC;YACH,OAAO,CAAC,gBAAgB,GAAG,cAAc,CAAC;YAC1C,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;gBAAS,CAAC;YACP,KAAK,CAAC,sBAAsB,GAAG,qBAAqB,CAAC;QACzD,CAAC;QAED,uFAAuF;QACvF,IAAI,QAAQ,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,CAAC,wBAAwB,EAAE,CAAC;YAC5E,OAAO,CAAC,SAAS,EAAE,CAAC;QACxB,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;;AAzSD;;GAEG;AACW,8BAAgB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Deferred } from \"core/Misc/deferred\";\r\n\r\nimport { type Scene } from \"core/scene\";\r\nimport { type AssetContainer } from \"core/assetContainer\";\r\n/**\r\n * Class reading and parsing the MTL file bundled with the obj file.\r\n */\r\nexport class MTLFileLoader {\r\n /**\r\n * Invert Y-Axis of referenced textures on load\r\n */\r\n public static INVERT_TEXTURE_Y = true;\r\n\r\n /**\r\n * All material loaded from the mtl will be set here\r\n */\r\n public materials: StandardMaterial[] = [];\r\n\r\n /**\r\n * This function will read the mtl file and create each material described inside\r\n * This function could be improve by adding :\r\n * -some component missing (Ni, Tf...)\r\n * -including the specific options available\r\n *\r\n * @param scene defines the scene the material will be created in\r\n * @param data defines the mtl data to parse\r\n * @param rootUrl defines the rooturl to use in order to load relative dependencies\r\n * @param assetContainer defines the asset container to store the material in (can be null)\r\n * @param invertTextureY defines whether referenced textures are inverted on the Y axis\r\n * @param materialNames defines which materials to load, or all materials if omitted\r\n * @param trackTextureLoading collects texture loading promises and starts delayed textures when true; defaults to false\r\n * @returns the texture loading promises, or an empty array when trackTextureLoading is false\r\n */\r\n public parseMTL(\r\n scene: Scene,\r\n data: string | ArrayBuffer,\r\n rootUrl: string,\r\n assetContainer: Nullable<AssetContainer>,\r\n invertTextureY = MTLFileLoader.INVERT_TEXTURE_Y,\r\n materialNames?: ReadonlySet<string>,\r\n trackTextureLoading = false\r\n ): Promise<void>[] {\r\n const textureLoadPromises: Nullable<Promise<void>[]> = trackTextureLoading ? [] : null;\r\n if (data instanceof ArrayBuffer) {\r\n return textureLoadPromises ?? [];\r\n }\r\n\r\n //Split the lines from the file\r\n const lines = data.split(\"\\n\");\r\n // whitespace char ie: [ \\t\\r\\n\\f]\r\n const delimiterPattern = /\\s+/;\r\n //Array with RGB colors\r\n let color: number[];\r\n //New material\r\n let material: Nullable<StandardMaterial> = null;\r\n\r\n //Look at each line\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i].trim();\r\n\r\n // Blank line or comment\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n }\r\n\r\n //Get the first parameter (keyword)\r\n const pos = line.indexOf(\" \");\r\n let key = pos >= 0 ? line.substring(0, pos) : line;\r\n key = key.toLowerCase();\r\n\r\n //Get the data following the key\r\n const value: string = pos >= 0 ? line.substring(pos + 1).trim() : \"\";\r\n\r\n //This mtl keyword will create the new material\r\n if (key === \"newmtl\") {\r\n //Check if it is the first material.\r\n // Materials specifications are described after this keyword.\r\n if (material) {\r\n //Add the previous material in the material array.\r\n this.materials.push(material);\r\n }\r\n if (materialNames && !materialNames.has(value)) {\r\n material = null;\r\n continue;\r\n }\r\n //Create a new material.\r\n // value is the name of the material read in the mtl file\r\n\r\n const blockEntityCollection = scene._blockEntityCollection;\r\n scene._blockEntityCollection = !!assetContainer;\r\n try {\r\n material = new StandardMaterial(value, scene);\r\n material._parentContainer = assetContainer;\r\n assetContainer?.materials.push(material);\r\n } finally {\r\n scene._blockEntityCollection = blockEntityCollection;\r\n }\r\n } else if (key === \"kd\" && material) {\r\n // Diffuse color (color under white light) using RGB values\r\n\r\n //value = \"r g b\"\r\n color = value.split(delimiterPattern, 3).map(parseFloat);\r\n //color = [r,g,b]\r\n //Set tghe color into the material\r\n material.diffuseColor = Color3.FromArray(color);\r\n } else if (key === \"ka\" && material) {\r\n // Ambient color (color under shadow) using RGB values\r\n\r\n //value = \"r g b\"\r\n color = value.split(delimiterPattern, 3).map(parseFloat);\r\n //color = [r,g,b]\r\n //Set tghe color into the material\r\n material.ambientColor = Color3.FromArray(color);\r\n } else if (key === \"ks\" && material) {\r\n // Specular color (color when light is reflected from shiny surface) using RGB values\r\n\r\n //value = \"r g b\"\r\n color = value.split(delimiterPattern, 3).map(parseFloat);\r\n //color = [r,g,b]\r\n //Set the color into the material\r\n material.specularColor = Color3.FromArray(color);\r\n } else if (key === \"ke\" && material) {\r\n // Emissive color using RGB values\r\n color = value.split(delimiterPattern, 3).map(parseFloat);\r\n material.emissiveColor = Color3.FromArray(color);\r\n } else if (key === \"ns\" && material) {\r\n //value = \"Integer\"\r\n material.specularPower = parseFloat(value);\r\n } else if (key === \"d\" && material) {\r\n //d is dissolve for current material. It mean alpha for BABYLON\r\n material.alpha = parseFloat(value);\r\n\r\n //Texture\r\n //This part can be improved by adding the possible options of texture\r\n } else if (key === \"map_ka\" && material) {\r\n // ambient texture map with a loaded image\r\n //We must first get the folder of the image\r\n material.ambientTexture = MTLFileLoader._GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises);\r\n } else if (key === \"map_kd\" && material) {\r\n // Diffuse texture map with a loaded image\r\n material.diffuseTexture = MTLFileLoader._GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises);\r\n } else if (key === \"map_ks\" && material) {\r\n // Specular texture map with a loaded image\r\n //We must first get the folder of the image\r\n material.specularTexture = MTLFileLoader._GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises);\r\n } else if (key === \"map_ns\") {\r\n //Specular\r\n //Specular highlight component\r\n //We must first get the folder of the image\r\n //\r\n //Not supported by BABYLON\r\n //\r\n // continue;\r\n } else if (key === \"map_bump\" && material) {\r\n //The bump texture\r\n const values = value.split(delimiterPattern);\r\n const bumpMultiplierIndex = values.indexOf(\"-bm\");\r\n let bumpMultiplier: Nullable<string> = null;\r\n\r\n if (bumpMultiplierIndex >= 0) {\r\n bumpMultiplier = values[bumpMultiplierIndex + 1];\r\n values.splice(bumpMultiplierIndex, 2); // remove\r\n }\r\n\r\n material.bumpTexture = MTLFileLoader._GetTexture(rootUrl, values.join(\" \"), scene, assetContainer, invertTextureY, textureLoadPromises);\r\n if (material.bumpTexture && bumpMultiplier !== null) {\r\n material.bumpTexture.level = parseFloat(bumpMultiplier);\r\n }\r\n } else if (key === \"map_d\" && material) {\r\n // The dissolve of the material\r\n material.opacityTexture = MTLFileLoader._GetTexture(rootUrl, value, scene, assetContainer, invertTextureY, textureLoadPromises);\r\n\r\n //Options for illumination\r\n } else if (key === \"illum\") {\r\n //Illumination\r\n if (value === \"0\") {\r\n //That mean Kd == Kd\r\n } else if (value === \"1\") {\r\n //Color on and Ambient on\r\n } else if (value === \"2\") {\r\n //Highlight on\r\n } else if (value === \"3\") {\r\n //Reflection on and Ray trace on\r\n } else if (value === \"4\") {\r\n //Transparency: Glass on, Reflection: Ray trace on\r\n } else if (value === \"5\") {\r\n //Reflection: Fresnel on and Ray trace on\r\n } else if (value === \"6\") {\r\n //Transparency: Refraction on, Reflection: Fresnel off and Ray trace on\r\n } else if (value === \"7\") {\r\n //Transparency: Refraction on, Reflection: Fresnel on and Ray trace on\r\n } else if (value === \"8\") {\r\n //Reflection on and Ray trace off\r\n } else if (value === \"9\") {\r\n //Transparency: Glass on, Reflection: Ray trace off\r\n } else if (value === \"10\") {\r\n //Casts shadows onto invisible surfaces\r\n }\r\n } else {\r\n // console.log(\"Unhandled expression at line : \" + i +'\\n' + \"with value : \" + line);\r\n }\r\n }\r\n //At the end of the file, add the last material\r\n if (material) {\r\n this.materials.push(material);\r\n }\r\n\r\n return textureLoadPromises ?? [];\r\n }\r\n\r\n /**\r\n * Gets the texture for the material.\r\n *\r\n * If the material is imported from input file,\r\n * We sanitize the url to ensure it takes the texture from aside the material.\r\n *\r\n * @param rootUrl The root url to load from\r\n * @param value The value stored in the mtl\r\n * @param scene\r\n * @param assetContainer The asset container to store the texture in\r\n * @param invertTextureY Whether to invert the texture on the Y axis\r\n * @param textureLoadPromises The promises to wait for when loading asynchronously\r\n * @returns The Texture\r\n */\r\n private static _GetTexture(\r\n rootUrl: string,\r\n value: string,\r\n scene: Scene,\r\n assetContainer: Nullable<AssetContainer>,\r\n invertTextureY: boolean,\r\n textureLoadPromises?: Nullable<Promise<void>[]>\r\n ): Nullable<Texture> {\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n let url = rootUrl;\r\n // Load from input file.\r\n if (rootUrl === \"file:\") {\r\n let lastDelimiter = value.lastIndexOf(\"\\\\\");\r\n if (lastDelimiter === -1) {\r\n lastDelimiter = value.lastIndexOf(\"/\");\r\n }\r\n\r\n if (lastDelimiter > -1) {\r\n url += value.substring(lastDelimiter + 1);\r\n } else {\r\n url += value;\r\n }\r\n }\r\n // Not from input file.\r\n else {\r\n url += value;\r\n }\r\n\r\n const deferred = textureLoadPromises ? new Deferred<void>() : null;\r\n if (deferred) {\r\n // Parsing may throw before returning the array. Observe rejection without changing the original promise returned to the caller.\r\n // eslint-disable-next-line github/no-then\r\n void deferred.promise.catch(() => undefined);\r\n textureLoadPromises!.push(deferred.promise);\r\n }\r\n\r\n let texture: Texture | undefined;\r\n const removeFailedTextureFromCache = () => {\r\n const internalTexture = texture?.getInternalTexture();\r\n if (!internalTexture) {\r\n return;\r\n }\r\n\r\n const texturesCache = scene.getEngine().getLoadedTexturesCache();\r\n const cacheIndex = texturesCache.indexOf(internalTexture);\r\n if (cacheIndex !== -1) {\r\n texturesCache.splice(cacheIndex, 1);\r\n }\r\n };\r\n\r\n const blockEntityCollection = scene._blockEntityCollection;\r\n scene._blockEntityCollection = !!assetContainer;\r\n try {\r\n texture = new Texture(url, scene, {\r\n invertY: invertTextureY,\r\n onLoad: deferred?.resolve,\r\n onError: (message, exception) => {\r\n if (texture) {\r\n removeFailedTextureFromCache();\r\n } else {\r\n queueMicrotask(removeFailedTextureFromCache);\r\n }\r\n if (deferred) {\r\n deferred.reject(new Error(`${url}: ${exception?.message || message || \"Failed to load texture\"}`));\r\n }\r\n },\r\n });\r\n texture._parentContainer = assetContainer;\r\n assetContainer?.textures.push(texture);\r\n } finally {\r\n scene._blockEntityCollection = blockEntityCollection;\r\n }\r\n\r\n // A container is not rendered yet, so delayed loading cannot wait for a material bind.\r\n if (deferred && texture.delayLoadState === Constants.DELAYLOADSTATE_NOTLOADED) {\r\n texture.delayLoad();\r\n }\r\n return texture;\r\n }\r\n}\r\n"]}
|
|
@@ -25,6 +25,11 @@ export declare class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoa
|
|
|
25
25
|
*/
|
|
26
26
|
static get INVERT_TEXTURE_Y(): boolean;
|
|
27
27
|
static set INVERT_TEXTURE_Y(value: boolean);
|
|
28
|
+
/**
|
|
29
|
+
* Wait for referenced textures to finish loading before completing the OBJ load.
|
|
30
|
+
* Defaults to false for backwards compatibility.
|
|
31
|
+
*/
|
|
32
|
+
static WAIT_FOR_TEXTURES: boolean;
|
|
28
33
|
/**
|
|
29
34
|
* Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
|
|
30
35
|
*/
|
|
@@ -45,6 +45,7 @@ export class OBJFileLoader {
|
|
|
45
45
|
importVertexColors: OBJFileLoader.IMPORT_VERTEX_COLORS,
|
|
46
46
|
invertY: OBJFileLoader.INVERT_Y,
|
|
47
47
|
invertTextureY: OBJFileLoader.INVERT_TEXTURE_Y,
|
|
48
|
+
waitForTextures: OBJFileLoader.WAIT_FOR_TEXTURES,
|
|
48
49
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
49
50
|
UVScaling: OBJFileLoader.UV_SCALING,
|
|
50
51
|
materialLoadingFailsSilently: OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY,
|
|
@@ -118,13 +119,20 @@ export class OBJFileLoader {
|
|
|
118
119
|
//get the meshes from OBJ file
|
|
119
120
|
// eslint-disable-next-line github/no-then
|
|
120
121
|
return this._parseSolidAsync(meshesNames, scene, data, rootUrl).then((meshes) => {
|
|
122
|
+
const geometries = [];
|
|
123
|
+
for (let i = 0; i < meshes.length; ++i) {
|
|
124
|
+
const geometry = meshes[i].geometry;
|
|
125
|
+
if (geometry) {
|
|
126
|
+
geometries.push(geometry);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
121
129
|
return {
|
|
122
130
|
meshes: meshes,
|
|
123
131
|
particleSystems: [],
|
|
124
132
|
skeletons: [],
|
|
125
133
|
animationGroups: [],
|
|
126
134
|
transformNodes: [],
|
|
127
|
-
geometries:
|
|
135
|
+
geometries: geometries,
|
|
128
136
|
lights: [],
|
|
129
137
|
spriteManagers: [],
|
|
130
138
|
};
|
|
@@ -152,38 +160,21 @@ export class OBJFileLoader {
|
|
|
152
160
|
* @param rootUrl The root url for scene and resources
|
|
153
161
|
* @returns The loaded asset container
|
|
154
162
|
*/
|
|
155
|
-
|
|
156
|
-
loadAssetContainerAsync(scene, data, rootUrl) {
|
|
163
|
+
async loadAssetContainerAsync(scene, data, rootUrl) {
|
|
157
164
|
const container = new AssetContainer(scene);
|
|
158
165
|
this._assetContainer = container;
|
|
159
|
-
|
|
160
|
-
//
|
|
161
|
-
.
|
|
162
|
-
result.meshes.forEach((mesh) => container.meshes.push(mesh));
|
|
163
|
-
result.meshes.forEach((mesh) => {
|
|
164
|
-
const material = mesh.material;
|
|
165
|
-
if (material) {
|
|
166
|
-
// Materials
|
|
167
|
-
if (container.materials.indexOf(material) == -1) {
|
|
168
|
-
container.materials.push(material);
|
|
169
|
-
// Textures
|
|
170
|
-
const textures = material.getActiveTextures();
|
|
171
|
-
textures.forEach((t) => {
|
|
172
|
-
if (container.textures.indexOf(t) == -1) {
|
|
173
|
-
container.textures.push(t);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
this._assetContainer = null;
|
|
166
|
+
try {
|
|
167
|
+
// Resources are collected as they are created, including before texture loading settles.
|
|
168
|
+
await this.importMeshAsync(null, scene, data, rootUrl);
|
|
180
169
|
return container;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.
|
|
184
|
-
this._assetContainer = null;
|
|
170
|
+
}
|
|
171
|
+
catch (ex) {
|
|
172
|
+
container.dispose();
|
|
185
173
|
throw ex;
|
|
186
|
-
}
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
this._assetContainer = null;
|
|
177
|
+
}
|
|
187
178
|
}
|
|
188
179
|
/**
|
|
189
180
|
* Read the OBJ file and create an Array of meshes.
|
|
@@ -213,43 +204,31 @@ export class OBJFileLoader {
|
|
|
213
204
|
const mtlPromises = [];
|
|
214
205
|
// Check if we have a file to load
|
|
215
206
|
if (fileToLoad !== "" && !this._loadingOptions.skipMaterials) {
|
|
216
|
-
//Load the
|
|
207
|
+
// Load the MTL and optionally wait for the textures used by the selected meshes.
|
|
217
208
|
mtlPromises.push(new Promise((resolve, reject) => {
|
|
218
|
-
this._loadMTL(fileToLoad, rootUrl, (dataLoaded) => {
|
|
209
|
+
this._loadMTL(fileToLoad, rootUrl, async (dataLoaded) => {
|
|
219
210
|
try {
|
|
220
211
|
//Create materials thanks MTLLoader function
|
|
221
|
-
materialsFromMTLFile.parseMTL(scene, this._decode(dataLoaded), rootUrl, this._assetContainer);
|
|
222
|
-
//
|
|
223
|
-
for (let n = 0; n < materialsFromMTLFile.materials.length; n
|
|
224
|
-
|
|
225
|
-
let
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
while ((_index = materialToUse.indexOf(materialsFromMTLFile.materials[n].name, startIndex)) > -1) {
|
|
232
|
-
_indices.push(_index);
|
|
233
|
-
startIndex = _index + 1;
|
|
234
|
-
}
|
|
235
|
-
//If the material is not used dispose it
|
|
236
|
-
if (_index === -1 && _indices.length === 0) {
|
|
237
|
-
//If the material is not needed, remove it
|
|
238
|
-
materialsFromMTLFile.materials[n].dispose();
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
for (let o = 0; o < _indices.length; o++) {
|
|
242
|
-
//Apply the material to the Mesh for each mesh with the material
|
|
243
|
-
const mesh = babylonMeshesArray[_indices[o]];
|
|
244
|
-
const material = materialsFromMTLFile.materials[n];
|
|
245
|
-
mesh.material = material;
|
|
246
|
-
if (!mesh.getTotalIndices()) {
|
|
247
|
-
// No indices, we need to turn on point cloud
|
|
248
|
-
material.pointsCloud = true;
|
|
249
|
-
}
|
|
212
|
+
const textureLoadPromises = materialsFromMTLFile.parseMTL(scene, this._decode(dataLoaded), rootUrl, this._assetContainer, this._loadingOptions.invertTextureY, new Set(materialToUse), this._loadingOptions.waitForTextures);
|
|
213
|
+
// Parsing creates the selected materials synchronously; only their textures are pending.
|
|
214
|
+
for (let n = 0; n < materialsFromMTLFile.materials.length; ++n) {
|
|
215
|
+
const material = materialsFromMTLFile.materials[n];
|
|
216
|
+
for (let index = materialToUse.indexOf(material.name); index !== -1; index = materialToUse.indexOf(material.name, index + 1)) {
|
|
217
|
+
const mesh = babylonMeshesArray[index];
|
|
218
|
+
mesh.material = material;
|
|
219
|
+
if (!mesh.getTotalIndices()) {
|
|
220
|
+
// No indices, we need to turn on point cloud
|
|
221
|
+
material.pointsCloud = true;
|
|
250
222
|
}
|
|
251
223
|
}
|
|
252
224
|
}
|
|
225
|
+
if (this._loadingOptions.waitForTextures) {
|
|
226
|
+
const results = await Promise.allSettled(textureLoadPromises);
|
|
227
|
+
const rejected = results.find((result) => result.status === "rejected");
|
|
228
|
+
if (rejected) {
|
|
229
|
+
throw rejected.reason;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
253
232
|
resolve();
|
|
254
233
|
}
|
|
255
234
|
catch (e) {
|
|
@@ -281,17 +260,60 @@ export class OBJFileLoader {
|
|
|
281
260
|
// Iterate over the mesh, determine if it is a line mesh, clone or modify the material to line rendering.
|
|
282
261
|
babylonMeshesArray.forEach((mesh) => {
|
|
283
262
|
if (isLine(mesh)) {
|
|
284
|
-
let mat = mesh.material
|
|
263
|
+
let mat = mesh.material;
|
|
264
|
+
if (!mat) {
|
|
265
|
+
const blockEntityCollection = scene._blockEntityCollection;
|
|
266
|
+
scene._blockEntityCollection = !!this._assetContainer;
|
|
267
|
+
try {
|
|
268
|
+
mat = new StandardMaterial(mesh.name + "_line", scene);
|
|
269
|
+
mat._parentContainer = this._assetContainer;
|
|
270
|
+
this._assetContainer?.materials.push(mat);
|
|
271
|
+
}
|
|
272
|
+
finally {
|
|
273
|
+
scene._blockEntityCollection = blockEntityCollection;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
285
276
|
// If another mesh is using this material and it is not a line then we need to clone it.
|
|
286
277
|
const needClone = mat.getBindedMeshes().filter((e) => !isLine(e)).length > 0;
|
|
287
278
|
if (needClone) {
|
|
288
|
-
|
|
279
|
+
// Clone only the material; keep the MTL texture objects shared.
|
|
280
|
+
const sourceMaterial = mat;
|
|
281
|
+
const { ambientTexture, diffuseTexture, specularTexture, bumpTexture, opacityTexture } = sourceMaterial;
|
|
282
|
+
const blockEntityCollection = scene._blockEntityCollection;
|
|
283
|
+
let lineMaterial;
|
|
284
|
+
try {
|
|
285
|
+
sourceMaterial.ambientTexture = null;
|
|
286
|
+
sourceMaterial.diffuseTexture = null;
|
|
287
|
+
sourceMaterial.specularTexture = null;
|
|
288
|
+
sourceMaterial.bumpTexture = null;
|
|
289
|
+
sourceMaterial.opacityTexture = null;
|
|
290
|
+
scene._blockEntityCollection = !!this._assetContainer;
|
|
291
|
+
lineMaterial = sourceMaterial.clone(sourceMaterial.name + "_line");
|
|
292
|
+
lineMaterial._parentContainer = this._assetContainer;
|
|
293
|
+
this._assetContainer?.materials.push(lineMaterial);
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
scene._blockEntityCollection = blockEntityCollection;
|
|
297
|
+
sourceMaterial.ambientTexture = ambientTexture;
|
|
298
|
+
sourceMaterial.diffuseTexture = diffuseTexture;
|
|
299
|
+
sourceMaterial.specularTexture = specularTexture;
|
|
300
|
+
sourceMaterial.bumpTexture = bumpTexture;
|
|
301
|
+
sourceMaterial.opacityTexture = opacityTexture;
|
|
302
|
+
}
|
|
303
|
+
lineMaterial.ambientTexture = ambientTexture;
|
|
304
|
+
lineMaterial.diffuseTexture = diffuseTexture;
|
|
305
|
+
lineMaterial.specularTexture = specularTexture;
|
|
306
|
+
lineMaterial.bumpTexture = bumpTexture;
|
|
307
|
+
lineMaterial.opacityTexture = opacityTexture;
|
|
308
|
+
mat = lineMaterial;
|
|
289
309
|
}
|
|
290
310
|
mat.wireframe = true;
|
|
291
311
|
mesh.material = mat;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
babylonMeshesArray.forEach((mesh) => {
|
|
315
|
+
if (mesh._internalMetadata) {
|
|
316
|
+
mesh._internalMetadata["_isLine"] = undefined;
|
|
295
317
|
}
|
|
296
318
|
});
|
|
297
319
|
return babylonMeshesArray;
|
|
@@ -310,6 +332,11 @@ OBJFileLoader.OPTIMIZE_WITH_UV = true;
|
|
|
310
332
|
* Invert model on y-axis (does a model scaling inversion)
|
|
311
333
|
*/
|
|
312
334
|
OBJFileLoader.INVERT_Y = false;
|
|
335
|
+
/**
|
|
336
|
+
* Wait for referenced textures to finish loading before completing the OBJ load.
|
|
337
|
+
* Defaults to false for backwards compatibility.
|
|
338
|
+
*/
|
|
339
|
+
OBJFileLoader.WAIT_FOR_TEXTURES = false;
|
|
313
340
|
/**
|
|
314
341
|
* Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
|
|
315
342
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objFileLoader.pure.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/objFileLoader.pure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAMH,yBAAyB,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE;;;GAGG;AACH,MAAM,OAAO,aAAa;IAatB;;OAEG;IACI,MAAM,KAAK,gBAAgB;QAC9B,OAAO,aAAa,CAAC,gBAAgB,CAAC;IAC1C,CAAC;IAEM,MAAM,KAAK,gBAAgB,CAAC,KAAc;QAC7C,aAAa,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAC3C,CAAC;IAiDD;;;;OAIG;IACH,YAAY,cAAqD;QAlBjE;;WAEG;QACa,SAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC;QAClD;;WAEG;QACa,eAAU,GAAG,q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B,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;oBAClD,CAAC;gBACL,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,kBAAkB,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;;AAlXD;;GAEG;AACW,sBAAQ,GAAG,MAAM,AAAT,CAAU;AAChC;;GAEG;AACW,8BAAgB,GAAG,IAAI,AAAP,CAAQ;AACtC;;GAEG;AACW,sBAAQ,GAAG,KAAK,AAAR,CAAS;AAY/B;;GAEG;AACW,kCAAoB,GAAG,KAAK,AAAR,CAAS;AAC3C;;GAEG;AACW,6BAAe,GAAG,KAAK,AAAR,CAAS;AACtC;;;GAGG;AACW,8BAAgB,GAAG,KAAK,AAAR,CAAS;AACvC;;GAEG;AACW,wBAAU,GAAiB,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,AAAlC,CAAmC;AAC3D;;GAEG;AACW,4BAAc,GAAG,KAAK,AAAR,CAAS;AAErC;;;;GAIG;AACW,6CAA+B,GAAG,IAAI,AAAP,CAAQ;AAErD;;GAEG;AACW,iCAAmB,GAAG,KAAK,AAAR,CAAS;AA8T9C,0CAA0C;AAE1C,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACjC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,yBAAyB,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;AACnD,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/promise-function-async */\r\nimport { type Nullable } from \"core/types\";\r\nimport { Vector2 } from \"core/Maths/math.vector.pure\";\r\nimport { Tools } from \"core/Misc/tools.pure\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport {\r\n type ISceneLoaderPluginAsync,\r\n type ISceneLoaderPluginFactory,\r\n type ISceneLoaderPlugin,\r\n type ISceneLoaderAsyncResult,\r\n type SceneLoaderPluginOptions,\r\n RegisterSceneLoaderPlugin,\r\n} from \"core/Loading/sceneLoader\";\r\nimport { AssetContainer } from \"core/assetContainer\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { type WebRequest } from \"core/Misc/webRequest\";\r\nimport { OBJFileLoaderMetadata } from \"./objFileLoader.metadata\";\r\nimport { MTLFileLoader } from \"./mtlFileLoader\";\r\nimport { type OBJLoadingOptions } from \"./objLoadingOptions\";\r\nimport { SolidParser } from \"./solidParser\";\r\nimport { type Mesh } from \"core/Meshes/mesh.pure\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial.pure\";\r\n\r\n/**\r\n * OBJ file type loader.\r\n * This is a babylon scene loader plugin.\r\n */\r\nexport class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\r\n /**\r\n * Defines the character encoding used to decode OBJ and MTL files.\r\n */\r\n public static ENCODING = \"auto\";\r\n /**\r\n * Defines if UVs are optimized by default during load.\r\n */\r\n public static OPTIMIZE_WITH_UV = true;\r\n /**\r\n * Invert model on y-axis (does a model scaling inversion)\r\n */\r\n public static INVERT_Y = false;\r\n /**\r\n * Invert Y-Axis of referenced textures on load\r\n */\r\n public static get INVERT_TEXTURE_Y() {\r\n return MTLFileLoader.INVERT_TEXTURE_Y;\r\n }\r\n\r\n public static set INVERT_TEXTURE_Y(value: boolean) {\r\n MTLFileLoader.INVERT_TEXTURE_Y = value;\r\n }\r\n\r\n /**\r\n * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.\r\n */\r\n public static IMPORT_VERTEX_COLORS = false;\r\n /**\r\n * Compute the normals for the model, even if normals are present in the file.\r\n */\r\n public static COMPUTE_NORMALS = false;\r\n /**\r\n * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.\r\n * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.\r\n */\r\n public static OPTIMIZE_NORMALS = false;\r\n /**\r\n * Defines custom scaling of UV coordinates of loaded meshes.\r\n */\r\n public static UV_SCALING = /*#__PURE__*/ new Vector2(1, 1);\r\n /**\r\n * Skip loading the materials even if defined in the OBJ file (materials are ignored).\r\n */\r\n public static SKIP_MATERIALS = false;\r\n\r\n /**\r\n * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.\r\n *\r\n * Defaults to true for backwards compatibility.\r\n */\r\n public static MATERIAL_LOADING_FAILS_SILENTLY = true;\r\n\r\n /**\r\n * Loads assets without handedness conversions. This flag is for compatibility. Use it only if absolutely required. Defaults to false.\r\n */\r\n public static USE_LEGACY_BEHAVIOR = false;\r\n\r\n /**\r\n * Defines the name of the plugin.\r\n */\r\n public readonly name = OBJFileLoaderMetadata.name;\r\n /**\r\n * Defines the extension the plugin is able to load.\r\n */\r\n public readonly extensions = OBJFileLoaderMetadata.extensions;\r\n\r\n private _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n private _loadingOptions: OBJLoadingOptions;\r\n\r\n /**\r\n * Creates loader for .OBJ files\r\n *\r\n * @param loadingOptions options for loading and parsing OBJ/MTL files.\r\n */\r\n constructor(loadingOptions?: Partial<Readonly<OBJLoadingOptions>>) {\r\n this._loadingOptions = { ...OBJFileLoader._DefaultLoadingOptions, ...(loadingOptions ?? {}) };\r\n }\r\n\r\n private static get _DefaultLoadingOptions(): OBJLoadingOptions {\r\n return {\r\n encoding: OBJFileLoader.ENCODING,\r\n computeNormals: OBJFileLoader.COMPUTE_NORMALS,\r\n optimizeNormals: OBJFileLoader.OPTIMIZE_NORMALS,\r\n importVertexColors: OBJFileLoader.IMPORT_VERTEX_COLORS,\r\n invertY: OBJFileLoader.INVERT_Y,\r\n invertTextureY: OBJFileLoader.INVERT_TEXTURE_Y,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n UVScaling: OBJFileLoader.UV_SCALING,\r\n materialLoadingFailsSilently: OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY,\r\n optimizeWithUV: OBJFileLoader.OPTIMIZE_WITH_UV,\r\n skipMaterials: OBJFileLoader.SKIP_MATERIALS,\r\n useLegacyBehavior: OBJFileLoader.USE_LEGACY_BEHAVIOR,\r\n };\r\n }\r\n\r\n /**\r\n * Calls synchronously the MTL file attached to this obj.\r\n * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.\r\n * Without this function materials are not displayed in the first frame (but displayed after).\r\n * In consequence it is impossible to get material information in your HTML file\r\n *\r\n * @param url The URL of the MTL file\r\n * @param rootUrl defines where to load data from\r\n * @param onSuccess Callback function to be called when the MTL file is loaded\r\n * @param onFailure\r\n */\r\n private _loadMTL(\r\n url: string,\r\n rootUrl: string,\r\n onSuccess: (response: string | ArrayBuffer, responseUrl?: string) => any,\r\n onFailure: (pathOfFile: string, exception?: any) => void\r\n ) {\r\n //The complete path to the mtl file\r\n const pathOfFile = rootUrl + url;\r\n\r\n // Loads through the babylon tools to allow fileInput search.\r\n Tools.LoadFile(pathOfFile, onSuccess, undefined, undefined, true, (request?: WebRequest, exception?: any) => {\r\n onFailure(pathOfFile, exception);\r\n });\r\n }\r\n\r\n private _decode(data: string | ArrayBuffer): string {\r\n if (typeof data === \"string\") {\r\n return data;\r\n }\r\n\r\n const bytes = new Uint8Array(data);\r\n const encoding = this._loadingOptions.encoding ?? \"auto\";\r\n if (encoding !== \"auto\") {\r\n return new TextDecoder(encoding).decode(bytes);\r\n }\r\n\r\n if (bytes[0] === 0xff && bytes[1] === 0xfe) {\r\n return new TextDecoder(\"utf-16le\").decode(bytes);\r\n }\r\n if (bytes[0] === 0xfe && bytes[1] === 0xff) {\r\n return new TextDecoder(\"utf-16be\").decode(bytes);\r\n }\r\n\r\n try {\r\n return new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes);\r\n } catch {\r\n return new TextDecoder(\"gb18030\").decode(bytes);\r\n }\r\n }\r\n\r\n /** @internal */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync | ISceneLoaderPlugin {\r\n return new OBJFileLoader(options[OBJFileLoaderMetadata.name]);\r\n }\r\n\r\n /**\r\n * If the data string can be loaded directly.\r\n * @returns if the data can be loaded directly\r\n */\r\n public canDirectLoad(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Imports one or more meshes from the loaded OBJ data and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param data the OBJ data to load\r\n * @param rootUrl root url to load from\r\n * @returns a promise containing the loaded meshes, particles, skeletons and animations\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string): Promise<ISceneLoaderAsyncResult> {\r\n //get the meshes from OBJ file\r\n // eslint-disable-next-line github/no-then\r\n return this._parseSolidAsync(meshesNames, scene, data, rootUrl).then((meshes) => {\r\n return {\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: [],\r\n animationGroups: [],\r\n transformNodes: [],\r\n geometries: [],\r\n lights: [],\r\n spriteManagers: [],\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Imports all objects from the loaded OBJ data and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data the OBJ data to load\r\n * @param rootUrl root url to load from\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n // eslint-disable-next-line no-restricted-syntax\r\n public loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string): Promise<void> {\r\n //Get the 3D model\r\n // eslint-disable-next-line github/no-then\r\n return this.importMeshAsync(null, scene, data, rootUrl).then(() => {\r\n // return void\r\n });\r\n }\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @returns The loaded asset container\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string): Promise<AssetContainer> {\r\n const container = new AssetContainer(scene);\r\n this._assetContainer = container;\r\n\r\n return (\r\n this.importMeshAsync(null, scene, data, rootUrl)\r\n // eslint-disable-next-line github/no-then\r\n .then((result) => {\r\n result.meshes.forEach((mesh) => container.meshes.push(mesh));\r\n result.meshes.forEach((mesh) => {\r\n const material = mesh.material;\r\n if (material) {\r\n // Materials\r\n if (container.materials.indexOf(material) == -1) {\r\n container.materials.push(material);\r\n\r\n // Textures\r\n const textures = material.getActiveTextures();\r\n textures.forEach((t) => {\r\n if (container.textures.indexOf(t) == -1) {\r\n container.textures.push(t);\r\n }\r\n });\r\n }\r\n }\r\n });\r\n this._assetContainer = null;\r\n return container;\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((ex) => {\r\n this._assetContainer = null;\r\n throw ex;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Read the OBJ file and create an Array of meshes.\r\n * Each mesh contains all information given by the OBJ and the MTL file.\r\n * i.e. vertices positions and indices, optional normals values, optional UV values, optional material\r\n * @param meshesNames defines a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene defines the scene where are displayed the data\r\n * @param data defines the content of the obj file\r\n * @param rootUrl defines the path to the folder\r\n * @returns the list of loaded meshes\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n private _parseSolidAsync(meshesNames: any, scene: Scene, data: string | ArrayBuffer, rootUrl: string): Promise<Array<AbstractMesh>> {\r\n let fileToLoad: string = \"\"; //The name of the mtlFile to load\r\n const materialsFromMTLFile: MTLFileLoader = new MTLFileLoader();\r\n const materialToUse: string[] = [];\r\n const babylonMeshesArray: Array<Mesh> = []; //The mesh for babylon\r\n\r\n data = this._decode(data);\r\n\r\n // Sanitize data\r\n data = data.replace(/#.*$/gm, \"\").trim();\r\n\r\n // Main function\r\n const solidParser = new SolidParser(materialToUse, babylonMeshesArray, this._loadingOptions);\r\n\r\n solidParser.parse(meshesNames, data, scene, this._assetContainer, (fileName: string) => {\r\n fileToLoad = fileName;\r\n });\r\n\r\n // load the materials\r\n const mtlPromises: Array<Promise<void>> = [];\r\n // Check if we have a file to load\r\n if (fileToLoad !== \"\" && !this._loadingOptions.skipMaterials) {\r\n //Load the file synchronously\r\n mtlPromises.push(\r\n new Promise((resolve, reject) => {\r\n this._loadMTL(\r\n fileToLoad,\r\n rootUrl,\r\n (dataLoaded) => {\r\n try {\r\n //Create materials thanks MTLLoader function\r\n materialsFromMTLFile.parseMTL(scene, this._decode(dataLoaded), rootUrl, this._assetContainer);\r\n //Look at each material loaded in the mtl file\r\n for (let n = 0; n < materialsFromMTLFile.materials.length; n++) {\r\n //Three variables to get all meshes with the same material\r\n let startIndex = 0;\r\n const _indices = [];\r\n let _index;\r\n\r\n //The material from MTL file is used in the meshes loaded\r\n //Push the indice in an array\r\n //Check if the material is not used for another mesh\r\n while ((_index = materialToUse.indexOf(materialsFromMTLFile.materials[n].name, startIndex)) > -1) {\r\n _indices.push(_index);\r\n startIndex = _index + 1;\r\n }\r\n //If the material is not used dispose it\r\n if (_index === -1 && _indices.length === 0) {\r\n //If the material is not needed, remove it\r\n materialsFromMTLFile.materials[n].dispose();\r\n } else {\r\n for (let o = 0; o < _indices.length; o++) {\r\n //Apply the material to the Mesh for each mesh with the material\r\n const mesh = babylonMeshesArray[_indices[o]];\r\n const material = materialsFromMTLFile.materials[n];\r\n mesh.material = material;\r\n\r\n if (!mesh.getTotalIndices()) {\r\n // No indices, we need to turn on point cloud\r\n material.pointsCloud = true;\r\n }\r\n }\r\n }\r\n }\r\n resolve();\r\n } catch (e) {\r\n Tools.Warn(`Error processing MTL file: '${fileToLoad}'`);\r\n if (this._loadingOptions.materialLoadingFailsSilently) {\r\n resolve();\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n }\r\n },\r\n (pathOfFile: string, exception?: any) => {\r\n Tools.Warn(`Error downloading MTL file: '${fileToLoad}'`);\r\n if (this._loadingOptions.materialLoadingFailsSilently) {\r\n resolve();\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception);\r\n }\r\n }\r\n );\r\n })\r\n );\r\n }\r\n //Return an array with all Mesh\r\n // eslint-disable-next-line github/no-then\r\n return Promise.all(mtlPromises).then(() => {\r\n const isLine = (mesh: AbstractMesh) => Boolean(mesh._internalMetadata?.[\"_isLine\"] ?? false);\r\n\r\n // Iterate over the mesh, determine if it is a line mesh, clone or modify the material to line rendering.\r\n babylonMeshesArray.forEach((mesh) => {\r\n if (isLine(mesh)) {\r\n let mat = mesh.material ?? new StandardMaterial(mesh.name + \"_line\", scene);\r\n // If another mesh is using this material and it is not a line then we need to clone it.\r\n const needClone = mat.getBindedMeshes().filter((e) => !isLine(e)).length > 0;\r\n if (needClone) {\r\n mat = mat.clone(mat.name + \"_line\") ?? mat;\r\n }\r\n mat.wireframe = true;\r\n mesh.material = mat;\r\n if (mesh._internalMetadata) {\r\n mesh._internalMetadata[\"_isLine\"] = undefined;\r\n }\r\n }\r\n });\r\n\r\n return babylonMeshesArray;\r\n });\r\n }\r\n}\r\n\r\n//Add this loader into the register plugin\r\n\r\nlet _Registered = false;\r\n/**\r\n * Registers the OBJFileLoader scene loader plugin.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterOBJFileLoader(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterSceneLoaderPlugin(new OBJFileLoader());\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"objFileLoader.pure.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/objFileLoader.pure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAMH,yBAAyB,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,q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,qBAAqB;IACjC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,yBAAyB,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;AACnD,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/promise-function-async */\r\nimport { type Nullable } from \"core/types\";\r\nimport { Vector2 } from \"core/Maths/math.vector.pure\";\r\nimport { Tools } from \"core/Misc/tools.pure\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport {\r\n type ISceneLoaderPluginAsync,\r\n type ISceneLoaderPluginFactory,\r\n type ISceneLoaderPlugin,\r\n type ISceneLoaderAsyncResult,\r\n type SceneLoaderPluginOptions,\r\n RegisterSceneLoaderPlugin,\r\n} from \"core/Loading/sceneLoader\";\r\nimport { AssetContainer } from \"core/assetContainer\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { type WebRequest } from \"core/Misc/webRequest\";\r\nimport { OBJFileLoaderMetadata } from \"./objFileLoader.metadata\";\r\nimport { MTLFileLoader } from \"./mtlFileLoader\";\r\nimport { type OBJLoadingOptions } from \"./objLoadingOptions\";\r\nimport { SolidParser } from \"./solidParser\";\r\nimport { type Mesh } from \"core/Meshes/mesh.pure\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial.pure\";\r\nimport { type Geometry } from \"core/Meshes/geometry\";\r\n\r\n/**\r\n * OBJ file type loader.\r\n * This is a babylon scene loader plugin.\r\n */\r\nexport class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\r\n /**\r\n * Defines the character encoding used to decode OBJ and MTL files.\r\n */\r\n public static ENCODING = \"auto\";\r\n /**\r\n * Defines if UVs are optimized by default during load.\r\n */\r\n public static OPTIMIZE_WITH_UV = true;\r\n /**\r\n * Invert model on y-axis (does a model scaling inversion)\r\n */\r\n public static INVERT_Y = false;\r\n /**\r\n * Invert Y-Axis of referenced textures on load\r\n */\r\n public static get INVERT_TEXTURE_Y() {\r\n return MTLFileLoader.INVERT_TEXTURE_Y;\r\n }\r\n\r\n public static set INVERT_TEXTURE_Y(value: boolean) {\r\n MTLFileLoader.INVERT_TEXTURE_Y = value;\r\n }\r\n\r\n /**\r\n * Wait for referenced textures to finish loading before completing the OBJ load.\r\n * Defaults to false for backwards compatibility.\r\n */\r\n public static WAIT_FOR_TEXTURES = false;\r\n\r\n /**\r\n * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.\r\n */\r\n public static IMPORT_VERTEX_COLORS = false;\r\n /**\r\n * Compute the normals for the model, even if normals are present in the file.\r\n */\r\n public static COMPUTE_NORMALS = false;\r\n /**\r\n * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.\r\n * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.\r\n */\r\n public static OPTIMIZE_NORMALS = false;\r\n /**\r\n * Defines custom scaling of UV coordinates of loaded meshes.\r\n */\r\n public static UV_SCALING = /*#__PURE__*/ new Vector2(1, 1);\r\n /**\r\n * Skip loading the materials even if defined in the OBJ file (materials are ignored).\r\n */\r\n public static SKIP_MATERIALS = false;\r\n\r\n /**\r\n * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.\r\n *\r\n * Defaults to true for backwards compatibility.\r\n */\r\n public static MATERIAL_LOADING_FAILS_SILENTLY = true;\r\n\r\n /**\r\n * Loads assets without handedness conversions. This flag is for compatibility. Use it only if absolutely required. Defaults to false.\r\n */\r\n public static USE_LEGACY_BEHAVIOR = false;\r\n\r\n /**\r\n * Defines the name of the plugin.\r\n */\r\n public readonly name = OBJFileLoaderMetadata.name;\r\n /**\r\n * Defines the extension the plugin is able to load.\r\n */\r\n public readonly extensions = OBJFileLoaderMetadata.extensions;\r\n\r\n private _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n private _loadingOptions: OBJLoadingOptions;\r\n\r\n /**\r\n * Creates loader for .OBJ files\r\n *\r\n * @param loadingOptions options for loading and parsing OBJ/MTL files.\r\n */\r\n constructor(loadingOptions?: Partial<Readonly<OBJLoadingOptions>>) {\r\n this._loadingOptions = { ...OBJFileLoader._DefaultLoadingOptions, ...(loadingOptions ?? {}) };\r\n }\r\n\r\n private static get _DefaultLoadingOptions(): OBJLoadingOptions {\r\n return {\r\n encoding: OBJFileLoader.ENCODING,\r\n computeNormals: OBJFileLoader.COMPUTE_NORMALS,\r\n optimizeNormals: OBJFileLoader.OPTIMIZE_NORMALS,\r\n importVertexColors: OBJFileLoader.IMPORT_VERTEX_COLORS,\r\n invertY: OBJFileLoader.INVERT_Y,\r\n invertTextureY: OBJFileLoader.INVERT_TEXTURE_Y,\r\n waitForTextures: OBJFileLoader.WAIT_FOR_TEXTURES,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n UVScaling: OBJFileLoader.UV_SCALING,\r\n materialLoadingFailsSilently: OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY,\r\n optimizeWithUV: OBJFileLoader.OPTIMIZE_WITH_UV,\r\n skipMaterials: OBJFileLoader.SKIP_MATERIALS,\r\n useLegacyBehavior: OBJFileLoader.USE_LEGACY_BEHAVIOR,\r\n };\r\n }\r\n\r\n /**\r\n * Calls synchronously the MTL file attached to this obj.\r\n * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.\r\n * Without this function materials are not displayed in the first frame (but displayed after).\r\n * In consequence it is impossible to get material information in your HTML file\r\n *\r\n * @param url The URL of the MTL file\r\n * @param rootUrl defines where to load data from\r\n * @param onSuccess Callback function to be called when the MTL file is loaded\r\n * @param onFailure\r\n */\r\n private _loadMTL(\r\n url: string,\r\n rootUrl: string,\r\n onSuccess: (response: string | ArrayBuffer, responseUrl?: string) => any,\r\n onFailure: (pathOfFile: string, exception?: any) => void\r\n ) {\r\n //The complete path to the mtl file\r\n const pathOfFile = rootUrl + url;\r\n\r\n // Loads through the babylon tools to allow fileInput search.\r\n Tools.LoadFile(pathOfFile, onSuccess, undefined, undefined, true, (request?: WebRequest, exception?: any) => {\r\n onFailure(pathOfFile, exception);\r\n });\r\n }\r\n\r\n private _decode(data: string | ArrayBuffer): string {\r\n if (typeof data === \"string\") {\r\n return data;\r\n }\r\n\r\n const bytes = new Uint8Array(data);\r\n const encoding = this._loadingOptions.encoding ?? \"auto\";\r\n if (encoding !== \"auto\") {\r\n return new TextDecoder(encoding).decode(bytes);\r\n }\r\n\r\n if (bytes[0] === 0xff && bytes[1] === 0xfe) {\r\n return new TextDecoder(\"utf-16le\").decode(bytes);\r\n }\r\n if (bytes[0] === 0xfe && bytes[1] === 0xff) {\r\n return new TextDecoder(\"utf-16be\").decode(bytes);\r\n }\r\n\r\n try {\r\n return new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes);\r\n } catch {\r\n return new TextDecoder(\"gb18030\").decode(bytes);\r\n }\r\n }\r\n\r\n /** @internal */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync | ISceneLoaderPlugin {\r\n return new OBJFileLoader(options[OBJFileLoaderMetadata.name]);\r\n }\r\n\r\n /**\r\n * If the data string can be loaded directly.\r\n * @returns if the data can be loaded directly\r\n */\r\n public canDirectLoad(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Imports one or more meshes from the loaded OBJ data and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param data the OBJ data to load\r\n * @param rootUrl root url to load from\r\n * @returns a promise containing the loaded meshes, particles, skeletons and animations\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string): Promise<ISceneLoaderAsyncResult> {\r\n //get the meshes from OBJ file\r\n // eslint-disable-next-line github/no-then\r\n return this._parseSolidAsync(meshesNames, scene, data, rootUrl).then((meshes) => {\r\n const geometries: Geometry[] = [];\r\n for (let i = 0; i < meshes.length; ++i) {\r\n const geometry = (meshes[i] as Mesh).geometry;\r\n if (geometry) {\r\n geometries.push(geometry);\r\n }\r\n }\r\n return {\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: [],\r\n animationGroups: [],\r\n transformNodes: [],\r\n geometries: geometries,\r\n lights: [],\r\n spriteManagers: [],\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Imports all objects from the loaded OBJ data and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data the OBJ data to load\r\n * @param rootUrl root url to load from\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n // eslint-disable-next-line no-restricted-syntax\r\n public loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string): Promise<void> {\r\n //Get the 3D model\r\n // eslint-disable-next-line github/no-then\r\n return this.importMeshAsync(null, scene, data, rootUrl).then(() => {\r\n // return void\r\n });\r\n }\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @returns The loaded asset container\r\n */\r\n public async loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string): Promise<AssetContainer> {\r\n const container = new AssetContainer(scene);\r\n this._assetContainer = container;\r\n\r\n try {\r\n // Resources are collected as they are created, including before texture loading settles.\r\n await this.importMeshAsync(null, scene, data, rootUrl);\r\n return container;\r\n } catch (ex) {\r\n container.dispose();\r\n throw ex;\r\n } finally {\r\n this._assetContainer = null;\r\n }\r\n }\r\n\r\n /**\r\n * Read the OBJ file and create an Array of meshes.\r\n * Each mesh contains all information given by the OBJ and the MTL file.\r\n * i.e. vertices positions and indices, optional normals values, optional UV values, optional material\r\n * @param meshesNames defines a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene defines the scene where are displayed the data\r\n * @param data defines the content of the obj file\r\n * @param rootUrl defines the path to the folder\r\n * @returns the list of loaded meshes\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n private _parseSolidAsync(meshesNames: any, scene: Scene, data: string | ArrayBuffer, rootUrl: string): Promise<Array<AbstractMesh>> {\r\n let fileToLoad: string = \"\"; //The name of the mtlFile to load\r\n const materialsFromMTLFile: MTLFileLoader = new MTLFileLoader();\r\n const materialToUse: string[] = [];\r\n const babylonMeshesArray: Array<Mesh> = []; //The mesh for babylon\r\n\r\n data = this._decode(data);\r\n\r\n // Sanitize data\r\n data = data.replace(/#.*$/gm, \"\").trim();\r\n\r\n // Main function\r\n const solidParser = new SolidParser(materialToUse, babylonMeshesArray, this._loadingOptions);\r\n\r\n solidParser.parse(meshesNames, data, scene, this._assetContainer, (fileName: string) => {\r\n fileToLoad = fileName;\r\n });\r\n\r\n // load the materials\r\n const mtlPromises: Array<Promise<void>> = [];\r\n // Check if we have a file to load\r\n if (fileToLoad !== \"\" && !this._loadingOptions.skipMaterials) {\r\n // Load the MTL and optionally wait for the textures used by the selected meshes.\r\n mtlPromises.push(\r\n new Promise((resolve, reject) => {\r\n this._loadMTL(\r\n fileToLoad,\r\n rootUrl,\r\n async (dataLoaded) => {\r\n try {\r\n //Create materials thanks MTLLoader function\r\n const textureLoadPromises = materialsFromMTLFile.parseMTL(\r\n scene,\r\n this._decode(dataLoaded),\r\n rootUrl,\r\n this._assetContainer,\r\n this._loadingOptions.invertTextureY,\r\n new Set(materialToUse),\r\n this._loadingOptions.waitForTextures\r\n );\r\n // Parsing creates the selected materials synchronously; only their textures are pending.\r\n for (let n = 0; n < materialsFromMTLFile.materials.length; ++n) {\r\n const material = materialsFromMTLFile.materials[n];\r\n for (let index = materialToUse.indexOf(material.name); index !== -1; index = materialToUse.indexOf(material.name, index + 1)) {\r\n const mesh = babylonMeshesArray[index];\r\n mesh.material = material;\r\n\r\n if (!mesh.getTotalIndices()) {\r\n // No indices, we need to turn on point cloud\r\n material.pointsCloud = true;\r\n }\r\n }\r\n }\r\n if (this._loadingOptions.waitForTextures) {\r\n const results = await Promise.allSettled(textureLoadPromises);\r\n const rejected = results.find((result) => result.status === \"rejected\");\r\n if (rejected) {\r\n throw rejected.reason;\r\n }\r\n }\r\n resolve();\r\n } catch (e) {\r\n Tools.Warn(`Error processing MTL file: '${fileToLoad}'`);\r\n if (this._loadingOptions.materialLoadingFailsSilently) {\r\n resolve();\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n }\r\n },\r\n (pathOfFile: string, exception?: any) => {\r\n Tools.Warn(`Error downloading MTL file: '${fileToLoad}'`);\r\n if (this._loadingOptions.materialLoadingFailsSilently) {\r\n resolve();\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception);\r\n }\r\n }\r\n );\r\n })\r\n );\r\n }\r\n //Return an array with all Mesh\r\n // eslint-disable-next-line github/no-then\r\n return Promise.all(mtlPromises).then(() => {\r\n const isLine = (mesh: AbstractMesh) => Boolean(mesh._internalMetadata?.[\"_isLine\"] ?? false);\r\n\r\n // Iterate over the mesh, determine if it is a line mesh, clone or modify the material to line rendering.\r\n babylonMeshesArray.forEach((mesh) => {\r\n if (isLine(mesh)) {\r\n let mat = mesh.material;\r\n if (!mat) {\r\n const blockEntityCollection = scene._blockEntityCollection;\r\n scene._blockEntityCollection = !!this._assetContainer;\r\n try {\r\n mat = new StandardMaterial(mesh.name + \"_line\", scene);\r\n mat._parentContainer = this._assetContainer;\r\n this._assetContainer?.materials.push(mat);\r\n } finally {\r\n scene._blockEntityCollection = blockEntityCollection;\r\n }\r\n }\r\n // If another mesh is using this material and it is not a line then we need to clone it.\r\n const needClone = mat.getBindedMeshes().filter((e) => !isLine(e)).length > 0;\r\n if (needClone) {\r\n // Clone only the material; keep the MTL texture objects shared.\r\n const sourceMaterial = mat as StandardMaterial;\r\n const { ambientTexture, diffuseTexture, specularTexture, bumpTexture, opacityTexture } = sourceMaterial;\r\n const blockEntityCollection = scene._blockEntityCollection;\r\n let lineMaterial: StandardMaterial;\r\n try {\r\n sourceMaterial.ambientTexture = null;\r\n sourceMaterial.diffuseTexture = null;\r\n sourceMaterial.specularTexture = null;\r\n sourceMaterial.bumpTexture = null;\r\n sourceMaterial.opacityTexture = null;\r\n scene._blockEntityCollection = !!this._assetContainer;\r\n lineMaterial = sourceMaterial.clone(sourceMaterial.name + \"_line\");\r\n lineMaterial._parentContainer = this._assetContainer;\r\n this._assetContainer?.materials.push(lineMaterial);\r\n } finally {\r\n scene._blockEntityCollection = blockEntityCollection;\r\n sourceMaterial.ambientTexture = ambientTexture;\r\n sourceMaterial.diffuseTexture = diffuseTexture;\r\n sourceMaterial.specularTexture = specularTexture;\r\n sourceMaterial.bumpTexture = bumpTexture;\r\n sourceMaterial.opacityTexture = opacityTexture;\r\n }\r\n lineMaterial.ambientTexture = ambientTexture;\r\n lineMaterial.diffuseTexture = diffuseTexture;\r\n lineMaterial.specularTexture = specularTexture;\r\n lineMaterial.bumpTexture = bumpTexture;\r\n lineMaterial.opacityTexture = opacityTexture;\r\n mat = lineMaterial;\r\n }\r\n mat.wireframe = true;\r\n mesh.material = mat;\r\n }\r\n });\r\n babylonMeshesArray.forEach((mesh) => {\r\n if (mesh._internalMetadata) {\r\n mesh._internalMetadata[\"_isLine\"] = undefined;\r\n }\r\n });\r\n\r\n return babylonMeshesArray;\r\n });\r\n }\r\n}\r\n\r\n//Add this loader into the register plugin\r\n\r\nlet _Registered = false;\r\n/**\r\n * Registers the OBJFileLoader scene loader plugin.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterOBJFileLoader(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterSceneLoaderPlugin(new OBJFileLoader());\r\n}\r\n"]}
|
|
@@ -25,6 +25,12 @@ export type OBJLoadingOptions = {
|
|
|
25
25
|
* Invert Y-Axis of referenced textures on load
|
|
26
26
|
*/
|
|
27
27
|
invertTextureY: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Wait for referenced textures to finish loading before completing the OBJ load.
|
|
30
|
+
* When enabled, texture loading failures follow materialLoadingFailsSilently.
|
|
31
|
+
* Defaults to false for backwards compatibility.
|
|
32
|
+
*/
|
|
33
|
+
waitForTextures?: boolean;
|
|
28
34
|
/**
|
|
29
35
|
* Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
|
|
30
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objLoadingOptions.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/objLoadingOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { type Vector2 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Options for loading OBJ/MTL files\r\n */\r\nexport type OBJLoadingOptions = {\r\n /**\r\n * Defines the character encoding used to decode OBJ and MTL files.\r\n * Use \"auto\" to detect UTF-8/UTF-16 and fall back to GB18030, or provide an encoding label supported by TextDecoder.\r\n * Defaults to \"auto\".\r\n */\r\n encoding?: string;\r\n /**\r\n * Defines if UVs are optimized by default during load.\r\n */\r\n optimizeWithUV: boolean;\r\n /**\r\n * Defines custom scaling of UV coordinates of loaded meshes.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n UVScaling: Vector2;\r\n /**\r\n * Invert model on y-axis (does a model scaling inversion)\r\n */\r\n invertY: boolean;\r\n /**\r\n * Invert Y-Axis of referenced textures on load\r\n */\r\n invertTextureY: boolean;\r\n /**\r\n * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.\r\n */\r\n importVertexColors: boolean;\r\n /**\r\n * Compute the normals for the model, even if normals are present in the file.\r\n */\r\n computeNormals: boolean;\r\n /**\r\n * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.\r\n * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.\r\n */\r\n optimizeNormals: boolean;\r\n /**\r\n * Skip loading the materials even if defined in the OBJ file (materials are ignored).\r\n */\r\n skipMaterials: boolean;\r\n /**\r\n * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.\r\n */\r\n materialLoadingFailsSilently: boolean;\r\n /**\r\n * Loads assets without handedness conversions. This flag is for compatibility. Use it only if absolutely required. Defaults to false.\r\n */\r\n useLegacyBehavior: boolean;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"objLoadingOptions.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/objLoadingOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { type Vector2 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Options for loading OBJ/MTL files\r\n */\r\nexport type OBJLoadingOptions = {\r\n /**\r\n * Defines the character encoding used to decode OBJ and MTL files.\r\n * Use \"auto\" to detect UTF-8/UTF-16 and fall back to GB18030, or provide an encoding label supported by TextDecoder.\r\n * Defaults to \"auto\".\r\n */\r\n encoding?: string;\r\n /**\r\n * Defines if UVs are optimized by default during load.\r\n */\r\n optimizeWithUV: boolean;\r\n /**\r\n * Defines custom scaling of UV coordinates of loaded meshes.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n UVScaling: Vector2;\r\n /**\r\n * Invert model on y-axis (does a model scaling inversion)\r\n */\r\n invertY: boolean;\r\n /**\r\n * Invert Y-Axis of referenced textures on load\r\n */\r\n invertTextureY: boolean;\r\n /**\r\n * Wait for referenced textures to finish loading before completing the OBJ load.\r\n * When enabled, texture loading failures follow materialLoadingFailsSilently.\r\n * Defaults to false for backwards compatibility.\r\n */\r\n waitForTextures?: boolean;\r\n /**\r\n * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.\r\n */\r\n importVertexColors: boolean;\r\n /**\r\n * Compute the normals for the model, even if normals are present in the file.\r\n */\r\n computeNormals: boolean;\r\n /**\r\n * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.\r\n * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.\r\n */\r\n optimizeNormals: boolean;\r\n /**\r\n * Skip loading the materials even if defined in the OBJ file (materials are ignored).\r\n */\r\n skipMaterials: boolean;\r\n /**\r\n * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.\r\n */\r\n materialLoadingFailsSilently: boolean;\r\n /**\r\n * Loads assets without handedness conversions. This flag is for compatibility. Use it only if absolutely required. Defaults to false.\r\n */\r\n useLegacyBehavior: boolean;\r\n};\r\n"]}
|
package/OBJ/solidParser.js
CHANGED
|
@@ -763,7 +763,16 @@ export class SolidParser {
|
|
|
763
763
|
}
|
|
764
764
|
if (!this._materialNameFromObj) {
|
|
765
765
|
// Create a material with point cloud on
|
|
766
|
-
|
|
766
|
+
const blockEntityCollection = scene._blockEntityCollection;
|
|
767
|
+
scene._blockEntityCollection = !!assetContainer;
|
|
768
|
+
try {
|
|
769
|
+
newMaterial = new StandardMaterial(Geometry.RandomId(), scene);
|
|
770
|
+
newMaterial._parentContainer = assetContainer;
|
|
771
|
+
assetContainer?.materials.push(newMaterial);
|
|
772
|
+
}
|
|
773
|
+
finally {
|
|
774
|
+
scene._blockEntityCollection = blockEntityCollection;
|
|
775
|
+
}
|
|
767
776
|
newMaterial.pointsCloud = true;
|
|
768
777
|
this._materialNameFromObj = newMaterial.name;
|
|
769
778
|
if (!this._normals.length) {
|
|
@@ -805,10 +814,17 @@ export class SolidParser {
|
|
|
805
814
|
//Set the data with VertexBuffer for each mesh
|
|
806
815
|
this._handledMesh = this._meshesFromObj[j];
|
|
807
816
|
//Create a Mesh with the name of the obj mesh
|
|
817
|
+
const blockEntityCollection = scene._blockEntityCollection;
|
|
808
818
|
scene._blockEntityCollection = !!assetContainer;
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
819
|
+
let babylonMesh;
|
|
820
|
+
try {
|
|
821
|
+
babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);
|
|
822
|
+
babylonMesh._parentContainer = assetContainer;
|
|
823
|
+
assetContainer?.meshes.push(babylonMesh);
|
|
824
|
+
}
|
|
825
|
+
finally {
|
|
826
|
+
scene._blockEntityCollection = blockEntityCollection;
|
|
827
|
+
}
|
|
812
828
|
this._handledMesh._babylonMesh = babylonMesh;
|
|
813
829
|
// If this is a group mesh, it should have an object mesh as a parent. So look for the first object mesh that appears before it.
|
|
814
830
|
if (!this._handledMesh.isObject) {
|
|
@@ -853,7 +869,16 @@ export class SolidParser {
|
|
|
853
869
|
vertexData.colors = this._handledMesh.colors;
|
|
854
870
|
}
|
|
855
871
|
//Set the data from the VertexBuffer to the current Mesh
|
|
856
|
-
|
|
872
|
+
const blockEntityCollectionBeforeGeometry = scene._blockEntityCollection;
|
|
873
|
+
scene._blockEntityCollection = !!assetContainer;
|
|
874
|
+
try {
|
|
875
|
+
vertexData.applyToMesh(babylonMesh);
|
|
876
|
+
babylonMesh.geometry._parentContainer = assetContainer;
|
|
877
|
+
assetContainer?.geometries.push(babylonMesh.geometry);
|
|
878
|
+
}
|
|
879
|
+
finally {
|
|
880
|
+
scene._blockEntityCollection = blockEntityCollectionBeforeGeometry;
|
|
881
|
+
}
|
|
857
882
|
if (this._loadingOptions.invertY) {
|
|
858
883
|
babylonMesh.scaling.y *= -1;
|
|
859
884
|
}
|
package/OBJ/solidParser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidParser.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/solidParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAIzD,OAAO,EAAE,MAAM,EAAE,M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C,cAAc,EAAE,CAAC;gBACnC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;YAC5D,CAAC;QACL,CAAC;IACL,CAAC;;AA3+BD,aAAa;AACb,wBAAwB;AACV,4BAAgB,GAAG,IAAI,AAAP,CAAQ;AACtC,uBAAuB;AACT,2BAAe,GAAG,IAAI,AAAP,CAAQ;AACrC,8BAA8B;AAChB,iCAAqB,GAAG,UAAU,AAAb,CAAc;AACjD,gCAAgC;AAClB,4BAAgB,GAAG,UAAU,AAAb,CAAc;AAC5C,wBAAwB;AACV,4BAAgB,GAAG,KAAK,AAAR,CAAS;AAEvC,WAAW;AACX,sCAAsC;AACxB,yBAAa,GAAG,8BAA8B,AAAjC,CAAkC;AAC7D,sCAAsC;AACxB,yBAAa,GAAG,kEAAkE,AAArE,CAAsE;AACjG,sCAAsC;AACxB,qBAAS,GAAG,8CAA8C,AAAjD,CAAkD;AACzE,2EAA2E;AAC7D,wBAAY,GAAG,6BAA6B,AAAhC,CAAiC;AAC3D,wFAAwF;AAC1E,wBAAY,GAAG,yCAAyC,AAA5C,CAA6C;AACvE,4GAA4G;AAC9F,wBAAY,GAAG,mDAAmD,AAAtD,CAAuD;AACjF,mGAAmG;AACrF,wBAAY,GAAG,2CAA2C,AAA9C,CAA+C;AACzE,qHAAqH;AACvG,wBAAY,GAAG,sDAAsD,AAAzD,CAA0D;AACpF,qDAAqD;AACvC,wBAAY,GAAG,6BAA6B,AAAhC,CAAiC;AAC3D,6EAA6E;AAC/D,wBAAY,GAAG,yCAAyC,AAA5C,CAA6C;AACvE,0FAA0F;AAC5E,wBAAY,GAAG,mDAAmD,AAAtD,CAAuD","sourcesContent":["import { type AssetContainer } from \"core/assetContainer\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { type Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type OBJLoadingOptions } from \"./objLoadingOptions\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\ntype MeshObject = {\r\n name: string;\r\n indices: Nullable<Array<number>>;\r\n positions: Nullable<Array<number>>;\r\n normals: Nullable<Array<number>>;\r\n colors: Nullable<Array<number>>;\r\n uvs: Nullable<Array<number>>;\r\n materialName: string;\r\n directMaterial?: Nullable<Material>;\r\n isObject: boolean; // If the entity is defined as an object (\"o\"), or group (\"g\")\r\n _babylonMesh?: AbstractMesh; // The corresponding Babylon mesh\r\n hasLines?: boolean; // If the mesh has lines\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 /** Pattern used to detect a line(l vertex vertex) */\r\n public static LinePattern1 = /^l\\s+(([\\d]{1,}[\\s]?){2,})+/;\r\n /** Pattern used to detect a second kind of line (l vertex/uvs vertex/uvs) */\r\n public static LinePattern2 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\r\n /** Pattern used to detect a third kind of line (l vertex/uvs/normal vertex/uvs/normal) */\r\n public static LinePattern3 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\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 _extColors: Array<Color4> = []; //Extension color\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 private _pushTriangle: (faces: Array<string>, faceIndex: number) => void;\r\n private _handednessSign: number;\r\n private _hasLineData: boolean = false; //If this mesh has line segment(l) data\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]]) {\r\n arr[obj[0]] = { normals: [], idx: [] };\r\n }\r\n const 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]]) {\r\n arr[obj[0]] = { normals: [], idx: [], uv: [] };\r\n }\r\n const 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 data The vertex's data\r\n * * indicesPositionFromObj: The index in positions array\r\n * * indicesUvsFromObj: The index in uvs array\r\n * * indicesNormalFromObj: The index in normals array\r\n * * positionVectorFromOBJ: The value of position at index objIndice\r\n * * textureVectorFromOBJ: The value of uvs\r\n * * normalsVectorFromOBJ: The value of normals at index objNormale\r\n * * positionColorsFromOBJ: The value of color at index objIndice\r\n */\r\n private _setData(data: {\r\n indicePositionFromObj: number;\r\n indiceUvsFromObj?: number;\r\n indiceNormalFromObj?: number;\r\n positionVectorFromOBJ: Vector3;\r\n textureVectorFromOBJ?: Vector2;\r\n normalsVectorFromOBJ?: Vector3;\r\n positionColorsFromOBJ?: Color4;\r\n }) {\r\n //Use default values if undefined\r\n data.indiceUvsFromObj ??= -1;\r\n data.indiceNormalFromObj ??= -1;\r\n\r\n //Check if this tuple already exists in the list of tuples\r\n let _index: number;\r\n if (this._loadingOptions.optimizeWithUV) {\r\n _index = this._isInArrayUV(this._tuplePosNorm, [data.indicePositionFromObj, data.indiceNormalFromObj, data.indiceUvsFromObj]);\r\n } else {\r\n _index = this._isInArray(this._tuplePosNorm, [data.indicePositionFromObj, data.indiceNormalFromObj]);\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(data.positionVectorFromOBJ);\r\n\r\n if (data.textureVectorFromOBJ !== undefined) {\r\n //Push the uvs for Babylon\r\n //Each element is a Vector2(u,v)\r\n this._wrappedUvsForBabylon.push(data.textureVectorFromOBJ);\r\n }\r\n if (data.normalsVectorFromOBJ !== undefined) {\r\n //Push the normals for Babylon\r\n //Each element is a Vector3(x,y,z)\r\n this._wrappedNormalsForBabylon.push(data.normalsVectorFromOBJ);\r\n }\r\n if (data.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(data.positionColorsFromOBJ);\r\n }\r\n\r\n //Add the tuple in the comparison list\r\n this._tuplePosNorm[data.indicePositionFromObj].normals.push(data.indiceNormalFromObj);\r\n this._tuplePosNorm[data.indicePositionFromObj].idx.push(this._curPositionInIndices++);\r\n if (this._loadingOptions.optimizeWithUV) {\r\n this._tuplePosNorm[data.indicePositionFromObj].uv.push(data.indiceUvsFromObj);\r\n }\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 try {\r\n //Every array has the same length\r\n for (let 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(\r\n this._wrappedPositionForBabylon[l].x * this._handednessSign,\r\n this._wrappedPositionForBabylon[l].y,\r\n this._wrappedPositionForBabylon[l].z\r\n );\r\n if (this._wrappedNormalsForBabylon.length) {\r\n this._unwrappedNormalsForBabylon.push(\r\n this._wrappedNormalsForBabylon[l].x * this._handednessSign,\r\n this._wrappedNormalsForBabylon[l].y,\r\n this._wrappedNormalsForBabylon[l].z\r\n );\r\n }\r\n if (this._wrappedUvsForBabylon.length) {\r\n this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON\r\n }\r\n if (this._wrappedColorsForBabylon.length) {\r\n //Push the r, g, b, a values of each element in the unwrapped array\r\n this._unwrappedColorsForBabylon.push(\r\n this._wrappedColorsForBabylon[l].r,\r\n this._wrappedColorsForBabylon[l].g,\r\n this._wrappedColorsForBabylon[l].b,\r\n this._wrappedColorsForBabylon[l].a\r\n );\r\n }\r\n }\r\n // Reset arrays for the next new meshes\r\n this._wrappedPositionForBabylon.length = 0;\r\n this._wrappedNormalsForBabylon.length = 0;\r\n this._wrappedUvsForBabylon.length = 0;\r\n this._wrappedColorsForBabylon.length = 0;\r\n this._tuplePosNorm.length = 0;\r\n this._curPositionInIndices = 0;\r\n } catch (e) {\r\n throw new Error(\"Unable to unwrap data while parsing OBJ data.\", { cause: e });\r\n }\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 faces 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 (let faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {\r\n //Add on the triangle variable the indexes to obtain triangles\r\n this._pushTriangle(faces, faceIndex);\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 * To get color between color and extension color\r\n * @param index Integer The index of the element in the array\r\n * @returns value of target color\r\n */\r\n private _getColor(index: number) {\r\n if (this._loadingOptions.importVertexColors) {\r\n return this._extColors[index] ?? this._colors[index];\r\n } else {\r\n return undefined;\r\n }\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 (let k = 0; k < this._triangles.length; k++) {\r\n // Set position indice\r\n const indicePositionFromObj = parseInt(this._triangles[k]) - 1;\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n positionColorsFromOBJ: this._getColor(indicePositionFromObj),\r\n });\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 uvs\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 (let 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 const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\"]\r\n //Set position indice\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n //Set uv indice\r\n const indiceUvsFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n textureVectorFromOBJ: this._uvs[indiceUvsFromObj],\r\n positionColorsFromOBJ: this._getColor(indicePositionFromObj),\r\n });\r\n }\r\n\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 (let 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 const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\", \"1\"]\r\n // Set position indice\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n // Set uv indice\r\n const indiceUvsFromObj = parseInt(point[1]) - 1;\r\n // Set normal indice\r\n const indiceNormalFromObj = parseInt(point[2]) - 1;\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n indiceNormalFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n textureVectorFromOBJ: this._uvs[indiceUvsFromObj],\r\n normalsVectorFromOBJ: this._normals[indiceNormalFromObj],\r\n });\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 (let 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 const point = this._triangles[k].split(\"//\"); // [\"1\", \"1\"]\r\n // We check indices, and normals\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n const indiceNormalFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n indiceNormalFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n normalsVectorFromOBJ: this._normals[indiceNormalFromObj],\r\n positionColorsFromOBJ: this._getColor(indicePositionFromObj),\r\n });\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 (let 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 const point = this._triangles[k].split(\"/\"); // [\"-1\", \"-1\", \"-1\"]\r\n // Set position indice\r\n const indicePositionFromObj = this._positions.length + parseInt(point[0]);\r\n // Set uv indice\r\n const indiceUvsFromObj = this._uvs.length + parseInt(point[1]);\r\n // Set normal indice\r\n const indiceNormalFromObj = this._normals.length + parseInt(point[2]);\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n indiceNormalFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n textureVectorFromOBJ: this._uvs[indiceUvsFromObj],\r\n normalsVectorFromOBJ: this._normals[indiceNormalFromObj],\r\n positionColorsFromOBJ: this._getColor(indicePositionFromObj),\r\n });\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 if (this._loadingOptions.useLegacyBehavior) {\r\n // Reverse tab. Otherwise face are displayed in the wrong sens\r\n this._indicesForBabylon.reverse();\r\n }\r\n\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 if (this._unwrappedNormalsForBabylon.length) {\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();\r\n }\r\n if (this._unwrappedUVForBabylon.length) {\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();\r\n }\r\n if (this._unwrappedColorsForBabylon.length) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();\r\n }\r\n this._handledMesh.hasLines = this._hasLineData;\r\n\r\n //Reset the array for the next mesh\r\n this._indicesForBabylon.length = 0;\r\n this._unwrappedPositionsForBabylon.length = 0;\r\n this._unwrappedColorsForBabylon.length = 0;\r\n this._unwrappedNormalsForBabylon.length = 0;\r\n this._unwrappedUVForBabylon.length = 0;\r\n this._hasLineData = false;\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 private static _IsLineElement(line: string) {\r\n return line.startsWith(\"l\");\r\n }\r\n\r\n private static _IsObjectElement(line: string) {\r\n return line.startsWith(\"o\");\r\n }\r\n\r\n private static _IsGroupElement(line: string) {\r\n return line.startsWith(\"g\");\r\n }\r\n\r\n private static _GetZbrushMRGB(line: string, notParse: boolean) {\r\n if (!line.startsWith(\"mrgb\")) {\r\n return null;\r\n }\r\n line = line.replace(\"mrgb\", \"\").trim();\r\n // if include vertex color , not load mrgb anymore\r\n if (notParse) {\r\n return [];\r\n }\r\n const regex = /[a-z0-9]/g;\r\n const regArray = line.match(regex);\r\n if (!regArray || regArray.length % 8 !== 0) {\r\n return [];\r\n }\r\n const array: Color4[] = [];\r\n for (let regIndex = 0; regIndex < regArray.length / 8; regIndex++) {\r\n //each item is MMRRGGBB, m is material index\r\n // const m = regArray[regIndex * 8 + 0] + regArray[regIndex * 8 + 1];\r\n const r = regArray[regIndex * 8 + 2] + regArray[regIndex * 8 + 3];\r\n const g = regArray[regIndex * 8 + 4] + regArray[regIndex * 8 + 5];\r\n const b = regArray[regIndex * 8 + 6] + regArray[regIndex * 8 + 7];\r\n array.push(new Color4(parseInt(r, 16) / 255, parseInt(g, 16) / 255, parseInt(b, 16) / 255, 1));\r\n }\r\n return array;\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(meshesNames: any, data: string, scene: Scene, assetContainer: Nullable<AssetContainer>, onFileToLoadFound: (fileToLoad: string) => void): void {\r\n //Move Santitize here to forbid delete zbrush data\r\n // Sanitize data\r\n data = data.replace(/#MRGB/g, \"mrgb\");\r\n data = data.replace(/#.*$/gm, \"\").trim();\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n this._handednessSign = 1;\r\n } else if (scene.useRightHandedSystem) {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex + 1], faces[faceIndex]);\r\n this._handednessSign = 1;\r\n } else {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n this._handednessSign = -1;\r\n }\r\n\r\n // Split the file into lines\r\n // Preprocess line data\r\n const linesOBJ = data.split(\"\\n\");\r\n const lineLines: string[][] = [];\r\n let currentGroup: string[] = [];\r\n\r\n lineLines.push(currentGroup);\r\n\r\n for (let i = 0; i < linesOBJ.length; i++) {\r\n const line = linesOBJ[i].trim().replace(/\\s\\s/g, \" \");\r\n\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n }\r\n\r\n if (SolidParser._IsGroupElement(line) || SolidParser._IsObjectElement(line)) {\r\n currentGroup = [];\r\n lineLines.push(currentGroup);\r\n }\r\n\r\n if (SolidParser._IsLineElement(line)) {\r\n const lineValues = line.split(\" \");\r\n // create line elements with two vertices only\r\n for (let i = 1; i < lineValues.length - 1; i++) {\r\n currentGroup.push(`l ${lineValues[i]} ${lineValues[i + 1]}`);\r\n }\r\n } else {\r\n currentGroup.push(line);\r\n }\r\n }\r\n\r\n const lines = lineLines.flat();\r\n // Look at each line\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i].trim().replace(/\\s\\s/g, \" \");\r\n let result;\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n } else if (SolidParser.VertexPattern.test(line)) {\r\n //Get information about one position possible for the vertices\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(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\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(\r\n new Color4(r > 1 ? r / 255 : r, g > 1 ? g / 255 : g, b > 1 ? b / 255 : b, 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 } 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(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\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(parseFloat(result[1]) * this._loadingOptions.UVScaling.x, parseFloat(result[2]) * this._loadingOptions.UVScaling.y));\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 } 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 } 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 } 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 } 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 analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser.LinePattern1.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1 2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern1(\r\n result[1].trim().split(\" \"), // [\"1\", \"2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser.LinePattern2.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1/1 2/2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern2(\r\n result[1].trim().split(\" \"), // [\"1/1\", \"2/2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser._GetZbrushMRGB(line, !this._loadingOptions.importVertexColors))) {\r\n for (const element of result) {\r\n this._extColors.push(element);\r\n }\r\n } else if ((result = SolidParser.LinePattern3.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1/1/1 2/2/2\"]\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\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, 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 const objMesh: MeshObject = {\r\n name: line.substring(2).trim(), //Set the name of the current obj mesh\r\n indices: null,\r\n positions: null,\r\n normals: null,\r\n uvs: null,\r\n colors: null,\r\n materialName: this._materialNameFromObj,\r\n isObject: SolidParser.ObjectDescriptor.test(line),\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 const 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: null,\r\n positions: null,\r\n normals: null,\r\n uvs: null,\r\n colors: null,\r\n materialName: this._materialNameFromObj,\r\n isObject: false,\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 Logger.Log(\"Unhandled expression at line : \" + line);\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 if (this._loadingOptions.useLegacyBehavior) {\r\n //Reverse indices for displaying faces in the good sense\r\n this._indicesForBabylon.reverse();\r\n }\r\n\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 if (this._unwrappedNormalsForBabylon.length) {\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon;\r\n }\r\n if (this._unwrappedUVForBabylon.length) {\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon;\r\n }\r\n if (this._unwrappedColorsForBabylon.length) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon;\r\n }\r\n this._handledMesh.hasLines = this._hasLineData;\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 if (this._loadingOptions.useLegacyBehavior) {\r\n // reverse tab of indices\r\n this._indicesForBabylon.reverse();\r\n }\r\n\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 (const 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 (const 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 (const uv of this._uvs) {\r\n this._unwrappedUVForBabylon.push(uv.x, uv.y);\r\n }\r\n }\r\n\r\n if (this._extColors.length) {\r\n for (const color of this._extColors) {\r\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\r\n }\r\n } else {\r\n if (this._colors.length) {\r\n for (const 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\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 isObject: true,\r\n hasLines: this._hasLineData,\r\n });\r\n }\r\n\r\n //Set data for each mesh\r\n for (let j = 0; j < this._meshesFromObj.length; j++) {\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 } 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 const babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);\r\n babylonMesh._parentContainer = assetContainer;\r\n scene._blockEntityCollection = false;\r\n this._handledMesh._babylonMesh = babylonMesh;\r\n // If this is a group mesh, it should have an object mesh as a parent. So look for the first object mesh that appears before it.\r\n if (!this._handledMesh.isObject) {\r\n for (let k = j - 1; k >= 0; --k) {\r\n if (this._meshesFromObj[k].isObject && this._meshesFromObj[k]._babylonMesh) {\r\n babylonMesh.parent = this._meshesFromObj[k]._babylonMesh!;\r\n break;\r\n }\r\n }\r\n }\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 //If the mesh is a line mesh\r\n if (this._handledMesh.hasLines) {\r\n babylonMesh._internalMetadata ??= {};\r\n babylonMesh._internalMetadata[\"_isLine\"] = true; //this is a line mesh\r\n }\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 const vertexData: VertexData = new VertexData(); //The container for the values\r\n //Set the data for the babylonMesh\r\n vertexData.indices = this._handledMesh.indices;\r\n vertexData.positions = this._handledMesh.positions;\r\n // Empty arrays are truthy; binding a zero-length buffer causes \"Vertex buffer is not big enough for the draw call\".\r\n if (this._loadingOptions.computeNormals || !this._handledMesh.normals?.length) {\r\n // Compute normals if requested or if normals are not defined\r\n const 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;\r\n }\r\n if (this._handledMesh.uvs?.length) {\r\n vertexData.uvs = this._handledMesh.uvs;\r\n }\r\n if (this._handledMesh.colors?.length) {\r\n vertexData.colors = this._handledMesh.colors;\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}\r\n"]}
|
|
1
|
+
{"version":3,"file":"solidParser.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/solidParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAIzD,OAAO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AAC5C,wBAAwB;AACV,4BAAgB,GAAG,KAAK,AAAR,CAAS;AAEvC,WAAW;AACX,sCAAsC;AACxB,yBAAa,GAAG,8BAA8B,AAAjC,CAAkC;AAC7D,sCAAsC;AACxB,yBAAa,GAAG,kEAAkE,AAArE,CAAsE;AACjG,sCAAsC;AACxB,qBAAS,GAAG,8CAA8C,AAAjD,CAAkD;AACzE,2EAA2E;AAC7D,wBAAY,GAAG,6BAA6B,AAAhC,CAAiC;AAC3D,wFAAwF;AAC1E,wBAAY,GAAG,yCAAyC,AAA5C,CAA6C;AACvE,4GAA4G;AAC9F,wBAAY,GAAG,mDAAmD,AAAtD,CAAuD;AACjF,mGAAmG;AACrF,wBAAY,GAAG,2CAA2C,AAA9C,CAA+C;AACzE,qHAAqH;AACvG,wBAAY,GAAG,sDAAsD,AAAzD,CAA0D;AACpF,qDAAqD;AACvC,wBAAY,GAAG,6BAA6B,AAAhC,CAAiC;AAC3D,6EAA6E;AAC/D,wBAAY,GAAG,yCAAyC,AAA5C,CAA6C;AACvE,0FAA0F;AAC5E,wBAAY,GAAG,mDAAmD,AAAtD,CAAuD","sourcesContent":["import { type AssetContainer } from \"core/assetContainer\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { type Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type OBJLoadingOptions } from \"./objLoadingOptions\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\ntype MeshObject = {\r\n name: string;\r\n indices: Nullable<Array<number>>;\r\n positions: Nullable<Array<number>>;\r\n normals: Nullable<Array<number>>;\r\n colors: Nullable<Array<number>>;\r\n uvs: Nullable<Array<number>>;\r\n materialName: string;\r\n directMaterial?: Nullable<Material>;\r\n isObject: boolean; // If the entity is defined as an object (\"o\"), or group (\"g\")\r\n _babylonMesh?: AbstractMesh; // The corresponding Babylon mesh\r\n hasLines?: boolean; // If the mesh has lines\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 /** Pattern used to detect a line(l vertex vertex) */\r\n public static LinePattern1 = /^l\\s+(([\\d]{1,}[\\s]?){2,})+/;\r\n /** Pattern used to detect a second kind of line (l vertex/uvs vertex/uvs) */\r\n public static LinePattern2 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\r\n /** Pattern used to detect a third kind of line (l vertex/uvs/normal vertex/uvs/normal) */\r\n public static LinePattern3 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\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 _extColors: Array<Color4> = []; //Extension color\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 private _pushTriangle: (faces: Array<string>, faceIndex: number) => void;\r\n private _handednessSign: number;\r\n private _hasLineData: boolean = false; //If this mesh has line segment(l) data\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]]) {\r\n arr[obj[0]] = { normals: [], idx: [] };\r\n }\r\n const 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]]) {\r\n arr[obj[0]] = { normals: [], idx: [], uv: [] };\r\n }\r\n const 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 data The vertex's data\r\n * * indicesPositionFromObj: The index in positions array\r\n * * indicesUvsFromObj: The index in uvs array\r\n * * indicesNormalFromObj: The index in normals array\r\n * * positionVectorFromOBJ: The value of position at index objIndice\r\n * * textureVectorFromOBJ: The value of uvs\r\n * * normalsVectorFromOBJ: The value of normals at index objNormale\r\n * * positionColorsFromOBJ: The value of color at index objIndice\r\n */\r\n private _setData(data: {\r\n indicePositionFromObj: number;\r\n indiceUvsFromObj?: number;\r\n indiceNormalFromObj?: number;\r\n positionVectorFromOBJ: Vector3;\r\n textureVectorFromOBJ?: Vector2;\r\n normalsVectorFromOBJ?: Vector3;\r\n positionColorsFromOBJ?: Color4;\r\n }) {\r\n //Use default values if undefined\r\n data.indiceUvsFromObj ??= -1;\r\n data.indiceNormalFromObj ??= -1;\r\n\r\n //Check if this tuple already exists in the list of tuples\r\n let _index: number;\r\n if (this._loadingOptions.optimizeWithUV) {\r\n _index = this._isInArrayUV(this._tuplePosNorm, [data.indicePositionFromObj, data.indiceNormalFromObj, data.indiceUvsFromObj]);\r\n } else {\r\n _index = this._isInArray(this._tuplePosNorm, [data.indicePositionFromObj, data.indiceNormalFromObj]);\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(data.positionVectorFromOBJ);\r\n\r\n if (data.textureVectorFromOBJ !== undefined) {\r\n //Push the uvs for Babylon\r\n //Each element is a Vector2(u,v)\r\n this._wrappedUvsForBabylon.push(data.textureVectorFromOBJ);\r\n }\r\n if (data.normalsVectorFromOBJ !== undefined) {\r\n //Push the normals for Babylon\r\n //Each element is a Vector3(x,y,z)\r\n this._wrappedNormalsForBabylon.push(data.normalsVectorFromOBJ);\r\n }\r\n if (data.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(data.positionColorsFromOBJ);\r\n }\r\n\r\n //Add the tuple in the comparison list\r\n this._tuplePosNorm[data.indicePositionFromObj].normals.push(data.indiceNormalFromObj);\r\n this._tuplePosNorm[data.indicePositionFromObj].idx.push(this._curPositionInIndices++);\r\n if (this._loadingOptions.optimizeWithUV) {\r\n this._tuplePosNorm[data.indicePositionFromObj].uv.push(data.indiceUvsFromObj);\r\n }\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 try {\r\n //Every array has the same length\r\n for (let 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(\r\n this._wrappedPositionForBabylon[l].x * this._handednessSign,\r\n this._wrappedPositionForBabylon[l].y,\r\n this._wrappedPositionForBabylon[l].z\r\n );\r\n if (this._wrappedNormalsForBabylon.length) {\r\n this._unwrappedNormalsForBabylon.push(\r\n this._wrappedNormalsForBabylon[l].x * this._handednessSign,\r\n this._wrappedNormalsForBabylon[l].y,\r\n this._wrappedNormalsForBabylon[l].z\r\n );\r\n }\r\n if (this._wrappedUvsForBabylon.length) {\r\n this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON\r\n }\r\n if (this._wrappedColorsForBabylon.length) {\r\n //Push the r, g, b, a values of each element in the unwrapped array\r\n this._unwrappedColorsForBabylon.push(\r\n this._wrappedColorsForBabylon[l].r,\r\n this._wrappedColorsForBabylon[l].g,\r\n this._wrappedColorsForBabylon[l].b,\r\n this._wrappedColorsForBabylon[l].a\r\n );\r\n }\r\n }\r\n // Reset arrays for the next new meshes\r\n this._wrappedPositionForBabylon.length = 0;\r\n this._wrappedNormalsForBabylon.length = 0;\r\n this._wrappedUvsForBabylon.length = 0;\r\n this._wrappedColorsForBabylon.length = 0;\r\n this._tuplePosNorm.length = 0;\r\n this._curPositionInIndices = 0;\r\n } catch (e) {\r\n throw new Error(\"Unable to unwrap data while parsing OBJ data.\", { cause: e });\r\n }\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 faces 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 (let faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {\r\n //Add on the triangle variable the indexes to obtain triangles\r\n this._pushTriangle(faces, faceIndex);\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 * To get color between color and extension color\r\n * @param index Integer The index of the element in the array\r\n * @returns value of target color\r\n */\r\n private _getColor(index: number) {\r\n if (this._loadingOptions.importVertexColors) {\r\n return this._extColors[index] ?? this._colors[index];\r\n } else {\r\n return undefined;\r\n }\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 (let k = 0; k < this._triangles.length; k++) {\r\n // Set position indice\r\n const indicePositionFromObj = parseInt(this._triangles[k]) - 1;\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n positionColorsFromOBJ: this._getColor(indicePositionFromObj),\r\n });\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 uvs\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 (let 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 const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\"]\r\n //Set position indice\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n //Set uv indice\r\n const indiceUvsFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n textureVectorFromOBJ: this._uvs[indiceUvsFromObj],\r\n positionColorsFromOBJ: this._getColor(indicePositionFromObj),\r\n });\r\n }\r\n\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 (let 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 const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\", \"1\"]\r\n // Set position indice\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n // Set uv indice\r\n const indiceUvsFromObj = parseInt(point[1]) - 1;\r\n // Set normal indice\r\n const indiceNormalFromObj = parseInt(point[2]) - 1;\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n indiceNormalFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n textureVectorFromOBJ: this._uvs[indiceUvsFromObj],\r\n normalsVectorFromOBJ: this._normals[indiceNormalFromObj],\r\n });\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 (let 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 const point = this._triangles[k].split(\"//\"); // [\"1\", \"1\"]\r\n // We check indices, and normals\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n const indiceNormalFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n indiceNormalFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n normalsVectorFromOBJ: this._normals[indiceNormalFromObj],\r\n positionColorsFromOBJ: this._getColor(indicePositionFromObj),\r\n });\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 (let 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 const point = this._triangles[k].split(\"/\"); // [\"-1\", \"-1\", \"-1\"]\r\n // Set position indice\r\n const indicePositionFromObj = this._positions.length + parseInt(point[0]);\r\n // Set uv indice\r\n const indiceUvsFromObj = this._uvs.length + parseInt(point[1]);\r\n // Set normal indice\r\n const indiceNormalFromObj = this._normals.length + parseInt(point[2]);\r\n\r\n this._setData({\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n indiceNormalFromObj,\r\n positionVectorFromOBJ: this._positions[indicePositionFromObj],\r\n textureVectorFromOBJ: this._uvs[indiceUvsFromObj],\r\n normalsVectorFromOBJ: this._normals[indiceNormalFromObj],\r\n positionColorsFromOBJ: this._getColor(indicePositionFromObj),\r\n });\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\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 if (this._loadingOptions.useLegacyBehavior) {\r\n // Reverse tab. Otherwise face are displayed in the wrong sens\r\n this._indicesForBabylon.reverse();\r\n }\r\n\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 if (this._unwrappedNormalsForBabylon.length) {\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();\r\n }\r\n if (this._unwrappedUVForBabylon.length) {\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();\r\n }\r\n if (this._unwrappedColorsForBabylon.length) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();\r\n }\r\n this._handledMesh.hasLines = this._hasLineData;\r\n\r\n //Reset the array for the next mesh\r\n this._indicesForBabylon.length = 0;\r\n this._unwrappedPositionsForBabylon.length = 0;\r\n this._unwrappedColorsForBabylon.length = 0;\r\n this._unwrappedNormalsForBabylon.length = 0;\r\n this._unwrappedUVForBabylon.length = 0;\r\n this._hasLineData = false;\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 private static _IsLineElement(line: string) {\r\n return line.startsWith(\"l\");\r\n }\r\n\r\n private static _IsObjectElement(line: string) {\r\n return line.startsWith(\"o\");\r\n }\r\n\r\n private static _IsGroupElement(line: string) {\r\n return line.startsWith(\"g\");\r\n }\r\n\r\n private static _GetZbrushMRGB(line: string, notParse: boolean) {\r\n if (!line.startsWith(\"mrgb\")) {\r\n return null;\r\n }\r\n line = line.replace(\"mrgb\", \"\").trim();\r\n // if include vertex color , not load mrgb anymore\r\n if (notParse) {\r\n return [];\r\n }\r\n const regex = /[a-z0-9]/g;\r\n const regArray = line.match(regex);\r\n if (!regArray || regArray.length % 8 !== 0) {\r\n return [];\r\n }\r\n const array: Color4[] = [];\r\n for (let regIndex = 0; regIndex < regArray.length / 8; regIndex++) {\r\n //each item is MMRRGGBB, m is material index\r\n // const m = regArray[regIndex * 8 + 0] + regArray[regIndex * 8 + 1];\r\n const r = regArray[regIndex * 8 + 2] + regArray[regIndex * 8 + 3];\r\n const g = regArray[regIndex * 8 + 4] + regArray[regIndex * 8 + 5];\r\n const b = regArray[regIndex * 8 + 6] + regArray[regIndex * 8 + 7];\r\n array.push(new Color4(parseInt(r, 16) / 255, parseInt(g, 16) / 255, parseInt(b, 16) / 255, 1));\r\n }\r\n return array;\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(meshesNames: any, data: string, scene: Scene, assetContainer: Nullable<AssetContainer>, onFileToLoadFound: (fileToLoad: string) => void): void {\r\n //Move Santitize here to forbid delete zbrush data\r\n // Sanitize data\r\n data = data.replace(/#MRGB/g, \"mrgb\");\r\n data = data.replace(/#.*$/gm, \"\").trim();\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n this._handednessSign = 1;\r\n } else if (scene.useRightHandedSystem) {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex + 1], faces[faceIndex]);\r\n this._handednessSign = 1;\r\n } else {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n this._handednessSign = -1;\r\n }\r\n\r\n // Split the file into lines\r\n // Preprocess line data\r\n const linesOBJ = data.split(\"\\n\");\r\n const lineLines: string[][] = [];\r\n let currentGroup: string[] = [];\r\n\r\n lineLines.push(currentGroup);\r\n\r\n for (let i = 0; i < linesOBJ.length; i++) {\r\n const line = linesOBJ[i].trim().replace(/\\s\\s/g, \" \");\r\n\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n }\r\n\r\n if (SolidParser._IsGroupElement(line) || SolidParser._IsObjectElement(line)) {\r\n currentGroup = [];\r\n lineLines.push(currentGroup);\r\n }\r\n\r\n if (SolidParser._IsLineElement(line)) {\r\n const lineValues = line.split(\" \");\r\n // create line elements with two vertices only\r\n for (let i = 1; i < lineValues.length - 1; i++) {\r\n currentGroup.push(`l ${lineValues[i]} ${lineValues[i + 1]}`);\r\n }\r\n } else {\r\n currentGroup.push(line);\r\n }\r\n }\r\n\r\n const lines = lineLines.flat();\r\n // Look at each line\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i].trim().replace(/\\s\\s/g, \" \");\r\n let result;\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n } else if (SolidParser.VertexPattern.test(line)) {\r\n //Get information about one position possible for the vertices\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(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\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(\r\n new Color4(r > 1 ? r / 255 : r, g > 1 ? g / 255 : g, b > 1 ? b / 255 : b, 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 } 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(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\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(parseFloat(result[1]) * this._loadingOptions.UVScaling.x, parseFloat(result[2]) * this._loadingOptions.UVScaling.y));\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 } 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 } 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 } 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 } 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 analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser.LinePattern1.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1 2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern1(\r\n result[1].trim().split(\" \"), // [\"1\", \"2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser.LinePattern2.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1/1 2/2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern2(\r\n result[1].trim().split(\" \"), // [\"1/1\", \"2/2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser._GetZbrushMRGB(line, !this._loadingOptions.importVertexColors))) {\r\n for (const element of result) {\r\n this._extColors.push(element);\r\n }\r\n } else if ((result = SolidParser.LinePattern3.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1/1/1 2/2/2\"]\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\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, 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 const objMesh: MeshObject = {\r\n name: line.substring(2).trim(), //Set the name of the current obj mesh\r\n indices: null,\r\n positions: null,\r\n normals: null,\r\n uvs: null,\r\n colors: null,\r\n materialName: this._materialNameFromObj,\r\n isObject: SolidParser.ObjectDescriptor.test(line),\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 const 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: null,\r\n positions: null,\r\n normals: null,\r\n uvs: null,\r\n colors: null,\r\n materialName: this._materialNameFromObj,\r\n isObject: false,\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 Logger.Log(\"Unhandled expression at line : \" + line);\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 if (this._loadingOptions.useLegacyBehavior) {\r\n //Reverse indices for displaying faces in the good sense\r\n this._indicesForBabylon.reverse();\r\n }\r\n\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 if (this._unwrappedNormalsForBabylon.length) {\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon;\r\n }\r\n if (this._unwrappedUVForBabylon.length) {\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon;\r\n }\r\n if (this._unwrappedColorsForBabylon.length) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon;\r\n }\r\n this._handledMesh.hasLines = this._hasLineData;\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 if (this._loadingOptions.useLegacyBehavior) {\r\n // reverse tab of indices\r\n this._indicesForBabylon.reverse();\r\n }\r\n\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 (const 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 (const 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 (const uv of this._uvs) {\r\n this._unwrappedUVForBabylon.push(uv.x, uv.y);\r\n }\r\n }\r\n\r\n if (this._extColors.length) {\r\n for (const color of this._extColors) {\r\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\r\n }\r\n } else {\r\n if (this._colors.length) {\r\n for (const 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\r\n if (!this._materialNameFromObj) {\r\n // Create a material with point cloud on\r\n const blockEntityCollection = scene._blockEntityCollection;\r\n scene._blockEntityCollection = !!assetContainer;\r\n try {\r\n newMaterial = new StandardMaterial(Geometry.RandomId(), scene);\r\n newMaterial._parentContainer = assetContainer;\r\n assetContainer?.materials.push(newMaterial);\r\n } finally {\r\n scene._blockEntityCollection = blockEntityCollection;\r\n }\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 isObject: true,\r\n hasLines: this._hasLineData,\r\n });\r\n }\r\n\r\n //Set data for each mesh\r\n for (let j = 0; j < this._meshesFromObj.length; j++) {\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 } 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 const blockEntityCollection = scene._blockEntityCollection;\r\n scene._blockEntityCollection = !!assetContainer;\r\n let babylonMesh: Mesh;\r\n try {\r\n babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);\r\n babylonMesh._parentContainer = assetContainer;\r\n assetContainer?.meshes.push(babylonMesh);\r\n } finally {\r\n scene._blockEntityCollection = blockEntityCollection;\r\n }\r\n this._handledMesh._babylonMesh = babylonMesh;\r\n // If this is a group mesh, it should have an object mesh as a parent. So look for the first object mesh that appears before it.\r\n if (!this._handledMesh.isObject) {\r\n for (let k = j - 1; k >= 0; --k) {\r\n if (this._meshesFromObj[k].isObject && this._meshesFromObj[k]._babylonMesh) {\r\n babylonMesh.parent = this._meshesFromObj[k]._babylonMesh!;\r\n break;\r\n }\r\n }\r\n }\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 //If the mesh is a line mesh\r\n if (this._handledMesh.hasLines) {\r\n babylonMesh._internalMetadata ??= {};\r\n babylonMesh._internalMetadata[\"_isLine\"] = true; //this is a line mesh\r\n }\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 const vertexData: VertexData = new VertexData(); //The container for the values\r\n //Set the data for the babylonMesh\r\n vertexData.indices = this._handledMesh.indices;\r\n vertexData.positions = this._handledMesh.positions;\r\n // Empty arrays are truthy; binding a zero-length buffer causes \"Vertex buffer is not big enough for the draw call\".\r\n if (this._loadingOptions.computeNormals || !this._handledMesh.normals?.length) {\r\n // Compute normals if requested or if normals are not defined\r\n const 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;\r\n }\r\n if (this._handledMesh.uvs?.length) {\r\n vertexData.uvs = this._handledMesh.uvs;\r\n }\r\n if (this._handledMesh.colors?.length) {\r\n vertexData.colors = this._handledMesh.colors;\r\n }\r\n //Set the data from the VertexBuffer to the current Mesh\r\n const blockEntityCollectionBeforeGeometry = scene._blockEntityCollection;\r\n scene._blockEntityCollection = !!assetContainer;\r\n try {\r\n vertexData.applyToMesh(babylonMesh);\r\n babylonMesh.geometry!._parentContainer = assetContainer;\r\n assetContainer?.geometries.push(babylonMesh.geometry!);\r\n } finally {\r\n scene._blockEntityCollection = blockEntityCollectionBeforeGeometry;\r\n }\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}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonjs/loaders",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.28.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@babylonjs/core": "9.
|
|
21
|
+
"@babylonjs/core": "9.28.0",
|
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
|
23
23
|
"@dev/loaders": "^1.0.0",
|
|
24
|
-
"babylonjs-gltf2interface": "9.
|
|
24
|
+
"babylonjs-gltf2interface": "9.28.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@babylonjs/core": "^9.0.0",
|