@onerjs/core 8.47.1 → 8.47.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animation.js +2 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.js +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animatorAvatar.js +13 -12
- package/Animations/animatorAvatar.js.map +1 -1
- package/Animations/easing.js +1 -1
- package/Animations/easing.js.map +1 -1
- package/Animations/pathCursor.js +1 -2
- package/Animations/pathCursor.js.map +1 -1
- package/Cameras/geospatialCameraMovement.js +4 -5
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Layers/selectionOutlineLayer.d.ts +7 -0
- package/Layers/selectionOutlineLayer.js +18 -1
- package/Layers/selectionOutlineLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +1 -0
- package/Layers/thinSelectionOutlineLayer.js +31 -6
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.d.ts +6 -0
- package/Lights/Clustered/clusteredLightContainer.js +42 -0
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Lights/light.d.ts +7 -0
- package/Lights/light.js +10 -0
- package/Lights/light.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +13 -3
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +10 -0
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +8 -1
- package/Meshes/abstractMesh.js +9 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.js +31 -4
- package/Meshes/mesh.js.map +1 -1
- package/Misc/greasedLineTools.js +5 -0
- package/Misc/greasedLineTools.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.js +2 -4
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Physics/v2/characterController.d.ts +5 -0
- package/Physics/v2/characterController.js +6 -0
- package/Physics/v2/characterController.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/XR/webXRSessionManager.js +7 -5
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animatorAvatar.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/animatorAvatar.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAyFtD;;;GAGG;AACH,MAAM,OAAO,cAAc;IAkBvB;;;OAGG;IACH,IAAW,+BAA+B;QACtC,IAAI,CAAC,IAAI,CAAC,gCAAgC,EAAE,CAAC;YACzC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,CAAC,gCAAgC,CAAC;IACjD,CAAC;IAOD;;;;;;OAMG;IACH,YACoB,IAAY,EACZ,QAAwB,EAChC,oBAAoB,IAAI,EAChC,aAAa,GAAG,IAAI;QAHJ,SAAI,GAAJ,IAAI,CAAQ;QACZ,aAAQ,GAAR,QAAQ,CAAgB;QAChC,sBAAiB,GAAjB,iBAAiB,CAAO;QAfpC;;WAEG;QACI,iBAAY,GAAG,IAAI,CAAC;QAevB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG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ED,oBAAoB,CAAC,IAAI,EAAE,CAAC;QAC5B,cAAc,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import {\r\n type MorphTargetManager,\r\n type Immutable,\r\n type Bone,\r\n type Nullable,\r\n type MorphTarget,\r\n type AnimationGroup,\r\n type Animation,\r\n type Node,\r\n type Skeleton,\r\n type TargetedAnimation,\r\n type DeepImmutableObject,\r\n} from \"core/index\";\r\nimport { Vector3, Quaternion, TmpVectors, Matrix } from \"core/Maths/math.vector\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Options for retargeting an animation group to an avatar.\r\n */\r\nexport interface IRetargetOptions {\r\n /**\r\n * The name to assign to the (cloned) retargeted animation group.\r\n * If not specified, the same name as the original animation group will be used.\r\n */\r\n animationGroupName?: string;\r\n\r\n /**\r\n * If true, the retargeted animations will be fixed to correct common issues like orthogonal quaternions.\r\n * Default is false.\r\n */\r\n fixAnimations?: boolean;\r\n\r\n /**\r\n * If true, the parent hierarchy of bones and transform nodes will be checked during retargeting.\r\n * Animations will be removed if the hierarchies don't match.\r\n * Default is false.\r\n */\r\n checkHierarchy?: boolean;\r\n\r\n /**\r\n * If true, the frame values in the animation keyframes will be adjusted during retargeting to account for differences\r\n * between the source and target bone transforms.\r\n * Default is true.\r\n */\r\n retargetAnimationKeys?: boolean;\r\n\r\n /**\r\n * If true, scales and adjusts the root position animation to account for size differences between the source and target avatars.\r\n * This helps maintain the relative motion of the character when retargeting between avatars of different proportions.\r\n * Default is true.\r\n */\r\n fixRootPosition?: boolean;\r\n\r\n /**\r\n * If true, adjusts the root position animation to correct for ground reference height differences between the source and target avatars.\r\n * This ensures that the animated character maintains proper contact with the ground during retargeting.\r\n * Requires groundReferenceNodeName to be specified to determine the ground reference point in the source animation.\r\n * Default is false.\r\n */\r\n fixGroundReference?: boolean;\r\n\r\n /**\r\n * If true, adjusts the ground reference dynamically during retargeting. fixGroundReference must be true for this to work.\r\n * When enabled, the system will continuously adjust the ground reference point throughout the retargeting process to make sure it's the lowest point of the character.\r\n * This allows for more accurate ground contact correction, especially in animations where groundReferenceNodeName is not always the lowest point (e.g., walking, running).\r\n * Default is false.\r\n */\r\n fixGroundReferenceDynamicRefNode?: boolean;\r\n\r\n /**\r\n * The name of the root transform node in the source animation group (typically \"Hips\" or similar).\r\n * If not specified, the system will attempt to automatically find the first bone without a parent.\r\n * This bone is used as a reference point for fixing root position during retargeting.\r\n * It's also used by the ground reference fixing processing.\r\n */\r\n rootNodeName?: string;\r\n\r\n /**\r\n * The name of the transform node in the source animation group used as a ground reference point (typically a foot bone like \"LeftFoot\" or \"RightFoot\").\r\n * This bone is used to determine the vertical offset needed to maintain proper ground contact during retargeting.\r\n * Required when fixGroundReference or fixRootPosition is enabled.\r\n */\r\n groundReferenceNodeName?: string;\r\n\r\n /**\r\n * Specifies which axis represents the vertical/up direction in the animation space.\r\n * Use \"X\", \"Y\", or \"Z\" to explicitly set the vertical axis, or \"\" (empty string) / undefined to auto-detect.\r\n * If not specified or empty, the system will automatically determine the vertical axis based on the difference\r\n * between the root node and ground reference node positions.\r\n * Default is undefined (auto-detect).\r\n */\r\n groundReferenceVerticalAxis?: \"\" | \"X\" | \"Y\" | \"Z\";\r\n\r\n /**\r\n * A map for renaming nodes during retargeting when the source transform node hierarchy and target skeleton use different naming conventions.\r\n * The map keys are the original node names from the source animation group, and the values are the corresponding\r\n * node names in the target skeleton. This is useful when bone names don't match between avatars.\r\n */\r\n mapNodeNames?: Map<string, string>;\r\n}\r\n\r\ntype TransformNodeNameToNode = Map<string, { node: TransformNode; initialTransformations: { position: Vector3; scaling: Vector3; quaternion?: Quaternion; rotation: Vector3 } }>;\r\n\r\n/**\r\n * Represents an animator avatar that manages meshes, skeletons and morph target managers for a hierarchical transform node and mesh structure.\r\n * This class is used to group and manage animation-related resources (meshes, skeletons and morph targets) associated with a root transform node and its descendants.\r\n */\r\nexport class AnimatorAvatar {\r\n /**\r\n * List of meshes found in the hierarchy of the root node. Only meshes with at least one vertex are included.\r\n */\r\n public meshes: AbstractMesh[];\r\n\r\n /**\r\n * Set of skeletons found in the mesh hierarchy.\r\n */\r\n public skeletons: Set<Skeleton>;\r\n\r\n /**\r\n * Set of morph target managers found in the mesh hierarchy.\r\n * Each morph target manager is configured with the appropriate mesh name and influencer count.\r\n */\r\n public morphTargetManagers: Set<MorphTargetManager>;\r\n\r\n private _mapMorphTargetNameToMorphTarget: Map<string, MorphTarget>;\r\n /**\r\n * Map of morph target names to their corresponding MorphTarget instances.\r\n * The keys are constructed using the format \"meshName_morphTargetName\".\r\n */\r\n public get mapMorphTargetNameToMorphTarget(): Immutable<Map<string, MorphTarget>> {\r\n if (!this._mapMorphTargetNameToMorphTarget) {\r\n this._buildMorphTargetMap();\r\n }\r\n return this._mapMorphTargetNameToMorphTarget;\r\n }\r\n\r\n /**\r\n * Indicates whether to show warnings during retargeting operations.\r\n */\r\n public showWarnings = true;\r\n\r\n /**\r\n * Creates an instance of AnimatorAvatar.\r\n * @param name - The name to assign to this avatar and its root node\r\n * @param rootNode - The root node of the avatar hierarchy. This node and its descendants will be scanned for meshes, skeletons and morph target managers. If not provided, you are expected to manually manage meshes, skeletons and morph target managers.\r\n * @param _disposeResources - Indicates whether to dispose of resources (meshes, skeletons, morph target managers, root node and descendants + materials and textures) when the avatar is disposed (true by default)\r\n * @param setAvatarName - Indicates whether to set the name of the root node to the avatar name. Default is true. Set this to false if you don't want the root node to be renamed, or if you want to set it to a different name after creating the avatar.\r\n */\r\n constructor(\r\n public readonly name: string,\r\n public readonly rootNode?: TransformNode,\r\n private _disposeResources = true,\r\n setAvatarName = true\r\n ) {\r\n this.meshes = [];\r\n this.skeletons = new Set<Skeleton>();\r\n this.morphTargetManagers = new Set<MorphTargetManager>();\r\n\r\n if (!rootNode) {\r\n return;\r\n }\r\n\r\n if (setAvatarName) {\r\n rootNode.name = name;\r\n }\r\n\r\n if (rootNode instanceof AbstractMesh && rootNode.getTotalVertices() > 0) {\r\n this._collectMesh(rootNode);\r\n }\r\n\r\n rootNode.getChildMeshes(false).forEach((mesh) => {\r\n if (mesh.getTotalVertices() > 0) {\r\n this._collectMesh(mesh);\r\n }\r\n });\r\n }\r\n\r\n private _collectMesh(mesh: AbstractMesh) {\r\n this.meshes.push(mesh);\r\n\r\n if (mesh.skeleton) {\r\n this.skeletons.add(mesh.skeleton);\r\n }\r\n\r\n if (mesh.morphTargetManager) {\r\n mesh.morphTargetManager.meshName = mesh.name;\r\n mesh.morphTargetManager.numMaxInfluencers = mesh.morphTargetManager.numTargets;\r\n\r\n this.morphTargetManagers.add(mesh.morphTargetManager);\r\n }\r\n }\r\n\r\n /**\r\n * Finds a bone in the avatar's skeletons by its linked transform node or the name of the linked transform node.\r\n * @param nameOrTransformNode The linked transform node or the name of the linked transform node\r\n * @returns The found bone or null if not found\r\n */\r\n public findBoneByTransformNode(nameOrTransformNode: string | TransformNode): Nullable<Bone> {\r\n const isName = !this._isTransformNode(nameOrTransformNode);\r\n const iterator = this.skeletons.keys();\r\n\r\n let bone: Nullable<Bone>;\r\n\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const skeleton = key.value;\r\n\r\n if (isName) {\r\n bone = skeleton.findBoneFromLinkedTransformNodeName(nameOrTransformNode);\r\n } else {\r\n bone = skeleton.findBoneFromLinkedTransformNode(nameOrTransformNode);\r\n }\r\n\r\n if (bone) {\r\n return bone;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Finds a bone in the avatar's skeletons by its name.\r\n * @param name The name of the bone\r\n * @returns The found bone or null if not found\r\n */\r\n public findBoneByName(name: string): Nullable<Bone> {\r\n const iterator = this.skeletons.keys();\r\n\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const skeleton = key.value;\r\n const index = skeleton.getBoneIndexByName(name);\r\n\r\n if (index !== -1) {\r\n return skeleton.bones[index];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Make sures that the animation group passed as the first parameter will animate the bones in the skeleton(s) / the morphs in the morph target manager(s) of the avatar.\r\n * Retargeting is based on the names of the targets (TransformNode or MorphTarget) in the animation and the names of the bones in the skeleton / morph targets in the morph target manager.\r\n * Note that you can use the mapNodeNames option to specify a mapping between source transform node names and target bone names in case they are different.\r\n * If no bones with the same name as a target (TransformNode) of a targeted animation are found, the targeted animation is removed from the animation group.\r\n * Same for morph targets.\r\n * Note that for the time being, we only support a source animation group which animates transform nodes, not bones!\r\n * That's typically the case when the source animation group is created from a glTF file, as glTF animations always target transform nodes.\r\n * @param sourceAnimationGroup The animation group to retarget\r\n * @param options Options for retargeting the animation group (optional)\r\n * @returns The retargeted (new) animation group\r\n */\r\n public retargetAnimationGroup(sourceAnimationGroup: AnimationGroup, options?: IRetargetOptions): AnimationGroup {\r\n const localOptions: IRetargetOptions = {\r\n animationGroupName: sourceAnimationGroup.name,\r\n fixAnimations: false,\r\n checkHierarchy: false,\r\n retargetAnimationKeys: true,\r\n fixGroundReference: false,\r\n fixGroundReferenceDynamicRefNode: false,\r\n fixRootPosition: true,\r\n ...options,\r\n };\r\n\r\n // Make sure that all world matrices are up to date, both in the bone hierarchy and in the animation transform node hierarchy\r\n this._computeBoneWorldMatrices();\r\n\r\n const mapNodeNames = localOptions.mapNodeNames ?? new Map();\r\n const lstSourceTransformNodes = new Set<TransformNode>();\r\n const sourceTransformNodeNameToNode: TransformNodeNameToNode = new Map();\r\n\r\n for (let i = 0; i < sourceAnimationGroup.targetedAnimations.length; ++i) {\r\n const ta = sourceAnimationGroup.targetedAnimations[i];\r\n if (ta.target.getClassName?.() === \"TransformNode\" && !lstSourceTransformNodes.has(ta.target)) {\r\n const tn = ta.target as TransformNode;\r\n\r\n lstSourceTransformNodes.add(tn);\r\n\r\n sourceTransformNodeNameToNode.set(mapNodeNames.get(tn.name) ?? tn.name, {\r\n node: tn,\r\n initialTransformations: {\r\n position: tn.position.clone(),\r\n scaling: tn.scaling.clone(),\r\n quaternion: tn.rotationQuaternion?.clone(),\r\n rotation: tn.rotation.clone(),\r\n },\r\n });\r\n\r\n if (!tn.rotationQuaternion) {\r\n tn.rotationQuaternion = Quaternion.FromEulerAngles(tn.rotation.x, tn.rotation.y, tn.rotation.z);\r\n tn.rotation.setAll(0);\r\n }\r\n }\r\n }\r\n\r\n lstSourceTransformNodes.forEach((node) => {\r\n node.computeWorldMatrix(true);\r\n });\r\n\r\n // Clone the source animation and retarget it\r\n const animationGroup = sourceAnimationGroup.clone(localOptions.animationGroupName!, undefined, true, true);\r\n\r\n const mapTransformNodeToRootNode: Map<TransformNode, Node> = new Map<TransformNode, Node>();\r\n const lstAnims = new Set<Animation>();\r\n\r\n for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {\r\n const ta = animationGroup.targetedAnimations[i];\r\n const animation = ta.animation;\r\n\r\n if (lstAnims.has(animation)) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': animation '${animation.name}' is used multiple times in the same animation group: duplicated animations are not supported, the retargeted animation may not work as expected.`\r\n );\r\n }\r\n }\r\n\r\n lstAnims.add(animation);\r\n\r\n switch (animation.targetProperty) {\r\n case \"influence\": {\r\n if (!this._retargetMorphTarget(ta, animationGroup.name)) {\r\n animationGroup.targetedAnimations.splice(i, 1);\r\n i--;\r\n }\r\n break;\r\n }\r\n case \"position\":\r\n case \"rotationQuaternion\":\r\n case \"scaling\": {\r\n if (ta.target.getClassName?.() !== \"TransformNode\") {\r\n break;\r\n }\r\n\r\n const sourceTransformNode = ta.target as TransformNode;\r\n const sourceTransformNodeName = mapNodeNames.get(sourceTransformNode.name) ?? sourceTransformNode.name;\r\n let targetBone = this.findBoneByTransformNode(sourceTransformNodeName);\r\n\r\n if (!targetBone) {\r\n targetBone = this.findBoneByName(sourceTransformNodeName);\r\n }\r\n\r\n if (!targetBone) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': \"${sourceTransformNodeName}\" bone not found in any skeleton of avatar: animation removed.`\r\n );\r\n }\r\n animationGroup.targetedAnimations.splice(i, 1);\r\n i--;\r\n break;\r\n }\r\n\r\n if (\r\n !this._retargetTransformNodeToBone(\r\n ta,\r\n sourceTransformNode,\r\n targetBone,\r\n animationGroup.name,\r\n mapTransformNodeToRootNode,\r\n mapNodeNames,\r\n !!localOptions.checkHierarchy\r\n )\r\n ) {\r\n animationGroup.targetedAnimations.splice(i, 1);\r\n i--;\r\n } else if (localOptions.retargetAnimationKeys) {\r\n this._retargetAnimationKeys(ta.animation, sourceTransformNode, targetBone);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (localOptions.fixAnimations) {\r\n this._fixAnimationGroup(animationGroup);\r\n }\r\n\r\n if (localOptions.fixGroundReference || localOptions.fixRootPosition) {\r\n const msg =\r\n localOptions.fixGroundReference && localOptions.fixRootPosition\r\n ? \"Ground reference and root position fixing processes skipped.\"\r\n : localOptions.fixGroundReference\r\n ? \"Ground reference fixing process skipped.\"\r\n : \"Root position fixing process skipped.\";\r\n\r\n const res = this._findVerticalAxis(\r\n msg,\r\n animationGroup,\r\n mapNodeNames.get(localOptions.rootNodeName) ?? localOptions.rootNodeName,\r\n sourceTransformNodeNameToNode,\r\n mapNodeNames.get(localOptions.groundReferenceNodeName) ?? localOptions.groundReferenceNodeName,\r\n localOptions.groundReferenceVerticalAxis\r\n );\r\n\r\n if (res) {\r\n const {\r\n verticalAxis,\r\n sourceRootTransformNode,\r\n targetRootTransformNodeOrBone,\r\n targetRootPositionAnimation,\r\n sourceGroundReferenceTransformNode,\r\n targetGroundReferenceTransformNodeOrBone,\r\n proportionRatio,\r\n } = res;\r\n\r\n if (localOptions.fixRootPosition) {\r\n this._fixRootPosition(\r\n sourceAnimationGroup,\r\n animationGroup,\r\n sourceRootTransformNode,\r\n targetRootTransformNodeOrBone,\r\n targetRootPositionAnimation,\r\n proportionRatio\r\n );\r\n this._resetStates(sourceTransformNodeNameToNode);\r\n }\r\n\r\n const fixGroundReferenceDynamicRefNode = !!localOptions.fixGroundReferenceDynamicRefNode;\r\n\r\n if (localOptions.fixGroundReference) {\r\n this._fixGroundReference(\r\n sourceAnimationGroup,\r\n animationGroup,\r\n verticalAxis,\r\n targetRootTransformNodeOrBone,\r\n targetRootPositionAnimation,\r\n sourceGroundReferenceTransformNode,\r\n targetGroundReferenceTransformNodeOrBone,\r\n lstSourceTransformNodes,\r\n mapNodeNames,\r\n fixGroundReferenceDynamicRefNode\r\n );\r\n this._resetStates(sourceTransformNodeNameToNode);\r\n } else if (fixGroundReferenceDynamicRefNode) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': fixGroundReferenceDynamicRefNode option is set to true but fixGroundReference is false: dynamic ground reference node fixing process skipped.`\r\n );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Disposes of the avatar and releases all associated resources.\r\n * This will dispose all skeletons, morph target managers, and the root mesh with its descendants (including materials and textures).\r\n * If disposeResources was set to false in the constructor, this method does nothing.\r\n */\r\n public dispose(): void {\r\n if (!this._disposeResources) {\r\n return;\r\n }\r\n\r\n const iterator = this.skeletons.keys();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n key.value.dispose();\r\n }\r\n\r\n const iterator2 = this.morphTargetManagers.keys();\r\n for (let key = iterator2.next(); key.done !== true; key = iterator2.next()) {\r\n key.value.dispose();\r\n }\r\n\r\n this.rootNode?.dispose(false, true);\r\n }\r\n\r\n private _computeBoneWorldMatrices() {\r\n this.skeletons.forEach((skeleton) => {\r\n skeleton.returnToRest();\r\n skeleton.prepare(true);\r\n\r\n skeleton.bones.forEach((bone) => {\r\n bone._linkedTransformNode?.computeWorldMatrix(true);\r\n });\r\n });\r\n }\r\n\r\n private _isTransformNode(nameOrTransformNode: string | TransformNode): nameOrTransformNode is TransformNode {\r\n return typeof nameOrTransformNode !== \"string\";\r\n }\r\n\r\n private _buildMorphTargetMap(): void {\r\n this._mapMorphTargetNameToMorphTarget = new Map<string, MorphTarget>();\r\n\r\n this.morphTargetManagers.forEach((manager) => {\r\n const numTargets = manager.numTargets;\r\n\r\n for (let t = 0; t < numTargets; ++t) {\r\n const target = manager.getTarget(t);\r\n const key = manager.meshName + \"_\" + target.name;\r\n\r\n this._mapMorphTargetNameToMorphTarget.set(key, target);\r\n }\r\n });\r\n }\r\n\r\n private _retargetMorphTarget(ta: TargetedAnimation, animationGroupName: string) {\r\n const morphTarget = ta.target as MorphTarget;\r\n const key = morphTarget.morphTargetManager?.meshName + \"_\" + morphTarget.name;\r\n\r\n if (!this.mapMorphTargetNameToMorphTarget.has(key)) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroupName}': \"${morphTarget.name}\" morph target not found in morph target manager of mesh \"${morphTarget.morphTargetManager?.meshName}\": animation removed`\r\n );\r\n }\r\n return false;\r\n }\r\n\r\n ta.target = this.mapMorphTargetNameToMorphTarget.get(key)!;\r\n\r\n return true;\r\n }\r\n\r\n private _retargetTransformNodeToBone(\r\n ta: TargetedAnimation,\r\n sourceTransformNode: TransformNode,\r\n targetBone: Bone,\r\n animationGroupName: string,\r\n mapTransformNodeToRootNode: Map<TransformNode, Node>,\r\n mapNodeNames: Map<string, string>,\r\n checkHierarchy: boolean\r\n ) {\r\n if (checkHierarchy) {\r\n let rootNode = mapTransformNodeToRootNode.get(sourceTransformNode);\r\n\r\n if (!rootNode) {\r\n rootNode = this._getRootNode(sourceTransformNode);\r\n mapTransformNodeToRootNode.set(sourceTransformNode, rootNode);\r\n }\r\n\r\n if (!this._checkParentHierarchy(targetBone, rootNode!, mapNodeNames)) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroupName}': parent hierarchy mismatch between bone \"${targetBone._linkedTransformNode?.name ?? targetBone.name}\" and transform node \"${sourceTransformNode.name}\": animation removed`\r\n );\r\n }\r\n return false;\r\n }\r\n }\r\n\r\n ta.target = targetBone._linkedTransformNode ?? targetBone;\r\n\r\n return true;\r\n }\r\n\r\n private _retargetAnimationKeys(animation: Animation, sourceTransformNode: TransformNode, targetBone: Bone) {\r\n const keys = animation.getKeys();\r\n const targetTransformNode = targetBone._linkedTransformNode;\r\n\r\n let targetWorldMatrix: Matrix;\r\n let targetParentWorldMatrix: DeepImmutableObject<Matrix>;\r\n\r\n if (targetTransformNode) {\r\n targetWorldMatrix = targetTransformNode.getWorldMatrix();\r\n targetParentWorldMatrix = targetTransformNode.parent ? targetTransformNode.parent.getWorldMatrix() : Matrix.IdentityReadOnly;\r\n } else {\r\n targetWorldMatrix = targetBone.getFinalMatrix();\r\n targetParentWorldMatrix = targetBone.parent ? targetBone.parent.getFinalMatrix() : Matrix.IdentityReadOnly;\r\n }\r\n\r\n const targetParentInverseWorldMatrix = targetParentWorldMatrix.invertToRef(TmpVectors.Matrix[0]);\r\n\r\n const sourceInverseWorld = sourceTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[1]);\r\n const sourceParentWorld = sourceTransformNode.parent ? sourceTransformNode.parent.getWorldMatrix() : Matrix.IdentityReadOnly;\r\n\r\n switch (animation.targetProperty) {\r\n case \"rotationQuaternion\": {\r\n for (const key of keys) {\r\n const quaternion = key.value as Quaternion;\r\n\r\n const localMat = Matrix.ComposeToRef(sourceTransformNode.scaling, quaternion, sourceTransformNode.position, TmpVectors.Matrix[2]);\r\n\r\n sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);\r\n targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(undefined, quaternion, undefined);\r\n }\r\n break;\r\n }\r\n case \"position\": {\r\n for (const key of keys) {\r\n const position = key.value as Vector3;\r\n\r\n const localMat = Matrix.ComposeToRef(sourceTransformNode.scaling, sourceTransformNode.rotationQuaternion!, position, TmpVectors.Matrix[2]);\r\n\r\n sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);\r\n targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(undefined, undefined, position);\r\n }\r\n break;\r\n }\r\n case \"scaling\": {\r\n for (const key of keys) {\r\n const scaling = key.value as Vector3;\r\n\r\n const localMat = Matrix.ComposeToRef(scaling, sourceTransformNode.rotationQuaternion!, sourceTransformNode.position, TmpVectors.Matrix[2]);\r\n\r\n sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);\r\n targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(scaling, undefined, undefined);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * This method corrects quaternion animations when two consecutive quaternions are orthogonal to each other. When this happens, in 99.99% of\r\n * cases it's an error in the animation data, as two consecutive rotations should normally be close to each other and not have a large gap.\r\n * The fix is to copy the first quaternion into the second.\r\n * @param animationGroup The animation group to fix\r\n * @internal\r\n */\r\n private _fixAnimationGroup(animationGroup: AnimationGroup) {\r\n for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {\r\n const ta = animationGroup.targetedAnimations[i];\r\n\r\n switch (ta.animation.targetProperty) {\r\n case \"rotationQuaternion\": {\r\n const keys = ta.animation.getKeys();\r\n\r\n for (let i = 0; i < keys.length - 1; ++i) {\r\n const curQuat = keys[i].value as Quaternion;\r\n const nextQuat = keys[i + 1].value as Quaternion;\r\n\r\n if (Math.abs(Quaternion.Dot(curQuat, nextQuat)) < 0.001) {\r\n keys[i + 1].value = curQuat.clone();\r\n i += 1;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _getRootNode(node: Node): Node {\r\n let current: Node = node;\r\n\r\n while (current.parent) {\r\n current = current.parent;\r\n }\r\n\r\n return current;\r\n }\r\n\r\n /**\r\n * Checks whether the parent hierarchy of a bone matches that of a given transform node. Checks are performed by name.\r\n * It works by first finding the transform node in the descendants of the root transform node that matches the bone's linked transform node.\r\n * Then it traverses up the hierarchy of both the bone and the transform node, comparing their names at each level.\r\n * @param bone The bone to check\r\n * @param rootTransformNode The root transform node to check against\r\n * @returns True if the hierarchies match, false otherwise\r\n * @internal\r\n */\r\n private _checkParentHierarchy(bone: Bone, rootTransformNode: Node, mapNodeNames: Map<string, string>) {\r\n const children = rootTransformNode.getDescendants(false, (node) => (mapNodeNames.get(node.name) ?? node.name) === (bone._linkedTransformNode?.name ?? bone.name));\r\n if (!children || children.length !== 1) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', CheckParentHierarchy: unable to find a corresponding transform node to bone name \"${bone._linkedTransformNode?.name ?? bone.name}\" in the source animation.`\r\n );\r\n }\r\n return false;\r\n }\r\n\r\n let transformNode: Nullable<Node> = children[0];\r\n\r\n while (bone) {\r\n const name = mapNodeNames.get(transformNode?.name ?? \"\") ?? transformNode?.name;\r\n const boneName = bone._linkedTransformNode?.name ?? bone.name;\r\n if (boneName !== name) {\r\n if (this.showWarnings) {\r\n Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', CheckParentHierarchy: bone name \"${boneName}\" is different from transform node name \"${name}\".`);\r\n }\r\n return false;\r\n }\r\n\r\n bone = bone.parent;\r\n transformNode = transformNode!.parent;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _getRootNodeName(rootNodeName: string | undefined, transformNodeNameToNode: TransformNodeNameToNode) {\r\n if (rootNodeName) {\r\n return rootNodeName;\r\n }\r\n\r\n // Look for the first bone that doesn't have a parent\r\n const iterator = this.skeletons.keys();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const skeleton = key.value;\r\n\r\n for (const bone of skeleton.bones) {\r\n if (!bone.parent) {\r\n // Make sure there's a transform node with that name in the source animation\r\n if (transformNodeNameToNode.get(bone.name)) {\r\n return bone.name;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return;\r\n }\r\n\r\n private _findVerticalAxis(\r\n msg: string,\r\n animationGroup: AnimationGroup,\r\n remappedRootNodeName: string | undefined,\r\n sourceTransformNodeNameToNode: TransformNodeNameToNode,\r\n remappedGroundReferenceNodeName?: string,\r\n groundReferenceVerticalAxis?: string\r\n ) {\r\n if (!remappedGroundReferenceNodeName) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': you must provide the name of the ground reference node (option parameter \"groundReferenceNodeName\"). ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n remappedRootNodeName = this._getRootNodeName(remappedRootNodeName, sourceTransformNodeNameToNode);\r\n\r\n if (!remappedRootNodeName) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find a suitable root node in the source animation. You should provide its name through the \"rootNodeName\" optional parameter. ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n const sourceRootTransformNode = sourceTransformNodeNameToNode.get(remappedRootNodeName)?.node;\r\n const sourceGroundReferenceTransformNode = sourceTransformNodeNameToNode.get(remappedGroundReferenceNodeName)?.node;\r\n\r\n if (!sourceRootTransformNode) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the transform node corresponding to \"${remappedRootNodeName}\" in the source animation. This transform node either doesn't exist or is not animated. ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n if (!sourceGroundReferenceTransformNode) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the transform node corresponding to \"${remappedGroundReferenceNodeName}\" in the source animation. This transform node either doesn't exist or is not animated. ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n // Look for the position animation + target node of the root node name (generally the hips) in the retargeted animation\r\n let targetRootPositionAnimation: Animation | undefined;\r\n let targetRootTransformNodeOrBone: TransformNode | Bone | undefined;\r\n\r\n for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {\r\n const ta = animationGroup.targetedAnimations[i];\r\n const target = ta.target;\r\n const animation = ta.animation;\r\n\r\n if (target.name === remappedRootNodeName && animation.targetProperty === \"position\") {\r\n targetRootPositionAnimation = animation;\r\n targetRootTransformNodeOrBone = ta.target;\r\n break;\r\n }\r\n }\r\n\r\n if (!targetRootPositionAnimation || !targetRootTransformNodeOrBone) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find a \"position\" animation for the node \"${remappedRootNodeName}\". ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n let targetGroundReferenceTransformNodeOrBone: Nullable<TransformNode | Bone>;\r\n\r\n if (targetRootTransformNodeOrBone instanceof TransformNode) {\r\n targetGroundReferenceTransformNodeOrBone = this.findBoneByTransformNode(remappedGroundReferenceNodeName)?._linkedTransformNode!;\r\n } else {\r\n targetGroundReferenceTransformNodeOrBone = this.findBoneByName(remappedGroundReferenceNodeName);\r\n }\r\n\r\n if (!targetGroundReferenceTransformNodeOrBone) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the bone/transform node corresponding with name \"${remappedGroundReferenceNodeName}\" in the avatar skeleton. Ensure that this bone exists. ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n sourceRootTransformNode.computeWorldMatrix(true);\r\n sourceGroundReferenceTransformNode.computeWorldMatrix(true);\r\n\r\n // Determine the vertical axis\r\n const sourceRootGroundReferenceDiff = sourceRootTransformNode.getAbsolutePosition().subtract(sourceGroundReferenceTransformNode.getAbsolutePosition());\r\n\r\n let verticalAxis = 0;\r\n\r\n if (groundReferenceVerticalAxis) {\r\n switch (groundReferenceVerticalAxis) {\r\n case \"Y\":\r\n verticalAxis = 1;\r\n break;\r\n case \"Z\":\r\n verticalAxis = 2;\r\n break;\r\n }\r\n } else {\r\n // No axis provided: assume the vertical axis is the one with the larger difference between the reference and the ground reference transform nodes\r\n if (Math.abs(sourceRootGroundReferenceDiff.y) > Math.abs(sourceRootGroundReferenceDiff.x)) {\r\n verticalAxis = 1;\r\n }\r\n if (Math.abs(sourceRootGroundReferenceDiff.z) > Math.abs(sourceRootGroundReferenceDiff.y)) {\r\n verticalAxis = 2;\r\n }\r\n }\r\n\r\n const targetRootGroundReferenceDiff = targetRootTransformNodeOrBone.getAbsolutePosition().subtract(targetGroundReferenceTransformNodeOrBone.getAbsolutePosition());\r\n\r\n return {\r\n verticalAxis,\r\n sourceRootTransformNode,\r\n sourceGroundReferenceTransformNode,\r\n targetRootTransformNodeOrBone,\r\n targetRootPositionAnimation,\r\n targetGroundReferenceTransformNodeOrBone,\r\n proportionRatio:\r\n verticalAxis === 0\r\n ? targetRootGroundReferenceDiff.x / sourceRootGroundReferenceDiff.x\r\n : verticalAxis === 1\r\n ? targetRootGroundReferenceDiff.y / sourceRootGroundReferenceDiff.y\r\n : targetRootGroundReferenceDiff.z / sourceRootGroundReferenceDiff.z,\r\n };\r\n }\r\n\r\n private _resetStates(sourceTransformNodeNameToNode: TransformNodeNameToNode) {\r\n this.skeletons.forEach((skeleton) => skeleton.returnToRest());\r\n\r\n sourceTransformNodeNameToNode.forEach((data) => {\r\n const { node, initialTransformations } = data;\r\n node.position.copyFrom(initialTransformations.position);\r\n node.scaling.copyFrom(initialTransformations.scaling);\r\n if (initialTransformations.quaternion) {\r\n node.rotationQuaternion!.copyFrom(initialTransformations.quaternion);\r\n } else {\r\n node.rotation.copyFrom(initialTransformations.rotation);\r\n }\r\n node.computeWorldMatrix(true);\r\n });\r\n }\r\n\r\n private _fixRootPosition(\r\n sourceAnimationGroup: AnimationGroup,\r\n animationGroup: AnimationGroup,\r\n sourceRootTransformNode: TransformNode,\r\n targetRootTransformNodeOrBone: TransformNode | Bone,\r\n targetRootPositionAnimation: Animation,\r\n proportionRatio: number\r\n ) {\r\n const targetNodeInverseParentWorldMatrix =\r\n targetRootTransformNodeOrBone instanceof TransformNode\r\n ? (targetRootTransformNodeOrBone.parent?.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly)\r\n : (targetRootTransformNodeOrBone.parent?.getFinalMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly);\r\n\r\n sourceRootTransformNode.computeWorldMatrix(true);\r\n targetRootTransformNodeOrBone.computeWorldMatrix(true);\r\n\r\n const sourceWorldPosition = sourceRootTransformNode.absolutePosition.clone();\r\n const targetWorldPosition = targetRootTransformNodeOrBone.getAbsolutePosition().clone();\r\n\r\n sourceAnimationGroup.play(false);\r\n animationGroup.play(false);\r\n\r\n // Loop over the position animation of the root transform node\r\n for (const key of targetRootPositionAnimation.getKeys()) {\r\n const frame = key.frame;\r\n\r\n // Advance the source and retargeted animations to this frame\r\n sourceAnimationGroup.goToFrame(frame);\r\n sourceAnimationGroup.pause();\r\n\r\n animationGroup.goToFrame(frame);\r\n animationGroup.pause();\r\n\r\n sourceRootTransformNode.computeWorldMatrix(true);\r\n\r\n const offset = sourceRootTransformNode.absolutePosition.subtractToRef(sourceWorldPosition, TmpVectors.Vector3[0]);\r\n\r\n offset.scaleInPlace(proportionRatio);\r\n offset.addInPlace(targetWorldPosition);\r\n\r\n Vector3.TransformNormalToRef(offset, targetNodeInverseParentWorldMatrix, key.value);\r\n }\r\n\r\n sourceAnimationGroup.stop();\r\n animationGroup.stop();\r\n }\r\n\r\n private _fixGroundReference(\r\n sourceAnimationGroup: AnimationGroup,\r\n animationGroup: AnimationGroup,\r\n verticalAxis: number,\r\n targetRootTransformNodeOrBone: TransformNode | Bone,\r\n targetRootPositionAnimation: Animation,\r\n sourceGroundReferenceTransformNode: TransformNode,\r\n targetGroundReferenceTransformNodeOrBone: TransformNode | Bone,\r\n sourceListTransformNodes: Set<TransformNode>,\r\n mapNodeNames: Map<string, string>,\r\n fixGroundReferenceDynamicRefNode: boolean\r\n ) {\r\n const targetNodeInverseParentWorldMatrix =\r\n targetRootTransformNodeOrBone instanceof TransformNode\r\n ? (targetRootTransformNodeOrBone.parent?.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly)\r\n : (targetRootTransformNodeOrBone.parent?.getFinalMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly);\r\n\r\n sourceAnimationGroup.play(false);\r\n animationGroup.play(false);\r\n\r\n // Loop over the position animation of the root transform node\r\n for (const key of targetRootPositionAnimation.getKeys()) {\r\n const frame = key.frame;\r\n\r\n // Advance the source and retargeted animations to this frame\r\n sourceAnimationGroup.goToFrame(frame);\r\n sourceAnimationGroup.pause();\r\n\r\n animationGroup.goToFrame(frame);\r\n animationGroup.pause();\r\n\r\n sourceGroundReferenceTransformNode.computeWorldMatrix(true);\r\n targetGroundReferenceTransformNodeOrBone.computeWorldMatrix(true);\r\n\r\n // Calculate the offset to apply to the root position in the target to have the ground reference at the same height in the source and target animations\r\n const diffGroundReferences = targetGroundReferenceTransformNodeOrBone\r\n .getAbsolutePosition()\r\n .subtractToRef(sourceGroundReferenceTransformNode.absolutePosition, TmpVectors.Vector3[0]);\r\n\r\n let groundReferenceOffset = verticalAxis === 0 ? diffGroundReferences.x : verticalAxis === 1 ? diffGroundReferences.y : diffGroundReferences.z;\r\n\r\n if (fixGroundReferenceDynamicRefNode) {\r\n // Try to find a bone in this frame that has a greater offset than the ground reference, to use it instead of the ground reference.\r\n const targetRootToGroundReferenceDiff = targetRootTransformNodeOrBone\r\n .getAbsolutePosition()\r\n .subtractToRef(targetGroundReferenceTransformNodeOrBone.getAbsolutePosition(), TmpVectors.Vector3[0]);\r\n\r\n const targetRootToGroundReferenceOffset =\r\n verticalAxis === 0 ? targetRootToGroundReferenceDiff.x : verticalAxis === 1 ? targetRootToGroundReferenceDiff.y : targetRootToGroundReferenceDiff.z;\r\n\r\n const iterator = sourceListTransformNodes.keys();\r\n\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const sourceTransformNode = key.value;\r\n if (sourceTransformNode === sourceGroundReferenceTransformNode) {\r\n continue;\r\n }\r\n\r\n const targetNodeName = mapNodeNames.get(sourceTransformNode.name) ?? sourceTransformNode.name;\r\n\r\n let targetBone = this.findBoneByTransformNode(targetNodeName);\r\n if (!targetBone) {\r\n targetBone = this.findBoneByName(targetNodeName);\r\n }\r\n if (!targetBone) {\r\n continue;\r\n }\r\n\r\n sourceTransformNode.computeWorldMatrix();\r\n targetBone.computeWorldMatrix();\r\n\r\n const targetBoneWorldPosition = targetBone._linkedTransformNode?.getAbsolutePosition() ?? targetBone.getAbsolutePosition();\r\n const targetRootToBoneDiff = targetRootTransformNodeOrBone.getAbsolutePosition().subtractToRef(targetBoneWorldPosition, TmpVectors.Vector3[0]);\r\n const rootToBoneOffset = verticalAxis === 0 ? targetRootToBoneDiff.x : verticalAxis === 1 ? targetRootToBoneDiff.y : targetRootToBoneDiff.z;\r\n\r\n if (Math.abs(rootToBoneOffset) > Math.abs(targetRootToGroundReferenceOffset) && Math.sign(rootToBoneOffset) === Math.sign(targetRootToGroundReferenceOffset)) {\r\n const diff = targetBoneWorldPosition.subtractToRef(sourceTransformNode.getAbsolutePosition(), TmpVectors.Vector3[0]);\r\n const offset = verticalAxis === 0 ? diff.x : verticalAxis === 1 ? diff.y : diff.z;\r\n\r\n groundReferenceOffset = offset;\r\n }\r\n }\r\n }\r\n\r\n const localOffset = Vector3.TransformNormalToRef(\r\n new Vector3(verticalAxis === 0 ? groundReferenceOffset : 0, verticalAxis === 1 ? groundReferenceOffset : 0, verticalAxis === 2 ? groundReferenceOffset : 0),\r\n targetNodeInverseParentWorldMatrix,\r\n TmpVectors.Vector3[1]\r\n );\r\n\r\n key.value.subtractInPlace(localOffset);\r\n }\r\n\r\n sourceAnimationGroup.stop();\r\n animationGroup.stop();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"animatorAvatar.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/animatorAvatar.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAyFtD;;;GAGG;AACH,MAAM,OAAO,cAAc;IAkBvB;;;OAGG;IACH,IAAW,+BAA+B;QACtC,IAAI,CAAC,IAAI,CAAC,gCAAgC,EAAE,CAAC;YACzC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,CAAC,gCAAgC,CAAC;IACjD,CAAC;IAOD;;;;;;OAMG;IACH,YACoB,IAAY,EACZ,QAAwB,EAChC,oBAAoB,IAAI,EAChC,aAAa,GAAG,IAAI;QAHJ,SAAI,GAAJ,IAAI,CAAQ;QACZ,aAAQ,GAAR,QAAQ,CAAgB;QAChC,sBAAiB,GAAjB,iBAAiB,CAAO;QAfpC;;WAEG;QACI,iBAAY,GAAG,IAAI,CAAC;QAevB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAY,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAsB,CAAC;QAEzD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO;QACX,CAAC;QA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CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3J,kCAAkC,EAClC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CACxB,CAAC;YAEF,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC;QAED,oBAAoB,CAAC,IAAI,EAAE,CAAC;QAC5B,cAAc,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import {\r\n type MorphTargetManager,\r\n type Immutable,\r\n type Bone,\r\n type Nullable,\r\n type MorphTarget,\r\n type AnimationGroup,\r\n type Animation,\r\n type Node,\r\n type Skeleton,\r\n type TargetedAnimation,\r\n type DeepImmutableObject,\r\n} from \"core/index\";\r\nimport { Vector3, Quaternion, TmpVectors, Matrix } from \"core/Maths/math.vector\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Options for retargeting an animation group to an avatar.\r\n */\r\nexport interface IRetargetOptions {\r\n /**\r\n * The name to assign to the (cloned) retargeted animation group.\r\n * If not specified, the same name as the original animation group will be used.\r\n */\r\n animationGroupName?: string;\r\n\r\n /**\r\n * If true, the retargeted animations will be fixed to correct common issues like orthogonal quaternions.\r\n * Default is false.\r\n */\r\n fixAnimations?: boolean;\r\n\r\n /**\r\n * If true, the parent hierarchy of bones and transform nodes will be checked during retargeting.\r\n * Animations will be removed if the hierarchies don't match.\r\n * Default is false.\r\n */\r\n checkHierarchy?: boolean;\r\n\r\n /**\r\n * If true, the frame values in the animation keyframes will be adjusted during retargeting to account for differences\r\n * between the source and target bone transforms.\r\n * Default is true.\r\n */\r\n retargetAnimationKeys?: boolean;\r\n\r\n /**\r\n * If true, scales and adjusts the root position animation to account for size differences between the source and target avatars.\r\n * This helps maintain the relative motion of the character when retargeting between avatars of different proportions.\r\n * Default is true.\r\n */\r\n fixRootPosition?: boolean;\r\n\r\n /**\r\n * If true, adjusts the root position animation to correct for ground reference height differences between the source and target avatars.\r\n * This ensures that the animated character maintains proper contact with the ground during retargeting.\r\n * Requires groundReferenceNodeName to be specified to determine the ground reference point in the source animation.\r\n * Default is false.\r\n */\r\n fixGroundReference?: boolean;\r\n\r\n /**\r\n * If true, adjusts the ground reference dynamically during retargeting. fixGroundReference must be true for this to work.\r\n * When enabled, the system will continuously adjust the ground reference point throughout the retargeting process to make sure it's the lowest point of the character.\r\n * This allows for more accurate ground contact correction, especially in animations where groundReferenceNodeName is not always the lowest point (e.g., walking, running).\r\n * Default is false.\r\n */\r\n fixGroundReferenceDynamicRefNode?: boolean;\r\n\r\n /**\r\n * The name of the root transform node in the source animation group (typically \"Hips\" or similar).\r\n * If not specified, the system will attempt to automatically find the first bone without a parent.\r\n * This bone is used as a reference point for fixing root position during retargeting.\r\n * It's also used by the ground reference fixing processing.\r\n */\r\n rootNodeName?: string;\r\n\r\n /**\r\n * The name of the transform node in the source animation group used as a ground reference point (typically a foot bone like \"LeftFoot\" or \"RightFoot\").\r\n * This bone is used to determine the vertical offset needed to maintain proper ground contact during retargeting.\r\n * Required when fixGroundReference or fixRootPosition is enabled.\r\n */\r\n groundReferenceNodeName?: string;\r\n\r\n /**\r\n * Specifies which axis represents the vertical/up direction in the animation space.\r\n * Use \"X\", \"Y\", or \"Z\" to explicitly set the vertical axis, or \"\" (empty string) / undefined to auto-detect.\r\n * If not specified or empty, the system will automatically determine the vertical axis based on the difference\r\n * between the root node and ground reference node positions.\r\n * Default is undefined (auto-detect).\r\n */\r\n groundReferenceVerticalAxis?: \"\" | \"X\" | \"Y\" | \"Z\";\r\n\r\n /**\r\n * A map for renaming nodes during retargeting when the source transform node hierarchy and target skeleton use different naming conventions.\r\n * The map keys are the original node names from the source animation group, and the values are the corresponding\r\n * node names in the target skeleton. This is useful when bone names don't match between avatars.\r\n */\r\n mapNodeNames?: Map<string, string>;\r\n}\r\n\r\ntype TransformNodeNameToNode = Map<string, { node: TransformNode; initialTransformations: { position: Vector3; scaling: Vector3; quaternion?: Quaternion; rotation: Vector3 } }>;\r\n\r\n/**\r\n * Represents an animator avatar that manages meshes, skeletons and morph target managers for a hierarchical transform node and mesh structure.\r\n * This class is used to group and manage animation-related resources (meshes, skeletons and morph targets) associated with a root transform node and its descendants.\r\n */\r\nexport class AnimatorAvatar {\r\n /**\r\n * List of meshes found in the hierarchy of the root node. Only meshes with at least one vertex are included.\r\n */\r\n public meshes: AbstractMesh[];\r\n\r\n /**\r\n * Set of skeletons found in the mesh hierarchy.\r\n */\r\n public skeletons: Set<Skeleton>;\r\n\r\n /**\r\n * Set of morph target managers found in the mesh hierarchy.\r\n * Each morph target manager is configured with the appropriate mesh name and influencer count.\r\n */\r\n public morphTargetManagers: Set<MorphTargetManager>;\r\n\r\n private _mapMorphTargetNameToMorphTarget: Map<string, MorphTarget>;\r\n /**\r\n * Map of morph target names to their corresponding MorphTarget instances.\r\n * The keys are constructed using the format \"meshName_morphTargetName\".\r\n */\r\n public get mapMorphTargetNameToMorphTarget(): Immutable<Map<string, MorphTarget>> {\r\n if (!this._mapMorphTargetNameToMorphTarget) {\r\n this._buildMorphTargetMap();\r\n }\r\n return this._mapMorphTargetNameToMorphTarget;\r\n }\r\n\r\n /**\r\n * Indicates whether to show warnings during retargeting operations.\r\n */\r\n public showWarnings = true;\r\n\r\n /**\r\n * Creates an instance of AnimatorAvatar.\r\n * @param name - The name to assign to this avatar and its root node\r\n * @param rootNode - The root node of the avatar hierarchy. This node and its descendants will be scanned for meshes, skeletons and morph target managers. If not provided, you are expected to manually manage meshes, skeletons and morph target managers.\r\n * @param _disposeResources - Indicates whether to dispose of resources (meshes, skeletons, morph target managers, root node and descendants + materials and textures) when the avatar is disposed (true by default)\r\n * @param setAvatarName - Indicates whether to set the name of the root node to the avatar name. Default is true. Set this to false if you don't want the root node to be renamed, or if you want to set it to a different name after creating the avatar.\r\n */\r\n constructor(\r\n public readonly name: string,\r\n public readonly rootNode?: TransformNode,\r\n private _disposeResources = true,\r\n setAvatarName = true\r\n ) {\r\n this.meshes = [];\r\n this.skeletons = new Set<Skeleton>();\r\n this.morphTargetManagers = new Set<MorphTargetManager>();\r\n\r\n if (!rootNode) {\r\n return;\r\n }\r\n\r\n if (setAvatarName) {\r\n rootNode.name = name;\r\n }\r\n\r\n if (rootNode instanceof AbstractMesh && rootNode.getTotalVertices() > 0) {\r\n this._collectMesh(rootNode);\r\n }\r\n\r\n rootNode.getChildMeshes(false).forEach((mesh) => {\r\n if (mesh.getTotalVertices() > 0) {\r\n this._collectMesh(mesh);\r\n }\r\n });\r\n }\r\n\r\n private _collectMesh(mesh: AbstractMesh) {\r\n this.meshes.push(mesh);\r\n\r\n if (mesh.skeleton) {\r\n this.skeletons.add(mesh.skeleton);\r\n }\r\n\r\n if (mesh.morphTargetManager) {\r\n mesh.morphTargetManager.meshName = mesh.name;\r\n mesh.morphTargetManager.numMaxInfluencers = mesh.morphTargetManager.numTargets;\r\n\r\n this.morphTargetManagers.add(mesh.morphTargetManager);\r\n }\r\n }\r\n\r\n /**\r\n * Finds a bone in the avatar's skeletons by its linked transform node or the name of the linked transform node.\r\n * @param nameOrTransformNode The linked transform node or the name of the linked transform node\r\n * @returns The found bone or null if not found\r\n */\r\n public findBoneByTransformNode(nameOrTransformNode: string | TransformNode): Nullable<Bone> {\r\n const isName = !this._isTransformNode(nameOrTransformNode);\r\n const iterator = this.skeletons.keys();\r\n\r\n let bone: Nullable<Bone>;\r\n\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const skeleton = key.value;\r\n\r\n if (isName) {\r\n bone = skeleton.findBoneFromLinkedTransformNodeName(nameOrTransformNode);\r\n } else {\r\n bone = skeleton.findBoneFromLinkedTransformNode(nameOrTransformNode);\r\n }\r\n\r\n if (bone) {\r\n return bone;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Finds a bone in the avatar's skeletons by its name.\r\n * @param name The name of the bone\r\n * @returns The found bone or null if not found\r\n */\r\n public findBoneByName(name: string): Nullable<Bone> {\r\n const iterator = this.skeletons.keys();\r\n\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const skeleton = key.value;\r\n const index = skeleton.getBoneIndexByName(name);\r\n\r\n if (index !== -1) {\r\n return skeleton.bones[index];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Make sures that the animation group passed as the first parameter will animate the bones in the skeleton(s) / the morphs in the morph target manager(s) of the avatar.\r\n * Retargeting is based on the names of the targets (TransformNode or MorphTarget) in the animation and the names of the bones in the skeleton / morph targets in the morph target manager.\r\n * Note that you can use the mapNodeNames option to specify a mapping between source transform node names and target bone names in case they are different.\r\n * If no bones with the same name as a target (TransformNode) of a targeted animation are found, the targeted animation is removed from the animation group.\r\n * Same for morph targets.\r\n * Note that for the time being, we only support a source animation group which animates transform nodes, not bones!\r\n * That's typically the case when the source animation group is created from a glTF file, as glTF animations always target transform nodes.\r\n * @param sourceAnimationGroup The animation group to retarget\r\n * @param options Options for retargeting the animation group (optional)\r\n * @returns The retargeted (new) animation group\r\n */\r\n public retargetAnimationGroup(sourceAnimationGroup: AnimationGroup, options?: IRetargetOptions): AnimationGroup {\r\n const localOptions: IRetargetOptions = {\r\n animationGroupName: sourceAnimationGroup.name,\r\n fixAnimations: false,\r\n checkHierarchy: false,\r\n retargetAnimationKeys: true,\r\n fixGroundReference: false,\r\n fixGroundReferenceDynamicRefNode: false,\r\n fixRootPosition: true,\r\n ...options,\r\n };\r\n\r\n // Make sure that all world matrices are up to date, both in the bone hierarchy and in the animation transform node hierarchy\r\n this._computeBoneWorldMatrices();\r\n\r\n const mapNodeNames = localOptions.mapNodeNames ?? new Map();\r\n const lstSourceTransformNodes = new Set<TransformNode>();\r\n const sourceTransformNodeNameToNode: TransformNodeNameToNode = new Map();\r\n\r\n for (let i = 0; i < sourceAnimationGroup.targetedAnimations.length; ++i) {\r\n const ta = sourceAnimationGroup.targetedAnimations[i];\r\n if (ta.target.getClassName?.() === \"TransformNode\" && !lstSourceTransformNodes.has(ta.target)) {\r\n const tn = ta.target as TransformNode;\r\n\r\n lstSourceTransformNodes.add(tn);\r\n\r\n sourceTransformNodeNameToNode.set(mapNodeNames.get(tn.name) ?? tn.name, {\r\n node: tn,\r\n initialTransformations: {\r\n position: tn.position.clone(),\r\n scaling: tn.scaling.clone(),\r\n quaternion: tn.rotationQuaternion?.clone(),\r\n rotation: tn.rotation.clone(),\r\n },\r\n });\r\n\r\n if (!tn.rotationQuaternion) {\r\n tn.rotationQuaternion = Quaternion.FromEulerAngles(tn.rotation.x, tn.rotation.y, tn.rotation.z);\r\n tn.rotation.setAll(0);\r\n }\r\n }\r\n }\r\n\r\n lstSourceTransformNodes.forEach((node) => {\r\n node.computeWorldMatrix(true);\r\n });\r\n\r\n // Clone the source animation and retarget it\r\n const animationGroup = sourceAnimationGroup.clone(localOptions.animationGroupName!, undefined, true, true);\r\n\r\n const mapTransformNodeToRootNode: Map<TransformNode, Node> = new Map<TransformNode, Node>();\r\n const lstAnims = new Set<Animation>();\r\n\r\n for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {\r\n const ta = animationGroup.targetedAnimations[i];\r\n const animation = ta.animation;\r\n\r\n if (lstAnims.has(animation)) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': animation '${animation.name}' is used multiple times in the same animation group: duplicated animations are not supported, the retargeted animation may not work as expected.`\r\n );\r\n }\r\n }\r\n\r\n lstAnims.add(animation);\r\n\r\n switch (animation.targetProperty) {\r\n case \"influence\": {\r\n if (!this._retargetMorphTarget(ta, animationGroup.name)) {\r\n animationGroup.targetedAnimations.splice(i, 1);\r\n i--;\r\n }\r\n break;\r\n }\r\n case \"position\":\r\n case \"rotationQuaternion\":\r\n case \"scaling\": {\r\n if (ta.target.getClassName?.() !== \"TransformNode\") {\r\n break;\r\n }\r\n\r\n const sourceTransformNode = ta.target as TransformNode;\r\n const sourceTransformNodeName = mapNodeNames.get(sourceTransformNode.name) ?? sourceTransformNode.name;\r\n let targetBone = this.findBoneByTransformNode(sourceTransformNodeName);\r\n\r\n if (!targetBone) {\r\n targetBone = this.findBoneByName(sourceTransformNodeName);\r\n }\r\n\r\n if (!targetBone) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': \"${sourceTransformNodeName}\" bone not found in any skeleton of avatar: animation removed.`\r\n );\r\n }\r\n animationGroup.targetedAnimations.splice(i, 1);\r\n i--;\r\n break;\r\n }\r\n\r\n if (\r\n !this._retargetTransformNodeToBone(\r\n ta,\r\n sourceTransformNode,\r\n targetBone,\r\n animationGroup.name,\r\n mapTransformNodeToRootNode,\r\n mapNodeNames,\r\n !!localOptions.checkHierarchy\r\n )\r\n ) {\r\n animationGroup.targetedAnimations.splice(i, 1);\r\n i--;\r\n } else if (localOptions.retargetAnimationKeys) {\r\n this._retargetAnimationKeys(ta.animation, sourceTransformNode, targetBone);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (localOptions.fixAnimations) {\r\n this._fixAnimationGroup(animationGroup);\r\n }\r\n\r\n if (localOptions.fixGroundReference || localOptions.fixRootPosition) {\r\n const msg =\r\n localOptions.fixGroundReference && localOptions.fixRootPosition\r\n ? \"Ground reference and root position fixing processes skipped.\"\r\n : localOptions.fixGroundReference\r\n ? \"Ground reference fixing process skipped.\"\r\n : \"Root position fixing process skipped.\";\r\n\r\n const res = this._findVerticalAxis(\r\n msg,\r\n animationGroup,\r\n mapNodeNames.get(localOptions.rootNodeName) ?? localOptions.rootNodeName,\r\n sourceTransformNodeNameToNode,\r\n mapNodeNames.get(localOptions.groundReferenceNodeName) ?? localOptions.groundReferenceNodeName,\r\n localOptions.groundReferenceVerticalAxis\r\n );\r\n\r\n if (res) {\r\n const {\r\n verticalAxis,\r\n sourceRootTransformNode,\r\n targetRootTransformNodeOrBone,\r\n targetRootPositionAnimation,\r\n sourceGroundReferenceTransformNode,\r\n targetGroundReferenceTransformNodeOrBone,\r\n proportionRatio,\r\n } = res;\r\n\r\n if (localOptions.fixRootPosition) {\r\n this._fixRootPosition(\r\n sourceAnimationGroup,\r\n animationGroup,\r\n sourceRootTransformNode,\r\n targetRootTransformNodeOrBone,\r\n targetRootPositionAnimation,\r\n proportionRatio\r\n );\r\n this._resetStates(sourceTransformNodeNameToNode);\r\n }\r\n\r\n const fixGroundReferenceDynamicRefNode = !!localOptions.fixGroundReferenceDynamicRefNode;\r\n\r\n if (localOptions.fixGroundReference) {\r\n this._fixGroundReference(\r\n sourceAnimationGroup,\r\n animationGroup,\r\n verticalAxis,\r\n targetRootTransformNodeOrBone,\r\n targetRootPositionAnimation,\r\n sourceGroundReferenceTransformNode,\r\n targetGroundReferenceTransformNodeOrBone,\r\n lstSourceTransformNodes,\r\n mapNodeNames,\r\n fixGroundReferenceDynamicRefNode\r\n );\r\n this._resetStates(sourceTransformNodeNameToNode);\r\n } else if (fixGroundReferenceDynamicRefNode) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': fixGroundReferenceDynamicRefNode option is set to true but fixGroundReference is false: dynamic ground reference node fixing process skipped.`\r\n );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Disposes of the avatar and releases all associated resources.\r\n * This will dispose all skeletons, morph target managers, and the root mesh with its descendants (including materials and textures).\r\n * If disposeResources was set to false in the constructor, this method does nothing.\r\n */\r\n public dispose(): void {\r\n if (!this._disposeResources) {\r\n return;\r\n }\r\n\r\n const iterator = this.skeletons.keys();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n key.value.dispose();\r\n }\r\n\r\n const iterator2 = this.morphTargetManagers.keys();\r\n for (let key = iterator2.next(); key.done !== true; key = iterator2.next()) {\r\n key.value.dispose();\r\n }\r\n\r\n this.rootNode?.dispose(false, true);\r\n }\r\n\r\n private _computeBoneWorldMatrices() {\r\n this.skeletons.forEach((skeleton) => {\r\n skeleton.returnToRest();\r\n skeleton.prepare(true);\r\n\r\n skeleton.bones.forEach((bone) => {\r\n bone._linkedTransformNode?.computeWorldMatrix(true);\r\n });\r\n });\r\n }\r\n\r\n private _isTransformNode(nameOrTransformNode: string | TransformNode): nameOrTransformNode is TransformNode {\r\n return typeof nameOrTransformNode !== \"string\";\r\n }\r\n\r\n private _buildMorphTargetMap(): void {\r\n this._mapMorphTargetNameToMorphTarget = new Map<string, MorphTarget>();\r\n\r\n this.morphTargetManagers.forEach((manager) => {\r\n const numTargets = manager.numTargets;\r\n\r\n for (let t = 0; t < numTargets; ++t) {\r\n const target = manager.getTarget(t);\r\n const key = manager.meshName + \"_\" + target.name;\r\n\r\n this._mapMorphTargetNameToMorphTarget.set(key, target);\r\n }\r\n });\r\n }\r\n\r\n private _retargetMorphTarget(ta: TargetedAnimation, animationGroupName: string) {\r\n const morphTarget = ta.target as MorphTarget;\r\n const key = morphTarget.morphTargetManager?.meshName + \"_\" + morphTarget.name;\r\n\r\n if (!this.mapMorphTargetNameToMorphTarget.has(key)) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroupName}': \"${morphTarget.name}\" morph target not found in morph target manager of mesh \"${morphTarget.morphTargetManager?.meshName}\": animation removed`\r\n );\r\n }\r\n return false;\r\n }\r\n\r\n ta.target = this.mapMorphTargetNameToMorphTarget.get(key)!;\r\n\r\n return true;\r\n }\r\n\r\n private _retargetTransformNodeToBone(\r\n ta: TargetedAnimation,\r\n sourceTransformNode: TransformNode,\r\n targetBone: Bone,\r\n animationGroupName: string,\r\n mapTransformNodeToRootNode: Map<TransformNode, Node>,\r\n mapNodeNames: Map<string, string>,\r\n checkHierarchy: boolean\r\n ) {\r\n if (checkHierarchy) {\r\n let rootNode = mapTransformNodeToRootNode.get(sourceTransformNode);\r\n\r\n if (!rootNode) {\r\n rootNode = this._getRootNode(sourceTransformNode);\r\n mapTransformNodeToRootNode.set(sourceTransformNode, rootNode);\r\n }\r\n\r\n if (!this._checkParentHierarchy(targetBone, rootNode!, mapNodeNames)) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroupName}': parent hierarchy mismatch between bone \"${targetBone._linkedTransformNode?.name ?? targetBone.name}\" and transform node \"${sourceTransformNode.name}\": animation removed`\r\n );\r\n }\r\n return false;\r\n }\r\n }\r\n\r\n ta.target = targetBone._linkedTransformNode ?? targetBone;\r\n\r\n return true;\r\n }\r\n\r\n private _retargetAnimationKeys(animation: Animation, sourceTransformNode: TransformNode, targetBone: Bone) {\r\n const keys = animation.getKeys();\r\n const targetTransformNode = targetBone._linkedTransformNode;\r\n\r\n let targetWorldMatrix: Matrix;\r\n let targetParentWorldMatrix: DeepImmutableObject<Matrix>;\r\n\r\n if (targetTransformNode) {\r\n targetWorldMatrix = targetTransformNode.getWorldMatrix();\r\n targetParentWorldMatrix = targetTransformNode.parent ? targetTransformNode.parent.getWorldMatrix() : Matrix.IdentityReadOnly;\r\n } else {\r\n targetWorldMatrix = targetBone.getFinalMatrix();\r\n targetParentWorldMatrix = targetBone.parent ? targetBone.parent.getFinalMatrix() : Matrix.IdentityReadOnly;\r\n }\r\n\r\n const targetParentInverseWorldMatrix = targetParentWorldMatrix.invertToRef(TmpVectors.Matrix[0]);\r\n\r\n const sourceInverseWorld = sourceTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[1]);\r\n const sourceParentWorld = sourceTransformNode.parent ? sourceTransformNode.parent.getWorldMatrix() : Matrix.IdentityReadOnly;\r\n\r\n switch (animation.targetProperty) {\r\n case \"rotationQuaternion\": {\r\n for (const key of keys) {\r\n const quaternion = key.value as Quaternion;\r\n\r\n const localMat = Matrix.ComposeToRef(sourceTransformNode.scaling, quaternion, sourceTransformNode.position, TmpVectors.Matrix[2]);\r\n\r\n sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);\r\n targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(undefined, quaternion, undefined);\r\n }\r\n break;\r\n }\r\n case \"position\": {\r\n for (const key of keys) {\r\n const position = key.value as Vector3;\r\n\r\n const localMat = Matrix.ComposeToRef(sourceTransformNode.scaling, sourceTransformNode.rotationQuaternion!, position, TmpVectors.Matrix[2]);\r\n\r\n sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);\r\n targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(undefined, undefined, position);\r\n }\r\n break;\r\n }\r\n case \"scaling\": {\r\n for (const key of keys) {\r\n const scaling = key.value as Vector3;\r\n\r\n const localMat = Matrix.ComposeToRef(scaling, sourceTransformNode.rotationQuaternion!, sourceTransformNode.position, TmpVectors.Matrix[2]);\r\n\r\n sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);\r\n targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(scaling, undefined, undefined);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * This method corrects quaternion animations when two consecutive quaternions are orthogonal to each other. When this happens, in 99.99% of\r\n * cases it's an error in the animation data, as two consecutive rotations should normally be close to each other and not have a large gap.\r\n * The fix is to copy the first quaternion into the second.\r\n * @param animationGroup The animation group to fix\r\n * @internal\r\n */\r\n private _fixAnimationGroup(animationGroup: AnimationGroup) {\r\n for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {\r\n const ta = animationGroup.targetedAnimations[i];\r\n\r\n switch (ta.animation.targetProperty) {\r\n case \"rotationQuaternion\": {\r\n const keys = ta.animation.getKeys();\r\n\r\n for (let j = 0; j < keys.length - 1; ++j) {\r\n const curQuat = keys[j].value as Quaternion;\r\n const nextQuat = keys[j + 1].value as Quaternion;\r\n\r\n if (Math.abs(Quaternion.Dot(curQuat, nextQuat)) < 0.001) {\r\n keys[j + 1].value = curQuat.clone();\r\n j += 1;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _getRootNode(node: Node): Node {\r\n let current: Node = node;\r\n\r\n while (current.parent) {\r\n current = current.parent;\r\n }\r\n\r\n return current;\r\n }\r\n\r\n /**\r\n * Checks whether the parent hierarchy of a bone matches that of a given transform node. Checks are performed by name.\r\n * It works by first finding the transform node in the descendants of the root transform node that matches the bone's linked transform node.\r\n * Then it traverses up the hierarchy of both the bone and the transform node, comparing their names at each level.\r\n * @param bone The bone to check\r\n * @param rootTransformNode The root transform node to check against\r\n * @returns True if the hierarchies match, false otherwise\r\n * @internal\r\n */\r\n private _checkParentHierarchy(bone: Bone, rootTransformNode: Node, mapNodeNames: Map<string, string>) {\r\n const children = rootTransformNode.getDescendants(false, (node) => (mapNodeNames.get(node.name) ?? node.name) === (bone._linkedTransformNode?.name ?? bone.name));\r\n if (!children || children.length !== 1) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', CheckParentHierarchy: unable to find a corresponding transform node to bone name \"${bone._linkedTransformNode?.name ?? bone.name}\" in the source animation.`\r\n );\r\n }\r\n return false;\r\n }\r\n\r\n let transformNode: Nullable<Node> = children[0];\r\n\r\n while (bone) {\r\n const name = mapNodeNames.get(transformNode?.name ?? \"\") ?? transformNode?.name;\r\n const boneName = bone._linkedTransformNode?.name ?? bone.name;\r\n if (boneName !== name) {\r\n if (this.showWarnings) {\r\n Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', CheckParentHierarchy: bone name \"${boneName}\" is different from transform node name \"${name}\".`);\r\n }\r\n return false;\r\n }\r\n\r\n bone = bone.parent;\r\n transformNode = transformNode!.parent;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _getRootNodeName(rootNodeName: string | undefined, transformNodeNameToNode: TransformNodeNameToNode) {\r\n if (rootNodeName) {\r\n return rootNodeName;\r\n }\r\n\r\n // Look for the first bone that doesn't have a parent\r\n const iterator = this.skeletons.keys();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const skeleton = key.value;\r\n\r\n for (const bone of skeleton.bones) {\r\n if (!bone.parent) {\r\n // Make sure there's a transform node with that name in the source animation\r\n if (transformNodeNameToNode.get(bone.name)) {\r\n return bone.name;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return;\r\n }\r\n\r\n private _findVerticalAxis(\r\n msg: string,\r\n animationGroup: AnimationGroup,\r\n remappedRootNodeName: string | undefined,\r\n sourceTransformNodeNameToNode: TransformNodeNameToNode,\r\n remappedGroundReferenceNodeName?: string,\r\n groundReferenceVerticalAxis?: string\r\n ) {\r\n if (!remappedGroundReferenceNodeName) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': you must provide the name of the ground reference node (option parameter \"groundReferenceNodeName\"). ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n remappedRootNodeName = this._getRootNodeName(remappedRootNodeName, sourceTransformNodeNameToNode);\r\n\r\n if (!remappedRootNodeName) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find a suitable root node in the source animation. You should provide its name through the \"rootNodeName\" optional parameter. ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n const sourceRootTransformNode = sourceTransformNodeNameToNode.get(remappedRootNodeName)?.node;\r\n const sourceGroundReferenceTransformNode = sourceTransformNodeNameToNode.get(remappedGroundReferenceNodeName)?.node;\r\n\r\n if (!sourceRootTransformNode) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the transform node corresponding to \"${remappedRootNodeName}\" in the source animation. This transform node either doesn't exist or is not animated. ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n if (!sourceGroundReferenceTransformNode) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the transform node corresponding to \"${remappedGroundReferenceNodeName}\" in the source animation. This transform node either doesn't exist or is not animated. ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n // Look for the position animation + target node of the root node name (generally the hips) in the retargeted animation\r\n let targetRootPositionAnimation: Animation | undefined;\r\n let targetRootTransformNodeOrBone: TransformNode | Bone | undefined;\r\n\r\n for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {\r\n const ta = animationGroup.targetedAnimations[i];\r\n const target = ta.target;\r\n const animation = ta.animation;\r\n\r\n if (target.name === remappedRootNodeName && animation.targetProperty === \"position\") {\r\n targetRootPositionAnimation = animation;\r\n targetRootTransformNodeOrBone = ta.target;\r\n break;\r\n }\r\n }\r\n\r\n if (!targetRootPositionAnimation || !targetRootTransformNodeOrBone) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find a \"position\" animation for the node \"${remappedRootNodeName}\". ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n let targetGroundReferenceTransformNodeOrBone: Nullable<TransformNode | Bone>;\r\n\r\n if (targetRootTransformNodeOrBone instanceof TransformNode) {\r\n targetGroundReferenceTransformNodeOrBone = this.findBoneByTransformNode(remappedGroundReferenceNodeName)?._linkedTransformNode!;\r\n } else {\r\n targetGroundReferenceTransformNodeOrBone = this.findBoneByName(remappedGroundReferenceNodeName);\r\n }\r\n\r\n if (!targetGroundReferenceTransformNodeOrBone) {\r\n if (this.showWarnings) {\r\n Logger.Warn(\r\n `RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the bone/transform node corresponding with name \"${remappedGroundReferenceNodeName}\" in the avatar skeleton. Ensure that this bone exists. ${msg}`\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n sourceRootTransformNode.computeWorldMatrix(true);\r\n sourceGroundReferenceTransformNode.computeWorldMatrix(true);\r\n\r\n // Determine the vertical axis\r\n const sourceRootGroundReferenceDiff = sourceRootTransformNode.getAbsolutePosition().subtract(sourceGroundReferenceTransformNode.getAbsolutePosition());\r\n\r\n let verticalAxis = 0;\r\n\r\n if (groundReferenceVerticalAxis) {\r\n switch (groundReferenceVerticalAxis) {\r\n case \"Y\":\r\n verticalAxis = 1;\r\n break;\r\n case \"Z\":\r\n verticalAxis = 2;\r\n break;\r\n }\r\n } else {\r\n // No axis provided: assume the vertical axis is the one with the larger difference between the reference and the ground reference transform nodes\r\n const absX = Math.abs(sourceRootGroundReferenceDiff.x);\r\n const absY = Math.abs(sourceRootGroundReferenceDiff.y);\r\n const absZ = Math.abs(sourceRootGroundReferenceDiff.z);\r\n if (absY > absX && absY >= absZ) {\r\n verticalAxis = 1;\r\n } else if (absZ > absX && absZ > absY) {\r\n verticalAxis = 2;\r\n }\r\n }\r\n\r\n const targetRootGroundReferenceDiff = targetRootTransformNodeOrBone.getAbsolutePosition().subtract(targetGroundReferenceTransformNodeOrBone.getAbsolutePosition());\r\n\r\n const sourceDiff = verticalAxis === 0 ? sourceRootGroundReferenceDiff.x : verticalAxis === 1 ? sourceRootGroundReferenceDiff.y : sourceRootGroundReferenceDiff.z;\r\n const targetDiff = verticalAxis === 0 ? targetRootGroundReferenceDiff.x : verticalAxis === 1 ? targetRootGroundReferenceDiff.y : targetRootGroundReferenceDiff.z;\r\n\r\n return {\r\n verticalAxis,\r\n sourceRootTransformNode,\r\n sourceGroundReferenceTransformNode,\r\n targetRootTransformNodeOrBone,\r\n targetRootPositionAnimation,\r\n targetGroundReferenceTransformNodeOrBone,\r\n proportionRatio: sourceDiff !== 0 ? targetDiff / sourceDiff : 1.0,\r\n };\r\n }\r\n\r\n private _resetStates(sourceTransformNodeNameToNode: TransformNodeNameToNode) {\r\n this.skeletons.forEach((skeleton) => skeleton.returnToRest());\r\n\r\n sourceTransformNodeNameToNode.forEach((data) => {\r\n const { node, initialTransformations } = data;\r\n node.position.copyFrom(initialTransformations.position);\r\n node.scaling.copyFrom(initialTransformations.scaling);\r\n if (initialTransformations.quaternion) {\r\n node.rotationQuaternion!.copyFrom(initialTransformations.quaternion);\r\n } else {\r\n node.rotation.copyFrom(initialTransformations.rotation);\r\n }\r\n node.computeWorldMatrix(true);\r\n });\r\n }\r\n\r\n private _fixRootPosition(\r\n sourceAnimationGroup: AnimationGroup,\r\n animationGroup: AnimationGroup,\r\n sourceRootTransformNode: TransformNode,\r\n targetRootTransformNodeOrBone: TransformNode | Bone,\r\n targetRootPositionAnimation: Animation,\r\n proportionRatio: number\r\n ) {\r\n const targetNodeInverseParentWorldMatrix =\r\n targetRootTransformNodeOrBone instanceof TransformNode\r\n ? (targetRootTransformNodeOrBone.parent?.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly)\r\n : (targetRootTransformNodeOrBone.parent?.getFinalMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly);\r\n\r\n sourceRootTransformNode.computeWorldMatrix(true);\r\n targetRootTransformNodeOrBone.computeWorldMatrix(true);\r\n\r\n const sourceWorldPosition = sourceRootTransformNode.absolutePosition.clone();\r\n const targetWorldPosition = targetRootTransformNodeOrBone.getAbsolutePosition().clone();\r\n\r\n sourceAnimationGroup.play(false);\r\n animationGroup.play(false);\r\n\r\n // Loop over the position animation of the root transform node\r\n for (const key of targetRootPositionAnimation.getKeys()) {\r\n const frame = key.frame;\r\n\r\n // Advance the source and retargeted animations to this frame\r\n sourceAnimationGroup.goToFrame(frame);\r\n sourceAnimationGroup.pause();\r\n\r\n animationGroup.goToFrame(frame);\r\n animationGroup.pause();\r\n\r\n sourceRootTransformNode.computeWorldMatrix(true);\r\n\r\n const offset = sourceRootTransformNode.absolutePosition.subtractToRef(sourceWorldPosition, TmpVectors.Vector3[0]);\r\n\r\n offset.scaleInPlace(proportionRatio);\r\n offset.addInPlace(targetWorldPosition);\r\n\r\n Vector3.TransformNormalToRef(offset, targetNodeInverseParentWorldMatrix, key.value);\r\n }\r\n\r\n sourceAnimationGroup.stop();\r\n animationGroup.stop();\r\n }\r\n\r\n private _fixGroundReference(\r\n sourceAnimationGroup: AnimationGroup,\r\n animationGroup: AnimationGroup,\r\n verticalAxis: number,\r\n targetRootTransformNodeOrBone: TransformNode | Bone,\r\n targetRootPositionAnimation: Animation,\r\n sourceGroundReferenceTransformNode: TransformNode,\r\n targetGroundReferenceTransformNodeOrBone: TransformNode | Bone,\r\n sourceListTransformNodes: Set<TransformNode>,\r\n mapNodeNames: Map<string, string>,\r\n fixGroundReferenceDynamicRefNode: boolean\r\n ) {\r\n const targetNodeInverseParentWorldMatrix =\r\n targetRootTransformNodeOrBone instanceof TransformNode\r\n ? (targetRootTransformNodeOrBone.parent?.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly)\r\n : (targetRootTransformNodeOrBone.parent?.getFinalMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly);\r\n\r\n sourceAnimationGroup.play(false);\r\n animationGroup.play(false);\r\n\r\n // Loop over the position animation of the root transform node\r\n for (const key of targetRootPositionAnimation.getKeys()) {\r\n const frame = key.frame;\r\n\r\n // Advance the source and retargeted animations to this frame\r\n sourceAnimationGroup.goToFrame(frame);\r\n sourceAnimationGroup.pause();\r\n\r\n animationGroup.goToFrame(frame);\r\n animationGroup.pause();\r\n\r\n sourceGroundReferenceTransformNode.computeWorldMatrix(true);\r\n targetGroundReferenceTransformNodeOrBone.computeWorldMatrix(true);\r\n\r\n // Calculate the offset to apply to the root position in the target to have the ground reference at the same height in the source and target animations\r\n const diffGroundReferences = targetGroundReferenceTransformNodeOrBone\r\n .getAbsolutePosition()\r\n .subtractToRef(sourceGroundReferenceTransformNode.absolutePosition, TmpVectors.Vector3[0]);\r\n\r\n let groundReferenceOffset = verticalAxis === 0 ? diffGroundReferences.x : verticalAxis === 1 ? diffGroundReferences.y : diffGroundReferences.z;\r\n\r\n if (fixGroundReferenceDynamicRefNode) {\r\n // Try to find a bone in this frame that has a greater offset than the ground reference, to use it instead of the ground reference.\r\n const targetRootToGroundReferenceDiff = targetRootTransformNodeOrBone\r\n .getAbsolutePosition()\r\n .subtractToRef(targetGroundReferenceTransformNodeOrBone.getAbsolutePosition(), TmpVectors.Vector3[0]);\r\n\r\n const targetRootToGroundReferenceOffset =\r\n verticalAxis === 0 ? targetRootToGroundReferenceDiff.x : verticalAxis === 1 ? targetRootToGroundReferenceDiff.y : targetRootToGroundReferenceDiff.z;\r\n\r\n const iterator = sourceListTransformNodes.keys();\r\n\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const sourceTransformNode = key.value;\r\n if (sourceTransformNode === sourceGroundReferenceTransformNode) {\r\n continue;\r\n }\r\n\r\n const targetNodeName = mapNodeNames.get(sourceTransformNode.name) ?? sourceTransformNode.name;\r\n\r\n let targetBone = this.findBoneByTransformNode(targetNodeName);\r\n if (!targetBone) {\r\n targetBone = this.findBoneByName(targetNodeName);\r\n }\r\n if (!targetBone) {\r\n continue;\r\n }\r\n\r\n sourceTransformNode.computeWorldMatrix();\r\n targetBone.computeWorldMatrix();\r\n\r\n const targetBoneWorldPosition = targetBone._linkedTransformNode?.getAbsolutePosition() ?? targetBone.getAbsolutePosition();\r\n const targetRootToBoneDiff = targetRootTransformNodeOrBone.getAbsolutePosition().subtractToRef(targetBoneWorldPosition, TmpVectors.Vector3[0]);\r\n const rootToBoneOffset = verticalAxis === 0 ? targetRootToBoneDiff.x : verticalAxis === 1 ? targetRootToBoneDiff.y : targetRootToBoneDiff.z;\r\n\r\n if (Math.abs(rootToBoneOffset) > Math.abs(targetRootToGroundReferenceOffset) && Math.sign(rootToBoneOffset) === Math.sign(targetRootToGroundReferenceOffset)) {\r\n const diff = targetBoneWorldPosition.subtractToRef(sourceTransformNode.getAbsolutePosition(), TmpVectors.Vector3[0]);\r\n const offset = verticalAxis === 0 ? diff.x : verticalAxis === 1 ? diff.y : diff.z;\r\n\r\n groundReferenceOffset = offset;\r\n }\r\n }\r\n }\r\n\r\n const localOffset = Vector3.TransformNormalToRef(\r\n new Vector3(verticalAxis === 0 ? groundReferenceOffset : 0, verticalAxis === 1 ? groundReferenceOffset : 0, verticalAxis === 2 ? groundReferenceOffset : 0),\r\n targetNodeInverseParentWorldMatrix,\r\n TmpVectors.Vector3[1]\r\n );\r\n\r\n key.value.subtractInPlace(localOffset);\r\n }\r\n\r\n sourceAnimationGroup.stop();\r\n animationGroup.stop();\r\n }\r\n}\r\n"]}
|
package/Animations/easing.js
CHANGED
package/Animations/easing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easing.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/easing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAmBjD;;;GAGG;AACH,MAAM,OAAO,cAAc;IAA3B;QAgBY,gBAAW,GAAG,cAAc,CAAC,iBAAiB,CAAC;IA8C3D,CAAC;IA5CG;;;OAGG;IACI,aAAa,CAAC,UAAkB;QACnC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IACzB,CAAC;IACD;;;OAGG;IACI,aAAa;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,6DAA6D;IACtD,UAAU,CAAC,QAAgB;QAC9B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CA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;QARD,OAAE,GAAF,EAAE,CAAY;QAEd,OAAE,GAAF,EAAE,CAAY;QAEd,OAAE,GAAF,EAAE,CAAY;QAEd,OAAE,GAAF,EAAE,CAAY;IAGzB,CAAC;IAED;;OAEG;IACa,UAAU,CAAC,QAAgB;QACvC,OAAO,WAAW,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;CACJ","sourcesContent":["import { BezierCurve } from \"../Maths/math.path\";\r\n\r\n/**\r\n * This represents the main contract an easing function should follow.\r\n * Easing functions are used throughout the animation system.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport interface IEasingFunction {\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * The link below provides some of the most common examples of easing functions.\r\n * @see https://easings.net/\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n ease(gradient: number): number;\r\n}\r\n\r\n/**\r\n * Base class used for every default easing function.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class EasingFunction implements IEasingFunction {\r\n /**\r\n * Interpolation follows the mathematical formula associated with the easing function.\r\n */\r\n public static readonly EASINGMODE_EASEIN = 0;\r\n\r\n /**\r\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\r\n */\r\n public static readonly EASINGMODE_EASEOUT = 1;\r\n\r\n /**\r\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\r\n */\r\n public static readonly EASINGMODE_EASEINOUT = 2;\r\n\r\n private _easingMode = EasingFunction.EASINGMODE_EASEIN;\r\n\r\n /**\r\n * Sets the easing mode of the current function.\r\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\r\n */\r\n public setEasingMode(easingMode: number) {\r\n const n = Math.min(Math.max(easingMode, 0), 2);\r\n this._easingMode = n;\r\n }\r\n /**\r\n * Gets the current easing mode.\r\n * @returns the easing mode\r\n */\r\n public getEasingMode(): number {\r\n return this._easingMode;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public easeInCore(gradient: number): number {\r\n throw new Error(\"You must implement this method\");\r\n }\r\n\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n public ease(gradient: number): number {\r\n switch (this._easingMode) {\r\n case EasingFunction.EASINGMODE_EASEIN:\r\n return this.easeInCore(gradient);\r\n case EasingFunction.EASINGMODE_EASEOUT:\r\n return 1 - this.easeInCore(1 - gradient);\r\n }\r\n\r\n if (gradient >= 0.5) {\r\n return (1 - this.easeInCore((1 - gradient) * 2)) * 0.5 + 0.5;\r\n }\r\n\r\n return this.easeInCore(gradient * 2) * 0.5;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a circle shape (see link below).\r\n * @see https://easings.net/#easeInCirc\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class CircleEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n gradient = Math.max(0, Math.min(1, gradient));\r\n return 1.0 - Math.sqrt(1.0 - gradient * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a ease back shape (see link below).\r\n * @see https://easings.net/#easeInBack\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class BackEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a back ease easing\r\n * @see https://easings.net/#easeInBack\r\n * @param amplitude Defines the amplitude of the function\r\n */\r\n constructor(\r\n /** [1] Defines the amplitude of the function */\r\n public amplitude: number = 1\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n const num = Math.max(0, this.amplitude);\r\n return Math.pow(gradient, 3.0) - gradient * num * Math.sin(3.1415926535897931 * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a bouncing shape (see link below).\r\n * @see https://easings.net/#easeInBounce\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class BounceEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a bounce easing\r\n * @see https://easings.net/#easeInBounce\r\n * @param bounces Defines the number of bounces\r\n * @param bounciness Defines the amplitude of the bounce\r\n */\r\n constructor(\r\n /** [3] Defines the number of bounces */\r\n public bounces: number = 3,\r\n /** [2] Defines the amplitude of the bounce */\r\n public bounciness: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n const y = Math.max(0.0, this.bounces);\r\n let bounciness = this.bounciness;\r\n if (bounciness <= 1.0) {\r\n bounciness = 1.001;\r\n }\r\n const num9 = Math.pow(bounciness, y);\r\n const num5 = 1.0 - bounciness;\r\n const num4 = (1.0 - num9) / num5 + num9 * 0.5;\r\n const num15 = gradient * num4;\r\n const num65 = Math.log(-num15 * (1.0 - bounciness) + 1.0) / Math.log(bounciness);\r\n const num3 = Math.floor(num65);\r\n const num13 = num3 + 1.0;\r\n const num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\r\n const num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\r\n const num7 = (num8 + num12) * 0.5;\r\n const num6 = gradient - num7;\r\n const num2 = num7 - num8;\r\n return (-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2) * (num6 + num2);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 3 shape (see link below).\r\n * @see https://easings.net/#easeInCubic\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class CubicEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with an elastic shape (see link below).\r\n * @see https://easings.net/#easeInElastic\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class ElasticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an elastic easing function\r\n * @see https://easings.net/#easeInElastic\r\n * @param oscillations Defines the number of oscillations\r\n * @param springiness Defines the amplitude of the oscillations\r\n */\r\n constructor(\r\n /** [3] Defines the number of oscillations*/\r\n public oscillations: number = 3,\r\n /** [3] Defines the amplitude of the oscillations*/\r\n public springiness: number = 3\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n let num2;\r\n const num3 = Math.max(0.0, this.oscillations);\r\n const num = Math.max(0.0, this.springiness);\r\n\r\n if (num == 0) {\r\n num2 = gradient;\r\n } else {\r\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\r\n }\r\n return num2 * Math.sin((6.2831853071795862 * num3 + 1.5707963267948966) * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with an exponential shape (see link below).\r\n * @see https://easings.net/#easeInExpo\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class ExponentialEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an exponential easing function\r\n * @see https://easings.net/#easeInExpo\r\n * @param exponent Defines the exponent of the function\r\n */\r\n constructor(\r\n /** [3] Defines the exponent of the function */\r\n public exponent: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n if (this.exponent <= 0) {\r\n return gradient;\r\n }\r\n\r\n return (Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class PowerEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an power base easing function\r\n * @see https://easings.net/#easeInQuad\r\n * @param power Defines the power of the function\r\n */\r\n constructor(\r\n /** [2] Defines the power of the function */\r\n public power: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n const y = Math.max(0.0, this.power);\r\n return Math.pow(gradient, y);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 2 shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuadraticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 4 shape (see link below).\r\n * @see https://easings.net/#easeInQuart\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuarticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 5 shape (see link below).\r\n * @see https://easings.net/#easeInQuint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuinticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a sin shape (see link below).\r\n * @see https://easings.net/#easeInSine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class SineEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return 1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient));\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a bezier shape (see link below).\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class BezierCurveEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a bezier function\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @param x1 Defines the x component of the start tangent in the bezier curve\r\n * @param y1 Defines the y component of the start tangent in the bezier curve\r\n * @param x2 Defines the x component of the end tangent in the bezier curve\r\n * @param y2 Defines the y component of the end tangent in the bezier curve\r\n */\r\n constructor(\r\n /** [0] Defines the x component of the start tangent in the bezier curve */\r\n public x1: number = 0,\r\n /** [0] Defines the y component of the start tangent in the bezier curve */\r\n public y1: number = 0,\r\n /** [1] Defines the x component of the end tangent in the bezier curve */\r\n public x2: number = 1,\r\n /** [1] Defines the y component of the end tangent in the bezier curve */\r\n public y2: number = 1\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return BezierCurve.Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"easing.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/easing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAmBjD;;;GAGG;AACH,MAA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AAQ,GAAG,QAAQ,CAAC;IAChE,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,cAAc;IACxC;;OAEG;IACa,UAAU,CAAC,QAAgB;QACvC,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC;IACjE,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAC/C;;;;;;;OAOG;IACH;IACI,2EAA2E;IACpE,KAAa,CAAC;IACrB,2EAA2E;IACpE,KAAa,CAAC;IACrB,yEAAyE;IAClE,KAAa,CAAC;IACrB,yEAAyE;IAClE,KAAa,CAAC;QAErB,KAAK,EAAE,CAAC;QARD,OAAE,GAAF,EAAE,CAAY;QAEd,OAAE,GAAF,EAAE,CAAY;QAEd,OAAE,GAAF,EAAE,CAAY;QAEd,OAAE,GAAF,EAAE,CAAY;IAGzB,CAAC;IAED;;OAEG;IACa,UAAU,CAAC,QAAgB;QACvC,OAAO,WAAW,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;CACJ","sourcesContent":["import { BezierCurve } from \"../Maths/math.path\";\r\n\r\n/**\r\n * This represents the main contract an easing function should follow.\r\n * Easing functions are used throughout the animation system.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport interface IEasingFunction {\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * The link below provides some of the most common examples of easing functions.\r\n * @see https://easings.net/\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n ease(gradient: number): number;\r\n}\r\n\r\n/**\r\n * Base class used for every default easing function.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class EasingFunction implements IEasingFunction {\r\n /**\r\n * Interpolation follows the mathematical formula associated with the easing function.\r\n */\r\n public static readonly EASINGMODE_EASEIN = 0;\r\n\r\n /**\r\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\r\n */\r\n public static readonly EASINGMODE_EASEOUT = 1;\r\n\r\n /**\r\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\r\n */\r\n public static readonly EASINGMODE_EASEINOUT = 2;\r\n\r\n private _easingMode = EasingFunction.EASINGMODE_EASEIN;\r\n\r\n /**\r\n * Sets the easing mode of the current function.\r\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\r\n */\r\n public setEasingMode(easingMode: number) {\r\n const n = Math.min(Math.max(easingMode, 0), 2);\r\n this._easingMode = n;\r\n }\r\n /**\r\n * Gets the current easing mode.\r\n * @returns the easing mode\r\n */\r\n public getEasingMode(): number {\r\n return this._easingMode;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public easeInCore(gradient: number): number {\r\n throw new Error(\"You must implement this method\");\r\n }\r\n\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n public ease(gradient: number): number {\r\n switch (this._easingMode) {\r\n case EasingFunction.EASINGMODE_EASEIN:\r\n return this.easeInCore(gradient);\r\n case EasingFunction.EASINGMODE_EASEOUT:\r\n return 1 - this.easeInCore(1 - gradient);\r\n }\r\n\r\n if (gradient >= 0.5) {\r\n return (1 - this.easeInCore((1 - gradient) * 2)) * 0.5 + 0.5;\r\n }\r\n\r\n return this.easeInCore(gradient * 2) * 0.5;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a circle shape (see link below).\r\n * @see https://easings.net/#easeInCirc\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class CircleEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n gradient = Math.max(0, Math.min(1, gradient));\r\n return 1.0 - Math.sqrt(1.0 - gradient * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a ease back shape (see link below).\r\n * @see https://easings.net/#easeInBack\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class BackEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a back ease easing\r\n * @see https://easings.net/#easeInBack\r\n * @param amplitude Defines the amplitude of the function\r\n */\r\n constructor(\r\n /** [1] Defines the amplitude of the function */\r\n public amplitude: number = 1\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n const num = Math.max(0, this.amplitude);\r\n return Math.pow(gradient, 3.0) - gradient * num * Math.sin(3.1415926535897931 * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a bouncing shape (see link below).\r\n * @see https://easings.net/#easeInBounce\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class BounceEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a bounce easing\r\n * @see https://easings.net/#easeInBounce\r\n * @param bounces Defines the number of bounces\r\n * @param bounciness Defines the amplitude of the bounce\r\n */\r\n constructor(\r\n /** [3] Defines the number of bounces */\r\n public bounces: number = 3,\r\n /** [2] Defines the amplitude of the bounce */\r\n public bounciness: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n const y = Math.max(0.0, this.bounces);\r\n let bounciness = this.bounciness;\r\n if (bounciness <= 1.0) {\r\n bounciness = 1.001;\r\n }\r\n const num9 = Math.pow(bounciness, y);\r\n const num5 = 1.0 - bounciness;\r\n const num4 = (1.0 - num9) / num5 + num9 * 0.5;\r\n const num15 = gradient * num4;\r\n const num65 = Math.log(-num15 * (1.0 - bounciness) + 1.0) / Math.log(bounciness);\r\n const num3 = Math.floor(num65);\r\n const num13 = num3 + 1.0;\r\n const num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\r\n const num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\r\n const num7 = (num8 + num12) * 0.5;\r\n const num6 = gradient - num7;\r\n const num2 = num7 - num8;\r\n return (-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2) * (num6 + num2);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 3 shape (see link below).\r\n * @see https://easings.net/#easeInCubic\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class CubicEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with an elastic shape (see link below).\r\n * @see https://easings.net/#easeInElastic\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class ElasticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an elastic easing function\r\n * @see https://easings.net/#easeInElastic\r\n * @param oscillations Defines the number of oscillations\r\n * @param springiness Defines the amplitude of the oscillations\r\n */\r\n constructor(\r\n /** [3] Defines the number of oscillations*/\r\n public oscillations: number = 3,\r\n /** [3] Defines the amplitude of the oscillations*/\r\n public springiness: number = 3\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n let num2;\r\n const num3 = Math.max(0.0, this.oscillations);\r\n const num = Math.max(0.0, this.springiness);\r\n\r\n if (num === 0) {\r\n num2 = gradient;\r\n } else {\r\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\r\n }\r\n return num2 * Math.sin((6.2831853071795862 * num3 + 1.5707963267948966) * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with an exponential shape (see link below).\r\n * @see https://easings.net/#easeInExpo\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class ExponentialEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an exponential easing function\r\n * @see https://easings.net/#easeInExpo\r\n * @param exponent Defines the exponent of the function\r\n */\r\n constructor(\r\n /** [3] Defines the exponent of the function */\r\n public exponent: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n if (this.exponent <= 0) {\r\n return gradient;\r\n }\r\n\r\n return (Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class PowerEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an power base easing function\r\n * @see https://easings.net/#easeInQuad\r\n * @param power Defines the power of the function\r\n */\r\n constructor(\r\n /** [2] Defines the power of the function */\r\n public power: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n const y = Math.max(0.0, this.power);\r\n return Math.pow(gradient, y);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 2 shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuadraticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 4 shape (see link below).\r\n * @see https://easings.net/#easeInQuart\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuarticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 5 shape (see link below).\r\n * @see https://easings.net/#easeInQuint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuinticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a sin shape (see link below).\r\n * @see https://easings.net/#easeInSine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class SineEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return 1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient));\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a bezier shape (see link below).\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\r\n */\r\nexport class BezierCurveEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a bezier function\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @param x1 Defines the x component of the start tangent in the bezier curve\r\n * @param y1 Defines the y component of the start tangent in the bezier curve\r\n * @param x2 Defines the x component of the end tangent in the bezier curve\r\n * @param y2 Defines the y component of the end tangent in the bezier curve\r\n */\r\n constructor(\r\n /** [0] Defines the x component of the start tangent in the bezier curve */\r\n public x1: number = 0,\r\n /** [0] Defines the y component of the start tangent in the bezier curve */\r\n public y1: number = 0,\r\n /** [1] Defines the x component of the end tangent in the bezier curve */\r\n public x2: number = 1,\r\n /** [1] Defines the y component of the end tangent in the bezier curve */\r\n public y2: number = 1\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override easeInCore(gradient: number): number {\r\n return BezierCurve.Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\r\n }\r\n}\r\n"]}
|
package/Animations/pathCursor.js
CHANGED
|
@@ -56,8 +56,7 @@ export class PathCursor {
|
|
|
56
56
|
*/
|
|
57
57
|
move(step) {
|
|
58
58
|
if (Math.abs(step) > 1) {
|
|
59
|
-
|
|
60
|
-
throw "step size should be less than 1.";
|
|
59
|
+
throw new Error("step size should be less than 1.");
|
|
61
60
|
}
|
|
62
61
|
this.value += step;
|
|
63
62
|
this._ensureLimits();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathCursor.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/pathCursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C;;GAEG;AACH,MAAM,OAAO,UAAU;IAgBnB;;;OAGG;IACH,YAAoB,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;QAnBhC;;WAEG;QACK,cAAS,GAAG,IAAI,KAAK,EAAgC,CAAC;QAE9D;;WAEG;QACH,UAAK,GAAW,CAAC,CAAC;QAElB;;WAEG;QACH,eAAU,GAAG,EAAiB,CAAC;IAMI,CAAC;IAEpC;;;OAGG;IACI,QAAQ;QACX,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9D,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5C,C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AI,CAAC,CAAC;QAEjB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAC,IAAY;QACpB,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QACnB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACK,aAAa;QACjB,OAAO,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACK,cAAc;QAClB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC7B,CAAC,CAAC,IAAI,CAAC,CAAC;QACZ,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,CAA+B;QAC3C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAEvB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../Maths/math.vector\";\r\nimport { type Path2 } from \"../Maths/math.path\";\r\n\r\n/**\r\n * A cursor which tracks a point on a path\r\n */\r\nexport class PathCursor {\r\n /**\r\n * Stores path cursor callbacks for when an onchange event is triggered\r\n */\r\n private _onchange = new Array<(cursor: PathCursor) => void>();\r\n\r\n /**\r\n * The value of the path cursor\r\n */\r\n value: number = 0;\r\n\r\n /**\r\n * The animation array of the path cursor\r\n */\r\n animations = [] as Animation[];\r\n\r\n /**\r\n * Initializes the path cursor\r\n * @param _path The path to track\r\n */\r\n constructor(private _path: Path2) {}\r\n\r\n /**\r\n * Gets the cursor point on the path\r\n * @returns A point on the path cursor at the cursor location\r\n */\r\n public getPoint(): Vector3 {\r\n const point = this._path.getPointAtLengthPosition(this.value);\r\n return new Vector3(point.x, 0, point.y);\r\n }\r\n\r\n /**\r\n * Moves the cursor ahead by the step amount\r\n * @param step The amount to move the cursor forward\r\n * @returns This path cursor\r\n */\r\n public moveAhead(step: number = 0.002): PathCursor {\r\n this.move(step);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Moves the cursor behind by the step amount\r\n * @param step The amount to move the cursor back\r\n * @returns This path cursor\r\n */\r\n public moveBack(step: number = 0.002): PathCursor {\r\n this.move(-step);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Moves the cursor by the step amount\r\n * If the step amount is greater than one, an exception is thrown\r\n * @param step The amount to move the cursor\r\n * @returns This path cursor\r\n */\r\n public move(step: number): PathCursor {\r\n if (Math.abs(step) > 1) {\r\n throw new Error(\"step size should be less than 1.\");\r\n }\r\n\r\n this.value += step;\r\n this._ensureLimits();\r\n this._raiseOnChange();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Ensures that the value is limited between zero and one\r\n * @returns This path cursor\r\n */\r\n private _ensureLimits(): PathCursor {\r\n while (this.value > 1) {\r\n this.value -= 1;\r\n }\r\n while (this.value < 0) {\r\n this.value += 1;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Runs onchange callbacks on change (used by the animation engine)\r\n * @returns This path cursor\r\n */\r\n private _raiseOnChange(): PathCursor {\r\n for (const f of this._onchange) {\r\n f(this);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Executes a function on change\r\n * @param f A path cursor onchange callback\r\n * @returns This path cursor\r\n */\r\n public onchange(f: (cursor: PathCursor) => void): PathCursor {\r\n this._onchange.push(f);\r\n\r\n return this;\r\n }\r\n}\r\n"]}
|
|
@@ -73,14 +73,13 @@ export class GeospatialCameraMovement extends CameraMovement {
|
|
|
73
73
|
*/
|
|
74
74
|
_recalculateDragPlaneHitPoint(hitPointRadius, ray, localToEcefResult) {
|
|
75
75
|
// Use the camera's geocentric normal to find the dragPlaneOriginPoint which lives at hitPointRadius along the camera's geocentric normal
|
|
76
|
-
this.
|
|
77
|
-
this._dragPlaneNormal.scaleToRef(hitPointRadius, this._dragPlaneOriginPointEcef);
|
|
76
|
+
this._cameraPosition.scaleToRef(hitPointRadius / Math.max(0.00001, this._cameraPosition.length()), this._dragPlaneOriginPointEcef);
|
|
78
77
|
// The dragPlaneOffsetVector will later be recalculated when drag occurs, and the delta between the offset vectors will be applied to localTranslation
|
|
79
|
-
ComputeLocalBasisToRefs(this._dragPlaneOriginPointEcef, TmpVectors.Vector3[0], TmpVectors.Vector3[1],
|
|
80
|
-
const localToEcef = Matrix.FromXYZAxesToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1],
|
|
78
|
+
ComputeLocalBasisToRefs(this._dragPlaneOriginPointEcef, TmpVectors.Vector3[0], TmpVectors.Vector3[1], this._dragPlaneNormal, this._scene.useRightHandedSystem, this.calculateUpVectorFromPointToRef);
|
|
79
|
+
const localToEcef = Matrix.FromXYZAxesToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], this._dragPlaneNormal, localToEcefResult);
|
|
81
80
|
localToEcef.setTranslationFromFloats(this._dragPlaneOriginPointEcef.x, this._dragPlaneOriginPointEcef.y, this._dragPlaneOriginPointEcef.z);
|
|
82
81
|
const ecefToLocal = localToEcef.invertToRef(TmpVectors.Matrix[1]);
|
|
83
|
-
// Now create a plane at that point, perpendicular to
|
|
82
|
+
// Now create a plane at that point, perpendicular to _dragPlaneNormal.
|
|
84
83
|
Plane.FromPositionAndNormalToRef(this._dragPlaneOriginPointEcef, this._dragPlaneNormal, this._dragPlane);
|
|
85
84
|
// Lastly, find the _dragPlaneHitPoint where the ray intersects the _dragPlane.
|
|
86
85
|
if (IntersectRayWithPlaneToRef(ray, this._dragPlane, this._dragPlaneHitPointLocal)) {
|