@babylonjs/loaders 7.34.4 → 7.35.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/OBJ/mtlFileLoader.js.map +1 -1
  2. package/OBJ/objFileLoader.js.map +1 -1
  3. package/OBJ/solidParser.js +2 -2
  4. package/OBJ/solidParser.js.map +1 -1
  5. package/SPLAT/splatFileLoader.js.map +1 -1
  6. package/STL/stlFileLoader.js.map +1 -1
  7. package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
  8. package/glTF/1.0/glTFLoader.js.map +1 -1
  9. package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
  10. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
  11. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
  12. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  13. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
  14. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
  15. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
  16. package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
  17. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  18. package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -1
  19. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  20. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
  21. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  22. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
  23. package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
  24. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  25. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  26. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
  27. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
  28. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  29. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  30. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  31. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  32. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
  33. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  34. package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -1
  35. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  36. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
  37. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
  38. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
  39. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
  40. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
  41. package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -1
  42. package/glTF/2.0/Extensions/interactivityFunctions.js +2 -2
  43. package/glTF/2.0/Extensions/interactivityFunctions.js.map +1 -1
  44. package/glTF/2.0/glTFLoader.js.map +1 -1
  45. package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
  46. package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -1
  47. package/glTF/glTFFileLoader.js.map +1 -1
  48. package/glTF/glTFValidation.js.map +1 -1
  49. package/legacy/legacy-glTF.js.map +1 -1
  50. package/legacy/legacy-glTF1.js.map +1 -1
  51. package/legacy/legacy-glTF2.js.map +1 -1
  52. package/legacy/legacy-objFileLoader.js.map +1 -1
  53. package/legacy/legacy-stlFileLoader.js.map +1 -1
  54. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"glTFLoader.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0/glTFLoader.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,cAAc,EAAE,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;YACD,cAAc,CAAC,sBAAsB,CAAC,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC/E,CAAC,CACJ,CAAC;IACN,CAAC;IAEO,MAAM,CAAC,mBAAmB,CAC9B,WAAyB,EACzB,EAAU,EACV,MAAuB,EACvB,SAAqC,EACrC,OAAkC;QAElC,mBAAmB,CAAC,gBAAgB,CAChC,CAAC,eAAe,EAAE,EAAE;YAChB,OAAO,eAAe,CAAC,kBAAkB,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC3F,CAAC,EACD,GAAG,EAAE;YACD,cAAc,CAAC,kBAAkB,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAC1E,CAAC,CACJ,CAAC;IACN,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,IAAuD,EAAE,WAAuB;QAC5G,KAAK,MAAM,aAAa,IAAI,UAAU,CAAC,UAAU,EAAE;YAC/C,MAAM,eAAe,GAAG,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YAC7D,IAAI,IAAI,CAAC,eAAe,CAAC,EAAE;gBACvB,OAAO;aACV;SACJ;QAED,WAAW,EAAE,CAAC;IAClB,CAAC;CACJ;AAED,cAAc,CAAC,kBAAkB,GAAG,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type {\r\n IGLTFRuntime,\r\n IGLTFTechniqueParameter,\r\n IGLTFAnimation,\r\n IGLTFAnimationSampler,\r\n IGLTFNode,\r\n IGLTFSkins,\r\n INodeToRoot,\r\n IJointNode,\r\n IGLTFMesh,\r\n IGLTFAccessor,\r\n IGLTFLight,\r\n IGLTFAmbienLight,\r\n IGLTFDirectionalLight,\r\n IGLTFPointLight,\r\n IGLTFSpotLight,\r\n IGLTFCamera,\r\n IGLTFCameraPerspective,\r\n IGLTFScene,\r\n IGLTFTechnique,\r\n IGLTFMaterial,\r\n IGLTFProgram,\r\n IGLTFBuffer,\r\n IGLTFTexture,\r\n IGLTFImage,\r\n IGLTFSampler,\r\n IGLTFShader,\r\n IGLTFTechniqueStates,\r\n} from \"./glTFLoaderInterfaces\";\r\nimport { EParameterType, ETextureFilterType, ECullingType, EBlendingFunction, EShaderType } from \"./glTFLoaderInterfaces\";\r\n\r\nimport type { FloatArray, Nullable } from \"core/types\";\r\nimport { Quaternion, Vector3, Matrix } 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 { Animation } from \"core/Animations/animation\";\r\nimport { Bone } from \"core/Bones/bone\";\r\nimport { Skeleton } from \"core/Bones/skeleton\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { MultiMaterial } from \"core/Materials/multiMaterial\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { ShaderMaterial } from \"core/Materials/shaderMaterial\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Node } from \"core/node\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport { SubMesh } from \"core/Meshes/subMesh\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\nimport type { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from \"core/Loading/sceneLoader\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport type { IGLTFLoader, IGLTFLoaderData } from \"../glTFFileLoader\";\r\nimport { GLTFFileLoader } from \"../glTFFileLoader\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport type { AssetContainer } from \"core/assetContainer\";\r\n\r\n/**\r\n * Tokenizer. Used for shaders compatibility\r\n * Automatically map world, view, projection, worldViewProjection, attributes and so on\r\n */\r\nenum ETokenType {\r\n IDENTIFIER = 1,\r\n\r\n UNKNOWN = 2,\r\n END_OF_INPUT = 3,\r\n}\r\n\r\nclass Tokenizer {\r\n private _toParse: string;\r\n private _pos: number = 0;\r\n private _maxPos: number;\r\n\r\n public currentToken: ETokenType = ETokenType.UNKNOWN;\r\n public currentIdentifier: string = \"\";\r\n public currentString: string = \"\";\r\n public isLetterOrDigitPattern: RegExp = /^[a-zA-Z0-9]+$/;\r\n\r\n constructor(toParse: string) {\r\n this._toParse = toParse;\r\n this._maxPos = toParse.length;\r\n }\r\n\r\n public getNextToken(): ETokenType {\r\n if (this.isEnd()) {\r\n return ETokenType.END_OF_INPUT;\r\n }\r\n\r\n this.currentString = this.read();\r\n this.currentToken = ETokenType.UNKNOWN;\r\n\r\n if (this.currentString === \"_\" || this.isLetterOrDigitPattern.test(this.currentString)) {\r\n this.currentToken = ETokenType.IDENTIFIER;\r\n this.currentIdentifier = this.currentString;\r\n while (!this.isEnd() && (this.isLetterOrDigitPattern.test((this.currentString = this.peek())) || this.currentString === \"_\")) {\r\n this.currentIdentifier += this.currentString;\r\n this.forward();\r\n }\r\n }\r\n\r\n return this.currentToken;\r\n }\r\n\r\n public peek(): string {\r\n return this._toParse[this._pos];\r\n }\r\n\r\n public read(): string {\r\n return this._toParse[this._pos++];\r\n }\r\n\r\n public forward(): void {\r\n this._pos++;\r\n }\r\n\r\n public isEnd(): boolean {\r\n return this._pos >= this._maxPos;\r\n }\r\n}\r\n\r\n/**\r\n * Values\r\n */\r\nconst glTFTransforms = [\"MODEL\", \"VIEW\", \"PROJECTION\", \"MODELVIEW\", \"MODELVIEWPROJECTION\", \"JOINTMATRIX\"];\r\nconst babylonTransforms = [\"world\", \"view\", \"projection\", \"worldView\", \"worldViewProjection\", \"mBones\"];\r\n\r\nconst glTFAnimationPaths = [\"translation\", \"rotation\", \"scale\"];\r\nconst babylonAnimationPaths = [\"position\", \"rotationQuaternion\", \"scaling\"];\r\n\r\n/**\r\n * Parse\r\n * @param parsedBuffers\r\n * @param gltfRuntime\r\n */\r\nconst parseBuffers = (parsedBuffers: any, gltfRuntime: IGLTFRuntime) => {\r\n for (const buf in parsedBuffers) {\r\n const parsedBuffer = parsedBuffers[buf];\r\n gltfRuntime.buffers[buf] = parsedBuffer;\r\n gltfRuntime.buffersCount++;\r\n }\r\n};\r\n\r\nconst parseShaders = (parsedShaders: any, gltfRuntime: IGLTFRuntime) => {\r\n for (const sha in parsedShaders) {\r\n const parsedShader = parsedShaders[sha];\r\n gltfRuntime.shaders[sha] = parsedShader;\r\n gltfRuntime.shaderscount++;\r\n }\r\n};\r\n\r\nconst parseObject = (parsedObjects: any, runtimeProperty: string, gltfRuntime: IGLTFRuntime) => {\r\n for (const object in parsedObjects) {\r\n const parsedObject = parsedObjects[object];\r\n (<any>gltfRuntime)[runtimeProperty][object] = parsedObject;\r\n }\r\n};\r\n\r\n/**\r\n * Utils\r\n * @param buffer\r\n */\r\nconst normalizeUVs = (buffer: any) => {\r\n if (!buffer) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < buffer.length / 2; i++) {\r\n buffer[i * 2 + 1] = 1.0 - buffer[i * 2 + 1];\r\n }\r\n};\r\n\r\nconst getAttribute = (attributeParameter: IGLTFTechniqueParameter): Nullable<string> => {\r\n if (attributeParameter.semantic === \"NORMAL\") {\r\n return \"normal\";\r\n } else if (attributeParameter.semantic === \"POSITION\") {\r\n return \"position\";\r\n } else if (attributeParameter.semantic === \"JOINT\") {\r\n return \"matricesIndices\";\r\n } else if (attributeParameter.semantic === \"WEIGHT\") {\r\n return \"matricesWeights\";\r\n } else if (attributeParameter.semantic === \"COLOR\") {\r\n return \"color\";\r\n } else if (attributeParameter.semantic && attributeParameter.semantic.indexOf(\"TEXCOORD_\") !== -1) {\r\n const channel = Number(attributeParameter.semantic.split(\"_\")[1]);\r\n return \"uv\" + (channel === 0 ? \"\" : channel + 1);\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Loads and creates animations\r\n * @param gltfRuntime\r\n */\r\nconst loadAnimations = (gltfRuntime: IGLTFRuntime) => {\r\n for (const anim in gltfRuntime.animations) {\r\n const animation: IGLTFAnimation = gltfRuntime.animations[anim];\r\n\r\n if (!animation.channels || !animation.samplers) {\r\n continue;\r\n }\r\n\r\n let lastAnimation: Nullable<Animation> = null;\r\n\r\n for (let i = 0; i < animation.channels.length; i++) {\r\n // Get parameters and load buffers\r\n const channel = animation.channels[i];\r\n const sampler: IGLTFAnimationSampler = animation.samplers[channel.sampler];\r\n\r\n if (!sampler) {\r\n continue;\r\n }\r\n\r\n let inputData: Nullable<string> = null;\r\n let outputData: Nullable<string> = null;\r\n\r\n if (animation.parameters) {\r\n inputData = animation.parameters[sampler.input];\r\n outputData = animation.parameters[sampler.output];\r\n } else {\r\n inputData = sampler.input;\r\n outputData = sampler.output;\r\n }\r\n\r\n const bufferInput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[inputData]);\r\n const bufferOutput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[outputData]);\r\n\r\n const targetId = channel.target.id;\r\n let targetNode: any = gltfRuntime.scene.getNodeById(targetId);\r\n\r\n if (targetNode === null) {\r\n targetNode = gltfRuntime.scene.getNodeByName(targetId);\r\n }\r\n\r\n if (targetNode === null) {\r\n Tools.Warn(\"Creating animation named \" + anim + \". But cannot find node named \" + targetId + \" to attach to\");\r\n continue;\r\n }\r\n\r\n const isBone = targetNode instanceof Bone;\r\n\r\n // Get target path (position, rotation or scaling)\r\n let targetPath = channel.target.path;\r\n const targetPathIndex = glTFAnimationPaths.indexOf(targetPath);\r\n\r\n if (targetPathIndex !== -1) {\r\n targetPath = babylonAnimationPaths[targetPathIndex];\r\n }\r\n\r\n // Determine animation type\r\n let animationType = Animation.ANIMATIONTYPE_MATRIX;\r\n\r\n if (!isBone) {\r\n if (targetPath === \"rotationQuaternion\") {\r\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\r\n targetNode.rotationQuaternion = new Quaternion();\r\n } else {\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n }\r\n }\r\n\r\n // Create animation and key frames\r\n let babylonAnimation: Nullable<Animation> = null;\r\n const keys = [];\r\n let arrayOffset = 0;\r\n let modifyKey = false;\r\n\r\n if (isBone && lastAnimation && lastAnimation.getKeys().length === bufferInput.length) {\r\n babylonAnimation = lastAnimation;\r\n modifyKey = true;\r\n }\r\n\r\n if (!modifyKey) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n babylonAnimation = new Animation(anim, isBone ? \"_matrix\" : targetPath, 1, animationType, Animation.ANIMATIONLOOPMODE_CYCLE);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n }\r\n\r\n // For each frame\r\n for (let j = 0; j < bufferInput.length; j++) {\r\n let value: any = null;\r\n\r\n if (targetPath === \"rotationQuaternion\") {\r\n // VEC4\r\n value = Quaternion.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2], bufferOutput[arrayOffset + 3]]);\r\n arrayOffset += 4;\r\n } else {\r\n // Position and scaling are VEC3\r\n value = Vector3.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2]]);\r\n arrayOffset += 3;\r\n }\r\n\r\n if (isBone) {\r\n const bone = <Bone>targetNode;\r\n let translation = Vector3.Zero();\r\n let rotationQuaternion = new Quaternion();\r\n let scaling = Vector3.Zero();\r\n\r\n // Warning on decompose\r\n let mat = bone.getBaseMatrix();\r\n\r\n if (modifyKey && lastAnimation) {\r\n mat = lastAnimation.getKeys()[j].value;\r\n }\r\n\r\n mat.decompose(scaling, rotationQuaternion, translation);\r\n\r\n if (targetPath === \"position\") {\r\n translation = value;\r\n } else if (targetPath === \"rotationQuaternion\") {\r\n rotationQuaternion = value;\r\n } else {\r\n scaling = value;\r\n }\r\n\r\n value = Matrix.Compose(scaling, rotationQuaternion, translation);\r\n }\r\n\r\n if (!modifyKey) {\r\n keys.push({\r\n frame: bufferInput[j],\r\n value: value,\r\n });\r\n } else if (lastAnimation) {\r\n lastAnimation.getKeys()[j].value = value;\r\n }\r\n }\r\n\r\n // Finish\r\n if (!modifyKey && babylonAnimation) {\r\n babylonAnimation.setKeys(keys);\r\n targetNode.animations.push(babylonAnimation);\r\n }\r\n\r\n lastAnimation = babylonAnimation;\r\n\r\n gltfRuntime.scene.stopAnimation(targetNode);\r\n gltfRuntime.scene.beginAnimation(targetNode, 0, bufferInput[bufferInput.length - 1], true, 1.0);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * @returns the bones transformation matrix\r\n * @param node\r\n */\r\nconst configureBoneTransformation = (node: IGLTFNode): Matrix => {\r\n let mat: Nullable<Matrix> = null;\r\n\r\n if (node.translation || node.rotation || node.scale) {\r\n const scale = Vector3.FromArray(node.scale || [1, 1, 1]);\r\n const rotation = Quaternion.FromArray(node.rotation || [0, 0, 0, 1]);\r\n const position = Vector3.FromArray(node.translation || [0, 0, 0]);\r\n\r\n mat = Matrix.Compose(scale, rotation, position);\r\n } else {\r\n mat = Matrix.FromArray(node.matrix);\r\n }\r\n\r\n return mat;\r\n};\r\n\r\n/**\r\n * Returns the parent bone\r\n * @param gltfRuntime\r\n * @param skins\r\n * @param jointName\r\n * @param newSkeleton\r\n * @returns the parent bone\r\n */\r\nconst getParentBone = (gltfRuntime: IGLTFRuntime, skins: IGLTFSkins, jointName: string, newSkeleton: Skeleton): Nullable<Bone> => {\r\n // Try to find\r\n for (let i = 0; i < newSkeleton.bones.length; i++) {\r\n if (newSkeleton.bones[i].name === jointName) {\r\n return newSkeleton.bones[i];\r\n }\r\n }\r\n\r\n // Not found, search in gltf nodes\r\n const nodes = gltfRuntime.nodes;\r\n for (const nde in nodes) {\r\n const node: IGLTFNode = nodes[nde];\r\n\r\n if (!node.jointName) {\r\n continue;\r\n }\r\n\r\n const children = node.children;\r\n for (let i = 0; i < children.length; i++) {\r\n const child: IGLTFNode = gltfRuntime.nodes[children[i]];\r\n if (!child.jointName) {\r\n continue;\r\n }\r\n\r\n if (child.jointName === jointName) {\r\n const mat = configureBoneTransformation(node);\r\n const bone = new Bone(node.name || \"\", newSkeleton, getParentBone(gltfRuntime, skins, node.jointName, newSkeleton), mat);\r\n bone.id = nde;\r\n return bone;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Returns the appropriate root node\r\n * @param nodesToRoot\r\n * @param id\r\n * @returns the root node\r\n */\r\nconst getNodeToRoot = (nodesToRoot: INodeToRoot[], id: string): Nullable<Bone> => {\r\n for (let i = 0; i < nodesToRoot.length; i++) {\r\n const nodeToRoot = nodesToRoot[i];\r\n\r\n for (let j = 0; j < nodeToRoot.node.children.length; j++) {\r\n const child = nodeToRoot.node.children[j];\r\n if (child === id) {\r\n return nodeToRoot.bone;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Returns the node with the joint name\r\n * @param gltfRuntime\r\n * @param jointName\r\n * @returns the node with the joint name\r\n */\r\nconst getJointNode = (gltfRuntime: IGLTFRuntime, jointName: string): Nullable<IJointNode> => {\r\n const nodes = gltfRuntime.nodes;\r\n let node: IGLTFNode = nodes[jointName];\r\n if (node) {\r\n return {\r\n node: node,\r\n id: jointName,\r\n };\r\n }\r\n\r\n for (const nde in nodes) {\r\n node = nodes[nde];\r\n if (node.jointName === jointName) {\r\n return {\r\n node: node,\r\n id: nde,\r\n };\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Checks if a nodes is in joints\r\n * @param skins\r\n * @param id\r\n * @returns true if the node is in joints, else false\r\n */\r\nconst nodeIsInJoints = (skins: IGLTFSkins, id: string): boolean => {\r\n for (let i = 0; i < skins.jointNames.length; i++) {\r\n if (skins.jointNames[i] === id) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\n/**\r\n * Fills the nodes to root for bones and builds hierarchy\r\n * @param gltfRuntime\r\n * @param newSkeleton\r\n * @param skins\r\n * @param nodesToRoot\r\n */\r\nconst getNodesToRoot = (gltfRuntime: IGLTFRuntime, newSkeleton: Skeleton, skins: IGLTFSkins, nodesToRoot: INodeToRoot[]) => {\r\n // Creates nodes for root\r\n for (const nde in gltfRuntime.nodes) {\r\n const node: IGLTFNode = gltfRuntime.nodes[nde];\r\n const id = nde;\r\n\r\n if (!node.jointName || nodeIsInJoints(skins, node.jointName)) {\r\n continue;\r\n }\r\n\r\n // Create node to root bone\r\n const mat = configureBoneTransformation(node);\r\n const bone = new Bone(node.name || \"\", newSkeleton, null, mat);\r\n bone.id = id;\r\n nodesToRoot.push({ bone: bone, node: node, id: id });\r\n }\r\n\r\n // Parenting\r\n for (let i = 0; i < nodesToRoot.length; i++) {\r\n const nodeToRoot = nodesToRoot[i];\r\n const children = nodeToRoot.node.children;\r\n\r\n for (let j = 0; j < children.length; j++) {\r\n let child: Nullable<INodeToRoot> = null;\r\n\r\n for (let k = 0; k < nodesToRoot.length; k++) {\r\n if (nodesToRoot[k].id === children[j]) {\r\n child = nodesToRoot[k];\r\n break;\r\n }\r\n }\r\n\r\n if (child) {\r\n (<any>child.bone)._parent = nodeToRoot.bone;\r\n nodeToRoot.bone.children.push(child.bone);\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Imports a skeleton\r\n * @param gltfRuntime\r\n * @param skins\r\n * @param mesh\r\n * @param newSkeleton\r\n * @returns the bone name\r\n */\r\nconst importSkeleton = (gltfRuntime: IGLTFRuntime, skins: IGLTFSkins, mesh: Mesh, newSkeleton: Skeleton | undefined): Skeleton => {\r\n if (!newSkeleton) {\r\n newSkeleton = new Skeleton(skins.name || \"\", \"\", gltfRuntime.scene);\r\n }\r\n\r\n if (!skins.babylonSkeleton) {\r\n return newSkeleton;\r\n }\r\n\r\n // Find the root bones\r\n const nodesToRoot: INodeToRoot[] = [];\r\n const nodesToRootToAdd: Bone[] = [];\r\n\r\n getNodesToRoot(gltfRuntime, newSkeleton, skins, nodesToRoot);\r\n newSkeleton.bones = [];\r\n\r\n // Joints\r\n for (let i = 0; i < skins.jointNames.length; i++) {\r\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\r\n\r\n if (!jointNode) {\r\n continue;\r\n }\r\n\r\n const node = jointNode.node;\r\n\r\n if (!node) {\r\n Tools.Warn(\"Joint named \" + skins.jointNames[i] + \" does not exist\");\r\n continue;\r\n }\r\n\r\n const id = jointNode.id;\r\n\r\n // Optimize, if the bone already exists...\r\n const existingBone = gltfRuntime.scene.getBoneById(id);\r\n if (existingBone) {\r\n newSkeleton.bones.push(existingBone);\r\n continue;\r\n }\r\n\r\n // Search for parent bone\r\n let foundBone = false;\r\n let parentBone: Nullable<Bone> = null;\r\n\r\n for (let j = 0; j < i; j++) {\r\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[j]);\r\n\r\n if (!jointNode) {\r\n continue;\r\n }\r\n\r\n const joint: IGLTFNode = jointNode.node;\r\n\r\n if (!joint) {\r\n Tools.Warn(\"Joint named \" + skins.jointNames[j] + \" does not exist when looking for parent\");\r\n continue;\r\n }\r\n\r\n const children = joint.children;\r\n if (!children) {\r\n continue;\r\n }\r\n foundBone = false;\r\n\r\n for (let k = 0; k < children.length; k++) {\r\n if (children[k] === id) {\r\n parentBone = getParentBone(gltfRuntime, skins, skins.jointNames[j], newSkeleton);\r\n foundBone = true;\r\n break;\r\n }\r\n }\r\n\r\n if (foundBone) {\r\n break;\r\n }\r\n }\r\n\r\n // Create bone\r\n const mat = configureBoneTransformation(node);\r\n\r\n if (!parentBone && nodesToRoot.length > 0) {\r\n parentBone = getNodeToRoot(nodesToRoot, id);\r\n\r\n if (parentBone) {\r\n if (nodesToRootToAdd.indexOf(parentBone) === -1) {\r\n nodesToRootToAdd.push(parentBone);\r\n }\r\n }\r\n }\r\n\r\n const bone = new Bone(node.jointName || \"\", newSkeleton, parentBone, mat);\r\n bone.id = id;\r\n }\r\n\r\n // Polish\r\n const bones = newSkeleton.bones;\r\n newSkeleton.bones = [];\r\n\r\n for (let i = 0; i < skins.jointNames.length; i++) {\r\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\r\n\r\n if (!jointNode) {\r\n continue;\r\n }\r\n\r\n for (let j = 0; j < bones.length; j++) {\r\n if (bones[j].id === jointNode.id) {\r\n newSkeleton.bones.push(bones[j]);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n newSkeleton.prepare();\r\n\r\n // Finish\r\n for (let i = 0; i < nodesToRootToAdd.length; i++) {\r\n newSkeleton.bones.push(nodesToRootToAdd[i]);\r\n }\r\n\r\n return newSkeleton;\r\n};\r\n\r\n/**\r\n * Imports a mesh and its geometries\r\n * @param gltfRuntime\r\n * @param node\r\n * @param meshes\r\n * @param id\r\n * @param newMesh\r\n * @returns the new mesh\r\n */\r\nconst importMesh = (gltfRuntime: IGLTFRuntime, node: IGLTFNode, meshes: string[], id: string, newMesh: Mesh): Mesh => {\r\n if (!newMesh) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n newMesh = new Mesh(node.name || \"\", gltfRuntime.scene);\r\n newMesh._parentContainer = gltfRuntime.assetContainer;\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n newMesh.id = id;\r\n }\r\n\r\n if (!node.babylonNode) {\r\n return newMesh;\r\n }\r\n\r\n const subMaterials: Material[] = [];\r\n\r\n let vertexData: Nullable<VertexData> = null;\r\n const verticesStarts: number[] = [];\r\n const verticesCounts: number[] = [];\r\n const indexStarts: number[] = [];\r\n const indexCounts: number[] = [];\r\n\r\n for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\r\n const meshId = meshes[meshIndex];\r\n const mesh: IGLTFMesh = gltfRuntime.meshes[meshId];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n // Positions, normals and UVs\r\n for (let i = 0; i < mesh.primitives.length; i++) {\r\n // Temporary vertex data\r\n const tempVertexData = new VertexData();\r\n\r\n const primitive = mesh.primitives[i];\r\n if (primitive.mode !== 4) {\r\n // continue;\r\n }\r\n\r\n const attributes = primitive.attributes;\r\n let accessor: Nullable<IGLTFAccessor> = null;\r\n let buffer: any = null;\r\n\r\n // Set positions, normal and uvs\r\n for (const semantic in attributes) {\r\n // Link accessor and buffer view\r\n accessor = gltfRuntime.accessors[attributes[semantic]];\r\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\r\n\r\n if (semantic === \"NORMAL\") {\r\n tempVertexData.normals = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.normals).set(buffer);\r\n } else if (semantic === \"POSITION\") {\r\n if (GLTFFileLoader.HomogeneousCoordinates) {\r\n tempVertexData.positions = new Float32Array(buffer.length - buffer.length / 4);\r\n\r\n for (let j = 0; j < buffer.length; j += 4) {\r\n tempVertexData.positions[j] = buffer[j];\r\n tempVertexData.positions[j + 1] = buffer[j + 1];\r\n tempVertexData.positions[j + 2] = buffer[j + 2];\r\n }\r\n } else {\r\n tempVertexData.positions = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.positions).set(buffer);\r\n }\r\n\r\n verticesCounts.push(tempVertexData.positions.length);\r\n } else if (semantic.indexOf(\"TEXCOORD_\") !== -1) {\r\n const channel = Number(semantic.split(\"_\")[1]);\r\n const uvKind = VertexBuffer.UVKind + (channel === 0 ? \"\" : channel + 1);\r\n const uvs = new Float32Array(buffer.length);\r\n (<Float32Array>uvs).set(buffer);\r\n normalizeUVs(uvs);\r\n tempVertexData.set(uvs, uvKind);\r\n } else if (semantic === \"JOINT\") {\r\n tempVertexData.matricesIndices = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.matricesIndices).set(buffer);\r\n } else if (semantic === \"WEIGHT\") {\r\n tempVertexData.matricesWeights = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.matricesWeights).set(buffer);\r\n } else if (semantic === \"COLOR\") {\r\n tempVertexData.colors = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.colors).set(buffer);\r\n }\r\n }\r\n\r\n // Indices\r\n accessor = gltfRuntime.accessors[primitive.indices];\r\n if (accessor) {\r\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\r\n\r\n tempVertexData.indices = new Int32Array(buffer.length);\r\n tempVertexData.indices.set(buffer);\r\n indexCounts.push(tempVertexData.indices.length);\r\n } else {\r\n // Set indices on the fly\r\n const indices: number[] = [];\r\n for (let j = 0; j < (<FloatArray>tempVertexData.positions).length / 3; j++) {\r\n indices.push(j);\r\n }\r\n\r\n tempVertexData.indices = new Int32Array(indices);\r\n indexCounts.push(tempVertexData.indices.length);\r\n }\r\n\r\n if (!vertexData) {\r\n vertexData = tempVertexData;\r\n } else {\r\n vertexData.merge(tempVertexData);\r\n }\r\n\r\n // Sub material\r\n const material = gltfRuntime.scene.getMaterialById(primitive.material);\r\n\r\n subMaterials.push(material === null ? GLTFUtils.GetDefaultMaterial(gltfRuntime.scene) : material);\r\n\r\n // Update vertices start and index start\r\n verticesStarts.push(verticesStarts.length === 0 ? 0 : verticesStarts[verticesStarts.length - 1] + verticesCounts[verticesCounts.length - 2]);\r\n indexStarts.push(indexStarts.length === 0 ? 0 : indexStarts[indexStarts.length - 1] + indexCounts[indexCounts.length - 2]);\r\n }\r\n }\r\n let material: StandardMaterial | MultiMaterial;\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n if (subMaterials.length > 1) {\r\n material = new MultiMaterial(\"multimat\" + id, gltfRuntime.scene);\r\n (material as MultiMaterial).subMaterials = subMaterials;\r\n } else {\r\n material = new StandardMaterial(\"multimat\" + id, gltfRuntime.scene);\r\n }\r\n\r\n if (subMaterials.length === 1) {\r\n material = subMaterials[0] as StandardMaterial;\r\n }\r\n\r\n material._parentContainer = gltfRuntime.assetContainer;\r\n\r\n if (!newMesh.material) {\r\n newMesh.material = material;\r\n }\r\n\r\n // Apply geometry\r\n new Geometry(id, gltfRuntime.scene, vertexData!, false, newMesh);\r\n newMesh.computeWorldMatrix(true);\r\n\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n\r\n // Apply submeshes\r\n newMesh.subMeshes = [];\r\n let index = 0;\r\n for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\r\n const meshId = meshes[meshIndex];\r\n const mesh: IGLTFMesh = gltfRuntime.meshes[meshId];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n for (let i = 0; i < mesh.primitives.length; i++) {\r\n if (mesh.primitives[i].mode !== 4) {\r\n //continue;\r\n }\r\n\r\n SubMesh.AddToMesh(index, verticesStarts[index], verticesCounts[index], indexStarts[index], indexCounts[index], newMesh, newMesh, true);\r\n index++;\r\n }\r\n }\r\n\r\n // Finish\r\n return newMesh;\r\n};\r\n\r\n/**\r\n * Configure node transformation from position, rotation and scaling\r\n * @param newNode\r\n * @param position\r\n * @param rotation\r\n * @param scaling\r\n */\r\nconst configureNode = (newNode: any, position: Vector3, rotation: Quaternion, scaling: Vector3) => {\r\n if (newNode.position) {\r\n newNode.position = position;\r\n }\r\n\r\n if (newNode.rotationQuaternion || newNode.rotation) {\r\n newNode.rotationQuaternion = rotation;\r\n }\r\n\r\n if (newNode.scaling) {\r\n newNode.scaling = scaling;\r\n }\r\n};\r\n\r\n/**\r\n * Configures node from transformation matrix\r\n * @param newNode\r\n * @param node\r\n */\r\nconst configureNodeFromMatrix = (newNode: Mesh, node: IGLTFNode) => {\r\n if (node.matrix) {\r\n const position = new Vector3(0, 0, 0);\r\n const rotation = new Quaternion();\r\n const scaling = new Vector3(0, 0, 0);\r\n const mat = Matrix.FromArray(node.matrix);\r\n mat.decompose(scaling, rotation, position);\r\n\r\n configureNode(newNode, position, rotation, scaling);\r\n } else if (node.translation && node.rotation && node.scale) {\r\n configureNode(newNode, Vector3.FromArray(node.translation), Quaternion.FromArray(node.rotation), Vector3.FromArray(node.scale));\r\n }\r\n\r\n newNode.computeWorldMatrix(true);\r\n};\r\n\r\n/**\r\n * Imports a node\r\n * @param gltfRuntime\r\n * @param node\r\n * @param id\r\n * @returns the newly imported node\r\n */\r\nconst importNode = (gltfRuntime: IGLTFRuntime, node: IGLTFNode, id: string): Nullable<Node> => {\r\n let lastNode: Nullable<Node> = null;\r\n\r\n if (gltfRuntime.importOnlyMeshes && (node.skin || node.meshes)) {\r\n if (gltfRuntime.importMeshesNames && gltfRuntime.importMeshesNames.length > 0 && gltfRuntime.importMeshesNames.indexOf(node.name || \"\") === -1) {\r\n return null;\r\n }\r\n }\r\n\r\n // Meshes\r\n if (node.skin) {\r\n if (node.meshes) {\r\n const skin: IGLTFSkins = gltfRuntime.skins[node.skin];\r\n\r\n const newMesh = importMesh(gltfRuntime, node, node.meshes, id, <Mesh>node.babylonNode);\r\n newMesh.skeleton = gltfRuntime.scene.getLastSkeletonById(node.skin);\r\n\r\n if (newMesh.skeleton === null) {\r\n newMesh.skeleton = importSkeleton(gltfRuntime, skin, newMesh, skin.babylonSkeleton);\r\n\r\n if (!skin.babylonSkeleton) {\r\n skin.babylonSkeleton = newMesh.skeleton;\r\n }\r\n }\r\n\r\n lastNode = newMesh;\r\n }\r\n } else if (node.meshes) {\r\n /**\r\n * Improve meshes property\r\n */\r\n const newMesh = importMesh(gltfRuntime, node, node.mesh ? [node.mesh] : node.meshes, id, <Mesh>node.babylonNode);\r\n lastNode = newMesh;\r\n }\r\n // Lights\r\n else if (node.light && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\r\n const light: IGLTFLight = gltfRuntime.lights[node.light];\r\n\r\n if (light) {\r\n if (light.type === \"ambient\") {\r\n const ambienLight: IGLTFAmbienLight = (<any>light)[light.type];\r\n const hemiLight = new HemisphericLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n hemiLight.name = node.name || \"\";\r\n\r\n if (ambienLight.color) {\r\n hemiLight.diffuse = Color3.FromArray(ambienLight.color);\r\n }\r\n\r\n lastNode = hemiLight;\r\n } else if (light.type === \"directional\") {\r\n const directionalLight: IGLTFDirectionalLight = (<any>light)[light.type];\r\n const dirLight = new DirectionalLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n dirLight.name = node.name || \"\";\r\n\r\n if (directionalLight.color) {\r\n dirLight.diffuse = Color3.FromArray(directionalLight.color);\r\n }\r\n\r\n lastNode = dirLight;\r\n } else if (light.type === \"point\") {\r\n const pointLight: IGLTFPointLight = (<any>light)[light.type];\r\n const ptLight = new PointLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n ptLight.name = node.name || \"\";\r\n\r\n if (pointLight.color) {\r\n ptLight.diffuse = Color3.FromArray(pointLight.color);\r\n }\r\n\r\n lastNode = ptLight;\r\n } else if (light.type === \"spot\") {\r\n const spotLight: IGLTFSpotLight = (<any>light)[light.type];\r\n const spLight = new SpotLight(node.light, Vector3.Zero(), Vector3.Zero(), 0, 0, gltfRuntime.scene);\r\n spLight.name = node.name || \"\";\r\n\r\n if (spotLight.color) {\r\n spLight.diffuse = Color3.FromArray(spotLight.color);\r\n }\r\n\r\n if (spotLight.fallOfAngle) {\r\n spLight.angle = spotLight.fallOfAngle;\r\n }\r\n\r\n if (spotLight.fallOffExponent) {\r\n spLight.exponent = spotLight.fallOffExponent;\r\n }\r\n\r\n lastNode = spLight;\r\n }\r\n }\r\n }\r\n // Cameras\r\n else if (node.camera && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\r\n const camera: IGLTFCamera = gltfRuntime.cameras[node.camera];\r\n\r\n if (camera) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n if (camera.type === \"orthographic\") {\r\n const orthoCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\r\n\r\n orthoCamera.name = node.name || \"\";\r\n orthoCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\r\n orthoCamera.attachControl();\r\n\r\n lastNode = orthoCamera;\r\n\r\n orthoCamera._parentContainer = gltfRuntime.assetContainer;\r\n } else if (camera.type === \"perspective\") {\r\n const perspectiveCamera: IGLTFCameraPerspective = (<any>camera)[camera.type];\r\n const persCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\r\n\r\n persCamera.name = node.name || \"\";\r\n persCamera.attachControl();\r\n\r\n if (!perspectiveCamera.aspectRatio) {\r\n perspectiveCamera.aspectRatio = gltfRuntime.scene.getEngine().getRenderWidth() / gltfRuntime.scene.getEngine().getRenderHeight();\r\n }\r\n\r\n if (perspectiveCamera.znear && perspectiveCamera.zfar) {\r\n persCamera.maxZ = perspectiveCamera.zfar;\r\n persCamera.minZ = perspectiveCamera.znear;\r\n }\r\n\r\n lastNode = persCamera;\r\n persCamera._parentContainer = gltfRuntime.assetContainer;\r\n }\r\n\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n }\r\n }\r\n\r\n // Empty node\r\n if (!node.jointName) {\r\n if (node.babylonNode) {\r\n return node.babylonNode;\r\n } else if (lastNode === null) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n const dummy = new Mesh(node.name || \"\", gltfRuntime.scene);\r\n dummy._parentContainer = gltfRuntime.assetContainer;\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n node.babylonNode = dummy;\r\n lastNode = dummy;\r\n }\r\n }\r\n\r\n if (lastNode !== null) {\r\n if (node.matrix && lastNode instanceof Mesh) {\r\n configureNodeFromMatrix(lastNode, node);\r\n } else {\r\n const translation = node.translation || [0, 0, 0];\r\n const rotation = node.rotation || [0, 0, 0, 1];\r\n const scale = node.scale || [1, 1, 1];\r\n configureNode(lastNode, Vector3.FromArray(translation), Quaternion.FromArray(rotation), Vector3.FromArray(scale));\r\n }\r\n\r\n lastNode.updateCache(true);\r\n node.babylonNode = lastNode;\r\n }\r\n\r\n return lastNode;\r\n};\r\n\r\n/**\r\n * Traverses nodes and creates them\r\n * @param gltfRuntime\r\n * @param id\r\n * @param parent\r\n * @param meshIncluded\r\n */\r\nconst traverseNodes = (gltfRuntime: IGLTFRuntime, id: string, parent: Nullable<Node>, meshIncluded: boolean = false) => {\r\n const node: IGLTFNode = gltfRuntime.nodes[id];\r\n let newNode: Nullable<Node> = null;\r\n\r\n if (gltfRuntime.importOnlyMeshes && !meshIncluded && gltfRuntime.importMeshesNames) {\r\n if (gltfRuntime.importMeshesNames.indexOf(node.name || \"\") !== -1 || gltfRuntime.importMeshesNames.length === 0) {\r\n meshIncluded = true;\r\n } else {\r\n meshIncluded = false;\r\n }\r\n } else {\r\n meshIncluded = true;\r\n }\r\n\r\n if (!node.jointName && meshIncluded) {\r\n newNode = importNode(gltfRuntime, node, id);\r\n\r\n if (newNode !== null) {\r\n newNode.id = id;\r\n newNode.parent = parent;\r\n }\r\n }\r\n\r\n if (node.children) {\r\n for (let i = 0; i < node.children.length; i++) {\r\n traverseNodes(gltfRuntime, node.children[i], newNode, meshIncluded);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * do stuff after buffers, shaders are loaded (e.g. hook up materials, load animations, etc.)\r\n * @param gltfRuntime\r\n */\r\nconst postLoad = (gltfRuntime: IGLTFRuntime) => {\r\n // Nodes\r\n let currentScene: IGLTFScene = <IGLTFScene>gltfRuntime.currentScene;\r\n\r\n if (currentScene) {\r\n for (let i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n } else {\r\n for (const thing in gltfRuntime.scenes) {\r\n currentScene = <IGLTFScene>gltfRuntime.scenes[thing];\r\n\r\n for (let i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n }\r\n\r\n // Set animations\r\n loadAnimations(gltfRuntime);\r\n\r\n for (let i = 0; i < gltfRuntime.scene.skeletons.length; i++) {\r\n const skeleton = gltfRuntime.scene.skeletons[i];\r\n gltfRuntime.scene.beginAnimation(skeleton, 0, Number.MAX_VALUE, true, 1.0);\r\n }\r\n};\r\n\r\n/**\r\n * onBind shaderrs callback to set uniforms and matrices\r\n * @param mesh\r\n * @param gltfRuntime\r\n * @param unTreatedUniforms\r\n * @param shaderMaterial\r\n * @param technique\r\n * @param material\r\n * @param onSuccess\r\n */\r\nconst onBindShaderMaterial = (\r\n mesh: AbstractMesh,\r\n gltfRuntime: IGLTFRuntime,\r\n unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter },\r\n shaderMaterial: ShaderMaterial,\r\n technique: IGLTFTechnique,\r\n material: IGLTFMaterial,\r\n onSuccess: (shaderMaterial: ShaderMaterial) => void\r\n) => {\r\n const materialValues = material.values || technique.parameters;\r\n\r\n for (const unif in unTreatedUniforms) {\r\n const uniform: IGLTFTechniqueParameter = unTreatedUniforms[unif];\r\n const type = uniform.type;\r\n\r\n if (type === EParameterType.FLOAT_MAT2 || type === EParameterType.FLOAT_MAT3 || type === EParameterType.FLOAT_MAT4) {\r\n if (uniform.semantic && !uniform.source && !uniform.node) {\r\n GLTFUtils.SetMatrix(gltfRuntime.scene, mesh, uniform, unif, <Effect>shaderMaterial.getEffect());\r\n } else if (uniform.semantic && (uniform.source || uniform.node)) {\r\n let source = gltfRuntime.scene.getNodeByName(uniform.source || uniform.node || \"\");\r\n if (source === null) {\r\n source = gltfRuntime.scene.getNodeById(uniform.source || uniform.node || \"\");\r\n }\r\n if (source === null) {\r\n continue;\r\n }\r\n\r\n GLTFUtils.SetMatrix(gltfRuntime.scene, source, uniform, unif, <Effect>shaderMaterial.getEffect());\r\n }\r\n } else {\r\n const value = (<any>materialValues)[technique.uniforms[unif]];\r\n if (!value) {\r\n continue;\r\n }\r\n\r\n if (type === EParameterType.SAMPLER_2D) {\r\n const texture = gltfRuntime.textures[material.values ? value : uniform.value].babylonTexture;\r\n\r\n if (texture === null || texture === undefined) {\r\n continue;\r\n }\r\n\r\n (<Effect>shaderMaterial.getEffect()).setTexture(unif, texture);\r\n } else {\r\n GLTFUtils.SetUniform(<Effect>shaderMaterial.getEffect(), unif, value, type);\r\n }\r\n }\r\n }\r\n\r\n onSuccess(shaderMaterial);\r\n};\r\n\r\n/**\r\n * Prepare uniforms to send the only one time\r\n * Loads the appropriate textures\r\n * @param gltfRuntime\r\n * @param shaderMaterial\r\n * @param technique\r\n * @param material\r\n */\r\nconst prepareShaderMaterialUniforms = (\r\n gltfRuntime: IGLTFRuntime,\r\n shaderMaterial: ShaderMaterial,\r\n technique: IGLTFTechnique,\r\n material: IGLTFMaterial,\r\n unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter }\r\n) => {\r\n const materialValues = material.values || technique.parameters;\r\n const techniqueUniforms = technique.uniforms;\r\n\r\n /**\r\n * Prepare values here (not matrices)\r\n */\r\n for (const unif in unTreatedUniforms) {\r\n const uniform: IGLTFTechniqueParameter = unTreatedUniforms[unif];\r\n const type = uniform.type;\r\n let value = (<any>materialValues)[techniqueUniforms[unif]];\r\n\r\n if (value === undefined) {\r\n // In case the value is the same for all materials\r\n value = <any>uniform.value;\r\n }\r\n\r\n if (!value) {\r\n continue;\r\n }\r\n\r\n const onLoadTexture = (uniformName: Nullable<string>) => {\r\n return (texture: Texture) => {\r\n if (uniform.value && uniformName) {\r\n // Static uniform\r\n shaderMaterial.setTexture(uniformName, texture);\r\n delete unTreatedUniforms[uniformName];\r\n }\r\n };\r\n };\r\n\r\n // Texture (sampler2D)\r\n if (type === EParameterType.SAMPLER_2D) {\r\n GLTFLoaderExtension.LoadTextureAsync(gltfRuntime, material.values ? value : uniform.value, onLoadTexture(unif), () => onLoadTexture(null));\r\n }\r\n // Others\r\n else {\r\n if (uniform.value && GLTFUtils.SetUniform(shaderMaterial, unif, material.values ? value : uniform.value, type)) {\r\n // Static uniform\r\n delete unTreatedUniforms[unif];\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Shader compilation failed\r\n * @param program\r\n * @param shaderMaterial\r\n * @param onError\r\n * @returns callback when shader is compiled\r\n */\r\nconst onShaderCompileError = (program: IGLTFProgram, shaderMaterial: ShaderMaterial, onError: (message: string) => void) => {\r\n return (effect: Effect, error: string) => {\r\n shaderMaterial.dispose(true);\r\n onError(\"Cannot compile program named \" + program.name + \". Error: \" + error + \". Default material will be applied\");\r\n };\r\n};\r\n\r\n/**\r\n * Shader compilation success\r\n * @param gltfRuntime\r\n * @param shaderMaterial\r\n * @param technique\r\n * @param material\r\n * @param unTreatedUniforms\r\n * @param onSuccess\r\n * @returns callback when shader is compiled\r\n */\r\nconst onShaderCompileSuccess = (\r\n gltfRuntime: IGLTFRuntime,\r\n shaderMaterial: ShaderMaterial,\r\n technique: IGLTFTechnique,\r\n material: IGLTFMaterial,\r\n unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter },\r\n onSuccess: (shaderMaterial: ShaderMaterial) => void\r\n) => {\r\n return (_: Effect) => {\r\n prepareShaderMaterialUniforms(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms);\r\n\r\n shaderMaterial.onBind = (mesh: AbstractMesh) => {\r\n onBindShaderMaterial(mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess);\r\n };\r\n };\r\n};\r\n\r\n/**\r\n * Returns the appropriate uniform if already handled by babylon\r\n * @param tokenizer\r\n * @param technique\r\n * @param unTreatedUniforms\r\n * @returns the name of the uniform handled by babylon\r\n */\r\nconst parseShaderUniforms = (tokenizer: Tokenizer, technique: IGLTFTechnique, unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter }): string => {\r\n for (const unif in technique.uniforms) {\r\n const uniform = technique.uniforms[unif];\r\n const uniformParameter: IGLTFTechniqueParameter = technique.parameters[uniform];\r\n\r\n if (tokenizer.currentIdentifier === unif) {\r\n if (uniformParameter.semantic && !uniformParameter.source && !uniformParameter.node) {\r\n const transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\r\n\r\n if (transformIndex !== -1) {\r\n delete unTreatedUniforms[unif];\r\n return babylonTransforms[transformIndex];\r\n }\r\n }\r\n }\r\n }\r\n\r\n return tokenizer.currentIdentifier;\r\n};\r\n\r\n/**\r\n * All shaders loaded. Create materials one by one\r\n * @param gltfRuntime\r\n */\r\nconst importMaterials = (gltfRuntime: IGLTFRuntime) => {\r\n // Create materials\r\n for (const mat in gltfRuntime.materials) {\r\n GLTFLoaderExtension.LoadMaterialAsync(\r\n gltfRuntime,\r\n mat,\r\n () => {},\r\n () => {}\r\n );\r\n }\r\n};\r\n\r\n/**\r\n * Implementation of the base glTF spec\r\n * @internal\r\n */\r\nexport class GLTFLoaderBase {\r\n public static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime {\r\n const gltfRuntime: IGLTFRuntime = {\r\n extensions: {},\r\n accessors: {},\r\n buffers: {},\r\n bufferViews: {},\r\n meshes: {},\r\n lights: {},\r\n cameras: {},\r\n nodes: {},\r\n images: {},\r\n textures: {},\r\n shaders: {},\r\n programs: {},\r\n samplers: {},\r\n techniques: {},\r\n materials: {},\r\n animations: {},\r\n skins: {},\r\n extensionsUsed: [],\r\n\r\n scenes: {},\r\n\r\n buffersCount: 0,\r\n shaderscount: 0,\r\n\r\n scene: scene,\r\n rootUrl: rootUrl,\r\n\r\n loadedBufferCount: 0,\r\n loadedBufferViews: {},\r\n\r\n loadedShaderCount: 0,\r\n\r\n importOnlyMeshes: false,\r\n\r\n dummyNodes: [],\r\n\r\n assetContainer: null,\r\n };\r\n\r\n // Parse\r\n if (parsedData.extensions) {\r\n parseObject(parsedData.extensions, \"extensions\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.extensionsUsed) {\r\n parseObject(parsedData.extensionsUsed, \"extensionsUsed\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.buffers) {\r\n parseBuffers(parsedData.buffers, gltfRuntime);\r\n }\r\n\r\n if (parsedData.bufferViews) {\r\n parseObject(parsedData.bufferViews, \"bufferViews\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.accessors) {\r\n parseObject(parsedData.accessors, \"accessors\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.meshes) {\r\n parseObject(parsedData.meshes, \"meshes\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.lights) {\r\n parseObject(parsedData.lights, \"lights\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.cameras) {\r\n parseObject(parsedData.cameras, \"cameras\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.nodes) {\r\n parseObject(parsedData.nodes, \"nodes\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.images) {\r\n parseObject(parsedData.images, \"images\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.textures) {\r\n parseObject(parsedData.textures, \"textures\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.shaders) {\r\n parseShaders(parsedData.shaders, gltfRuntime);\r\n }\r\n\r\n if (parsedData.programs) {\r\n parseObject(parsedData.programs, \"programs\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.samplers) {\r\n parseObject(parsedData.samplers, \"samplers\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.techniques) {\r\n parseObject(parsedData.techniques, \"techniques\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.materials) {\r\n parseObject(parsedData.materials, \"materials\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.animations) {\r\n parseObject(parsedData.animations, \"animations\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.skins) {\r\n parseObject(parsedData.skins, \"skins\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.scenes) {\r\n gltfRuntime.scenes = parsedData.scenes;\r\n }\r\n\r\n if (parsedData.scene && parsedData.scenes) {\r\n gltfRuntime.currentScene = parsedData.scenes[parsedData.scene];\r\n }\r\n\r\n return gltfRuntime;\r\n }\r\n\r\n public static LoadBufferAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n onSuccess: (buffer: ArrayBufferView) => void,\r\n onError: (message: string) => void,\r\n onProgress?: () => void\r\n ): void {\r\n const buffer: IGLTFBuffer = gltfRuntime.buffers[id];\r\n\r\n if (Tools.IsBase64(buffer.uri)) {\r\n setTimeout(() => onSuccess(new Uint8Array(Tools.DecodeBase64(buffer.uri))));\r\n } else {\r\n Tools.LoadFile(\r\n gltfRuntime.rootUrl + buffer.uri,\r\n (data) => onSuccess(new Uint8Array(data as ArrayBuffer)),\r\n onProgress,\r\n undefined,\r\n true,\r\n (request) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n }\r\n );\r\n }\r\n }\r\n\r\n public static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void {\r\n const texture: IGLTFTexture = gltfRuntime.textures[id];\r\n\r\n if (!texture || !texture.source) {\r\n onError(\"\");\r\n return;\r\n }\r\n\r\n if (texture.babylonTexture) {\r\n onSuccess(null);\r\n return;\r\n }\r\n\r\n const source: IGLTFImage = gltfRuntime.images[texture.source];\r\n\r\n if (Tools.IsBase64(source.uri)) {\r\n setTimeout(() => onSuccess(new Uint8Array(Tools.DecodeBase64(source.uri))));\r\n } else {\r\n Tools.LoadFile(\r\n gltfRuntime.rootUrl + source.uri,\r\n (data) => onSuccess(new Uint8Array(data as ArrayBuffer)),\r\n undefined,\r\n undefined,\r\n true,\r\n (request) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n }\r\n );\r\n }\r\n }\r\n\r\n public static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void): void {\r\n const texture: IGLTFTexture = gltfRuntime.textures[id];\r\n\r\n if (texture.babylonTexture) {\r\n onSuccess(texture.babylonTexture);\r\n return;\r\n }\r\n\r\n const sampler: IGLTFSampler = gltfRuntime.samplers[texture.sampler];\r\n\r\n const createMipMaps =\r\n sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_NEAREST ||\r\n sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_LINEAR ||\r\n sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_NEAREST ||\r\n sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_LINEAR;\r\n\r\n const samplingMode = Texture.BILINEAR_SAMPLINGMODE;\r\n\r\n const blob = buffer == null ? new Blob() : new Blob([buffer]);\r\n const blobURL = URL.createObjectURL(blob);\r\n const revokeBlobURL = () => URL.revokeObjectURL(blobURL);\r\n const newTexture = new Texture(blobURL, gltfRuntime.scene, !createMipMaps, true, samplingMode, revokeBlobURL, revokeBlobURL);\r\n if (sampler.wrapS !== undefined) {\r\n newTexture.wrapU = GLTFUtils.GetWrapMode(sampler.wrapS);\r\n }\r\n if (sampler.wrapT !== undefined) {\r\n newTexture.wrapV = GLTFUtils.GetWrapMode(sampler.wrapT);\r\n }\r\n newTexture.name = id;\r\n\r\n texture.babylonTexture = newTexture;\r\n onSuccess(newTexture);\r\n }\r\n\r\n public static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void {\r\n const shader: IGLTFShader = gltfRuntime.shaders[id];\r\n\r\n if (Tools.IsBase64(shader.uri)) {\r\n const shaderString = atob(shader.uri.split(\",\")[1]);\r\n if (onSuccess) {\r\n onSuccess(shaderString);\r\n }\r\n } else {\r\n Tools.LoadFile(gltfRuntime.rootUrl + shader.uri, onSuccess, undefined, undefined, false, (request) => {\r\n if (request && onError) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n });\r\n }\r\n }\r\n\r\n public static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void {\r\n const material: IGLTFMaterial = gltfRuntime.materials[id];\r\n if (!material.technique) {\r\n if (onError) {\r\n onError(\"No technique found.\");\r\n }\r\n return;\r\n }\r\n\r\n const technique: IGLTFTechnique = gltfRuntime.techniques[material.technique];\r\n if (!technique) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n const defaultMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n defaultMaterial._parentContainer = gltfRuntime.assetContainer;\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n defaultMaterial.diffuseColor = new Color3(0.5, 0.5, 0.5);\r\n defaultMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n onSuccess(defaultMaterial);\r\n return;\r\n }\r\n\r\n const program: IGLTFProgram = gltfRuntime.programs[technique.program];\r\n const states: IGLTFTechniqueStates = technique.states;\r\n\r\n const vertexShader: string = Effect.ShadersStore[program.vertexShader + \"VertexShader\"];\r\n const pixelShader: string = Effect.ShadersStore[program.fragmentShader + \"PixelShader\"];\r\n let newVertexShader = \"\";\r\n let newPixelShader = \"\";\r\n\r\n const vertexTokenizer = new Tokenizer(vertexShader);\r\n const pixelTokenizer = new Tokenizer(pixelShader);\r\n\r\n const unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter } = {};\r\n const uniforms: string[] = [];\r\n const attributes: string[] = [];\r\n const samplers: string[] = [];\r\n\r\n // Fill uniform, sampler2D and attributes\r\n for (const unif in technique.uniforms) {\r\n const uniform = technique.uniforms[unif];\r\n const uniformParameter: IGLTFTechniqueParameter = technique.parameters[uniform];\r\n\r\n unTreatedUniforms[unif] = uniformParameter;\r\n\r\n if (uniformParameter.semantic && !uniformParameter.node && !uniformParameter.source) {\r\n const transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\r\n if (transformIndex !== -1) {\r\n uniforms.push(babylonTransforms[transformIndex]);\r\n delete unTreatedUniforms[unif];\r\n } else {\r\n uniforms.push(unif);\r\n }\r\n } else if (uniformParameter.type === EParameterType.SAMPLER_2D) {\r\n samplers.push(unif);\r\n } else {\r\n uniforms.push(unif);\r\n }\r\n }\r\n\r\n for (const attr in technique.attributes) {\r\n const attribute = technique.attributes[attr];\r\n const attributeParameter: IGLTFTechniqueParameter = technique.parameters[attribute];\r\n\r\n if (attributeParameter.semantic) {\r\n const name = getAttribute(attributeParameter);\r\n if (name) {\r\n attributes.push(name);\r\n }\r\n }\r\n }\r\n\r\n // Configure vertex shader\r\n while (!vertexTokenizer.isEnd() && vertexTokenizer.getNextToken()) {\r\n const tokenType = vertexTokenizer.currentToken;\r\n\r\n if (tokenType !== ETokenType.IDENTIFIER) {\r\n newVertexShader += vertexTokenizer.currentString;\r\n continue;\r\n }\r\n\r\n let foundAttribute = false;\r\n\r\n for (const attr in technique.attributes) {\r\n const attribute = technique.attributes[attr];\r\n const attributeParameter: IGLTFTechniqueParameter = technique.parameters[attribute];\r\n\r\n if (vertexTokenizer.currentIdentifier === attr && attributeParameter.semantic) {\r\n newVertexShader += getAttribute(attributeParameter);\r\n foundAttribute = true;\r\n break;\r\n }\r\n }\r\n\r\n if (foundAttribute) {\r\n continue;\r\n }\r\n\r\n newVertexShader += parseShaderUniforms(vertexTokenizer, technique, unTreatedUniforms);\r\n }\r\n\r\n // Configure pixel shader\r\n while (!pixelTokenizer.isEnd() && pixelTokenizer.getNextToken()) {\r\n const tokenType = pixelTokenizer.currentToken;\r\n\r\n if (tokenType !== ETokenType.IDENTIFIER) {\r\n newPixelShader += pixelTokenizer.currentString;\r\n continue;\r\n }\r\n\r\n newPixelShader += parseShaderUniforms(pixelTokenizer, technique, unTreatedUniforms);\r\n }\r\n\r\n // Create shader material\r\n const shaderPath = {\r\n vertex: program.vertexShader + id,\r\n fragment: program.fragmentShader + id,\r\n };\r\n\r\n const options = {\r\n attributes: attributes,\r\n uniforms: uniforms,\r\n samplers: samplers,\r\n needAlphaBlending: states && states.enable && states.enable.indexOf(3042) !== -1,\r\n };\r\n\r\n Effect.ShadersStore[program.vertexShader + id + \"VertexShader\"] = newVertexShader;\r\n Effect.ShadersStore[program.fragmentShader + id + \"PixelShader\"] = newPixelShader;\r\n\r\n const shaderMaterial = new ShaderMaterial(id, gltfRuntime.scene, shaderPath, options);\r\n shaderMaterial.onError = onShaderCompileError(program, shaderMaterial, onError);\r\n shaderMaterial.onCompiled = onShaderCompileSuccess(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess);\r\n shaderMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n\r\n if (states && states.functions) {\r\n const functions = states.functions;\r\n if (functions.cullFace && functions.cullFace[0] !== ECullingType.BACK) {\r\n shaderMaterial.backFaceCulling = false;\r\n }\r\n\r\n const blendFunc = functions.blendFuncSeparate;\r\n if (blendFunc) {\r\n if (\r\n blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\r\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_ALPHA &&\r\n blendFunc[2] === EBlendingFunction.ONE &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_COMBINE;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.ONE &&\r\n blendFunc[1] === EBlendingFunction.ONE &&\r\n blendFunc[2] === EBlendingFunction.ZERO &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_ONEONE;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\r\n blendFunc[1] === EBlendingFunction.ONE &&\r\n blendFunc[2] === EBlendingFunction.ZERO &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_ADD;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.ZERO &&\r\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR &&\r\n blendFunc[2] === EBlendingFunction.ONE &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_SUBTRACT;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.DST_COLOR &&\r\n blendFunc[1] === EBlendingFunction.ZERO &&\r\n blendFunc[2] === EBlendingFunction.ONE &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_MULTIPLY;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\r\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR &&\r\n blendFunc[2] === EBlendingFunction.ONE &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_MAXIMIZED;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * glTF V1 Loader\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class GLTFLoader implements IGLTFLoader {\r\n public static Extensions: { [name: string]: GLTFLoaderExtension } = {};\r\n\r\n public static RegisterExtension(extension: GLTFLoaderExtension): void {\r\n if (GLTFLoader.Extensions[extension.name]) {\r\n Tools.Error('Tool with the same name \"' + extension.name + '\" already exists');\r\n return;\r\n }\r\n\r\n GLTFLoader.Extensions[extension.name] = extension;\r\n }\r\n\r\n public dispose(): void {\r\n // do nothing\r\n }\r\n\r\n private _importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n assetContainer: Nullable<AssetContainer>,\r\n onSuccess: (meshes: AbstractMesh[], skeletons: Skeleton[]) => void,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n onError?: (message: string) => void\r\n ): boolean {\r\n scene.useRightHandedSystem = true;\r\n\r\n GLTFLoaderExtension.LoadRuntimeAsync(\r\n scene,\r\n data,\r\n rootUrl,\r\n (gltfRuntime) => {\r\n gltfRuntime.assetContainer = assetContainer;\r\n gltfRuntime.importOnlyMeshes = true;\r\n\r\n if (meshesNames === \"\") {\r\n gltfRuntime.importMeshesNames = [];\r\n } else if (typeof meshesNames === \"string\") {\r\n gltfRuntime.importMeshesNames = [meshesNames];\r\n } else if (meshesNames && !(meshesNames instanceof Array)) {\r\n gltfRuntime.importMeshesNames = [meshesNames];\r\n } else {\r\n gltfRuntime.importMeshesNames = [];\r\n Tools.Warn(\"Argument meshesNames must be of type string or string[]\");\r\n }\r\n\r\n // Create nodes\r\n this._createNodes(gltfRuntime);\r\n\r\n const meshes: AbstractMesh[] = [];\r\n const skeletons: Skeleton[] = [];\r\n\r\n // Fill arrays of meshes and skeletons\r\n for (const nde in gltfRuntime.nodes) {\r\n const node: IGLTFNode = gltfRuntime.nodes[nde];\r\n\r\n if (node.babylonNode instanceof AbstractMesh) {\r\n meshes.push(<AbstractMesh>node.babylonNode);\r\n }\r\n }\r\n\r\n for (const skl in gltfRuntime.skins) {\r\n const skin: IGLTFSkins = gltfRuntime.skins[skl];\r\n\r\n if (skin.babylonSkeleton instanceof Skeleton) {\r\n skeletons.push(skin.babylonSkeleton);\r\n }\r\n }\r\n\r\n // Load buffers, shaders, materials, etc.\r\n this._loadBuffersAsync(gltfRuntime, () => {\r\n this._loadShadersAsync(gltfRuntime, () => {\r\n importMaterials(gltfRuntime);\r\n postLoad(gltfRuntime);\r\n\r\n if (!GLTFFileLoader.IncrementalLoading && onSuccess) {\r\n onSuccess(meshes, skeletons);\r\n }\r\n });\r\n });\r\n\r\n if (GLTFFileLoader.IncrementalLoading && onSuccess) {\r\n onSuccess(meshes, skeletons);\r\n }\r\n },\r\n onError\r\n );\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Imports one or more meshes from a loaded gltf file and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param assetContainer defines the asset container to use (can be null)\r\n * @param data gltf data containing information of the meshes in a loaded file\r\n * @param rootUrl root url to load from\r\n * @param onProgress event that fires when loading progress has occured\r\n * @returns a promise containg the loaded meshes, particles, skeletons and animations\r\n */\r\n public importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n assetContainer: Nullable<AssetContainer>,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return new Promise((resolve, reject) => {\r\n this._importMeshAsync(\r\n meshesNames,\r\n scene,\r\n data,\r\n rootUrl,\r\n assetContainer,\r\n (meshes, skeletons) => {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: skeletons,\r\n animationGroups: [],\r\n lights: [],\r\n transformNodes: [],\r\n geometries: [],\r\n spriteManagers: [],\r\n });\r\n },\r\n onProgress,\r\n (message) => {\r\n reject(new Error(message));\r\n }\r\n );\r\n });\r\n }\r\n\r\n private _loadAsync(\r\n scene: Scene,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n onSuccess: () => void,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n onError?: (message: string) => void\r\n ): void {\r\n scene.useRightHandedSystem = true;\r\n\r\n GLTFLoaderExtension.LoadRuntimeAsync(\r\n scene,\r\n data,\r\n rootUrl,\r\n (gltfRuntime) => {\r\n // Load runtime extensios\r\n GLTFLoaderExtension.LoadRuntimeExtensionsAsync(\r\n gltfRuntime,\r\n () => {\r\n // Create nodes\r\n this._createNodes(gltfRuntime);\r\n\r\n // Load buffers, shaders, materials, etc.\r\n this._loadBuffersAsync(gltfRuntime, () => {\r\n this._loadShadersAsync(gltfRuntime, () => {\r\n importMaterials(gltfRuntime);\r\n postLoad(gltfRuntime);\r\n\r\n if (!GLTFFileLoader.IncrementalLoading) {\r\n onSuccess();\r\n }\r\n });\r\n });\r\n\r\n if (GLTFFileLoader.IncrementalLoading) {\r\n onSuccess();\r\n }\r\n },\r\n onError\r\n );\r\n },\r\n onError\r\n );\r\n }\r\n\r\n /**\r\n * Imports all objects from a loaded gltf file and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data gltf data containing information of the meshes in a loaded file\r\n * @param rootUrl root url to load from\r\n * @param onProgress event that fires when loading progress has occured\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n public loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n this._loadAsync(\r\n scene,\r\n data,\r\n rootUrl,\r\n () => {\r\n resolve();\r\n },\r\n onProgress,\r\n (message) => {\r\n reject(new Error(message));\r\n }\r\n );\r\n });\r\n }\r\n\r\n private _loadShadersAsync(gltfRuntime: IGLTFRuntime, onload: () => void): void {\r\n let hasShaders = false;\r\n\r\n const processShader = (sha: string, shader: IGLTFShader) => {\r\n GLTFLoaderExtension.LoadShaderStringAsync(\r\n gltfRuntime,\r\n sha,\r\n (shaderString) => {\r\n if (shaderString instanceof ArrayBuffer) {\r\n return;\r\n }\r\n\r\n gltfRuntime.loadedShaderCount++;\r\n\r\n if (shaderString) {\r\n Effect.ShadersStore[sha + (shader.type === EShaderType.VERTEX ? \"VertexShader\" : \"PixelShader\")] = shaderString;\r\n }\r\n\r\n if (gltfRuntime.loadedShaderCount === gltfRuntime.shaderscount) {\r\n onload();\r\n }\r\n },\r\n () => {\r\n Tools.Error(\"Error when loading shader program named \" + sha + \" located at \" + shader.uri);\r\n }\r\n );\r\n };\r\n\r\n for (const sha in gltfRuntime.shaders) {\r\n hasShaders = true;\r\n\r\n const shader: IGLTFShader = gltfRuntime.shaders[sha];\r\n if (shader) {\r\n processShader.bind(this, sha, shader)();\r\n } else {\r\n Tools.Error(\"No shader named: \" + sha);\r\n }\r\n }\r\n\r\n if (!hasShaders) {\r\n onload();\r\n }\r\n }\r\n\r\n private _loadBuffersAsync(gltfRuntime: IGLTFRuntime, onLoad: () => void): void {\r\n let hasBuffers = false;\r\n\r\n const processBuffer = (buf: string, buffer: IGLTFBuffer) => {\r\n GLTFLoaderExtension.LoadBufferAsync(\r\n gltfRuntime,\r\n buf,\r\n (bufferView) => {\r\n gltfRuntime.loadedBufferCount++;\r\n\r\n if (bufferView) {\r\n if (bufferView.byteLength != gltfRuntime.buffers[buf].byteLength) {\r\n Tools.Error(\"Buffer named \" + buf + \" is length \" + bufferView.byteLength + \". Expected: \" + buffer.byteLength); // Improve error message\r\n }\r\n\r\n gltfRuntime.loadedBufferViews[buf] = bufferView;\r\n }\r\n\r\n if (gltfRuntime.loadedBufferCount === gltfRuntime.buffersCount) {\r\n onLoad();\r\n }\r\n },\r\n () => {\r\n Tools.Error(\"Error when loading buffer named \" + buf + \" located at \" + buffer.uri);\r\n }\r\n );\r\n };\r\n\r\n for (const buf in gltfRuntime.buffers) {\r\n hasBuffers = true;\r\n\r\n const buffer: IGLTFBuffer = gltfRuntime.buffers[buf];\r\n if (buffer) {\r\n processBuffer.bind(this, buf, buffer)();\r\n } else {\r\n Tools.Error(\"No buffer named: \" + buf);\r\n }\r\n }\r\n\r\n if (!hasBuffers) {\r\n onLoad();\r\n }\r\n }\r\n\r\n private _createNodes(gltfRuntime: IGLTFRuntime): void {\r\n let currentScene = <IGLTFScene>gltfRuntime.currentScene;\r\n\r\n if (currentScene) {\r\n // Only one scene even if multiple scenes are defined\r\n for (let i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n } else {\r\n // Load all scenes\r\n for (const thing in gltfRuntime.scenes) {\r\n currentScene = <IGLTFScene>gltfRuntime.scenes[thing];\r\n\r\n for (let i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport abstract class GLTFLoaderExtension {\r\n private _name: string;\r\n\r\n public constructor(name: string) {\r\n this._name = name;\r\n }\r\n\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n /**\r\n * Defines an override for loading the runtime\r\n * Return true to stop further extensions from loading the runtime\r\n * @param scene\r\n * @param data\r\n * @param rootUrl\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading the runtime\r\n */\r\n public loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an onverride for creating gltf runtime\r\n * Return true to stop further extensions from creating the runtime\r\n * @param gltfRuntime\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from creating the runtime\r\n */\r\n public loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for loading buffers\r\n * Return true to stop further extensions from loading this buffer\r\n * @param gltfRuntime\r\n * @param id\r\n * @param onSuccess\r\n * @param onError\r\n * @param onProgress\r\n * @returns true to stop further extensions from loading this buffer\r\n */\r\n public loadBufferAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n onSuccess: (buffer: ArrayBufferView) => void,\r\n onError: (message: string) => void,\r\n onProgress?: () => void\r\n ): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for loading texture buffers\r\n * Return true to stop further extensions from loading this texture data\r\n * @param gltfRuntime\r\n * @param id\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading this texture data\r\n */\r\n public loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for creating textures\r\n * Return true to stop further extensions from loading this texture\r\n * @param gltfRuntime\r\n * @param id\r\n * @param buffer\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading this texture\r\n */\r\n public createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for loading shader strings\r\n * Return true to stop further extensions from loading this shader data\r\n * @param gltfRuntime\r\n * @param id\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading this shader data\r\n */\r\n public loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for loading materials\r\n * Return true to stop further extensions from loading this material\r\n * @param gltfRuntime\r\n * @param id\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading this material\r\n */\r\n public loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n // ---------\r\n // Utilities\r\n // ---------\r\n\r\n public static LoadRuntimeAsync(\r\n scene: Scene,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n onSuccess?: (gltfRuntime: IGLTFRuntime) => void,\r\n onError?: (message: string) => void\r\n ): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError);\r\n },\r\n () => {\r\n setTimeout(() => {\r\n if (!onSuccess) {\r\n return;\r\n }\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n });\r\n }\r\n );\r\n }\r\n\r\n public static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError);\r\n },\r\n () => {\r\n setTimeout(() => {\r\n onSuccess();\r\n });\r\n }\r\n );\r\n }\r\n\r\n public static LoadBufferAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n onSuccess: (bufferView: ArrayBufferView) => void,\r\n onError: (message: string) => void,\r\n onProgress?: () => void\r\n ): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\r\n },\r\n () => {\r\n GLTFLoaderBase.LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\r\n }\r\n );\r\n }\r\n\r\n public static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void {\r\n GLTFLoaderExtension._LoadTextureBufferAsync(\r\n gltfRuntime,\r\n id,\r\n (buffer) => {\r\n if (buffer) {\r\n GLTFLoaderExtension._CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n }\r\n },\r\n onError\r\n );\r\n }\r\n\r\n public static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\r\n },\r\n () => {\r\n GLTFLoaderBase.LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\r\n }\r\n );\r\n }\r\n\r\n public static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadMaterialAsync(gltfRuntime, id, onSuccess, onError);\r\n },\r\n () => {\r\n GLTFLoaderBase.LoadMaterialAsync(gltfRuntime, id, onSuccess, onError);\r\n }\r\n );\r\n }\r\n\r\n private static _LoadTextureBufferAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n onSuccess: (buffer: Nullable<ArrayBufferView>) => void,\r\n onError: (message: string) => void\r\n ): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\r\n },\r\n () => {\r\n GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\r\n }\r\n );\r\n }\r\n\r\n private static _CreateTextureAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n buffer: ArrayBufferView,\r\n onSuccess: (texture: Texture) => void,\r\n onError: (message: string) => void\r\n ): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.createTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n },\r\n () => {\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess);\r\n }\r\n );\r\n }\r\n\r\n private static _ApplyExtensions(func: (loaderExtension: GLTFLoaderExtension) => boolean, defaultFunc: () => void): void {\r\n for (const extensionName in GLTFLoader.Extensions) {\r\n const loaderExtension = GLTFLoader.Extensions[extensionName];\r\n if (func(loaderExtension)) {\r\n return;\r\n }\r\n }\r\n\r\n defaultFunc();\r\n }\r\n}\r\n\r\nGLTFFileLoader._CreateGLTF1Loader = () => new GLTFLoader();\r\n"]}
