0f718acc61c9ba8d6a5eb12287d3acbca23b423f9ea466283fb10a9f4f3fd88b.json 116 KB

1
  1. {"ast":null,"code":"import { Mesh } from \"./Meshes/mesh.js\";\nimport { TransformNode } from \"./Meshes/transformNode.js\";\nimport { AbstractMesh } from \"./Meshes/abstractMesh.js\";\nimport { Logger } from \"./Misc/logger.js\";\nimport { EngineStore } from \"./Engines/engineStore.js\";\nimport { InstancedMesh } from \"./Meshes/instancedMesh.js\";\nimport { Light } from \"./Lights/light.js\";\nimport { Camera } from \"./Cameras/camera.js\";\nimport { Tools } from \"./Misc/tools.js\";\n/**\n * Root class for AssetContainer and KeepAssets\n */\nexport class AbstractAssetContainer {\n constructor() {\n /**\n * Gets the list of root nodes (ie. nodes with no parent)\n */\n this.rootNodes = [];\n /** All of the cameras added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n */\n this.cameras = [];\n /**\n * All of the lights added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n */\n this.lights = [];\n /**\n * All of the (abstract) meshes added to this scene\n */\n this.meshes = [];\n /**\n * The list of skeletons added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\n */\n this.skeletons = [];\n /**\n * All of the particle systems added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\n */\n this.particleSystems = [];\n /**\n * Gets a list of Animations associated with the scene\n */\n this.animations = [];\n /**\n * All of the animation groups added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\n */\n this.animationGroups = [];\n /**\n * All of the multi-materials added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\n */\n this.multiMaterials = [];\n /**\n * All of the materials added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\n * Note also that the order of the Material within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\n */\n this.materials = [];\n /**\n * The list of morph target managers added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\n */\n this.morphTargetManagers = [];\n /**\n * The list of geometries used in the scene.\n */\n this.geometries = [];\n /**\n * All of the transform nodes added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\n * Note also that the order of the TransformNode within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\n */\n this.transformNodes = [];\n /**\n * ActionManagers available on the scene.\n * @deprecated\n */\n this.actionManagers = [];\n /**\n * Textures to keep.\n */\n this.textures = [];\n /** @internal */\n this._environmentTexture = null;\n /**\n * The list of postprocesses added to the scene\n */\n this.postProcesses = [];\n /**\n * The list of sounds\n */\n this.sounds = null;\n /**\n * The list of effect layers added to the scene\n */\n this.effectLayers = [];\n /**\n * The list of layers added to the scene\n */\n this.layers = [];\n /**\n * The list of reflection probes added to the scene\n */\n this.reflectionProbes = [];\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n get environmentTexture() {\n return this._environmentTexture;\n }\n set environmentTexture(value) {\n this._environmentTexture = value;\n }\n /**\n * @returns all meshes, lights, cameras, transformNodes and bones\n */\n getNodes() {\n let nodes = [];\n nodes = nodes.concat(this.meshes);\n nodes = nodes.concat(this.lights);\n nodes = nodes.concat(this.cameras);\n nodes = nodes.concat(this.transformNodes); // dummies\n this.skeletons.forEach(skeleton => nodes = nodes.concat(skeleton.bones));\n return nodes;\n }\n}\n/**\n * Set of assets to keep when moving a scene into an asset container.\n */\nexport class KeepAssets extends AbstractAssetContainer {}\n/**\n * Class used to store the output of the AssetContainer.instantiateAllMeshesToScene function\n */\nexport class InstantiatedEntries {\n constructor() {\n /**\n * List of new root nodes (eg. nodes with no parent)\n */\n this.rootNodes = [];\n /**\n * List of new skeletons\n */\n this.skeletons = [];\n /**\n * List of new animation groups\n */\n this.animationGroups = [];\n }\n /**\n * Disposes the instantiated entries from the scene\n */\n dispose() {\n this.rootNodes.slice(0).forEach(o => {\n o.dispose();\n });\n this.rootNodes.length = 0;\n this.skeletons.slice(0).forEach(o => {\n o.dispose();\n });\n this.skeletons.length = 0;\n this.animationGroups.slice(0).forEach(o => {\n o.dispose();\n });\n this.animationGroups.length = 0;\n }\n}\n/**\n * Container with a set of assets that can be added or removed from a scene.\n */\nexport class AssetContainer extends AbstractAssetContainer {\n /**\n * Instantiates an AssetContainer.\n * @param scene The scene the AssetContainer belongs to.\n */\n constructor(scene) {\n super();\n this._wasAddedToScene = false;\n scene = scene || EngineStore.LastCreatedScene;\n if (!scene) {\n return;\n }\n this.scene = scene;\n this[\"proceduralTextures\"] = [];\n scene.onDisposeObservable.add(() => {\n if (!this._wasAddedToScene) {\n this.dispose();\n }\n });\n this._onContextRestoredObserver = scene.getEngine().onContextRestoredObservable.add(() => {\n for (const geometry of this.geometries) {\n geometry._rebuild();\n }\n for (const mesh of this.meshes) {\n mesh._rebuild();\n }\n for (const system of this.particleSystems) {\n system.rebuild();\n }\n for (const texture of this.textures) {\n texture._rebuild();\n }\n });\n }\n /**\n * Given a list of nodes, return a topological sorting of them.\n * @param nodes\n * @returns a sorted array of nodes\n */\n _topologicalSort(nodes) {\n const nodesUidMap = new Map();\n for (const node of nodes) {\n nodesUidMap.set(node.uniqueId, node);\n }\n const dependencyGraph = {\n dependsOn: new Map(),\n // given a node id, what are the ids of the nodes it depends on\n dependedBy: new Map() // given a node id, what are the ids of the nodes that depend on it\n };\n // Build the dependency graph given the list of nodes\n // First pass: Initialize the empty dependency graph\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n dependencyGraph.dependsOn.set(nodeId, new Set());\n dependencyGraph.dependedBy.set(nodeId, new Set());\n }\n // Second pass: Populate the dependency graph. We assume that we\n // don't need to check for cycles here, as the scene graph cannot\n // contain cycles. Our graph also already contains all transitive\n // dependencies because getDescendants returns the transitive\n // dependencies by default.\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n const dependsOn = dependencyGraph.dependsOn.get(nodeId);\n if (node instanceof InstancedMesh) {\n const masterMesh = node.sourceMesh;\n if (nodesUidMap.has(masterMesh.uniqueId)) {\n dependsOn.add(masterMesh.uniqueId);\n dependencyGraph.dependedBy.get(masterMesh.uniqueId).add(nodeId);\n }\n }\n const dependedBy = dependencyGraph.dependedBy.get(nodeId);\n for (const child of node.getDescendants()) {\n const childId = child.uniqueId;\n if (nodesUidMap.has(childId)) {\n dependedBy.add(childId);\n const childDependsOn = dependencyGraph.dependsOn.get(childId);\n childDependsOn.add(nodeId);\n }\n }\n }\n // Third pass: Topological sort\n const sortedNodes = [];\n // First: Find all nodes that have no dependencies\n const leaves = [];\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n if (dependencyGraph.dependsOn.get(nodeId).size === 0) {\n leaves.push(node);\n nodesUidMap.delete(nodeId);\n }\n }\n const visitList = leaves;\n while (visitList.length > 0) {\n const nodeToVisit = visitList.shift();\n sortedNodes.push(nodeToVisit);\n // Remove the node from the dependency graph\n // When a node is visited, we know that dependsOn is empty.\n // So we only need to remove the node from dependedBy.\n const dependedByVisitedNode = dependencyGraph.dependedBy.get(nodeToVisit.uniqueId);\n // Array.from(x.values()) is to make the TS compiler happy\n for (const dependedByVisitedNodeId of Array.from(dependedByVisitedNode.values())) {\n const dependsOnDependedByVisitedNode = dependencyGraph.dependsOn.get(dependedByVisitedNodeId);\n dependsOnDependedByVisitedNode.delete(nodeToVisit.uniqueId);\n if (dependsOnDependedByVisitedNode.size === 0 && nodesUidMap.get(dependedByVisitedNodeId)) {\n visitList.push(nodesUidMap.get(dependedByVisitedNodeId));\n nodesUidMap.delete(dependedByVisitedNodeId);\n }\n }\n }\n if (nodesUidMap.size > 0) {\n Logger.Error(\"SceneSerializer._topologicalSort: There were unvisited nodes:\");\n nodesUidMap.forEach(node => Logger.Error(node.name));\n }\n return sortedNodes;\n }\n _addNodeAndDescendantsToList(list, addedIds, rootNode, predicate) {\n if (!rootNode || predicate && !predicate(rootNode) || addedIds.has(rootNode.uniqueId)) {\n return;\n }\n list.push(rootNode);\n addedIds.add(rootNode.uniqueId);\n for (const child of rootNode.getDescendants(true)) {\n this._addNodeAndDescendantsToList(list, addedIds, child, predicate);\n }\n }\n /**\n * Check if a specific node is contained in this asset container.\n * @param node the node to check\n * @returns true if the node is contained in this container, otherwise false.\n */\n _isNodeInContainer(node) {\n if (node instanceof AbstractMesh && this.meshes.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof TransformNode && this.transformNodes.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof Light && this.lights.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof Camera && this.cameras.indexOf(node) !== -1) {\n return true;\n }\n return false;\n }\n /**\n * For every node in the scene, check if its parent node is also in the scene.\n * @returns true if every node's parent is also in the scene, otherwise false.\n */\n _isValidHierarchy() {\n for (const node of this.meshes) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.transformNodes) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.lights) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.cameras) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n return true;\n }\n /**\n * Instantiate or clone all meshes and add the new ones to the scene.\n * Skeletons and animation groups will all be cloned\n * @param nameFunction defines an optional function used to get new names for clones\n * @param cloneMaterials defines an optional boolean that defines if materials must be cloned as well (false by default)\n * @param options defines an optional list of options to control how to instantiate / clone models\n * @param options.doNotInstantiate defines if the model must be instantiated or just cloned\n * @param options.predicate defines a predicate used to filter whih mesh to instantiate/clone\n * @returns a list of rootNodes, skeletons and animation groups that were duplicated\n */\n instantiateModelsToScene(nameFunction, cloneMaterials = false, options) {\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.InstantiateModelsToScene: The Asset Container hierarchy is not valid.\");\n }\n const conversionMap = {};\n const storeMap = {};\n const result = new InstantiatedEntries();\n const alreadySwappedSkeletons = [];\n const alreadySwappedMaterials = [];\n const localOptions = {\n doNotInstantiate: true,\n ...options\n };\n const onClone = (source, clone) => {\n conversionMap[source.uniqueId] = clone.uniqueId;\n storeMap[clone.uniqueId] = clone;\n if (nameFunction) {\n clone.name = nameFunction(source.name);\n }\n if (clone instanceof Mesh) {\n const clonedMesh = clone;\n if (clonedMesh.morphTargetManager) {\n const oldMorphTargetManager = source.morphTargetManager;\n clonedMesh.morphTargetManager = oldMorphTargetManager.clone();\n for (let index = 0; index < oldMorphTargetManager.numTargets; index++) {\n const oldTarget = oldMorphTargetManager.getTarget(index);\n const newTarget = clonedMesh.morphTargetManager.getTarget(index);\n conversionMap[oldTarget.uniqueId] = newTarget.uniqueId;\n storeMap[newTarget.uniqueId] = newTarget;\n }\n }\n }\n };\n const nodesToSort = [];\n const idsOnSortList = new Set();\n for (const transformNode of this.transformNodes) {\n if (transformNode.parent === null) {\n this._addNodeAndDescendantsToList(nodesToSort, idsOnSortList, transformNode, localOptions.predicate);\n }\n }\n for (const mesh of this.meshes) {\n if (mesh.parent === null) {\n this._addNodeAndDescendantsToList(nodesToSort, idsOnSortList, mesh, localOptions.predicate);\n }\n }\n // Topologically sort nodes by parenting/instancing relationships so that all resources are in place\n // when a given node is instantiated.\n const sortedNodes = this._topologicalSort(nodesToSort);\n const onNewCreated = (source, clone) => {\n onClone(source, clone);\n if (source.parent) {\n const replicatedParentId = conversionMap[source.parent.uniqueId];\n const replicatedParent = storeMap[replicatedParentId];\n if (replicatedParent) {\n clone.parent = replicatedParent;\n } else {\n clone.parent = source.parent;\n }\n }\n if (clone.position && source.position) {\n clone.position.copyFrom(source.position);\n }\n if (clone.rotationQuaternion && source.rotationQuaternion) {\n clone.rotationQuaternion.copyFrom(source.rotationQuaternion);\n }\n if (clone.rotation && source.rotation) {\n clone.rotation.copyFrom(source.rotation);\n }\n if (clone.scaling && source.scaling) {\n clone.scaling.copyFrom(source.scaling);\n }\n if (clone.material) {\n const mesh = clone;\n if (mesh.material) {\n if (cloneMaterials) {\n const sourceMaterial = source.material;\n if (alreadySwappedMaterials.indexOf(sourceMaterial) === -1) {\n let swap = sourceMaterial.clone(nameFunction ? nameFunction(sourceMaterial.name) : \"Clone of \" + sourceMaterial.name);\n alreadySwappedMaterials.push(sourceMaterial);\n conversionMap[sourceMaterial.uniqueId] = swap.uniqueId;\n storeMap[swap.uniqueId] = swap;\n if (sourceMaterial.getClassName() === \"MultiMaterial\") {\n const multi = sourceMaterial;\n for (const material of multi.subMaterials) {\n if (!material) {\n continue;\n }\n swap = material.clone(nameFunction ? nameFunction(material.name) : \"Clone of \" + material.name);\n alreadySwappedMaterials.push(material);\n conversionMap[material.uniqueId] = swap.uniqueId;\n storeMap[swap.uniqueId] = swap;\n }\n multi.subMaterials = multi.subMaterials.map(m => m && storeMap[conversionMap[m.uniqueId]]);\n }\n }\n if (mesh.getClassName() !== \"InstancedMesh\") {\n mesh.material = storeMap[conversionMap[sourceMaterial.uniqueId]];\n }\n } else {\n if (mesh.material.getClassName() === \"MultiMaterial\") {\n if (this.scene.multiMaterials.indexOf(mesh.material) === -1) {\n this.scene.addMultiMaterial(mesh.material);\n }\n } else {\n if (this.scene.materials.indexOf(mesh.material) === -1) {\n this.scene.addMaterial(mesh.material);\n }\n }\n }\n }\n }\n if (clone.parent === null) {\n result.rootNodes.push(clone);\n }\n };\n sortedNodes.forEach(node => {\n if (node.getClassName() === \"InstancedMesh\") {\n const instancedNode = node;\n const sourceMesh = instancedNode.sourceMesh;\n const replicatedSourceId = conversionMap[sourceMesh.uniqueId];\n const replicatedSource = typeof replicatedSourceId === \"number\" ? storeMap[replicatedSourceId] : sourceMesh;\n const replicatedInstancedNode = replicatedSource.createInstance(instancedNode.name);\n onNewCreated(instancedNode, replicatedInstancedNode);\n } else {\n // Mesh or TransformNode\n let canInstance = true;\n if (node.getClassName() === \"TransformNode\" || node.getClassName() === \"Node\" || node.skeleton || !node.getTotalVertices || node.getTotalVertices() === 0) {\n // Transform nodes, skinned meshes, and meshes with no vertices can never be instanced!\n canInstance = false;\n } else if (localOptions.doNotInstantiate) {\n if (typeof localOptions.doNotInstantiate === \"function\") {\n canInstance = !localOptions.doNotInstantiate(node);\n } else {\n canInstance = !localOptions.doNotInstantiate;\n }\n }\n const replicatedNode = canInstance ? node.createInstance(`instance of ${node.name}`) : node.clone(`Clone of ${node.name}`, null, true);\n if (!replicatedNode) {\n throw new Error(`Could not clone or instantiate node on Asset Container ${node.name}`);\n }\n onNewCreated(node, replicatedNode);\n }\n });\n this.skeletons.forEach(s => {\n if (localOptions.predicate && !localOptions.predicate(s)) {\n return;\n }\n const clone = s.clone(nameFunction ? nameFunction(s.name) : \"Clone of \" + s.name);\n for (const m of this.meshes) {\n if (m.skeleton === s && !m.isAnInstance) {\n const copy = storeMap[conversionMap[m.uniqueId]];\n if (!copy || copy.isAnInstance) {\n continue;\n }\n copy.skeleton = clone;\n if (alreadySwappedSkeletons.indexOf(clone) !== -1) {\n continue;\n }\n alreadySwappedSkeletons.push(clone);\n // Check if bones are mesh linked\n for (const bone of clone.bones) {\n if (bone._linkedTransformNode) {\n bone._linkedTransformNode = storeMap[conversionMap[bone._linkedTransformNode.uniqueId]];\n }\n }\n }\n }\n result.skeletons.push(clone);\n });\n this.animationGroups.forEach(o => {\n if (localOptions.predicate && !localOptions.predicate(o)) {\n return;\n }\n const clone = o.clone(nameFunction ? nameFunction(o.name) : \"Clone of \" + o.name, oldTarget => {\n const newTarget = storeMap[conversionMap[oldTarget.uniqueId]];\n return newTarget || oldTarget;\n });\n result.animationGroups.push(clone);\n });\n return result;\n }\n /**\n * Adds all the assets from the container to the scene.\n */\n addAllToScene() {\n if (this._wasAddedToScene) {\n return;\n }\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.addAllToScene: The Asset Container hierarchy is not valid.\");\n }\n this._wasAddedToScene = true;\n this.addToScene(null);\n if (this.environmentTexture) {\n this.scene.environmentTexture = this.environmentTexture;\n }\n for (const component of this.scene._serializableComponents) {\n component.addFromContainer(this);\n }\n this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n /**\n * Adds assets from the container to the scene.\n * @param predicate defines a predicate used to select which entity will be added (can be null)\n */\n addToScene(predicate = null) {\n const addedNodes = [];\n this.cameras.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addCamera(o);\n addedNodes.push(o);\n });\n this.lights.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addLight(o);\n addedNodes.push(o);\n });\n this.meshes.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMesh(o);\n addedNodes.push(o);\n });\n this.skeletons.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addSkeleton(o);\n });\n this.animations.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addAnimation(o);\n });\n this.animationGroups.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addAnimationGroup(o);\n });\n this.multiMaterials.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMultiMaterial(o);\n });\n this.materials.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMaterial(o);\n });\n this.morphTargetManagers.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMorphTargetManager(o);\n });\n this.geometries.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addGeometry(o);\n });\n this.transformNodes.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addTransformNode(o);\n addedNodes.push(o);\n });\n this.actionManagers.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addActionManager(o);\n });\n this.textures.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addTexture(o);\n });\n this.reflectionProbes.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addReflectionProbe(o);\n });\n for (const addedNode of addedNodes) {\n // If node was added to the scene, but parent is not in the scene, break the relationship\n if (addedNode.parent && this.scene.getNodes().indexOf(addedNode.parent) === -1) {\n // Use setParent to keep transform if possible\n if (addedNode.setParent) {\n addedNode.setParent(null);\n } else {\n addedNode.parent = null;\n }\n }\n }\n }\n /**\n * Removes all the assets in the container from the scene\n */\n removeAllFromScene() {\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.removeAllFromScene: The Asset Container hierarchy is not valid.\");\n }\n this._wasAddedToScene = false;\n this.removeFromScene(null);\n if (this.environmentTexture === this.scene.environmentTexture) {\n this.scene.environmentTexture = null;\n }\n for (const component of this.scene._serializableComponents) {\n component.removeFromContainer(this);\n }\n }\n /**\n * Removes assets in the container from the scene\n * @param predicate defines a predicate used to select which entity will be added (can be null)\n */\n removeFromScene(predicate = null) {\n this.cameras.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeCamera(o);\n });\n this.lights.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeLight(o);\n });\n this.meshes.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMesh(o, true);\n });\n this.skeletons.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeSkeleton(o);\n });\n this.animations.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeAnimation(o);\n });\n this.animationGroups.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeAnimationGroup(o);\n });\n this.multiMaterials.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMultiMaterial(o);\n });\n this.materials.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMaterial(o);\n });\n this.morphTargetManagers.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMorphTargetManager(o);\n });\n this.geometries.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeGeometry(o);\n });\n this.transformNodes.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeTransformNode(o);\n });\n this.actionManagers.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeActionManager(o);\n });\n this.textures.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeTexture(o);\n });\n this.reflectionProbes.forEach(o => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeReflectionProbe(o);\n });\n }\n /**\n * Disposes all the assets in the container\n */\n dispose() {\n this.cameras.slice(0).forEach(o => {\n o.dispose();\n });\n this.cameras.length = 0;\n this.lights.slice(0).forEach(o => {\n o.dispose();\n });\n this.lights.length = 0;\n this.meshes.slice(0).forEach(o => {\n o.dispose();\n });\n this.meshes.length = 0;\n this.skeletons.slice(0).forEach(o => {\n o.dispose();\n });\n this.skeletons.length = 0;\n this.animationGroups.slice(0).forEach(o => {\n o.dispose();\n });\n this.animationGroups.length = 0;\n this.multiMaterials.slice(0).forEach(o => {\n o.dispose();\n });\n this.multiMaterials.length = 0;\n this.materials.slice(0).forEach(o => {\n o.dispose();\n });\n this.materials.length = 0;\n this.geometries.slice(0).forEach(o => {\n o.dispose();\n });\n this.geometries.length = 0;\n this.transformNodes.slice(0).forEach(o => {\n o.dispose();\n });\n this.transformNodes.length = 0;\n this.actionManagers.slice(0).forEach(o => {\n o.dispose();\n });\n this.actionManagers.length = 0;\n this.textures.slice(0).forEach(o => {\n o.dispose();\n });\n this.textures.length = 0;\n this.reflectionProbes.slice(0).forEach(o => {\n o.dispose();\n });\n this.reflectionProbes.length = 0;\n this.morphTargetManagers.slice(0).forEach(o => {\n o.dispose();\n });\n this.morphTargetManagers.length = 0;\n if (this.environmentTexture) {\n this.environmentTexture.dispose();\n this.environmentTexture = null;\n }\n for (const component of this.scene._serializableComponents) {\n component.removeFromContainer(this, true);\n }\n if (this._onContextRestoredObserver) {\n this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n }\n _moveAssets(sourceAssets, targetAssets, keepAssets) {\n if (!sourceAssets || !targetAssets) {\n return;\n }\n for (const asset of sourceAssets) {\n let move = true;\n if (keepAssets) {\n for (const keepAsset of keepAssets) {\n if (asset === keepAsset) {\n move = false;\n break;\n }\n }\n }\n if (move) {\n targetAssets.push(asset);\n asset._parentContainer = this;\n }\n }\n }\n /**\n * Removes all the assets contained in the scene and adds them to the container.\n * @param keepAssets Set of assets to keep in the scene. (default: empty)\n */\n moveAllFromScene(keepAssets) {\n this._wasAddedToScene = false;\n if (keepAssets === undefined) {\n keepAssets = new KeepAssets();\n }\n for (const key in this) {\n if (Object.prototype.hasOwnProperty.call(this, key)) {\n this[key] = this[key] || (key === \"_environmentTexture\" ? null : []);\n this._moveAssets(this.scene[key], this[key], keepAssets[key]);\n }\n }\n this.environmentTexture = this.scene.environmentTexture;\n this.removeAllFromScene();\n }\n /**\n * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.\n * @returns the root mesh\n */\n createRootMesh() {\n const rootMesh = new Mesh(\"assetContainerRootMesh\", this.scene);\n this.meshes.forEach(m => {\n if (!m.parent) {\n rootMesh.addChild(m);\n }\n });\n this.meshes.unshift(rootMesh);\n return rootMesh;\n }\n /**\n * Merge animations (direct and animation groups) from this asset container into a scene\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\n * @param animatables set of animatables to retarget to a node from the scene\n * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)\n * @returns an array of the new AnimationGroup added to the scene (empty array if none)\n */\n mergeAnimationsTo(scene = EngineStore.LastCreatedScene, animatables, targetConverter = null) {\n if (!scene) {\n Logger.Error(\"No scene available to merge animations to\");\n return [];\n }\n const _targetConverter = targetConverter ? targetConverter : target => {\n let node = null;\n const targetProperty = target.animations.length ? target.animations[0].targetProperty : \"\";\n /*\n BabylonJS adds special naming to targets that are children of nodes.\n This name attempts to remove that special naming to get the parent nodes name in case the target\n can't be found in the node tree\n Ex: Torso_primitive0 likely points to a Mesh primitive. We take away primitive0 and are left with \"Torso\" which is the name\n of the primitive's parent.\n */\n const name = target.name.split(\".\").join(\"\").split(\"_primitive\")[0];\n switch (targetProperty) {\n case \"position\":\n case \"rotationQuaternion\":\n node = scene.getTransformNodeByName(target.name) || scene.getTransformNodeByName(name);\n break;\n case \"influence\":\n node = scene.getMorphTargetByName(target.name) || scene.getMorphTargetByName(name);\n break;\n default:\n node = scene.getNodeByName(target.name) || scene.getNodeByName(name);\n }\n return node;\n };\n // Copy new node animations\n const nodesInAC = this.getNodes();\n nodesInAC.forEach(nodeInAC => {\n const nodeInScene = _targetConverter(nodeInAC);\n if (nodeInScene !== null) {\n // Remove old animations with same target property as a new one\n for (const animationInAC of nodeInAC.animations) {\n // Doing treatment on an array for safety measure\n const animationsWithSameProperty = nodeInScene.animations.filter(animationInScene => {\n return animationInScene.targetProperty === animationInAC.targetProperty;\n });\n for (const animationWithSameProperty of animationsWithSameProperty) {\n const index = nodeInScene.animations.indexOf(animationWithSameProperty, 0);\n if (index > -1) {\n nodeInScene.animations.splice(index, 1);\n }\n }\n }\n // Append new animations\n nodeInScene.animations = nodeInScene.animations.concat(nodeInAC.animations);\n }\n });\n const newAnimationGroups = [];\n // Copy new animation groups\n this.animationGroups.slice().forEach(animationGroupInAC => {\n // Clone the animation group and all its animatables\n newAnimationGroups.push(animationGroupInAC.clone(animationGroupInAC.name, _targetConverter));\n // Remove animatables related to the asset container\n animationGroupInAC.animatables.forEach(animatable => {\n animatable.stop();\n });\n });\n // Retarget animatables\n animatables.forEach(animatable => {\n const target = _targetConverter(animatable.target);\n if (target) {\n // Clone the animatable and retarget it\n scene.beginAnimation(target, animatable.fromFrame, animatable.toFrame, animatable.loopAnimation, animatable.speedRatio, animatable.onAnimationEnd ? animatable.onAnimationEnd : undefined, undefined, true, undefined, animatable.onAnimationLoop ? animatable.onAnimationLoop : undefined);\n // Stop animation for the target in the asset container\n scene.stopAnimation(animatable.target);\n }\n });\n return newAnimationGroups;\n }\n /**\n * @since 6.15.0\n * This method checks for any node that has no parent\n * and is not in the rootNodes array, and adds the node\n * there, if so.\n */\n populateRootNodes() {\n this.rootNodes.length = 0;\n this.meshes.forEach(m => {\n if (!m.parent && this.rootNodes.indexOf(m) === -1) {\n this.rootNodes.push(m);\n }\n });\n this.transformNodes.forEach(t => {\n if (!t.parent && this.rootNodes.indexOf(t) === -1) {\n this.rootNodes.push(t);\n }\n });\n this.lights.forEach(l => {\n if (!l.parent && this.rootNodes.indexOf(l) === -1) {\n this.rootNodes.push(l);\n }\n });\n this.cameras.forEach(c => {\n if (!c.parent && this.rootNodes.indexOf(c) === -1) {\n this.rootNodes.push(c);\n }\n });\n }\n /**\n * @since 6.26.0\n * Given a root asset, this method will traverse its hierarchy and add it, its children and any materials/skeletons/animation groups to the container.\n * @param root root node\n */\n addAllAssetsToContainer(root) {\n if (!root) {\n return;\n }\n const nodesToVisit = [];\n const visitedNodes = new Set();\n nodesToVisit.push(root);\n while (nodesToVisit.length > 0) {\n const nodeToVisit = nodesToVisit.pop();\n if (nodeToVisit instanceof Mesh) {\n if (nodeToVisit.geometry && this.geometries.indexOf(nodeToVisit.geometry) === -1) {\n this.geometries.push(nodeToVisit.geometry);\n }\n this.meshes.push(nodeToVisit);\n } else if (nodeToVisit instanceof TransformNode) {\n this.transformNodes.push(nodeToVisit);\n } else if (nodeToVisit instanceof Light) {\n this.lights.push(nodeToVisit);\n } else if (nodeToVisit instanceof Camera) {\n this.cameras.push(nodeToVisit);\n }\n if (nodeToVisit instanceof AbstractMesh) {\n if (nodeToVisit.material && this.materials.indexOf(nodeToVisit.material) === -1) {\n this.materials.push(nodeToVisit.material);\n for (const texture of nodeToVisit.material.getActiveTextures()) {\n if (this.textures.indexOf(texture) === -1) {\n this.textures.push(texture);\n }\n }\n }\n if (nodeToVisit.skeleton && this.skeletons.indexOf(nodeToVisit.skeleton) === -1) {\n this.skeletons.push(nodeToVisit.skeleton);\n }\n if (nodeToVisit.morphTargetManager && this.morphTargetManagers.indexOf(nodeToVisit.morphTargetManager) === -1) {\n this.morphTargetManagers.push(nodeToVisit.morphTargetManager);\n }\n }\n for (const child of nodeToVisit.getChildren()) {\n if (!visitedNodes.has(child)) {\n nodesToVisit.push(child);\n }\n }\n visitedNodes.add(nodeToVisit);\n }\n this.populateRootNodes();\n }\n}","map":{"version":3,"names":["Mesh","TransformNode","AbstractMesh","Logger","EngineStore","InstancedMesh","Light","Camera","Tools","AbstractAssetContainer","constructor","rootNodes","cameras","lights","meshes","skeletons","particleSystems","animations","animationGroups","multiMaterials","materials","morphTargetManagers","geometries","transformNodes","actionManagers","textures","_environmentTexture","postProcesses","sounds","effectLayers","layers","reflectionProbes","environmentTexture","value","getNodes","nodes","concat","forEach","skeleton","bones","KeepAssets","InstantiatedEntries","dispose","slice","o","length","AssetContainer","scene","_wasAddedToScene","LastCreatedScene","onDisposeObservable","add","_onContextRestoredObserver","getEngine","onContextRestoredObservable","geometry","_rebuild","mesh","system","rebuild","texture","_topologicalSort","nodesUidMap","Map","node","set","uniqueId","dependencyGraph","dependsOn","dependedBy","nodeId","Set","get","masterMesh","sourceMesh","has","child","getDescendants","childId","childDependsOn","sortedNodes","leaves","size","push","delete","visitList","nodeToVisit","shift","dependedByVisitedNode","dependedByVisitedNodeId","Array","from","values","dependsOnDependedByVisitedNode","Error","name","_addNodeAndDescendantsToList","list","addedIds","rootNode","predicate","_isNodeInContainer","indexOf","_isValidHierarchy","parent","Warn","instantiateModelsToScene","nameFunction","cloneMaterials","options","conversionMap","storeMap","result","alreadySwappedSkeletons","alreadySwappedMaterials","localOptions","doNotInstantiate","onClone","source","clone","clonedMesh","morphTargetManager","oldMorphTargetManager","index","numTargets","oldTarget","getTarget","newTarget","nodesToSort","idsOnSortList","transformNode","onNewCreated","replicatedParentId","replicatedParent","position","copyFrom","rotationQuaternion","rotation","scaling","material","sourceMaterial","swap","getClassName","multi","subMaterials","map","m","addMultiMaterial","addMaterial","instancedNode","replicatedSourceId","replicatedSource","replicatedInstancedNode","createInstance","canInstance","getTotalVertices","replicatedNode","s","isAnInstance","copy","bone","_linkedTransformNode","addAllToScene","addToScene","component","_serializableComponents","addFromContainer","remove","addedNodes","addCamera","addLight","addMesh","addSkeleton","addAnimation","addAnimationGroup","addMorphTargetManager","addGeometry","addTransformNode","addActionManager","addTexture","addReflectionProbe","addedNode","setParent","removeAllFromScene","removeFromScene","removeFromContainer","removeCamera","removeLight","removeMesh","removeSkeleton","removeAnimation","removeAnimationGroup","removeMultiMaterial","removeMaterial","removeMorphTargetManager","removeGeometry","removeTransformNode","removeActionManager","removeTexture","removeReflectionProbe","_moveAssets","sourceAssets","targetAssets","keepAssets","asset","move","keepAsset","_parentContainer","moveAllFromScene","undefined","key","Object","prototype","hasOwnProperty","call","createRootMesh","rootMesh","addChild","unshift","mergeAnimationsTo","animatables","targetConverter","_targetConverter","target","targetProperty","split","join","getTransformNodeByName","getMorphTargetByName","getNodeByName","nodesInAC","nodeInAC","nodeInScene","animationInAC","animationsWithSameProperty","filter","animationInScene","animationWithSameProperty","splice","newAnimationGroups","animationGroupInAC","animatable","stop","beginAnimation","fromFrame","toFrame","loopAnimation","speedRatio","onAnimationEnd","onAnimationLoop","stopAnimation","populateRootNodes","t","l","c","addAllAssetsToContainer","root","nodesToVisit","visitedNodes","pop","getActiveTextures","getChildren"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/assetContainer.js"],"sourcesContent":["import { Mesh } from \"./Meshes/mesh.js\";\nimport { TransformNode } from \"./Meshes/transformNode.js\";\nimport { AbstractMesh } from \"./Meshes/abstractMesh.js\";\nimport { Logger } from \"./Misc/logger.js\";\nimport { EngineStore } from \"./Engines/engineStore.js\";\nimport { InstancedMesh } from \"./Meshes/instancedMesh.js\";\nimport { Light } from \"./Lights/light.js\";\nimport { Camera } from \"./Cameras/camera.js\";\nimport { Tools } from \"./Misc/tools.js\";\n/**\n * Root class for AssetContainer and KeepAssets\n */\nexport class AbstractAssetContainer {\n constructor() {\n /**\n * Gets the list of root nodes (ie. nodes with no parent)\n */\n this.rootNodes = [];\n /** All of the cameras added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n */\n this.cameras = [];\n /**\n * All of the lights added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n */\n this.lights = [];\n /**\n * All of the (abstract) meshes added to this scene\n */\n this.meshes = [];\n /**\n * The list of skeletons added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\n */\n this.skeletons = [];\n /**\n * All of the particle systems added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\n */\n this.particleSystems = [];\n /**\n * Gets a list of Animations associated with the scene\n */\n this.animations = [];\n /**\n * All of the animation groups added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\n */\n this.animationGroups = [];\n /**\n * All of the multi-materials added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\n */\n this.multiMaterials = [];\n /**\n * All of the materials added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\n * Note also that the order of the Material within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\n */\n this.materials = [];\n /**\n * The list of morph target managers added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\n */\n this.morphTargetManagers = [];\n /**\n * The list of geometries used in the scene.\n */\n this.geometries = [];\n /**\n * All of the transform nodes added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\n * Note also that the order of the TransformNode within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\n */\n this.transformNodes = [];\n /**\n * ActionManagers available on the scene.\n * @deprecated\n */\n this.actionManagers = [];\n /**\n * Textures to keep.\n */\n this.textures = [];\n /** @internal */\n this._environmentTexture = null;\n /**\n * The list of postprocesses added to the scene\n */\n this.postProcesses = [];\n /**\n * The list of sounds\n */\n this.sounds = null;\n /**\n * The list of effect layers added to the scene\n */\n this.effectLayers = [];\n /**\n * The list of layers added to the scene\n */\n this.layers = [];\n /**\n * The list of reflection probes added to the scene\n */\n this.reflectionProbes = [];\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n get environmentTexture() {\n return this._environmentTexture;\n }\n set environmentTexture(value) {\n this._environmentTexture = value;\n }\n /**\n * @returns all meshes, lights, cameras, transformNodes and bones\n */\n getNodes() {\n let nodes = [];\n nodes = nodes.concat(this.meshes);\n nodes = nodes.concat(this.lights);\n nodes = nodes.concat(this.cameras);\n nodes = nodes.concat(this.transformNodes); // dummies\n this.skeletons.forEach((skeleton) => (nodes = nodes.concat(skeleton.bones)));\n return nodes;\n }\n}\n/**\n * Set of assets to keep when moving a scene into an asset container.\n */\nexport class KeepAssets extends AbstractAssetContainer {\n}\n/**\n * Class used to store the output of the AssetContainer.instantiateAllMeshesToScene function\n */\nexport class InstantiatedEntries {\n constructor() {\n /**\n * List of new root nodes (eg. nodes with no parent)\n */\n this.rootNodes = [];\n /**\n * List of new skeletons\n */\n this.skeletons = [];\n /**\n * List of new animation groups\n */\n this.animationGroups = [];\n }\n /**\n * Disposes the instantiated entries from the scene\n */\n dispose() {\n this.rootNodes.slice(0).forEach((o) => {\n o.dispose();\n });\n this.rootNodes.length = 0;\n this.skeletons.slice(0).forEach((o) => {\n o.dispose();\n });\n this.skeletons.length = 0;\n this.animationGroups.slice(0).forEach((o) => {\n o.dispose();\n });\n this.animationGroups.length = 0;\n }\n}\n/**\n * Container with a set of assets that can be added or removed from a scene.\n */\nexport class AssetContainer extends AbstractAssetContainer {\n /**\n * Instantiates an AssetContainer.\n * @param scene The scene the AssetContainer belongs to.\n */\n constructor(scene) {\n super();\n this._wasAddedToScene = false;\n scene = scene || EngineStore.LastCreatedScene;\n if (!scene) {\n return;\n }\n this.scene = scene;\n this[\"proceduralTextures\"] = [];\n scene.onDisposeObservable.add(() => {\n if (!this._wasAddedToScene) {\n this.dispose();\n }\n });\n this._onContextRestoredObserver = scene.getEngine().onContextRestoredObservable.add(() => {\n for (const geometry of this.geometries) {\n geometry._rebuild();\n }\n for (const mesh of this.meshes) {\n mesh._rebuild();\n }\n for (const system of this.particleSystems) {\n system.rebuild();\n }\n for (const texture of this.textures) {\n texture._rebuild();\n }\n });\n }\n /**\n * Given a list of nodes, return a topological sorting of them.\n * @param nodes\n * @returns a sorted array of nodes\n */\n _topologicalSort(nodes) {\n const nodesUidMap = new Map();\n for (const node of nodes) {\n nodesUidMap.set(node.uniqueId, node);\n }\n const dependencyGraph = {\n dependsOn: new Map(), // given a node id, what are the ids of the nodes it depends on\n dependedBy: new Map(), // given a node id, what are the ids of the nodes that depend on it\n };\n // Build the dependency graph given the list of nodes\n // First pass: Initialize the empty dependency graph\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n dependencyGraph.dependsOn.set(nodeId, new Set());\n dependencyGraph.dependedBy.set(nodeId, new Set());\n }\n // Second pass: Populate the dependency graph. We assume that we\n // don't need to check for cycles here, as the scene graph cannot\n // contain cycles. Our graph also already contains all transitive\n // dependencies because getDescendants returns the transitive\n // dependencies by default.\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n const dependsOn = dependencyGraph.dependsOn.get(nodeId);\n if (node instanceof InstancedMesh) {\n const masterMesh = node.sourceMesh;\n if (nodesUidMap.has(masterMesh.uniqueId)) {\n dependsOn.add(masterMesh.uniqueId);\n dependencyGraph.dependedBy.get(masterMesh.uniqueId).add(nodeId);\n }\n }\n const dependedBy = dependencyGraph.dependedBy.get(nodeId);\n for (const child of node.getDescendants()) {\n const childId = child.uniqueId;\n if (nodesUidMap.has(childId)) {\n dependedBy.add(childId);\n const childDependsOn = dependencyGraph.dependsOn.get(childId);\n childDependsOn.add(nodeId);\n }\n }\n }\n // Third pass: Topological sort\n const sortedNodes = [];\n // First: Find all nodes that have no dependencies\n const leaves = [];\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n if (dependencyGraph.dependsOn.get(nodeId).size === 0) {\n leaves.push(node);\n nodesUidMap.delete(nodeId);\n }\n }\n const visitList = leaves;\n while (visitList.length > 0) {\n const nodeToVisit = visitList.shift();\n sortedNodes.push(nodeToVisit);\n // Remove the node from the dependency graph\n // When a node is visited, we know that dependsOn is empty.\n // So we only need to remove the node from dependedBy.\n const dependedByVisitedNode = dependencyGraph.dependedBy.get(nodeToVisit.uniqueId);\n // Array.from(x.values()) is to make the TS compiler happy\n for (const dependedByVisitedNodeId of Array.from(dependedByVisitedNode.values())) {\n const dependsOnDependedByVisitedNode = dependencyGraph.dependsOn.get(dependedByVisitedNodeId);\n dependsOnDependedByVisitedNode.delete(nodeToVisit.uniqueId);\n if (dependsOnDependedByVisitedNode.size === 0 && nodesUidMap.get(dependedByVisitedNodeId)) {\n visitList.push(nodesUidMap.get(dependedByVisitedNodeId));\n nodesUidMap.delete(dependedByVisitedNodeId);\n }\n }\n }\n if (nodesUidMap.size > 0) {\n Logger.Error(\"SceneSerializer._topologicalSort: There were unvisited nodes:\");\n nodesUidMap.forEach((node) => Logger.Error(node.name));\n }\n return sortedNodes;\n }\n _addNodeAndDescendantsToList(list, addedIds, rootNode, predicate) {\n if (!rootNode || (predicate && !predicate(rootNode)) || addedIds.has(rootNode.uniqueId)) {\n return;\n }\n list.push(rootNode);\n addedIds.add(rootNode.uniqueId);\n for (const child of rootNode.getDescendants(true)) {\n this._addNodeAndDescendantsToList(list, addedIds, child, predicate);\n }\n }\n /**\n * Check if a specific node is contained in this asset container.\n * @param node the node to check\n * @returns true if the node is contained in this container, otherwise false.\n */\n _isNodeInContainer(node) {\n if (node instanceof AbstractMesh && this.meshes.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof TransformNode && this.transformNodes.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof Light && this.lights.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof Camera && this.cameras.indexOf(node) !== -1) {\n return true;\n }\n return false;\n }\n /**\n * For every node in the scene, check if its parent node is also in the scene.\n * @returns true if every node's parent is also in the scene, otherwise false.\n */\n _isValidHierarchy() {\n for (const node of this.meshes) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.transformNodes) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.lights) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.cameras) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n return true;\n }\n /**\n * Instantiate or clone all meshes and add the new ones to the scene.\n * Skeletons and animation groups will all be cloned\n * @param nameFunction defines an optional function used to get new names for clones\n * @param cloneMaterials defines an optional boolean that defines if materials must be cloned as well (false by default)\n * @param options defines an optional list of options to control how to instantiate / clone models\n * @param options.doNotInstantiate defines if the model must be instantiated or just cloned\n * @param options.predicate defines a predicate used to filter whih mesh to instantiate/clone\n * @returns a list of rootNodes, skeletons and animation groups that were duplicated\n */\n instantiateModelsToScene(nameFunction, cloneMaterials = false, options) {\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.InstantiateModelsToScene: The Asset Container hierarchy is not valid.\");\n }\n const conversionMap = {};\n const storeMap = {};\n const result = new InstantiatedEntries();\n const alreadySwappedSkeletons = [];\n const alreadySwappedMaterials = [];\n const localOptions = {\n doNotInstantiate: true,\n ...options,\n };\n const onClone = (source, clone) => {\n conversionMap[source.uniqueId] = clone.uniqueId;\n storeMap[clone.uniqueId] = clone;\n if (nameFunction) {\n clone.name = nameFunction(source.name);\n }\n if (clone instanceof Mesh) {\n const clonedMesh = clone;\n if (clonedMesh.morphTargetManager) {\n const oldMorphTargetManager = source.morphTargetManager;\n clonedMesh.morphTargetManager = oldMorphTargetManager.clone();\n for (let index = 0; index < oldMorphTargetManager.numTargets; index++) {\n const oldTarget = oldMorphTargetManager.getTarget(index);\n const newTarget = clonedMesh.morphTargetManager.getTarget(index);\n conversionMap[oldTarget.uniqueId] = newTarget.uniqueId;\n storeMap[newTarget.uniqueId] = newTarget;\n }\n }\n }\n };\n const nodesToSort = [];\n const idsOnSortList = new Set();\n for (const transformNode of this.transformNodes) {\n if (transformNode.parent === null) {\n this._addNodeAndDescendantsToList(nodesToSort, idsOnSortList, transformNode, localOptions.predicate);\n }\n }\n for (const mesh of this.meshes) {\n if (mesh.parent === null) {\n this._addNodeAndDescendantsToList(nodesToSort, idsOnSortList, mesh, localOptions.predicate);\n }\n }\n // Topologically sort nodes by parenting/instancing relationships so that all resources are in place\n // when a given node is instantiated.\n const sortedNodes = this._topologicalSort(nodesToSort);\n const onNewCreated = (source, clone) => {\n onClone(source, clone);\n if (source.parent) {\n const replicatedParentId = conversionMap[source.parent.uniqueId];\n const replicatedParent = storeMap[replicatedParentId];\n if (replicatedParent) {\n clone.parent = replicatedParent;\n }\n else {\n clone.parent = source.parent;\n }\n }\n if (clone.position && source.position) {\n clone.position.copyFrom(source.position);\n }\n if (clone.rotationQuaternion && source.rotationQuaternion) {\n clone.rotationQuaternion.copyFrom(source.rotationQuaternion);\n }\n if (clone.rotation && source.rotation) {\n clone.rotation.copyFrom(source.rotation);\n }\n if (clone.scaling && source.scaling) {\n clone.scaling.copyFrom(source.scaling);\n }\n if (clone.material) {\n const mesh = clone;\n if (mesh.material) {\n if (cloneMaterials) {\n const sourceMaterial = source.material;\n if (alreadySwappedMaterials.indexOf(sourceMaterial) === -1) {\n let swap = sourceMaterial.clone(nameFunction ? nameFunction(sourceMaterial.name) : \"Clone of \" + sourceMaterial.name);\n alreadySwappedMaterials.push(sourceMaterial);\n conversionMap[sourceMaterial.uniqueId] = swap.uniqueId;\n storeMap[swap.uniqueId] = swap;\n if (sourceMaterial.getClassName() === \"MultiMaterial\") {\n const multi = sourceMaterial;\n for (const material of multi.subMaterials) {\n if (!material) {\n continue;\n }\n swap = material.clone(nameFunction ? nameFunction(material.name) : \"Clone of \" + material.name);\n alreadySwappedMaterials.push(material);\n conversionMap[material.uniqueId] = swap.uniqueId;\n storeMap[swap.uniqueId] = swap;\n }\n multi.subMaterials = multi.subMaterials.map((m) => m && storeMap[conversionMap[m.uniqueId]]);\n }\n }\n if (mesh.getClassName() !== \"InstancedMesh\") {\n mesh.material = storeMap[conversionMap[sourceMaterial.uniqueId]];\n }\n }\n else {\n if (mesh.material.getClassName() === \"MultiMaterial\") {\n if (this.scene.multiMaterials.indexOf(mesh.material) === -1) {\n this.scene.addMultiMaterial(mesh.material);\n }\n }\n else {\n if (this.scene.materials.indexOf(mesh.material) === -1) {\n this.scene.addMaterial(mesh.material);\n }\n }\n }\n }\n }\n if (clone.parent === null) {\n result.rootNodes.push(clone);\n }\n };\n sortedNodes.forEach((node) => {\n if (node.getClassName() === \"InstancedMesh\") {\n const instancedNode = node;\n const sourceMesh = instancedNode.sourceMesh;\n const replicatedSourceId = conversionMap[sourceMesh.uniqueId];\n const replicatedSource = typeof replicatedSourceId === \"number\" ? storeMap[replicatedSourceId] : sourceMesh;\n const replicatedInstancedNode = replicatedSource.createInstance(instancedNode.name);\n onNewCreated(instancedNode, replicatedInstancedNode);\n }\n else {\n // Mesh or TransformNode\n let canInstance = true;\n if (node.getClassName() === \"TransformNode\" ||\n node.getClassName() === \"Node\" ||\n node.skeleton ||\n !node.getTotalVertices ||\n node.getTotalVertices() === 0) {\n // Transform nodes, skinned meshes, and meshes with no vertices can never be instanced!\n canInstance = false;\n }\n else if (localOptions.doNotInstantiate) {\n if (typeof localOptions.doNotInstantiate === \"function\") {\n canInstance = !localOptions.doNotInstantiate(node);\n }\n else {\n canInstance = !localOptions.doNotInstantiate;\n }\n }\n const replicatedNode = canInstance ? node.createInstance(`instance of ${node.name}`) : node.clone(`Clone of ${node.name}`, null, true);\n if (!replicatedNode) {\n throw new Error(`Could not clone or instantiate node on Asset Container ${node.name}`);\n }\n onNewCreated(node, replicatedNode);\n }\n });\n this.skeletons.forEach((s) => {\n if (localOptions.predicate && !localOptions.predicate(s)) {\n return;\n }\n const clone = s.clone(nameFunction ? nameFunction(s.name) : \"Clone of \" + s.name);\n for (const m of this.meshes) {\n if (m.skeleton === s && !m.isAnInstance) {\n const copy = storeMap[conversionMap[m.uniqueId]];\n if (!copy || copy.isAnInstance) {\n continue;\n }\n copy.skeleton = clone;\n if (alreadySwappedSkeletons.indexOf(clone) !== -1) {\n continue;\n }\n alreadySwappedSkeletons.push(clone);\n // Check if bones are mesh linked\n for (const bone of clone.bones) {\n if (bone._linkedTransformNode) {\n bone._linkedTransformNode = storeMap[conversionMap[bone._linkedTransformNode.uniqueId]];\n }\n }\n }\n }\n result.skeletons.push(clone);\n });\n this.animationGroups.forEach((o) => {\n if (localOptions.predicate && !localOptions.predicate(o)) {\n return;\n }\n const clone = o.clone(nameFunction ? nameFunction(o.name) : \"Clone of \" + o.name, (oldTarget) => {\n const newTarget = storeMap[conversionMap[oldTarget.uniqueId]];\n return newTarget || oldTarget;\n });\n result.animationGroups.push(clone);\n });\n return result;\n }\n /**\n * Adds all the assets from the container to the scene.\n */\n addAllToScene() {\n if (this._wasAddedToScene) {\n return;\n }\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.addAllToScene: The Asset Container hierarchy is not valid.\");\n }\n this._wasAddedToScene = true;\n this.addToScene(null);\n if (this.environmentTexture) {\n this.scene.environmentTexture = this.environmentTexture;\n }\n for (const component of this.scene._serializableComponents) {\n component.addFromContainer(this);\n }\n this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n /**\n * Adds assets from the container to the scene.\n * @param predicate defines a predicate used to select which entity will be added (can be null)\n */\n addToScene(predicate = null) {\n const addedNodes = [];\n this.cameras.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addCamera(o);\n addedNodes.push(o);\n });\n this.lights.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addLight(o);\n addedNodes.push(o);\n });\n this.meshes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMesh(o);\n addedNodes.push(o);\n });\n this.skeletons.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addSkeleton(o);\n });\n this.animations.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addAnimation(o);\n });\n this.animationGroups.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addAnimationGroup(o);\n });\n this.multiMaterials.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMultiMaterial(o);\n });\n this.materials.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMaterial(o);\n });\n this.morphTargetManagers.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMorphTargetManager(o);\n });\n this.geometries.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addGeometry(o);\n });\n this.transformNodes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addTransformNode(o);\n addedNodes.push(o);\n });\n this.actionManagers.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addActionManager(o);\n });\n this.textures.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addTexture(o);\n });\n this.reflectionProbes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addReflectionProbe(o);\n });\n for (const addedNode of addedNodes) {\n // If node was added to the scene, but parent is not in the scene, break the relationship\n if (addedNode.parent && this.scene.getNodes().indexOf(addedNode.parent) === -1) {\n // Use setParent to keep transform if possible\n if (addedNode.setParent) {\n addedNode.setParent(null);\n }\n else {\n addedNode.parent = null;\n }\n }\n }\n }\n /**\n * Removes all the assets in the container from the scene\n */\n removeAllFromScene() {\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.removeAllFromScene: The Asset Container hierarchy is not valid.\");\n }\n this._wasAddedToScene = false;\n this.removeFromScene(null);\n if (this.environmentTexture === this.scene.environmentTexture) {\n this.scene.environmentTexture = null;\n }\n for (const component of this.scene._serializableComponents) {\n component.removeFromContainer(this);\n }\n }\n /**\n * Removes assets in the container from the scene\n * @param predicate defines a predicate used to select which entity will be added (can be null)\n */\n removeFromScene(predicate = null) {\n this.cameras.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeCamera(o);\n });\n this.lights.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeLight(o);\n });\n this.meshes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMesh(o, true);\n });\n this.skeletons.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeSkeleton(o);\n });\n this.animations.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeAnimation(o);\n });\n this.animationGroups.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeAnimationGroup(o);\n });\n this.multiMaterials.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMultiMaterial(o);\n });\n this.materials.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMaterial(o);\n });\n this.morphTargetManagers.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMorphTargetManager(o);\n });\n this.geometries.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeGeometry(o);\n });\n this.transformNodes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeTransformNode(o);\n });\n this.actionManagers.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeActionManager(o);\n });\n this.textures.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeTexture(o);\n });\n this.reflectionProbes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeReflectionProbe(o);\n });\n }\n /**\n * Disposes all the assets in the container\n */\n dispose() {\n this.cameras.slice(0).forEach((o) => {\n o.dispose();\n });\n this.cameras.length = 0;\n this.lights.slice(0).forEach((o) => {\n o.dispose();\n });\n this.lights.length = 0;\n this.meshes.slice(0).forEach((o) => {\n o.dispose();\n });\n this.meshes.length = 0;\n this.skeletons.slice(0).forEach((o) => {\n o.dispose();\n });\n this.skeletons.length = 0;\n this.animationGroups.slice(0).forEach((o) => {\n o.dispose();\n });\n this.animationGroups.length = 0;\n this.multiMaterials.slice(0).forEach((o) => {\n o.dispose();\n });\n this.multiMaterials.length = 0;\n this.materials.slice(0).forEach((o) => {\n o.dispose();\n });\n this.materials.length = 0;\n this.geometries.slice(0).forEach((o) => {\n o.dispose();\n });\n this.geometries.length = 0;\n this.transformNodes.slice(0).forEach((o) => {\n o.dispose();\n });\n this.transformNodes.length = 0;\n this.actionManagers.slice(0).forEach((o) => {\n o.dispose();\n });\n this.actionManagers.length = 0;\n this.textures.slice(0).forEach((o) => {\n o.dispose();\n });\n this.textures.length = 0;\n this.reflectionProbes.slice(0).forEach((o) => {\n o.dispose();\n });\n this.reflectionProbes.length = 0;\n this.morphTargetManagers.slice(0).forEach((o) => {\n o.dispose();\n });\n this.morphTargetManagers.length = 0;\n if (this.environmentTexture) {\n this.environmentTexture.dispose();\n this.environmentTexture = null;\n }\n for (const component of this.scene._serializableComponents) {\n component.removeFromContainer(this, true);\n }\n if (this._onContextRestoredObserver) {\n this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n }\n _moveAssets(sourceAssets, targetAssets, keepAssets) {\n if (!sourceAssets || !targetAssets) {\n return;\n }\n for (const asset of sourceAssets) {\n let move = true;\n if (keepAssets) {\n for (const keepAsset of keepAssets) {\n if (asset === keepAsset) {\n move = false;\n break;\n }\n }\n }\n if (move) {\n targetAssets.push(asset);\n asset._parentContainer = this;\n }\n }\n }\n /**\n * Removes all the assets contained in the scene and adds them to the container.\n * @param keepAssets Set of assets to keep in the scene. (default: empty)\n */\n moveAllFromScene(keepAssets) {\n this._wasAddedToScene = false;\n if (keepAssets === undefined) {\n keepAssets = new KeepAssets();\n }\n for (const key in this) {\n if (Object.prototype.hasOwnProperty.call(this, key)) {\n this[key] = this[key] || (key === \"_environmentTexture\" ? null : []);\n this._moveAssets(this.scene[key], this[key], keepAssets[key]);\n }\n }\n this.environmentTexture = this.scene.environmentTexture;\n this.removeAllFromScene();\n }\n /**\n * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.\n * @returns the root mesh\n */\n createRootMesh() {\n const rootMesh = new Mesh(\"assetContainerRootMesh\", this.scene);\n this.meshes.forEach((m) => {\n if (!m.parent) {\n rootMesh.addChild(m);\n }\n });\n this.meshes.unshift(rootMesh);\n return rootMesh;\n }\n /**\n * Merge animations (direct and animation groups) from this asset container into a scene\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\n * @param animatables set of animatables to retarget to a node from the scene\n * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)\n * @returns an array of the new AnimationGroup added to the scene (empty array if none)\n */\n mergeAnimationsTo(scene = EngineStore.LastCreatedScene, animatables, targetConverter = null) {\n if (!scene) {\n Logger.Error(\"No scene available to merge animations to\");\n return [];\n }\n const _targetConverter = targetConverter\n ? targetConverter\n : (target) => {\n let node = null;\n const targetProperty = target.animations.length ? target.animations[0].targetProperty : \"\";\n /*\n BabylonJS adds special naming to targets that are children of nodes.\n This name attempts to remove that special naming to get the parent nodes name in case the target\n can't be found in the node tree\n\n Ex: Torso_primitive0 likely points to a Mesh primitive. We take away primitive0 and are left with \"Torso\" which is the name\n of the primitive's parent.\n */\n const name = target.name.split(\".\").join(\"\").split(\"_primitive\")[0];\n switch (targetProperty) {\n case \"position\":\n case \"rotationQuaternion\":\n node = scene.getTransformNodeByName(target.name) || scene.getTransformNodeByName(name);\n break;\n case \"influence\":\n node = scene.getMorphTargetByName(target.name) || scene.getMorphTargetByName(name);\n break;\n default:\n node = scene.getNodeByName(target.name) || scene.getNodeByName(name);\n }\n return node;\n };\n // Copy new node animations\n const nodesInAC = this.getNodes();\n nodesInAC.forEach((nodeInAC) => {\n const nodeInScene = _targetConverter(nodeInAC);\n if (nodeInScene !== null) {\n // Remove old animations with same target property as a new one\n for (const animationInAC of nodeInAC.animations) {\n // Doing treatment on an array for safety measure\n const animationsWithSameProperty = nodeInScene.animations.filter((animationInScene) => {\n return animationInScene.targetProperty === animationInAC.targetProperty;\n });\n for (const animationWithSameProperty of animationsWithSameProperty) {\n const index = nodeInScene.animations.indexOf(animationWithSameProperty, 0);\n if (index > -1) {\n nodeInScene.animations.splice(index, 1);\n }\n }\n }\n // Append new animations\n nodeInScene.animations = nodeInScene.animations.concat(nodeInAC.animations);\n }\n });\n const newAnimationGroups = [];\n // Copy new animation groups\n this.animationGroups.slice().forEach((animationGroupInAC) => {\n // Clone the animation group and all its animatables\n newAnimationGroups.push(animationGroupInAC.clone(animationGroupInAC.name, _targetConverter));\n // Remove animatables related to the asset container\n animationGroupInAC.animatables.forEach((animatable) => {\n animatable.stop();\n });\n });\n // Retarget animatables\n animatables.forEach((animatable) => {\n const target = _targetConverter(animatable.target);\n if (target) {\n // Clone the animatable and retarget it\n scene.beginAnimation(target, animatable.fromFrame, animatable.toFrame, animatable.loopAnimation, animatable.speedRatio, animatable.onAnimationEnd ? animatable.onAnimationEnd : undefined, undefined, true, undefined, animatable.onAnimationLoop ? animatable.onAnimationLoop : undefined);\n // Stop animation for the target in the asset container\n scene.stopAnimation(animatable.target);\n }\n });\n return newAnimationGroups;\n }\n /**\n * @since 6.15.0\n * This method checks for any node that has no parent\n * and is not in the rootNodes array, and adds the node\n * there, if so.\n */\n populateRootNodes() {\n this.rootNodes.length = 0;\n this.meshes.forEach((m) => {\n if (!m.parent && this.rootNodes.indexOf(m) === -1) {\n this.rootNodes.push(m);\n }\n });\n this.transformNodes.forEach((t) => {\n if (!t.parent && this.rootNodes.indexOf(t) === -1) {\n this.rootNodes.push(t);\n }\n });\n this.lights.forEach((l) => {\n if (!l.parent && this.rootNodes.indexOf(l) === -1) {\n this.rootNodes.push(l);\n }\n });\n this.cameras.forEach((c) => {\n if (!c.parent && this.rootNodes.indexOf(c) === -1) {\n this.rootNodes.push(c);\n }\n });\n }\n /**\n * @since 6.26.0\n * Given a root asset, this method will traverse its hierarchy and add it, its children and any materials/skeletons/animation groups to the container.\n * @param root root node\n */\n addAllAssetsToContainer(root) {\n if (!root) {\n return;\n }\n const nodesToVisit = [];\n const visitedNodes = new Set();\n nodesToVisit.push(root);\n while (nodesToVisit.length > 0) {\n const nodeToVisit = nodesToVisit.pop();\n if (nodeToVisit instanceof Mesh) {\n if (nodeToVisit.geometry && this.geometries.indexOf(nodeToVisit.geometry) === -1) {\n this.geometries.push(nodeToVisit.geometry);\n }\n this.meshes.push(nodeToVisit);\n }\n else if (nodeToVisit instanceof TransformNode) {\n this.transformNodes.push(nodeToVisit);\n }\n else if (nodeToVisit instanceof Light) {\n this.lights.push(nodeToVisit);\n }\n else if (nodeToVisit instanceof Camera) {\n this.cameras.push(nodeToVisit);\n }\n if (nodeToVisit instanceof AbstractMesh) {\n if (nodeToVisit.material && this.materials.indexOf(nodeToVisit.material) === -1) {\n this.materials.push(nodeToVisit.material);\n for (const texture of nodeToVisit.material.getActiveTextures()) {\n if (this.textures.indexOf(texture) === -1) {\n this.textures.push(texture);\n }\n }\n }\n if (nodeToVisit.skeleton && this.skeletons.indexOf(nodeToVisit.skeleton) === -1) {\n this.skeletons.push(nodeToVisit.skeleton);\n }\n if (nodeToVisit.morphTargetManager && this.morphTargetManagers.indexOf(nodeToVisit.morphTargetManager) === -1) {\n this.morphTargetManagers.push(nodeToVisit.morphTargetManager);\n }\n }\n for (const child of nodeToVisit.getChildren()) {\n if (!visitedNodes.has(child)) {\n nodesToVisit.push(child);\n }\n }\n visitedNodes.add(nodeToVisit);\n }\n this.populateRootNodes();\n }\n}\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,kBAAkB;AACvC,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,KAAK,QAAQ,iBAAiB;AACvC;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,CAAC;EAChCC,WAAWA,CAAA,EAAG;IACV;AACR;AACA;IACQ,IAAI,CAACC,SAAS,GAAG,EAAE;IACnB;AACR;AACA;IACQ,IAAI,CAACC,OAAO,GAAG,EAAE;IACjB;AACR;AACA;AACA;IACQ,IAAI,CAACC,MAAM,GAAG,EAAE;IAChB;AACR;AACA;IACQ,IAAI,CAACC,MAAM,GAAG,EAAE;IAChB;AACR;AACA;AACA;IACQ,IAAI,CAACC,SAAS,GAAG,EAAE;IACnB;AACR;AACA;AACA;IACQ,IAAI,CAACC,eA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