@babylonjs/loaders 5.0.0-rc.1 → 5.0.0-rc.10
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.d.ts +4 -4
- package/OBJ/index.js +4 -4
- package/OBJ/index.js.map +1 -1
- package/OBJ/mtlFileLoader.d.ts +41 -40
- package/OBJ/mtlFileLoader.js +232 -231
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +126 -133
- package/OBJ/objFileLoader.js +296 -300
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/OBJ/solidParser.d.ts +154 -153
- package/OBJ/solidParser.js +693 -699
- package/OBJ/solidParser.js.map +1 -1
- package/STL/index.d.ts +1 -1
- package/STL/index.js +1 -1
- package/STL/index.js.map +1 -1
- package/STL/stlFileLoader.d.ts +64 -71
- package/STL/stlFileLoader.js +233 -239
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -61
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.d.ts +136 -106
- package/glTF/1.0/glTFLoader.js +1814 -1696
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.d.ts +63 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -232
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -127
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/1.0/index.d.ts +5 -5
- package/glTF/1.0/index.js +5 -5
- package/glTF/1.0/index.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -36
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -110
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -28
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -80
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -27
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -42
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -21
- package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -32
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -32
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -55
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -31
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -101
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -28
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -81
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -31
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -86
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -30
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -45
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -34
- package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -54
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -30
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -72
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -31
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -76
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -30
- package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -66
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -31
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -76
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -30
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -277
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -30
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -65
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -76
- package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -243
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -31
- package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -78
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -19
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -21
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -21
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -32
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -25
- package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -53
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -29
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -46
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -38
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -216
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -75
- package/glTF/2.0/Extensions/MSFT_lod.js +369 -333
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/index.d.ts +26 -26
- package/glTF/2.0/Extensions/index.js +26 -26
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/glTFLoader.d.ts +406 -357
- package/glTF/2.0/glTFLoader.js +2366 -2266
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -209
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +5 -4
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +433 -373
- package/glTF/glTFFileLoader.js +927 -870
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -121
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +6 -5
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +15 -14
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -2
- package/legacy/legacy-glTF1FileLoader.js.map +1 -1
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +33 -32
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -2
- package/legacy/legacy-glTF2FileLoader.js.map +1 -1
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -3
- package/legacy/legacy-glTFFileLoader.js.map +1 -1
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +13 -12
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +13 -12
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +8 -6
- package/legacy/legacy.js.map +1 -1
- package/package.json +23 -198
- package/readme.md +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFLoader.js","sourceRoot":"","sources":["../../../../sourceES6/loaders/src/glTF/2.0/glTFLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAExE,OAAO,EAAE,OAAO,EAA2B,MAAM,4CAA4C,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;A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AAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzF,CAAC;IAED;;;OAGG;IACI,4BAAO,GAAd,UAAe,OAAe;QAC1B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,6BAAQ,GAAf;QACI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,wBAAG,GAAV,UAAW,OAAe;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,4CAAuB,GAA9B,UAA+B,WAAmB;QAC9C,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACI,0CAAqB,GAA5B,UAA6B,WAAmB;QAC5C,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;IA96Ec,gCAAqB,GAA6C,EAAE,CAAC;IAEpF;;OAEG;IACoB,yBAAc,GAAa,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC;IA06EpE,iBAAC;CAAA,AAz8ED,IAy8EC;SAz8EY,UAAU;AA28EvB,cAAc,CAAC,kBAAkB,GAAG,UAAC,MAAM,IAAK,OAAA,IAAI,UAAU,CAAC,MAAM,CAAC,EAAtB,CAAsB,CAAC","sourcesContent":["import { IndicesArray, Nullable } from \"@babylonjs/core/types\";\nimport { Deferred } from \"@babylonjs/core/Misc/deferred\";\nimport { Quaternion, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\nimport { FreeCamera } from \"@babylonjs/core/Cameras/freeCamera\";\nimport { AnimationGroup } from \"@babylonjs/core/Animations/animationGroup\";\nimport { Animation } from \"@babylonjs/core/Animations/animation\";\nimport { Bone } from \"@babylonjs/core/Bones/bone\";\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton\";\nimport { Material } from \"@babylonjs/core/Materials/material\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\nimport { BaseTexture } from \"@babylonjs/core/Materials/Textures/baseTexture\";\nimport { Texture, ITextureCreationOptions } from \"@babylonjs/core/Materials/Textures/texture\";\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\nimport { Buffer, VertexBuffer } from \"@babylonjs/core/Buffers/buffer\";\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\nimport { InstancedMesh } from \"@babylonjs/core/Meshes/instancedMesh\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\nimport { MorphTarget } from \"@babylonjs/core/Morph/morphTarget\";\nimport { MorphTargetManager } from \"@babylonjs/core/Morph/morphTargetManager\";\nimport { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from \"@babylonjs/core/Loading/sceneLoader\";\nimport { Scene } from \"@babylonjs/core/scene\";\nimport { IProperty, AccessorType, CameraType, AnimationChannelTargetPath, AnimationSamplerInterpolation, AccessorComponentType, MaterialAlphaMode, TextureMinFilter, TextureWrapMode, TextureMagFilter, MeshPrimitiveMode } from \"babylonjs-gltf2interface\";\nimport { _IAnimationSamplerData, IGLTF, ISampler, INode, IScene, IMesh, IAccessor, ISkin, ICamera, IAnimation, IAnimationChannel, IAnimationSampler, IBuffer, IBufferView, IMaterialPbrMetallicRoughness, IMaterial, ITextureInfo, ITexture, IImage, IMeshPrimitive, IArrayItem as IArrItem, _ISamplerData } from \"./glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"./glTFLoaderExtension\";\nimport { IGLTFLoader, GLTFFileLoader, GLTFLoaderState, IGLTFLoaderData, GLTFLoaderCoordinateSystemMode, GLTFLoaderAnimationStartMode } from \"../glTFFileLoader\";\nimport { IAnimationKey, AnimationKeyInterpolation } from '@babylonjs/core/Animations/animationKey';\nimport { IAnimatable } from '@babylonjs/core/Animations/animatable.interface';\nimport { IDataBuffer } from '@babylonjs/core/Misc/dataReader';\nimport { DecodeBase64UrlToBinary, IsBase64DataUrl, LoadFileError } from '@babylonjs/core/Misc/fileTools';\nimport { Logger } from '@babylonjs/core/Misc/logger';\nimport { Light } from '@babylonjs/core/Lights/light';\nimport { TmpVectors } from '@babylonjs/core/Maths/math.vector';\nimport { BoundingInfo } from '@babylonjs/core/Culling/boundingInfo';\nimport { StringTools } from '@babylonjs/core/Misc/stringTools';\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\n\ninterface TypedArrayLike extends ArrayBufferView {\n readonly length: number;\n [n: number]: number;\n}\n\ninterface TypedArrayConstructor {\n new(length: number): TypedArrayLike;\n new(buffer: ArrayBufferLike, byteOffset: number, length?: number): TypedArrayLike;\n}\n\ninterface ILoaderProperty extends IProperty {\n _activeLoaderExtensionFunctions: {\n [id: string]: boolean\n };\n}\n\ninterface IRegisteredExtension {\n factory: (loader: GLTFLoader) => IGLTFLoaderExtension;\n}\n\n/**\n * Helper class for working with arrays when loading the glTF asset\n */\nexport class ArrayItem {\n /**\n * Gets an item from the given array.\n * @param context The context when loading the asset\n * @param array The array to get the item from\n * @param index The index to the array\n * @returns The array item\n */\n public static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T {\n if (!array || index == undefined || !array[index]) {\n throw new Error(`${context}: Failed to find index (${index})`);\n }\n\n return array[index];\n }\n\n /**\n * Assign an `index` field to each item of the given array.\n * @param array The array of items\n */\n public static Assign(array?: IArrItem[]): void {\n if (array) {\n for (let index = 0; index < array.length; index++) {\n array[index].index = index;\n }\n }\n }\n}\n\n/**\n * The glTF 2.0 loader\n */\nexport class GLTFLoader implements IGLTFLoader {\n /** @hidden */\n public _completePromises = new Array<Promise<any>>();\n\n /** @hidden */\n public _assetContainer: Nullable<AssetContainer> = null;\n\n /** Storage */\n public _babylonLights: Light[] = [];\n\n /** @hidden */\n public _disableInstancedMesh = 0;\n\n private readonly _parent: GLTFFileLoader;\n private readonly _extensions = new Array<IGLTFLoaderExtension>();\n private _disposed = false;\n private _rootUrl: Nullable<string> = null;\n private _fileName: Nullable<string> = null;\n private _uniqueRootUrl: Nullable<string> = null;\n private _gltf: IGLTF;\n private _bin: Nullable<IDataBuffer> = null;\n private _babylonScene: Scene;\n private _rootBabylonMesh: Nullable<Mesh> = null;\n private _defaultBabylonMaterialData: { [drawMode: number]: Material } = {};\n private _postSceneLoadActions = new Array<() => void>();\n\n private static _RegisteredExtensions: { [name: string]: IRegisteredExtension } = {};\n\n /**\n * The default glTF sampler.\n */\n public static readonly DefaultSampler: ISampler = { index: -1 };\n\n /**\n * Registers a loader extension.\n * @param name The name of the loader extension.\n * @param factory The factory function that creates the loader extension.\n */\n public static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void {\n if (GLTFLoader.UnregisterExtension(name)) {\n Logger.Warn(`Extension with the name '${name}' already exists`);\n }\n\n GLTFLoader._RegisteredExtensions[name] = {\n factory: factory\n };\n }\n\n /**\n * Unregisters a loader extension.\n * @param name The name of the loader extension.\n * @returns A boolean indicating whether the extension has been unregistered\n */\n public static UnregisterExtension(name: string): boolean {\n if (!GLTFLoader._RegisteredExtensions[name]) {\n return false;\n }\n\n delete GLTFLoader._RegisteredExtensions[name];\n return true;\n }\n\n /**\n * The object that represents the glTF JSON.\n */\n public get gltf(): IGLTF {\n if (!this._gltf) {\n throw new Error(\"glTF JSON is not available\");\n }\n\n return this._gltf;\n }\n\n /**\n * The BIN chunk of a binary glTF.\n */\n public get bin(): Nullable<IDataBuffer> {\n return this._bin;\n }\n\n /**\n * The parent file loader.\n */\n public get parent(): GLTFFileLoader {\n return this._parent;\n }\n\n /**\n * The Babylon scene when loading the asset.\n */\n public get babylonScene(): Scene {\n if (!this._babylonScene) {\n throw new Error(\"Scene is not available\");\n }\n\n return this._babylonScene;\n }\n\n /**\n * The root Babylon mesh when loading the asset.\n */\n public get rootBabylonMesh(): Nullable<Mesh> {\n return this._rootBabylonMesh;\n }\n\n /** @hidden */\n constructor(parent: GLTFFileLoader) {\n this._parent = parent;\n }\n\n /** @hidden */\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n\n this._disposed = true;\n\n this._completePromises.length = 0;\n\n this._extensions.forEach((extension) => extension.dispose && extension.dispose());\n this._extensions.length = 0;\n\n (this._gltf as Nullable<IGLTF>) = null; // TODO\n this._bin = null;\n (this._babylonScene as Nullable<Scene>) = null; // TODO\n this._rootBabylonMesh = null;\n this._defaultBabylonMaterialData = {};\n this._postSceneLoadActions.length = 0;\n\n this._parent.dispose();\n }\n\n /** @hidden */\n public importMeshAsync(meshesNames: any, scene: Scene, container: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName = \"\"): Promise<ISceneLoaderAsyncResult> {\n return Promise.resolve().then(() => {\n this._babylonScene = scene;\n this._assetContainer = container;\n this._loadData(data);\n\n let nodes: Nullable<Array<number>> = null;\n\n if (meshesNames) {\n const nodeMap: { [name: string]: number } = {};\n if (this._gltf.nodes) {\n for (const node of this._gltf.nodes) {\n if (node.name) {\n nodeMap[node.name] = node.index;\n }\n }\n }\n\n const names = (meshesNames instanceof Array) ? meshesNames : [meshesNames];\n nodes = names.map((name) => {\n const node = nodeMap[name];\n if (node === undefined) {\n throw new Error(`Failed to find node '${name}'`);\n }\n\n return node;\n });\n }\n\n return this._loadAsync(rootUrl, fileName, nodes, () => {\n return {\n meshes: this._getMeshes(),\n particleSystems: [],\n skeletons: this._getSkeletons(),\n animationGroups: this._getAnimationGroups(),\n lights: this._babylonLights,\n transformNodes: this._getTransformNodes(),\n geometries: this._getGeometries()\n };\n });\n });\n }\n\n /** @hidden */\n public loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName = \"\"): Promise<void> {\n return Promise.resolve().then(() => {\n this._babylonScene = scene;\n this._loadData(data);\n return this._loadAsync(rootUrl, fileName, null, () => undefined);\n });\n }\n\n private _loadAsync<T>(rootUrl: string, fileName: string, nodes: Nullable<Array<number>>, resultFunc: () => T): Promise<T> {\n return Promise.resolve().then(() => {\n this._rootUrl = rootUrl;\n this._uniqueRootUrl = (!StringTools.StartsWith(rootUrl, \"file:\") && fileName) ? rootUrl : `${rootUrl}${Date.now()}/`;\n this._fileName = fileName;\n\n this._loadExtensions();\n this._checkExtensions();\n\n const loadingToReadyCounterName = `${GLTFLoaderState[GLTFLoaderState.LOADING]} => ${GLTFLoaderState[GLTFLoaderState.READY]}`;\n const loadingToCompleteCounterName = `${GLTFLoaderState[GLTFLoaderState.LOADING]} => ${GLTFLoaderState[GLTFLoaderState.COMPLETE]}`;\n\n this._parent._startPerformanceCounter(loadingToReadyCounterName);\n this._parent._startPerformanceCounter(loadingToCompleteCounterName);\n\n this._parent._setState(GLTFLoaderState.LOADING);\n this._extensionsOnLoading();\n\n const promises = new Array<Promise<any>>();\n\n // Block the marking of materials dirty until the scene is loaded.\n const oldBlockMaterialDirtyMechanism = this._babylonScene.blockMaterialDirtyMechanism;\n this._babylonScene.blockMaterialDirtyMechanism = true;\n\n if (nodes) {\n promises.push(this.loadSceneAsync(\"/nodes\", { nodes: nodes, index: -1 }));\n }\n else if (this._gltf.scene != undefined || (this._gltf.scenes && this._gltf.scenes[0])) {\n const scene = ArrayItem.Get(`/scene`, this._gltf.scenes, this._gltf.scene || 0);\n promises.push(this.loadSceneAsync(`/scenes/${scene.index}`, scene));\n }\n\n if (this.parent.loadAllMaterials && this._gltf.materials) {\n for (let m = 0; m < this._gltf.materials.length; ++m) {\n const material = this._gltf.materials[m];\n const context = \"/materials/\" + m;\n const babylonDrawMode = Material.TriangleFillMode;\n\n promises.push(this._loadMaterialAsync(context, material, null, babylonDrawMode, (material) => { }));\n }\n }\n\n // Restore the blocking of material dirty.\n this._babylonScene.blockMaterialDirtyMechanism = oldBlockMaterialDirtyMechanism;\n\n if (this._parent.compileMaterials) {\n promises.push(this._compileMaterialsAsync());\n }\n\n if (this._parent.compileShadowGenerators) {\n promises.push(this._compileShadowGeneratorsAsync());\n }\n\n const resultPromise = Promise.all(promises).then(() => {\n if (this._rootBabylonMesh) {\n this._rootBabylonMesh.setEnabled(true);\n }\n\n this._extensionsOnReady();\n this._parent._setState(GLTFLoaderState.READY);\n\n this._startAnimations();\n\n return resultFunc();\n });\n\n return resultPromise.then((result) => {\n this._parent._endPerformanceCounter(loadingToReadyCounterName);\n\n Tools.SetImmediate(() => {\n if (!this._disposed) {\n Promise.all(this._completePromises).then(() => {\n this._parent._endPerformanceCounter(loadingToCompleteCounterName);\n\n this._parent._setState(GLTFLoaderState.COMPLETE);\n\n this._parent.onCompleteObservable.notifyObservers(undefined);\n this._parent.onCompleteObservable.clear();\n\n this.dispose();\n }, (error) => {\n this._parent.onErrorObservable.notifyObservers(error);\n this._parent.onErrorObservable.clear();\n\n this.dispose();\n });\n }\n });\n\n return result;\n });\n }).catch((error) => {\n if (!this._disposed) {\n this._parent.onErrorObservable.notifyObservers(error);\n this._parent.onErrorObservable.clear();\n\n this.dispose();\n }\n\n throw error;\n });\n }\n\n private _loadData(data: IGLTFLoaderData): void {\n this._gltf = data.json as IGLTF;\n this._setupData();\n\n if (data.bin) {\n const buffers = this._gltf.buffers;\n if (buffers && buffers[0] && !buffers[0].uri) {\n const binaryBuffer = buffers[0];\n if (binaryBuffer.byteLength < data.bin.byteLength - 3 || binaryBuffer.byteLength > data.bin.byteLength) {\n Logger.Warn(`Binary buffer length (${binaryBuffer.byteLength}) from JSON does not match chunk length (${data.bin.byteLength})`);\n }\n\n this._bin = data.bin;\n }\n else {\n Logger.Warn(\"Unexpected BIN chunk\");\n }\n }\n }\n\n private _setupData(): void {\n ArrayItem.Assign(this._gltf.accessors);\n ArrayItem.Assign(this._gltf.animations);\n ArrayItem.Assign(this._gltf.buffers);\n ArrayItem.Assign(this._gltf.bufferViews);\n ArrayItem.Assign(this._gltf.cameras);\n ArrayItem.Assign(this._gltf.images);\n ArrayItem.Assign(this._gltf.materials);\n ArrayItem.Assign(this._gltf.meshes);\n ArrayItem.Assign(this._gltf.nodes);\n ArrayItem.Assign(this._gltf.samplers);\n ArrayItem.Assign(this._gltf.scenes);\n ArrayItem.Assign(this._gltf.skins);\n ArrayItem.Assign(this._gltf.textures);\n\n if (this._gltf.nodes) {\n const nodeParents: { [index: number]: number } = {};\n for (const node of this._gltf.nodes) {\n if (node.children) {\n for (const index of node.children) {\n nodeParents[index] = node.index;\n }\n }\n }\n\n const rootNode = this._createRootNode();\n for (const node of this._gltf.nodes) {\n const parentIndex = nodeParents[node.index];\n node.parent = parentIndex === undefined ? rootNode : this._gltf.nodes[parentIndex];\n }\n }\n }\n\n private _loadExtensions(): void {\n for (const name in GLTFLoader._RegisteredExtensions) {\n const extension = GLTFLoader._RegisteredExtensions[name].factory(this);\n if (extension.name !== name) {\n Logger.Warn(`The name of the glTF loader extension instance does not match the registered name: ${extension.name} !== ${name}`);\n }\n\n this._extensions.push(extension);\n this._parent.onExtensionLoadedObservable.notifyObservers(extension);\n }\n\n this._extensions.sort((a, b) => (a.order || Number.MAX_VALUE) - (b.order || Number.MAX_VALUE));\n this._parent.onExtensionLoadedObservable.clear();\n }\n\n private _checkExtensions(): void {\n if (this._gltf.extensionsRequired) {\n for (const name of this._gltf.extensionsRequired) {\n const available = this._extensions.some((extension) => extension.name === name && extension.enabled);\n if (!available) {\n throw new Error(`Require extension ${name} is not available`);\n }\n }\n }\n }\n\n private _createRootNode(): INode {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n this._rootBabylonMesh = new Mesh(\"__root__\", this._babylonScene);\n this._rootBabylonMesh._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n this._rootBabylonMesh.setEnabled(false);\n\n const rootNode: INode = {\n _babylonTransformNode: this._rootBabylonMesh,\n index: -1\n };\n\n switch (this._parent.coordinateSystemMode) {\n case GLTFLoaderCoordinateSystemMode.AUTO: {\n if (!this._babylonScene.useRightHandedSystem) {\n rootNode.rotation = [0, 1, 0, 0];\n rootNode.scale = [1, 1, -1];\n GLTFLoader._LoadTransform(rootNode, this._rootBabylonMesh);\n }\n break;\n }\n case GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED: {\n this._babylonScene.useRightHandedSystem = true;\n break;\n }\n default: {\n throw new Error(`Invalid coordinate system mode (${this._parent.coordinateSystemMode})`);\n }\n }\n\n this._parent.onMeshLoadedObservable.notifyObservers(this._rootBabylonMesh);\n return rootNode;\n }\n\n /**\n * Loads a glTF scene.\n * @param context The context when loading the asset\n * @param scene The glTF scene property\n * @returns A promise that resolves when the load is complete\n */\n public loadSceneAsync(context: string, scene: IScene): Promise<void> {\n const extensionPromise = this._extensionsLoadSceneAsync(context, scene);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n const promises = new Array<Promise<any>>();\n\n this.logOpen(`${context} ${scene.name || \"\"}`);\n\n if (scene.nodes) {\n for (let index of scene.nodes) {\n const node = ArrayItem.Get(`${context}/nodes/${index}`, this._gltf.nodes, index);\n promises.push(this.loadNodeAsync(`/nodes/${node.index}`, node, (babylonMesh) => {\n babylonMesh.parent = this._rootBabylonMesh;\n }));\n }\n }\n\n for (const action of this._postSceneLoadActions) {\n action();\n }\n\n promises.push(this._loadAnimationsAsync());\n\n this.logClose();\n\n return Promise.all(promises).then(() => { });\n }\n\n private _forEachPrimitive(node: INode, callback: (babylonMesh: AbstractMesh) => void): void {\n if (node._primitiveBabylonMeshes) {\n for (const babylonMesh of node._primitiveBabylonMeshes) {\n callback(babylonMesh);\n }\n }\n }\n\n private _getGeometries(): Geometry[] {\n const geometries = new Array<Geometry>();\n\n const nodes = this._gltf.nodes;\n if (nodes) {\n for (const node of nodes) {\n this._forEachPrimitive(node, (babylonMesh) => {\n const geometry = (babylonMesh as Mesh).geometry;\n if (geometry && geometries.indexOf(geometry) === -1) {\n geometries.push(geometry);\n }\n });\n }\n }\n\n return geometries;\n }\n\n private _getMeshes(): AbstractMesh[] {\n const meshes = new Array<AbstractMesh>();\n\n // Root mesh is always first, if available.\n if (this._rootBabylonMesh) {\n meshes.push(this._rootBabylonMesh);\n }\n\n const nodes = this._gltf.nodes;\n if (nodes) {\n for (const node of nodes) {\n this._forEachPrimitive(node, (babylonMesh) => {\n meshes.push(babylonMesh);\n });\n }\n }\n\n return meshes;\n }\n\n private _getTransformNodes(): TransformNode[] {\n const transformNodes = new Array<TransformNode>();\n\n const nodes = this._gltf.nodes;\n if (nodes) {\n for (const node of nodes) {\n if (node._babylonTransformNode && node._babylonTransformNode.getClassName() === \"TransformNode\") {\n transformNodes.push(node._babylonTransformNode);\n }\n }\n }\n\n return transformNodes;\n }\n\n private _getSkeletons(): Skeleton[] {\n const skeletons = new Array<Skeleton>();\n\n const skins = this._gltf.skins;\n if (skins) {\n for (const skin of skins) {\n if (skin._data) {\n skeletons.push(skin._data.babylonSkeleton);\n }\n }\n }\n\n return skeletons;\n }\n\n private _getAnimationGroups(): AnimationGroup[] {\n const animationGroups = new Array<AnimationGroup>();\n\n const animations = this._gltf.animations;\n if (animations) {\n for (const animation of animations) {\n if (animation._babylonAnimationGroup) {\n animationGroups.push(animation._babylonAnimationGroup);\n }\n }\n }\n\n return animationGroups;\n }\n\n private _startAnimations(): void {\n switch (this._parent.animationStartMode) {\n case GLTFLoaderAnimationStartMode.NONE: {\n // do nothing\n break;\n }\n case GLTFLoaderAnimationStartMode.FIRST: {\n const babylonAnimationGroups = this._getAnimationGroups();\n if (babylonAnimationGroups.length !== 0) {\n babylonAnimationGroups[0].start(true);\n }\n break;\n }\n case GLTFLoaderAnimationStartMode.ALL: {\n const babylonAnimationGroups = this._getAnimationGroups();\n for (const babylonAnimationGroup of babylonAnimationGroups) {\n babylonAnimationGroup.start(true);\n }\n break;\n }\n default: {\n Logger.Error(`Invalid animation start mode (${this._parent.animationStartMode})`);\n return;\n }\n }\n }\n\n /**\n * Loads a glTF node.\n * @param context The context when loading the asset\n * @param node The glTF node property\n * @param assign A function called synchronously after parsing the glTF properties\n * @returns A promise that resolves with the loaded Babylon mesh when the load is complete\n */\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void = () => { }): Promise<TransformNode> {\n const extensionPromise = this._extensionsLoadNodeAsync(context, node, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n if (node._babylonTransformNode) {\n throw new Error(`${context}: Invalid recursive node hierarchy`);\n }\n\n const promises = new Array<Promise<any>>();\n\n this.logOpen(`${context} ${node.name || \"\"}`);\n\n const loadNode = (babylonTransformNode: TransformNode) => {\n GLTFLoader.AddPointerMetadata(babylonTransformNode, context);\n GLTFLoader._LoadTransform(node, babylonTransformNode);\n\n if (node.camera != undefined) {\n const camera = ArrayItem.Get(`${context}/camera`, this._gltf.cameras, node.camera);\n promises.push(this.loadCameraAsync(`/cameras/${camera.index}`, camera, (babylonCamera) => {\n babylonCamera.parent = babylonTransformNode;\n }));\n }\n\n if (node.children) {\n for (const index of node.children) {\n const childNode = ArrayItem.Get(`${context}/children/${index}`, this._gltf.nodes, index);\n promises.push(this.loadNodeAsync(`/nodes/${childNode.index}`, childNode, (childBabylonMesh) => {\n childBabylonMesh.parent = babylonTransformNode;\n }));\n }\n }\n\n assign(babylonTransformNode);\n };\n\n if (node.mesh == undefined || node.skin != undefined) {\n const nodeName = node.name || `node${node.index}`;\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n node._babylonTransformNode = new TransformNode(nodeName, this._babylonScene);\n node._babylonTransformNode._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n loadNode(node._babylonTransformNode);\n }\n\n if (node.mesh != undefined) {\n if (node.skin == undefined) {\n const mesh = ArrayItem.Get(`${context}/mesh`, this._gltf.meshes, node.mesh);\n promises.push(this._loadMeshAsync(`/meshes/${mesh.index}`, node, mesh, loadNode));\n } else {\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\n // This code path will place the skinned mesh as a sibling of the skeleton root node without loading the\n // transform, which effectively ignores the transform of the skinned mesh, as per spec.\n\n const mesh = ArrayItem.Get(`${context}/mesh`, this._gltf.meshes, node.mesh);\n promises.push(this._loadMeshAsync(`/meshes/${mesh.index}`, node, mesh, (babylonTransformNode) => {\n GLTFLoader.AddPointerMetadata(babylonTransformNode, context);\n\n const skin = ArrayItem.Get(`${context}/skin`, this._gltf.skins, node.skin);\n promises.push(this._loadSkinAsync(`/skins/${skin.index}`, node, skin, (babylonSkeleton) => {\n this._forEachPrimitive(node, (babylonMesh) => {\n babylonMesh.skeleton = babylonSkeleton;\n });\n\n // Wait until the scene is loaded to ensure the skeleton root node has been loaded.\n this._postSceneLoadActions.push(() => {\n if (skin.skeleton != undefined) {\n // Place the skinned mesh node as a sibling of the skeleton root node.\n const skeletonRootNode = ArrayItem.Get(`/skins/${skin.index}/skeleton`, this._gltf.nodes, skin.skeleton);\n babylonTransformNode.parent = skeletonRootNode.parent!._babylonTransformNode!;\n } else {\n babylonTransformNode.parent = this._rootBabylonMesh;\n }\n });\n }));\n }));\n }\n }\n\n this.logClose();\n\n return Promise.all(promises).then(() => {\n this._forEachPrimitive(node, (babylonMesh) => {\n if ((babylonMesh as Mesh).geometry && (babylonMesh as Mesh).geometry!.useBoundingInfoFromGeometry) {\n // simply apply the world matrices to the bounding info - the extends are already ok\n babylonMesh._updateBoundingInfo();\n } else {\n babylonMesh.refreshBoundingInfo(true);\n }\n });\n\n return node._babylonTransformNode!;\n });\n }\n\n private _loadMeshAsync(context: string, node: INode, mesh: IMesh, assign: (babylonTransformNode: TransformNode) => void): Promise<TransformNode> {\n const primitives = mesh.primitives;\n if (!primitives || !primitives.length) {\n throw new Error(`${context}: Primitives are missing`);\n }\n\n if (primitives[0].index == undefined) {\n ArrayItem.Assign(primitives);\n }\n\n const promises = new Array<Promise<any>>();\n\n this.logOpen(`${context} ${mesh.name || \"\"}`);\n\n const name = node.name || `node${node.index}`;\n\n if (primitives.length === 1) {\n const primitive = mesh.primitives[0];\n promises.push(this._loadMeshPrimitiveAsync(`${context}/primitives/${primitive.index}`, name, node, mesh, primitive, (babylonMesh) => {\n node._babylonTransformNode = babylonMesh;\n node._primitiveBabylonMeshes = [babylonMesh];\n }));\n }\n else {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n node._babylonTransformNode = new TransformNode(name, this._babylonScene);\n node._babylonTransformNode._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n node._primitiveBabylonMeshes = [];\n for (const primitive of primitives) {\n promises.push(this._loadMeshPrimitiveAsync(`${context}/primitives/${primitive.index}`, `${name}_primitive${primitive.index}`, node, mesh, primitive, (babylonMesh) => {\n babylonMesh.parent = node._babylonTransformNode!;\n node._primitiveBabylonMeshes!.push(babylonMesh);\n }));\n }\n }\n\n assign(node._babylonTransformNode!);\n\n this.logClose();\n\n return Promise.all(promises).then(() => {\n return node._babylonTransformNode!;\n });\n }\n\n /**\n * @hidden Define this method to modify the default behavior when loading data for mesh primitives.\n * @param context The context when loading the asset\n * @param name The mesh name when loading the asset\n * @param node The glTF node when loading the asset\n * @param mesh The glTF mesh when loading the asset\n * @param primitive The glTF mesh primitive property\n * @param assign A function called synchronously after parsing the glTF properties\n * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled\n */\n public _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh> {\n const extensionPromise = this._extensionsLoadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n this.logOpen(`${context}`);\n\n const shouldInstance = (this._disableInstancedMesh === 0) && this._parent.createInstances && (node.skin == undefined && !mesh.primitives[0].targets);\n\n let babylonAbstractMesh: AbstractMesh;\n let promise: Promise<any>;\n\n if (shouldInstance && primitive._instanceData) {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n babylonAbstractMesh = primitive._instanceData.babylonSourceMesh.createInstance(name) as InstancedMesh;\n babylonAbstractMesh._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n promise = primitive._instanceData.promise;\n }\n else {\n const promises = new Array<Promise<any>>();\n\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonMesh = new Mesh(name, this._babylonScene);\n babylonMesh._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n babylonMesh.overrideMaterialSideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n\n this._createMorphTargets(context, node, mesh, primitive, babylonMesh);\n promises.push(this._loadVertexDataAsync(context, primitive, babylonMesh).then((babylonGeometry) => {\n return this._loadMorphTargetsAsync(context, primitive, babylonMesh, babylonGeometry).then(() => {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n babylonGeometry.applyToMesh(babylonMesh);\n babylonGeometry._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n });\n }));\n\n const babylonDrawMode = GLTFLoader._GetDrawMode(context, primitive.mode);\n if (primitive.material == undefined) {\n let babylonMaterial = this._defaultBabylonMaterialData[babylonDrawMode];\n if (!babylonMaterial) {\n babylonMaterial = this._createDefaultMaterial(\"__GLTFLoader._default\", babylonDrawMode);\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\n this._defaultBabylonMaterialData[babylonDrawMode] = babylonMaterial;\n }\n babylonMesh.material = babylonMaterial;\n }\n else {\n const material = ArrayItem.Get(`${context}/material`, this._gltf.materials, primitive.material);\n promises.push(this._loadMaterialAsync(`/materials/${material.index}`, material, babylonMesh, babylonDrawMode, (babylonMaterial) => {\n babylonMesh.material = babylonMaterial;\n }));\n }\n\n promise = Promise.all(promises);\n\n if (shouldInstance) {\n primitive._instanceData = {\n babylonSourceMesh: babylonMesh,\n promise: promise\n };\n }\n\n babylonAbstractMesh = babylonMesh;\n }\n\n GLTFLoader.AddPointerMetadata(babylonAbstractMesh, context);\n this._parent.onMeshLoadedObservable.notifyObservers(babylonAbstractMesh);\n assign(babylonAbstractMesh);\n\n this.logClose();\n\n return promise.then(() => {\n return babylonAbstractMesh;\n });\n }\n\n private _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Promise<Geometry> {\n const extensionPromise = this._extensionsLoadVertexDataAsync(context, primitive, babylonMesh);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n const attributes = primitive.attributes;\n if (!attributes) {\n throw new Error(`${context}: Attributes are missing`);\n }\n\n const promises = new Array<Promise<any>>();\n\n const babylonGeometry = new Geometry(babylonMesh.name, this._babylonScene);\n\n if (primitive.indices == undefined) {\n babylonMesh.isUnIndexed = true;\n }\n else {\n const accessor = ArrayItem.Get(`${context}/indices`, this._gltf.accessors, primitive.indices);\n promises.push(this._loadIndicesAccessorAsync(`/accessors/${accessor.index}`, accessor).then((data) => {\n babylonGeometry.setIndices(data);\n }));\n }\n\n const loadAttribute = (attribute: string, kind: string, callback?: (accessor: IAccessor) => void) => {\n if (attributes[attribute] == undefined) {\n return;\n }\n\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\n babylonMesh._delayInfo.push(kind);\n }\n\n const accessor = ArrayItem.Get(`${context}/attributes/${attribute}`, this._gltf.accessors, attributes[attribute]);\n promises.push(this._loadVertexAccessorAsync(`/accessors/${accessor.index}`, accessor, kind).then((babylonVertexBuffer) => {\n if (babylonVertexBuffer.getKind() === VertexBuffer.PositionKind && !this.parent.alwaysComputeBoundingBox && !babylonMesh.skeleton) {\n const mmin = accessor.min as [number, number, number], mmax = accessor.max as [number, number, number];\n if (mmin !== undefined && mmax !== undefined) {\n if (accessor.normalized && accessor.componentType !== AccessorComponentType.FLOAT) {\n let divider = 1;\n switch (accessor.componentType) {\n case AccessorComponentType.BYTE:\n divider = 127.0;\n break;\n case AccessorComponentType.UNSIGNED_BYTE:\n divider = 255.0;\n break;\n case AccessorComponentType.SHORT:\n divider = 32767.0;\n break;\n case AccessorComponentType.UNSIGNED_SHORT:\n divider = 65535.0;\n break;\n }\n for (let i = 0; i < 3; ++i) {\n mmin[i] = Math.max(mmin[i] / divider, -1.0);\n mmax[i] = Math.max(mmax[i] / divider, -1.0);\n }\n }\n const min = TmpVectors.Vector3[0], max = TmpVectors.Vector3[1];\n min.copyFromFloats(...mmin);\n max.copyFromFloats(...mmax);\n babylonGeometry._boundingInfo = new BoundingInfo(min, max);\n babylonGeometry.useBoundingInfoFromGeometry = true;\n }\n }\n babylonGeometry.setVerticesBuffer(babylonVertexBuffer, accessor.count);\n }));\n\n if (kind == VertexBuffer.MatricesIndicesExtraKind) {\n babylonMesh.numBoneInfluencers = 8;\n }\n\n if (callback) {\n callback(accessor);\n }\n };\n\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\n loadAttribute(\"JOINTS_1\", VertexBuffer.MatricesIndicesExtraKind);\n loadAttribute(\"WEIGHTS_1\", VertexBuffer.MatricesWeightsExtraKind);\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind, (accessor) => {\n if (accessor.type === AccessorType.VEC4) {\n babylonMesh.hasVertexAlpha = true;\n }\n });\n\n return Promise.all(promises).then(() => {\n return babylonGeometry;\n });\n }\n\n private _createMorphTargets(context: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, babylonMesh: Mesh): void {\n if (!primitive.targets) {\n return;\n }\n\n if (node._numMorphTargets == undefined) {\n node._numMorphTargets = primitive.targets.length;\n }\n else if (primitive.targets.length !== node._numMorphTargets) {\n throw new Error(`${context}: Primitives do not have the same number of targets`);\n }\n\n const targetNames = mesh.extras ? mesh.extras.targetNames : null;\n\n babylonMesh.morphTargetManager = new MorphTargetManager(babylonMesh.getScene());\n babylonMesh.morphTargetManager.areUpdatesFrozen = true;\n\n for (let index = 0; index < primitive.targets.length; index++) {\n const weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;\n const name = targetNames ? targetNames[index] : `morphTarget${index}`;\n babylonMesh.morphTargetManager.addTarget(new MorphTarget(name, weight, babylonMesh.getScene()));\n // TODO: tell the target whether it has positions, normals, tangents\n }\n }\n\n private _loadMorphTargetsAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh, babylonGeometry: Geometry): Promise<void> {\n if (!primitive.targets) {\n return Promise.resolve();\n }\n\n const promises = new Array<Promise<any>>();\n\n const morphTargetManager = babylonMesh.morphTargetManager!;\n for (let index = 0; index < morphTargetManager.numTargets; index++) {\n const babylonMorphTarget = morphTargetManager.getTarget(index);\n promises.push(this._loadMorphTargetVertexDataAsync(`${context}/targets/${index}`, babylonGeometry, primitive.targets[index], babylonMorphTarget));\n }\n\n return Promise.all(promises).then(() => {\n morphTargetManager.areUpdatesFrozen = false;\n });\n }\n\n private _loadMorphTargetVertexDataAsync(context: string, babylonGeometry: Geometry, attributes: { [name: string]: number }, babylonMorphTarget: MorphTarget): Promise<void> {\n const promises = new Array<Promise<any>>();\n\n const loadAttribute = (attribute: string, kind: string, setData: (babylonVertexBuffer: VertexBuffer, data: Float32Array) => void) => {\n if (attributes[attribute] == undefined) {\n return;\n }\n\n const babylonVertexBuffer = babylonGeometry.getVertexBuffer(kind);\n if (!babylonVertexBuffer) {\n return;\n }\n\n const accessor = ArrayItem.Get(`${context}/${attribute}`, this._gltf.accessors, attributes[attribute]);\n promises.push(this._loadFloatAccessorAsync(`/accessors/${accessor.index}`, accessor).then((data) => {\n setData(babylonVertexBuffer, data);\n }));\n };\n\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind, (babylonVertexBuffer, data) => {\n const positions = new Float32Array(data.length);\n babylonVertexBuffer.forEach(data.length, (value, index) => {\n positions[index] = data[index] + value;\n });\n\n babylonMorphTarget.setPositions(positions);\n });\n\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind, (babylonVertexBuffer, data) => {\n const normals = new Float32Array(data.length);\n babylonVertexBuffer.forEach(normals.length, (value, index) => {\n normals[index] = data[index] + value;\n });\n\n babylonMorphTarget.setNormals(normals);\n });\n\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind, (babylonVertexBuffer, data) => {\n const tangents = new Float32Array(data.length / 3 * 4);\n let dataIndex = 0;\n babylonVertexBuffer.forEach(data.length / 3 * 4, (value, index) => {\n // Tangent data for morph targets is stored as xyz delta.\n // The vertexData.tangent is stored as xyzw.\n // So we need to skip every fourth vertexData.tangent.\n if (((index + 1) % 4) !== 0) {\n tangents[dataIndex] = data[dataIndex] + value;\n dataIndex++;\n }\n });\n babylonMorphTarget.setTangents(tangents);\n });\n\n return Promise.all(promises).then(() => { });\n }\n\n private static _LoadTransform(node: INode, babylonNode: TransformNode): void {\n // Ignore the TRS of skinned nodes.\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\n if (node.skin != undefined) {\n return;\n }\n\n let position = Vector3.Zero();\n let rotation = Quaternion.Identity();\n let scaling = Vector3.One();\n\n if (node.matrix) {\n const matrix = Matrix.FromArray(node.matrix);\n matrix.decompose(scaling, rotation, position);\n }\n else {\n if (node.translation) { position = Vector3.FromArray(node.translation); }\n if (node.rotation) { rotation = Quaternion.FromArray(node.rotation); }\n if (node.scale) { scaling = Vector3.FromArray(node.scale); }\n }\n\n babylonNode.position = position;\n babylonNode.rotationQuaternion = rotation;\n babylonNode.scaling = scaling;\n }\n\n private _loadSkinAsync(context: string, node: INode, skin: ISkin, assign: (babylonSkeleton: Skeleton) => void): Promise<void> {\n const extensionPromise = this._extensionsLoadSkinAsync(context, node, skin);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n if (skin._data) {\n assign(skin._data.babylonSkeleton);\n return skin._data.promise;\n }\n\n const skeletonId = `skeleton${skin.index}`;\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonSkeleton = new Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);\n babylonSkeleton._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n\n this._loadBones(context, skin, babylonSkeleton);\n const promise = this._loadSkinInverseBindMatricesDataAsync(context, skin).then((inverseBindMatricesData) => {\n this._updateBoneMatrices(babylonSkeleton, inverseBindMatricesData);\n });\n\n skin._data = {\n babylonSkeleton: babylonSkeleton,\n promise: promise\n };\n\n assign(babylonSkeleton);\n\n return promise;\n }\n\n private _loadBones(context: string, skin: ISkin, babylonSkeleton: Skeleton): void {\n if (skin.skeleton == undefined || this._parent.alwaysComputeSkeletonRootNode) {\n const rootNode = this._findSkeletonRootNode(`${context}/joints`, skin.joints);\n if (rootNode) {\n if (skin.skeleton === undefined) {\n skin.skeleton = rootNode.index;\n } else {\n const isParent = (a: INode, b: INode): boolean => {\n for (; b.parent; b = b.parent) {\n if (b.parent === a) {\n return true;\n }\n }\n\n return false;\n };\n\n const skeletonNode = ArrayItem.Get(`${context}/skeleton`, this._gltf.nodes, skin.skeleton);\n if (skeletonNode !== rootNode && !isParent(skeletonNode, rootNode)) {\n Logger.Warn(`${context}/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root`);\n skin.skeleton = rootNode.index;\n }\n }\n } else {\n Logger.Warn(`${context}: Failed to find common root`);\n }\n }\n\n const babylonBones: { [index: number]: Bone } = {};\n for (const index of skin.joints) {\n const node = ArrayItem.Get(`${context}/joints/${index}`, this._gltf.nodes, index);\n this._loadBone(node, skin, babylonSkeleton, babylonBones);\n }\n }\n\n private _findSkeletonRootNode(context: string, joints: Array<number>): Nullable<INode> {\n const paths: { [joint: number]: Array<INode> } = {};\n for (const index of joints) {\n const path = new Array<INode>();\n let node = ArrayItem.Get(`${context}/${index}`, this._gltf.nodes, index);\n while (node.index !== -1) {\n path.unshift(node);\n node = node.parent!;\n }\n paths[index] = path;\n }\n\n let rootNode: Nullable<INode> = null;\n for (let i = 0;; ++i) {\n let path = paths[joints[0]];\n if (i >= path.length) {\n return rootNode;\n }\n\n const node = path[i];\n for (let j = 1; j < joints.length; ++j) {\n path = paths[joints[j]];\n if (i >= path.length || node !== path[i]) {\n return rootNode;\n }\n }\n\n rootNode = node;\n }\n }\n\n private _loadBone(node: INode, skin: ISkin, babylonSkeleton: Skeleton, babylonBones: { [index: number]: Bone }): Bone {\n let babylonBone = babylonBones[node.index];\n if (babylonBone) {\n return babylonBone;\n }\n\n let parentBabylonBone: Nullable<Bone> = null;\n if (node.index !== skin.skeleton) {\n if (node.parent && node.parent.index !== -1) {\n parentBabylonBone = this._loadBone(node.parent, skin, babylonSkeleton, babylonBones);\n } else if (skin.skeleton !== undefined) {\n Logger.Warn(`/skins/${skin.index}/skeleton: Skeleton node is not a common root`);\n }\n }\n\n const boneIndex = skin.joints.indexOf(node.index);\n babylonBone = new Bone(node.name || `joint${node.index}`, babylonSkeleton, parentBabylonBone, this._getNodeMatrix(node), null, null, boneIndex);\n babylonBones[node.index] = babylonBone;\n\n // Wait until the scene is loaded to ensure the transform nodes are loaded.\n this._postSceneLoadActions.push(() => {\n // Link the Babylon bone with the corresponding Babylon transform node.\n // A glTF joint is a pointer to a glTF node in the glTF node hierarchy similar to Unity3D.\n babylonBone.linkTransformNode(node._babylonTransformNode!);\n });\n\n return babylonBone;\n }\n\n private _loadSkinInverseBindMatricesDataAsync(context: string, skin: ISkin): Promise<Nullable<Float32Array>> {\n if (skin.inverseBindMatrices == undefined) {\n return Promise.resolve(null);\n }\n\n const accessor = ArrayItem.Get(`${context}/inverseBindMatrices`, this._gltf.accessors, skin.inverseBindMatrices);\n return this._loadFloatAccessorAsync(`/accessors/${accessor.index}`, accessor);\n }\n\n private _updateBoneMatrices(babylonSkeleton: Skeleton, inverseBindMatricesData: Nullable<Float32Array>): void {\n for (const babylonBone of babylonSkeleton.bones) {\n let baseMatrix = Matrix.Identity();\n const boneIndex = babylonBone._index!;\n if (inverseBindMatricesData && boneIndex !== -1) {\n Matrix.FromArrayToRef(inverseBindMatricesData, boneIndex * 16, baseMatrix);\n baseMatrix.invertToRef(baseMatrix);\n }\n\n const babylonParentBone = babylonBone.getParent();\n if (babylonParentBone) {\n baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);\n }\n\n babylonBone.updateMatrix(baseMatrix, false, false);\n babylonBone._updateDifferenceMatrix(undefined, false);\n }\n }\n\n private _getNodeMatrix(node: INode): Matrix {\n return node.matrix ?\n Matrix.FromArray(node.matrix) :\n Matrix.Compose(\n node.scale ? Vector3.FromArray(node.scale) : Vector3.One(),\n node.rotation ? Quaternion.FromArray(node.rotation) : Quaternion.Identity(),\n node.translation ? Vector3.FromArray(node.translation) : Vector3.Zero());\n }\n\n /**\n * Loads a glTF camera.\n * @param context The context when loading the asset\n * @param camera The glTF camera property\n * @param assign A function called synchronously after parsing the glTF properties\n * @returns A promise that resolves with the loaded Babylon camera when the load is complete\n */\n public loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void = () => { }): Promise<Camera> {\n const extensionPromise = this._extensionsLoadCameraAsync(context, camera, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n const promises = new Array<Promise<any>>();\n\n this.logOpen(`${context} ${camera.name || \"\"}`);\n\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonCamera = new FreeCamera(camera.name || `camera${camera.index}`, Vector3.Zero(), this._babylonScene, false);\n babylonCamera._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n babylonCamera.ignoreParentScaling = true;\n\n babylonCamera.rotation = new Vector3(0, Math.PI, 0);\n\n switch (camera.type) {\n case CameraType.PERSPECTIVE: {\n const perspective = camera.perspective;\n if (!perspective) {\n throw new Error(`${context}: Camera perspective properties are missing`);\n }\n\n babylonCamera.fov = perspective.yfov;\n babylonCamera.minZ = perspective.znear;\n babylonCamera.maxZ = perspective.zfar || 0;\n break;\n }\n case CameraType.ORTHOGRAPHIC: {\n if (!camera.orthographic) {\n throw new Error(`${context}: Camera orthographic properties are missing`);\n }\n\n babylonCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\n babylonCamera.orthoLeft = -camera.orthographic.xmag;\n babylonCamera.orthoRight = camera.orthographic.xmag;\n babylonCamera.orthoBottom = -camera.orthographic.ymag;\n babylonCamera.orthoTop = camera.orthographic.ymag;\n babylonCamera.minZ = camera.orthographic.znear;\n babylonCamera.maxZ = camera.orthographic.zfar;\n break;\n }\n default: {\n throw new Error(`${context}: Invalid camera type (${camera.type})`);\n }\n }\n\n GLTFLoader.AddPointerMetadata(babylonCamera, context);\n this._parent.onCameraLoadedObservable.notifyObservers(babylonCamera);\n assign(babylonCamera);\n\n this.logClose();\n\n return Promise.all(promises).then(() => {\n return babylonCamera;\n });\n }\n\n private _loadAnimationsAsync(): Promise<void> {\n const animations = this._gltf.animations;\n if (!animations) {\n return Promise.resolve();\n }\n\n const promises = new Array<Promise<void>>();\n\n for (let index = 0; index < animations.length; index++) {\n const animation = animations[index];\n promises.push(this.loadAnimationAsync(`/animations/${animation.index}`, animation).then((animationGroup) => {\n // Delete the animation group if it ended up not having any animations in it.\n if (animationGroup.targetedAnimations.length === 0) {\n animationGroup.dispose();\n }\n }));\n }\n\n return Promise.all(promises).then(() => { });\n }\n\n /**\n * Loads a glTF animation.\n * @param context The context when loading the asset\n * @param animation The glTF animation property\n * @returns A promise that resolves with the loaded Babylon animation group when the load is complete\n */\n public loadAnimationAsync(context: string, animation: IAnimation): Promise<AnimationGroup> {\n const promise = this._extensionsLoadAnimationAsync(context, animation);\n if (promise) {\n return promise;\n }\n\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonAnimationGroup = new AnimationGroup(animation.name || `animation${animation.index}`, this._babylonScene);\n babylonAnimationGroup._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n animation._babylonAnimationGroup = babylonAnimationGroup;\n\n const promises = new Array<Promise<any>>();\n\n ArrayItem.Assign(animation.channels);\n ArrayItem.Assign(animation.samplers);\n\n for (const channel of animation.channels) {\n promises.push(this._loadAnimationChannelAsync(`${context}/channels/${channel.index}`, context, animation, channel, babylonAnimationGroup));\n }\n\n return Promise.all(promises).then(() => {\n babylonAnimationGroup.normalize(0);\n return babylonAnimationGroup;\n });\n }\n\n /**\n * @hidden Loads a glTF animation channel.\n * @param context The context when loading the asset\n * @param animationContext The context of the animation when loading the asset\n * @param animation The glTF animation property\n * @param channel The glTF animation channel property\n * @param babylonAnimationGroup The babylon animation group property\n * @param animationTargetOverride The babylon animation channel target override property. My be null.\n * @returns A void promise when the channel load is complete\n */\n public _loadAnimationChannelAsync(context: string, animationContext: string, animation: IAnimation, channel: IAnimationChannel, babylonAnimationGroup: AnimationGroup, animationTargetOverride: Nullable<IAnimatable> = null): Promise<void> {\n if (channel.target.node == undefined) {\n return Promise.resolve();\n }\n\n const targetNode = ArrayItem.Get(`${context}/target/node`, this._gltf.nodes, channel.target.node);\n\n // Ignore animations that have no animation targets.\n if ((channel.target.path === AnimationChannelTargetPath.WEIGHTS && !targetNode._numMorphTargets) ||\n (channel.target.path !== AnimationChannelTargetPath.WEIGHTS && !targetNode._babylonTransformNode)) {\n return Promise.resolve();\n }\n\n const sampler = ArrayItem.Get(`${context}/sampler`, animation.samplers, channel.sampler);\n return this._loadAnimationSamplerAsync(`${animationContext}/samplers/${channel.sampler}`, sampler).then((data) => {\n let targetPath: string;\n let animationType: number;\n switch (channel.target.path) {\n case AnimationChannelTargetPath.TRANSLATION: {\n targetPath = \"position\";\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\n break;\n }\n case AnimationChannelTargetPath.ROTATION: {\n targetPath = \"rotationQuaternion\";\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\n break;\n }\n case AnimationChannelTargetPath.SCALE: {\n targetPath = \"scaling\";\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\n break;\n }\n case AnimationChannelTargetPath.WEIGHTS: {\n targetPath = \"influence\";\n animationType = Animation.ANIMATIONTYPE_FLOAT;\n break;\n }\n default: {\n throw new Error(`${context}/target/path: Invalid value (${channel.target.path})`);\n }\n }\n\n let outputBufferOffset = 0;\n let getNextOutputValue: (scale: number) => Vector3 | Quaternion | Array<number>;\n switch (targetPath) {\n case \"position\": {\n getNextOutputValue = (scale) => {\n const value = Vector3.FromArray(data.output, outputBufferOffset).scaleInPlace(scale);\n outputBufferOffset += 3;\n return value;\n };\n break;\n }\n case \"rotationQuaternion\": {\n getNextOutputValue = (scale) => {\n const value = Quaternion.FromArray(data.output, outputBufferOffset).scaleInPlace(scale);\n outputBufferOffset += 4;\n return value;\n };\n break;\n }\n case \"scaling\": {\n getNextOutputValue = (scale) => {\n const value = Vector3.FromArray(data.output, outputBufferOffset).scaleInPlace(scale);\n outputBufferOffset += 3;\n return value;\n };\n break;\n }\n case \"influence\": {\n getNextOutputValue = (scale) => {\n const value = new Array<number>(targetNode._numMorphTargets!);\n for (let i = 0; i < targetNode._numMorphTargets!; i++) {\n value[i] = data.output[outputBufferOffset++] * scale;\n }\n return value;\n };\n break;\n }\n }\n\n let getNextKey: (frameIndex: number) => IAnimationKey;\n switch (data.interpolation) {\n case AnimationSamplerInterpolation.STEP: {\n getNextKey = (frameIndex) => ({\n frame: data.input[frameIndex] * this.parent.targetFps,\n value: getNextOutputValue(1),\n interpolation: AnimationKeyInterpolation.STEP\n });\n break;\n }\n case AnimationSamplerInterpolation.LINEAR: {\n getNextKey = (frameIndex) => ({\n frame: data.input[frameIndex] * this.parent.targetFps,\n value: getNextOutputValue(1)\n });\n break;\n }\n case AnimationSamplerInterpolation.CUBICSPLINE: {\n const invTargetFps = 1 / this.parent.targetFps;\n getNextKey = (frameIndex) => ({\n frame: data.input[frameIndex] * this.parent.targetFps,\n inTangent: getNextOutputValue(invTargetFps),\n value: getNextOutputValue(1),\n outTangent: getNextOutputValue(invTargetFps)\n });\n break;\n }\n }\n\n const keys = new Array(data.input.length);\n for (let frameIndex = 0; frameIndex < data.input.length; frameIndex++) {\n keys[frameIndex] = getNextKey!(frameIndex);\n }\n\n if (targetPath === \"influence\") {\n for (let targetIndex = 0; targetIndex < targetNode._numMorphTargets!; targetIndex++) {\n const animationName = `${babylonAnimationGroup.name}_channel${babylonAnimationGroup.targetedAnimations.length}`;\n const babylonAnimation = new Animation(animationName, targetPath, this.parent.targetFps, animationType);\n babylonAnimation.setKeys(keys.map((key) => ({\n frame: key.frame,\n inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,\n value: key.value[targetIndex],\n outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined\n })));\n\n this._forEachPrimitive(targetNode, (babylonAbstractMesh: AbstractMesh) => {\n const babylonMesh = babylonAbstractMesh as Mesh;\n const morphTarget = babylonMesh.morphTargetManager!.getTarget(targetIndex);\n const babylonAnimationClone = babylonAnimation.clone();\n morphTarget.animations.push(babylonAnimationClone);\n babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);\n });\n }\n }\n else {\n const animationName = `${babylonAnimationGroup.name}_channel${babylonAnimationGroup.targetedAnimations.length}`;\n const babylonAnimation = new Animation(animationName, targetPath, this.parent.targetFps, animationType);\n babylonAnimation.setKeys(keys);\n\n if (animationTargetOverride != null && animationTargetOverride.animations != null) {\n animationTargetOverride.animations.push(babylonAnimation);\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, animationTargetOverride);\n } else {\n targetNode._babylonTransformNode!.animations.push(babylonAnimation);\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonTransformNode!);\n }\n }\n });\n }\n\n private _loadAnimationSamplerAsync(context: string, sampler: IAnimationSampler): Promise<_IAnimationSamplerData> {\n if (sampler._data) {\n return sampler._data;\n }\n\n const interpolation = sampler.interpolation || AnimationSamplerInterpolation.LINEAR;\n switch (interpolation) {\n case AnimationSamplerInterpolation.STEP:\n case AnimationSamplerInterpolation.LINEAR:\n case AnimationSamplerInterpolation.CUBICSPLINE: {\n break;\n }\n default: {\n throw new Error(`${context}/interpolation: Invalid value (${sampler.interpolation})`);\n }\n }\n\n const inputAccessor = ArrayItem.Get(`${context}/input`, this._gltf.accessors, sampler.input);\n const outputAccessor = ArrayItem.Get(`${context}/output`, this._gltf.accessors, sampler.output);\n sampler._data = Promise.all([\n this._loadFloatAccessorAsync(`/accessors/${inputAccessor.index}`, inputAccessor),\n this._loadFloatAccessorAsync(`/accessors/${outputAccessor.index}`, outputAccessor)\n ]).then(([inputData, outputData]) => {\n return {\n input: inputData,\n interpolation: interpolation,\n output: outputData,\n };\n });\n\n return sampler._data;\n }\n\n /**\n * Loads a glTF buffer.\n * @param context The context when loading the asset\n * @param buffer The glTF buffer property\n * @param byteOffset The byte offset to use\n * @param byteLength The byte length to use\n * @returns A promise that resolves with the loaded data when the load is complete\n */\n public loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Promise<ArrayBufferView> {\n const extensionPromise = this._extensionsLoadBufferAsync(context, buffer, byteOffset, byteLength);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n if (!buffer._data) {\n if (buffer.uri) {\n buffer._data = this.loadUriAsync(`${context}/uri`, buffer, buffer.uri);\n }\n else {\n if (!this._bin) {\n throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);\n }\n\n buffer._data = this._bin.readAsync(0, buffer.byteLength);\n }\n }\n\n return buffer._data.then((data) => {\n try {\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\n }\n catch (e) {\n throw new Error(`${context}: ${e.message}`);\n }\n });\n }\n\n /**\n * Loads a glTF buffer view.\n * @param context The context when loading the asset\n * @param bufferView The glTF buffer view property\n * @returns A promise that resolves with the loaded data when the load is complete\n */\n public loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView> {\n const extensionPromise = this._extensionsLoadBufferViewAsync(context, bufferView);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n if (bufferView._data) {\n return bufferView._data;\n }\n\n const buffer = ArrayItem.Get(`${context}/buffer`, this._gltf.buffers, bufferView.buffer);\n bufferView._data = this.loadBufferAsync(`/buffers/${buffer.index}`, buffer, (bufferView.byteOffset || 0), bufferView.byteLength);\n\n return bufferView._data;\n }\n\n private _loadAccessorAsync(context: string, accessor: IAccessor, constructor: TypedArrayConstructor): Promise<ArrayBufferView> {\n if (accessor._data) {\n return accessor._data;\n }\n\n const numComponents = GLTFLoader._GetNumComponents(context, accessor.type);\n const byteStride = numComponents * VertexBuffer.GetTypeByteLength(accessor.componentType);\n const length = numComponents * accessor.count;\n\n if (accessor.bufferView == undefined) {\n accessor._data = Promise.resolve(new constructor(length));\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\n accessor._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\n if (accessor.componentType === AccessorComponentType.FLOAT && !accessor.normalized && (!bufferView.byteStride || bufferView.byteStride === byteStride)) {\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, length);\n }\n else {\n const typedArray = new constructor(length);\n VertexBuffer.ForEach(data, accessor.byteOffset || 0, bufferView.byteStride || byteStride, numComponents, accessor.componentType, typedArray.length, accessor.normalized || false, (value, index) => {\n typedArray[index] = value;\n });\n return typedArray;\n }\n });\n }\n\n if (accessor.sparse) {\n const sparse = accessor.sparse;\n accessor._data = accessor._data.then((data) => {\n const typedArray = data as TypedArrayLike;\n const indicesBufferView = ArrayItem.Get(`${context}/sparse/indices/bufferView`, this._gltf.bufferViews, sparse.indices.bufferView);\n const valuesBufferView = ArrayItem.Get(`${context}/sparse/values/bufferView`, this._gltf.bufferViews, sparse.values.bufferView);\n return Promise.all([\n this.loadBufferViewAsync(`/bufferViews/${indicesBufferView.index}`, indicesBufferView),\n this.loadBufferViewAsync(`/bufferViews/${valuesBufferView.index}`, valuesBufferView)\n ]).then(([indicesData, valuesData]) => {\n const indices = GLTFLoader._GetTypedArray(`${context}/sparse/indices`, sparse.indices.componentType, indicesData, sparse.indices.byteOffset, sparse.count) as IndicesArray;\n\n const sparseLength = numComponents * sparse.count;\n let values: TypedArrayLike;\n\n if (accessor.componentType === AccessorComponentType.FLOAT && !accessor.normalized) {\n values = GLTFLoader._GetTypedArray(`${context}/sparse/values`, accessor.componentType, valuesData, sparse.values.byteOffset, sparseLength);\n }\n else {\n const sparseData = GLTFLoader._GetTypedArray(`${context}/sparse/values`, accessor.componentType, valuesData, sparse.values.byteOffset, sparseLength);\n values = new constructor(sparseLength);\n VertexBuffer.ForEach(sparseData, 0, byteStride, numComponents, accessor.componentType, values.length, accessor.normalized || false, (value, index) => {\n values[index] = value;\n });\n }\n\n let valuesIndex = 0;\n for (let indicesIndex = 0; indicesIndex < indices.length; indicesIndex++) {\n let dataIndex = indices[indicesIndex] * numComponents;\n for (let componentIndex = 0; componentIndex < numComponents; componentIndex++) {\n typedArray[dataIndex++] = values[valuesIndex++];\n }\n }\n\n return typedArray;\n });\n });\n }\n\n return accessor._data;\n }\n\n /** @hidden */\n public _loadFloatAccessorAsync(context: string, accessor: IAccessor): Promise<Float32Array> {\n return this._loadAccessorAsync(context, accessor, Float32Array) as Promise<Float32Array>;\n }\n\n private _loadIndicesAccessorAsync(context: string, accessor: IAccessor): Promise<IndicesArray> {\n if (accessor.type !== AccessorType.SCALAR) {\n throw new Error(`${context}/type: Invalid value ${accessor.type}`);\n }\n\n if (accessor.componentType !== AccessorComponentType.UNSIGNED_BYTE &&\n accessor.componentType !== AccessorComponentType.UNSIGNED_SHORT &&\n accessor.componentType !== AccessorComponentType.UNSIGNED_INT) {\n throw new Error(`${context}/componentType: Invalid value ${accessor.componentType}`);\n }\n\n if (accessor._data) {\n return accessor._data as Promise<IndicesArray>;\n }\n\n if (accessor.sparse) {\n const constructor = GLTFLoader._GetTypedArrayConstructor(`${context}/componentType`, accessor.componentType);\n accessor._data = this._loadAccessorAsync(context, accessor, constructor);\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\n accessor._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, accessor.count);\n });\n }\n\n return accessor._data as Promise<IndicesArray>;\n }\n\n private _loadVertexBufferViewAsync(bufferView: IBufferView, kind: string): Promise<Buffer> {\n if (bufferView._babylonBuffer) {\n return bufferView._babylonBuffer;\n }\n\n bufferView._babylonBuffer = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\n return new Buffer(this._babylonScene.getEngine(), data, false);\n });\n\n return bufferView._babylonBuffer;\n }\n\n private _loadVertexAccessorAsync(context: string, accessor: IAccessor, kind: string): Promise<VertexBuffer> {\n if (accessor._babylonVertexBuffer?.[kind]) {\n return accessor._babylonVertexBuffer[kind];\n }\n\n if (!accessor._babylonVertexBuffer) {\n accessor._babylonVertexBuffer = {};\n }\n\n if (accessor.sparse) {\n accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then((data) => {\n return new VertexBuffer(this._babylonScene.getEngine(), data, kind, false);\n });\n }\n // Load joint indices as a float array since the shaders expect float data but glTF uses unsigned byte/short.\n // This prevents certain platforms (e.g. D3D) from having to convert the data to float on the fly.\n else if (kind === VertexBuffer.MatricesIndicesKind || kind === VertexBuffer.MatricesIndicesExtraKind) {\n accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then((data) => {\n return new VertexBuffer(this._babylonScene.getEngine(), data, kind, false);\n });\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\n accessor._babylonVertexBuffer[kind] = this._loadVertexBufferViewAsync(bufferView, kind).then((babylonBuffer) => {\n const size = GLTFLoader._GetNumComponents(context, accessor.type);\n return new VertexBuffer(this._babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView.byteStride,\n false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true, 1, true);\n });\n }\n\n return accessor._babylonVertexBuffer[kind];\n }\n\n private _loadMaterialMetallicRoughnessPropertiesAsync(context: string, properties: IMaterialPbrMetallicRoughness, babylonMaterial: Material): Promise<void> {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n\n const promises = new Array<Promise<any>>();\n\n if (properties) {\n if (properties.baseColorFactor) {\n babylonMaterial.albedoColor = Color3.FromArray(properties.baseColorFactor);\n babylonMaterial.alpha = properties.baseColorFactor[3];\n }\n else {\n babylonMaterial.albedoColor = Color3.White();\n }\n\n babylonMaterial.metallic = properties.metallicFactor == undefined ? 1 : properties.metallicFactor;\n babylonMaterial.roughness = properties.roughnessFactor == undefined ? 1 : properties.roughnessFactor;\n\n if (properties.baseColorTexture) {\n promises.push(this.loadTextureInfoAsync(`${context}/baseColorTexture`, properties.baseColorTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Base Color)`;\n babylonMaterial.albedoTexture = texture;\n }));\n }\n\n if (properties.metallicRoughnessTexture) {\n properties.metallicRoughnessTexture.nonColorData = true;\n promises.push(this.loadTextureInfoAsync(`${context}/metallicRoughnessTexture`, properties.metallicRoughnessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Metallic Roughness)`;\n babylonMaterial.metallicTexture = texture;\n }));\n\n babylonMaterial.useMetallnessFromMetallicTextureBlue = true;\n babylonMaterial.useRoughnessFromMetallicTextureGreen = true;\n babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;\n }\n }\n\n return Promise.all(promises).then(() => { });\n }\n\n /** @hidden */\n public _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign: (babylonMaterial: Material) => void = () => { }): Promise<Material> {\n const extensionPromise = this._extensionsLoadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n material._data = material._data || {};\n let babylonData = material._data[babylonDrawMode];\n if (!babylonData) {\n this.logOpen(`${context} ${material.name || \"\"}`);\n\n const babylonMaterial = this.createMaterial(context, material, babylonDrawMode);\n\n babylonData = {\n babylonMaterial: babylonMaterial,\n babylonMeshes: [],\n promise: this.loadMaterialPropertiesAsync(context, material, babylonMaterial)\n };\n\n material._data[babylonDrawMode] = babylonData;\n\n GLTFLoader.AddPointerMetadata(babylonMaterial, context);\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\n\n this.logClose();\n }\n\n if (babylonMesh) {\n babylonData.babylonMeshes.push(babylonMesh);\n\n babylonMesh.onDisposeObservable.addOnce(() => {\n const index = babylonData.babylonMeshes.indexOf(babylonMesh);\n if (index !== -1) {\n babylonData.babylonMeshes.splice(index, 1);\n }\n });\n }\n\n assign(babylonData.babylonMaterial);\n\n return babylonData.promise.then(() => {\n return babylonData.babylonMaterial;\n });\n }\n\n private _createDefaultMaterial(name: string, babylonDrawMode: number): Material {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonMaterial = new PBRMaterial(name, this._babylonScene);\n babylonMaterial._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n // Moved to mesh so user can change materials on gltf meshes: babylonMaterial.sideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n babylonMaterial.fillMode = babylonDrawMode;\n babylonMaterial.enableSpecularAntiAliasing = true;\n babylonMaterial.useRadianceOverAlpha = !this._parent.transparencyAsCoverage;\n babylonMaterial.useSpecularOverAlpha = !this._parent.transparencyAsCoverage;\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\n babylonMaterial.metallic = 1;\n babylonMaterial.roughness = 1;\n return babylonMaterial;\n }\n\n /**\n * Creates a Babylon material from a glTF material.\n * @param context The context when loading the asset\n * @param material The glTF material property\n * @param babylonDrawMode The draw mode for the Babylon material\n * @returns The Babylon material\n */\n public createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Material {\n const extensionPromise = this._extensionsCreateMaterial(context, material, babylonDrawMode);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n const name = material.name || `material${material.index}`;\n const babylonMaterial = this._createDefaultMaterial(name, babylonDrawMode);\n\n return babylonMaterial;\n }\n\n /**\n * Loads properties from a glTF material into a Babylon material.\n * @param context The context when loading the asset\n * @param material The glTF material property\n * @param babylonMaterial The Babylon material\n * @returns A promise that resolves when the load is complete\n */\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void> {\n const extensionPromise = this._extensionsLoadMaterialPropertiesAsync(context, material, babylonMaterial);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n const promises = new Array<Promise<any>>();\n\n promises.push(this.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\n\n if (material.pbrMetallicRoughness) {\n promises.push(this._loadMaterialMetallicRoughnessPropertiesAsync(`${context}/pbrMetallicRoughness`, material.pbrMetallicRoughness, babylonMaterial));\n }\n\n this.loadMaterialAlphaProperties(context, material, babylonMaterial);\n\n return Promise.all(promises).then(() => { });\n }\n\n /**\n * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.\n * @param context The context when loading the asset\n * @param material The glTF material property\n * @param babylonMaterial The Babylon material\n * @returns A promise that resolves when the load is complete\n */\n public loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void> {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n\n const promises = new Array<Promise<any>>();\n\n babylonMaterial.emissiveColor = material.emissiveFactor ? Color3.FromArray(material.emissiveFactor) : new Color3(0, 0, 0);\n if (material.doubleSided) {\n babylonMaterial.backFaceCulling = false;\n babylonMaterial.twoSidedLighting = true;\n }\n\n if (material.normalTexture) {\n material.normalTexture.nonColorData = true;\n promises.push(this.loadTextureInfoAsync(`${context}/normalTexture`, material.normalTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Normal)`;\n babylonMaterial.bumpTexture = texture;\n }));\n\n babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;\n babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;\n if (material.normalTexture.scale != undefined) {\n babylonMaterial.bumpTexture.level = material.normalTexture.scale;\n }\n\n babylonMaterial.forceIrradianceInFragment = true;\n }\n\n if (material.occlusionTexture) {\n material.occlusionTexture.nonColorData = true;\n promises.push(this.loadTextureInfoAsync(`${context}/occlusionTexture`, material.occlusionTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Occlusion)`;\n babylonMaterial.ambientTexture = texture;\n }));\n\n babylonMaterial.useAmbientInGrayScale = true;\n if (material.occlusionTexture.strength != undefined) {\n babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;\n }\n }\n\n if (material.emissiveTexture) {\n promises.push(this.loadTextureInfoAsync(`${context}/emissiveTexture`, material.emissiveTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Emissive)`;\n babylonMaterial.emissiveTexture = texture;\n }));\n }\n\n return Promise.all(promises).then(() => { });\n }\n\n /**\n * Loads the alpha properties from a glTF material into a Babylon material.\n * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.\n * @param context The context when loading the asset\n * @param material The glTF material property\n * @param babylonMaterial The Babylon material\n */\n public loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: Material): void {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n\n const alphaMode = material.alphaMode || MaterialAlphaMode.OPAQUE;\n switch (alphaMode) {\n case MaterialAlphaMode.OPAQUE: {\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\n break;\n }\n case MaterialAlphaMode.MASK: {\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHATEST;\n babylonMaterial.alphaCutOff = (material.alphaCutoff == undefined ? 0.5 : material.alphaCutoff);\n if (babylonMaterial.albedoTexture) {\n babylonMaterial.albedoTexture.hasAlpha = true;\n }\n break;\n }\n case MaterialAlphaMode.BLEND: {\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHABLEND;\n if (babylonMaterial.albedoTexture) {\n babylonMaterial.albedoTexture.hasAlpha = true;\n babylonMaterial.useAlphaFromAlbedoTexture = true;\n }\n break;\n }\n default: {\n throw new Error(`${context}/alphaMode: Invalid value (${material.alphaMode})`);\n }\n }\n }\n\n /**\n * Loads a glTF texture info.\n * @param context The context when loading the asset\n * @param textureInfo The glTF texture info property\n * @param assign A function called synchronously after parsing the glTF properties\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete\n */\n public loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void = () => { }): Promise<BaseTexture> {\n const extensionPromise = this._extensionsLoadTextureInfoAsync(context, textureInfo, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n this.logOpen(`${context}`);\n\n if (textureInfo.texCoord! >= 6) {\n throw new Error(`${context}/texCoord: Invalid value (${textureInfo.texCoord})`);\n }\n\n const texture = ArrayItem.Get(`${context}/index`, this._gltf.textures, textureInfo.index);\n texture._textureInfo = textureInfo;\n\n const promise = this._loadTextureAsync(`/textures/${textureInfo.index}`, texture, (babylonTexture) => {\n babylonTexture.coordinatesIndex = textureInfo.texCoord || 0;\n GLTFLoader.AddPointerMetadata(babylonTexture, context);\n this._parent.onTextureLoadedObservable.notifyObservers(babylonTexture);\n assign(babylonTexture);\n });\n\n this.logClose();\n\n return promise;\n }\n\n /** @hidden */\n public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void = () => { }): Promise<BaseTexture> {\n const extensionPromise = this._extensionsLoadTextureAsync(context, texture, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n this.logOpen(`${context} ${texture.name || \"\"}`);\n\n const sampler = (texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._gltf.samplers, texture.sampler));\n const image = ArrayItem.Get(`${context}/source`, this._gltf.images, texture.source);\n const promise = this._createTextureAsync(context, sampler, image, assign, undefined, !texture._textureInfo.nonColorData);\n\n this.logClose();\n\n return promise;\n }\n\n /** @hidden */\n public _createTextureAsync(context: string, sampler: ISampler, image: IImage, assign: (babylonTexture: BaseTexture) => void = () => { }, textureLoaderOptions?: any, useSRGBBuffer?: boolean): Promise<BaseTexture> {\n const samplerData = this._loadSampler(`/samplers/${sampler.index}`, sampler);\n\n const promises = new Array<Promise<any>>();\n\n const deferred = new Deferred<void>();\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const textureCreationOptions: ITextureCreationOptions = {\n noMipmap: samplerData.noMipMaps,\n invertY: false,\n samplingMode: samplerData.samplingMode,\n onLoad: () => {\n if (!this._disposed) {\n deferred.resolve();\n }\n },\n onError: (message?: string, exception?: any) => {\n if (!this._disposed) {\n deferred.reject(new Error(`${context}: ${(exception && exception.message) ? exception.message : message || \"Failed to load texture\"}`));\n }\n },\n mimeType: image.mimeType,\n loaderOptions: textureLoaderOptions,\n useSRGBBuffer: !!useSRGBBuffer && this._parent.useSRGBBuffers,\n };\n const babylonTexture = new Texture(null, this._babylonScene, textureCreationOptions);\n babylonTexture._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n promises.push(deferred.promise);\n\n promises.push(this.loadImageAsync(`/images/${image.index}`, image).then((data) => {\n const name = image.uri || `${this._fileName}#image${image.index}`;\n const dataUrl = `data:${this._uniqueRootUrl}${name}`;\n babylonTexture.updateURL(dataUrl, data);\n }));\n\n babylonTexture.wrapU = samplerData.wrapU;\n babylonTexture.wrapV = samplerData.wrapV;\n assign(babylonTexture);\n\n return Promise.all(promises).then(() => {\n return babylonTexture;\n });\n }\n\n private _loadSampler(context: string, sampler: ISampler): _ISamplerData {\n if (!sampler._data) {\n sampler._data = {\n noMipMaps: (sampler.minFilter === TextureMinFilter.NEAREST || sampler.minFilter === TextureMinFilter.LINEAR),\n samplingMode: GLTFLoader._GetTextureSamplingMode(context, sampler),\n wrapU: GLTFLoader._GetTextureWrapMode(`${context}/wrapS`, sampler.wrapS),\n wrapV: GLTFLoader._GetTextureWrapMode(`${context}/wrapT`, sampler.wrapT)\n };\n }\n\n return sampler._data;\n }\n\n /**\n * Loads a glTF image.\n * @param context The context when loading the asset\n * @param image The glTF image property\n * @returns A promise that resolves with the loaded data when the load is complete\n */\n public loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView> {\n if (!image._data) {\n this.logOpen(`${context} ${image.name || \"\"}`);\n\n if (image.uri) {\n image._data = this.loadUriAsync(`${context}/uri`, image, image.uri);\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, image.bufferView);\n image._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView);\n }\n\n this.logClose();\n }\n\n return image._data;\n }\n\n /**\n * Loads a glTF uri.\n * @param context The context when loading the asset\n * @param property The glTF property associated with the uri\n * @param uri The base64 or relative uri\n * @returns A promise that resolves with the loaded data when the load is complete\n */\n public loadUriAsync(context: string, property: IProperty, uri: string): Promise<ArrayBufferView> {\n const extensionPromise = this._extensionsLoadUriAsync(context, property, uri);\n if (extensionPromise) {\n return extensionPromise;\n }\n\n if (!GLTFLoader._ValidateUri(uri)) {\n throw new Error(`${context}: '${uri}' is invalid`);\n }\n\n if (IsBase64DataUrl(uri)) {\n const data = new Uint8Array(DecodeBase64UrlToBinary(uri));\n this.log(`${context}: Decoded ${uri.substr(0, 64)}... (${data.length} bytes)`);\n return Promise.resolve(data);\n }\n\n this.log(`${context}: Loading ${uri}`);\n\n return this._parent.preprocessUrlAsync(this._rootUrl + uri).then((url) => {\n return new Promise((resolve, reject) => {\n this._parent._loadFile(this._babylonScene, url, (data) => {\n if (!this._disposed) {\n this.log(`${context}: Loaded ${uri} (${(data as ArrayBuffer).byteLength} bytes)`);\n resolve(new Uint8Array(data as ArrayBuffer));\n }\n }, true, (request) => {\n reject(new LoadFileError(`${context}: Failed to load '${uri}'${request ? \": \" + request.status + \" \" + request.statusText : \"\"}`, request));\n });\n });\n });\n }\n\n /**\n * Adds a JSON pointer to the metadata of the Babylon object at `<object>.metadata.gltf.pointers`.\n * @param babylonObject the Babylon object with metadata\n * @param pointer the JSON pointer\n */\n public static AddPointerMetadata(babylonObject: { metadata: any }, pointer: string): void {\n const metadata = (babylonObject.metadata = babylonObject.metadata || {});\n const gltf = (metadata.gltf = metadata.gltf || {});\n const pointers = (gltf.pointers = gltf.pointers || []);\n pointers.push(pointer);\n }\n\n private static _GetTextureWrapMode(context: string, mode: TextureWrapMode | undefined): number {\n // Set defaults if undefined\n mode = mode == undefined ? TextureWrapMode.REPEAT : mode;\n\n switch (mode) {\n case TextureWrapMode.CLAMP_TO_EDGE: return Texture.CLAMP_ADDRESSMODE;\n case TextureWrapMode.MIRRORED_REPEAT: return Texture.MIRROR_ADDRESSMODE;\n case TextureWrapMode.REPEAT: return Texture.WRAP_ADDRESSMODE;\n default:\n Logger.Warn(`${context}: Invalid value (${mode})`);\n return Texture.WRAP_ADDRESSMODE;\n }\n }\n\n private static _GetTextureSamplingMode(context: string, sampler: ISampler): number {\n // Set defaults if undefined\n const magFilter = sampler.magFilter == undefined ? TextureMagFilter.LINEAR : sampler.magFilter;\n const minFilter = sampler.minFilter == undefined ? TextureMinFilter.LINEAR_MIPMAP_LINEAR : sampler.minFilter;\n\n if (magFilter === TextureMagFilter.LINEAR) {\n switch (minFilter) {\n case TextureMinFilter.NEAREST: return Texture.LINEAR_NEAREST;\n case TextureMinFilter.LINEAR: return Texture.LINEAR_LINEAR;\n case TextureMinFilter.NEAREST_MIPMAP_NEAREST: return Texture.LINEAR_NEAREST_MIPNEAREST;\n case TextureMinFilter.LINEAR_MIPMAP_NEAREST: return Texture.LINEAR_LINEAR_MIPNEAREST;\n case TextureMinFilter.NEAREST_MIPMAP_LINEAR: return Texture.LINEAR_NEAREST_MIPLINEAR;\n case TextureMinFilter.LINEAR_MIPMAP_LINEAR: return Texture.LINEAR_LINEAR_MIPLINEAR;\n default:\n Logger.Warn(`${context}/minFilter: Invalid value (${minFilter})`);\n return Texture.LINEAR_LINEAR_MIPLINEAR;\n }\n }\n else {\n if (magFilter !== TextureMagFilter.NEAREST) {\n Logger.Warn(`${context}/magFilter: Invalid value (${magFilter})`);\n }\n\n switch (minFilter) {\n case TextureMinFilter.NEAREST: return Texture.NEAREST_NEAREST;\n case TextureMinFilter.LINEAR: return Texture.NEAREST_LINEAR;\n case TextureMinFilter.NEAREST_MIPMAP_NEAREST: return Texture.NEAREST_NEAREST_MIPNEAREST;\n case TextureMinFilter.LINEAR_MIPMAP_NEAREST: return Texture.NEAREST_LINEAR_MIPNEAREST;\n case TextureMinFilter.NEAREST_MIPMAP_LINEAR: return Texture.NEAREST_NEAREST_MIPLINEAR;\n case TextureMinFilter.LINEAR_MIPMAP_LINEAR: return Texture.NEAREST_LINEAR_MIPLINEAR;\n default:\n Logger.Warn(`${context}/minFilter: Invalid value (${minFilter})`);\n return Texture.NEAREST_NEAREST_MIPNEAREST;\n }\n }\n }\n\n private static _GetTypedArrayConstructor(context: string, componentType: AccessorComponentType): TypedArrayConstructor {\n switch (componentType) {\n case AccessorComponentType.BYTE: return Int8Array;\n case AccessorComponentType.UNSIGNED_BYTE: return Uint8Array;\n case AccessorComponentType.SHORT: return Int16Array;\n case AccessorComponentType.UNSIGNED_SHORT: return Uint16Array;\n case AccessorComponentType.UNSIGNED_INT: return Uint32Array;\n case AccessorComponentType.FLOAT: return Float32Array;\n default: throw new Error(`${context}: Invalid component type ${componentType}`);\n }\n }\n\n private static _GetTypedArray(context: string, componentType: AccessorComponentType, bufferView: ArrayBufferView, byteOffset: number | undefined, length: number): TypedArrayLike {\n const buffer = bufferView.buffer;\n byteOffset = bufferView.byteOffset + (byteOffset || 0);\n\n const constructor = GLTFLoader._GetTypedArrayConstructor(`${context}/componentType`, componentType);\n\n const componentTypeLength = VertexBuffer.GetTypeByteLength(componentType);\n if (byteOffset % componentTypeLength !== 0) {\n // HACK: Copy the buffer if byte offset is not a multiple of component type byte length.\n Logger.Warn(`${context}: Copying buffer as byte offset (${byteOffset}) is not a multiple of component type byte length (${componentTypeLength})`);\n return new constructor(buffer.slice(byteOffset, byteOffset + length * componentTypeLength), 0);\n }\n\n return new constructor(buffer, byteOffset, length);\n }\n\n private static _GetNumComponents(context: string, type: string): number {\n switch (type) {\n case \"SCALAR\": return 1;\n case \"VEC2\": return 2;\n case \"VEC3\": return 3;\n case \"VEC4\": return 4;\n case \"MAT2\": return 4;\n case \"MAT3\": return 9;\n case \"MAT4\": return 16;\n }\n\n throw new Error(`${context}: Invalid type (${type})`);\n }\n\n private static _ValidateUri(uri: string): boolean {\n return (Tools.IsBase64(uri) || uri.indexOf(\"..\") === -1);\n }\n\n /** @hidden */\n public static _GetDrawMode(context: string, mode: number | undefined): number {\n if (mode == undefined) {\n mode = MeshPrimitiveMode.TRIANGLES;\n }\n\n switch (mode) {\n case MeshPrimitiveMode.POINTS: return Material.PointListDrawMode;\n case MeshPrimitiveMode.LINES: return Material.LineListDrawMode;\n case MeshPrimitiveMode.LINE_LOOP: return Material.LineLoopDrawMode;\n case MeshPrimitiveMode.LINE_STRIP: return Material.LineStripDrawMode;\n case MeshPrimitiveMode.TRIANGLES: return Material.TriangleFillMode;\n case MeshPrimitiveMode.TRIANGLE_STRIP: return Material.TriangleStripDrawMode;\n case MeshPrimitiveMode.TRIANGLE_FAN: return Material.TriangleFanDrawMode;\n }\n\n throw new Error(`${context}: Invalid mesh primitive mode (${mode})`);\n }\n\n private _compileMaterialsAsync(): Promise<void> {\n this._parent._startPerformanceCounter(\"Compile materials\");\n\n const promises = new Array<Promise<any>>();\n\n if (this._gltf.materials) {\n for (const material of this._gltf.materials) {\n if (material._data) {\n for (const babylonDrawMode in material._data) {\n const babylonData = material._data[babylonDrawMode];\n for (const babylonMesh of babylonData.babylonMeshes) {\n // Ensure nonUniformScaling is set if necessary.\n babylonMesh.computeWorldMatrix(true);\n\n const babylonMaterial = babylonData.babylonMaterial;\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh));\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { useInstances: true }));\n if (this._parent.useClipPlane) {\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true }));\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true, useInstances: true }));\n }\n }\n }\n }\n }\n }\n\n return Promise.all(promises).then(() => {\n this._parent._endPerformanceCounter(\"Compile materials\");\n });\n }\n\n private _compileShadowGeneratorsAsync(): Promise<void> {\n this._parent._startPerformanceCounter(\"Compile shadow generators\");\n\n const promises = new Array<Promise<any>>();\n\n const lights = this._babylonScene.lights;\n for (let light of lights) {\n let generator = light.getShadowGenerator();\n if (generator) {\n promises.push(generator.forceCompilationAsync());\n }\n }\n\n return Promise.all(promises).then(() => {\n this._parent._endPerformanceCounter(\"Compile shadow generators\");\n });\n }\n\n private _forEachExtensions(action: (extension: IGLTFLoaderExtension) => void): void {\n for (const extension of this._extensions) {\n if (extension.enabled) {\n action(extension);\n }\n }\n }\n\n private _applyExtensions<T>(property: IProperty, functionName: string, actionAsync: (extension: IGLTFLoaderExtension) => Nullable<T> | undefined): Nullable<T> {\n for (const extension of this._extensions) {\n if (extension.enabled) {\n const id = `${extension.name}.${functionName}`;\n const loaderProperty = property as ILoaderProperty;\n loaderProperty._activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions || {};\n const activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions;\n if (!activeLoaderExtensionFunctions[id]) {\n activeLoaderExtensionFunctions[id] = true;\n\n try {\n const result = actionAsync(extension);\n if (result) {\n return result;\n }\n }\n finally {\n delete activeLoaderExtensionFunctions[id];\n }\n }\n }\n }\n\n return null;\n }\n\n private _extensionsOnLoading(): void {\n this._forEachExtensions((extension) => extension.onLoading && extension.onLoading());\n }\n\n private _extensionsOnReady(): void {\n this._forEachExtensions((extension) => extension.onReady && extension.onReady());\n }\n\n private _extensionsLoadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>> {\n return this._applyExtensions(scene, \"loadScene\", (extension) => extension.loadSceneAsync && extension.loadSceneAsync(context, scene));\n }\n\n private _extensionsLoadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\n return this._applyExtensions(node, \"loadNode\", (extension) => extension.loadNodeAsync && extension.loadNodeAsync(context, node, assign));\n }\n\n private _extensionsLoadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>> {\n return this._applyExtensions(camera, \"loadCamera\", (extension) => extension.loadCameraAsync && extension.loadCameraAsync(context, camera, assign));\n }\n\n private _extensionsLoadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>> {\n return this._applyExtensions(primitive, \"loadVertexData\", (extension) => extension._loadVertexDataAsync && extension._loadVertexDataAsync(context, primitive, babylonMesh));\n }\n\n private _extensionsLoadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Nullable<Promise<AbstractMesh>> {\n return this._applyExtensions(primitive, \"loadMeshPrimitive\", (extension) => extension._loadMeshPrimitiveAsync && extension._loadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign));\n }\n\n private _extensionsLoadMaterialAsync(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>> {\n return this._applyExtensions(material, \"loadMaterial\", (extension) => extension._loadMaterialAsync && extension._loadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign));\n }\n\n private _extensionsCreateMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material> {\n return this._applyExtensions(material, \"createMaterial\", (extension) => extension.createMaterial && extension.createMaterial(context, material, babylonDrawMode));\n }\n\n private _extensionsLoadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\n return this._applyExtensions(material, \"loadMaterialProperties\", (extension) => extension.loadMaterialPropertiesAsync && extension.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n }\n\n private _extensionsLoadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\n return this._applyExtensions(textureInfo, \"loadTextureInfo\", (extension) => extension.loadTextureInfoAsync && extension.loadTextureInfoAsync(context, textureInfo, assign));\n }\n\n private _extensionsLoadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\n return this._applyExtensions(texture, \"loadTexture\", (extension) => extension._loadTextureAsync && extension._loadTextureAsync(context, texture, assign));\n }\n\n private _extensionsLoadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>> {\n return this._applyExtensions(animation, \"loadAnimation\", (extension) => extension.loadAnimationAsync && extension.loadAnimationAsync(context, animation));\n }\n\n private _extensionsLoadSkinAsync(context: string, node: INode, skin: ISkin): Nullable<Promise<void>> {\n return this._applyExtensions(skin, \"loadSkin\", (extension) => extension._loadSkinAsync && extension._loadSkinAsync(context, node, skin));\n }\n\n private _extensionsLoadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>> {\n return this._applyExtensions(property, \"loadUri\", (extension) => extension._loadUriAsync && extension._loadUriAsync(context, property, uri));\n }\n\n private _extensionsLoadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>> {\n return this._applyExtensions(bufferView, \"loadBufferView\", (extension) => extension.loadBufferViewAsync && extension.loadBufferViewAsync(context, bufferView));\n }\n\n private _extensionsLoadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>> {\n return this._applyExtensions(buffer, \"loadBuffer\", (extension) => extension.loadBufferAsync && extension.loadBufferAsync(context, buffer, byteOffset, byteLength));\n }\n\n /**\n * Helper method called by a loader extension to load an glTF extension.\n * @param context The context when loading the asset\n * @param property The glTF property to load the extension from\n * @param extensionName The name of the extension to load\n * @param actionAsync The action to run\n * @returns The promise returned by actionAsync or null if the extension does not exist\n */\n public static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>> {\n if (!property.extensions) {\n return null;\n }\n\n const extensions = property.extensions;\n\n const extension = extensions[extensionName] as TExtension;\n if (!extension) {\n return null;\n }\n\n return actionAsync(`${context}/extensions/${extensionName}`, extension);\n }\n\n /**\n * Helper method called by a loader extension to load a glTF extra.\n * @param context The context when loading the asset\n * @param property The glTF property to load the extra from\n * @param extensionName The name of the extension to load\n * @param actionAsync The action to run\n * @returns The promise returned by actionAsync or null if the extra does not exist\n */\n public static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>> {\n if (!property.extras) {\n return null;\n }\n\n const extras = property.extras;\n\n const extra = extras[extensionName] as TExtra;\n if (!extra) {\n return null;\n }\n\n return actionAsync(`${context}/extras/${extensionName}`, extra);\n }\n\n /**\n * Checks for presence of an extension.\n * @param name The name of the extension to check\n * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`\n */\n public isExtensionUsed(name: string): boolean {\n return !!this._gltf.extensionsUsed && this._gltf.extensionsUsed.indexOf(name) !== -1;\n }\n\n /**\n * Increments the indentation level and logs a message.\n * @param message The message to log\n */\n public logOpen(message: string): void {\n this._parent._logOpen(message);\n }\n\n /**\n * Decrements the indentation level.\n */\n public logClose(): void {\n this._parent._logClose();\n }\n\n /**\n * Logs a message\n * @param message The message to log\n */\n public log(message: string): void {\n this._parent._log(message);\n }\n\n /**\n * Starts a performance counter.\n * @param counterName The name of the performance counter\n */\n public startPerformanceCounter(counterName: string): void {\n this._parent._startPerformanceCounter(counterName);\n }\n\n /**\n * Ends a performance counter.\n * @param counterName The name of the performance counter\n */\n public endPerformanceCounter(counterName: string): void {\n this._parent._endPerformanceCounter(counterName);\n }\n}\n\nGLTFFileLoader._CreateGLTF2Loader = (parent) => new GLTFLoader(parent);\n"]}
|
1
|
+
{"version":3,"file":"glTFLoader.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/2.0/glTFLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,yCAA2B;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,6CAA+B;AACjF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,MAAM,EAAE,0CAA4B;AAC7C,OAAO,EAAE,UAAU,EAAE,8CAAgC;AACrD,OAAO,EAAE,cAAc,EAAE,qDAAuC;AAChE,OAAO,EAAE,SAAS,EAAE,gDAAkC;AACtD,OAAO,EAAE,IAAI,EAAE,sCAAwB;AACvC,OAAO,EAAE,QAAQ,EAAE,0CAA4B;AAC/C,OAAO,EAAE,QAAQ,EAAE,8CAAgC;AACnD,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAG7D,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,0CAA4B;AAC3D,OAAO,EAAE,QAAQ,EAAE,2CAA6B;AAGhD,OAAO,EAAE,IAAI,EAAE,uCAAyB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;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,4CAAuB,GAA9B,UAA+B,WAAmB;QAC9C,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACI,0CAAqB,GAA5B,UAA6B,WAAmB;QAC5C,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;IAtqFc,gCAAqB,GAA6C,EAAE,CAAC;IAEpF;;OAEG;IACoB,yBAAc,GAAa,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC;IAkqFpE,iBAAC;CAAA,AAjsFD,IAisFC;SAjsFY,UAAU;AAmsFvB,cAAc,CAAC,kBAAkB,GAAG,UAAC,MAAM,IAAK,OAAA,IAAI,UAAU,CAAC,MAAM,CAAC,EAAtB,CAAsB,CAAC","sourcesContent":["import type { IndicesArray, Nullable } from \"core/types\";\r\nimport { Deferred } from \"core/Misc/deferred\";\r\nimport { Quaternion, Vector3, Matrix, TmpVectors } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\nimport { FreeCamera } from \"core/Cameras/freeCamera\";\r\nimport { AnimationGroup } from \"core/Animations/animationGroup\";\r\nimport { Animation } from \"core/Animations/animation\";\r\nimport { Bone } from \"core/Bones/bone\";\r\nimport { Skeleton } from \"core/Bones/skeleton\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { ITextureCreationOptions } from \"core/Materials/Textures/texture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Buffer, VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { InstancedMesh } from \"core/Meshes/instancedMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { MorphTarget } from \"core/Morph/morphTarget\";\r\nimport { MorphTargetManager } from \"core/Morph/morphTargetManager\";\r\nimport type { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from \"core/Loading/sceneLoader\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { IProperty } from \"babylonjs-gltf2interface\";\r\nimport {\r\n AccessorType,\r\n CameraType,\r\n AnimationChannelTargetPath,\r\n AnimationSamplerInterpolation,\r\n AccessorComponentType,\r\n MaterialAlphaMode,\r\n TextureMinFilter,\r\n TextureWrapMode,\r\n TextureMagFilter,\r\n MeshPrimitiveMode,\r\n} from \"babylonjs-gltf2interface\";\r\nimport type {\r\n _IAnimationSamplerData,\r\n IGLTF,\r\n ISampler,\r\n INode,\r\n IScene,\r\n IMesh,\r\n IAccessor,\r\n ISkin,\r\n ICamera,\r\n IAnimation,\r\n IAnimationChannel,\r\n IAnimationSampler,\r\n IBuffer,\r\n IBufferView,\r\n IMaterialPbrMetallicRoughness,\r\n IMaterial,\r\n ITextureInfo,\r\n ITexture,\r\n IImage,\r\n IMeshPrimitive,\r\n IArrayItem as IArrItem,\r\n _ISamplerData,\r\n} from \"./glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"./glTFLoaderExtension\";\r\nimport type { IGLTFLoader, IGLTFLoaderData } from \"../glTFFileLoader\";\r\nimport { GLTFFileLoader, GLTFLoaderState, GLTFLoaderCoordinateSystemMode, GLTFLoaderAnimationStartMode } from \"../glTFFileLoader\";\r\nimport type { IAnimationKey } from \"core/Animations/animationKey\";\r\nimport { AnimationKeyInterpolation } from \"core/Animations/animationKey\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { IDataBuffer } from \"core/Misc/dataReader\";\r\nimport { DecodeBase64UrlToBinary, IsBase64DataUrl, LoadFileError } from \"core/Misc/fileTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport type { Light } from \"core/Lights/light\";\r\n\r\nimport { BoundingInfo } from \"core/Culling/boundingInfo\";\r\nimport { StringTools } from \"core/Misc/stringTools\";\r\nimport type { AssetContainer } from \"core/assetContainer\";\r\n\r\ninterface TypedArrayLike extends ArrayBufferView {\r\n readonly length: number;\r\n [n: number]: number;\r\n}\r\n\r\ninterface TypedArrayConstructor {\r\n new (length: number): TypedArrayLike;\r\n new (buffer: ArrayBufferLike, byteOffset: number, length?: number): TypedArrayLike;\r\n}\r\n\r\ninterface ILoaderProperty extends IProperty {\r\n _activeLoaderExtensionFunctions: {\r\n [id: string]: boolean;\r\n };\r\n}\r\n\r\ninterface IRegisteredExtension {\r\n factory: (loader: GLTFLoader) => IGLTFLoaderExtension;\r\n}\r\n\r\n/**\r\n * Helper class for working with arrays when loading the glTF asset\r\n */\r\nexport class ArrayItem {\r\n /**\r\n * Gets an item from the given array.\r\n * @param context The context when loading the asset\r\n * @param array The array to get the item from\r\n * @param index The index to the array\r\n * @returns The array item\r\n */\r\n public static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T {\r\n if (!array || index == undefined || !array[index]) {\r\n throw new Error(`${context}: Failed to find index (${index})`);\r\n }\r\n\r\n return array[index];\r\n }\r\n\r\n /**\r\n * Assign an `index` field to each item of the given array.\r\n * @param array The array of items\r\n */\r\n public static Assign(array?: IArrItem[]): void {\r\n if (array) {\r\n for (let index = 0; index < array.length; index++) {\r\n array[index].index = index;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The glTF 2.0 loader\r\n */\r\nexport class GLTFLoader implements IGLTFLoader {\r\n /** @hidden */\r\n public _completePromises = new Array<Promise<any>>();\r\n\r\n /** @hidden */\r\n public _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n /** Storage */\r\n public _babylonLights: Light[] = [];\r\n\r\n /** @hidden */\r\n public _disableInstancedMesh = 0;\r\n\r\n private readonly _parent: GLTFFileLoader;\r\n private readonly _extensions = new Array<IGLTFLoaderExtension>();\r\n private _disposed = false;\r\n private _rootUrl: Nullable<string> = null;\r\n private _fileName: Nullable<string> = null;\r\n private _uniqueRootUrl: Nullable<string> = null;\r\n private _gltf: IGLTF;\r\n private _bin: Nullable<IDataBuffer> = null;\r\n private _babylonScene: Scene;\r\n private _rootBabylonMesh: Nullable<Mesh> = null;\r\n private _defaultBabylonMaterialData: { [drawMode: number]: Material } = {};\r\n private _postSceneLoadActions = new Array<() => void>();\r\n\r\n private static _RegisteredExtensions: { [name: string]: IRegisteredExtension } = {};\r\n\r\n /**\r\n * The default glTF sampler.\r\n */\r\n public static readonly DefaultSampler: ISampler = { index: -1 };\r\n\r\n /**\r\n * Registers a loader extension.\r\n * @param name The name of the loader extension.\r\n * @param factory The factory function that creates the loader extension.\r\n */\r\n public static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void {\r\n if (GLTFLoader.UnregisterExtension(name)) {\r\n Logger.Warn(`Extension with the name '${name}' already exists`);\r\n }\r\n\r\n GLTFLoader._RegisteredExtensions[name] = {\r\n factory: factory,\r\n };\r\n }\r\n\r\n /**\r\n * Unregisters a loader extension.\r\n * @param name The name of the loader extension.\r\n * @returns A boolean indicating whether the extension has been unregistered\r\n */\r\n public static UnregisterExtension(name: string): boolean {\r\n if (!GLTFLoader._RegisteredExtensions[name]) {\r\n return false;\r\n }\r\n\r\n delete GLTFLoader._RegisteredExtensions[name];\r\n return true;\r\n }\r\n\r\n /**\r\n * The object that represents the glTF JSON.\r\n */\r\n public get gltf(): IGLTF {\r\n if (!this._gltf) {\r\n throw new Error(\"glTF JSON is not available\");\r\n }\r\n\r\n return this._gltf;\r\n }\r\n\r\n /**\r\n * The BIN chunk of a binary glTF.\r\n */\r\n public get bin(): Nullable<IDataBuffer> {\r\n return this._bin;\r\n }\r\n\r\n /**\r\n * The parent file loader.\r\n */\r\n public get parent(): GLTFFileLoader {\r\n return this._parent;\r\n }\r\n\r\n /**\r\n * The Babylon scene when loading the asset.\r\n */\r\n public get babylonScene(): Scene {\r\n if (!this._babylonScene) {\r\n throw new Error(\"Scene is not available\");\r\n }\r\n\r\n return this._babylonScene;\r\n }\r\n\r\n /**\r\n * The root Babylon mesh when loading the asset.\r\n */\r\n public get rootBabylonMesh(): Nullable<Mesh> {\r\n return this._rootBabylonMesh;\r\n }\r\n\r\n /**\r\n * @param parent\r\n * @hidden\r\n */\r\n constructor(parent: GLTFFileLoader) {\r\n this._parent = parent;\r\n }\r\n\r\n /** @hidden */\r\n public dispose(): void {\r\n if (this._disposed) {\r\n return;\r\n }\r\n\r\n this._disposed = true;\r\n\r\n this._completePromises.length = 0;\r\n\r\n this._extensions.forEach((extension) => extension.dispose && extension.dispose());\r\n this._extensions.length = 0;\r\n\r\n (this._gltf as Nullable<IGLTF>) = null; // TODO\r\n this._bin = null;\r\n (this._babylonScene as Nullable<Scene>) = null; // TODO\r\n this._rootBabylonMesh = null;\r\n this._defaultBabylonMaterialData = {};\r\n this._postSceneLoadActions.length = 0;\r\n\r\n this._parent.dispose();\r\n }\r\n\r\n /**\r\n * @param meshesNames\r\n * @param scene\r\n * @param container\r\n * @param data\r\n * @param rootUrl\r\n * @param onProgress\r\n * @param fileName\r\n * @hidden\r\n */\r\n public importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n container: Nullable<AssetContainer>,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName = \"\"\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return Promise.resolve().then(() => {\r\n this._babylonScene = scene;\r\n this._assetContainer = container;\r\n this._loadData(data);\r\n\r\n let nodes: Nullable<Array<number>> = null;\r\n\r\n if (meshesNames) {\r\n const nodeMap: { [name: string]: number } = {};\r\n if (this._gltf.nodes) {\r\n for (const node of this._gltf.nodes) {\r\n if (node.name) {\r\n nodeMap[node.name] = node.index;\r\n }\r\n }\r\n }\r\n\r\n const names = meshesNames instanceof Array ? meshesNames : [meshesNames];\r\n nodes = names.map((name) => {\r\n const node = nodeMap[name];\r\n if (node === undefined) {\r\n throw new Error(`Failed to find node '${name}'`);\r\n }\r\n\r\n return node;\r\n });\r\n }\r\n\r\n return this._loadAsync(rootUrl, fileName, nodes, () => {\r\n return {\r\n meshes: this._getMeshes(),\r\n particleSystems: [],\r\n skeletons: this._getSkeletons(),\r\n animationGroups: this._getAnimationGroups(),\r\n lights: this._babylonLights,\r\n transformNodes: this._getTransformNodes(),\r\n geometries: this._getGeometries(),\r\n };\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * @param scene\r\n * @param data\r\n * @param rootUrl\r\n * @param onProgress\r\n * @param fileName\r\n * @hidden\r\n */\r\n public loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName = \"\"): Promise<void> {\r\n return Promise.resolve().then(() => {\r\n this._babylonScene = scene;\r\n this._loadData(data);\r\n return this._loadAsync(rootUrl, fileName, null, () => undefined);\r\n });\r\n }\r\n\r\n private _loadAsync<T>(rootUrl: string, fileName: string, nodes: Nullable<Array<number>>, resultFunc: () => T): Promise<T> {\r\n return Promise.resolve()\r\n .then(() => {\r\n this._rootUrl = rootUrl;\r\n this._uniqueRootUrl = !StringTools.StartsWith(rootUrl, \"file:\") && fileName ? rootUrl : `${rootUrl}${Date.now()}/`;\r\n this._fileName = fileName;\r\n\r\n this._loadExtensions();\r\n this._checkExtensions();\r\n\r\n const loadingToReadyCounterName = `${GLTFLoaderState[GLTFLoaderState.LOADING]} => ${GLTFLoaderState[GLTFLoaderState.READY]}`;\r\n const loadingToCompleteCounterName = `${GLTFLoaderState[GLTFLoaderState.LOADING]} => ${GLTFLoaderState[GLTFLoaderState.COMPLETE]}`;\r\n\r\n this._parent._startPerformanceCounter(loadingToReadyCounterName);\r\n this._parent._startPerformanceCounter(loadingToCompleteCounterName);\r\n\r\n this._parent._setState(GLTFLoaderState.LOADING);\r\n this._extensionsOnLoading();\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n // Block the marking of materials dirty until the scene is loaded.\r\n const oldBlockMaterialDirtyMechanism = this._babylonScene.blockMaterialDirtyMechanism;\r\n this._babylonScene.blockMaterialDirtyMechanism = true;\r\n\r\n if (!this.parent.loadOnlyMaterials) {\r\n if (nodes) {\r\n promises.push(this.loadSceneAsync(\"/nodes\", { nodes: nodes, index: -1 }));\r\n } else if (this._gltf.scene != undefined || (this._gltf.scenes && this._gltf.scenes[0])) {\r\n const scene = ArrayItem.Get(`/scene`, this._gltf.scenes, this._gltf.scene || 0);\r\n promises.push(this.loadSceneAsync(`/scenes/${scene.index}`, scene));\r\n }\r\n }\r\n\r\n if (!this.parent.skipMaterials && this.parent.loadAllMaterials && this._gltf.materials) {\r\n for (let m = 0; m < this._gltf.materials.length; ++m) {\r\n const material = this._gltf.materials[m];\r\n const context = \"/materials/\" + m;\r\n const babylonDrawMode = Material.TriangleFillMode;\r\n\r\n promises.push(this._loadMaterialAsync(context, material, null, babylonDrawMode, () => {}));\r\n }\r\n }\r\n\r\n // Restore the blocking of material dirty.\r\n this._babylonScene.blockMaterialDirtyMechanism = oldBlockMaterialDirtyMechanism;\r\n\r\n if (this._parent.compileMaterials) {\r\n promises.push(this._compileMaterialsAsync());\r\n }\r\n\r\n if (this._parent.compileShadowGenerators) {\r\n promises.push(this._compileShadowGeneratorsAsync());\r\n }\r\n\r\n const resultPromise = Promise.all(promises).then(() => {\r\n if (this._rootBabylonMesh) {\r\n this._rootBabylonMesh.setEnabled(true);\r\n }\r\n\r\n this._extensionsOnReady();\r\n this._parent._setState(GLTFLoaderState.READY);\r\n\r\n this._startAnimations();\r\n\r\n return resultFunc();\r\n });\r\n\r\n return resultPromise.then((result) => {\r\n this._parent._endPerformanceCounter(loadingToReadyCounterName);\r\n\r\n Tools.SetImmediate(() => {\r\n if (!this._disposed) {\r\n Promise.all(this._completePromises).then(\r\n () => {\r\n this._parent._endPerformanceCounter(loadingToCompleteCounterName);\r\n\r\n this._parent._setState(GLTFLoaderState.COMPLETE);\r\n\r\n this._parent.onCompleteObservable.notifyObservers(undefined);\r\n this._parent.onCompleteObservable.clear();\r\n\r\n this.dispose();\r\n },\r\n (error) => {\r\n this._parent.onErrorObservable.notifyObservers(error);\r\n this._parent.onErrorObservable.clear();\r\n\r\n this.dispose();\r\n }\r\n );\r\n }\r\n });\r\n\r\n return result;\r\n });\r\n })\r\n .catch((error) => {\r\n if (!this._disposed) {\r\n this._parent.onErrorObservable.notifyObservers(error);\r\n this._parent.onErrorObservable.clear();\r\n\r\n this.dispose();\r\n }\r\n\r\n throw error;\r\n });\r\n }\r\n\r\n private _loadData(data: IGLTFLoaderData): void {\r\n this._gltf = data.json as IGLTF;\r\n this._setupData();\r\n\r\n if (data.bin) {\r\n const buffers = this._gltf.buffers;\r\n if (buffers && buffers[0] && !buffers[0].uri) {\r\n const binaryBuffer = buffers[0];\r\n if (binaryBuffer.byteLength < data.bin.byteLength - 3 || binaryBuffer.byteLength > data.bin.byteLength) {\r\n Logger.Warn(`Binary buffer length (${binaryBuffer.byteLength}) from JSON does not match chunk length (${data.bin.byteLength})`);\r\n }\r\n\r\n this._bin = data.bin;\r\n } else {\r\n Logger.Warn(\"Unexpected BIN chunk\");\r\n }\r\n }\r\n }\r\n\r\n private _setupData(): void {\r\n ArrayItem.Assign(this._gltf.accessors);\r\n ArrayItem.Assign(this._gltf.animations);\r\n ArrayItem.Assign(this._gltf.buffers);\r\n ArrayItem.Assign(this._gltf.bufferViews);\r\n ArrayItem.Assign(this._gltf.cameras);\r\n ArrayItem.Assign(this._gltf.images);\r\n ArrayItem.Assign(this._gltf.materials);\r\n ArrayItem.Assign(this._gltf.meshes);\r\n ArrayItem.Assign(this._gltf.nodes);\r\n ArrayItem.Assign(this._gltf.samplers);\r\n ArrayItem.Assign(this._gltf.scenes);\r\n ArrayItem.Assign(this._gltf.skins);\r\n ArrayItem.Assign(this._gltf.textures);\r\n\r\n if (this._gltf.nodes) {\r\n const nodeParents: { [index: number]: number } = {};\r\n for (const node of this._gltf.nodes) {\r\n if (node.children) {\r\n for (const index of node.children) {\r\n nodeParents[index] = node.index;\r\n }\r\n }\r\n }\r\n\r\n const rootNode = this._createRootNode();\r\n for (const node of this._gltf.nodes) {\r\n const parentIndex = nodeParents[node.index];\r\n node.parent = parentIndex === undefined ? rootNode : this._gltf.nodes[parentIndex];\r\n }\r\n }\r\n }\r\n\r\n private _loadExtensions(): void {\r\n for (const name in GLTFLoader._RegisteredExtensions) {\r\n const extension = GLTFLoader._RegisteredExtensions[name].factory(this);\r\n if (extension.name !== name) {\r\n Logger.Warn(`The name of the glTF loader extension instance does not match the registered name: ${extension.name} !== ${name}`);\r\n }\r\n\r\n this._extensions.push(extension);\r\n this._parent.onExtensionLoadedObservable.notifyObservers(extension);\r\n }\r\n\r\n this._extensions.sort((a, b) => (a.order || Number.MAX_VALUE) - (b.order || Number.MAX_VALUE));\r\n this._parent.onExtensionLoadedObservable.clear();\r\n }\r\n\r\n private _checkExtensions(): void {\r\n if (this._gltf.extensionsRequired) {\r\n for (const name of this._gltf.extensionsRequired) {\r\n const available = this._extensions.some((extension) => extension.name === name && extension.enabled);\r\n if (!available) {\r\n throw new Error(`Require extension ${name} is not available`);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _createRootNode(): INode {\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n this._rootBabylonMesh = new Mesh(\"__root__\", this._babylonScene);\r\n this._rootBabylonMesh._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n this._rootBabylonMesh.setEnabled(false);\r\n\r\n const rootNode: INode = {\r\n _babylonTransformNode: this._rootBabylonMesh,\r\n index: -1,\r\n };\r\n\r\n switch (this._parent.coordinateSystemMode) {\r\n case GLTFLoaderCoordinateSystemMode.AUTO: {\r\n if (!this._babylonScene.useRightHandedSystem) {\r\n rootNode.rotation = [0, 1, 0, 0];\r\n rootNode.scale = [1, 1, -1];\r\n GLTFLoader._LoadTransform(rootNode, this._rootBabylonMesh);\r\n }\r\n break;\r\n }\r\n case GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED: {\r\n this._babylonScene.useRightHandedSystem = true;\r\n break;\r\n }\r\n default: {\r\n throw new Error(`Invalid coordinate system mode (${this._parent.coordinateSystemMode})`);\r\n }\r\n }\r\n\r\n this._parent.onMeshLoadedObservable.notifyObservers(this._rootBabylonMesh);\r\n return rootNode;\r\n }\r\n\r\n /**\r\n * Loads a glTF scene.\r\n * @param context The context when loading the asset\r\n * @param scene The glTF scene property\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n public loadSceneAsync(context: string, scene: IScene): Promise<void> {\r\n const extensionPromise = this._extensionsLoadSceneAsync(context, scene);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n this.logOpen(`${context} ${scene.name || \"\"}`);\r\n\r\n if (scene.nodes) {\r\n for (const index of scene.nodes) {\r\n const node = ArrayItem.Get(`${context}/nodes/${index}`, this._gltf.nodes, index);\r\n promises.push(\r\n this.loadNodeAsync(`/nodes/${node.index}`, node, (babylonMesh) => {\r\n babylonMesh.parent = this._rootBabylonMesh;\r\n })\r\n );\r\n }\r\n }\r\n\r\n for (const action of this._postSceneLoadActions) {\r\n action();\r\n }\r\n\r\n promises.push(this._loadAnimationsAsync());\r\n\r\n this.logClose();\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n\r\n private _forEachPrimitive(node: INode, callback: (babylonMesh: AbstractMesh) => void): void {\r\n if (node._primitiveBabylonMeshes) {\r\n for (const babylonMesh of node._primitiveBabylonMeshes) {\r\n callback(babylonMesh);\r\n }\r\n }\r\n }\r\n\r\n private _getGeometries(): Geometry[] {\r\n const geometries = new Array<Geometry>();\r\n\r\n const nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (const node of nodes) {\r\n this._forEachPrimitive(node, (babylonMesh) => {\r\n const geometry = (babylonMesh as Mesh).geometry;\r\n if (geometry && geometries.indexOf(geometry) === -1) {\r\n geometries.push(geometry);\r\n }\r\n });\r\n }\r\n }\r\n\r\n return geometries;\r\n }\r\n\r\n private _getMeshes(): AbstractMesh[] {\r\n const meshes = new Array<AbstractMesh>();\r\n\r\n // Root mesh is always first, if available.\r\n if (this._rootBabylonMesh) {\r\n meshes.push(this._rootBabylonMesh);\r\n }\r\n\r\n const nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (const node of nodes) {\r\n this._forEachPrimitive(node, (babylonMesh) => {\r\n meshes.push(babylonMesh);\r\n });\r\n }\r\n }\r\n\r\n return meshes;\r\n }\r\n\r\n private _getTransformNodes(): TransformNode[] {\r\n const transformNodes = new Array<TransformNode>();\r\n\r\n const nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (const node of nodes) {\r\n if (node._babylonTransformNode && node._babylonTransformNode.getClassName() === \"TransformNode\") {\r\n transformNodes.push(node._babylonTransformNode);\r\n }\r\n if (node._babylonTransformNodeForSkin) {\r\n transformNodes.push(node._babylonTransformNodeForSkin);\r\n }\r\n }\r\n }\r\n\r\n return transformNodes;\r\n }\r\n\r\n private _getSkeletons(): Skeleton[] {\r\n const skeletons = new Array<Skeleton>();\r\n\r\n const skins = this._gltf.skins;\r\n if (skins) {\r\n for (const skin of skins) {\r\n if (skin._data) {\r\n skeletons.push(skin._data.babylonSkeleton);\r\n }\r\n }\r\n }\r\n\r\n return skeletons;\r\n }\r\n\r\n private _getAnimationGroups(): AnimationGroup[] {\r\n const animationGroups = new Array<AnimationGroup>();\r\n\r\n const animations = this._gltf.animations;\r\n if (animations) {\r\n for (const animation of animations) {\r\n if (animation._babylonAnimationGroup) {\r\n animationGroups.push(animation._babylonAnimationGroup);\r\n }\r\n }\r\n }\r\n\r\n return animationGroups;\r\n }\r\n\r\n private _startAnimations(): void {\r\n switch (this._parent.animationStartMode) {\r\n case GLTFLoaderAnimationStartMode.NONE: {\r\n // do nothing\r\n break;\r\n }\r\n case GLTFLoaderAnimationStartMode.FIRST: {\r\n const babylonAnimationGroups = this._getAnimationGroups();\r\n if (babylonAnimationGroups.length !== 0) {\r\n babylonAnimationGroups[0].start(true);\r\n }\r\n break;\r\n }\r\n case GLTFLoaderAnimationStartMode.ALL: {\r\n const babylonAnimationGroups = this._getAnimationGroups();\r\n for (const babylonAnimationGroup of babylonAnimationGroups) {\r\n babylonAnimationGroup.start(true);\r\n }\r\n break;\r\n }\r\n default: {\r\n Logger.Error(`Invalid animation start mode (${this._parent.animationStartMode})`);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Loads a glTF node.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon mesh when the load is complete\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void = () => {}): Promise<TransformNode> {\r\n const extensionPromise = this._extensionsLoadNodeAsync(context, node, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n if (node._babylonTransformNode) {\r\n throw new Error(`${context}: Invalid recursive node hierarchy`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n this.logOpen(`${context} ${node.name || \"\"}`);\r\n\r\n const loadNode = (babylonTransformNode: TransformNode) => {\r\n GLTFLoader.AddPointerMetadata(babylonTransformNode, context);\r\n GLTFLoader._LoadTransform(node, babylonTransformNode);\r\n\r\n if (node.camera != undefined) {\r\n const camera = ArrayItem.Get(`${context}/camera`, this._gltf.cameras, node.camera);\r\n promises.push(\r\n this.loadCameraAsync(`/cameras/${camera.index}`, camera, (babylonCamera) => {\r\n babylonCamera.parent = babylonTransformNode;\r\n })\r\n );\r\n }\r\n\r\n if (node.children) {\r\n for (const index of node.children) {\r\n const childNode = ArrayItem.Get(`${context}/children/${index}`, this._gltf.nodes, index);\r\n promises.push(\r\n this.loadNodeAsync(`/nodes/${childNode.index}`, childNode, (childBabylonMesh) => {\r\n childBabylonMesh.parent = babylonTransformNode;\r\n })\r\n );\r\n }\r\n }\r\n\r\n assign(babylonTransformNode);\r\n };\r\n\r\n if (node.mesh == undefined || node.skin != undefined) {\r\n const nodeName = node.name || `node${node.index}`;\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const transformNode = new TransformNode(nodeName, this._babylonScene);\r\n transformNode._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n if (node.mesh == undefined) {\r\n node._babylonTransformNode = transformNode;\r\n } else {\r\n node._babylonTransformNodeForSkin = transformNode;\r\n }\r\n loadNode(transformNode);\r\n }\r\n\r\n if (node.mesh != undefined) {\r\n if (node.skin == undefined) {\r\n const mesh = ArrayItem.Get(`${context}/mesh`, this._gltf.meshes, node.mesh);\r\n promises.push(this._loadMeshAsync(`/meshes/${mesh.index}`, node, mesh, loadNode));\r\n } else {\r\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\r\n // This code path will place the skinned mesh as a sibling of the skeleton root node without loading the\r\n // transform, which effectively ignores the transform of the skinned mesh, as per spec.\r\n\r\n const mesh = ArrayItem.Get(`${context}/mesh`, this._gltf.meshes, node.mesh);\r\n promises.push(\r\n this._loadMeshAsync(`/meshes/${mesh.index}`, node, mesh, (babylonTransformNode) => {\r\n // Duplicate the metadata from the skin node to the skinned mesh in case any loader extension added metadata.\r\n babylonTransformNode.metadata = node._babylonTransformNodeForSkin!.metadata;\r\n\r\n const skin = ArrayItem.Get(`${context}/skin`, this._gltf.skins, node.skin);\r\n promises.push(\r\n this._loadSkinAsync(`/skins/${skin.index}`, node, skin, (babylonSkeleton) => {\r\n this._forEachPrimitive(node, (babylonMesh) => {\r\n babylonMesh.skeleton = babylonSkeleton;\r\n });\r\n\r\n // Wait until the scene is loaded to ensure the skeleton root node has been loaded.\r\n this._postSceneLoadActions.push(() => {\r\n if (skin.skeleton != undefined) {\r\n // Place the skinned mesh node as a sibling of the skeleton root node.\r\n const skeletonRootNode = ArrayItem.Get(`/skins/${skin.index}/skeleton`, this._gltf.nodes, skin.skeleton);\r\n babylonTransformNode.parent = skeletonRootNode.parent!._babylonTransformNode!;\r\n } else {\r\n babylonTransformNode.parent = this._rootBabylonMesh;\r\n }\r\n });\r\n })\r\n );\r\n })\r\n );\r\n }\r\n }\r\n\r\n this.logClose();\r\n\r\n return Promise.all(promises).then(() => {\r\n this._forEachPrimitive(node, (babylonMesh) => {\r\n if ((babylonMesh as Mesh).geometry && (babylonMesh as Mesh).geometry!.useBoundingInfoFromGeometry) {\r\n // simply apply the world matrices to the bounding info - the extends are already ok\r\n babylonMesh._updateBoundingInfo();\r\n } else {\r\n babylonMesh.refreshBoundingInfo(true);\r\n }\r\n });\r\n\r\n return node._babylonTransformNode!;\r\n });\r\n }\r\n\r\n private _loadMeshAsync(context: string, node: INode, mesh: IMesh, assign: (babylonTransformNode: TransformNode) => void): Promise<TransformNode> {\r\n const primitives = mesh.primitives;\r\n if (!primitives || !primitives.length) {\r\n throw new Error(`${context}: Primitives are missing`);\r\n }\r\n\r\n if (primitives[0].index == undefined) {\r\n ArrayItem.Assign(primitives);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n this.logOpen(`${context} ${mesh.name || \"\"}`);\r\n\r\n const name = node.name || `node${node.index}`;\r\n\r\n if (primitives.length === 1) {\r\n const primitive = mesh.primitives[0];\r\n promises.push(\r\n this._loadMeshPrimitiveAsync(`${context}/primitives/${primitive.index}`, name, node, mesh, primitive, (babylonMesh) => {\r\n node._babylonTransformNode = babylonMesh;\r\n node._primitiveBabylonMeshes = [babylonMesh];\r\n })\r\n );\r\n } else {\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n node._babylonTransformNode = new TransformNode(name, this._babylonScene);\r\n node._babylonTransformNode._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n node._primitiveBabylonMeshes = [];\r\n for (const primitive of primitives) {\r\n promises.push(\r\n this._loadMeshPrimitiveAsync(`${context}/primitives/${primitive.index}`, `${name}_primitive${primitive.index}`, node, mesh, primitive, (babylonMesh) => {\r\n babylonMesh.parent = node._babylonTransformNode!;\r\n node._primitiveBabylonMeshes!.push(babylonMesh);\r\n })\r\n );\r\n }\r\n }\r\n\r\n assign(node._babylonTransformNode!);\r\n\r\n this.logClose();\r\n\r\n return Promise.all(promises).then(() => {\r\n return node._babylonTransformNode!;\r\n });\r\n }\r\n\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading data for mesh primitives.\r\n * @param context The context when loading the asset\r\n * @param name The mesh name when loading the asset\r\n * @param node The glTF node when loading the asset\r\n * @param mesh The glTF mesh when loading the asset\r\n * @param primitive The glTF mesh primitive property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled\r\n */\r\n public _loadMeshPrimitiveAsync(\r\n context: string,\r\n name: string,\r\n node: INode,\r\n mesh: IMesh,\r\n primitive: IMeshPrimitive,\r\n assign: (babylonMesh: AbstractMesh) => void\r\n ): Promise<AbstractMesh> {\r\n const extensionPromise = this._extensionsLoadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n this.logOpen(`${context}`);\r\n\r\n const shouldInstance = this._disableInstancedMesh === 0 && this._parent.createInstances && node.skin == undefined && !mesh.primitives[0].targets;\r\n\r\n let babylonAbstractMesh: AbstractMesh;\r\n let promise: Promise<any>;\r\n\r\n if (shouldInstance && primitive._instanceData) {\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n babylonAbstractMesh = primitive._instanceData.babylonSourceMesh.createInstance(name) as InstancedMesh;\r\n babylonAbstractMesh._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n promise = primitive._instanceData.promise;\r\n } else {\r\n const promises = new Array<Promise<any>>();\r\n\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const babylonMesh = new Mesh(name, this._babylonScene);\r\n babylonMesh._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n babylonMesh.overrideMaterialSideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\r\n\r\n this._createMorphTargets(context, node, mesh, primitive, babylonMesh);\r\n promises.push(\r\n this._loadVertexDataAsync(context, primitive, babylonMesh).then((babylonGeometry) => {\r\n return this._loadMorphTargetsAsync(context, primitive, babylonMesh, babylonGeometry).then(() => {\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n babylonGeometry.applyToMesh(babylonMesh);\r\n babylonGeometry._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n });\r\n })\r\n );\r\n\r\n const babylonDrawMode = GLTFLoader._GetDrawMode(context, primitive.mode);\r\n if (primitive.material == undefined) {\r\n let babylonMaterial = this._defaultBabylonMaterialData[babylonDrawMode];\r\n if (!babylonMaterial) {\r\n babylonMaterial = this._createDefaultMaterial(\"__GLTFLoader._default\", babylonDrawMode);\r\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\r\n this._defaultBabylonMaterialData[babylonDrawMode] = babylonMaterial;\r\n }\r\n babylonMesh.material = babylonMaterial;\r\n } else if (!this.parent.skipMaterials) {\r\n const material = ArrayItem.Get(`${context}/material`, this._gltf.materials, primitive.material);\r\n promises.push(\r\n this._loadMaterialAsync(`/materials/${material.index}`, material, babylonMesh, babylonDrawMode, (babylonMaterial) => {\r\n babylonMesh.material = babylonMaterial;\r\n })\r\n );\r\n }\r\n\r\n promise = Promise.all(promises);\r\n\r\n if (shouldInstance) {\r\n primitive._instanceData = {\r\n babylonSourceMesh: babylonMesh,\r\n promise: promise,\r\n };\r\n }\r\n\r\n babylonAbstractMesh = babylonMesh;\r\n }\r\n\r\n GLTFLoader.AddPointerMetadata(babylonAbstractMesh, context);\r\n this._parent.onMeshLoadedObservable.notifyObservers(babylonAbstractMesh);\r\n assign(babylonAbstractMesh);\r\n\r\n this.logClose();\r\n\r\n return promise.then(() => {\r\n return babylonAbstractMesh;\r\n });\r\n }\r\n\r\n private _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Promise<Geometry> {\r\n const extensionPromise = this._extensionsLoadVertexDataAsync(context, primitive, babylonMesh);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n const attributes = primitive.attributes;\r\n if (!attributes) {\r\n throw new Error(`${context}: Attributes are missing`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n const babylonGeometry = new Geometry(babylonMesh.name, this._babylonScene);\r\n\r\n if (primitive.indices == undefined) {\r\n babylonMesh.isUnIndexed = true;\r\n } else {\r\n const accessor = ArrayItem.Get(`${context}/indices`, this._gltf.accessors, primitive.indices);\r\n promises.push(\r\n this._loadIndicesAccessorAsync(`/accessors/${accessor.index}`, accessor).then((data) => {\r\n babylonGeometry.setIndices(data);\r\n })\r\n );\r\n }\r\n\r\n const loadAttribute = (attribute: string, kind: string, callback?: (accessor: IAccessor) => void) => {\r\n if (attributes[attribute] == undefined) {\r\n return;\r\n }\r\n\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n\r\n const accessor = ArrayItem.Get(`${context}/attributes/${attribute}`, this._gltf.accessors, attributes[attribute]);\r\n promises.push(\r\n this._loadVertexAccessorAsync(`/accessors/${accessor.index}`, accessor, kind).then((babylonVertexBuffer) => {\r\n if (babylonVertexBuffer.getKind() === VertexBuffer.PositionKind && !this.parent.alwaysComputeBoundingBox && !babylonMesh.skeleton) {\r\n const mmin = accessor.min as [number, number, number],\r\n mmax = accessor.max as [number, number, number];\r\n if (mmin !== undefined && mmax !== undefined) {\r\n if (accessor.normalized && accessor.componentType !== AccessorComponentType.FLOAT) {\r\n let divider = 1;\r\n switch (accessor.componentType) {\r\n case AccessorComponentType.BYTE:\r\n divider = 127.0;\r\n break;\r\n case AccessorComponentType.UNSIGNED_BYTE:\r\n divider = 255.0;\r\n break;\r\n case AccessorComponentType.SHORT:\r\n divider = 32767.0;\r\n break;\r\n case AccessorComponentType.UNSIGNED_SHORT:\r\n divider = 65535.0;\r\n break;\r\n }\r\n for (let i = 0; i < 3; ++i) {\r\n mmin[i] = Math.max(mmin[i] / divider, -1.0);\r\n mmax[i] = Math.max(mmax[i] / divider, -1.0);\r\n }\r\n }\r\n const min = TmpVectors.Vector3[0],\r\n max = TmpVectors.Vector3[1];\r\n min.copyFromFloats(...mmin);\r\n max.copyFromFloats(...mmax);\r\n babylonGeometry._boundingInfo = new BoundingInfo(min, max);\r\n babylonGeometry.useBoundingInfoFromGeometry = true;\r\n }\r\n }\r\n babylonGeometry.setVerticesBuffer(babylonVertexBuffer, accessor.count);\r\n })\r\n );\r\n\r\n if (kind == VertexBuffer.MatricesIndicesExtraKind) {\r\n babylonMesh.numBoneInfluencers = 8;\r\n }\r\n\r\n if (callback) {\r\n callback(accessor);\r\n }\r\n };\r\n\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\r\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\r\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\r\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"JOINTS_1\", VertexBuffer.MatricesIndicesExtraKind);\r\n loadAttribute(\"WEIGHTS_1\", VertexBuffer.MatricesWeightsExtraKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind, (accessor) => {\r\n if (accessor.type === AccessorType.VEC4) {\r\n babylonMesh.hasVertexAlpha = true;\r\n }\r\n });\r\n\r\n return Promise.all(promises).then(() => {\r\n return babylonGeometry;\r\n });\r\n }\r\n\r\n private _createMorphTargets(context: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, babylonMesh: Mesh): void {\r\n if (!primitive.targets) {\r\n return;\r\n }\r\n\r\n if (node._numMorphTargets == undefined) {\r\n node._numMorphTargets = primitive.targets.length;\r\n } else if (primitive.targets.length !== node._numMorphTargets) {\r\n throw new Error(`${context}: Primitives do not have the same number of targets`);\r\n }\r\n\r\n const targetNames = mesh.extras ? mesh.extras.targetNames : null;\r\n\r\n babylonMesh.morphTargetManager = new MorphTargetManager(babylonMesh.getScene());\r\n babylonMesh.morphTargetManager.areUpdatesFrozen = true;\r\n\r\n for (let index = 0; index < primitive.targets.length; index++) {\r\n const weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;\r\n const name = targetNames ? targetNames[index] : `morphTarget${index}`;\r\n babylonMesh.morphTargetManager.addTarget(new MorphTarget(name, weight, babylonMesh.getScene()));\r\n // TODO: tell the target whether it has positions, normals, tangents\r\n }\r\n }\r\n\r\n private _loadMorphTargetsAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh, babylonGeometry: Geometry): Promise<void> {\r\n if (!primitive.targets) {\r\n return Promise.resolve();\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n const morphTargetManager = babylonMesh.morphTargetManager!;\r\n for (let index = 0; index < morphTargetManager.numTargets; index++) {\r\n const babylonMorphTarget = morphTargetManager.getTarget(index);\r\n promises.push(this._loadMorphTargetVertexDataAsync(`${context}/targets/${index}`, babylonGeometry, primitive.targets[index], babylonMorphTarget));\r\n }\r\n\r\n return Promise.all(promises).then(() => {\r\n morphTargetManager.areUpdatesFrozen = false;\r\n });\r\n }\r\n\r\n private _loadMorphTargetVertexDataAsync(context: string, babylonGeometry: Geometry, attributes: { [name: string]: number }, babylonMorphTarget: MorphTarget): Promise<void> {\r\n const promises = new Array<Promise<any>>();\r\n\r\n const loadAttribute = (attribute: string, kind: string, setData: (babylonVertexBuffer: VertexBuffer, data: Float32Array) => void) => {\r\n if (attributes[attribute] == undefined) {\r\n return;\r\n }\r\n\r\n const babylonVertexBuffer = babylonGeometry.getVertexBuffer(kind);\r\n if (!babylonVertexBuffer) {\r\n return;\r\n }\r\n\r\n const accessor = ArrayItem.Get(`${context}/${attribute}`, this._gltf.accessors, attributes[attribute]);\r\n promises.push(\r\n this._loadFloatAccessorAsync(`/accessors/${accessor.index}`, accessor).then((data) => {\r\n setData(babylonVertexBuffer, data);\r\n })\r\n );\r\n };\r\n\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind, (babylonVertexBuffer, data) => {\r\n const positions = new Float32Array(data.length);\r\n babylonVertexBuffer.forEach(data.length, (value, index) => {\r\n positions[index] = data[index] + value;\r\n });\r\n\r\n babylonMorphTarget.setPositions(positions);\r\n });\r\n\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind, (babylonVertexBuffer, data) => {\r\n const normals = new Float32Array(data.length);\r\n babylonVertexBuffer.forEach(normals.length, (value, index) => {\r\n normals[index] = data[index] + value;\r\n });\r\n\r\n babylonMorphTarget.setNormals(normals);\r\n });\r\n\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind, (babylonVertexBuffer, data) => {\r\n const tangents = new Float32Array((data.length / 3) * 4);\r\n let dataIndex = 0;\r\n babylonVertexBuffer.forEach((data.length / 3) * 4, (value, index) => {\r\n // Tangent data for morph targets is stored as xyz delta.\r\n // The vertexData.tangent is stored as xyzw.\r\n // So we need to skip every fourth vertexData.tangent.\r\n if ((index + 1) % 4 !== 0) {\r\n tangents[dataIndex] = data[dataIndex] + value;\r\n dataIndex++;\r\n }\r\n });\r\n babylonMorphTarget.setTangents(tangents);\r\n });\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n\r\n private static _LoadTransform(node: INode, babylonNode: TransformNode): void {\r\n // Ignore the TRS of skinned nodes.\r\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\r\n if (node.skin != undefined) {\r\n return;\r\n }\r\n\r\n let position = Vector3.Zero();\r\n let rotation = Quaternion.Identity();\r\n let scaling = Vector3.One();\r\n\r\n if (node.matrix) {\r\n const matrix = Matrix.FromArray(node.matrix);\r\n matrix.decompose(scaling, rotation, position);\r\n } else {\r\n if (node.translation) {\r\n position = Vector3.FromArray(node.translation);\r\n }\r\n if (node.rotation) {\r\n rotation = Quaternion.FromArray(node.rotation);\r\n }\r\n if (node.scale) {\r\n scaling = Vector3.FromArray(node.scale);\r\n }\r\n }\r\n\r\n babylonNode.position = position;\r\n babylonNode.rotationQuaternion = rotation;\r\n babylonNode.scaling = scaling;\r\n }\r\n\r\n private _loadSkinAsync(context: string, node: INode, skin: ISkin, assign: (babylonSkeleton: Skeleton) => void): Promise<void> {\r\n const extensionPromise = this._extensionsLoadSkinAsync(context, node, skin);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n if (skin._data) {\r\n assign(skin._data.babylonSkeleton);\r\n return skin._data.promise;\r\n }\r\n\r\n const skeletonId = `skeleton${skin.index}`;\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const babylonSkeleton = new Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);\r\n babylonSkeleton._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n\r\n this._loadBones(context, skin, babylonSkeleton);\r\n const promise = this._loadSkinInverseBindMatricesDataAsync(context, skin).then((inverseBindMatricesData) => {\r\n this._updateBoneMatrices(babylonSkeleton, inverseBindMatricesData);\r\n });\r\n\r\n skin._data = {\r\n babylonSkeleton: babylonSkeleton,\r\n promise: promise,\r\n };\r\n\r\n assign(babylonSkeleton);\r\n\r\n return promise;\r\n }\r\n\r\n private _loadBones(context: string, skin: ISkin, babylonSkeleton: Skeleton): void {\r\n if (skin.skeleton == undefined || this._parent.alwaysComputeSkeletonRootNode) {\r\n const rootNode = this._findSkeletonRootNode(`${context}/joints`, skin.joints);\r\n if (rootNode) {\r\n if (skin.skeleton === undefined) {\r\n skin.skeleton = rootNode.index;\r\n } else {\r\n const isParent = (a: INode, b: INode): boolean => {\r\n for (; b.parent; b = b.parent) {\r\n if (b.parent === a) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n\r\n const skeletonNode = ArrayItem.Get(`${context}/skeleton`, this._gltf.nodes, skin.skeleton);\r\n if (skeletonNode !== rootNode && !isParent(skeletonNode, rootNode)) {\r\n Logger.Warn(`${context}/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root`);\r\n skin.skeleton = rootNode.index;\r\n }\r\n }\r\n } else {\r\n Logger.Warn(`${context}: Failed to find common root`);\r\n }\r\n }\r\n\r\n const babylonBones: { [index: number]: Bone } = {};\r\n for (const index of skin.joints) {\r\n const node = ArrayItem.Get(`${context}/joints/${index}`, this._gltf.nodes, index);\r\n this._loadBone(node, skin, babylonSkeleton, babylonBones);\r\n }\r\n }\r\n\r\n private _findSkeletonRootNode(context: string, joints: Array<number>): Nullable<INode> {\r\n if (joints.length === 0) {\r\n return null;\r\n }\r\n\r\n const paths: { [joint: number]: Array<INode> } = {};\r\n for (const index of joints) {\r\n const path = new Array<INode>();\r\n let node = ArrayItem.Get(`${context}/${index}`, this._gltf.nodes, index);\r\n while (node.index !== -1) {\r\n path.unshift(node);\r\n node = node.parent!;\r\n }\r\n paths[index] = path;\r\n }\r\n\r\n let rootNode: Nullable<INode> = null;\r\n for (let i = 0; ; ++i) {\r\n let path = paths[joints[0]];\r\n if (i >= path.length) {\r\n return rootNode;\r\n }\r\n\r\n const node = path[i];\r\n for (let j = 1; j < joints.length; ++j) {\r\n path = paths[joints[j]];\r\n if (i >= path.length || node !== path[i]) {\r\n return rootNode;\r\n }\r\n }\r\n\r\n rootNode = node;\r\n }\r\n }\r\n\r\n private _loadBone(node: INode, skin: ISkin, babylonSkeleton: Skeleton, babylonBones: { [index: number]: Bone }): Bone {\r\n let babylonBone = babylonBones[node.index];\r\n if (babylonBone) {\r\n return babylonBone;\r\n }\r\n\r\n let parentBabylonBone: Nullable<Bone> = null;\r\n if (node.index !== skin.skeleton) {\r\n if (node.parent && node.parent.index !== -1) {\r\n parentBabylonBone = this._loadBone(node.parent, skin, babylonSkeleton, babylonBones);\r\n } else if (skin.skeleton !== undefined) {\r\n Logger.Warn(`/skins/${skin.index}/skeleton: Skeleton node is not a common root`);\r\n }\r\n }\r\n\r\n const boneIndex = skin.joints.indexOf(node.index);\r\n babylonBone = new Bone(node.name || `joint${node.index}`, babylonSkeleton, parentBabylonBone, this._getNodeMatrix(node), null, null, boneIndex);\r\n babylonBones[node.index] = babylonBone;\r\n\r\n // Wait until the scene is loaded to ensure the transform nodes are loaded.\r\n this._postSceneLoadActions.push(() => {\r\n // Link the Babylon bone with the corresponding Babylon transform node.\r\n // A glTF joint is a pointer to a glTF node in the glTF node hierarchy similar to Unity3D.\r\n babylonBone.linkTransformNode(node._babylonTransformNode!);\r\n });\r\n\r\n return babylonBone;\r\n }\r\n\r\n private _loadSkinInverseBindMatricesDataAsync(context: string, skin: ISkin): Promise<Nullable<Float32Array>> {\r\n if (skin.inverseBindMatrices == undefined) {\r\n return Promise.resolve(null);\r\n }\r\n\r\n const accessor = ArrayItem.Get(`${context}/inverseBindMatrices`, this._gltf.accessors, skin.inverseBindMatrices);\r\n return this._loadFloatAccessorAsync(`/accessors/${accessor.index}`, accessor);\r\n }\r\n\r\n private _updateBoneMatrices(babylonSkeleton: Skeleton, inverseBindMatricesData: Nullable<Float32Array>): void {\r\n for (const babylonBone of babylonSkeleton.bones) {\r\n const baseMatrix = Matrix.Identity();\r\n const boneIndex = babylonBone._index!;\r\n if (inverseBindMatricesData && boneIndex !== -1) {\r\n Matrix.FromArrayToRef(inverseBindMatricesData, boneIndex * 16, baseMatrix);\r\n baseMatrix.invertToRef(baseMatrix);\r\n }\r\n\r\n const babylonParentBone = babylonBone.getParent();\r\n if (babylonParentBone) {\r\n baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);\r\n }\r\n\r\n babylonBone.updateMatrix(baseMatrix, false, false);\r\n babylonBone._updateDifferenceMatrix(undefined, false);\r\n }\r\n }\r\n\r\n private _getNodeMatrix(node: INode): Matrix {\r\n return node.matrix\r\n ? Matrix.FromArray(node.matrix)\r\n : Matrix.Compose(\r\n node.scale ? Vector3.FromArray(node.scale) : Vector3.One(),\r\n node.rotation ? Quaternion.FromArray(node.rotation) : Quaternion.Identity(),\r\n node.translation ? Vector3.FromArray(node.translation) : Vector3.Zero()\r\n );\r\n }\r\n\r\n /**\r\n * Loads a glTF camera.\r\n * @param context The context when loading the asset\r\n * @param camera The glTF camera property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon camera when the load is complete\r\n */\r\n public loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void = () => {}): Promise<Camera> {\r\n const extensionPromise = this._extensionsLoadCameraAsync(context, camera, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n this.logOpen(`${context} ${camera.name || \"\"}`);\r\n\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const babylonCamera = new FreeCamera(camera.name || `camera${camera.index}`, Vector3.Zero(), this._babylonScene, false);\r\n babylonCamera._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n babylonCamera.ignoreParentScaling = true;\r\n\r\n babylonCamera.rotation = new Vector3(0, Math.PI, 0);\r\n\r\n switch (camera.type) {\r\n case CameraType.PERSPECTIVE: {\r\n const perspective = camera.perspective;\r\n if (!perspective) {\r\n throw new Error(`${context}: Camera perspective properties are missing`);\r\n }\r\n\r\n babylonCamera.fov = perspective.yfov;\r\n babylonCamera.minZ = perspective.znear;\r\n babylonCamera.maxZ = perspective.zfar || 0;\r\n break;\r\n }\r\n case CameraType.ORTHOGRAPHIC: {\r\n if (!camera.orthographic) {\r\n throw new Error(`${context}: Camera orthographic properties are missing`);\r\n }\r\n\r\n babylonCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\r\n babylonCamera.orthoLeft = -camera.orthographic.xmag;\r\n babylonCamera.orthoRight = camera.orthographic.xmag;\r\n babylonCamera.orthoBottom = -camera.orthographic.ymag;\r\n babylonCamera.orthoTop = camera.orthographic.ymag;\r\n babylonCamera.minZ = camera.orthographic.znear;\r\n babylonCamera.maxZ = camera.orthographic.zfar;\r\n break;\r\n }\r\n default: {\r\n throw new Error(`${context}: Invalid camera type (${camera.type})`);\r\n }\r\n }\r\n\r\n GLTFLoader.AddPointerMetadata(babylonCamera, context);\r\n this._parent.onCameraLoadedObservable.notifyObservers(babylonCamera);\r\n assign(babylonCamera);\r\n\r\n this.logClose();\r\n\r\n return Promise.all(promises).then(() => {\r\n return babylonCamera;\r\n });\r\n }\r\n\r\n private _loadAnimationsAsync(): Promise<void> {\r\n const animations = this._gltf.animations;\r\n if (!animations) {\r\n return Promise.resolve();\r\n }\r\n\r\n const promises = new Array<Promise<void>>();\r\n\r\n for (let index = 0; index < animations.length; index++) {\r\n const animation = animations[index];\r\n promises.push(\r\n this.loadAnimationAsync(`/animations/${animation.index}`, animation).then((animationGroup) => {\r\n // Delete the animation group if it ended up not having any animations in it.\r\n if (animationGroup.targetedAnimations.length === 0) {\r\n animationGroup.dispose();\r\n }\r\n })\r\n );\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n\r\n /**\r\n * Loads a glTF animation.\r\n * @param context The context when loading the asset\r\n * @param animation The glTF animation property\r\n * @returns A promise that resolves with the loaded Babylon animation group when the load is complete\r\n */\r\n public loadAnimationAsync(context: string, animation: IAnimation): Promise<AnimationGroup> {\r\n const promise = this._extensionsLoadAnimationAsync(context, animation);\r\n if (promise) {\r\n return promise;\r\n }\r\n\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const babylonAnimationGroup = new AnimationGroup(animation.name || `animation${animation.index}`, this._babylonScene);\r\n babylonAnimationGroup._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n animation._babylonAnimationGroup = babylonAnimationGroup;\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n ArrayItem.Assign(animation.channels);\r\n ArrayItem.Assign(animation.samplers);\r\n\r\n for (const channel of animation.channels) {\r\n promises.push(this._loadAnimationChannelAsync(`${context}/channels/${channel.index}`, context, animation, channel, babylonAnimationGroup));\r\n }\r\n\r\n return Promise.all(promises).then(() => {\r\n babylonAnimationGroup.normalize(0);\r\n return babylonAnimationGroup;\r\n });\r\n }\r\n\r\n /**\r\n * @hidden Loads a glTF animation channel.\r\n * @param context The context when loading the asset\r\n * @param animationContext The context of the animation when loading the asset\r\n * @param animation The glTF animation property\r\n * @param channel The glTF animation channel property\r\n * @param babylonAnimationGroup The babylon animation group property\r\n * @param animationTargetOverride The babylon animation channel target override property. My be null.\r\n * @returns A void promise when the channel load is complete\r\n */\r\n public _loadAnimationChannelAsync(\r\n context: string,\r\n animationContext: string,\r\n animation: IAnimation,\r\n channel: IAnimationChannel,\r\n babylonAnimationGroup: AnimationGroup,\r\n animationTargetOverride: Nullable<IAnimatable> = null\r\n ): Promise<void> {\r\n if (channel.target.node == undefined) {\r\n return Promise.resolve();\r\n }\r\n\r\n const targetNode = ArrayItem.Get(`${context}/target/node`, this._gltf.nodes, channel.target.node);\r\n\r\n // Ignore animations that have no animation targets.\r\n if (\r\n (channel.target.path === AnimationChannelTargetPath.WEIGHTS && !targetNode._numMorphTargets) ||\r\n (channel.target.path !== AnimationChannelTargetPath.WEIGHTS && !targetNode._babylonTransformNode)\r\n ) {\r\n return Promise.resolve();\r\n }\r\n\r\n const sampler = ArrayItem.Get(`${context}/sampler`, animation.samplers, channel.sampler);\r\n return this._loadAnimationSamplerAsync(`${animationContext}/samplers/${channel.sampler}`, sampler).then((data) => {\r\n let targetPath: string;\r\n let animationType: number;\r\n switch (channel.target.path) {\r\n case AnimationChannelTargetPath.TRANSLATION: {\r\n targetPath = \"position\";\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.ROTATION: {\r\n targetPath = \"rotationQuaternion\";\r\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.SCALE: {\r\n targetPath = \"scaling\";\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.WEIGHTS: {\r\n targetPath = \"influence\";\r\n animationType = Animation.ANIMATIONTYPE_FLOAT;\r\n break;\r\n }\r\n default: {\r\n throw new Error(`${context}/target/path: Invalid value (${channel.target.path})`);\r\n }\r\n }\r\n\r\n let outputBufferOffset = 0;\r\n let getNextOutputValue: (scale: number) => Vector3 | Quaternion | Array<number>;\r\n switch (targetPath) {\r\n case \"position\": {\r\n getNextOutputValue = (scale) => {\r\n const value = Vector3.FromArray(data.output, outputBufferOffset).scaleInPlace(scale);\r\n outputBufferOffset += 3;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"rotationQuaternion\": {\r\n getNextOutputValue = (scale) => {\r\n const value = Quaternion.FromArray(data.output, outputBufferOffset).scaleInPlace(scale);\r\n outputBufferOffset += 4;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"scaling\": {\r\n getNextOutputValue = (scale) => {\r\n const value = Vector3.FromArray(data.output, outputBufferOffset).scaleInPlace(scale);\r\n outputBufferOffset += 3;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"influence\": {\r\n getNextOutputValue = (scale) => {\r\n const value = new Array<number>(targetNode._numMorphTargets!);\r\n for (let i = 0; i < targetNode._numMorphTargets!; i++) {\r\n value[i] = data.output[outputBufferOffset++] * scale;\r\n }\r\n return value;\r\n };\r\n break;\r\n }\r\n }\r\n\r\n let getNextKey: (frameIndex: number) => IAnimationKey;\r\n switch (data.interpolation) {\r\n case AnimationSamplerInterpolation.STEP: {\r\n getNextKey = (frameIndex) => ({\r\n frame: data.input[frameIndex] * this.parent.targetFps,\r\n value: getNextOutputValue(1),\r\n interpolation: AnimationKeyInterpolation.STEP,\r\n });\r\n break;\r\n }\r\n case AnimationSamplerInterpolation.LINEAR: {\r\n getNextKey = (frameIndex) => ({\r\n frame: data.input[frameIndex] * this.parent.targetFps,\r\n value: getNextOutputValue(1),\r\n });\r\n break;\r\n }\r\n case AnimationSamplerInterpolation.CUBICSPLINE: {\r\n const invTargetFps = 1 / this.parent.targetFps;\r\n getNextKey = (frameIndex) => ({\r\n frame: data.input[frameIndex] * this.parent.targetFps,\r\n inTangent: getNextOutputValue(invTargetFps),\r\n value: getNextOutputValue(1),\r\n outTangent: getNextOutputValue(invTargetFps),\r\n });\r\n break;\r\n }\r\n }\r\n\r\n const keys = new Array(data.input.length);\r\n for (let frameIndex = 0; frameIndex < data.input.length; frameIndex++) {\r\n keys[frameIndex] = getNextKey!(frameIndex);\r\n }\r\n\r\n if (targetPath === \"influence\") {\r\n for (let targetIndex = 0; targetIndex < targetNode._numMorphTargets!; targetIndex++) {\r\n const animationName = `${babylonAnimationGroup.name}_channel${babylonAnimationGroup.targetedAnimations.length}`;\r\n const babylonAnimation = new Animation(animationName, targetPath, this.parent.targetFps, animationType);\r\n babylonAnimation.setKeys(\r\n keys.map((key) => ({\r\n frame: key.frame,\r\n inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,\r\n value: key.value[targetIndex],\r\n outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined,\r\n }))\r\n );\r\n\r\n this._forEachPrimitive(targetNode, (babylonAbstractMesh: AbstractMesh) => {\r\n const babylonMesh = babylonAbstractMesh as Mesh;\r\n const morphTarget = babylonMesh.morphTargetManager!.getTarget(targetIndex);\r\n const babylonAnimationClone = babylonAnimation.clone();\r\n morphTarget.animations.push(babylonAnimationClone);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);\r\n });\r\n }\r\n } else {\r\n const animationName = `${babylonAnimationGroup.name}_channel${babylonAnimationGroup.targetedAnimations.length}`;\r\n const babylonAnimation = new Animation(animationName, targetPath, this.parent.targetFps, animationType);\r\n babylonAnimation.setKeys(keys);\r\n\r\n if (animationTargetOverride != null && animationTargetOverride.animations != null) {\r\n animationTargetOverride.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, animationTargetOverride);\r\n } else {\r\n targetNode._babylonTransformNode!.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonTransformNode!);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private _loadAnimationSamplerAsync(context: string, sampler: IAnimationSampler): Promise<_IAnimationSamplerData> {\r\n if (sampler._data) {\r\n return sampler._data;\r\n }\r\n\r\n const interpolation = sampler.interpolation || AnimationSamplerInterpolation.LINEAR;\r\n switch (interpolation) {\r\n case AnimationSamplerInterpolation.STEP:\r\n case AnimationSamplerInterpolation.LINEAR:\r\n case AnimationSamplerInterpolation.CUBICSPLINE: {\r\n break;\r\n }\r\n default: {\r\n throw new Error(`${context}/interpolation: Invalid value (${sampler.interpolation})`);\r\n }\r\n }\r\n\r\n const inputAccessor = ArrayItem.Get(`${context}/input`, this._gltf.accessors, sampler.input);\r\n const outputAccessor = ArrayItem.Get(`${context}/output`, this._gltf.accessors, sampler.output);\r\n sampler._data = Promise.all([\r\n this._loadFloatAccessorAsync(`/accessors/${inputAccessor.index}`, inputAccessor),\r\n this._loadFloatAccessorAsync(`/accessors/${outputAccessor.index}`, outputAccessor),\r\n ]).then(([inputData, outputData]) => {\r\n return {\r\n input: inputData,\r\n interpolation: interpolation,\r\n output: outputData,\r\n };\r\n });\r\n\r\n return sampler._data;\r\n }\r\n\r\n /**\r\n * Loads a glTF buffer.\r\n * @param context The context when loading the asset\r\n * @param buffer The glTF buffer property\r\n * @param byteOffset The byte offset to use\r\n * @param byteLength The byte length to use\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n public loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Promise<ArrayBufferView> {\r\n const extensionPromise = this._extensionsLoadBufferAsync(context, buffer, byteOffset, byteLength);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n if (!buffer._data) {\r\n if (buffer.uri) {\r\n buffer._data = this.loadUriAsync(`${context}/uri`, buffer, buffer.uri);\r\n } else {\r\n if (!this._bin) {\r\n throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);\r\n }\r\n\r\n buffer._data = this._bin.readAsync(0, buffer.byteLength);\r\n }\r\n }\r\n\r\n return buffer._data.then((data) => {\r\n try {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\r\n } catch (e) {\r\n throw new Error(`${context}: ${e.message}`);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Loads a glTF buffer view.\r\n * @param context The context when loading the asset\r\n * @param bufferView The glTF buffer view property\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n public loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView> {\r\n const extensionPromise = this._extensionsLoadBufferViewAsync(context, bufferView);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n if (bufferView._data) {\r\n return bufferView._data;\r\n }\r\n\r\n const buffer = ArrayItem.Get(`${context}/buffer`, this._gltf.buffers, bufferView.buffer);\r\n bufferView._data = this.loadBufferAsync(`/buffers/${buffer.index}`, buffer, bufferView.byteOffset || 0, bufferView.byteLength);\r\n\r\n return bufferView._data;\r\n }\r\n\r\n private _loadAccessorAsync(context: string, accessor: IAccessor, constructor: TypedArrayConstructor): Promise<ArrayBufferView> {\r\n if (accessor._data) {\r\n return accessor._data;\r\n }\r\n\r\n const numComponents = GLTFLoader._GetNumComponents(context, accessor.type);\r\n const byteStride = numComponents * VertexBuffer.GetTypeByteLength(accessor.componentType);\r\n const length = numComponents * accessor.count;\r\n\r\n if (accessor.bufferView == undefined) {\r\n accessor._data = Promise.resolve(new constructor(length));\r\n } else {\r\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\r\n accessor._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n if (accessor.componentType === AccessorComponentType.FLOAT && !accessor.normalized && (!bufferView.byteStride || bufferView.byteStride === byteStride)) {\r\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, length);\r\n } else {\r\n const typedArray = new constructor(length);\r\n VertexBuffer.ForEach(\r\n data,\r\n accessor.byteOffset || 0,\r\n bufferView.byteStride || byteStride,\r\n numComponents,\r\n accessor.componentType,\r\n typedArray.length,\r\n accessor.normalized || false,\r\n (value, index) => {\r\n typedArray[index] = value;\r\n }\r\n );\r\n return typedArray;\r\n }\r\n });\r\n }\r\n\r\n if (accessor.sparse) {\r\n const sparse = accessor.sparse;\r\n accessor._data = accessor._data.then((data) => {\r\n const typedArray = data as TypedArrayLike;\r\n const indicesBufferView = ArrayItem.Get(`${context}/sparse/indices/bufferView`, this._gltf.bufferViews, sparse.indices.bufferView);\r\n const valuesBufferView = ArrayItem.Get(`${context}/sparse/values/bufferView`, this._gltf.bufferViews, sparse.values.bufferView);\r\n return Promise.all([\r\n this.loadBufferViewAsync(`/bufferViews/${indicesBufferView.index}`, indicesBufferView),\r\n this.loadBufferViewAsync(`/bufferViews/${valuesBufferView.index}`, valuesBufferView),\r\n ]).then(([indicesData, valuesData]) => {\r\n const indices = GLTFLoader._GetTypedArray(\r\n `${context}/sparse/indices`,\r\n sparse.indices.componentType,\r\n indicesData,\r\n sparse.indices.byteOffset,\r\n sparse.count\r\n ) as IndicesArray;\r\n\r\n const sparseLength = numComponents * sparse.count;\r\n let values: TypedArrayLike;\r\n\r\n if (accessor.componentType === AccessorComponentType.FLOAT && !accessor.normalized) {\r\n values = GLTFLoader._GetTypedArray(`${context}/sparse/values`, accessor.componentType, valuesData, sparse.values.byteOffset, sparseLength);\r\n } else {\r\n const sparseData = GLTFLoader._GetTypedArray(`${context}/sparse/values`, accessor.componentType, valuesData, sparse.values.byteOffset, sparseLength);\r\n values = new constructor(sparseLength);\r\n VertexBuffer.ForEach(sparseData, 0, byteStride, numComponents, accessor.componentType, values.length, accessor.normalized || false, (value, index) => {\r\n values[index] = value;\r\n });\r\n }\r\n\r\n let valuesIndex = 0;\r\n for (let indicesIndex = 0; indicesIndex < indices.length; indicesIndex++) {\r\n let dataIndex = indices[indicesIndex] * numComponents;\r\n for (let componentIndex = 0; componentIndex < numComponents; componentIndex++) {\r\n typedArray[dataIndex++] = values[valuesIndex++];\r\n }\r\n }\r\n\r\n return typedArray;\r\n });\r\n });\r\n }\r\n\r\n return accessor._data;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param accessor\r\n * @hidden\r\n */\r\n public _loadFloatAccessorAsync(context: string, accessor: IAccessor): Promise<Float32Array> {\r\n return this._loadAccessorAsync(context, accessor, Float32Array) as Promise<Float32Array>;\r\n }\r\n\r\n private _loadIndicesAccessorAsync(context: string, accessor: IAccessor): Promise<IndicesArray> {\r\n if (accessor.type !== AccessorType.SCALAR) {\r\n throw new Error(`${context}/type: Invalid value ${accessor.type}`);\r\n }\r\n\r\n if (\r\n accessor.componentType !== AccessorComponentType.UNSIGNED_BYTE &&\r\n accessor.componentType !== AccessorComponentType.UNSIGNED_SHORT &&\r\n accessor.componentType !== AccessorComponentType.UNSIGNED_INT\r\n ) {\r\n throw new Error(`${context}/componentType: Invalid value ${accessor.componentType}`);\r\n }\r\n\r\n if (accessor._data) {\r\n return accessor._data as Promise<IndicesArray>;\r\n }\r\n\r\n if (accessor.sparse) {\r\n const constructor = GLTFLoader._GetTypedArrayConstructor(`${context}/componentType`, accessor.componentType);\r\n accessor._data = this._loadAccessorAsync(context, accessor, constructor);\r\n } else {\r\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\r\n accessor._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, accessor.count);\r\n });\r\n }\r\n\r\n return accessor._data as Promise<IndicesArray>;\r\n }\r\n\r\n private _loadVertexBufferViewAsync(bufferView: IBufferView): Promise<Buffer> {\r\n if (bufferView._babylonBuffer) {\r\n return bufferView._babylonBuffer;\r\n }\r\n\r\n bufferView._babylonBuffer = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n return new Buffer(this._babylonScene.getEngine(), data, false);\r\n });\r\n\r\n return bufferView._babylonBuffer;\r\n }\r\n\r\n private _loadVertexAccessorAsync(context: string, accessor: IAccessor, kind: string): Promise<VertexBuffer> {\r\n if (accessor._babylonVertexBuffer?.[kind]) {\r\n return accessor._babylonVertexBuffer[kind];\r\n }\r\n\r\n if (!accessor._babylonVertexBuffer) {\r\n accessor._babylonVertexBuffer = {};\r\n }\r\n\r\n if (accessor.sparse) {\r\n accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then((data) => {\r\n return new VertexBuffer(this._babylonScene.getEngine(), data, kind, false);\r\n });\r\n }\r\n // Load joint indices as a float array since the shaders expect float data but glTF uses unsigned byte/short.\r\n // This prevents certain platforms (e.g. D3D) from having to convert the data to float on the fly.\r\n else if (kind === VertexBuffer.MatricesIndicesKind || kind === VertexBuffer.MatricesIndicesExtraKind) {\r\n accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then((data) => {\r\n return new VertexBuffer(this._babylonScene.getEngine(), data, kind, false);\r\n });\r\n } else {\r\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\r\n accessor._babylonVertexBuffer[kind] = this._loadVertexBufferViewAsync(bufferView).then((babylonBuffer) => {\r\n const size = GLTFLoader._GetNumComponents(context, accessor.type);\r\n return new VertexBuffer(\r\n this._babylonScene.getEngine(),\r\n babylonBuffer,\r\n kind,\r\n false,\r\n false,\r\n bufferView.byteStride,\r\n false,\r\n accessor.byteOffset,\r\n size,\r\n accessor.componentType,\r\n accessor.normalized,\r\n true,\r\n 1,\r\n true\r\n );\r\n });\r\n }\r\n\r\n return accessor._babylonVertexBuffer[kind];\r\n }\r\n\r\n private _loadMaterialMetallicRoughnessPropertiesAsync(context: string, properties: IMaterialPbrMetallicRoughness, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n if (properties) {\r\n if (properties.baseColorFactor) {\r\n babylonMaterial.albedoColor = Color3.FromArray(properties.baseColorFactor);\r\n babylonMaterial.alpha = properties.baseColorFactor[3];\r\n } else {\r\n babylonMaterial.albedoColor = Color3.White();\r\n }\r\n\r\n babylonMaterial.metallic = properties.metallicFactor == undefined ? 1 : properties.metallicFactor;\r\n babylonMaterial.roughness = properties.roughnessFactor == undefined ? 1 : properties.roughnessFactor;\r\n\r\n if (properties.baseColorTexture) {\r\n promises.push(\r\n this.loadTextureInfoAsync(`${context}/baseColorTexture`, properties.baseColorTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Base Color)`;\r\n babylonMaterial.albedoTexture = texture;\r\n })\r\n );\r\n }\r\n\r\n if (properties.metallicRoughnessTexture) {\r\n properties.metallicRoughnessTexture.nonColorData = true;\r\n promises.push(\r\n this.loadTextureInfoAsync(`${context}/metallicRoughnessTexture`, properties.metallicRoughnessTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Metallic Roughness)`;\r\n babylonMaterial.metallicTexture = texture;\r\n })\r\n );\r\n\r\n babylonMaterial.useMetallnessFromMetallicTextureBlue = true;\r\n babylonMaterial.useRoughnessFromMetallicTextureGreen = true;\r\n babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;\r\n }\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonMesh\r\n * @param babylonDrawMode\r\n * @param assign\r\n * @hidden\r\n */\r\n public _loadMaterialAsync(\r\n context: string,\r\n material: IMaterial,\r\n babylonMesh: Nullable<Mesh>,\r\n babylonDrawMode: number,\r\n assign: (babylonMaterial: Material) => void = () => {}\r\n ): Promise<Material> {\r\n const extensionPromise = this._extensionsLoadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n material._data = material._data || {};\r\n let babylonData = material._data[babylonDrawMode];\r\n if (!babylonData) {\r\n this.logOpen(`${context} ${material.name || \"\"}`);\r\n\r\n const babylonMaterial = this.createMaterial(context, material, babylonDrawMode);\r\n\r\n babylonData = {\r\n babylonMaterial: babylonMaterial,\r\n babylonMeshes: [],\r\n promise: this.loadMaterialPropertiesAsync(context, material, babylonMaterial),\r\n };\r\n\r\n material._data[babylonDrawMode] = babylonData;\r\n\r\n GLTFLoader.AddPointerMetadata(babylonMaterial, context);\r\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\r\n\r\n this.logClose();\r\n }\r\n\r\n if (babylonMesh) {\r\n babylonData.babylonMeshes.push(babylonMesh);\r\n\r\n babylonMesh.onDisposeObservable.addOnce(() => {\r\n const index = babylonData.babylonMeshes.indexOf(babylonMesh);\r\n if (index !== -1) {\r\n babylonData.babylonMeshes.splice(index, 1);\r\n }\r\n });\r\n }\r\n\r\n assign(babylonData.babylonMaterial);\r\n\r\n return babylonData.promise.then(() => {\r\n return babylonData.babylonMaterial;\r\n });\r\n }\r\n\r\n private _createDefaultMaterial(name: string, babylonDrawMode: number): Material {\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const babylonMaterial = new PBRMaterial(name, this._babylonScene);\r\n babylonMaterial._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n // Moved to mesh so user can change materials on gltf meshes: babylonMaterial.sideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\r\n babylonMaterial.fillMode = babylonDrawMode;\r\n babylonMaterial.enableSpecularAntiAliasing = true;\r\n babylonMaterial.useRadianceOverAlpha = !this._parent.transparencyAsCoverage;\r\n babylonMaterial.useSpecularOverAlpha = !this._parent.transparencyAsCoverage;\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\r\n babylonMaterial.metallic = 1;\r\n babylonMaterial.roughness = 1;\r\n return babylonMaterial;\r\n }\r\n\r\n /**\r\n * Creates a Babylon material from a glTF material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonDrawMode The draw mode for the Babylon material\r\n * @returns The Babylon material\r\n */\r\n public createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Material {\r\n const extensionPromise = this._extensionsCreateMaterial(context, material, babylonDrawMode);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n const name = material.name || `material${material.index}`;\r\n const babylonMaterial = this._createDefaultMaterial(name, babylonDrawMode);\r\n\r\n return babylonMaterial;\r\n }\r\n\r\n /**\r\n * Loads properties from a glTF material into a Babylon material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void> {\r\n const extensionPromise = this._extensionsLoadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n promises.push(this.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n\r\n if (material.pbrMetallicRoughness) {\r\n promises.push(this._loadMaterialMetallicRoughnessPropertiesAsync(`${context}/pbrMetallicRoughness`, material.pbrMetallicRoughness, babylonMaterial));\r\n }\r\n\r\n this.loadMaterialAlphaProperties(context, material, babylonMaterial);\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n\r\n /**\r\n * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n public loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n babylonMaterial.emissiveColor = material.emissiveFactor ? Color3.FromArray(material.emissiveFactor) : new Color3(0, 0, 0);\r\n if (material.doubleSided) {\r\n babylonMaterial.backFaceCulling = false;\r\n babylonMaterial.twoSidedLighting = true;\r\n }\r\n\r\n if (material.normalTexture) {\r\n material.normalTexture.nonColorData = true;\r\n promises.push(\r\n this.loadTextureInfoAsync(`${context}/normalTexture`, material.normalTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Normal)`;\r\n babylonMaterial.bumpTexture = texture;\r\n })\r\n );\r\n\r\n babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;\r\n babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;\r\n if (material.normalTexture.scale != undefined) {\r\n babylonMaterial.bumpTexture.level = material.normalTexture.scale;\r\n }\r\n\r\n babylonMaterial.forceIrradianceInFragment = true;\r\n }\r\n\r\n if (material.occlusionTexture) {\r\n material.occlusionTexture.nonColorData = true;\r\n promises.push(\r\n this.loadTextureInfoAsync(`${context}/occlusionTexture`, material.occlusionTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Occlusion)`;\r\n babylonMaterial.ambientTexture = texture;\r\n })\r\n );\r\n\r\n babylonMaterial.useAmbientInGrayScale = true;\r\n if (material.occlusionTexture.strength != undefined) {\r\n babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;\r\n }\r\n }\r\n\r\n if (material.emissiveTexture) {\r\n promises.push(\r\n this.loadTextureInfoAsync(`${context}/emissiveTexture`, material.emissiveTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Emissive)`;\r\n babylonMaterial.emissiveTexture = texture;\r\n })\r\n );\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n\r\n /**\r\n * Loads the alpha properties from a glTF material into a Babylon material.\r\n * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n */\r\n public loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: Material): void {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const alphaMode = material.alphaMode || MaterialAlphaMode.OPAQUE;\r\n switch (alphaMode) {\r\n case MaterialAlphaMode.OPAQUE: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\r\n break;\r\n }\r\n case MaterialAlphaMode.MASK: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHATEST;\r\n babylonMaterial.alphaCutOff = material.alphaCutoff == undefined ? 0.5 : material.alphaCutoff;\r\n if (babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoTexture.hasAlpha = true;\r\n }\r\n break;\r\n }\r\n case MaterialAlphaMode.BLEND: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHABLEND;\r\n if (babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoTexture.hasAlpha = true;\r\n babylonMaterial.useAlphaFromAlbedoTexture = true;\r\n }\r\n break;\r\n }\r\n default: {\r\n throw new Error(`${context}/alphaMode: Invalid value (${material.alphaMode})`);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Loads a glTF texture info.\r\n * @param context The context when loading the asset\r\n * @param textureInfo The glTF texture info property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete\r\n */\r\n public loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void = () => {}): Promise<BaseTexture> {\r\n const extensionPromise = this._extensionsLoadTextureInfoAsync(context, textureInfo, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n this.logOpen(`${context}`);\r\n\r\n if (textureInfo.texCoord! >= 6) {\r\n throw new Error(`${context}/texCoord: Invalid value (${textureInfo.texCoord})`);\r\n }\r\n\r\n const texture = ArrayItem.Get(`${context}/index`, this._gltf.textures, textureInfo.index);\r\n texture._textureInfo = textureInfo;\r\n\r\n const promise = this._loadTextureAsync(`/textures/${textureInfo.index}`, texture, (babylonTexture) => {\r\n babylonTexture.coordinatesIndex = textureInfo.texCoord || 0;\r\n GLTFLoader.AddPointerMetadata(babylonTexture, context);\r\n this._parent.onTextureLoadedObservable.notifyObservers(babylonTexture);\r\n assign(babylonTexture);\r\n });\r\n\r\n this.logClose();\r\n\r\n return promise;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param texture\r\n * @param assign\r\n * @hidden\r\n */\r\n public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void = () => {}): Promise<BaseTexture> {\r\n const extensionPromise = this._extensionsLoadTextureAsync(context, texture, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n this.logOpen(`${context} ${texture.name || \"\"}`);\r\n\r\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._gltf.samplers, texture.sampler);\r\n const image = ArrayItem.Get(`${context}/source`, this._gltf.images, texture.source);\r\n const promise = this._createTextureAsync(context, sampler, image, assign, undefined, !texture._textureInfo.nonColorData);\r\n\r\n this.logClose();\r\n\r\n return promise;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param sampler\r\n * @param image\r\n * @param assign\r\n * @param textureLoaderOptions\r\n * @param useSRGBBuffer\r\n * @hidden\r\n */\r\n public _createTextureAsync(\r\n context: string,\r\n sampler: ISampler,\r\n image: IImage,\r\n assign: (babylonTexture: BaseTexture) => void = () => {},\r\n textureLoaderOptions?: any,\r\n useSRGBBuffer?: boolean\r\n ): Promise<BaseTexture> {\r\n const samplerData = this._loadSampler(`/samplers/${sampler.index}`, sampler);\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n const deferred = new Deferred<void>();\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const textureCreationOptions: ITextureCreationOptions = {\r\n noMipmap: samplerData.noMipMaps,\r\n invertY: false,\r\n samplingMode: samplerData.samplingMode,\r\n onLoad: () => {\r\n if (!this._disposed) {\r\n deferred.resolve();\r\n }\r\n },\r\n onError: (message?: string, exception?: any) => {\r\n if (!this._disposed) {\r\n deferred.reject(new Error(`${context}: ${exception && exception.message ? exception.message : message || \"Failed to load texture\"}`));\r\n }\r\n },\r\n mimeType: image.mimeType,\r\n loaderOptions: textureLoaderOptions,\r\n useSRGBBuffer: !!useSRGBBuffer && this._parent.useSRGBBuffers,\r\n };\r\n const babylonTexture = new Texture(null, this._babylonScene, textureCreationOptions);\r\n babylonTexture._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n promises.push(deferred.promise);\r\n\r\n promises.push(\r\n this.loadImageAsync(`/images/${image.index}`, image).then((data) => {\r\n const name = image.uri || `${this._fileName}#image${image.index}`;\r\n const dataUrl = `data:${this._uniqueRootUrl}${name}`;\r\n babylonTexture.updateURL(dataUrl, data);\r\n })\r\n );\r\n\r\n babylonTexture.wrapU = samplerData.wrapU;\r\n babylonTexture.wrapV = samplerData.wrapV;\r\n assign(babylonTexture);\r\n\r\n return Promise.all(promises).then(() => {\r\n return babylonTexture;\r\n });\r\n }\r\n\r\n private _loadSampler(context: string, sampler: ISampler): _ISamplerData {\r\n if (!sampler._data) {\r\n sampler._data = {\r\n noMipMaps: sampler.minFilter === TextureMinFilter.NEAREST || sampler.minFilter === TextureMinFilter.LINEAR,\r\n samplingMode: GLTFLoader._GetTextureSamplingMode(context, sampler),\r\n wrapU: GLTFLoader._GetTextureWrapMode(`${context}/wrapS`, sampler.wrapS),\r\n wrapV: GLTFLoader._GetTextureWrapMode(`${context}/wrapT`, sampler.wrapT),\r\n };\r\n }\r\n\r\n return sampler._data;\r\n }\r\n\r\n /**\r\n * Loads a glTF image.\r\n * @param context The context when loading the asset\r\n * @param image The glTF image property\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n public loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView> {\r\n if (!image._data) {\r\n this.logOpen(`${context} ${image.name || \"\"}`);\r\n\r\n if (image.uri) {\r\n image._data = this.loadUriAsync(`${context}/uri`, image, image.uri);\r\n } else {\r\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, image.bufferView);\r\n image._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView);\r\n }\r\n\r\n this.logClose();\r\n }\r\n\r\n return image._data;\r\n }\r\n\r\n /**\r\n * Loads a glTF uri.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property associated with the uri\r\n * @param uri The base64 or relative uri\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n public loadUriAsync(context: string, property: IProperty, uri: string): Promise<ArrayBufferView> {\r\n const extensionPromise = this._extensionsLoadUriAsync(context, property, uri);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n\r\n if (!GLTFLoader._ValidateUri(uri)) {\r\n throw new Error(`${context}: '${uri}' is invalid`);\r\n }\r\n\r\n if (IsBase64DataUrl(uri)) {\r\n const data = new Uint8Array(DecodeBase64UrlToBinary(uri));\r\n this.log(`${context}: Decoded ${uri.substr(0, 64)}... (${data.length} bytes)`);\r\n return Promise.resolve(data);\r\n }\r\n\r\n this.log(`${context}: Loading ${uri}`);\r\n\r\n return this._parent.preprocessUrlAsync(this._rootUrl + uri).then((url) => {\r\n return new Promise((resolve, reject) => {\r\n this._parent._loadFile(\r\n this._babylonScene,\r\n url,\r\n (data) => {\r\n if (!this._disposed) {\r\n this.log(`${context}: Loaded ${uri} (${(data as ArrayBuffer).byteLength} bytes)`);\r\n resolve(new Uint8Array(data as ArrayBuffer));\r\n }\r\n },\r\n true,\r\n (request) => {\r\n reject(new LoadFileError(`${context}: Failed to load '${uri}'${request ? \": \" + request.status + \" \" + request.statusText : \"\"}`, request));\r\n }\r\n );\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Adds a JSON pointer to the metadata of the Babylon object at `<object>.metadata.gltf.pointers`.\r\n * @param babylonObject the Babylon object with metadata\r\n * @param babylonObject.metadata\r\n * @param pointer the JSON pointer\r\n */\r\n public static AddPointerMetadata(babylonObject: { metadata: any }, pointer: string): void {\r\n const metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n const gltf = (metadata.gltf = metadata.gltf || {});\r\n const pointers = (gltf.pointers = gltf.pointers || []);\r\n pointers.push(pointer);\r\n }\r\n\r\n private static _GetTextureWrapMode(context: string, mode: TextureWrapMode | undefined): number {\r\n // Set defaults if undefined\r\n mode = mode == undefined ? TextureWrapMode.REPEAT : mode;\r\n\r\n switch (mode) {\r\n case TextureWrapMode.CLAMP_TO_EDGE:\r\n return Texture.CLAMP_ADDRESSMODE;\r\n case TextureWrapMode.MIRRORED_REPEAT:\r\n return Texture.MIRROR_ADDRESSMODE;\r\n case TextureWrapMode.REPEAT:\r\n return Texture.WRAP_ADDRESSMODE;\r\n default:\r\n Logger.Warn(`${context}: Invalid value (${mode})`);\r\n return Texture.WRAP_ADDRESSMODE;\r\n }\r\n }\r\n\r\n private static _GetTextureSamplingMode(context: string, sampler: ISampler): number {\r\n // Set defaults if undefined\r\n const magFilter = sampler.magFilter == undefined ? TextureMagFilter.LINEAR : sampler.magFilter;\r\n const minFilter = sampler.minFilter == undefined ? TextureMinFilter.LINEAR_MIPMAP_LINEAR : sampler.minFilter;\r\n\r\n if (magFilter === TextureMagFilter.LINEAR) {\r\n switch (minFilter) {\r\n case TextureMinFilter.NEAREST:\r\n return Texture.LINEAR_NEAREST;\r\n case TextureMinFilter.LINEAR:\r\n return Texture.LINEAR_LINEAR;\r\n case TextureMinFilter.NEAREST_MIPMAP_NEAREST:\r\n return Texture.LINEAR_NEAREST_MIPNEAREST;\r\n case TextureMinFilter.LINEAR_MIPMAP_NEAREST:\r\n return Texture.LINEAR_LINEAR_MIPNEAREST;\r\n case TextureMinFilter.NEAREST_MIPMAP_LINEAR:\r\n return Texture.LINEAR_NEAREST_MIPLINEAR;\r\n case TextureMinFilter.LINEAR_MIPMAP_LINEAR:\r\n return Texture.LINEAR_LINEAR_MIPLINEAR;\r\n default:\r\n Logger.Warn(`${context}/minFilter: Invalid value (${minFilter})`);\r\n return Texture.LINEAR_LINEAR_MIPLINEAR;\r\n }\r\n } else {\r\n if (magFilter !== TextureMagFilter.NEAREST) {\r\n Logger.Warn(`${context}/magFilter: Invalid value (${magFilter})`);\r\n }\r\n\r\n switch (minFilter) {\r\n case TextureMinFilter.NEAREST:\r\n return Texture.NEAREST_NEAREST;\r\n case TextureMinFilter.LINEAR:\r\n return Texture.NEAREST_LINEAR;\r\n case TextureMinFilter.NEAREST_MIPMAP_NEAREST:\r\n return Texture.NEAREST_NEAREST_MIPNEAREST;\r\n case TextureMinFilter.LINEAR_MIPMAP_NEAREST:\r\n return Texture.NEAREST_LINEAR_MIPNEAREST;\r\n case TextureMinFilter.NEAREST_MIPMAP_LINEAR:\r\n return Texture.NEAREST_NEAREST_MIPLINEAR;\r\n case TextureMinFilter.LINEAR_MIPMAP_LINEAR:\r\n return Texture.NEAREST_LINEAR_MIPLINEAR;\r\n default:\r\n Logger.Warn(`${context}/minFilter: Invalid value (${minFilter})`);\r\n return Texture.NEAREST_NEAREST_MIPNEAREST;\r\n }\r\n }\r\n }\r\n\r\n private static _GetTypedArrayConstructor(context: string, componentType: AccessorComponentType): TypedArrayConstructor {\r\n switch (componentType) {\r\n case AccessorComponentType.BYTE:\r\n return Int8Array;\r\n case AccessorComponentType.UNSIGNED_BYTE:\r\n return Uint8Array;\r\n case AccessorComponentType.SHORT:\r\n return Int16Array;\r\n case AccessorComponentType.UNSIGNED_SHORT:\r\n return Uint16Array;\r\n case AccessorComponentType.UNSIGNED_INT:\r\n return Uint32Array;\r\n case AccessorComponentType.FLOAT:\r\n return Float32Array;\r\n default:\r\n throw new Error(`${context}: Invalid component type ${componentType}`);\r\n }\r\n }\r\n\r\n private static _GetTypedArray(\r\n context: string,\r\n componentType: AccessorComponentType,\r\n bufferView: ArrayBufferView,\r\n byteOffset: number | undefined,\r\n length: number\r\n ): TypedArrayLike {\r\n const buffer = bufferView.buffer;\r\n byteOffset = bufferView.byteOffset + (byteOffset || 0);\r\n\r\n const constructor = GLTFLoader._GetTypedArrayConstructor(`${context}/componentType`, componentType);\r\n\r\n const componentTypeLength = VertexBuffer.GetTypeByteLength(componentType);\r\n if (byteOffset % componentTypeLength !== 0) {\r\n // HACK: Copy the buffer if byte offset is not a multiple of component type byte length.\r\n Logger.Warn(`${context}: Copying buffer as byte offset (${byteOffset}) is not a multiple of component type byte length (${componentTypeLength})`);\r\n return new constructor(buffer.slice(byteOffset, byteOffset + length * componentTypeLength), 0);\r\n }\r\n\r\n return new constructor(buffer, byteOffset, length);\r\n }\r\n\r\n private static _GetNumComponents(context: string, type: string): number {\r\n switch (type) {\r\n case \"SCALAR\":\r\n return 1;\r\n case \"VEC2\":\r\n return 2;\r\n case \"VEC3\":\r\n return 3;\r\n case \"VEC4\":\r\n return 4;\r\n case \"MAT2\":\r\n return 4;\r\n case \"MAT3\":\r\n return 9;\r\n case \"MAT4\":\r\n return 16;\r\n }\r\n\r\n throw new Error(`${context}: Invalid type (${type})`);\r\n }\r\n\r\n private static _ValidateUri(uri: string): boolean {\r\n return Tools.IsBase64(uri) || uri.indexOf(\"..\") === -1;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param mode\r\n * @hidden\r\n */\r\n public static _GetDrawMode(context: string, mode: number | undefined): number {\r\n if (mode == undefined) {\r\n mode = MeshPrimitiveMode.TRIANGLES;\r\n }\r\n\r\n switch (mode) {\r\n case MeshPrimitiveMode.POINTS:\r\n return Material.PointListDrawMode;\r\n case MeshPrimitiveMode.LINES:\r\n return Material.LineListDrawMode;\r\n case MeshPrimitiveMode.LINE_LOOP:\r\n return Material.LineLoopDrawMode;\r\n case MeshPrimitiveMode.LINE_STRIP:\r\n return Material.LineStripDrawMode;\r\n case MeshPrimitiveMode.TRIANGLES:\r\n return Material.TriangleFillMode;\r\n case MeshPrimitiveMode.TRIANGLE_STRIP:\r\n return Material.TriangleStripDrawMode;\r\n case MeshPrimitiveMode.TRIANGLE_FAN:\r\n return Material.TriangleFanDrawMode;\r\n }\r\n\r\n throw new Error(`${context}: Invalid mesh primitive mode (${mode})`);\r\n }\r\n\r\n private _compileMaterialsAsync(): Promise<void> {\r\n this._parent._startPerformanceCounter(\"Compile materials\");\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n if (this._gltf.materials) {\r\n for (const material of this._gltf.materials) {\r\n if (material._data) {\r\n for (const babylonDrawMode in material._data) {\r\n const babylonData = material._data[babylonDrawMode];\r\n for (const babylonMesh of babylonData.babylonMeshes) {\r\n // Ensure nonUniformScaling is set if necessary.\r\n babylonMesh.computeWorldMatrix(true);\r\n\r\n const babylonMaterial = babylonData.babylonMaterial;\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh));\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { useInstances: true }));\r\n if (this._parent.useClipPlane) {\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true }));\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true, useInstances: true }));\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return Promise.all(promises).then(() => {\r\n this._parent._endPerformanceCounter(\"Compile materials\");\r\n });\r\n }\r\n\r\n private _compileShadowGeneratorsAsync(): Promise<void> {\r\n this._parent._startPerformanceCounter(\"Compile shadow generators\");\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n const lights = this._babylonScene.lights;\r\n for (const light of lights) {\r\n const generator = light.getShadowGenerator();\r\n if (generator) {\r\n promises.push(generator.forceCompilationAsync());\r\n }\r\n }\r\n\r\n return Promise.all(promises).then(() => {\r\n this._parent._endPerformanceCounter(\"Compile shadow generators\");\r\n });\r\n }\r\n\r\n private _forEachExtensions(action: (extension: IGLTFLoaderExtension) => void): void {\r\n for (const extension of this._extensions) {\r\n if (extension.enabled) {\r\n action(extension);\r\n }\r\n }\r\n }\r\n\r\n private _applyExtensions<T>(property: IProperty, functionName: string, actionAsync: (extension: IGLTFLoaderExtension) => Nullable<T> | undefined): Nullable<T> {\r\n for (const extension of this._extensions) {\r\n if (extension.enabled) {\r\n const id = `${extension.name}.${functionName}`;\r\n const loaderProperty = property as ILoaderProperty;\r\n loaderProperty._activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions || {};\r\n const activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions;\r\n if (!activeLoaderExtensionFunctions[id]) {\r\n activeLoaderExtensionFunctions[id] = true;\r\n\r\n try {\r\n const result = actionAsync(extension);\r\n if (result) {\r\n return result;\r\n }\r\n } finally {\r\n delete activeLoaderExtensionFunctions[id];\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private _extensionsOnLoading(): void {\r\n this._forEachExtensions((extension) => extension.onLoading && extension.onLoading());\r\n }\r\n\r\n private _extensionsOnReady(): void {\r\n this._forEachExtensions((extension) => extension.onReady && extension.onReady());\r\n }\r\n\r\n private _extensionsLoadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>> {\r\n return this._applyExtensions(scene, \"loadScene\", (extension) => extension.loadSceneAsync && extension.loadSceneAsync(context, scene));\r\n }\r\n\r\n private _extensionsLoadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return this._applyExtensions(node, \"loadNode\", (extension) => extension.loadNodeAsync && extension.loadNodeAsync(context, node, assign));\r\n }\r\n\r\n private _extensionsLoadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>> {\r\n return this._applyExtensions(camera, \"loadCamera\", (extension) => extension.loadCameraAsync && extension.loadCameraAsync(context, camera, assign));\r\n }\r\n\r\n private _extensionsLoadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>> {\r\n return this._applyExtensions(primitive, \"loadVertexData\", (extension) => extension._loadVertexDataAsync && extension._loadVertexDataAsync(context, primitive, babylonMesh));\r\n }\r\n\r\n private _extensionsLoadMeshPrimitiveAsync(\r\n context: string,\r\n name: string,\r\n node: INode,\r\n mesh: IMesh,\r\n primitive: IMeshPrimitive,\r\n assign: (babylonMesh: AbstractMesh) => void\r\n ): Nullable<Promise<AbstractMesh>> {\r\n return this._applyExtensions(\r\n primitive,\r\n \"loadMeshPrimitive\",\r\n (extension) => extension._loadMeshPrimitiveAsync && extension._loadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign)\r\n );\r\n }\r\n\r\n private _extensionsLoadMaterialAsync(\r\n context: string,\r\n material: IMaterial,\r\n babylonMesh: Nullable<Mesh>,\r\n babylonDrawMode: number,\r\n assign: (babylonMaterial: Material) => void\r\n ): Nullable<Promise<Material>> {\r\n return this._applyExtensions(\r\n material,\r\n \"loadMaterial\",\r\n (extension) => extension._loadMaterialAsync && extension._loadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign)\r\n );\r\n }\r\n\r\n private _extensionsCreateMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material> {\r\n return this._applyExtensions(material, \"createMaterial\", (extension) => extension.createMaterial && extension.createMaterial(context, material, babylonDrawMode));\r\n }\r\n\r\n private _extensionsLoadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return this._applyExtensions(\r\n material,\r\n \"loadMaterialProperties\",\r\n (extension) => extension.loadMaterialPropertiesAsync && extension.loadMaterialPropertiesAsync(context, material, babylonMaterial)\r\n );\r\n }\r\n\r\n private _extensionsLoadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return this._applyExtensions(textureInfo, \"loadTextureInfo\", (extension) => extension.loadTextureInfoAsync && extension.loadTextureInfoAsync(context, textureInfo, assign));\r\n }\r\n\r\n private _extensionsLoadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return this._applyExtensions(texture, \"loadTexture\", (extension) => extension._loadTextureAsync && extension._loadTextureAsync(context, texture, assign));\r\n }\r\n\r\n private _extensionsLoadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>> {\r\n return this._applyExtensions(animation, \"loadAnimation\", (extension) => extension.loadAnimationAsync && extension.loadAnimationAsync(context, animation));\r\n }\r\n\r\n private _extensionsLoadSkinAsync(context: string, node: INode, skin: ISkin): Nullable<Promise<void>> {\r\n return this._applyExtensions(skin, \"loadSkin\", (extension) => extension._loadSkinAsync && extension._loadSkinAsync(context, node, skin));\r\n }\r\n\r\n private _extensionsLoadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>> {\r\n return this._applyExtensions(property, \"loadUri\", (extension) => extension._loadUriAsync && extension._loadUriAsync(context, property, uri));\r\n }\r\n\r\n private _extensionsLoadBufferViewAsync(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>> {\r\n return this._applyExtensions(bufferView, \"loadBufferView\", (extension) => extension.loadBufferViewAsync && extension.loadBufferViewAsync(context, bufferView));\r\n }\r\n\r\n private _extensionsLoadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>> {\r\n return this._applyExtensions(buffer, \"loadBuffer\", (extension) => extension.loadBufferAsync && extension.loadBufferAsync(context, buffer, byteOffset, byteLength));\r\n }\r\n\r\n /**\r\n * Helper method called by a loader extension to load an glTF extension.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property to load the extension from\r\n * @param extensionName The name of the extension to load\r\n * @param actionAsync The action to run\r\n * @returns The promise returned by actionAsync or null if the extension does not exist\r\n */\r\n public static LoadExtensionAsync<TExtension = any, TResult = void>(\r\n context: string,\r\n property: IProperty,\r\n extensionName: string,\r\n actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>\r\n ): Nullable<Promise<TResult>> {\r\n if (!property.extensions) {\r\n return null;\r\n }\r\n\r\n const extensions = property.extensions;\r\n\r\n const extension = extensions[extensionName] as TExtension;\r\n if (!extension) {\r\n return null;\r\n }\r\n\r\n return actionAsync(`${context}/extensions/${extensionName}`, extension);\r\n }\r\n\r\n /**\r\n * Helper method called by a loader extension to load a glTF extra.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property to load the extra from\r\n * @param extensionName The name of the extension to load\r\n * @param actionAsync The action to run\r\n * @returns The promise returned by actionAsync or null if the extra does not exist\r\n */\r\n public static LoadExtraAsync<TExtra = any, TResult = void>(\r\n context: string,\r\n property: IProperty,\r\n extensionName: string,\r\n actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>\r\n ): Nullable<Promise<TResult>> {\r\n if (!property.extras) {\r\n return null;\r\n }\r\n\r\n const extras = property.extras;\r\n\r\n const extra = extras[extensionName] as TExtra;\r\n if (!extra) {\r\n return null;\r\n }\r\n\r\n return actionAsync(`${context}/extras/${extensionName}`, extra);\r\n }\r\n\r\n /**\r\n * Checks for presence of an extension.\r\n * @param name The name of the extension to check\r\n * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`\r\n */\r\n public isExtensionUsed(name: string): boolean {\r\n return !!this._gltf.extensionsUsed && this._gltf.extensionsUsed.indexOf(name) !== -1;\r\n }\r\n\r\n /**\r\n * Increments the indentation level and logs a message.\r\n * @param message The message to log\r\n */\r\n public logOpen(message: string): void {\r\n this._parent._logOpen(message);\r\n }\r\n\r\n /**\r\n * Decrements the indentation level.\r\n */\r\n public logClose(): void {\r\n this._parent._logClose();\r\n }\r\n\r\n /**\r\n * Logs a message\r\n * @param message The message to log\r\n */\r\n public log(message: string): void {\r\n this._parent._log(message);\r\n }\r\n\r\n /**\r\n * Starts a performance counter.\r\n * @param counterName The name of the performance counter\r\n */\r\n public startPerformanceCounter(counterName: string): void {\r\n this._parent._startPerformanceCounter(counterName);\r\n }\r\n\r\n /**\r\n * Ends a performance counter.\r\n * @param counterName The name of the performance counter\r\n */\r\n public endPerformanceCounter(counterName: string): void {\r\n this._parent._endPerformanceCounter(counterName);\r\n }\r\n}\r\n\r\nGLTFFileLoader._CreateGLTF2Loader = (parent) => new GLTFLoader(parent);\r\n"]}
|