@babylonjs/loaders 5.0.0-rc.5 → 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,36 +1,36 @@
|
|
1
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
2
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
3
|
-
import { GLTFLoader } from "../glTFLoader";
|
4
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
-
import { INode } from "../glTFLoaderInterfaces";
|
6
|
-
import "@babylonjs/core/Meshes/thinInstanceMesh.js";
|
7
|
-
/**
|
8
|
-
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)
|
9
|
-
* [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)
|
10
|
-
* !!! Experimental Extension Subject to Changes !!!
|
11
|
-
*/
|
12
|
-
export declare class EXT_mesh_gpu_instancing implements IGLTFLoaderExtension {
|
13
|
-
/**
|
14
|
-
* The name of this extension.
|
15
|
-
*/
|
16
|
-
readonly name = "EXT_mesh_gpu_instancing";
|
17
|
-
/**
|
18
|
-
* Defines whether this extension is enabled.
|
19
|
-
*/
|
20
|
-
enabled: boolean;
|
21
|
-
private _loader;
|
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
|
-
}
|
1
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
2
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
3
|
+
import { GLTFLoader } from "../glTFLoader";
|
4
|
+
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
+
import { INode } from "../glTFLoaderInterfaces";
|
6
|
+
import "@babylonjs/core/Meshes/thinInstanceMesh.js";
|
7
|
+
/**
|
8
|
+
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)
|
9
|
+
* [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)
|
10
|
+
* !!! Experimental Extension Subject to Changes !!!
|
11
|
+
*/
|
12
|
+
export declare class EXT_mesh_gpu_instancing implements IGLTFLoaderExtension {
|
13
|
+
/**
|
14
|
+
* The name of this extension.
|
15
|
+
*/
|
16
|
+
readonly name = "EXT_mesh_gpu_instancing";
|
17
|
+
/**
|
18
|
+
* Defines whether this extension is enabled.
|
19
|
+
*/
|
20
|
+
enabled: boolean;
|
21
|
+
private _loader;
|
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
|
+
}
|
@@ -1,89 +1,89 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
2
|
-
import { Vector3, Quaternion, Matrix, TmpVectors } from "@babylonjs/core/Maths/math.vector.js";
|
3
|
-
import { GLTFLoader, ArrayItem } from "../glTFLoader
|
4
|
-
import "@babylonjs/core/Meshes/thinInstanceMesh.js";
|
5
|
-
var NAME = "EXT_mesh_gpu_instancing";
|
6
|
-
/**
|
7
|
-
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)
|
8
|
-
* [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)
|
9
|
-
* !!! Experimental Extension Subject to Changes !!!
|
10
|
-
*/
|
11
|
-
var EXT_mesh_gpu_instancing = /** @class */ (function () {
|
12
|
-
/**
|
13
|
-
* @param loader
|
14
|
-
* @hidden
|
15
|
-
*/
|
16
|
-
function EXT_mesh_gpu_instancing(loader) {
|
17
|
-
/**
|
18
|
-
* The name of this extension.
|
19
|
-
*/
|
20
|
-
this.name = NAME;
|
21
|
-
this._loader = loader;
|
22
|
-
this.enabled = this._loader.isExtensionUsed(NAME);
|
23
|
-
}
|
24
|
-
/** @hidden */
|
25
|
-
EXT_mesh_gpu_instancing.prototype.dispose = function () {
|
26
|
-
this._loader = null;
|
27
|
-
};
|
28
|
-
/**
|
29
|
-
* @param context
|
30
|
-
* @param node
|
31
|
-
* @param assign
|
32
|
-
* @hidden
|
33
|
-
*/
|
34
|
-
EXT_mesh_gpu_instancing.prototype.loadNodeAsync = function (context, node, assign) {
|
35
|
-
var _this = this;
|
36
|
-
return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {
|
37
|
-
_this._loader._disableInstancedMesh++;
|
38
|
-
var promise = _this._loader.loadNodeAsync("/nodes/".concat(node.index), node, assign);
|
39
|
-
_this._loader._disableInstancedMesh--;
|
40
|
-
if (!node._primitiveBabylonMeshes) {
|
41
|
-
return promise;
|
42
|
-
}
|
43
|
-
var promises = new Array();
|
44
|
-
var instanceCount = 0;
|
45
|
-
var loadAttribute = function (attribute) {
|
46
|
-
if (extension.attributes[attribute] == undefined) {
|
47
|
-
promises.push(Promise.resolve(null));
|
48
|
-
return;
|
49
|
-
}
|
50
|
-
var accessor = ArrayItem.Get("".concat(extensionContext, "/attributes/").concat(attribute), _this._loader.gltf.accessors, extension.attributes[attribute]);
|
51
|
-
promises.push(_this._loader._loadFloatAccessorAsync("/accessors/".concat(accessor.bufferView), accessor));
|
52
|
-
if (instanceCount === 0) {
|
53
|
-
instanceCount = accessor.count;
|
54
|
-
}
|
55
|
-
else if (instanceCount !== accessor.count) {
|
56
|
-
throw new Error("".concat(extensionContext, "/attributes: Instance buffer accessors do not have the same count."));
|
57
|
-
}
|
58
|
-
};
|
59
|
-
loadAttribute("TRANSLATION");
|
60
|
-
loadAttribute("ROTATION");
|
61
|
-
loadAttribute("SCALE");
|
62
|
-
return promise.then(function (babylonTransformNode) {
|
63
|
-
return Promise.all(promises).then(function (_a) {
|
64
|
-
var translationBuffer = _a[0], rotationBuffer = _a[1], scaleBuffer = _a[2];
|
65
|
-
var matrices = new Float32Array(instanceCount * 16);
|
66
|
-
TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation
|
67
|
-
TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation
|
68
|
-
TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale
|
69
|
-
for (var i = 0; i < instanceCount; ++i) {
|
70
|
-
translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);
|
71
|
-
rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);
|
72
|
-
scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);
|
73
|
-
Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);
|
74
|
-
TmpVectors.Matrix[0].copyToArray(matrices, i * 16);
|
75
|
-
}
|
76
|
-
for (var _i = 0, _b = node._primitiveBabylonMeshes; _i < _b.length; _i++) {
|
77
|
-
var babylonMesh = _b[_i];
|
78
|
-
babylonMesh.thinInstanceSetBuffer("matrix", matrices, 16, true);
|
79
|
-
}
|
80
|
-
return babylonTransformNode;
|
81
|
-
});
|
82
|
-
});
|
83
|
-
});
|
84
|
-
};
|
85
|
-
return EXT_mesh_gpu_instancing;
|
86
|
-
}());
|
87
|
-
export { EXT_mesh_gpu_instancing };
|
88
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_mesh_gpu_instancing(loader); });
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
2
|
+
import { Vector3, Quaternion, Matrix, TmpVectors } from "@babylonjs/core/Maths/math.vector.js";
|
3
|
+
import { GLTFLoader, ArrayItem } from "../glTFLoader";
|
4
|
+
import "@babylonjs/core/Meshes/thinInstanceMesh.js";
|
5
|
+
var NAME = "EXT_mesh_gpu_instancing";
|
6
|
+
/**
|
7
|
+
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)
|
8
|
+
* [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)
|
9
|
+
* !!! Experimental Extension Subject to Changes !!!
|
10
|
+
*/
|
11
|
+
var EXT_mesh_gpu_instancing = /** @class */ (function () {
|
12
|
+
/**
|
13
|
+
* @param loader
|
14
|
+
* @hidden
|
15
|
+
*/
|
16
|
+
function EXT_mesh_gpu_instancing(loader) {
|
17
|
+
/**
|
18
|
+
* The name of this extension.
|
19
|
+
*/
|
20
|
+
this.name = NAME;
|
21
|
+
this._loader = loader;
|
22
|
+
this.enabled = this._loader.isExtensionUsed(NAME);
|
23
|
+
}
|
24
|
+
/** @hidden */
|
25
|
+
EXT_mesh_gpu_instancing.prototype.dispose = function () {
|
26
|
+
this._loader = null;
|
27
|
+
};
|
28
|
+
/**
|
29
|
+
* @param context
|
30
|
+
* @param node
|
31
|
+
* @param assign
|
32
|
+
* @hidden
|
33
|
+
*/
|
34
|
+
EXT_mesh_gpu_instancing.prototype.loadNodeAsync = function (context, node, assign) {
|
35
|
+
var _this = this;
|
36
|
+
return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {
|
37
|
+
_this._loader._disableInstancedMesh++;
|
38
|
+
var promise = _this._loader.loadNodeAsync("/nodes/".concat(node.index), node, assign);
|
39
|
+
_this._loader._disableInstancedMesh--;
|
40
|
+
if (!node._primitiveBabylonMeshes) {
|
41
|
+
return promise;
|
42
|
+
}
|
43
|
+
var promises = new Array();
|
44
|
+
var instanceCount = 0;
|
45
|
+
var loadAttribute = function (attribute) {
|
46
|
+
if (extension.attributes[attribute] == undefined) {
|
47
|
+
promises.push(Promise.resolve(null));
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
var accessor = ArrayItem.Get("".concat(extensionContext, "/attributes/").concat(attribute), _this._loader.gltf.accessors, extension.attributes[attribute]);
|
51
|
+
promises.push(_this._loader._loadFloatAccessorAsync("/accessors/".concat(accessor.bufferView), accessor));
|
52
|
+
if (instanceCount === 0) {
|
53
|
+
instanceCount = accessor.count;
|
54
|
+
}
|
55
|
+
else if (instanceCount !== accessor.count) {
|
56
|
+
throw new Error("".concat(extensionContext, "/attributes: Instance buffer accessors do not have the same count."));
|
57
|
+
}
|
58
|
+
};
|
59
|
+
loadAttribute("TRANSLATION");
|
60
|
+
loadAttribute("ROTATION");
|
61
|
+
loadAttribute("SCALE");
|
62
|
+
return promise.then(function (babylonTransformNode) {
|
63
|
+
return Promise.all(promises).then(function (_a) {
|
64
|
+
var translationBuffer = _a[0], rotationBuffer = _a[1], scaleBuffer = _a[2];
|
65
|
+
var matrices = new Float32Array(instanceCount * 16);
|
66
|
+
TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation
|
67
|
+
TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation
|
68
|
+
TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale
|
69
|
+
for (var i = 0; i < instanceCount; ++i) {
|
70
|
+
translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);
|
71
|
+
rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);
|
72
|
+
scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);
|
73
|
+
Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);
|
74
|
+
TmpVectors.Matrix[0].copyToArray(matrices, i * 16);
|
75
|
+
}
|
76
|
+
for (var _i = 0, _b = node._primitiveBabylonMeshes; _i < _b.length; _i++) {
|
77
|
+
var babylonMesh = _b[_i];
|
78
|
+
babylonMesh.thinInstanceSetBuffer("matrix", matrices, 16, true);
|
79
|
+
}
|
80
|
+
return babylonTransformNode;
|
81
|
+
});
|
82
|
+
});
|
83
|
+
});
|
84
|
+
};
|
85
|
+
return EXT_mesh_gpu_instancing;
|
86
|
+
}());
|
87
|
+
export { EXT_mesh_gpu_instancing };
|
88
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_mesh_gpu_instancing(loader); });
|
89
89
|
//# sourceMappingURL=EXT_mesh_gpu_instancing.js.map
|
@@ -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 { 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,50 +1,50 @@
|
|
1
|
-
import { ArrayItem, GLTFLoader } from "../glTFLoader
|
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";
|
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,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 { 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,41 +1,41 @@
|
|
1
|
-
import { GLTFLoader, ArrayItem } from "../glTFLoader
|
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";
|
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
|