1
+ {"version":3,"file":"glTFLoader.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/1.0/glTFLoader.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1H,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,6CAA+B;AACrE,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,SAAS,EAAE,gDAAkC;AACtD,OAAO,EAAE,IAAI,EAAE,sCAAwB;AACvC,OAAO,EAAE,QAAQ,EAAE,0CAA4B;AAC/C,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,QAAQ,EAAE,8CAAgC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AkB,GAAG,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type {\r\n IGLTFRuntime,\r\n IGLTFTechniqueParameter,\r\n IGLTFAnimation,\r\n IGLTFAnimationSampler,\r\n IGLTFNode,\r\n IGLTFSkins,\r\n INodeToRoot,\r\n IJointNode,\r\n IGLTFMesh,\r\n IGLTFAccessor,\r\n IGLTFLight,\r\n IGLTFAmbienLight,\r\n IGLTFDirectionalLight,\r\n IGLTFPointLight,\r\n IGLTFSpotLight,\r\n IGLTFCamera,\r\n IGLTFCameraPerspective,\r\n IGLTFScene,\r\n IGLTFTechnique,\r\n IGLTFMaterial,\r\n IGLTFProgram,\r\n IGLTFBuffer,\r\n IGLTFTexture,\r\n IGLTFImage,\r\n IGLTFSampler,\r\n IGLTFShader,\r\n IGLTFTechniqueStates,\r\n} from \"./glTFLoaderInterfaces\";\r\nimport { EParameterType, ETextureFilterType, ECullingType, EBlendingFunction, EShaderType } from \"./glTFLoaderInterfaces\";\r\n\r\nimport type { FloatArray, Nullable } from \"core/types\";\r\nimport { Quaternion, Vector3, Matrix } 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 { Animation } from \"core/Animations/animation\";\r\nimport { Bone } from \"core/Bones/bone\";\r\nimport { Skeleton } from \"core/Bones/skeleton\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { MultiMaterial } from \"core/Materials/multiMaterial\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { ShaderMaterial } from \"core/Materials/shaderMaterial\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Node } from \"core/node\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport { SubMesh } from \"core/Meshes/subMesh\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\nimport type { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from \"core/Loading/sceneLoader\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport type { IGLTFLoader, IGLTFLoaderData } from \"../glTFFileLoader\";\r\nimport { GLTFFileLoader } from \"../glTFFileLoader\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport type { AssetContainer } from \"core/assetContainer\";\r\n\r\n/**\r\n * Tokenizer. Used for shaders compatibility\r\n * Automatically map world, view, projection, worldViewProjection, attributes and so on\r\n */\r\nenum ETokenType {\r\n IDENTIFIER = 1,\r\n\r\n UNKNOWN = 2,\r\n END_OF_INPUT = 3,\r\n}\r\n\r\nclass Tokenizer {\r\n private _toParse: string;\r\n private _pos: number = 0;\r\n private _maxPos: number;\r\n\r\n public currentToken: ETokenType = ETokenType.UNKNOWN;\r\n public currentIdentifier: string = \"\";\r\n public currentString: string = \"\";\r\n public isLetterOrDigitPattern: RegExp = /^[a-zA-Z0-9]+$/;\r\n\r\n constructor(toParse: string) {\r\n this._toParse = toParse;\r\n this._maxPos = toParse.length;\r\n }\r\n\r\n public getNextToken(): ETokenType {\r\n if (this.isEnd()) {\r\n return ETokenType.END_OF_INPUT;\r\n }\r\n\r\n this.currentString = this.read();\r\n this.currentToken = ETokenType.UNKNOWN;\r\n\r\n if (this.currentString === \"_\" || this.isLetterOrDigitPattern.test(this.currentString)) {\r\n this.currentToken = ETokenType.IDENTIFIER;\r\n this.currentIdentifier = this.currentString;\r\n while (!this.isEnd() && (this.isLetterOrDigitPattern.test((this.currentString = this.peek())) || this.currentString === \"_\")) {\r\n this.currentIdentifier += this.currentString;\r\n this.forward();\r\n }\r\n }\r\n\r\n return this.currentToken;\r\n }\r\n\r\n public peek(): string {\r\n return this._toParse[this._pos];\r\n }\r\n\r\n public read(): string {\r\n return this._toParse[this._pos++];\r\n }\r\n\r\n public forward(): void {\r\n this._pos++;\r\n }\r\n\r\n public isEnd(): boolean {\r\n return this._pos >= this._maxPos;\r\n }\r\n}\r\n\r\n/**\r\n * Values\r\n */\r\nconst glTFTransforms = [\"MODEL\", \"VIEW\", \"PROJECTION\", \"MODELVIEW\", \"MODELVIEWPROJECTION\", \"JOINTMATRIX\"];\r\nconst babylonTransforms = [\"world\", \"view\", \"projection\", \"worldView\", \"worldViewProjection\", \"mBones\"];\r\n\r\nconst glTFAnimationPaths = [\"translation\", \"rotation\", \"scale\"];\r\nconst babylonAnimationPaths = [\"position\", \"rotationQuaternion\", \"scaling\"];\r\n\r\n/**\r\n * Parse\r\n * @param parsedBuffers\r\n * @param gltfRuntime\r\n */\r\nconst parseBuffers = (parsedBuffers: any, gltfRuntime: IGLTFRuntime) => {\r\n for (const buf in parsedBuffers) {\r\n const parsedBuffer = parsedBuffers[buf];\r\n gltfRuntime.buffers[buf] = parsedBuffer;\r\n gltfRuntime.buffersCount++;\r\n }\r\n};\r\n\r\nconst parseShaders = (parsedShaders: any, gltfRuntime: IGLTFRuntime) => {\r\n for (const sha in parsedShaders) {\r\n const parsedShader = parsedShaders[sha];\r\n gltfRuntime.shaders[sha] = parsedShader;\r\n gltfRuntime.shaderscount++;\r\n }\r\n};\r\n\r\nconst parseObject = (parsedObjects: any, runtimeProperty: string, gltfRuntime: IGLTFRuntime) => {\r\n for (const object in parsedObjects) {\r\n const parsedObject = parsedObjects[object];\r\n (<any>gltfRuntime)[runtimeProperty][object] = parsedObject;\r\n }\r\n};\r\n\r\n/**\r\n * Utils\r\n * @param buffer\r\n */\r\nconst normalizeUVs = (buffer: any) => {\r\n if (!buffer) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < buffer.length / 2; i++) {\r\n buffer[i * 2 + 1] = 1.0 - buffer[i * 2 + 1];\r\n }\r\n};\r\n\r\nconst getAttribute = (attributeParameter: IGLTFTechniqueParameter): Nullable<string> => {\r\n if (attributeParameter.semantic === \"NORMAL\") {\r\n return \"normal\";\r\n } else if (attributeParameter.semantic === \"POSITION\") {\r\n return \"position\";\r\n } else if (attributeParameter.semantic === \"JOINT\") {\r\n return \"matricesIndices\";\r\n } else if (attributeParameter.semantic === \"WEIGHT\") {\r\n return \"matricesWeights\";\r\n } else if (attributeParameter.semantic === \"COLOR\") {\r\n return \"color\";\r\n } else if (attributeParameter.semantic && attributeParameter.semantic.indexOf(\"TEXCOORD_\") !== -1) {\r\n const channel = Number(attributeParameter.semantic.split(\"_\")[1]);\r\n return \"uv\" + (channel === 0 ? \"\" : channel + 1);\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Loads and creates animations\r\n * @param gltfRuntime\r\n */\r\nconst loadAnimations = (gltfRuntime: IGLTFRuntime) => {\r\n for (const anim in gltfRuntime.animations) {\r\n const animation: IGLTFAnimation = gltfRuntime.animations[anim];\r\n\r\n if (!animation.channels || !animation.samplers) {\r\n continue;\r\n }\r\n\r\n let lastAnimation: Nullable<Animation> = null;\r\n\r\n for (let i = 0; i < animation.channels.length; i++) {\r\n // Get parameters and load buffers\r\n const channel = animation.channels[i];\r\n const sampler: IGLTFAnimationSampler = animation.samplers[channel.sampler];\r\n\r\n if (!sampler) {\r\n continue;\r\n }\r\n\r\n let inputData: Nullable<string> = null;\r\n let outputData: Nullable<string> = null;\r\n\r\n if (animation.parameters) {\r\n inputData = animation.parameters[sampler.input];\r\n outputData = animation.parameters[sampler.output];\r\n } else {\r\n inputData = sampler.input;\r\n outputData = sampler.output;\r\n }\r\n\r\n const bufferInput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[inputData]);\r\n const bufferOutput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[outputData]);\r\n\r\n const targetId = channel.target.id;\r\n let targetNode: any = gltfRuntime.scene.getNodeById(targetId);\r\n\r\n if (targetNode === null) {\r\n targetNode = gltfRuntime.scene.getNodeByName(targetId);\r\n }\r\n\r\n if (targetNode === null) {\r\n Tools.Warn(\"Creating animation named \" + anim + \". But cannot find node named \" + targetId + \" to attach to\");\r\n continue;\r\n }\r\n\r\n const isBone = targetNode instanceof Bone;\r\n\r\n // Get target path (position, rotation or scaling)\r\n let targetPath = channel.target.path;\r\n const targetPathIndex = glTFAnimationPaths.indexOf(targetPath);\r\n\r\n if (targetPathIndex !== -1) {\r\n targetPath = babylonAnimationPaths[targetPathIndex];\r\n }\r\n\r\n // Determine animation type\r\n let animationType = Animation.ANIMATIONTYPE_MATRIX;\r\n\r\n if (!isBone) {\r\n if (targetPath === \"rotationQuaternion\") {\r\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\r\n targetNode.rotationQuaternion = new Quaternion();\r\n } else {\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n }\r\n }\r\n\r\n // Create animation and key frames\r\n let babylonAnimation: Nullable<Animation> = null;\r\n const keys = [];\r\n let arrayOffset = 0;\r\n let modifyKey = false;\r\n\r\n if (isBone && lastAnimation && lastAnimation.getKeys().length === bufferInput.length) {\r\n babylonAnimation = lastAnimation;\r\n modifyKey = true;\r\n }\r\n\r\n if (!modifyKey) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n babylonAnimation = new Animation(anim, isBone ? \"_matrix\" : targetPath, 1, animationType, Animation.ANIMATIONLOOPMODE_CYCLE);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n }\r\n\r\n // For each frame\r\n for (let j = 0; j < bufferInput.length; j++) {\r\n let value: any = null;\r\n\r\n if (targetPath === \"rotationQuaternion\") {\r\n // VEC4\r\n value = Quaternion.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2], bufferOutput[arrayOffset + 3]]);\r\n arrayOffset += 4;\r\n } else {\r\n // Position and scaling are VEC3\r\n value = Vector3.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2]]);\r\n arrayOffset += 3;\r\n }\r\n\r\n if (isBone) {\r\n const bone = <Bone>targetNode;\r\n let translation = Vector3.Zero();\r\n let rotationQuaternion = new Quaternion();\r\n let scaling = Vector3.Zero();\r\n\r\n // Warning on decompose\r\n let mat = bone.getBaseMatrix();\r\n\r\n if (modifyKey && lastAnimation) {\r\n mat = lastAnimation.getKeys()[j].value;\r\n }\r\n\r\n mat.decompose(scaling, rotationQuaternion, translation);\r\n\r\n if (targetPath === \"position\") {\r\n translation = value;\r\n } else if (targetPath === \"rotationQuaternion\") {\r\n rotationQuaternion = value;\r\n } else {\r\n scaling = value;\r\n }\r\n\r\n value = Matrix.Compose(scaling, rotationQuaternion, translation);\r\n }\r\n\r\n if (!modifyKey) {\r\n keys.push({\r\n frame: bufferInput[j],\r\n value: value,\r\n });\r\n } else if (lastAnimation) {\r\n lastAnimation.getKeys()[j].value = value;\r\n }\r\n }\r\n\r\n // Finish\r\n if (!modifyKey && babylonAnimation) {\r\n babylonAnimation.setKeys(keys);\r\n targetNode.animations.push(babylonAnimation);\r\n }\r\n\r\n lastAnimation = babylonAnimation;\r\n\r\n gltfRuntime.scene.stopAnimation(targetNode);\r\n gltfRuntime.scene.beginAnimation(targetNode, 0, bufferInput[bufferInput.length - 1], true, 1.0);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * @returns the bones transformation matrix\r\n * @param node\r\n */\r\nconst configureBoneTransformation = (node: IGLTFNode): Matrix => {\r\n let mat: Nullable<Matrix> = null;\r\n\r\n if (node.translation || node.rotation || node.scale) {\r\n const scale = Vector3.FromArray(node.scale || [1, 1, 1]);\r\n const rotation = Quaternion.FromArray(node.rotation || [0, 0, 0, 1]);\r\n const position = Vector3.FromArray(node.translation || [0, 0, 0]);\r\n\r\n mat = Matrix.Compose(scale, rotation, position);\r\n } else {\r\n mat = Matrix.FromArray(node.matrix);\r\n }\r\n\r\n return mat;\r\n};\r\n\r\n/**\r\n * Returns the parent bone\r\n * @param gltfRuntime\r\n * @param skins\r\n * @param jointName\r\n * @param newSkeleton\r\n * @returns the parent bone\r\n */\r\nconst getParentBone = (gltfRuntime: IGLTFRuntime, skins: IGLTFSkins, jointName: string, newSkeleton: Skeleton): Nullable<Bone> => {\r\n // Try to find\r\n for (let i = 0; i < newSkeleton.bones.length; i++) {\r\n if (newSkeleton.bones[i].name === jointName) {\r\n return newSkeleton.bones[i];\r\n }\r\n }\r\n\r\n // Not found, search in gltf nodes\r\n const nodes = gltfRuntime.nodes;\r\n for (const nde in nodes) {\r\n const node: IGLTFNode = nodes[nde];\r\n\r\n if (!node.jointName) {\r\n continue;\r\n }\r\n\r\n const children = node.children;\r\n for (let i = 0; i < children.length; i++) {\r\n const child: IGLTFNode = gltfRuntime.nodes[children[i]];\r\n if (!child.jointName) {\r\n continue;\r\n }\r\n\r\n if (child.jointName === jointName) {\r\n const mat = configureBoneTransformation(node);\r\n const bone = new Bone(node.name || \"\", newSkeleton, getParentBone(gltfRuntime, skins, node.jointName, newSkeleton), mat);\r\n bone.id = nde;\r\n return bone;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Returns the appropriate root node\r\n * @param nodesToRoot\r\n * @param id\r\n * @returns the root node\r\n */\r\nconst getNodeToRoot = (nodesToRoot: INodeToRoot[], id: string): Nullable<Bone> => {\r\n for (let i = 0; i < nodesToRoot.length; i++) {\r\n const nodeToRoot = nodesToRoot[i];\r\n\r\n for (let j = 0; j < nodeToRoot.node.children.length; j++) {\r\n const child = nodeToRoot.node.children[j];\r\n if (child === id) {\r\n return nodeToRoot.bone;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Returns the node with the joint name\r\n * @param gltfRuntime\r\n * @param jointName\r\n * @returns the node with the joint name\r\n */\r\nconst getJointNode = (gltfRuntime: IGLTFRuntime, jointName: string): Nullable<IJointNode> => {\r\n const nodes = gltfRuntime.nodes;\r\n let node: IGLTFNode = nodes[jointName];\r\n if (node) {\r\n return {\r\n node: node,\r\n id: jointName,\r\n };\r\n }\r\n\r\n for (const nde in nodes) {\r\n node = nodes[nde];\r\n if (node.jointName === jointName) {\r\n return {\r\n node: node,\r\n id: nde,\r\n };\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Checks if a nodes is in joints\r\n * @param skins\r\n * @param id\r\n * @returns true if the node is in joints, else false\r\n */\r\nconst nodeIsInJoints = (skins: IGLTFSkins, id: string): boolean => {\r\n for (let i = 0; i < skins.jointNames.length; i++) {\r\n if (skins.jointNames[i] === id) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\n/**\r\n * Fills the nodes to root for bones and builds hierarchy\r\n * @param gltfRuntime\r\n * @param newSkeleton\r\n * @param skins\r\n * @param nodesToRoot\r\n */\r\nconst getNodesToRoot = (gltfRuntime: IGLTFRuntime, newSkeleton: Skeleton, skins: IGLTFSkins, nodesToRoot: INodeToRoot[]) => {\r\n // Creates nodes for root\r\n for (const nde in gltfRuntime.nodes) {\r\n const node: IGLTFNode = gltfRuntime.nodes[nde];\r\n const id = nde;\r\n\r\n if (!node.jointName || nodeIsInJoints(skins, node.jointName)) {\r\n continue;\r\n }\r\n\r\n // Create node to root bone\r\n const mat = configureBoneTransformation(node);\r\n const bone = new Bone(node.name || \"\", newSkeleton, null, mat);\r\n bone.id = id;\r\n nodesToRoot.push({ bone: bone, node: node, id: id });\r\n }\r\n\r\n // Parenting\r\n for (let i = 0; i < nodesToRoot.length; i++) {\r\n const nodeToRoot = nodesToRoot[i];\r\n const children = nodeToRoot.node.children;\r\n\r\n for (let j = 0; j < children.length; j++) {\r\n let child: Nullable<INodeToRoot> = null;\r\n\r\n for (let k = 0; k < nodesToRoot.length; k++) {\r\n if (nodesToRoot[k].id === children[j]) {\r\n child = nodesToRoot[k];\r\n break;\r\n }\r\n }\r\n\r\n if (child) {\r\n (<any>child.bone)._parent = nodeToRoot.bone;\r\n nodeToRoot.bone.children.push(child.bone);\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Imports a skeleton\r\n * @param gltfRuntime\r\n * @param skins\r\n * @param mesh\r\n * @param newSkeleton\r\n * @returns the bone name\r\n */\r\nconst importSkeleton = (gltfRuntime: IGLTFRuntime, skins: IGLTFSkins, mesh: Mesh, newSkeleton: Skeleton | undefined): Skeleton => {\r\n if (!newSkeleton) {\r\n newSkeleton = new Skeleton(skins.name || \"\", \"\", gltfRuntime.scene);\r\n }\r\n\r\n if (!skins.babylonSkeleton) {\r\n return newSkeleton;\r\n }\r\n\r\n // Find the root bones\r\n const nodesToRoot: INodeToRoot[] = [];\r\n const nodesToRootToAdd: Bone[] = [];\r\n\r\n getNodesToRoot(gltfRuntime, newSkeleton, skins, nodesToRoot);\r\n newSkeleton.bones = [];\r\n\r\n // Joints\r\n for (let i = 0; i < skins.jointNames.length; i++) {\r\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\r\n\r\n if (!jointNode) {\r\n continue;\r\n }\r\n\r\n const node = jointNode.node;\r\n\r\n if (!node) {\r\n Tools.Warn(\"Joint named \" + skins.jointNames[i] + \" does not exist\");\r\n continue;\r\n }\r\n\r\n const id = jointNode.id;\r\n\r\n // Optimize, if the bone already exists...\r\n const existingBone = gltfRuntime.scene.getBoneById(id);\r\n if (existingBone) {\r\n newSkeleton.bones.push(existingBone);\r\n continue;\r\n }\r\n\r\n // Search for parent bone\r\n let foundBone = false;\r\n let parentBone: Nullable<Bone> = null;\r\n\r\n for (let j = 0; j < i; j++) {\r\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[j]);\r\n\r\n if (!jointNode) {\r\n continue;\r\n }\r\n\r\n const joint: IGLTFNode = jointNode.node;\r\n\r\n if (!joint) {\r\n Tools.Warn(\"Joint named \" + skins.jointNames[j] + \" does not exist when looking for parent\");\r\n continue;\r\n }\r\n\r\n const children = joint.children;\r\n if (!children) {\r\n continue;\r\n }\r\n foundBone = false;\r\n\r\n for (let k = 0; k < children.length; k++) {\r\n if (children[k] === id) {\r\n parentBone = getParentBone(gltfRuntime, skins, skins.jointNames[j], newSkeleton);\r\n foundBone = true;\r\n break;\r\n }\r\n }\r\n\r\n if (foundBone) {\r\n break;\r\n }\r\n }\r\n\r\n // Create bone\r\n const mat = configureBoneTransformation(node);\r\n\r\n if (!parentBone && nodesToRoot.length > 0) {\r\n parentBone = getNodeToRoot(nodesToRoot, id);\r\n\r\n if (parentBone) {\r\n if (nodesToRootToAdd.indexOf(parentBone) === -1) {\r\n nodesToRootToAdd.push(parentBone);\r\n }\r\n }\r\n }\r\n\r\n const bone = new Bone(node.jointName || \"\", newSkeleton, parentBone, mat);\r\n bone.id = id;\r\n }\r\n\r\n // Polish\r\n const bones = newSkeleton.bones;\r\n newSkeleton.bones = [];\r\n\r\n for (let i = 0; i < skins.jointNames.length; i++) {\r\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\r\n\r\n if (!jointNode) {\r\n continue;\r\n }\r\n\r\n for (let j = 0; j < bones.length; j++) {\r\n if (bones[j].id === jointNode.id) {\r\n newSkeleton.bones.push(bones[j]);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n newSkeleton.prepare();\r\n\r\n // Finish\r\n for (let i = 0; i < nodesToRootToAdd.length; i++) {\r\n newSkeleton.bones.push(nodesToRootToAdd[i]);\r\n }\r\n\r\n return newSkeleton;\r\n};\r\n\r\n/**\r\n * Imports a mesh and its geometries\r\n * @param gltfRuntime\r\n * @param node\r\n * @param meshes\r\n * @param id\r\n * @param newMesh\r\n * @returns the new mesh\r\n */\r\nconst importMesh = (gltfRuntime: IGLTFRuntime, node: IGLTFNode, meshes: string[], id: string, newMesh: Mesh): Mesh => {\r\n if (!newMesh) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n newMesh = new Mesh(node.name || \"\", gltfRuntime.scene);\r\n newMesh._parentContainer = gltfRuntime.assetContainer;\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n newMesh.id = id;\r\n }\r\n\r\n if (!node.babylonNode) {\r\n return newMesh;\r\n }\r\n\r\n const subMaterials: Material[] = [];\r\n\r\n let vertexData: Nullable<VertexData> = null;\r\n const verticesStarts: number[] = [];\r\n const verticesCounts: number[] = [];\r\n const indexStarts: number[] = [];\r\n const indexCounts: number[] = [];\r\n\r\n for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\r\n const meshId = meshes[meshIndex];\r\n const mesh: IGLTFMesh = gltfRuntime.meshes[meshId];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n // Positions, normals and UVs\r\n for (let i = 0; i < mesh.primitives.length; i++) {\r\n // Temporary vertex data\r\n const tempVertexData = new VertexData();\r\n\r\n const primitive = mesh.primitives[i];\r\n if (primitive.mode !== 4) {\r\n // continue;\r\n }\r\n\r\n const attributes = primitive.attributes;\r\n let accessor: Nullable<IGLTFAccessor> = null;\r\n let buffer: any = null;\r\n\r\n // Set positions, normal and uvs\r\n for (const semantic in attributes) {\r\n // Link accessor and buffer view\r\n accessor = gltfRuntime.accessors[attributes[semantic]];\r\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\r\n\r\n if (semantic === \"NORMAL\") {\r\n tempVertexData.normals = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.normals).set(buffer);\r\n } else if (semantic === \"POSITION\") {\r\n if (GLTFFileLoader.HomogeneousCoordinates) {\r\n tempVertexData.positions = new Float32Array(buffer.length - buffer.length / 4);\r\n\r\n for (let j = 0; j < buffer.length; j += 4) {\r\n tempVertexData.positions[j] = buffer[j];\r\n tempVertexData.positions[j + 1] = buffer[j + 1];\r\n tempVertexData.positions[j + 2] = buffer[j + 2];\r\n }\r\n } else {\r\n tempVertexData.positions = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.positions).set(buffer);\r\n }\r\n\r\n verticesCounts.push(tempVertexData.positions.length);\r\n } else if (semantic.indexOf(\"TEXCOORD_\") !== -1) {\r\n const channel = Number(semantic.split(\"_\")[1]);\r\n const uvKind = VertexBuffer.UVKind + (channel === 0 ? \"\" : channel + 1);\r\n const uvs = new Float32Array(buffer.length);\r\n (<Float32Array>uvs).set(buffer);\r\n normalizeUVs(uvs);\r\n tempVertexData.set(uvs, uvKind);\r\n } else if (semantic === \"JOINT\") {\r\n tempVertexData.matricesIndices = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.matricesIndices).set(buffer);\r\n } else if (semantic === \"WEIGHT\") {\r\n tempVertexData.matricesWeights = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.matricesWeights).set(buffer);\r\n } else if (semantic === \"COLOR\") {\r\n tempVertexData.colors = new Float32Array(buffer.length);\r\n (<Float32Array>tempVertexData.colors).set(buffer);\r\n }\r\n }\r\n\r\n // Indices\r\n accessor = gltfRuntime.accessors[primitive.indices];\r\n if (accessor) {\r\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\r\n\r\n tempVertexData.indices = new Int32Array(buffer.length);\r\n tempVertexData.indices.set(buffer);\r\n indexCounts.push(tempVertexData.indices.length);\r\n } else {\r\n // Set indices on the fly\r\n const indices: number[] = [];\r\n for (let j = 0; j < (<FloatArray>tempVertexData.positions).length / 3; j++) {\r\n indices.push(j);\r\n }\r\n\r\n tempVertexData.indices = new Int32Array(indices);\r\n indexCounts.push(tempVertexData.indices.length);\r\n }\r\n\r\n if (!vertexData) {\r\n vertexData = tempVertexData;\r\n } else {\r\n vertexData.merge(tempVertexData);\r\n }\r\n\r\n // Sub material\r\n const material = gltfRuntime.scene.getMaterialById(primitive.material);\r\n\r\n subMaterials.push(material === null ? GLTFUtils.GetDefaultMaterial(gltfRuntime.scene) : material);\r\n\r\n // Update vertices start and index start\r\n verticesStarts.push(verticesStarts.length === 0 ? 0 : verticesStarts[verticesStarts.length - 1] + verticesCounts[verticesCounts.length - 2]);\r\n indexStarts.push(indexStarts.length === 0 ? 0 : indexStarts[indexStarts.length - 1] + indexCounts[indexCounts.length - 2]);\r\n }\r\n }\r\n let material: StandardMaterial | MultiMaterial;\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n if (subMaterials.length > 1) {\r\n material = new MultiMaterial(\"multimat\" + id, gltfRuntime.scene);\r\n (material as MultiMaterial).subMaterials = subMaterials;\r\n } else {\r\n material = new StandardMaterial(\"multimat\" + id, gltfRuntime.scene);\r\n }\r\n\r\n if (subMaterials.length === 1) {\r\n material = subMaterials[0] as StandardMaterial;\r\n }\r\n\r\n material._parentContainer = gltfRuntime.assetContainer;\r\n\r\n if (!newMesh.material) {\r\n newMesh.material = material;\r\n }\r\n\r\n // Apply geometry\r\n new Geometry(id, gltfRuntime.scene, vertexData!, false, newMesh);\r\n newMesh.computeWorldMatrix(true);\r\n\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n\r\n // Apply submeshes\r\n newMesh.subMeshes = [];\r\n let index = 0;\r\n for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\r\n const meshId = meshes[meshIndex];\r\n const mesh: IGLTFMesh = gltfRuntime.meshes[meshId];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n for (let i = 0; i < mesh.primitives.length; i++) {\r\n if (mesh.primitives[i].mode !== 4) {\r\n //continue;\r\n }\r\n\r\n SubMesh.AddToMesh(index, verticesStarts[index], verticesCounts[index], indexStarts[index], indexCounts[index], newMesh, newMesh, true);\r\n index++;\r\n }\r\n }\r\n\r\n // Finish\r\n return newMesh;\r\n};\r\n\r\n/**\r\n * Configure node transformation from position, rotation and scaling\r\n * @param newNode\r\n * @param position\r\n * @param rotation\r\n * @param scaling\r\n */\r\nconst configureNode = (newNode: any, position: Vector3, rotation: Quaternion, scaling: Vector3) => {\r\n if (newNode.position) {\r\n newNode.position = position;\r\n }\r\n\r\n if (newNode.rotationQuaternion || newNode.rotation) {\r\n newNode.rotationQuaternion = rotation;\r\n }\r\n\r\n if (newNode.scaling) {\r\n newNode.scaling = scaling;\r\n }\r\n};\r\n\r\n/**\r\n * Configures node from transformation matrix\r\n * @param newNode\r\n * @param node\r\n */\r\nconst configureNodeFromMatrix = (newNode: Mesh, node: IGLTFNode) => {\r\n if (node.matrix) {\r\n const position = new Vector3(0, 0, 0);\r\n const rotation = new Quaternion();\r\n const scaling = new Vector3(0, 0, 0);\r\n const mat = Matrix.FromArray(node.matrix);\r\n mat.decompose(scaling, rotation, position);\r\n\r\n configureNode(newNode, position, rotation, scaling);\r\n } else if (node.translation && node.rotation && node.scale) {\r\n configureNode(newNode, Vector3.FromArray(node.translation), Quaternion.FromArray(node.rotation), Vector3.FromArray(node.scale));\r\n }\r\n\r\n newNode.computeWorldMatrix(true);\r\n};\r\n\r\n/**\r\n * Imports a node\r\n * @param gltfRuntime\r\n * @param node\r\n * @param id\r\n * @returns the newly imported node\r\n */\r\nconst importNode = (gltfRuntime: IGLTFRuntime, node: IGLTFNode, id: string): Nullable<Node> => {\r\n let lastNode: Nullable<Node> = null;\r\n\r\n if (gltfRuntime.importOnlyMeshes && (node.skin || node.meshes)) {\r\n if (gltfRuntime.importMeshesNames && gltfRuntime.importMeshesNames.length > 0 && gltfRuntime.importMeshesNames.indexOf(node.name || \"\") === -1) {\r\n return null;\r\n }\r\n }\r\n\r\n // Meshes\r\n if (node.skin) {\r\n if (node.meshes) {\r\n const skin: IGLTFSkins = gltfRuntime.skins[node.skin];\r\n\r\n const newMesh = importMesh(gltfRuntime, node, node.meshes, id, <Mesh>node.babylonNode);\r\n newMesh.skeleton = gltfRuntime.scene.getLastSkeletonById(node.skin);\r\n\r\n if (newMesh.skeleton === null) {\r\n newMesh.skeleton = importSkeleton(gltfRuntime, skin, newMesh, skin.babylonSkeleton);\r\n\r\n if (!skin.babylonSkeleton) {\r\n skin.babylonSkeleton = newMesh.skeleton;\r\n }\r\n }\r\n\r\n lastNode = newMesh;\r\n }\r\n } else if (node.meshes) {\r\n /**\r\n * Improve meshes property\r\n */\r\n const newMesh = importMesh(gltfRuntime, node, node.mesh ? [node.mesh] : node.meshes, id, <Mesh>node.babylonNode);\r\n lastNode = newMesh;\r\n }\r\n // Lights\r\n else if (node.light && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\r\n const light: IGLTFLight = gltfRuntime.lights[node.light];\r\n\r\n if (light) {\r\n if (light.type === \"ambient\") {\r\n const ambienLight: IGLTFAmbienLight = (<any>light)[light.type];\r\n const hemiLight = new HemisphericLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n hemiLight.name = node.name || \"\";\r\n\r\n if (ambienLight.color) {\r\n hemiLight.diffuse = Color3.FromArray(ambienLight.color);\r\n }\r\n\r\n lastNode = hemiLight;\r\n } else if (light.type === \"directional\") {\r\n const directionalLight: IGLTFDirectionalLight = (<any>light)[light.type];\r\n const dirLight = new DirectionalLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n dirLight.name = node.name || \"\";\r\n\r\n if (directionalLight.color) {\r\n dirLight.diffuse = Color3.FromArray(directionalLight.color);\r\n }\r\n\r\n lastNode = dirLight;\r\n } else if (light.type === \"point\") {\r\n const pointLight: IGLTFPointLight = (<any>light)[light.type];\r\n const ptLight = new PointLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n ptLight.name = node.name || \"\";\r\n\r\n if (pointLight.color) {\r\n ptLight.diffuse = Color3.FromArray(pointLight.color);\r\n }\r\n\r\n lastNode = ptLight;\r\n } else if (light.type === \"spot\") {\r\n const spotLight: IGLTFSpotLight = (<any>light)[light.type];\r\n const spLight = new SpotLight(node.light, Vector3.Zero(), Vector3.Zero(), 0, 0, gltfRuntime.scene);\r\n spLight.name = node.name || \"\";\r\n\r\n if (spotLight.color) {\r\n spLight.diffuse = Color3.FromArray(spotLight.color);\r\n }\r\n\r\n if (spotLight.fallOfAngle) {\r\n spLight.angle = spotLight.fallOfAngle;\r\n }\r\n\r\n if (spotLight.fallOffExponent) {\r\n spLight.exponent = spotLight.fallOffExponent;\r\n }\r\n\r\n lastNode = spLight;\r\n }\r\n }\r\n }\r\n // Cameras\r\n else if (node.camera && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\r\n const camera: IGLTFCamera = gltfRuntime.cameras[node.camera];\r\n\r\n if (camera) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n if (camera.type === \"orthographic\") {\r\n const orthoCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\r\n\r\n orthoCamera.name = node.name || \"\";\r\n orthoCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\r\n orthoCamera.attachControl();\r\n\r\n lastNode = orthoCamera;\r\n\r\n orthoCamera._parentContainer = gltfRuntime.assetContainer;\r\n } else if (camera.type === \"perspective\") {\r\n const perspectiveCamera: IGLTFCameraPerspective = (<any>camera)[camera.type];\r\n const persCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\r\n\r\n persCamera.name = node.name || \"\";\r\n persCamera.attachControl();\r\n\r\n if (!perspectiveCamera.aspectRatio) {\r\n perspectiveCamera.aspectRatio = gltfRuntime.scene.getEngine().getRenderWidth() / gltfRuntime.scene.getEngine().getRenderHeight();\r\n }\r\n\r\n if (perspectiveCamera.znear && perspectiveCamera.zfar) {\r\n persCamera.maxZ = perspectiveCamera.zfar;\r\n persCamera.minZ = perspectiveCamera.znear;\r\n }\r\n\r\n lastNode = persCamera;\r\n persCamera._parentContainer = gltfRuntime.assetContainer;\r\n }\r\n\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n }\r\n }\r\n\r\n // Empty node\r\n if (!node.jointName) {\r\n if (node.babylonNode) {\r\n return node.babylonNode;\r\n } else if (lastNode === null) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n const dummy = new Mesh(node.name || \"\", gltfRuntime.scene);\r\n dummy._parentContainer = gltfRuntime.assetContainer;\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n node.babylonNode = dummy;\r\n lastNode = dummy;\r\n }\r\n }\r\n\r\n if (lastNode !== null) {\r\n if (node.matrix && lastNode instanceof Mesh) {\r\n configureNodeFromMatrix(lastNode, node);\r\n } else {\r\n const translation = node.translation || [0, 0, 0];\r\n const rotation = node.rotation || [0, 0, 0, 1];\r\n const scale = node.scale || [1, 1, 1];\r\n configureNode(lastNode, Vector3.FromArray(translation), Quaternion.FromArray(rotation), Vector3.FromArray(scale));\r\n }\r\n\r\n lastNode.updateCache(true);\r\n node.babylonNode = lastNode;\r\n }\r\n\r\n return lastNode;\r\n};\r\n\r\n/**\r\n * Traverses nodes and creates them\r\n * @param gltfRuntime\r\n * @param id\r\n * @param parent\r\n * @param meshIncluded\r\n */\r\nconst traverseNodes = (gltfRuntime: IGLTFRuntime, id: string, parent: Nullable<Node>, meshIncluded: boolean = false) => {\r\n const node: IGLTFNode = gltfRuntime.nodes[id];\r\n let newNode: Nullable<Node> = null;\r\n\r\n if (gltfRuntime.importOnlyMeshes && !meshIncluded && gltfRuntime.importMeshesNames) {\r\n if (gltfRuntime.importMeshesNames.indexOf(node.name || \"\") !== -1 || gltfRuntime.importMeshesNames.length === 0) {\r\n meshIncluded = true;\r\n } else {\r\n meshIncluded = false;\r\n }\r\n } else {\r\n meshIncluded = true;\r\n }\r\n\r\n if (!node.jointName && meshIncluded) {\r\n newNode = importNode(gltfRuntime, node, id);\r\n\r\n if (newNode !== null) {\r\n newNode.id = id;\r\n newNode.parent = parent;\r\n }\r\n }\r\n\r\n if (node.children) {\r\n for (let i = 0; i < node.children.length; i++) {\r\n traverseNodes(gltfRuntime, node.children[i], newNode, meshIncluded);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * do stuff after buffers, shaders are loaded (e.g. hook up materials, load animations, etc.)\r\n * @param gltfRuntime\r\n */\r\nconst postLoad = (gltfRuntime: IGLTFRuntime) => {\r\n // Nodes\r\n let currentScene: IGLTFScene = <IGLTFScene>gltfRuntime.currentScene;\r\n\r\n if (currentScene) {\r\n for (let i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n } else {\r\n for (const thing in gltfRuntime.scenes) {\r\n currentScene = <IGLTFScene>gltfRuntime.scenes[thing];\r\n\r\n for (let i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n }\r\n\r\n // Set animations\r\n loadAnimations(gltfRuntime);\r\n\r\n for (let i = 0; i < gltfRuntime.scene.skeletons.length; i++) {\r\n const skeleton = gltfRuntime.scene.skeletons[i];\r\n gltfRuntime.scene.beginAnimation(skeleton, 0, Number.MAX_VALUE, true, 1.0);\r\n }\r\n};\r\n\r\n/**\r\n * onBind shaderrs callback to set uniforms and matrices\r\n * @param mesh\r\n * @param gltfRuntime\r\n * @param unTreatedUniforms\r\n * @param shaderMaterial\r\n * @param technique\r\n * @param material\r\n * @param onSuccess\r\n */\r\nconst onBindShaderMaterial = (\r\n mesh: AbstractMesh,\r\n gltfRuntime: IGLTFRuntime,\r\n unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter },\r\n shaderMaterial: ShaderMaterial,\r\n technique: IGLTFTechnique,\r\n material: IGLTFMaterial,\r\n onSuccess: (shaderMaterial: ShaderMaterial) => void\r\n) => {\r\n const materialValues = material.values || technique.parameters;\r\n\r\n for (const unif in unTreatedUniforms) {\r\n const uniform: IGLTFTechniqueParameter = unTreatedUniforms[unif];\r\n const type = uniform.type;\r\n\r\n if (type === EParameterType.FLOAT_MAT2 || type === EParameterType.FLOAT_MAT3 || type === EParameterType.FLOAT_MAT4) {\r\n if (uniform.semantic && !uniform.source && !uniform.node) {\r\n GLTFUtils.SetMatrix(gltfRuntime.scene, mesh, uniform, unif, <Effect>shaderMaterial.getEffect());\r\n } else if (uniform.semantic && (uniform.source || uniform.node)) {\r\n let source = gltfRuntime.scene.getNodeByName(uniform.source || uniform.node || \"\");\r\n if (source === null) {\r\n source = gltfRuntime.scene.getNodeById(uniform.source || uniform.node || \"\");\r\n }\r\n if (source === null) {\r\n continue;\r\n }\r\n\r\n GLTFUtils.SetMatrix(gltfRuntime.scene, source, uniform, unif, <Effect>shaderMaterial.getEffect());\r\n }\r\n } else {\r\n const value = (<any>materialValues)[technique.uniforms[unif]];\r\n if (!value) {\r\n continue;\r\n }\r\n\r\n if (type === EParameterType.SAMPLER_2D) {\r\n const texture = gltfRuntime.textures[material.values ? value : uniform.value].babylonTexture;\r\n\r\n if (texture === null || texture === undefined) {\r\n continue;\r\n }\r\n\r\n (<Effect>shaderMaterial.getEffect()).setTexture(unif, texture);\r\n } else {\r\n GLTFUtils.SetUniform(<Effect>shaderMaterial.getEffect(), unif, value, type);\r\n }\r\n }\r\n }\r\n\r\n onSuccess(shaderMaterial);\r\n};\r\n\r\n/**\r\n * Prepare uniforms to send the only one time\r\n * Loads the appropriate textures\r\n * @param gltfRuntime\r\n * @param shaderMaterial\r\n * @param technique\r\n * @param material\r\n */\r\nconst prepareShaderMaterialUniforms = (\r\n gltfRuntime: IGLTFRuntime,\r\n shaderMaterial: ShaderMaterial,\r\n technique: IGLTFTechnique,\r\n material: IGLTFMaterial,\r\n unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter }\r\n) => {\r\n const materialValues = material.values || technique.parameters;\r\n const techniqueUniforms = technique.uniforms;\r\n\r\n /**\r\n * Prepare values here (not matrices)\r\n */\r\n for (const unif in unTreatedUniforms) {\r\n const uniform: IGLTFTechniqueParameter = unTreatedUniforms[unif];\r\n const type = uniform.type;\r\n let value = (<any>materialValues)[techniqueUniforms[unif]];\r\n\r\n if (value === undefined) {\r\n // In case the value is the same for all materials\r\n value = <any>uniform.value;\r\n }\r\n\r\n if (!value) {\r\n continue;\r\n }\r\n\r\n const onLoadTexture = (uniformName: Nullable<string>) => {\r\n return (texture: Texture) => {\r\n if (uniform.value && uniformName) {\r\n // Static uniform\r\n shaderMaterial.setTexture(uniformName, texture);\r\n delete unTreatedUniforms[uniformName];\r\n }\r\n };\r\n };\r\n\r\n // Texture (sampler2D)\r\n if (type === EParameterType.SAMPLER_2D) {\r\n GLTFLoaderExtension.LoadTextureAsync(gltfRuntime, material.values ? value : uniform.value, onLoadTexture(unif), () => onLoadTexture(null));\r\n }\r\n // Others\r\n else {\r\n if (uniform.value && GLTFUtils.SetUniform(shaderMaterial, unif, material.values ? value : uniform.value, type)) {\r\n // Static uniform\r\n delete unTreatedUniforms[unif];\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Shader compilation failed\r\n * @param program\r\n * @param shaderMaterial\r\n * @param onError\r\n * @returns callback when shader is compiled\r\n */\r\nconst onShaderCompileError = (program: IGLTFProgram, shaderMaterial: ShaderMaterial, onError: (message: string) => void) => {\r\n return (effect: Effect, error: string) => {\r\n shaderMaterial.dispose(true);\r\n onError(\"Cannot compile program named \" + program.name + \". Error: \" + error + \". Default material will be applied\");\r\n };\r\n};\r\n\r\n/**\r\n * Shader compilation success\r\n * @param gltfRuntime\r\n * @param shaderMaterial\r\n * @param technique\r\n * @param material\r\n * @param unTreatedUniforms\r\n * @param onSuccess\r\n * @returns callback when shader is compiled\r\n */\r\nconst onShaderCompileSuccess = (\r\n gltfRuntime: IGLTFRuntime,\r\n shaderMaterial: ShaderMaterial,\r\n technique: IGLTFTechnique,\r\n material: IGLTFMaterial,\r\n unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter },\r\n onSuccess: (shaderMaterial: ShaderMaterial) => void\r\n) => {\r\n return (_: Effect) => {\r\n prepareShaderMaterialUniforms(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms);\r\n\r\n shaderMaterial.onBind = (mesh: AbstractMesh) => {\r\n onBindShaderMaterial(mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess);\r\n };\r\n };\r\n};\r\n\r\n/**\r\n * Returns the appropriate uniform if already handled by babylon\r\n * @param tokenizer\r\n * @param technique\r\n * @param unTreatedUniforms\r\n * @returns the name of the uniform handled by babylon\r\n */\r\nconst parseShaderUniforms = (tokenizer: Tokenizer, technique: IGLTFTechnique, unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter }): string => {\r\n for (const unif in technique.uniforms) {\r\n const uniform = technique.uniforms[unif];\r\n const uniformParameter: IGLTFTechniqueParameter = technique.parameters[uniform];\r\n\r\n if (tokenizer.currentIdentifier === unif) {\r\n if (uniformParameter.semantic && !uniformParameter.source && !uniformParameter.node) {\r\n const transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\r\n\r\n if (transformIndex !== -1) {\r\n delete unTreatedUniforms[unif];\r\n return babylonTransforms[transformIndex];\r\n }\r\n }\r\n }\r\n }\r\n\r\n return tokenizer.currentIdentifier;\r\n};\r\n\r\n/**\r\n * All shaders loaded. Create materials one by one\r\n * @param gltfRuntime\r\n */\r\nconst importMaterials = (gltfRuntime: IGLTFRuntime) => {\r\n // Create materials\r\n for (const mat in gltfRuntime.materials) {\r\n GLTFLoaderExtension.LoadMaterialAsync(\r\n gltfRuntime,\r\n mat,\r\n () => {},\r\n () => {}\r\n );\r\n }\r\n};\r\n\r\n/**\r\n * Implementation of the base glTF spec\r\n * @internal\r\n */\r\nexport class GLTFLoaderBase {\r\n public static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime {\r\n const gltfRuntime: IGLTFRuntime = {\r\n extensions: {},\r\n accessors: {},\r\n buffers: {},\r\n bufferViews: {},\r\n meshes: {},\r\n lights: {},\r\n cameras: {},\r\n nodes: {},\r\n images: {},\r\n textures: {},\r\n shaders: {},\r\n programs: {},\r\n samplers: {},\r\n techniques: {},\r\n materials: {},\r\n animations: {},\r\n skins: {},\r\n extensionsUsed: [],\r\n\r\n scenes: {},\r\n\r\n buffersCount: 0,\r\n shaderscount: 0,\r\n\r\n scene: scene,\r\n rootUrl: rootUrl,\r\n\r\n loadedBufferCount: 0,\r\n loadedBufferViews: {},\r\n\r\n loadedShaderCount: 0,\r\n\r\n importOnlyMeshes: false,\r\n\r\n dummyNodes: [],\r\n\r\n assetContainer: null,\r\n };\r\n\r\n // Parse\r\n if (parsedData.extensions) {\r\n parseObject(parsedData.extensions, \"extensions\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.extensionsUsed) {\r\n parseObject(parsedData.extensionsUsed, \"extensionsUsed\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.buffers) {\r\n parseBuffers(parsedData.buffers, gltfRuntime);\r\n }\r\n\r\n if (parsedData.bufferViews) {\r\n parseObject(parsedData.bufferViews, \"bufferViews\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.accessors) {\r\n parseObject(parsedData.accessors, \"accessors\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.meshes) {\r\n parseObject(parsedData.meshes, \"meshes\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.lights) {\r\n parseObject(parsedData.lights, \"lights\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.cameras) {\r\n parseObject(parsedData.cameras, \"cameras\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.nodes) {\r\n parseObject(parsedData.nodes, \"nodes\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.images) {\r\n parseObject(parsedData.images, \"images\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.textures) {\r\n parseObject(parsedData.textures, \"textures\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.shaders) {\r\n parseShaders(parsedData.shaders, gltfRuntime);\r\n }\r\n\r\n if (parsedData.programs) {\r\n parseObject(parsedData.programs, \"programs\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.samplers) {\r\n parseObject(parsedData.samplers, \"samplers\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.techniques) {\r\n parseObject(parsedData.techniques, \"techniques\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.materials) {\r\n parseObject(parsedData.materials, \"materials\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.animations) {\r\n parseObject(parsedData.animations, \"animations\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.skins) {\r\n parseObject(parsedData.skins, \"skins\", gltfRuntime);\r\n }\r\n\r\n if (parsedData.scenes) {\r\n gltfRuntime.scenes = parsedData.scenes;\r\n }\r\n\r\n if (parsedData.scene && parsedData.scenes) {\r\n gltfRuntime.currentScene = parsedData.scenes[parsedData.scene];\r\n }\r\n\r\n return gltfRuntime;\r\n }\r\n\r\n public static LoadBufferAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n onSuccess: (buffer: ArrayBufferView) => void,\r\n onError: (message: string) => void,\r\n onProgress?: () => void\r\n ): void {\r\n const buffer: IGLTFBuffer = gltfRuntime.buffers[id];\r\n\r\n if (Tools.IsBase64(buffer.uri)) {\r\n setTimeout(() => onSuccess(new Uint8Array(Tools.DecodeBase64(buffer.uri))));\r\n } else {\r\n Tools.LoadFile(\r\n gltfRuntime.rootUrl + buffer.uri,\r\n (data) => onSuccess(new Uint8Array(data as ArrayBuffer)),\r\n onProgress,\r\n undefined,\r\n true,\r\n (request) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n }\r\n );\r\n }\r\n }\r\n\r\n public static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void {\r\n const texture: IGLTFTexture = gltfRuntime.textures[id];\r\n\r\n if (!texture || !texture.source) {\r\n onError(\"\");\r\n return;\r\n }\r\n\r\n if (texture.babylonTexture) {\r\n onSuccess(null);\r\n return;\r\n }\r\n\r\n const source: IGLTFImage = gltfRuntime.images[texture.source];\r\n\r\n if (Tools.IsBase64(source.uri)) {\r\n setTimeout(() => onSuccess(new Uint8Array(Tools.DecodeBase64(source.uri))));\r\n } else {\r\n Tools.LoadFile(\r\n gltfRuntime.rootUrl + source.uri,\r\n (data) => onSuccess(new Uint8Array(data as ArrayBuffer)),\r\n undefined,\r\n undefined,\r\n true,\r\n (request) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n }\r\n );\r\n }\r\n }\r\n\r\n public static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void): void {\r\n const texture: IGLTFTexture = gltfRuntime.textures[id];\r\n\r\n if (texture.babylonTexture) {\r\n onSuccess(texture.babylonTexture);\r\n return;\r\n }\r\n\r\n const sampler: IGLTFSampler = gltfRuntime.samplers[texture.sampler];\r\n\r\n const createMipMaps =\r\n sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_NEAREST ||\r\n sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_LINEAR ||\r\n sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_NEAREST ||\r\n sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_LINEAR;\r\n\r\n const samplingMode = Texture.BILINEAR_SAMPLINGMODE;\r\n\r\n const blob = buffer == null ? new Blob() : new Blob([buffer]);\r\n const blobURL = URL.createObjectURL(blob);\r\n const revokeBlobURL = () => URL.revokeObjectURL(blobURL);\r\n const newTexture = new Texture(blobURL, gltfRuntime.scene, !createMipMaps, true, samplingMode, revokeBlobURL, revokeBlobURL);\r\n if (sampler.wrapS !== undefined) {\r\n newTexture.wrapU = GLTFUtils.GetWrapMode(sampler.wrapS);\r\n }\r\n if (sampler.wrapT !== undefined) {\r\n newTexture.wrapV = GLTFUtils.GetWrapMode(sampler.wrapT);\r\n }\r\n newTexture.name = id;\r\n\r\n texture.babylonTexture = newTexture;\r\n onSuccess(newTexture);\r\n }\r\n\r\n public static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void {\r\n const shader: IGLTFShader = gltfRuntime.shaders[id];\r\n\r\n if (Tools.IsBase64(shader.uri)) {\r\n const shaderString = atob(shader.uri.split(\",\")[1]);\r\n if (onSuccess) {\r\n onSuccess(shaderString);\r\n }\r\n } else {\r\n Tools.LoadFile(gltfRuntime.rootUrl + shader.uri, onSuccess, undefined, undefined, false, (request) => {\r\n if (request && onError) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n });\r\n }\r\n }\r\n\r\n public static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void {\r\n const material: IGLTFMaterial = gltfRuntime.materials[id];\r\n if (!material.technique) {\r\n if (onError) {\r\n onError(\"No technique found.\");\r\n }\r\n return;\r\n }\r\n\r\n const technique: IGLTFTechnique = gltfRuntime.techniques[material.technique];\r\n if (!technique) {\r\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\r\n const defaultMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n defaultMaterial._parentContainer = gltfRuntime.assetContainer;\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n defaultMaterial.diffuseColor = new Color3(0.5, 0.5, 0.5);\r\n defaultMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n onSuccess(defaultMaterial);\r\n return;\r\n }\r\n\r\n const program: IGLTFProgram = gltfRuntime.programs[technique.program];\r\n const states: IGLTFTechniqueStates = technique.states;\r\n\r\n const vertexShader: string = Effect.ShadersStore[program.vertexShader + \"VertexShader\"];\r\n const pixelShader: string = Effect.ShadersStore[program.fragmentShader + \"PixelShader\"];\r\n let newVertexShader = \"\";\r\n let newPixelShader = \"\";\r\n\r\n const vertexTokenizer = new Tokenizer(vertexShader);\r\n const pixelTokenizer = new Tokenizer(pixelShader);\r\n\r\n const unTreatedUniforms: { [key: string]: IGLTFTechniqueParameter } = {};\r\n const uniforms: string[] = [];\r\n const attributes: string[] = [];\r\n const samplers: string[] = [];\r\n\r\n // Fill uniform, sampler2D and attributes\r\n for (const unif in technique.uniforms) {\r\n const uniform = technique.uniforms[unif];\r\n const uniformParameter: IGLTFTechniqueParameter = technique.parameters[uniform];\r\n\r\n unTreatedUniforms[unif] = uniformParameter;\r\n\r\n if (uniformParameter.semantic && !uniformParameter.node && !uniformParameter.source) {\r\n const transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\r\n if (transformIndex !== -1) {\r\n uniforms.push(babylonTransforms[transformIndex]);\r\n delete unTreatedUniforms[unif];\r\n } else {\r\n uniforms.push(unif);\r\n }\r\n } else if (uniformParameter.type === EParameterType.SAMPLER_2D) {\r\n samplers.push(unif);\r\n } else {\r\n uniforms.push(unif);\r\n }\r\n }\r\n\r\n for (const attr in technique.attributes) {\r\n const attribute = technique.attributes[attr];\r\n const attributeParameter: IGLTFTechniqueParameter = technique.parameters[attribute];\r\n\r\n if (attributeParameter.semantic) {\r\n const name = getAttribute(attributeParameter);\r\n if (name) {\r\n attributes.push(name);\r\n }\r\n }\r\n }\r\n\r\n // Configure vertex shader\r\n while (!vertexTokenizer.isEnd() && vertexTokenizer.getNextToken()) {\r\n const tokenType = vertexTokenizer.currentToken;\r\n\r\n if (tokenType !== ETokenType.IDENTIFIER) {\r\n newVertexShader += vertexTokenizer.currentString;\r\n continue;\r\n }\r\n\r\n let foundAttribute = false;\r\n\r\n for (const attr in technique.attributes) {\r\n const attribute = technique.attributes[attr];\r\n const attributeParameter: IGLTFTechniqueParameter = technique.parameters[attribute];\r\n\r\n if (vertexTokenizer.currentIdentifier === attr && attributeParameter.semantic) {\r\n newVertexShader += getAttribute(attributeParameter);\r\n foundAttribute = true;\r\n break;\r\n }\r\n }\r\n\r\n if (foundAttribute) {\r\n continue;\r\n }\r\n\r\n newVertexShader += parseShaderUniforms(vertexTokenizer, technique, unTreatedUniforms);\r\n }\r\n\r\n // Configure pixel shader\r\n while (!pixelTokenizer.isEnd() && pixelTokenizer.getNextToken()) {\r\n const tokenType = pixelTokenizer.currentToken;\r\n\r\n if (tokenType !== ETokenType.IDENTIFIER) {\r\n newPixelShader += pixelTokenizer.currentString;\r\n continue;\r\n }\r\n\r\n newPixelShader += parseShaderUniforms(pixelTokenizer, technique, unTreatedUniforms);\r\n }\r\n\r\n // Create shader material\r\n const shaderPath = {\r\n vertex: program.vertexShader + id,\r\n fragment: program.fragmentShader + id,\r\n };\r\n\r\n const options = {\r\n attributes: attributes,\r\n uniforms: uniforms,\r\n samplers: samplers,\r\n needAlphaBlending: states && states.enable && states.enable.indexOf(3042) !== -1,\r\n };\r\n\r\n Effect.ShadersStore[program.vertexShader + id + \"VertexShader\"] = newVertexShader;\r\n Effect.ShadersStore[program.fragmentShader + id + \"PixelShader\"] = newPixelShader;\r\n\r\n const shaderMaterial = new ShaderMaterial(id, gltfRuntime.scene, shaderPath, options);\r\n shaderMaterial.onError = onShaderCompileError(program, shaderMaterial, onError);\r\n shaderMaterial.onCompiled = onShaderCompileSuccess(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess);\r\n shaderMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n\r\n if (states && states.functions) {\r\n const functions = states.functions;\r\n if (functions.cullFace && functions.cullFace[0] !== ECullingType.BACK) {\r\n shaderMaterial.backFaceCulling = false;\r\n }\r\n\r\n const blendFunc = functions.blendFuncSeparate;\r\n if (blendFunc) {\r\n if (\r\n blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\r\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_ALPHA &&\r\n blendFunc[2] === EBlendingFunction.ONE &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_COMBINE;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.ONE &&\r\n blendFunc[1] === EBlendingFunction.ONE &&\r\n blendFunc[2] === EBlendingFunction.ZERO &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_ONEONE;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\r\n blendFunc[1] === EBlendingFunction.ONE &&\r\n blendFunc[2] === EBlendingFunction.ZERO &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_ADD;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.ZERO &&\r\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR &&\r\n blendFunc[2] === EBlendingFunction.ONE &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_SUBTRACT;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.DST_COLOR &&\r\n blendFunc[1] === EBlendingFunction.ZERO &&\r\n blendFunc[2] === EBlendingFunction.ONE &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_MULTIPLY;\r\n } else if (\r\n blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\r\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR &&\r\n blendFunc[2] === EBlendingFunction.ONE &&\r\n blendFunc[3] === EBlendingFunction.ONE\r\n ) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_MAXIMIZED;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * glTF V1 Loader\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class GLTFLoader implements IGLTFLoader {\r\n public static Extensions: { [name: string]: GLTFLoaderExtension } = {};\r\n\r\n public static RegisterExtension(extension: GLTFLoaderExtension): void {\r\n if (GLTFLoader.Extensions[extension.name]) {\r\n Tools.Error('Tool with the same name \"' + extension.name + '\" already exists');\r\n return;\r\n }\r\n\r\n GLTFLoader.Extensions[extension.name] = extension;\r\n }\r\n\r\n public dispose(): void {\r\n // do nothing\r\n }\r\n\r\n private _importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n assetContainer: Nullable<AssetContainer>,\r\n onSuccess: (meshes: AbstractMesh[], skeletons: Skeleton[]) => void,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n onError?: (message: string) => void\r\n ): boolean {\r\n scene.useRightHandedSystem = true;\r\n\r\n GLTFLoaderExtension.LoadRuntimeAsync(\r\n scene,\r\n data,\r\n rootUrl,\r\n (gltfRuntime) => {\r\n gltfRuntime.assetContainer = assetContainer;\r\n gltfRuntime.importOnlyMeshes = true;\r\n\r\n if (meshesNames === \"\") {\r\n gltfRuntime.importMeshesNames = [];\r\n } else if (typeof meshesNames === \"string\") {\r\n gltfRuntime.importMeshesNames = [meshesNames];\r\n } else if (meshesNames && !(meshesNames instanceof Array)) {\r\n gltfRuntime.importMeshesNames = [meshesNames];\r\n } else {\r\n gltfRuntime.importMeshesNames = [];\r\n Tools.Warn(\"Argument meshesNames must be of type string or string[]\");\r\n }\r\n\r\n // Create nodes\r\n this._createNodes(gltfRuntime);\r\n\r\n const meshes: AbstractMesh[] = [];\r\n const skeletons: Skeleton[] = [];\r\n\r\n // Fill arrays of meshes and skeletons\r\n for (const nde in gltfRuntime.nodes) {\r\n const node: IGLTFNode = gltfRuntime.nodes[nde];\r\n\r\n if (node.babylonNode instanceof AbstractMesh) {\r\n meshes.push(<AbstractMesh>node.babylonNode);\r\n }\r\n }\r\n\r\n for (const skl in gltfRuntime.skins) {\r\n const skin: IGLTFSkins = gltfRuntime.skins[skl];\r\n\r\n if (skin.babylonSkeleton instanceof Skeleton) {\r\n skeletons.push(skin.babylonSkeleton);\r\n }\r\n }\r\n\r\n // Load buffers, shaders, materials, etc.\r\n this._loadBuffersAsync(gltfRuntime, () => {\r\n this._loadShadersAsync(gltfRuntime, () => {\r\n importMaterials(gltfRuntime);\r\n postLoad(gltfRuntime);\r\n\r\n if (!GLTFFileLoader.IncrementalLoading && onSuccess) {\r\n onSuccess(meshes, skeletons);\r\n }\r\n });\r\n });\r\n\r\n if (GLTFFileLoader.IncrementalLoading && onSuccess) {\r\n onSuccess(meshes, skeletons);\r\n }\r\n },\r\n onError\r\n );\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Imports one or more meshes from a loaded gltf file and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param assetContainer defines the asset container to use (can be null)\r\n * @param data gltf data containing information of the meshes in a loaded file\r\n * @param rootUrl root url to load from\r\n * @param onProgress event that fires when loading progress has occured\r\n * @returns a promise containg the loaded meshes, particles, skeletons and animations\r\n */\r\n public importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n assetContainer: Nullable<AssetContainer>,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return new Promise((resolve, reject) => {\r\n this._importMeshAsync(\r\n meshesNames,\r\n scene,\r\n data,\r\n rootUrl,\r\n assetContainer,\r\n (meshes, skeletons) => {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: skeletons,\r\n animationGroups: [],\r\n lights: [],\r\n transformNodes: [],\r\n geometries: [],\r\n spriteManagers: [],\r\n });\r\n },\r\n onProgress,\r\n (message) => {\r\n reject(new Error(message));\r\n }\r\n );\r\n });\r\n }\r\n\r\n private _loadAsync(\r\n scene: Scene,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n onSuccess: () => void,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n onError?: (message: string) => void\r\n ): void {\r\n scene.useRightHandedSystem = true;\r\n\r\n GLTFLoaderExtension.LoadRuntimeAsync(\r\n scene,\r\n data,\r\n rootUrl,\r\n (gltfRuntime) => {\r\n // Load runtime extensios\r\n GLTFLoaderExtension.LoadRuntimeExtensionsAsync(\r\n gltfRuntime,\r\n () => {\r\n // Create nodes\r\n this._createNodes(gltfRuntime);\r\n\r\n // Load buffers, shaders, materials, etc.\r\n this._loadBuffersAsync(gltfRuntime, () => {\r\n this._loadShadersAsync(gltfRuntime, () => {\r\n importMaterials(gltfRuntime);\r\n postLoad(gltfRuntime);\r\n\r\n if (!GLTFFileLoader.IncrementalLoading) {\r\n onSuccess();\r\n }\r\n });\r\n });\r\n\r\n if (GLTFFileLoader.IncrementalLoading) {\r\n onSuccess();\r\n }\r\n },\r\n onError\r\n );\r\n },\r\n onError\r\n );\r\n }\r\n\r\n /**\r\n * Imports all objects from a loaded gltf file and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data gltf data containing information of the meshes in a loaded file\r\n * @param rootUrl root url to load from\r\n * @param onProgress event that fires when loading progress has occured\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n public loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n this._loadAsync(\r\n scene,\r\n data,\r\n rootUrl,\r\n () => {\r\n resolve();\r\n },\r\n onProgress,\r\n (message) => {\r\n reject(new Error(message));\r\n }\r\n );\r\n });\r\n }\r\n\r\n private _loadShadersAsync(gltfRuntime: IGLTFRuntime, onload: () => void): void {\r\n let hasShaders = false;\r\n\r\n const processShader = (sha: string, shader: IGLTFShader) => {\r\n GLTFLoaderExtension.LoadShaderStringAsync(\r\n gltfRuntime,\r\n sha,\r\n (shaderString) => {\r\n if (shaderString instanceof ArrayBuffer) {\r\n return;\r\n }\r\n\r\n gltfRuntime.loadedShaderCount++;\r\n\r\n if (shaderString) {\r\n Effect.ShadersStore[sha + (shader.type === EShaderType.VERTEX ? \"VertexShader\" : \"PixelShader\")] = shaderString;\r\n }\r\n\r\n if (gltfRuntime.loadedShaderCount === gltfRuntime.shaderscount) {\r\n onload();\r\n }\r\n },\r\n () => {\r\n Tools.Error(\"Error when loading shader program named \" + sha + \" located at \" + shader.uri);\r\n }\r\n );\r\n };\r\n\r\n for (const sha in gltfRuntime.shaders) {\r\n hasShaders = true;\r\n\r\n const shader: IGLTFShader = gltfRuntime.shaders[sha];\r\n if (shader) {\r\n processShader.bind(this, sha, shader)();\r\n } else {\r\n Tools.Error(\"No shader named: \" + sha);\r\n }\r\n }\r\n\r\n if (!hasShaders) {\r\n onload();\r\n }\r\n }\r\n\r\n private _loadBuffersAsync(gltfRuntime: IGLTFRuntime, onLoad: () => void): void {\r\n let hasBuffers = false;\r\n\r\n const processBuffer = (buf: string, buffer: IGLTFBuffer) => {\r\n GLTFLoaderExtension.LoadBufferAsync(\r\n gltfRuntime,\r\n buf,\r\n (bufferView) => {\r\n gltfRuntime.loadedBufferCount++;\r\n\r\n if (bufferView) {\r\n if (bufferView.byteLength != gltfRuntime.buffers[buf].byteLength) {\r\n Tools.Error(\"Buffer named \" + buf + \" is length \" + bufferView.byteLength + \". Expected: \" + buffer.byteLength); // Improve error message\r\n }\r\n\r\n gltfRuntime.loadedBufferViews[buf] = bufferView;\r\n }\r\n\r\n if (gltfRuntime.loadedBufferCount === gltfRuntime.buffersCount) {\r\n onLoad();\r\n }\r\n },\r\n () => {\r\n Tools.Error(\"Error when loading buffer named \" + buf + \" located at \" + buffer.uri);\r\n }\r\n );\r\n };\r\n\r\n for (const buf in gltfRuntime.buffers) {\r\n hasBuffers = true;\r\n\r\n const buffer: IGLTFBuffer = gltfRuntime.buffers[buf];\r\n if (buffer) {\r\n processBuffer.bind(this, buf, buffer)();\r\n } else {\r\n Tools.Error(\"No buffer named: \" + buf);\r\n }\r\n }\r\n\r\n if (!hasBuffers) {\r\n onLoad();\r\n }\r\n }\r\n\r\n private _createNodes(gltfRuntime: IGLTFRuntime): void {\r\n let currentScene = <IGLTFScene>gltfRuntime.currentScene;\r\n\r\n if (currentScene) {\r\n // Only one scene even if multiple scenes are defined\r\n for (let i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n } else {\r\n // Load all scenes\r\n for (const thing in gltfRuntime.scenes) {\r\n currentScene = <IGLTFScene>gltfRuntime.scenes[thing];\r\n\r\n for (let i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport abstract class GLTFLoaderExtension {\r\n private _name: string;\r\n\r\n public constructor(name: string) {\r\n this._name = name;\r\n }\r\n\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n /**\r\n * Defines an override for loading the runtime\r\n * Return true to stop further extensions from loading the runtime\r\n * @param scene\r\n * @param data\r\n * @param rootUrl\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading the runtime\r\n */\r\n public loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an onverride for creating gltf runtime\r\n * Return true to stop further extensions from creating the runtime\r\n * @param gltfRuntime\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from creating the runtime\r\n */\r\n public loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for loading buffers\r\n * Return true to stop further extensions from loading this buffer\r\n * @param gltfRuntime\r\n * @param id\r\n * @param onSuccess\r\n * @param onError\r\n * @param onProgress\r\n * @returns true to stop further extensions from loading this buffer\r\n */\r\n public loadBufferAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n onSuccess: (buffer: ArrayBufferView) => void,\r\n onError: (message: string) => void,\r\n onProgress?: () => void\r\n ): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for loading texture buffers\r\n * Return true to stop further extensions from loading this texture data\r\n * @param gltfRuntime\r\n * @param id\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading this texture data\r\n */\r\n public loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for creating textures\r\n * Return true to stop further extensions from loading this texture\r\n * @param gltfRuntime\r\n * @param id\r\n * @param buffer\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading this texture\r\n */\r\n public createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for loading shader strings\r\n * Return true to stop further extensions from loading this shader data\r\n * @param gltfRuntime\r\n * @param id\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading this shader data\r\n */\r\n public loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Defines an override for loading materials\r\n * Return true to stop further extensions from loading this material\r\n * @param gltfRuntime\r\n * @param id\r\n * @param onSuccess\r\n * @param onError\r\n * @returns true to stop further extensions from loading this material\r\n */\r\n public loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean {\r\n return false;\r\n }\r\n\r\n // ---------\r\n // Utilities\r\n // ---------\r\n\r\n public static LoadRuntimeAsync(\r\n scene: Scene,\r\n data: IGLTFLoaderData,\r\n rootUrl: string,\r\n onSuccess?: (gltfRuntime: IGLTFRuntime) => void,\r\n onError?: (message: string) => void\r\n ): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError);\r\n },\r\n () => {\r\n setTimeout(() => {\r\n if (!onSuccess) {\r\n return;\r\n }\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n });\r\n }\r\n );\r\n }\r\n\r\n public static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError);\r\n },\r\n () => {\r\n setTimeout(() => {\r\n onSuccess();\r\n });\r\n }\r\n );\r\n }\r\n\r\n public static LoadBufferAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n onSuccess: (bufferView: ArrayBufferView) => void,\r\n onError: (message: string) => void,\r\n onProgress?: () => void\r\n ): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\r\n },\r\n () => {\r\n GLTFLoaderBase.LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\r\n }\r\n );\r\n }\r\n\r\n public static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void {\r\n GLTFLoaderExtension._LoadTextureBufferAsync(\r\n gltfRuntime,\r\n id,\r\n (buffer) => {\r\n if (buffer) {\r\n GLTFLoaderExtension._CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n }\r\n },\r\n onError\r\n );\r\n }\r\n\r\n public static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\r\n },\r\n () => {\r\n GLTFLoaderBase.LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\r\n }\r\n );\r\n }\r\n\r\n public static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadMaterialAsync(gltfRuntime, id, onSuccess, onError);\r\n },\r\n () => {\r\n GLTFLoaderBase.LoadMaterialAsync(gltfRuntime, id, onSuccess, onError);\r\n }\r\n );\r\n }\r\n\r\n private static _LoadTextureBufferAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n onSuccess: (buffer: Nullable<ArrayBufferView>) => void,\r\n onError: (message: string) => void\r\n ): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.loadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\r\n },\r\n () => {\r\n GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\r\n }\r\n );\r\n }\r\n\r\n private static _CreateTextureAsync(\r\n gltfRuntime: IGLTFRuntime,\r\n id: string,\r\n buffer: ArrayBufferView,\r\n onSuccess: (texture: Texture) => void,\r\n onError: (message: string) => void\r\n ): void {\r\n GLTFLoaderExtension._ApplyExtensions(\r\n (loaderExtension) => {\r\n return loaderExtension.createTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n },\r\n () => {\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess);\r\n }\r\n );\r\n }\r\n\r\n private static _ApplyExtensions(func: (loaderExtension: GLTFLoaderExtension) => boolean, defaultFunc: () => void): void {\r\n for (const extensionName in GLTFLoader.Extensions) {\r\n const loaderExtension = GLTFLoader.Extensions[extensionName];\r\n if (func(loaderExtension)) {\r\n return;\r\n }\r\n }\r\n\r\n defaultFunc();\r\n }\r\n}\r\n\r\nGLTFFileLoader._CreateGLTF1Loader = () => new GLTFLoader();\r\n"]}