@babylonjs/loaders 5.0.0-beta.1 → 5.0.0-beta.10
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/objFileLoader.js +2 -2
- package/OBJ/objFileLoader.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +8 -8
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +1 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +5 -4
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +2 -2
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.js +2 -2
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +27 -7
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +7 -7
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +5 -5
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +5 -5
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js +5 -5
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +2 -2
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +2 -2
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +3 -3
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.js +6 -6
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.js +2 -2
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +2 -2
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +13 -13
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +0 -1
- package/glTF/2.0/Extensions/MSFT_lod.js +17 -54
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/glTFLoader.d.ts +4 -2
- package/glTF/2.0/glTFLoader.js +289 -206
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +0 -3
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +11 -2
- package/glTF/glTFFileLoader.js +35 -29
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.js +1 -1
- package/glTF/glTFValidation.js.map +1 -1
- package/package.json +3 -3
@@ -1,5 +1,4 @@
|
|
1
1
|
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup";
|
2
|
-
import { Bone } from "@babylonjs/core/Bones/bone";
|
3
2
|
import { Skeleton } from "@babylonjs/core/Bones/skeleton";
|
4
3
|
import { Material } from "@babylonjs/core/Materials/material";
|
5
4
|
import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
|
@@ -145,8 +144,6 @@ export interface INode extends GLTF2.INode, IArrayItem {
|
|
145
144
|
/** @hidden */
|
146
145
|
_primitiveBabylonMeshes?: AbstractMesh[];
|
147
146
|
/** @hidden */
|
148
|
-
_babylonBones?: Bone[];
|
149
|
-
/** @hidden */
|
150
147
|
_numMorphTargets?: number;
|
151
148
|
}
|
152
149
|
/** @hidden */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFLoaderInterfaces.js","sourceRoot":"","sources":["../../../../sourceES6/loaders/src/glTF/2.0/glTFLoaderInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { AnimationGroup } from \"@babylonjs/core/Animations/animationGroup\";\r\nimport {
|
1
|
+
{"version":3,"file":"glTFLoaderInterfaces.js","sourceRoot":"","sources":["../../../../sourceES6/loaders/src/glTF/2.0/glTFLoaderInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { AnimationGroup } from \"@babylonjs/core/Animations/animationGroup\";\r\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { Buffer, VertexBuffer } from \"@babylonjs/core/Buffers/buffer\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\n\r\nimport * as GLTF2 from \"babylonjs-gltf2interface\";\r\n\r\n/**\r\n * Loader interface with an index field.\r\n */\r\nexport interface IArrayItem {\r\n /**\r\n * The index of this item in the array.\r\n */\r\n index: number;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IAccessor extends GLTF2.IAccessor, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<ArrayBufferView>;\r\n\r\n /** @hidden */\r\n _babylonVertexBuffer?: { [kind: string]: Promise<VertexBuffer>; };\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IAnimationChannel extends GLTF2.IAnimationChannel, IArrayItem {\r\n}\r\n\r\n/** @hidden */\r\nexport interface _IAnimationSamplerData {\r\n input: Float32Array;\r\n interpolation: GLTF2.AnimationSamplerInterpolation;\r\n output: Float32Array;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IAnimationSampler extends GLTF2.IAnimationSampler, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<_IAnimationSamplerData>;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IAnimation extends GLTF2.IAnimation, IArrayItem {\r\n channels: IAnimationChannel[];\r\n samplers: IAnimationSampler[];\r\n\r\n /** @hidden */\r\n _babylonAnimationGroup?: AnimationGroup;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IBuffer extends GLTF2.IBuffer, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IBufferView extends GLTF2.IBufferView, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<ArrayBufferView>;\r\n\r\n /** @hidden */\r\n _babylonBuffer?: Promise<Buffer>;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ICamera extends GLTF2.ICamera, IArrayItem {\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IImage extends GLTF2.IImage, IArrayItem {\r\n /** @hidden */\r\n _data?: Promise<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMaterialNormalTextureInfo extends GLTF2.IMaterialNormalTextureInfo, ITextureInfo {\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMaterialOcclusionTextureInfo extends GLTF2.IMaterialOcclusionTextureInfo, ITextureInfo {\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMaterialPbrMetallicRoughness extends GLTF2.IMaterialPbrMetallicRoughness {\r\n baseColorTexture?: ITextureInfo;\r\n metallicRoughnessTexture?: ITextureInfo;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMaterial extends GLTF2.IMaterial, IArrayItem {\r\n pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;\r\n normalTexture?: IMaterialNormalTextureInfo;\r\n occlusionTexture?: IMaterialOcclusionTextureInfo;\r\n emissiveTexture?: ITextureInfo;\r\n\r\n /** @hidden */\r\n _data?: {\r\n [babylonDrawMode: number]: {\r\n babylonMaterial: Material;\r\n babylonMeshes: AbstractMesh[];\r\n promise: Promise<void>;\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMesh extends GLTF2.IMesh, IArrayItem {\r\n primitives: IMeshPrimitive[];\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IMeshPrimitive extends GLTF2.IMeshPrimitive, IArrayItem {\r\n /** @hidden */\r\n _instanceData?: {\r\n babylonSourceMesh: Mesh;\r\n promise: Promise<any>;\r\n };\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface INode extends GLTF2.INode, IArrayItem {\r\n /**\r\n * The parent glTF node.\r\n */\r\n parent?: INode;\r\n\r\n /** @hidden */\r\n _babylonTransformNode?: TransformNode;\r\n\r\n /** @hidden */\r\n _primitiveBabylonMeshes?: AbstractMesh[];\r\n\r\n /** @hidden */\r\n _numMorphTargets?: number;\r\n}\r\n\r\n/** @hidden */\r\nexport interface _ISamplerData {\r\n noMipMaps: boolean;\r\n samplingMode: number;\r\n wrapU: number;\r\n wrapV: number;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ISampler extends GLTF2.ISampler, IArrayItem {\r\n /** @hidden */\r\n _data?: _ISamplerData;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IScene extends GLTF2.IScene, IArrayItem {\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ISkin extends GLTF2.ISkin, IArrayItem {\r\n /** @hidden */\r\n _data?: {\r\n babylonSkeleton: Skeleton;\r\n promise: Promise<void>;\r\n };\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ITexture extends GLTF2.ITexture, IArrayItem {\r\n /** @hidden */\r\n _textureInfo: ITextureInfo;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface ITextureInfo extends GLTF2.ITextureInfo {\r\n /** false or undefined if the texture holds color data (true if data are roughness, normal, ...) */\r\n nonColorData?: boolean;\r\n}\r\n\r\n/**\r\n * Loader interface with additional members.\r\n */\r\nexport interface IGLTF extends GLTF2.IGLTF {\r\n accessors?: IAccessor[];\r\n animations?: IAnimation[];\r\n buffers?: IBuffer[];\r\n bufferViews?: IBufferView[];\r\n cameras?: ICamera[];\r\n images?: IImage[];\r\n materials?: IMaterial[];\r\n meshes?: IMesh[];\r\n nodes?: INode[];\r\n samplers?: ISampler[];\r\n scenes?: IScene[];\r\n skins?: ISkin[];\r\n textures?: ITexture[];\r\n}\r\n"]}
|
package/glTF/glTFFileLoader.d.ts
CHANGED
@@ -10,8 +10,8 @@ import { AssetContainer } from "@babylonjs/core/assetContainer";
|
|
10
10
|
import { Scene, IDisposable } from "@babylonjs/core/scene";
|
11
11
|
import { WebRequest } from "@babylonjs/core/Misc/webRequest";
|
12
12
|
import { IFileRequest } from "@babylonjs/core/Misc/fileRequest";
|
13
|
-
import { IDataBuffer } from
|
14
|
-
import { LoadFileError } from
|
13
|
+
import { IDataBuffer } from "@babylonjs/core/Misc/dataReader";
|
14
|
+
import { LoadFileError } from "@babylonjs/core/Misc/fileTools";
|
15
15
|
/**
|
16
16
|
* Mode that determines the coordinate system to use.
|
17
17
|
*/
|
@@ -173,6 +173,15 @@ export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAs
|
|
173
173
|
* If true, load the color (gamma encoded) textures into sRGB buffers (if supported by the GPU), which will yield more accurate results when sampling the texture. Defaults to true.
|
174
174
|
*/
|
175
175
|
useSRGBBuffers: boolean;
|
176
|
+
/**
|
177
|
+
* When loading glTF animations, which are defined in seconds, target them to this FPS. Defaults to 60.
|
178
|
+
*/
|
179
|
+
targetFps: number;
|
180
|
+
/**
|
181
|
+
* Defines if the loader should always compute the nearest common ancestor of the skeleton joints instead of using `skin.skeleton`. Defaults to false.
|
182
|
+
* Set this to true if loading assets with invalid `skin.skeleton` values.
|
183
|
+
*/
|
184
|
+
alwaysComputeSkeletonRootNode: boolean;
|
176
185
|
/**
|
177
186
|
* Function called before loading a url referenced by the asset.
|
178
187
|
*/
|
package/glTF/glTFFileLoader.js
CHANGED
@@ -2,11 +2,12 @@ import { Observable } from "@babylonjs/core/Misc/observable.js";
|
|
2
2
|
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
3
3
|
import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader.js";
|
4
4
|
import { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
5
|
-
import { Logger } from
|
6
|
-
import { DataReader } from
|
7
|
-
import { GLTFValidation } from
|
8
|
-
import { DecodeBase64UrlToBinary } from
|
9
|
-
import { StringTools } from
|
5
|
+
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
6
|
+
import { DataReader } from "@babylonjs/core/Misc/dataReader.js";
|
7
|
+
import { GLTFValidation } from "./glTFValidation.js";
|
8
|
+
import { DecodeBase64UrlToBinary } from "@babylonjs/core/Misc/fileTools.js";
|
9
|
+
import { StringTools } from "@babylonjs/core/Misc/stringTools.js";
|
10
|
+
import { RuntimeError, ErrorCodes } from "@babylonjs/core/Misc/error.js";
|
10
11
|
function readAsync(arrayBuffer, byteOffset, byteLength) {
|
11
12
|
try {
|
12
13
|
return Promise.resolve(new Uint8Array(arrayBuffer, byteOffset, byteLength));
|
@@ -128,6 +129,15 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
128
129
|
* If true, load the color (gamma encoded) textures into sRGB buffers (if supported by the GPU), which will yield more accurate results when sampling the texture. Defaults to true.
|
129
130
|
*/
|
130
131
|
this.useSRGBBuffers = true;
|
132
|
+
/**
|
133
|
+
* When loading glTF animations, which are defined in seconds, target them to this FPS. Defaults to 60.
|
134
|
+
*/
|
135
|
+
this.targetFps = 60;
|
136
|
+
/**
|
137
|
+
* Defines if the loader should always compute the nearest common ancestor of the skeleton joints instead of using `skin.skeleton`. Defaults to false.
|
138
|
+
* Set this to true if loading assets with invalid `skin.skeleton` values.
|
139
|
+
*/
|
140
|
+
this.alwaysComputeSkeletonRootNode = false;
|
131
141
|
/**
|
132
142
|
* Function called before loading a url referenced by the asset.
|
133
143
|
*/
|
@@ -409,6 +419,8 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
409
419
|
GLTFFileLoader.prototype.loadFile = function (scene, fileOrUrl, onSuccess, onProgress, useArrayBuffer, onError) {
|
410
420
|
var _this = this;
|
411
421
|
this._progressCallback = onProgress;
|
422
|
+
var rootUrl = fileOrUrl.name ? "file:" : Tools.GetFolderPath(fileOrUrl);
|
423
|
+
var fileName = fileOrUrl.name || Tools.GetFilename(fileOrUrl);
|
412
424
|
if (useArrayBuffer) {
|
413
425
|
if (this.useRangeRequests) {
|
414
426
|
if (this.validate) {
|
@@ -426,7 +438,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
426
438
|
}, true, function (error) {
|
427
439
|
reject(error);
|
428
440
|
}, function (webRequest) {
|
429
|
-
webRequest.setRequestHeader("Range", "bytes="
|
441
|
+
webRequest.setRequestHeader("Range", "bytes=".concat(byteOffset, "-").concat(byteOffset + byteLength - 1));
|
430
442
|
});
|
431
443
|
});
|
432
444
|
},
|
@@ -439,23 +451,17 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
439
451
|
return fileRequest_1;
|
440
452
|
}
|
441
453
|
return this._loadFile(scene, fileOrUrl, function (data) {
|
442
|
-
|
454
|
+
_this._validate(scene, data, rootUrl, fileName);
|
443
455
|
_this._unpackBinaryAsync(new DataReader({
|
444
|
-
readAsync: function (byteOffset, byteLength) { return readAsync(
|
445
|
-
byteLength:
|
456
|
+
readAsync: function (byteOffset, byteLength) { return readAsync(data, byteOffset, byteLength); },
|
457
|
+
byteLength: data.byteLength
|
446
458
|
})).then(function (loaderData) {
|
447
459
|
onSuccess(loaderData);
|
448
460
|
}, onError ? function (error) { return onError(undefined, error); } : undefined);
|
449
461
|
}, true, onError);
|
450
462
|
}
|
451
463
|
return this._loadFile(scene, fileOrUrl, function (data) {
|
452
|
-
|
453
|
-
_this._validate(scene, data, "file:", fileOrUrl.name);
|
454
|
-
}
|
455
|
-
else {
|
456
|
-
var url = fileOrUrl;
|
457
|
-
_this._validate(scene, data, Tools.GetFolderPath(url), Tools.GetFilename(url));
|
458
|
-
}
|
464
|
+
_this._validate(scene, data, rootUrl, fileName);
|
459
465
|
onSuccess({ json: _this._parseJson(data) });
|
460
466
|
}, useArrayBuffer, onError);
|
461
467
|
};
|
@@ -465,7 +471,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
465
471
|
return Promise.resolve().then(function () {
|
466
472
|
_this.onParsedObservable.notifyObservers(data);
|
467
473
|
_this.onParsedObservable.clear();
|
468
|
-
_this._log("Loading "
|
474
|
+
_this._log("Loading ".concat(fileName || ""));
|
469
475
|
_this._loader = _this._getLoader(data);
|
470
476
|
return _this._loader.importMeshAsync(meshesNames, scene, null, data, rootUrl, onProgress, fileName);
|
471
477
|
});
|
@@ -476,7 +482,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
476
482
|
return Promise.resolve().then(function () {
|
477
483
|
_this.onParsedObservable.notifyObservers(data);
|
478
484
|
_this.onParsedObservable.clear();
|
479
|
-
_this._log("Loading "
|
485
|
+
_this._log("Loading ".concat(fileName || ""));
|
480
486
|
_this._loader = _this._getLoader(data);
|
481
487
|
return _this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);
|
482
488
|
});
|
@@ -487,7 +493,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
487
493
|
return Promise.resolve().then(function () {
|
488
494
|
_this.onParsedObservable.notifyObservers(data);
|
489
495
|
_this.onParsedObservable.clear();
|
490
|
-
_this._log("Loading "
|
496
|
+
_this._log("Loading ".concat(fileName || ""));
|
491
497
|
_this._loader = _this._getLoader(data);
|
492
498
|
// Prepare the asset container.
|
493
499
|
var container = new AssetContainer(scene);
|
@@ -634,15 +640,15 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
634
640
|
_this.onValidatedObservable.clear();
|
635
641
|
}, function (reason) {
|
636
642
|
_this._endPerformanceCounter("Validate JSON");
|
637
|
-
Tools.Warn("Failed to validate: "
|
643
|
+
Tools.Warn("Failed to validate: ".concat(reason.message));
|
638
644
|
_this.onValidatedObservable.clear();
|
639
645
|
});
|
640
646
|
};
|
641
647
|
GLTFFileLoader.prototype._getLoader = function (loaderData) {
|
642
648
|
var asset = loaderData.json.asset || {};
|
643
|
-
this._log("Asset version: "
|
644
|
-
asset.minVersion && this._log("Asset minimum version: "
|
645
|
-
asset.generator && this._log("Asset generator: "
|
649
|
+
this._log("Asset version: ".concat(asset.version));
|
650
|
+
asset.minVersion && this._log("Asset minimum version: ".concat(asset.minVersion));
|
651
|
+
asset.generator && this._log("Asset generator: ".concat(asset.generator));
|
646
652
|
var version = GLTFFileLoader._parseVersion(asset.version);
|
647
653
|
if (!version) {
|
648
654
|
throw new Error("Invalid version: " + asset.version);
|
@@ -668,7 +674,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
668
674
|
};
|
669
675
|
GLTFFileLoader.prototype._parseJson = function (json) {
|
670
676
|
this._startPerformanceCounter("Parse JSON");
|
671
|
-
this._log("JSON length: "
|
677
|
+
this._log("JSON length: ".concat(json.length));
|
672
678
|
var parsed = JSON.parse(json);
|
673
679
|
this._endPerformanceCounter("Parse JSON");
|
674
680
|
return parsed;
|
@@ -683,15 +689,15 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
683
689
|
};
|
684
690
|
var magic = dataReader.readUint32();
|
685
691
|
if (magic !== Binary.Magic) {
|
686
|
-
throw new
|
692
|
+
throw new RuntimeError("Unexpected magic: " + magic, ErrorCodes.GLTFLoaderUnexpectedMagicError);
|
687
693
|
}
|
688
694
|
var version = dataReader.readUint32();
|
689
695
|
if (_this.loggingEnabled) {
|
690
|
-
_this._log("Binary version: "
|
696
|
+
_this._log("Binary version: ".concat(version));
|
691
697
|
}
|
692
698
|
var length = dataReader.readUint32();
|
693
699
|
if (dataReader.buffer.byteLength !== 0 && length !== dataReader.buffer.byteLength) {
|
694
|
-
throw new Error("Length in header does not match actual data length: "
|
700
|
+
throw new Error("Length in header does not match actual data length: ".concat(length, " != ").concat(dataReader.buffer.byteLength));
|
695
701
|
}
|
696
702
|
var unpacked;
|
697
703
|
switch (version) {
|
@@ -718,7 +724,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
718
724
|
var contentLength = dataReader.readUint32();
|
719
725
|
var contentFormat = dataReader.readUint32();
|
720
726
|
if (contentFormat !== ContentFormat.JSON) {
|
721
|
-
throw new Error("Unexpected content format: "
|
727
|
+
throw new Error("Unexpected content format: ".concat(contentFormat));
|
722
728
|
}
|
723
729
|
var bodyLength = length - dataReader.byteOffset;
|
724
730
|
var data = { json: this._parseJson(dataReader.readString(contentLength)), bin: null };
|
@@ -824,7 +830,7 @@ var GLTFFileLoader = /** @class */ (function () {
|
|
824
830
|
};
|
825
831
|
GLTFFileLoader.prototype._logEnabled = function (message) {
|
826
832
|
var spaces = GLTFFileLoader._logSpaces.substr(0, this._logIndentLevel * 2);
|
827
|
-
Logger.Log(""
|
833
|
+
Logger.Log("".concat(spaces).concat(message));
|
828
834
|
};
|
829
835
|
GLTFFileLoader.prototype._logDisabled = function (message) {
|
830
836
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFFileLoader.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/glTF/glTFFileLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAY,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAKnD,OAAO,EAAE,WAAW,EAA4J,MAAM,qCAAqC,CAAC;AAC5N,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIhE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAe,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAiB,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAQ/D,SAAS,SAAS,CAAC,WAAwB,EAAE,UAAkB,EAAE,UAAkB;IAC/E,IAAI;QACA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;KAC/E;IACD,OAAO,CAAC,EAAE;QACN,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC5B;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,8BAUX;AAVD,WAAY,8BAA8B;IACtC;;OAEG;IACH,mFAAI,CAAA;IAEJ;;OAEG;IACH,+GAAkB,CAAA;AACtB,CAAC,EAVW,8BAA8B,KAA9B,8BAA8B,QAUzC;AAED;;GAEG;AACH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I,CAAC;IAExC;;;;OAIG;IACW,qCAAsB,GAAG,KAAK,CAAC;IA8R9B,iCAAkB,GAAG,QAAQ,CAAC,CAAC,8CAA8C;IA+fpE,yBAAU,GAAG,kCAAkC,CAAC;IA+C5E,qBAAC;CAAA,AAz3BD,IAy3BC;SAz3BY,cAAc;AA23B3B,IAAI,WAAW,EAAE;IACb,WAAW,CAAC,cAAc,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;CACpD","sourcesContent":["import * as GLTF2 from \"babylonjs-gltf2interface\";\r\nimport { Nullable } from \"@babylonjs/core/types\";\r\nimport { Observable, Observer } from \"@babylonjs/core/Misc/observable\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\r\nimport { BaseTexture } from \"@babylonjs/core/Materials/Textures/baseTexture\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { SceneLoader, ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginExtensions, ISceneLoaderAsyncResult } from \"@babylonjs/core/Loading/sceneLoader\";\r\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\r\nimport { Scene, IDisposable } from \"@babylonjs/core/scene\";\r\nimport { WebRequest } from \"@babylonjs/core/Misc/webRequest\";\r\nimport { IFileRequest } from \"@babylonjs/core/Misc/fileRequest\";\r\nimport { Logger } from '@babylonjs/core/Misc/logger';\r\nimport { DataReader, IDataBuffer } from '@babylonjs/core/Misc/dataReader';\r\nimport { GLTFValidation } from './glTFValidation';\r\nimport { DecodeBase64UrlToBinary, LoadFileError } from '@babylonjs/core/Misc/fileTools';\r\nimport { StringTools } from '@babylonjs/core/Misc/stringTools';\r\n\r\ninterface IFileRequestInfo extends IFileRequest {\r\n _lengthComputable?: boolean;\r\n _loaded?: number;\r\n _total?: number;\r\n}\r\n\r\nfunction readAsync(arrayBuffer: ArrayBuffer, byteOffset: number, byteLength: number): Promise<Uint8Array> {\r\n try {\r\n return Promise.resolve(new Uint8Array(arrayBuffer, byteOffset, byteLength));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n}\r\n\r\n/**\r\n * Mode that determines the coordinate system to use.\r\n */\r\nexport enum GLTFLoaderCoordinateSystemMode {\r\n /**\r\n * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.\r\n */\r\n AUTO,\r\n\r\n /**\r\n * Sets the useRightHandedSystem flag on the scene.\r\n */\r\n FORCE_RIGHT_HANDED,\r\n}\r\n\r\n/**\r\n * Mode that determines what animations will start.\r\n */\r\nexport enum GLTFLoaderAnimationStartMode {\r\n /**\r\n * No animation will start.\r\n */\r\n NONE,\r\n\r\n /**\r\n * The first animation will start.\r\n */\r\n FIRST,\r\n\r\n /**\r\n * All animations will start.\r\n */\r\n ALL,\r\n}\r\n\r\n/**\r\n * Interface that contains the data for the glTF asset.\r\n */\r\nexport interface IGLTFLoaderData {\r\n /**\r\n * The object that represents the glTF JSON.\r\n */\r\n json: Object;\r\n\r\n /**\r\n * The BIN chunk of a binary glTF.\r\n */\r\n bin: Nullable<IDataBuffer>;\r\n}\r\n\r\n/**\r\n * Interface for extending the loader.\r\n */\r\nexport interface IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n enabled: boolean;\r\n\r\n /**\r\n * Defines the order of this extension.\r\n * The loader sorts the extensions using these values when loading.\r\n */\r\n order?: number;\r\n}\r\n\r\n/**\r\n * Loader state.\r\n */\r\nexport enum GLTFLoaderState {\r\n /**\r\n * The asset is loading.\r\n */\r\n LOADING,\r\n\r\n /**\r\n * The asset is ready for rendering.\r\n */\r\n READY,\r\n\r\n /**\r\n * The asset is completely loaded.\r\n */\r\n COMPLETE\r\n}\r\n\r\n/** @hidden */\r\nexport interface IGLTFLoader extends IDisposable {\r\n importMeshAsync: (meshesNames: any, scene: Scene, container: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<ISceneLoaderAsyncResult>;\r\n loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;\r\n}\r\n\r\n/**\r\n * File loader for loading glTF files into a scene.\r\n */\r\nexport class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\r\n /** @hidden */\r\n public static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;\r\n\r\n /** @hidden */\r\n public static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;\r\n\r\n // --------------\r\n // Common options\r\n // --------------\r\n\r\n /**\r\n * Raised when the asset has been parsed\r\n */\r\n public onParsedObservable = new Observable<IGLTFLoaderData>();\r\n\r\n private _onParsedObserver: Nullable<Observer<IGLTFLoaderData>>;\r\n\r\n /**\r\n * Raised when the asset has been parsed\r\n */\r\n public set onParsed(callback: (loaderData: IGLTFLoaderData) => void) {\r\n if (this._onParsedObserver) {\r\n this.onParsedObservable.remove(this._onParsedObserver);\r\n }\r\n this._onParsedObserver = this.onParsedObservable.add(callback);\r\n }\r\n\r\n // ----------\r\n // V1 options\r\n // ----------\r\n\r\n /**\r\n * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.\r\n * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.\r\n * Defaults to true.\r\n * @hidden\r\n */\r\n public static IncrementalLoading = true;\r\n\r\n /**\r\n * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.\r\n * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.\r\n * @hidden\r\n */\r\n public static HomogeneousCoordinates = false;\r\n\r\n // ----------\r\n // V2 options\r\n // ----------\r\n\r\n /**\r\n * The coordinate system mode. Defaults to AUTO.\r\n */\r\n public coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;\r\n\r\n /**\r\n * The animation start mode. Defaults to FIRST.\r\n */\r\n public animationStartMode = GLTFLoaderAnimationStartMode.FIRST;\r\n\r\n /**\r\n * Defines if the loader should compile materials before raising the success callback. Defaults to false.\r\n */\r\n public compileMaterials = false;\r\n\r\n /**\r\n * Defines if the loader should also compile materials with clip planes. Defaults to false.\r\n */\r\n public useClipPlane = false;\r\n\r\n /**\r\n * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.\r\n */\r\n public compileShadowGenerators = false;\r\n\r\n /**\r\n * Defines if the Alpha blended materials are only applied as coverage.\r\n * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.\r\n * If true, no extra effects are applied to transparent pixels.\r\n */\r\n public transparencyAsCoverage = false;\r\n\r\n /**\r\n * Defines if the loader should use range requests when load binary glTF files from HTTP.\r\n * Enabling will disable offline support and glTF validator.\r\n * Defaults to false.\r\n */\r\n public useRangeRequests = false;\r\n\r\n /**\r\n * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.\r\n */\r\n public createInstances = true;\r\n\r\n /**\r\n * Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.\r\n */\r\n public alwaysComputeBoundingBox = false;\r\n\r\n /**\r\n * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.\r\n */\r\n public loadAllMaterials = false;\r\n\r\n /**\r\n * If true, load the color (gamma encoded) textures into sRGB buffers (if supported by the GPU), which will yield more accurate results when sampling the texture. Defaults to true.\r\n */\r\n public useSRGBBuffers = true;\r\n\r\n /**\r\n * Function called before loading a url referenced by the asset.\r\n */\r\n public preprocessUrlAsync = (url: string) => Promise.resolve(url);\r\n\r\n /**\r\n * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.\r\n * Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\r\n */\r\n public readonly onMeshLoadedObservable = new Observable<AbstractMesh>();\r\n\r\n private _onMeshLoadedObserver: Nullable<Observer<AbstractMesh>>;\r\n\r\n /**\r\n * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.\r\n * Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\r\n */\r\n public set onMeshLoaded(callback: (mesh: AbstractMesh) => void) {\r\n if (this._onMeshLoadedObserver) {\r\n this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver);\r\n }\r\n this._onMeshLoadedObserver = this.onMeshLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.\r\n */\r\n public readonly onTextureLoadedObservable = new Observable<BaseTexture>();\r\n\r\n private _onTextureLoadedObserver: Nullable<Observer<BaseTexture>>;\r\n\r\n /**\r\n * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.\r\n */\r\n public set onTextureLoaded(callback: (texture: BaseTexture) => void) {\r\n if (this._onTextureLoadedObserver) {\r\n this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver);\r\n }\r\n this._onTextureLoadedObserver = this.onTextureLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when the loader creates a material after parsing the glTF properties of the material.\r\n */\r\n public readonly onMaterialLoadedObservable = new Observable<Material>();\r\n\r\n private _onMaterialLoadedObserver: Nullable<Observer<Material>>;\r\n\r\n /**\r\n * Callback raised when the loader creates a material after parsing the glTF properties of the material.\r\n */\r\n public set onMaterialLoaded(callback: (material: Material) => void) {\r\n if (this._onMaterialLoadedObserver) {\r\n this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver);\r\n }\r\n this._onMaterialLoadedObserver = this.onMaterialLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.\r\n */\r\n public readonly onCameraLoadedObservable = new Observable<Camera>();\r\n\r\n private _onCameraLoadedObserver: Nullable<Observer<Camera>>;\r\n\r\n /**\r\n * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.\r\n */\r\n public set onCameraLoaded(callback: (camera: Camera) => void) {\r\n if (this._onCameraLoadedObserver) {\r\n this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver);\r\n }\r\n this._onCameraLoadedObserver = this.onCameraLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when the asset is completely loaded, immediately before the loader is disposed.\r\n * For assets with LODs, raised when all of the LODs are complete.\r\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\r\n */\r\n public readonly onCompleteObservable = new Observable<void>();\r\n\r\n private _onCompleteObserver: Nullable<Observer<void>>;\r\n\r\n /**\r\n * Callback raised when the asset is completely loaded, immediately before the loader is disposed.\r\n * For assets with LODs, raised when all of the LODs are complete.\r\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\r\n */\r\n public set onComplete(callback: () => void) {\r\n if (this._onCompleteObserver) {\r\n this.onCompleteObservable.remove(this._onCompleteObserver);\r\n }\r\n this._onCompleteObserver = this.onCompleteObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when an error occurs.\r\n */\r\n public readonly onErrorObservable = new Observable<any>();\r\n\r\n private _onErrorObserver: Nullable<Observer<any>>;\r\n\r\n /**\r\n * Callback raised when an error occurs.\r\n */\r\n public set onError(callback: (reason: any) => void) {\r\n if (this._onErrorObserver) {\r\n this.onErrorObservable.remove(this._onErrorObserver);\r\n }\r\n this._onErrorObserver = this.onErrorObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised after the loader is disposed.\r\n */\r\n public readonly onDisposeObservable = new Observable<void>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<void>>;\r\n\r\n /**\r\n * Callback raised after the loader is disposed.\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised after a loader extension is created.\r\n * Set additional options for a loader extension in this event.\r\n */\r\n public readonly onExtensionLoadedObservable = new Observable<IGLTFLoaderExtension>();\r\n\r\n private _onExtensionLoadedObserver: Nullable<Observer<IGLTFLoaderExtension>>;\r\n\r\n /**\r\n * Callback raised after a loader extension is created.\r\n */\r\n public set onExtensionLoaded(callback: (extension: IGLTFLoaderExtension) => void) {\r\n if (this._onExtensionLoadedObserver) {\r\n this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver);\r\n }\r\n this._onExtensionLoadedObserver = this.onExtensionLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Defines if the loader logging is enabled.\r\n */\r\n public get loggingEnabled(): boolean {\r\n return this._loggingEnabled;\r\n }\r\n\r\n public set loggingEnabled(value: boolean) {\r\n if (this._loggingEnabled === value) {\r\n return;\r\n }\r\n\r\n this._loggingEnabled = value;\r\n\r\n if (this._loggingEnabled) {\r\n this._log = this._logEnabled;\r\n }\r\n else {\r\n this._log = this._logDisabled;\r\n }\r\n }\r\n\r\n /**\r\n * Defines if the loader should capture performance counters.\r\n */\r\n public get capturePerformanceCounters(): boolean {\r\n return this._capturePerformanceCounters;\r\n }\r\n\r\n public set capturePerformanceCounters(value: boolean) {\r\n if (this._capturePerformanceCounters === value) {\r\n return;\r\n }\r\n\r\n this._capturePerformanceCounters = value;\r\n\r\n if (this._capturePerformanceCounters) {\r\n this._startPerformanceCounter = this._startPerformanceCounterEnabled;\r\n this._endPerformanceCounter = this._endPerformanceCounterEnabled;\r\n }\r\n else {\r\n this._startPerformanceCounter = this._startPerformanceCounterDisabled;\r\n this._endPerformanceCounter = this._endPerformanceCounterDisabled;\r\n }\r\n }\r\n\r\n /**\r\n * Defines if the loader should validate the asset.\r\n */\r\n public validate = false;\r\n\r\n /**\r\n * Observable raised after validation when validate is set to true. The event data is the result of the validation.\r\n */\r\n public readonly onValidatedObservable = new Observable<GLTF2.IGLTFValidationResults>();\r\n\r\n private _onValidatedObserver: Nullable<Observer<GLTF2.IGLTFValidationResults>>;\r\n\r\n /**\r\n * Callback raised after a loader extension is created.\r\n */\r\n public set onValidated(callback: (results: GLTF2.IGLTFValidationResults) => void) {\r\n if (this._onValidatedObserver) {\r\n this.onValidatedObservable.remove(this._onValidatedObserver);\r\n }\r\n this._onValidatedObserver = this.onValidatedObservable.add(callback);\r\n }\r\n\r\n private _loader: Nullable<IGLTFLoader> = null;\r\n private _state: Nullable<GLTFLoaderState> = null;\r\n private _progressCallback?: (event: ISceneLoaderProgressEvent) => void;\r\n private _requests = new Array<IFileRequestInfo>();\r\n\r\n private static magicBase64Encoded = \"Z2xURg\"; // \"glTF\" base64 encoded (without the quotes!)\r\n\r\n /**\r\n * Name of the loader (\"gltf\")\r\n */\r\n public name = \"gltf\";\r\n\r\n /** @hidden */\r\n public extensions: ISceneLoaderPluginExtensions = {\r\n \".gltf\": { isBinary: false },\r\n \".glb\": { isBinary: true }\r\n };\r\n\r\n /**\r\n * Disposes the loader, releases resources during load, and cancels any outstanding requests.\r\n */\r\n public dispose(): void {\r\n if (this._loader) {\r\n this._loader.dispose();\r\n this._loader = null;\r\n }\r\n\r\n for (const request of this._requests) {\r\n request.abort();\r\n }\r\n\r\n this._requests.length = 0;\r\n\r\n delete this._progressCallback;\r\n\r\n this.preprocessUrlAsync = (url) => Promise.resolve(url);\r\n\r\n this.onMeshLoadedObservable.clear();\r\n this.onTextureLoadedObservable.clear();\r\n this.onMaterialLoadedObservable.clear();\r\n this.onCameraLoadedObservable.clear();\r\n this.onCompleteObservable.clear();\r\n this.onExtensionLoadedObservable.clear();\r\n\r\n this.onDisposeObservable.notifyObservers(undefined);\r\n this.onDisposeObservable.clear();\r\n }\r\n\r\n /** @hidden */\r\n public loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: any, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void): IFileRequest {\r\n this._progressCallback = onProgress;\r\n\r\n if (useArrayBuffer) {\r\n if (this.useRangeRequests) {\r\n if (this.validate) {\r\n Logger.Warn(\"glTF validation is not supported when range requests are enabled\");\r\n }\r\n\r\n const fileRequest: IFileRequest = {\r\n abort: () => { },\r\n onCompleteObservable: new Observable<IFileRequest>()\r\n };\r\n\r\n const dataBuffer = {\r\n readAsync: (byteOffset: number, byteLength: number) => {\r\n return new Promise<ArrayBufferView>((resolve, reject) => {\r\n this._loadFile(scene, fileOrUrl, (data) => {\r\n resolve(new Uint8Array(data as ArrayBuffer));\r\n }, true, (error) => {\r\n reject(error);\r\n }, (webRequest) => {\r\n webRequest.setRequestHeader(\"Range\", `bytes=${byteOffset}-${byteOffset + byteLength - 1}`);\r\n });\r\n });\r\n },\r\n byteLength: 0\r\n };\r\n\r\n this._unpackBinaryAsync(new DataReader(dataBuffer)).then((loaderData) => {\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n onSuccess(loaderData);\r\n }, onError ? (error) => onError(undefined, error) : undefined);\r\n\r\n return fileRequest;\r\n }\r\n\r\n return this._loadFile(scene, fileOrUrl, (data) => {\r\n const arrayBuffer = data as ArrayBuffer;\r\n this._unpackBinaryAsync(new DataReader({\r\n readAsync: (byteOffset, byteLength) => readAsync(arrayBuffer, byteOffset, byteLength),\r\n byteLength: arrayBuffer.byteLength\r\n })).then((loaderData) => {\r\n onSuccess(loaderData);\r\n }, onError ? (error) => onError(undefined, error) : undefined);\r\n }, true, onError);\r\n }\r\n\r\n return this._loadFile(scene, fileOrUrl, (data) => {\r\n if ((fileOrUrl as File).name) {\r\n this._validate(scene, data, \"file:\", (fileOrUrl as File).name);\r\n }\r\n else {\r\n const url = fileOrUrl as string;\r\n this._validate(scene, data, Tools.GetFolderPath(url), Tools.GetFilename(url));\r\n }\r\n onSuccess({ json: this._parseJson(data as string) });\r\n }, useArrayBuffer, onError);\r\n }\r\n\r\n /** @hidden */\r\n public importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult> {\r\n return Promise.resolve().then(() => {\r\n this.onParsedObservable.notifyObservers(data);\r\n this.onParsedObservable.clear();\r\n\r\n this._log(`Loading ${fileName || \"\"}`);\r\n this._loader = this._getLoader(data);\r\n return this._loader.importMeshAsync(meshesNames, scene, null, data, rootUrl, onProgress, fileName);\r\n });\r\n }\r\n\r\n /** @hidden */\r\n public loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\r\n return Promise.resolve().then(() => {\r\n this.onParsedObservable.notifyObservers(data);\r\n this.onParsedObservable.clear();\r\n\r\n this._log(`Loading ${fileName || \"\"}`);\r\n this._loader = this._getLoader(data);\r\n return this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);\r\n });\r\n }\r\n\r\n /** @hidden */\r\n public loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer> {\r\n return Promise.resolve().then(() => {\r\n this.onParsedObservable.notifyObservers(data);\r\n this.onParsedObservable.clear();\r\n\r\n this._log(`Loading ${fileName || \"\"}`);\r\n this._loader = this._getLoader(data);\r\n\r\n // Prepare the asset container.\r\n const container = new AssetContainer(scene);\r\n\r\n // Get materials/textures when loading to add to container\r\n const materials: Array<Material> = [];\r\n this.onMaterialLoadedObservable.add((material) => {\r\n materials.push(material);\r\n });\r\n const textures: Array<BaseTexture> = [];\r\n this.onTextureLoadedObservable.add((texture) => {\r\n textures.push(texture);\r\n });\r\n const cameras: Array<Camera> = [];\r\n this.onCameraLoadedObservable.add((camera) => {\r\n cameras.push(camera);\r\n });\r\n\r\n return this._loader.importMeshAsync(null, scene, container, data, rootUrl, onProgress, fileName).then((result) => {\r\n Array.prototype.push.apply(container.geometries, result.geometries);\r\n Array.prototype.push.apply(container.meshes, result.meshes);\r\n Array.prototype.push.apply(container.particleSystems, result.particleSystems);\r\n Array.prototype.push.apply(container.skeletons, result.skeletons);\r\n Array.prototype.push.apply(container.animationGroups, result.animationGroups);\r\n Array.prototype.push.apply(container.materials, materials);\r\n Array.prototype.push.apply(container.textures, textures);\r\n Array.prototype.push.apply(container.lights, result.lights);\r\n Array.prototype.push.apply(container.transformNodes, result.transformNodes);\r\n Array.prototype.push.apply(container.cameras, cameras);\r\n return container;\r\n });\r\n });\r\n }\r\n\r\n /** @hidden */\r\n public canDirectLoad(data: string): boolean {\r\n return (data.indexOf(\"asset\") !== -1 && data.indexOf(\"version\") !== -1)\r\n || StringTools.StartsWith(data, \"data:base64,\" + GLTFFileLoader.magicBase64Encoded) // this is technically incorrect, but will continue to support for backcompat.\r\n || StringTools.StartsWith(data, \"data:;base64,\" + GLTFFileLoader.magicBase64Encoded)\r\n || StringTools.StartsWith(data, \"data:application/octet-stream;base64,\" + GLTFFileLoader.magicBase64Encoded)\r\n || StringTools.StartsWith(data, \"data:model/gltf-binary;base64,\" + GLTFFileLoader.magicBase64Encoded);\r\n }\r\n\r\n /** @hidden */\r\n public directLoad(scene: Scene, data: string): Promise<any> {\r\n if (StringTools.StartsWith(data, \"base64,\" + GLTFFileLoader.magicBase64Encoded) || // this is technically incorrect, but will continue to support for backcompat.\r\n StringTools.StartsWith(data, \";base64,\" + GLTFFileLoader.magicBase64Encoded) ||\r\n StringTools.StartsWith(data, \"application/octet-stream;base64,\" + GLTFFileLoader.magicBase64Encoded) ||\r\n StringTools.StartsWith(data, \"model/gltf-binary;base64,\" + GLTFFileLoader.magicBase64Encoded)) {\r\n const arrayBuffer = DecodeBase64UrlToBinary(data);\r\n\r\n this._validate(scene, arrayBuffer);\r\n return this._unpackBinaryAsync(new DataReader({\r\n readAsync: (byteOffset, byteLength) => readAsync(arrayBuffer, byteOffset, byteLength),\r\n byteLength: arrayBuffer.byteLength\r\n }));\r\n }\r\n\r\n this._validate(scene, data);\r\n return Promise.resolve({ json: this._parseJson(data) });\r\n }\r\n\r\n /**\r\n * The callback that allows custom handling of the root url based on the response url.\r\n * @param rootUrl the original root url\r\n * @param responseURL the response url if available\r\n * @returns the new root url\r\n */\r\n public rewriteRootURL?(rootUrl: string, responseURL?: string): string;\r\n\r\n /** @hidden */\r\n public createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync {\r\n return new GLTFFileLoader();\r\n }\r\n\r\n /**\r\n * The loader state or null if the loader is not active.\r\n */\r\n public get loaderState(): Nullable<GLTFLoaderState> {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * Observable raised when the loader state changes.\r\n */\r\n public onLoaderStateChangedObservable = new Observable<Nullable<GLTFLoaderState>>();\r\n\r\n /**\r\n * Returns a promise that resolves when the asset is completely loaded.\r\n * @returns a promise that resolves when the asset is completely loaded.\r\n */\r\n public whenCompleteAsync(): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n this.onCompleteObservable.addOnce(() => {\r\n resolve();\r\n });\r\n this.onErrorObservable.addOnce((reason) => {\r\n reject(reason);\r\n });\r\n });\r\n }\r\n\r\n /** @hidden */\r\n public _setState(state: GLTFLoaderState): void {\r\n if (this._state === state) {\r\n return;\r\n }\r\n\r\n this._state = state;\r\n this.onLoaderStateChangedObservable.notifyObservers(this._state);\r\n this._log(GLTFLoaderState[this._state]);\r\n }\r\n\r\n /** @hidden */\r\n public _loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: string | ArrayBuffer) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest) => void, onOpened?: (request: WebRequest) => void): IFileRequest {\r\n const request = scene._loadFile(fileOrUrl, onSuccess, (event) => {\r\n this._onProgress(event, request);\r\n }, true, useArrayBuffer, onError, onOpened) as IFileRequestInfo;\r\n request.onCompleteObservable.add((request) => {\r\n this._requests.splice(this._requests.indexOf(request), 1);\r\n });\r\n this._requests.push(request);\r\n return request;\r\n }\r\n\r\n private _onProgress(event: ProgressEvent, request: IFileRequestInfo): void {\r\n if (!this._progressCallback) {\r\n return;\r\n }\r\n\r\n request._lengthComputable = event.lengthComputable;\r\n request._loaded = event.loaded;\r\n request._total = event.total;\r\n\r\n let lengthComputable = true;\r\n let loaded = 0;\r\n let total = 0;\r\n for (let request of this._requests) {\r\n if (request._lengthComputable === undefined || request._loaded === undefined || request._total === undefined) {\r\n return;\r\n }\r\n\r\n lengthComputable = lengthComputable && request._lengthComputable;\r\n loaded += request._loaded;\r\n total += request._total;\r\n }\r\n\r\n this._progressCallback({\r\n lengthComputable: lengthComputable,\r\n loaded: loaded,\r\n total: lengthComputable ? total : 0\r\n });\r\n }\r\n\r\n private _validate(scene: Scene, data: string | ArrayBuffer, rootUrl = \"\", fileName = \"\"): void {\r\n if (!this.validate) {\r\n return;\r\n }\r\n\r\n this._startPerformanceCounter(\"Validate JSON\");\r\n GLTFValidation.ValidateAsync(data, rootUrl, fileName, (uri) => {\r\n return this.preprocessUrlAsync(rootUrl + uri).then((url) => (scene._loadFileAsync(url, undefined, true, true) as Promise<ArrayBuffer>));\r\n }).then((result) => {\r\n this._endPerformanceCounter(\"Validate JSON\");\r\n this.onValidatedObservable.notifyObservers(result);\r\n this.onValidatedObservable.clear();\r\n }, (reason) => {\r\n this._endPerformanceCounter(\"Validate JSON\");\r\n Tools.Warn(`Failed to validate: ${reason.message}`);\r\n this.onValidatedObservable.clear();\r\n });\r\n }\r\n\r\n private _getLoader(loaderData: IGLTFLoaderData): IGLTFLoader {\r\n const asset = (<any>loaderData.json).asset || {};\r\n\r\n this._log(`Asset version: ${asset.version}`);\r\n asset.minVersion && this._log(`Asset minimum version: ${asset.minVersion}`);\r\n asset.generator && this._log(`Asset generator: ${asset.generator}`);\r\n\r\n const version = GLTFFileLoader._parseVersion(asset.version);\r\n if (!version) {\r\n throw new Error(\"Invalid version: \" + asset.version);\r\n }\r\n\r\n if (asset.minVersion !== undefined) {\r\n const minVersion = GLTFFileLoader._parseVersion(asset.minVersion);\r\n if (!minVersion) {\r\n throw new Error(\"Invalid minimum version: \" + asset.minVersion);\r\n }\r\n\r\n if (GLTFFileLoader._compareVersion(minVersion, { major: 2, minor: 0 }) > 0) {\r\n throw new Error(\"Incompatible minimum version: \" + asset.minVersion);\r\n }\r\n }\r\n\r\n const createLoaders: { [key: number]: (parent: GLTFFileLoader) => IGLTFLoader } = {\r\n 1: GLTFFileLoader._CreateGLTF1Loader,\r\n 2: GLTFFileLoader._CreateGLTF2Loader\r\n };\r\n\r\n const createLoader = createLoaders[version.major];\r\n if (!createLoader) {\r\n throw new Error(\"Unsupported version: \" + asset.version);\r\n }\r\n\r\n return createLoader(this);\r\n }\r\n\r\n private _parseJson(json: string): Object {\r\n this._startPerformanceCounter(\"Parse JSON\");\r\n this._log(`JSON length: ${json.length}`);\r\n const parsed = JSON.parse(json);\r\n this._endPerformanceCounter(\"Parse JSON\");\r\n return parsed;\r\n }\r\n\r\n private _unpackBinaryAsync(dataReader: DataReader): Promise<IGLTFLoaderData> {\r\n this._startPerformanceCounter(\"Unpack Binary\");\r\n\r\n // Read magic + version + length + json length + json format\r\n return dataReader.loadAsync(20).then(() => {\r\n const Binary = {\r\n Magic: 0x46546C67\r\n };\r\n\r\n const magic = dataReader.readUint32();\r\n if (magic !== Binary.Magic) {\r\n throw new Error(\"Unexpected magic: \" + magic);\r\n }\r\n\r\n const version = dataReader.readUint32();\r\n\r\n if (this.loggingEnabled) {\r\n this._log(`Binary version: ${version}`);\r\n }\r\n\r\n const length = dataReader.readUint32();\r\n if (dataReader.buffer.byteLength !== 0 && length !== dataReader.buffer.byteLength) {\r\n throw new Error(`Length in header does not match actual data length: ${length} != ${dataReader.buffer.byteLength}`);\r\n }\r\n\r\n let unpacked: Promise<IGLTFLoaderData>;\r\n switch (version) {\r\n case 1: {\r\n unpacked = this._unpackBinaryV1Async(dataReader, length);\r\n break;\r\n }\r\n case 2: {\r\n unpacked = this._unpackBinaryV2Async(dataReader, length);\r\n break;\r\n }\r\n default: {\r\n throw new Error(\"Unsupported version: \" + version);\r\n }\r\n }\r\n\r\n this._endPerformanceCounter(\"Unpack Binary\");\r\n\r\n return unpacked;\r\n });\r\n }\r\n\r\n private _unpackBinaryV1Async(dataReader: DataReader, length: number): Promise<IGLTFLoaderData> {\r\n const ContentFormat = {\r\n JSON: 0\r\n };\r\n\r\n const contentLength = dataReader.readUint32();\r\n const contentFormat = dataReader.readUint32();\r\n\r\n if (contentFormat !== ContentFormat.JSON) {\r\n throw new Error(`Unexpected content format: ${contentFormat}`);\r\n }\r\n\r\n const bodyLength = length - dataReader.byteOffset;\r\n\r\n const data: IGLTFLoaderData = { json: this._parseJson(dataReader.readString(contentLength)), bin: null };\r\n if (bodyLength !== 0) {\r\n const startByteOffset = dataReader.byteOffset;\r\n data.bin = {\r\n readAsync: (byteOffset, byteLength) => dataReader.buffer.readAsync(startByteOffset + byteOffset, byteLength),\r\n byteLength: bodyLength\r\n };\r\n }\r\n\r\n return Promise.resolve(data);\r\n }\r\n\r\n private _unpackBinaryV2Async(dataReader: DataReader, length: number): Promise<IGLTFLoaderData> {\r\n const ChunkFormat = {\r\n JSON: 0x4E4F534A,\r\n BIN: 0x004E4942\r\n };\r\n\r\n // Read the JSON chunk header.\r\n const chunkLength = dataReader.readUint32();\r\n const chunkFormat = dataReader.readUint32();\r\n if (chunkFormat !== ChunkFormat.JSON) {\r\n throw new Error(\"First chunk format is not JSON\");\r\n }\r\n\r\n // Bail if there are no other chunks.\r\n if (dataReader.byteOffset + chunkLength === length) {\r\n return dataReader.loadAsync(chunkLength).then(() => {\r\n return { json: this._parseJson(dataReader.readString(chunkLength)), bin: null };\r\n });\r\n }\r\n\r\n // Read the JSON chunk and the length and type of the next chunk.\r\n return dataReader.loadAsync(chunkLength + 8).then(() => {\r\n const data: IGLTFLoaderData = { json: this._parseJson(dataReader.readString(chunkLength)), bin: null };\r\n\r\n const readAsync = (): Promise<IGLTFLoaderData> => {\r\n const chunkLength = dataReader.readUint32();\r\n const chunkFormat = dataReader.readUint32();\r\n\r\n switch (chunkFormat) {\r\n case ChunkFormat.JSON: {\r\n throw new Error(\"Unexpected JSON chunk\");\r\n }\r\n case ChunkFormat.BIN: {\r\n const startByteOffset = dataReader.byteOffset;\r\n data.bin = {\r\n readAsync: (byteOffset, byteLength) => dataReader.buffer.readAsync(startByteOffset + byteOffset, byteLength),\r\n byteLength: chunkLength\r\n };\r\n dataReader.skipBytes(chunkLength);\r\n break;\r\n }\r\n default: {\r\n // ignore unrecognized chunkFormat\r\n dataReader.skipBytes(chunkLength);\r\n break;\r\n }\r\n }\r\n\r\n if (dataReader.byteOffset !== length) {\r\n return dataReader.loadAsync(8).then(readAsync);\r\n }\r\n\r\n return Promise.resolve(data);\r\n };\r\n\r\n return readAsync();\r\n });\r\n }\r\n\r\n private static _parseVersion(version: string): Nullable<{ major: number, minor: number }> {\r\n if (version === \"1.0\" || version === \"1.0.1\") {\r\n return {\r\n major: 1,\r\n minor: 0\r\n };\r\n }\r\n\r\n const match = (version + \"\").match(/^(\\d+)\\.(\\d+)/);\r\n if (!match) {\r\n return null;\r\n }\r\n\r\n return {\r\n major: parseInt(match[1]),\r\n minor: parseInt(match[2])\r\n };\r\n }\r\n\r\n private static _compareVersion(a: { major: number, minor: number }, b: { major: number, minor: number }): number {\r\n if (a.major > b.major) { return 1; }\r\n if (a.major < b.major) { return -1; }\r\n if (a.minor > b.minor) { return 1; }\r\n if (a.minor < b.minor) { return -1; }\r\n return 0;\r\n }\r\n\r\n private static readonly _logSpaces = \" \";\r\n private _logIndentLevel = 0;\r\n private _loggingEnabled = false;\r\n\r\n /** @hidden */\r\n public _log = this._logDisabled;\r\n\r\n /** @hidden */\r\n public _logOpen(message: string): void {\r\n this._log(message);\r\n this._logIndentLevel++;\r\n }\r\n\r\n /** @hidden */\r\n public _logClose(): void {\r\n --this._logIndentLevel;\r\n }\r\n\r\n private _logEnabled(message: string): void {\r\n const spaces = GLTFFileLoader._logSpaces.substr(0, this._logIndentLevel * 2);\r\n Logger.Log(`${spaces}${message}`);\r\n }\r\n\r\n private _logDisabled(message: string): void {\r\n }\r\n\r\n private _capturePerformanceCounters = false;\r\n\r\n /** @hidden */\r\n public _startPerformanceCounter = this._startPerformanceCounterDisabled;\r\n\r\n /** @hidden */\r\n public _endPerformanceCounter = this._endPerformanceCounterDisabled;\r\n\r\n private _startPerformanceCounterEnabled(counterName: string): void {\r\n Tools.StartPerformanceCounter(counterName);\r\n }\r\n\r\n private _startPerformanceCounterDisabled(counterName: string): void {\r\n }\r\n\r\n private _endPerformanceCounterEnabled(counterName: string): void {\r\n Tools.EndPerformanceCounter(counterName);\r\n }\r\n\r\n private _endPerformanceCounterDisabled(counterName: string): void {\r\n }\r\n}\r\n\r\nif (SceneLoader) {\r\n SceneLoader.RegisterPlugin(new GLTFFileLoader());\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"glTFFileLoader.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/glTF/glTFFileLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAY,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAKnD,OAAO,EAAE,WAAW,EAA4J,MAAM,qCAAqC,CAAC;AAC5N,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIhE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAe,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAiB,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAQtE,SAAS,SAAS,CAAC,WAAwB,EAAE,UAAkB,EAAE,UAAkB;IAC/E,IAAI;QAC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AAG,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC;QAC7E,MAAM,CAAC,GAAG,CAAC,UAAG,MAAM,SAAG,OAAO,CAAE,CAAC,CAAC;IACtC,CAAC;IAEO,qCAAY,GAApB,UAAqB,OAAe;IACpC,CAAC;IAUO,wDAA+B,GAAvC,UAAwC,WAAmB;QACvD,KAAK,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAEO,yDAAgC,GAAxC,UAAyC,WAAmB;IAC5D,CAAC;IAEO,sDAA6B,GAArC,UAAsC,WAAmB;QACrD,KAAK,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAEO,uDAA8B,GAAtC,UAAuC,WAAmB;IAC1D,CAAC;IAp2BD,aAAa;IACb,aAAa;IACb,aAAa;IAEb;;;;;OAKG;IACW,iCAAkB,GAAG,IAAI,CAAC;IAExC;;;;OAIG;IACW,qCAAsB,GAAG,KAAK,CAAC;IAyS9B,iCAAkB,GAAG,QAAQ,CAAC,CAAC,8CAA8C;IA4fpE,yBAAU,GAAG,kCAAkC,CAAC;IA+C5E,qBAAC;CAAA,AAj4BD,IAi4BC;SAj4BY,cAAc;AAm4B3B,IAAI,WAAW,EAAE;IACb,WAAW,CAAC,cAAc,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;CACpD","sourcesContent":["import * as GLTF2 from \"babylonjs-gltf2interface\";\r\nimport { Nullable } from \"@babylonjs/core/types\";\r\nimport { Observable, Observer } from \"@babylonjs/core/Misc/observable\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\r\nimport { BaseTexture } from \"@babylonjs/core/Materials/Textures/baseTexture\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { SceneLoader, ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginExtensions, ISceneLoaderAsyncResult } from \"@babylonjs/core/Loading/sceneLoader\";\r\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\r\nimport { Scene, IDisposable } from \"@babylonjs/core/scene\";\r\nimport { WebRequest } from \"@babylonjs/core/Misc/webRequest\";\r\nimport { IFileRequest } from \"@babylonjs/core/Misc/fileRequest\";\r\nimport { Logger } from \"@babylonjs/core/Misc/logger\";\r\nimport { DataReader, IDataBuffer } from \"@babylonjs/core/Misc/dataReader\";\r\nimport { GLTFValidation } from \"./glTFValidation\";\r\nimport { DecodeBase64UrlToBinary, LoadFileError } from \"@babylonjs/core/Misc/fileTools\";\r\nimport { StringTools } from \"@babylonjs/core/Misc/stringTools\";\r\nimport { RuntimeError, ErrorCodes } from \"@babylonjs/core/Misc/error\";\r\n\r\ninterface IFileRequestInfo extends IFileRequest {\r\n _lengthComputable?: boolean;\r\n _loaded?: number;\r\n _total?: number;\r\n}\r\n\r\nfunction readAsync(arrayBuffer: ArrayBuffer, byteOffset: number, byteLength: number): Promise<Uint8Array> {\r\n try {\r\n return Promise.resolve(new Uint8Array(arrayBuffer, byteOffset, byteLength));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n}\r\n\r\n/**\r\n * Mode that determines the coordinate system to use.\r\n */\r\nexport enum GLTFLoaderCoordinateSystemMode {\r\n /**\r\n * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.\r\n */\r\n AUTO,\r\n\r\n /**\r\n * Sets the useRightHandedSystem flag on the scene.\r\n */\r\n FORCE_RIGHT_HANDED,\r\n}\r\n\r\n/**\r\n * Mode that determines what animations will start.\r\n */\r\nexport enum GLTFLoaderAnimationStartMode {\r\n /**\r\n * No animation will start.\r\n */\r\n NONE,\r\n\r\n /**\r\n * The first animation will start.\r\n */\r\n FIRST,\r\n\r\n /**\r\n * All animations will start.\r\n */\r\n ALL,\r\n}\r\n\r\n/**\r\n * Interface that contains the data for the glTF asset.\r\n */\r\nexport interface IGLTFLoaderData {\r\n /**\r\n * The object that represents the glTF JSON.\r\n */\r\n json: Object;\r\n\r\n /**\r\n * The BIN chunk of a binary glTF.\r\n */\r\n bin: Nullable<IDataBuffer>;\r\n}\r\n\r\n/**\r\n * Interface for extending the loader.\r\n */\r\nexport interface IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n enabled: boolean;\r\n\r\n /**\r\n * Defines the order of this extension.\r\n * The loader sorts the extensions using these values when loading.\r\n */\r\n order?: number;\r\n}\r\n\r\n/**\r\n * Loader state.\r\n */\r\nexport enum GLTFLoaderState {\r\n /**\r\n * The asset is loading.\r\n */\r\n LOADING,\r\n\r\n /**\r\n * The asset is ready for rendering.\r\n */\r\n READY,\r\n\r\n /**\r\n * The asset is completely loaded.\r\n */\r\n COMPLETE\r\n}\r\n\r\n/** @hidden */\r\nexport interface IGLTFLoader extends IDisposable {\r\n importMeshAsync: (meshesNames: any, scene: Scene, container: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<ISceneLoaderAsyncResult>;\r\n loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;\r\n}\r\n\r\n/**\r\n * File loader for loading glTF files into a scene.\r\n */\r\nexport class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\r\n /** @hidden */\r\n public static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;\r\n\r\n /** @hidden */\r\n public static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;\r\n\r\n // --------------\r\n // Common options\r\n // --------------\r\n\r\n /**\r\n * Raised when the asset has been parsed\r\n */\r\n public onParsedObservable = new Observable<IGLTFLoaderData>();\r\n\r\n private _onParsedObserver: Nullable<Observer<IGLTFLoaderData>>;\r\n\r\n /**\r\n * Raised when the asset has been parsed\r\n */\r\n public set onParsed(callback: (loaderData: IGLTFLoaderData) => void) {\r\n if (this._onParsedObserver) {\r\n this.onParsedObservable.remove(this._onParsedObserver);\r\n }\r\n this._onParsedObserver = this.onParsedObservable.add(callback);\r\n }\r\n\r\n // ----------\r\n // V1 options\r\n // ----------\r\n\r\n /**\r\n * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.\r\n * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.\r\n * Defaults to true.\r\n * @hidden\r\n */\r\n public static IncrementalLoading = true;\r\n\r\n /**\r\n * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.\r\n * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.\r\n * @hidden\r\n */\r\n public static HomogeneousCoordinates = false;\r\n\r\n // ----------\r\n // V2 options\r\n // ----------\r\n\r\n /**\r\n * The coordinate system mode. Defaults to AUTO.\r\n */\r\n public coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;\r\n\r\n /**\r\n * The animation start mode. Defaults to FIRST.\r\n */\r\n public animationStartMode = GLTFLoaderAnimationStartMode.FIRST;\r\n\r\n /**\r\n * Defines if the loader should compile materials before raising the success callback. Defaults to false.\r\n */\r\n public compileMaterials = false;\r\n\r\n /**\r\n * Defines if the loader should also compile materials with clip planes. Defaults to false.\r\n */\r\n public useClipPlane = false;\r\n\r\n /**\r\n * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.\r\n */\r\n public compileShadowGenerators = false;\r\n\r\n /**\r\n * Defines if the Alpha blended materials are only applied as coverage.\r\n * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.\r\n * If true, no extra effects are applied to transparent pixels.\r\n */\r\n public transparencyAsCoverage = false;\r\n\r\n /**\r\n * Defines if the loader should use range requests when load binary glTF files from HTTP.\r\n * Enabling will disable offline support and glTF validator.\r\n * Defaults to false.\r\n */\r\n public useRangeRequests = false;\r\n\r\n /**\r\n * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.\r\n */\r\n public createInstances = true;\r\n\r\n /**\r\n * Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.\r\n */\r\n public alwaysComputeBoundingBox = false;\r\n\r\n /**\r\n * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.\r\n */\r\n public loadAllMaterials = false;\r\n\r\n /**\r\n * If true, load the color (gamma encoded) textures into sRGB buffers (if supported by the GPU), which will yield more accurate results when sampling the texture. Defaults to true.\r\n */\r\n public useSRGBBuffers = true;\r\n\r\n /**\r\n * When loading glTF animations, which are defined in seconds, target them to this FPS. Defaults to 60.\r\n */\r\n public targetFps = 60;\r\n\r\n /**\r\n * Defines if the loader should always compute the nearest common ancestor of the skeleton joints instead of using `skin.skeleton`. Defaults to false.\r\n * Set this to true if loading assets with invalid `skin.skeleton` values.\r\n */\r\n public alwaysComputeSkeletonRootNode = false;\r\n\r\n /**\r\n * Function called before loading a url referenced by the asset.\r\n */\r\n public preprocessUrlAsync = (url: string) => Promise.resolve(url);\r\n\r\n /**\r\n * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.\r\n * Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\r\n */\r\n public readonly onMeshLoadedObservable = new Observable<AbstractMesh>();\r\n\r\n private _onMeshLoadedObserver: Nullable<Observer<AbstractMesh>>;\r\n\r\n /**\r\n * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.\r\n * Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\r\n */\r\n public set onMeshLoaded(callback: (mesh: AbstractMesh) => void) {\r\n if (this._onMeshLoadedObserver) {\r\n this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver);\r\n }\r\n this._onMeshLoadedObserver = this.onMeshLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.\r\n */\r\n public readonly onTextureLoadedObservable = new Observable<BaseTexture>();\r\n\r\n private _onTextureLoadedObserver: Nullable<Observer<BaseTexture>>;\r\n\r\n /**\r\n * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.\r\n */\r\n public set onTextureLoaded(callback: (texture: BaseTexture) => void) {\r\n if (this._onTextureLoadedObserver) {\r\n this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver);\r\n }\r\n this._onTextureLoadedObserver = this.onTextureLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when the loader creates a material after parsing the glTF properties of the material.\r\n */\r\n public readonly onMaterialLoadedObservable = new Observable<Material>();\r\n\r\n private _onMaterialLoadedObserver: Nullable<Observer<Material>>;\r\n\r\n /**\r\n * Callback raised when the loader creates a material after parsing the glTF properties of the material.\r\n */\r\n public set onMaterialLoaded(callback: (material: Material) => void) {\r\n if (this._onMaterialLoadedObserver) {\r\n this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver);\r\n }\r\n this._onMaterialLoadedObserver = this.onMaterialLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.\r\n */\r\n public readonly onCameraLoadedObservable = new Observable<Camera>();\r\n\r\n private _onCameraLoadedObserver: Nullable<Observer<Camera>>;\r\n\r\n /**\r\n * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.\r\n */\r\n public set onCameraLoaded(callback: (camera: Camera) => void) {\r\n if (this._onCameraLoadedObserver) {\r\n this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver);\r\n }\r\n this._onCameraLoadedObserver = this.onCameraLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when the asset is completely loaded, immediately before the loader is disposed.\r\n * For assets with LODs, raised when all of the LODs are complete.\r\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\r\n */\r\n public readonly onCompleteObservable = new Observable<void>();\r\n\r\n private _onCompleteObserver: Nullable<Observer<void>>;\r\n\r\n /**\r\n * Callback raised when the asset is completely loaded, immediately before the loader is disposed.\r\n * For assets with LODs, raised when all of the LODs are complete.\r\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\r\n */\r\n public set onComplete(callback: () => void) {\r\n if (this._onCompleteObserver) {\r\n this.onCompleteObservable.remove(this._onCompleteObserver);\r\n }\r\n this._onCompleteObserver = this.onCompleteObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised when an error occurs.\r\n */\r\n public readonly onErrorObservable = new Observable<any>();\r\n\r\n private _onErrorObserver: Nullable<Observer<any>>;\r\n\r\n /**\r\n * Callback raised when an error occurs.\r\n */\r\n public set onError(callback: (reason: any) => void) {\r\n if (this._onErrorObserver) {\r\n this.onErrorObservable.remove(this._onErrorObserver);\r\n }\r\n this._onErrorObserver = this.onErrorObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised after the loader is disposed.\r\n */\r\n public readonly onDisposeObservable = new Observable<void>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<void>>;\r\n\r\n /**\r\n * Callback raised after the loader is disposed.\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Observable raised after a loader extension is created.\r\n * Set additional options for a loader extension in this event.\r\n */\r\n public readonly onExtensionLoadedObservable = new Observable<IGLTFLoaderExtension>();\r\n\r\n private _onExtensionLoadedObserver: Nullable<Observer<IGLTFLoaderExtension>>;\r\n\r\n /**\r\n * Callback raised after a loader extension is created.\r\n */\r\n public set onExtensionLoaded(callback: (extension: IGLTFLoaderExtension) => void) {\r\n if (this._onExtensionLoadedObserver) {\r\n this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver);\r\n }\r\n this._onExtensionLoadedObserver = this.onExtensionLoadedObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Defines if the loader logging is enabled.\r\n */\r\n public get loggingEnabled(): boolean {\r\n return this._loggingEnabled;\r\n }\r\n\r\n public set loggingEnabled(value: boolean) {\r\n if (this._loggingEnabled === value) {\r\n return;\r\n }\r\n\r\n this._loggingEnabled = value;\r\n\r\n if (this._loggingEnabled) {\r\n this._log = this._logEnabled;\r\n }\r\n else {\r\n this._log = this._logDisabled;\r\n }\r\n }\r\n\r\n /**\r\n * Defines if the loader should capture performance counters.\r\n */\r\n public get capturePerformanceCounters(): boolean {\r\n return this._capturePerformanceCounters;\r\n }\r\n\r\n public set capturePerformanceCounters(value: boolean) {\r\n if (this._capturePerformanceCounters === value) {\r\n return;\r\n }\r\n\r\n this._capturePerformanceCounters = value;\r\n\r\n if (this._capturePerformanceCounters) {\r\n this._startPerformanceCounter = this._startPerformanceCounterEnabled;\r\n this._endPerformanceCounter = this._endPerformanceCounterEnabled;\r\n }\r\n else {\r\n this._startPerformanceCounter = this._startPerformanceCounterDisabled;\r\n this._endPerformanceCounter = this._endPerformanceCounterDisabled;\r\n }\r\n }\r\n\r\n /**\r\n * Defines if the loader should validate the asset.\r\n */\r\n public validate = false;\r\n\r\n /**\r\n * Observable raised after validation when validate is set to true. The event data is the result of the validation.\r\n */\r\n public readonly onValidatedObservable = new Observable<GLTF2.IGLTFValidationResults>();\r\n\r\n private _onValidatedObserver: Nullable<Observer<GLTF2.IGLTFValidationResults>>;\r\n\r\n /**\r\n * Callback raised after a loader extension is created.\r\n */\r\n public set onValidated(callback: (results: GLTF2.IGLTFValidationResults) => void) {\r\n if (this._onValidatedObserver) {\r\n this.onValidatedObservable.remove(this._onValidatedObserver);\r\n }\r\n this._onValidatedObserver = this.onValidatedObservable.add(callback);\r\n }\r\n\r\n private _loader: Nullable<IGLTFLoader> = null;\r\n private _state: Nullable<GLTFLoaderState> = null;\r\n private _progressCallback?: (event: ISceneLoaderProgressEvent) => void;\r\n private _requests = new Array<IFileRequestInfo>();\r\n\r\n private static magicBase64Encoded = \"Z2xURg\"; // \"glTF\" base64 encoded (without the quotes!)\r\n\r\n /**\r\n * Name of the loader (\"gltf\")\r\n */\r\n public name = \"gltf\";\r\n\r\n /** @hidden */\r\n public extensions: ISceneLoaderPluginExtensions = {\r\n \".gltf\": { isBinary: false },\r\n \".glb\": { isBinary: true }\r\n };\r\n\r\n /**\r\n * Disposes the loader, releases resources during load, and cancels any outstanding requests.\r\n */\r\n public dispose(): void {\r\n if (this._loader) {\r\n this._loader.dispose();\r\n this._loader = null;\r\n }\r\n\r\n for (const request of this._requests) {\r\n request.abort();\r\n }\r\n\r\n this._requests.length = 0;\r\n\r\n delete this._progressCallback;\r\n\r\n this.preprocessUrlAsync = (url) => Promise.resolve(url);\r\n\r\n this.onMeshLoadedObservable.clear();\r\n this.onTextureLoadedObservable.clear();\r\n this.onMaterialLoadedObservable.clear();\r\n this.onCameraLoadedObservable.clear();\r\n this.onCompleteObservable.clear();\r\n this.onExtensionLoadedObservable.clear();\r\n\r\n this.onDisposeObservable.notifyObservers(undefined);\r\n this.onDisposeObservable.clear();\r\n }\r\n\r\n /** @hidden */\r\n public loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: any, responseURL?: string) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void): IFileRequest {\r\n this._progressCallback = onProgress;\r\n\r\n const rootUrl = (fileOrUrl as File).name ? \"file:\" : Tools.GetFolderPath(fileOrUrl as string);\r\n const fileName = (fileOrUrl as File).name || Tools.GetFilename(fileOrUrl as string);\r\n\r\n if (useArrayBuffer) {\r\n if (this.useRangeRequests) {\r\n if (this.validate) {\r\n Logger.Warn(\"glTF validation is not supported when range requests are enabled\");\r\n }\r\n\r\n const fileRequest: IFileRequest = {\r\n abort: () => { },\r\n onCompleteObservable: new Observable<IFileRequest>()\r\n };\r\n\r\n const dataBuffer = {\r\n readAsync: (byteOffset: number, byteLength: number) => {\r\n return new Promise<ArrayBufferView>((resolve, reject) => {\r\n this._loadFile(scene, fileOrUrl, (data) => {\r\n resolve(new Uint8Array(data as ArrayBuffer));\r\n }, true, (error) => {\r\n reject(error);\r\n }, (webRequest) => {\r\n webRequest.setRequestHeader(\"Range\", `bytes=${byteOffset}-${byteOffset + byteLength - 1}`);\r\n });\r\n });\r\n },\r\n byteLength: 0\r\n };\r\n\r\n this._unpackBinaryAsync(new DataReader(dataBuffer)).then((loaderData) => {\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n onSuccess(loaderData);\r\n }, onError ? (error) => onError(undefined, error) : undefined);\r\n\r\n return fileRequest;\r\n }\r\n\r\n return this._loadFile(scene, fileOrUrl, (data) => {\r\n this._validate(scene, data as ArrayBuffer, rootUrl, fileName);\r\n this._unpackBinaryAsync(new DataReader({\r\n readAsync: (byteOffset, byteLength) => readAsync(data as ArrayBuffer, byteOffset, byteLength),\r\n byteLength: (data as ArrayBuffer).byteLength\r\n })).then((loaderData) => {\r\n onSuccess(loaderData);\r\n }, onError ? (error) => onError(undefined, error) : undefined);\r\n }, true, onError);\r\n }\r\n\r\n return this._loadFile(scene, fileOrUrl, (data) => {\r\n this._validate(scene, data, rootUrl, fileName);\r\n onSuccess({ json: this._parseJson(data as string) });\r\n }, useArrayBuffer, onError);\r\n }\r\n\r\n /** @hidden */\r\n public importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult> {\r\n return Promise.resolve().then(() => {\r\n this.onParsedObservable.notifyObservers(data);\r\n this.onParsedObservable.clear();\r\n\r\n this._log(`Loading ${fileName || \"\"}`);\r\n this._loader = this._getLoader(data);\r\n return this._loader.importMeshAsync(meshesNames, scene, null, data, rootUrl, onProgress, fileName);\r\n });\r\n }\r\n\r\n /** @hidden */\r\n public loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\r\n return Promise.resolve().then(() => {\r\n this.onParsedObservable.notifyObservers(data);\r\n this.onParsedObservable.clear();\r\n\r\n this._log(`Loading ${fileName || \"\"}`);\r\n this._loader = this._getLoader(data);\r\n return this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);\r\n });\r\n }\r\n\r\n /** @hidden */\r\n public loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer> {\r\n return Promise.resolve().then(() => {\r\n this.onParsedObservable.notifyObservers(data);\r\n this.onParsedObservable.clear();\r\n\r\n this._log(`Loading ${fileName || \"\"}`);\r\n this._loader = this._getLoader(data);\r\n\r\n // Prepare the asset container.\r\n const container = new AssetContainer(scene);\r\n\r\n // Get materials/textures when loading to add to container\r\n const materials: Array<Material> = [];\r\n this.onMaterialLoadedObservable.add((material) => {\r\n materials.push(material);\r\n });\r\n const textures: Array<BaseTexture> = [];\r\n this.onTextureLoadedObservable.add((texture) => {\r\n textures.push(texture);\r\n });\r\n const cameras: Array<Camera> = [];\r\n this.onCameraLoadedObservable.add((camera) => {\r\n cameras.push(camera);\r\n });\r\n\r\n return this._loader.importMeshAsync(null, scene, container, data, rootUrl, onProgress, fileName).then((result) => {\r\n Array.prototype.push.apply(container.geometries, result.geometries);\r\n Array.prototype.push.apply(container.meshes, result.meshes);\r\n Array.prototype.push.apply(container.particleSystems, result.particleSystems);\r\n Array.prototype.push.apply(container.skeletons, result.skeletons);\r\n Array.prototype.push.apply(container.animationGroups, result.animationGroups);\r\n Array.prototype.push.apply(container.materials, materials);\r\n Array.prototype.push.apply(container.textures, textures);\r\n Array.prototype.push.apply(container.lights, result.lights);\r\n Array.prototype.push.apply(container.transformNodes, result.transformNodes);\r\n Array.prototype.push.apply(container.cameras, cameras);\r\n return container;\r\n });\r\n });\r\n }\r\n\r\n /** @hidden */\r\n public canDirectLoad(data: string): boolean {\r\n return (data.indexOf(\"asset\") !== -1 && data.indexOf(\"version\") !== -1)\r\n || StringTools.StartsWith(data, \"data:base64,\" + GLTFFileLoader.magicBase64Encoded) // this is technically incorrect, but will continue to support for backcompat.\r\n || StringTools.StartsWith(data, \"data:;base64,\" + GLTFFileLoader.magicBase64Encoded)\r\n || StringTools.StartsWith(data, \"data:application/octet-stream;base64,\" + GLTFFileLoader.magicBase64Encoded)\r\n || StringTools.StartsWith(data, \"data:model/gltf-binary;base64,\" + GLTFFileLoader.magicBase64Encoded);\r\n }\r\n\r\n /** @hidden */\r\n public directLoad(scene: Scene, data: string): Promise<any> {\r\n if (StringTools.StartsWith(data, \"base64,\" + GLTFFileLoader.magicBase64Encoded) || // this is technically incorrect, but will continue to support for backcompat.\r\n StringTools.StartsWith(data, \";base64,\" + GLTFFileLoader.magicBase64Encoded) ||\r\n StringTools.StartsWith(data, \"application/octet-stream;base64,\" + GLTFFileLoader.magicBase64Encoded) ||\r\n StringTools.StartsWith(data, \"model/gltf-binary;base64,\" + GLTFFileLoader.magicBase64Encoded)) {\r\n const arrayBuffer = DecodeBase64UrlToBinary(data);\r\n\r\n this._validate(scene, arrayBuffer);\r\n return this._unpackBinaryAsync(new DataReader({\r\n readAsync: (byteOffset, byteLength) => readAsync(arrayBuffer, byteOffset, byteLength),\r\n byteLength: arrayBuffer.byteLength\r\n }));\r\n }\r\n\r\n this._validate(scene, data);\r\n return Promise.resolve({ json: this._parseJson(data) });\r\n }\r\n\r\n /**\r\n * The callback that allows custom handling of the root url based on the response url.\r\n * @param rootUrl the original root url\r\n * @param responseURL the response url if available\r\n * @returns the new root url\r\n */\r\n public rewriteRootURL?(rootUrl: string, responseURL?: string): string;\r\n\r\n /** @hidden */\r\n public createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync {\r\n return new GLTFFileLoader();\r\n }\r\n\r\n /**\r\n * The loader state or null if the loader is not active.\r\n */\r\n public get loaderState(): Nullable<GLTFLoaderState> {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * Observable raised when the loader state changes.\r\n */\r\n public onLoaderStateChangedObservable = new Observable<Nullable<GLTFLoaderState>>();\r\n\r\n /**\r\n * Returns a promise that resolves when the asset is completely loaded.\r\n * @returns a promise that resolves when the asset is completely loaded.\r\n */\r\n public whenCompleteAsync(): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n this.onCompleteObservable.addOnce(() => {\r\n resolve();\r\n });\r\n this.onErrorObservable.addOnce((reason) => {\r\n reject(reason);\r\n });\r\n });\r\n }\r\n\r\n /** @hidden */\r\n public _setState(state: GLTFLoaderState): void {\r\n if (this._state === state) {\r\n return;\r\n }\r\n\r\n this._state = state;\r\n this.onLoaderStateChangedObservable.notifyObservers(this._state);\r\n this._log(GLTFLoaderState[this._state]);\r\n }\r\n\r\n /** @hidden */\r\n public _loadFile(scene: Scene, fileOrUrl: File | string, onSuccess: (data: string | ArrayBuffer) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest) => void, onOpened?: (request: WebRequest) => void): IFileRequest {\r\n const request = scene._loadFile(fileOrUrl, onSuccess, (event) => {\r\n this._onProgress(event, request);\r\n }, true, useArrayBuffer, onError, onOpened) as IFileRequestInfo;\r\n request.onCompleteObservable.add((request) => {\r\n this._requests.splice(this._requests.indexOf(request), 1);\r\n });\r\n this._requests.push(request);\r\n return request;\r\n }\r\n\r\n private _onProgress(event: ProgressEvent, request: IFileRequestInfo): void {\r\n if (!this._progressCallback) {\r\n return;\r\n }\r\n\r\n request._lengthComputable = event.lengthComputable;\r\n request._loaded = event.loaded;\r\n request._total = event.total;\r\n\r\n let lengthComputable = true;\r\n let loaded = 0;\r\n let total = 0;\r\n for (let request of this._requests) {\r\n if (request._lengthComputable === undefined || request._loaded === undefined || request._total === undefined) {\r\n return;\r\n }\r\n\r\n lengthComputable = lengthComputable && request._lengthComputable;\r\n loaded += request._loaded;\r\n total += request._total;\r\n }\r\n\r\n this._progressCallback({\r\n lengthComputable: lengthComputable,\r\n loaded: loaded,\r\n total: lengthComputable ? total : 0\r\n });\r\n }\r\n\r\n private _validate(scene: Scene, data: string | ArrayBuffer, rootUrl = \"\", fileName = \"\"): void {\r\n if (!this.validate) {\r\n return;\r\n }\r\n\r\n this._startPerformanceCounter(\"Validate JSON\");\r\n GLTFValidation.ValidateAsync(data, rootUrl, fileName, (uri) => {\r\n return this.preprocessUrlAsync(rootUrl + uri).then((url) => (scene._loadFileAsync(url, undefined, true, true) as Promise<ArrayBuffer>));\r\n }).then((result) => {\r\n this._endPerformanceCounter(\"Validate JSON\");\r\n this.onValidatedObservable.notifyObservers(result);\r\n this.onValidatedObservable.clear();\r\n }, (reason) => {\r\n this._endPerformanceCounter(\"Validate JSON\");\r\n Tools.Warn(`Failed to validate: ${reason.message}`);\r\n this.onValidatedObservable.clear();\r\n });\r\n }\r\n\r\n private _getLoader(loaderData: IGLTFLoaderData): IGLTFLoader {\r\n const asset = (<any>loaderData.json).asset || {};\r\n\r\n this._log(`Asset version: ${asset.version}`);\r\n asset.minVersion && this._log(`Asset minimum version: ${asset.minVersion}`);\r\n asset.generator && this._log(`Asset generator: ${asset.generator}`);\r\n\r\n const version = GLTFFileLoader._parseVersion(asset.version);\r\n if (!version) {\r\n throw new Error(\"Invalid version: \" + asset.version);\r\n }\r\n\r\n if (asset.minVersion !== undefined) {\r\n const minVersion = GLTFFileLoader._parseVersion(asset.minVersion);\r\n if (!minVersion) {\r\n throw new Error(\"Invalid minimum version: \" + asset.minVersion);\r\n }\r\n\r\n if (GLTFFileLoader._compareVersion(minVersion, { major: 2, minor: 0 }) > 0) {\r\n throw new Error(\"Incompatible minimum version: \" + asset.minVersion);\r\n }\r\n }\r\n\r\n const createLoaders: { [key: number]: (parent: GLTFFileLoader) => IGLTFLoader } = {\r\n 1: GLTFFileLoader._CreateGLTF1Loader,\r\n 2: GLTFFileLoader._CreateGLTF2Loader\r\n };\r\n\r\n const createLoader = createLoaders[version.major];\r\n if (!createLoader) {\r\n throw new Error(\"Unsupported version: \" + asset.version);\r\n }\r\n\r\n return createLoader(this);\r\n }\r\n\r\n private _parseJson(json: string): Object {\r\n this._startPerformanceCounter(\"Parse JSON\");\r\n this._log(`JSON length: ${json.length}`);\r\n const parsed = JSON.parse(json);\r\n this._endPerformanceCounter(\"Parse JSON\");\r\n return parsed;\r\n }\r\n\r\n private _unpackBinaryAsync(dataReader: DataReader): Promise<IGLTFLoaderData> {\r\n this._startPerformanceCounter(\"Unpack Binary\");\r\n\r\n // Read magic + version + length + json length + json format\r\n return dataReader.loadAsync(20).then(() => {\r\n const Binary = {\r\n Magic: 0x46546C67\r\n };\r\n\r\n const magic = dataReader.readUint32();\r\n if (magic !== Binary.Magic) {\r\n throw new RuntimeError(\"Unexpected magic: \" + magic, ErrorCodes.GLTFLoaderUnexpectedMagicError);\r\n }\r\n\r\n const version = dataReader.readUint32();\r\n\r\n if (this.loggingEnabled) {\r\n this._log(`Binary version: ${version}`);\r\n }\r\n\r\n const length = dataReader.readUint32();\r\n if (dataReader.buffer.byteLength !== 0 && length !== dataReader.buffer.byteLength) {\r\n throw new Error(`Length in header does not match actual data length: ${length} != ${dataReader.buffer.byteLength}`);\r\n }\r\n\r\n let unpacked: Promise<IGLTFLoaderData>;\r\n switch (version) {\r\n case 1: {\r\n unpacked = this._unpackBinaryV1Async(dataReader, length);\r\n break;\r\n }\r\n case 2: {\r\n unpacked = this._unpackBinaryV2Async(dataReader, length);\r\n break;\r\n }\r\n default: {\r\n throw new Error(\"Unsupported version: \" + version);\r\n }\r\n }\r\n\r\n this._endPerformanceCounter(\"Unpack Binary\");\r\n\r\n return unpacked;\r\n });\r\n }\r\n\r\n private _unpackBinaryV1Async(dataReader: DataReader, length: number): Promise<IGLTFLoaderData> {\r\n const ContentFormat = {\r\n JSON: 0\r\n };\r\n\r\n const contentLength = dataReader.readUint32();\r\n const contentFormat = dataReader.readUint32();\r\n\r\n if (contentFormat !== ContentFormat.JSON) {\r\n throw new Error(`Unexpected content format: ${contentFormat}`);\r\n }\r\n\r\n const bodyLength = length - dataReader.byteOffset;\r\n\r\n const data: IGLTFLoaderData = { json: this._parseJson(dataReader.readString(contentLength)), bin: null };\r\n if (bodyLength !== 0) {\r\n const startByteOffset = dataReader.byteOffset;\r\n data.bin = {\r\n readAsync: (byteOffset, byteLength) => dataReader.buffer.readAsync(startByteOffset + byteOffset, byteLength),\r\n byteLength: bodyLength\r\n };\r\n }\r\n\r\n return Promise.resolve(data);\r\n }\r\n\r\n private _unpackBinaryV2Async(dataReader: DataReader, length: number): Promise<IGLTFLoaderData> {\r\n const ChunkFormat = {\r\n JSON: 0x4E4F534A,\r\n BIN: 0x004E4942\r\n };\r\n\r\n // Read the JSON chunk header.\r\n const chunkLength = dataReader.readUint32();\r\n const chunkFormat = dataReader.readUint32();\r\n if (chunkFormat !== ChunkFormat.JSON) {\r\n throw new Error(\"First chunk format is not JSON\");\r\n }\r\n\r\n // Bail if there are no other chunks.\r\n if (dataReader.byteOffset + chunkLength === length) {\r\n return dataReader.loadAsync(chunkLength).then(() => {\r\n return { json: this._parseJson(dataReader.readString(chunkLength)), bin: null };\r\n });\r\n }\r\n\r\n // Read the JSON chunk and the length and type of the next chunk.\r\n return dataReader.loadAsync(chunkLength + 8).then(() => {\r\n const data: IGLTFLoaderData = { json: this._parseJson(dataReader.readString(chunkLength)), bin: null };\r\n\r\n const readAsync = (): Promise<IGLTFLoaderData> => {\r\n const chunkLength = dataReader.readUint32();\r\n const chunkFormat = dataReader.readUint32();\r\n\r\n switch (chunkFormat) {\r\n case ChunkFormat.JSON: {\r\n throw new Error(\"Unexpected JSON chunk\");\r\n }\r\n case ChunkFormat.BIN: {\r\n const startByteOffset = dataReader.byteOffset;\r\n data.bin = {\r\n readAsync: (byteOffset, byteLength) => dataReader.buffer.readAsync(startByteOffset + byteOffset, byteLength),\r\n byteLength: chunkLength\r\n };\r\n dataReader.skipBytes(chunkLength);\r\n break;\r\n }\r\n default: {\r\n // ignore unrecognized chunkFormat\r\n dataReader.skipBytes(chunkLength);\r\n break;\r\n }\r\n }\r\n\r\n if (dataReader.byteOffset !== length) {\r\n return dataReader.loadAsync(8).then(readAsync);\r\n }\r\n\r\n return Promise.resolve(data);\r\n };\r\n\r\n return readAsync();\r\n });\r\n }\r\n\r\n private static _parseVersion(version: string): Nullable<{ major: number, minor: number }> {\r\n if (version === \"1.0\" || version === \"1.0.1\") {\r\n return {\r\n major: 1,\r\n minor: 0\r\n };\r\n }\r\n\r\n const match = (version + \"\").match(/^(\\d+)\\.(\\d+)/);\r\n if (!match) {\r\n return null;\r\n }\r\n\r\n return {\r\n major: parseInt(match[1]),\r\n minor: parseInt(match[2])\r\n };\r\n }\r\n\r\n private static _compareVersion(a: { major: number, minor: number }, b: { major: number, minor: number }): number {\r\n if (a.major > b.major) { return 1; }\r\n if (a.major < b.major) { return -1; }\r\n if (a.minor > b.minor) { return 1; }\r\n if (a.minor < b.minor) { return -1; }\r\n return 0;\r\n }\r\n\r\n private static readonly _logSpaces = \" \";\r\n private _logIndentLevel = 0;\r\n private _loggingEnabled = false;\r\n\r\n /** @hidden */\r\n public _log = this._logDisabled;\r\n\r\n /** @hidden */\r\n public _logOpen(message: string): void {\r\n this._log(message);\r\n this._logIndentLevel++;\r\n }\r\n\r\n /** @hidden */\r\n public _logClose(): void {\r\n --this._logIndentLevel;\r\n }\r\n\r\n private _logEnabled(message: string): void {\r\n const spaces = GLTFFileLoader._logSpaces.substr(0, this._logIndentLevel * 2);\r\n Logger.Log(`${spaces}${message}`);\r\n }\r\n\r\n private _logDisabled(message: string): void {\r\n }\r\n\r\n private _capturePerformanceCounters = false;\r\n\r\n /** @hidden */\r\n public _startPerformanceCounter = this._startPerformanceCounterDisabled;\r\n\r\n /** @hidden */\r\n public _endPerformanceCounter = this._endPerformanceCounterDisabled;\r\n\r\n private _startPerformanceCounterEnabled(counterName: string): void {\r\n Tools.StartPerformanceCounter(counterName);\r\n }\r\n\r\n private _startPerformanceCounterDisabled(counterName: string): void {\r\n }\r\n\r\n private _endPerformanceCounterEnabled(counterName: string): void {\r\n Tools.EndPerformanceCounter(counterName);\r\n }\r\n\r\n private _endPerformanceCounterDisabled(counterName: string): void {\r\n }\r\n}\r\n\r\nif (SceneLoader) {\r\n SceneLoader.RegisterPlugin(new GLTFFileLoader());\r\n}\r\n"]}
|
package/glTF/glTFValidation.js
CHANGED
@@ -63,7 +63,7 @@ var GLTFValidation = /** @class */ (function () {
|
|
63
63
|
var _this = this;
|
64
64
|
if (typeof Worker === "function") {
|
65
65
|
return new Promise(function (resolve, reject) {
|
66
|
-
var workerContent = validateAsync
|
66
|
+
var workerContent = "".concat(validateAsync, "(").concat(workerFunc, ")()");
|
67
67
|
var workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: "application/javascript" }));
|
68
68
|
var worker = new Worker(workerBlobUrl);
|
69
69
|
var onError = function (error) {
|