@babylonjs/loaders 5.0.0-rc.7 → 5.0.0-rc.9
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.d.ts +4 -4
- package/OBJ/index.js +4 -4
- package/OBJ/mtlFileLoader.d.ts +41 -41
- package/OBJ/mtlFileLoader.js +232 -232
- package/OBJ/objFileLoader.d.ts +126 -126
- package/OBJ/objFileLoader.js +296 -296
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/solidParser.d.ts +154 -154
- package/OBJ/solidParser.js +693 -693
- package/STL/index.d.ts +1 -1
- package/STL/index.js +1 -1
- package/STL/stlFileLoader.d.ts +64 -64
- package/STL/stlFileLoader.js +233 -233
- package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -60
- package/glTF/1.0/glTFLoader.d.ts +136 -136
- package/glTF/1.0/glTFLoader.js +1815 -1815
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderUtils.d.ts +62 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -250
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
- package/glTF/1.0/index.d.ts +5 -5
- package/glTF/1.0/index.js +5 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -43
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -117
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -36
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -88
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -34
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -49
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -29
- package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -40
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -112
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -36
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -89
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -94
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -53
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -42
- package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -62
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -80
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -84
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -74
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -83
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -288
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -73
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -87
- package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -254
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -85
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -22
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -23
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -29
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -40
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -33
- package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -61
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -32
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -49
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -54
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -240
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -109
- package/glTF/2.0/Extensions/MSFT_lod.js +369 -369
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
- package/glTF/2.0/Extensions/index.d.ts +26 -26
- package/glTF/2.0/Extensions/index.js +26 -26
- package/glTF/2.0/glTFLoader.d.ts +405 -405
- package/glTF/2.0/glTFLoader.js +2366 -2366
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +4 -4
- package/glTF/glTFFileLoader.d.ts +433 -433
- package/glTF/glTFFileLoader.js +927 -927
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -123
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +5 -5
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +14 -14
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -3
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +32 -32
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -3
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -4
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +12 -12
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +12 -12
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +7 -7
- package/package.json +3 -3
@@ -1,43 +1,43 @@
|
|
1
|
-
import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
|
2
|
-
/**
|
3
|
-
* Options for loading OBJ/MTL files
|
4
|
-
*/
|
5
|
-
export declare type OBJLoadingOptions = {
|
6
|
-
/**
|
7
|
-
* Defines if UVs are optimized by default during load.
|
8
|
-
*/
|
9
|
-
optimizeWithUV: boolean;
|
10
|
-
/**
|
11
|
-
* Defines custom scaling of UV coordinates of loaded meshes.
|
12
|
-
*/
|
13
|
-
UVScaling: Vector2;
|
14
|
-
/**
|
15
|
-
* Invert model on y-axis (does a model scaling inversion)
|
16
|
-
*/
|
17
|
-
invertY: boolean;
|
18
|
-
/**
|
19
|
-
* Invert Y-Axis of referenced textures on load
|
20
|
-
*/
|
21
|
-
invertTextureY: boolean;
|
22
|
-
/**
|
23
|
-
* Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
|
24
|
-
*/
|
25
|
-
importVertexColors: boolean;
|
26
|
-
/**
|
27
|
-
* Compute the normals for the model, even if normals are present in the file.
|
28
|
-
*/
|
29
|
-
computeNormals: boolean;
|
30
|
-
/**
|
31
|
-
* 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.
|
32
|
-
* Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.
|
33
|
-
*/
|
34
|
-
optimizeNormals: boolean;
|
35
|
-
/**
|
36
|
-
* Skip loading the materials even if defined in the OBJ file (materials are ignored).
|
37
|
-
*/
|
38
|
-
skipMaterials: boolean;
|
39
|
-
/**
|
40
|
-
* When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
|
41
|
-
*/
|
42
|
-
materialLoadingFailsSilently: boolean;
|
43
|
-
};
|
1
|
+
import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
|
2
|
+
/**
|
3
|
+
* Options for loading OBJ/MTL files
|
4
|
+
*/
|
5
|
+
export declare type OBJLoadingOptions = {
|
6
|
+
/**
|
7
|
+
* Defines if UVs are optimized by default during load.
|
8
|
+
*/
|
9
|
+
optimizeWithUV: boolean;
|
10
|
+
/**
|
11
|
+
* Defines custom scaling of UV coordinates of loaded meshes.
|
12
|
+
*/
|
13
|
+
UVScaling: Vector2;
|
14
|
+
/**
|
15
|
+
* Invert model on y-axis (does a model scaling inversion)
|
16
|
+
*/
|
17
|
+
invertY: boolean;
|
18
|
+
/**
|
19
|
+
* Invert Y-Axis of referenced textures on load
|
20
|
+
*/
|
21
|
+
invertTextureY: boolean;
|
22
|
+
/**
|
23
|
+
* Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
|
24
|
+
*/
|
25
|
+
importVertexColors: boolean;
|
26
|
+
/**
|
27
|
+
* Compute the normals for the model, even if normals are present in the file.
|
28
|
+
*/
|
29
|
+
computeNormals: boolean;
|
30
|
+
/**
|
31
|
+
* 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.
|
32
|
+
* Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.
|
33
|
+
*/
|
34
|
+
optimizeNormals: boolean;
|
35
|
+
/**
|
36
|
+
* Skip loading the materials even if defined in the OBJ file (materials are ignored).
|
37
|
+
*/
|
38
|
+
skipMaterials: boolean;
|
39
|
+
/**
|
40
|
+
* When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
|
41
|
+
*/
|
42
|
+
materialLoadingFailsSilently: boolean;
|
43
|
+
};
|
package/OBJ/objLoadingOptions.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
2
2
|
//# sourceMappingURL=objLoadingOptions.js.map
|
package/OBJ/solidParser.d.ts
CHANGED
@@ -1,154 +1,154 @@
|
|
1
|
-
import { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
2
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
3
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
4
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
5
|
-
import { OBJLoadingOptions } from "./objLoadingOptions";
|
6
|
-
/**
|
7
|
-
* Class used to load mesh data from OBJ content
|
8
|
-
*/
|
9
|
-
export declare class SolidParser {
|
10
|
-
/** Object descriptor */
|
11
|
-
static ObjectDescriptor: RegExp;
|
12
|
-
/** Group descriptor */
|
13
|
-
static GroupDescriptor: RegExp;
|
14
|
-
/** Material lib descriptor */
|
15
|
-
static MtlLibGroupDescriptor: RegExp;
|
16
|
-
/** Use a material descriptor */
|
17
|
-
static UseMtlDescriptor: RegExp;
|
18
|
-
/** Smooth descriptor */
|
19
|
-
static SmoothDescriptor: RegExp;
|
20
|
-
/** Pattern used to detect a vertex */
|
21
|
-
static VertexPattern: RegExp;
|
22
|
-
/** Pattern used to detect a normal */
|
23
|
-
static NormalPattern: RegExp;
|
24
|
-
/** Pattern used to detect a UV set */
|
25
|
-
static UVPattern: RegExp;
|
26
|
-
/** Pattern used to detect a first kind of face (f vertex vertex vertex) */
|
27
|
-
static FacePattern1: RegExp;
|
28
|
-
/** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */
|
29
|
-
static FacePattern2: RegExp;
|
30
|
-
/** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */
|
31
|
-
static FacePattern3: RegExp;
|
32
|
-
/** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/
|
33
|
-
static FacePattern4: RegExp;
|
34
|
-
/** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */
|
35
|
-
static FacePattern5: RegExp;
|
36
|
-
private _loadingOptions;
|
37
|
-
private _positions;
|
38
|
-
private _normals;
|
39
|
-
private _uvs;
|
40
|
-
private _colors;
|
41
|
-
private _meshesFromObj;
|
42
|
-
private _handledMesh;
|
43
|
-
private _indicesForBabylon;
|
44
|
-
private _wrappedPositionForBabylon;
|
45
|
-
private _wrappedUvsForBabylon;
|
46
|
-
private _wrappedColorsForBabylon;
|
47
|
-
private _wrappedNormalsForBabylon;
|
48
|
-
private _tuplePosNorm;
|
49
|
-
private _curPositionInIndices;
|
50
|
-
private _hasMeshes;
|
51
|
-
private _unwrappedPositionsForBabylon;
|
52
|
-
private _unwrappedColorsForBabylon;
|
53
|
-
private _unwrappedNormalsForBabylon;
|
54
|
-
private _unwrappedUVForBabylon;
|
55
|
-
private _triangles;
|
56
|
-
private _materialNameFromObj;
|
57
|
-
private _objMeshName;
|
58
|
-
private _increment;
|
59
|
-
private _isFirstMaterial;
|
60
|
-
private _grayColor;
|
61
|
-
private _materialToUse;
|
62
|
-
private _babylonMeshesArray;
|
63
|
-
/**
|
64
|
-
* Creates a new SolidParser
|
65
|
-
* @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)
|
66
|
-
* @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)
|
67
|
-
* @param loadingOptions defines the loading options to use
|
68
|
-
*/
|
69
|
-
constructor(materialToUse: string[], babylonMeshesArray: Array<Mesh>, loadingOptions: OBJLoadingOptions);
|
70
|
-
/**
|
71
|
-
* Search for obj in the given array.
|
72
|
-
* This function is called to check if a couple of data already exists in an array.
|
73
|
-
*
|
74
|
-
* If found, returns the index of the founded tuple index. Returns -1 if not found
|
75
|
-
* @param arr Array<{ normals: Array<number>, idx: Array<number> }>
|
76
|
-
* @param obj Array<number>
|
77
|
-
* @returns {boolean}
|
78
|
-
*/
|
79
|
-
private _isInArray;
|
80
|
-
private _isInArrayUV;
|
81
|
-
/**
|
82
|
-
* This function set the data for each triangle.
|
83
|
-
* Data are position, normals and uvs
|
84
|
-
* If a tuple of (position, normal) is not set, add the data into the corresponding array
|
85
|
-
* If the tuple already exist, add only their indice
|
86
|
-
*
|
87
|
-
* @param indicePositionFromObj Integer The index in positions array
|
88
|
-
* @param indiceUvsFromObj Integer The index in uvs array
|
89
|
-
* @param indiceNormalFromObj Integer The index in normals array
|
90
|
-
* @param positionVectorFromOBJ Vector3 The value of position at index objIndice
|
91
|
-
* @param textureVectorFromOBJ Vector3 The value of uvs
|
92
|
-
* @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale
|
93
|
-
* @param positionColorsFromOBJ
|
94
|
-
*/
|
95
|
-
private _setData;
|
96
|
-
/**
|
97
|
-
* Transform Vector() and BABYLON.Color() objects into numbers in an array
|
98
|
-
*/
|
99
|
-
private _unwrapData;
|
100
|
-
/**
|
101
|
-
* Create triangles from polygons
|
102
|
-
* It is important to notice that a triangle is a polygon
|
103
|
-
* We get 5 patterns of face defined in OBJ File :
|
104
|
-
* facePattern1 = ["1","2","3","4","5","6"]
|
105
|
-
* facePattern2 = ["1/1","2/2","3/3","4/4","5/5","6/6"]
|
106
|
-
* facePattern3 = ["1/1/1","2/2/2","3/3/3","4/4/4","5/5/5","6/6/6"]
|
107
|
-
* facePattern4 = ["1//1","2//2","3//3","4//4","5//5","6//6"]
|
108
|
-
* facePattern5 = ["-1/-1/-1","-2/-2/-2","-3/-3/-3","-4/-4/-4","-5/-5/-5","-6/-6/-6"]
|
109
|
-
* Each pattern is divided by the same method
|
110
|
-
* @param faces Array[String] The indices of elements
|
111
|
-
* @param v Integer The variable to increment
|
112
|
-
*/
|
113
|
-
private _getTriangles;
|
114
|
-
/**
|
115
|
-
* Create triangles and push the data for each polygon for the pattern 1
|
116
|
-
* In this pattern we get vertice positions
|
117
|
-
* @param face
|
118
|
-
* @param v
|
119
|
-
*/
|
120
|
-
private _setDataForCurrentFaceWithPattern1;
|
121
|
-
/**
|
122
|
-
* Create triangles and push the data for each polygon for the pattern 2
|
123
|
-
* In this pattern we get vertice positions and uvsu
|
124
|
-
* @param face
|
125
|
-
* @param v
|
126
|
-
*/
|
127
|
-
private _setDataForCurrentFaceWithPattern2;
|
128
|
-
/**
|
129
|
-
* Create triangles and push the data for each polygon for the pattern 3
|
130
|
-
* In this pattern we get vertice positions, uvs and normals
|
131
|
-
* @param face
|
132
|
-
* @param v
|
133
|
-
*/
|
134
|
-
private _setDataForCurrentFaceWithPattern3;
|
135
|
-
/**
|
136
|
-
* Create triangles and push the data for each polygon for the pattern 4
|
137
|
-
* In this pattern we get vertice positions and normals
|
138
|
-
* @param face
|
139
|
-
* @param v
|
140
|
-
*/
|
141
|
-
private _setDataForCurrentFaceWithPattern4;
|
142
|
-
private _setDataForCurrentFaceWithPattern5;
|
143
|
-
private _addPreviousObjMesh;
|
144
|
-
private _optimizeNormals;
|
145
|
-
/**
|
146
|
-
* Function used to parse an OBJ string
|
147
|
-
* @param meshesNames defines the list of meshes to load (all if not defined)
|
148
|
-
* @param data defines the OBJ string
|
149
|
-
* @param scene defines the hosting scene
|
150
|
-
* @param assetContainer defines the asset container to load data in
|
151
|
-
* @param onFileToLoadFound defines a callback that will be called if a MTL file is found
|
152
|
-
*/
|
153
|
-
parse(meshesNames: any, data: string, scene: Scene, assetContainer: Nullable<AssetContainer>, onFileToLoadFound: (fileToLoad: string) => void): void;
|
154
|
-
}
|
1
|
+
import { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
2
|
+
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
3
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
4
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
5
|
+
import { OBJLoadingOptions } from "./objLoadingOptions";
|
6
|
+
/**
|
7
|
+
* Class used to load mesh data from OBJ content
|
8
|
+
*/
|
9
|
+
export declare class SolidParser {
|
10
|
+
/** Object descriptor */
|
11
|
+
static ObjectDescriptor: RegExp;
|
12
|
+
/** Group descriptor */
|
13
|
+
static GroupDescriptor: RegExp;
|
14
|
+
/** Material lib descriptor */
|
15
|
+
static MtlLibGroupDescriptor: RegExp;
|
16
|
+
/** Use a material descriptor */
|
17
|
+
static UseMtlDescriptor: RegExp;
|
18
|
+
/** Smooth descriptor */
|
19
|
+
static SmoothDescriptor: RegExp;
|
20
|
+
/** Pattern used to detect a vertex */
|
21
|
+
static VertexPattern: RegExp;
|
22
|
+
/** Pattern used to detect a normal */
|
23
|
+
static NormalPattern: RegExp;
|
24
|
+
/** Pattern used to detect a UV set */
|
25
|
+
static UVPattern: RegExp;
|
26
|
+
/** Pattern used to detect a first kind of face (f vertex vertex vertex) */
|
27
|
+
static FacePattern1: RegExp;
|
28
|
+
/** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */
|
29
|
+
static FacePattern2: RegExp;
|
30
|
+
/** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */
|
31
|
+
static FacePattern3: RegExp;
|
32
|
+
/** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/
|
33
|
+
static FacePattern4: RegExp;
|
34
|
+
/** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */
|
35
|
+
static FacePattern5: RegExp;
|
36
|
+
private _loadingOptions;
|
37
|
+
private _positions;
|
38
|
+
private _normals;
|
39
|
+
private _uvs;
|
40
|
+
private _colors;
|
41
|
+
private _meshesFromObj;
|
42
|
+
private _handledMesh;
|
43
|
+
private _indicesForBabylon;
|
44
|
+
private _wrappedPositionForBabylon;
|
45
|
+
private _wrappedUvsForBabylon;
|
46
|
+
private _wrappedColorsForBabylon;
|
47
|
+
private _wrappedNormalsForBabylon;
|
48
|
+
private _tuplePosNorm;
|
49
|
+
private _curPositionInIndices;
|
50
|
+
private _hasMeshes;
|
51
|
+
private _unwrappedPositionsForBabylon;
|
52
|
+
private _unwrappedColorsForBabylon;
|
53
|
+
private _unwrappedNormalsForBabylon;
|
54
|
+
private _unwrappedUVForBabylon;
|
55
|
+
private _triangles;
|
56
|
+
private _materialNameFromObj;
|
57
|
+
private _objMeshName;
|
58
|
+
private _increment;
|
59
|
+
private _isFirstMaterial;
|
60
|
+
private _grayColor;
|
61
|
+
private _materialToUse;
|
62
|
+
private _babylonMeshesArray;
|
63
|
+
/**
|
64
|
+
* Creates a new SolidParser
|
65
|
+
* @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)
|
66
|
+
* @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)
|
67
|
+
* @param loadingOptions defines the loading options to use
|
68
|
+
*/
|
69
|
+
constructor(materialToUse: string[], babylonMeshesArray: Array<Mesh>, loadingOptions: OBJLoadingOptions);
|
70
|
+
/**
|
71
|
+
* Search for obj in the given array.
|
72
|
+
* This function is called to check if a couple of data already exists in an array.
|
73
|
+
*
|
74
|
+
* If found, returns the index of the founded tuple index. Returns -1 if not found
|
75
|
+
* @param arr Array<{ normals: Array<number>, idx: Array<number> }>
|
76
|
+
* @param obj Array<number>
|
77
|
+
* @returns {boolean}
|
78
|
+
*/
|
79
|
+
private _isInArray;
|
80
|
+
private _isInArrayUV;
|
81
|
+
/**
|
82
|
+
* This function set the data for each triangle.
|
83
|
+
* Data are position, normals and uvs
|
84
|
+
* If a tuple of (position, normal) is not set, add the data into the corresponding array
|
85
|
+
* If the tuple already exist, add only their indice
|
86
|
+
*
|
87
|
+
* @param indicePositionFromObj Integer The index in positions array
|
88
|
+
* @param indiceUvsFromObj Integer The index in uvs array
|
89
|
+
* @param indiceNormalFromObj Integer The index in normals array
|
90
|
+
* @param positionVectorFromOBJ Vector3 The value of position at index objIndice
|
91
|
+
* @param textureVectorFromOBJ Vector3 The value of uvs
|
92
|
+
* @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale
|
93
|
+
* @param positionColorsFromOBJ
|
94
|
+
*/
|
95
|
+
private _setData;
|
96
|
+
/**
|
97
|
+
* Transform Vector() and BABYLON.Color() objects into numbers in an array
|
98
|
+
*/
|
99
|
+
private _unwrapData;
|
100
|
+
/**
|
101
|
+
* Create triangles from polygons
|
102
|
+
* It is important to notice that a triangle is a polygon
|
103
|
+
* We get 5 patterns of face defined in OBJ File :
|
104
|
+
* facePattern1 = ["1","2","3","4","5","6"]
|
105
|
+
* facePattern2 = ["1/1","2/2","3/3","4/4","5/5","6/6"]
|
106
|
+
* facePattern3 = ["1/1/1","2/2/2","3/3/3","4/4/4","5/5/5","6/6/6"]
|
107
|
+
* facePattern4 = ["1//1","2//2","3//3","4//4","5//5","6//6"]
|
108
|
+
* facePattern5 = ["-1/-1/-1","-2/-2/-2","-3/-3/-3","-4/-4/-4","-5/-5/-5","-6/-6/-6"]
|
109
|
+
* Each pattern is divided by the same method
|
110
|
+
* @param faces Array[String] The indices of elements
|
111
|
+
* @param v Integer The variable to increment
|
112
|
+
*/
|
113
|
+
private _getTriangles;
|
114
|
+
/**
|
115
|
+
* Create triangles and push the data for each polygon for the pattern 1
|
116
|
+
* In this pattern we get vertice positions
|
117
|
+
* @param face
|
118
|
+
* @param v
|
119
|
+
*/
|
120
|
+
private _setDataForCurrentFaceWithPattern1;
|
121
|
+
/**
|
122
|
+
* Create triangles and push the data for each polygon for the pattern 2
|
123
|
+
* In this pattern we get vertice positions and uvsu
|
124
|
+
* @param face
|
125
|
+
* @param v
|
126
|
+
*/
|
127
|
+
private _setDataForCurrentFaceWithPattern2;
|
128
|
+
/**
|
129
|
+
* Create triangles and push the data for each polygon for the pattern 3
|
130
|
+
* In this pattern we get vertice positions, uvs and normals
|
131
|
+
* @param face
|
132
|
+
* @param v
|
133
|
+
*/
|
134
|
+
private _setDataForCurrentFaceWithPattern3;
|
135
|
+
/**
|
136
|
+
* Create triangles and push the data for each polygon for the pattern 4
|
137
|
+
* In this pattern we get vertice positions and normals
|
138
|
+
* @param face
|
139
|
+
* @param v
|
140
|
+
*/
|
141
|
+
private _setDataForCurrentFaceWithPattern4;
|
142
|
+
private _setDataForCurrentFaceWithPattern5;
|
143
|
+
private _addPreviousObjMesh;
|
144
|
+
private _optimizeNormals;
|
145
|
+
/**
|
146
|
+
* Function used to parse an OBJ string
|
147
|
+
* @param meshesNames defines the list of meshes to load (all if not defined)
|
148
|
+
* @param data defines the OBJ string
|
149
|
+
* @param scene defines the hosting scene
|
150
|
+
* @param assetContainer defines the asset container to load data in
|
151
|
+
* @param onFileToLoadFound defines a callback that will be called if a MTL file is found
|
152
|
+
*/
|
153
|
+
parse(meshesNames: any, data: string, scene: Scene, assetContainer: Nullable<AssetContainer>, onFileToLoadFound: (fileToLoad: string) => void): void;
|
154
|
+
}
|