1 |
- {"ast":null,"code":"import { Observable } from \"../Misc/observable.js\";\nimport { Tools, AsyncLoop } from \"../Misc/tools.js\";\nimport { DeepCopier } from \"../Misc/deepCopier.js\";\nimport { Tags } from \"../Misc/tags.js\";\nimport { runCoroutineSync, runCoroutineAsync, createYieldingScheduler } from \"../Misc/coroutine.js\";\nimport { Camera } from \"../Cameras/camera.js\";\nimport { Quaternion, Matrix, Vector3, Vector2 } from \"../Maths/math.vector.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { Node } from \"../node.js\";\nimport { VertexBuffer, Buffer } from \"../Buffers/buffer.js\";\nimport { VertexData } from \"./mesh.vertexData.js\";\nimport { Geometry } from \"./geometry.js\";\nimport { AbstractMesh } from \"./abstractMesh.js\";\nimport { SubMesh } from \"./subMesh.js\";\nimport { Material } from \"../Materials/material.js\";\nimport { MultiMaterial } from \"../Materials/multiMaterial.js\";\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { GetClass, RegisterClass } from \"../Misc/typeStore.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { MeshLODLevel } from \"./meshLODLevel.js\";\n/**\n * @internal\n **/\nexport class _CreationDataStorage {}\n/**\n * @internal\n **/\nclass _InstanceDataStorage {\n constructor() {\n this.visibleInstances = {};\n this.batchCache = new _InstancesBatch();\n this.batchCacheReplacementModeInFrozenMode = new _InstancesBatch();\n this.instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances\n }\n}\n/**\n * @internal\n **/\nexport class _InstancesBatch {\n constructor() {\n this.mustReturn = false;\n this.visibleInstances = new Array();\n this.renderSelf = [];\n this.hardwareInstancedRendering = [];\n }\n}\n/**\n * @internal\n **/\nclass _ThinInstanceDataStorage {\n constructor() {\n this.instancesCount = 0;\n this.matrixBuffer = null;\n this.previousMatrixBuffer = null;\n this.matrixBufferSize = 32 * 16; // let's start with a maximum of 32 thin instances\n this.matrixData = null;\n this.boundingVectors = [];\n this.worldMatrices = null;\n }\n}\n/**\n * @internal\n **/\nclass _InternalMeshDataInfo {\n constructor() {\n this._areNormalsFrozen = false; // Will be used by ribbons mainly\n // Will be used to save a source mesh reference, If any\n this._source = null;\n // Will be used to for fast cloned mesh lookup\n this.meshMap = null;\n this._preActivateId = -1;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this._LODLevels = new Array();\n /** Alternative definition of LOD level, using screen coverage instead of distance */\n this._useLODScreenCoverage = false;\n this._effectiveMaterial = null;\n this._forcedInstanceCount = 0;\n this._overrideRenderingFillMode = null;\n }\n}\n/**\n * Class used to represent renderable models\n */\nexport class Mesh extends AbstractMesh {\n /**\n * Gets the default side orientation.\n * @param orientation the orientation to value to attempt to get\n * @returns the default orientation\n * @internal\n */\n static _GetDefaultSideOrientation(orientation) {\n return orientation || Mesh.FRONTSIDE; // works as Mesh.FRONTSIDE is 0\n }\n /**\n * Determines if the LOD levels are intended to be calculated using screen coverage (surface area ratio) instead of distance.\n */\n get useLODScreenCoverage() {\n return this._internalMeshDataInfo._useLODScreenCoverage;\n }\n set useLODScreenCoverage(value) {\n this._internalMeshDataInfo._useLODScreenCoverage = value;\n this._sortLODLevels();\n }\n get computeBonesUsingShaders() {\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\n }\n set computeBonesUsingShaders(value) {\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\n return;\n }\n if (value && this._internalMeshDataInfo._sourcePositions) {\n // switch from software to GPU computation: we need to reset the vertex and normal buffers that have been updated by the software process\n this.setVerticesData(VertexBuffer.PositionKind, this._internalMeshDataInfo._sourcePositions, true);\n if (this._internalMeshDataInfo._sourceNormals) {\n this.setVerticesData(VertexBuffer.NormalKind, this._internalMeshDataInfo._sourceNormals, true);\n }\n this._internalMeshDataInfo._sourcePositions = null;\n this._internalMeshDataInfo._sourceNormals = null;\n }\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\n this._markSubMeshesAsAttributesDirty();\n }\n /**\n * An event triggered before rendering the mesh\n */\n get onBeforeRenderObservable() {\n if (!this._internalMeshDataInfo._onBeforeRenderObservable) {\n this._internalMeshDataInfo._onBeforeRenderObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeRenderObservable;\n }\n /**\n * An event triggered before binding the mesh\n */\n get onBeforeBindObservable() {\n if (!this._internalMeshDataInfo._onBeforeBindObservable) {\n this._internalMeshDataInfo._onBeforeBindObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeBindObservable;\n }\n /**\n * An event triggered after rendering the mesh\n */\n get onAfterRenderObservable() {\n if (!this._internalMeshDataInfo._onAfterRenderObservable) {\n this._internalMeshDataInfo._onAfterRenderObservable = new Observable();\n }\n return this._internalMeshDataInfo._onAfterRenderObservable;\n }\n /**\n * An event triggeredbetween rendering pass when using separateCullingPass = true\n */\n get onBetweenPassObservable() {\n if (!this._internalMeshDataInfo._onBetweenPassObservable) {\n this._internalMeshDataInfo._onBetweenPassObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBetweenPassObservable;\n }\n /**\n * An event triggered before drawing the mesh\n */\n get onBeforeDrawObservable() {\n if (!this._internalMeshDataInfo._onBeforeDrawObservable) {\n this._internalMeshDataInfo._onBeforeDrawObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeDrawObservable;\n }\n /**\n * Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead\n */\n set onBeforeDraw(callback) {\n if (this._onBeforeDrawObserver) {\n this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver);\n }\n this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(callback);\n }\n get hasInstances() {\n return this.instances.length > 0;\n }\n get hasThinInstances() {\n return (this.forcedInstanceCount || this._thinInstanceDataStorage.instancesCount || 0) > 0;\n }\n /**\n * Gets or sets the forced number of instances to display.\n * If 0 (default value), the number of instances is not forced and depends on the draw type\n * (regular / instance / thin instances mesh)\n */\n get forcedInstanceCount() {\n return this._internalMeshDataInfo._forcedInstanceCount;\n }\n set forcedInstanceCount(count) {\n this._internalMeshDataInfo._forcedInstanceCount = count;\n }\n /**\n * Use this property to change the original side orientation defined at construction time\n * Material.sideOrientation will override this value if set\n * User will still be able to change the material sideOrientation afterwards if they really need it\n */\n get sideOrientation() {\n return this._internalMeshDataInfo._sideOrientation;\n }\n set sideOrientation(value) {\n this._internalMeshDataInfo._sideOrientation = value;\n this._internalAbstractMeshDataInfo._sideOrientationHint = this._scene.useRightHandedSystem && value === 1 || !this._scene.useRightHandedSystem && value === 0;\n }\n /**\n * @deprecated Please use sideOrientation instead.\n * @see https://doc.babylonjs.com/breaking-changes#7110\n */\n get overrideMaterialSideOrientation() {\n return this.sideOrientation;\n }\n set overrideMaterialSideOrientation(value) {\n this.sideOrientation = value;\n if (this.material) {\n this.material.sideOrientation = null;\n }\n }\n /**\n * Use this property to override the Material's fillMode value\n */\n get overrideRenderingFillMode() {\n return this._internalMeshDataInfo._overrideRenderingFillMode;\n }\n set overrideRenderingFillMode(fillMode) {\n this._internalMeshDataInfo._overrideRenderingFillMode = fillMode;\n }\n get material() {\n return this._internalAbstractMeshDataInfo._material;\n }\n set material(value) {\n if (value && (this.material && this.material.sideOrientation === null || this._internalAbstractMeshDataInfo._sideOrientationHint)) {\n value.sideOrientation = null;\n }\n this._setMaterial(value);\n }\n /**\n * Gets the source mesh (the one used to clone this one from)\n */\n get source() {\n return this._internalMeshDataInfo._source;\n }\n /**\n * Gets the list of clones of this mesh\n * The scene must have been constructed with useClonedMeshMap=true for this to work!\n * Note that useClonedMeshMap=true is the default setting\n */\n get cloneMeshMap() {\n return this._internalMeshDataInfo.meshMap;\n }\n /**\n * Gets or sets a boolean indicating that this mesh does not use index buffer\n */\n get isUnIndexed() {\n return this._unIndexed;\n }\n set isUnIndexed(value) {\n if (this._unIndexed !== value) {\n this._unIndexed = value;\n this._markSubMeshesAsAttributesDirty();\n }\n }\n /** Gets the array buffer used to store the instanced buffer used for instances' world matrices */\n get worldMatrixInstancedBuffer() {\n return this._instanceDataStorage.instancesData;\n }\n /** Gets the array buffer used to store the instanced buffer used for instances' previous world matrices */\n get previousWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.instancesPreviousData;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */\n get manualUpdateOfWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.manualUpdate;\n }\n set manualUpdateOfWorldMatrixInstancedBuffer(value) {\n this._instanceDataStorage.manualUpdate = value;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */\n get manualUpdateOfPreviousWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.previousManualUpdate;\n }\n set manualUpdateOfPreviousWorldMatrixInstancedBuffer(value) {\n this._instanceDataStorage.previousManualUpdate = value;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices must be performed in all cases (and notably even in frozen mode) */\n get forceWorldMatrixInstancedBufferUpdate() {\n return this._instanceDataStorage.forceMatrixUpdates;\n }\n set forceWorldMatrixInstancedBufferUpdate(value) {\n this._instanceDataStorage.forceMatrixUpdates = value;\n }\n _copySource(source, doNotCloneChildren, clonePhysicsImpostor = true) {\n const scene = this.getScene();\n // Geometry\n if (source._geometry) {\n source._geometry.applyToMesh(this);\n }\n // Deep copy\n DeepCopier.DeepCopy(source, this, [\"name\", \"material\", \"skeleton\", \"instances\", \"parent\", \"uniqueId\", \"source\", \"metadata\", \"morphTargetManager\", \"hasInstances\", \"worldMatrixInstancedBuffer\", \"previousWorldMatrixInstancedBuffer\", \"hasLODLevels\", \"geometry\", \"isBlocked\", \"areNormalsFrozen\", \"facetNb\", \"isFacetDataEnabled\", \"lightSources\", \"useBones\", \"isAnInstance\", \"collider\", \"edgesRenderer\", \"forward\", \"up\", \"right\", \"absolutePosition\", \"absoluteScaling\", \"absoluteRotationQuaternion\", \"isWorldMatrixFrozen\", \"nonUniformScaling\", \"behaviors\", \"worldMatrixFromCache\", \"hasThinInstances\", \"cloneMeshMap\", \"hasBoundingInfo\", \"physicsBody\", \"physicsImpostor\"], [\"_poseMatrix\"]);\n // Source mesh\n this._internalMeshDataInfo._source = source;\n if (scene.useClonedMeshMap) {\n if (!source._internalMeshDataInfo.meshMap) {\n source._internalMeshDataInfo.meshMap = {};\n }\n source._internalMeshDataInfo.meshMap[this.uniqueId] = this;\n }\n // Construction Params\n // Clone parameters allowing mesh to be updated in case of parametric shapes.\n this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;\n this._creationDataStorage = source._creationDataStorage;\n // Animation ranges\n if (source._ranges) {\n const ranges = source._ranges;\n for (const name in ranges) {\n if (!Object.prototype.hasOwnProperty.call(ranges, name)) {\n continue;\n }\n if (!ranges[name]) {\n continue;\n }\n this.createAnimationRange(name, ranges[name].from, ranges[name].to);\n }\n }\n // Metadata\n if (source.metadata && source.metadata.clone) {\n this.metadata = source.metadata.clone();\n } else {\n this.metadata = source.metadata;\n }\n this._internalMetadata = source._internalMetadata;\n // Tags\n if (Tags && Tags.HasTags(source)) {\n Tags.AddTagsTo(this, Tags.GetTags(source, true));\n }\n // Enabled. We shouldn't need to check the source's ancestors, as this mesh\n // will have the same ones.\n this.setEnabled(source.isEnabled(false));\n // Parent\n this.parent = source.parent;\n // Pivot\n this.setPivotMatrix(source.getPivotMatrix(), this._postMultiplyPivotMatrix);\n this.id = this.name + \".\" + source.id;\n // Material\n this.material = source.material;\n if (!doNotCloneChildren) {\n // Children\n const directDescendants = source.getDescendants(true);\n for (let index = 0; index < directDescendants.length; index++) {\n const child = directDescendants[index];\n if (child.clone) {\n child.clone(this.name + \".\" + child.name, this);\n }\n }\n }\n // Morphs\n if (source.morphTargetManager) {\n this.morphTargetManager = source.morphTargetManager;\n }\n // Physics clone\n if (scene.getPhysicsEngine) {\n const physicsEngine = scene.getPhysicsEngine();\n if (clonePhysicsImpostor && physicsEngine) {\n if (physicsEngine.getPluginVersion() === 1) {\n const impostor = physicsEngine.getImpostorForPhysicsObject(source);\n if (impostor) {\n this.physicsImpostor = impostor.clone(this);\n }\n } else if (physicsEngine.getPluginVersion() === 2) {\n if (source.physicsBody) {\n source.physicsBody.clone(this);\n }\n }\n }\n }\n // Particles\n for (let index = 0; index < scene.particleSystems.length; index++) {\n const system = scene.particleSystems[index];\n if (system.emitter === source) {\n system.clone(system.name, this);\n }\n }\n // Skeleton\n this.skeleton = source.skeleton;\n this.refreshBoundingInfo(true, true);\n this.computeWorldMatrix(true);\n }\n /**\n * Constructor\n * @param name The value used by scene.getMeshByName() to do a lookup.\n * @param scene The scene to add this mesh to.\n * @param parent The parent of this mesh, if it has one\n * @param source An optional Mesh from which geometry is shared, cloned.\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\n * When false, achieved by calling a clone(), also passing False.\n * This will make creation of children, recursive.\n * @param clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.\n */\n constructor(name, scene = null, parent = null, source = null, doNotCloneChildren, clonePhysicsImpostor = true) {\n super(name, scene);\n // Internal data\n this._internalMeshDataInfo = new _InternalMeshDataInfo();\n // Members\n /**\n * Gets the delay loading state of the mesh (when delay loading is turned on)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/incrementalLoading\n */\n this.delayLoadState = 0;\n /**\n * Gets the list of instances created from this mesh\n * it is not supposed to be modified manually.\n * Note also that the order of the InstancedMesh wihin the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances\n */\n this.instances = [];\n // Private\n /** @internal */\n this._creationDataStorage = null;\n /** @internal */\n this._geometry = null;\n /** @internal */\n this._instanceDataStorage = new _InstanceDataStorage();\n /** @internal */\n this._thinInstanceDataStorage = new _ThinInstanceDataStorage();\n /** @internal */\n this._shouldGenerateFlatShading = false;\n // Use by builder only to know what orientation were the mesh build in.\n /** @internal */\n this._originalBuilderSideOrientation = Mesh.DEFAULTSIDE;\n /**\n * Gets or sets a boolean indicating whether to render ignoring the active camera's max z setting. (false by default)\n * You should not mix meshes that have this property set to true with meshes that have it set to false if they all write\n * to the depth buffer, because the z-values are not comparable in the two cases and you will get rendering artifacts if you do.\n * You can set the property to true for meshes that do not write to the depth buffer, or set the same value (either false or true) otherwise.\n * Note this will reduce performance when set to true.\n */\n this.ignoreCameraMaxZ = false;\n scene = this.getScene();\n if (this._scene.useRightHandedSystem) {\n this.sideOrientation = 0;\n } else {\n this.sideOrientation = 1;\n }\n this._onBeforeDraw = (isInstance, world, effectiveMaterial) => {\n if (isInstance && effectiveMaterial) {\n if (this._uniformBuffer) {\n this.transferToEffect(world);\n } else {\n effectiveMaterial.bindOnlyWorldMatrix(world);\n }\n }\n };\n if (source) {\n this._copySource(source, doNotCloneChildren, clonePhysicsImpostor);\n }\n // Parent\n if (parent !== null) {\n this.parent = parent;\n }\n this._instanceDataStorage.hardwareInstancedRendering = this.getEngine().getCaps().instancedArrays;\n this._internalMeshDataInfo._onMeshReadyObserverAdded = observer => {\n // only notify once! then unregister the observer\n observer.unregisterOnNextCall = true;\n if (this.isReady(true)) {\n this.onMeshReadyObservable.notifyObservers(this);\n } else {\n if (!this._internalMeshDataInfo._checkReadinessObserver) {\n this._internalMeshDataInfo._checkReadinessObserver = this._scene.onBeforeRenderObservable.add(() => {\n // check for complete readiness\n if (this.isReady(true)) {\n this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver);\n this._internalMeshDataInfo._checkReadinessObserver = null;\n this.onMeshReadyObservable.notifyObservers(this);\n }\n });\n }\n }\n };\n this.onMeshReadyObservable = new Observable(this._internalMeshDataInfo._onMeshReadyObserverAdded);\n if (source) {\n source.onClonedObservable.notifyObservers(this);\n }\n }\n instantiateHierarchy(newParent = null, options, onNewNodeCreated) {\n const instance = this.getTotalVertices() === 0 || options && options.doNotInstantiate && (options.doNotInstantiate === true || options.doNotInstantiate(this)) ? this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true) : this.createInstance(\"instance of \" + (this.name || this.id));\n instance.parent = newParent || this.parent;\n instance.position = this.position.clone();\n instance.scaling = this.scaling.clone();\n if (this.rotationQuaternion) {\n instance.rotationQuaternion = this.rotationQuaternion.clone();\n } else {\n instance.rotation = this.rotation.clone();\n }\n if (onNewNodeCreated) {\n onNewNodeCreated(this, instance);\n }\n for (const child of this.getChildTransformNodes(true)) {\n // instancedMesh should have a different sourced mesh\n if (child.getClassName() === \"InstancedMesh\" && instance.getClassName() === \"Mesh\" && child.sourceMesh === this) {\n child.instantiateHierarchy(instance, {\n doNotInstantiate: options && options.doNotInstantiate || false,\n newSourcedMesh: instance\n }, onNewNodeCreated);\n } else {\n child.instantiateHierarchy(instance, options, onNewNodeCreated);\n }\n }\n return instance;\n }\n /**\n * Gets the class name\n * @returns the string \"Mesh\".\n */\n getClassName() {\n return \"Mesh\";\n }\n /** @internal */\n get _isMesh() {\n return true;\n }\n /**\n * Returns a description of this mesh\n * @param fullDetails define if full details about this mesh must be used\n * @returns a descriptive string representing this mesh\n */\n toString(fullDetails) {\n let ret = super.toString(fullDetails);\n ret += \", n vertices: \" + this.getTotalVertices();\n ret += \", parent: \" + (this._waitingParentId ? this._waitingParentId : this.parent ? this.parent.name : \"NONE\");\n if (this.animations) {\n for (let i = 0; i < this.animations.length; i++) {\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\n }\n }\n if (fullDetails) {\n if (this._geometry) {\n const ib = this.getIndices();\n const vb = this.getVerticesData(VertexBuffer.PositionKind);\n if (vb && ib) {\n ret += \", flat shading: \" + (vb.length / 3 === ib.length ? \"YES\" : \"NO\");\n }\n } else {\n ret += \", flat shading: UNKNOWN\";\n }\n }\n return ret;\n }\n /** @internal */\n _unBindEffect() {\n super._unBindEffect();\n for (const instance of this.instances) {\n instance._unBindEffect();\n }\n }\n /**\n * Gets a boolean indicating if this mesh has LOD\n */\n get hasLODLevels() {\n return this._internalMeshDataInfo._LODLevels.length > 0;\n }\n /**\n * Gets the list of MeshLODLevel associated with the current mesh\n * @returns an array of MeshLODLevel\n */\n getLODLevels() {\n return this._internalMeshDataInfo._LODLevels;\n }\n _sortLODLevels() {\n const sortingOrderFactor = this._internalMeshDataInfo._useLODScreenCoverage ? -1 : 1;\n this._internalMeshDataInfo._LODLevels.sort((a, b) => {\n if (a.distanceOrScreenCoverage < b.distanceOrScreenCoverage) {\n return sortingOrderFactor;\n }\n if (a.distanceOrScreenCoverage > b.distanceOrScreenCoverage) {\n return -sortingOrderFactor;\n }\n return 0;\n });\n }\n /**\n * Add a mesh as LOD level triggered at the given distance.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param distanceOrScreenCoverage Either distance from the center of the object to show this level or the screen coverage if `useScreenCoverage` is set to `true`.\n * If screen coverage, value is a fraction of the screen's total surface, between 0 and 1.\n * Example Playground for distance https://playground.babylonjs.com/#QE7KM#197\n * Example Playground for screen coverage https://playground.babylonjs.com/#QE7KM#196\n * @param mesh The mesh to be added as LOD level (can be null)\n * @returns This mesh (for chaining)\n */\n addLODLevel(distanceOrScreenCoverage, mesh) {\n if (mesh && mesh._masterMesh) {\n Logger.Warn(\"You cannot use a mesh as LOD level twice\");\n return this;\n }\n const level = new MeshLODLevel(distanceOrScreenCoverage, mesh);\n this._internalMeshDataInfo._LODLevels.push(level);\n if (mesh) {\n mesh._masterMesh = this;\n }\n this._sortLODLevels();\n return this;\n }\n /**\n * Returns the LOD level mesh at the passed distance or null if not found.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param distance The distance from the center of the object to show this level\n * @returns a Mesh or `null`\n */\n getLODLevelAtDistance(distance) {\n const internalDataInfo = this._internalMeshDataInfo;\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n const level = internalDataInfo._LODLevels[index];\n if (level.distanceOrScreenCoverage === distance) {\n return level.mesh;\n }\n }\n return null;\n }\n /**\n * Remove a mesh from the LOD array\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param mesh defines the mesh to be removed\n * @returns This mesh (for chaining)\n */\n removeLODLevel(mesh) {\n const internalDataInfo = this._internalMeshDataInfo;\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n if (internalDataInfo._LODLevels[index].mesh === mesh) {\n internalDataInfo._LODLevels.splice(index, 1);\n if (mesh) {\n mesh._masterMesh = null;\n }\n }\n }\n this._sortLODLevels();\n return this;\n }\n /**\n * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param camera defines the camera to use to compute distance\n * @param boundingSphere defines a custom bounding sphere to use instead of the one from this mesh\n * @returns This mesh (for chaining)\n */\n getLOD(camera, boundingSphere) {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._LODLevels || internalDataInfo._LODLevels.length === 0) {\n return this;\n }\n const bSphere = boundingSphere || this.getBoundingInfo().boundingSphere;\n const distanceToCamera = camera.mode === Camera.ORTHOGRAPHIC_CAMERA ? camera.minZ : bSphere.centerWorld.subtract(camera.globalPosition).length();\n let compareValue = distanceToCamera;\n let compareSign = 1;\n if (internalDataInfo._useLODScreenCoverage) {\n const screenArea = camera.screenArea;\n let meshArea = bSphere.radiusWorld * camera.minZ / distanceToCamera;\n meshArea = meshArea * meshArea * Math.PI;\n compareValue = meshArea / screenArea;\n compareSign = -1;\n }\n if (compareSign * internalDataInfo._LODLevels[internalDataInfo._LODLevels.length - 1].distanceOrScreenCoverage > compareSign * compareValue) {\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, this);\n }\n return this;\n }\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n const level = internalDataInfo._LODLevels[index];\n if (compareSign * level.distanceOrScreenCoverage < compareSign * compareValue) {\n if (level.mesh) {\n if (level.mesh.delayLoadState === 4) {\n level.mesh._checkDelayState();\n return this;\n }\n if (level.mesh.delayLoadState === 2) {\n return this;\n }\n level.mesh._preActivate();\n level.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\n }\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, level.mesh);\n }\n return level.mesh;\n }\n }\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, this);\n }\n return this;\n }\n /**\n * Gets the mesh internal Geometry object\n */\n get geometry() {\n return this._geometry;\n }\n /**\n * Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.\n * @returns the total number of vertices\n */\n getTotalVertices() {\n if (this._geometry === null || this._geometry === undefined) {\n return 0;\n }\n return this._geometry.getTotalVertices();\n }\n /**\n * Returns the content of an associated vertex buffer\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param copyWhenShared defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one\n * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.\n */\n getVerticesData(kind, copyWhenShared, forceCopy, bypassInstanceData) {\n var _this$_userInstancedB;\n if (!this._geometry) {\n return null;\n }\n let data = bypassInstanceData ? undefined : (_this$_userInstancedB = this._userInstancedBuffersStorage) === null || _this$_userInstancedB === void 0 || (_this$_userInstancedB = _this$_userInstancedB.vertexBuffers[kind]) === null || _this$_userInstancedB === void 0 ? void 0 : _this$_userInstancedB.getFloatData(this.instances.length + 1,\n // +1 because the master mesh is not included in the instances array\n forceCopy || copyWhenShared && this._geometry.meshes.length !== 1);\n if (!data) {\n data = this._geometry.getVerticesData(kind, copyWhenShared, forceCopy);\n }\n return data;\n }\n copyVerticesData(kind, vertexData) {\n if (this._geometry) {\n this._geometry.copyVerticesData(kind, vertexData);\n }\n }\n /**\n * Returns the mesh VertexBuffer object from the requested `kind`\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.NormalKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a FloatArray or null if the mesh has no vertex buffer for this kind.\n */\n getVertexBuffer(kind, bypassInstanceData) {\n var _ref, _this$_userInstancedB2;\n if (!this._geometry) {\n return null;\n }\n return (_ref = bypassInstanceData ? undefined : (_this$_userInstancedB2 = this._userInstancedBuffersStorage) === null || _this$_userInstancedB2 === void 0 ? void 0 : _this$_userInstancedB2.vertexBuffers[kind]) !== null && _ref !== void 0 ? _ref : this._geometry.getVertexBuffer(kind);\n }\n /**\n * Tests if a specific vertex buffer is associated with this mesh\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.NormalKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a boolean\n */\n isVerticesDataPresent(kind, bypassInstanceData) {\n var _this$_userInstancedB3;\n if (!this._geometry) {\n if (this._delayInfo) {\n return this._delayInfo.indexOf(kind) !== -1;\n }\n return false;\n }\n return !bypassInstanceData && ((_this$_userInstancedB3 = this._userInstancedBuffersStorage) === null || _this$_userInstancedB3 === void 0 ? void 0 : _this$_userInstancedB3.vertexBuffers[kind]) !== undefined || this._geometry.isVerticesDataPresent(kind);\n }\n /**\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable.\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a boolean\n */\n isVertexBufferUpdatable(kind, bypassInstanceData) {\n if (!this._geometry) {\n if (this._delayInfo) {\n return this._delayInfo.indexOf(kind) !== -1;\n }\n return false;\n }\n if (!bypassInstanceData) {\n var _this$_userInstancedB4;\n const buffer = (_this$_userInstancedB4 = this._userInstancedBuffersStorage) === null || _this$_userInstancedB4 === void 0 ? void 0 : _this$_userInstancedB4.vertexBuffers[kind];\n if (buffer) {\n return buffer.isUpdatable();\n }\n }\n return this._geometry.isVertexBufferUpdatable(kind);\n }\n /**\n * Returns a string which contains the list of existing `kinds` of Vertex Data associated with this mesh.\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns an array of strings\n */\n getVerticesDataKinds(bypassInstanceData) {\n if (!this._geometry) {\n const result = [];\n if (this._delayInfo) {\n this._delayInfo.forEach(function (kind) {\n result.push(kind);\n });\n }\n return result;\n }\n const kinds = this._geometry.getVerticesDataKinds();\n if (!bypassInstanceData && this._userInstancedBuffersStorage) {\n for (const kind in this._userInstancedBuffersStorage.vertexBuffers) {\n if (kinds.indexOf(kind) === -1) {\n kinds.push(kind);\n }\n }\n }\n return kinds;\n }\n /**\n * Returns a positive integer : the total number of indices in this mesh geometry.\n * @returns the numner of indices or zero if the mesh has no geometry.\n */\n getTotalIndices() {\n if (!this._geometry) {\n return 0;\n }\n return this._geometry.getTotalIndices();\n }\n /**\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\n * @returns the indices array or an empty array if the mesh has no geometry\n */\n getIndices(copyWhenShared, forceCopy) {\n if (!this._geometry) {\n return [];\n }\n return this._geometry.getIndices(copyWhenShared, forceCopy);\n }\n get isBlocked() {\n return this._masterMesh !== null && this._masterMesh !== undefined;\n }\n /**\n * Determine if the current mesh is ready to be rendered\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\n * @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)\n * @returns true if all associated assets are ready (material, textures, shaders)\n */\n isReady(completeCheck = false, forceInstanceSupport = false) {\n if (this.delayLoadState === 2) {\n return false;\n }\n if (!super.isReady(completeCheck)) {\n return false;\n }\n if (!this.subMeshes || this.subMeshes.length === 0) {\n return true;\n }\n if (!completeCheck) {\n return true;\n }\n const engine = this.getEngine();\n const scene = this.getScene();\n const hardwareInstancedRendering = forceInstanceSupport || engine.getCaps().instancedArrays && (this.instances.length > 0 || this.hasThinInstances);\n this.computeWorldMatrix();\n const mat = this.material || scene.defaultMaterial;\n if (mat) {\n if (mat._storeEffectOnSubMeshes) {\n for (const subMesh of this.subMeshes) {\n const effectiveMaterial = subMesh.getMaterial();\n if (effectiveMaterial) {\n if (effectiveMaterial._storeEffectOnSubMeshes) {\n if (!effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\n return false;\n }\n } else {\n if (!effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\n return false;\n }\n }\n }\n }\n } else {\n if (!mat.isReady(this, hardwareInstancedRendering)) {\n return false;\n }\n }\n }\n // Shadows\n const currentRenderPassId = engine.currentRenderPassId;\n for (const light of this.lightSources) {\n const generators = light.getShadowGenerators();\n if (!generators) {\n continue;\n }\n const iterator = generators.values();\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\n var _generator$getShadowM, _generator$getShadowM2, _generator$getShadowM3;\n const generator = key.value;\n if (generator && (!((_generator$getShadowM = generator.getShadowMap()) !== null && _generator$getShadowM !== void 0 && _generator$getShadowM.renderList) || (_generator$getShadowM2 = generator.getShadowMap()) !== null && _generator$getShadowM2 !== void 0 && _generator$getShadowM2.renderList && ((_generator$getShadowM3 = generator.getShadowMap()) === null || _generator$getShadowM3 === void 0 || (_generator$getShadowM3 = _generator$getShadowM3.renderList) === null || _generator$getShadowM3 === void 0 ? void 0 : _generator$getShadowM3.indexOf(this)) !== -1)) {\n var _shadowMap$renderPass;\n const shadowMap = generator.getShadowMap();\n const renderPassIds = (_shadowMap$renderPass = shadowMap.renderPassIds) !== null && _shadowMap$renderPass !== void 0 ? _shadowMap$renderPass : [engine.currentRenderPassId];\n for (let p = 0; p < renderPassIds.length; ++p) {\n engine.currentRenderPassId = renderPassIds[p];\n for (const subMesh of this.subMeshes) {\n var _subMesh$getMaterial$, _subMesh$getMaterial;\n if (!generator.isReady(subMesh, hardwareInstancedRendering, (_subMesh$getMaterial$ = (_subMesh$getMaterial = subMesh.getMaterial()) === null || _subMesh$getMaterial === void 0 ? void 0 : _subMesh$getMaterial.needAlphaBlendingForMesh(this)) !== null && _subMesh$getMaterial$ !== void 0 ? _subMesh$getMaterial$ : false)) {\n engine.currentRenderPassId = currentRenderPassId;\n return false;\n }\n }\n }\n engine.currentRenderPassId = currentRenderPassId;\n }\n }\n }\n // LOD\n for (const lod of this._internalMeshDataInfo._LODLevels) {\n if (lod.mesh && !lod.mesh.isReady(hardwareInstancedRendering)) {\n return false;\n }\n }\n return true;\n }\n /**\n * Gets a boolean indicating if the normals aren't to be recomputed on next mesh `positions` array update. This property is pertinent only for updatable parametric shapes.\n */\n get areNormalsFrozen() {\n return this._internalMeshDataInfo._areNormalsFrozen;\n }\n /**\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next `positions` array update.\n * @returns the current mesh\n */\n freezeNormals() {\n this._internalMeshDataInfo._areNormalsFrozen = true;\n return this;\n }\n /**\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen\n * @returns the current mesh\n */\n unfreezeNormals() {\n this._internalMeshDataInfo._areNormalsFrozen = false;\n return this;\n }\n /**\n * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs\n */\n set overridenInstanceCount(count) {\n this._instanceDataStorage.overridenInstanceCount = count;\n }\n // Methods\n /** @internal */\n _preActivate() {\n const internalDataInfo = this._internalMeshDataInfo;\n const sceneRenderId = this.getScene().getRenderId();\n if (internalDataInfo._preActivateId === sceneRenderId) {\n return this;\n }\n internalDataInfo._preActivateId = sceneRenderId;\n this._instanceDataStorage.visibleInstances = null;\n return this;\n }\n /**\n * @internal\n */\n _preActivateForIntermediateRendering(renderId) {\n if (this._instanceDataStorage.visibleInstances) {\n this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = renderId;\n }\n return this;\n }\n /**\n * @internal\n */\n _registerInstanceForRenderId(instance, renderId) {\n if (!this._instanceDataStorage.visibleInstances) {\n this._instanceDataStorage.visibleInstances = {\n defaultRenderId: renderId,\n selfDefaultRenderId: this._renderId\n };\n }\n if (!this._instanceDataStorage.visibleInstances[renderId]) {\n if (this._instanceDataStorage.previousRenderId !== undefined && this._instanceDataStorage.isFrozen) {\n this._instanceDataStorage.visibleInstances[this._instanceDataStorage.previousRenderId] = null;\n }\n this._instanceDataStorage.previousRenderId = renderId;\n this._instanceDataStorage.visibleInstances[renderId] = new Array();\n }\n this._instanceDataStorage.visibleInstances[renderId].push(instance);\n return this;\n }\n _afterComputeWorldMatrix() {\n super._afterComputeWorldMatrix();\n if (!this.hasThinInstances) {\n return;\n }\n if (!this.doNotSyncBoundingInfo) {\n this.thinInstanceRefreshBoundingInfo(false);\n }\n }\n /** @internal */\n _postActivate() {\n if (this.edgesShareWithInstances && this.edgesRenderer && this.edgesRenderer.isEnabled && this._renderingGroup) {\n this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer);\n this.edgesRenderer.customInstances.push(this.getWorldMatrix());\n }\n }\n /**\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\n * This means the mesh underlying bounding box and sphere are recomputed.\n * @param applySkeletonOrOptions defines whether to apply the skeleton before computing the bounding info or a set of options\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\n * @returns the current mesh\n */\n refreshBoundingInfo(applySkeletonOrOptions = false, applyMorph = false) {\n if (this.hasBoundingInfo && this.getBoundingInfo().isLocked) {\n return this;\n }\n let options;\n if (typeof applySkeletonOrOptions === \"object\") {\n options = applySkeletonOrOptions;\n } else {\n options = {\n applySkeleton: applySkeletonOrOptions,\n applyMorph: applyMorph\n };\n }\n const bias = this.geometry ? this.geometry.boundingBias : null;\n this._refreshBoundingInfo(this._getData(options, null, VertexBuffer.PositionKind), bias);\n return this;\n }\n /**\n * @internal\n */\n _createGlobalSubMesh(force) {\n const totalVertices = this.getTotalVertices();\n if (!totalVertices || !this.getIndices()) {\n return null;\n }\n // Check if we need to recreate the submeshes\n if (this.subMeshes && this.subMeshes.length > 0) {\n const ib = this.getIndices();\n if (!ib) {\n return null;\n }\n const totalIndices = ib.length;\n let needToRecreate = false;\n if (force) {\n needToRecreate = true;\n } else {\n for (const submesh of this.subMeshes) {\n if (submesh.indexStart + submesh.indexCount > totalIndices) {\n needToRecreate = true;\n break;\n }\n if (submesh.verticesStart + submesh.verticesCount > totalVertices) {\n needToRecreate = true;\n break;\n }\n }\n }\n if (!needToRecreate) {\n return this.subMeshes[0];\n }\n }\n this.releaseSubMeshes();\n return new SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);\n }\n /**\n * This function will subdivide the mesh into multiple submeshes\n * @param count defines the expected number of submeshes\n */\n subdivide(count) {\n if (count < 1) {\n return;\n }\n const totalIndices = this.getTotalIndices();\n let subdivisionSize = totalIndices / count | 0;\n let offset = 0;\n // Ensure that subdivisionSize is a multiple of 3\n while (subdivisionSize % 3 !== 0) {\n subdivisionSize++;\n }\n this.releaseSubMeshes();\n for (let index = 0; index < count; index++) {\n if (offset >= totalIndices) {\n break;\n }\n SubMesh.CreateFromIndices(0, offset, index === count - 1 ? totalIndices - offset : subdivisionSize, this, undefined, false);\n offset += subdivisionSize;\n }\n this.refreshBoundingInfo();\n this.synchronizeInstances();\n }\n /**\n * Copy a FloatArray into a specific associated vertex buffer\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param data defines the data source\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\n * @param stride defines the data stride size (can be null)\n * @returns the current mesh\n */\n setVerticesData(kind, data, updatable = false, stride) {\n if (!this._geometry) {\n const vertexData = new VertexData();\n vertexData.set(data, kind);\n const scene = this.getScene();\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\n } else {\n this._geometry.setVerticesData(kind, data, updatable, stride);\n }\n return this;\n }\n /**\n * Delete a vertex buffer associated with this mesh\n * @param kind defines which buffer to delete (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n */\n removeVerticesData(kind) {\n if (!this._geometry) {\n return;\n }\n this._geometry.removeVerticesData(kind);\n }\n /**\n * Flags an associated vertex buffer as updatable\n * @param kind defines which buffer to use (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\n */\n markVerticesDataAsUpdatable(kind, updatable = true) {\n const vb = this.getVertexBuffer(kind);\n if (!vb || vb.isUpdatable() === updatable) {\n return;\n }\n this.setVerticesData(kind, this.getVerticesData(kind), updatable);\n }\n /**\n * Sets the mesh global Vertex Buffer\n * @param buffer defines the buffer to use\n * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)\n * @returns the current mesh\n */\n setVerticesBuffer(buffer, disposeExistingBuffer = true) {\n if (!this._geometry) {\n this._geometry = Geometry.CreateGeometryForMesh(this);\n }\n this._geometry.setVerticesBuffer(buffer, null, disposeExistingBuffer);\n return this;\n }\n /**\n * Update a specific associated vertex buffer\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param data defines the data source\n * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for \"position\" kind\n * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)\n * @returns the current mesh\n */\n updateVerticesData(kind, data, updateExtends, makeItUnique) {\n if (!this._geometry) {\n return this;\n }\n if (!makeItUnique) {\n this._geometry.updateVerticesData(kind, data, updateExtends);\n } else {\n this.makeGeometryUnique();\n this.updateVerticesData(kind, data, updateExtends, false);\n }\n return this;\n }\n /**\n * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#other-shapes-updatemeshpositions\n * @param positionFunction is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything\n * @param computeNormals is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update\n * @returns the current mesh\n */\n updateMeshPositions(positionFunction, computeNormals = true) {\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positions) {\n return this;\n }\n positionFunction(positions);\n this.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\n if (computeNormals) {\n const indices = this.getIndices();\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\n if (!normals) {\n return this;\n }\n VertexData.ComputeNormals(positions, indices, normals);\n this.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\n }\n return this;\n }\n /**\n * Creates a un-shared specific occurence of the geometry for the mesh.\n * @returns the current mesh\n */\n makeGeometryUnique() {\n if (!this._geometry) {\n return this;\n }\n if (this._geometry.meshes.length === 1) {\n return this;\n }\n const oldGeometry = this._geometry;\n const geometry = this._geometry.copy(Geometry.RandomId());\n oldGeometry.releaseForMesh(this, true);\n geometry.applyToMesh(this);\n return this;\n }\n /**\n * Sets the index buffer of this mesh.\n * @param indexBuffer Defines the index buffer to use for this mesh\n * @param totalVertices Defines the total number of vertices used by the buffer\n * @param totalIndices Defines the total number of indices in the index buffer\n */\n setIndexBuffer(indexBuffer, totalVertices, totalIndices) {\n let geometry = this._geometry;\n if (!geometry) {\n geometry = new Geometry(Geometry.RandomId(), this.getScene(), undefined, undefined, this);\n }\n geometry.setIndexBuffer(indexBuffer, totalVertices, totalIndices);\n }\n /**\n * Set the index buffer of this mesh\n * @param indices defines the source data\n * @param totalVertices defines the total number of vertices referenced by this index data (can be null)\n * @param updatable defines if the updated index buffer must be flagged as updatable (default is false)\n * @param dontForceSubMeshRecreation defines a boolean indicating that we don't want to force the recreation of sub-meshes if we don't have to (false by default)\n * @returns the current mesh\n */\n setIndices(indices, totalVertices = null, updatable = false, dontForceSubMeshRecreation = false) {\n if (!this._geometry) {\n const vertexData = new VertexData();\n vertexData.indices = indices;\n const scene = this.getScene();\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\n } else {\n this._geometry.setIndices(indices, totalVertices, updatable, dontForceSubMeshRecreation);\n }\n return this;\n }\n /**\n * Update the current index buffer\n * @param indices defines the source data\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\n * @returns the current mesh\n */\n updateIndices(indices, offset, gpuMemoryOnly = false) {\n if (!this._geometry) {\n return this;\n }\n this._geometry.updateIndices(indices, offset, gpuMemoryOnly);\n return this;\n }\n /**\n * Invert the geometry to move from a right handed system to a left handed one.\n * @returns the current mesh\n */\n toLeftHanded() {\n if (!this._geometry) {\n return this;\n }\n this._geometry.toLeftHanded();\n return this;\n }\n /**\n * @internal\n */\n _bind(subMesh, effect, fillMode, allowInstancedRendering = true) {\n if (!this._geometry) {\n return this;\n }\n const engine = this.getScene().getEngine();\n // Wireframe\n let indexToBind;\n if (this._unIndexed) {\n switch (this._getRenderingFillMode(fillMode)) {\n case Material.WireFrameFillMode:\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\n break;\n default:\n indexToBind = null;\n break;\n }\n } else {\n switch (this._getRenderingFillMode(fillMode)) {\n case Material.PointFillMode:\n indexToBind = null;\n break;\n case Material.WireFrameFillMode:\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\n break;\n default:\n case Material.TriangleFillMode:\n indexToBind = this._geometry.getIndexBuffer();\n break;\n }\n }\n return this._bindDirect(effect, indexToBind, allowInstancedRendering);\n }\n /**\n * @internal\n */\n _bindDirect(effect, indexToBind, allowInstancedRendering = true) {\n if (!this._geometry) {\n return this;\n }\n // Morph targets\n if (this.morphTargetManager && this.morphTargetManager.isUsingTextureForTargets) {\n this.morphTargetManager._bind(effect);\n }\n // VBOs\n if (!allowInstancedRendering || !this._userInstancedBuffersStorage || this.hasThinInstances) {\n this._geometry._bind(effect, indexToBind);\n } else {\n this._geometry._bind(effect, indexToBind, this._userInstancedBuffersStorage.vertexBuffers, this._userInstancedBuffersStorage.vertexArrayObjects);\n }\n return this;\n }\n /**\n * @internal\n */\n _draw(subMesh, fillMode, instancesCount) {\n if (!this._geometry || !this._geometry.getVertexBuffers() || !this._unIndexed && !this._geometry.getIndexBuffer()) {\n return this;\n }\n if (this._internalMeshDataInfo._onBeforeDrawObservable) {\n this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);\n }\n const scene = this.getScene();\n const engine = scene.getEngine();\n if (this._unIndexed && fillMode !== Material.WireFrameFillMode || fillMode == Material.PointFillMode) {\n // or triangles as points\n engine.drawArraysType(fillMode, subMesh.verticesStart, subMesh.verticesCount, this.forcedInstanceCount || instancesCount);\n } else if (fillMode == Material.WireFrameFillMode) {\n // Triangles as wireframe\n engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, this.forcedInstanceCount || instancesCount);\n } else {\n engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, this.forcedInstanceCount || instancesCount);\n }\n return this;\n }\n /**\n * Registers for this mesh a javascript function called just before the rendering process\n * @param func defines the function to call before rendering this mesh\n * @returns the current mesh\n */\n registerBeforeRender(func) {\n this.onBeforeRenderObservable.add(func);\n return this;\n }\n /**\n * Disposes a previously registered javascript function called before the rendering\n * @param func defines the function to remove\n * @returns the current mesh\n */\n unregisterBeforeRender(func) {\n this.onBeforeRenderObservable.removeCallback(func);\n return this;\n }\n /**\n * Registers for this mesh a javascript function called just after the rendering is complete\n * @param func defines the function to call after rendering this mesh\n * @returns the current mesh\n */\n registerAfterRender(func) {\n this.onAfterRenderObservable.add(func);\n return this;\n }\n /**\n * Disposes a previously registered javascript function called after the rendering.\n * @param func defines the function to remove\n * @returns the current mesh\n */\n unregisterAfterRender(func) {\n this.onAfterRenderObservable.removeCallback(func);\n return this;\n }\n /**\n * @internal\n */\n _getInstancesRenderList(subMeshId, isReplacementMode = false) {\n if (this._instanceDataStorage.isFrozen) {\n if (isReplacementMode) {\n this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[subMeshId] = false;\n this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.renderSelf[subMeshId] = true;\n return this._instanceDataStorage.batchCacheReplacementModeInFrozenMode;\n }\n if (this._instanceDataStorage.previousBatch) {\n return this._instanceDataStorage.previousBatch;\n }\n }\n const scene = this.getScene();\n const isInIntermediateRendering = scene._isInIntermediateRendering();\n const onlyForInstances = isInIntermediateRendering ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate : this._internalAbstractMeshDataInfo._onlyForInstances;\n const batchCache = this._instanceDataStorage.batchCache;\n batchCache.mustReturn = false;\n batchCache.renderSelf[subMeshId] = isReplacementMode || !onlyForInstances && this.isEnabled() && this.isVisible;\n batchCache.visibleInstances[subMeshId] = null;\n if (this._instanceDataStorage.visibleInstances && !isReplacementMode) {\n const visibleInstances = this._instanceDataStorage.visibleInstances;\n const currentRenderId = scene.getRenderId();\n const defaultRenderId = isInIntermediateRendering ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId;\n batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];\n if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {\n batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];\n }\n }\n batchCache.hardwareInstancedRendering[subMeshId] = !isReplacementMode && this._instanceDataStorage.hardwareInstancedRendering && batchCache.visibleInstances[subMeshId] !== null && batchCache.visibleInstances[subMeshId] !== undefined;\n this._instanceDataStorage.previousBatch = batchCache;\n return batchCache;\n }\n /**\n * @internal\n */\n _renderWithInstances(subMesh, fillMode, batch, effect, engine) {\n const visibleInstances = batch.visibleInstances[subMesh._id];\n const visibleInstanceCount = visibleInstances ? visibleInstances.length : 0;\n const instanceStorage = this._instanceDataStorage;\n const currentInstancesBufferSize = instanceStorage.instancesBufferSize;\n let instancesBuffer = instanceStorage.instancesBuffer;\n let instancesPreviousBuffer = instanceStorage.instancesPreviousBuffer;\n const matricesCount = visibleInstanceCount + 1;\n const bufferSize = matricesCount * 16 * 4;\n while (instanceStorage.instancesBufferSize < bufferSize) {\n instanceStorage.instancesBufferSize *= 2;\n }\n if (!instanceStorage.instancesData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\n instanceStorage.instancesData = new Float32Array(instanceStorage.instancesBufferSize / 4);\n }\n if (this._scene.needsPreviousWorldMatrices && !instanceStorage.instancesPreviousData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\n instanceStorage.instancesPreviousData = new Float32Array(instanceStorage.instancesBufferSize / 4);\n }\n let offset = 0;\n let instancesCount = 0;\n const renderSelf = batch.renderSelf[subMesh._id];\n const needUpdateBuffer = !instancesBuffer || currentInstancesBufferSize !== instanceStorage.instancesBufferSize || this._scene.needsPreviousWorldMatrices && !instanceStorage.instancesPreviousBuffer;\n if (!this._instanceDataStorage.manualUpdate && (!instanceStorage.isFrozen || needUpdateBuffer)) {\n const world = this.getWorldMatrix();\n if (renderSelf) {\n if (this._scene.needsPreviousWorldMatrices) {\n if (!instanceStorage.masterMeshPreviousWorldMatrix) {\n instanceStorage.masterMeshPreviousWorldMatrix = world.clone();\n instanceStorage.masterMeshPreviousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n } else {\n instanceStorage.masterMeshPreviousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n instanceStorage.masterMeshPreviousWorldMatrix.copyFrom(world);\n }\n }\n world.copyToArray(instanceStorage.instancesData, offset);\n offset += 16;\n instancesCount++;\n }\n if (visibleInstances) {\n var _subMesh$getMaterial2;\n if (Mesh.INSTANCEDMESH_SORT_TRANSPARENT && this._scene.activeCamera && (_subMesh$getMaterial2 = subMesh.getMaterial()) !== null && _subMesh$getMaterial2 !== void 0 && _subMesh$getMaterial2.needAlphaBlendingForMesh(subMesh.getRenderingMesh())) {\n const cameraPosition = this._scene.activeCamera.globalPosition;\n for (let instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\n const instanceMesh = visibleInstances[instanceIndex];\n instanceMesh._distanceToCamera = Vector3.Distance(instanceMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);\n }\n visibleInstances.sort((m1, m2) => {\n return m1._distanceToCamera > m2._distanceToCamera ? -1 : m1._distanceToCamera < m2._distanceToCamera ? 1 : 0;\n });\n }\n for (let instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\n const instance = visibleInstances[instanceIndex];\n const matrix = instance.getWorldMatrix();\n matrix.copyToArray(instanceStorage.instancesData, offset);\n if (this._scene.needsPreviousWorldMatrices) {\n if (!instance._previousWorldMatrix) {\n instance._previousWorldMatrix = matrix.clone();\n instance._previousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n } else {\n instance._previousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n instance._previousWorldMatrix.copyFrom(matrix);\n }\n }\n offset += 16;\n instancesCount++;\n }\n }\n } else {\n instancesCount = (renderSelf ? 1 : 0) + visibleInstanceCount;\n }\n if (needUpdateBuffer) {\n if (instancesBuffer) {\n instancesBuffer.dispose();\n }\n if (instancesPreviousBuffer) {\n instancesPreviousBuffer.dispose();\n }\n instancesBuffer = new Buffer(engine, instanceStorage.instancesData, true, 16, false, true);\n instanceStorage.instancesBuffer = instancesBuffer;\n if (!this._userInstancedBuffersStorage) {\n this._userInstancedBuffersStorage = {\n data: {},\n vertexBuffers: {},\n strides: {},\n sizes: {},\n vertexArrayObjects: this.getEngine().getCaps().vertexArrayObject ? {} : undefined\n };\n }\n this._userInstancedBuffersStorage.vertexBuffers[\"world0\"] = instancesBuffer.createVertexBuffer(\"world0\", 0, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world1\"] = instancesBuffer.createVertexBuffer(\"world1\", 4, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world2\"] = instancesBuffer.createVertexBuffer(\"world2\", 8, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world3\"] = instancesBuffer.createVertexBuffer(\"world3\", 12, 4);\n if (this._scene.needsPreviousWorldMatrices) {\n instancesPreviousBuffer = new Buffer(engine, instanceStorage.instancesPreviousData, true, 16, false, true);\n instanceStorage.instancesPreviousBuffer = instancesPreviousBuffer;\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld0\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld0\", 0, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld1\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld1\", 4, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld2\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld2\", 8, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld3\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld3\", 12, 4);\n }\n this._invalidateInstanceVertexArrayObject();\n } else {\n if (!this._instanceDataStorage.isFrozen || this._instanceDataStorage.forceMatrixUpdates) {\n instancesBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\n if (this._scene.needsPreviousWorldMatrices && (!this._instanceDataStorage.manualUpdate || this._instanceDataStorage.previousManualUpdate)) {\n instancesPreviousBuffer.updateDirectly(instanceStorage.instancesPreviousData, 0, instancesCount);\n }\n }\n }\n this._processInstancedBuffers(visibleInstances, renderSelf);\n // Stats\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\n // Draw\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = true;\n }\n this._bind(subMesh, effect, fillMode);\n this._draw(subMesh, fillMode, instancesCount);\n // Write current matrices as previous matrices in case of manual update\n // Default behaviour when previous matrices are not specified explicitly\n // Will break if instances number/order changes\n if (this._scene.needsPreviousWorldMatrices && !needUpdateBuffer && this._instanceDataStorage.manualUpdate && (!this._instanceDataStorage.isFrozen || this._instanceDataStorage.forceMatrixUpdates) && !this._instanceDataStorage.previousManualUpdate) {\n instancesPreviousBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\n }\n engine.unbindInstanceAttributes();\n return this;\n }\n /**\n * @internal\n */\n _renderWithThinInstances(subMesh, fillMode, effect, engine) {\n var _this$_thinInstanceDa, _this$_thinInstanceDa2;\n // Stats\n const instancesCount = (_this$_thinInstanceDa = (_this$_thinInstanceDa2 = this._thinInstanceDataStorage) === null || _this$_thinInstanceDa2 === void 0 ? void 0 : _this$_thinInstanceDa2.instancesCount) !== null && _this$_thinInstanceDa !== void 0 ? _this$_thinInstanceDa : 0;\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\n // Draw\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = true;\n }\n this._bind(subMesh, effect, fillMode);\n this._draw(subMesh, fillMode, instancesCount);\n // Write current matrices as previous matrices\n // Default behaviour when previous matrices are not specified explicitly\n // Will break if instances number/order changes\n if (this._scene.needsPreviousWorldMatrices && !this._thinInstanceDataStorage.previousMatrixData && this._thinInstanceDataStorage.matrixData) {\n if (!this._thinInstanceDataStorage.previousMatrixBuffer) {\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", this._thinInstanceDataStorage.matrixData, false);\n } else {\n this._thinInstanceDataStorage.previousMatrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData, 0, instancesCount);\n }\n }\n engine.unbindInstanceAttributes();\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _processInstancedBuffers(visibleInstances, renderSelf) {\n // Do nothing\n }\n /**\n * @internal\n */\n _processRendering(renderingMesh, subMesh, effect, fillMode, batch, hardwareInstancedRendering, onBeforeDraw, effectiveMaterial) {\n const scene = this.getScene();\n const engine = scene.getEngine();\n fillMode = this._getRenderingFillMode(fillMode);\n if (hardwareInstancedRendering && subMesh.getRenderingMesh().hasThinInstances) {\n this._renderWithThinInstances(subMesh, fillMode, effect, engine);\n return this;\n }\n if (hardwareInstancedRendering) {\n this._renderWithInstances(subMesh, fillMode, batch, effect, engine);\n } else {\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = false;\n }\n let instanceCount = 0;\n if (batch.renderSelf[subMesh._id]) {\n // Draw\n if (onBeforeDraw) {\n onBeforeDraw(false, renderingMesh.getWorldMatrix(), effectiveMaterial);\n }\n instanceCount++;\n this._draw(subMesh, fillMode, this._instanceDataStorage.overridenInstanceCount);\n }\n const visibleInstancesForSubMesh = batch.visibleInstances[subMesh._id];\n if (visibleInstancesForSubMesh) {\n const visibleInstanceCount = visibleInstancesForSubMesh.length;\n instanceCount += visibleInstanceCount;\n // Stats\n for (let instanceIndex = 0; instanceIndex < visibleInstanceCount; instanceIndex++) {\n const instance = visibleInstancesForSubMesh[instanceIndex];\n // World\n const world = instance.getWorldMatrix();\n if (onBeforeDraw) {\n onBeforeDraw(true, world, effectiveMaterial);\n }\n // Draw\n this._draw(subMesh, fillMode);\n }\n }\n // Stats\n scene._activeIndices.addCount(subMesh.indexCount * instanceCount, false);\n }\n return this;\n }\n /**\n * @internal\n */\n _rebuild(dispose = false) {\n if (this._instanceDataStorage.instancesBuffer) {\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\n if (dispose) {\n this._instanceDataStorage.instancesBuffer.dispose();\n }\n this._instanceDataStorage.instancesBuffer = null;\n }\n if (this._userInstancedBuffersStorage) {\n for (const kind in this._userInstancedBuffersStorage.vertexBuffers) {\n const buffer = this._userInstancedBuffersStorage.vertexBuffers[kind];\n if (buffer) {\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\n if (dispose) {\n buffer.dispose();\n }\n this._userInstancedBuffersStorage.vertexBuffers[kind] = null;\n }\n }\n if (this._userInstancedBuffersStorage.vertexArrayObjects) {\n this._userInstancedBuffersStorage.vertexArrayObjects = {};\n }\n }\n this._internalMeshDataInfo._effectiveMaterial = null;\n super._rebuild(dispose);\n }\n /** @internal */\n _freeze() {\n if (!this.subMeshes) {\n return;\n }\n // Prepare batches\n for (let index = 0; index < this.subMeshes.length; index++) {\n this._getInstancesRenderList(index);\n }\n this._internalMeshDataInfo._effectiveMaterial = null;\n this._instanceDataStorage.isFrozen = true;\n }\n /** @internal */\n _unFreeze() {\n this._instanceDataStorage.isFrozen = false;\n this._instanceDataStorage.previousBatch = null;\n }\n /**\n * Triggers the draw call for the mesh (or a submesh), for a specific render pass id\n * @param renderPassId defines the render pass id to use to draw the mesh / submesh. If not provided, use the current renderPassId of the engine.\n * @param enableAlphaMode defines if alpha mode can be changed (default: false)\n * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering (default: undefined)\n * @param subMesh defines the subMesh to render. If not provided, draw all mesh submeshes (default: undefined)\n * @param checkFrustumCulling defines if frustum culling must be checked (default: true). If you know the mesh is in the frustum (or if you don't care!), you can pass false to optimize.\n * @returns the current mesh\n */\n renderWithRenderPassId(renderPassId, enableAlphaMode, effectiveMeshReplacement, subMesh, checkFrustumCulling = true) {\n const engine = this._scene.getEngine();\n const currentRenderPassId = engine.currentRenderPassId;\n if (renderPassId !== undefined) {\n engine.currentRenderPassId = renderPassId;\n }\n if (subMesh) {\n if (!checkFrustumCulling || checkFrustumCulling && subMesh.isInFrustum(this._scene._frustumPlanes)) {\n this.render(subMesh, !!enableAlphaMode, effectiveMeshReplacement);\n }\n } else {\n for (let s = 0; s < this.subMeshes.length; s++) {\n const subMesh = this.subMeshes[s];\n if (!checkFrustumCulling || checkFrustumCulling && subMesh.isInFrustum(this._scene._frustumPlanes)) {\n this.render(subMesh, !!enableAlphaMode, effectiveMeshReplacement);\n }\n }\n }\n if (renderPassId !== undefined) {\n engine.currentRenderPassId = currentRenderPassId;\n }\n return this;\n }\n /**\n * Render a complete mesh by going through all submeshes\n * @returns the current mesh\n * #5SPY1V#2: simple test\n * #5SPY1V#5: perf test\n */\n directRender() {\n if (!this.subMeshes) {\n return this;\n }\n for (const submesh of this.subMeshes) {\n this.render(submesh, false);\n }\n return this;\n }\n /**\n * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager\n * @param subMesh defines the subMesh to render\n * @param enableAlphaMode defines if alpha mode can be changed\n * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering\n * @returns the current mesh\n */\n render(subMesh, enableAlphaMode, effectiveMeshReplacement) {\n var _scene$activeCameras$, _scene$activeCameras, _subMesh$_drawWrapper, _drawWrapper$effect, _drawWrapper;\n const scene = this.getScene();\n if (this._internalAbstractMeshDataInfo._isActiveIntermediate) {\n this._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n } else {\n this._internalAbstractMeshDataInfo._isActive = false;\n }\n const numActiveCameras = (_scene$activeCameras$ = (_scene$activeCameras = scene.activeCameras) === null || _scene$activeCameras === void 0 ? void 0 : _scene$activeCameras.length) !== null && _scene$activeCameras$ !== void 0 ? _scene$activeCameras$ : 0;\n const canCheckOcclusionQuery = numActiveCameras > 1 && scene.activeCamera === scene.activeCameras[0] || numActiveCameras <= 1;\n if (canCheckOcclusionQuery && this._checkOcclusionQuery() && !this._occlusionDataStorage.forceRenderingWhenOccluded) {\n return this;\n }\n // Managing instances\n const batch = this._getInstancesRenderList(subMesh._id, !!effectiveMeshReplacement);\n if (batch.mustReturn) {\n return this;\n }\n // Checking geometry state\n if (!this._geometry || !this._geometry.getVertexBuffers() || !this._unIndexed && !this._geometry.getIndexBuffer()) {\n return this;\n }\n const engine = scene.getEngine();\n let oldCameraMaxZ = 0;\n let oldCamera = null;\n if (this.ignoreCameraMaxZ && scene.activeCamera && !scene._isInIntermediateRendering()) {\n oldCameraMaxZ = scene.activeCamera.maxZ;\n oldCamera = scene.activeCamera;\n scene.activeCamera.maxZ = 0;\n scene.updateTransformMatrix(true);\n }\n if (this._internalMeshDataInfo._onBeforeRenderObservable) {\n this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);\n }\n const renderingMesh = subMesh.getRenderingMesh();\n const hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id] || renderingMesh.hasThinInstances || !!this._userInstancedBuffersStorage && !subMesh.getMesh()._internalAbstractMeshDataInfo._actAsRegularMesh;\n const instanceDataStorage = this._instanceDataStorage;\n const material = subMesh.getMaterial();\n if (!material) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n // Material\n if (!instanceDataStorage.isFrozen || !this._internalMeshDataInfo._effectiveMaterial || this._internalMeshDataInfo._effectiveMaterial !== material) {\n if (material._storeEffectOnSubMeshes) {\n if (!material.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n } else if (!material.isReady(this, hardwareInstancedRendering)) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n this._internalMeshDataInfo._effectiveMaterial = material;\n } else if (material._storeEffectOnSubMeshes && !((_subMesh$_drawWrapper = subMesh._drawWrapper) !== null && _subMesh$_drawWrapper !== void 0 && _subMesh$_drawWrapper._wasPreviouslyReady) || !material._storeEffectOnSubMeshes && !material._getDrawWrapper()._wasPreviouslyReady) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n // Alpha mode\n if (enableAlphaMode) {\n engine.setAlphaMode(this._internalMeshDataInfo._effectiveMaterial.alphaMode);\n }\n let drawWrapper;\n if (this._internalMeshDataInfo._effectiveMaterial._storeEffectOnSubMeshes) {\n drawWrapper = subMesh._drawWrapper;\n } else {\n drawWrapper = this._internalMeshDataInfo._effectiveMaterial._getDrawWrapper();\n }\n const effect = (_drawWrapper$effect = (_drawWrapper = drawWrapper) === null || _drawWrapper === void 0 ? void 0 : _drawWrapper.effect) !== null && _drawWrapper$effect !== void 0 ? _drawWrapper$effect : null;\n for (const step of scene._beforeRenderingMeshStage) {\n step.action(this, subMesh, batch, effect);\n }\n if (!drawWrapper || !effect) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n const effectiveMesh = effectiveMeshReplacement || this;\n let sideOrientation;\n if (!instanceDataStorage.isFrozen && (this._internalMeshDataInfo._effectiveMaterial.backFaceCulling || this._internalMeshDataInfo._effectiveMaterial.sideOrientation !== null || this._internalMeshDataInfo._effectiveMaterial.twoSidedLighting)) {\n // Note: if two sided lighting is enabled, we need to ensure that the normal will point in the right direction even if the determinant of the world matrix is negative\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n sideOrientation = this._internalMeshDataInfo._effectiveMaterial._getEffectiveOrientation(this);\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n instanceDataStorage.sideOrientation = sideOrientation;\n } else {\n sideOrientation = instanceDataStorage.sideOrientation;\n }\n const reverse = this._internalMeshDataInfo._effectiveMaterial._preBind(drawWrapper, sideOrientation);\n if (this._internalMeshDataInfo._effectiveMaterial.forceDepthWrite) {\n engine.setDepthWrite(true);\n }\n // Bind\n const effectiveMaterial = this._internalMeshDataInfo._effectiveMaterial;\n const fillMode = effectiveMaterial.fillMode;\n if (this._internalMeshDataInfo._onBeforeBindObservable) {\n this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this);\n }\n if (!hardwareInstancedRendering) {\n // Binding will be done later because we need to add more info to the VB\n this._bind(subMesh, effect, fillMode, false);\n }\n const world = effectiveMesh.getWorldMatrix();\n if (effectiveMaterial._storeEffectOnSubMeshes) {\n effectiveMaterial.bindForSubMesh(world, this, subMesh);\n } else {\n effectiveMaterial.bind(world, this);\n }\n if (!effectiveMaterial.backFaceCulling && effectiveMaterial.separateCullingPass) {\n engine.setState(true, effectiveMaterial.zOffset, false, !reverse, effectiveMaterial.cullBackFaces, effectiveMaterial.stencil, effectiveMaterial.zOffsetUnits);\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._internalMeshDataInfo._effectiveMaterial);\n engine.setState(true, effectiveMaterial.zOffset, false, reverse, effectiveMaterial.cullBackFaces, effectiveMaterial.stencil, effectiveMaterial.zOffsetUnits);\n if (this._internalMeshDataInfo._onBetweenPassObservable) {\n this._internalMeshDataInfo._onBetweenPassObservable.notifyObservers(subMesh);\n }\n }\n // Draw\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._internalMeshDataInfo._effectiveMaterial);\n // Unbind\n this._internalMeshDataInfo._effectiveMaterial.unbind();\n for (const step of scene._afterRenderingMeshStage) {\n step.action(this, subMesh, batch, effect);\n }\n if (this._internalMeshDataInfo._onAfterRenderObservable) {\n this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this);\n }\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n if (scene.performancePriority === 2 /* ScenePerformancePriority.Aggressive */ && !instanceDataStorage.isFrozen) {\n this._freeze();\n }\n return this;\n }\n /**\n * Renormalize the mesh and patch it up if there are no weights\n * Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1.\n * However in the case of zero weights then we set just a single influence to 1.\n * We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.\n */\n cleanMatrixWeights() {\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsExtraKind)) {\n this._normalizeSkinWeightsAndExtra();\n } else {\n this._normalizeSkinFourWeights();\n }\n }\n }\n // faster 4 weight version.\n _normalizeSkinFourWeights() {\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n const numWeights = matricesWeights.length;\n for (let a = 0; a < numWeights; a += 4) {\n // accumulate weights\n const t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n matricesWeights[a] = 1;\n } else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n matricesWeights[a] *= recip;\n matricesWeights[a + 1] *= recip;\n matricesWeights[a + 2] *= recip;\n matricesWeights[a + 3] *= recip;\n }\n }\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\n }\n // handle special case of extra verts. (in theory gltf can handle 12 influences)\n _normalizeSkinWeightsAndExtra() {\n const matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n const numWeights = matricesWeights.length;\n for (let a = 0; a < numWeights; a += 4) {\n // accumulate weights\n let t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\n t += matricesWeightsExtra[a] + matricesWeightsExtra[a + 1] + matricesWeightsExtra[a + 2] + matricesWeightsExtra[a + 3];\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n matricesWeights[a] = 1;\n } else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n matricesWeights[a] *= recip;\n matricesWeights[a + 1] *= recip;\n matricesWeights[a + 2] *= recip;\n matricesWeights[a + 3] *= recip;\n // same goes for extras\n matricesWeightsExtra[a] *= recip;\n matricesWeightsExtra[a + 1] *= recip;\n matricesWeightsExtra[a + 2] *= recip;\n matricesWeightsExtra[a + 3] *= recip;\n }\n }\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsExtra);\n }\n /**\n * ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights,\n * or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let\n * the user know there was an issue with importing the mesh\n * @returns a validation object with skinned, valid and report string\n */\n validateSkinning() {\n const matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n if (matricesWeights === null || this.skeleton == null) {\n return {\n skinned: false,\n valid: true,\n report: \"not skinned\"\n };\n }\n const numWeights = matricesWeights.length;\n let numberNotSorted = 0;\n let missingWeights = 0;\n let maxUsedWeights = 0;\n let numberNotNormalized = 0;\n const numInfluences = matricesWeightsExtra === null ? 4 : 8;\n const usedWeightCounts = [];\n for (let a = 0; a <= numInfluences; a++) {\n usedWeightCounts[a] = 0;\n }\n const toleranceEpsilon = 0.001;\n for (let a = 0; a < numWeights; a += 4) {\n let lastWeight = matricesWeights[a];\n let t = lastWeight;\n let usedWeights = t === 0 ? 0 : 1;\n for (let b = 1; b < numInfluences; b++) {\n const d = b < 4 ? matricesWeights[a + b] : matricesWeightsExtra[a + b - 4];\n if (d > lastWeight) {\n numberNotSorted++;\n }\n if (d !== 0) {\n usedWeights++;\n }\n t += d;\n lastWeight = d;\n }\n // count the buffer weights usage\n usedWeightCounts[usedWeights]++;\n // max influences\n if (usedWeights > maxUsedWeights) {\n maxUsedWeights = usedWeights;\n }\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n missingWeights++;\n } else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n let tolerance = 0;\n for (let b = 0; b < numInfluences; b++) {\n if (b < 4) {\n tolerance += Math.abs(matricesWeights[a + b] - matricesWeights[a + b] * recip);\n } else {\n tolerance += Math.abs(matricesWeightsExtra[a + b - 4] - matricesWeightsExtra[a + b - 4] * recip);\n }\n }\n // arbitrary epsilon value for dictating not normalized\n if (tolerance > toleranceEpsilon) {\n numberNotNormalized++;\n }\n }\n }\n // validate bone indices are in range of the skeleton\n const numBones = this.skeleton.bones.length;\n const matricesIndices = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\n const matricesIndicesExtra = this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\n let numBadBoneIndices = 0;\n for (let a = 0; a < numWeights; a += 4) {\n for (let b = 0; b < numInfluences; b++) {\n const index = b < 4 ? matricesIndices[a + b] : matricesIndicesExtra[a + b - 4];\n if (index >= numBones || index < 0) {\n numBadBoneIndices++;\n }\n }\n }\n // log mesh stats\n const output = \"Number of Weights = \" + numWeights / 4 + \"\\nMaximum influences = \" + maxUsedWeights + \"\\nMissing Weights = \" + missingWeights + \"\\nNot Sorted = \" + numberNotSorted + \"\\nNot Normalized = \" + numberNotNormalized + \"\\nWeightCounts = [\" + usedWeightCounts + \"]\" + \"\\nNumber of bones = \" + numBones + \"\\nBad Bone Indices = \" + numBadBoneIndices;\n return {\n skinned: true,\n valid: missingWeights === 0 && numberNotNormalized === 0 && numBadBoneIndices === 0,\n report: output\n };\n }\n /** @internal */\n _checkDelayState() {\n const scene = this.getScene();\n if (this._geometry) {\n this._geometry.load(scene);\n } else if (this.delayLoadState === 4) {\n this.delayLoadState = 2;\n this._queueLoad(scene);\n }\n return this;\n }\n _queueLoad(scene) {\n scene.addPendingData(this);\n const getBinaryData = this.delayLoadingFile.indexOf(\".babylonbinarymeshdata\") !== -1;\n Tools.LoadFile(this.delayLoadingFile, data => {\n if (data instanceof ArrayBuffer) {\n this._delayLoadingFunction(data, this);\n } else {\n this._delayLoadingFunction(JSON.parse(data), this);\n }\n this.instances.forEach(instance => {\n instance.refreshBoundingInfo();\n instance._syncSubMeshes();\n });\n this.delayLoadState = 1;\n scene.removePendingData(this);\n }, () => {}, scene.offlineProvider, getBinaryData);\n return this;\n }\n /**\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\n * A mesh is in the frustum if its bounding box intersects the frustum\n * @param frustumPlanes defines the frustum to test\n * @returns true if the mesh is in the frustum planes\n */\n isInFrustum(frustumPlanes) {\n if (this.delayLoadState === 2) {\n return false;\n }\n if (!super.isInFrustum(frustumPlanes)) {\n return false;\n }\n this._checkDelayState();\n return true;\n }\n /**\n * Sets the mesh material by the material or multiMaterial `id` property\n * @param id is a string identifying the material or the multiMaterial\n * @returns the current mesh\n */\n setMaterialById(id) {\n const materials = this.getScene().materials;\n let index;\n for (index = materials.length - 1; index > -1; index--) {\n if (materials[index].id === id) {\n this.material = materials[index];\n return this;\n }\n }\n // Multi\n const multiMaterials = this.getScene().multiMaterials;\n for (index = multiMaterials.length - 1; index > -1; index--) {\n if (multiMaterials[index].id === id) {\n this.material = multiMaterials[index];\n return this;\n }\n }\n return this;\n }\n /**\n * Returns as a new array populated with the mesh material and/or skeleton, if any.\n * @returns an array of IAnimatable\n */\n getAnimatables() {\n const results = [];\n if (this.material) {\n results.push(this.material);\n }\n if (this.skeleton) {\n results.push(this.skeleton);\n }\n return results;\n }\n /**\n * Modifies the mesh geometry according to the passed transformation matrix.\n * This method returns nothing, but it really modifies the mesh even if it's originally not set as updatable.\n * The mesh normals are modified using the same transformation.\n * Note that, under the hood, this method sets a new VertexBuffer each call.\n * @param transform defines the transform matrix to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/bakingTransforms\n * @returns the current mesh\n */\n bakeTransformIntoVertices(transform) {\n // Position\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\n return this;\n }\n const submeshes = this.subMeshes.splice(0);\n this._resetPointsArrayCache();\n let data = this.getVerticesData(VertexBuffer.PositionKind);\n const temp = Vector3.Zero();\n let index;\n for (index = 0; index < data.length; index += 3) {\n Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], transform, temp).toArray(data, index);\n }\n this.setVerticesData(VertexBuffer.PositionKind, data, this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable());\n // Normals\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\n data = this.getVerticesData(VertexBuffer.NormalKind);\n for (index = 0; index < data.length; index += 3) {\n Vector3.TransformNormalFromFloatsToRef(data[index], data[index + 1], data[index + 2], transform, temp).normalize().toArray(data, index);\n }\n this.setVerticesData(VertexBuffer.NormalKind, data, this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable());\n }\n // Tangents\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\n data = this.getVerticesData(VertexBuffer.TangentKind);\n for (index = 0; index < data.length; index += 4) {\n Vector3.TransformNormalFromFloatsToRef(data[index], data[index + 1], data[index + 2], transform, temp).normalize().toArray(data, index);\n }\n this.setVerticesData(VertexBuffer.TangentKind, data, this.getVertexBuffer(VertexBuffer.TangentKind).isUpdatable());\n }\n // flip faces?\n if (transform.determinant() < 0) {\n this.flipFaces();\n }\n // Restore submeshes\n this.releaseSubMeshes();\n this.subMeshes = submeshes;\n return this;\n }\n /**\n * Modifies the mesh geometry according to its own current World Matrix.\n * The mesh World Matrix is then reset.\n * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.\n * Note that, under the hood, this method sets a new VertexBuffer each call.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/bakingTransforms\n * @param bakeIndependentlyOfChildren indicates whether to preserve all child nodes' World Matrix during baking\n * @returns the current mesh\n */\n bakeCurrentTransformIntoVertices(bakeIndependentlyOfChildren = true) {\n this.bakeTransformIntoVertices(this.computeWorldMatrix(true));\n this.resetLocalMatrix(bakeIndependentlyOfChildren);\n return this;\n }\n // Cache\n /** @internal */\n get _positions() {\n return this._internalAbstractMeshDataInfo._positions || this._geometry && this._geometry._positions || null;\n }\n /** @internal */\n _resetPointsArrayCache() {\n if (this._geometry) {\n this._geometry._resetPointsArrayCache();\n }\n return this;\n }\n /** @internal */\n _generatePointsArray() {\n if (this._geometry) {\n return this._geometry._generatePointsArray();\n }\n return false;\n }\n /**\n * Returns a new Mesh object generated from the current mesh properties.\n * This method must not get confused with createInstance()\n * @param name is a string, the name given to the new mesh\n * @param newParent can be any Node object (default `null`)\n * @param doNotCloneChildren allows/denies the recursive cloning of the original mesh children if any (default `false`)\n * @param clonePhysicsImpostor allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any (default `true`)\n * @returns a new mesh\n */\n clone(name = \"\", newParent = null, doNotCloneChildren, clonePhysicsImpostor = true) {\n return new Mesh(name, this.getScene(), newParent, this, doNotCloneChildren, clonePhysicsImpostor);\n }\n /**\n * Releases resources associated with this mesh.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n this.morphTargetManager = null;\n if (this._geometry) {\n this._geometry.releaseForMesh(this, true);\n }\n const internalDataInfo = this._internalMeshDataInfo;\n if (internalDataInfo._onBeforeDrawObservable) {\n internalDataInfo._onBeforeDrawObservable.clear();\n }\n if (internalDataInfo._onBeforeBindObservable) {\n internalDataInfo._onBeforeBindObservable.clear();\n }\n if (internalDataInfo._onBeforeRenderObservable) {\n internalDataInfo._onBeforeRenderObservable.clear();\n }\n if (internalDataInfo._onAfterRenderObservable) {\n internalDataInfo._onAfterRenderObservable.clear();\n }\n if (internalDataInfo._onBetweenPassObservable) {\n internalDataInfo._onBetweenPassObservable.clear();\n }\n // Sources\n if (this._scene.useClonedMeshMap) {\n if (internalDataInfo.meshMap) {\n for (const uniqueId in internalDataInfo.meshMap) {\n const mesh = internalDataInfo.meshMap[uniqueId];\n if (mesh) {\n mesh._internalMeshDataInfo._source = null;\n internalDataInfo.meshMap[uniqueId] = undefined;\n }\n }\n }\n if (internalDataInfo._source && internalDataInfo._source._internalMeshDataInfo.meshMap) {\n internalDataInfo._source._internalMeshDataInfo.meshMap[this.uniqueId] = undefined;\n }\n } else {\n const meshes = this.getScene().meshes;\n for (const abstractMesh of meshes) {\n const mesh = abstractMesh;\n if (mesh._internalMeshDataInfo && mesh._internalMeshDataInfo._source && mesh._internalMeshDataInfo._source === this) {\n mesh._internalMeshDataInfo._source = null;\n }\n }\n }\n internalDataInfo._source = null;\n this._instanceDataStorage.visibleInstances = {};\n // Instances\n this._disposeInstanceSpecificData();\n // Thin instances\n this._disposeThinInstanceSpecificData();\n if (this._internalMeshDataInfo._checkReadinessObserver) {\n this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver);\n }\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /** @internal */\n _disposeInstanceSpecificData() {\n // Do nothing\n }\n /** @internal */\n _disposeThinInstanceSpecificData() {\n // Do nothing\n }\n /** @internal */\n _invalidateInstanceVertexArrayObject() {\n // Do nothing\n }\n /**\n * Modifies the mesh geometry according to a displacement map.\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\n * @param url is a string, the URL from the image file is to be downloaded.\n * @param minHeight is the lower limit of the displacement.\n * @param maxHeight is the upper limit of the displacement.\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\n * @param uvOffset is an optional vector2 used to offset UV.\n * @param uvScale is an optional vector2 used to scale UV.\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\n * @param onError defines a callback called when an error occurs during the processing of the request.\n * @returns the Mesh.\n */\n applyDisplacementMap(url, minHeight, maxHeight, onSuccess, uvOffset, uvScale, forceUpdate = false, onError) {\n const scene = this.getScene();\n const onload = img => {\n // Getting height map data\n const heightMapWidth = img.width;\n const heightMapHeight = img.height;\n const canvas = this.getEngine().createCanvas(heightMapWidth, heightMapHeight);\n const context = canvas.getContext(\"2d\");\n context.drawImage(img, 0, 0);\n // Create VertexData from map data\n //Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\n const buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;\n this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate);\n //execute success callback, if set\n if (onSuccess) {\n onSuccess(this);\n }\n };\n Tools.LoadImage(url, onload, onError ? onError : () => {}, scene.offlineProvider);\n return this;\n }\n /**\n * Modifies the mesh geometry according to a displacementMap buffer.\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\n * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.\n * @param heightMapWidth is the width of the buffer image.\n * @param heightMapHeight is the height of the buffer image.\n * @param minHeight is the lower limit of the displacement.\n * @param maxHeight is the upper limit of the displacement.\n * @param uvOffset is an optional vector2 used to offset UV.\n * @param uvScale is an optional vector2 used to scale UV.\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\n * @returns the Mesh.\n */\n applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate = false) {\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind) || !this.isVerticesDataPresent(VertexBuffer.NormalKind) || !this.isVerticesDataPresent(VertexBuffer.UVKind)) {\n Logger.Warn(\"Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing\");\n return this;\n }\n const positions = this.getVerticesData(VertexBuffer.PositionKind, true, true);\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\n const uvs = this.getVerticesData(VertexBuffer.UVKind);\n let position = Vector3.Zero();\n const normal = Vector3.Zero();\n const uv = Vector2.Zero();\n uvOffset = uvOffset || Vector2.Zero();\n uvScale = uvScale || new Vector2(1, 1);\n for (let index = 0; index < positions.length; index += 3) {\n Vector3.FromArrayToRef(positions, index, position);\n Vector3.FromArrayToRef(normals, index, normal);\n Vector2.FromArrayToRef(uvs, index / 3 * 2, uv);\n // Compute height\n const u = Math.abs(uv.x * uvScale.x + uvOffset.x % 1) * (heightMapWidth - 1) % heightMapWidth | 0;\n const v = Math.abs(uv.y * uvScale.y + uvOffset.y % 1) * (heightMapHeight - 1) % heightMapHeight | 0;\n const pos = (u + v * heightMapWidth) * 4;\n const r = buffer[pos] / 255.0;\n const g = buffer[pos + 1] / 255.0;\n const b = buffer[pos + 2] / 255.0;\n const gradient = r * 0.3 + g * 0.59 + b * 0.11;\n normal.normalize();\n normal.scaleInPlace(minHeight + (maxHeight - minHeight) * gradient);\n position = position.add(normal);\n position.toArray(positions, index);\n }\n VertexData.ComputeNormals(positions, this.getIndices(), normals);\n if (forceUpdate) {\n this.setVerticesData(VertexBuffer.PositionKind, positions);\n this.setVerticesData(VertexBuffer.NormalKind, normals);\n this.setVerticesData(VertexBuffer.UVKind, uvs);\n } else {\n this.updateVerticesData(VertexBuffer.PositionKind, positions);\n this.updateVerticesData(VertexBuffer.NormalKind, normals);\n }\n return this;\n }\n _getFlattenedNormals(indices, positions) {\n const normals = new Float32Array(indices.length * 3);\n let normalsCount = 0;\n // Decide if normals should be flipped\n const flipNormalGeneration = this.sideOrientation === (this._scene.useRightHandedSystem ? 1 : 0);\n // Generate new normals\n for (let index = 0; index < indices.length; index += 3) {\n const p1 = Vector3.FromArray(positions, indices[index] * 3);\n const p2 = Vector3.FromArray(positions, indices[index + 1] * 3);\n const p3 = Vector3.FromArray(positions, indices[index + 2] * 3);\n const p1p2 = p1.subtract(p2);\n const p3p2 = p3.subtract(p2);\n const normal = Vector3.Normalize(Vector3.Cross(p1p2, p3p2));\n if (flipNormalGeneration) {\n normal.scaleInPlace(-1);\n }\n // Store same normals for every vertex\n for (let localIndex = 0; localIndex < 3; localIndex++) {\n normals[normalsCount++] = normal.x;\n normals[normalsCount++] = normal.y;\n normals[normalsCount++] = normal.z;\n }\n }\n return normals;\n }\n _convertToUnIndexedMesh(flattenNormals = false) {\n const kinds = this.getVerticesDataKinds().filter(kind => {\n var _this$getVertexBuffer;\n return !((_this$getVertexBuffer = this.getVertexBuffer(kind)) !== null && _this$getVertexBuffer !== void 0 && _this$getVertexBuffer.getIsInstanced());\n });\n const indices = this.getIndices();\n const data = {};\n const separateVertices = (data, size) => {\n const newData = new Float32Array(indices.length * size);\n let count = 0;\n for (let index = 0; index < indices.length; index++) {\n for (let offset = 0; offset < size; offset++) {\n newData[count++] = data[indices[index] * size + offset];\n }\n }\n return newData;\n };\n // Save mesh bounding info\n const meshBoundingInfo = this.getBoundingInfo();\n // Save previous submeshes\n const previousSubmeshes = this.geometry ? this.subMeshes.slice(0) : [];\n // Cache vertex data\n for (const kind of kinds) {\n data[kind] = this.getVerticesData(kind);\n }\n // Update vertex data\n for (const kind of kinds) {\n const vertexBuffer = this.getVertexBuffer(kind);\n const size = vertexBuffer.getSize();\n if (flattenNormals && kind === VertexBuffer.NormalKind) {\n const normals = this._getFlattenedNormals(indices, data[VertexBuffer.PositionKind]);\n this.setVerticesData(VertexBuffer.NormalKind, normals, vertexBuffer.isUpdatable(), size);\n } else {\n this.setVerticesData(kind, separateVertices(data[kind], size), vertexBuffer.isUpdatable(), size);\n }\n }\n // Update morph targets\n if (this.morphTargetManager) {\n for (let targetIndex = 0; targetIndex < this.morphTargetManager.numTargets; targetIndex++) {\n const target = this.morphTargetManager.getTarget(targetIndex);\n const positions = target.getPositions();\n target.setPositions(separateVertices(positions, 3));\n const normals = target.getNormals();\n if (normals) {\n target.setNormals(flattenNormals ? this._getFlattenedNormals(indices, positions) : separateVertices(normals, 3));\n }\n const tangents = target.getTangents();\n if (tangents) {\n target.setTangents(separateVertices(tangents, 3));\n }\n const uvs = target.getUVs();\n if (uvs) {\n target.setUVs(separateVertices(uvs, 2));\n }\n }\n this.morphTargetManager.synchronize();\n }\n // Update indices\n for (let index = 0; index < indices.length; index++) {\n indices[index] = index;\n }\n this.setIndices(indices);\n this._unIndexed = true;\n // Update submeshes\n this.releaseSubMeshes();\n for (const previousOne of previousSubmeshes) {\n const boundingInfo = previousOne.getBoundingInfo();\n const subMesh = SubMesh.AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\n subMesh.setBoundingInfo(boundingInfo);\n }\n this.setBoundingInfo(meshBoundingInfo);\n this.synchronizeInstances();\n return this;\n }\n /**\n * Modify the mesh to get a flat shading rendering.\n * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.\n * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.\n * @returns current mesh\n */\n convertToFlatShadedMesh() {\n return this._convertToUnIndexedMesh(true);\n }\n /**\n * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.\n * In other words, more vertices, no more indices and a single bigger VBO.\n * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.\n * @returns current mesh\n */\n convertToUnIndexedMesh() {\n return this._convertToUnIndexedMesh();\n }\n /**\n * Inverses facet orientations.\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n * @param flipNormals will also inverts the normals\n * @returns current mesh\n */\n flipFaces(flipNormals = false) {\n const vertex_data = VertexData.ExtractFromMesh(this);\n let i;\n if (flipNormals && this.isVerticesDataPresent(VertexBuffer.NormalKind) && vertex_data.normals) {\n for (i = 0; i < vertex_data.normals.length; i++) {\n vertex_data.normals[i] *= -1;\n }\n this.setVerticesData(VertexBuffer.NormalKind, vertex_data.normals, this.isVertexBufferUpdatable(VertexBuffer.NormalKind));\n }\n if (vertex_data.indices) {\n let temp;\n for (i = 0; i < vertex_data.indices.length; i += 3) {\n // reassign indices\n temp = vertex_data.indices[i + 1];\n vertex_data.indices[i + 1] = vertex_data.indices[i + 2];\n vertex_data.indices[i + 2] = temp;\n }\n this.setIndices(vertex_data.indices, null, this.isVertexBufferUpdatable(VertexBuffer.PositionKind), true);\n }\n return this;\n }\n /**\n * Increase the number of facets and hence vertices in a mesh\n * Vertex normals are interpolated from existing vertex normals\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n * @param numberPerEdge the number of new vertices to add to each edge of a facet, optional default 1\n */\n increaseVertices(numberPerEdge = 1) {\n const vertex_data = VertexData.ExtractFromMesh(this);\n const currentIndices = vertex_data.indices && !Array.isArray(vertex_data.indices) && Array.from ? Array.from(vertex_data.indices) : vertex_data.indices;\n const positions = vertex_data.positions && !Array.isArray(vertex_data.positions) && Array.from ? Array.from(vertex_data.positions) : vertex_data.positions;\n const uvs = vertex_data.uvs && !Array.isArray(vertex_data.uvs) && Array.from ? Array.from(vertex_data.uvs) : vertex_data.uvs;\n const normals = vertex_data.normals && !Array.isArray(vertex_data.normals) && Array.from ? Array.from(vertex_data.normals) : vertex_data.normals;\n if (!currentIndices || !positions) {\n Logger.Warn(\"Couldn't increase number of vertices : VertexData must contain at least indices and positions\");\n } else {\n vertex_data.indices = currentIndices;\n vertex_data.positions = positions;\n if (uvs) {\n vertex_data.uvs = uvs;\n }\n if (normals) {\n vertex_data.normals = normals;\n }\n const segments = numberPerEdge + 1; //segments per current facet edge, become sides of new facets\n const tempIndices = new Array();\n for (let i = 0; i < segments + 1; i++) {\n tempIndices[i] = new Array();\n }\n let a; //vertex index of one end of a side\n let b; //vertex index of other end of the side\n const deltaPosition = new Vector3(0, 0, 0);\n const deltaNormal = new Vector3(0, 0, 0);\n const deltaUV = new Vector2(0, 0);\n const indices = new Array();\n const vertexIndex = new Array();\n const side = new Array();\n let len;\n let positionPtr = positions.length;\n let uvPtr;\n if (uvs) {\n uvPtr = uvs.length;\n }\n let normalsPtr;\n if (normals) {\n normalsPtr = normals.length;\n }\n for (let i = 0; i < currentIndices.length; i += 3) {\n vertexIndex[0] = currentIndices[i];\n vertexIndex[1] = currentIndices[i + 1];\n vertexIndex[2] = currentIndices[i + 2];\n for (let j = 0; j < 3; j++) {\n a = vertexIndex[j];\n b = vertexIndex[(j + 1) % 3];\n if (side[a] === undefined && side[b] === undefined) {\n side[a] = new Array();\n side[b] = new Array();\n } else {\n if (side[a] === undefined) {\n side[a] = new Array();\n }\n if (side[b] === undefined) {\n side[b] = new Array();\n }\n }\n if (side[a][b] === undefined && side[b][a] === undefined) {\n side[a][b] = [];\n deltaPosition.x = (positions[3 * b] - positions[3 * a]) / segments;\n deltaPosition.y = (positions[3 * b + 1] - positions[3 * a + 1]) / segments;\n deltaPosition.z = (positions[3 * b + 2] - positions[3 * a + 2]) / segments;\n if (normals) {\n deltaNormal.x = (normals[3 * b] - normals[3 * a]) / segments;\n deltaNormal.y = (normals[3 * b + 1] - normals[3 * a + 1]) / segments;\n deltaNormal.z = (normals[3 * b + 2] - normals[3 * a + 2]) / segments;\n }\n if (uvs) {\n deltaUV.x = (uvs[2 * b] - uvs[2 * a]) / segments;\n deltaUV.y = (uvs[2 * b + 1] - uvs[2 * a + 1]) / segments;\n }\n side[a][b].push(a);\n for (let k = 1; k < segments; k++) {\n side[a][b].push(positions.length / 3);\n positions[positionPtr++] = positions[3 * a] + k * deltaPosition.x;\n positions[positionPtr++] = positions[3 * a + 1] + k * deltaPosition.y;\n positions[positionPtr++] = positions[3 * a + 2] + k * deltaPosition.z;\n if (normals) {\n normals[normalsPtr++] = normals[3 * a] + k * deltaNormal.x;\n normals[normalsPtr++] = normals[3 * a + 1] + k * deltaNormal.y;\n normals[normalsPtr++] = normals[3 * a + 2] + k * deltaNormal.z;\n }\n if (uvs) {\n uvs[uvPtr++] = uvs[2 * a] + k * deltaUV.x;\n uvs[uvPtr++] = uvs[2 * a + 1] + k * deltaUV.y;\n }\n }\n side[a][b].push(b);\n side[b][a] = new Array();\n len = side[a][b].length;\n for (let idx = 0; idx < len; idx++) {\n side[b][a][idx] = side[a][b][len - 1 - idx];\n }\n }\n }\n //Calculate positions, normals and uvs of new internal vertices\n tempIndices[0][0] = currentIndices[i];\n tempIndices[1][0] = side[currentIndices[i]][currentIndices[i + 1]][1];\n tempIndices[1][1] = side[currentIndices[i]][currentIndices[i + 2]][1];\n for (let k = 2; k < segments; k++) {\n tempIndices[k][0] = side[currentIndices[i]][currentIndices[i + 1]][k];\n tempIndices[k][k] = side[currentIndices[i]][currentIndices[i + 2]][k];\n deltaPosition.x = (positions[3 * tempIndices[k][k]] - positions[3 * tempIndices[k][0]]) / k;\n deltaPosition.y = (positions[3 * tempIndices[k][k] + 1] - positions[3 * tempIndices[k][0] + 1]) / k;\n deltaPosition.z = (positions[3 * tempIndices[k][k] + 2] - positions[3 * tempIndices[k][0] + 2]) / k;\n if (normals) {\n deltaNormal.x = (normals[3 * tempIndices[k][k]] - normals[3 * tempIndices[k][0]]) / k;\n deltaNormal.y = (normals[3 * tempIndices[k][k] + 1] - normals[3 * tempIndices[k][0] + 1]) / k;\n deltaNormal.z = (normals[3 * tempIndices[k][k] + 2] - normals[3 * tempIndices[k][0] + 2]) / k;\n }\n if (uvs) {\n deltaUV.x = (uvs[2 * tempIndices[k][k]] - uvs[2 * tempIndices[k][0]]) / k;\n deltaUV.y = (uvs[2 * tempIndices[k][k] + 1] - uvs[2 * tempIndices[k][0] + 1]) / k;\n }\n for (let j = 1; j < k; j++) {\n tempIndices[k][j] = positions.length / 3;\n positions[positionPtr++] = positions[3 * tempIndices[k][0]] + j * deltaPosition.x;\n positions[positionPtr++] = positions[3 * tempIndices[k][0] + 1] + j * deltaPosition.y;\n positions[positionPtr++] = positions[3 * tempIndices[k][0] + 2] + j * deltaPosition.z;\n if (normals) {\n normals[normalsPtr++] = normals[3 * tempIndices[k][0]] + j * deltaNormal.x;\n normals[normalsPtr++] = normals[3 * tempIndices[k][0] + 1] + j * deltaNormal.y;\n normals[normalsPtr++] = normals[3 * tempIndices[k][0] + 2] + j * deltaNormal.z;\n }\n if (uvs) {\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0]] + j * deltaUV.x;\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0] + 1] + j * deltaUV.y;\n }\n }\n }\n tempIndices[segments] = side[currentIndices[i + 1]][currentIndices[i + 2]];\n // reform indices\n indices.push(tempIndices[0][0], tempIndices[1][0], tempIndices[1][1]);\n for (let k = 1; k < segments; k++) {\n let j;\n for (j = 0; j < k; j++) {\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\n indices.push(tempIndices[k][j], tempIndices[k + 1][j + 1], tempIndices[k][j + 1]);\n }\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\n }\n }\n vertex_data.indices = indices;\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\n }\n }\n /**\n * Force adjacent facets to share vertices and remove any facets that have all vertices in a line\n * This will undo any application of covertToFlatShadedMesh\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n */\n forceSharedVertices() {\n const vertex_data = VertexData.ExtractFromMesh(this);\n const currentUVs = vertex_data.uvs;\n const currentIndices = vertex_data.indices;\n const currentPositions = vertex_data.positions;\n const currentColors = vertex_data.colors;\n const currentMatrixIndices = vertex_data.matricesIndices;\n const currentMatrixWeights = vertex_data.matricesWeights;\n const currentMatrixIndicesExtra = vertex_data.matricesIndicesExtra;\n const currentMatrixWeightsExtra = vertex_data.matricesWeightsExtra;\n if (currentIndices === void 0 || currentPositions === void 0 || currentIndices === null || currentPositions === null) {\n Logger.Warn(\"VertexData contains empty entries\");\n } else {\n const positions = new Array();\n const indices = new Array();\n const uvs = new Array();\n const colors = new Array();\n const matrixIndices = new Array();\n const matrixWeights = new Array();\n const matrixIndicesExtra = new Array();\n const matrixWeightsExtra = new Array();\n let pstring = new Array(); //lists facet vertex positions (a,b,c) as string \"a|b|c\"\n let indexPtr = 0; // pointer to next available index value\n const uniquePositions = {}; // unique vertex positions\n let ptr; // pointer to element in uniquePositions\n let facet;\n for (let i = 0; i < currentIndices.length; i += 3) {\n facet = [currentIndices[i], currentIndices[i + 1], currentIndices[i + 2]]; //facet vertex indices\n pstring = [];\n for (let j = 0; j < 3; j++) {\n pstring[j] = \"\";\n for (let k = 0; k < 3; k++) {\n //small values make 0\n if (Math.abs(currentPositions[3 * facet[j] + k]) < 0.00000001) {\n currentPositions[3 * facet[j] + k] = 0;\n }\n pstring[j] += currentPositions[3 * facet[j] + k] + \"|\";\n }\n }\n //check facet vertices to see that none are repeated\n // do not process any facet that has a repeated vertex, ie is a line\n if (!(pstring[0] == pstring[1] || pstring[0] == pstring[2] || pstring[1] == pstring[2])) {\n //for each facet position check if already listed in uniquePositions\n // if not listed add to uniquePositions and set index pointer\n // if listed use its index in uniquePositions and new index pointer\n for (let j = 0; j < 3; j++) {\n ptr = uniquePositions[pstring[j]];\n if (ptr === undefined) {\n uniquePositions[pstring[j]] = indexPtr;\n ptr = indexPtr++;\n //not listed so add individual x, y, z coordinates to positions\n for (let k = 0; k < 3; k++) {\n positions.push(currentPositions[3 * facet[j] + k]);\n }\n if (currentColors !== null && currentColors !== void 0) {\n for (let k = 0; k < 4; k++) {\n colors.push(currentColors[4 * facet[j] + k]);\n }\n }\n if (currentUVs !== null && currentUVs !== void 0) {\n for (let k = 0; k < 2; k++) {\n uvs.push(currentUVs[2 * facet[j] + k]);\n }\n }\n if (currentMatrixIndices !== null && currentMatrixIndices !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixIndices.push(currentMatrixIndices[4 * facet[j] + k]);\n }\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixWeights.push(currentMatrixWeights[4 * facet[j] + k]);\n }\n }\n if (currentMatrixIndicesExtra !== null && currentMatrixIndicesExtra !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixIndicesExtra.push(currentMatrixIndicesExtra[4 * facet[j] + k]);\n }\n }\n if (currentMatrixWeightsExtra !== null && currentMatrixWeightsExtra !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixWeightsExtra.push(currentMatrixWeightsExtra[4 * facet[j] + k]);\n }\n }\n }\n // add new index pointer to indices array\n indices.push(ptr);\n }\n }\n }\n const normals = new Array();\n VertexData.ComputeNormals(positions, indices, normals);\n //create new vertex data object and update\n vertex_data.positions = positions;\n vertex_data.indices = indices;\n vertex_data.normals = normals;\n if (currentUVs !== null && currentUVs !== void 0) {\n vertex_data.uvs = uvs;\n }\n if (currentColors !== null && currentColors !== void 0) {\n vertex_data.colors = colors;\n }\n if (currentMatrixIndices !== null && currentMatrixIndices !== void 0) {\n vertex_data.matricesIndices = matrixIndices;\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n vertex_data.matricesWeights = matrixWeights;\n }\n if (currentMatrixIndicesExtra !== null && currentMatrixIndicesExtra !== void 0) {\n vertex_data.matricesIndicesExtra = matrixIndicesExtra;\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n vertex_data.matricesWeightsExtra = matrixWeightsExtra;\n }\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\n }\n }\n // Instances\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/naming-convention\n static _instancedMeshFactory(name, mesh) {\n throw _WarnImport(\"InstancedMesh\");\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _PhysicsImpostorParser(scene, physicObject, jsonObject) {\n throw _WarnImport(\"PhysicsImpostor\");\n }\n /**\n * Creates a new InstancedMesh object from the mesh model.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances\n * @param name defines the name of the new instance\n * @returns a new InstancedMesh\n */\n createInstance(name) {\n const instance = Mesh._instancedMeshFactory(name, this);\n instance.parent = this.parent;\n return instance;\n }\n /**\n * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.\n * After this call, all the mesh instances have the same submeshes than the current mesh.\n * @returns the current mesh\n */\n synchronizeInstances() {\n for (let instanceIndex = 0; instanceIndex < this.instances.length; instanceIndex++) {\n const instance = this.instances[instanceIndex];\n instance._syncSubMeshes();\n }\n return this;\n }\n /**\n * Optimization of the mesh's indices, in case a mesh has duplicated vertices.\n * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.\n * This should be used together with the simplification to avoid disappearing triangles.\n * @param successCallback an optional success callback to be called after the optimization finished.\n * @returns the current mesh\n */\n optimizeIndices(successCallback) {\n const indices = this.getIndices();\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positions || !indices) {\n return this;\n }\n const vectorPositions = [];\n for (let pos = 0; pos < positions.length; pos = pos + 3) {\n vectorPositions.push(Vector3.FromArray(positions, pos));\n }\n const dupes = [];\n AsyncLoop.SyncAsyncForLoop(vectorPositions.length, 40, iteration => {\n const realPos = vectorPositions.length - 1 - iteration;\n const testedPosition = vectorPositions[realPos];\n for (let j = 0; j < realPos; ++j) {\n const againstPosition = vectorPositions[j];\n if (testedPosition.equals(againstPosition)) {\n dupes[realPos] = j;\n break;\n }\n }\n }, () => {\n for (let i = 0; i < indices.length; ++i) {\n indices[i] = dupes[indices[i]] || indices[i];\n }\n //indices are now reordered\n const originalSubMeshes = this.subMeshes.slice(0);\n this.setIndices(indices);\n this.subMeshes = originalSubMeshes;\n if (successCallback) {\n successCallback(this);\n }\n });\n return this;\n }\n /**\n * Serialize current mesh\n * @param serializationObject defines the object which will receive the serialization data\n * @returns the serialized object\n */\n serialize(serializationObject = {}) {\n serializationObject.name = this.name;\n serializationObject.id = this.id;\n serializationObject.uniqueId = this.uniqueId;\n serializationObject.type = this.getClassName();\n if (Tags && Tags.HasTags(this)) {\n serializationObject.tags = Tags.GetTags(this);\n }\n serializationObject.position = this.position.asArray();\n if (this.rotationQuaternion) {\n serializationObject.rotationQuaternion = this.rotationQuaternion.asArray();\n } else if (this.rotation) {\n serializationObject.rotation = this.rotation.asArray();\n }\n serializationObject.scaling = this.scaling.asArray();\n if (this._postMultiplyPivotMatrix) {\n serializationObject.pivotMatrix = this.getPivotMatrix().asArray();\n } else {\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\n }\n serializationObject.isEnabled = this.isEnabled(false);\n serializationObject.isVisible = this.isVisible;\n serializationObject.infiniteDistance = this.infiniteDistance;\n serializationObject.pickable = this.isPickable;\n serializationObject.receiveShadows = this.receiveShadows;\n serializationObject.billboardMode = this.billboardMode;\n serializationObject.visibility = this.visibility;\n serializationObject.alwaysSelectAsActiveMesh = this.alwaysSelectAsActiveMesh;\n serializationObject.checkCollisions = this.checkCollisions;\n serializationObject.ellipsoid = this.ellipsoid.asArray();\n serializationObject.ellipsoidOffset = this.ellipsoidOffset.asArray();\n serializationObject.doNotSyncBoundingInfo = this.doNotSyncBoundingInfo;\n serializationObject.isBlocker = this.isBlocker;\n serializationObject.sideOrientation = this.sideOrientation;\n // Parent\n if (this.parent) {\n this.parent._serializeAsParent(serializationObject);\n }\n // Geometry\n serializationObject.isUnIndexed = this.isUnIndexed;\n const geometry = this._geometry;\n if (geometry && this.subMeshes) {\n serializationObject.geometryUniqueId = geometry.uniqueId;\n serializationObject.geometryId = geometry.id;\n // SubMeshes\n serializationObject.subMeshes = [];\n for (let subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {\n const subMesh = this.subMeshes[subIndex];\n serializationObject.subMeshes.push({\n materialIndex: subMesh.materialIndex,\n verticesStart: subMesh.verticesStart,\n verticesCount: subMesh.verticesCount,\n indexStart: subMesh.indexStart,\n indexCount: subMesh.indexCount\n });\n }\n }\n // Material\n if (this.material) {\n if (!this.material.doNotSerialize) {\n serializationObject.materialUniqueId = this.material.uniqueId;\n serializationObject.materialId = this.material.id; // back compat\n }\n } else {\n this.material = null;\n serializationObject.materialUniqueId = this._scene.defaultMaterial.uniqueId;\n serializationObject.materialId = this._scene.defaultMaterial.id; // back compat\n }\n // Morph targets\n if (this.morphTargetManager) {\n serializationObject.morphTargetManagerId = this.morphTargetManager.uniqueId;\n }\n // Skeleton\n if (this.skeleton) {\n serializationObject.skeletonId = this.skeleton.id;\n serializationObject.numBoneInfluencers = this.numBoneInfluencers;\n }\n // Physics\n //TODO implement correct serialization for physics impostors.\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\n const impostor = this.getPhysicsImpostor();\n if (impostor) {\n serializationObject.physicsMass = impostor.getParam(\"mass\");\n serializationObject.physicsFriction = impostor.getParam(\"friction\");\n serializationObject.physicsRestitution = impostor.getParam(\"mass\");\n serializationObject.physicsImpostor = impostor.type;\n }\n }\n // Metadata\n if (this.metadata) {\n serializationObject.metadata = this.metadata;\n }\n // Instances\n serializationObject.instances = [];\n for (let index = 0; index < this.instances.length; index++) {\n const instance = this.instances[index];\n if (instance.doNotSerialize) {\n continue;\n }\n const serializationInstance = {\n name: instance.name,\n id: instance.id,\n isEnabled: instance.isEnabled(false),\n isVisible: instance.isVisible,\n isPickable: instance.isPickable,\n checkCollisions: instance.checkCollisions,\n position: instance.position.asArray(),\n scaling: instance.scaling.asArray()\n };\n if (instance.parent) {\n instance.parent._serializeAsParent(serializationInstance);\n }\n if (instance.rotationQuaternion) {\n serializationInstance.rotationQuaternion = instance.rotationQuaternion.asArray();\n } else if (instance.rotation) {\n serializationInstance.rotation = instance.rotation.asArray();\n }\n // Physics\n //TODO implement correct serialization for physics impostors.\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\n const impostor = instance.getPhysicsImpostor();\n if (impostor) {\n serializationInstance.physicsMass = impostor.getParam(\"mass\");\n serializationInstance.physicsFriction = impostor.getParam(\"friction\");\n serializationInstance.physicsRestitution = impostor.getParam(\"mass\");\n serializationInstance.physicsImpostor = impostor.type;\n }\n }\n // Metadata\n if (instance.metadata) {\n serializationInstance.metadata = instance.metadata;\n }\n // Action Manager\n if (instance.actionManager) {\n serializationInstance.actions = instance.actionManager.serialize(instance.name);\n }\n serializationObject.instances.push(serializationInstance);\n // Animations\n SerializationHelper.AppendSerializedAnimations(instance, serializationInstance);\n serializationInstance.ranges = instance.serializeAnimationRanges();\n }\n // Thin instances\n if (this._thinInstanceDataStorage.instancesCount && this._thinInstanceDataStorage.matrixData) {\n serializationObject.thinInstances = {\n instancesCount: this._thinInstanceDataStorage.instancesCount,\n matrixData: Array.from(this._thinInstanceDataStorage.matrixData),\n matrixBufferSize: this._thinInstanceDataStorage.matrixBufferSize,\n enablePicking: this.thinInstanceEnablePicking\n };\n if (this._userThinInstanceBuffersStorage) {\n const userThinInstance = {\n data: {},\n sizes: {},\n strides: {}\n };\n for (const kind in this._userThinInstanceBuffersStorage.data) {\n userThinInstance.data[kind] = Array.from(this._userThinInstanceBuffersStorage.data[kind]);\n userThinInstance.sizes[kind] = this._userThinInstanceBuffersStorage.sizes[kind];\n userThinInstance.strides[kind] = this._userThinInstanceBuffersStorage.strides[kind];\n }\n serializationObject.thinInstances.userThinInstance = userThinInstance;\n }\n }\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n serializationObject.ranges = this.serializeAnimationRanges();\n // Layer mask\n serializationObject.layerMask = this.layerMask;\n // Alpha\n serializationObject.alphaIndex = this.alphaIndex;\n serializationObject.hasVertexAlpha = this.hasVertexAlpha;\n // Overlay\n serializationObject.overlayAlpha = this.overlayAlpha;\n serializationObject.overlayColor = this.overlayColor.asArray();\n serializationObject.renderOverlay = this.renderOverlay;\n // Fog\n serializationObject.applyFog = this.applyFog;\n // Action Manager\n if (this.actionManager) {\n serializationObject.actions = this.actionManager.serialize(this.name);\n }\n return serializationObject;\n }\n /** @internal */\n _syncGeometryWithMorphTargetManager() {\n if (!this.geometry) {\n return;\n }\n this._markSubMeshesAsAttributesDirty();\n const morphTargetManager = this._internalAbstractMeshDataInfo._morphTargetManager;\n if (morphTargetManager && morphTargetManager.vertexCount) {\n if (morphTargetManager.vertexCount !== this.getTotalVertices()) {\n Logger.Error(\"Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count.\");\n this.morphTargetManager = null;\n return;\n }\n if (morphTargetManager.isUsingTextureForTargets) {\n return;\n }\n for (let index = 0; index < morphTargetManager.numInfluencers; index++) {\n const morphTarget = morphTargetManager.getActiveTarget(index);\n const positions = morphTarget.getPositions();\n if (!positions) {\n Logger.Error(\"Invalid morph target. Target must have positions.\");\n return;\n }\n this.geometry.setVerticesData(VertexBuffer.PositionKind + index, positions, false, 3);\n const normals = morphTarget.getNormals();\n if (normals) {\n this.geometry.setVerticesData(VertexBuffer.NormalKind + index, normals, false, 3);\n }\n const tangents = morphTarget.getTangents();\n if (tangents) {\n this.geometry.setVerticesData(VertexBuffer.TangentKind + index, tangents, false, 3);\n }\n const uvs = morphTarget.getUVs();\n if (uvs) {\n this.geometry.setVerticesData(VertexBuffer.UVKind + \"_\" + index, uvs, false, 2);\n }\n }\n } else {\n let index = 0;\n // Positions\n while (this.geometry.isVerticesDataPresent(VertexBuffer.PositionKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.PositionKind + index);\n if (this.geometry.isVerticesDataPresent(VertexBuffer.NormalKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.NormalKind + index);\n }\n if (this.geometry.isVerticesDataPresent(VertexBuffer.TangentKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.TangentKind + index);\n }\n if (this.geometry.isVerticesDataPresent(VertexBuffer.UVKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.UVKind + \"_\" + index);\n }\n index++;\n }\n }\n }\n /**\n * Returns a new Mesh object parsed from the source provided.\n * @param parsedMesh is the source\n * @param scene defines the hosting scene\n * @param rootUrl is the root URL to prefix the `delayLoadingFile` property with\n * @returns a new Mesh\n */\n static Parse(parsedMesh, scene, rootUrl) {\n let mesh;\n if (parsedMesh.type && parsedMesh.type === \"LinesMesh\") {\n mesh = Mesh._LinesMeshParser(parsedMesh, scene);\n } else if (parsedMesh.type && parsedMesh.type === \"GroundMesh\") {\n mesh = Mesh._GroundMeshParser(parsedMesh, scene);\n } else if (parsedMesh.type && parsedMesh.type === \"GoldbergMesh\") {\n mesh = Mesh._GoldbergMeshParser(parsedMesh, scene);\n } else if (parsedMesh.type && parsedMesh.type === \"GreasedLineMesh\") {\n mesh = Mesh._GreasedLineMeshParser(parsedMesh, scene);\n } else if (parsedMesh.type && parsedMesh.type === \"TrailMesh\") {\n mesh = Mesh._TrailMeshParser(parsedMesh, scene);\n } else {\n mesh = new Mesh(parsedMesh.name, scene);\n }\n mesh.id = parsedMesh.id;\n mesh._waitingParsedUniqueId = parsedMesh.uniqueId;\n if (Tags) {\n Tags.AddTagsTo(mesh, parsedMesh.tags);\n }\n mesh.position = Vector3.FromArray(parsedMesh.position);\n if (parsedMesh.metadata !== undefined) {\n mesh.metadata = parsedMesh.metadata;\n }\n if (parsedMesh.rotationQuaternion) {\n mesh.rotationQuaternion = Quaternion.FromArray(parsedMesh.rotationQuaternion);\n } else if (parsedMesh.rotation) {\n mesh.rotation = Vector3.FromArray(parsedMesh.rotation);\n }\n mesh.scaling = Vector3.FromArray(parsedMesh.scaling);\n if (parsedMesh.localMatrix) {\n mesh.setPreTransformMatrix(Matrix.FromArray(parsedMesh.localMatrix));\n } else if (parsedMesh.pivotMatrix) {\n mesh.setPivotMatrix(Matrix.FromArray(parsedMesh.pivotMatrix));\n }\n mesh.setEnabled(parsedMesh.isEnabled);\n mesh.isVisible = parsedMesh.isVisible;\n mesh.infiniteDistance = parsedMesh.infiniteDistance;\n mesh.alwaysSelectAsActiveMesh = !!parsedMesh.alwaysSelectAsActiveMesh;\n mesh.showBoundingBox = parsedMesh.showBoundingBox;\n mesh.showSubMeshesBoundingBox = parsedMesh.showSubMeshesBoundingBox;\n if (parsedMesh.applyFog !== undefined) {\n mesh.applyFog = parsedMesh.applyFog;\n }\n if (parsedMesh.pickable !== undefined) {\n mesh.isPickable = parsedMesh.pickable;\n }\n if (parsedMesh.alphaIndex !== undefined) {\n mesh.alphaIndex = parsedMesh.alphaIndex;\n }\n mesh.receiveShadows = parsedMesh.receiveShadows;\n if (parsedMesh.billboardMode !== undefined) {\n mesh.billboardMode = parsedMesh.billboardMode;\n }\n if (parsedMesh.visibility !== undefined) {\n mesh.visibility = parsedMesh.visibility;\n }\n mesh.checkCollisions = parsedMesh.checkCollisions;\n mesh.doNotSyncBoundingInfo = !!parsedMesh.doNotSyncBoundingInfo;\n if (parsedMesh.ellipsoid) {\n mesh.ellipsoid = Vector3.FromArray(parsedMesh.ellipsoid);\n }\n if (parsedMesh.ellipsoidOffset) {\n mesh.ellipsoidOffset = Vector3.FromArray(parsedMesh.ellipsoidOffset);\n }\n // For Backward compatibility (\"!=\" to exclude null and undefined)\n if (parsedMesh.overrideMaterialSideOrientation != null) {\n mesh.sideOrientation = parsedMesh.overrideMaterialSideOrientation;\n }\n if (parsedMesh.sideOrientation !== undefined) {\n mesh.sideOrientation = parsedMesh.sideOrientation;\n }\n if (parsedMesh.isBlocker !== undefined) {\n mesh.isBlocker = parsedMesh.isBlocker;\n }\n mesh._shouldGenerateFlatShading = parsedMesh.useFlatShading;\n // freezeWorldMatrix\n if (parsedMesh.freezeWorldMatrix) {\n mesh._waitingData.freezeWorldMatrix = parsedMesh.freezeWorldMatrix;\n }\n // Parent\n if (parsedMesh.parentId !== undefined) {\n mesh._waitingParentId = parsedMesh.parentId;\n }\n if (parsedMesh.parentInstanceIndex !== undefined) {\n mesh._waitingParentInstanceIndex = parsedMesh.parentInstanceIndex;\n }\n // Actions\n if (parsedMesh.actions !== undefined) {\n mesh._waitingData.actions = parsedMesh.actions;\n }\n // Overlay\n if (parsedMesh.overlayAlpha !== undefined) {\n mesh.overlayAlpha = parsedMesh.overlayAlpha;\n }\n if (parsedMesh.overlayColor !== undefined) {\n mesh.overlayColor = Color3.FromArray(parsedMesh.overlayColor);\n }\n if (parsedMesh.renderOverlay !== undefined) {\n mesh.renderOverlay = parsedMesh.renderOverlay;\n }\n // Geometry\n mesh.isUnIndexed = !!parsedMesh.isUnIndexed;\n mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha;\n if (parsedMesh.delayLoadingFile) {\n mesh.delayLoadState = 4;\n mesh.delayLoadingFile = rootUrl + parsedMesh.delayLoadingFile;\n mesh.buildBoundingInfo(Vector3.FromArray(parsedMesh.boundingBoxMinimum), Vector3.FromArray(parsedMesh.boundingBoxMaximum));\n if (parsedMesh._binaryInfo) {\n mesh._binaryInfo = parsedMesh._binaryInfo;\n }\n mesh._delayInfo = [];\n if (parsedMesh.hasUVs) {\n mesh._delayInfo.push(VertexBuffer.UVKind);\n }\n if (parsedMesh.hasUVs2) {\n mesh._delayInfo.push(VertexBuffer.UV2Kind);\n }\n if (parsedMesh.hasUVs3) {\n mesh._delayInfo.push(VertexBuffer.UV3Kind);\n }\n if (parsedMesh.hasUVs4) {\n mesh._delayInfo.push(VertexBuffer.UV4Kind);\n }\n if (parsedMesh.hasUVs5) {\n mesh._delayInfo.push(VertexBuffer.UV5Kind);\n }\n if (parsedMesh.hasUVs6) {\n mesh._delayInfo.push(VertexBuffer.UV6Kind);\n }\n if (parsedMesh.hasColors) {\n mesh._delayInfo.push(VertexBuffer.ColorKind);\n }\n if (parsedMesh.hasMatricesIndices) {\n mesh._delayInfo.push(VertexBuffer.MatricesIndicesKind);\n }\n if (parsedMesh.hasMatricesWeights) {\n mesh._delayInfo.push(VertexBuffer.MatricesWeightsKind);\n }\n mesh._delayLoadingFunction = Geometry._ImportGeometry;\n if (SceneLoaderFlags.ForceFullSceneLoadingForIncremental) {\n mesh._checkDelayState();\n }\n } else {\n Geometry._ImportGeometry(parsedMesh, mesh);\n }\n // Material\n if (parsedMesh.materialUniqueId) {\n mesh._waitingMaterialId = parsedMesh.materialUniqueId;\n } else if (parsedMesh.materialId) {\n mesh._waitingMaterialId = parsedMesh.materialId;\n }\n // Morph targets\n if (parsedMesh.morphTargetManagerId > -1) {\n mesh._waitingMorphTargetManagerId = parsedMesh.morphTargetManagerId;\n }\n // Skeleton\n if (parsedMesh.skeletonId !== undefined && parsedMesh.skeletonId !== null) {\n mesh.skeleton = scene.getLastSkeletonById(parsedMesh.skeletonId);\n if (parsedMesh.numBoneInfluencers) {\n mesh.numBoneInfluencers = parsedMesh.numBoneInfluencers;\n }\n }\n // Animations\n if (parsedMesh.animations) {\n for (let animationIndex = 0; animationIndex < parsedMesh.animations.length; animationIndex++) {\n const parsedAnimation = parsedMesh.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n mesh.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(mesh, parsedMesh, scene);\n }\n if (parsedMesh.autoAnimate) {\n scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);\n }\n // Layer Mask\n if (parsedMesh.layerMask && !isNaN(parsedMesh.layerMask)) {\n mesh.layerMask = Math.abs(parseInt(parsedMesh.layerMask));\n } else {\n mesh.layerMask = 0x0fffffff;\n }\n // Physics\n if (parsedMesh.physicsImpostor) {\n mesh.physicsImpostor = Mesh._PhysicsImpostorParser(scene, mesh, parsedMesh);\n }\n // Levels\n if (parsedMesh.lodMeshIds) {\n mesh._waitingData.lods = {\n ids: parsedMesh.lodMeshIds,\n distances: parsedMesh.lodDistances ? parsedMesh.lodDistances : null,\n coverages: parsedMesh.lodCoverages ? parsedMesh.lodCoverages : null\n };\n }\n // Instances\n if (parsedMesh.instances) {\n for (let index = 0; index < parsedMesh.instances.length; index++) {\n const parsedInstance = parsedMesh.instances[index];\n const instance = mesh.createInstance(parsedInstance.name);\n if (parsedInstance.id) {\n instance.id = parsedInstance.id;\n }\n if (Tags) {\n if (parsedInstance.tags) {\n Tags.AddTagsTo(instance, parsedInstance.tags);\n } else {\n Tags.AddTagsTo(instance, parsedMesh.tags);\n }\n }\n instance.position = Vector3.FromArray(parsedInstance.position);\n if (parsedInstance.metadata !== undefined) {\n instance.metadata = parsedInstance.metadata;\n }\n if (parsedInstance.parentId !== undefined) {\n instance._waitingParentId = parsedInstance.parentId;\n }\n if (parsedInstance.parentInstanceIndex !== undefined) {\n instance._waitingParentInstanceIndex = parsedInstance.parentInstanceIndex;\n }\n if (parsedInstance.isEnabled !== undefined && parsedInstance.isEnabled !== null) {\n instance.setEnabled(parsedInstance.isEnabled);\n }\n if (parsedInstance.isVisible !== undefined && parsedInstance.isVisible !== null) {\n instance.isVisible = parsedInstance.isVisible;\n }\n if (parsedInstance.isPickable !== undefined && parsedInstance.isPickable !== null) {\n instance.isPickable = parsedInstance.isPickable;\n }\n if (parsedInstance.rotationQuaternion) {\n instance.rotationQuaternion = Quaternion.FromArray(parsedInstance.rotationQuaternion);\n } else if (parsedInstance.rotation) {\n instance.rotation = Vector3.FromArray(parsedInstance.rotation);\n }\n instance.scaling = Vector3.FromArray(parsedInstance.scaling);\n if (parsedInstance.checkCollisions != undefined && parsedInstance.checkCollisions != null) {\n instance.checkCollisions = parsedInstance.checkCollisions;\n }\n if (parsedInstance.pickable != undefined && parsedInstance.pickable != null) {\n instance.isPickable = parsedInstance.pickable;\n }\n if (parsedInstance.showBoundingBox != undefined && parsedInstance.showBoundingBox != null) {\n instance.showBoundingBox = parsedInstance.showBoundingBox;\n }\n if (parsedInstance.showSubMeshesBoundingBox != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\n instance.showSubMeshesBoundingBox = parsedInstance.showSubMeshesBoundingBox;\n }\n if (parsedInstance.alphaIndex != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\n instance.alphaIndex = parsedInstance.alphaIndex;\n }\n // Physics\n if (parsedInstance.physicsImpostor) {\n instance.physicsImpostor = Mesh._PhysicsImpostorParser(scene, instance, parsedInstance);\n }\n // Actions\n if (parsedInstance.actions !== undefined) {\n instance._waitingData.actions = parsedInstance.actions;\n }\n // Animation\n if (parsedInstance.animations) {\n for (let animationIndex = 0; animationIndex < parsedInstance.animations.length; animationIndex++) {\n const parsedAnimation = parsedInstance.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n instance.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(instance, parsedInstance, scene);\n if (parsedInstance.autoAnimate) {\n scene.beginAnimation(instance, parsedInstance.autoAnimateFrom, parsedInstance.autoAnimateTo, parsedInstance.autoAnimateLoop, parsedInstance.autoAnimateSpeed || 1.0);\n }\n }\n }\n }\n // Thin instances\n if (parsedMesh.thinInstances) {\n const thinInstances = parsedMesh.thinInstances;\n mesh.thinInstanceEnablePicking = !!thinInstances.enablePicking;\n if (thinInstances.matrixData) {\n mesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(thinInstances.matrixData), 16, false);\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\n mesh._thinInstanceDataStorage.instancesCount = thinInstances.instancesCount;\n } else {\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\n }\n if (parsedMesh.thinInstances.userThinInstance) {\n const userThinInstance = parsedMesh.thinInstances.userThinInstance;\n for (const kind in userThinInstance.data) {\n mesh.thinInstanceSetBuffer(kind, new Float32Array(userThinInstance.data[kind]), userThinInstance.strides[kind], false);\n mesh._userThinInstanceBuffersStorage.sizes[kind] = userThinInstance.sizes[kind];\n }\n }\n }\n return mesh;\n }\n // Skeletons\n /**\n * Prepare internal position array for software CPU skinning\n * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh\n */\n setPositionsForCPUSkinning() {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourcePositions) {\n const source = this.getVerticesData(VertexBuffer.PositionKind);\n if (!source) {\n return internalDataInfo._sourcePositions;\n }\n internalDataInfo._sourcePositions = new Float32Array(source);\n if (!this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\n this.setVerticesData(VertexBuffer.PositionKind, source, true);\n }\n }\n return internalDataInfo._sourcePositions;\n }\n /**\n * Prepare internal normal array for software CPU skinning\n * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.\n */\n setNormalsForCPUSkinning() {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourceNormals) {\n const source = this.getVerticesData(VertexBuffer.NormalKind);\n if (!source) {\n return internalDataInfo._sourceNormals;\n }\n internalDataInfo._sourceNormals = new Float32Array(source);\n if (!this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\n this.setVerticesData(VertexBuffer.NormalKind, source, true);\n }\n }\n return internalDataInfo._sourceNormals;\n }\n /**\n * Updates the vertex buffer by applying transformation from the bones\n * @param skeleton defines the skeleton to apply to current mesh\n * @returns the current mesh\n */\n applySkeleton(skeleton) {\n if (!this.geometry) {\n return this;\n }\n if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId()) {\n return this;\n }\n this.geometry._softwareSkinningFrameId = this.getScene().getFrameId();\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\n return this;\n }\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\n return this;\n }\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\n return this;\n }\n const hasNormals = this.isVerticesDataPresent(VertexBuffer.NormalKind);\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourcePositions) {\n const submeshes = this.subMeshes.slice();\n this.setPositionsForCPUSkinning();\n this.subMeshes = submeshes;\n }\n if (hasNormals && !internalDataInfo._sourceNormals) {\n this.setNormalsForCPUSkinning();\n }\n // positionsData checks for not being Float32Array will only pass at most once\n let positionsData = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positionsData) {\n return this;\n }\n if (!(positionsData instanceof Float32Array)) {\n positionsData = new Float32Array(positionsData);\n }\n // normalsData checks for not being Float32Array will only pass at most once\n let normalsData = this.getVerticesData(VertexBuffer.NormalKind);\n if (hasNormals) {\n if (!normalsData) {\n return this;\n }\n if (!(normalsData instanceof Float32Array)) {\n normalsData = new Float32Array(normalsData);\n }\n }\n const matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\n const matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n if (!matricesWeightsData || !matricesIndicesData) {\n return this;\n }\n const needExtras = this.numBoneInfluencers > 4;\n const matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\n const matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\n const skeletonMatrices = skeleton.getTransformMatrices(this);\n const tempVector3 = Vector3.Zero();\n const finalMatrix = new Matrix();\n const tempMatrix = new Matrix();\n let matWeightIdx = 0;\n let inf;\n for (let index = 0; index < positionsData.length; index += 3, matWeightIdx += 4) {\n let weight;\n for (inf = 0; inf < 4; inf++) {\n weight = matricesWeightsData[matWeightIdx + inf];\n if (weight > 0) {\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\n finalMatrix.addToSelf(tempMatrix);\n }\n }\n if (needExtras) {\n for (inf = 0; inf < 4; inf++) {\n weight = matricesWeightsExtraData[matWeightIdx + inf];\n if (weight > 0) {\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\n finalMatrix.addToSelf(tempMatrix);\n }\n }\n }\n Vector3.TransformCoordinatesFromFloatsToRef(internalDataInfo._sourcePositions[index], internalDataInfo._sourcePositions[index + 1], internalDataInfo._sourcePositions[index + 2], finalMatrix, tempVector3);\n tempVector3.toArray(positionsData, index);\n if (hasNormals) {\n Vector3.TransformNormalFromFloatsToRef(internalDataInfo._sourceNormals[index], internalDataInfo._sourceNormals[index + 1], internalDataInfo._sourceNormals[index + 2], finalMatrix, tempVector3);\n tempVector3.toArray(normalsData, index);\n }\n finalMatrix.reset();\n }\n this.updateVerticesData(VertexBuffer.PositionKind, positionsData);\n if (hasNormals) {\n this.updateVerticesData(VertexBuffer.NormalKind, normalsData);\n }\n return this;\n }\n // Tools\n /**\n * Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates\n * @param meshes defines the list of meshes to scan\n * @returns an object `{min:` Vector3`, max:` Vector3`}`\n */\n static MinMax(meshes) {\n let minVector = null;\n let maxVector = null;\n meshes.forEach(function (mesh) {\n const boundingInfo = mesh.getBoundingInfo();\n const boundingBox = boundingInfo.boundingBox;\n if (!minVector || !maxVector) {\n minVector = boundingBox.minimumWorld;\n maxVector = boundingBox.maximumWorld;\n } else {\n minVector.minimizeInPlace(boundingBox.minimumWorld);\n maxVector.maximizeInPlace(boundingBox.maximumWorld);\n }\n });\n if (!minVector || !maxVector) {\n return {\n min: Vector3.Zero(),\n max: Vector3.Zero()\n };\n }\n return {\n min: minVector,\n max: maxVector\n };\n }\n /**\n * Returns the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array\n * @param meshesOrMinMaxVector could be an array of meshes or a `{min:` Vector3`, max:` Vector3`}` object\n * @returns a vector3\n */\n static Center(meshesOrMinMaxVector) {\n const minMaxVector = meshesOrMinMaxVector instanceof Array ? Mesh.MinMax(meshesOrMinMaxVector) : meshesOrMinMaxVector;\n return Vector3.Center(minMaxVector.min, minMaxVector.max);\n }\n /**\n * Merge the array of meshes into a single mesh for performance reasons.\n * @param meshes array of meshes with the vertices to merge. Entries cannot be empty meshes.\n * @param disposeSource when true (default), dispose of the vertices from the source meshes.\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true.\n * @param meshSubclass (optional) can be set to a Mesh where the merged vertices will be inserted.\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh into subMeshes.\n * @param multiMultiMaterials when true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.\n * @returns a new mesh\n */\n static MergeMeshes(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\n return runCoroutineSync(Mesh._MergeMeshesCoroutine(meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, false));\n }\n /**\n * Merge the array of meshes into a single mesh for performance reasons.\n * @param meshes array of meshes with the vertices to merge. Entries cannot be empty meshes.\n * @param disposeSource when true (default), dispose of the vertices from the source meshes.\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true.\n * @param meshSubclass (optional) can be set to a Mesh where the merged vertices will be inserted.\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh into subMeshes.\n * @param multiMultiMaterials when true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.\n * @returns a new mesh\n */\n static MergeMeshesAsync(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\n return runCoroutineAsync(Mesh._MergeMeshesCoroutine(meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, true), createYieldingScheduler());\n }\n static *_MergeMeshesCoroutine(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, isAsync) {\n // Remove any null/undefined entries from the mesh array\n meshes = meshes.filter(Boolean);\n if (meshes.length === 0) {\n return null;\n }\n let index;\n if (!allow32BitsIndices) {\n let totalVertices = 0;\n // Counting vertices\n for (index = 0; index < meshes.length; index++) {\n totalVertices += meshes[index].getTotalVertices();\n if (totalVertices >= 65536) {\n Logger.Warn(\"Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices\");\n return null;\n }\n }\n }\n if (multiMultiMaterials) {\n subdivideWithSubMeshes = false;\n }\n const materialArray = new Array();\n const materialIndexArray = new Array();\n // Merge\n const indiceArray = new Array();\n const currentsideOrientation = meshes[0].sideOrientation;\n for (index = 0; index < meshes.length; index++) {\n const mesh = meshes[index];\n if (mesh.isAnInstance) {\n Logger.Warn(\"Cannot merge instance meshes.\");\n return null;\n }\n if (currentsideOrientation !== mesh.sideOrientation) {\n Logger.Warn(\"Cannot merge meshes with different sideOrientation values.\");\n return null;\n }\n if (subdivideWithSubMeshes) {\n indiceArray.push(mesh.getTotalIndices());\n }\n if (multiMultiMaterials) {\n if (mesh.material) {\n const material = mesh.material;\n if (material instanceof MultiMaterial) {\n for (let matIndex = 0; matIndex < material.subMaterials.length; matIndex++) {\n if (materialArray.indexOf(material.subMaterials[matIndex]) < 0) {\n materialArray.push(material.subMaterials[matIndex]);\n }\n }\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(materialArray.indexOf(material.subMaterials[mesh.subMeshes[subIndex].materialIndex]));\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n } else {\n if (materialArray.indexOf(material) < 0) {\n materialArray.push(material);\n }\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(materialArray.indexOf(material));\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n }\n } else {\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(0);\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n }\n }\n }\n const source = meshes[0];\n const getVertexDataFromMesh = mesh => {\n const wm = mesh.computeWorldMatrix(true);\n const vertexData = VertexData.ExtractFromMesh(mesh, false, false);\n return {\n vertexData,\n transform: wm\n };\n };\n const {\n vertexData: sourceVertexData,\n transform: sourceTransform\n } = getVertexDataFromMesh(source);\n if (isAsync) {\n yield;\n }\n const meshVertexDatas = new Array(meshes.length - 1);\n for (let i = 1; i < meshes.length; i++) {\n meshVertexDatas[i - 1] = getVertexDataFromMesh(meshes[i]);\n if (isAsync) {\n yield;\n }\n }\n const mergeCoroutine = sourceVertexData._mergeCoroutine(sourceTransform, meshVertexDatas, allow32BitsIndices, isAsync, !disposeSource);\n let mergeCoroutineStep = mergeCoroutine.next();\n while (!mergeCoroutineStep.done) {\n if (isAsync) {\n yield;\n }\n mergeCoroutineStep = mergeCoroutine.next();\n }\n const vertexData = mergeCoroutineStep.value;\n if (!meshSubclass) {\n meshSubclass = new Mesh(source.name + \"_merged\", source.getScene());\n }\n const applyToCoroutine = vertexData._applyToCoroutine(meshSubclass, undefined, isAsync);\n let applyToCoroutineStep = applyToCoroutine.next();\n while (!applyToCoroutineStep.done) {\n if (isAsync) {\n yield;\n }\n applyToCoroutineStep = applyToCoroutine.next();\n }\n // Setting properties\n meshSubclass.checkCollisions = source.checkCollisions;\n meshSubclass.sideOrientation = source.sideOrientation;\n // Cleaning\n if (disposeSource) {\n for (index = 0; index < meshes.length; index++) {\n meshes[index].dispose();\n }\n }\n // Subdivide\n if (subdivideWithSubMeshes || multiMultiMaterials) {\n //-- removal of global submesh\n meshSubclass.releaseSubMeshes();\n index = 0;\n let offset = 0;\n //-- apply subdivision according to index table\n while (index < indiceArray.length) {\n SubMesh.CreateFromIndices(0, offset, indiceArray[index], meshSubclass, undefined, false);\n offset += indiceArray[index];\n index++;\n }\n for (const subMesh of meshSubclass.subMeshes) {\n subMesh.refreshBoundingInfo();\n }\n meshSubclass.computeWorldMatrix(true);\n }\n if (multiMultiMaterials) {\n const newMultiMaterial = new MultiMaterial(source.name + \"_merged\", source.getScene());\n newMultiMaterial.subMaterials = materialArray;\n for (let subIndex = 0; subIndex < meshSubclass.subMeshes.length; subIndex++) {\n meshSubclass.subMeshes[subIndex].materialIndex = materialIndexArray[subIndex];\n }\n meshSubclass.material = newMultiMaterial;\n } else {\n meshSubclass.material = source.material;\n }\n return meshSubclass;\n }\n /**\n * @internal\n */\n addInstance(instance) {\n instance._indexInSourceMeshInstanceArray = this.instances.length;\n this.instances.push(instance);\n }\n /**\n * @internal\n */\n removeInstance(instance) {\n // Remove from mesh\n const index = instance._indexInSourceMeshInstanceArray;\n if (index != -1) {\n if (index !== this.instances.length - 1) {\n const last = this.instances[this.instances.length - 1];\n this.instances[index] = last;\n last._indexInSourceMeshInstanceArray = index;\n }\n instance._indexInSourceMeshInstanceArray = -1;\n this.instances.pop();\n }\n }\n /** @internal */\n _shouldConvertRHS() {\n return this._scene.useRightHandedSystem && this.sideOrientation === Material.CounterClockWiseSideOrientation;\n }\n /** @internal */\n _getRenderingFillMode(fillMode) {\n var _this$overrideRenderi;\n const scene = this.getScene();\n if (scene.forcePointsCloud) return Material.PointFillMode;\n if (scene.forceWireframe) return Material.WireFrameFillMode;\n return (_this$overrideRenderi = this.overrideRenderingFillMode) !== null && _this$overrideRenderi !== void 0 ? _this$overrideRenderi : fillMode;\n }\n // deprecated methods\n /**\n * Sets the mesh material by the material or multiMaterial `id` property\n * @param id is a string identifying the material or the multiMaterial\n * @returns the current mesh\n * @deprecated Please use MeshBuilder instead Please use setMaterialById instead\n */\n setMaterialByID(id) {\n return this.setMaterialById(id);\n }\n /**\n * Creates a ribbon mesh.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @param name defines the name of the mesh to create\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\n * @param closePath creates a seam between the first and the last points of each path of the path array\n * @param offset is taken in account only if the `pathArray` is containing a single path\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateRibbon(name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a plane polygonal mesh. By default, this is a disc.\n * @param name defines the name of the mesh to create\n * @param radius sets the radius size (float) of the polygon (default 0.5)\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDisc(name, radius, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a box mesh.\n * @param name defines the name of the mesh to create\n * @param size sets the size (float) of each box side (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateBox(name, size, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a sphere mesh.\n * @param name defines the name of the mesh to create\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\n * @param diameter sets the diameter size (float) of the sphere (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateSphere(name, segments, diameter, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a hemisphere mesh.\n * @param name defines the name of the mesh to create\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\n * @param diameter sets the diameter size (float) of the sphere (default 1)\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateHemisphere(name, segments, diameter, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a cylinder or a cone mesh.\n * @param name defines the name of the mesh to create\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\n * @param diameterTop set the top cap diameter (floats, default 1)\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateCylinder(name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n // Torus (Code from SharpDX.org)\n /**\n * Creates a torus mesh.\n * @param name defines the name of the mesh to create\n * @param diameter sets the diameter size (float) of the torus (default 1)\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\n * @param tessellation sets the number of torus sides (positive integer, default 16)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTorus(name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a torus knot mesh.\n * @param name defines the name of the mesh to create\n * @param radius sets the global radius size (float) of the torus knot (default 2)\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\n * @param p the number of windings on X axis (positive integers, default 2)\n * @param q the number of windings on Y axis (positive integers, default 3)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTorusKnot(name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a line mesh..\n * @param name defines the name of the mesh to create\n * @param points is an array successive Vector3\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateLines(name, points, scene, updatable, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a dashed line mesh.\n * @param name defines the name of the mesh to create\n * @param points is an array successive Vector3\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDashedLines(name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * Remember you can only change the shape positions, not their number when updating a polygon.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#non-regular-polygon\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\n * @param scene defines the hosting scene\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePolygon(name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an extruded polygon mesh, with depth in the Y direction..\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-non-regular-polygon\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\n * @param depth defines the height of extrusion\n * @param scene defines the hosting scene\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudePolygon(name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an extruded shape mesh.\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\n * @param scale is the value to scale the shape\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudeShape(name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an custom extruded shape mesh.\n * The custom extrusion is a parametric shape.\n * It has no predefined shape. Its final shape will depend on the input parameters.\n *\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\n * @param scaleFunction is a custom Javascript function called on each path point\n * @param rotationFunction is a custom Javascript function called on each path point\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudeShapeCustom(name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates lathe mesh.\n * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe.\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\n * @param radius is the radius value of the lathe\n * @param tessellation is the side number of the lathe.\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateLathe(name, shape, radius, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a plane mesh.\n * @param name defines the name of the mesh to create\n * @param size sets the size (float) of both sides of the plane at once (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePlane(name, size, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a ground mesh.\n * @param name defines the name of the mesh to create\n * @param width set the width of the ground\n * @param height set the height of the ground\n * @param subdivisions sets the number of subdivisions per side\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateGround(name, width, height, subdivisions, scene, updatable) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a tiled ground mesh.\n * @param name defines the name of the mesh to create\n * @param xmin set the ground minimum X coordinate\n * @param zmin set the ground minimum Y coordinate\n * @param xmax set the ground maximum X coordinate\n * @param zmax set the ground maximum Z coordinate\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTiledGround(name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a ground mesh from a height map.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\n * @param name defines the name of the mesh to create\n * @param url sets the URL of the height map image resource\n * @param width set the ground width size\n * @param height set the ground height size\n * @param subdivisions sets the number of subdivision per side\n * @param minHeight is the minimum altitude on the ground\n * @param maxHeight is the maximum altitude on the ground\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateGroundFromHeightMap(name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a tube mesh.\n * The tube is a parametric shape.\n * It has no predefined shape. Its final shape will depend on the input parameters.\n *\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @param name defines the name of the mesh to create\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\n * @param radius sets the tube radius size\n * @param tessellation is the number of sides on the tubular surface\n * @param radiusFunction is a custom function. If it is not null, it overrides the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTube(name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a polyhedron mesh.\n *.\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embedded types. Please refer to the type sheet in the tutorial to choose the wanted type\n * * The parameter `size` (positive float, default 1) sets the polygon size\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh to create\n * @param options defines the options used to create the mesh\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePolyhedron(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\n * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra#icosphere\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateIcoSphere(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a decal mesh.\n *.\n * A decal is a mesh usually applied as a model onto the surface of another mesh\n * @param name defines the name of the mesh\n * @param sourceMesh defines the mesh receiving the decal\n * @param position sets the position of the decal in world coordinates\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\n * @param size sets the decal scaling\n * @param angle sets the angle to rotate the decal\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDecal(name, sourceMesh, position, normal, size, angle) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /** Creates a Capsule Mesh\n * @param name defines the name of the mesh.\n * @param options the constructors options used to shape the mesh.\n * @param scene defines the scene the mesh is scoped to.\n * @returns the capsule mesh\n * @see https://doc.babylonjs.com/how_to/capsule_shape\n * @deprecated Please use MeshBuilder instead\n */\n static CreateCapsule(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Extends a mesh to a Goldberg mesh\n * Warning the mesh to convert MUST be an import of a perviously exported Goldberg mesh\n * @param mesh the mesh to convert\n * @returns the extended mesh\n * @deprecated Please use ExtendMeshToGoldberg instead\n */\n static ExtendToGoldberg(mesh) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n}\n// Consts\n/**\n * Mesh side orientation : usually the external or front surface\n */\nMesh.FRONTSIDE = VertexData.FRONTSIDE;\n/**\n * Mesh side orientation : usually the internal or back surface\n */\nMesh.BACKSIDE = VertexData.BACKSIDE;\n/**\n * Mesh side orientation : both internal and external or front and back surfaces\n */\nMesh.DOUBLESIDE = VertexData.DOUBLESIDE;\n/**\n * Mesh side orientation : by default, `FRONTSIDE`\n */\nMesh.DEFAULTSIDE = VertexData.DEFAULTSIDE;\n/**\n * Mesh cap setting : no cap\n */\nMesh.NO_CAP = 0;\n/**\n * Mesh cap setting : one cap at the beginning of the mesh\n */\nMesh.CAP_START = 1;\n/**\n * Mesh cap setting : one cap at the end of the mesh\n */\nMesh.CAP_END = 2;\n/**\n * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh\n */\nMesh.CAP_ALL = 3;\n/**\n * Mesh pattern setting : no flip or rotate\n */\nMesh.NO_FLIP = 0;\n/**\n * Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column\n */\nMesh.FLIP_TILE = 1;\n/**\n * Mesh pattern setting : rotate (180degs) alternate tiles on each row or column\n */\nMesh.ROTATE_TILE = 2;\n/**\n * Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows\n */\nMesh.FLIP_ROW = 3;\n/**\n * Mesh pattern setting : rotate (180degs) all tiles on alternate rows\n */\nMesh.ROTATE_ROW = 4;\n/**\n * Mesh pattern setting : flip and rotate alternate tiles on each row or column\n */\nMesh.FLIP_N_ROTATE_TILE = 5;\n/**\n * Mesh pattern setting : rotate pattern and rotate\n */\nMesh.FLIP_N_ROTATE_ROW = 6;\n/**\n * Mesh tile positioning : part tiles same on left/right or top/bottom\n */\nMesh.CENTER = 0;\n/**\n * Mesh tile positioning : part tiles on left\n */\nMesh.LEFT = 1;\n/**\n * Mesh tile positioning : part tiles on right\n */\nMesh.RIGHT = 2;\n/**\n * Mesh tile positioning : part tiles on top\n */\nMesh.TOP = 3;\n/**\n * Mesh tile positioning : part tiles on bottom\n */\nMesh.BOTTOM = 4;\n/**\n * Indicates that the instanced meshes should be sorted from back to front before rendering if their material is transparent\n */\nMesh.INSTANCEDMESH_SORT_TRANSPARENT = false;\n// Statics\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GroundMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GroundMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GoldbergMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GoldbergMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._LinesMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"LinesMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GreasedLineMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GreasedLineMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GreasedLineRibbonMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GreasedLineRibbonMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._TrailMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"TrailMesh\");\n};\nRegisterClass(\"BABYLON.Mesh\", Mesh);","map":{"version":3,"names":["Observable","Tools","AsyncLoop","DeepCopier","Tags","runCoroutineSync","runCoroutineAsync","createYieldingScheduler","Camera","Quaternion","Matrix","Vector3","Vector2","Color3","Node","VertexBuffer","Buffer","VertexData","Geometry","AbstractMesh","SubMesh","Material","MultiMaterial","SceneLoaderFlags","SerializationHelper","Logger","GetClass","RegisterClass","_WarnImport","SceneComponentConstants","MeshLODLevel","_CreationDataStorage","_InstanceDataStorage","constructor","visibleInstances","batchCache","_InstancesBatch","batchCacheReplacementModeInFrozenMode","instancesBufferSize","mustReturn","Array","renderSelf","hardwareInstancedRendering","_ThinInstanceDataStorage","instancesCount","matrixBuffer","previousMatrixBuffer","matrixBufferSize","matrixData","boundingVectors","worldMatrices","_InternalMeshDataInfo","_areNormalsFrozen","_source","meshMap","_preActivateId","_LODLevels","_useLODScreenCoverage","_effectiveMaterial","_forcedInstanceCount","_overrideRenderingFillMode","Mesh","_GetDefaultSideOrientation","orientation","FRONTSIDE","useLODScreenCoverage","_internalMeshDataInfo","value","_sortLODLevels","computeBonesUsingShaders","_internalAbstractMeshDataInfo","_computeBonesUsingShaders","_sourcePositions","setVerticesData","PositionKind","_sourceNormals","NormalKind","_markSubMeshesAsAttributesDirty","onBeforeRenderObservable","_onBeforeRenderObservable","onBeforeBindObservable","_onBeforeBindObservable","onAfterRenderObservable","_onAfterRenderObservable","onBetweenPassObservable","_onBetweenPassObservable","onBeforeDrawObservable","_onBeforeDrawObservable","onBeforeDraw","callback","_onBeforeDrawObserver","remove","add","hasInstances","instances","length","hasThinInstances","forcedInstanceCount","_thinInstanceDataStorage","count","sideOrientation","_sideOrientation","_sideOrientationHint","_scene","useRightHandedSystem","overrideMaterialSideOrientation","material","overrideRenderingFillMode","fillMode","_material","_setMaterial","source","cloneMeshMap","isUnIndexed","_unIndexed","worldMatrixInstancedBuffer","_instanceDataStorage","instancesData","previousWorldMatrixInstancedBuffer","instancesPreviousData","manualUpdateOfWorldMatrixInstancedBuffer","manualUpdate","manualUpdateOfPreviousWorldMatrixInstancedBuffer","previousManualUpdate","forceWorldMatrixInstancedBufferUpdate","forceMatrixUpdates","_copySource","doNotCloneChildren","clonePhysicsImpostor","scene","getScene","_geometry","applyToMesh","DeepCopy","useClonedMeshMap","uniqueId","_originalBuilderSideOrientation","_creationDataStorage","_ranges","ranges","name","Object","prototype","hasOwnProperty","call","createAnimationRange","from","to","metadata","clone","_internalMetadata","HasTags","AddTagsTo","GetTags","setEnabled","isEnabled","parent","setPivotMatrix","getPivotMatrix","_postMultiplyPivotMatrix","id","directDescendants","getDescendants","index","child","morphTargetManager","getPhysicsEngine","physicsEngine","getPluginVersion","impostor","getImpostorForPhysicsObject","physicsImpostor","physicsBody","particleSystems","system","emitter","skeleton","refreshBoundingInfo","computeWorldMatrix","delayLoadState","_shouldGenerateFlatShading","DEFAULTSIDE","ignoreCameraMaxZ","_onBeforeDraw","isInstance","world","effectiveMaterial","_uniformBuffer","transferToEffect","bindOnlyWorldMatrix","getEngine","getCaps","instancedArrays","_onMeshReadyObserverAdded","observer","unregisterOnNextCall","isReady","onMeshReadyObservable","notifyObservers","_checkReadinessObserver","onClonedObservable","instantiateHierarchy","newParent","options","onNewNodeCreated","instance","getTotalVertices","doNotInstantiate","createInstance","position","scaling","rotationQuaternion","rotation","getChildTransformNodes","getClassName","sourceMesh","newSourcedMesh","_isMesh","toString","fullDetails","ret","_waitingParentId","animations","i","ib","getIndices","vb","getVerticesData","_unBindEffect","hasLODLevels","getLODLevels","sortingOrderFactor","sort","a","b","distanceOrScreenCoverage","addLODLevel","mesh","_masterMesh","Warn","level","push","getLODLevelAtDistance","distance","internalDataInfo","removeLODLevel","splice","getLOD","camera","boundingSphere","bSphere","getBoundingInfo","distanceToCamera","mode","ORTHOGRAPHIC_CAMERA","minZ","centerWorld","subtract","globalPosition","compareValue","compareSign","screenArea","meshArea","radiusWorld","Math","PI","onLODLevelSelection","_checkDelayState","_preActivate","_updateSubMeshesBoundingInfo","worldMatrixFromCache","geometry","undefined","kind","copyWhenShared","forceCopy","bypassInstanceData","_this$_userInstancedB","data","_userInstancedBuffersStorage","vertexBuffers","getFloatData","meshes","copyVerticesData","vertexData","getVertexBuffer","_ref","_this$_userInstancedB2","isVerticesDataPresent","_this$_userInstancedB3","_delayInfo","indexOf","isVertexBufferUpdatable","_this$_userInstancedB4","buffer","isUpdatable","getVerticesDataKinds","result","forEach","kinds","getTotalIndices","isBlocked","completeCheck","forceInstanceSupport","subMeshes","engine","mat","defaultMaterial","_storeEffectOnSubMeshes","subMesh","getMaterial","isReadyForSubMesh","currentRenderPassId","light","lightSources","generators","getShadowGenerators","iterator","values","key","next","done","_generator$getShadowM","_generator$getShadowM2","_generator$getShadowM3","generator","getShadowMap","renderList","_shadowMap$renderPass","shadowMap","renderPassIds","p","_subMesh$getMaterial$","_subMesh$getMaterial","needAlphaBlendingForMesh","lod","areNormalsFrozen","freezeNormals","unfreezeNormals","overridenInstanceCount","sceneRenderId","getRenderId","_preActivateForIntermediateRendering","renderId","intermediateDefaultRenderId","_registerInstanceForRenderId","defaultRenderId","selfDefaultRenderId","_renderId","previousRenderId","isFrozen","_afterComputeWorldMatrix","doNotSyncBoundingInfo","thinInstanceRefreshBoundingInfo","_postActivate","edgesShareWithInstances","edgesRenderer","_renderingGroup","_edgesRenderers","pushNoDuplicate","customInstances","getWorldMatrix","applySkeletonOrOptions","applyMorph","hasBoundingInfo","isLocked","applySkeleton","bias","boundingBias","_refreshBoundingInfo","_getData","_createGlobalSubMesh","force","totalVertices","totalIndices","needToRecreate","submesh","indexStart","indexCount","verticesStart","verticesCount","releaseSubMeshes","subdivide","subdivisionSize","offset","CreateFromIndices","synchronizeInstances","updatable","stride","set","RandomId","removeVerticesData","markVerticesDataAsUpdatable","setVerticesBuffer","disposeExistingBuffer","CreateGeometryForMesh","updateVerticesData","updateExtends","makeItUnique","makeGeometryUnique","updateMeshPositions","positionFunction","computeNormals","positions","indices","normals","ComputeNormals","oldGeometry","copy","releaseForMesh","setIndexBuffer","indexBuffer","setIndices","dontForceSubMeshRecreation","updateIndices","gpuMemoryOnly","toLeftHanded","_bind","effect","allowInstancedRendering","indexToBind","_getRenderingFillMode","WireFrameFillMode","_getLinesIndexBuffer","PointFillMode","TriangleFillMode","getIndexBuffer","_bindDirect","isUsingTextureForTargets","vertexArrayObjects","_draw","getVertexBuffers","drawArraysType","drawElementsType","_linesIndexCount","registerBeforeRender","func","unregisterBeforeRender","removeCallback","registerAfterRender","unregisterAfterRender","_getInstancesRenderList","subMeshId","isReplacementMode","previousBatch","isInIntermediateRendering","_isInIntermediateRendering","onlyForInstances","_onlyForInstancesIntermediate","_onlyForInstances","isVisible","currentRenderId","_renderWithInstances","batch","_id","visibleInstanceCount","instanceStorage","currentInstancesBufferSize","instancesBuffer","instancesPreviousBuffer","matricesCount","bufferSize","Float32Array","needsPreviousWorldMatrices","needUpdateBuffer","masterMeshPreviousWorldMatrix","copyToArray","copyFrom","_subMesh$getMaterial2","INSTANCEDMESH_SORT_TRANSPARENT","activeCamera","getRenderingMesh","cameraPosition","instanceIndex","instanceMesh","_distanceToCamera","Distance","m1","m2","matrix","_previousWorldMatrix","dispose","strides","sizes","vertexArrayObject","createVertexBuffer","_invalidateInstanceVertexArrayObject","updateDirectly","_processInstancedBuffers","_activeIndices","addCount","_currentDrawContext","useInstancing","unbindInstanceAttributes","_renderWithThinInstances","_this$_thinInstanceDa","_this$_thinInstanceDa2","previousMatrixData","_thinInstanceCreateMatrixBuffer","_processRendering","renderingMesh","instanceCount","visibleInstancesForSubMesh","_rebuild","_freeze","_unFreeze","renderWithRenderPassId","renderPassId","enableAlphaMode","effectiveMeshReplacement","checkFrustumCulling","isInFrustum","_frustumPlanes","render","s","directRender","_scene$activeCameras$","_scene$activeCameras","_subMesh$_drawWrapper","_drawWrapper$effect","_drawWrapper","_isActiveIntermediate","_isActive","numActiveCameras","activeCameras","canCheckOcclusionQuery","_checkOcclusionQuery","_occlusionDataStorage","forceRenderingWhenOccluded","oldCameraMaxZ","oldCamera","maxZ","updateTransformMatrix","getMesh","_actAsRegularMesh","instanceDataStorage","_wasPreviouslyReady","_getDrawWrapper","setAlphaMode","alphaMode","drawWrapper","step","_beforeRenderingMeshStage","action","effectiveMesh","backFaceCulling","twoSidedLighting","mainDeterminant","_getWorldMatrixDeterminant","_getEffectiveOrientation","ClockWiseSideOrientation","CounterClockWiseSideOrientation","reverse","_preBind","forceDepthWrite","setDepthWrite","bindForSubMesh","bind","separateCullingPass","setState","zOffset","cullBackFaces","stencil","zOffsetUnits","unbind","_afterRenderingMeshStage","performancePriority","cleanMatrixWeights","MatricesWeightsKind","MatricesWeightsExtraKind","_normalizeSkinWeightsAndExtra","_normalizeSkinFourWeights","matricesWeights","numWeights","t","recip","matricesWeightsExtra","validateSkinning","skinned","valid","report","numberNotSorted","missingWeights","maxUsedWeights","numberNotNormalized","numInfluences","usedWeightCounts","toleranceEpsilon","lastWeight","usedWeights","d","tolerance","abs","numBones","bones","matricesIndices","MatricesIndicesKind","matricesIndicesExtra","MatricesIndicesExtraKind","numBadBoneIndices","output","load","_queueLoad","addPendingData","getBinaryData","delayLoadingFile","LoadFile","ArrayBuffer","_delayLoadingFunction","JSON","parse","_syncSubMeshes","removePendingData","offlineProvider","frustumPlanes","setMaterialById","materials","multiMaterials","getAnimatables","results","bakeTransformIntoVertices","transform","submeshes","_resetPointsArrayCache","temp","Zero","TransformCoordinatesFromFloatsToRef","toArray","TransformNormalFromFloatsToRef","normalize","TangentKind","determinant","flipFaces","bakeCurrentTransformIntoVertices","bakeIndependentlyOfChildren","resetLocalMatrix","_positions","_generatePointsArray","doNotRecurse","disposeMaterialAndTextures","clear","abstractMesh","_disposeInstanceSpecificData","_disposeThinInstanceSpecificData","applyDisplacementMap","url","minHeight","maxHeight","onSuccess","uvOffset","uvScale","forceUpdate","onError","onload","img","heightMapWidth","width","heightMapHeight","height","canvas","createCanvas","context","getContext","drawImage","getImageData","applyDisplacementMapFromBuffer","LoadImage","UVKind","uvs","normal","uv","FromArrayToRef","u","x","v","y","pos","r","g","gradient","scaleInPlace","_getFlattenedNormals","normalsCount","flipNormalGeneration","p1","FromArray","p2","p3","p1p2","p3p2","Normalize","Cross","localIndex","z","_convertToUnIndexedMesh","flattenNormals","filter","_this$getVertexBuffer","getIsInstanced","separateVertices","size","newData","meshBoundingInfo","previousSubmeshes","slice","vertexBuffer","getSize","targetIndex","numTargets","target","getTarget","getPositions","setPositions","getNormals","setNormals","tangents","getTangents","setTangents","getUVs","setUVs","synchronize","previousOne","boundingInfo","AddToMesh","materialIndex","setBoundingInfo","convertToFlatShadedMesh","convertToUnIndexedMesh","flipNormals","vertex_data","ExtractFromMesh","increaseVertices","numberPerEdge","currentIndices","isArray","segments","tempIndices","deltaPosition","deltaNormal","deltaUV","vertexIndex","side","len","positionPtr","uvPtr","normalsPtr","j","k","idx","forceSharedVertices","currentUVs","currentPositions","currentColors","colors","currentMatrixIndices","currentMatrixWeights","currentMatrixIndicesExtra","currentMatrixWeightsExtra","matrixIndices","matrixWeights","matrixIndicesExtra","matrixWeightsExtra","pstring","indexPtr","uniquePositions","ptr","facet","_instancedMeshFactory","_PhysicsImpostorParser","physicObject","jsonObject","optimizeIndices","successCallback","vectorPositions","dupes","SyncAsyncForLoop","iteration","realPos","testedPosition","againstPosition","equals","originalSubMeshes","serialize","serializationObject","type","tags","asArray","pivotMatrix","localMatrix","infiniteDistance","pickable","isPickable","receiveShadows","billboardMode","visibility","alwaysSelectAsActiveMesh","checkCollisions","ellipsoid","ellipsoidOffset","isBlocker","_serializeAsParent","geometryUniqueId","geometryId","subIndex","doNotSerialize","materialUniqueId","materialId","morphTargetManagerId","skeletonId","numBoneInfluencers","_getComponent","NAME_PHYSICSENGINE","getPhysicsImpostor","physicsMass","getParam","physicsFriction","physicsRestitution","serializationInstance","actionManager","actions","AppendSerializedAnimations","serializeAnimationRanges","thinInstances","enablePicking","thinInstanceEnablePicking","_userThinInstanceBuffersStorage","userThinInstance","layerMask","alphaIndex","hasVertexAlpha","overlayAlpha","overlayColor","renderOverlay","applyFog","_syncGeometryWithMorphTargetManager","_morphTargetManager","vertexCount","Error","numInfluencers","morphTarget","getActiveTarget","Parse","parsedMesh","rootUrl","_LinesMeshParser","_GroundMeshParser","_GoldbergMeshParser","_GreasedLineMeshParser","_TrailMeshParser","_waitingParsedUniqueId","setPreTransformMatrix","showBoundingBox","showSubMeshesBoundingBox","useFlatShading","freezeWorldMatrix","_waitingData","parentId","parentInstanceIndex","_waitingParentInstanceIndex","buildBoundingInfo","boundingBoxMinimum","boundingBoxMaximum","_binaryInfo","hasUVs","hasUVs2","UV2Kind","hasUVs3","UV3Kind","hasUVs4","UV4Kind","hasUVs5","UV5Kind","hasUVs6","UV6Kind","hasColors","ColorKind","hasMatricesIndices","hasMatricesWeights","_ImportGeometry","ForceFullSceneLoadingForIncremental","_waitingMaterialId","_waitingMorphTargetManagerId","getLastSkeletonById","animationIndex","parsedAnimation","internalClass","ParseAnimationRanges","autoAnimate","beginAnimation","autoAnimateFrom","autoAnimateTo","autoAnimateLoop","autoAnimateSpeed","isNaN","parseInt","lodMeshIds","lods","ids","distances","lodDistances","coverages","lodCoverages","parsedInstance","thinInstanceSetBuffer","setPositionsForCPUSkinning","setNormalsForCPUSkinning","_softwareSkinningFrameId","getFrameId","hasNormals","positionsData","normalsData","matricesIndicesData","matricesWeightsData","needExtras","matricesIndicesExtraData","matricesWeightsExtraData","skeletonMatrices","getTransformMatrices","tempVector3","finalMatrix","tempMatrix","matWeightIdx","inf","weight","FromFloat32ArrayToRefScaled","floor","addToSelf","reset","MinMax","minVector","maxVector","boundingBox","minimumWorld","maximumWorld","minimizeInPlace","maximizeInPlace","min","max","Center","meshesOrMinMaxVector","minMaxVector","MergeMeshes","disposeSource","allow32BitsIndices","meshSubclass","subdivideWithSubMeshes","multiMultiMaterials","_MergeMeshesCoroutine","MergeMeshesAsync","isAsync","Boolean","materialArray","materialIndexArray","indiceArray","currentsideOrientation","isAnInstance","matIndex","subMaterials","getVertexDataFromMesh","wm","sourceVertexData","sourceTransform","meshVertexDatas","mergeCoroutine","_mergeCoroutine","mergeCoroutineStep","applyToCoroutine","_applyToCoroutine","applyToCoroutineStep","newMultiMaterial","addInstance","_indexInSourceMeshInstanceArray","removeInstance","last","pop","_shouldConvertRHS","_this$overrideRenderi","forcePointsCloud","forceWireframe","setMaterialByID","CreateRibbon","pathArray","closeArray","closePath","CreateDisc","radius","tessellation","CreateBox","CreateSphere","diameter","CreateHemisphere","CreateCylinder","diameterTop","diameterBottom","subdivisions","CreateTorus","thickness","CreateTorusKnot","tube","radialSegments","tubularSegments","q","CreateLines","points","CreateDashedLines","dashSize","gapSize","dashNb","CreatePolygon","shape","holes","earcutInjection","ExtrudePolygon","depth","ExtrudeShape","path","scale","cap","ExtrudeShapeCustom","scaleFunction","rotationFunction","ribbonCloseArray","ribbonClosePath","CreateLathe","CreatePlane","CreateGround","CreateTiledGround","xmin","zmin","xmax","zmax","precision","CreateGroundFromHeightMap","onReady","alphaFilter","CreateTube","radiusFunction","CreatePolyhedron","CreateIcoSphere","CreateDecal","angle","CreateCapsule","ExtendToGoldberg","BACKSIDE","DOUBLESIDE","NO_CAP","CAP_START","CAP_END","CAP_ALL","NO_FLIP","FLIP_TILE","ROTATE_TILE","FLIP_ROW","ROTATE_ROW","FLIP_N_ROTATE_TILE","FLIP_N_ROTATE_ROW","CENTER","LEFT","RIGHT","TOP","BOTTOM","_GreasedLineRibbonMeshParser"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/mesh.js"],"sourcesContent":["import { Observable } from \"../Misc/observable.js\";\nimport { Tools, AsyncLoop } from \"../Misc/tools.js\";\nimport { DeepCopier } from \"../Misc/deepCopier.js\";\nimport { Tags } from \"../Misc/tags.js\";\nimport { runCoroutineSync, runCoroutineAsync, createYieldingScheduler } from \"../Misc/coroutine.js\";\nimport { Camera } from \"../Cameras/camera.js\";\nimport { Quaternion, Matrix, Vector3, Vector2 } from \"../Maths/math.vector.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { Node } from \"../node.js\";\nimport { VertexBuffer, Buffer } from \"../Buffers/buffer.js\";\nimport { VertexData } from \"./mesh.vertexData.js\";\nimport { Geometry } from \"./geometry.js\";\nimport { AbstractMesh } from \"./abstractMesh.js\";\nimport { SubMesh } from \"./subMesh.js\";\nimport { Material } from \"../Materials/material.js\";\nimport { MultiMaterial } from \"../Materials/multiMaterial.js\";\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags.js\";\n\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { GetClass, RegisterClass } from \"../Misc/typeStore.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { MeshLODLevel } from \"./meshLODLevel.js\";\n/**\n * @internal\n **/\nexport class _CreationDataStorage {\n}\n/**\n * @internal\n **/\nclass _InstanceDataStorage {\n constructor() {\n this.visibleInstances = {};\n this.batchCache = new _InstancesBatch();\n this.batchCacheReplacementModeInFrozenMode = new _InstancesBatch();\n this.instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances\n }\n}\n/**\n * @internal\n **/\nexport class _InstancesBatch {\n constructor() {\n this.mustReturn = false;\n this.visibleInstances = new Array();\n this.renderSelf = [];\n this.hardwareInstancedRendering = [];\n }\n}\n/**\n * @internal\n **/\nclass _ThinInstanceDataStorage {\n constructor() {\n this.instancesCount = 0;\n this.matrixBuffer = null;\n this.previousMatrixBuffer = null;\n this.matrixBufferSize = 32 * 16; // let's start with a maximum of 32 thin instances\n this.matrixData = null;\n this.boundingVectors = [];\n this.worldMatrices = null;\n }\n}\n/**\n * @internal\n **/\nclass _InternalMeshDataInfo {\n constructor() {\n this._areNormalsFrozen = false; // Will be used by ribbons mainly\n // Will be used to save a source mesh reference, If any\n this._source = null;\n // Will be used to for fast cloned mesh lookup\n this.meshMap = null;\n this._preActivateId = -1;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this._LODLevels = new Array();\n /** Alternative definition of LOD level, using screen coverage instead of distance */\n this._useLODScreenCoverage = false;\n this._effectiveMaterial = null;\n this._forcedInstanceCount = 0;\n this._overrideRenderingFillMode = null;\n }\n}\n/**\n * Class used to represent renderable models\n */\nexport class Mesh extends AbstractMesh {\n /**\n * Gets the default side orientation.\n * @param orientation the orientation to value to attempt to get\n * @returns the default orientation\n * @internal\n */\n static _GetDefaultSideOrientation(orientation) {\n return orientation || Mesh.FRONTSIDE; // works as Mesh.FRONTSIDE is 0\n }\n /**\n * Determines if the LOD levels are intended to be calculated using screen coverage (surface area ratio) instead of distance.\n */\n get useLODScreenCoverage() {\n return this._internalMeshDataInfo._useLODScreenCoverage;\n }\n set useLODScreenCoverage(value) {\n this._internalMeshDataInfo._useLODScreenCoverage = value;\n this._sortLODLevels();\n }\n get computeBonesUsingShaders() {\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\n }\n set computeBonesUsingShaders(value) {\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\n return;\n }\n if (value && this._internalMeshDataInfo._sourcePositions) {\n // switch from software to GPU computation: we need to reset the vertex and normal buffers that have been updated by the software process\n this.setVerticesData(VertexBuffer.PositionKind, this._internalMeshDataInfo._sourcePositions, true);\n if (this._internalMeshDataInfo._sourceNormals) {\n this.setVerticesData(VertexBuffer.NormalKind, this._internalMeshDataInfo._sourceNormals, true);\n }\n this._internalMeshDataInfo._sourcePositions = null;\n this._internalMeshDataInfo._sourceNormals = null;\n }\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\n this._markSubMeshesAsAttributesDirty();\n }\n /**\n * An event triggered before rendering the mesh\n */\n get onBeforeRenderObservable() {\n if (!this._internalMeshDataInfo._onBeforeRenderObservable) {\n this._internalMeshDataInfo._onBeforeRenderObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeRenderObservable;\n }\n /**\n * An event triggered before binding the mesh\n */\n get onBeforeBindObservable() {\n if (!this._internalMeshDataInfo._onBeforeBindObservable) {\n this._internalMeshDataInfo._onBeforeBindObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeBindObservable;\n }\n /**\n * An event triggered after rendering the mesh\n */\n get onAfterRenderObservable() {\n if (!this._internalMeshDataInfo._onAfterRenderObservable) {\n this._internalMeshDataInfo._onAfterRenderObservable = new Observable();\n }\n return this._internalMeshDataInfo._onAfterRenderObservable;\n }\n /**\n * An event triggeredbetween rendering pass when using separateCullingPass = true\n */\n get onBetweenPassObservable() {\n if (!this._internalMeshDataInfo._onBetweenPassObservable) {\n this._internalMeshDataInfo._onBetweenPassObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBetweenPassObservable;\n }\n /**\n * An event triggered before drawing the mesh\n */\n get onBeforeDrawObservable() {\n if (!this._internalMeshDataInfo._onBeforeDrawObservable) {\n this._internalMeshDataInfo._onBeforeDrawObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeDrawObservable;\n }\n /**\n * Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead\n */\n set onBeforeDraw(callback) {\n if (this._onBeforeDrawObserver) {\n this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver);\n }\n this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(callback);\n }\n get hasInstances() {\n return this.instances.length > 0;\n }\n get hasThinInstances() {\n return (this.forcedInstanceCount || this._thinInstanceDataStorage.instancesCount || 0) > 0;\n }\n /**\n * Gets or sets the forced number of instances to display.\n * If 0 (default value), the number of instances is not forced and depends on the draw type\n * (regular / instance / thin instances mesh)\n */\n get forcedInstanceCount() {\n return this._internalMeshDataInfo._forcedInstanceCount;\n }\n set forcedInstanceCount(count) {\n this._internalMeshDataInfo._forcedInstanceCount = count;\n }\n /**\n * Use this property to change the original side orientation defined at construction time\n * Material.sideOrientation will override this value if set\n * User will still be able to change the material sideOrientation afterwards if they really need it\n */\n get sideOrientation() {\n return this._internalMeshDataInfo._sideOrientation;\n }\n set sideOrientation(value) {\n this._internalMeshDataInfo._sideOrientation = value;\n this._internalAbstractMeshDataInfo._sideOrientationHint =\n (this._scene.useRightHandedSystem && value === 1) ||\n (!this._scene.useRightHandedSystem && value === 0);\n }\n /**\n * @deprecated Please use sideOrientation instead.\n * @see https://doc.babylonjs.com/breaking-changes#7110\n */\n get overrideMaterialSideOrientation() {\n return this.sideOrientation;\n }\n set overrideMaterialSideOrientation(value) {\n this.sideOrientation = value;\n if (this.material) {\n this.material.sideOrientation = null;\n }\n }\n /**\n * Use this property to override the Material's fillMode value\n */\n get overrideRenderingFillMode() {\n return this._internalMeshDataInfo._overrideRenderingFillMode;\n }\n set overrideRenderingFillMode(fillMode) {\n this._internalMeshDataInfo._overrideRenderingFillMode = fillMode;\n }\n get material() {\n return this._internalAbstractMeshDataInfo._material;\n }\n set material(value) {\n if (value && ((this.material && this.material.sideOrientation === null) || this._internalAbstractMeshDataInfo._sideOrientationHint)) {\n value.sideOrientation = null;\n }\n this._setMaterial(value);\n }\n /**\n * Gets the source mesh (the one used to clone this one from)\n */\n get source() {\n return this._internalMeshDataInfo._source;\n }\n /**\n * Gets the list of clones of this mesh\n * The scene must have been constructed with useClonedMeshMap=true for this to work!\n * Note that useClonedMeshMap=true is the default setting\n */\n get cloneMeshMap() {\n return this._internalMeshDataInfo.meshMap;\n }\n /**\n * Gets or sets a boolean indicating that this mesh does not use index buffer\n */\n get isUnIndexed() {\n return this._unIndexed;\n }\n set isUnIndexed(value) {\n if (this._unIndexed !== value) {\n this._unIndexed = value;\n this._markSubMeshesAsAttributesDirty();\n }\n }\n /** Gets the array buffer used to store the instanced buffer used for instances' world matrices */\n get worldMatrixInstancedBuffer() {\n return this._instanceDataStorage.instancesData;\n }\n /** Gets the array buffer used to store the instanced buffer used for instances' previous world matrices */\n get previousWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.instancesPreviousData;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */\n get manualUpdateOfWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.manualUpdate;\n }\n set manualUpdateOfWorldMatrixInstancedBuffer(value) {\n this._instanceDataStorage.manualUpdate = value;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */\n get manualUpdateOfPreviousWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.previousManualUpdate;\n }\n set manualUpdateOfPreviousWorldMatrixInstancedBuffer(value) {\n this._instanceDataStorage.previousManualUpdate = value;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices must be performed in all cases (and notably even in frozen mode) */\n get forceWorldMatrixInstancedBufferUpdate() {\n return this._instanceDataStorage.forceMatrixUpdates;\n }\n set forceWorldMatrixInstancedBufferUpdate(value) {\n this._instanceDataStorage.forceMatrixUpdates = value;\n }\n _copySource(source, doNotCloneChildren, clonePhysicsImpostor = true) {\n const scene = this.getScene();\n // Geometry\n if (source._geometry) {\n source._geometry.applyToMesh(this);\n }\n // Deep copy\n DeepCopier.DeepCopy(source, this, [\n \"name\",\n \"material\",\n \"skeleton\",\n \"instances\",\n \"parent\",\n \"uniqueId\",\n \"source\",\n \"metadata\",\n \"morphTargetManager\",\n \"hasInstances\",\n \"worldMatrixInstancedBuffer\",\n \"previousWorldMatrixInstancedBuffer\",\n \"hasLODLevels\",\n \"geometry\",\n \"isBlocked\",\n \"areNormalsFrozen\",\n \"facetNb\",\n \"isFacetDataEnabled\",\n \"lightSources\",\n \"useBones\",\n \"isAnInstance\",\n \"collider\",\n \"edgesRenderer\",\n \"forward\",\n \"up\",\n \"right\",\n \"absolutePosition\",\n \"absoluteScaling\",\n \"absoluteRotationQuaternion\",\n \"isWorldMatrixFrozen\",\n \"nonUniformScaling\",\n \"behaviors\",\n \"worldMatrixFromCache\",\n \"hasThinInstances\",\n \"cloneMeshMap\",\n \"hasBoundingInfo\",\n \"physicsBody\",\n \"physicsImpostor\",\n ], [\"_poseMatrix\"]);\n // Source mesh\n this._internalMeshDataInfo._source = source;\n if (scene.useClonedMeshMap) {\n if (!source._internalMeshDataInfo.meshMap) {\n source._internalMeshDataInfo.meshMap = {};\n }\n source._internalMeshDataInfo.meshMap[this.uniqueId] = this;\n }\n // Construction Params\n // Clone parameters allowing mesh to be updated in case of parametric shapes.\n this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;\n this._creationDataStorage = source._creationDataStorage;\n // Animation ranges\n if (source._ranges) {\n const ranges = source._ranges;\n for (const name in ranges) {\n if (!Object.prototype.hasOwnProperty.call(ranges, name)) {\n continue;\n }\n if (!ranges[name]) {\n continue;\n }\n this.createAnimationRange(name, ranges[name].from, ranges[name].to);\n }\n }\n // Metadata\n if (source.metadata && source.metadata.clone) {\n this.metadata = source.metadata.clone();\n }\n else {\n this.metadata = source.metadata;\n }\n this._internalMetadata = source._internalMetadata;\n // Tags\n if (Tags && Tags.HasTags(source)) {\n Tags.AddTagsTo(this, Tags.GetTags(source, true));\n }\n // Enabled. We shouldn't need to check the source's ancestors, as this mesh\n // will have the same ones.\n this.setEnabled(source.isEnabled(false));\n // Parent\n this.parent = source.parent;\n // Pivot\n this.setPivotMatrix(source.getPivotMatrix(), this._postMultiplyPivotMatrix);\n this.id = this.name + \".\" + source.id;\n // Material\n this.material = source.material;\n if (!doNotCloneChildren) {\n // Children\n const directDescendants = source.getDescendants(true);\n for (let index = 0; index < directDescendants.length; index++) {\n const child = directDescendants[index];\n if (child.clone) {\n child.clone(this.name + \".\" + child.name, this);\n }\n }\n }\n // Morphs\n if (source.morphTargetManager) {\n this.morphTargetManager = source.morphTargetManager;\n }\n // Physics clone\n if (scene.getPhysicsEngine) {\n const physicsEngine = scene.getPhysicsEngine();\n if (clonePhysicsImpostor && physicsEngine) {\n if (physicsEngine.getPluginVersion() === 1) {\n const impostor = physicsEngine.getImpostorForPhysicsObject(source);\n if (impostor) {\n this.physicsImpostor = impostor.clone(this);\n }\n }\n else if (physicsEngine.getPluginVersion() === 2) {\n if (source.physicsBody) {\n source.physicsBody.clone(this);\n }\n }\n }\n }\n // Particles\n for (let index = 0; index < scene.particleSystems.length; index++) {\n const system = scene.particleSystems[index];\n if (system.emitter === source) {\n system.clone(system.name, this);\n }\n }\n // Skeleton\n this.skeleton = source.skeleton;\n this.refreshBoundingInfo(true, true);\n this.computeWorldMatrix(true);\n }\n /**\n * Constructor\n * @param name The value used by scene.getMeshByName() to do a lookup.\n * @param scene The scene to add this mesh to.\n * @param parent The parent of this mesh, if it has one\n * @param source An optional Mesh from which geometry is shared, cloned.\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\n * When false, achieved by calling a clone(), also passing False.\n * This will make creation of children, recursive.\n * @param clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.\n */\n constructor(name, scene = null, parent = null, source = null, doNotCloneChildren, clonePhysicsImpostor = true) {\n super(name, scene);\n // Internal data\n this._internalMeshDataInfo = new _InternalMeshDataInfo();\n // Members\n /**\n * Gets the delay loading state of the mesh (when delay loading is turned on)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/incrementalLoading\n */\n this.delayLoadState = 0;\n /**\n * Gets the list of instances created from this mesh\n * it is not supposed to be modified manually.\n * Note also that the order of the InstancedMesh wihin the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances\n */\n this.instances = [];\n // Private\n /** @internal */\n this._creationDataStorage = null;\n /** @internal */\n this._geometry = null;\n /** @internal */\n this._instanceDataStorage = new _InstanceDataStorage();\n /** @internal */\n this._thinInstanceDataStorage = new _ThinInstanceDataStorage();\n /** @internal */\n this._shouldGenerateFlatShading = false;\n // Use by builder only to know what orientation were the mesh build in.\n /** @internal */\n this._originalBuilderSideOrientation = Mesh.DEFAULTSIDE;\n /**\n * Gets or sets a boolean indicating whether to render ignoring the active camera's max z setting. (false by default)\n * You should not mix meshes that have this property set to true with meshes that have it set to false if they all write\n * to the depth buffer, because the z-values are not comparable in the two cases and you will get rendering artifacts if you do.\n * You can set the property to true for meshes that do not write to the depth buffer, or set the same value (either false or true) otherwise.\n * Note this will reduce performance when set to true.\n */\n this.ignoreCameraMaxZ = false;\n scene = this.getScene();\n if (this._scene.useRightHandedSystem) {\n this.sideOrientation = 0;\n }\n else {\n this.sideOrientation = 1;\n }\n this._onBeforeDraw = (isInstance, world, effectiveMaterial) => {\n if (isInstance && effectiveMaterial) {\n if (this._uniformBuffer) {\n this.transferToEffect(world);\n }\n else {\n effectiveMaterial.bindOnlyWorldMatrix(world);\n }\n }\n };\n if (source) {\n this._copySource(source, doNotCloneChildren, clonePhysicsImpostor);\n }\n // Parent\n if (parent !== null) {\n this.parent = parent;\n }\n this._instanceDataStorage.hardwareInstancedRendering = this.getEngine().getCaps().instancedArrays;\n this._internalMeshDataInfo._onMeshReadyObserverAdded = (observer) => {\n // only notify once! then unregister the observer\n observer.unregisterOnNextCall = true;\n if (this.isReady(true)) {\n this.onMeshReadyObservable.notifyObservers(this);\n }\n else {\n if (!this._internalMeshDataInfo._checkReadinessObserver) {\n this._internalMeshDataInfo._checkReadinessObserver = this._scene.onBeforeRenderObservable.add(() => {\n // check for complete readiness\n if (this.isReady(true)) {\n this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver);\n this._internalMeshDataInfo._checkReadinessObserver = null;\n this.onMeshReadyObservable.notifyObservers(this);\n }\n });\n }\n }\n };\n this.onMeshReadyObservable = new Observable(this._internalMeshDataInfo._onMeshReadyObserverAdded);\n if (source) {\n source.onClonedObservable.notifyObservers(this);\n }\n }\n instantiateHierarchy(newParent = null, options, onNewNodeCreated) {\n const instance = this.getTotalVertices() === 0 || (options && options.doNotInstantiate && (options.doNotInstantiate === true || options.doNotInstantiate(this)))\n ? this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true)\n : this.createInstance(\"instance of \" + (this.name || this.id));\n instance.parent = newParent || this.parent;\n instance.position = this.position.clone();\n instance.scaling = this.scaling.clone();\n if (this.rotationQuaternion) {\n instance.rotationQuaternion = this.rotationQuaternion.clone();\n }\n else {\n instance.rotation = this.rotation.clone();\n }\n if (onNewNodeCreated) {\n onNewNodeCreated(this, instance);\n }\n for (const child of this.getChildTransformNodes(true)) {\n // instancedMesh should have a different sourced mesh\n if (child.getClassName() === \"InstancedMesh\" && instance.getClassName() === \"Mesh\" && child.sourceMesh === this) {\n child.instantiateHierarchy(instance, {\n doNotInstantiate: (options && options.doNotInstantiate) || false,\n newSourcedMesh: instance,\n }, onNewNodeCreated);\n }\n else {\n child.instantiateHierarchy(instance, options, onNewNodeCreated);\n }\n }\n return instance;\n }\n /**\n * Gets the class name\n * @returns the string \"Mesh\".\n */\n getClassName() {\n return \"Mesh\";\n }\n /** @internal */\n get _isMesh() {\n return true;\n }\n /**\n * Returns a description of this mesh\n * @param fullDetails define if full details about this mesh must be used\n * @returns a descriptive string representing this mesh\n */\n toString(fullDetails) {\n let ret = super.toString(fullDetails);\n ret += \", n vertices: \" + this.getTotalVertices();\n ret += \", parent: \" + (this._waitingParentId ? this._waitingParentId : this.parent ? this.parent.name : \"NONE\");\n if (this.animations) {\n for (let i = 0; i < this.animations.length; i++) {\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\n }\n }\n if (fullDetails) {\n if (this._geometry) {\n const ib = this.getIndices();\n const vb = this.getVerticesData(VertexBuffer.PositionKind);\n if (vb && ib) {\n ret += \", flat shading: \" + (vb.length / 3 === ib.length ? \"YES\" : \"NO\");\n }\n }\n else {\n ret += \", flat shading: UNKNOWN\";\n }\n }\n return ret;\n }\n /** @internal */\n _unBindEffect() {\n super._unBindEffect();\n for (const instance of this.instances) {\n instance._unBindEffect();\n }\n }\n /**\n * Gets a boolean indicating if this mesh has LOD\n */\n get hasLODLevels() {\n return this._internalMeshDataInfo._LODLevels.length > 0;\n }\n /**\n * Gets the list of MeshLODLevel associated with the current mesh\n * @returns an array of MeshLODLevel\n */\n getLODLevels() {\n return this._internalMeshDataInfo._LODLevels;\n }\n _sortLODLevels() {\n const sortingOrderFactor = this._internalMeshDataInfo._useLODScreenCoverage ? -1 : 1;\n this._internalMeshDataInfo._LODLevels.sort((a, b) => {\n if (a.distanceOrScreenCoverage < b.distanceOrScreenCoverage) {\n return sortingOrderFactor;\n }\n if (a.distanceOrScreenCoverage > b.distanceOrScreenCoverage) {\n return -sortingOrderFactor;\n }\n return 0;\n });\n }\n /**\n * Add a mesh as LOD level triggered at the given distance.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param distanceOrScreenCoverage Either distance from the center of the object to show this level or the screen coverage if `useScreenCoverage` is set to `true`.\n * If screen coverage, value is a fraction of the screen's total surface, between 0 and 1.\n * Example Playground for distance https://playground.babylonjs.com/#QE7KM#197\n * Example Playground for screen coverage https://playground.babylonjs.com/#QE7KM#196\n * @param mesh The mesh to be added as LOD level (can be null)\n * @returns This mesh (for chaining)\n */\n addLODLevel(distanceOrScreenCoverage, mesh) {\n if (mesh && mesh._masterMesh) {\n Logger.Warn(\"You cannot use a mesh as LOD level twice\");\n return this;\n }\n const level = new MeshLODLevel(distanceOrScreenCoverage, mesh);\n this._internalMeshDataInfo._LODLevels.push(level);\n if (mesh) {\n mesh._masterMesh = this;\n }\n this._sortLODLevels();\n return this;\n }\n /**\n * Returns the LOD level mesh at the passed distance or null if not found.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param distance The distance from the center of the object to show this level\n * @returns a Mesh or `null`\n */\n getLODLevelAtDistance(distance) {\n const internalDataInfo = this._internalMeshDataInfo;\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n const level = internalDataInfo._LODLevels[index];\n if (level.distanceOrScreenCoverage === distance) {\n return level.mesh;\n }\n }\n return null;\n }\n /**\n * Remove a mesh from the LOD array\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param mesh defines the mesh to be removed\n * @returns This mesh (for chaining)\n */\n removeLODLevel(mesh) {\n const internalDataInfo = this._internalMeshDataInfo;\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n if (internalDataInfo._LODLevels[index].mesh === mesh) {\n internalDataInfo._LODLevels.splice(index, 1);\n if (mesh) {\n mesh._masterMesh = null;\n }\n }\n }\n this._sortLODLevels();\n return this;\n }\n /**\n * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param camera defines the camera to use to compute distance\n * @param boundingSphere defines a custom bounding sphere to use instead of the one from this mesh\n * @returns This mesh (for chaining)\n */\n getLOD(camera, boundingSphere) {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._LODLevels || internalDataInfo._LODLevels.length === 0) {\n return this;\n }\n const bSphere = boundingSphere || this.getBoundingInfo().boundingSphere;\n const distanceToCamera = camera.mode === Camera.ORTHOGRAPHIC_CAMERA ? camera.minZ : bSphere.centerWorld.subtract(camera.globalPosition).length();\n let compareValue = distanceToCamera;\n let compareSign = 1;\n if (internalDataInfo._useLODScreenCoverage) {\n const screenArea = camera.screenArea;\n let meshArea = (bSphere.radiusWorld * camera.minZ) / distanceToCamera;\n meshArea = meshArea * meshArea * Math.PI;\n compareValue = meshArea / screenArea;\n compareSign = -1;\n }\n if (compareSign * internalDataInfo._LODLevels[internalDataInfo._LODLevels.length - 1].distanceOrScreenCoverage > compareSign * compareValue) {\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, this);\n }\n return this;\n }\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n const level = internalDataInfo._LODLevels[index];\n if (compareSign * level.distanceOrScreenCoverage < compareSign * compareValue) {\n if (level.mesh) {\n if (level.mesh.delayLoadState === 4) {\n level.mesh._checkDelayState();\n return this;\n }\n if (level.mesh.delayLoadState === 2) {\n return this;\n }\n level.mesh._preActivate();\n level.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\n }\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, level.mesh);\n }\n return level.mesh;\n }\n }\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, this);\n }\n return this;\n }\n /**\n * Gets the mesh internal Geometry object\n */\n get geometry() {\n return this._geometry;\n }\n /**\n * Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.\n * @returns the total number of vertices\n */\n getTotalVertices() {\n if (this._geometry === null || this._geometry === undefined) {\n return 0;\n }\n return this._geometry.getTotalVertices();\n }\n /**\n * Returns the content of an associated vertex buffer\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param copyWhenShared defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one\n * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.\n */\n getVerticesData(kind, copyWhenShared, forceCopy, bypassInstanceData) {\n if (!this._geometry) {\n return null;\n }\n let data = bypassInstanceData\n ? undefined\n : this._userInstancedBuffersStorage?.vertexBuffers[kind]?.getFloatData(this.instances.length + 1, // +1 because the master mesh is not included in the instances array\n forceCopy || (copyWhenShared && this._geometry.meshes.length !== 1));\n if (!data) {\n data = this._geometry.getVerticesData(kind, copyWhenShared, forceCopy);\n }\n return data;\n }\n copyVerticesData(kind, vertexData) {\n if (this._geometry) {\n this._geometry.copyVerticesData(kind, vertexData);\n }\n }\n /**\n * Returns the mesh VertexBuffer object from the requested `kind`\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.NormalKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a FloatArray or null if the mesh has no vertex buffer for this kind.\n */\n getVertexBuffer(kind, bypassInstanceData) {\n if (!this._geometry) {\n return null;\n }\n return (bypassInstanceData ? undefined : this._userInstancedBuffersStorage?.vertexBuffers[kind]) ?? this._geometry.getVertexBuffer(kind);\n }\n /**\n * Tests if a specific vertex buffer is associated with this mesh\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.NormalKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a boolean\n */\n isVerticesDataPresent(kind, bypassInstanceData) {\n if (!this._geometry) {\n if (this._delayInfo) {\n return this._delayInfo.indexOf(kind) !== -1;\n }\n return false;\n }\n return (!bypassInstanceData && this._userInstancedBuffersStorage?.vertexBuffers[kind] !== undefined) || this._geometry.isVerticesDataPresent(kind);\n }\n /**\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable.\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a boolean\n */\n isVertexBufferUpdatable(kind, bypassInstanceData) {\n if (!this._geometry) {\n if (this._delayInfo) {\n return this._delayInfo.indexOf(kind) !== -1;\n }\n return false;\n }\n if (!bypassInstanceData) {\n const buffer = this._userInstancedBuffersStorage?.vertexBuffers[kind];\n if (buffer) {\n return buffer.isUpdatable();\n }\n }\n return this._geometry.isVertexBufferUpdatable(kind);\n }\n /**\n * Returns a string which contains the list of existing `kinds` of Vertex Data associated with this mesh.\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns an array of strings\n */\n getVerticesDataKinds(bypassInstanceData) {\n if (!this._geometry) {\n const result = [];\n if (this._delayInfo) {\n this._delayInfo.forEach(function (kind) {\n result.push(kind);\n });\n }\n return result;\n }\n const kinds = this._geometry.getVerticesDataKinds();\n if (!bypassInstanceData && this._userInstancedBuffersStorage) {\n for (const kind in this._userInstancedBuffersStorage.vertexBuffers) {\n if (kinds.indexOf(kind) === -1) {\n kinds.push(kind);\n }\n }\n }\n return kinds;\n }\n /**\n * Returns a positive integer : the total number of indices in this mesh geometry.\n * @returns the numner of indices or zero if the mesh has no geometry.\n */\n getTotalIndices() {\n if (!this._geometry) {\n return 0;\n }\n return this._geometry.getTotalIndices();\n }\n /**\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\n * @returns the indices array or an empty array if the mesh has no geometry\n */\n getIndices(copyWhenShared, forceCopy) {\n if (!this._geometry) {\n return [];\n }\n return this._geometry.getIndices(copyWhenShared, forceCopy);\n }\n get isBlocked() {\n return this._masterMesh !== null && this._masterMesh !== undefined;\n }\n /**\n * Determine if the current mesh is ready to be rendered\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\n * @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)\n * @returns true if all associated assets are ready (material, textures, shaders)\n */\n isReady(completeCheck = false, forceInstanceSupport = false) {\n if (this.delayLoadState === 2) {\n return false;\n }\n if (!super.isReady(completeCheck)) {\n return false;\n }\n if (!this.subMeshes || this.subMeshes.length === 0) {\n return true;\n }\n if (!completeCheck) {\n return true;\n }\n const engine = this.getEngine();\n const scene = this.getScene();\n const hardwareInstancedRendering = forceInstanceSupport || (engine.getCaps().instancedArrays && (this.instances.length > 0 || this.hasThinInstances));\n this.computeWorldMatrix();\n const mat = this.material || scene.defaultMaterial;\n if (mat) {\n if (mat._storeEffectOnSubMeshes) {\n for (const subMesh of this.subMeshes) {\n const effectiveMaterial = subMesh.getMaterial();\n if (effectiveMaterial) {\n if (effectiveMaterial._storeEffectOnSubMeshes) {\n if (!effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\n return false;\n }\n }\n else {\n if (!effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\n return false;\n }\n }\n }\n }\n }\n else {\n if (!mat.isReady(this, hardwareInstancedRendering)) {\n return false;\n }\n }\n }\n // Shadows\n const currentRenderPassId = engine.currentRenderPassId;\n for (const light of this.lightSources) {\n const generators = light.getShadowGenerators();\n if (!generators) {\n continue;\n }\n const iterator = generators.values();\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\n const generator = key.value;\n if (generator && (!generator.getShadowMap()?.renderList || (generator.getShadowMap()?.renderList && generator.getShadowMap()?.renderList?.indexOf(this) !== -1))) {\n const shadowMap = generator.getShadowMap();\n const renderPassIds = shadowMap.renderPassIds ?? [engine.currentRenderPassId];\n for (let p = 0; p < renderPassIds.length; ++p) {\n engine.currentRenderPassId = renderPassIds[p];\n for (const subMesh of this.subMeshes) {\n if (!generator.isReady(subMesh, hardwareInstancedRendering, subMesh.getMaterial()?.needAlphaBlendingForMesh(this) ?? false)) {\n engine.currentRenderPassId = currentRenderPassId;\n return false;\n }\n }\n }\n engine.currentRenderPassId = currentRenderPassId;\n }\n }\n }\n // LOD\n for (const lod of this._internalMeshDataInfo._LODLevels) {\n if (lod.mesh && !lod.mesh.isReady(hardwareInstancedRendering)) {\n return false;\n }\n }\n return true;\n }\n /**\n * Gets a boolean indicating if the normals aren't to be recomputed on next mesh `positions` array update. This property is pertinent only for updatable parametric shapes.\n */\n get areNormalsFrozen() {\n return this._internalMeshDataInfo._areNormalsFrozen;\n }\n /**\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next `positions` array update.\n * @returns the current mesh\n */\n freezeNormals() {\n this._internalMeshDataInfo._areNormalsFrozen = true;\n return this;\n }\n /**\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen\n * @returns the current mesh\n */\n unfreezeNormals() {\n this._internalMeshDataInfo._areNormalsFrozen = false;\n return this;\n }\n /**\n * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs\n */\n set overridenInstanceCount(count) {\n this._instanceDataStorage.overridenInstanceCount = count;\n }\n // Methods\n /** @internal */\n _preActivate() {\n const internalDataInfo = this._internalMeshDataInfo;\n const sceneRenderId = this.getScene().getRenderId();\n if (internalDataInfo._preActivateId === sceneRenderId) {\n return this;\n }\n internalDataInfo._preActivateId = sceneRenderId;\n this._instanceDataStorage.visibleInstances = null;\n return this;\n }\n /**\n * @internal\n */\n _preActivateForIntermediateRendering(renderId) {\n if (this._instanceDataStorage.visibleInstances) {\n this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = renderId;\n }\n return this;\n }\n /**\n * @internal\n */\n _registerInstanceForRenderId(instance, renderId) {\n if (!this._instanceDataStorage.visibleInstances) {\n this._instanceDataStorage.visibleInstances = {\n defaultRenderId: renderId,\n selfDefaultRenderId: this._renderId,\n };\n }\n if (!this._instanceDataStorage.visibleInstances[renderId]) {\n if (this._instanceDataStorage.previousRenderId !== undefined && this._instanceDataStorage.isFrozen) {\n this._instanceDataStorage.visibleInstances[this._instanceDataStorage.previousRenderId] = null;\n }\n this._instanceDataStorage.previousRenderId = renderId;\n this._instanceDataStorage.visibleInstances[renderId] = new Array();\n }\n this._instanceDataStorage.visibleInstances[renderId].push(instance);\n return this;\n }\n _afterComputeWorldMatrix() {\n super._afterComputeWorldMatrix();\n if (!this.hasThinInstances) {\n return;\n }\n if (!this.doNotSyncBoundingInfo) {\n this.thinInstanceRefreshBoundingInfo(false);\n }\n }\n /** @internal */\n _postActivate() {\n if (this.edgesShareWithInstances && this.edgesRenderer && this.edgesRenderer.isEnabled && this._renderingGroup) {\n this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer);\n this.edgesRenderer.customInstances.push(this.getWorldMatrix());\n }\n }\n /**\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\n * This means the mesh underlying bounding box and sphere are recomputed.\n * @param applySkeletonOrOptions defines whether to apply the skeleton before computing the bounding info or a set of options\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\n * @returns the current mesh\n */\n refreshBoundingInfo(applySkeletonOrOptions = false, applyMorph = false) {\n if (this.hasBoundingInfo && this.getBoundingInfo().isLocked) {\n return this;\n }\n let options;\n if (typeof applySkeletonOrOptions === \"object\") {\n options = applySkeletonOrOptions;\n }\n else {\n options = {\n applySkeleton: applySkeletonOrOptions,\n applyMorph: applyMorph,\n };\n }\n const bias = this.geometry ? this.geometry.boundingBias : null;\n this._refreshBoundingInfo(this._getData(options, null, VertexBuffer.PositionKind), bias);\n return this;\n }\n /**\n * @internal\n */\n _createGlobalSubMesh(force) {\n const totalVertices = this.getTotalVertices();\n if (!totalVertices || !this.getIndices()) {\n return null;\n }\n // Check if we need to recreate the submeshes\n if (this.subMeshes && this.subMeshes.length > 0) {\n const ib = this.getIndices();\n if (!ib) {\n return null;\n }\n const totalIndices = ib.length;\n let needToRecreate = false;\n if (force) {\n needToRecreate = true;\n }\n else {\n for (const submesh of this.subMeshes) {\n if (submesh.indexStart + submesh.indexCount > totalIndices) {\n needToRecreate = true;\n break;\n }\n if (submesh.verticesStart + submesh.verticesCount > totalVertices) {\n needToRecreate = true;\n break;\n }\n }\n }\n if (!needToRecreate) {\n return this.subMeshes[0];\n }\n }\n this.releaseSubMeshes();\n return new SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);\n }\n /**\n * This function will subdivide the mesh into multiple submeshes\n * @param count defines the expected number of submeshes\n */\n subdivide(count) {\n if (count < 1) {\n return;\n }\n const totalIndices = this.getTotalIndices();\n let subdivisionSize = (totalIndices / count) | 0;\n let offset = 0;\n // Ensure that subdivisionSize is a multiple of 3\n while (subdivisionSize % 3 !== 0) {\n subdivisionSize++;\n }\n this.releaseSubMeshes();\n for (let index = 0; index < count; index++) {\n if (offset >= totalIndices) {\n break;\n }\n SubMesh.CreateFromIndices(0, offset, index === count - 1 ? totalIndices - offset : subdivisionSize, this, undefined, false);\n offset += subdivisionSize;\n }\n this.refreshBoundingInfo();\n this.synchronizeInstances();\n }\n /**\n * Copy a FloatArray into a specific associated vertex buffer\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param data defines the data source\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\n * @param stride defines the data stride size (can be null)\n * @returns the current mesh\n */\n setVerticesData(kind, data, updatable = false, stride) {\n if (!this._geometry) {\n const vertexData = new VertexData();\n vertexData.set(data, kind);\n const scene = this.getScene();\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\n }\n else {\n this._geometry.setVerticesData(kind, data, updatable, stride);\n }\n return this;\n }\n /**\n * Delete a vertex buffer associated with this mesh\n * @param kind defines which buffer to delete (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n */\n removeVerticesData(kind) {\n if (!this._geometry) {\n return;\n }\n this._geometry.removeVerticesData(kind);\n }\n /**\n * Flags an associated vertex buffer as updatable\n * @param kind defines which buffer to use (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\n */\n markVerticesDataAsUpdatable(kind, updatable = true) {\n const vb = this.getVertexBuffer(kind);\n if (!vb || vb.isUpdatable() === updatable) {\n return;\n }\n this.setVerticesData(kind, this.getVerticesData(kind), updatable);\n }\n /**\n * Sets the mesh global Vertex Buffer\n * @param buffer defines the buffer to use\n * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)\n * @returns the current mesh\n */\n setVerticesBuffer(buffer, disposeExistingBuffer = true) {\n if (!this._geometry) {\n this._geometry = Geometry.CreateGeometryForMesh(this);\n }\n this._geometry.setVerticesBuffer(buffer, null, disposeExistingBuffer);\n return this;\n }\n /**\n * Update a specific associated vertex buffer\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param data defines the data source\n * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for \"position\" kind\n * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)\n * @returns the current mesh\n */\n updateVerticesData(kind, data, updateExtends, makeItUnique) {\n if (!this._geometry) {\n return this;\n }\n if (!makeItUnique) {\n this._geometry.updateVerticesData(kind, data, updateExtends);\n }\n else {\n this.makeGeometryUnique();\n this.updateVerticesData(kind, data, updateExtends, false);\n }\n return this;\n }\n /**\n * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#other-shapes-updatemeshpositions\n * @param positionFunction is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything\n * @param computeNormals is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update\n * @returns the current mesh\n */\n updateMeshPositions(positionFunction, computeNormals = true) {\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positions) {\n return this;\n }\n positionFunction(positions);\n this.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\n if (computeNormals) {\n const indices = this.getIndices();\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\n if (!normals) {\n return this;\n }\n VertexData.ComputeNormals(positions, indices, normals);\n this.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\n }\n return this;\n }\n /**\n * Creates a un-shared specific occurence of the geometry for the mesh.\n * @returns the current mesh\n */\n makeGeometryUnique() {\n if (!this._geometry) {\n return this;\n }\n if (this._geometry.meshes.length === 1) {\n return this;\n }\n const oldGeometry = this._geometry;\n const geometry = this._geometry.copy(Geometry.RandomId());\n oldGeometry.releaseForMesh(this, true);\n geometry.applyToMesh(this);\n return this;\n }\n /**\n * Sets the index buffer of this mesh.\n * @param indexBuffer Defines the index buffer to use for this mesh\n * @param totalVertices Defines the total number of vertices used by the buffer\n * @param totalIndices Defines the total number of indices in the index buffer\n */\n setIndexBuffer(indexBuffer, totalVertices, totalIndices) {\n let geometry = this._geometry;\n if (!geometry) {\n geometry = new Geometry(Geometry.RandomId(), this.getScene(), undefined, undefined, this);\n }\n geometry.setIndexBuffer(indexBuffer, totalVertices, totalIndices);\n }\n /**\n * Set the index buffer of this mesh\n * @param indices defines the source data\n * @param totalVertices defines the total number of vertices referenced by this index data (can be null)\n * @param updatable defines if the updated index buffer must be flagged as updatable (default is false)\n * @param dontForceSubMeshRecreation defines a boolean indicating that we don't want to force the recreation of sub-meshes if we don't have to (false by default)\n * @returns the current mesh\n */\n setIndices(indices, totalVertices = null, updatable = false, dontForceSubMeshRecreation = false) {\n if (!this._geometry) {\n const vertexData = new VertexData();\n vertexData.indices = indices;\n const scene = this.getScene();\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\n }\n else {\n this._geometry.setIndices(indices, totalVertices, updatable, dontForceSubMeshRecreation);\n }\n return this;\n }\n /**\n * Update the current index buffer\n * @param indices defines the source data\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\n * @returns the current mesh\n */\n updateIndices(indices, offset, gpuMemoryOnly = false) {\n if (!this._geometry) {\n return this;\n }\n this._geometry.updateIndices(indices, offset, gpuMemoryOnly);\n return this;\n }\n /**\n * Invert the geometry to move from a right handed system to a left handed one.\n * @returns the current mesh\n */\n toLeftHanded() {\n if (!this._geometry) {\n return this;\n }\n this._geometry.toLeftHanded();\n return this;\n }\n /**\n * @internal\n */\n _bind(subMesh, effect, fillMode, allowInstancedRendering = true) {\n if (!this._geometry) {\n return this;\n }\n const engine = this.getScene().getEngine();\n // Wireframe\n let indexToBind;\n if (this._unIndexed) {\n switch (this._getRenderingFillMode(fillMode)) {\n case Material.WireFrameFillMode:\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\n break;\n default:\n indexToBind = null;\n break;\n }\n }\n else {\n switch (this._getRenderingFillMode(fillMode)) {\n case Material.PointFillMode:\n indexToBind = null;\n break;\n case Material.WireFrameFillMode:\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\n break;\n default:\n case Material.TriangleFillMode:\n indexToBind = this._geometry.getIndexBuffer();\n break;\n }\n }\n return this._bindDirect(effect, indexToBind, allowInstancedRendering);\n }\n /**\n * @internal\n */\n _bindDirect(effect, indexToBind, allowInstancedRendering = true) {\n if (!this._geometry) {\n return this;\n }\n // Morph targets\n if (this.morphTargetManager && this.morphTargetManager.isUsingTextureForTargets) {\n this.morphTargetManager._bind(effect);\n }\n // VBOs\n if (!allowInstancedRendering || !this._userInstancedBuffersStorage || this.hasThinInstances) {\n this._geometry._bind(effect, indexToBind);\n }\n else {\n this._geometry._bind(effect, indexToBind, this._userInstancedBuffersStorage.vertexBuffers, this._userInstancedBuffersStorage.vertexArrayObjects);\n }\n return this;\n }\n /**\n * @internal\n */\n _draw(subMesh, fillMode, instancesCount) {\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\n return this;\n }\n if (this._internalMeshDataInfo._onBeforeDrawObservable) {\n this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);\n }\n const scene = this.getScene();\n const engine = scene.getEngine();\n if ((this._unIndexed && fillMode !== Material.WireFrameFillMode) || fillMode == Material.PointFillMode) {\n // or triangles as points\n engine.drawArraysType(fillMode, subMesh.verticesStart, subMesh.verticesCount, this.forcedInstanceCount || instancesCount);\n }\n else if (fillMode == Material.WireFrameFillMode) {\n // Triangles as wireframe\n engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, this.forcedInstanceCount || instancesCount);\n }\n else {\n engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, this.forcedInstanceCount || instancesCount);\n }\n return this;\n }\n /**\n * Registers for this mesh a javascript function called just before the rendering process\n * @param func defines the function to call before rendering this mesh\n * @returns the current mesh\n */\n registerBeforeRender(func) {\n this.onBeforeRenderObservable.add(func);\n return this;\n }\n /**\n * Disposes a previously registered javascript function called before the rendering\n * @param func defines the function to remove\n * @returns the current mesh\n */\n unregisterBeforeRender(func) {\n this.onBeforeRenderObservable.removeCallback(func);\n return this;\n }\n /**\n * Registers for this mesh a javascript function called just after the rendering is complete\n * @param func defines the function to call after rendering this mesh\n * @returns the current mesh\n */\n registerAfterRender(func) {\n this.onAfterRenderObservable.add(func);\n return this;\n }\n /**\n * Disposes a previously registered javascript function called after the rendering.\n * @param func defines the function to remove\n * @returns the current mesh\n */\n unregisterAfterRender(func) {\n this.onAfterRenderObservable.removeCallback(func);\n return this;\n }\n /**\n * @internal\n */\n _getInstancesRenderList(subMeshId, isReplacementMode = false) {\n if (this._instanceDataStorage.isFrozen) {\n if (isReplacementMode) {\n this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[subMeshId] = false;\n this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.renderSelf[subMeshId] = true;\n return this._instanceDataStorage.batchCacheReplacementModeInFrozenMode;\n }\n if (this._instanceDataStorage.previousBatch) {\n return this._instanceDataStorage.previousBatch;\n }\n }\n const scene = this.getScene();\n const isInIntermediateRendering = scene._isInIntermediateRendering();\n const onlyForInstances = isInIntermediateRendering\n ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate\n : this._internalAbstractMeshDataInfo._onlyForInstances;\n const batchCache = this._instanceDataStorage.batchCache;\n batchCache.mustReturn = false;\n batchCache.renderSelf[subMeshId] = isReplacementMode || (!onlyForInstances && this.isEnabled() && this.isVisible);\n batchCache.visibleInstances[subMeshId] = null;\n if (this._instanceDataStorage.visibleInstances && !isReplacementMode) {\n const visibleInstances = this._instanceDataStorage.visibleInstances;\n const currentRenderId = scene.getRenderId();\n const defaultRenderId = isInIntermediateRendering ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId;\n batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];\n if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {\n batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];\n }\n }\n batchCache.hardwareInstancedRendering[subMeshId] =\n !isReplacementMode &&\n this._instanceDataStorage.hardwareInstancedRendering &&\n batchCache.visibleInstances[subMeshId] !== null &&\n batchCache.visibleInstances[subMeshId] !== undefined;\n this._instanceDataStorage.previousBatch = batchCache;\n return batchCache;\n }\n /**\n * @internal\n */\n _renderWithInstances(subMesh, fillMode, batch, effect, engine) {\n const visibleInstances = batch.visibleInstances[subMesh._id];\n const visibleInstanceCount = visibleInstances ? visibleInstances.length : 0;\n const instanceStorage = this._instanceDataStorage;\n const currentInstancesBufferSize = instanceStorage.instancesBufferSize;\n let instancesBuffer = instanceStorage.instancesBuffer;\n let instancesPreviousBuffer = instanceStorage.instancesPreviousBuffer;\n const matricesCount = visibleInstanceCount + 1;\n const bufferSize = matricesCount * 16 * 4;\n while (instanceStorage.instancesBufferSize < bufferSize) {\n instanceStorage.instancesBufferSize *= 2;\n }\n if (!instanceStorage.instancesData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\n instanceStorage.instancesData = new Float32Array(instanceStorage.instancesBufferSize / 4);\n }\n if ((this._scene.needsPreviousWorldMatrices && !instanceStorage.instancesPreviousData) || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\n instanceStorage.instancesPreviousData = new Float32Array(instanceStorage.instancesBufferSize / 4);\n }\n let offset = 0;\n let instancesCount = 0;\n const renderSelf = batch.renderSelf[subMesh._id];\n const needUpdateBuffer = !instancesBuffer ||\n currentInstancesBufferSize !== instanceStorage.instancesBufferSize ||\n (this._scene.needsPreviousWorldMatrices && !instanceStorage.instancesPreviousBuffer);\n if (!this._instanceDataStorage.manualUpdate && (!instanceStorage.isFrozen || needUpdateBuffer)) {\n const world = this.getWorldMatrix();\n if (renderSelf) {\n if (this._scene.needsPreviousWorldMatrices) {\n if (!instanceStorage.masterMeshPreviousWorldMatrix) {\n instanceStorage.masterMeshPreviousWorldMatrix = world.clone();\n instanceStorage.masterMeshPreviousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n }\n else {\n instanceStorage.masterMeshPreviousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n instanceStorage.masterMeshPreviousWorldMatrix.copyFrom(world);\n }\n }\n world.copyToArray(instanceStorage.instancesData, offset);\n offset += 16;\n instancesCount++;\n }\n if (visibleInstances) {\n if (Mesh.INSTANCEDMESH_SORT_TRANSPARENT && this._scene.activeCamera && subMesh.getMaterial()?.needAlphaBlendingForMesh(subMesh.getRenderingMesh())) {\n const cameraPosition = this._scene.activeCamera.globalPosition;\n for (let instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\n const instanceMesh = visibleInstances[instanceIndex];\n instanceMesh._distanceToCamera = Vector3.Distance(instanceMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);\n }\n visibleInstances.sort((m1, m2) => {\n return m1._distanceToCamera > m2._distanceToCamera ? -1 : m1._distanceToCamera < m2._distanceToCamera ? 1 : 0;\n });\n }\n for (let instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\n const instance = visibleInstances[instanceIndex];\n const matrix = instance.getWorldMatrix();\n matrix.copyToArray(instanceStorage.instancesData, offset);\n if (this._scene.needsPreviousWorldMatrices) {\n if (!instance._previousWorldMatrix) {\n instance._previousWorldMatrix = matrix.clone();\n instance._previousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n }\n else {\n instance._previousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n instance._previousWorldMatrix.copyFrom(matrix);\n }\n }\n offset += 16;\n instancesCount++;\n }\n }\n }\n else {\n instancesCount = (renderSelf ? 1 : 0) + visibleInstanceCount;\n }\n if (needUpdateBuffer) {\n if (instancesBuffer) {\n instancesBuffer.dispose();\n }\n if (instancesPreviousBuffer) {\n instancesPreviousBuffer.dispose();\n }\n instancesBuffer = new Buffer(engine, instanceStorage.instancesData, true, 16, false, true);\n instanceStorage.instancesBuffer = instancesBuffer;\n if (!this._userInstancedBuffersStorage) {\n this._userInstancedBuffersStorage = {\n data: {},\n vertexBuffers: {},\n strides: {},\n sizes: {},\n vertexArrayObjects: this.getEngine().getCaps().vertexArrayObject ? {} : undefined,\n };\n }\n this._userInstancedBuffersStorage.vertexBuffers[\"world0\"] = instancesBuffer.createVertexBuffer(\"world0\", 0, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world1\"] = instancesBuffer.createVertexBuffer(\"world1\", 4, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world2\"] = instancesBuffer.createVertexBuffer(\"world2\", 8, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world3\"] = instancesBuffer.createVertexBuffer(\"world3\", 12, 4);\n if (this._scene.needsPreviousWorldMatrices) {\n instancesPreviousBuffer = new Buffer(engine, instanceStorage.instancesPreviousData, true, 16, false, true);\n instanceStorage.instancesPreviousBuffer = instancesPreviousBuffer;\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld0\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld0\", 0, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld1\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld1\", 4, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld2\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld2\", 8, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld3\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld3\", 12, 4);\n }\n this._invalidateInstanceVertexArrayObject();\n }\n else {\n if (!this._instanceDataStorage.isFrozen || this._instanceDataStorage.forceMatrixUpdates) {\n instancesBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\n if (this._scene.needsPreviousWorldMatrices && (!this._instanceDataStorage.manualUpdate || this._instanceDataStorage.previousManualUpdate)) {\n instancesPreviousBuffer.updateDirectly(instanceStorage.instancesPreviousData, 0, instancesCount);\n }\n }\n }\n this._processInstancedBuffers(visibleInstances, renderSelf);\n // Stats\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\n // Draw\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = true;\n }\n this._bind(subMesh, effect, fillMode);\n this._draw(subMesh, fillMode, instancesCount);\n // Write current matrices as previous matrices in case of manual update\n // Default behaviour when previous matrices are not specified explicitly\n // Will break if instances number/order changes\n if (this._scene.needsPreviousWorldMatrices &&\n !needUpdateBuffer &&\n this._instanceDataStorage.manualUpdate &&\n (!this._instanceDataStorage.isFrozen || this._instanceDataStorage.forceMatrixUpdates) &&\n !this._instanceDataStorage.previousManualUpdate) {\n instancesPreviousBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\n }\n engine.unbindInstanceAttributes();\n return this;\n }\n /**\n * @internal\n */\n _renderWithThinInstances(subMesh, fillMode, effect, engine) {\n // Stats\n const instancesCount = this._thinInstanceDataStorage?.instancesCount ?? 0;\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\n // Draw\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = true;\n }\n this._bind(subMesh, effect, fillMode);\n this._draw(subMesh, fillMode, instancesCount);\n // Write current matrices as previous matrices\n // Default behaviour when previous matrices are not specified explicitly\n // Will break if instances number/order changes\n if (this._scene.needsPreviousWorldMatrices && !this._thinInstanceDataStorage.previousMatrixData && this._thinInstanceDataStorage.matrixData) {\n if (!this._thinInstanceDataStorage.previousMatrixBuffer) {\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", this._thinInstanceDataStorage.matrixData, false);\n }\n else {\n this._thinInstanceDataStorage.previousMatrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData, 0, instancesCount);\n }\n }\n engine.unbindInstanceAttributes();\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _processInstancedBuffers(visibleInstances, renderSelf) {\n // Do nothing\n }\n /**\n * @internal\n */\n _processRendering(renderingMesh, subMesh, effect, fillMode, batch, hardwareInstancedRendering, onBeforeDraw, effectiveMaterial) {\n const scene = this.getScene();\n const engine = scene.getEngine();\n fillMode = this._getRenderingFillMode(fillMode);\n if (hardwareInstancedRendering && subMesh.getRenderingMesh().hasThinInstances) {\n this._renderWithThinInstances(subMesh, fillMode, effect, engine);\n return this;\n }\n if (hardwareInstancedRendering) {\n this._renderWithInstances(subMesh, fillMode, batch, effect, engine);\n }\n else {\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = false;\n }\n let instanceCount = 0;\n if (batch.renderSelf[subMesh._id]) {\n // Draw\n if (onBeforeDraw) {\n onBeforeDraw(false, renderingMesh.getWorldMatrix(), effectiveMaterial);\n }\n instanceCount++;\n this._draw(subMesh, fillMode, this._instanceDataStorage.overridenInstanceCount);\n }\n const visibleInstancesForSubMesh = batch.visibleInstances[subMesh._id];\n if (visibleInstancesForSubMesh) {\n const visibleInstanceCount = visibleInstancesForSubMesh.length;\n instanceCount += visibleInstanceCount;\n // Stats\n for (let instanceIndex = 0; instanceIndex < visibleInstanceCount; instanceIndex++) {\n const instance = visibleInstancesForSubMesh[instanceIndex];\n // World\n const world = instance.getWorldMatrix();\n if (onBeforeDraw) {\n onBeforeDraw(true, world, effectiveMaterial);\n }\n // Draw\n this._draw(subMesh, fillMode);\n }\n }\n // Stats\n scene._activeIndices.addCount(subMesh.indexCount * instanceCount, false);\n }\n return this;\n }\n /**\n * @internal\n */\n _rebuild(dispose = false) {\n if (this._instanceDataStorage.instancesBuffer) {\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\n if (dispose) {\n this._instanceDataStorage.instancesBuffer.dispose();\n }\n this._instanceDataStorage.instancesBuffer = null;\n }\n if (this._userInstancedBuffersStorage) {\n for (const kind in this._userInstancedBuffersStorage.vertexBuffers) {\n const buffer = this._userInstancedBuffersStorage.vertexBuffers[kind];\n if (buffer) {\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\n if (dispose) {\n buffer.dispose();\n }\n this._userInstancedBuffersStorage.vertexBuffers[kind] = null;\n }\n }\n if (this._userInstancedBuffersStorage.vertexArrayObjects) {\n this._userInstancedBuffersStorage.vertexArrayObjects = {};\n }\n }\n this._internalMeshDataInfo._effectiveMaterial = null;\n super._rebuild(dispose);\n }\n /** @internal */\n _freeze() {\n if (!this.subMeshes) {\n return;\n }\n // Prepare batches\n for (let index = 0; index < this.subMeshes.length; index++) {\n this._getInstancesRenderList(index);\n }\n this._internalMeshDataInfo._effectiveMaterial = null;\n this._instanceDataStorage.isFrozen = true;\n }\n /** @internal */\n _unFreeze() {\n this._instanceDataStorage.isFrozen = false;\n this._instanceDataStorage.previousBatch = null;\n }\n /**\n * Triggers the draw call for the mesh (or a submesh), for a specific render pass id\n * @param renderPassId defines the render pass id to use to draw the mesh / submesh. If not provided, use the current renderPassId of the engine.\n * @param enableAlphaMode defines if alpha mode can be changed (default: false)\n * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering (default: undefined)\n * @param subMesh defines the subMesh to render. If not provided, draw all mesh submeshes (default: undefined)\n * @param checkFrustumCulling defines if frustum culling must be checked (default: true). If you know the mesh is in the frustum (or if you don't care!), you can pass false to optimize.\n * @returns the current mesh\n */\n renderWithRenderPassId(renderPassId, enableAlphaMode, effectiveMeshReplacement, subMesh, checkFrustumCulling = true) {\n const engine = this._scene.getEngine();\n const currentRenderPassId = engine.currentRenderPassId;\n if (renderPassId !== undefined) {\n engine.currentRenderPassId = renderPassId;\n }\n if (subMesh) {\n if (!checkFrustumCulling || (checkFrustumCulling && subMesh.isInFrustum(this._scene._frustumPlanes))) {\n this.render(subMesh, !!enableAlphaMode, effectiveMeshReplacement);\n }\n }\n else {\n for (let s = 0; s < this.subMeshes.length; s++) {\n const subMesh = this.subMeshes[s];\n if (!checkFrustumCulling || (checkFrustumCulling && subMesh.isInFrustum(this._scene._frustumPlanes))) {\n this.render(subMesh, !!enableAlphaMode, effectiveMeshReplacement);\n }\n }\n }\n if (renderPassId !== undefined) {\n engine.currentRenderPassId = currentRenderPassId;\n }\n return this;\n }\n /**\n * Render a complete mesh by going through all submeshes\n * @returns the current mesh\n * #5SPY1V#2: simple test\n * #5SPY1V#5: perf test\n */\n directRender() {\n if (!this.subMeshes) {\n return this;\n }\n for (const submesh of this.subMeshes) {\n this.render(submesh, false);\n }\n return this;\n }\n /**\n * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager\n * @param subMesh defines the subMesh to render\n * @param enableAlphaMode defines if alpha mode can be changed\n * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering\n * @returns the current mesh\n */\n render(subMesh, enableAlphaMode, effectiveMeshReplacement) {\n const scene = this.getScene();\n if (this._internalAbstractMeshDataInfo._isActiveIntermediate) {\n this._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n }\n else {\n this._internalAbstractMeshDataInfo._isActive = false;\n }\n const numActiveCameras = scene.activeCameras?.length ?? 0;\n const canCheckOcclusionQuery = (numActiveCameras > 1 && scene.activeCamera === scene.activeCameras[0]) || numActiveCameras <= 1;\n if (canCheckOcclusionQuery && this._checkOcclusionQuery() && !this._occlusionDataStorage.forceRenderingWhenOccluded) {\n return this;\n }\n // Managing instances\n const batch = this._getInstancesRenderList(subMesh._id, !!effectiveMeshReplacement);\n if (batch.mustReturn) {\n return this;\n }\n // Checking geometry state\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\n return this;\n }\n const engine = scene.getEngine();\n let oldCameraMaxZ = 0;\n let oldCamera = null;\n if (this.ignoreCameraMaxZ && scene.activeCamera && !scene._isInIntermediateRendering()) {\n oldCameraMaxZ = scene.activeCamera.maxZ;\n oldCamera = scene.activeCamera;\n scene.activeCamera.maxZ = 0;\n scene.updateTransformMatrix(true);\n }\n if (this._internalMeshDataInfo._onBeforeRenderObservable) {\n this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);\n }\n const renderingMesh = subMesh.getRenderingMesh();\n const hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id] ||\n renderingMesh.hasThinInstances ||\n (!!this._userInstancedBuffersStorage && !subMesh.getMesh()._internalAbstractMeshDataInfo._actAsRegularMesh);\n const instanceDataStorage = this._instanceDataStorage;\n const material = subMesh.getMaterial();\n if (!material) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n // Material\n if (!instanceDataStorage.isFrozen || !this._internalMeshDataInfo._effectiveMaterial || this._internalMeshDataInfo._effectiveMaterial !== material) {\n if (material._storeEffectOnSubMeshes) {\n if (!material.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n }\n else if (!material.isReady(this, hardwareInstancedRendering)) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n this._internalMeshDataInfo._effectiveMaterial = material;\n }\n else if ((material._storeEffectOnSubMeshes && !subMesh._drawWrapper?._wasPreviouslyReady) ||\n (!material._storeEffectOnSubMeshes && !material._getDrawWrapper()._wasPreviouslyReady)) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n // Alpha mode\n if (enableAlphaMode) {\n engine.setAlphaMode(this._internalMeshDataInfo._effectiveMaterial.alphaMode);\n }\n let drawWrapper;\n if (this._internalMeshDataInfo._effectiveMaterial._storeEffectOnSubMeshes) {\n drawWrapper = subMesh._drawWrapper;\n }\n else {\n drawWrapper = this._internalMeshDataInfo._effectiveMaterial._getDrawWrapper();\n }\n const effect = drawWrapper?.effect ?? null;\n for (const step of scene._beforeRenderingMeshStage) {\n step.action(this, subMesh, batch, effect);\n }\n if (!drawWrapper || !effect) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n const effectiveMesh = effectiveMeshReplacement || this;\n let sideOrientation;\n if (!instanceDataStorage.isFrozen &&\n (this._internalMeshDataInfo._effectiveMaterial.backFaceCulling ||\n this._internalMeshDataInfo._effectiveMaterial.sideOrientation !== null ||\n this._internalMeshDataInfo._effectiveMaterial.twoSidedLighting)) {\n // Note: if two sided lighting is enabled, we need to ensure that the normal will point in the right direction even if the determinant of the world matrix is negative\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n sideOrientation = this._internalMeshDataInfo._effectiveMaterial._getEffectiveOrientation(this);\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n instanceDataStorage.sideOrientation = sideOrientation;\n }\n else {\n sideOrientation = instanceDataStorage.sideOrientation;\n }\n const reverse = this._internalMeshDataInfo._effectiveMaterial._preBind(drawWrapper, sideOrientation);\n if (this._internalMeshDataInfo._effectiveMaterial.forceDepthWrite) {\n engine.setDepthWrite(true);\n }\n // Bind\n const effectiveMaterial = this._internalMeshDataInfo._effectiveMaterial;\n const fillMode = effectiveMaterial.fillMode;\n if (this._internalMeshDataInfo._onBeforeBindObservable) {\n this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this);\n }\n if (!hardwareInstancedRendering) {\n // Binding will be done later because we need to add more info to the VB\n this._bind(subMesh, effect, fillMode, false);\n }\n const world = effectiveMesh.getWorldMatrix();\n if (effectiveMaterial._storeEffectOnSubMeshes) {\n effectiveMaterial.bindForSubMesh(world, this, subMesh);\n }\n else {\n effectiveMaterial.bind(world, this);\n }\n if (!effectiveMaterial.backFaceCulling && effectiveMaterial.separateCullingPass) {\n engine.setState(true, effectiveMaterial.zOffset, false, !reverse, effectiveMaterial.cullBackFaces, effectiveMaterial.stencil, effectiveMaterial.zOffsetUnits);\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._internalMeshDataInfo._effectiveMaterial);\n engine.setState(true, effectiveMaterial.zOffset, false, reverse, effectiveMaterial.cullBackFaces, effectiveMaterial.stencil, effectiveMaterial.zOffsetUnits);\n if (this._internalMeshDataInfo._onBetweenPassObservable) {\n this._internalMeshDataInfo._onBetweenPassObservable.notifyObservers(subMesh);\n }\n }\n // Draw\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._internalMeshDataInfo._effectiveMaterial);\n // Unbind\n this._internalMeshDataInfo._effectiveMaterial.unbind();\n for (const step of scene._afterRenderingMeshStage) {\n step.action(this, subMesh, batch, effect);\n }\n if (this._internalMeshDataInfo._onAfterRenderObservable) {\n this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this);\n }\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n if (scene.performancePriority === 2 /* ScenePerformancePriority.Aggressive */ && !instanceDataStorage.isFrozen) {\n this._freeze();\n }\n return this;\n }\n /**\n * Renormalize the mesh and patch it up if there are no weights\n * Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1.\n * However in the case of zero weights then we set just a single influence to 1.\n * We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.\n */\n cleanMatrixWeights() {\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsExtraKind)) {\n this._normalizeSkinWeightsAndExtra();\n }\n else {\n this._normalizeSkinFourWeights();\n }\n }\n }\n // faster 4 weight version.\n _normalizeSkinFourWeights() {\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n const numWeights = matricesWeights.length;\n for (let a = 0; a < numWeights; a += 4) {\n // accumulate weights\n const t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n matricesWeights[a] = 1;\n }\n else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n matricesWeights[a] *= recip;\n matricesWeights[a + 1] *= recip;\n matricesWeights[a + 2] *= recip;\n matricesWeights[a + 3] *= recip;\n }\n }\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\n }\n // handle special case of extra verts. (in theory gltf can handle 12 influences)\n _normalizeSkinWeightsAndExtra() {\n const matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n const numWeights = matricesWeights.length;\n for (let a = 0; a < numWeights; a += 4) {\n // accumulate weights\n let t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\n t += matricesWeightsExtra[a] + matricesWeightsExtra[a + 1] + matricesWeightsExtra[a + 2] + matricesWeightsExtra[a + 3];\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n matricesWeights[a] = 1;\n }\n else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n matricesWeights[a] *= recip;\n matricesWeights[a + 1] *= recip;\n matricesWeights[a + 2] *= recip;\n matricesWeights[a + 3] *= recip;\n // same goes for extras\n matricesWeightsExtra[a] *= recip;\n matricesWeightsExtra[a + 1] *= recip;\n matricesWeightsExtra[a + 2] *= recip;\n matricesWeightsExtra[a + 3] *= recip;\n }\n }\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsExtra);\n }\n /**\n * ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights,\n * or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let\n * the user know there was an issue with importing the mesh\n * @returns a validation object with skinned, valid and report string\n */\n validateSkinning() {\n const matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n if (matricesWeights === null || this.skeleton == null) {\n return { skinned: false, valid: true, report: \"not skinned\" };\n }\n const numWeights = matricesWeights.length;\n let numberNotSorted = 0;\n let missingWeights = 0;\n let maxUsedWeights = 0;\n let numberNotNormalized = 0;\n const numInfluences = matricesWeightsExtra === null ? 4 : 8;\n const usedWeightCounts = [];\n for (let a = 0; a <= numInfluences; a++) {\n usedWeightCounts[a] = 0;\n }\n const toleranceEpsilon = 0.001;\n for (let a = 0; a < numWeights; a += 4) {\n let lastWeight = matricesWeights[a];\n let t = lastWeight;\n let usedWeights = t === 0 ? 0 : 1;\n for (let b = 1; b < numInfluences; b++) {\n const d = b < 4 ? matricesWeights[a + b] : matricesWeightsExtra[a + b - 4];\n if (d > lastWeight) {\n numberNotSorted++;\n }\n if (d !== 0) {\n usedWeights++;\n }\n t += d;\n lastWeight = d;\n }\n // count the buffer weights usage\n usedWeightCounts[usedWeights]++;\n // max influences\n if (usedWeights > maxUsedWeights) {\n maxUsedWeights = usedWeights;\n }\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n missingWeights++;\n }\n else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n let tolerance = 0;\n for (let b = 0; b < numInfluences; b++) {\n if (b < 4) {\n tolerance += Math.abs(matricesWeights[a + b] - matricesWeights[a + b] * recip);\n }\n else {\n tolerance += Math.abs(matricesWeightsExtra[a + b - 4] - matricesWeightsExtra[a + b - 4] * recip);\n }\n }\n // arbitrary epsilon value for dictating not normalized\n if (tolerance > toleranceEpsilon) {\n numberNotNormalized++;\n }\n }\n }\n // validate bone indices are in range of the skeleton\n const numBones = this.skeleton.bones.length;\n const matricesIndices = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\n const matricesIndicesExtra = this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\n let numBadBoneIndices = 0;\n for (let a = 0; a < numWeights; a += 4) {\n for (let b = 0; b < numInfluences; b++) {\n const index = b < 4 ? matricesIndices[a + b] : matricesIndicesExtra[a + b - 4];\n if (index >= numBones || index < 0) {\n numBadBoneIndices++;\n }\n }\n }\n // log mesh stats\n const output = \"Number of Weights = \" +\n numWeights / 4 +\n \"\\nMaximum influences = \" +\n maxUsedWeights +\n \"\\nMissing Weights = \" +\n missingWeights +\n \"\\nNot Sorted = \" +\n numberNotSorted +\n \"\\nNot Normalized = \" +\n numberNotNormalized +\n \"\\nWeightCounts = [\" +\n usedWeightCounts +\n \"]\" +\n \"\\nNumber of bones = \" +\n numBones +\n \"\\nBad Bone Indices = \" +\n numBadBoneIndices;\n return { skinned: true, valid: missingWeights === 0 && numberNotNormalized === 0 && numBadBoneIndices === 0, report: output };\n }\n /** @internal */\n _checkDelayState() {\n const scene = this.getScene();\n if (this._geometry) {\n this._geometry.load(scene);\n }\n else if (this.delayLoadState === 4) {\n this.delayLoadState = 2;\n this._queueLoad(scene);\n }\n return this;\n }\n _queueLoad(scene) {\n scene.addPendingData(this);\n const getBinaryData = this.delayLoadingFile.indexOf(\".babylonbinarymeshdata\") !== -1;\n Tools.LoadFile(this.delayLoadingFile, (data) => {\n if (data instanceof ArrayBuffer) {\n this._delayLoadingFunction(data, this);\n }\n else {\n this._delayLoadingFunction(JSON.parse(data), this);\n }\n this.instances.forEach((instance) => {\n instance.refreshBoundingInfo();\n instance._syncSubMeshes();\n });\n this.delayLoadState = 1;\n scene.removePendingData(this);\n }, () => { }, scene.offlineProvider, getBinaryData);\n return this;\n }\n /**\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\n * A mesh is in the frustum if its bounding box intersects the frustum\n * @param frustumPlanes defines the frustum to test\n * @returns true if the mesh is in the frustum planes\n */\n isInFrustum(frustumPlanes) {\n if (this.delayLoadState === 2) {\n return false;\n }\n if (!super.isInFrustum(frustumPlanes)) {\n return false;\n }\n this._checkDelayState();\n return true;\n }\n /**\n * Sets the mesh material by the material or multiMaterial `id` property\n * @param id is a string identifying the material or the multiMaterial\n * @returns the current mesh\n */\n setMaterialById(id) {\n const materials = this.getScene().materials;\n let index;\n for (index = materials.length - 1; index > -1; index--) {\n if (materials[index].id === id) {\n this.material = materials[index];\n return this;\n }\n }\n // Multi\n const multiMaterials = this.getScene().multiMaterials;\n for (index = multiMaterials.length - 1; index > -1; index--) {\n if (multiMaterials[index].id === id) {\n this.material = multiMaterials[index];\n return this;\n }\n }\n return this;\n }\n /**\n * Returns as a new array populated with the mesh material and/or skeleton, if any.\n * @returns an array of IAnimatable\n */\n getAnimatables() {\n const results = [];\n if (this.material) {\n results.push(this.material);\n }\n if (this.skeleton) {\n results.push(this.skeleton);\n }\n return results;\n }\n /**\n * Modifies the mesh geometry according to the passed transformation matrix.\n * This method returns nothing, but it really modifies the mesh even if it's originally not set as updatable.\n * The mesh normals are modified using the same transformation.\n * Note that, under the hood, this method sets a new VertexBuffer each call.\n * @param transform defines the transform matrix to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/bakingTransforms\n * @returns the current mesh\n */\n bakeTransformIntoVertices(transform) {\n // Position\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\n return this;\n }\n const submeshes = this.subMeshes.splice(0);\n this._resetPointsArrayCache();\n let data = this.getVerticesData(VertexBuffer.PositionKind);\n const temp = Vector3.Zero();\n let index;\n for (index = 0; index < data.length; index += 3) {\n Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], transform, temp).toArray(data, index);\n }\n this.setVerticesData(VertexBuffer.PositionKind, data, this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable());\n // Normals\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\n data = this.getVerticesData(VertexBuffer.NormalKind);\n for (index = 0; index < data.length; index += 3) {\n Vector3.TransformNormalFromFloatsToRef(data[index], data[index + 1], data[index + 2], transform, temp)\n .normalize()\n .toArray(data, index);\n }\n this.setVerticesData(VertexBuffer.NormalKind, data, this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable());\n }\n // Tangents\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\n data = this.getVerticesData(VertexBuffer.TangentKind);\n for (index = 0; index < data.length; index += 4) {\n Vector3.TransformNormalFromFloatsToRef(data[index], data[index + 1], data[index + 2], transform, temp)\n .normalize()\n .toArray(data, index);\n }\n this.setVerticesData(VertexBuffer.TangentKind, data, this.getVertexBuffer(VertexBuffer.TangentKind).isUpdatable());\n }\n // flip faces?\n if (transform.determinant() < 0) {\n this.flipFaces();\n }\n // Restore submeshes\n this.releaseSubMeshes();\n this.subMeshes = submeshes;\n return this;\n }\n /**\n * Modifies the mesh geometry according to its own current World Matrix.\n * The mesh World Matrix is then reset.\n * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.\n * Note that, under the hood, this method sets a new VertexBuffer each call.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/bakingTransforms\n * @param bakeIndependentlyOfChildren indicates whether to preserve all child nodes' World Matrix during baking\n * @returns the current mesh\n */\n bakeCurrentTransformIntoVertices(bakeIndependentlyOfChildren = true) {\n this.bakeTransformIntoVertices(this.computeWorldMatrix(true));\n this.resetLocalMatrix(bakeIndependentlyOfChildren);\n return this;\n }\n // Cache\n /** @internal */\n get _positions() {\n return this._internalAbstractMeshDataInfo._positions || (this._geometry && this._geometry._positions) || null;\n }\n /** @internal */\n _resetPointsArrayCache() {\n if (this._geometry) {\n this._geometry._resetPointsArrayCache();\n }\n return this;\n }\n /** @internal */\n _generatePointsArray() {\n if (this._geometry) {\n return this._geometry._generatePointsArray();\n }\n return false;\n }\n /**\n * Returns a new Mesh object generated from the current mesh properties.\n * This method must not get confused with createInstance()\n * @param name is a string, the name given to the new mesh\n * @param newParent can be any Node object (default `null`)\n * @param doNotCloneChildren allows/denies the recursive cloning of the original mesh children if any (default `false`)\n * @param clonePhysicsImpostor allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any (default `true`)\n * @returns a new mesh\n */\n clone(name = \"\", newParent = null, doNotCloneChildren, clonePhysicsImpostor = true) {\n return new Mesh(name, this.getScene(), newParent, this, doNotCloneChildren, clonePhysicsImpostor);\n }\n /**\n * Releases resources associated with this mesh.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n this.morphTargetManager = null;\n if (this._geometry) {\n this._geometry.releaseForMesh(this, true);\n }\n const internalDataInfo = this._internalMeshDataInfo;\n if (internalDataInfo._onBeforeDrawObservable) {\n internalDataInfo._onBeforeDrawObservable.clear();\n }\n if (internalDataInfo._onBeforeBindObservable) {\n internalDataInfo._onBeforeBindObservable.clear();\n }\n if (internalDataInfo._onBeforeRenderObservable) {\n internalDataInfo._onBeforeRenderObservable.clear();\n }\n if (internalDataInfo._onAfterRenderObservable) {\n internalDataInfo._onAfterRenderObservable.clear();\n }\n if (internalDataInfo._onBetweenPassObservable) {\n internalDataInfo._onBetweenPassObservable.clear();\n }\n // Sources\n if (this._scene.useClonedMeshMap) {\n if (internalDataInfo.meshMap) {\n for (const uniqueId in internalDataInfo.meshMap) {\n const mesh = internalDataInfo.meshMap[uniqueId];\n if (mesh) {\n mesh._internalMeshDataInfo._source = null;\n internalDataInfo.meshMap[uniqueId] = undefined;\n }\n }\n }\n if (internalDataInfo._source && internalDataInfo._source._internalMeshDataInfo.meshMap) {\n internalDataInfo._source._internalMeshDataInfo.meshMap[this.uniqueId] = undefined;\n }\n }\n else {\n const meshes = this.getScene().meshes;\n for (const abstractMesh of meshes) {\n const mesh = abstractMesh;\n if (mesh._internalMeshDataInfo && mesh._internalMeshDataInfo._source && mesh._internalMeshDataInfo._source === this) {\n mesh._internalMeshDataInfo._source = null;\n }\n }\n }\n internalDataInfo._source = null;\n this._instanceDataStorage.visibleInstances = {};\n // Instances\n this._disposeInstanceSpecificData();\n // Thin instances\n this._disposeThinInstanceSpecificData();\n if (this._internalMeshDataInfo._checkReadinessObserver) {\n this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver);\n }\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /** @internal */\n _disposeInstanceSpecificData() {\n // Do nothing\n }\n /** @internal */\n _disposeThinInstanceSpecificData() {\n // Do nothing\n }\n /** @internal */\n _invalidateInstanceVertexArrayObject() {\n // Do nothing\n }\n /**\n * Modifies the mesh geometry according to a displacement map.\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\n * @param url is a string, the URL from the image file is to be downloaded.\n * @param minHeight is the lower limit of the displacement.\n * @param maxHeight is the upper limit of the displacement.\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\n * @param uvOffset is an optional vector2 used to offset UV.\n * @param uvScale is an optional vector2 used to scale UV.\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\n * @param onError defines a callback called when an error occurs during the processing of the request.\n * @returns the Mesh.\n */\n applyDisplacementMap(url, minHeight, maxHeight, onSuccess, uvOffset, uvScale, forceUpdate = false, onError) {\n const scene = this.getScene();\n const onload = (img) => {\n // Getting height map data\n const heightMapWidth = img.width;\n const heightMapHeight = img.height;\n const canvas = this.getEngine().createCanvas(heightMapWidth, heightMapHeight);\n const context = canvas.getContext(\"2d\");\n context.drawImage(img, 0, 0);\n // Create VertexData from map data\n //Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\n const buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;\n this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate);\n //execute success callback, if set\n if (onSuccess) {\n onSuccess(this);\n }\n };\n Tools.LoadImage(url, onload, onError ? onError : () => { }, scene.offlineProvider);\n return this;\n }\n /**\n * Modifies the mesh geometry according to a displacementMap buffer.\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\n * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.\n * @param heightMapWidth is the width of the buffer image.\n * @param heightMapHeight is the height of the buffer image.\n * @param minHeight is the lower limit of the displacement.\n * @param maxHeight is the upper limit of the displacement.\n * @param uvOffset is an optional vector2 used to offset UV.\n * @param uvScale is an optional vector2 used to scale UV.\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\n * @returns the Mesh.\n */\n applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate = false) {\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind) || !this.isVerticesDataPresent(VertexBuffer.NormalKind) || !this.isVerticesDataPresent(VertexBuffer.UVKind)) {\n Logger.Warn(\"Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing\");\n return this;\n }\n const positions = this.getVerticesData(VertexBuffer.PositionKind, true, true);\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\n const uvs = this.getVerticesData(VertexBuffer.UVKind);\n let position = Vector3.Zero();\n const normal = Vector3.Zero();\n const uv = Vector2.Zero();\n uvOffset = uvOffset || Vector2.Zero();\n uvScale = uvScale || new Vector2(1, 1);\n for (let index = 0; index < positions.length; index += 3) {\n Vector3.FromArrayToRef(positions, index, position);\n Vector3.FromArrayToRef(normals, index, normal);\n Vector2.FromArrayToRef(uvs, (index / 3) * 2, uv);\n // Compute height\n const u = (Math.abs(uv.x * uvScale.x + (uvOffset.x % 1)) * (heightMapWidth - 1)) % heightMapWidth | 0;\n const v = (Math.abs(uv.y * uvScale.y + (uvOffset.y % 1)) * (heightMapHeight - 1)) % heightMapHeight | 0;\n const pos = (u + v * heightMapWidth) * 4;\n const r = buffer[pos] / 255.0;\n const g = buffer[pos + 1] / 255.0;\n const b = buffer[pos + 2] / 255.0;\n const gradient = r * 0.3 + g * 0.59 + b * 0.11;\n normal.normalize();\n normal.scaleInPlace(minHeight + (maxHeight - minHeight) * gradient);\n position = position.add(normal);\n position.toArray(positions, index);\n }\n VertexData.ComputeNormals(positions, this.getIndices(), normals);\n if (forceUpdate) {\n this.setVerticesData(VertexBuffer.PositionKind, positions);\n this.setVerticesData(VertexBuffer.NormalKind, normals);\n this.setVerticesData(VertexBuffer.UVKind, uvs);\n }\n else {\n this.updateVerticesData(VertexBuffer.PositionKind, positions);\n this.updateVerticesData(VertexBuffer.NormalKind, normals);\n }\n return this;\n }\n _getFlattenedNormals(indices, positions) {\n const normals = new Float32Array(indices.length * 3);\n let normalsCount = 0;\n // Decide if normals should be flipped\n const flipNormalGeneration = this.sideOrientation === (this._scene.useRightHandedSystem ? 1 : 0);\n // Generate new normals\n for (let index = 0; index < indices.length; index += 3) {\n const p1 = Vector3.FromArray(positions, indices[index] * 3);\n const p2 = Vector3.FromArray(positions, indices[index + 1] * 3);\n const p3 = Vector3.FromArray(positions, indices[index + 2] * 3);\n const p1p2 = p1.subtract(p2);\n const p3p2 = p3.subtract(p2);\n const normal = Vector3.Normalize(Vector3.Cross(p1p2, p3p2));\n if (flipNormalGeneration) {\n normal.scaleInPlace(-1);\n }\n // Store same normals for every vertex\n for (let localIndex = 0; localIndex < 3; localIndex++) {\n normals[normalsCount++] = normal.x;\n normals[normalsCount++] = normal.y;\n normals[normalsCount++] = normal.z;\n }\n }\n return normals;\n }\n _convertToUnIndexedMesh(flattenNormals = false) {\n const kinds = this.getVerticesDataKinds().filter((kind) => !this.getVertexBuffer(kind)?.getIsInstanced());\n const indices = this.getIndices();\n const data = {};\n const separateVertices = (data, size) => {\n const newData = new Float32Array(indices.length * size);\n let count = 0;\n for (let index = 0; index < indices.length; index++) {\n for (let offset = 0; offset < size; offset++) {\n newData[count++] = data[indices[index] * size + offset];\n }\n }\n return newData;\n };\n // Save mesh bounding info\n const meshBoundingInfo = this.getBoundingInfo();\n // Save previous submeshes\n const previousSubmeshes = this.geometry ? this.subMeshes.slice(0) : [];\n // Cache vertex data\n for (const kind of kinds) {\n data[kind] = this.getVerticesData(kind);\n }\n // Update vertex data\n for (const kind of kinds) {\n const vertexBuffer = this.getVertexBuffer(kind);\n const size = vertexBuffer.getSize();\n if (flattenNormals && kind === VertexBuffer.NormalKind) {\n const normals = this._getFlattenedNormals(indices, data[VertexBuffer.PositionKind]);\n this.setVerticesData(VertexBuffer.NormalKind, normals, vertexBuffer.isUpdatable(), size);\n }\n else {\n this.setVerticesData(kind, separateVertices(data[kind], size), vertexBuffer.isUpdatable(), size);\n }\n }\n // Update morph targets\n if (this.morphTargetManager) {\n for (let targetIndex = 0; targetIndex < this.morphTargetManager.numTargets; targetIndex++) {\n const target = this.morphTargetManager.getTarget(targetIndex);\n const positions = target.getPositions();\n target.setPositions(separateVertices(positions, 3));\n const normals = target.getNormals();\n if (normals) {\n target.setNormals(flattenNormals ? this._getFlattenedNormals(indices, positions) : separateVertices(normals, 3));\n }\n const tangents = target.getTangents();\n if (tangents) {\n target.setTangents(separateVertices(tangents, 3));\n }\n const uvs = target.getUVs();\n if (uvs) {\n target.setUVs(separateVertices(uvs, 2));\n }\n }\n this.morphTargetManager.synchronize();\n }\n // Update indices\n for (let index = 0; index < indices.length; index++) {\n indices[index] = index;\n }\n this.setIndices(indices);\n this._unIndexed = true;\n // Update submeshes\n this.releaseSubMeshes();\n for (const previousOne of previousSubmeshes) {\n const boundingInfo = previousOne.getBoundingInfo();\n const subMesh = SubMesh.AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\n subMesh.setBoundingInfo(boundingInfo);\n }\n this.setBoundingInfo(meshBoundingInfo);\n this.synchronizeInstances();\n return this;\n }\n /**\n * Modify the mesh to get a flat shading rendering.\n * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.\n * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.\n * @returns current mesh\n */\n convertToFlatShadedMesh() {\n return this._convertToUnIndexedMesh(true);\n }\n /**\n * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.\n * In other words, more vertices, no more indices and a single bigger VBO.\n * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.\n * @returns current mesh\n */\n convertToUnIndexedMesh() {\n return this._convertToUnIndexedMesh();\n }\n /**\n * Inverses facet orientations.\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n * @param flipNormals will also inverts the normals\n * @returns current mesh\n */\n flipFaces(flipNormals = false) {\n const vertex_data = VertexData.ExtractFromMesh(this);\n let i;\n if (flipNormals && this.isVerticesDataPresent(VertexBuffer.NormalKind) && vertex_data.normals) {\n for (i = 0; i < vertex_data.normals.length; i++) {\n vertex_data.normals[i] *= -1;\n }\n this.setVerticesData(VertexBuffer.NormalKind, vertex_data.normals, this.isVertexBufferUpdatable(VertexBuffer.NormalKind));\n }\n if (vertex_data.indices) {\n let temp;\n for (i = 0; i < vertex_data.indices.length; i += 3) {\n // reassign indices\n temp = vertex_data.indices[i + 1];\n vertex_data.indices[i + 1] = vertex_data.indices[i + 2];\n vertex_data.indices[i + 2] = temp;\n }\n this.setIndices(vertex_data.indices, null, this.isVertexBufferUpdatable(VertexBuffer.PositionKind), true);\n }\n return this;\n }\n /**\n * Increase the number of facets and hence vertices in a mesh\n * Vertex normals are interpolated from existing vertex normals\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n * @param numberPerEdge the number of new vertices to add to each edge of a facet, optional default 1\n */\n increaseVertices(numberPerEdge = 1) {\n const vertex_data = VertexData.ExtractFromMesh(this);\n const currentIndices = vertex_data.indices && !Array.isArray(vertex_data.indices) && Array.from ? Array.from(vertex_data.indices) : vertex_data.indices;\n const positions = vertex_data.positions && !Array.isArray(vertex_data.positions) && Array.from ? Array.from(vertex_data.positions) : vertex_data.positions;\n const uvs = vertex_data.uvs && !Array.isArray(vertex_data.uvs) && Array.from ? Array.from(vertex_data.uvs) : vertex_data.uvs;\n const normals = vertex_data.normals && !Array.isArray(vertex_data.normals) && Array.from ? Array.from(vertex_data.normals) : vertex_data.normals;\n if (!currentIndices || !positions) {\n Logger.Warn(\"Couldn't increase number of vertices : VertexData must contain at least indices and positions\");\n }\n else {\n vertex_data.indices = currentIndices;\n vertex_data.positions = positions;\n if (uvs) {\n vertex_data.uvs = uvs;\n }\n if (normals) {\n vertex_data.normals = normals;\n }\n const segments = numberPerEdge + 1; //segments per current facet edge, become sides of new facets\n const tempIndices = new Array();\n for (let i = 0; i < segments + 1; i++) {\n tempIndices[i] = new Array();\n }\n let a; //vertex index of one end of a side\n let b; //vertex index of other end of the side\n const deltaPosition = new Vector3(0, 0, 0);\n const deltaNormal = new Vector3(0, 0, 0);\n const deltaUV = new Vector2(0, 0);\n const indices = new Array();\n const vertexIndex = new Array();\n const side = new Array();\n let len;\n let positionPtr = positions.length;\n let uvPtr;\n if (uvs) {\n uvPtr = uvs.length;\n }\n let normalsPtr;\n if (normals) {\n normalsPtr = normals.length;\n }\n for (let i = 0; i < currentIndices.length; i += 3) {\n vertexIndex[0] = currentIndices[i];\n vertexIndex[1] = currentIndices[i + 1];\n vertexIndex[2] = currentIndices[i + 2];\n for (let j = 0; j < 3; j++) {\n a = vertexIndex[j];\n b = vertexIndex[(j + 1) % 3];\n if (side[a] === undefined && side[b] === undefined) {\n side[a] = new Array();\n side[b] = new Array();\n }\n else {\n if (side[a] === undefined) {\n side[a] = new Array();\n }\n if (side[b] === undefined) {\n side[b] = new Array();\n }\n }\n if (side[a][b] === undefined && side[b][a] === undefined) {\n side[a][b] = [];\n deltaPosition.x = (positions[3 * b] - positions[3 * a]) / segments;\n deltaPosition.y = (positions[3 * b + 1] - positions[3 * a + 1]) / segments;\n deltaPosition.z = (positions[3 * b + 2] - positions[3 * a + 2]) / segments;\n if (normals) {\n deltaNormal.x = (normals[3 * b] - normals[3 * a]) / segments;\n deltaNormal.y = (normals[3 * b + 1] - normals[3 * a + 1]) / segments;\n deltaNormal.z = (normals[3 * b + 2] - normals[3 * a + 2]) / segments;\n }\n if (uvs) {\n deltaUV.x = (uvs[2 * b] - uvs[2 * a]) / segments;\n deltaUV.y = (uvs[2 * b + 1] - uvs[2 * a + 1]) / segments;\n }\n side[a][b].push(a);\n for (let k = 1; k < segments; k++) {\n side[a][b].push(positions.length / 3);\n positions[positionPtr++] = positions[3 * a] + k * deltaPosition.x;\n positions[positionPtr++] = positions[3 * a + 1] + k * deltaPosition.y;\n positions[positionPtr++] = positions[3 * a + 2] + k * deltaPosition.z;\n if (normals) {\n normals[normalsPtr++] = normals[3 * a] + k * deltaNormal.x;\n normals[normalsPtr++] = normals[3 * a + 1] + k * deltaNormal.y;\n normals[normalsPtr++] = normals[3 * a + 2] + k * deltaNormal.z;\n }\n if (uvs) {\n uvs[uvPtr++] = uvs[2 * a] + k * deltaUV.x;\n uvs[uvPtr++] = uvs[2 * a + 1] + k * deltaUV.y;\n }\n }\n side[a][b].push(b);\n side[b][a] = new Array();\n len = side[a][b].length;\n for (let idx = 0; idx < len; idx++) {\n side[b][a][idx] = side[a][b][len - 1 - idx];\n }\n }\n }\n //Calculate positions, normals and uvs of new internal vertices\n tempIndices[0][0] = currentIndices[i];\n tempIndices[1][0] = side[currentIndices[i]][currentIndices[i + 1]][1];\n tempIndices[1][1] = side[currentIndices[i]][currentIndices[i + 2]][1];\n for (let k = 2; k < segments; k++) {\n tempIndices[k][0] = side[currentIndices[i]][currentIndices[i + 1]][k];\n tempIndices[k][k] = side[currentIndices[i]][currentIndices[i + 2]][k];\n deltaPosition.x = (positions[3 * tempIndices[k][k]] - positions[3 * tempIndices[k][0]]) / k;\n deltaPosition.y = (positions[3 * tempIndices[k][k] + 1] - positions[3 * tempIndices[k][0] + 1]) / k;\n deltaPosition.z = (positions[3 * tempIndices[k][k] + 2] - positions[3 * tempIndices[k][0] + 2]) / k;\n if (normals) {\n deltaNormal.x = (normals[3 * tempIndices[k][k]] - normals[3 * tempIndices[k][0]]) / k;\n deltaNormal.y = (normals[3 * tempIndices[k][k] + 1] - normals[3 * tempIndices[k][0] + 1]) / k;\n deltaNormal.z = (normals[3 * tempIndices[k][k] + 2] - normals[3 * tempIndices[k][0] + 2]) / k;\n }\n if (uvs) {\n deltaUV.x = (uvs[2 * tempIndices[k][k]] - uvs[2 * tempIndices[k][0]]) / k;\n deltaUV.y = (uvs[2 * tempIndices[k][k] + 1] - uvs[2 * tempIndices[k][0] + 1]) / k;\n }\n for (let j = 1; j < k; j++) {\n tempIndices[k][j] = positions.length / 3;\n positions[positionPtr++] = positions[3 * tempIndices[k][0]] + j * deltaPosition.x;\n positions[positionPtr++] = positions[3 * tempIndices[k][0] + 1] + j * deltaPosition.y;\n positions[positionPtr++] = positions[3 * tempIndices[k][0] + 2] + j * deltaPosition.z;\n if (normals) {\n normals[normalsPtr++] = normals[3 * tempIndices[k][0]] + j * deltaNormal.x;\n normals[normalsPtr++] = normals[3 * tempIndices[k][0] + 1] + j * deltaNormal.y;\n normals[normalsPtr++] = normals[3 * tempIndices[k][0] + 2] + j * deltaNormal.z;\n }\n if (uvs) {\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0]] + j * deltaUV.x;\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0] + 1] + j * deltaUV.y;\n }\n }\n }\n tempIndices[segments] = side[currentIndices[i + 1]][currentIndices[i + 2]];\n // reform indices\n indices.push(tempIndices[0][0], tempIndices[1][0], tempIndices[1][1]);\n for (let k = 1; k < segments; k++) {\n let j;\n for (j = 0; j < k; j++) {\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\n indices.push(tempIndices[k][j], tempIndices[k + 1][j + 1], tempIndices[k][j + 1]);\n }\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\n }\n }\n vertex_data.indices = indices;\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\n }\n }\n /**\n * Force adjacent facets to share vertices and remove any facets that have all vertices in a line\n * This will undo any application of covertToFlatShadedMesh\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n */\n forceSharedVertices() {\n const vertex_data = VertexData.ExtractFromMesh(this);\n const currentUVs = vertex_data.uvs;\n const currentIndices = vertex_data.indices;\n const currentPositions = vertex_data.positions;\n const currentColors = vertex_data.colors;\n const currentMatrixIndices = vertex_data.matricesIndices;\n const currentMatrixWeights = vertex_data.matricesWeights;\n const currentMatrixIndicesExtra = vertex_data.matricesIndicesExtra;\n const currentMatrixWeightsExtra = vertex_data.matricesWeightsExtra;\n if (currentIndices === void 0 || currentPositions === void 0 || currentIndices === null || currentPositions === null) {\n Logger.Warn(\"VertexData contains empty entries\");\n }\n else {\n const positions = new Array();\n const indices = new Array();\n const uvs = new Array();\n const colors = new Array();\n const matrixIndices = new Array();\n const matrixWeights = new Array();\n const matrixIndicesExtra = new Array();\n const matrixWeightsExtra = new Array();\n let pstring = new Array(); //lists facet vertex positions (a,b,c) as string \"a|b|c\"\n let indexPtr = 0; // pointer to next available index value\n const uniquePositions = {}; // unique vertex positions\n let ptr; // pointer to element in uniquePositions\n let facet;\n for (let i = 0; i < currentIndices.length; i += 3) {\n facet = [currentIndices[i], currentIndices[i + 1], currentIndices[i + 2]]; //facet vertex indices\n pstring = [];\n for (let j = 0; j < 3; j++) {\n pstring[j] = \"\";\n for (let k = 0; k < 3; k++) {\n //small values make 0\n if (Math.abs(currentPositions[3 * facet[j] + k]) < 0.00000001) {\n currentPositions[3 * facet[j] + k] = 0;\n }\n pstring[j] += currentPositions[3 * facet[j] + k] + \"|\";\n }\n }\n //check facet vertices to see that none are repeated\n // do not process any facet that has a repeated vertex, ie is a line\n if (!(pstring[0] == pstring[1] || pstring[0] == pstring[2] || pstring[1] == pstring[2])) {\n //for each facet position check if already listed in uniquePositions\n // if not listed add to uniquePositions and set index pointer\n // if listed use its index in uniquePositions and new index pointer\n for (let j = 0; j < 3; j++) {\n ptr = uniquePositions[pstring[j]];\n if (ptr === undefined) {\n uniquePositions[pstring[j]] = indexPtr;\n ptr = indexPtr++;\n //not listed so add individual x, y, z coordinates to positions\n for (let k = 0; k < 3; k++) {\n positions.push(currentPositions[3 * facet[j] + k]);\n }\n if (currentColors !== null && currentColors !== void 0) {\n for (let k = 0; k < 4; k++) {\n colors.push(currentColors[4 * facet[j] + k]);\n }\n }\n if (currentUVs !== null && currentUVs !== void 0) {\n for (let k = 0; k < 2; k++) {\n uvs.push(currentUVs[2 * facet[j] + k]);\n }\n }\n if (currentMatrixIndices !== null && currentMatrixIndices !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixIndices.push(currentMatrixIndices[4 * facet[j] + k]);\n }\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixWeights.push(currentMatrixWeights[4 * facet[j] + k]);\n }\n }\n if (currentMatrixIndicesExtra !== null && currentMatrixIndicesExtra !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixIndicesExtra.push(currentMatrixIndicesExtra[4 * facet[j] + k]);\n }\n }\n if (currentMatrixWeightsExtra !== null && currentMatrixWeightsExtra !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixWeightsExtra.push(currentMatrixWeightsExtra[4 * facet[j] + k]);\n }\n }\n }\n // add new index pointer to indices array\n indices.push(ptr);\n }\n }\n }\n const normals = new Array();\n VertexData.ComputeNormals(positions, indices, normals);\n //create new vertex data object and update\n vertex_data.positions = positions;\n vertex_data.indices = indices;\n vertex_data.normals = normals;\n if (currentUVs !== null && currentUVs !== void 0) {\n vertex_data.uvs = uvs;\n }\n if (currentColors !== null && currentColors !== void 0) {\n vertex_data.colors = colors;\n }\n if (currentMatrixIndices !== null && currentMatrixIndices !== void 0) {\n vertex_data.matricesIndices = matrixIndices;\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n vertex_data.matricesWeights = matrixWeights;\n }\n if (currentMatrixIndicesExtra !== null && currentMatrixIndicesExtra !== void 0) {\n vertex_data.matricesIndicesExtra = matrixIndicesExtra;\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n vertex_data.matricesWeightsExtra = matrixWeightsExtra;\n }\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\n }\n }\n // Instances\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/naming-convention\n static _instancedMeshFactory(name, mesh) {\n throw _WarnImport(\"InstancedMesh\");\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _PhysicsImpostorParser(scene, physicObject, jsonObject) {\n throw _WarnImport(\"PhysicsImpostor\");\n }\n /**\n * Creates a new InstancedMesh object from the mesh model.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances\n * @param name defines the name of the new instance\n * @returns a new InstancedMesh\n */\n createInstance(name) {\n const instance = Mesh._instancedMeshFactory(name, this);\n instance.parent = this.parent;\n return instance;\n }\n /**\n * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.\n * After this call, all the mesh instances have the same submeshes than the current mesh.\n * @returns the current mesh\n */\n synchronizeInstances() {\n for (let instanceIndex = 0; instanceIndex < this.instances.length; instanceIndex++) {\n const instance = this.instances[instanceIndex];\n instance._syncSubMeshes();\n }\n return this;\n }\n /**\n * Optimization of the mesh's indices, in case a mesh has duplicated vertices.\n * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.\n * This should be used together with the simplification to avoid disappearing triangles.\n * @param successCallback an optional success callback to be called after the optimization finished.\n * @returns the current mesh\n */\n optimizeIndices(successCallback) {\n const indices = this.getIndices();\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positions || !indices) {\n return this;\n }\n const vectorPositions = [];\n for (let pos = 0; pos < positions.length; pos = pos + 3) {\n vectorPositions.push(Vector3.FromArray(positions, pos));\n }\n const dupes = [];\n AsyncLoop.SyncAsyncForLoop(vectorPositions.length, 40, (iteration) => {\n const realPos = vectorPositions.length - 1 - iteration;\n const testedPosition = vectorPositions[realPos];\n for (let j = 0; j < realPos; ++j) {\n const againstPosition = vectorPositions[j];\n if (testedPosition.equals(againstPosition)) {\n dupes[realPos] = j;\n break;\n }\n }\n }, () => {\n for (let i = 0; i < indices.length; ++i) {\n indices[i] = dupes[indices[i]] || indices[i];\n }\n //indices are now reordered\n const originalSubMeshes = this.subMeshes.slice(0);\n this.setIndices(indices);\n this.subMeshes = originalSubMeshes;\n if (successCallback) {\n successCallback(this);\n }\n });\n return this;\n }\n /**\n * Serialize current mesh\n * @param serializationObject defines the object which will receive the serialization data\n * @returns the serialized object\n */\n serialize(serializationObject = {}) {\n serializationObject.name = this.name;\n serializationObject.id = this.id;\n serializationObject.uniqueId = this.uniqueId;\n serializationObject.type = this.getClassName();\n if (Tags && Tags.HasTags(this)) {\n serializationObject.tags = Tags.GetTags(this);\n }\n serializationObject.position = this.position.asArray();\n if (this.rotationQuaternion) {\n serializationObject.rotationQuaternion = this.rotationQuaternion.asArray();\n }\n else if (this.rotation) {\n serializationObject.rotation = this.rotation.asArray();\n }\n serializationObject.scaling = this.scaling.asArray();\n if (this._postMultiplyPivotMatrix) {\n serializationObject.pivotMatrix = this.getPivotMatrix().asArray();\n }\n else {\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\n }\n serializationObject.isEnabled = this.isEnabled(false);\n serializationObject.isVisible = this.isVisible;\n serializationObject.infiniteDistance = this.infiniteDistance;\n serializationObject.pickable = this.isPickable;\n serializationObject.receiveShadows = this.receiveShadows;\n serializationObject.billboardMode = this.billboardMode;\n serializationObject.visibility = this.visibility;\n serializationObject.alwaysSelectAsActiveMesh = this.alwaysSelectAsActiveMesh;\n serializationObject.checkCollisions = this.checkCollisions;\n serializationObject.ellipsoid = this.ellipsoid.asArray();\n serializationObject.ellipsoidOffset = this.ellipsoidOffset.asArray();\n serializationObject.doNotSyncBoundingInfo = this.doNotSyncBoundingInfo;\n serializationObject.isBlocker = this.isBlocker;\n serializationObject.sideOrientation = this.sideOrientation;\n // Parent\n if (this.parent) {\n this.parent._serializeAsParent(serializationObject);\n }\n // Geometry\n serializationObject.isUnIndexed = this.isUnIndexed;\n const geometry = this._geometry;\n if (geometry && this.subMeshes) {\n serializationObject.geometryUniqueId = geometry.uniqueId;\n serializationObject.geometryId = geometry.id;\n // SubMeshes\n serializationObject.subMeshes = [];\n for (let subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {\n const subMesh = this.subMeshes[subIndex];\n serializationObject.subMeshes.push({\n materialIndex: subMesh.materialIndex,\n verticesStart: subMesh.verticesStart,\n verticesCount: subMesh.verticesCount,\n indexStart: subMesh.indexStart,\n indexCount: subMesh.indexCount,\n });\n }\n }\n // Material\n if (this.material) {\n if (!this.material.doNotSerialize) {\n serializationObject.materialUniqueId = this.material.uniqueId;\n serializationObject.materialId = this.material.id; // back compat\n }\n }\n else {\n this.material = null;\n serializationObject.materialUniqueId = this._scene.defaultMaterial.uniqueId;\n serializationObject.materialId = this._scene.defaultMaterial.id; // back compat\n }\n // Morph targets\n if (this.morphTargetManager) {\n serializationObject.morphTargetManagerId = this.morphTargetManager.uniqueId;\n }\n // Skeleton\n if (this.skeleton) {\n serializationObject.skeletonId = this.skeleton.id;\n serializationObject.numBoneInfluencers = this.numBoneInfluencers;\n }\n // Physics\n //TODO implement correct serialization for physics impostors.\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\n const impostor = this.getPhysicsImpostor();\n if (impostor) {\n serializationObject.physicsMass = impostor.getParam(\"mass\");\n serializationObject.physicsFriction = impostor.getParam(\"friction\");\n serializationObject.physicsRestitution = impostor.getParam(\"mass\");\n serializationObject.physicsImpostor = impostor.type;\n }\n }\n // Metadata\n if (this.metadata) {\n serializationObject.metadata = this.metadata;\n }\n // Instances\n serializationObject.instances = [];\n for (let index = 0; index < this.instances.length; index++) {\n const instance = this.instances[index];\n if (instance.doNotSerialize) {\n continue;\n }\n const serializationInstance = {\n name: instance.name,\n id: instance.id,\n isEnabled: instance.isEnabled(false),\n isVisible: instance.isVisible,\n isPickable: instance.isPickable,\n checkCollisions: instance.checkCollisions,\n position: instance.position.asArray(),\n scaling: instance.scaling.asArray(),\n };\n if (instance.parent) {\n instance.parent._serializeAsParent(serializationInstance);\n }\n if (instance.rotationQuaternion) {\n serializationInstance.rotationQuaternion = instance.rotationQuaternion.asArray();\n }\n else if (instance.rotation) {\n serializationInstance.rotation = instance.rotation.asArray();\n }\n // Physics\n //TODO implement correct serialization for physics impostors.\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\n const impostor = instance.getPhysicsImpostor();\n if (impostor) {\n serializationInstance.physicsMass = impostor.getParam(\"mass\");\n serializationInstance.physicsFriction = impostor.getParam(\"friction\");\n serializationInstance.physicsRestitution = impostor.getParam(\"mass\");\n serializationInstance.physicsImpostor = impostor.type;\n }\n }\n // Metadata\n if (instance.metadata) {\n serializationInstance.metadata = instance.metadata;\n }\n // Action Manager\n if (instance.actionManager) {\n serializationInstance.actions = instance.actionManager.serialize(instance.name);\n }\n serializationObject.instances.push(serializationInstance);\n // Animations\n SerializationHelper.AppendSerializedAnimations(instance, serializationInstance);\n serializationInstance.ranges = instance.serializeAnimationRanges();\n }\n // Thin instances\n if (this._thinInstanceDataStorage.instancesCount && this._thinInstanceDataStorage.matrixData) {\n serializationObject.thinInstances = {\n instancesCount: this._thinInstanceDataStorage.instancesCount,\n matrixData: Array.from(this._thinInstanceDataStorage.matrixData),\n matrixBufferSize: this._thinInstanceDataStorage.matrixBufferSize,\n enablePicking: this.thinInstanceEnablePicking,\n };\n if (this._userThinInstanceBuffersStorage) {\n const userThinInstance = {\n data: {},\n sizes: {},\n strides: {},\n };\n for (const kind in this._userThinInstanceBuffersStorage.data) {\n userThinInstance.data[kind] = Array.from(this._userThinInstanceBuffersStorage.data[kind]);\n userThinInstance.sizes[kind] = this._userThinInstanceBuffersStorage.sizes[kind];\n userThinInstance.strides[kind] = this._userThinInstanceBuffersStorage.strides[kind];\n }\n serializationObject.thinInstances.userThinInstance = userThinInstance;\n }\n }\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n serializationObject.ranges = this.serializeAnimationRanges();\n // Layer mask\n serializationObject.layerMask = this.layerMask;\n // Alpha\n serializationObject.alphaIndex = this.alphaIndex;\n serializationObject.hasVertexAlpha = this.hasVertexAlpha;\n // Overlay\n serializationObject.overlayAlpha = this.overlayAlpha;\n serializationObject.overlayColor = this.overlayColor.asArray();\n serializationObject.renderOverlay = this.renderOverlay;\n // Fog\n serializationObject.applyFog = this.applyFog;\n // Action Manager\n if (this.actionManager) {\n serializationObject.actions = this.actionManager.serialize(this.name);\n }\n return serializationObject;\n }\n /** @internal */\n _syncGeometryWithMorphTargetManager() {\n if (!this.geometry) {\n return;\n }\n this._markSubMeshesAsAttributesDirty();\n const morphTargetManager = this._internalAbstractMeshDataInfo._morphTargetManager;\n if (morphTargetManager && morphTargetManager.vertexCount) {\n if (morphTargetManager.vertexCount !== this.getTotalVertices()) {\n Logger.Error(\"Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count.\");\n this.morphTargetManager = null;\n return;\n }\n if (morphTargetManager.isUsingTextureForTargets) {\n return;\n }\n for (let index = 0; index < morphTargetManager.numInfluencers; index++) {\n const morphTarget = morphTargetManager.getActiveTarget(index);\n const positions = morphTarget.getPositions();\n if (!positions) {\n Logger.Error(\"Invalid morph target. Target must have positions.\");\n return;\n }\n this.geometry.setVerticesData(VertexBuffer.PositionKind + index, positions, false, 3);\n const normals = morphTarget.getNormals();\n if (normals) {\n this.geometry.setVerticesData(VertexBuffer.NormalKind + index, normals, false, 3);\n }\n const tangents = morphTarget.getTangents();\n if (tangents) {\n this.geometry.setVerticesData(VertexBuffer.TangentKind + index, tangents, false, 3);\n }\n const uvs = morphTarget.getUVs();\n if (uvs) {\n this.geometry.setVerticesData(VertexBuffer.UVKind + \"_\" + index, uvs, false, 2);\n }\n }\n }\n else {\n let index = 0;\n // Positions\n while (this.geometry.isVerticesDataPresent(VertexBuffer.PositionKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.PositionKind + index);\n if (this.geometry.isVerticesDataPresent(VertexBuffer.NormalKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.NormalKind + index);\n }\n if (this.geometry.isVerticesDataPresent(VertexBuffer.TangentKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.TangentKind + index);\n }\n if (this.geometry.isVerticesDataPresent(VertexBuffer.UVKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.UVKind + \"_\" + index);\n }\n index++;\n }\n }\n }\n /**\n * Returns a new Mesh object parsed from the source provided.\n * @param parsedMesh is the source\n * @param scene defines the hosting scene\n * @param rootUrl is the root URL to prefix the `delayLoadingFile` property with\n * @returns a new Mesh\n */\n static Parse(parsedMesh, scene, rootUrl) {\n let mesh;\n if (parsedMesh.type && parsedMesh.type === \"LinesMesh\") {\n mesh = Mesh._LinesMeshParser(parsedMesh, scene);\n }\n else if (parsedMesh.type && parsedMesh.type === \"GroundMesh\") {\n mesh = Mesh._GroundMeshParser(parsedMesh, scene);\n }\n else if (parsedMesh.type && parsedMesh.type === \"GoldbergMesh\") {\n mesh = Mesh._GoldbergMeshParser(parsedMesh, scene);\n }\n else if (parsedMesh.type && parsedMesh.type === \"GreasedLineMesh\") {\n mesh = Mesh._GreasedLineMeshParser(parsedMesh, scene);\n }\n else if (parsedMesh.type && parsedMesh.type === \"TrailMesh\") {\n mesh = Mesh._TrailMeshParser(parsedMesh, scene);\n }\n else {\n mesh = new Mesh(parsedMesh.name, scene);\n }\n mesh.id = parsedMesh.id;\n mesh._waitingParsedUniqueId = parsedMesh.uniqueId;\n if (Tags) {\n Tags.AddTagsTo(mesh, parsedMesh.tags);\n }\n mesh.position = Vector3.FromArray(parsedMesh.position);\n if (parsedMesh.metadata !== undefined) {\n mesh.metadata = parsedMesh.metadata;\n }\n if (parsedMesh.rotationQuaternion) {\n mesh.rotationQuaternion = Quaternion.FromArray(parsedMesh.rotationQuaternion);\n }\n else if (parsedMesh.rotation) {\n mesh.rotation = Vector3.FromArray(parsedMesh.rotation);\n }\n mesh.scaling = Vector3.FromArray(parsedMesh.scaling);\n if (parsedMesh.localMatrix) {\n mesh.setPreTransformMatrix(Matrix.FromArray(parsedMesh.localMatrix));\n }\n else if (parsedMesh.pivotMatrix) {\n mesh.setPivotMatrix(Matrix.FromArray(parsedMesh.pivotMatrix));\n }\n mesh.setEnabled(parsedMesh.isEnabled);\n mesh.isVisible = parsedMesh.isVisible;\n mesh.infiniteDistance = parsedMesh.infiniteDistance;\n mesh.alwaysSelectAsActiveMesh = !!parsedMesh.alwaysSelectAsActiveMesh;\n mesh.showBoundingBox = parsedMesh.showBoundingBox;\n mesh.showSubMeshesBoundingBox = parsedMesh.showSubMeshesBoundingBox;\n if (parsedMesh.applyFog !== undefined) {\n mesh.applyFog = parsedMesh.applyFog;\n }\n if (parsedMesh.pickable !== undefined) {\n mesh.isPickable = parsedMesh.pickable;\n }\n if (parsedMesh.alphaIndex !== undefined) {\n mesh.alphaIndex = parsedMesh.alphaIndex;\n }\n mesh.receiveShadows = parsedMesh.receiveShadows;\n if (parsedMesh.billboardMode !== undefined) {\n mesh.billboardMode = parsedMesh.billboardMode;\n }\n if (parsedMesh.visibility !== undefined) {\n mesh.visibility = parsedMesh.visibility;\n }\n mesh.checkCollisions = parsedMesh.checkCollisions;\n mesh.doNotSyncBoundingInfo = !!parsedMesh.doNotSyncBoundingInfo;\n if (parsedMesh.ellipsoid) {\n mesh.ellipsoid = Vector3.FromArray(parsedMesh.ellipsoid);\n }\n if (parsedMesh.ellipsoidOffset) {\n mesh.ellipsoidOffset = Vector3.FromArray(parsedMesh.ellipsoidOffset);\n }\n // For Backward compatibility (\"!=\" to exclude null and undefined)\n if (parsedMesh.overrideMaterialSideOrientation != null) {\n mesh.sideOrientation = parsedMesh.overrideMaterialSideOrientation;\n }\n if (parsedMesh.sideOrientation !== undefined) {\n mesh.sideOrientation = parsedMesh.sideOrientation;\n }\n if (parsedMesh.isBlocker !== undefined) {\n mesh.isBlocker = parsedMesh.isBlocker;\n }\n mesh._shouldGenerateFlatShading = parsedMesh.useFlatShading;\n // freezeWorldMatrix\n if (parsedMesh.freezeWorldMatrix) {\n mesh._waitingData.freezeWorldMatrix = parsedMesh.freezeWorldMatrix;\n }\n // Parent\n if (parsedMesh.parentId !== undefined) {\n mesh._waitingParentId = parsedMesh.parentId;\n }\n if (parsedMesh.parentInstanceIndex !== undefined) {\n mesh._waitingParentInstanceIndex = parsedMesh.parentInstanceIndex;\n }\n // Actions\n if (parsedMesh.actions !== undefined) {\n mesh._waitingData.actions = parsedMesh.actions;\n }\n // Overlay\n if (parsedMesh.overlayAlpha !== undefined) {\n mesh.overlayAlpha = parsedMesh.overlayAlpha;\n }\n if (parsedMesh.overlayColor !== undefined) {\n mesh.overlayColor = Color3.FromArray(parsedMesh.overlayColor);\n }\n if (parsedMesh.renderOverlay !== undefined) {\n mesh.renderOverlay = parsedMesh.renderOverlay;\n }\n // Geometry\n mesh.isUnIndexed = !!parsedMesh.isUnIndexed;\n mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha;\n if (parsedMesh.delayLoadingFile) {\n mesh.delayLoadState = 4;\n mesh.delayLoadingFile = rootUrl + parsedMesh.delayLoadingFile;\n mesh.buildBoundingInfo(Vector3.FromArray(parsedMesh.boundingBoxMinimum), Vector3.FromArray(parsedMesh.boundingBoxMaximum));\n if (parsedMesh._binaryInfo) {\n mesh._binaryInfo = parsedMesh._binaryInfo;\n }\n mesh._delayInfo = [];\n if (parsedMesh.hasUVs) {\n mesh._delayInfo.push(VertexBuffer.UVKind);\n }\n if (parsedMesh.hasUVs2) {\n mesh._delayInfo.push(VertexBuffer.UV2Kind);\n }\n if (parsedMesh.hasUVs3) {\n mesh._delayInfo.push(VertexBuffer.UV3Kind);\n }\n if (parsedMesh.hasUVs4) {\n mesh._delayInfo.push(VertexBuffer.UV4Kind);\n }\n if (parsedMesh.hasUVs5) {\n mesh._delayInfo.push(VertexBuffer.UV5Kind);\n }\n if (parsedMesh.hasUVs6) {\n mesh._delayInfo.push(VertexBuffer.UV6Kind);\n }\n if (parsedMesh.hasColors) {\n mesh._delayInfo.push(VertexBuffer.ColorKind);\n }\n if (parsedMesh.hasMatricesIndices) {\n mesh._delayInfo.push(VertexBuffer.MatricesIndicesKind);\n }\n if (parsedMesh.hasMatricesWeights) {\n mesh._delayInfo.push(VertexBuffer.MatricesWeightsKind);\n }\n mesh._delayLoadingFunction = Geometry._ImportGeometry;\n if (SceneLoaderFlags.ForceFullSceneLoadingForIncremental) {\n mesh._checkDelayState();\n }\n }\n else {\n Geometry._ImportGeometry(parsedMesh, mesh);\n }\n // Material\n if (parsedMesh.materialUniqueId) {\n mesh._waitingMaterialId = parsedMesh.materialUniqueId;\n }\n else if (parsedMesh.materialId) {\n mesh._waitingMaterialId = parsedMesh.materialId;\n }\n // Morph targets\n if (parsedMesh.morphTargetManagerId > -1) {\n mesh._waitingMorphTargetManagerId = parsedMesh.morphTargetManagerId;\n }\n // Skeleton\n if (parsedMesh.skeletonId !== undefined && parsedMesh.skeletonId !== null) {\n mesh.skeleton = scene.getLastSkeletonById(parsedMesh.skeletonId);\n if (parsedMesh.numBoneInfluencers) {\n mesh.numBoneInfluencers = parsedMesh.numBoneInfluencers;\n }\n }\n // Animations\n if (parsedMesh.animations) {\n for (let animationIndex = 0; animationIndex < parsedMesh.animations.length; animationIndex++) {\n const parsedAnimation = parsedMesh.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n mesh.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(mesh, parsedMesh, scene);\n }\n if (parsedMesh.autoAnimate) {\n scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);\n }\n // Layer Mask\n if (parsedMesh.layerMask && !isNaN(parsedMesh.layerMask)) {\n mesh.layerMask = Math.abs(parseInt(parsedMesh.layerMask));\n }\n else {\n mesh.layerMask = 0x0fffffff;\n }\n // Physics\n if (parsedMesh.physicsImpostor) {\n mesh.physicsImpostor = Mesh._PhysicsImpostorParser(scene, mesh, parsedMesh);\n }\n // Levels\n if (parsedMesh.lodMeshIds) {\n mesh._waitingData.lods = {\n ids: parsedMesh.lodMeshIds,\n distances: parsedMesh.lodDistances ? parsedMesh.lodDistances : null,\n coverages: parsedMesh.lodCoverages ? parsedMesh.lodCoverages : null,\n };\n }\n // Instances\n if (parsedMesh.instances) {\n for (let index = 0; index < parsedMesh.instances.length; index++) {\n const parsedInstance = parsedMesh.instances[index];\n const instance = mesh.createInstance(parsedInstance.name);\n if (parsedInstance.id) {\n instance.id = parsedInstance.id;\n }\n if (Tags) {\n if (parsedInstance.tags) {\n Tags.AddTagsTo(instance, parsedInstance.tags);\n }\n else {\n Tags.AddTagsTo(instance, parsedMesh.tags);\n }\n }\n instance.position = Vector3.FromArray(parsedInstance.position);\n if (parsedInstance.metadata !== undefined) {\n instance.metadata = parsedInstance.metadata;\n }\n if (parsedInstance.parentId !== undefined) {\n instance._waitingParentId = parsedInstance.parentId;\n }\n if (parsedInstance.parentInstanceIndex !== undefined) {\n instance._waitingParentInstanceIndex = parsedInstance.parentInstanceIndex;\n }\n if (parsedInstance.isEnabled !== undefined && parsedInstance.isEnabled !== null) {\n instance.setEnabled(parsedInstance.isEnabled);\n }\n if (parsedInstance.isVisible !== undefined && parsedInstance.isVisible !== null) {\n instance.isVisible = parsedInstance.isVisible;\n }\n if (parsedInstance.isPickable !== undefined && parsedInstance.isPickable !== null) {\n instance.isPickable = parsedInstance.isPickable;\n }\n if (parsedInstance.rotationQuaternion) {\n instance.rotationQuaternion = Quaternion.FromArray(parsedInstance.rotationQuaternion);\n }\n else if (parsedInstance.rotation) {\n instance.rotation = Vector3.FromArray(parsedInstance.rotation);\n }\n instance.scaling = Vector3.FromArray(parsedInstance.scaling);\n if (parsedInstance.checkCollisions != undefined && parsedInstance.checkCollisions != null) {\n instance.checkCollisions = parsedInstance.checkCollisions;\n }\n if (parsedInstance.pickable != undefined && parsedInstance.pickable != null) {\n instance.isPickable = parsedInstance.pickable;\n }\n if (parsedInstance.showBoundingBox != undefined && parsedInstance.showBoundingBox != null) {\n instance.showBoundingBox = parsedInstance.showBoundingBox;\n }\n if (parsedInstance.showSubMeshesBoundingBox != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\n instance.showSubMeshesBoundingBox = parsedInstance.showSubMeshesBoundingBox;\n }\n if (parsedInstance.alphaIndex != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\n instance.alphaIndex = parsedInstance.alphaIndex;\n }\n // Physics\n if (parsedInstance.physicsImpostor) {\n instance.physicsImpostor = Mesh._PhysicsImpostorParser(scene, instance, parsedInstance);\n }\n // Actions\n if (parsedInstance.actions !== undefined) {\n instance._waitingData.actions = parsedInstance.actions;\n }\n // Animation\n if (parsedInstance.animations) {\n for (let animationIndex = 0; animationIndex < parsedInstance.animations.length; animationIndex++) {\n const parsedAnimation = parsedInstance.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n instance.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(instance, parsedInstance, scene);\n if (parsedInstance.autoAnimate) {\n scene.beginAnimation(instance, parsedInstance.autoAnimateFrom, parsedInstance.autoAnimateTo, parsedInstance.autoAnimateLoop, parsedInstance.autoAnimateSpeed || 1.0);\n }\n }\n }\n }\n // Thin instances\n if (parsedMesh.thinInstances) {\n const thinInstances = parsedMesh.thinInstances;\n mesh.thinInstanceEnablePicking = !!thinInstances.enablePicking;\n if (thinInstances.matrixData) {\n mesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(thinInstances.matrixData), 16, false);\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\n mesh._thinInstanceDataStorage.instancesCount = thinInstances.instancesCount;\n }\n else {\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\n }\n if (parsedMesh.thinInstances.userThinInstance) {\n const userThinInstance = parsedMesh.thinInstances.userThinInstance;\n for (const kind in userThinInstance.data) {\n mesh.thinInstanceSetBuffer(kind, new Float32Array(userThinInstance.data[kind]), userThinInstance.strides[kind], false);\n mesh._userThinInstanceBuffersStorage.sizes[kind] = userThinInstance.sizes[kind];\n }\n }\n }\n return mesh;\n }\n // Skeletons\n /**\n * Prepare internal position array for software CPU skinning\n * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh\n */\n setPositionsForCPUSkinning() {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourcePositions) {\n const source = this.getVerticesData(VertexBuffer.PositionKind);\n if (!source) {\n return internalDataInfo._sourcePositions;\n }\n internalDataInfo._sourcePositions = new Float32Array(source);\n if (!this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\n this.setVerticesData(VertexBuffer.PositionKind, source, true);\n }\n }\n return internalDataInfo._sourcePositions;\n }\n /**\n * Prepare internal normal array for software CPU skinning\n * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.\n */\n setNormalsForCPUSkinning() {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourceNormals) {\n const source = this.getVerticesData(VertexBuffer.NormalKind);\n if (!source) {\n return internalDataInfo._sourceNormals;\n }\n internalDataInfo._sourceNormals = new Float32Array(source);\n if (!this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\n this.setVerticesData(VertexBuffer.NormalKind, source, true);\n }\n }\n return internalDataInfo._sourceNormals;\n }\n /**\n * Updates the vertex buffer by applying transformation from the bones\n * @param skeleton defines the skeleton to apply to current mesh\n * @returns the current mesh\n */\n applySkeleton(skeleton) {\n if (!this.geometry) {\n return this;\n }\n if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId()) {\n return this;\n }\n this.geometry._softwareSkinningFrameId = this.getScene().getFrameId();\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\n return this;\n }\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\n return this;\n }\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\n return this;\n }\n const hasNormals = this.isVerticesDataPresent(VertexBuffer.NormalKind);\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourcePositions) {\n const submeshes = this.subMeshes.slice();\n this.setPositionsForCPUSkinning();\n this.subMeshes = submeshes;\n }\n if (hasNormals && !internalDataInfo._sourceNormals) {\n this.setNormalsForCPUSkinning();\n }\n // positionsData checks for not being Float32Array will only pass at most once\n let positionsData = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positionsData) {\n return this;\n }\n if (!(positionsData instanceof Float32Array)) {\n positionsData = new Float32Array(positionsData);\n }\n // normalsData checks for not being Float32Array will only pass at most once\n let normalsData = this.getVerticesData(VertexBuffer.NormalKind);\n if (hasNormals) {\n if (!normalsData) {\n return this;\n }\n if (!(normalsData instanceof Float32Array)) {\n normalsData = new Float32Array(normalsData);\n }\n }\n const matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\n const matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n if (!matricesWeightsData || !matricesIndicesData) {\n return this;\n }\n const needExtras = this.numBoneInfluencers > 4;\n const matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\n const matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\n const skeletonMatrices = skeleton.getTransformMatrices(this);\n const tempVector3 = Vector3.Zero();\n const finalMatrix = new Matrix();\n const tempMatrix = new Matrix();\n let matWeightIdx = 0;\n let inf;\n for (let index = 0; index < positionsData.length; index += 3, matWeightIdx += 4) {\n let weight;\n for (inf = 0; inf < 4; inf++) {\n weight = matricesWeightsData[matWeightIdx + inf];\n if (weight > 0) {\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\n finalMatrix.addToSelf(tempMatrix);\n }\n }\n if (needExtras) {\n for (inf = 0; inf < 4; inf++) {\n weight = matricesWeightsExtraData[matWeightIdx + inf];\n if (weight > 0) {\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\n finalMatrix.addToSelf(tempMatrix);\n }\n }\n }\n Vector3.TransformCoordinatesFromFloatsToRef(internalDataInfo._sourcePositions[index], internalDataInfo._sourcePositions[index + 1], internalDataInfo._sourcePositions[index + 2], finalMatrix, tempVector3);\n tempVector3.toArray(positionsData, index);\n if (hasNormals) {\n Vector3.TransformNormalFromFloatsToRef(internalDataInfo._sourceNormals[index], internalDataInfo._sourceNormals[index + 1], internalDataInfo._sourceNormals[index + 2], finalMatrix, tempVector3);\n tempVector3.toArray(normalsData, index);\n }\n finalMatrix.reset();\n }\n this.updateVerticesData(VertexBuffer.PositionKind, positionsData);\n if (hasNormals) {\n this.updateVerticesData(VertexBuffer.NormalKind, normalsData);\n }\n return this;\n }\n // Tools\n /**\n * Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates\n * @param meshes defines the list of meshes to scan\n * @returns an object `{min:` Vector3`, max:` Vector3`}`\n */\n static MinMax(meshes) {\n let minVector = null;\n let maxVector = null;\n meshes.forEach(function (mesh) {\n const boundingInfo = mesh.getBoundingInfo();\n const boundingBox = boundingInfo.boundingBox;\n if (!minVector || !maxVector) {\n minVector = boundingBox.minimumWorld;\n maxVector = boundingBox.maximumWorld;\n }\n else {\n minVector.minimizeInPlace(boundingBox.minimumWorld);\n maxVector.maximizeInPlace(boundingBox.maximumWorld);\n }\n });\n if (!minVector || !maxVector) {\n return {\n min: Vector3.Zero(),\n max: Vector3.Zero(),\n };\n }\n return {\n min: minVector,\n max: maxVector,\n };\n }\n /**\n * Returns the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array\n * @param meshesOrMinMaxVector could be an array of meshes or a `{min:` Vector3`, max:` Vector3`}` object\n * @returns a vector3\n */\n static Center(meshesOrMinMaxVector) {\n const minMaxVector = meshesOrMinMaxVector instanceof Array ? Mesh.MinMax(meshesOrMinMaxVector) : meshesOrMinMaxVector;\n return Vector3.Center(minMaxVector.min, minMaxVector.max);\n }\n /**\n * Merge the array of meshes into a single mesh for performance reasons.\n * @param meshes array of meshes with the vertices to merge. Entries cannot be empty meshes.\n * @param disposeSource when true (default), dispose of the vertices from the source meshes.\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true.\n * @param meshSubclass (optional) can be set to a Mesh where the merged vertices will be inserted.\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh into subMeshes.\n * @param multiMultiMaterials when true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.\n * @returns a new mesh\n */\n static MergeMeshes(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\n return runCoroutineSync(Mesh._MergeMeshesCoroutine(meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, false));\n }\n /**\n * Merge the array of meshes into a single mesh for performance reasons.\n * @param meshes array of meshes with the vertices to merge. Entries cannot be empty meshes.\n * @param disposeSource when true (default), dispose of the vertices from the source meshes.\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true.\n * @param meshSubclass (optional) can be set to a Mesh where the merged vertices will be inserted.\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh into subMeshes.\n * @param multiMultiMaterials when true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.\n * @returns a new mesh\n */\n static MergeMeshesAsync(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\n return runCoroutineAsync(Mesh._MergeMeshesCoroutine(meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, true), createYieldingScheduler());\n }\n static *_MergeMeshesCoroutine(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, isAsync) {\n // Remove any null/undefined entries from the mesh array\n meshes = meshes.filter(Boolean);\n if (meshes.length === 0) {\n return null;\n }\n let index;\n if (!allow32BitsIndices) {\n let totalVertices = 0;\n // Counting vertices\n for (index = 0; index < meshes.length; index++) {\n totalVertices += meshes[index].getTotalVertices();\n if (totalVertices >= 65536) {\n Logger.Warn(\"Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices\");\n return null;\n }\n }\n }\n if (multiMultiMaterials) {\n subdivideWithSubMeshes = false;\n }\n const materialArray = new Array();\n const materialIndexArray = new Array();\n // Merge\n const indiceArray = new Array();\n const currentsideOrientation = meshes[0].sideOrientation;\n for (index = 0; index < meshes.length; index++) {\n const mesh = meshes[index];\n if (mesh.isAnInstance) {\n Logger.Warn(\"Cannot merge instance meshes.\");\n return null;\n }\n if (currentsideOrientation !== mesh.sideOrientation) {\n Logger.Warn(\"Cannot merge meshes with different sideOrientation values.\");\n return null;\n }\n if (subdivideWithSubMeshes) {\n indiceArray.push(mesh.getTotalIndices());\n }\n if (multiMultiMaterials) {\n if (mesh.material) {\n const material = mesh.material;\n if (material instanceof MultiMaterial) {\n for (let matIndex = 0; matIndex < material.subMaterials.length; matIndex++) {\n if (materialArray.indexOf(material.subMaterials[matIndex]) < 0) {\n materialArray.push(material.subMaterials[matIndex]);\n }\n }\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(materialArray.indexOf(material.subMaterials[mesh.subMeshes[subIndex].materialIndex]));\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n }\n else {\n if (materialArray.indexOf(material) < 0) {\n materialArray.push(material);\n }\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(materialArray.indexOf(material));\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n }\n }\n else {\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(0);\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n }\n }\n }\n const source = meshes[0];\n const getVertexDataFromMesh = (mesh) => {\n const wm = mesh.computeWorldMatrix(true);\n const vertexData = VertexData.ExtractFromMesh(mesh, false, false);\n return { vertexData, transform: wm };\n };\n const { vertexData: sourceVertexData, transform: sourceTransform } = getVertexDataFromMesh(source);\n if (isAsync) {\n yield;\n }\n const meshVertexDatas = new Array(meshes.length - 1);\n for (let i = 1; i < meshes.length; i++) {\n meshVertexDatas[i - 1] = getVertexDataFromMesh(meshes[i]);\n if (isAsync) {\n yield;\n }\n }\n const mergeCoroutine = sourceVertexData._mergeCoroutine(sourceTransform, meshVertexDatas, allow32BitsIndices, isAsync, !disposeSource);\n let mergeCoroutineStep = mergeCoroutine.next();\n while (!mergeCoroutineStep.done) {\n if (isAsync) {\n yield;\n }\n mergeCoroutineStep = mergeCoroutine.next();\n }\n const vertexData = mergeCoroutineStep.value;\n if (!meshSubclass) {\n meshSubclass = new Mesh(source.name + \"_merged\", source.getScene());\n }\n const applyToCoroutine = vertexData._applyToCoroutine(meshSubclass, undefined, isAsync);\n let applyToCoroutineStep = applyToCoroutine.next();\n while (!applyToCoroutineStep.done) {\n if (isAsync) {\n yield;\n }\n applyToCoroutineStep = applyToCoroutine.next();\n }\n // Setting properties\n meshSubclass.checkCollisions = source.checkCollisions;\n meshSubclass.sideOrientation = source.sideOrientation;\n // Cleaning\n if (disposeSource) {\n for (index = 0; index < meshes.length; index++) {\n meshes[index].dispose();\n }\n }\n // Subdivide\n if (subdivideWithSubMeshes || multiMultiMaterials) {\n //-- removal of global submesh\n meshSubclass.releaseSubMeshes();\n index = 0;\n let offset = 0;\n //-- apply subdivision according to index table\n while (index < indiceArray.length) {\n SubMesh.CreateFromIndices(0, offset, indiceArray[index], meshSubclass, undefined, false);\n offset += indiceArray[index];\n index++;\n }\n for (const subMesh of meshSubclass.subMeshes) {\n subMesh.refreshBoundingInfo();\n }\n meshSubclass.computeWorldMatrix(true);\n }\n if (multiMultiMaterials) {\n const newMultiMaterial = new MultiMaterial(source.name + \"_merged\", source.getScene());\n newMultiMaterial.subMaterials = materialArray;\n for (let subIndex = 0; subIndex < meshSubclass.subMeshes.length; subIndex++) {\n meshSubclass.subMeshes[subIndex].materialIndex = materialIndexArray[subIndex];\n }\n meshSubclass.material = newMultiMaterial;\n }\n else {\n meshSubclass.material = source.material;\n }\n return meshSubclass;\n }\n /**\n * @internal\n */\n addInstance(instance) {\n instance._indexInSourceMeshInstanceArray = this.instances.length;\n this.instances.push(instance);\n }\n /**\n * @internal\n */\n removeInstance(instance) {\n // Remove from mesh\n const index = instance._indexInSourceMeshInstanceArray;\n if (index != -1) {\n if (index !== this.instances.length - 1) {\n const last = this.instances[this.instances.length - 1];\n this.instances[index] = last;\n last._indexInSourceMeshInstanceArray = index;\n }\n instance._indexInSourceMeshInstanceArray = -1;\n this.instances.pop();\n }\n }\n /** @internal */\n _shouldConvertRHS() {\n return this._scene.useRightHandedSystem && this.sideOrientation === Material.CounterClockWiseSideOrientation;\n }\n /** @internal */\n _getRenderingFillMode(fillMode) {\n const scene = this.getScene();\n if (scene.forcePointsCloud)\n return Material.PointFillMode;\n if (scene.forceWireframe)\n return Material.WireFrameFillMode;\n return this.overrideRenderingFillMode ?? fillMode;\n }\n // deprecated methods\n /**\n * Sets the mesh material by the material or multiMaterial `id` property\n * @param id is a string identifying the material or the multiMaterial\n * @returns the current mesh\n * @deprecated Please use MeshBuilder instead Please use setMaterialById instead\n */\n setMaterialByID(id) {\n return this.setMaterialById(id);\n }\n /**\n * Creates a ribbon mesh.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @param name defines the name of the mesh to create\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\n * @param closePath creates a seam between the first and the last points of each path of the path array\n * @param offset is taken in account only if the `pathArray` is containing a single path\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateRibbon(name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a plane polygonal mesh. By default, this is a disc.\n * @param name defines the name of the mesh to create\n * @param radius sets the radius size (float) of the polygon (default 0.5)\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDisc(name, radius, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a box mesh.\n * @param name defines the name of the mesh to create\n * @param size sets the size (float) of each box side (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateBox(name, size, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a sphere mesh.\n * @param name defines the name of the mesh to create\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\n * @param diameter sets the diameter size (float) of the sphere (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateSphere(name, segments, diameter, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a hemisphere mesh.\n * @param name defines the name of the mesh to create\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\n * @param diameter sets the diameter size (float) of the sphere (default 1)\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateHemisphere(name, segments, diameter, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a cylinder or a cone mesh.\n * @param name defines the name of the mesh to create\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\n * @param diameterTop set the top cap diameter (floats, default 1)\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateCylinder(name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n // Torus (Code from SharpDX.org)\n /**\n * Creates a torus mesh.\n * @param name defines the name of the mesh to create\n * @param diameter sets the diameter size (float) of the torus (default 1)\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\n * @param tessellation sets the number of torus sides (positive integer, default 16)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTorus(name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a torus knot mesh.\n * @param name defines the name of the mesh to create\n * @param radius sets the global radius size (float) of the torus knot (default 2)\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\n * @param p the number of windings on X axis (positive integers, default 2)\n * @param q the number of windings on Y axis (positive integers, default 3)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTorusKnot(name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a line mesh..\n * @param name defines the name of the mesh to create\n * @param points is an array successive Vector3\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateLines(name, points, scene, updatable, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a dashed line mesh.\n * @param name defines the name of the mesh to create\n * @param points is an array successive Vector3\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDashedLines(name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * Remember you can only change the shape positions, not their number when updating a polygon.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#non-regular-polygon\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\n * @param scene defines the hosting scene\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePolygon(name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an extruded polygon mesh, with depth in the Y direction..\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-non-regular-polygon\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\n * @param depth defines the height of extrusion\n * @param scene defines the hosting scene\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudePolygon(name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an extruded shape mesh.\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\n * @param scale is the value to scale the shape\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudeShape(name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an custom extruded shape mesh.\n * The custom extrusion is a parametric shape.\n * It has no predefined shape. Its final shape will depend on the input parameters.\n *\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\n * @param scaleFunction is a custom Javascript function called on each path point\n * @param rotationFunction is a custom Javascript function called on each path point\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudeShapeCustom(name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates lathe mesh.\n * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe.\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\n * @param radius is the radius value of the lathe\n * @param tessellation is the side number of the lathe.\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateLathe(name, shape, radius, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a plane mesh.\n * @param name defines the name of the mesh to create\n * @param size sets the size (float) of both sides of the plane at once (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePlane(name, size, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a ground mesh.\n * @param name defines the name of the mesh to create\n * @param width set the width of the ground\n * @param height set the height of the ground\n * @param subdivisions sets the number of subdivisions per side\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateGround(name, width, height, subdivisions, scene, updatable) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a tiled ground mesh.\n * @param name defines the name of the mesh to create\n * @param xmin set the ground minimum X coordinate\n * @param zmin set the ground minimum Y coordinate\n * @param xmax set the ground maximum X coordinate\n * @param zmax set the ground maximum Z coordinate\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTiledGround(name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a ground mesh from a height map.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\n * @param name defines the name of the mesh to create\n * @param url sets the URL of the height map image resource\n * @param width set the ground width size\n * @param height set the ground height size\n * @param subdivisions sets the number of subdivision per side\n * @param minHeight is the minimum altitude on the ground\n * @param maxHeight is the maximum altitude on the ground\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateGroundFromHeightMap(name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a tube mesh.\n * The tube is a parametric shape.\n * It has no predefined shape. Its final shape will depend on the input parameters.\n *\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @param name defines the name of the mesh to create\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\n * @param radius sets the tube radius size\n * @param tessellation is the number of sides on the tubular surface\n * @param radiusFunction is a custom function. If it is not null, it overrides the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTube(name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a polyhedron mesh.\n *.\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embedded types. Please refer to the type sheet in the tutorial to choose the wanted type\n * * The parameter `size` (positive float, default 1) sets the polygon size\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh to create\n * @param options defines the options used to create the mesh\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePolyhedron(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\n * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra#icosphere\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateIcoSphere(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a decal mesh.\n *.\n * A decal is a mesh usually applied as a model onto the surface of another mesh\n * @param name defines the name of the mesh\n * @param sourceMesh defines the mesh receiving the decal\n * @param position sets the position of the decal in world coordinates\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\n * @param size sets the decal scaling\n * @param angle sets the angle to rotate the decal\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDecal(name, sourceMesh, position, normal, size, angle) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /** Creates a Capsule Mesh\n * @param name defines the name of the mesh.\n * @param options the constructors options used to shape the mesh.\n * @param scene defines the scene the mesh is scoped to.\n * @returns the capsule mesh\n * @see https://doc.babylonjs.com/how_to/capsule_shape\n * @deprecated Please use MeshBuilder instead\n */\n static CreateCapsule(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Extends a mesh to a Goldberg mesh\n * Warning the mesh to convert MUST be an import of a perviously exported Goldberg mesh\n * @param mesh the mesh to convert\n * @returns the extended mesh\n * @deprecated Please use ExtendMeshToGoldberg instead\n */\n static ExtendToGoldberg(mesh) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n}\n// Consts\n/**\n * Mesh side orientation : usually the external or front surface\n */\nMesh.FRONTSIDE = VertexData.FRONTSIDE;\n/**\n * Mesh side orientation : usually the internal or back surface\n */\nMesh.BACKSIDE = VertexData.BACKSIDE;\n/**\n * Mesh side orientation : both internal and external or front and back surfaces\n */\nMesh.DOUBLESIDE = VertexData.DOUBLESIDE;\n/**\n * Mesh side orientation : by default, `FRONTSIDE`\n */\nMesh.DEFAULTSIDE = VertexData.DEFAULTSIDE;\n/**\n * Mesh cap setting : no cap\n */\nMesh.NO_CAP = 0;\n/**\n * Mesh cap setting : one cap at the beginning of the mesh\n */\nMesh.CAP_START = 1;\n/**\n * Mesh cap setting : one cap at the end of the mesh\n */\nMesh.CAP_END = 2;\n/**\n * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh\n */\nMesh.CAP_ALL = 3;\n/**\n * Mesh pattern setting : no flip or rotate\n */\nMesh.NO_FLIP = 0;\n/**\n * Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column\n */\nMesh.FLIP_TILE = 1;\n/**\n * Mesh pattern setting : rotate (180degs) alternate tiles on each row or column\n */\nMesh.ROTATE_TILE = 2;\n/**\n * Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows\n */\nMesh.FLIP_ROW = 3;\n/**\n * Mesh pattern setting : rotate (180degs) all tiles on alternate rows\n */\nMesh.ROTATE_ROW = 4;\n/**\n * Mesh pattern setting : flip and rotate alternate tiles on each row or column\n */\nMesh.FLIP_N_ROTATE_TILE = 5;\n/**\n * Mesh pattern setting : rotate pattern and rotate\n */\nMesh.FLIP_N_ROTATE_ROW = 6;\n/**\n * Mesh tile positioning : part tiles same on left/right or top/bottom\n */\nMesh.CENTER = 0;\n/**\n * Mesh tile positioning : part tiles on left\n */\nMesh.LEFT = 1;\n/**\n * Mesh tile positioning : part tiles on right\n */\nMesh.RIGHT = 2;\n/**\n * Mesh tile positioning : part tiles on top\n */\nMesh.TOP = 3;\n/**\n * Mesh tile positioning : part tiles on bottom\n */\nMesh.BOTTOM = 4;\n/**\n * Indicates that the instanced meshes should be sorted from back to front before rendering if their material is transparent\n */\nMesh.INSTANCEDMESH_SORT_TRANSPARENT = false;\n// Statics\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GroundMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GroundMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GoldbergMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GoldbergMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._LinesMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"LinesMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GreasedLineMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GreasedLineMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GreasedLineRibbonMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GreasedLineRibbonMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._TrailMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"TrailMesh\");\n};\nRegisterClass(\"BABYLON.Mesh\", Mesh);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,KAAK,EAAEC,SAAS,QAAQ,kBAAkB;AACnD,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,IAAI,QAAQ,iBAAiB;AACtC,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,uBAAuB,QAAQ,sBAAsB;AACnG,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,UAAU,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,QAAQ,yBAAyB;AAC9E,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,YAAY,EAAEC,MAAM,QAAQ,sBAAsB;AAC3D,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,QAAQ,QAAQ,eAAe;AACxC,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,OAAO,QAAQ,cAAc;AACtC,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE,SAASC,mBAAmB,QAAQ,qCAAqC;AACzE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,QAAQ,EAAEC,aAAa,QAAQ,sBAAsB;AAC9D,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,uBAAuB,QAAQ,sBAAsB;AAC9D,SAASC,YAAY,QAAQ,mBAAmB;AAChD;AACA;AACA;AACA,OAA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B,4BAA4B,GAAG,CAAC3N,UAAU,EAAEzsB,KAAK,KAAK;EACvD,MAAMrG,WAAW,CAAC,uBAAuB,CAAC;AAC9C,CAAC;AACD;AACA;AACA;AACA;AACAiC,IAAI,CAACmxB,gBAAgB,GAAG,CAACN,UAAU,EAAEzsB,KAAK,KAAK;EAC3C,MAAMrG,WAAW,CAAC,WAAW,CAAC;AAClC,CAAC;AACDD,aAAa,CAAC,cAAc,EAAEkC,IAAI,CAAC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|