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