@babylonjs/loaders 7.26.3 → 7.26.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFLoader.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/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;AAKrD,OAAO,EAAE,cAAc,EAAE,qDAAuC;AAChE,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;AAChD,OAAO,EAAE,YAAY,EAAE,+CAAiC;AAExD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,WAAW,EAAE,6CAA+B;AACrD,OAAO,EAAE,kBAAkB,EAAE,oDAAsC;AA0CnE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAElI,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,aAAa,EAAE,0CAA4B;AAC9F,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAE1C,OAAO,EAAE,YAAY,EAAE,gDAAkC;AAGzD,OAAO,EAAE,iB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IAED;;OAEG;IACI,QAAQ;QACX,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,GAAG,CAAC,OAAe;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,uBAAuB,CAAC,WAAmB;QAC9C,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACI,qBAAqB,CAAC,WAAmB;QAC5C,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;;AAttFD;;GAEG;AACoB,yBAAc,GAAa,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,AAA1B,CAA2B;AAstFpE,cAAc,CAAC,kBAAkB,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,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 type { Animation } from \"core/Animations/animation\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { IAnimationKey } from \"core/Animations/animationKey\";\r\nimport { AnimationKeyInterpolation } from \"core/Animations/animationKey\";\r\nimport { AnimationGroup } from \"core/Animations/animationGroup\";\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 { 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 AnimationChannelTargetPath,\r\n AnimationSamplerInterpolation,\r\n AccessorType,\r\n CameraType,\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 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 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,\r\n _ISamplerData,\r\n IAnimationChannel,\r\n IAnimationSampler,\r\n _IAnimationSamplerData,\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 { 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\nimport { BoundingInfo } from \"core/Culling/boundingInfo\";\r\nimport type { AssetContainer } from \"core/assetContainer\";\r\nimport type { AnimationPropertyInfo } from \"./glTFLoaderAnimation\";\r\nimport { nodeAnimationData } from \"./glTFLoaderAnimation\";\r\nimport type { IObjectInfo } from \"core/ObjectModel/objectModelInterfaces\";\r\nimport { registeredGLTFExtensions, registerGLTFExtension, unregisterGLTFExtension } from \"./glTFLoaderExtensionRegistry\";\r\nimport type { GLTFExtensionFactory } from \"./glTFLoaderExtensionRegistry\";\r\nexport { GLTFFileLoader };\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 IWithMetadata {\r\n metadata: any;\r\n _internalMetadata: any;\r\n}\r\n\r\n// https://stackoverflow.com/a/48218209\r\nfunction mergeDeep(...objects: any[]): any {\r\n const isObject = (obj: any) => obj && typeof obj === \"object\";\r\n\r\n return objects.reduce((prev, obj) => {\r\n Object.keys(obj).forEach((key) => {\r\n const pVal = prev[key];\r\n const oVal = obj[key];\r\n\r\n if (Array.isArray(pVal) && Array.isArray(oVal)) {\r\n prev[key] = pVal.concat(...oVal);\r\n } else if (isObject(pVal) && isObject(oVal)) {\r\n prev[key] = mergeDeep(pVal, oVal);\r\n } else {\r\n prev[key] = oVal;\r\n }\r\n });\r\n\r\n return prev;\r\n }, {});\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 * Gets an item from the given array or returns null if not available.\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 or null\r\n */\r\n public static TryGet<T>(array: ArrayLike<T> | undefined, index: number | undefined): Nullable<T> {\r\n if (!array || index == undefined || !array[index]) {\r\n return null;\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?: IArrayItem[]): 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/** @internal */\r\nexport interface IAnimationTargetInfo {\r\n /** @internal */\r\n target: unknown;\r\n\r\n /** @internal */\r\n properties: Array<AnimationPropertyInfo>;\r\n}\r\n\r\n/**\r\n * The glTF 2.0 loader\r\n */\r\nexport class GLTFLoader implements IGLTFLoader {\r\n /** @internal */\r\n public readonly _completePromises = new Array<Promise<unknown>>();\r\n\r\n /** @internal */\r\n public _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n /** Storage */\r\n public _babylonLights: Light[] = [];\r\n\r\n /** @internal */\r\n public _disableInstancedMesh = 0;\r\n\r\n /** @internal */\r\n public _allMaterialsDirtyRequired = false;\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<TransformNode> = null;\r\n private _defaultBabylonMaterialData: { [drawMode: number]: Material } = {};\r\n private readonly _postSceneLoadActions = new Array<() => void>();\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 * @deprecated Please use registerGLTFExtension instead.\r\n */\r\n public static RegisterExtension(name: string, factory: GLTFExtensionFactory): void {\r\n registerGLTFExtension(name, false, factory);\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 * @deprecated Please use unregisterGLTFExtension instead.\r\n */\r\n public static UnregisterExtension(name: string): boolean {\r\n return unregisterGLTFExtension(name);\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 node when loading the asset.\r\n */\r\n public get rootBabylonMesh(): Nullable<TransformNode> {\r\n return this._rootBabylonMesh;\r\n }\r\n\r\n /**\r\n * The root url when loading the asset.\r\n */\r\n public get rootUrl(): Nullable<string> {\r\n return this._rootUrl;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(parent: GLTFFileLoader) {\r\n this._parent = parent;\r\n }\r\n\r\n /** @internal */\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 * @internal\r\n */\r\n public importMeshAsync(\r\n meshesNames: string | readonly string[] | null | undefined,\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 spriteManagers: [],\r\n };\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * @internal\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(async () => {\r\n this._rootUrl = rootUrl;\r\n this._uniqueRootUrl = !rootUrl.startsWith(\"file:\") && fileName ? rootUrl : `${rootUrl}${Date.now()}/`;\r\n this._fileName = fileName;\r\n this._allMaterialsDirtyRequired = false;\r\n\r\n await this._loadExtensionsAsync();\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<unknown>>();\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 if (this._allMaterialsDirtyRequired) {\r\n // This can happen if we add a light for instance as it will impact the whole scene.\r\n // This automatically resets everything if needed.\r\n this._babylonScene.blockMaterialDirtyMechanism = oldBlockMaterialDirtyMechanism;\r\n } else {\r\n // By default a newly created material is dirty so there is no need to flag the full scene as dirty.\r\n // For perf reasons, we then bypass blockMaterialDirtyMechanism as this would \"dirty\" the entire scene.\r\n this._babylonScene._forceBlockMaterialDirtyMechanism(oldBlockMaterialDirtyMechanism);\r\n }\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 && this._rootBabylonMesh !== this._parent.customRootNode) {\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 async _loadExtensionsAsync() {\r\n const extensionPromises: Promise<IGLTFLoaderExtension>[] = [];\r\n\r\n registeredGLTFExtensions.forEach((registeredExtension, name) => {\r\n // Don't load explicitly disabled extensions.\r\n if (this.parent.extensionOptions[name]?.enabled === false) {\r\n // But warn if the disabled extension is used by the model.\r\n if (registeredExtension.isGLTFExtension && this.isExtensionUsed(name)) {\r\n Logger.Warn(`Extension ${name} is used but has been explicitly disabled.`);\r\n }\r\n }\r\n // Load loader extensions that are not a glTF extension, as well as extensions that are glTF extensions and are used by the model.\r\n else if (!registeredExtension.isGLTFExtension || this.isExtensionUsed(name)) {\r\n extensionPromises.push(\r\n (async () => {\r\n const extension = await registeredExtension.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._parent.onExtensionLoadedObservable.notifyObservers(extension);\r\n return extension;\r\n })()\r\n );\r\n }\r\n });\r\n\r\n this._extensions.push(...(await Promise.all(extensionPromises)));\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 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 if (this.parent.extensionOptions[name]?.enabled === false) {\r\n throw new Error(`Required extension ${name} is disabled`);\r\n }\r\n throw new Error(`Required extension ${name} is not available`);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _createRootNode(): INode {\r\n if (this._parent.customRootNode !== undefined) {\r\n this._rootBabylonMesh = this._parent.customRootNode;\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n _babylonTransformNode: this._rootBabylonMesh === null ? undefined : this._rootBabylonMesh,\r\n index: -1,\r\n };\r\n }\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const rootMesh = new Mesh(\"__root__\", this._babylonScene);\r\n this._rootBabylonMesh = rootMesh;\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 // eslint-disable-next-line @typescript-eslint/naming-convention\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(rootMesh);\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<unknown>>();\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: 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: AbstractMesh[] = [];\r\n\r\n // Root mesh is always first, if available.\r\n if (this._rootBabylonMesh instanceof AbstractMesh) {\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: 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: 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: 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<unknown>>();\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 const hasMesh = node.mesh != undefined;\r\n const hasSkin = this._parent.loadSkins && node.skin != undefined;\r\n\r\n if (!hasMesh || hasSkin) {\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 (hasMesh) {\r\n if (hasSkin) {\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 const babylonTransformNodeForSkin = node._babylonTransformNodeForSkin!;\r\n\r\n // Merge the metadata from the skin node to the skinned mesh in case a loader extension added metadata.\r\n babylonTransformNode.metadata = mergeDeep(babylonTransformNodeForSkin.metadata, babylonTransformNode.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 all the nodes are parented before parenting the skinned mesh.\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 // Handle special case when the parent of the skeleton root is the skinned mesh.\r\n const parentNode = ArrayItem.Get(`/skins/${skin.index}/skeleton`, this._gltf.nodes, skin.skeleton).parent!;\r\n if (node.index === parentNode.index) {\r\n babylonTransformNode.parent = babylonTransformNodeForSkin.parent;\r\n } else {\r\n babylonTransformNode.parent = parentNode._babylonTransformNode!;\r\n }\r\n } else {\r\n babylonTransformNode.parent = this._rootBabylonMesh;\r\n }\r\n\r\n this._parent.onSkinLoadedObservable.notifyObservers({ node: babylonTransformNodeForSkin, skinnedNode: babylonTransformNode });\r\n });\r\n })\r\n );\r\n })\r\n );\r\n } else {\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 }\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, 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<unknown>>();\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 * @internal 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<unknown>;\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<unknown>>();\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.sideOrientation = 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 if (this._disposed) {\r\n return;\r\n }\r\n\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<unknown>>();\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 = (name: string, kind: string, callback?: (accessor: IAccessor) => void) => {\r\n if (attributes[name] == 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/${name}`, this._gltf.accessors, attributes[name]);\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 if (accessor.min && accessor.max) {\r\n const min = TmpVectors.Vector3[0].copyFromFloats(...(accessor.min as [number, number, number]));\r\n const max = TmpVectors.Vector3[1].copyFromFloats(...(accessor.max as [number, number, number]));\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 const oneOverDivider = 1 / divider;\r\n min.scaleInPlace(oneOverDivider);\r\n max.scaleInPlace(oneOverDivider);\r\n }\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 || !this._parent.loadMorphTargets) {\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 this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n babylonMesh.morphTargetManager = new MorphTargetManager(this._babylonScene);\r\n babylonMesh.morphTargetManager._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n\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 || !this._parent.loadMorphTargets) {\r\n return Promise.resolve();\r\n }\r\n\r\n const promises = new Array<Promise<unknown>>();\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<unknown>>();\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 if (!this._parent.loadSkins) {\r\n return Promise.resolve();\r\n }\r\n\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: 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 node._isJoint = true;\r\n\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.getAbsoluteInverseBindMatrix(), baseMatrix);\r\n }\r\n\r\n babylonBone.updateMatrix(baseMatrix, false, false);\r\n babylonBone._updateAbsoluteBindMatrices(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<unknown>>();\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 camera._babylonCamera = babylonCamera;\r\n\r\n // Rotation by 180 as glTF has a different convention than Babylon.\r\n babylonCamera.rotation.set(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<unknown>>();\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(\r\n this._loadAnimationChannelAsync(`${context}/channels/${channel.index}`, context, animation, channel, (babylonTarget, babylonAnimation) => {\r\n babylonTarget.animations = babylonTarget.animations || [];\r\n babylonTarget.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, babylonTarget);\r\n })\r\n );\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\r\n * 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 onLoad Called for each animation loaded\r\n * @returns A void promise that resolves when the 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 onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Promise<void> {\r\n const promise = this._extensionsLoadAnimationChannelAsync(context, animationContext, animation, channel, onLoad);\r\n if (promise) {\r\n return promise;\r\n }\r\n\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 const channelTargetPath = channel.target.path;\r\n const pathIsWeights = channelTargetPath === AnimationChannelTargetPath.WEIGHTS;\r\n\r\n // Ignore animations that have no animation targets.\r\n if ((pathIsWeights && !targetNode._numMorphTargets) || (!pathIsWeights && !targetNode._babylonTransformNode)) {\r\n return Promise.resolve();\r\n }\r\n\r\n // Don't load node animations if disabled.\r\n if (!this._parent.loadNodeAnimations && !pathIsWeights && !targetNode._isJoint) {\r\n return Promise.resolve();\r\n }\r\n\r\n let properties: Array<AnimationPropertyInfo>;\r\n switch (channelTargetPath) {\r\n case AnimationChannelTargetPath.TRANSLATION: {\r\n properties = nodeAnimationData.translation;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.ROTATION: {\r\n properties = nodeAnimationData.rotation;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.SCALE: {\r\n properties = nodeAnimationData.scale;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.WEIGHTS: {\r\n properties = nodeAnimationData.weights;\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 const targetInfo: IObjectInfo<AnimationPropertyInfo[]> = {\r\n object: targetNode,\r\n info: properties,\r\n };\r\n\r\n return this._loadAnimationChannelFromTargetInfoAsync(context, animationContext, animation, channel, targetInfo, onLoad);\r\n }\r\n\r\n /**\r\n * @hidden\r\n * 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 targetInfo The glTF target and properties\r\n * @param onLoad Called for each animation loaded\r\n * @returns A void promise that resolves when the load is complete\r\n */\r\n public _loadAnimationChannelFromTargetInfoAsync(\r\n context: string,\r\n animationContext: string,\r\n animation: IAnimation,\r\n channel: IAnimationChannel,\r\n targetInfo: IObjectInfo<AnimationPropertyInfo[]>,\r\n onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Promise<void> {\r\n const fps = this.parent.targetFps;\r\n const invfps = 1 / fps;\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 numAnimations = 0;\r\n\r\n const target = targetInfo.object;\r\n const propertyInfos = targetInfo.info;\r\n // Extract the corresponding values from the read value.\r\n // GLTF values may be dispatched to several Babylon properties.\r\n // For example, baseColorFactor [`r`, `g`, `b`, `a`] is dispatched to\r\n // - albedoColor as Color3(`r`, `g`, `b`)\r\n // - alpha as `a`\r\n for (const propertyInfo of propertyInfos) {\r\n const stride = propertyInfo.getStride(target);\r\n const input = data.input;\r\n const output = data.output;\r\n const keys = new Array<IAnimationKey>(input.length);\r\n let outputOffset = 0;\r\n\r\n switch (data.interpolation) {\r\n case AnimationSamplerInterpolation.STEP: {\r\n for (let index = 0; index < input.length; index++) {\r\n const value = propertyInfo.getValue(target, output, outputOffset, 1);\r\n outputOffset += stride;\r\n\r\n keys[index] = {\r\n frame: input[index] * fps,\r\n value: value,\r\n interpolation: AnimationKeyInterpolation.STEP,\r\n };\r\n }\r\n break;\r\n }\r\n case AnimationSamplerInterpolation.CUBICSPLINE: {\r\n for (let index = 0; index < input.length; index++) {\r\n const inTangent = propertyInfo.getValue(target, output, outputOffset, invfps);\r\n outputOffset += stride;\r\n const value = propertyInfo.getValue(target, output, outputOffset, 1);\r\n outputOffset += stride;\r\n const outTangent = propertyInfo.getValue(target, output, outputOffset, invfps);\r\n outputOffset += stride;\r\n\r\n keys[index] = {\r\n frame: input[index] * fps,\r\n inTangent: inTangent,\r\n value: value,\r\n outTangent: outTangent,\r\n };\r\n }\r\n break;\r\n }\r\n case AnimationSamplerInterpolation.LINEAR: {\r\n for (let index = 0; index < input.length; index++) {\r\n const value = propertyInfo.getValue(target, output, outputOffset, 1);\r\n outputOffset += stride;\r\n\r\n keys[index] = {\r\n frame: input[index] * fps,\r\n value: value,\r\n };\r\n }\r\n break;\r\n }\r\n }\r\n\r\n if (outputOffset > 0) {\r\n const name = `${animation.name || `animation${animation.index}`}_channel${channel.index}_${numAnimations}`;\r\n propertyInfo.buildAnimations(target, name, fps, keys, (babylonAnimatable, babylonAnimation) => {\r\n ++numAnimations;\r\n onLoad(babylonAnimatable, babylonAnimation);\r\n });\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 * @internal\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 /**\r\n * @internal\r\n */\r\n public _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 /**\r\n * @internal\r\n */\r\n public _loadVertexBufferViewAsync(bufferView: IBufferView): Promise<Buffer> {\r\n if (bufferView._babylonBuffer) {\r\n return bufferView._babylonBuffer;\r\n }\r\n\r\n const engine = this._babylonScene.getEngine();\r\n bufferView._babylonBuffer = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n return new Buffer(engine, data, false);\r\n });\r\n\r\n return bufferView._babylonBuffer;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _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 const engine = this._babylonScene.getEngine();\r\n\r\n if (accessor.sparse || accessor.bufferView == undefined) {\r\n accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then((data) => {\r\n return new VertexBuffer(engine, 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 numComponents = GLTFLoader._GetNumComponents(context, accessor.type);\r\n return new VertexBuffer(\r\n engine,\r\n babylonBuffer,\r\n kind,\r\n false,\r\n undefined,\r\n bufferView.byteStride,\r\n undefined,\r\n accessor.byteOffset,\r\n numComponents,\r\n accessor.componentType,\r\n accessor.normalized,\r\n true,\r\n undefined,\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<unknown>>();\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 * @internal\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<unknown>>();\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<unknown>>();\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 && babylonMaterial.bumpTexture) {\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 babylonMaterial.alpha = 1.0; // Force alpha to 1.0 for opaque mode.\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 * @internal\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 * @internal\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?: unknown,\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<unknown>>();\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.substring(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 _internalMetadata of the Babylon object at `<object>._internalMetadata.gltf.pointers`.\r\n * @param babylonObject the Babylon object with _internalMetadata\r\n * @param pointer the JSON pointer\r\n */\r\n public static AddPointerMetadata(babylonObject: IWithMetadata, pointer: string): void {\r\n babylonObject.metadata = babylonObject.metadata || {};\r\n const metadata = (babylonObject._internalMetadata = babylonObject._internalMetadata || {});\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 * @internal\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<unknown>>();\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<unknown>>();\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 _extensionsLoadAnimationChannelAsync(\r\n context: string,\r\n animationContext: string,\r\n animation: IAnimation,\r\n channel: IAnimationChannel,\r\n onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Nullable<Promise<void>> {\r\n return this._applyExtensions(\r\n animation,\r\n \"loadAnimationChannel\",\r\n (extension) => extension._loadAnimationChannelAsync && extension._loadAnimationChannelAsync(context, animationContext, animation, channel, onLoad)\r\n );\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 = unknown, 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 = unknown, 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"]}
|
1
|
+
{"version":3,"file":"glTFLoader.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/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;AAMrD,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;AAChD,OAAO,EAAE,YAAY,EAAE,+CAAiC;AAExD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,WAAW,EAAE,6CAA+B;AACrD,OAAO,EAAE,kBAAkB,EAAE,oDAAsC;AA0CnE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAElI,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,aAAa,EAAE,0CAA4B;AAC9F,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAE1C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,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzF,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,OAAe;QAC1B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,QAAQ;QACX,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,GAAG,CAAC,OAAe;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,uBAAuB,CAAC,WAAmB;QAC9C,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACI,qBAAqB,CAAC,WAAmB;QAC5C,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;;AAztFD;;GAEG;AACoB,yBAAc,GAAa,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,AAA1B,CAA2B;AAytFpE,cAAc,CAAC,kBAAkB,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,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 type { Animation } from \"core/Animations/animation\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { IAnimationKey } from \"core/Animations/animationKey\";\r\nimport { AnimationKeyInterpolation } from \"core/Animations/animationKey\";\r\nimport type { AnimationGroup } from \"core/Animations/animationGroup\";\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 { 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 AnimationChannelTargetPath,\r\n AnimationSamplerInterpolation,\r\n AccessorType,\r\n CameraType,\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 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 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,\r\n _ISamplerData,\r\n IAnimationChannel,\r\n IAnimationSampler,\r\n _IAnimationSamplerData,\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 { 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\nimport { BoundingInfo } from \"core/Culling/boundingInfo\";\r\nimport type { AssetContainer } from \"core/assetContainer\";\r\nimport type { AnimationPropertyInfo } from \"./glTFLoaderAnimation\";\r\nimport { nodeAnimationData } from \"./glTFLoaderAnimation\";\r\nimport type { IObjectInfo } from \"core/ObjectModel/objectModelInterfaces\";\r\nimport { registeredGLTFExtensions, registerGLTFExtension, unregisterGLTFExtension } from \"./glTFLoaderExtensionRegistry\";\r\nimport type { GLTFExtensionFactory } from \"./glTFLoaderExtensionRegistry\";\r\nexport { GLTFFileLoader };\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 IWithMetadata {\r\n metadata: any;\r\n _internalMetadata: any;\r\n}\r\n\r\n// https://stackoverflow.com/a/48218209\r\nfunction mergeDeep(...objects: any[]): any {\r\n const isObject = (obj: any) => obj && typeof obj === \"object\";\r\n\r\n return objects.reduce((prev, obj) => {\r\n Object.keys(obj).forEach((key) => {\r\n const pVal = prev[key];\r\n const oVal = obj[key];\r\n\r\n if (Array.isArray(pVal) && Array.isArray(oVal)) {\r\n prev[key] = pVal.concat(...oVal);\r\n } else if (isObject(pVal) && isObject(oVal)) {\r\n prev[key] = mergeDeep(pVal, oVal);\r\n } else {\r\n prev[key] = oVal;\r\n }\r\n });\r\n\r\n return prev;\r\n }, {});\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 * Gets an item from the given array or returns null if not available.\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 or null\r\n */\r\n public static TryGet<T>(array: ArrayLike<T> | undefined, index: number | undefined): Nullable<T> {\r\n if (!array || index == undefined || !array[index]) {\r\n return null;\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?: IArrayItem[]): 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/** @internal */\r\nexport interface IAnimationTargetInfo {\r\n /** @internal */\r\n target: unknown;\r\n\r\n /** @internal */\r\n properties: Array<AnimationPropertyInfo>;\r\n}\r\n\r\n/**\r\n * The glTF 2.0 loader\r\n */\r\nexport class GLTFLoader implements IGLTFLoader {\r\n /** @internal */\r\n public readonly _completePromises = new Array<Promise<unknown>>();\r\n\r\n /** @internal */\r\n public _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n /** Storage */\r\n public _babylonLights: Light[] = [];\r\n\r\n /** @internal */\r\n public _disableInstancedMesh = 0;\r\n\r\n /** @internal */\r\n public _allMaterialsDirtyRequired = false;\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<TransformNode> = null;\r\n private _defaultBabylonMaterialData: { [drawMode: number]: Material } = {};\r\n private readonly _postSceneLoadActions = new Array<() => void>();\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 * @deprecated Please use registerGLTFExtension instead.\r\n */\r\n public static RegisterExtension(name: string, factory: GLTFExtensionFactory): void {\r\n registerGLTFExtension(name, false, factory);\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 * @deprecated Please use unregisterGLTFExtension instead.\r\n */\r\n public static UnregisterExtension(name: string): boolean {\r\n return unregisterGLTFExtension(name);\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 node when loading the asset.\r\n */\r\n public get rootBabylonMesh(): Nullable<TransformNode> {\r\n return this._rootBabylonMesh;\r\n }\r\n\r\n /**\r\n * The root url when loading the asset.\r\n */\r\n public get rootUrl(): Nullable<string> {\r\n return this._rootUrl;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(parent: GLTFFileLoader) {\r\n this._parent = parent;\r\n }\r\n\r\n /** @internal */\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 * @internal\r\n */\r\n public importMeshAsync(\r\n meshesNames: string | readonly string[] | null | undefined,\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 spriteManagers: [],\r\n };\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * @internal\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(async () => {\r\n this._rootUrl = rootUrl;\r\n this._uniqueRootUrl = !rootUrl.startsWith(\"file:\") && fileName ? rootUrl : `${rootUrl}${Date.now()}/`;\r\n this._fileName = fileName;\r\n this._allMaterialsDirtyRequired = false;\r\n\r\n await this._loadExtensionsAsync();\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<unknown>>();\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 if (this._allMaterialsDirtyRequired) {\r\n // This can happen if we add a light for instance as it will impact the whole scene.\r\n // This automatically resets everything if needed.\r\n this._babylonScene.blockMaterialDirtyMechanism = oldBlockMaterialDirtyMechanism;\r\n } else {\r\n // By default a newly created material is dirty so there is no need to flag the full scene as dirty.\r\n // For perf reasons, we then bypass blockMaterialDirtyMechanism as this would \"dirty\" the entire scene.\r\n this._babylonScene._forceBlockMaterialDirtyMechanism(oldBlockMaterialDirtyMechanism);\r\n }\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 && this._rootBabylonMesh !== this._parent.customRootNode) {\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 async _loadExtensionsAsync() {\r\n const extensionPromises: Promise<IGLTFLoaderExtension>[] = [];\r\n\r\n registeredGLTFExtensions.forEach((registeredExtension, name) => {\r\n // Don't load explicitly disabled extensions.\r\n if (this.parent.extensionOptions[name]?.enabled === false) {\r\n // But warn if the disabled extension is used by the model.\r\n if (registeredExtension.isGLTFExtension && this.isExtensionUsed(name)) {\r\n Logger.Warn(`Extension ${name} is used but has been explicitly disabled.`);\r\n }\r\n }\r\n // Load loader extensions that are not a glTF extension, as well as extensions that are glTF extensions and are used by the model.\r\n else if (!registeredExtension.isGLTFExtension || this.isExtensionUsed(name)) {\r\n extensionPromises.push(\r\n (async () => {\r\n const extension = await registeredExtension.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._parent.onExtensionLoadedObservable.notifyObservers(extension);\r\n return extension;\r\n })()\r\n );\r\n }\r\n });\r\n\r\n this._extensions.push(...(await Promise.all(extensionPromises)));\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 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 if (this.parent.extensionOptions[name]?.enabled === false) {\r\n throw new Error(`Required extension ${name} is disabled`);\r\n }\r\n throw new Error(`Required extension ${name} is not available`);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _createRootNode(): INode {\r\n if (this._parent.customRootNode !== undefined) {\r\n this._rootBabylonMesh = this._parent.customRootNode;\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n _babylonTransformNode: this._rootBabylonMesh === null ? undefined : this._rootBabylonMesh,\r\n index: -1,\r\n };\r\n }\r\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n const rootMesh = new Mesh(\"__root__\", this._babylonScene);\r\n this._rootBabylonMesh = rootMesh;\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 // eslint-disable-next-line @typescript-eslint/naming-convention\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(rootMesh);\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<unknown>>();\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: 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: AbstractMesh[] = [];\r\n\r\n // Root mesh is always first, if available.\r\n if (this._rootBabylonMesh instanceof AbstractMesh) {\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: 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: 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: 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<unknown>>();\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 const hasMesh = node.mesh != undefined;\r\n const hasSkin = this._parent.loadSkins && node.skin != undefined;\r\n\r\n if (!hasMesh || hasSkin) {\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 (hasMesh) {\r\n if (hasSkin) {\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 const babylonTransformNodeForSkin = node._babylonTransformNodeForSkin!;\r\n\r\n // Merge the metadata from the skin node to the skinned mesh in case a loader extension added metadata.\r\n babylonTransformNode.metadata = mergeDeep(babylonTransformNodeForSkin.metadata, babylonTransformNode.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 all the nodes are parented before parenting the skinned mesh.\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 // Handle special case when the parent of the skeleton root is the skinned mesh.\r\n const parentNode = ArrayItem.Get(`/skins/${skin.index}/skeleton`, this._gltf.nodes, skin.skeleton).parent!;\r\n if (node.index === parentNode.index) {\r\n babylonTransformNode.parent = babylonTransformNodeForSkin.parent;\r\n } else {\r\n babylonTransformNode.parent = parentNode._babylonTransformNode!;\r\n }\r\n } else {\r\n babylonTransformNode.parent = this._rootBabylonMesh;\r\n }\r\n\r\n this._parent.onSkinLoadedObservable.notifyObservers({ node: babylonTransformNodeForSkin, skinnedNode: babylonTransformNode });\r\n });\r\n })\r\n );\r\n })\r\n );\r\n } else {\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 }\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, 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<unknown>>();\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 * @internal 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<unknown>;\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<unknown>>();\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.sideOrientation = 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 if (this._disposed) {\r\n return;\r\n }\r\n\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<unknown>>();\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 = (name: string, kind: string, callback?: (accessor: IAccessor) => void) => {\r\n if (attributes[name] == 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/${name}`, this._gltf.accessors, attributes[name]);\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 if (accessor.min && accessor.max) {\r\n const min = TmpVectors.Vector3[0].copyFromFloats(...(accessor.min as [number, number, number]));\r\n const max = TmpVectors.Vector3[1].copyFromFloats(...(accessor.max as [number, number, number]));\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 const oneOverDivider = 1 / divider;\r\n min.scaleInPlace(oneOverDivider);\r\n max.scaleInPlace(oneOverDivider);\r\n }\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 || !this._parent.loadMorphTargets) {\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 this._babylonScene._blockEntityCollection = !!this._assetContainer;\r\n babylonMesh.morphTargetManager = new MorphTargetManager(this._babylonScene);\r\n babylonMesh.morphTargetManager._parentContainer = this._assetContainer;\r\n this._babylonScene._blockEntityCollection = false;\r\n\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 || !this._parent.loadMorphTargets) {\r\n return Promise.resolve();\r\n }\r\n\r\n const promises = new Array<Promise<unknown>>();\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<unknown>>();\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 if (!this._parent.loadSkins) {\r\n return Promise.resolve();\r\n }\r\n\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: 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 node._isJoint = true;\r\n\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.getAbsoluteInverseBindMatrix(), baseMatrix);\r\n }\r\n\r\n babylonBone.updateMatrix(baseMatrix, false, false);\r\n babylonBone._updateAbsoluteBindMatrices(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<unknown>>();\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 camera._babylonCamera = babylonCamera;\r\n\r\n // Rotation by 180 as glTF has a different convention than Babylon.\r\n babylonCamera.rotation.set(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 // eslint-disable-next-line @typescript-eslint/naming-convention\r\n return import(\"core/Animations/animationGroup\").then(({ AnimationGroup }) => {\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<unknown>>();\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(\r\n this._loadAnimationChannelAsync(`${context}/channels/${channel.index}`, context, animation, channel, (babylonTarget, babylonAnimation) => {\r\n babylonTarget.animations = babylonTarget.animations || [];\r\n babylonTarget.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, babylonTarget);\r\n })\r\n );\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 /**\r\n * @hidden\r\n * 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 onLoad Called for each animation loaded\r\n * @returns A void promise that resolves when the 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 onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Promise<void> {\r\n const promise = this._extensionsLoadAnimationChannelAsync(context, animationContext, animation, channel, onLoad);\r\n if (promise) {\r\n return promise;\r\n }\r\n\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 const channelTargetPath = channel.target.path;\r\n const pathIsWeights = channelTargetPath === AnimationChannelTargetPath.WEIGHTS;\r\n\r\n // Ignore animations that have no animation targets.\r\n if ((pathIsWeights && !targetNode._numMorphTargets) || (!pathIsWeights && !targetNode._babylonTransformNode)) {\r\n return Promise.resolve();\r\n }\r\n\r\n // Don't load node animations if disabled.\r\n if (!this._parent.loadNodeAnimations && !pathIsWeights && !targetNode._isJoint) {\r\n return Promise.resolve();\r\n }\r\n\r\n let properties: Array<AnimationPropertyInfo>;\r\n switch (channelTargetPath) {\r\n case AnimationChannelTargetPath.TRANSLATION: {\r\n properties = nodeAnimationData.translation;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.ROTATION: {\r\n properties = nodeAnimationData.rotation;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.SCALE: {\r\n properties = nodeAnimationData.scale;\r\n break;\r\n }\r\n case AnimationChannelTargetPath.WEIGHTS: {\r\n properties = nodeAnimationData.weights;\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 const targetInfo: IObjectInfo<AnimationPropertyInfo[]> = {\r\n object: targetNode,\r\n info: properties,\r\n };\r\n\r\n return this._loadAnimationChannelFromTargetInfoAsync(context, animationContext, animation, channel, targetInfo, onLoad);\r\n }\r\n\r\n /**\r\n * @hidden\r\n * 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 targetInfo The glTF target and properties\r\n * @param onLoad Called for each animation loaded\r\n * @returns A void promise that resolves when the load is complete\r\n */\r\n public _loadAnimationChannelFromTargetInfoAsync(\r\n context: string,\r\n animationContext: string,\r\n animation: IAnimation,\r\n channel: IAnimationChannel,\r\n targetInfo: IObjectInfo<AnimationPropertyInfo[]>,\r\n onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Promise<void> {\r\n const fps = this.parent.targetFps;\r\n const invfps = 1 / fps;\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 numAnimations = 0;\r\n\r\n const target = targetInfo.object;\r\n const propertyInfos = targetInfo.info;\r\n // Extract the corresponding values from the read value.\r\n // GLTF values may be dispatched to several Babylon properties.\r\n // For example, baseColorFactor [`r`, `g`, `b`, `a`] is dispatched to\r\n // - albedoColor as Color3(`r`, `g`, `b`)\r\n // - alpha as `a`\r\n for (const propertyInfo of propertyInfos) {\r\n const stride = propertyInfo.getStride(target);\r\n const input = data.input;\r\n const output = data.output;\r\n const keys = new Array<IAnimationKey>(input.length);\r\n let outputOffset = 0;\r\n\r\n switch (data.interpolation) {\r\n case AnimationSamplerInterpolation.STEP: {\r\n for (let index = 0; index < input.length; index++) {\r\n const value = propertyInfo.getValue(target, output, outputOffset, 1);\r\n outputOffset += stride;\r\n\r\n keys[index] = {\r\n frame: input[index] * fps,\r\n value: value,\r\n interpolation: AnimationKeyInterpolation.STEP,\r\n };\r\n }\r\n break;\r\n }\r\n case AnimationSamplerInterpolation.CUBICSPLINE: {\r\n for (let index = 0; index < input.length; index++) {\r\n const inTangent = propertyInfo.getValue(target, output, outputOffset, invfps);\r\n outputOffset += stride;\r\n const value = propertyInfo.getValue(target, output, outputOffset, 1);\r\n outputOffset += stride;\r\n const outTangent = propertyInfo.getValue(target, output, outputOffset, invfps);\r\n outputOffset += stride;\r\n\r\n keys[index] = {\r\n frame: input[index] * fps,\r\n inTangent: inTangent,\r\n value: value,\r\n outTangent: outTangent,\r\n };\r\n }\r\n break;\r\n }\r\n case AnimationSamplerInterpolation.LINEAR: {\r\n for (let index = 0; index < input.length; index++) {\r\n const value = propertyInfo.getValue(target, output, outputOffset, 1);\r\n outputOffset += stride;\r\n\r\n keys[index] = {\r\n frame: input[index] * fps,\r\n value: value,\r\n };\r\n }\r\n break;\r\n }\r\n }\r\n\r\n if (outputOffset > 0) {\r\n const name = `${animation.name || `animation${animation.index}`}_channel${channel.index}_${numAnimations}`;\r\n propertyInfo.buildAnimations(target, name, fps, keys, (babylonAnimatable, babylonAnimation) => {\r\n ++numAnimations;\r\n onLoad(babylonAnimatable, babylonAnimation);\r\n });\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 * @internal\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 /**\r\n * @internal\r\n */\r\n public _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 /**\r\n * @internal\r\n */\r\n public _loadVertexBufferViewAsync(bufferView: IBufferView): Promise<Buffer> {\r\n if (bufferView._babylonBuffer) {\r\n return bufferView._babylonBuffer;\r\n }\r\n\r\n const engine = this._babylonScene.getEngine();\r\n bufferView._babylonBuffer = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n return new Buffer(engine, data, false);\r\n });\r\n\r\n return bufferView._babylonBuffer;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _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 const engine = this._babylonScene.getEngine();\r\n\r\n if (accessor.sparse || accessor.bufferView == undefined) {\r\n accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then((data) => {\r\n return new VertexBuffer(engine, 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 numComponents = GLTFLoader._GetNumComponents(context, accessor.type);\r\n return new VertexBuffer(\r\n engine,\r\n babylonBuffer,\r\n kind,\r\n false,\r\n undefined,\r\n bufferView.byteStride,\r\n undefined,\r\n accessor.byteOffset,\r\n numComponents,\r\n accessor.componentType,\r\n accessor.normalized,\r\n true,\r\n undefined,\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<unknown>>();\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 * @internal\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<unknown>>();\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<unknown>>();\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 && babylonMaterial.bumpTexture) {\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 babylonMaterial.alpha = 1.0; // Force alpha to 1.0 for opaque mode.\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 * @internal\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 * @internal\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?: unknown,\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<unknown>>();\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.substring(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 _internalMetadata of the Babylon object at `<object>._internalMetadata.gltf.pointers`.\r\n * @param babylonObject the Babylon object with _internalMetadata\r\n * @param pointer the JSON pointer\r\n */\r\n public static AddPointerMetadata(babylonObject: IWithMetadata, pointer: string): void {\r\n babylonObject.metadata = babylonObject.metadata || {};\r\n const metadata = (babylonObject._internalMetadata = babylonObject._internalMetadata || {});\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 * @internal\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<unknown>>();\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<unknown>>();\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 _extensionsLoadAnimationChannelAsync(\r\n context: string,\r\n animationContext: string,\r\n animation: IAnimation,\r\n channel: IAnimationChannel,\r\n onLoad: (babylonAnimatable: IAnimatable, babylonAnimation: Animation) => void\r\n ): Nullable<Promise<void>> {\r\n return this._applyExtensions(\r\n animation,\r\n \"loadAnimationChannel\",\r\n (extension) => extension._loadAnimationChannelAsync && extension._loadAnimationChannelAsync(context, animationContext, animation, channel, onLoad)\r\n );\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 = unknown, 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 = unknown, 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"]}
|