@babylonjs/loaders 5.0.0-rc.6 → 5.0.0
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/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +126 -126
- package/OBJ/objFileLoader.js +296 -296
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/OBJ/solidParser.d.ts +154 -154
- package/OBJ/solidParser.js +693 -693
- package/OBJ/solidParser.js.map +1 -1
- 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/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -60
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.d.ts +136 -136
- package/glTF/1.0/glTFLoader.js +1814 -1815
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.d.ts +63 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -250
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- 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_lights_image_based.js.map +1 -1
- 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_mesh_gpu_instancing.js.map +1 -1
- 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_meshopt_compression.js.map +1 -1
- 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/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- 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_draco_mesh_compression.js.map +1 -1
- 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_lights_punctual.js.map +1 -1
- 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_clearcoat.js.map +1 -1
- 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_emissive_strength.js.map +1 -1
- 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_ior.js.map +1 -1
- 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_pbrSpecularGlossiness.js.map +1 -1
- 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_sheen.js.map +1 -1
- 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_specular.js.map +1 -1
- 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_translucency.js.map +1 -1
- 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_transmission.js.map +1 -1
- 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_unlit.js.map +1 -1
- 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_variants.js.map +1 -1
- 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_materials_volume.js.map +1 -1
- 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_mesh_quantization.js.map +1 -1
- 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_basisu.js.map +1 -1
- 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_texture_transform.js.map +1 -1
- 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/KHR_xmp_json_ld.js.map +1 -1
- 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_audio_emitter.js.map +1 -1
- 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_lod.js.map +1 -1
- 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_minecraftMesh.js.map +1 -1
- 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/MSFT_sRGBFactors.js.map +1 -1
- 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 +406 -405
- package/glTF/2.0/glTFLoader.js +2366 -2366
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +5 -4
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +433 -433
- package/glTF/glTFFileLoader.js +927 -927
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -123
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +6 -5
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +15 -14
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -3
- package/legacy/legacy-glTF1FileLoader.js.map +1 -1
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +33 -32
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -3
- package/legacy/legacy-glTF2FileLoader.js.map +1 -1
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -4
- package/legacy/legacy-glTFFileLoader.js.map +1 -1
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +13 -12
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +13 -12
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +8 -7
- package/legacy/legacy.js.map +1 -1
- package/license.md +71 -0
- package/package.json +25 -6
@@ -1,34 +1,34 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
3
|
-
import { GLTFLoader } from "../glTFLoader";
|
4
|
-
import { IBufferView } from "../glTFLoaderInterfaces";
|
5
|
-
/**
|
6
|
-
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression)
|
7
|
-
*
|
8
|
-
* This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js
|
9
|
-
* @since 5.0.0
|
10
|
-
*/
|
11
|
-
export declare class EXT_meshopt_compression implements IGLTFLoaderExtension {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
readonly name = "EXT_meshopt_compression";
|
16
|
-
/**
|
17
|
-
* Defines whether this extension is enabled.
|
18
|
-
*/
|
19
|
-
enabled: boolean;
|
20
|
-
private _loader;
|
21
|
-
/**
|
22
|
-
* @param loader
|
23
|
-
* @hidden
|
24
|
-
*/
|
25
|
-
constructor(loader: GLTFLoader);
|
26
|
-
/** @hidden */
|
27
|
-
dispose(): void;
|
28
|
-
/**
|
29
|
-
* @param context
|
30
|
-
* @param bufferView
|
31
|
-
* @hidden
|
32
|
-
*/
|
33
|
-
loadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>>;
|
34
|
-
}
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
3
|
+
import { GLTFLoader } from "../glTFLoader";
|
4
|
+
import type { IBufferView } from "../glTFLoaderInterfaces";
|
5
|
+
/**
|
6
|
+
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression)
|
7
|
+
*
|
8
|
+
* This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js
|
9
|
+
* @since 5.0.0
|
10
|
+
*/
|
11
|
+
export declare class EXT_meshopt_compression implements IGLTFLoaderExtension {
|
12
|
+
/**
|
13
|
+
* The name of this extension.
|
14
|
+
*/
|
15
|
+
readonly name = "EXT_meshopt_compression";
|
16
|
+
/**
|
17
|
+
* Defines whether this extension is enabled.
|
18
|
+
*/
|
19
|
+
enabled: boolean;
|
20
|
+
private _loader;
|
21
|
+
/**
|
22
|
+
* @param loader
|
23
|
+
* @hidden
|
24
|
+
*/
|
25
|
+
constructor(loader: GLTFLoader);
|
26
|
+
/** @hidden */
|
27
|
+
dispose(): void;
|
28
|
+
/**
|
29
|
+
* @param context
|
30
|
+
* @param bufferView
|
31
|
+
* @hidden
|
32
|
+
*/
|
33
|
+
loadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>>;
|
34
|
+
}
|
@@ -1,50 +1,50 @@
|
|
1
|
-
import { ArrayItem, GLTFLoader } from "../glTFLoader.js";
|
2
|
-
import { MeshoptCompression } from "@babylonjs/core/Meshes/Compression/meshoptCompression.js";
|
3
|
-
var NAME = "EXT_meshopt_compression";
|
4
|
-
/**
|
5
|
-
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression)
|
6
|
-
*
|
7
|
-
* This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js
|
8
|
-
* @since 5.0.0
|
9
|
-
*/
|
10
|
-
var EXT_meshopt_compression = /** @class */ (function () {
|
11
|
-
/**
|
12
|
-
* @param loader
|
13
|
-
* @hidden
|
14
|
-
*/
|
15
|
-
function EXT_meshopt_compression(loader) {
|
16
|
-
/**
|
17
|
-
* The name of this extension.
|
18
|
-
*/
|
19
|
-
this.name = NAME;
|
20
|
-
this.enabled = loader.isExtensionUsed(NAME);
|
21
|
-
this._loader = loader;
|
22
|
-
}
|
23
|
-
/** @hidden */
|
24
|
-
EXT_meshopt_compression.prototype.dispose = function () {
|
25
|
-
this._loader = null;
|
26
|
-
};
|
27
|
-
/**
|
28
|
-
* @param context
|
29
|
-
* @param bufferView
|
30
|
-
* @hidden
|
31
|
-
*/
|
32
|
-
EXT_meshopt_compression.prototype.loadBufferViewAsync = function (context, bufferView) {
|
33
|
-
var _this = this;
|
34
|
-
return GLTFLoader.LoadExtensionAsync(context, bufferView, this.name, function (extensionContext, extension) {
|
35
|
-
var bufferViewMeshopt = bufferView;
|
36
|
-
if (bufferViewMeshopt._meshOptData) {
|
37
|
-
return bufferViewMeshopt._meshOptData;
|
38
|
-
}
|
39
|
-
var buffer = ArrayItem.Get("".concat(context, "/buffer"), _this._loader.gltf.buffers, extension.buffer);
|
40
|
-
bufferViewMeshopt._meshOptData = _this._loader.loadBufferAsync("/buffers/".concat(buffer.index), buffer, extension.byteOffset || 0, extension.byteLength).then(function (buffer) {
|
41
|
-
return MeshoptCompression.Default.decodeGltfBufferAsync(buffer, extension.count, extension.byteStride, extension.mode, extension.filter);
|
42
|
-
});
|
43
|
-
return bufferViewMeshopt._meshOptData;
|
44
|
-
});
|
45
|
-
};
|
46
|
-
return EXT_meshopt_compression;
|
47
|
-
}());
|
48
|
-
export { EXT_meshopt_compression };
|
49
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_meshopt_compression(loader); });
|
1
|
+
import { ArrayItem, GLTFLoader } from "../glTFLoader.js";
|
2
|
+
import { MeshoptCompression } from "@babylonjs/core/Meshes/Compression/meshoptCompression.js";
|
3
|
+
var NAME = "EXT_meshopt_compression";
|
4
|
+
/**
|
5
|
+
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression)
|
6
|
+
*
|
7
|
+
* This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js
|
8
|
+
* @since 5.0.0
|
9
|
+
*/
|
10
|
+
var EXT_meshopt_compression = /** @class */ (function () {
|
11
|
+
/**
|
12
|
+
* @param loader
|
13
|
+
* @hidden
|
14
|
+
*/
|
15
|
+
function EXT_meshopt_compression(loader) {
|
16
|
+
/**
|
17
|
+
* The name of this extension.
|
18
|
+
*/
|
19
|
+
this.name = NAME;
|
20
|
+
this.enabled = loader.isExtensionUsed(NAME);
|
21
|
+
this._loader = loader;
|
22
|
+
}
|
23
|
+
/** @hidden */
|
24
|
+
EXT_meshopt_compression.prototype.dispose = function () {
|
25
|
+
this._loader = null;
|
26
|
+
};
|
27
|
+
/**
|
28
|
+
* @param context
|
29
|
+
* @param bufferView
|
30
|
+
* @hidden
|
31
|
+
*/
|
32
|
+
EXT_meshopt_compression.prototype.loadBufferViewAsync = function (context, bufferView) {
|
33
|
+
var _this = this;
|
34
|
+
return GLTFLoader.LoadExtensionAsync(context, bufferView, this.name, function (extensionContext, extension) {
|
35
|
+
var bufferViewMeshopt = bufferView;
|
36
|
+
if (bufferViewMeshopt._meshOptData) {
|
37
|
+
return bufferViewMeshopt._meshOptData;
|
38
|
+
}
|
39
|
+
var buffer = ArrayItem.Get("".concat(context, "/buffer"), _this._loader.gltf.buffers, extension.buffer);
|
40
|
+
bufferViewMeshopt._meshOptData = _this._loader.loadBufferAsync("/buffers/".concat(buffer.index), buffer, extension.byteOffset || 0, extension.byteLength).then(function (buffer) {
|
41
|
+
return MeshoptCompression.Default.decodeGltfBufferAsync(buffer, extension.count, extension.byteStride, extension.mode, extension.filter);
|
42
|
+
});
|
43
|
+
return bufferViewMeshopt._meshOptData;
|
44
|
+
});
|
45
|
+
};
|
46
|
+
return EXT_meshopt_compression;
|
47
|
+
}());
|
48
|
+
export { EXT_meshopt_compression };
|
49
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_meshopt_compression(loader); });
|
50
50
|
//# sourceMappingURL=EXT_meshopt_compression.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EXT_meshopt_compression.js","sourceRoot":"","sources":["../../../../../../../lts/loaders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AAC,MAAoB,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YAC3J,CAAC,CAAC,CAAC;YAEH,OAAO,iBAAiB,CAAC,YAAY,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC;IACL,8BAAC;AAAD,CAAC,AA/CD,IA+CC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAnC,CAAmC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { ArrayItem, GLTFLoader } from \"../glTFLoader\";\r\nimport { IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport { IEXTMeshoptCompression } from \"babylonjs-gltf2interface\";\r\nimport { MeshoptCompression } from \"core/Meshes/Compression/meshoptCompression\";\r\n\r\nconst NAME = \"EXT_meshopt_compression\";\r\n\r\ninterface IBufferViewMeshopt extends IBufferView {\r\n _meshOptData?: Promise<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression)\r\n *\r\n * This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js\r\n * @since 5.0.0\r\n */\r\nexport class EXT_meshopt_compression implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n this._loader = loader;\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param bufferView\r\n * @hidden\r\n */\r\n public loadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTMeshoptCompression, ArrayBufferView>(context, bufferView, this.name, (extensionContext, extension) => {\r\n const bufferViewMeshopt = bufferView as IBufferViewMeshopt;\r\n if (bufferViewMeshopt._meshOptData) {\r\n return bufferViewMeshopt._meshOptData;\r\n }\r\n\r\n const buffer = ArrayItem.Get(`${context}/buffer`, this._loader.gltf.buffers, extension.buffer);\r\n bufferViewMeshopt._meshOptData = this._loader.loadBufferAsync(`/buffers/${buffer.index}`, buffer, extension.byteOffset || 0, extension.byteLength).then((buffer) => {\r\n return MeshoptCompression.Default.decodeGltfBufferAsync(buffer as Uint8Array, extension.count, extension.byteStride, extension.mode, extension.filter);\r\n });\r\n\r\n return bufferViewMeshopt._meshOptData;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_meshopt_compression(loader));\r\n"]}
|
1
|
+
{"version":3,"file":"EXT_meshopt_compression.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/EXT_meshopt_compression.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,iEAAmD;AAEhF,IAAM,IAAI,GAAG,yBAAyB,CAAC;AAMvC;;;;;GAKG;AACH;IAaI;;;OAGG;IACH,iCAAY,MAAkB;QAhB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAcxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,cAAc;IACP,yCAAO,GAAd;QACK,IA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TFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { ArrayItem, GLTFLoader } from \"../glTFLoader\";\r\nimport type { IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport type { IEXTMeshoptCompression } from \"babylonjs-gltf2interface\";\r\nimport { MeshoptCompression } from \"core/Meshes/Compression/meshoptCompression\";\r\n\r\nconst NAME = \"EXT_meshopt_compression\";\r\n\r\ninterface IBufferViewMeshopt extends IBufferView {\r\n _meshOptData?: Promise<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression)\r\n *\r\n * This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js\r\n * @since 5.0.0\r\n */\r\nexport class EXT_meshopt_compression implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n this._loader = loader;\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param bufferView\r\n * @hidden\r\n */\r\n public loadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTMeshoptCompression, ArrayBufferView>(context, bufferView, this.name, (extensionContext, extension) => {\r\n const bufferViewMeshopt = bufferView as IBufferViewMeshopt;\r\n if (bufferViewMeshopt._meshOptData) {\r\n return bufferViewMeshopt._meshOptData;\r\n }\r\n\r\n const buffer = ArrayItem.Get(`${context}/buffer`, this._loader.gltf.buffers, extension.buffer);\r\n bufferViewMeshopt._meshOptData = this._loader.loadBufferAsync(`/buffers/${buffer.index}`, buffer, extension.byteOffset || 0, extension.byteLength).then((buffer) => {\r\n return MeshoptCompression.Default.decodeGltfBufferAsync(buffer as Uint8Array, extension.count, extension.byteStride, extension.mode, extension.filter);\r\n });\r\n\r\n return bufferViewMeshopt._meshOptData;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_meshopt_compression(loader));\r\n"]}
|
@@ -1,29 +1,29 @@
|
|
1
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
2
|
-
import { GLTFLoader } from "../glTFLoader";
|
3
|
-
import { ITexture } from "../glTFLoaderInterfaces";
|
4
|
-
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
5
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
6
|
-
/**
|
7
|
-
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)
|
8
|
-
*/
|
9
|
-
export declare class EXT_texture_webp implements IGLTFLoaderExtension {
|
10
|
-
/** The name of this extension. */
|
11
|
-
readonly name = "EXT_texture_webp";
|
12
|
-
/** Defines whether this extension is enabled. */
|
13
|
-
enabled: boolean;
|
14
|
-
private _loader;
|
15
|
-
/**
|
16
|
-
* @param loader
|
17
|
-
* @hidden
|
18
|
-
*/
|
19
|
-
constructor(loader: GLTFLoader);
|
20
|
-
/** @hidden */
|
21
|
-
dispose(): void;
|
22
|
-
/**
|
23
|
-
* @param context
|
24
|
-
* @param texture
|
25
|
-
* @param assign
|
26
|
-
* @hidden
|
27
|
-
*/
|
28
|
-
_loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
|
29
|
-
}
|
1
|
+
import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
2
|
+
import { GLTFLoader } from "../glTFLoader";
|
3
|
+
import type { ITexture } from "../glTFLoaderInterfaces";
|
4
|
+
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
5
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
6
|
+
/**
|
7
|
+
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)
|
8
|
+
*/
|
9
|
+
export declare class EXT_texture_webp implements IGLTFLoaderExtension {
|
10
|
+
/** The name of this extension. */
|
11
|
+
readonly name = "EXT_texture_webp";
|
12
|
+
/** Defines whether this extension is enabled. */
|
13
|
+
enabled: boolean;
|
14
|
+
private _loader;
|
15
|
+
/**
|
16
|
+
* @param loader
|
17
|
+
* @hidden
|
18
|
+
*/
|
19
|
+
constructor(loader: GLTFLoader);
|
20
|
+
/** @hidden */
|
21
|
+
dispose(): void;
|
22
|
+
/**
|
23
|
+
* @param context
|
24
|
+
* @param texture
|
25
|
+
* @param assign
|
26
|
+
* @hidden
|
27
|
+
*/
|
28
|
+
_loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
|
29
|
+
}
|
@@ -1,41 +1,41 @@
|
|
1
|
-
import { GLTFLoader, ArrayItem } from "../glTFLoader.js";
|
2
|
-
var NAME = "EXT_texture_webp";
|
3
|
-
/**
|
4
|
-
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)
|
5
|
-
*/
|
6
|
-
var EXT_texture_webp = /** @class */ (function () {
|
7
|
-
/**
|
8
|
-
* @param loader
|
9
|
-
* @hidden
|
10
|
-
*/
|
11
|
-
function EXT_texture_webp(loader) {
|
12
|
-
/** The name of this extension. */
|
13
|
-
this.name = NAME;
|
14
|
-
this._loader = loader;
|
15
|
-
this.enabled = loader.isExtensionUsed(NAME);
|
16
|
-
}
|
17
|
-
/** @hidden */
|
18
|
-
EXT_texture_webp.prototype.dispose = function () {
|
19
|
-
this._loader = null;
|
20
|
-
};
|
21
|
-
/**
|
22
|
-
* @param context
|
23
|
-
* @param texture
|
24
|
-
* @param assign
|
25
|
-
* @hidden
|
26
|
-
*/
|
27
|
-
EXT_texture_webp.prototype._loadTextureAsync = function (context, texture, assign) {
|
28
|
-
var _this = this;
|
29
|
-
return GLTFLoader.LoadExtensionAsync(context, texture, this.name, function (extensionContext, extension) {
|
30
|
-
var sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get("".concat(context, "/sampler"), _this._loader.gltf.samplers, texture.sampler);
|
31
|
-
var image = ArrayItem.Get("".concat(extensionContext, "/source"), _this._loader.gltf.images, extension.source);
|
32
|
-
return _this._loader._createTextureAsync(context, sampler, image, function (babylonTexture) {
|
33
|
-
assign(babylonTexture);
|
34
|
-
}, undefined, !texture._textureInfo.nonColorData);
|
35
|
-
});
|
36
|
-
};
|
37
|
-
return EXT_texture_webp;
|
38
|
-
}());
|
39
|
-
export { EXT_texture_webp };
|
40
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_texture_webp(loader); });
|
1
|
+
import { GLTFLoader, ArrayItem } from "../glTFLoader.js";
|
2
|
+
var NAME = "EXT_texture_webp";
|
3
|
+
/**
|
4
|
+
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)
|
5
|
+
*/
|
6
|
+
var EXT_texture_webp = /** @class */ (function () {
|
7
|
+
/**
|
8
|
+
* @param loader
|
9
|
+
* @hidden
|
10
|
+
*/
|
11
|
+
function EXT_texture_webp(loader) {
|
12
|
+
/** The name of this extension. */
|
13
|
+
this.name = NAME;
|
14
|
+
this._loader = loader;
|
15
|
+
this.enabled = loader.isExtensionUsed(NAME);
|
16
|
+
}
|
17
|
+
/** @hidden */
|
18
|
+
EXT_texture_webp.prototype.dispose = function () {
|
19
|
+
this._loader = null;
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
* @param context
|
23
|
+
* @param texture
|
24
|
+
* @param assign
|
25
|
+
* @hidden
|
26
|
+
*/
|
27
|
+
EXT_texture_webp.prototype._loadTextureAsync = function (context, texture, assign) {
|
28
|
+
var _this = this;
|
29
|
+
return GLTFLoader.LoadExtensionAsync(context, texture, this.name, function (extensionContext, extension) {
|
30
|
+
var sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get("".concat(context, "/sampler"), _this._loader.gltf.samplers, texture.sampler);
|
31
|
+
var image = ArrayItem.Get("".concat(extensionContext, "/source"), _this._loader.gltf.images, extension.source);
|
32
|
+
return _this._loader._createTextureAsync(context, sampler, image, function (babylonTexture) {
|
33
|
+
assign(babylonTexture);
|
34
|
+
}, undefined, !texture._textureInfo.nonColorData);
|
35
|
+
});
|
36
|
+
};
|
37
|
+
return EXT_texture_webp;
|
38
|
+
}());
|
39
|
+
export { EXT_texture_webp };
|
40
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_texture_webp(loader); });
|
41
41
|
//# sourceMappingURL=EXT_texture_webp.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EXT_texture_webp.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/EXT_texture_webp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAMtD,IAAM,IAAI,GAAG,kBAAkB,CAAC;AAEhC;;GAEG;AACH;IASI;;;OAGG;IACH,0BAAY,MAAkB;QAZ9B,kCAAkC;QAClB,SAAI,GAAG,IAAI,CAAC;QAYxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,cAAc;IACP,kCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,4CAAiB,GAAxB,UAAyB,OAAe,EAAE,OAAiB,EAAE,MAA6C;QAA1G,iBAeC;QAdG,OAAO,UAAU,CAAC,kBAAkB,CAA+B,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YACxH,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,UAAG,OAAO,aAAU,EAAE,KAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5J,IAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,UAAG,gBAAgB,YAAS,EAAE,KAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YACtG,OAAO,KAAI,CAAC,OAAO,CAAC,mBAAmB,CACnC,OAAO,EACP,OAAO,EACP,KAAK,EACL,UAAC,cAAc;gBACX,MAAM,CAAC,cAAc,CAAC,CAAC;YAC3B,CAAC,EACD,SAAS,EACT,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CACrC,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IACL,uBAAC;AAAD,CAAC,AA7CD,IA6CC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { ITexture } from \"../glTFLoaderInterfaces\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Nullable } from \"core/types\";\r\nimport { IEXTTextureWebP } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"EXT_texture_webp\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)\r\n */\r\nexport class EXT_texture_webp implements IGLTFLoaderExtension {\r\n /** The name of this extension. */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled. */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param texture\r\n * @param assign\r\n * @hidden\r\n */\r\n public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTTextureWebP, BaseTexture>(context, texture, this.name, (extensionContext, extension) => {\r\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);\r\n const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);\r\n return this._loader._createTextureAsync(\r\n context,\r\n sampler,\r\n image,\r\n (babylonTexture) => {\r\n assign(babylonTexture);\r\n },\r\n undefined,\r\n !texture._textureInfo.nonColorData\r\n );\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_texture_webp(loader));\r\n"]}
|
1
|
+
{"version":3,"file":"EXT_texture_webp.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/EXT_texture_webp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAMtD,IAAM,IAAI,GAAG,kBAAkB,CAAC;AAEhC;;GAEG;AACH;IASI;;;OAGG;IACH,0BAAY,MAAkB;QAZ9B,kCAAkC;QAClB,SAAI,GAAG,IAAI,CAAC;QAYxB,IAAI,CAAC,OAAO,GAAG,MAAM,C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tension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { ITexture } from \"../glTFLoaderInterfaces\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { IEXTTextureWebP } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"EXT_texture_webp\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)\r\n */\r\nexport class EXT_texture_webp implements IGLTFLoaderExtension {\r\n /** The name of this extension. */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled. */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param texture\r\n * @param assign\r\n * @hidden\r\n */\r\n public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return GLTFLoader.LoadExtensionAsync<IEXTTextureWebP, BaseTexture>(context, texture, this.name, (extensionContext, extension) => {\r\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);\r\n const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);\r\n return this._loader._createTextureAsync(\r\n context,\r\n sampler,\r\n image,\r\n (babylonTexture) => {\r\n assign(babylonTexture);\r\n },\r\n undefined,\r\n !texture._textureInfo.nonColorData\r\n );\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_texture_webp(loader));\r\n"]}
|
@@ -1,50 +1,50 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
3
|
-
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
4
|
-
import { INode, ICamera, IMaterial } from "../glTFLoaderInterfaces";
|
5
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
6
|
-
import { GLTFLoader } from "../glTFLoader";
|
7
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
8
|
-
/**
|
9
|
-
* Store glTF extras (if present) in BJS objects' metadata
|
10
|
-
*/
|
11
|
-
export declare class ExtrasAsMetadata implements IGLTFLoaderExtension {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
readonly name = "ExtrasAsMetadata";
|
16
|
-
/**
|
17
|
-
* Defines whether this extension is enabled.
|
18
|
-
*/
|
19
|
-
enabled: boolean;
|
20
|
-
private _loader;
|
21
|
-
private _assignExtras;
|
22
|
-
/**
|
23
|
-
* @param loader
|
24
|
-
* @hidden
|
25
|
-
*/
|
26
|
-
constructor(loader: GLTFLoader);
|
27
|
-
/** @hidden */
|
28
|
-
dispose(): void;
|
29
|
-
/**
|
30
|
-
* @param context
|
31
|
-
* @param node
|
32
|
-
* @param assign
|
33
|
-
* @hidden
|
34
|
-
*/
|
35
|
-
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
36
|
-
/**
|
37
|
-
* @param context
|
38
|
-
* @param camera
|
39
|
-
* @param assign
|
40
|
-
* @hidden
|
41
|
-
*/
|
42
|
-
loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
|
43
|
-
/**
|
44
|
-
* @param context
|
45
|
-
* @param material
|
46
|
-
* @param babylonDrawMode
|
47
|
-
* @hidden
|
48
|
-
*/
|
49
|
-
createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
|
50
|
-
}
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
3
|
+
import type { Camera } from "@babylonjs/core/Cameras/camera.js";
|
4
|
+
import type { INode, ICamera, IMaterial } from "../glTFLoaderInterfaces";
|
5
|
+
import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
6
|
+
import { GLTFLoader } from "../glTFLoader";
|
7
|
+
import type { Material } from "@babylonjs/core/Materials/material.js";
|
8
|
+
/**
|
9
|
+
* Store glTF extras (if present) in BJS objects' metadata
|
10
|
+
*/
|
11
|
+
export declare class ExtrasAsMetadata implements IGLTFLoaderExtension {
|
12
|
+
/**
|
13
|
+
* The name of this extension.
|
14
|
+
*/
|
15
|
+
readonly name = "ExtrasAsMetadata";
|
16
|
+
/**
|
17
|
+
* Defines whether this extension is enabled.
|
18
|
+
*/
|
19
|
+
enabled: boolean;
|
20
|
+
private _loader;
|
21
|
+
private _assignExtras;
|
22
|
+
/**
|
23
|
+
* @param loader
|
24
|
+
* @hidden
|
25
|
+
*/
|
26
|
+
constructor(loader: GLTFLoader);
|
27
|
+
/** @hidden */
|
28
|
+
dispose(): void;
|
29
|
+
/**
|
30
|
+
* @param context
|
31
|
+
* @param node
|
32
|
+
* @param assign
|
33
|
+
* @hidden
|
34
|
+
*/
|
35
|
+
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
36
|
+
/**
|
37
|
+
* @param context
|
38
|
+
* @param camera
|
39
|
+
* @param assign
|
40
|
+
* @hidden
|
41
|
+
*/
|
42
|
+
loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
|
43
|
+
/**
|
44
|
+
* @param context
|
45
|
+
* @param material
|
46
|
+
* @param babylonDrawMode
|
47
|
+
* @hidden
|
48
|
+
*/
|
49
|
+
createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
|
50
|
+
}
|
@@ -1,74 +1,74 @@
|
|
1
|
-
import { GLTFLoader } from "../glTFLoader.js";
|
2
|
-
var NAME = "ExtrasAsMetadata";
|
3
|
-
/**
|
4
|
-
* Store glTF extras (if present) in BJS objects' metadata
|
5
|
-
*/
|
6
|
-
var ExtrasAsMetadata = /** @class */ (function () {
|
7
|
-
/**
|
8
|
-
* @param loader
|
9
|
-
* @hidden
|
10
|
-
*/
|
11
|
-
function ExtrasAsMetadata(loader) {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
this.name = NAME;
|
16
|
-
/**
|
17
|
-
* Defines whether this extension is enabled.
|
18
|
-
*/
|
19
|
-
this.enabled = true;
|
20
|
-
this._loader = loader;
|
21
|
-
}
|
22
|
-
ExtrasAsMetadata.prototype._assignExtras = function (babylonObject, gltfProp) {
|
23
|
-
if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {
|
24
|
-
var metadata = (babylonObject.metadata = babylonObject.metadata || {});
|
25
|
-
var gltf = (metadata.gltf = metadata.gltf || {});
|
26
|
-
gltf.extras = gltfProp.extras;
|
27
|
-
}
|
28
|
-
};
|
29
|
-
/** @hidden */
|
30
|
-
ExtrasAsMetadata.prototype.dispose = function () {
|
31
|
-
this._loader = null;
|
32
|
-
};
|
33
|
-
/**
|
34
|
-
* @param context
|
35
|
-
* @param node
|
36
|
-
* @param assign
|
37
|
-
* @hidden
|
38
|
-
*/
|
39
|
-
ExtrasAsMetadata.prototype.loadNodeAsync = function (context, node, assign) {
|
40
|
-
var _this = this;
|
41
|
-
return this._loader.loadNodeAsync(context, node, function (babylonTransformNode) {
|
42
|
-
_this._assignExtras(babylonTransformNode, node);
|
43
|
-
assign(babylonTransformNode);
|
44
|
-
});
|
45
|
-
};
|
46
|
-
/**
|
47
|
-
* @param context
|
48
|
-
* @param camera
|
49
|
-
* @param assign
|
50
|
-
* @hidden
|
51
|
-
*/
|
52
|
-
ExtrasAsMetadata.prototype.loadCameraAsync = function (context, camera, assign) {
|
53
|
-
var _this = this;
|
54
|
-
return this._loader.loadCameraAsync(context, camera, function (babylonCamera) {
|
55
|
-
_this._assignExtras(babylonCamera, camera);
|
56
|
-
assign(babylonCamera);
|
57
|
-
});
|
58
|
-
};
|
59
|
-
/**
|
60
|
-
* @param context
|
61
|
-
* @param material
|
62
|
-
* @param babylonDrawMode
|
63
|
-
* @hidden
|
64
|
-
*/
|
65
|
-
ExtrasAsMetadata.prototype.createMaterial = function (context, material, babylonDrawMode) {
|
66
|
-
var babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);
|
67
|
-
this._assignExtras(babylonMaterial, material);
|
68
|
-
return babylonMaterial;
|
69
|
-
};
|
70
|
-
return ExtrasAsMetadata;
|
71
|
-
}());
|
72
|
-
export { ExtrasAsMetadata };
|
73
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new ExtrasAsMetadata(loader); });
|
1
|
+
import { GLTFLoader } from "../glTFLoader.js";
|
2
|
+
var NAME = "ExtrasAsMetadata";
|
3
|
+
/**
|
4
|
+
* Store glTF extras (if present) in BJS objects' metadata
|
5
|
+
*/
|
6
|
+
var ExtrasAsMetadata = /** @class */ (function () {
|
7
|
+
/**
|
8
|
+
* @param loader
|
9
|
+
* @hidden
|
10
|
+
*/
|
11
|
+
function ExtrasAsMetadata(loader) {
|
12
|
+
/**
|
13
|
+
* The name of this extension.
|
14
|
+
*/
|
15
|
+
this.name = NAME;
|
16
|
+
/**
|
17
|
+
* Defines whether this extension is enabled.
|
18
|
+
*/
|
19
|
+
this.enabled = true;
|
20
|
+
this._loader = loader;
|
21
|
+
}
|
22
|
+
ExtrasAsMetadata.prototype._assignExtras = function (babylonObject, gltfProp) {
|
23
|
+
if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {
|
24
|
+
var metadata = (babylonObject.metadata = babylonObject.metadata || {});
|
25
|
+
var gltf = (metadata.gltf = metadata.gltf || {});
|
26
|
+
gltf.extras = gltfProp.extras;
|
27
|
+
}
|
28
|
+
};
|
29
|
+
/** @hidden */
|
30
|
+
ExtrasAsMetadata.prototype.dispose = function () {
|
31
|
+
this._loader = null;
|
32
|
+
};
|
33
|
+
/**
|
34
|
+
* @param context
|
35
|
+
* @param node
|
36
|
+
* @param assign
|
37
|
+
* @hidden
|
38
|
+
*/
|
39
|
+
ExtrasAsMetadata.prototype.loadNodeAsync = function (context, node, assign) {
|
40
|
+
var _this = this;
|
41
|
+
return this._loader.loadNodeAsync(context, node, function (babylonTransformNode) {
|
42
|
+
_this._assignExtras(babylonTransformNode, node);
|
43
|
+
assign(babylonTransformNode);
|
44
|
+
});
|
45
|
+
};
|
46
|
+
/**
|
47
|
+
* @param context
|
48
|
+
* @param camera
|
49
|
+
* @param assign
|
50
|
+
* @hidden
|
51
|
+
*/
|
52
|
+
ExtrasAsMetadata.prototype.loadCameraAsync = function (context, camera, assign) {
|
53
|
+
var _this = this;
|
54
|
+
return this._loader.loadCameraAsync(context, camera, function (babylonCamera) {
|
55
|
+
_this._assignExtras(babylonCamera, camera);
|
56
|
+
assign(babylonCamera);
|
57
|
+
});
|
58
|
+
};
|
59
|
+
/**
|
60
|
+
* @param context
|
61
|
+
* @param material
|
62
|
+
* @param babylonDrawMode
|
63
|
+
* @hidden
|
64
|
+
*/
|
65
|
+
ExtrasAsMetadata.prototype.createMaterial = function (context, material, babylonDrawMode) {
|
66
|
+
var babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);
|
67
|
+
this._assignExtras(babylonMaterial, material);
|
68
|
+
return babylonMaterial;
|
69
|
+
};
|
70
|
+
return ExtrasAsMetadata;
|
71
|
+
}());
|
72
|
+
export { ExtrasAsMetadata };
|
73
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new ExtrasAsMetadata(loader); });
|
74
74
|
//# sourceMappingURL=ExtrasAsMetadata.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExtrasAsMetadata.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated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,MAAuC;QAAhG,iBAKC;QAJG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,UAAC,aAAa;YAC/D,KAAI,CAAC,aAAa,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAC1C,MAAM,CAAC,aAAa,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACI,yCAAc,GAArB,UAAsB,OAAe,EAAE,QAAmB,EAAE,eAAuB;QAC/E,IAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxF,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,eAAe,CAAC;IAC3B,CAAC;IACL,uBAAC;AAAD,CAAC,AAvED,IAuEC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAA2B,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC,CAAC","sourcesContent":["import { Nullable } from \"core/types\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\n\r\nimport { IProperty } from \"babylonjs-gltf2interface\";\r\nimport { INode, ICamera, IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { Material } from \"core/Materials/material\";\r\n\r\nconst NAME = \"ExtrasAsMetadata\";\r\n\r\ninterface ObjectWithMetadata {\r\n metadata: any;\r\n}\r\n\r\n/**\r\n * Store glTF extras (if present) in BJS objects' metadata\r\n */\r\nexport class ExtrasAsMetadata implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled = true;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n private _assignExtras(babylonObject: ObjectWithMetadata, gltfProp: IProperty): void {\r\n if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {\r\n const metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n const gltf = (metadata.gltf = metadata.gltf || {});\r\n gltf.extras = gltfProp.extras;\r\n }\r\n }\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n public constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n }\r\n\r\n /** @hidden */\r\n public dispose(): void {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return this._loader.loadNodeAsync(context, node, (babylonTransformNode): void => {\r\n this._assignExtras(babylonTransformNode, node);\r\n assign(babylonTransformNode);\r\n });\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param camera\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>> {\r\n return this._loader.loadCameraAsync(context, camera, (babylonCamera): void => {\r\n this._assignExtras(babylonCamera, camera);\r\n assign(babylonCamera);\r\n });\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonDrawMode\r\n * @hidden\r\n */\r\n public createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material> {\r\n const babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);\r\n this._assignExtras(babylonMaterial, material);\r\n return babylonMaterial;\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader): IGLTFLoaderExtension => new ExtrasAsMetadata(loader));\r\n"]}
|
1
|
+
{"version":3,"file":"ExtrasAsMetadata.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/Ex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KC;QAJG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,UAAC,aAAa;YAC/D,KAAI,CAAC,aAAa,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAC1C,MAAM,CAAC,aAAa,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACI,yCAAc,GAArB,UAAsB,OAAe,EAAE,QAAmB,EAAE,eAAuB;QAC/E,IAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxF,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,eAAe,CAAC;IAC3B,CAAC;IACL,uBAAC;AAAD,CAAC,AAvED,IAuEC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAA2B,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\n\r\nimport type { IProperty } from \"babylonjs-gltf2interface\";\r\nimport type { INode, ICamera, IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nconst NAME = \"ExtrasAsMetadata\";\r\n\r\ninterface ObjectWithMetadata {\r\n metadata: any;\r\n}\r\n\r\n/**\r\n * Store glTF extras (if present) in BJS objects' metadata\r\n */\r\nexport class ExtrasAsMetadata implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled = true;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n private _assignExtras(babylonObject: ObjectWithMetadata, gltfProp: IProperty): void {\r\n if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {\r\n const metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n const gltf = (metadata.gltf = metadata.gltf || {});\r\n gltf.extras = gltfProp.extras;\r\n }\r\n }\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n public constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n }\r\n\r\n /** @hidden */\r\n public dispose(): void {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return this._loader.loadNodeAsync(context, node, (babylonTransformNode): void => {\r\n this._assignExtras(babylonTransformNode, node);\r\n assign(babylonTransformNode);\r\n });\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param camera\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>> {\r\n return this._loader.loadCameraAsync(context, camera, (babylonCamera): void => {\r\n this._assignExtras(babylonCamera, camera);\r\n assign(babylonCamera);\r\n });\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonDrawMode\r\n * @hidden\r\n */\r\n public createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material> {\r\n const babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);\r\n this._assignExtras(babylonMaterial, material);\r\n return babylonMaterial;\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader): IGLTFLoaderExtension => new ExtrasAsMetadata(loader));\r\n"]}
|