1 |
- {"ast":null,"code":"import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, serializeAsVector3, serializeAsQuaternion } from \"../Misc/decorators.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nimport { GetClass } from \"../Misc/typeStore.js\";\nconst convertRHSToLHS = Matrix.Compose(Vector3.One(), Quaternion.FromEulerAngles(0, Math.PI, 0), Vector3.Zero());\n/**\n * A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\n */\nexport class TransformNode extends Node {\n /**\n * Gets or sets the billboard mode. Default is 0.\n *\n * | Value | Type | Description |\n * | --- | --- | --- |\n * | 0 | BILLBOARDMODE_NONE | |\n * | 1 | BILLBOARDMODE_X | |\n * | 2 | BILLBOARDMODE_Y | |\n * | 4 | BILLBOARDMODE_Z | |\n * | 7 | BILLBOARDMODE_ALL | |\n *\n */\n get billboardMode() {\n return this._billboardMode;\n }\n set billboardMode(value) {\n if (this._billboardMode === value) {\n return;\n }\n this._billboardMode = value;\n this._cache.useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;\n this._computeUseBillboardPath();\n }\n /**\n * Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.\n * This could be useful for glTF objects where parent rotation helps converting from right handed to left handed\n */\n get preserveParentRotationForBillboard() {\n return this._preserveParentRotationForBillboard;\n }\n set preserveParentRotationForBillboard(value) {\n if (value === this._preserveParentRotationForBillboard) {\n return;\n }\n this._preserveParentRotationForBillboard = value;\n this._computeUseBillboardPath();\n }\n _computeUseBillboardPath() {\n this._cache.useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;\n }\n /**\n * Gets or sets the distance of the object to max, often used by skybox\n */\n get infiniteDistance() {\n return this._infiniteDistance;\n }\n set infiniteDistance(value) {\n if (this._infiniteDistance === value) {\n return;\n }\n this._infiniteDistance = value;\n }\n constructor(name, scene = null, isPure = true) {\n super(name, scene, false);\n this._forward = new Vector3(0, 0, 1);\n this._up = new Vector3(0, 1, 0);\n this._right = new Vector3(1, 0, 0);\n // Properties\n this._position = Vector3.Zero();\n this._rotation = Vector3.Zero();\n this._rotationQuaternion = null;\n this._scaling = Vector3.One();\n this._transformToBoneReferal = null;\n this._isAbsoluteSynced = false;\n this._billboardMode = TransformNode.BILLBOARDMODE_NONE;\n this._preserveParentRotationForBillboard = false;\n /**\n * Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube\n */\n this.scalingDeterminant = 1;\n this._infiniteDistance = false;\n /**\n * Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored.\n * By default the system will update normals to compensate\n */\n this.ignoreNonUniformScaling = false;\n /**\n * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both\n */\n this.reIntegrateRotationIntoRotationQuaternion = false;\n // Cache\n /** @internal */\n this._poseMatrix = null;\n /** @internal */\n this._localMatrix = Matrix.Zero();\n this._usePivotMatrix = false;\n this._absolutePosition = Vector3.Zero();\n this._absoluteScaling = Vector3.Zero();\n this._absoluteRotationQuaternion = Quaternion.Identity();\n this._pivotMatrix = Matrix.Identity();\n /** @internal */\n this._postMultiplyPivotMatrix = false;\n this._isWorldMatrixFrozen = false;\n /** @internal */\n this._indexInSceneTransformNodesArray = -1;\n /**\n * An event triggered after the world matrix is updated\n */\n this.onAfterWorldMatrixUpdateObservable = new Observable();\n this._nonUniformScaling = false;\n if (isPure) {\n this.getScene().addTransformNode(this);\n }\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"TransformNode\" string\n */\n getClassName() {\n return \"TransformNode\";\n }\n /**\n * Gets or set the node position (default is (0.0, 0.0, 0.0))\n */\n get position() {\n return this._position;\n }\n set position(newPosition) {\n this._position = newPosition;\n this._markAsDirtyInternal();\n }\n /**\n * return true if a pivot has been set\n * @returns true if a pivot matrix is used\n */\n isUsingPivotMatrix() {\n return this._usePivotMatrix;\n }\n /**\n * @returns true if pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect.\n */\n isUsingPostMultiplyPivotMatrix() {\n return this._postMultiplyPivotMatrix;\n }\n /**\n * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\n * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion\n */\n get rotation() {\n return this._rotation;\n }\n set rotation(newRotation) {\n this._rotation = newRotation;\n this._rotationQuaternion = null;\n this._markAsDirtyInternal();\n }\n /**\n * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (1.0, 1.0, 1.0)).\n */\n get scaling() {\n return this._scaling;\n }\n set scaling(newScaling) {\n this._scaling = newScaling;\n this._markAsDirtyInternal();\n }\n /**\n * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).\n * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)\n */\n get rotationQuaternion() {\n return this._rotationQuaternion;\n }\n set rotationQuaternion(quaternion) {\n this._rotationQuaternion = quaternion;\n //reset the rotation vector.\n if (quaternion) {\n this._rotation.setAll(0.0);\n }\n this._markAsDirtyInternal();\n }\n _markAsDirtyInternal() {\n if (this._isDirty) {\n return;\n }\n this._isDirty = true;\n if (this.customMarkAsDirty) {\n this.customMarkAsDirty();\n }\n }\n /**\n * The forward direction of that transform in world space.\n */\n get forward() {\n Vector3.TransformNormalFromFloatsToRef(0, 0, this.getScene().useRightHandedSystem ? -1.0 : 1.0, this.getWorldMatrix(), this._forward);\n return this._forward.normalize();\n }\n /**\n * The up direction of that transform in world space.\n */\n get up() {\n Vector3.TransformNormalFromFloatsToRef(0, 1, 0, this.getWorldMatrix(), this._up);\n return this._up.normalize();\n }\n /**\n * The right direction of that transform in world space.\n */\n get right() {\n Vector3.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem ? -1.0 : 1.0, 0, 0, this.getWorldMatrix(), this._right);\n return this._right.normalize();\n }\n /**\n * Copies the parameter passed Matrix into the mesh Pose matrix.\n * @param matrix the matrix to copy the pose from\n * @returns this TransformNode.\n */\n updatePoseMatrix(matrix) {\n if (!this._poseMatrix) {\n this._poseMatrix = matrix.clone();\n return this;\n }\n this._poseMatrix.copyFrom(matrix);\n return this;\n }\n /**\n * Returns the mesh Pose matrix.\n * @returns the pose matrix\n */\n getPoseMatrix() {\n if (!this._poseMatrix) {\n this._poseMatrix = Matrix.Identity();\n }\n return this._poseMatrix;\n }\n /** @internal */\n _isSynchronized() {\n const cache = this._cache;\n if (this._billboardMode !== cache.billboardMode || this._billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\n return false;\n }\n if (cache.pivotMatrixUpdated) {\n return false;\n }\n if (this._infiniteDistance) {\n return false;\n }\n if (this._position._isDirty) {\n return false;\n }\n if (this._scaling._isDirty) {\n return false;\n }\n if (this._rotationQuaternion && this._rotationQuaternion._isDirty || this._rotation._isDirty) {\n return false;\n }\n return true;\n }\n /** @internal */\n _initCache() {\n super._initCache();\n const cache = this._cache;\n cache.localMatrixUpdated = false;\n cache.billboardMode = -1;\n cache.infiniteDistance = false;\n cache.useBillboardPosition = false;\n cache.useBillboardPath = false;\n }\n /**\n * Returns the current mesh absolute position.\n * Returns a Vector3.\n */\n get absolutePosition() {\n return this.getAbsolutePosition();\n }\n /**\n * Returns the current mesh absolute scaling.\n * Returns a Vector3.\n */\n get absoluteScaling() {\n this._syncAbsoluteScalingAndRotation();\n return this._absoluteScaling;\n }\n /**\n * Returns the current mesh absolute rotation.\n * Returns a Quaternion.\n */\n get absoluteRotationQuaternion() {\n this._syncAbsoluteScalingAndRotation();\n return this._absoluteRotationQuaternion;\n }\n /**\n * Sets a new matrix to apply before all other transformation\n * @param matrix defines the transform matrix\n * @returns the current TransformNode\n */\n setPreTransformMatrix(matrix) {\n return this.setPivotMatrix(matrix, false);\n }\n /**\n * Sets a new pivot matrix to the current node\n * @param matrix defines the new pivot matrix to use\n * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect\n * @returns the current TransformNode\n */\n setPivotMatrix(matrix, postMultiplyPivotMatrix = true) {\n this._pivotMatrix.copyFrom(matrix);\n this._usePivotMatrix = !this._pivotMatrix.isIdentity();\n this._cache.pivotMatrixUpdated = true;\n this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;\n if (this._postMultiplyPivotMatrix) {\n if (!this._pivotMatrixInverse) {\n this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);\n } else {\n this._pivotMatrix.invertToRef(this._pivotMatrixInverse);\n }\n }\n return this;\n }\n /**\n * Returns the mesh pivot matrix.\n * Default : Identity.\n * @returns the matrix\n */\n getPivotMatrix() {\n return this._pivotMatrix;\n }\n /**\n * Instantiate (when possible) or clone that node with its hierarchy\n * @param newParent defines the new parent to use for the instance (or clone)\n * @param options defines options to configure how copy is done\n * @param options.doNotInstantiate defines if the model must be instantiated or just cloned\n * @param onNewNodeCreated defines an option callback to call when a clone or an instance is created\n * @returns an instance (or a clone) of the current node with its hierarchy\n */\n instantiateHierarchy(newParent = null, options, onNewNodeCreated) {\n const clone = this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\n if (clone) {\n if (onNewNodeCreated) {\n onNewNodeCreated(this, clone);\n }\n }\n for (const child of this.getChildTransformNodes(true)) {\n child.instantiateHierarchy(clone, options, onNewNodeCreated);\n }\n return clone;\n }\n /**\n * Prevents the World matrix to be computed any longer\n * @param newWorldMatrix defines an optional matrix to use as world matrix\n * @param decompose defines whether to decompose the given newWorldMatrix or directly assign\n * @returns the TransformNode.\n */\n freezeWorldMatrix(newWorldMatrix = null, decompose = false) {\n if (newWorldMatrix) {\n if (decompose) {\n this._rotation.setAll(0);\n this._rotationQuaternion = this._rotationQuaternion || Quaternion.Identity();\n newWorldMatrix.decompose(this._scaling, this._rotationQuaternion, this._position);\n this.computeWorldMatrix(true);\n } else {\n this._worldMatrix = newWorldMatrix;\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\n this._afterComputeWorldMatrix();\n }\n } else {\n this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily\n this.computeWorldMatrix(true);\n }\n this._isDirty = false;\n this._isWorldMatrixFrozen = true;\n return this;\n }\n /**\n * Allows back the World matrix computation.\n * @returns the TransformNode.\n */\n unfreezeWorldMatrix() {\n this._isWorldMatrixFrozen = false;\n this.computeWorldMatrix(true);\n return this;\n }\n /**\n * True if the World matrix has been frozen.\n */\n get isWorldMatrixFrozen() {\n return this._isWorldMatrixFrozen;\n }\n /**\n * Returns the mesh absolute position in the World.\n * @returns a Vector3.\n */\n getAbsolutePosition() {\n this.computeWorldMatrix();\n return this._absolutePosition;\n }\n /**\n * Sets the mesh absolute position in the World from a Vector3 or an Array(3).\n * @param absolutePosition the absolute position to set\n * @returns the TransformNode.\n */\n setAbsolutePosition(absolutePosition) {\n if (!absolutePosition) {\n return this;\n }\n let absolutePositionX;\n let absolutePositionY;\n let absolutePositionZ;\n if (absolutePosition.x === undefined) {\n if (arguments.length < 3) {\n return this;\n }\n absolutePositionX = arguments[0];\n absolutePositionY = arguments[1];\n absolutePositionZ = arguments[2];\n } else {\n absolutePositionX = absolutePosition.x;\n absolutePositionY = absolutePosition.y;\n absolutePositionZ = absolutePosition.z;\n }\n if (this.parent) {\n const invertParentWorldMatrix = TmpVectors.Matrix[0];\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\n Vector3.TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);\n } else {\n this.position.x = absolutePositionX;\n this.position.y = absolutePositionY;\n this.position.z = absolutePositionZ;\n }\n this._absolutePosition.copyFrom(absolutePosition);\n return this;\n }\n /**\n * Sets the mesh position in its local space.\n * @param vector3 the position to set in localspace\n * @returns the TransformNode.\n */\n setPositionWithLocalVector(vector3) {\n this.computeWorldMatrix();\n this.position = Vector3.TransformNormal(vector3, this._localMatrix);\n return this;\n }\n /**\n * Returns the mesh position in the local space from the current World matrix values.\n * @returns a new Vector3.\n */\n getPositionExpressedInLocalSpace() {\n this.computeWorldMatrix();\n const invLocalWorldMatrix = TmpVectors.Matrix[0];\n this._localMatrix.invertToRef(invLocalWorldMatrix);\n return Vector3.TransformNormal(this.position, invLocalWorldMatrix);\n }\n /**\n * Translates the mesh along the passed Vector3 in its local space.\n * @param vector3 the distance to translate in localspace\n * @returns the TransformNode.\n */\n locallyTranslate(vector3) {\n this.computeWorldMatrix(true);\n this.position = Vector3.TransformCoordinates(vector3, this._localMatrix);\n return this;\n }\n /**\n * Orients a mesh towards a target point. Mesh must be drawn facing user.\n * @param targetPoint the position (must be in same space as current mesh) to look at\n * @param yawCor optional yaw (y-axis) correction in radians\n * @param pitchCor optional pitch (x-axis) correction in radians\n * @param rollCor optional roll (z-axis) correction in radians\n * @param space the chosen space of the target\n * @returns the TransformNode.\n */\n lookAt(targetPoint, yawCor = 0, pitchCor = 0, rollCor = 0, space = 0 /* Space.LOCAL */) {\n const dv = TransformNode._LookAtVectorCache;\n const pos = space === 0 /* Space.LOCAL */ ? this.position : this.getAbsolutePosition();\n targetPoint.subtractToRef(pos, dv);\n this.setDirection(dv, yawCor, pitchCor, rollCor);\n // Correct for parent's rotation offset\n if (space === 1 /* Space.WORLD */ && this.parent) {\n if (this.rotationQuaternion) {\n // Get local rotation matrix of the looking object\n const rotationMatrix = TmpVectors.Matrix[0];\n this.rotationQuaternion.toRotationMatrix(rotationMatrix);\n // Offset rotation by parent's inverted rotation matrix to correct in world space\n const parentRotationMatrix = TmpVectors.Matrix[1];\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\n parentRotationMatrix.invert();\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\n this.rotationQuaternion.fromRotationMatrix(rotationMatrix);\n } else {\n // Get local rotation matrix of the looking object\n const quaternionRotation = TmpVectors.Quaternion[0];\n Quaternion.FromEulerVectorToRef(this.rotation, quaternionRotation);\n const rotationMatrix = TmpVectors.Matrix[0];\n quaternionRotation.toRotationMatrix(rotationMatrix);\n // Offset rotation by parent's inverted rotation matrix to correct in world space\n const parentRotationMatrix = TmpVectors.Matrix[1];\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\n parentRotationMatrix.invert();\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\n quaternionRotation.fromRotationMatrix(rotationMatrix);\n quaternionRotation.toEulerAnglesToRef(this.rotation);\n }\n }\n return this;\n }\n /**\n * Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\n * This Vector3 is expressed in the World space.\n * @param localAxis axis to rotate\n * @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\n */\n getDirection(localAxis) {\n const result = Vector3.Zero();\n this.getDirectionToRef(localAxis, result);\n return result;\n }\n /**\n * Sets the Vector3 \"result\" as the rotated Vector3 \"localAxis\" in the same rotation than the mesh.\n * localAxis is expressed in the mesh local space.\n * result is computed in the World space from the mesh World matrix.\n * @param localAxis axis to rotate\n * @param result the resulting transformnode\n * @returns this TransformNode.\n */\n getDirectionToRef(localAxis, result) {\n Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\n return this;\n }\n /**\n * Sets this transform node rotation to the given local axis.\n * @param localAxis the axis in local space\n * @param yawCor optional yaw (y-axis) correction in radians\n * @param pitchCor optional pitch (x-axis) correction in radians\n * @param rollCor optional roll (z-axis) correction in radians\n * @returns this TransformNode\n */\n setDirection(localAxis, yawCor = 0, pitchCor = 0, rollCor = 0) {\n const yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;\n const len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);\n const pitch = -Math.atan2(localAxis.y, len);\n if (this.rotationQuaternion) {\n Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);\n } else {\n this.rotation.x = pitch + pitchCor;\n this.rotation.y = yaw + yawCor;\n this.rotation.z = rollCor;\n }\n return this;\n }\n /**\n * Sets a new pivot point to the current node\n * @param point defines the new pivot point to use\n * @param space defines if the point is in world or local space (local by default)\n * @returns the current TransformNode\n */\n setPivotPoint(point, space = 0 /* Space.LOCAL */) {\n if (this.getScene().getRenderId() == 0) {\n this.computeWorldMatrix(true);\n }\n const wm = this.getWorldMatrix();\n if (space == 1 /* Space.WORLD */) {\n const tmat = TmpVectors.Matrix[0];\n wm.invertToRef(tmat);\n point = Vector3.TransformCoordinates(point, tmat);\n }\n return this.setPivotMatrix(Matrix.Translation(-point.x, -point.y, -point.z), true);\n }\n /**\n * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.\n * @returns the pivot point\n */\n getPivotPoint() {\n const point = Vector3.Zero();\n this.getPivotPointToRef(point);\n return point;\n }\n /**\n * Sets the passed Vector3 \"result\" with the coordinates of the mesh pivot point in the local space.\n * @param result the vector3 to store the result\n * @returns this TransformNode.\n */\n getPivotPointToRef(result) {\n result.x = -this._pivotMatrix.m[12];\n result.y = -this._pivotMatrix.m[13];\n result.z = -this._pivotMatrix.m[14];\n return this;\n }\n /**\n * Returns a new Vector3 set with the mesh pivot point World coordinates.\n * @returns a new Vector3 set with the mesh pivot point World coordinates.\n */\n getAbsolutePivotPoint() {\n const point = Vector3.Zero();\n this.getAbsolutePivotPointToRef(point);\n return point;\n }\n /**\n * Sets the Vector3 \"result\" coordinates with the mesh pivot point World coordinates.\n * @param result vector3 to store the result\n * @returns this TransformNode.\n */\n getAbsolutePivotPointToRef(result) {\n this.getPivotPointToRef(result);\n Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);\n return this;\n }\n /**\n * Flag the transform node as dirty (Forcing it to update everything)\n * @param property if set to \"rotation\" the objects rotationQuaternion will be set to null\n * @returns this node\n */\n markAsDirty(property) {\n if (this._isDirty) {\n return this;\n }\n // We need to explicitly update the children\n // as the scene.evaluateActiveMeshes will not poll the transform nodes\n if (this._children) {\n for (const child of this._children) {\n child.markAsDirty(property);\n }\n }\n return super.markAsDirty(property);\n }\n /**\n * Defines the passed node as the parent of the current node.\n * The node will remain exactly where it is and its position / rotation will be updated accordingly.\n * Note that if the mesh has a pivot matrix / point defined it will be applied after the parent was updated.\n * In that case the node will not remain in the same space as it is, as the pivot will be applied.\n * To avoid this, you can set updatePivot to true and the pivot will be updated to identity\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent\n * @param node the node ot set as the parent\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @param updatePivot if true, update the pivot matrix to keep the node in the same space as before\n * @returns this TransformNode.\n */\n setParent(node, preserveScalingSign = false, updatePivot = false) {\n if (!node && !this.parent) {\n return this;\n }\n const quatRotation = TmpVectors.Quaternion[0];\n const position = TmpVectors.Vector3[0];\n const scale = TmpVectors.Vector3[1];\n const invParentMatrix = TmpVectors.Matrix[1];\n Matrix.IdentityToRef(invParentMatrix);\n const composedMatrix = TmpVectors.Matrix[0];\n this.computeWorldMatrix(true);\n let currentRotation = this.rotationQuaternion;\n if (!currentRotation) {\n currentRotation = TransformNode._TmpRotation;\n Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, currentRotation);\n }\n // current global transformation without pivot\n Matrix.ComposeToRef(this.scaling, currentRotation, this.position, composedMatrix);\n if (this.parent) {\n composedMatrix.multiplyToRef(this.parent.computeWorldMatrix(true), composedMatrix);\n }\n // is a node was set, calculate the difference between this and the node\n if (node) {\n node.computeWorldMatrix(true).invertToRef(invParentMatrix);\n composedMatrix.multiplyToRef(invParentMatrix, composedMatrix);\n }\n composedMatrix.decompose(scale, quatRotation, position, preserveScalingSign ? this : undefined);\n if (this.rotationQuaternion) {\n this.rotationQuaternion.copyFrom(quatRotation);\n } else {\n quatRotation.toEulerAnglesToRef(this.rotation);\n }\n this.scaling.copyFrom(scale);\n this.position.copyFrom(position);\n this.parent = node;\n if (updatePivot) {\n this.setPivotMatrix(Matrix.Identity());\n }\n return this;\n }\n /**\n * Adds the passed mesh as a child to the current mesh\n * @param mesh defines the child mesh\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @returns the current mesh\n */\n addChild(mesh, preserveScalingSign = false) {\n mesh.setParent(this, preserveScalingSign);\n return this;\n }\n /**\n * Removes the passed mesh from the current mesh children list\n * @param mesh defines the child mesh\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @returns the current mesh\n */\n removeChild(mesh, preserveScalingSign = false) {\n mesh.setParent(null, preserveScalingSign);\n return this;\n }\n /**\n * True if the scaling property of this object is non uniform eg. (1,2,1)\n */\n get nonUniformScaling() {\n return this._nonUniformScaling;\n }\n /**\n * @internal\n */\n _updateNonUniformScalingState(value) {\n if (this._nonUniformScaling === value) {\n return false;\n }\n this._nonUniformScaling = value;\n return true;\n }\n /**\n * Attach the current TransformNode to another TransformNode associated with a bone\n * @param bone Bone affecting the TransformNode\n * @param affectedTransformNode TransformNode associated with the bone\n * @returns this object\n */\n attachToBone(bone, affectedTransformNode) {\n this._currentParentWhenAttachingToBone = this.parent;\n this._transformToBoneReferal = affectedTransformNode;\n this.parent = bone;\n bone.getSkeleton().prepare(true); // make sure bone.getFinalMatrix() is up to date\n if (bone.getFinalMatrix().determinant() < 0) {\n this.scalingDeterminant *= -1;\n }\n return this;\n }\n /**\n * Detach the transform node if its associated with a bone\n * @param resetToPreviousParent Indicates if the parent that was in effect when attachToBone was called should be set back or if we should set parent to null instead (defaults to the latter)\n * @returns this object\n */\n detachFromBone(resetToPreviousParent = false) {\n if (!this.parent) {\n if (resetToPreviousParent) {\n this.parent = this._currentParentWhenAttachingToBone;\n }\n return this;\n }\n if (this.parent.getWorldMatrix().determinant() < 0) {\n this.scalingDeterminant *= -1;\n }\n this._transformToBoneReferal = null;\n if (resetToPreviousParent) {\n this.parent = this._currentParentWhenAttachingToBone;\n } else {\n this.parent = null;\n }\n return this;\n }\n /**\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\n * The passed axis is also normalized.\n * @param axis the axis to rotate around\n * @param amount the amount to rotate in radians\n * @param space Space to rotate in (Default: local)\n * @returns the TransformNode.\n */\n rotate(axis, amount, space) {\n axis.normalize();\n if (!this.rotationQuaternion) {\n this.rotationQuaternion = this.rotation.toQuaternion();\n this.rotation.setAll(0);\n }\n let rotationQuaternion;\n if (!space || space === 0 /* Space.LOCAL */) {\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._RotationAxisCache);\n this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);\n } else {\n if (this.parent) {\n const parentWorldMatrix = this.parent.getWorldMatrix();\n const invertParentWorldMatrix = TmpVectors.Matrix[0];\n parentWorldMatrix.invertToRef(invertParentWorldMatrix);\n axis = Vector3.TransformNormal(axis, invertParentWorldMatrix);\n if (parentWorldMatrix.determinant() < 0) {\n amount *= -1;\n }\n }\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._RotationAxisCache);\n rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\n }\n return this;\n }\n /**\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\n * The passed axis is also normalized. .\n * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm\n * @param point the point to rotate around\n * @param axis the axis to rotate around\n * @param amount the amount to rotate in radians\n * @returns the TransformNode\n */\n rotateAround(point, axis, amount) {\n axis.normalize();\n if (!this.rotationQuaternion) {\n this.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\n this.rotation.setAll(0);\n }\n const tmpVector = TmpVectors.Vector3[0];\n const finalScale = TmpVectors.Vector3[1];\n const finalTranslation = TmpVectors.Vector3[2];\n const finalRotation = TmpVectors.Quaternion[0];\n const translationMatrix = TmpVectors.Matrix[0]; // T\n const translationMatrixInv = TmpVectors.Matrix[1]; // T'\n const rotationMatrix = TmpVectors.Matrix[2]; // R\n const finalMatrix = TmpVectors.Matrix[3]; // T' x R x T\n point.subtractToRef(this.position, tmpVector);\n Matrix.TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T\n Matrix.TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'\n Matrix.RotationAxisToRef(axis, amount, rotationMatrix); // R\n translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R\n finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T\n finalMatrix.decompose(finalScale, finalRotation, finalTranslation);\n this.position.addInPlace(finalTranslation);\n finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\n return this;\n }\n /**\n * Translates the mesh along the axis vector for the passed distance in the given space.\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\n * @param axis the axis to translate in\n * @param distance the distance to translate\n * @param space Space to rotate in (Default: local)\n * @returns the TransformNode.\n */\n translate(axis, distance, space) {\n const displacementVector = axis.scale(distance);\n if (!space || space === 0 /* Space.LOCAL */) {\n const tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);\n this.setPositionWithLocalVector(tempV3);\n } else {\n this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));\n }\n return this;\n }\n /**\n * Adds a rotation step to the mesh current rotation.\n * x, y, z are Euler angles expressed in radians.\n * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.\n * This means this rotation is made in the mesh local space only.\n * It's useful to set a custom rotation order different from the BJS standard one YXZ.\n * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.\n * ```javascript\n * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);\n * ```\n * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.\n * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.\n * @param x Rotation to add\n * @param y Rotation to add\n * @param z Rotation to add\n * @returns the TransformNode.\n */\n addRotation(x, y, z) {\n let rotationQuaternion;\n if (this.rotationQuaternion) {\n rotationQuaternion = this.rotationQuaternion;\n } else {\n rotationQuaternion = TmpVectors.Quaternion[1];\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);\n }\n const accumulation = TmpVectors.Quaternion[0];\n Quaternion.RotationYawPitchRollToRef(y, x, z, accumulation);\n rotationQuaternion.multiplyInPlace(accumulation);\n if (!this.rotationQuaternion) {\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\n }\n return this;\n }\n /**\n * @internal\n */\n _getEffectiveParent() {\n return this.parent;\n }\n /**\n * Returns whether the transform node world matrix computation needs the camera information to be computed.\n * This is the case when the node is a billboard or has an infinite distance for instance.\n * @returns true if the world matrix computation needs the camera information to be computed\n */\n isWorldMatrixCameraDependent() {\n return this._infiniteDistance && !this.parent || this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;\n }\n /**\n * Computes the world matrix of the node\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\n * @param camera defines the camera used if different from the scene active camera (This is used with modes like Billboard or infinite distance)\n * @returns the world matrix\n */\n computeWorldMatrix(force = false, camera = null) {\n if (this._isWorldMatrixFrozen && !this._isDirty) {\n return this._worldMatrix;\n }\n const currentRenderId = this.getScene().getRenderId();\n if (!this._isDirty && !force && (this._currentRenderId === currentRenderId || this.isSynchronized())) {\n this._currentRenderId = currentRenderId;\n return this._worldMatrix;\n }\n camera = camera || this.getScene().activeCamera;\n this._updateCache();\n const cache = this._cache;\n cache.pivotMatrixUpdated = false;\n cache.billboardMode = this.billboardMode;\n cache.infiniteDistance = this.infiniteDistance;\n cache.parent = this._parentNode;\n this._currentRenderId = currentRenderId;\n this._childUpdateId += 1;\n this._isDirty = false;\n this._position._isDirty = false;\n this._rotation._isDirty = false;\n this._scaling._isDirty = false;\n const parent = this._getEffectiveParent();\n // Scaling\n const scaling = TransformNode._TmpScaling;\n let translation = this._position;\n // Translation\n if (this._infiniteDistance) {\n if (!this.parent && camera) {\n const cameraWorldMatrix = camera.getWorldMatrix();\n const cameraGlobalPosition = new Vector3(cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);\n translation = TransformNode._TmpTranslation;\n translation.copyFromFloats(this._position.x + cameraGlobalPosition.x, this._position.y + cameraGlobalPosition.y, this._position.z + cameraGlobalPosition.z);\n }\n }\n // Scaling\n scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);\n // Rotation\n let rotation;\n if (this._rotationQuaternion) {\n this._rotationQuaternion._isDirty = false;\n rotation = this._rotationQuaternion;\n if (this.reIntegrateRotationIntoRotationQuaternion) {\n const len = this.rotation.lengthSquared();\n if (len) {\n this._rotationQuaternion.multiplyInPlace(Quaternion.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z));\n this._rotation.copyFromFloats(0, 0, 0);\n }\n }\n } else {\n rotation = TransformNode._TmpRotation;\n Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);\n }\n // Compose\n if (this._usePivotMatrix) {\n const scaleMatrix = TmpVectors.Matrix[1];\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, scaleMatrix);\n // Rotation\n const rotationMatrix = TmpVectors.Matrix[0];\n rotation.toRotationMatrix(rotationMatrix);\n // Composing transformations\n this._pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, this._localMatrix);\n // Post multiply inverse of pivotMatrix\n if (this._postMultiplyPivotMatrix) {\n this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix);\n }\n this._localMatrix.addTranslationFromFloats(translation.x, translation.y, translation.z);\n } else {\n Matrix.ComposeToRef(scaling, rotation, translation, this._localMatrix);\n }\n // Parent\n if (parent && parent.getWorldMatrix) {\n if (force) {\n parent.computeWorldMatrix(force);\n }\n if (cache.useBillboardPath) {\n if (this._transformToBoneReferal) {\n const bone = this.parent;\n bone.getSkeleton().prepare();\n bone.getFinalMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), TmpVectors.Matrix[7]);\n } else {\n TmpVectors.Matrix[7].copyFrom(parent.getWorldMatrix());\n }\n // Extract scaling and translation from parent\n const translation = TmpVectors.Vector3[5];\n const scale = TmpVectors.Vector3[6];\n const orientation = TmpVectors.Quaternion[0];\n TmpVectors.Matrix[7].decompose(scale, orientation, translation);\n Matrix.ScalingToRef(scale.x, scale.y, scale.z, TmpVectors.Matrix[7]);\n TmpVectors.Matrix[7].setTranslation(translation);\n if (TransformNode.BillboardUseParentOrientation) {\n // set localMatrix translation to be transformed against parent's orientation.\n this._position.applyRotationQuaternionToRef(orientation, translation);\n this._localMatrix.setTranslation(translation);\n }\n this._localMatrix.multiplyToRef(TmpVectors.Matrix[7], this._worldMatrix);\n } else {\n if (this._transformToBoneReferal) {\n const bone = this.parent;\n bone.getSkeleton().prepare();\n this._localMatrix.multiplyToRef(bone.getFinalMatrix(), TmpVectors.Matrix[6]);\n TmpVectors.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);\n } else {\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), this._worldMatrix);\n }\n }\n this._markSyncedWithParent();\n } else {\n this._worldMatrix.copyFrom(this._localMatrix);\n }\n // Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)\n if (cache.useBillboardPath && camera && this.billboardMode && !cache.useBillboardPosition) {\n const storedTranslation = TmpVectors.Vector3[0];\n this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation\n // Cancel camera rotation\n TmpVectors.Matrix[1].copyFrom(camera.getViewMatrix());\n if (this._scene.useRightHandedSystem) {\n TmpVectors.Matrix[1].multiplyToRef(convertRHSToLHS, TmpVectors.Matrix[1]);\n }\n TmpVectors.Matrix[1].setTranslationFromFloats(0, 0, 0);\n TmpVectors.Matrix[1].invertToRef(TmpVectors.Matrix[0]);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\n TmpVectors.Matrix[0].decompose(undefined, TmpVectors.Quaternion[0], undefined);\n const eulerAngles = TmpVectors.Vector3[1];\n TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\n eulerAngles.x = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\n eulerAngles.y = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\n eulerAngles.z = 0;\n }\n Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);\n }\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\n this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);\n // Restore translation\n this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);\n }\n // Billboarding based on camera position\n else if (cache.useBillboardPath && camera && cache.useBillboardPosition) {\n const storedTranslation = TmpVectors.Vector3[0];\n // Save translation\n this._worldMatrix.getTranslationToRef(storedTranslation);\n // Compute camera position in local space\n const cameraPosition = camera.globalPosition;\n this._worldMatrix.invertToRef(TmpVectors.Matrix[1]);\n const camInObjSpace = TmpVectors.Vector3[1];\n Vector3.TransformCoordinatesToRef(cameraPosition, TmpVectors.Matrix[1], camInObjSpace);\n camInObjSpace.normalize();\n // Find the lookAt info in local space\n const yaw = -Math.atan2(camInObjSpace.z, camInObjSpace.x) + Math.PI / 2;\n const len = Math.sqrt(camInObjSpace.x * camInObjSpace.x + camInObjSpace.z * camInObjSpace.z);\n const pitch = -Math.atan2(camInObjSpace.y, len);\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, 0, TmpVectors.Quaternion[0]);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\n const eulerAngles = TmpVectors.Vector3[1];\n TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\n eulerAngles.x = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\n eulerAngles.y = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\n eulerAngles.z = 0;\n }\n Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);\n } else {\n Matrix.FromQuaternionToRef(TmpVectors.Quaternion[0], TmpVectors.Matrix[0]);\n }\n // Cancel translation\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\n // Rotate according to lookat (diff from local to lookat)\n this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);\n // Restore translation\n this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);\n }\n // Normal matrix\n if (!this.ignoreNonUniformScaling) {\n if (this._scaling.isNonUniformWithinEpsilon(0.000001)) {\n this._updateNonUniformScalingState(true);\n } else if (parent && parent._nonUniformScaling) {\n this._updateNonUniformScalingState(parent._nonUniformScaling);\n } else {\n this._updateNonUniformScalingState(false);\n }\n } else {\n this._updateNonUniformScalingState(false);\n }\n this._afterComputeWorldMatrix();\n // Absolute position\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\n this._isAbsoluteSynced = false;\n // Callbacks\n this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);\n if (!this._poseMatrix) {\n this._poseMatrix = Matrix.Invert(this._worldMatrix);\n }\n // Cache the determinant\n this._worldMatrixDeterminantIsDirty = true;\n return this._worldMatrix;\n }\n /**\n * Resets this nodeTransform's local matrix to Matrix.Identity().\n * @param independentOfChildren indicates if all child nodeTransform's world-space transform should be preserved.\n */\n resetLocalMatrix(independentOfChildren = true) {\n this.computeWorldMatrix();\n if (independentOfChildren) {\n const children = this.getChildren();\n for (let i = 0; i < children.length; ++i) {\n const child = children[i];\n if (child) {\n child.computeWorldMatrix();\n const bakedMatrix = TmpVectors.Matrix[0];\n child._localMatrix.multiplyToRef(this._localMatrix, bakedMatrix);\n const tmpRotationQuaternion = TmpVectors.Quaternion[0];\n bakedMatrix.decompose(child.scaling, tmpRotationQuaternion, child.position);\n if (child.rotationQuaternion) {\n child.rotationQuaternion.copyFrom(tmpRotationQuaternion);\n } else {\n tmpRotationQuaternion.toEulerAnglesToRef(child.rotation);\n }\n }\n }\n }\n this.scaling.copyFromFloats(1, 1, 1);\n this.position.copyFromFloats(0, 0, 0);\n this.rotation.copyFromFloats(0, 0, 0);\n //only if quaternion is already set\n if (this.rotationQuaternion) {\n this.rotationQuaternion = Quaternion.Identity();\n }\n this._worldMatrix = Matrix.Identity();\n }\n _afterComputeWorldMatrix() {}\n /**\n * If you'd like to be called back after the mesh position, rotation or scaling has been updated.\n * @param func callback function to add\n *\n * @returns the TransformNode.\n */\n registerAfterWorldMatrixUpdate(func) {\n this.onAfterWorldMatrixUpdateObservable.add(func);\n return this;\n }\n /**\n * Removes a registered callback function.\n * @param func callback function to remove\n * @returns the TransformNode.\n */\n unregisterAfterWorldMatrixUpdate(func) {\n this.onAfterWorldMatrixUpdateObservable.removeCallback(func);\n return this;\n }\n /**\n * Gets the position of the current mesh in camera space\n * @param camera defines the camera to use\n * @returns a position\n */\n getPositionInCameraSpace(camera = null) {\n if (!camera) {\n camera = this.getScene().activeCamera;\n }\n return Vector3.TransformCoordinates(this.getAbsolutePosition(), camera.getViewMatrix());\n }\n /**\n * Returns the distance from the mesh to the active camera\n * @param camera defines the camera to use\n * @returns the distance\n */\n getDistanceToCamera(camera = null) {\n if (!camera) {\n camera = this.getScene().activeCamera;\n }\n return this.getAbsolutePosition().subtract(camera.globalPosition).length();\n }\n /**\n * Clone the current transform node\n * @param name Name of the new clone\n * @param newParent New parent for the clone\n * @param doNotCloneChildren Do not clone children hierarchy\n * @returns the new transform node\n */\n clone(name, newParent, doNotCloneChildren) {\n const result = SerializationHelper.Clone(() => new TransformNode(name, this.getScene()), this);\n result.name = name;\n result.id = name;\n if (newParent) {\n result.parent = newParent;\n }\n if (!doNotCloneChildren) {\n // Children\n const directDescendants = this.getDescendants(true);\n for (let index = 0; index < directDescendants.length; index++) {\n const child = directDescendants[index];\n if (child.clone) {\n child.clone(name + \".\" + child.name, result);\n }\n }\n }\n return result;\n }\n /**\n * Serializes the objects information.\n * @param currentSerializationObject defines the object to serialize in\n * @returns the serialized object\n */\n serialize(currentSerializationObject) {\n const serializationObject = SerializationHelper.Serialize(this, currentSerializationObject);\n serializationObject.type = this.getClassName();\n serializationObject.uniqueId = this.uniqueId;\n // Parent\n if (this.parent) {\n this.parent._serializeAsParent(serializationObject);\n }\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\n serializationObject.isEnabled = this.isEnabled();\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n serializationObject.ranges = this.serializeAnimationRanges();\n return serializationObject;\n }\n // Statics\n /**\n * Returns a new TransformNode object parsed from the source provided.\n * @param parsedTransformNode is the source.\n * @param scene the scene the object belongs to\n * @param rootUrl is a string, it's the root URL to prefix the `delayLoadingFile` property with\n * @returns a new TransformNode object parsed from the source provided.\n */\n static Parse(parsedTransformNode, scene, rootUrl) {\n const transformNode = SerializationHelper.Parse(() => new TransformNode(parsedTransformNode.name, scene), parsedTransformNode, scene, rootUrl);\n if (parsedTransformNode.localMatrix) {\n transformNode.setPreTransformMatrix(Matrix.FromArray(parsedTransformNode.localMatrix));\n } else if (parsedTransformNode.pivotMatrix) {\n transformNode.setPivotMatrix(Matrix.FromArray(parsedTransformNode.pivotMatrix));\n }\n transformNode.setEnabled(parsedTransformNode.isEnabled);\n transformNode._waitingParsedUniqueId = parsedTransformNode.uniqueId;\n // Parent\n if (parsedTransformNode.parentId !== undefined) {\n transformNode._waitingParentId = parsedTransformNode.parentId;\n }\n if (parsedTransformNode.parentInstanceIndex !== undefined) {\n transformNode._waitingParentInstanceIndex = parsedTransformNode.parentInstanceIndex;\n }\n // Animations\n if (parsedTransformNode.animations) {\n for (let animationIndex = 0; animationIndex < parsedTransformNode.animations.length; animationIndex++) {\n const parsedAnimation = parsedTransformNode.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n transformNode.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(transformNode, parsedTransformNode, scene);\n }\n if (parsedTransformNode.autoAnimate) {\n scene.beginAnimation(transformNode, parsedTransformNode.autoAnimateFrom, parsedTransformNode.autoAnimateTo, parsedTransformNode.autoAnimateLoop, parsedTransformNode.autoAnimateSpeed || 1.0);\n }\n return transformNode;\n }\n /**\n * Get all child-transformNodes of this node\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\n * @returns an array of TransformNode\n */\n getChildTransformNodes(directDescendantsOnly, predicate) {\n const results = [];\n this._getDescendants(results, directDescendantsOnly, node => {\n return (!predicate || predicate(node)) && node instanceof TransformNode;\n });\n return results;\n }\n /**\n * Releases resources associated with this transform node.\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 // Animations\n this.getScene().stopAnimation(this);\n // Remove from scene\n this.getScene().removeTransformNode(this);\n if (this._parentContainer) {\n const index = this._parentContainer.transformNodes.indexOf(this);\n if (index > -1) {\n this._parentContainer.transformNodes.splice(index, 1);\n }\n this._parentContainer = null;\n }\n this.onAfterWorldMatrixUpdateObservable.clear();\n if (doNotRecurse) {\n const transformNodes = this.getChildTransformNodes(true);\n for (const transformNode of transformNodes) {\n transformNode.parent = null;\n transformNode.computeWorldMatrix(true);\n }\n }\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /**\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\n * @returns the current mesh\n */\n normalizeToUnitCube(includeDescendants = true, ignoreRotation = false, predicate) {\n let storedRotation = null;\n let storedRotationQuaternion = null;\n if (ignoreRotation) {\n if (this.rotationQuaternion) {\n storedRotationQuaternion = this.rotationQuaternion.clone();\n this.rotationQuaternion.copyFromFloats(0, 0, 0, 1);\n } else if (this.rotation) {\n storedRotation = this.rotation.clone();\n this.rotation.copyFromFloats(0, 0, 0);\n }\n }\n const boundingVectors = this.getHierarchyBoundingVectors(includeDescendants, predicate);\n const sizeVec = boundingVectors.max.subtract(boundingVectors.min);\n const maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);\n if (maxDimension === 0) {\n return this;\n }\n const scale = 1 / maxDimension;\n this.scaling.scaleInPlace(scale);\n if (ignoreRotation) {\n if (this.rotationQuaternion && storedRotationQuaternion) {\n this.rotationQuaternion.copyFrom(storedRotationQuaternion);\n } else if (this.rotation && storedRotation) {\n this.rotation.copyFrom(storedRotation);\n }\n }\n return this;\n }\n _syncAbsoluteScalingAndRotation() {\n if (!this._isAbsoluteSynced) {\n this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion);\n this._isAbsoluteSynced = true;\n }\n }\n}\n// Statics\n/**\n * Object will not rotate to face the camera\n */\nTransformNode.BILLBOARDMODE_NONE = 0;\n/**\n * Object will rotate to face the camera but only on the x axis\n */\nTransformNode.BILLBOARDMODE_X = 1;\n/**\n * Object will rotate to face the camera but only on the y axis\n */\nTransformNode.BILLBOARDMODE_Y = 2;\n/**\n * Object will rotate to face the camera but only on the z axis\n */\nTransformNode.BILLBOARDMODE_Z = 4;\n/**\n * Object will rotate to face the camera\n */\nTransformNode.BILLBOARDMODE_ALL = 7;\n/**\n * Object will rotate to face the camera's position instead of orientation\n */\nTransformNode.BILLBOARDMODE_USE_POSITION = 128;\n/**\n * Child transform with Billboard flags should or should not apply parent rotation (default if off)\n */\nTransformNode.BillboardUseParentOrientation = false;\nTransformNode._TmpRotation = Quaternion.Zero();\nTransformNode._TmpScaling = Vector3.Zero();\nTransformNode._TmpTranslation = Vector3.Zero();\nTransformNode._LookAtVectorCache = new Vector3(0, 0, 0);\nTransformNode._RotationAxisCache = new Quaternion();\n__decorate([serializeAsVector3(\"position\")], TransformNode.prototype, \"_position\", void 0);\n__decorate([serializeAsVector3(\"rotation\")], TransformNode.prototype, \"_rotation\", void 0);\n__decorate([serializeAsQuaternion(\"rotationQuaternion\")], TransformNode.prototype, \"_rotationQuaternion\", void 0);\n__decorate([serializeAsVector3(\"scaling\")], TransformNode.prototype, \"_scaling\", void 0);\n__decorate([serialize(\"billboardMode\")], TransformNode.prototype, \"_billboardMode\", void 0);\n__decorate([serialize()], TransformNode.prototype, \"scalingDeterminant\", void 0);\n__decorate([serialize(\"infiniteDistance\")], TransformNode.prototype, \"_infiniteDistance\", void 0);\n__decorate([serialize()], TransformNode.prototype, \"ignoreNonUniformScaling\", void 0);\n__decorate([serialize()], TransformNode.prototype, \"reIntegrateRotationIntoRotationQuaternion\", void 0);","map":{"version":3,"names":["__decorate","serialize","serializeAsVector3","serializeAsQuaternion","SerializationHelper","Observable","Quaternion","Matrix","Vector3","TmpVectors","Node","GetClass","convertRHSToLHS","Compose","One","FromEulerAngles","Math","PI","Zero","TransformNode","billboardMode","_billboardMode","value","_cache","useBillboardPosition","BILLBOARDMODE_USE_POSITION","_computeUseBillboardPath","preserveParentRotationForBillboard","_preserveParentRotationForBillboard","useBillboardPath","BILLBOARDMODE_NONE","infiniteDistance","_infiniteDistance","constructor","name","scene","isPure","_forward","_up","_right","_position","_rotation","_rotationQuaternion","_scaling","_transformToBoneReferal","_isAbsoluteSynced","scalingDeterminant","ignoreNonUniformScaling","reIntegrateRotationIntoRotationQuaternion","_poseMatrix","_localMatrix","_usePivotMatrix","_absolutePosition","_absoluteScaling","_absoluteRotationQuaternion","Identity","_pivotMatrix","_postMultiplyPivotMatrix","_isWorldMatrixFrozen","_indexInSceneTransformNodesArray","onAfterWorldMatrixUpdateObservable","_nonUniformScaling","getScene","addTransformNode","getClassName","position","newPosition","_markAsDirtyInternal","isUsingPivotMatrix","isUsingPostMultiplyPivotMatrix","rotation","newRotation","scaling","newScaling","rotationQuaternion","quaternion","setAll","_isDirty","customMarkAsDirty","forward","TransformNormalFromFloatsToRef","useRightHandedSystem","getWorldMatrix","normalize","up","right","updatePoseMatrix","matrix","clone","copyFrom","getPoseMatrix","_isSynchronized","cache","pivotMatrixUpdated","_initCache","localMatrixUpdated","absolutePosition","getAbsolutePosition","absoluteScaling","_syncAbsoluteScalingAndRotation","absoluteRotationQuaternion","setPreTransformMatrix","setPivotMatrix","postMultiplyPivotMatrix","isIdentity","_pivotMatrixInverse","Invert","invertToRef","getPivotMatrix","instantiateHierarchy","newParent","options","onNewNodeCreated","id","parent","child","getChildTransformNodes","freezeWorldMatrix","newWorldMatrix","decompose","computeWorldMatrix","_worldMatrix","copyFromFloats","m","_afterComputeWorldMatrix","unfreezeWorldMatrix","isWorldMatrixFrozen","setAbsolutePosition","absolutePositionX","absolutePositionY","absolutePositionZ","x","undefined","arguments","length","y","z","invertParentWorldMatrix","TransformCoordinatesFromFloatsToRef","setPositionWithLocalVector","vector3","TransformNormal","getPositionExpressedInLocalSpace","invLocalWorldMatrix","locallyTranslate","TransformCoordinates","lookAt","targetPoint","yawCor","pitchCor","rollCor","space","dv","_LookAtVectorCache","pos","subtractToRef","setDirection","rotationMatrix","toRotationMatrix","parentRotationMatrix","getRotationMatrixToRef","invert","multiplyToRef","fromRotationMatrix","quaternionRotation","FromEulerVectorToRef","toEulerAnglesToRef","getDirection","localAxis","result","getDirectionToRef","TransformNormalToRef","yaw","atan2","len","sqrt","pitch","RotationYawPitchRollToRef","setPivotPoint","point","getRenderId","wm","tmat","Translation","getPivotPoint","getPivotPointToRef","getAbsolutePivotPoint","getAbsolutePivotPointToRef","TransformCoordinatesToRef","markAsDirty","property","_children","setParent","node","preserveScalingSign","updatePivot","quatRotation","scale","invParentMatrix","IdentityToRef","composedMatrix","currentRotation","_TmpRotation","ComposeToRef","addChild","mesh","removeChild","nonUniformScaling","_updateNonUniformScalingState","attachToBone","bone","affectedTransformNode","_currentParentWhenAttachingToBone","getSkeleton","prepare","getFinalMatrix","determinant","detachFromBone","resetToPreviousParent","rotate","axis","amount","toQuaternion","RotationAxisToRef","_RotationAxisCache","parentWorldMatrix","rotateAround","RotationYawPitchRoll","tmpVector","finalScale","finalTranslation","finalRotation","translationMatrix","translationMatrixInv","finalMatrix","TranslationToRef","addInPlace","translate","distance","displacementVector","tempV3","add","addRotation","accumulation","multiplyInPlace","_getEffectiveParent","isWorldMatrixCameraDependent","force","camera","currentRenderId","_currentRenderId","isSynchronized","activeCamera","_updateCache","_parentNode","_childUpdateId","_TmpScaling","translation","cameraWorldMatrix","cameraGlobalPosition","_TmpTranslation","lengthSquared","scaleMatrix","ScalingToRef","addTranslationFromFloats","orientation","setTranslation","BillboardUseParentOrientation","applyRotationQuaternionToRef","_markSyncedWithParent","storedTranslation","getTranslationToRef","getViewMatrix","_scene","setTranslationFromFloats","BILLBOARDMODE_ALL","eulerAngles","BILLBOARDMODE_X","BILLBOARDMODE_Y","BILLBOARDMODE_Z","cameraPosition","globalPosition","camInObjSpace","FromQuaternionToRef","isNonUniformWithinEpsilon","notifyObservers","_worldMatrixDeterminantIsDirty","resetLocalMatrix","independentOfChildren","children","getChildren","i","bakedMatrix","tmpRotationQuaternion","registerAfterWorldMatrixUpdate","func","unregisterAfterWorldMatrixUpdate","removeCallback","getPositionInCameraSpace","getDistanceToCamera","subtract","doNotCloneChildren","Clone","directDescendants","getDescendants","index","currentSerializationObject","serializationObject","Serialize","type","uniqueId","_serializeAsParent","localMatrix","asArray","isEnabled","AppendSerializedAnimations","ranges","serializeAnimationRanges","Parse","parsedTransformNode","rootUrl","transformNode","FromArray","pivotMatrix","setEnabled","_waitingParsedUniqueId","parentId","_waitingParentId","parentInstanceIndex","_waitingParentInstanceIndex","animations","animationIndex","parsedAnimation","internalClass","push","ParseAnimationRanges","autoAnimate","beginAnimation","autoAnimateFrom","autoAnimateTo","autoAnimateLoop","autoAnimateSpeed","directDescendantsOnly","predicate","results","_getDescendants","dispose","doNotRecurse","disposeMaterialAndTextures","stopAnimation","removeTransformNode","_parentContainer","transformNodes","indexOf","splice","clear","normalizeToUnitCube","includeDescendants","ignoreRotation","storedRotation","storedRotationQuaternion","boundingVectors","getHierarchyBoundingVectors","sizeVec","max","min","maxDimension","scaleInPlace","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/transformNode.js"],"sourcesContent":["import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, serializeAsVector3, serializeAsQuaternion } from \"../Misc/decorators.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nimport { GetClass } from \"../Misc/typeStore.js\";\nconst convertRHSToLHS = Matrix.Compose(Vector3.One(), Quaternion.FromEulerAngles(0, Math.PI, 0), Vector3.Zero());\n/**\n * A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\n */\nexport class TransformNode extends Node {\n /**\n * Gets or sets the billboard mode. Default is 0.\n *\n * | Value | Type | Description |\n * | --- | --- | --- |\n * | 0 | BILLBOARDMODE_NONE | |\n * | 1 | BILLBOARDMODE_X | |\n * | 2 | BILLBOARDMODE_Y | |\n * | 4 | BILLBOARDMODE_Z | |\n * | 7 | BILLBOARDMODE_ALL | |\n *\n */\n get billboardMode() {\n return this._billboardMode;\n }\n set billboardMode(value) {\n if (this._billboardMode === value) {\n return;\n }\n this._billboardMode = value;\n this._cache.useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;\n this._computeUseBillboardPath();\n }\n /**\n * Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.\n * This could be useful for glTF objects where parent rotation helps converting from right handed to left handed\n */\n get preserveParentRotationForBillboard() {\n return this._preserveParentRotationForBillboard;\n }\n set preserveParentRotationForBillboard(value) {\n if (value === this._preserveParentRotationForBillboard) {\n return;\n }\n this._preserveParentRotationForBillboard = value;\n this._computeUseBillboardPath();\n }\n _computeUseBillboardPath() {\n this._cache.useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;\n }\n /**\n * Gets or sets the distance of the object to max, often used by skybox\n */\n get infiniteDistance() {\n return this._infiniteDistance;\n }\n set infiniteDistance(value) {\n if (this._infiniteDistance === value) {\n return;\n }\n this._infiniteDistance = value;\n }\n constructor(name, scene = null, isPure = true) {\n super(name, scene, false);\n this._forward = new Vector3(0, 0, 1);\n this._up = new Vector3(0, 1, 0);\n this._right = new Vector3(1, 0, 0);\n // Properties\n this._position = Vector3.Zero();\n this._rotation = Vector3.Zero();\n this._rotationQuaternion = null;\n this._scaling = Vector3.One();\n this._transformToBoneReferal = null;\n this._isAbsoluteSynced = false;\n this._billboardMode = TransformNode.BILLBOARDMODE_NONE;\n this._preserveParentRotationForBillboard = false;\n /**\n * Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube\n */\n this.scalingDeterminant = 1;\n this._infiniteDistance = false;\n /**\n * Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored.\n * By default the system will update normals to compensate\n */\n this.ignoreNonUniformScaling = false;\n /**\n * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both\n */\n this.reIntegrateRotationIntoRotationQuaternion = false;\n // Cache\n /** @internal */\n this._poseMatrix = null;\n /** @internal */\n this._localMatrix = Matrix.Zero();\n this._usePivotMatrix = false;\n this._absolutePosition = Vector3.Zero();\n this._absoluteScaling = Vector3.Zero();\n this._absoluteRotationQuaternion = Quaternion.Identity();\n this._pivotMatrix = Matrix.Identity();\n /** @internal */\n this._postMultiplyPivotMatrix = false;\n this._isWorldMatrixFrozen = false;\n /** @internal */\n this._indexInSceneTransformNodesArray = -1;\n /**\n * An event triggered after the world matrix is updated\n */\n this.onAfterWorldMatrixUpdateObservable = new Observable();\n this._nonUniformScaling = false;\n if (isPure) {\n this.getScene().addTransformNode(this);\n }\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"TransformNode\" string\n */\n getClassName() {\n return \"TransformNode\";\n }\n /**\n * Gets or set the node position (default is (0.0, 0.0, 0.0))\n */\n get position() {\n return this._position;\n }\n set position(newPosition) {\n this._position = newPosition;\n this._markAsDirtyInternal();\n }\n /**\n * return true if a pivot has been set\n * @returns true if a pivot matrix is used\n */\n isUsingPivotMatrix() {\n return this._usePivotMatrix;\n }\n /**\n * @returns true if pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect.\n */\n isUsingPostMultiplyPivotMatrix() {\n return this._postMultiplyPivotMatrix;\n }\n /**\n * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\n * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion\n */\n get rotation() {\n return this._rotation;\n }\n set rotation(newRotation) {\n this._rotation = newRotation;\n this._rotationQuaternion = null;\n this._markAsDirtyInternal();\n }\n /**\n * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (1.0, 1.0, 1.0)).\n */\n get scaling() {\n return this._scaling;\n }\n set scaling(newScaling) {\n this._scaling = newScaling;\n this._markAsDirtyInternal();\n }\n /**\n * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).\n * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)\n */\n get rotationQuaternion() {\n return this._rotationQuaternion;\n }\n set rotationQuaternion(quaternion) {\n this._rotationQuaternion = quaternion;\n //reset the rotation vector.\n if (quaternion) {\n this._rotation.setAll(0.0);\n }\n this._markAsDirtyInternal();\n }\n _markAsDirtyInternal() {\n if (this._isDirty) {\n return;\n }\n this._isDirty = true;\n if (this.customMarkAsDirty) {\n this.customMarkAsDirty();\n }\n }\n /**\n * The forward direction of that transform in world space.\n */\n get forward() {\n Vector3.TransformNormalFromFloatsToRef(0, 0, this.getScene().useRightHandedSystem ? -1.0 : 1.0, this.getWorldMatrix(), this._forward);\n return this._forward.normalize();\n }\n /**\n * The up direction of that transform in world space.\n */\n get up() {\n Vector3.TransformNormalFromFloatsToRef(0, 1, 0, this.getWorldMatrix(), this._up);\n return this._up.normalize();\n }\n /**\n * The right direction of that transform in world space.\n */\n get right() {\n Vector3.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem ? -1.0 : 1.0, 0, 0, this.getWorldMatrix(), this._right);\n return this._right.normalize();\n }\n /**\n * Copies the parameter passed Matrix into the mesh Pose matrix.\n * @param matrix the matrix to copy the pose from\n * @returns this TransformNode.\n */\n updatePoseMatrix(matrix) {\n if (!this._poseMatrix) {\n this._poseMatrix = matrix.clone();\n return this;\n }\n this._poseMatrix.copyFrom(matrix);\n return this;\n }\n /**\n * Returns the mesh Pose matrix.\n * @returns the pose matrix\n */\n getPoseMatrix() {\n if (!this._poseMatrix) {\n this._poseMatrix = Matrix.Identity();\n }\n return this._poseMatrix;\n }\n /** @internal */\n _isSynchronized() {\n const cache = this._cache;\n if (this._billboardMode !== cache.billboardMode || this._billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\n return false;\n }\n if (cache.pivotMatrixUpdated) {\n return false;\n }\n if (this._infiniteDistance) {\n return false;\n }\n if (this._position._isDirty) {\n return false;\n }\n if (this._scaling._isDirty) {\n return false;\n }\n if ((this._rotationQuaternion && this._rotationQuaternion._isDirty) || this._rotation._isDirty) {\n return false;\n }\n return true;\n }\n /** @internal */\n _initCache() {\n super._initCache();\n const cache = this._cache;\n cache.localMatrixUpdated = false;\n cache.billboardMode = -1;\n cache.infiniteDistance = false;\n cache.useBillboardPosition = false;\n cache.useBillboardPath = false;\n }\n /**\n * Returns the current mesh absolute position.\n * Returns a Vector3.\n */\n get absolutePosition() {\n return this.getAbsolutePosition();\n }\n /**\n * Returns the current mesh absolute scaling.\n * Returns a Vector3.\n */\n get absoluteScaling() {\n this._syncAbsoluteScalingAndRotation();\n return this._absoluteScaling;\n }\n /**\n * Returns the current mesh absolute rotation.\n * Returns a Quaternion.\n */\n get absoluteRotationQuaternion() {\n this._syncAbsoluteScalingAndRotation();\n return this._absoluteRotationQuaternion;\n }\n /**\n * Sets a new matrix to apply before all other transformation\n * @param matrix defines the transform matrix\n * @returns the current TransformNode\n */\n setPreTransformMatrix(matrix) {\n return this.setPivotMatrix(matrix, false);\n }\n /**\n * Sets a new pivot matrix to the current node\n * @param matrix defines the new pivot matrix to use\n * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect\n * @returns the current TransformNode\n */\n setPivotMatrix(matrix, postMultiplyPivotMatrix = true) {\n this._pivotMatrix.copyFrom(matrix);\n this._usePivotMatrix = !this._pivotMatrix.isIdentity();\n this._cache.pivotMatrixUpdated = true;\n this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;\n if (this._postMultiplyPivotMatrix) {\n if (!this._pivotMatrixInverse) {\n this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);\n }\n else {\n this._pivotMatrix.invertToRef(this._pivotMatrixInverse);\n }\n }\n return this;\n }\n /**\n * Returns the mesh pivot matrix.\n * Default : Identity.\n * @returns the matrix\n */\n getPivotMatrix() {\n return this._pivotMatrix;\n }\n /**\n * Instantiate (when possible) or clone that node with its hierarchy\n * @param newParent defines the new parent to use for the instance (or clone)\n * @param options defines options to configure how copy is done\n * @param options.doNotInstantiate defines if the model must be instantiated or just cloned\n * @param onNewNodeCreated defines an option callback to call when a clone or an instance is created\n * @returns an instance (or a clone) of the current node with its hierarchy\n */\n instantiateHierarchy(newParent = null, options, onNewNodeCreated) {\n const clone = this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\n if (clone) {\n if (onNewNodeCreated) {\n onNewNodeCreated(this, clone);\n }\n }\n for (const child of this.getChildTransformNodes(true)) {\n child.instantiateHierarchy(clone, options, onNewNodeCreated);\n }\n return clone;\n }\n /**\n * Prevents the World matrix to be computed any longer\n * @param newWorldMatrix defines an optional matrix to use as world matrix\n * @param decompose defines whether to decompose the given newWorldMatrix or directly assign\n * @returns the TransformNode.\n */\n freezeWorldMatrix(newWorldMatrix = null, decompose = false) {\n if (newWorldMatrix) {\n if (decompose) {\n this._rotation.setAll(0);\n this._rotationQuaternion = this._rotationQuaternion || Quaternion.Identity();\n newWorldMatrix.decompose(this._scaling, this._rotationQuaternion, this._position);\n this.computeWorldMatrix(true);\n }\n else {\n this._worldMatrix = newWorldMatrix;\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\n this._afterComputeWorldMatrix();\n }\n }\n else {\n this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily\n this.computeWorldMatrix(true);\n }\n this._isDirty = false;\n this._isWorldMatrixFrozen = true;\n return this;\n }\n /**\n * Allows back the World matrix computation.\n * @returns the TransformNode.\n */\n unfreezeWorldMatrix() {\n this._isWorldMatrixFrozen = false;\n this.computeWorldMatrix(true);\n return this;\n }\n /**\n * True if the World matrix has been frozen.\n */\n get isWorldMatrixFrozen() {\n return this._isWorldMatrixFrozen;\n }\n /**\n * Returns the mesh absolute position in the World.\n * @returns a Vector3.\n */\n getAbsolutePosition() {\n this.computeWorldMatrix();\n return this._absolutePosition;\n }\n /**\n * Sets the mesh absolute position in the World from a Vector3 or an Array(3).\n * @param absolutePosition the absolute position to set\n * @returns the TransformNode.\n */\n setAbsolutePosition(absolutePosition) {\n if (!absolutePosition) {\n return this;\n }\n let absolutePositionX;\n let absolutePositionY;\n let absolutePositionZ;\n if (absolutePosition.x === undefined) {\n if (arguments.length < 3) {\n return this;\n }\n absolutePositionX = arguments[0];\n absolutePositionY = arguments[1];\n absolutePositionZ = arguments[2];\n }\n else {\n absolutePositionX = absolutePosition.x;\n absolutePositionY = absolutePosition.y;\n absolutePositionZ = absolutePosition.z;\n }\n if (this.parent) {\n const invertParentWorldMatrix = TmpVectors.Matrix[0];\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\n Vector3.TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);\n }\n else {\n this.position.x = absolutePositionX;\n this.position.y = absolutePositionY;\n this.position.z = absolutePositionZ;\n }\n this._absolutePosition.copyFrom(absolutePosition);\n return this;\n }\n /**\n * Sets the mesh position in its local space.\n * @param vector3 the position to set in localspace\n * @returns the TransformNode.\n */\n setPositionWithLocalVector(vector3) {\n this.computeWorldMatrix();\n this.position = Vector3.TransformNormal(vector3, this._localMatrix);\n return this;\n }\n /**\n * Returns the mesh position in the local space from the current World matrix values.\n * @returns a new Vector3.\n */\n getPositionExpressedInLocalSpace() {\n this.computeWorldMatrix();\n const invLocalWorldMatrix = TmpVectors.Matrix[0];\n this._localMatrix.invertToRef(invLocalWorldMatrix);\n return Vector3.TransformNormal(this.position, invLocalWorldMatrix);\n }\n /**\n * Translates the mesh along the passed Vector3 in its local space.\n * @param vector3 the distance to translate in localspace\n * @returns the TransformNode.\n */\n locallyTranslate(vector3) {\n this.computeWorldMatrix(true);\n this.position = Vector3.TransformCoordinates(vector3, this._localMatrix);\n return this;\n }\n /**\n * Orients a mesh towards a target point. Mesh must be drawn facing user.\n * @param targetPoint the position (must be in same space as current mesh) to look at\n * @param yawCor optional yaw (y-axis) correction in radians\n * @param pitchCor optional pitch (x-axis) correction in radians\n * @param rollCor optional roll (z-axis) correction in radians\n * @param space the chosen space of the target\n * @returns the TransformNode.\n */\n lookAt(targetPoint, yawCor = 0, pitchCor = 0, rollCor = 0, space = 0 /* Space.LOCAL */) {\n const dv = TransformNode._LookAtVectorCache;\n const pos = space === 0 /* Space.LOCAL */ ? this.position : this.getAbsolutePosition();\n targetPoint.subtractToRef(pos, dv);\n this.setDirection(dv, yawCor, pitchCor, rollCor);\n // Correct for parent's rotation offset\n if (space === 1 /* Space.WORLD */ && this.parent) {\n if (this.rotationQuaternion) {\n // Get local rotation matrix of the looking object\n const rotationMatrix = TmpVectors.Matrix[0];\n this.rotationQuaternion.toRotationMatrix(rotationMatrix);\n // Offset rotation by parent's inverted rotation matrix to correct in world space\n const parentRotationMatrix = TmpVectors.Matrix[1];\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\n parentRotationMatrix.invert();\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\n this.rotationQuaternion.fromRotationMatrix(rotationMatrix);\n }\n else {\n // Get local rotation matrix of the looking object\n const quaternionRotation = TmpVectors.Quaternion[0];\n Quaternion.FromEulerVectorToRef(this.rotation, quaternionRotation);\n const rotationMatrix = TmpVectors.Matrix[0];\n quaternionRotation.toRotationMatrix(rotationMatrix);\n // Offset rotation by parent's inverted rotation matrix to correct in world space\n const parentRotationMatrix = TmpVectors.Matrix[1];\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\n parentRotationMatrix.invert();\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\n quaternionRotation.fromRotationMatrix(rotationMatrix);\n quaternionRotation.toEulerAnglesToRef(this.rotation);\n }\n }\n return this;\n }\n /**\n * Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\n * This Vector3 is expressed in the World space.\n * @param localAxis axis to rotate\n * @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\n */\n getDirection(localAxis) {\n const result = Vector3.Zero();\n this.getDirectionToRef(localAxis, result);\n return result;\n }\n /**\n * Sets the Vector3 \"result\" as the rotated Vector3 \"localAxis\" in the same rotation than the mesh.\n * localAxis is expressed in the mesh local space.\n * result is computed in the World space from the mesh World matrix.\n * @param localAxis axis to rotate\n * @param result the resulting transformnode\n * @returns this TransformNode.\n */\n getDirectionToRef(localAxis, result) {\n Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\n return this;\n }\n /**\n * Sets this transform node rotation to the given local axis.\n * @param localAxis the axis in local space\n * @param yawCor optional yaw (y-axis) correction in radians\n * @param pitchCor optional pitch (x-axis) correction in radians\n * @param rollCor optional roll (z-axis) correction in radians\n * @returns this TransformNode\n */\n setDirection(localAxis, yawCor = 0, pitchCor = 0, rollCor = 0) {\n const yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;\n const len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);\n const pitch = -Math.atan2(localAxis.y, len);\n if (this.rotationQuaternion) {\n Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);\n }\n else {\n this.rotation.x = pitch + pitchCor;\n this.rotation.y = yaw + yawCor;\n this.rotation.z = rollCor;\n }\n return this;\n }\n /**\n * Sets a new pivot point to the current node\n * @param point defines the new pivot point to use\n * @param space defines if the point is in world or local space (local by default)\n * @returns the current TransformNode\n */\n setPivotPoint(point, space = 0 /* Space.LOCAL */) {\n if (this.getScene().getRenderId() == 0) {\n this.computeWorldMatrix(true);\n }\n const wm = this.getWorldMatrix();\n if (space == 1 /* Space.WORLD */) {\n const tmat = TmpVectors.Matrix[0];\n wm.invertToRef(tmat);\n point = Vector3.TransformCoordinates(point, tmat);\n }\n return this.setPivotMatrix(Matrix.Translation(-point.x, -point.y, -point.z), true);\n }\n /**\n * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.\n * @returns the pivot point\n */\n getPivotPoint() {\n const point = Vector3.Zero();\n this.getPivotPointToRef(point);\n return point;\n }\n /**\n * Sets the passed Vector3 \"result\" with the coordinates of the mesh pivot point in the local space.\n * @param result the vector3 to store the result\n * @returns this TransformNode.\n */\n getPivotPointToRef(result) {\n result.x = -this._pivotMatrix.m[12];\n result.y = -this._pivotMatrix.m[13];\n result.z = -this._pivotMatrix.m[14];\n return this;\n }\n /**\n * Returns a new Vector3 set with the mesh pivot point World coordinates.\n * @returns a new Vector3 set with the mesh pivot point World coordinates.\n */\n getAbsolutePivotPoint() {\n const point = Vector3.Zero();\n this.getAbsolutePivotPointToRef(point);\n return point;\n }\n /**\n * Sets the Vector3 \"result\" coordinates with the mesh pivot point World coordinates.\n * @param result vector3 to store the result\n * @returns this TransformNode.\n */\n getAbsolutePivotPointToRef(result) {\n this.getPivotPointToRef(result);\n Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);\n return this;\n }\n /**\n * Flag the transform node as dirty (Forcing it to update everything)\n * @param property if set to \"rotation\" the objects rotationQuaternion will be set to null\n * @returns this node\n */\n markAsDirty(property) {\n if (this._isDirty) {\n return this;\n }\n // We need to explicitly update the children\n // as the scene.evaluateActiveMeshes will not poll the transform nodes\n if (this._children) {\n for (const child of this._children) {\n child.markAsDirty(property);\n }\n }\n return super.markAsDirty(property);\n }\n /**\n * Defines the passed node as the parent of the current node.\n * The node will remain exactly where it is and its position / rotation will be updated accordingly.\n * Note that if the mesh has a pivot matrix / point defined it will be applied after the parent was updated.\n * In that case the node will not remain in the same space as it is, as the pivot will be applied.\n * To avoid this, you can set updatePivot to true and the pivot will be updated to identity\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent\n * @param node the node ot set as the parent\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @param updatePivot if true, update the pivot matrix to keep the node in the same space as before\n * @returns this TransformNode.\n */\n setParent(node, preserveScalingSign = false, updatePivot = false) {\n if (!node && !this.parent) {\n return this;\n }\n const quatRotation = TmpVectors.Quaternion[0];\n const position = TmpVectors.Vector3[0];\n const scale = TmpVectors.Vector3[1];\n const invParentMatrix = TmpVectors.Matrix[1];\n Matrix.IdentityToRef(invParentMatrix);\n const composedMatrix = TmpVectors.Matrix[0];\n this.computeWorldMatrix(true);\n let currentRotation = this.rotationQuaternion;\n if (!currentRotation) {\n currentRotation = TransformNode._TmpRotation;\n Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, currentRotation);\n }\n // current global transformation without pivot\n Matrix.ComposeToRef(this.scaling, currentRotation, this.position, composedMatrix);\n if (this.parent) {\n composedMatrix.multiplyToRef(this.parent.computeWorldMatrix(true), composedMatrix);\n }\n // is a node was set, calculate the difference between this and the node\n if (node) {\n node.computeWorldMatrix(true).invertToRef(invParentMatrix);\n composedMatrix.multiplyToRef(invParentMatrix, composedMatrix);\n }\n composedMatrix.decompose(scale, quatRotation, position, preserveScalingSign ? this : undefined);\n if (this.rotationQuaternion) {\n this.rotationQuaternion.copyFrom(quatRotation);\n }\n else {\n quatRotation.toEulerAnglesToRef(this.rotation);\n }\n this.scaling.copyFrom(scale);\n this.position.copyFrom(position);\n this.parent = node;\n if (updatePivot) {\n this.setPivotMatrix(Matrix.Identity());\n }\n return this;\n }\n /**\n * Adds the passed mesh as a child to the current mesh\n * @param mesh defines the child mesh\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @returns the current mesh\n */\n addChild(mesh, preserveScalingSign = false) {\n mesh.setParent(this, preserveScalingSign);\n return this;\n }\n /**\n * Removes the passed mesh from the current mesh children list\n * @param mesh defines the child mesh\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @returns the current mesh\n */\n removeChild(mesh, preserveScalingSign = false) {\n mesh.setParent(null, preserveScalingSign);\n return this;\n }\n /**\n * True if the scaling property of this object is non uniform eg. (1,2,1)\n */\n get nonUniformScaling() {\n return this._nonUniformScaling;\n }\n /**\n * @internal\n */\n _updateNonUniformScalingState(value) {\n if (this._nonUniformScaling === value) {\n return false;\n }\n this._nonUniformScaling = value;\n return true;\n }\n /**\n * Attach the current TransformNode to another TransformNode associated with a bone\n * @param bone Bone affecting the TransformNode\n * @param affectedTransformNode TransformNode associated with the bone\n * @returns this object\n */\n attachToBone(bone, affectedTransformNode) {\n this._currentParentWhenAttachingToBone = this.parent;\n this._transformToBoneReferal = affectedTransformNode;\n this.parent = bone;\n bone.getSkeleton().prepare(true); // make sure bone.getFinalMatrix() is up to date\n if (bone.getFinalMatrix().determinant() < 0) {\n this.scalingDeterminant *= -1;\n }\n return this;\n }\n /**\n * Detach the transform node if its associated with a bone\n * @param resetToPreviousParent Indicates if the parent that was in effect when attachToBone was called should be set back or if we should set parent to null instead (defaults to the latter)\n * @returns this object\n */\n detachFromBone(resetToPreviousParent = false) {\n if (!this.parent) {\n if (resetToPreviousParent) {\n this.parent = this._currentParentWhenAttachingToBone;\n }\n return this;\n }\n if (this.parent.getWorldMatrix().determinant() < 0) {\n this.scalingDeterminant *= -1;\n }\n this._transformToBoneReferal = null;\n if (resetToPreviousParent) {\n this.parent = this._currentParentWhenAttachingToBone;\n }\n else {\n this.parent = null;\n }\n return this;\n }\n /**\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\n * The passed axis is also normalized.\n * @param axis the axis to rotate around\n * @param amount the amount to rotate in radians\n * @param space Space to rotate in (Default: local)\n * @returns the TransformNode.\n */\n rotate(axis, amount, space) {\n axis.normalize();\n if (!this.rotationQuaternion) {\n this.rotationQuaternion = this.rotation.toQuaternion();\n this.rotation.setAll(0);\n }\n let rotationQuaternion;\n if (!space || space === 0 /* Space.LOCAL */) {\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._RotationAxisCache);\n this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);\n }\n else {\n if (this.parent) {\n const parentWorldMatrix = this.parent.getWorldMatrix();\n const invertParentWorldMatrix = TmpVectors.Matrix[0];\n parentWorldMatrix.invertToRef(invertParentWorldMatrix);\n axis = Vector3.TransformNormal(axis, invertParentWorldMatrix);\n if (parentWorldMatrix.determinant() < 0) {\n amount *= -1;\n }\n }\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._RotationAxisCache);\n rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\n }\n return this;\n }\n /**\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\n * The passed axis is also normalized. .\n * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm\n * @param point the point to rotate around\n * @param axis the axis to rotate around\n * @param amount the amount to rotate in radians\n * @returns the TransformNode\n */\n rotateAround(point, axis, amount) {\n axis.normalize();\n if (!this.rotationQuaternion) {\n this.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\n this.rotation.setAll(0);\n }\n const tmpVector = TmpVectors.Vector3[0];\n const finalScale = TmpVectors.Vector3[1];\n const finalTranslation = TmpVectors.Vector3[2];\n const finalRotation = TmpVectors.Quaternion[0];\n const translationMatrix = TmpVectors.Matrix[0]; // T\n const translationMatrixInv = TmpVectors.Matrix[1]; // T'\n const rotationMatrix = TmpVectors.Matrix[2]; // R\n const finalMatrix = TmpVectors.Matrix[3]; // T' x R x T\n point.subtractToRef(this.position, tmpVector);\n Matrix.TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T\n Matrix.TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'\n Matrix.RotationAxisToRef(axis, amount, rotationMatrix); // R\n translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R\n finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T\n finalMatrix.decompose(finalScale, finalRotation, finalTranslation);\n this.position.addInPlace(finalTranslation);\n finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\n return this;\n }\n /**\n * Translates the mesh along the axis vector for the passed distance in the given space.\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\n * @param axis the axis to translate in\n * @param distance the distance to translate\n * @param space Space to rotate in (Default: local)\n * @returns the TransformNode.\n */\n translate(axis, distance, space) {\n const displacementVector = axis.scale(distance);\n if (!space || space === 0 /* Space.LOCAL */) {\n const tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);\n this.setPositionWithLocalVector(tempV3);\n }\n else {\n this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));\n }\n return this;\n }\n /**\n * Adds a rotation step to the mesh current rotation.\n * x, y, z are Euler angles expressed in radians.\n * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.\n * This means this rotation is made in the mesh local space only.\n * It's useful to set a custom rotation order different from the BJS standard one YXZ.\n * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.\n * ```javascript\n * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);\n * ```\n * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.\n * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.\n * @param x Rotation to add\n * @param y Rotation to add\n * @param z Rotation to add\n * @returns the TransformNode.\n */\n addRotation(x, y, z) {\n let rotationQuaternion;\n if (this.rotationQuaternion) {\n rotationQuaternion = this.rotationQuaternion;\n }\n else {\n rotationQuaternion = TmpVectors.Quaternion[1];\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);\n }\n const accumulation = TmpVectors.Quaternion[0];\n Quaternion.RotationYawPitchRollToRef(y, x, z, accumulation);\n rotationQuaternion.multiplyInPlace(accumulation);\n if (!this.rotationQuaternion) {\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\n }\n return this;\n }\n /**\n * @internal\n */\n _getEffectiveParent() {\n return this.parent;\n }\n /**\n * Returns whether the transform node world matrix computation needs the camera information to be computed.\n * This is the case when the node is a billboard or has an infinite distance for instance.\n * @returns true if the world matrix computation needs the camera information to be computed\n */\n isWorldMatrixCameraDependent() {\n return (this._infiniteDistance && !this.parent) || (this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard);\n }\n /**\n * Computes the world matrix of the node\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\n * @param camera defines the camera used if different from the scene active camera (This is used with modes like Billboard or infinite distance)\n * @returns the world matrix\n */\n computeWorldMatrix(force = false, camera = null) {\n if (this._isWorldMatrixFrozen && !this._isDirty) {\n return this._worldMatrix;\n }\n const currentRenderId = this.getScene().getRenderId();\n if (!this._isDirty && !force && (this._currentRenderId === currentRenderId || this.isSynchronized())) {\n this._currentRenderId = currentRenderId;\n return this._worldMatrix;\n }\n camera = camera || this.getScene().activeCamera;\n this._updateCache();\n const cache = this._cache;\n cache.pivotMatrixUpdated = false;\n cache.billboardMode = this.billboardMode;\n cache.infiniteDistance = this.infiniteDistance;\n cache.parent = this._parentNode;\n this._currentRenderId = currentRenderId;\n this._childUpdateId += 1;\n this._isDirty = false;\n this._position._isDirty = false;\n this._rotation._isDirty = false;\n this._scaling._isDirty = false;\n const parent = this._getEffectiveParent();\n // Scaling\n const scaling = TransformNode._TmpScaling;\n let translation = this._position;\n // Translation\n if (this._infiniteDistance) {\n if (!this.parent && camera) {\n const cameraWorldMatrix = camera.getWorldMatrix();\n const cameraGlobalPosition = new Vector3(cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);\n translation = TransformNode._TmpTranslation;\n translation.copyFromFloats(this._position.x + cameraGlobalPosition.x, this._position.y + cameraGlobalPosition.y, this._position.z + cameraGlobalPosition.z);\n }\n }\n // Scaling\n scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);\n // Rotation\n let rotation;\n if (this._rotationQuaternion) {\n this._rotationQuaternion._isDirty = false;\n rotation = this._rotationQuaternion;\n if (this.reIntegrateRotationIntoRotationQuaternion) {\n const len = this.rotation.lengthSquared();\n if (len) {\n this._rotationQuaternion.multiplyInPlace(Quaternion.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z));\n this._rotation.copyFromFloats(0, 0, 0);\n }\n }\n }\n else {\n rotation = TransformNode._TmpRotation;\n Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);\n }\n // Compose\n if (this._usePivotMatrix) {\n const scaleMatrix = TmpVectors.Matrix[1];\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, scaleMatrix);\n // Rotation\n const rotationMatrix = TmpVectors.Matrix[0];\n rotation.toRotationMatrix(rotationMatrix);\n // Composing transformations\n this._pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, this._localMatrix);\n // Post multiply inverse of pivotMatrix\n if (this._postMultiplyPivotMatrix) {\n this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix);\n }\n this._localMatrix.addTranslationFromFloats(translation.x, translation.y, translation.z);\n }\n else {\n Matrix.ComposeToRef(scaling, rotation, translation, this._localMatrix);\n }\n // Parent\n if (parent && parent.getWorldMatrix) {\n if (force) {\n parent.computeWorldMatrix(force);\n }\n if (cache.useBillboardPath) {\n if (this._transformToBoneReferal) {\n const bone = this.parent;\n bone.getSkeleton().prepare();\n bone.getFinalMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), TmpVectors.Matrix[7]);\n }\n else {\n TmpVectors.Matrix[7].copyFrom(parent.getWorldMatrix());\n }\n // Extract scaling and translation from parent\n const translation = TmpVectors.Vector3[5];\n const scale = TmpVectors.Vector3[6];\n const orientation = TmpVectors.Quaternion[0];\n TmpVectors.Matrix[7].decompose(scale, orientation, translation);\n Matrix.ScalingToRef(scale.x, scale.y, scale.z, TmpVectors.Matrix[7]);\n TmpVectors.Matrix[7].setTranslation(translation);\n if (TransformNode.BillboardUseParentOrientation) {\n // set localMatrix translation to be transformed against parent's orientation.\n this._position.applyRotationQuaternionToRef(orientation, translation);\n this._localMatrix.setTranslation(translation);\n }\n this._localMatrix.multiplyToRef(TmpVectors.Matrix[7], this._worldMatrix);\n }\n else {\n if (this._transformToBoneReferal) {\n const bone = this.parent;\n bone.getSkeleton().prepare();\n this._localMatrix.multiplyToRef(bone.getFinalMatrix(), TmpVectors.Matrix[6]);\n TmpVectors.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);\n }\n else {\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), this._worldMatrix);\n }\n }\n this._markSyncedWithParent();\n }\n else {\n this._worldMatrix.copyFrom(this._localMatrix);\n }\n // Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)\n if (cache.useBillboardPath && camera && this.billboardMode && !cache.useBillboardPosition) {\n const storedTranslation = TmpVectors.Vector3[0];\n this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation\n // Cancel camera rotation\n TmpVectors.Matrix[1].copyFrom(camera.getViewMatrix());\n if (this._scene.useRightHandedSystem) {\n TmpVectors.Matrix[1].multiplyToRef(convertRHSToLHS, TmpVectors.Matrix[1]);\n }\n TmpVectors.Matrix[1].setTranslationFromFloats(0, 0, 0);\n TmpVectors.Matrix[1].invertToRef(TmpVectors.Matrix[0]);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\n TmpVectors.Matrix[0].decompose(undefined, TmpVectors.Quaternion[0], undefined);\n const eulerAngles = TmpVectors.Vector3[1];\n TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\n eulerAngles.x = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\n eulerAngles.y = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\n eulerAngles.z = 0;\n }\n Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);\n }\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\n this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);\n // Restore translation\n this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);\n }\n // Billboarding based on camera position\n else if (cache.useBillboardPath && camera && cache.useBillboardPosition) {\n const storedTranslation = TmpVectors.Vector3[0];\n // Save translation\n this._worldMatrix.getTranslationToRef(storedTranslation);\n // Compute camera position in local space\n const cameraPosition = camera.globalPosition;\n this._worldMatrix.invertToRef(TmpVectors.Matrix[1]);\n const camInObjSpace = TmpVectors.Vector3[1];\n Vector3.TransformCoordinatesToRef(cameraPosition, TmpVectors.Matrix[1], camInObjSpace);\n camInObjSpace.normalize();\n // Find the lookAt info in local space\n const yaw = -Math.atan2(camInObjSpace.z, camInObjSpace.x) + Math.PI / 2;\n const len = Math.sqrt(camInObjSpace.x * camInObjSpace.x + camInObjSpace.z * camInObjSpace.z);\n const pitch = -Math.atan2(camInObjSpace.y, len);\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, 0, TmpVectors.Quaternion[0]);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\n const eulerAngles = TmpVectors.Vector3[1];\n TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\n eulerAngles.x = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\n eulerAngles.y = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\n eulerAngles.z = 0;\n }\n Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);\n }\n else {\n Matrix.FromQuaternionToRef(TmpVectors.Quaternion[0], TmpVectors.Matrix[0]);\n }\n // Cancel translation\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\n // Rotate according to lookat (diff from local to lookat)\n this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);\n // Restore translation\n this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);\n }\n // Normal matrix\n if (!this.ignoreNonUniformScaling) {\n if (this._scaling.isNonUniformWithinEpsilon(0.000001)) {\n this._updateNonUniformScalingState(true);\n }\n else if (parent && parent._nonUniformScaling) {\n this._updateNonUniformScalingState(parent._nonUniformScaling);\n }\n else {\n this._updateNonUniformScalingState(false);\n }\n }\n else {\n this._updateNonUniformScalingState(false);\n }\n this._afterComputeWorldMatrix();\n // Absolute position\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\n this._isAbsoluteSynced = false;\n // Callbacks\n this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);\n if (!this._poseMatrix) {\n this._poseMatrix = Matrix.Invert(this._worldMatrix);\n }\n // Cache the determinant\n this._worldMatrixDeterminantIsDirty = true;\n return this._worldMatrix;\n }\n /**\n * Resets this nodeTransform's local matrix to Matrix.Identity().\n * @param independentOfChildren indicates if all child nodeTransform's world-space transform should be preserved.\n */\n resetLocalMatrix(independentOfChildren = true) {\n this.computeWorldMatrix();\n if (independentOfChildren) {\n const children = this.getChildren();\n for (let i = 0; i < children.length; ++i) {\n const child = children[i];\n if (child) {\n child.computeWorldMatrix();\n const bakedMatrix = TmpVectors.Matrix[0];\n child._localMatrix.multiplyToRef(this._localMatrix, bakedMatrix);\n const tmpRotationQuaternion = TmpVectors.Quaternion[0];\n bakedMatrix.decompose(child.scaling, tmpRotationQuaternion, child.position);\n if (child.rotationQuaternion) {\n child.rotationQuaternion.copyFrom(tmpRotationQuaternion);\n }\n else {\n tmpRotationQuaternion.toEulerAnglesToRef(child.rotation);\n }\n }\n }\n }\n this.scaling.copyFromFloats(1, 1, 1);\n this.position.copyFromFloats(0, 0, 0);\n this.rotation.copyFromFloats(0, 0, 0);\n //only if quaternion is already set\n if (this.rotationQuaternion) {\n this.rotationQuaternion = Quaternion.Identity();\n }\n this._worldMatrix = Matrix.Identity();\n }\n _afterComputeWorldMatrix() { }\n /**\n * If you'd like to be called back after the mesh position, rotation or scaling has been updated.\n * @param func callback function to add\n *\n * @returns the TransformNode.\n */\n registerAfterWorldMatrixUpdate(func) {\n this.onAfterWorldMatrixUpdateObservable.add(func);\n return this;\n }\n /**\n * Removes a registered callback function.\n * @param func callback function to remove\n * @returns the TransformNode.\n */\n unregisterAfterWorldMatrixUpdate(func) {\n this.onAfterWorldMatrixUpdateObservable.removeCallback(func);\n return this;\n }\n /**\n * Gets the position of the current mesh in camera space\n * @param camera defines the camera to use\n * @returns a position\n */\n getPositionInCameraSpace(camera = null) {\n if (!camera) {\n camera = this.getScene().activeCamera;\n }\n return Vector3.TransformCoordinates(this.getAbsolutePosition(), camera.getViewMatrix());\n }\n /**\n * Returns the distance from the mesh to the active camera\n * @param camera defines the camera to use\n * @returns the distance\n */\n getDistanceToCamera(camera = null) {\n if (!camera) {\n camera = this.getScene().activeCamera;\n }\n return this.getAbsolutePosition().subtract(camera.globalPosition).length();\n }\n /**\n * Clone the current transform node\n * @param name Name of the new clone\n * @param newParent New parent for the clone\n * @param doNotCloneChildren Do not clone children hierarchy\n * @returns the new transform node\n */\n clone(name, newParent, doNotCloneChildren) {\n const result = SerializationHelper.Clone(() => new TransformNode(name, this.getScene()), this);\n result.name = name;\n result.id = name;\n if (newParent) {\n result.parent = newParent;\n }\n if (!doNotCloneChildren) {\n // Children\n const directDescendants = this.getDescendants(true);\n for (let index = 0; index < directDescendants.length; index++) {\n const child = directDescendants[index];\n if (child.clone) {\n child.clone(name + \".\" + child.name, result);\n }\n }\n }\n return result;\n }\n /**\n * Serializes the objects information.\n * @param currentSerializationObject defines the object to serialize in\n * @returns the serialized object\n */\n serialize(currentSerializationObject) {\n const serializationObject = SerializationHelper.Serialize(this, currentSerializationObject);\n serializationObject.type = this.getClassName();\n serializationObject.uniqueId = this.uniqueId;\n // Parent\n if (this.parent) {\n this.parent._serializeAsParent(serializationObject);\n }\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\n serializationObject.isEnabled = this.isEnabled();\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n serializationObject.ranges = this.serializeAnimationRanges();\n return serializationObject;\n }\n // Statics\n /**\n * Returns a new TransformNode object parsed from the source provided.\n * @param parsedTransformNode is the source.\n * @param scene the scene the object belongs to\n * @param rootUrl is a string, it's the root URL to prefix the `delayLoadingFile` property with\n * @returns a new TransformNode object parsed from the source provided.\n */\n static Parse(parsedTransformNode, scene, rootUrl) {\n const transformNode = SerializationHelper.Parse(() => new TransformNode(parsedTransformNode.name, scene), parsedTransformNode, scene, rootUrl);\n if (parsedTransformNode.localMatrix) {\n transformNode.setPreTransformMatrix(Matrix.FromArray(parsedTransformNode.localMatrix));\n }\n else if (parsedTransformNode.pivotMatrix) {\n transformNode.setPivotMatrix(Matrix.FromArray(parsedTransformNode.pivotMatrix));\n }\n transformNode.setEnabled(parsedTransformNode.isEnabled);\n transformNode._waitingParsedUniqueId = parsedTransformNode.uniqueId;\n // Parent\n if (parsedTransformNode.parentId !== undefined) {\n transformNode._waitingParentId = parsedTransformNode.parentId;\n }\n if (parsedTransformNode.parentInstanceIndex !== undefined) {\n transformNode._waitingParentInstanceIndex = parsedTransformNode.parentInstanceIndex;\n }\n // Animations\n if (parsedTransformNode.animations) {\n for (let animationIndex = 0; animationIndex < parsedTransformNode.animations.length; animationIndex++) {\n const parsedAnimation = parsedTransformNode.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n transformNode.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(transformNode, parsedTransformNode, scene);\n }\n if (parsedTransformNode.autoAnimate) {\n scene.beginAnimation(transformNode, parsedTransformNode.autoAnimateFrom, parsedTransformNode.autoAnimateTo, parsedTransformNode.autoAnimateLoop, parsedTransformNode.autoAnimateSpeed || 1.0);\n }\n return transformNode;\n }\n /**\n * Get all child-transformNodes of this node\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\n * @returns an array of TransformNode\n */\n getChildTransformNodes(directDescendantsOnly, predicate) {\n const results = [];\n this._getDescendants(results, directDescendantsOnly, (node) => {\n return (!predicate || predicate(node)) && node instanceof TransformNode;\n });\n return results;\n }\n /**\n * Releases resources associated with this transform node.\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 // Animations\n this.getScene().stopAnimation(this);\n // Remove from scene\n this.getScene().removeTransformNode(this);\n if (this._parentContainer) {\n const index = this._parentContainer.transformNodes.indexOf(this);\n if (index > -1) {\n this._parentContainer.transformNodes.splice(index, 1);\n }\n this._parentContainer = null;\n }\n this.onAfterWorldMatrixUpdateObservable.clear();\n if (doNotRecurse) {\n const transformNodes = this.getChildTransformNodes(true);\n for (const transformNode of transformNodes) {\n transformNode.parent = null;\n transformNode.computeWorldMatrix(true);\n }\n }\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /**\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\n * @returns the current mesh\n */\n normalizeToUnitCube(includeDescendants = true, ignoreRotation = false, predicate) {\n let storedRotation = null;\n let storedRotationQuaternion = null;\n if (ignoreRotation) {\n if (this.rotationQuaternion) {\n storedRotationQuaternion = this.rotationQuaternion.clone();\n this.rotationQuaternion.copyFromFloats(0, 0, 0, 1);\n }\n else if (this.rotation) {\n storedRotation = this.rotation.clone();\n this.rotation.copyFromFloats(0, 0, 0);\n }\n }\n const boundingVectors = this.getHierarchyBoundingVectors(includeDescendants, predicate);\n const sizeVec = boundingVectors.max.subtract(boundingVectors.min);\n const maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);\n if (maxDimension === 0) {\n return this;\n }\n const scale = 1 / maxDimension;\n this.scaling.scaleInPlace(scale);\n if (ignoreRotation) {\n if (this.rotationQuaternion && storedRotationQuaternion) {\n this.rotationQuaternion.copyFrom(storedRotationQuaternion);\n }\n else if (this.rotation && storedRotation) {\n this.rotation.copyFrom(storedRotation);\n }\n }\n return this;\n }\n _syncAbsoluteScalingAndRotation() {\n if (!this._isAbsoluteSynced) {\n this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion);\n this._isAbsoluteSynced = true;\n }\n }\n}\n// Statics\n/**\n * Object will not rotate to face the camera\n */\nTransformNode.BILLBOARDMODE_NONE = 0;\n/**\n * Object will rotate to face the camera but only on the x axis\n */\nTransformNode.BILLBOARDMODE_X = 1;\n/**\n * Object will rotate to face the camera but only on the y axis\n */\nTransformNode.BILLBOARDMODE_Y = 2;\n/**\n * Object will rotate to face the camera but only on the z axis\n */\nTransformNode.BILLBOARDMODE_Z = 4;\n/**\n * Object will rotate to face the camera\n */\nTransformNode.BILLBOARDMODE_ALL = 7;\n/**\n * Object will rotate to face the camera's position instead of orientation\n */\nTransformNode.BILLBOARDMODE_USE_POSITION = 128;\n/**\n * Child transform with Billboard flags should or should not apply parent rotation (default if off)\n */\nTransformNode.BillboardUseParentOrientation = false;\nTransformNode._TmpRotation = Quaternion.Zero();\nTransformNode._TmpScaling = Vector3.Zero();\nTransformNode._TmpTranslation = Vector3.Zero();\nTransformNode._LookAtVectorCache = new Vector3(0, 0, 0);\nTransformNode._RotationAxisCache = new Quaternion();\n__decorate([\n serializeAsVector3(\"position\")\n], TransformNode.prototype, \"_position\", void 0);\n__decorate([\n serializeAsVector3(\"rotation\")\n], TransformNode.prototype, \"_rotation\", void 0);\n__decorate([\n serializeAsQuaternion(\"rotationQuaternion\")\n], TransformNode.prototype, \"_rotationQuaternion\", void 0);\n__decorate([\n serializeAsVector3(\"scaling\")\n], TransformNode.prototype, \"_scaling\", void 0);\n__decorate([\n serialize(\"billboardMode\")\n], TransformNode.prototype, \"_billboardMode\", void 0);\n__decorate([\n serialize()\n], TransformNode.prototype, \"scalingDeterminant\", void 0);\n__decorate([\n serialize(\"infiniteDistance\")\n], TransformNode.prototype, \"_infiniteDistance\", void 0);\n__decorate([\n serialize()\n], TransformNode.prototype, \"ignoreNonUniformScaling\", void 0);\n__decorate([\n serialize()\n], TransformNode.prototype, \"reIntegrateRotationIntoRotationQuaternion\", void 0);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,SAAS,EAAEC,kBAAkB,EAAEC,qBAAqB,QAAQ,uBAAuB;AAC5F,SAASC,mBAAmB,QAAQ,qCAAqC;AACzE,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,UAAU,EAAEC,MAAM,EAAEC,OAAO,EAAEC,UAAU,QAAQ,yBAAyB;AACjF,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,MAAMC,eAAe,GAAGL,MAAM,CAACM,OAAO,CAACL,OAAO,CAACM,GAAG,CAAC,CAAC,EAAER,UAAU,CAACS,eAAe,CAAC,CAAC,EAAEC,IAAI,CAACC,EAAE,EAAE,CAAC,CAAC,EAAET,OAAO,CAACU,IAAI,CAAC,CAAC,CAAC;AAChH;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,SAAST,IAAI,CAAC;EACpC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,IAAIU,aAAaA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACC,cAAc;EAC9B;EACA,IAAID,aAAaA,CAACE,KAAK,EAAE;IACrB,IAAI,IAAI,CAACD,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