@babylonjs/loaders 5.0.0-beta.8 → 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 -357
- package/glTF/2.0/glTFLoader.js +0 -2249
- 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 -209
- 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 -368
- package/glTF/glTFFileLoader.js +0 -869
- 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
@@ -1,27 +0,0 @@
|
|
1
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
|
2
|
-
import { Nullable } from "@babylonjs/core/types";
|
3
|
-
import { GLTFLoader } from "../glTFLoader";
|
4
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
-
import { INode } from "../glTFLoaderInterfaces";
|
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
|
-
export declare class EXT_mesh_gpu_instancing implements IGLTFLoaderExtension {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
readonly name = "EXT_mesh_gpu_instancing";
|
16
|
-
/**
|
17
|
-
* Defines whether this extension is enabled.
|
18
|
-
*/
|
19
|
-
enabled: boolean;
|
20
|
-
private _loader;
|
21
|
-
/** @hidden */
|
22
|
-
constructor(loader: GLTFLoader);
|
23
|
-
/** @hidden */
|
24
|
-
dispose(): void;
|
25
|
-
/** @hidden */
|
26
|
-
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
27
|
-
}
|
@@ -1,80 +0,0 @@
|
|
1
|
-
import { Vector3, Quaternion, Matrix } from '@babylonjs/core/Maths/math.vector.js';
|
2
|
-
import { GLTFLoader, ArrayItem } from "../glTFLoader.js";
|
3
|
-
import { TmpVectors } from '@babylonjs/core/Maths/math.vector.js';
|
4
|
-
var NAME = "EXT_mesh_gpu_instancing";
|
5
|
-
/**
|
6
|
-
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)
|
7
|
-
* [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)
|
8
|
-
* !!! Experimental Extension Subject to Changes !!!
|
9
|
-
*/
|
10
|
-
var EXT_mesh_gpu_instancing = /** @class */ (function () {
|
11
|
-
/** @hidden */
|
12
|
-
function EXT_mesh_gpu_instancing(loader) {
|
13
|
-
/**
|
14
|
-
* The name of this extension.
|
15
|
-
*/
|
16
|
-
this.name = NAME;
|
17
|
-
this._loader = loader;
|
18
|
-
this.enabled = this._loader.isExtensionUsed(NAME);
|
19
|
-
}
|
20
|
-
/** @hidden */
|
21
|
-
EXT_mesh_gpu_instancing.prototype.dispose = function () {
|
22
|
-
this._loader = null;
|
23
|
-
};
|
24
|
-
/** @hidden */
|
25
|
-
EXT_mesh_gpu_instancing.prototype.loadNodeAsync = function (context, node, assign) {
|
26
|
-
var _this = this;
|
27
|
-
return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {
|
28
|
-
_this._loader._disableInstancedMesh++;
|
29
|
-
var promise = _this._loader.loadNodeAsync("/nodes/".concat(node.index), node, assign);
|
30
|
-
_this._loader._disableInstancedMesh--;
|
31
|
-
if (!node._primitiveBabylonMeshes) {
|
32
|
-
return promise;
|
33
|
-
}
|
34
|
-
var promises = new Array();
|
35
|
-
var instanceCount = 0;
|
36
|
-
var loadAttribute = function (attribute) {
|
37
|
-
if (extension.attributes[attribute] == undefined) {
|
38
|
-
promises.push(Promise.resolve(null));
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
var accessor = ArrayItem.Get("".concat(extensionContext, "/attributes/").concat(attribute), _this._loader.gltf.accessors, extension.attributes[attribute]);
|
42
|
-
promises.push(_this._loader._loadFloatAccessorAsync("/accessors/".concat(accessor.bufferView), accessor));
|
43
|
-
if (instanceCount === 0) {
|
44
|
-
instanceCount = accessor.count;
|
45
|
-
}
|
46
|
-
else if (instanceCount !== accessor.count) {
|
47
|
-
throw new Error("".concat(extensionContext, "/attributes: Instance buffer accessors do not have the same count."));
|
48
|
-
}
|
49
|
-
};
|
50
|
-
loadAttribute("TRANSLATION");
|
51
|
-
loadAttribute("ROTATION");
|
52
|
-
loadAttribute("SCALE");
|
53
|
-
return promise.then(function (babylonTransformNode) {
|
54
|
-
return Promise.all(promises).then(function (_a) {
|
55
|
-
var translationBuffer = _a[0], rotationBuffer = _a[1], scaleBuffer = _a[2];
|
56
|
-
var matrices = new Float32Array(instanceCount * 16);
|
57
|
-
TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation
|
58
|
-
TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation
|
59
|
-
TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale
|
60
|
-
for (var i = 0; i < instanceCount; ++i) {
|
61
|
-
translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);
|
62
|
-
rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);
|
63
|
-
scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);
|
64
|
-
Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);
|
65
|
-
TmpVectors.Matrix[0].copyToArray(matrices, i * 16);
|
66
|
-
}
|
67
|
-
for (var _i = 0, _b = node._primitiveBabylonMeshes; _i < _b.length; _i++) {
|
68
|
-
var babylonMesh = _b[_i];
|
69
|
-
babylonMesh.thinInstanceSetBuffer("matrix", matrices, 16, true);
|
70
|
-
}
|
71
|
-
return babylonTransformNode;
|
72
|
-
});
|
73
|
-
});
|
74
|
-
});
|
75
|
-
};
|
76
|
-
return EXT_mesh_gpu_instancing;
|
77
|
-
}());
|
78
|
-
export { EXT_mesh_gpu_instancing };
|
79
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_mesh_gpu_instancing(loader); });
|
80
|
-
//# sourceMappingURL=EXT_mesh_gpu_instancing.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EXT_mesh_gpu_instancing.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAIhF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAG/D,IAAM,IAAI,GAAG,yBAAyB,CAAC;AAEvC;;;;GAIG;AACH;IAaI,cAAc;IACd,iCAAY,MAAkB;QAb9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAWxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,cAAc;IACP,yCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,cAAc;IACP,+CAAa,GAApB,UAAqB,OAAe,EAAE,IAAW,EAAE,MAAqD;QAAxG,iBA6DC;QA5DG,OAAO,UAAU,CAAC,kBAAkB,CAAuC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YAC7H,KAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAErC,IAAM,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC,aAAa,CAAC,iBAAU,IAAI,CAAC,KAAK,CAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAEjF,KAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAErC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;gBAC/B,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A7B,cAA6B,EAA7B,IAA6B,EAAE;wBAApD,IAAM,WAAW,SAAA;wBACjB,WAAoB,CAAC,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;qBAC7E;oBAED,OAAO,oBAAoB,CAAC;gBAChC,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IACL,8BAAC;AAAD,CAAC,AAvFD,IAuFC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAnC,CAAmC,CAAC,CAAC","sourcesContent":["import { Vector3, Quaternion, Matrix } from '@babylonjs/core/Maths/math.vector';\nimport { Mesh } from '@babylonjs/core/Meshes/mesh';\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\nimport { Nullable } from \"@babylonjs/core/types\";\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { INode } from \"../glTFLoaderInterfaces\";\nimport { TmpVectors } from '@babylonjs/core/Maths/math.vector';\nimport { IEXTMeshGpuInstancing } from \"babylonjs-gltf2interface\";\n\nconst NAME = \"EXT_mesh_gpu_instancing\";\n\n/**\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)\n * [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)\n * !!! Experimental Extension Subject to Changes !!!\n */\nexport class EXT_mesh_gpu_instancing implements IGLTFLoaderExtension {\n /**\n * The name of this extension.\n */\n public readonly name = NAME;\n\n /**\n * Defines whether this extension is enabled.\n */\n public enabled: boolean;\n\n private _loader: GLTFLoader;\n\n /** @hidden */\n constructor(loader: GLTFLoader) {\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n\n /** @hidden */\n public dispose() {\n (this._loader as any) = null;\n }\n\n /** @hidden */\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\n return GLTFLoader.LoadExtensionAsync<IEXTMeshGpuInstancing, TransformNode>(context, node, this.name, (extensionContext, extension) => {\n this._loader._disableInstancedMesh++;\n\n const promise = this._loader.loadNodeAsync(`/nodes/${node.index}`, node, assign);\n\n this._loader._disableInstancedMesh--;\n\n if (!node._primitiveBabylonMeshes) {\n return promise;\n }\n\n const promises = new Array<Promise<Nullable<Float32Array>>>();\n let instanceCount = 0;\n\n const loadAttribute = (attribute: string) => {\n if (extension.attributes[attribute] == undefined) {\n promises.push(Promise.resolve(null));\n return;\n }\n\n const accessor = ArrayItem.Get(`${extensionContext}/attributes/${attribute}`, this._loader.gltf.accessors, extension.attributes[attribute]);\n promises.push(this._loader._loadFloatAccessorAsync(`/accessors/${accessor.bufferView}`, accessor));\n\n if (instanceCount === 0) {\n instanceCount = accessor.count;\n } else if (instanceCount !== accessor.count) {\n throw new Error(`${extensionContext}/attributes: Instance buffer accessors do not have the same count.`);\n }\n };\n\n loadAttribute(\"TRANSLATION\");\n loadAttribute(\"ROTATION\");\n loadAttribute(\"SCALE\");\n\n return promise.then((babylonTransformNode) => {\n return Promise.all(promises).then(([translationBuffer, rotationBuffer, scaleBuffer]) => {\n const matrices = new Float32Array(instanceCount * 16);\n\n TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation\n TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation\n TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale\n\n for (let i = 0; i < instanceCount; ++i) {\n translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);\n rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);\n scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);\n\n Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);\n\n TmpVectors.Matrix[0].copyToArray(matrices, i * 16);\n }\n\n for (const babylonMesh of node._primitiveBabylonMeshes!) {\n (babylonMesh as Mesh).thinInstanceSetBuffer(\"matrix\", matrices, 16, true);\n }\n\n return babylonTransformNode;\n });\n });\n });\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_mesh_gpu_instancing(loader));\n"]}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
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
|
-
/** @hidden */
|
22
|
-
constructor(loader: GLTFLoader);
|
23
|
-
/** @hidden */
|
24
|
-
dispose(): void;
|
25
|
-
/** @hidden */
|
26
|
-
loadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>>;
|
27
|
-
}
|
@@ -1,43 +0,0 @@
|
|
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
|
-
/** @hidden */
|
12
|
-
function EXT_meshopt_compression(loader) {
|
13
|
-
/**
|
14
|
-
* The name of this extension.
|
15
|
-
*/
|
16
|
-
this.name = NAME;
|
17
|
-
this.enabled = loader.isExtensionUsed(NAME);
|
18
|
-
this._loader = loader;
|
19
|
-
}
|
20
|
-
/** @hidden */
|
21
|
-
EXT_meshopt_compression.prototype.dispose = function () {
|
22
|
-
this._loader = null;
|
23
|
-
};
|
24
|
-
/** @hidden */
|
25
|
-
EXT_meshopt_compression.prototype.loadBufferViewAsync = function (context, bufferView) {
|
26
|
-
var _this = this;
|
27
|
-
return GLTFLoader.LoadExtensionAsync(context, bufferView, this.name, function (extensionContext, extension) {
|
28
|
-
var bufferViewMeshopt = bufferView;
|
29
|
-
if (bufferViewMeshopt._meshOptData) {
|
30
|
-
return bufferViewMeshopt._meshOptData;
|
31
|
-
}
|
32
|
-
var buffer = ArrayItem.Get("".concat(context, "/buffer"), _this._loader.gltf.buffers, extension.buffer);
|
33
|
-
bufferViewMeshopt._meshOptData = _this._loader.loadBufferAsync("/buffers/".concat(buffer.index), buffer, (extension.byteOffset || 0), extension.byteLength).then(function (buffer) {
|
34
|
-
return MeshoptCompression.Default.decodeGltfBufferAsync(buffer, extension.count, extension.byteStride, extension.mode, extension.filter);
|
35
|
-
});
|
36
|
-
return bufferViewMeshopt._meshOptData;
|
37
|
-
});
|
38
|
-
};
|
39
|
-
return EXT_meshopt_compression;
|
40
|
-
}());
|
41
|
-
export { EXT_meshopt_compression };
|
42
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_meshopt_compression(loader); });
|
43
|
-
//# sourceMappingURL=EXT_meshopt_compression.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EXT_meshopt_compression.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/EXT_meshopt_compression.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAE3F,IAAM,IAAI,GAAG,yBAAyB,CAAC;AAMvC;;;;;GAKG;AACH;IAaI,cAAc;IACd,iCAAY,MAAkB;QAb9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAWxB,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,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,cAAc;IACP,qDAAmB,GAA1B,UAA2B,OAAe,EAAE,UAAuB;QAAnE,iBAcC;QAbG,OAAO,UAAU,CAAC,kBAAkB,CAA0C,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YACtI,IAAM,iBAAiB,GAAG,UAAgC,CAAC;YAC3D,IAAI,iBAAiB,CAAC,YAAY,EAAE;gBAChC,OAAO,iBAAiB,CAAC,YAAY,CAAC;aACzC;YAED,IAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,UAAG,OAAO,YAAS,EAAE,KAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YAC/F,iBAAiB,CAAC,YAAY,GAAG,KAAI,CAAC,OAAO,CAAC,eAAe,CAAC,mBAAY,MAAM,CAAC,KAAK,CAAE,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,MAAM;gBAC7J,OAAO,kBAAkB,CAAC,OAAO,CAAC,qBAAqB,CAAC,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,AAxCD,IAwCC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAnC,CAAmC,CAAC,CAAC","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { ArrayItem, GLTFLoader } from \"../glTFLoader\";\nimport { IBufferView } from \"../glTFLoaderInterfaces\";\nimport { IEXTMeshoptCompression } from \"babylonjs-gltf2interface\";\nimport { MeshoptCompression } from \"@babylonjs/core/Meshes/Compression/meshoptCompression\";\n\nconst NAME = \"EXT_meshopt_compression\";\n\ninterface IBufferViewMeshopt extends IBufferView {\n _meshOptData?: Promise<ArrayBufferView>;\n}\n\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression)\n *\n * This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js\n * @since 5.0.0\n */\nexport class EXT_meshopt_compression implements IGLTFLoaderExtension {\n /**\n * The name of this extension.\n */\n public readonly name = NAME;\n\n /**\n * Defines whether this extension is enabled.\n */\n public enabled: boolean;\n\n private _loader: GLTFLoader;\n\n /** @hidden */\n constructor(loader: GLTFLoader) {\n this.enabled = loader.isExtensionUsed(NAME);\n this._loader = loader;\n }\n\n /** @hidden */\n public dispose() {\n (this._loader as any) = null;\n }\n\n /** @hidden */\n public loadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>> {\n return GLTFLoader.LoadExtensionAsync<IEXTMeshoptCompression, ArrayBufferView>(context, bufferView, this.name, (extensionContext, extension) => {\n const bufferViewMeshopt = bufferView as IBufferViewMeshopt;\n if (bufferViewMeshopt._meshOptData) {\n return bufferViewMeshopt._meshOptData;\n }\n\n const buffer = ArrayItem.Get(`${context}/buffer`, this._loader.gltf.buffers, extension.buffer);\n bufferViewMeshopt._meshOptData = this._loader.loadBufferAsync(`/buffers/${buffer.index}`, buffer, (extension.byteOffset || 0), extension.byteLength).then((buffer) => {\n return MeshoptCompression.Default.decodeGltfBufferAsync(buffer as Uint8Array, extension.count, extension.byteStride, extension.mode, extension.filter);\n });\n\n return bufferViewMeshopt._meshOptData;\n });\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_meshopt_compression(loader));\n"]}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
2
|
-
import { GLTFLoader } from "../glTFLoader";
|
3
|
-
import { ITexture } from "../glTFLoaderInterfaces";
|
4
|
-
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture";
|
5
|
-
import { Nullable } from "@babylonjs/core/types";
|
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
|
-
/** @hidden */
|
16
|
-
constructor(loader: GLTFLoader);
|
17
|
-
/** @hidden */
|
18
|
-
dispose(): void;
|
19
|
-
/** @hidden */
|
20
|
-
_loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
|
21
|
-
}
|
@@ -1,33 +0,0 @@
|
|
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
|
-
/** @hidden */
|
8
|
-
function EXT_texture_webp(loader) {
|
9
|
-
/** The name of this extension. */
|
10
|
-
this.name = NAME;
|
11
|
-
this._loader = loader;
|
12
|
-
this.enabled = loader.isExtensionUsed(NAME);
|
13
|
-
}
|
14
|
-
/** @hidden */
|
15
|
-
EXT_texture_webp.prototype.dispose = function () {
|
16
|
-
this._loader = null;
|
17
|
-
};
|
18
|
-
/** @hidden */
|
19
|
-
EXT_texture_webp.prototype._loadTextureAsync = function (context, texture, assign) {
|
20
|
-
var _this = this;
|
21
|
-
return GLTFLoader.LoadExtensionAsync(context, texture, this.name, function (extensionContext, extension) {
|
22
|
-
var sampler = (texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get("".concat(context, "/sampler"), _this._loader.gltf.samplers, texture.sampler));
|
23
|
-
var image = ArrayItem.Get("".concat(extensionContext, "/source"), _this._loader.gltf.images, extension.source);
|
24
|
-
return _this._loader._createTextureAsync(context, sampler, image, function (babylonTexture) {
|
25
|
-
assign(babylonTexture);
|
26
|
-
}, undefined, !texture._textureInfo.nonColorData);
|
27
|
-
});
|
28
|
-
};
|
29
|
-
return EXT_texture_webp;
|
30
|
-
}());
|
31
|
-
export { EXT_texture_webp };
|
32
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_texture_webp(loader); });
|
33
|
-
//# sourceMappingURL=EXT_texture_webp.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EXT_texture_web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B,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;IACL,uBAAC;AAAD,CAAC,AA9BD,IA8BC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC,CAAC","sourcesContent":["import { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { ITexture } from \"../glTFLoaderInterfaces\";\r\nimport { BaseTexture } from \"@babylonjs/core/Materials/Textures/baseTexture\";\r\nimport { Nullable } from \"@babylonjs/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 /** @hidden */\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 /** @hidden */\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(context, sampler, image, (babylonTexture) => {\r\n assign(babylonTexture);\r\n }, undefined, !texture._textureInfo.nonColorData);\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_texture_webp(loader));\r\n"]}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
|
3
|
-
import { Camera } from "@babylonjs/core/Cameras/camera";
|
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";
|
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
|
-
/** @hidden */
|
23
|
-
constructor(loader: GLTFLoader);
|
24
|
-
/** @hidden */
|
25
|
-
dispose(): void;
|
26
|
-
/** @hidden */
|
27
|
-
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
28
|
-
/** @hidden */
|
29
|
-
loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
|
30
|
-
/** @hidden */
|
31
|
-
createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
|
32
|
-
}
|
@@ -1,56 +0,0 @@
|
|
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
|
-
/** @hidden */
|
8
|
-
function ExtrasAsMetadata(loader) {
|
9
|
-
/**
|
10
|
-
* The name of this extension.
|
11
|
-
*/
|
12
|
-
this.name = NAME;
|
13
|
-
/**
|
14
|
-
* Defines whether this extension is enabled.
|
15
|
-
*/
|
16
|
-
this.enabled = true;
|
17
|
-
this._loader = loader;
|
18
|
-
}
|
19
|
-
ExtrasAsMetadata.prototype._assignExtras = function (babylonObject, gltfProp) {
|
20
|
-
if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {
|
21
|
-
var metadata = (babylonObject.metadata = babylonObject.metadata || {});
|
22
|
-
var gltf = (metadata.gltf = metadata.gltf || {});
|
23
|
-
gltf.extras = gltfProp.extras;
|
24
|
-
}
|
25
|
-
};
|
26
|
-
/** @hidden */
|
27
|
-
ExtrasAsMetadata.prototype.dispose = function () {
|
28
|
-
this._loader = null;
|
29
|
-
};
|
30
|
-
/** @hidden */
|
31
|
-
ExtrasAsMetadata.prototype.loadNodeAsync = function (context, node, assign) {
|
32
|
-
var _this = this;
|
33
|
-
return this._loader.loadNodeAsync(context, node, function (babylonTransformNode) {
|
34
|
-
_this._assignExtras(babylonTransformNode, node);
|
35
|
-
assign(babylonTransformNode);
|
36
|
-
});
|
37
|
-
};
|
38
|
-
/** @hidden */
|
39
|
-
ExtrasAsMetadata.prototype.loadCameraAsync = function (context, camera, assign) {
|
40
|
-
var _this = this;
|
41
|
-
return this._loader.loadCameraAsync(context, camera, function (babylonCamera) {
|
42
|
-
_this._assignExtras(babylonCamera, camera);
|
43
|
-
assign(babylonCamera);
|
44
|
-
});
|
45
|
-
};
|
46
|
-
/** @hidden */
|
47
|
-
ExtrasAsMetadata.prototype.createMaterial = function (context, material, babylonDrawMode) {
|
48
|
-
var babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);
|
49
|
-
this._assignExtras(babylonMaterial, material);
|
50
|
-
return babylonMaterial;
|
51
|
-
};
|
52
|
-
return ExtrasAsMetadata;
|
53
|
-
}());
|
54
|
-
export { ExtrasAsMetadata };
|
55
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new ExtrasAsMetadata(loader); });
|
56
|
-
//# sourceMappingURL=ExtrasAsMetadata.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ExtrasAsMetadata.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/ExtrasAsMetadata.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,kBAAkB,CAAC;AAMhC;;GAEG;AACH;IAwBI,cAAc;IACd,0BAAmB,MAAkB;QAxBrC;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAE5B;;WAEG;QACI,YAAO,GAAG,IAAI,CAAC;QAiBlB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAdO,wCAAa,GAArB,UACI,aAAiC,EACjC,QAAmB;QAEnB,IAAI,QAAQ,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5D,IAAM,QAAQ,GAAG,CAAC,aAAa,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;YACzE,IAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YACnD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;SACjC;IACL,CAAC;IAOD,cAAc;IACP,kCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,cAAc;IACP,wCAAa,GAApB,UACI,OAAe,EACf,IAAW,EACX,MAAqD;QAHzD,iBAaC;QARG,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAC7B,OAAO,EACP,IAAI,EACJ,UAAC,oBAAoB;YACjB,KAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;YAC/C,MAAM,CAAC,oBAAoB,CAAC,CAAC;QACjC,CAAC,CACJ,CAAC;IACN,CAAC;IAED,cAAc;IACP,0CAAe,GAAtB,UACI,OAAe,EACf,MAAe,EACf,MAAuC;QAH3C,iBAaC;QARG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAC/B,OAAO,EACP,MAAM,EACN,UAAC,aAAa;YACV,KAAI,CAAC,aAAa,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAC1C,MAAM,CAAC,aAAa,CAAC,CAAC;QAC1B,CAAC,CACJ,CAAC;IACN,CAAC;IAED,cAAc;IACP,yCAAc,GAArB,UACI,OAAe,EACf,QAAmB,EACnB,eAAuB;QAEvB,IAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAC/C,OAAO,EACP,QAAQ,EACR,eAAe,CAClB,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,eAAe,CAAC;IAC3B,CAAC;IACL,uBAAC;AAAD,CAAC,AAhFD,IAgFC;;AAED,UAAU,CAAC,iBAAiB,CACxB,IAAI,EACJ,UAAC,MAAM,IAA2B,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CACjE,CAAC","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { Camera } from \"@babylonjs/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 \"@babylonjs/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(\r\n babylonObject: ObjectWithMetadata,\r\n gltfProp: IProperty\r\n ): 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 /** @hidden */\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 /** @hidden */\r\n public loadNodeAsync(\r\n context: string,\r\n node: INode,\r\n assign: (babylonTransformNode: TransformNode) => void\r\n ): Nullable<Promise<TransformNode>> {\r\n return this._loader.loadNodeAsync(\r\n context,\r\n node,\r\n (babylonTransformNode): void => {\r\n this._assignExtras(babylonTransformNode, node);\r\n assign(babylonTransformNode);\r\n }\r\n );\r\n }\r\n\r\n /** @hidden */\r\n public loadCameraAsync(\r\n context: string,\r\n camera: ICamera,\r\n assign: (babylonCamera: Camera) => void\r\n ): Nullable<Promise<Camera>> {\r\n return this._loader.loadCameraAsync(\r\n context,\r\n camera,\r\n (babylonCamera): void => {\r\n this._assignExtras(babylonCamera, camera);\r\n assign(babylonCamera);\r\n }\r\n );\r\n }\r\n\r\n /** @hidden */\r\n public createMaterial(\r\n context: string,\r\n material: IMaterial,\r\n babylonDrawMode: number\r\n ): Nullable<Material> {\r\n const babylonMaterial = this._loader.createMaterial(\r\n context,\r\n material,\r\n babylonDrawMode\r\n );\r\n this._assignExtras(babylonMaterial, material);\r\n return babylonMaterial;\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(\r\n NAME,\r\n (loader): IGLTFLoaderExtension => new ExtrasAsMetadata(loader)\r\n);\r\n"]}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
2
|
-
import { Nullable } from "@babylonjs/core/types";
|
3
|
-
import { Geometry } from "@babylonjs/core/Meshes/geometry";
|
4
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh";
|
5
|
-
import { IMeshPrimitive } from "../glTFLoaderInterfaces";
|
6
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
7
|
-
import { GLTFLoader } from "../glTFLoader";
|
8
|
-
/**
|
9
|
-
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
|
10
|
-
*/
|
11
|
-
export declare class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
readonly name = "KHR_draco_mesh_compression";
|
16
|
-
/**
|
17
|
-
* The draco compression used to decode vertex data or DracoCompression.Default if not defined
|
18
|
-
*/
|
19
|
-
dracoCompression?: DracoCompression;
|
20
|
-
/**
|
21
|
-
* Defines whether this extension is enabled.
|
22
|
-
*/
|
23
|
-
enabled: boolean;
|
24
|
-
private _loader;
|
25
|
-
/** @hidden */
|
26
|
-
constructor(loader: GLTFLoader);
|
27
|
-
/** @hidden */
|
28
|
-
dispose(): void;
|
29
|
-
/** @hidden */
|
30
|
-
_loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
|
31
|
-
}
|
@@ -1,102 +0,0 @@
|
|
1
|
-
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression.js";
|
2
|
-
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
3
|
-
import { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
4
|
-
import { GLTFLoader, ArrayItem } from "../glTFLoader.js";
|
5
|
-
var NAME = "KHR_draco_mesh_compression";
|
6
|
-
/**
|
7
|
-
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
|
8
|
-
*/
|
9
|
-
var KHR_draco_mesh_compression = /** @class */ (function () {
|
10
|
-
/** @hidden */
|
11
|
-
function KHR_draco_mesh_compression(loader) {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
this.name = NAME;
|
16
|
-
this._loader = loader;
|
17
|
-
this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);
|
18
|
-
}
|
19
|
-
/** @hidden */
|
20
|
-
KHR_draco_mesh_compression.prototype.dispose = function () {
|
21
|
-
delete this.dracoCompression;
|
22
|
-
this._loader = null;
|
23
|
-
};
|
24
|
-
/** @hidden */
|
25
|
-
KHR_draco_mesh_compression.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {
|
26
|
-
var _this = this;
|
27
|
-
return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, function (extensionContext, extension) {
|
28
|
-
if (primitive.mode != undefined) {
|
29
|
-
if (primitive.mode !== 5 /* TRIANGLE_STRIP */ &&
|
30
|
-
primitive.mode !== 4 /* TRIANGLES */) {
|
31
|
-
throw new Error("".concat(context, ": Unsupported mode ").concat(primitive.mode));
|
32
|
-
}
|
33
|
-
// TODO: handle triangle strips
|
34
|
-
if (primitive.mode === 5 /* TRIANGLE_STRIP */) {
|
35
|
-
throw new Error("".concat(context, ": Mode ").concat(primitive.mode, " is not currently supported"));
|
36
|
-
}
|
37
|
-
}
|
38
|
-
var attributes = {};
|
39
|
-
var dividers = {};
|
40
|
-
var loadAttribute = function (name, kind) {
|
41
|
-
var uniqueId = extension.attributes[name];
|
42
|
-
if (uniqueId === undefined || primitive.attributes[name] === undefined) {
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
attributes[kind] = uniqueId;
|
46
|
-
var accessor = ArrayItem.Get("".concat(context, "/attributes/").concat(name), _this._loader.gltf.accessors, primitive.attributes[name]);
|
47
|
-
if (accessor.normalized && accessor.componentType !== 5126 /* FLOAT */) {
|
48
|
-
var divider = 1;
|
49
|
-
switch (accessor.componentType) {
|
50
|
-
case 5120 /* BYTE */:
|
51
|
-
divider = 127.0;
|
52
|
-
break;
|
53
|
-
case 5121 /* UNSIGNED_BYTE */:
|
54
|
-
divider = 255.0;
|
55
|
-
break;
|
56
|
-
case 5122 /* SHORT */:
|
57
|
-
divider = 32767.0;
|
58
|
-
break;
|
59
|
-
case 5123 /* UNSIGNED_SHORT */:
|
60
|
-
divider = 65535.0;
|
61
|
-
break;
|
62
|
-
}
|
63
|
-
dividers[kind] = divider;
|
64
|
-
}
|
65
|
-
babylonMesh._delayInfo = babylonMesh._delayInfo || [];
|
66
|
-
if (babylonMesh._delayInfo.indexOf(kind) === -1) {
|
67
|
-
babylonMesh._delayInfo.push(kind);
|
68
|
-
}
|
69
|
-
};
|
70
|
-
loadAttribute("POSITION", VertexBuffer.PositionKind);
|
71
|
-
loadAttribute("NORMAL", VertexBuffer.NormalKind);
|
72
|
-
loadAttribute("TANGENT", VertexBuffer.TangentKind);
|
73
|
-
loadAttribute("TEXCOORD_0", VertexBuffer.UVKind);
|
74
|
-
loadAttribute("TEXCOORD_1", VertexBuffer.UV2Kind);
|
75
|
-
loadAttribute("TEXCOORD_2", VertexBuffer.UV3Kind);
|
76
|
-
loadAttribute("TEXCOORD_3", VertexBuffer.UV4Kind);
|
77
|
-
loadAttribute("TEXCOORD_4", VertexBuffer.UV5Kind);
|
78
|
-
loadAttribute("TEXCOORD_5", VertexBuffer.UV6Kind);
|
79
|
-
loadAttribute("JOINTS_0", VertexBuffer.MatricesIndicesKind);
|
80
|
-
loadAttribute("WEIGHTS_0", VertexBuffer.MatricesWeightsKind);
|
81
|
-
loadAttribute("COLOR_0", VertexBuffer.ColorKind);
|
82
|
-
var bufferView = ArrayItem.Get(extensionContext, _this._loader.gltf.bufferViews, extension.bufferView);
|
83
|
-
if (!bufferView._dracoBabylonGeometry) {
|
84
|
-
bufferView._dracoBabylonGeometry = _this._loader.loadBufferViewAsync("/bufferViews/".concat(bufferView.index), bufferView).then(function (data) {
|
85
|
-
var dracoCompression = _this.dracoCompression || DracoCompression.Default;
|
86
|
-
return dracoCompression.decodeMeshAsync(data, attributes, dividers).then(function (babylonVertexData) {
|
87
|
-
var babylonGeometry = new Geometry(babylonMesh.name, _this._loader.babylonScene);
|
88
|
-
babylonVertexData.applyToGeometry(babylonGeometry);
|
89
|
-
return babylonGeometry;
|
90
|
-
}).catch(function (error) {
|
91
|
-
throw new Error("".concat(context, ": ").concat(error.message));
|
92
|
-
});
|
93
|
-
});
|
94
|
-
}
|
95
|
-
return bufferView._dracoBabylonGeometry;
|
96
|
-
});
|
97
|
-
};
|
98
|
-
return KHR_draco_mesh_compression;
|
99
|
-
}());
|
100
|
-
export { KHR_draco_mesh_compression };
|
101
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_draco_mesh_compression(loader); });
|
102
|
-
//# sourceMappingURL=KHR_draco_mesh_compression.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"KHR_draco_mesh_compression.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_draco_mesh_compression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAM3D,OAAO,EAAE,UAAU,EAA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C3B,CAAC,CAAC,CAAC,KAAK,CAAC,UAAC,KAAK;wBACX,MAAM,IAAI,KAAK,CAAC,UAAG,OAAO,eAAK,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC;oBACpD,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;aACN;YAED,OAAO,UAAU,CAAC,qBAAqB,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;IACL,iCAAC;AAAD,CAAC,AAnHD,IAmHC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAtC,CAAsC,CAAC,CAAC","sourcesContent":["import { DracoCompression } from \"@babylonjs/core/Meshes/Compression/dracoCompression\";\r\nimport { Nullable } from \"@babylonjs/core/types\";\r\nimport { VertexBuffer } from \"@babylonjs/core/Buffers/buffer\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\n\r\nimport { MeshPrimitiveMode, IKHRDracoMeshCompression, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport { IMeshPrimitive, IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\n\r\nconst NAME = \"KHR_draco_mesh_compression\";\r\n\r\ninterface IBufferViewDraco extends IBufferView {\r\n _dracoBabylonGeometry?: Promise<Geometry>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)\r\n */\r\nexport class KHR_draco_mesh_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 * The draco compression used to decode vertex data or DracoCompression.Default if not defined\r\n */\r\n public dracoCompression?: DracoCompression;\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 /** @hidden */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose(): void {\r\n delete this.dracoCompression;\r\n (this._loader as any) = null;\r\n }\r\n\r\n /** @hidden */\r\n public _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRDracoMeshCompression, Geometry>(context, primitive, this.name, (extensionContext, extension) => {\r\n if (primitive.mode != undefined) {\r\n if (primitive.mode !== MeshPrimitiveMode.TRIANGLE_STRIP &&\r\n primitive.mode !== MeshPrimitiveMode.TRIANGLES) {\r\n throw new Error(`${context}: Unsupported mode ${primitive.mode}`);\r\n }\r\n\r\n // TODO: handle triangle strips\r\n if (primitive.mode === MeshPrimitiveMode.TRIANGLE_STRIP) {\r\n throw new Error(`${context}: Mode ${primitive.mode} is not currently supported`);\r\n }\r\n }\r\n\r\n const attributes: {\r\n [kind: string]: number\r\n } = {};\r\n const dividers: {\r\n [kind: string]: number\r\n } = {};\r\n const loadAttribute = (name: string, kind: string) => {\r\n const uniqueId = extension.attributes[name];\r\n if (uniqueId === undefined || primitive.attributes[name] === undefined) {\r\n return;\r\n }\r\n\r\n attributes[kind] = uniqueId;\r\n const accessor = ArrayItem.Get(`${context}/attributes/${name}`, this._loader.gltf.accessors, primitive.attributes[name]);\r\n if (accessor.normalized && accessor.componentType !== AccessorComponentType.FLOAT) {\r\n let divider = 1;\r\n switch (accessor.componentType) {\r\n case AccessorComponentType.BYTE:\r\n divider = 127.0;\r\n break;\r\n case AccessorComponentType.UNSIGNED_BYTE:\r\n divider = 255.0;\r\n break;\r\n case AccessorComponentType.SHORT:\r\n divider = 32767.0;\r\n break;\r\n case AccessorComponentType.UNSIGNED_SHORT:\r\n divider = 65535.0;\r\n break;\r\n }\r\n dividers[kind] = divider;\r\n }\r\n\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n\r\n };\r\n\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\r\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\r\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\r\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind);\r\n\r\n var bufferView = ArrayItem.Get(extensionContext, this._loader.gltf.bufferViews, extension.bufferView) as IBufferViewDraco;\r\n if (!bufferView._dracoBabylonGeometry) {\r\n bufferView._dracoBabylonGeometry = this._loader.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n const dracoCompression = this.dracoCompression || DracoCompression.Default;\r\n return dracoCompression.decodeMeshAsync(data, attributes, dividers).then((babylonVertexData) => {\r\n const babylonGeometry = new Geometry(babylonMesh.name, this._loader.babylonScene);\r\n babylonVertexData.applyToGeometry(babylonGeometry);\r\n return babylonGeometry;\r\n }).catch((error) => {\r\n throw new Error(`${context}: ${error.message}`);\r\n });\r\n });\r\n }\r\n\r\n return bufferView._dracoBabylonGeometry;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_draco_mesh_compression(loader));"]}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
|
3
|
-
import { INode } from "../glTFLoaderInterfaces";
|
4
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
-
import { GLTFLoader } from "../glTFLoader";
|
6
|
-
/**
|
7
|
-
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)
|
8
|
-
*/
|
9
|
-
export declare class KHR_lights implements IGLTFLoaderExtension {
|
10
|
-
/**
|
11
|
-
* The name of this extension.
|
12
|
-
*/
|
13
|
-
readonly name = "KHR_lights_punctual";
|
14
|
-
/**
|
15
|
-
* Defines whether this extension is enabled.
|
16
|
-
*/
|
17
|
-
enabled: boolean;
|
18
|
-
private _loader;
|
19
|
-
private _lights?;
|
20
|
-
/** @hidden */
|
21
|
-
constructor(loader: GLTFLoader);
|
22
|
-
/** @hidden */
|
23
|
-
dispose(): void;
|
24
|
-
/** @hidden */
|
25
|
-
onLoading(): void;
|
26
|
-
/** @hidden */
|
27
|
-
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
28
|
-
}
|