@babylonjs/loaders 5.0.0-beta.6 → 5.0.0-beta.8-snapshot
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +20 -198
- package/OBJ/index.d.ts +0 -4
- package/OBJ/index.js +0 -5
- package/OBJ/index.js.map +0 -1
- package/OBJ/mtlFileLoader.d.ts +0 -40
- package/OBJ/mtlFileLoader.js +0 -222
- package/OBJ/mtlFileLoader.js.map +0 -1
- package/OBJ/objFileLoader.d.ts +0 -133
- package/OBJ/objFileLoader.js +0 -301
- package/OBJ/objFileLoader.js.map +0 -1
- package/OBJ/objLoadingOptions.d.ts +0 -43
- package/OBJ/objLoadingOptions.js +0 -2
- package/OBJ/objLoadingOptions.js.map +0 -1
- package/OBJ/solidParser.d.ts +0 -153
- package/OBJ/solidParser.js +0 -700
- package/OBJ/solidParser.js.map +0 -1
- package/STL/index.d.ts +0 -1
- package/STL/index.js +0 -2
- package/STL/index.js.map +0 -1
- package/STL/stlFileLoader.d.ts +0 -71
- package/STL/stlFileLoader.js +0 -240
- package/STL/stlFileLoader.js.map +0 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +0 -13
- package/glTF/1.0/glTFBinaryExtension.js +0 -62
- package/glTF/1.0/glTFBinaryExtension.js.map +0 -1
- package/glTF/1.0/glTFLoader.d.ts +0 -106
- package/glTF/1.0/glTFLoader.js +0 -1697
- package/glTF/1.0/glTFLoader.js.map +0 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +0 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +0 -96
- package/glTF/1.0/glTFLoaderInterfaces.js.map +0 -1
- package/glTF/1.0/glTFLoaderUtils.d.ts +0 -62
- package/glTF/1.0/glTFLoaderUtils.js +0 -233
- package/glTF/1.0/glTFLoaderUtils.js.map +0 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +0 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +0 -128
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +0 -1
- package/glTF/1.0/index.d.ts +0 -5
- package/glTF/1.0/index.js +0 -6
- package/glTF/1.0/index.js.map +0 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +0 -36
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +0 -111
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +0 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +0 -27
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +0 -80
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +0 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +0 -27
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +0 -43
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +0 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +0 -21
- package/glTF/2.0/Extensions/EXT_texture_webp.js +0 -33
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +0 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +0 -32
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +0 -56
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +0 -31
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +0 -102
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +0 -28
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +0 -82
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +0 -31
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +0 -87
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +0 -30
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +0 -46
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +0 -34
- package/glTF/2.0/Extensions/KHR_materials_ior.js +0 -55
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +0 -30
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +0 -73
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +0 -31
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +0 -77
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +0 -30
- package/glTF/2.0/Extensions/KHR_materials_specular.js +0 -67
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +0 -31
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +0 -77
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +0 -30
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +0 -278
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +0 -30
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +0 -66
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +0 -76
- package/glTF/2.0/Extensions/KHR_materials_variants.js +0 -244
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +0 -31
- package/glTF/2.0/Extensions/KHR_materials_volume.js +0 -79
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +0 -19
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +0 -22
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +0 -21
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +0 -33
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +0 -25
- package/glTF/2.0/Extensions/KHR_texture_transform.js +0 -54
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +0 -29
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +0 -47
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +0 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +0 -38
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +0 -217
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +0 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +0 -75
- package/glTF/2.0/Extensions/MSFT_lod.js +0 -334
- package/glTF/2.0/Extensions/MSFT_lod.js.map +0 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +0 -14
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +0 -37
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +0 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +0 -14
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +0 -37
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +0 -1
- package/glTF/2.0/Extensions/index.d.ts +0 -26
- package/glTF/2.0/Extensions/index.js +0 -27
- package/glTF/2.0/Extensions/index.js.map +0 -1
- package/glTF/2.0/glTFLoader.d.ts +0 -355
- package/glTF/2.0/glTFLoader.js +0 -2184
- package/glTF/2.0/glTFLoader.js.map +0 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +0 -152
- package/glTF/2.0/glTFLoaderExtension.js +0 -2
- package/glTF/2.0/glTFLoaderExtension.js.map +0 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +0 -212
- package/glTF/2.0/glTFLoaderInterfaces.js +0 -2
- package/glTF/2.0/glTFLoaderInterfaces.js.map +0 -1
- package/glTF/2.0/index.d.ts +0 -4
- package/glTF/2.0/index.js +0 -5
- package/glTF/2.0/index.js.map +0 -1
- package/glTF/glTFFileLoader.d.ts +0 -364
- package/glTF/glTFFileLoader.js +0 -865
- package/glTF/glTFFileLoader.js.map +0 -1
- package/glTF/glTFValidation.d.ts +0 -29
- package/glTF/glTFValidation.js +0 -122
- package/glTF/glTFValidation.js.map +0 -1
- package/glTF/index.d.ts +0 -5
- package/glTF/index.js +0 -6
- package/glTF/index.js.map +0 -1
- package/index.d.ts +0 -3
- package/index.js.map +0 -1
- package/legacy/legacy-glTF.d.ts +0 -2
- package/legacy/legacy-glTF.js +0 -19
- package/legacy/legacy-glTF.js.map +0 -1
- package/legacy/legacy-glTF1.d.ts +0 -2
- package/legacy/legacy-glTF1.js +0 -15
- package/legacy/legacy-glTF1.js.map +0 -1
- package/legacy/legacy-glTF1FileLoader.d.ts +0 -2
- package/legacy/legacy-glTF1FileLoader.js +0 -3
- package/legacy/legacy-glTF1FileLoader.js.map +0 -1
- package/legacy/legacy-glTF2.d.ts +0 -2
- package/legacy/legacy-glTF2.js +0 -33
- package/legacy/legacy-glTF2.js.map +0 -1
- package/legacy/legacy-glTF2FileLoader.d.ts +0 -2
- package/legacy/legacy-glTF2FileLoader.js +0 -3
- package/legacy/legacy-glTF2FileLoader.js.map +0 -1
- package/legacy/legacy-glTFFileLoader.d.ts +0 -3
- package/legacy/legacy-glTFFileLoader.js +0 -4
- package/legacy/legacy-glTFFileLoader.js.map +0 -1
- package/legacy/legacy-objFileLoader.d.ts +0 -1
- package/legacy/legacy-objFileLoader.js +0 -13
- package/legacy/legacy-objFileLoader.js.map +0 -1
- package/legacy/legacy-stlFileLoader.d.ts +0 -1
- package/legacy/legacy-stlFileLoader.js +0 -13
- package/legacy/legacy-stlFileLoader.js.map +0 -1
- package/legacy/legacy.d.ts +0 -6
- package/legacy/legacy.js +0 -7
- package/legacy/legacy.js.map +0 -1
- package/readme.md +0 -24
package/package.json
CHANGED
@@ -1,207 +1,29 @@
|
|
1
1
|
{
|
2
|
-
"author": {
|
3
|
-
"name": "David CATUHE"
|
4
|
-
},
|
5
2
|
"name": "@babylonjs/loaders",
|
6
|
-
"
|
7
|
-
"version": "5.0.0-beta.6",
|
8
|
-
"repository": {
|
9
|
-
"type": "git",
|
10
|
-
"url": "https://github.com/BabylonJS/Babylon.js.git"
|
11
|
-
},
|
3
|
+
"version": "5.0.0-beta.8-snapshot",
|
12
4
|
"main": "index.js",
|
5
|
+
"module": "index.js",
|
6
|
+
"types": "index.d.ts",
|
13
7
|
"files": [
|
14
|
-
"
|
15
|
-
"glTF/1.0/glTFBinaryExtension.js",
|
16
|
-
"glTF/1.0/glTFBinaryExtension.js.map",
|
17
|
-
"glTF/1.0/glTFLoader.d.ts",
|
18
|
-
"glTF/1.0/glTFLoader.js",
|
19
|
-
"glTF/1.0/glTFLoader.js.map",
|
20
|
-
"glTF/1.0/glTFLoaderInterfaces.d.ts",
|
21
|
-
"glTF/1.0/glTFLoaderInterfaces.js",
|
22
|
-
"glTF/1.0/glTFLoaderInterfaces.js.map",
|
23
|
-
"glTF/1.0/glTFLoaderUtils.d.ts",
|
24
|
-
"glTF/1.0/glTFLoaderUtils.js",
|
25
|
-
"glTF/1.0/glTFLoaderUtils.js.map",
|
26
|
-
"glTF/1.0/glTFMaterialsCommonExtension.d.ts",
|
27
|
-
"glTF/1.0/glTFMaterialsCommonExtension.js",
|
28
|
-
"glTF/1.0/glTFMaterialsCommonExtension.js.map",
|
29
|
-
"glTF/1.0/index.d.ts",
|
30
|
-
"glTF/1.0/index.js",
|
31
|
-
"glTF/1.0/index.js.map",
|
32
|
-
"glTF/2.0/Extensions/ExtrasAsMetadata.d.ts",
|
33
|
-
"glTF/2.0/Extensions/ExtrasAsMetadata.js",
|
34
|
-
"glTF/2.0/Extensions/ExtrasAsMetadata.js.map",
|
35
|
-
"glTF/2.0/Extensions/EXT_lights_image_based.d.ts",
|
36
|
-
"glTF/2.0/Extensions/EXT_lights_image_based.js",
|
37
|
-
"glTF/2.0/Extensions/EXT_lights_image_based.js.map",
|
38
|
-
"glTF/2.0/Extensions/EXT_meshopt_compression.d.ts",
|
39
|
-
"glTF/2.0/Extensions/EXT_meshopt_compression.js",
|
40
|
-
"glTF/2.0/Extensions/EXT_meshopt_compression.js.map",
|
41
|
-
"glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts",
|
42
|
-
"glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js",
|
43
|
-
"glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map",
|
44
|
-
"glTF/2.0/Extensions/EXT_texture_webp.d.ts",
|
45
|
-
"glTF/2.0/Extensions/EXT_texture_webp.js",
|
46
|
-
"glTF/2.0/Extensions/EXT_texture_webp.js.map",
|
47
|
-
"glTF/2.0/Extensions/index.d.ts",
|
48
|
-
"glTF/2.0/Extensions/index.js",
|
49
|
-
"glTF/2.0/Extensions/index.js.map",
|
50
|
-
"glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts",
|
51
|
-
"glTF/2.0/Extensions/KHR_draco_mesh_compression.js",
|
52
|
-
"glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map",
|
53
|
-
"glTF/2.0/Extensions/KHR_lights_punctual.d.ts",
|
54
|
-
"glTF/2.0/Extensions/KHR_lights_punctual.js",
|
55
|
-
"glTF/2.0/Extensions/KHR_lights_punctual.js.map",
|
56
|
-
"glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts",
|
57
|
-
"glTF/2.0/Extensions/KHR_materials_clearcoat.js",
|
58
|
-
"glTF/2.0/Extensions/KHR_materials_clearcoat.js.map",
|
59
|
-
"glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts",
|
60
|
-
"glTF/2.0/Extensions/KHR_materials_emissive_strength.js",
|
61
|
-
"glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map",
|
62
|
-
"glTF/2.0/Extensions/KHR_materials_ior.d.ts",
|
63
|
-
"glTF/2.0/Extensions/KHR_materials_ior.js",
|
64
|
-
"glTF/2.0/Extensions/KHR_materials_ior.js.map",
|
65
|
-
"glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts",
|
66
|
-
"glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js",
|
67
|
-
"glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map",
|
68
|
-
"glTF/2.0/Extensions/KHR_materials_sheen.d.ts",
|
69
|
-
"glTF/2.0/Extensions/KHR_materials_sheen.js",
|
70
|
-
"glTF/2.0/Extensions/KHR_materials_sheen.js.map",
|
71
|
-
"glTF/2.0/Extensions/KHR_materials_specular.d.ts",
|
72
|
-
"glTF/2.0/Extensions/KHR_materials_specular.js",
|
73
|
-
"glTF/2.0/Extensions/KHR_materials_specular.js.map",
|
74
|
-
"glTF/2.0/Extensions/KHR_materials_translucency.d.ts",
|
75
|
-
"glTF/2.0/Extensions/KHR_materials_translucency.js",
|
76
|
-
"glTF/2.0/Extensions/KHR_materials_translucency.js.map",
|
77
|
-
"glTF/2.0/Extensions/KHR_materials_transmission.d.ts",
|
78
|
-
"glTF/2.0/Extensions/KHR_materials_transmission.js",
|
79
|
-
"glTF/2.0/Extensions/KHR_materials_transmission.js.map",
|
80
|
-
"glTF/2.0/Extensions/KHR_materials_unlit.d.ts",
|
81
|
-
"glTF/2.0/Extensions/KHR_materials_unlit.js",
|
82
|
-
"glTF/2.0/Extensions/KHR_materials_unlit.js.map",
|
83
|
-
"glTF/2.0/Extensions/KHR_materials_variants.d.ts",
|
84
|
-
"glTF/2.0/Extensions/KHR_materials_variants.js",
|
85
|
-
"glTF/2.0/Extensions/KHR_materials_variants.js.map",
|
86
|
-
"glTF/2.0/Extensions/KHR_materials_volume.d.ts",
|
87
|
-
"glTF/2.0/Extensions/KHR_materials_volume.js",
|
88
|
-
"glTF/2.0/Extensions/KHR_materials_volume.js.map",
|
89
|
-
"glTF/2.0/Extensions/KHR_mesh_quantization.d.ts",
|
90
|
-
"glTF/2.0/Extensions/KHR_mesh_quantization.js",
|
91
|
-
"glTF/2.0/Extensions/KHR_mesh_quantization.js.map",
|
92
|
-
"glTF/2.0/Extensions/KHR_texture_basisu.d.ts",
|
93
|
-
"glTF/2.0/Extensions/KHR_texture_basisu.js",
|
94
|
-
"glTF/2.0/Extensions/KHR_texture_basisu.js.map",
|
95
|
-
"glTF/2.0/Extensions/KHR_texture_transform.d.ts",
|
96
|
-
"glTF/2.0/Extensions/KHR_texture_transform.js",
|
97
|
-
"glTF/2.0/Extensions/KHR_texture_transform.js.map",
|
98
|
-
"glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts",
|
99
|
-
"glTF/2.0/Extensions/KHR_xmp_json_ld.js",
|
100
|
-
"glTF/2.0/Extensions/KHR_xmp_json_ld.js.map",
|
101
|
-
"glTF/2.0/Extensions/MSFT_audio_emitter.d.ts",
|
102
|
-
"glTF/2.0/Extensions/MSFT_audio_emitter.js",
|
103
|
-
"glTF/2.0/Extensions/MSFT_audio_emitter.js.map",
|
104
|
-
"glTF/2.0/Extensions/MSFT_lod.d.ts",
|
105
|
-
"glTF/2.0/Extensions/MSFT_lod.js",
|
106
|
-
"glTF/2.0/Extensions/MSFT_lod.js.map",
|
107
|
-
"glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts",
|
108
|
-
"glTF/2.0/Extensions/MSFT_minecraftMesh.js",
|
109
|
-
"glTF/2.0/Extensions/MSFT_minecraftMesh.js.map",
|
110
|
-
"glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts",
|
111
|
-
"glTF/2.0/Extensions/MSFT_sRGBFactors.js",
|
112
|
-
"glTF/2.0/Extensions/MSFT_sRGBFactors.js.map",
|
113
|
-
"glTF/2.0/glTFLoader.d.ts",
|
114
|
-
"glTF/2.0/glTFLoader.js",
|
115
|
-
"glTF/2.0/glTFLoader.js.map",
|
116
|
-
"glTF/2.0/glTFLoaderExtension.d.ts",
|
117
|
-
"glTF/2.0/glTFLoaderExtension.js",
|
118
|
-
"glTF/2.0/glTFLoaderExtension.js.map",
|
119
|
-
"glTF/2.0/glTFLoaderInterfaces.d.ts",
|
120
|
-
"glTF/2.0/glTFLoaderInterfaces.js",
|
121
|
-
"glTF/2.0/glTFLoaderInterfaces.js.map",
|
122
|
-
"glTF/2.0/index.d.ts",
|
123
|
-
"glTF/2.0/index.js",
|
124
|
-
"glTF/2.0/index.js.map",
|
125
|
-
"glTF/glTFFileLoader.d.ts",
|
126
|
-
"glTF/glTFFileLoader.js",
|
127
|
-
"glTF/glTFFileLoader.js.map",
|
128
|
-
"glTF/glTFValidation.d.ts",
|
129
|
-
"glTF/glTFValidation.js",
|
130
|
-
"glTF/glTFValidation.js.map",
|
131
|
-
"glTF/index.d.ts",
|
132
|
-
"glTF/index.js",
|
133
|
-
"glTF/index.js.map",
|
134
|
-
"index.d.ts",
|
135
|
-
"index.js",
|
136
|
-
"index.js.map",
|
137
|
-
"legacy/legacy-glTF.d.ts",
|
138
|
-
"legacy/legacy-glTF.js",
|
139
|
-
"legacy/legacy-glTF.js.map",
|
140
|
-
"legacy/legacy-glTF1.d.ts",
|
141
|
-
"legacy/legacy-glTF1.js",
|
142
|
-
"legacy/legacy-glTF1.js.map",
|
143
|
-
"legacy/legacy-glTF1FileLoader.d.ts",
|
144
|
-
"legacy/legacy-glTF1FileLoader.js",
|
145
|
-
"legacy/legacy-glTF1FileLoader.js.map",
|
146
|
-
"legacy/legacy-glTF2.d.ts",
|
147
|
-
"legacy/legacy-glTF2.js",
|
148
|
-
"legacy/legacy-glTF2.js.map",
|
149
|
-
"legacy/legacy-glTF2FileLoader.d.ts",
|
150
|
-
"legacy/legacy-glTF2FileLoader.js",
|
151
|
-
"legacy/legacy-glTF2FileLoader.js.map",
|
152
|
-
"legacy/legacy-glTFFileLoader.d.ts",
|
153
|
-
"legacy/legacy-glTFFileLoader.js",
|
154
|
-
"legacy/legacy-glTFFileLoader.js.map",
|
155
|
-
"legacy/legacy-objFileLoader.d.ts",
|
156
|
-
"legacy/legacy-objFileLoader.js",
|
157
|
-
"legacy/legacy-objFileLoader.js.map",
|
158
|
-
"legacy/legacy-stlFileLoader.d.ts",
|
159
|
-
"legacy/legacy-stlFileLoader.js",
|
160
|
-
"legacy/legacy-stlFileLoader.js.map",
|
161
|
-
"legacy/legacy.d.ts",
|
162
|
-
"legacy/legacy.js",
|
163
|
-
"legacy/legacy.js.map",
|
164
|
-
"OBJ/index.d.ts",
|
165
|
-
"OBJ/index.js",
|
166
|
-
"OBJ/index.js.map",
|
167
|
-
"OBJ/mtlFileLoader.d.ts",
|
168
|
-
"OBJ/mtlFileLoader.js",
|
169
|
-
"OBJ/mtlFileLoader.js.map",
|
170
|
-
"OBJ/objFileLoader.d.ts",
|
171
|
-
"OBJ/objFileLoader.js",
|
172
|
-
"OBJ/objFileLoader.js.map",
|
173
|
-
"OBJ/objLoadingOptions.d.ts",
|
174
|
-
"OBJ/objLoadingOptions.js",
|
175
|
-
"OBJ/objLoadingOptions.js.map",
|
176
|
-
"OBJ/solidParser.d.ts",
|
177
|
-
"OBJ/solidParser.js",
|
178
|
-
"OBJ/solidParser.js.map",
|
179
|
-
"readme.md",
|
180
|
-
"STL/index.d.ts",
|
181
|
-
"STL/index.js",
|
182
|
-
"STL/index.js.map",
|
183
|
-
"STL/stlFileLoader.d.ts",
|
184
|
-
"STL/stlFileLoader.js",
|
185
|
-
"STL/stlFileLoader.js.map"
|
8
|
+
"./"
|
186
9
|
],
|
187
|
-
"
|
188
|
-
|
189
|
-
"
|
190
|
-
"
|
191
|
-
"
|
192
|
-
"
|
193
|
-
|
194
|
-
],
|
195
|
-
"license": "Apache-2.0",
|
10
|
+
"scripts": {
|
11
|
+
"build": "npm run clean && npm run compile",
|
12
|
+
"clean": "rimraf dist && rimraf *.tsbuildinfo && rimraf \"./**/*.!(json|build.json)\"",
|
13
|
+
"compile": "tsc -b tsconfig.build.json",
|
14
|
+
"postcompile": "build-tools -c add-js-to-es6 --path ./dist/**/*.js",
|
15
|
+
"prepublishOnly": "build-tools -c prepare-es6-build"
|
16
|
+
},
|
196
17
|
"dependencies": {
|
197
|
-
"babylonjs
|
198
|
-
"
|
18
|
+
"@babylonjs/core": "^5.0.0-beta.8-snapshot",
|
19
|
+
"babylonjs-gltf2interface": "^5.0.0-beta.8-snapshot",
|
199
20
|
"tslib": "^2.3.1"
|
200
21
|
},
|
201
|
-
"
|
202
|
-
"
|
22
|
+
"devDependencies": {
|
23
|
+
"@dev/build-tools": "^5.0.0-beta.8-snapshot",
|
24
|
+
"@lts/loaders": "^5.0.0-beta.8-snapshot",
|
25
|
+
"rimraf": "^3.0.2",
|
26
|
+
"typescript": "^4.4.4"
|
203
27
|
},
|
204
|
-
"
|
205
|
-
|
206
|
-
"type": "module"
|
207
|
-
}
|
28
|
+
"sideEffects": true
|
29
|
+
}
|
package/OBJ/index.d.ts
DELETED
package/OBJ/index.js
DELETED
package/OBJ/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/OBJ/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./mtlFileLoader\";\r\nexport * from \"./objLoadingOptions\";\r\nexport * from \"./solidParser\";\r\nexport * from \"./objFileLoader\";\r\n"]}
|
package/OBJ/mtlFileLoader.d.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
|
3
|
-
import { Scene } from "@babylonjs/core/scene";
|
4
|
-
import { AssetContainer } from "@babylonjs/core/assetContainer";
|
5
|
-
/**
|
6
|
-
* Class reading and parsing the MTL file bundled with the obj file.
|
7
|
-
*/
|
8
|
-
export declare class MTLFileLoader {
|
9
|
-
/**
|
10
|
-
* Invert Y-Axis of referenced textures on load
|
11
|
-
*/
|
12
|
-
static INVERT_TEXTURE_Y: boolean;
|
13
|
-
/**
|
14
|
-
* All material loaded from the mtl will be set here
|
15
|
-
*/
|
16
|
-
materials: StandardMaterial[];
|
17
|
-
/**
|
18
|
-
* This function will read the mtl file and create each material described inside
|
19
|
-
* This function could be improve by adding :
|
20
|
-
* -some component missing (Ni, Tf...)
|
21
|
-
* -including the specific options available
|
22
|
-
*
|
23
|
-
* @param scene defines the scene the material will be created in
|
24
|
-
* @param data defines the mtl data to parse
|
25
|
-
* @param rootUrl defines the rooturl to use in order to load relative dependencies
|
26
|
-
* @param assetContainer defines the asset container to store the material in (can be null)
|
27
|
-
*/
|
28
|
-
parseMTL(scene: Scene, data: string | ArrayBuffer, rootUrl: string, assetContainer: Nullable<AssetContainer>): void;
|
29
|
-
/**
|
30
|
-
* Gets the texture for the material.
|
31
|
-
*
|
32
|
-
* If the material is imported from input file,
|
33
|
-
* We sanitize the url to ensure it takes the textre from aside the material.
|
34
|
-
*
|
35
|
-
* @param rootUrl The root url to load from
|
36
|
-
* @param value The value stored in the mtl
|
37
|
-
* @return The Texture
|
38
|
-
*/
|
39
|
-
private static _getTexture;
|
40
|
-
}
|
package/OBJ/mtlFileLoader.js
DELETED
@@ -1,222 +0,0 @@
|
|
1
|
-
import { Color3 } from '@babylonjs/core/Maths/math.color.js';
|
2
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
3
|
-
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
4
|
-
/**
|
5
|
-
* Class reading and parsing the MTL file bundled with the obj file.
|
6
|
-
*/
|
7
|
-
var MTLFileLoader = /** @class */ (function () {
|
8
|
-
function MTLFileLoader() {
|
9
|
-
/**
|
10
|
-
* All material loaded from the mtl will be set here
|
11
|
-
*/
|
12
|
-
this.materials = [];
|
13
|
-
}
|
14
|
-
/**
|
15
|
-
* This function will read the mtl file and create each material described inside
|
16
|
-
* This function could be improve by adding :
|
17
|
-
* -some component missing (Ni, Tf...)
|
18
|
-
* -including the specific options available
|
19
|
-
*
|
20
|
-
* @param scene defines the scene the material will be created in
|
21
|
-
* @param data defines the mtl data to parse
|
22
|
-
* @param rootUrl defines the rooturl to use in order to load relative dependencies
|
23
|
-
* @param assetContainer defines the asset container to store the material in (can be null)
|
24
|
-
*/
|
25
|
-
MTLFileLoader.prototype.parseMTL = function (scene, data, rootUrl, assetContainer) {
|
26
|
-
if (data instanceof ArrayBuffer) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
//Split the lines from the file
|
30
|
-
var lines = data.split('\n');
|
31
|
-
//Space char
|
32
|
-
var delimiter_pattern = /\s+/;
|
33
|
-
//Array with RGB colors
|
34
|
-
var color;
|
35
|
-
//New material
|
36
|
-
var material = null;
|
37
|
-
//Look at each line
|
38
|
-
for (var i = 0; i < lines.length; i++) {
|
39
|
-
var line = lines[i].trim();
|
40
|
-
// Blank line or comment
|
41
|
-
if (line.length === 0 || line.charAt(0) === '#') {
|
42
|
-
continue;
|
43
|
-
}
|
44
|
-
//Get the first parameter (keyword)
|
45
|
-
var pos = line.indexOf(' ');
|
46
|
-
var key = (pos >= 0) ? line.substring(0, pos) : line;
|
47
|
-
key = key.toLowerCase();
|
48
|
-
//Get the data following the key
|
49
|
-
var value = (pos >= 0) ? line.substring(pos + 1).trim() : "";
|
50
|
-
//This mtl keyword will create the new material
|
51
|
-
if (key === "newmtl") {
|
52
|
-
//Check if it is the first material.
|
53
|
-
// Materials specifications are described after this keyword.
|
54
|
-
if (material) {
|
55
|
-
//Add the previous material in the material array.
|
56
|
-
this.materials.push(material);
|
57
|
-
}
|
58
|
-
//Create a new material.
|
59
|
-
// value is the name of the material read in the mtl file
|
60
|
-
scene._blockEntityCollection = !!assetContainer;
|
61
|
-
material = new StandardMaterial(value, scene);
|
62
|
-
material._parentContainer = assetContainer;
|
63
|
-
scene._blockEntityCollection = false;
|
64
|
-
}
|
65
|
-
else if (key === "kd" && material) {
|
66
|
-
// Diffuse color (color under white light) using RGB values
|
67
|
-
//value = "r g b"
|
68
|
-
color = value.split(delimiter_pattern, 3).map(parseFloat);
|
69
|
-
//color = [r,g,b]
|
70
|
-
//Set tghe color into the material
|
71
|
-
material.diffuseColor = Color3.FromArray(color);
|
72
|
-
}
|
73
|
-
else if (key === "ka" && material) {
|
74
|
-
// Ambient color (color under shadow) using RGB values
|
75
|
-
//value = "r g b"
|
76
|
-
color = value.split(delimiter_pattern, 3).map(parseFloat);
|
77
|
-
//color = [r,g,b]
|
78
|
-
//Set tghe color into the material
|
79
|
-
material.ambientColor = Color3.FromArray(color);
|
80
|
-
}
|
81
|
-
else if (key === "ks" && material) {
|
82
|
-
// Specular color (color when light is reflected from shiny surface) using RGB values
|
83
|
-
//value = "r g b"
|
84
|
-
color = value.split(delimiter_pattern, 3).map(parseFloat);
|
85
|
-
//color = [r,g,b]
|
86
|
-
//Set the color into the material
|
87
|
-
material.specularColor = Color3.FromArray(color);
|
88
|
-
}
|
89
|
-
else if (key === "ke" && material) {
|
90
|
-
// Emissive color using RGB values
|
91
|
-
color = value.split(delimiter_pattern, 3).map(parseFloat);
|
92
|
-
material.emissiveColor = Color3.FromArray(color);
|
93
|
-
}
|
94
|
-
else if (key === "ns" && material) {
|
95
|
-
//value = "Integer"
|
96
|
-
material.specularPower = parseFloat(value);
|
97
|
-
}
|
98
|
-
else if (key === "d" && material) {
|
99
|
-
//d is dissolve for current material. It mean alpha for BABYLON
|
100
|
-
material.alpha = parseFloat(value);
|
101
|
-
//Texture
|
102
|
-
//This part can be improved by adding the possible options of texture
|
103
|
-
}
|
104
|
-
else if (key === "map_ka" && material) {
|
105
|
-
// ambient texture map with a loaded image
|
106
|
-
//We must first get the folder of the image
|
107
|
-
material.ambientTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
|
108
|
-
}
|
109
|
-
else if (key === "map_kd" && material) {
|
110
|
-
// Diffuse texture map with a loaded image
|
111
|
-
material.diffuseTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
|
112
|
-
}
|
113
|
-
else if (key === "map_ks" && material) {
|
114
|
-
// Specular texture map with a loaded image
|
115
|
-
//We must first get the folder of the image
|
116
|
-
material.specularTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
|
117
|
-
}
|
118
|
-
else if (key === "map_ns") {
|
119
|
-
//Specular
|
120
|
-
//Specular highlight component
|
121
|
-
//We must first get the folder of the image
|
122
|
-
//
|
123
|
-
//Not supported by BABYLON
|
124
|
-
//
|
125
|
-
// continue;
|
126
|
-
}
|
127
|
-
else if (key === "map_bump" && material) {
|
128
|
-
//The bump texture
|
129
|
-
material.bumpTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
|
130
|
-
}
|
131
|
-
else if (key === "map_d" && material) {
|
132
|
-
// The dissolve of the material
|
133
|
-
material.opacityTexture = MTLFileLoader._getTexture(rootUrl, value, scene);
|
134
|
-
//Options for illumination
|
135
|
-
}
|
136
|
-
else if (key === "illum") {
|
137
|
-
//Illumination
|
138
|
-
if (value === "0") {
|
139
|
-
//That mean Kd == Kd
|
140
|
-
}
|
141
|
-
else if (value === "1") {
|
142
|
-
//Color on and Ambient on
|
143
|
-
}
|
144
|
-
else if (value === "2") {
|
145
|
-
//Highlight on
|
146
|
-
}
|
147
|
-
else if (value === "3") {
|
148
|
-
//Reflection on and Ray trace on
|
149
|
-
}
|
150
|
-
else if (value === "4") {
|
151
|
-
//Transparency: Glass on, Reflection: Ray trace on
|
152
|
-
}
|
153
|
-
else if (value === "5") {
|
154
|
-
//Reflection: Fresnel on and Ray trace on
|
155
|
-
}
|
156
|
-
else if (value === "6") {
|
157
|
-
//Transparency: Refraction on, Reflection: Fresnel off and Ray trace on
|
158
|
-
}
|
159
|
-
else if (value === "7") {
|
160
|
-
//Transparency: Refraction on, Reflection: Fresnel on and Ray trace on
|
161
|
-
}
|
162
|
-
else if (value === "8") {
|
163
|
-
//Reflection on and Ray trace off
|
164
|
-
}
|
165
|
-
else if (value === "9") {
|
166
|
-
//Transparency: Glass on, Reflection: Ray trace off
|
167
|
-
}
|
168
|
-
else if (value === "10") {
|
169
|
-
//Casts shadows onto invisible surfaces
|
170
|
-
}
|
171
|
-
}
|
172
|
-
else {
|
173
|
-
// console.log("Unhandled expression at line : " + i +'\n' + "with value : " + line);
|
174
|
-
}
|
175
|
-
}
|
176
|
-
//At the end of the file, add the last material
|
177
|
-
if (material) {
|
178
|
-
this.materials.push(material);
|
179
|
-
}
|
180
|
-
};
|
181
|
-
/**
|
182
|
-
* Gets the texture for the material.
|
183
|
-
*
|
184
|
-
* If the material is imported from input file,
|
185
|
-
* We sanitize the url to ensure it takes the textre from aside the material.
|
186
|
-
*
|
187
|
-
* @param rootUrl The root url to load from
|
188
|
-
* @param value The value stored in the mtl
|
189
|
-
* @return The Texture
|
190
|
-
*/
|
191
|
-
MTLFileLoader._getTexture = function (rootUrl, value, scene) {
|
192
|
-
if (!value) {
|
193
|
-
return null;
|
194
|
-
}
|
195
|
-
var url = rootUrl;
|
196
|
-
// Load from input file.
|
197
|
-
if (rootUrl === "file:") {
|
198
|
-
var lastDelimiter = value.lastIndexOf("\\");
|
199
|
-
if (lastDelimiter === -1) {
|
200
|
-
lastDelimiter = value.lastIndexOf("/");
|
201
|
-
}
|
202
|
-
if (lastDelimiter > -1) {
|
203
|
-
url += value.substr(lastDelimiter + 1);
|
204
|
-
}
|
205
|
-
else {
|
206
|
-
url += value;
|
207
|
-
}
|
208
|
-
}
|
209
|
-
// Not from input file.
|
210
|
-
else {
|
211
|
-
url += value;
|
212
|
-
}
|
213
|
-
return new Texture(url, scene, false, MTLFileLoader.INVERT_TEXTURE_Y);
|
214
|
-
};
|
215
|
-
/**
|
216
|
-
* Invert Y-Axis of referenced textures on load
|
217
|
-
*/
|
218
|
-
MTLFileLoader.INVERT_TEXTURE_Y = true;
|
219
|
-
return MTLFileLoader;
|
220
|
-
}());
|
221
|
-
export { MTLFileLoader };
|
222
|
-
//# sourceMappingURL=mtlFileLoader.js.map
|
package/OBJ/mtlFileLoader.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mtlFileLoader.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/OBJ/mtlFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAI9E;;GAEG;AACH;IAAA;QAMI;;WAEG;QACI,cAAS,GAAuB,EAAE,CAAC;IAoM9C,CAAC;IAlMG;;;;;;;;;;OAUG;IACI,gCAAQ,GAAf,UAAgB,KAAY,EAAE,IAA0B,EAAE,OAAe,EAAE,cAAwC;QAC/G,IAAI,IAAI,YAAY,WAAW,EAAE;YAC7B,OAAO;SACV;QAED,+BAA+B;QAC/B,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,YAAY;QACZ,IAAI,iBAAiB,GAAG,KAAK,CAAC;QAC9B,uBAAuB;QACvB,IAAI,KAAe,CAAC;QACpB,cAAc;QACd,IAAI,QAAQ,GAA+B,IAAI,CAAC;QAEhD,mBAAmB;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAE3B,wBAAwB;YACxB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;g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I,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1E,CAAC;IA3MD;;OAEG;IACW,8BAAgB,GAAG,IAAI,CAAC;IAyM1C,oBAAC;CAAA,AA7MD,IA6MC;SA7MY,aAAa","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { AssetContainer } from \"@babylonjs/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 var lines = data.split('\\n');\r\n //Space char\r\n var delimiter_pattern = /\\s+/;\r\n //Array with RGB colors\r\n var color: number[];\r\n //New material\r\n var material: Nullable<StandardMaterial> = null;\r\n\r\n //Look at each line\r\n for (var i = 0; i < lines.length; i++) {\r\n var 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 var pos = line.indexOf(' ');\r\n var 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 var 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 = <number[]>value.split(delimiter_pattern, 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 = <number[]>value.split(delimiter_pattern, 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 = <number[]>value.split(delimiter_pattern, 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(delimiter_pattern, 3).map(parseFloat);\r\n material.emissiveColor = Color3.FromArray(color);\r\n } else if (key === \"ns\" && material) {\r\n\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 material.bumpTexture = MTLFileLoader._getTexture(rootUrl, value, scene);\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 textre 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 * @return 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 var url = rootUrl;\r\n // Load from input file.\r\n if (rootUrl === \"file:\") {\r\n var 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.substr(lastDelimiter + 1);\r\n }\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"]}
|