@babylonjs/core 5.52.0 → 5.53.0

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.
Files changed (54) hide show
  1. package/Animations/animatable.js +1 -1
  2. package/Animations/animatable.js.map +1 -1
  3. package/Collisions/pickingInfo.d.ts +2 -1
  4. package/Collisions/pickingInfo.js +4 -3
  5. package/Collisions/pickingInfo.js.map +1 -1
  6. package/DeviceInput/eventFactory.js +4 -0
  7. package/DeviceInput/eventFactory.js.map +1 -1
  8. package/DeviceInput/webDeviceInputSystem.js +17 -9
  9. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  10. package/Engines/engine.d.ts +2 -0
  11. package/Engines/engine.js +5 -0
  12. package/Engines/engine.js.map +1 -1
  13. package/Engines/thinEngine.js +3 -3
  14. package/Engines/thinEngine.js.map +1 -1
  15. package/Inputs/scene.inputManager.js +5 -12
  16. package/Inputs/scene.inputManager.js.map +1 -1
  17. package/Materials/Textures/Filtering/hdrFiltering.js +4 -0
  18. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  19. package/Materials/materialPluginBase.d.ts +3 -2
  20. package/Materials/materialPluginBase.js.map +1 -1
  21. package/Materials/materialPluginManager.js +13 -3
  22. package/Materials/materialPluginManager.js.map +1 -1
  23. package/Materials/uniformBuffer.d.ts +2 -0
  24. package/Materials/uniformBuffer.js +4 -0
  25. package/Materials/uniformBuffer.js.map +1 -1
  26. package/Maths/math.frustum.d.ts +8 -1
  27. package/Maths/math.frustum.js +14 -0
  28. package/Maths/math.frustum.js.map +1 -1
  29. package/Meshes/instancedMesh.d.ts +2 -1
  30. package/Meshes/instancedMesh.js +3 -2
  31. package/Meshes/instancedMesh.js.map +1 -1
  32. package/Meshes/mesh.d.ts +10 -5
  33. package/Meshes/mesh.js +40 -16
  34. package/Meshes/mesh.js.map +1 -1
  35. package/Misc/filesInput.d.ts +5 -2
  36. package/Misc/filesInput.js +39 -20
  37. package/Misc/filesInput.js.map +1 -1
  38. package/Misc/sceneOptimizer.js +3 -0
  39. package/Misc/sceneOptimizer.js.map +1 -1
  40. package/Physics/v2/physicsAggregate.js +3 -3
  41. package/Physics/v2/physicsAggregate.js.map +1 -1
  42. package/Physics/v2/physicsBody.d.ts +27 -16
  43. package/Physics/v2/physicsBody.js +31 -16
  44. package/Physics/v2/physicsBody.js.map +1 -1
  45. package/Physics/v2/physicsConstraint.d.ts +6 -6
  46. package/Physics/v2/physicsConstraint.js +6 -6
  47. package/Physics/v2/physicsConstraint.js.map +1 -1
  48. package/Physics/v2/physicsShape.d.ts +7 -7
  49. package/Physics/v2/physicsShape.js +7 -7
  50. package/Physics/v2/physicsShape.js.map +1 -1
  51. package/XR/features/WebXRControllerTeleportation.d.ts +9 -0
  52. package/XR/features/WebXRControllerTeleportation.js +28 -4
  53. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  54. package/package.json +1 -1
@@ -510,7 +510,7 @@ Scene.prototype.stopAnimation = function (target, animationName, targetMask) {
510
510
  Scene.prototype.stopAllAnimations = function () {
511
511
  if (this._activeAnimatables) {
512
512
  for (let i = 0; i < this._activeAnimatables.length; i++) {
513
- this._activeAnimatables[i].stop();
513
+ this._activeAnimatables[i].stop(undefined, undefined, true);
514
514
  }
515
515
  this._activeAnimatables.length = 0;
516
516
  }
@@ -1 +1 @@
1
- {"version":3,"file":"animatable.js","sourceRoot":"","sources":["../../../../lts/core/generated/Animations/animatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,u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AI,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,EAAE;YACxC,IAAI,iBAAiB,EAAE;gBACnB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBAEzB,oDAAoD;gBACpD,IAAI,iBAAiB,EAAE;oBACnB,eAAe,GAAG,GAAG,CAAC,cAAc,EAAE,CAAC;oBACvC,GAAG,CAAC,cAAc,CAAC,eAAe,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC;oBAE9D,8EAA8E;iBACjF;qBAAM,IAAI,qBAAqB,IAAI,mBAAmB,EAAE;oBACrD,eAAe,GAAG,GAAG,CAAC,cAAc,EAAE,CAAC;oBACvC,GAAG,CAAC,cAAc,CAAC,eAAe,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAC;oBAEzE,mEAAmE;iBACtE;qBAAM;oBACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;iBACpB;aACJ;iBAAM;gBACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;aACpB;YACD,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;SAClE;KACJ;IACD,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,GAAG,WAAW,EAAE,EAAE,GAAG,WAAW,CAAC,CAAC;IAChF,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { Animation } from \"./animation\";\r\nimport { RuntimeAnimation } from \"./runtimeAnimation\";\r\n\r\nimport type { Nullable } from \"../types\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { Matrix, Quaternion, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { PrecisionDate } from \"../Misc/precisionDate\";\r\nimport { Bone } from \"../Bones/bone\";\r\nimport type { Node } from \"../node\";\r\n\r\n/**\r\n * Class used to store an actual running animation\r\n */\r\nexport class Animatable {\r\n private _localDelayOffset: Nullable<number> = null;\r\n private _pausedDelay: Nullable<number> = null;\r\n private _manualJumpDelay: Nullable<number> = null;\r\n /** @hidden */\r\n public _runtimeAnimations = new Array<RuntimeAnimation>();\r\n private _paused = false;\r\n private _scene: Scene;\r\n private _speedRatio = 1;\r\n private _weight = -1.0;\r\n private _syncRoot: Nullable<Animatable> = null;\r\n private _frameToSyncFromJump: Nullable<number> = null;\r\n private _goToFrame: Nullable<number> = null;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.\r\n * This will only apply for non looping animation (default is true)\r\n */\r\n public disposeOnEnd = true;\r\n\r\n /**\r\n * Gets a boolean indicating if the animation has started\r\n */\r\n public animationStarted = false;\r\n\r\n /**\r\n * Observer raised when the animation ends\r\n */\r\n public onAnimationEndObservable = new Observable<Animatable>();\r\n\r\n /**\r\n * Observer raised when the animation loops\r\n */\r\n public onAnimationLoopObservable = new Observable<Animatable>();\r\n\r\n /**\r\n * Gets the root Animatable used to synchronize and normalize animations\r\n */\r\n public get syncRoot(): Nullable<Animatable> {\r\n return this._syncRoot;\r\n }\r\n\r\n /**\r\n * Gets the current frame of the first RuntimeAnimation\r\n * Used to synchronize Animatables\r\n */\r\n public get masterFrame(): number {\r\n if (this._runtimeAnimations.length === 0) {\r\n return 0;\r\n }\r\n\r\n return this._runtimeAnimations[0].currentFrame;\r\n }\r\n\r\n /**\r\n * Gets or sets the animatable weight (-1.0 by default meaning not weighted)\r\n */\r\n public get weight(): number {\r\n return this._weight;\r\n }\r\n\r\n public set weight(value: number) {\r\n if (value === -1) {\r\n // -1 is ok and means no weight\r\n this._weight = -1;\r\n return;\r\n }\r\n\r\n // Else weight must be in [0, 1] range\r\n this._weight = Math.min(Math.max(value, 0), 1.0);\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to apply to the animatable (1.0 by default)\r\n */\r\n public get speedRatio(): number {\r\n return this._speedRatio;\r\n }\r\n\r\n public set speedRatio(value: number) {\r\n for (let index = 0; index < this._runtimeAnimations.length; index++) {\r\n const animation = this._runtimeAnimations[index];\r\n\r\n animation._prepareForSpeedRatioChange(value);\r\n }\r\n this._speedRatio = value;\r\n\r\n // Resync _manualJumpDelay in case goToFrame was called before speedRatio was set.\r\n if (this._goToFrame !== null) {\r\n this.goToFrame(this._goToFrame);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new Animatable\r\n * @param scene defines the hosting scene\r\n * @param target defines the target object\r\n * @param fromFrame defines the starting frame number (default is 0)\r\n * @param toFrame defines the ending frame number (default is 100)\r\n * @param loopAnimation defines if the animation must loop (default is false)\r\n * @param speedRatio defines the factor to apply to animation speed (default is 1)\r\n * @param onAnimationEnd defines a callback to call when animation ends if it is not looping\r\n * @param animations defines a group of animation to add to the new Animatable\r\n * @param onAnimationLoop defines a callback to call when animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively\r\n */\r\n constructor(\r\n scene: Scene,\r\n /** defines the target object */\r\n public target: any,\r\n /** defines the starting frame number (default is 0) */\r\n public fromFrame: number = 0,\r\n /** defines the ending frame number (default is 100) */\r\n public toFrame: number = 100,\r\n /** defines if the animation must loop (default is false) */\r\n public loopAnimation: boolean = false,\r\n speedRatio: number = 1.0,\r\n /** defines a callback to call when animation ends if it is not looping */\r\n public onAnimationEnd?: Nullable<() => void>,\r\n animations?: Animation[],\r\n /** defines a callback to call when animation loops */\r\n public onAnimationLoop?: Nullable<() => void>,\r\n /** defines whether the animation should be evaluated additively */\r\n public isAdditive: boolean = false\r\n ) {\r\n this._scene = scene;\r\n if (animations) {\r\n this.appendAnimations(target, animations);\r\n }\r\n\r\n this._speedRatio = speedRatio;\r\n scene._activeAnimatables.push(this);\r\n }\r\n\r\n // Methods\r\n /**\r\n * Synchronize and normalize current Animatable with a source Animatable\r\n * This is useful when using animation weights and when animations are not of the same length\r\n * @param root defines the root Animatable to synchronize with (null to stop synchronizing)\r\n * @returns the current Animatable\r\n */\r\n public syncWith(root: Nullable<Animatable>): Animatable {\r\n this._syncRoot = root;\r\n\r\n if (root) {\r\n // Make sure this animatable will animate after the root\r\n const index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n this._scene._activeAnimatables.push(this);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the list of runtime animations\r\n * @returns an array of RuntimeAnimation\r\n */\r\n public getAnimations(): RuntimeAnimation[] {\r\n return this._runtimeAnimations;\r\n }\r\n\r\n /**\r\n * Adds more animations to the current animatable\r\n * @param target defines the target of the animations\r\n * @param animations defines the new animations to add\r\n */\r\n public appendAnimations(target: any, animations: Animation[]): void {\r\n for (let index = 0; index < animations.length; index++) {\r\n const animation = animations[index];\r\n\r\n const newRuntimeAnimation = new RuntimeAnimation(target, animation, this._scene, this);\r\n newRuntimeAnimation._onLoop = () => {\r\n this.onAnimationLoopObservable.notifyObservers(this);\r\n if (this.onAnimationLoop) {\r\n this.onAnimationLoop();\r\n }\r\n };\r\n\r\n this._runtimeAnimations.push(newRuntimeAnimation);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the source animation for a specific property\r\n * @param property defines the property to look for\r\n * @returns null or the source animation for the given property\r\n */\r\n public getAnimationByTargetProperty(property: string): Nullable<Animation> {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index].animation;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the runtime animation for a specific property\r\n * @param property defines the property to look for\r\n * @returns null or the runtime animation for the given property\r\n */\r\n public getRuntimeAnimationByTargetProperty(property: string): Nullable<RuntimeAnimation> {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Resets the animatable to its original state\r\n */\r\n public reset(): void {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].reset(true);\r\n }\r\n\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n }\r\n\r\n /**\r\n * Allows the animatable to blend with current running animations\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending\r\n * @param blendingSpeed defines the blending speed to use\r\n */\r\n public enableBlending(blendingSpeed: number): void {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = true;\r\n runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;\r\n }\r\n }\r\n\r\n /**\r\n * Disable animation blending\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending\r\n */\r\n public disableBlending(): void {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = false;\r\n }\r\n }\r\n\r\n /**\r\n * Jump directly to a given frame\r\n * @param frame defines the frame to jump to\r\n */\r\n public goToFrame(frame: number): void {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n if (runtimeAnimations[0]) {\r\n const fps = runtimeAnimations[0].animation.framePerSecond;\r\n this._frameToSyncFromJump = this._frameToSyncFromJump ?? runtimeAnimations[0].currentFrame;\r\n const delay = this.speedRatio === 0 ? 0 : (((frame - this._frameToSyncFromJump) / fps) * 1000) / this.speedRatio;\r\n this._manualJumpDelay = -delay;\r\n }\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].goToFrame(frame);\r\n }\r\n\r\n this._goToFrame = frame;\r\n }\r\n\r\n /**\r\n * Pause the animation\r\n */\r\n public pause(): void {\r\n if (this._paused) {\r\n return;\r\n }\r\n this._paused = true;\r\n }\r\n\r\n /**\r\n * Restart the animation\r\n */\r\n public restart(): void {\r\n this._paused = false;\r\n }\r\n\r\n private _raiseOnAnimationEnd() {\r\n if (this.onAnimationEnd) {\r\n this.onAnimationEnd();\r\n }\r\n\r\n this.onAnimationEndObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Stop and delete the current animation\r\n * @param animationName defines a string used to only stop some of the runtime animations instead of all\r\n * @param targetMask a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n * @param useGlobalSplice if true, the animatables will be removed by the caller of this function (false by default)\r\n */\r\n public stop(animationName?: string, targetMask?: (target: any) => boolean, useGlobalSplice = false): void {\r\n if (animationName || targetMask) {\r\n const idx = this._scene._activeAnimatables.indexOf(this);\r\n\r\n if (idx > -1) {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = runtimeAnimations.length - 1; index >= 0; index--) {\r\n const runtimeAnimation = runtimeAnimations[index];\r\n if (animationName && runtimeAnimation.animation.name != animationName) {\r\n continue;\r\n }\r\n if (targetMask && !targetMask(runtimeAnimation.target)) {\r\n continue;\r\n }\r\n\r\n runtimeAnimation.dispose();\r\n runtimeAnimations.splice(index, 1);\r\n }\r\n\r\n if (runtimeAnimations.length == 0) {\r\n if (!useGlobalSplice) {\r\n this._scene._activeAnimatables.splice(idx, 1);\r\n }\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n } else {\r\n const index = this._scene._activeAnimatables.indexOf(this);\r\n\r\n if (index > -1) {\r\n if (!useGlobalSplice) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n }\r\n this._runtimeAnimations.length = 0;\r\n\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Wait asynchronously for the animation to end\r\n * @returns a promise which will be fulfilled when the animation ends\r\n */\r\n public waitAsync(): Promise<Animatable> {\r\n return new Promise((resolve) => {\r\n this.onAnimationEndObservable.add(\r\n () => {\r\n resolve(this);\r\n },\r\n undefined,\r\n undefined,\r\n this,\r\n true\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _animate(delay: number): boolean {\r\n if (this._paused) {\r\n this.animationStarted = false;\r\n if (this._pausedDelay === null) {\r\n this._pausedDelay = delay;\r\n }\r\n return true;\r\n }\r\n\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = delay;\r\n this._pausedDelay = null;\r\n } else if (this._pausedDelay !== null) {\r\n this._localDelayOffset += delay - this._pausedDelay;\r\n this._pausedDelay = null;\r\n }\r\n\r\n if (this._manualJumpDelay !== null) {\r\n this._localDelayOffset += this._manualJumpDelay;\r\n this._manualJumpDelay = null;\r\n this._frameToSyncFromJump = null;\r\n }\r\n\r\n this._goToFrame = null;\r\n\r\n if (this._weight === 0) {\r\n // We consider that an animation with a weight === 0 is \"actively\" paused\r\n return true;\r\n }\r\n\r\n // Animating\r\n let running = false;\r\n const runtimeAnimations = this._runtimeAnimations;\r\n let index: number;\r\n\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n const animation = runtimeAnimations[index];\r\n const isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);\r\n running = running || isRunning;\r\n }\r\n\r\n this.animationStarted = running;\r\n\r\n if (!running) {\r\n if (this.disposeOnEnd) {\r\n // Remove from active animatables\r\n index = this._scene._activeAnimatables.indexOf(this);\r\n this._scene._activeAnimatables.splice(index, 1);\r\n\r\n // Dispose all runtime animations\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n }\r\n\r\n this._raiseOnAnimationEnd();\r\n\r\n if (this.disposeOnEnd) {\r\n this.onAnimationEnd = null;\r\n this.onAnimationLoop = null;\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationEndObservable.clear();\r\n }\r\n }\r\n\r\n return running;\r\n }\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /** @internal */\r\n _registerTargetForLateAnimationBinding(runtimeAnimation: RuntimeAnimation, originalValue: any): void;\r\n\r\n /** @internal */\r\n _processLateAnimationBindingsForMatrices(holder: {\r\n totalWeight: number;\r\n totalAdditiveWeight: number;\r\n animations: RuntimeAnimation[];\r\n additiveAnimations: RuntimeAnimation[];\r\n originalValue: Matrix;\r\n }): any;\r\n\r\n /** @internal */\r\n _processLateAnimationBindingsForQuaternions(\r\n holder: {\r\n totalWeight: number;\r\n totalAdditiveWeight: number;\r\n animations: RuntimeAnimation[];\r\n additiveAnimations: RuntimeAnimation[];\r\n originalValue: Quaternion;\r\n },\r\n refQuaternion: Quaternion\r\n ): Quaternion;\r\n\r\n /** @internal */\r\n _processLateAnimationBindings(): void;\r\n\r\n /**\r\n * Will start the animation sequence of a given target\r\n * @param target defines the target\r\n * @param from defines from which frame should animation start\r\n * @param to defines until which frame should animation run.\r\n * @param weight defines the weight to apply to the animation (1.0 by default)\r\n * @param loop defines if the animation loops\r\n * @param speedRatio defines the speed in which to run the animation (1.0 by default)\r\n * @param onAnimationEnd defines the function to be executed when the animation ends\r\n * @param animatable defines an animatable object. If not provided a new one will be created from the given params\r\n * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the animatable object created for this animation\r\n */\r\n beginWeightedAnimation(\r\n target: any,\r\n from: number,\r\n to: number,\r\n weight: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable;\r\n\r\n /**\r\n * Will start the animation sequence of a given target\r\n * @param target defines the target\r\n * @param from defines from which frame should animation start\r\n * @param to defines until which frame should animation run.\r\n * @param loop defines if the animation loops\r\n * @param speedRatio defines the speed in which to run the animation (1.0 by default)\r\n * @param onAnimationEnd defines the function to be executed when the animation ends\r\n * @param animatable defines an animatable object. If not provided a new one will be created from the given params\r\n * @param stopCurrent defines if the current animations must be stopped first (true by default)\r\n * @param targetMask defines if the target should be animate if animations are present (this is called recursively on descendant animatables regardless of return value)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the animatable object created for this animation\r\n */\r\n beginAnimation(\r\n target: any,\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n stopCurrent?: boolean,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable;\r\n\r\n /**\r\n * Will start the animation sequence of a given target and its hierarchy\r\n * @param target defines the target\r\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.\r\n * @param from defines from which frame should animation start\r\n * @param to defines until which frame should animation run.\r\n * @param loop defines if the animation loops\r\n * @param speedRatio defines the speed in which to run the animation (1.0 by default)\r\n * @param onAnimationEnd defines the function to be executed when the animation ends\r\n * @param animatable defines an animatable object. If not provided a new one will be created from the given params\r\n * @param stopCurrent defines if the current animations must be stopped first (true by default)\r\n * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the list of created animatables\r\n */\r\n beginHierarchyAnimation(\r\n target: any,\r\n directDescendantsOnly: boolean,\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n stopCurrent?: boolean,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable[];\r\n\r\n /**\r\n * Begin a new animation on a given node\r\n * @param target defines the target where the animation will take place\r\n * @param animations defines the list of animations to start\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loop defines if you want animation to loop (off by default)\r\n * @param speedRatio defines the speed ratio to apply to all animations\r\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the list of created animatables\r\n */\r\n beginDirectAnimation(\r\n target: any,\r\n animations: Animation[],\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable;\r\n\r\n /**\r\n * Begin a new animation on a given node and its hierarchy\r\n * @param target defines the root node where the animation will take place\r\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.\r\n * @param animations defines the list of animations to start\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loop defines if you want animation to loop (off by default)\r\n * @param speedRatio defines the speed ratio to apply to all animations\r\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the list of animatables created for all nodes\r\n */\r\n beginDirectHierarchyAnimation(\r\n target: Node,\r\n directDescendantsOnly: boolean,\r\n animations: Animation[],\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable[];\r\n\r\n /**\r\n * Gets the animatable associated with a specific target\r\n * @param target defines the target of the animatable\r\n * @returns the required animatable if found\r\n */\r\n getAnimatableByTarget(target: any): Nullable<Animatable>;\r\n\r\n /**\r\n * Gets all animatables associated with a given target\r\n * @param target defines the target to look animatables for\r\n * @returns an array of Animatables\r\n */\r\n getAllAnimatablesByTarget(target: any): Array<Animatable>;\r\n\r\n /**\r\n * Stops and removes all animations that have been applied to the scene\r\n */\r\n stopAllAnimations(): void;\r\n\r\n /**\r\n * Gets the current delta time used by animation engine\r\n */\r\n deltaTime: number;\r\n }\r\n}\r\n\r\nScene.prototype._animate = function (): void {\r\n if (!this.animationsEnabled) {\r\n return;\r\n }\r\n\r\n // Getting time\r\n const now = PrecisionDate.Now;\r\n if (!this._animationTimeLast) {\r\n if (this._pendingData.length > 0) {\r\n return;\r\n }\r\n this._animationTimeLast = now;\r\n }\r\n\r\n this.deltaTime = this.useConstantAnimationDeltaTime ? 16.0 : (now - this._animationTimeLast) * this.animationTimeScale;\r\n this._animationTimeLast = now;\r\n\r\n const animatables = this._activeAnimatables;\r\n if (animatables.length === 0) {\r\n return;\r\n }\r\n\r\n this._animationTime += this.deltaTime;\r\n const animationTime = this._animationTime;\r\n\r\n for (let index = 0; index < animatables.length; index++) {\r\n const animatable = animatables[index];\r\n\r\n if (!animatable._animate(animationTime) && animatable.disposeOnEnd) {\r\n index--; // Array was updated\r\n }\r\n }\r\n\r\n // Late animation bindings\r\n this._processLateAnimationBindings();\r\n};\r\n\r\nScene.prototype.beginWeightedAnimation = function (\r\n target: any,\r\n from: number,\r\n to: number,\r\n weight = 1.0,\r\n loop?: boolean,\r\n speedRatio: number = 1.0,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable {\r\n const returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false, targetMask, onAnimationLoop, isAdditive);\r\n returnedAnimatable.weight = weight;\r\n\r\n return returnedAnimatable;\r\n};\r\n\r\nScene.prototype.beginAnimation = function (\r\n target: any,\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio: number = 1.0,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n stopCurrent = true,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable {\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n }\r\n\r\n if (stopCurrent) {\r\n this.stopAnimation(target, undefined, targetMask);\r\n }\r\n\r\n if (!animatable) {\r\n animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, undefined, onAnimationLoop, isAdditive);\r\n }\r\n\r\n const shouldRunTargetAnimations = targetMask ? targetMask(target) : true;\r\n // Local animations\r\n if (target.animations && shouldRunTargetAnimations) {\r\n animatable.appendAnimations(target, target.animations);\r\n }\r\n\r\n // Children animations\r\n if (target.getAnimatables) {\r\n const animatables = target.getAnimatables();\r\n for (let index = 0; index < animatables.length; index++) {\r\n this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop);\r\n }\r\n }\r\n\r\n animatable.reset();\r\n\r\n return animatable;\r\n};\r\n\r\nScene.prototype.beginHierarchyAnimation = function (\r\n target: any,\r\n directDescendantsOnly: boolean,\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio: number = 1.0,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n stopCurrent = true,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable[] {\r\n const children = target.getDescendants(directDescendantsOnly);\r\n\r\n const result = [];\r\n result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\r\n for (const child of children) {\r\n result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\r\n }\r\n\r\n return result;\r\n};\r\n\r\nScene.prototype.beginDirectAnimation = function (\r\n target: any,\r\n animations: Animation[],\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable {\r\n if (speedRatio === undefined) {\r\n speedRatio = 1.0;\r\n }\r\n\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n } else if (to > from && speedRatio < 0) {\r\n const temp = to;\r\n to = from;\r\n from = temp;\r\n }\r\n\r\n const animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations, onAnimationLoop, isAdditive);\r\n\r\n return animatable;\r\n};\r\n\r\nScene.prototype.beginDirectHierarchyAnimation = function (\r\n target: Node,\r\n directDescendantsOnly: boolean,\r\n animations: Animation[],\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable[] {\r\n const children = target.getDescendants(directDescendantsOnly);\r\n\r\n const result = [];\r\n result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\r\n for (const child of children) {\r\n result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\r\n }\r\n\r\n return result;\r\n};\r\n\r\nScene.prototype.getAnimatableByTarget = function (target: any): Nullable<Animatable> {\r\n for (let index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n return this._activeAnimatables[index];\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nScene.prototype.getAllAnimatablesByTarget = function (target: any): Array<Animatable> {\r\n const result = [];\r\n for (let index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n result.push(this._activeAnimatables[index]);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\nScene.prototype.stopAnimation = function (target: any, animationName?: string, targetMask?: (target: any) => boolean): void {\r\n const animatables = this.getAllAnimatablesByTarget(target);\r\n\r\n for (const animatable of animatables) {\r\n animatable.stop(animationName, targetMask);\r\n }\r\n};\r\n\r\n/**\r\n * Stops and removes all animations that have been applied to the scene\r\n */\r\nScene.prototype.stopAllAnimations = function (): void {\r\n if (this._activeAnimatables) {\r\n for (let i = 0; i < this._activeAnimatables.length; i++) {\r\n this._activeAnimatables[i].stop();\r\n }\r\n this._activeAnimatables.length = 0;\r\n }\r\n\r\n for (const group of this.animationGroups) {\r\n group.stop();\r\n }\r\n};\r\n\r\nScene.prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation: RuntimeAnimation, originalValue: any): void {\r\n const target = runtimeAnimation.target;\r\n this._registeredForLateAnimationBindings.pushNoDuplicate(target);\r\n\r\n if (!target._lateAnimationHolders) {\r\n target._lateAnimationHolders = {};\r\n }\r\n\r\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\r\n totalWeight: 0,\r\n totalAdditiveWeight: 0,\r\n animations: [],\r\n additiveAnimations: [],\r\n originalValue: originalValue,\r\n };\r\n }\r\n\r\n if (runtimeAnimation.isAdditive) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].additiveAnimations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalAdditiveWeight += runtimeAnimation.weight;\r\n } else {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\r\n }\r\n};\r\n\r\nScene.prototype._processLateAnimationBindingsForMatrices = function (holder: {\r\n totalWeight: number;\r\n totalAdditiveWeight: number;\r\n animations: RuntimeAnimation[];\r\n additiveAnimations: RuntimeAnimation[];\r\n originalValue: Matrix;\r\n}): any {\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\r\n return holder.originalValue;\r\n }\r\n\r\n let normalizer = 1.0;\r\n const finalPosition = TmpVectors.Vector3[0];\r\n const finalScaling = TmpVectors.Vector3[1];\r\n const finalQuaternion = TmpVectors.Quaternion[0];\r\n let startIndex = 0;\r\n const originalAnimation = holder.animations[0];\r\n const originalValue = holder.originalValue;\r\n\r\n let scale = 1;\r\n let skipOverride = false;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n scale = 1.0 - holder.totalWeight;\r\n originalValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n } else {\r\n startIndex = 1;\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n scale = originalAnimation.weight / normalizer;\r\n if (scale == 1) {\r\n if (holder.totalAdditiveWeight) {\r\n skipOverride = true;\r\n } else {\r\n return originalAnimation.currentValue;\r\n }\r\n }\r\n\r\n originalAnimation.currentValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n }\r\n\r\n // Add up the override animations\r\n if (!skipOverride) {\r\n finalScaling.scaleInPlace(scale);\r\n finalPosition.scaleInPlace(scale);\r\n finalQuaternion.scaleInPlace(scale);\r\n\r\n for (let animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n const runtimeAnimation = holder.animations[animIndex];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n\r\n scale = runtimeAnimation.weight / normalizer;\r\n const currentPosition = TmpVectors.Vector3[2];\r\n const currentScaling = TmpVectors.Vector3[3];\r\n const currentQuaternion = TmpVectors.Quaternion[1];\r\n\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n\r\n currentScaling.scaleAndAddToRef(scale, finalScaling);\r\n currentQuaternion.scaleAndAddToRef(Quaternion.Dot(finalQuaternion, currentQuaternion) > 0 ? scale : -scale, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(scale, finalPosition);\r\n }\r\n\r\n finalQuaternion.normalize();\r\n }\r\n\r\n // Add up the additive animations\r\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\r\n const runtimeAnimation = holder.additiveAnimations[animIndex];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n\r\n const currentPosition = TmpVectors.Vector3[2];\r\n const currentScaling = TmpVectors.Vector3[3];\r\n const currentQuaternion = TmpVectors.Quaternion[1];\r\n\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n currentScaling.multiplyToRef(finalScaling, currentScaling);\r\n Vector3.LerpToRef(finalScaling, currentScaling, runtimeAnimation.weight, finalScaling);\r\n finalQuaternion.multiplyToRef(currentQuaternion, currentQuaternion);\r\n Quaternion.SlerpToRef(finalQuaternion, currentQuaternion, runtimeAnimation.weight, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(runtimeAnimation.weight, finalPosition);\r\n }\r\n\r\n const workValue = originalAnimation ? originalAnimation._animationState.workValue : TmpVectors.Matrix[0].clone();\r\n Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, workValue);\r\n return workValue;\r\n};\r\n\r\nScene.prototype._processLateAnimationBindingsForQuaternions = function (\r\n holder: {\r\n totalWeight: number;\r\n totalAdditiveWeight: number;\r\n animations: RuntimeAnimation[];\r\n additiveAnimations: RuntimeAnimation[];\r\n originalValue: Quaternion;\r\n },\r\n refQuaternion: Quaternion\r\n): Quaternion {\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\r\n return refQuaternion;\r\n }\r\n\r\n const originalAnimation = holder.animations[0];\r\n const originalValue = holder.originalValue;\r\n let cumulativeQuaternion = refQuaternion;\r\n\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight > 0) {\r\n cumulativeQuaternion.copyFrom(originalValue);\r\n } else if (holder.animations.length === 1) {\r\n Quaternion.SlerpToRef(originalValue, originalAnimation.currentValue, Math.min(1.0, holder.totalWeight), cumulativeQuaternion);\r\n\r\n if (holder.totalAdditiveWeight === 0) {\r\n return cumulativeQuaternion;\r\n }\r\n } else if (holder.animations.length > 1) {\r\n // Add up the override animations\r\n let normalizer = 1.0;\r\n let quaternions: Array<Quaternion>;\r\n let weights: Array<number>;\r\n\r\n if (holder.totalWeight < 1.0) {\r\n const scale = 1.0 - holder.totalWeight;\r\n\r\n quaternions = [];\r\n weights = [];\r\n\r\n quaternions.push(originalValue);\r\n weights.push(scale);\r\n } else {\r\n if (holder.animations.length === 2) {\r\n // Slerp as soon as we can\r\n Quaternion.SlerpToRef(holder.animations[0].currentValue, holder.animations[1].currentValue, holder.animations[1].weight / holder.totalWeight, refQuaternion);\r\n\r\n if (holder.totalAdditiveWeight === 0) {\r\n return refQuaternion;\r\n }\r\n }\r\n\r\n quaternions = [];\r\n weights = [];\r\n normalizer = holder.totalWeight;\r\n }\r\n\r\n for (let animIndex = 0; animIndex < holder.animations.length; animIndex++) {\r\n const runtimeAnimation = holder.animations[animIndex];\r\n quaternions.push(runtimeAnimation.currentValue);\r\n weights.push(runtimeAnimation.weight / normalizer);\r\n }\r\n\r\n // https://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions\r\n\r\n let cumulativeAmount = 0;\r\n for (let index = 0; index < quaternions.length; ) {\r\n if (!index) {\r\n Quaternion.SlerpToRef(quaternions[index], quaternions[index + 1], weights[index + 1] / (weights[index] + weights[index + 1]), refQuaternion);\r\n cumulativeQuaternion = refQuaternion;\r\n cumulativeAmount = weights[index] + weights[index + 1];\r\n index += 2;\r\n continue;\r\n }\r\n cumulativeAmount += weights[index];\r\n Quaternion.SlerpToRef(cumulativeQuaternion, quaternions[index], weights[index] / cumulativeAmount, cumulativeQuaternion);\r\n index++;\r\n }\r\n }\r\n\r\n // Add up the additive animations\r\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\r\n const runtimeAnimation = holder.additiveAnimations[animIndex];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n\r\n cumulativeQuaternion.multiplyToRef(runtimeAnimation.currentValue, TmpVectors.Quaternion[0]);\r\n Quaternion.SlerpToRef(cumulativeQuaternion, TmpVectors.Quaternion[0], runtimeAnimation.weight, cumulativeQuaternion);\r\n }\r\n\r\n return cumulativeQuaternion!;\r\n};\r\n\r\nScene.prototype._processLateAnimationBindings = function (): void {\r\n if (!this._registeredForLateAnimationBindings.length) {\r\n return;\r\n }\r\n for (let index = 0; index < this._registeredForLateAnimationBindings.length; index++) {\r\n const target = this._registeredForLateAnimationBindings.data[index];\r\n\r\n for (const path in target._lateAnimationHolders) {\r\n const holder = target._lateAnimationHolders[path];\r\n const originalAnimation: RuntimeAnimation = holder.animations[0];\r\n const originalValue = holder.originalValue;\r\n if (originalValue === undefined || originalValue === null) {\r\n continue;\r\n }\r\n const matrixDecomposeMode = Animation.AllowMatrixDecomposeForInterpolation && originalValue.m; // ie. data is matrix\r\n\r\n let finalValue: any = target[path];\r\n if (matrixDecomposeMode) {\r\n finalValue = this._processLateAnimationBindingsForMatrices(holder);\r\n } else {\r\n const quaternionMode = originalValue.w !== undefined;\r\n if (quaternionMode) {\r\n finalValue = this._processLateAnimationBindingsForQuaternions(holder, finalValue || Quaternion.Identity());\r\n } else {\r\n let startIndex = 0;\r\n let normalizer = 1.0;\r\n\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n if (originalAnimation && originalValue.scale) {\r\n finalValue = originalValue.scale(1.0 - holder.totalWeight);\r\n } else if (originalAnimation) {\r\n finalValue = originalValue * (1.0 - holder.totalWeight);\r\n } else if (originalValue.clone) {\r\n finalValue = originalValue.clone();\r\n } else {\r\n finalValue = originalValue;\r\n }\r\n } else if (originalAnimation) {\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n const scale = originalAnimation.weight / normalizer;\r\n if (scale !== 1) {\r\n if (originalAnimation.currentValue.scale) {\r\n finalValue = originalAnimation.currentValue.scale(scale);\r\n } else {\r\n finalValue = originalAnimation.currentValue * scale;\r\n }\r\n } else {\r\n finalValue = originalAnimation.currentValue;\r\n }\r\n\r\n startIndex = 1;\r\n }\r\n\r\n // Add up the override animations\r\n for (let animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n const runtimeAnimation = holder.animations[animIndex];\r\n const scale = runtimeAnimation.weight / normalizer;\r\n\r\n if (!scale) {\r\n continue;\r\n } else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n } else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n\r\n // Add up the additive animations\r\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\r\n const runtimeAnimation = holder.additiveAnimations[animIndex];\r\n const scale: number = runtimeAnimation.weight;\r\n\r\n if (!scale) {\r\n continue;\r\n } else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n } else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n }\r\n }\r\n target[path] = finalValue;\r\n }\r\n\r\n target._lateAnimationHolders = {};\r\n }\r\n this._registeredForLateAnimationBindings.reset();\r\n};\r\n\r\ndeclare module \"../Bones/bone\" {\r\n export interface Bone {\r\n /**\r\n * Copy an animation range from another bone\r\n * @param source defines the source bone\r\n * @param rangeName defines the range name to copy\r\n * @param frameOffset defines the frame offset\r\n * @param rescaleAsRequired defines if rescaling must be applied if required\r\n * @param skelDimensionsRatio defines the scaling ratio\r\n * @returns true if operation was successful\r\n */\r\n copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired: boolean, skelDimensionsRatio: Nullable<Vector3>): boolean;\r\n }\r\n}\r\n\r\nBone.prototype.copyAnimationRange = function (\r\n source: Bone,\r\n rangeName: string,\r\n frameOffset: number,\r\n rescaleAsRequired = false,\r\n skelDimensionsRatio: Nullable<Vector3> = null\r\n): boolean {\r\n // all animation may be coming from a library skeleton, so may need to create animation\r\n if (this.animations.length === 0) {\r\n this.animations.push(new Animation(this.name, \"_matrix\", source.animations[0].framePerSecond, Animation.ANIMATIONTYPE_MATRIX, 0));\r\n this.animations[0].setKeys([]);\r\n }\r\n\r\n // get animation info / verify there is such a range from the source bone\r\n const sourceRange = source.animations[0].getRange(rangeName);\r\n if (!sourceRange) {\r\n return false;\r\n }\r\n const from = sourceRange.from;\r\n const to = sourceRange.to;\r\n const sourceKeys = source.animations[0].getKeys();\r\n\r\n // rescaling prep\r\n const sourceBoneLength = source.length;\r\n const sourceParent = source.getParent();\r\n const parent = this.getParent();\r\n const parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;\r\n const parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;\r\n\r\n const dimensionsScalingReqd =\r\n rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);\r\n\r\n const destKeys = this.animations[0].getKeys();\r\n\r\n // loop vars declaration\r\n let orig: { frame: number; value: Matrix };\r\n let origTranslation: Vector3;\r\n let mat: Matrix;\r\n\r\n for (let key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {\r\n orig = sourceKeys[key];\r\n if (orig.frame >= from && orig.frame <= to) {\r\n if (rescaleAsRequired) {\r\n mat = orig.value.clone();\r\n\r\n // scale based on parent ratio, when bone has parent\r\n if (parentScalingReqd) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.scaleInPlace(parentRatio));\r\n\r\n // scale based on skeleton dimension ratio when root bone, and value is passed\r\n } else if (dimensionsScalingReqd && skelDimensionsRatio) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));\r\n\r\n // use original when root bone, and no data for skelDimensionsRatio\r\n } else {\r\n mat = orig.value;\r\n }\r\n } else {\r\n mat = orig.value;\r\n }\r\n destKeys.push({ frame: orig.frame + frameOffset, value: mat });\r\n }\r\n }\r\n this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);\r\n return true;\r\n};\r\n"]}
1
+ {"version":3,"file":"animatable.js","sourceRoot":"","sources":["../../../../lts/core/generated/Animations/animatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC;;GAEG;AACH,MAAM,OAAO,UAAU;IAmCnB;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,IAAW,WAAW;QAClB,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;YACtC,OAAO,CAAC,CAAC;SACZ;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,KAAa;QAC3B,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,+BAA+B;YAC/B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;YAClB,OAAO;SACV;QAED,sCAAsC;QACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC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;YACD,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;SAClE;KACJ;IACD,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,GAAG,WAAW,EAAE,EAAE,GAAG,WAAW,CAAC,CAAC;IAChF,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { Animation } from \"./animation\";\r\nimport { RuntimeAnimation } from \"./runtimeAnimation\";\r\n\r\nimport type { Nullable } from \"../types\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { Matrix, Quaternion, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { PrecisionDate } from \"../Misc/precisionDate\";\r\nimport { Bone } from \"../Bones/bone\";\r\nimport type { Node } from \"../node\";\r\n\r\n/**\r\n * Class used to store an actual running animation\r\n */\r\nexport class Animatable {\r\n private _localDelayOffset: Nullable<number> = null;\r\n private _pausedDelay: Nullable<number> = null;\r\n private _manualJumpDelay: Nullable<number> = null;\r\n /** @hidden */\r\n public _runtimeAnimations = new Array<RuntimeAnimation>();\r\n private _paused = false;\r\n private _scene: Scene;\r\n private _speedRatio = 1;\r\n private _weight = -1.0;\r\n private _syncRoot: Nullable<Animatable> = null;\r\n private _frameToSyncFromJump: Nullable<number> = null;\r\n private _goToFrame: Nullable<number> = null;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.\r\n * This will only apply for non looping animation (default is true)\r\n */\r\n public disposeOnEnd = true;\r\n\r\n /**\r\n * Gets a boolean indicating if the animation has started\r\n */\r\n public animationStarted = false;\r\n\r\n /**\r\n * Observer raised when the animation ends\r\n */\r\n public onAnimationEndObservable = new Observable<Animatable>();\r\n\r\n /**\r\n * Observer raised when the animation loops\r\n */\r\n public onAnimationLoopObservable = new Observable<Animatable>();\r\n\r\n /**\r\n * Gets the root Animatable used to synchronize and normalize animations\r\n */\r\n public get syncRoot(): Nullable<Animatable> {\r\n return this._syncRoot;\r\n }\r\n\r\n /**\r\n * Gets the current frame of the first RuntimeAnimation\r\n * Used to synchronize Animatables\r\n */\r\n public get masterFrame(): number {\r\n if (this._runtimeAnimations.length === 0) {\r\n return 0;\r\n }\r\n\r\n return this._runtimeAnimations[0].currentFrame;\r\n }\r\n\r\n /**\r\n * Gets or sets the animatable weight (-1.0 by default meaning not weighted)\r\n */\r\n public get weight(): number {\r\n return this._weight;\r\n }\r\n\r\n public set weight(value: number) {\r\n if (value === -1) {\r\n // -1 is ok and means no weight\r\n this._weight = -1;\r\n return;\r\n }\r\n\r\n // Else weight must be in [0, 1] range\r\n this._weight = Math.min(Math.max(value, 0), 1.0);\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to apply to the animatable (1.0 by default)\r\n */\r\n public get speedRatio(): number {\r\n return this._speedRatio;\r\n }\r\n\r\n public set speedRatio(value: number) {\r\n for (let index = 0; index < this._runtimeAnimations.length; index++) {\r\n const animation = this._runtimeAnimations[index];\r\n\r\n animation._prepareForSpeedRatioChange(value);\r\n }\r\n this._speedRatio = value;\r\n\r\n // Resync _manualJumpDelay in case goToFrame was called before speedRatio was set.\r\n if (this._goToFrame !== null) {\r\n this.goToFrame(this._goToFrame);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new Animatable\r\n * @param scene defines the hosting scene\r\n * @param target defines the target object\r\n * @param fromFrame defines the starting frame number (default is 0)\r\n * @param toFrame defines the ending frame number (default is 100)\r\n * @param loopAnimation defines if the animation must loop (default is false)\r\n * @param speedRatio defines the factor to apply to animation speed (default is 1)\r\n * @param onAnimationEnd defines a callback to call when animation ends if it is not looping\r\n * @param animations defines a group of animation to add to the new Animatable\r\n * @param onAnimationLoop defines a callback to call when animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively\r\n */\r\n constructor(\r\n scene: Scene,\r\n /** defines the target object */\r\n public target: any,\r\n /** defines the starting frame number (default is 0) */\r\n public fromFrame: number = 0,\r\n /** defines the ending frame number (default is 100) */\r\n public toFrame: number = 100,\r\n /** defines if the animation must loop (default is false) */\r\n public loopAnimation: boolean = false,\r\n speedRatio: number = 1.0,\r\n /** defines a callback to call when animation ends if it is not looping */\r\n public onAnimationEnd?: Nullable<() => void>,\r\n animations?: Animation[],\r\n /** defines a callback to call when animation loops */\r\n public onAnimationLoop?: Nullable<() => void>,\r\n /** defines whether the animation should be evaluated additively */\r\n public isAdditive: boolean = false\r\n ) {\r\n this._scene = scene;\r\n if (animations) {\r\n this.appendAnimations(target, animations);\r\n }\r\n\r\n this._speedRatio = speedRatio;\r\n scene._activeAnimatables.push(this);\r\n }\r\n\r\n // Methods\r\n /**\r\n * Synchronize and normalize current Animatable with a source Animatable\r\n * This is useful when using animation weights and when animations are not of the same length\r\n * @param root defines the root Animatable to synchronize with (null to stop synchronizing)\r\n * @returns the current Animatable\r\n */\r\n public syncWith(root: Nullable<Animatable>): Animatable {\r\n this._syncRoot = root;\r\n\r\n if (root) {\r\n // Make sure this animatable will animate after the root\r\n const index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n this._scene._activeAnimatables.push(this);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the list of runtime animations\r\n * @returns an array of RuntimeAnimation\r\n */\r\n public getAnimations(): RuntimeAnimation[] {\r\n return this._runtimeAnimations;\r\n }\r\n\r\n /**\r\n * Adds more animations to the current animatable\r\n * @param target defines the target of the animations\r\n * @param animations defines the new animations to add\r\n */\r\n public appendAnimations(target: any, animations: Animation[]): void {\r\n for (let index = 0; index < animations.length; index++) {\r\n const animation = animations[index];\r\n\r\n const newRuntimeAnimation = new RuntimeAnimation(target, animation, this._scene, this);\r\n newRuntimeAnimation._onLoop = () => {\r\n this.onAnimationLoopObservable.notifyObservers(this);\r\n if (this.onAnimationLoop) {\r\n this.onAnimationLoop();\r\n }\r\n };\r\n\r\n this._runtimeAnimations.push(newRuntimeAnimation);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the source animation for a specific property\r\n * @param property defines the property to look for\r\n * @returns null or the source animation for the given property\r\n */\r\n public getAnimationByTargetProperty(property: string): Nullable<Animation> {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index].animation;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the runtime animation for a specific property\r\n * @param property defines the property to look for\r\n * @returns null or the runtime animation for the given property\r\n */\r\n public getRuntimeAnimationByTargetProperty(property: string): Nullable<RuntimeAnimation> {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Resets the animatable to its original state\r\n */\r\n public reset(): void {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].reset(true);\r\n }\r\n\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n }\r\n\r\n /**\r\n * Allows the animatable to blend with current running animations\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending\r\n * @param blendingSpeed defines the blending speed to use\r\n */\r\n public enableBlending(blendingSpeed: number): void {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = true;\r\n runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;\r\n }\r\n }\r\n\r\n /**\r\n * Disable animation blending\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending\r\n */\r\n public disableBlending(): void {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = false;\r\n }\r\n }\r\n\r\n /**\r\n * Jump directly to a given frame\r\n * @param frame defines the frame to jump to\r\n */\r\n public goToFrame(frame: number): void {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n if (runtimeAnimations[0]) {\r\n const fps = runtimeAnimations[0].animation.framePerSecond;\r\n this._frameToSyncFromJump = this._frameToSyncFromJump ?? runtimeAnimations[0].currentFrame;\r\n const delay = this.speedRatio === 0 ? 0 : (((frame - this._frameToSyncFromJump) / fps) * 1000) / this.speedRatio;\r\n this._manualJumpDelay = -delay;\r\n }\r\n\r\n for (let index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].goToFrame(frame);\r\n }\r\n\r\n this._goToFrame = frame;\r\n }\r\n\r\n /**\r\n * Pause the animation\r\n */\r\n public pause(): void {\r\n if (this._paused) {\r\n return;\r\n }\r\n this._paused = true;\r\n }\r\n\r\n /**\r\n * Restart the animation\r\n */\r\n public restart(): void {\r\n this._paused = false;\r\n }\r\n\r\n private _raiseOnAnimationEnd() {\r\n if (this.onAnimationEnd) {\r\n this.onAnimationEnd();\r\n }\r\n\r\n this.onAnimationEndObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Stop and delete the current animation\r\n * @param animationName defines a string used to only stop some of the runtime animations instead of all\r\n * @param targetMask a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n * @param useGlobalSplice if true, the animatables will be removed by the caller of this function (false by default)\r\n */\r\n public stop(animationName?: string, targetMask?: (target: any) => boolean, useGlobalSplice = false): void {\r\n if (animationName || targetMask) {\r\n const idx = this._scene._activeAnimatables.indexOf(this);\r\n\r\n if (idx > -1) {\r\n const runtimeAnimations = this._runtimeAnimations;\r\n\r\n for (let index = runtimeAnimations.length - 1; index >= 0; index--) {\r\n const runtimeAnimation = runtimeAnimations[index];\r\n if (animationName && runtimeAnimation.animation.name != animationName) {\r\n continue;\r\n }\r\n if (targetMask && !targetMask(runtimeAnimation.target)) {\r\n continue;\r\n }\r\n\r\n runtimeAnimation.dispose();\r\n runtimeAnimations.splice(index, 1);\r\n }\r\n\r\n if (runtimeAnimations.length == 0) {\r\n if (!useGlobalSplice) {\r\n this._scene._activeAnimatables.splice(idx, 1);\r\n }\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n } else {\r\n const index = this._scene._activeAnimatables.indexOf(this);\r\n\r\n if (index > -1) {\r\n if (!useGlobalSplice) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n }\r\n this._runtimeAnimations.length = 0;\r\n\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Wait asynchronously for the animation to end\r\n * @returns a promise which will be fulfilled when the animation ends\r\n */\r\n public waitAsync(): Promise<Animatable> {\r\n return new Promise((resolve) => {\r\n this.onAnimationEndObservable.add(\r\n () => {\r\n resolve(this);\r\n },\r\n undefined,\r\n undefined,\r\n this,\r\n true\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _animate(delay: number): boolean {\r\n if (this._paused) {\r\n this.animationStarted = false;\r\n if (this._pausedDelay === null) {\r\n this._pausedDelay = delay;\r\n }\r\n return true;\r\n }\r\n\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = delay;\r\n this._pausedDelay = null;\r\n } else if (this._pausedDelay !== null) {\r\n this._localDelayOffset += delay - this._pausedDelay;\r\n this._pausedDelay = null;\r\n }\r\n\r\n if (this._manualJumpDelay !== null) {\r\n this._localDelayOffset += this._manualJumpDelay;\r\n this._manualJumpDelay = null;\r\n this._frameToSyncFromJump = null;\r\n }\r\n\r\n this._goToFrame = null;\r\n\r\n if (this._weight === 0) {\r\n // We consider that an animation with a weight === 0 is \"actively\" paused\r\n return true;\r\n }\r\n\r\n // Animating\r\n let running = false;\r\n const runtimeAnimations = this._runtimeAnimations;\r\n let index: number;\r\n\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n const animation = runtimeAnimations[index];\r\n const isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);\r\n running = running || isRunning;\r\n }\r\n\r\n this.animationStarted = running;\r\n\r\n if (!running) {\r\n if (this.disposeOnEnd) {\r\n // Remove from active animatables\r\n index = this._scene._activeAnimatables.indexOf(this);\r\n this._scene._activeAnimatables.splice(index, 1);\r\n\r\n // Dispose all runtime animations\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n }\r\n\r\n this._raiseOnAnimationEnd();\r\n\r\n if (this.disposeOnEnd) {\r\n this.onAnimationEnd = null;\r\n this.onAnimationLoop = null;\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationEndObservable.clear();\r\n }\r\n }\r\n\r\n return running;\r\n }\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /** @internal */\r\n _registerTargetForLateAnimationBinding(runtimeAnimation: RuntimeAnimation, originalValue: any): void;\r\n\r\n /** @internal */\r\n _processLateAnimationBindingsForMatrices(holder: {\r\n totalWeight: number;\r\n totalAdditiveWeight: number;\r\n animations: RuntimeAnimation[];\r\n additiveAnimations: RuntimeAnimation[];\r\n originalValue: Matrix;\r\n }): any;\r\n\r\n /** @internal */\r\n _processLateAnimationBindingsForQuaternions(\r\n holder: {\r\n totalWeight: number;\r\n totalAdditiveWeight: number;\r\n animations: RuntimeAnimation[];\r\n additiveAnimations: RuntimeAnimation[];\r\n originalValue: Quaternion;\r\n },\r\n refQuaternion: Quaternion\r\n ): Quaternion;\r\n\r\n /** @internal */\r\n _processLateAnimationBindings(): void;\r\n\r\n /**\r\n * Will start the animation sequence of a given target\r\n * @param target defines the target\r\n * @param from defines from which frame should animation start\r\n * @param to defines until which frame should animation run.\r\n * @param weight defines the weight to apply to the animation (1.0 by default)\r\n * @param loop defines if the animation loops\r\n * @param speedRatio defines the speed in which to run the animation (1.0 by default)\r\n * @param onAnimationEnd defines the function to be executed when the animation ends\r\n * @param animatable defines an animatable object. If not provided a new one will be created from the given params\r\n * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the animatable object created for this animation\r\n */\r\n beginWeightedAnimation(\r\n target: any,\r\n from: number,\r\n to: number,\r\n weight: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable;\r\n\r\n /**\r\n * Will start the animation sequence of a given target\r\n * @param target defines the target\r\n * @param from defines from which frame should animation start\r\n * @param to defines until which frame should animation run.\r\n * @param loop defines if the animation loops\r\n * @param speedRatio defines the speed in which to run the animation (1.0 by default)\r\n * @param onAnimationEnd defines the function to be executed when the animation ends\r\n * @param animatable defines an animatable object. If not provided a new one will be created from the given params\r\n * @param stopCurrent defines if the current animations must be stopped first (true by default)\r\n * @param targetMask defines if the target should be animate if animations are present (this is called recursively on descendant animatables regardless of return value)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the animatable object created for this animation\r\n */\r\n beginAnimation(\r\n target: any,\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n stopCurrent?: boolean,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable;\r\n\r\n /**\r\n * Will start the animation sequence of a given target and its hierarchy\r\n * @param target defines the target\r\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.\r\n * @param from defines from which frame should animation start\r\n * @param to defines until which frame should animation run.\r\n * @param loop defines if the animation loops\r\n * @param speedRatio defines the speed in which to run the animation (1.0 by default)\r\n * @param onAnimationEnd defines the function to be executed when the animation ends\r\n * @param animatable defines an animatable object. If not provided a new one will be created from the given params\r\n * @param stopCurrent defines if the current animations must be stopped first (true by default)\r\n * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the list of created animatables\r\n */\r\n beginHierarchyAnimation(\r\n target: any,\r\n directDescendantsOnly: boolean,\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n stopCurrent?: boolean,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable[];\r\n\r\n /**\r\n * Begin a new animation on a given node\r\n * @param target defines the target where the animation will take place\r\n * @param animations defines the list of animations to start\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loop defines if you want animation to loop (off by default)\r\n * @param speedRatio defines the speed ratio to apply to all animations\r\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the list of created animatables\r\n */\r\n beginDirectAnimation(\r\n target: any,\r\n animations: Animation[],\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable;\r\n\r\n /**\r\n * Begin a new animation on a given node and its hierarchy\r\n * @param target defines the root node where the animation will take place\r\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.\r\n * @param animations defines the list of animations to start\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loop defines if you want animation to loop (off by default)\r\n * @param speedRatio defines the speed ratio to apply to all animations\r\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\r\n * @param onAnimationLoop defines the callback to call when an animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively (false by default)\r\n * @returns the list of animatables created for all nodes\r\n */\r\n beginDirectHierarchyAnimation(\r\n target: Node,\r\n directDescendantsOnly: boolean,\r\n animations: Animation[],\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n onAnimationLoop?: () => void,\r\n isAdditive?: boolean\r\n ): Animatable[];\r\n\r\n /**\r\n * Gets the animatable associated with a specific target\r\n * @param target defines the target of the animatable\r\n * @returns the required animatable if found\r\n */\r\n getAnimatableByTarget(target: any): Nullable<Animatable>;\r\n\r\n /**\r\n * Gets all animatables associated with a given target\r\n * @param target defines the target to look animatables for\r\n * @returns an array of Animatables\r\n */\r\n getAllAnimatablesByTarget(target: any): Array<Animatable>;\r\n\r\n /**\r\n * Stops and removes all animations that have been applied to the scene\r\n */\r\n stopAllAnimations(): void;\r\n\r\n /**\r\n * Gets the current delta time used by animation engine\r\n */\r\n deltaTime: number;\r\n }\r\n}\r\n\r\nScene.prototype._animate = function (): void {\r\n if (!this.animationsEnabled) {\r\n return;\r\n }\r\n\r\n // Getting time\r\n const now = PrecisionDate.Now;\r\n if (!this._animationTimeLast) {\r\n if (this._pendingData.length > 0) {\r\n return;\r\n }\r\n this._animationTimeLast = now;\r\n }\r\n\r\n this.deltaTime = this.useConstantAnimationDeltaTime ? 16.0 : (now - this._animationTimeLast) * this.animationTimeScale;\r\n this._animationTimeLast = now;\r\n\r\n const animatables = this._activeAnimatables;\r\n if (animatables.length === 0) {\r\n return;\r\n }\r\n\r\n this._animationTime += this.deltaTime;\r\n const animationTime = this._animationTime;\r\n\r\n for (let index = 0; index < animatables.length; index++) {\r\n const animatable = animatables[index];\r\n\r\n if (!animatable._animate(animationTime) && animatable.disposeOnEnd) {\r\n index--; // Array was updated\r\n }\r\n }\r\n\r\n // Late animation bindings\r\n this._processLateAnimationBindings();\r\n};\r\n\r\nScene.prototype.beginWeightedAnimation = function (\r\n target: any,\r\n from: number,\r\n to: number,\r\n weight = 1.0,\r\n loop?: boolean,\r\n speedRatio: number = 1.0,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable {\r\n const returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false, targetMask, onAnimationLoop, isAdditive);\r\n returnedAnimatable.weight = weight;\r\n\r\n return returnedAnimatable;\r\n};\r\n\r\nScene.prototype.beginAnimation = function (\r\n target: any,\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio: number = 1.0,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n stopCurrent = true,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable {\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n }\r\n\r\n if (stopCurrent) {\r\n this.stopAnimation(target, undefined, targetMask);\r\n }\r\n\r\n if (!animatable) {\r\n animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, undefined, onAnimationLoop, isAdditive);\r\n }\r\n\r\n const shouldRunTargetAnimations = targetMask ? targetMask(target) : true;\r\n // Local animations\r\n if (target.animations && shouldRunTargetAnimations) {\r\n animatable.appendAnimations(target, target.animations);\r\n }\r\n\r\n // Children animations\r\n if (target.getAnimatables) {\r\n const animatables = target.getAnimatables();\r\n for (let index = 0; index < animatables.length; index++) {\r\n this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop);\r\n }\r\n }\r\n\r\n animatable.reset();\r\n\r\n return animatable;\r\n};\r\n\r\nScene.prototype.beginHierarchyAnimation = function (\r\n target: any,\r\n directDescendantsOnly: boolean,\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio: number = 1.0,\r\n onAnimationEnd?: () => void,\r\n animatable?: Animatable,\r\n stopCurrent = true,\r\n targetMask?: (target: any) => boolean,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable[] {\r\n const children = target.getDescendants(directDescendantsOnly);\r\n\r\n const result = [];\r\n result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\r\n for (const child of children) {\r\n result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\r\n }\r\n\r\n return result;\r\n};\r\n\r\nScene.prototype.beginDirectAnimation = function (\r\n target: any,\r\n animations: Animation[],\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable {\r\n if (speedRatio === undefined) {\r\n speedRatio = 1.0;\r\n }\r\n\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n } else if (to > from && speedRatio < 0) {\r\n const temp = to;\r\n to = from;\r\n from = temp;\r\n }\r\n\r\n const animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations, onAnimationLoop, isAdditive);\r\n\r\n return animatable;\r\n};\r\n\r\nScene.prototype.beginDirectHierarchyAnimation = function (\r\n target: Node,\r\n directDescendantsOnly: boolean,\r\n animations: Animation[],\r\n from: number,\r\n to: number,\r\n loop?: boolean,\r\n speedRatio?: number,\r\n onAnimationEnd?: () => void,\r\n onAnimationLoop?: () => void,\r\n isAdditive = false\r\n): Animatable[] {\r\n const children = target.getDescendants(directDescendantsOnly);\r\n\r\n const result = [];\r\n result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\r\n for (const child of children) {\r\n result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\r\n }\r\n\r\n return result;\r\n};\r\n\r\nScene.prototype.getAnimatableByTarget = function (target: any): Nullable<Animatable> {\r\n for (let index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n return this._activeAnimatables[index];\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nScene.prototype.getAllAnimatablesByTarget = function (target: any): Array<Animatable> {\r\n const result = [];\r\n for (let index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n result.push(this._activeAnimatables[index]);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\nScene.prototype.stopAnimation = function (target: any, animationName?: string, targetMask?: (target: any) => boolean): void {\r\n const animatables = this.getAllAnimatablesByTarget(target);\r\n\r\n for (const animatable of animatables) {\r\n animatable.stop(animationName, targetMask);\r\n }\r\n};\r\n\r\n/**\r\n * Stops and removes all animations that have been applied to the scene\r\n */\r\nScene.prototype.stopAllAnimations = function (): void {\r\n if (this._activeAnimatables) {\r\n for (let i = 0; i < this._activeAnimatables.length; i++) {\r\n this._activeAnimatables[i].stop(undefined, undefined, true);\r\n }\r\n this._activeAnimatables.length = 0;\r\n }\r\n\r\n for (const group of this.animationGroups) {\r\n group.stop();\r\n }\r\n};\r\n\r\nScene.prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation: RuntimeAnimation, originalValue: any): void {\r\n const target = runtimeAnimation.target;\r\n this._registeredForLateAnimationBindings.pushNoDuplicate(target);\r\n\r\n if (!target._lateAnimationHolders) {\r\n target._lateAnimationHolders = {};\r\n }\r\n\r\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\r\n totalWeight: 0,\r\n totalAdditiveWeight: 0,\r\n animations: [],\r\n additiveAnimations: [],\r\n originalValue: originalValue,\r\n };\r\n }\r\n\r\n if (runtimeAnimation.isAdditive) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].additiveAnimations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalAdditiveWeight += runtimeAnimation.weight;\r\n } else {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\r\n }\r\n};\r\n\r\nScene.prototype._processLateAnimationBindingsForMatrices = function (holder: {\r\n totalWeight: number;\r\n totalAdditiveWeight: number;\r\n animations: RuntimeAnimation[];\r\n additiveAnimations: RuntimeAnimation[];\r\n originalValue: Matrix;\r\n}): any {\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\r\n return holder.originalValue;\r\n }\r\n\r\n let normalizer = 1.0;\r\n const finalPosition = TmpVectors.Vector3[0];\r\n const finalScaling = TmpVectors.Vector3[1];\r\n const finalQuaternion = TmpVectors.Quaternion[0];\r\n let startIndex = 0;\r\n const originalAnimation = holder.animations[0];\r\n const originalValue = holder.originalValue;\r\n\r\n let scale = 1;\r\n let skipOverride = false;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n scale = 1.0 - holder.totalWeight;\r\n originalValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n } else {\r\n startIndex = 1;\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n scale = originalAnimation.weight / normalizer;\r\n if (scale == 1) {\r\n if (holder.totalAdditiveWeight) {\r\n skipOverride = true;\r\n } else {\r\n return originalAnimation.currentValue;\r\n }\r\n }\r\n\r\n originalAnimation.currentValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n }\r\n\r\n // Add up the override animations\r\n if (!skipOverride) {\r\n finalScaling.scaleInPlace(scale);\r\n finalPosition.scaleInPlace(scale);\r\n finalQuaternion.scaleInPlace(scale);\r\n\r\n for (let animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n const runtimeAnimation = holder.animations[animIndex];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n\r\n scale = runtimeAnimation.weight / normalizer;\r\n const currentPosition = TmpVectors.Vector3[2];\r\n const currentScaling = TmpVectors.Vector3[3];\r\n const currentQuaternion = TmpVectors.Quaternion[1];\r\n\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n\r\n currentScaling.scaleAndAddToRef(scale, finalScaling);\r\n currentQuaternion.scaleAndAddToRef(Quaternion.Dot(finalQuaternion, currentQuaternion) > 0 ? scale : -scale, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(scale, finalPosition);\r\n }\r\n\r\n finalQuaternion.normalize();\r\n }\r\n\r\n // Add up the additive animations\r\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\r\n const runtimeAnimation = holder.additiveAnimations[animIndex];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n\r\n const currentPosition = TmpVectors.Vector3[2];\r\n const currentScaling = TmpVectors.Vector3[3];\r\n const currentQuaternion = TmpVectors.Quaternion[1];\r\n\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n currentScaling.multiplyToRef(finalScaling, currentScaling);\r\n Vector3.LerpToRef(finalScaling, currentScaling, runtimeAnimation.weight, finalScaling);\r\n finalQuaternion.multiplyToRef(currentQuaternion, currentQuaternion);\r\n Quaternion.SlerpToRef(finalQuaternion, currentQuaternion, runtimeAnimation.weight, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(runtimeAnimation.weight, finalPosition);\r\n }\r\n\r\n const workValue = originalAnimation ? originalAnimation._animationState.workValue : TmpVectors.Matrix[0].clone();\r\n Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, workValue);\r\n return workValue;\r\n};\r\n\r\nScene.prototype._processLateAnimationBindingsForQuaternions = function (\r\n holder: {\r\n totalWeight: number;\r\n totalAdditiveWeight: number;\r\n animations: RuntimeAnimation[];\r\n additiveAnimations: RuntimeAnimation[];\r\n originalValue: Quaternion;\r\n },\r\n refQuaternion: Quaternion\r\n): Quaternion {\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\r\n return refQuaternion;\r\n }\r\n\r\n const originalAnimation = holder.animations[0];\r\n const originalValue = holder.originalValue;\r\n let cumulativeQuaternion = refQuaternion;\r\n\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight > 0) {\r\n cumulativeQuaternion.copyFrom(originalValue);\r\n } else if (holder.animations.length === 1) {\r\n Quaternion.SlerpToRef(originalValue, originalAnimation.currentValue, Math.min(1.0, holder.totalWeight), cumulativeQuaternion);\r\n\r\n if (holder.totalAdditiveWeight === 0) {\r\n return cumulativeQuaternion;\r\n }\r\n } else if (holder.animations.length > 1) {\r\n // Add up the override animations\r\n let normalizer = 1.0;\r\n let quaternions: Array<Quaternion>;\r\n let weights: Array<number>;\r\n\r\n if (holder.totalWeight < 1.0) {\r\n const scale = 1.0 - holder.totalWeight;\r\n\r\n quaternions = [];\r\n weights = [];\r\n\r\n quaternions.push(originalValue);\r\n weights.push(scale);\r\n } else {\r\n if (holder.animations.length === 2) {\r\n // Slerp as soon as we can\r\n Quaternion.SlerpToRef(holder.animations[0].currentValue, holder.animations[1].currentValue, holder.animations[1].weight / holder.totalWeight, refQuaternion);\r\n\r\n if (holder.totalAdditiveWeight === 0) {\r\n return refQuaternion;\r\n }\r\n }\r\n\r\n quaternions = [];\r\n weights = [];\r\n normalizer = holder.totalWeight;\r\n }\r\n\r\n for (let animIndex = 0; animIndex < holder.animations.length; animIndex++) {\r\n const runtimeAnimation = holder.animations[animIndex];\r\n quaternions.push(runtimeAnimation.currentValue);\r\n weights.push(runtimeAnimation.weight / normalizer);\r\n }\r\n\r\n // https://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions\r\n\r\n let cumulativeAmount = 0;\r\n for (let index = 0; index < quaternions.length; ) {\r\n if (!index) {\r\n Quaternion.SlerpToRef(quaternions[index], quaternions[index + 1], weights[index + 1] / (weights[index] + weights[index + 1]), refQuaternion);\r\n cumulativeQuaternion = refQuaternion;\r\n cumulativeAmount = weights[index] + weights[index + 1];\r\n index += 2;\r\n continue;\r\n }\r\n cumulativeAmount += weights[index];\r\n Quaternion.SlerpToRef(cumulativeQuaternion, quaternions[index], weights[index] / cumulativeAmount, cumulativeQuaternion);\r\n index++;\r\n }\r\n }\r\n\r\n // Add up the additive animations\r\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\r\n const runtimeAnimation = holder.additiveAnimations[animIndex];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n\r\n cumulativeQuaternion.multiplyToRef(runtimeAnimation.currentValue, TmpVectors.Quaternion[0]);\r\n Quaternion.SlerpToRef(cumulativeQuaternion, TmpVectors.Quaternion[0], runtimeAnimation.weight, cumulativeQuaternion);\r\n }\r\n\r\n return cumulativeQuaternion!;\r\n};\r\n\r\nScene.prototype._processLateAnimationBindings = function (): void {\r\n if (!this._registeredForLateAnimationBindings.length) {\r\n return;\r\n }\r\n for (let index = 0; index < this._registeredForLateAnimationBindings.length; index++) {\r\n const target = this._registeredForLateAnimationBindings.data[index];\r\n\r\n for (const path in target._lateAnimationHolders) {\r\n const holder = target._lateAnimationHolders[path];\r\n const originalAnimation: RuntimeAnimation = holder.animations[0];\r\n const originalValue = holder.originalValue;\r\n if (originalValue === undefined || originalValue === null) {\r\n continue;\r\n }\r\n const matrixDecomposeMode = Animation.AllowMatrixDecomposeForInterpolation && originalValue.m; // ie. data is matrix\r\n\r\n let finalValue: any = target[path];\r\n if (matrixDecomposeMode) {\r\n finalValue = this._processLateAnimationBindingsForMatrices(holder);\r\n } else {\r\n const quaternionMode = originalValue.w !== undefined;\r\n if (quaternionMode) {\r\n finalValue = this._processLateAnimationBindingsForQuaternions(holder, finalValue || Quaternion.Identity());\r\n } else {\r\n let startIndex = 0;\r\n let normalizer = 1.0;\r\n\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n if (originalAnimation && originalValue.scale) {\r\n finalValue = originalValue.scale(1.0 - holder.totalWeight);\r\n } else if (originalAnimation) {\r\n finalValue = originalValue * (1.0 - holder.totalWeight);\r\n } else if (originalValue.clone) {\r\n finalValue = originalValue.clone();\r\n } else {\r\n finalValue = originalValue;\r\n }\r\n } else if (originalAnimation) {\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n const scale = originalAnimation.weight / normalizer;\r\n if (scale !== 1) {\r\n if (originalAnimation.currentValue.scale) {\r\n finalValue = originalAnimation.currentValue.scale(scale);\r\n } else {\r\n finalValue = originalAnimation.currentValue * scale;\r\n }\r\n } else {\r\n finalValue = originalAnimation.currentValue;\r\n }\r\n\r\n startIndex = 1;\r\n }\r\n\r\n // Add up the override animations\r\n for (let animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n const runtimeAnimation = holder.animations[animIndex];\r\n const scale = runtimeAnimation.weight / normalizer;\r\n\r\n if (!scale) {\r\n continue;\r\n } else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n } else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n\r\n // Add up the additive animations\r\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\r\n const runtimeAnimation = holder.additiveAnimations[animIndex];\r\n const scale: number = runtimeAnimation.weight;\r\n\r\n if (!scale) {\r\n continue;\r\n } else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n } else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n }\r\n }\r\n target[path] = finalValue;\r\n }\r\n\r\n target._lateAnimationHolders = {};\r\n }\r\n this._registeredForLateAnimationBindings.reset();\r\n};\r\n\r\ndeclare module \"../Bones/bone\" {\r\n export interface Bone {\r\n /**\r\n * Copy an animation range from another bone\r\n * @param source defines the source bone\r\n * @param rangeName defines the range name to copy\r\n * @param frameOffset defines the frame offset\r\n * @param rescaleAsRequired defines if rescaling must be applied if required\r\n * @param skelDimensionsRatio defines the scaling ratio\r\n * @returns true if operation was successful\r\n */\r\n copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired: boolean, skelDimensionsRatio: Nullable<Vector3>): boolean;\r\n }\r\n}\r\n\r\nBone.prototype.copyAnimationRange = function (\r\n source: Bone,\r\n rangeName: string,\r\n frameOffset: number,\r\n rescaleAsRequired = false,\r\n skelDimensionsRatio: Nullable<Vector3> = null\r\n): boolean {\r\n // all animation may be coming from a library skeleton, so may need to create animation\r\n if (this.animations.length === 0) {\r\n this.animations.push(new Animation(this.name, \"_matrix\", source.animations[0].framePerSecond, Animation.ANIMATIONTYPE_MATRIX, 0));\r\n this.animations[0].setKeys([]);\r\n }\r\n\r\n // get animation info / verify there is such a range from the source bone\r\n const sourceRange = source.animations[0].getRange(rangeName);\r\n if (!sourceRange) {\r\n return false;\r\n }\r\n const from = sourceRange.from;\r\n const to = sourceRange.to;\r\n const sourceKeys = source.animations[0].getKeys();\r\n\r\n // rescaling prep\r\n const sourceBoneLength = source.length;\r\n const sourceParent = source.getParent();\r\n const parent = this.getParent();\r\n const parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;\r\n const parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;\r\n\r\n const dimensionsScalingReqd =\r\n rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);\r\n\r\n const destKeys = this.animations[0].getKeys();\r\n\r\n // loop vars declaration\r\n let orig: { frame: number; value: Matrix };\r\n let origTranslation: Vector3;\r\n let mat: Matrix;\r\n\r\n for (let key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {\r\n orig = sourceKeys[key];\r\n if (orig.frame >= from && orig.frame <= to) {\r\n if (rescaleAsRequired) {\r\n mat = orig.value.clone();\r\n\r\n // scale based on parent ratio, when bone has parent\r\n if (parentScalingReqd) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.scaleInPlace(parentRatio));\r\n\r\n // scale based on skeleton dimension ratio when root bone, and value is passed\r\n } else if (dimensionsScalingReqd && skelDimensionsRatio) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));\r\n\r\n // use original when root bone, and no data for skelDimensionsRatio\r\n } else {\r\n mat = orig.value;\r\n }\r\n } else {\r\n mat = orig.value;\r\n }\r\n destKeys.push({ frame: orig.frame + frameOffset, value: mat });\r\n }\r\n }\r\n this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);\r\n return true;\r\n};\r\n"]}
@@ -66,8 +66,9 @@ export declare class PickingInfo {
66
66
  getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Nullable<Vector3>;
67
67
  /**
68
68
  * Gets the texture coordinates of where the pick occurred
69
+ * @param uvSet The UV set to use to calculate the texture coordinates (default: VertexBuffer.UVKind)
69
70
  * @returns The vector containing the coordinates of the texture
70
71
  */
71
- getTextureCoordinates(): Nullable<Vector2>;
72
+ getTextureCoordinates(uvSet?: string): Nullable<Vector2>;
72
73
  }
73
74
  export {};
@@ -120,17 +120,18 @@ export class PickingInfo {
120
120
  }
121
121
  /**
122
122
  * Gets the texture coordinates of where the pick occurred
123
+ * @param uvSet The UV set to use to calculate the texture coordinates (default: VertexBuffer.UVKind)
123
124
  * @returns The vector containing the coordinates of the texture
124
125
  */
125
- getTextureCoordinates() {
126
- if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(VertexBuffer.UVKind)) {
126
+ getTextureCoordinates(uvSet = VertexBuffer.UVKind) {
127
+ if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(uvSet)) {
127
128
  return null;
128
129
  }
129
130
  const indices = this.pickedMesh.getIndices();
130
131
  if (!indices) {
131
132
  return null;
132
133
  }
133
- const uvs = this.pickedMesh.getVerticesData(VertexBuffer.UVKind);
134
+ const uvs = this.pickedMesh.getVerticesData(uvSet);
134
135
  if (!uvs) {
135
136
  return null;
136
137
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pickingInfo.js","sourceRoot":"","sources":["../../../../lts/core/generated/Collisions/pickingInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD;;;GAGG;AACH,MAAM,OAAO,WAAW;IAAxB;QACI;;WAEG;QACI,QAAG,GAAG,KAAK,CAAC;QACnB;;WAEG;QACI,aAAQ,GAAG,CAAC,CAAC;QACpB;;WAEG;QACI,gBAAW,GAAsB,IAAI,CAAC;QAC7C;;WAEG;QACI,eAAU,GAA2B,IAAI,CAAC;QACjD,sIAAsI;QAC/H,OAAE,GAAG,CAAC,CAAC;QACd,sIAAsI;QAC/H,OAAE,GAAG,CAAC,CAAC;QACd,oHAAoH;QAC7G,WAAM,GAAG,CAAC,CAAC,CAAC;QACnB,uHAAuH;QAChH,kBAAa,GAAG,CAAC,CAAC,CAAC;QAC1B,wCAAwC;QACjC,cAAS,GAAG,CAAC,CAAC;QACrB,6EAA6E;QACtE,iBAAY,GAAqB,IAAI,CAAC;QAC7C,+FAA+F;QACxF,sBAAiB,GAAG,CAAC,CAAC,CAAC;QAC9B;;WAEG;QACI,QAAG,GAAkB,IAAI,CAAC;QACjC;;WAEG;QACI,eAAU,GAA2B,IAAI,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TmpVectors } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { Sprite } from \"../Sprites/sprite\";\r\n\r\ndeclare type Ray = import(\"../Culling/ray\").Ray;\r\n\r\n/**\r\n * Information about the result of picking within a scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/interactions/picking_collisions\r\n */\r\nexport class PickingInfo {\r\n /**\r\n * If the pick collided with an object\r\n */\r\n public hit = false;\r\n /**\r\n * Distance away where the pick collided\r\n */\r\n public distance = 0;\r\n /**\r\n * The location of pick collision\r\n */\r\n public pickedPoint: Nullable<Vector3> = null;\r\n /**\r\n * The mesh corresponding the pick collision\r\n */\r\n public pickedMesh: Nullable<AbstractMesh> = null;\r\n /** (See getTextureCoordinates) The barycentric U coordinate that is used when calculating the texture coordinates of the collision.*/\r\n public bu = 0;\r\n /** (See getTextureCoordinates) The barycentric V coordinate that is used when calculating the texture coordinates of the collision.*/\r\n public bv = 0;\r\n /** The index of the face on the mesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n public faceId = -1;\r\n /** The index of the face on the subMesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n public subMeshFaceId = -1;\r\n /** Id of the submesh that was picked */\r\n public subMeshId = 0;\r\n /** If a sprite was picked, this will be the sprite the pick collided with */\r\n public pickedSprite: Nullable<Sprite> = null;\r\n /** If we are picking a mesh with thin instance, this will give you the picked thin instance */\r\n public thinInstanceIndex = -1;\r\n /**\r\n * The ray that was used to perform the picking.\r\n */\r\n public ray: Nullable<Ray> = null;\r\n /**\r\n * If a mesh was used to do the picking (eg. 6dof controller) as a \"near interaction\", this will be populated.\r\n */\r\n public originMesh: Nullable<AbstractMesh> = null;\r\n /**\r\n * The aim-space transform of the input used for picking, if it is an XR input source.\r\n */\r\n public aimTransform: Nullable<TransformNode> = null;\r\n /**\r\n * The grip-space transform of the input used for picking, if it is an XR input source.\r\n * Some XR sources, such as input coming from head mounted displays, do not have this.\r\n */\r\n public gripTransform: Nullable<TransformNode> = null;\r\n\r\n /**\r\n * Gets the normal corresponding to the face the pick collided with\r\n * @param useWorldCoordinates If the resulting normal should be relative to the world (default: false)\r\n * @param useVerticesNormals If the vertices normals should be used to calculate the normal instead of the normal map (default: true)\r\n * @returns The normal corresponding to the face the pick collided with\r\n * @remarks Note that the returned normal will always point towards the picking ray.\r\n */\r\n public getNormal(useWorldCoordinates = false, useVerticesNormals = true): Nullable<Vector3> {\r\n if (!this.pickedMesh || (useVerticesNormals && !this.pickedMesh.isVerticesDataPresent(VertexBuffer.NormalKind))) {\r\n return null;\r\n }\r\n\r\n const indices = this.pickedMesh.getIndices();\r\n\r\n if (!indices) {\r\n return null;\r\n }\r\n\r\n let result: Vector3;\r\n\r\n if (useVerticesNormals) {\r\n const normals = <FloatArray>this.pickedMesh.getVerticesData(VertexBuffer.NormalKind);\r\n\r\n let normal0 = Vector3.FromArray(normals, indices[this.faceId * 3] * 3);\r\n let normal1 = Vector3.FromArray(normals, indices[this.faceId * 3 + 1] * 3);\r\n let normal2 = Vector3.FromArray(normals, indices[this.faceId * 3 + 2] * 3);\r\n\r\n normal0 = normal0.scale(this.bu);\r\n normal1 = normal1.scale(this.bv);\r\n normal2 = normal2.scale(1.0 - this.bu - this.bv);\r\n\r\n result = new Vector3(normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);\r\n } else {\r\n const positions = <FloatArray>this.pickedMesh.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n const vertex1 = Vector3.FromArray(positions, indices[this.faceId * 3] * 3);\r\n const vertex2 = Vector3.FromArray(positions, indices[this.faceId * 3 + 1] * 3);\r\n const vertex3 = Vector3.FromArray(positions, indices[this.faceId * 3 + 2] * 3);\r\n\r\n const p1p2 = vertex1.subtract(vertex2);\r\n const p3p2 = vertex3.subtract(vertex2);\r\n\r\n result = Vector3.Cross(p1p2, p3p2);\r\n }\r\n\r\n const transformNormalToWorld = (pickedMesh: AbstractMesh, n: Vector3) => {\r\n let wm = pickedMesh.getWorldMatrix();\r\n\r\n if (pickedMesh.nonUniformScaling) {\r\n TmpVectors.Matrix[0].copyFrom(wm);\r\n wm = TmpVectors.Matrix[0];\r\n wm.setTranslationFromFloats(0, 0, 0);\r\n wm.invert();\r\n wm.transposeToRef(TmpVectors.Matrix[1]);\r\n\r\n wm = TmpVectors.Matrix[1];\r\n }\r\n\r\n Vector3.TransformNormalToRef(n, wm, n);\r\n };\r\n\r\n if (useWorldCoordinates) {\r\n transformNormalToWorld(this.pickedMesh, result);\r\n }\r\n\r\n if (this.ray) {\r\n const normalForDirectionChecking = TmpVectors.Vector3[0].copyFrom(result);\r\n\r\n if (!useWorldCoordinates) {\r\n // the normal has not been transformed to world space as part as the normal processing, so we must do it now\r\n transformNormalToWorld(this.pickedMesh, normalForDirectionChecking);\r\n }\r\n\r\n // Flip the normal if the picking ray is in the same direction.\r\n if (Vector3.Dot(normalForDirectionChecking, this.ray.direction) > 0) {\r\n result.negateInPlace();\r\n }\r\n }\r\n\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Gets the texture coordinates of where the pick occurred\r\n * @returns The vector containing the coordinates of the texture\r\n */\r\n public getTextureCoordinates(): Nullable<Vector2> {\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n return null;\r\n }\r\n\r\n const indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n\r\n const uvs = this.pickedMesh.getVerticesData(VertexBuffer.UVKind);\r\n if (!uvs) {\r\n return null;\r\n }\r\n\r\n let uv0 = Vector2.FromArray(uvs, indices[this.faceId * 3] * 2);\r\n let uv1 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 1] * 2);\r\n let uv2 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 2] * 2);\r\n\r\n uv0 = uv0.scale(this.bu);\r\n uv1 = uv1.scale(this.bv);\r\n uv2 = uv2.scale(1.0 - this.bu - this.bv);\r\n\r\n return new Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"pickingInfo.js","sourceRoot":"","sources":["../../../../lts/core/generated/Collisions/pickingInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD;;;GAGG;AACH,MAAM,OAAO,WAAW;IAAxB;QACI;;WAEG;QACI,QAAG,GAAG,KAAK,CAAC;QACnB;;WAEG;QACI,aAAQ,GAAG,CAAC,CAAC;QACpB;;WAEG;QACI,gBAAW,GAAsB,IAAI,CAAC;QAC7C;;WAEG;QACI,eAAU,GAA2B,IAAI,CAAC;QACjD,sIAAsI;QAC/H,OAAE,GAAG,CAAC,CAAC;QACd,sIAAsI;QAC/H,OAAE,GAAG,CAAC,CAAC;QACd,oHAAoH;QAC7G,WAAM,GAAG,CAAC,CAAC,CAAC;QACnB,uHAAuH;QAChH,kBAAa,GAAG,CAAC,CAAC,CAAC;QAC1B,wCAAwC;QACjC,cAAS,GAAG,CAAC,CAAC;QACrB,6EAA6E;QACtE,iBAAY,GAAqB,IAAI,CAAC;QAC7C,+FAA+F;QACxF,sBAAiB,GAAG,CAAC,CAAC,CAAC;QAC9B;;WAEG;QACI,QAAG,GAAkB,IAAI,CAAC;QACjC;;WAEG;QACI,eAAU,GAA2B,IAAI,CAAC;QACjD;;WAEG;QACI,iBAAY,GAA4B,IAAI,CAAC;QACpD;;;WAGG;QACI,kBAAa,GAA4B,IAAI,CAAC;IAoHzD,CAAC;IAlHG;;;;;;OAMG;IACI,SAAS,CAAC,mBAAmB,GAAG,KAAK,EAAE,kBAAkB,GAAG,IAAI;QACnE,IAAI,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AI,CAAC,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,GAAG,EAAE;YACN,OAAO,IAAI,CAAC;SACf;QAED,IAAI,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/D,IAAI,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACnE,IAAI,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAEnE,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;QAEzC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;CACJ","sourcesContent":["import type { Nullable, FloatArray } from \"../types\";\r\nimport { Vector3, Vector2, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { Sprite } from \"../Sprites/sprite\";\r\n\r\ndeclare type Ray = import(\"../Culling/ray\").Ray;\r\n\r\n/**\r\n * Information about the result of picking within a scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/interactions/picking_collisions\r\n */\r\nexport class PickingInfo {\r\n /**\r\n * If the pick collided with an object\r\n */\r\n public hit = false;\r\n /**\r\n * Distance away where the pick collided\r\n */\r\n public distance = 0;\r\n /**\r\n * The location of pick collision\r\n */\r\n public pickedPoint: Nullable<Vector3> = null;\r\n /**\r\n * The mesh corresponding the pick collision\r\n */\r\n public pickedMesh: Nullable<AbstractMesh> = null;\r\n /** (See getTextureCoordinates) The barycentric U coordinate that is used when calculating the texture coordinates of the collision.*/\r\n public bu = 0;\r\n /** (See getTextureCoordinates) The barycentric V coordinate that is used when calculating the texture coordinates of the collision.*/\r\n public bv = 0;\r\n /** The index of the face on the mesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n public faceId = -1;\r\n /** The index of the face on the subMesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n public subMeshFaceId = -1;\r\n /** Id of the submesh that was picked */\r\n public subMeshId = 0;\r\n /** If a sprite was picked, this will be the sprite the pick collided with */\r\n public pickedSprite: Nullable<Sprite> = null;\r\n /** If we are picking a mesh with thin instance, this will give you the picked thin instance */\r\n public thinInstanceIndex = -1;\r\n /**\r\n * The ray that was used to perform the picking.\r\n */\r\n public ray: Nullable<Ray> = null;\r\n /**\r\n * If a mesh was used to do the picking (eg. 6dof controller) as a \"near interaction\", this will be populated.\r\n */\r\n public originMesh: Nullable<AbstractMesh> = null;\r\n /**\r\n * The aim-space transform of the input used for picking, if it is an XR input source.\r\n */\r\n public aimTransform: Nullable<TransformNode> = null;\r\n /**\r\n * The grip-space transform of the input used for picking, if it is an XR input source.\r\n * Some XR sources, such as input coming from head mounted displays, do not have this.\r\n */\r\n public gripTransform: Nullable<TransformNode> = null;\r\n\r\n /**\r\n * Gets the normal corresponding to the face the pick collided with\r\n * @param useWorldCoordinates If the resulting normal should be relative to the world (default: false)\r\n * @param useVerticesNormals If the vertices normals should be used to calculate the normal instead of the normal map (default: true)\r\n * @returns The normal corresponding to the face the pick collided with\r\n * @remarks Note that the returned normal will always point towards the picking ray.\r\n */\r\n public getNormal(useWorldCoordinates = false, useVerticesNormals = true): Nullable<Vector3> {\r\n if (!this.pickedMesh || (useVerticesNormals && !this.pickedMesh.isVerticesDataPresent(VertexBuffer.NormalKind))) {\r\n return null;\r\n }\r\n\r\n const indices = this.pickedMesh.getIndices();\r\n\r\n if (!indices) {\r\n return null;\r\n }\r\n\r\n let result: Vector3;\r\n\r\n if (useVerticesNormals) {\r\n const normals = <FloatArray>this.pickedMesh.getVerticesData(VertexBuffer.NormalKind);\r\n\r\n let normal0 = Vector3.FromArray(normals, indices[this.faceId * 3] * 3);\r\n let normal1 = Vector3.FromArray(normals, indices[this.faceId * 3 + 1] * 3);\r\n let normal2 = Vector3.FromArray(normals, indices[this.faceId * 3 + 2] * 3);\r\n\r\n normal0 = normal0.scale(this.bu);\r\n normal1 = normal1.scale(this.bv);\r\n normal2 = normal2.scale(1.0 - this.bu - this.bv);\r\n\r\n result = new Vector3(normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);\r\n } else {\r\n const positions = <FloatArray>this.pickedMesh.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n const vertex1 = Vector3.FromArray(positions, indices[this.faceId * 3] * 3);\r\n const vertex2 = Vector3.FromArray(positions, indices[this.faceId * 3 + 1] * 3);\r\n const vertex3 = Vector3.FromArray(positions, indices[this.faceId * 3 + 2] * 3);\r\n\r\n const p1p2 = vertex1.subtract(vertex2);\r\n const p3p2 = vertex3.subtract(vertex2);\r\n\r\n result = Vector3.Cross(p1p2, p3p2);\r\n }\r\n\r\n const transformNormalToWorld = (pickedMesh: AbstractMesh, n: Vector3) => {\r\n let wm = pickedMesh.getWorldMatrix();\r\n\r\n if (pickedMesh.nonUniformScaling) {\r\n TmpVectors.Matrix[0].copyFrom(wm);\r\n wm = TmpVectors.Matrix[0];\r\n wm.setTranslationFromFloats(0, 0, 0);\r\n wm.invert();\r\n wm.transposeToRef(TmpVectors.Matrix[1]);\r\n\r\n wm = TmpVectors.Matrix[1];\r\n }\r\n\r\n Vector3.TransformNormalToRef(n, wm, n);\r\n };\r\n\r\n if (useWorldCoordinates) {\r\n transformNormalToWorld(this.pickedMesh, result);\r\n }\r\n\r\n if (this.ray) {\r\n const normalForDirectionChecking = TmpVectors.Vector3[0].copyFrom(result);\r\n\r\n if (!useWorldCoordinates) {\r\n // the normal has not been transformed to world space as part as the normal processing, so we must do it now\r\n transformNormalToWorld(this.pickedMesh, normalForDirectionChecking);\r\n }\r\n\r\n // Flip the normal if the picking ray is in the same direction.\r\n if (Vector3.Dot(normalForDirectionChecking, this.ray.direction) > 0) {\r\n result.negateInPlace();\r\n }\r\n }\r\n\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Gets the texture coordinates of where the pick occurred\r\n * @param uvSet The UV set to use to calculate the texture coordinates (default: VertexBuffer.UVKind)\r\n * @returns The vector containing the coordinates of the texture\r\n */\r\n public getTextureCoordinates(uvSet = VertexBuffer.UVKind): Nullable<Vector2> {\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(uvSet)) {\r\n return null;\r\n }\r\n\r\n const indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n\r\n const uvs = this.pickedMesh.getVerticesData(uvSet);\r\n if (!uvs) {\r\n return null;\r\n }\r\n\r\n let uv0 = Vector2.FromArray(uvs, indices[this.faceId * 3] * 2);\r\n let uv1 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 1] * 2);\r\n let uv2 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 2] * 2);\r\n\r\n uv0 = uv0.scale(this.bu);\r\n uv1 = uv1.scale(this.bv);\r\n uv2 = uv2.scale(1.0 - this.bu - this.bv);\r\n\r\n return new Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);\r\n }\r\n}\r\n"]}
@@ -75,6 +75,10 @@ export class DeviceEventFactory {
75
75
  */
76
76
  static _CreateWheelEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo) {
77
77
  const evt = this._CreateMouseEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);
78
+ // While WheelEvents don't generally have a pointerId, we used to add one in the InputManager
79
+ // This line has been added to make the InputManager more platform-agnostic
80
+ // Similar code exists in the WebDeviceInputSystem to handle browser created events
81
+ evt.pointerId = 1;
78
82
  evt.type = "wheel";
79
83
  evt.deltaMode = EventConstants.DOM_DELTA_PIXEL;
80
84
  evt.deltaX = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"eventFactory.js","sourceRoot":"","sources":["../../../../lts/core/generated/DeviceInput/eventFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1F;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC3B;;;;;;;;;;OAUG;IACI,MAAM,CAAC,iBAAiB,CAC3B,UAAsB,EACtB,UAAkB,EAClB,UAAkB,EAClB,YAA8B,EAC9B,iBAAqC,EACrC,iBAAuB,EACvB,SAAkB;QAElB,QAAQ,UAAU,EAAE;YAChB,KAAK,UAAU,CAAC,QAAQ;gBACpB,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;YACrG,KAAK,UAAU,CAAC,KAAK;gBACjB,IAAI,UAAU,KAAK,YAAY,CAAC,WAAW,IAAI,UAAU,KAAK,YAAY,CAAC,WAAW,IAAI,UAAU,KAAK,YAAY,CAAC,WAAW,EAAE;oBAC/H,OAAO,IAAI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,KAAK,CAAC;gBACjF,iBAAiB,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC;gBACpF,iBAAiB,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9F,MAAM,QAAQ,GAAG,gBAAgB,IAAI,iBAAiB,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAE1H,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;QACpB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACtB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACtB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,YAAY,CAAC,iBAAsB;QAC9C,MAAM,GAAG,GAAyB,EAAE,CAAC;QACrC,GAAG,CAAC,cAAc,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QAC9B,GAAG,CAAC,MAAM,GAAG,iBAAiB,CAAC;QAE/B,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import { Constants } from \"../Engines/constants\";\r\nimport type { IUIEvent } from \"../Events/deviceInputEvents\";\r\nimport { EventConstants } from \"../Events/deviceInputEvents\";\r\nimport type { Nullable } from \"../types\";\r\nimport { DeviceType, NativePointerInput, PointerInput } from \"./InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"./inputInterfaces\";\r\n\r\n/**\r\n * Class to wrap DeviceInputSystem data into an event object\r\n */\r\nexport class DeviceEventFactory {\r\n /**\r\n * Create device input events based on provided type and slot\r\n *\r\n * @param deviceType Type of device\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IUIEvent object\r\n */\r\n public static CreateDeviceEvent(\r\n deviceType: DeviceType,\r\n deviceSlot: number,\r\n inputIndex: number,\r\n currentState: Nullable<number>,\r\n deviceInputSystem: IDeviceInputSystem,\r\n elementToAttachTo?: any,\r\n pointerId?: number\r\n ): IUIEvent {\r\n switch (deviceType) {\r\n case DeviceType.Keyboard:\r\n return this._CreateKeyboardEvent(inputIndex, currentState, deviceInputSystem, elementToAttachTo);\r\n case DeviceType.Mouse:\r\n if (inputIndex === PointerInput.MouseWheelX || inputIndex === PointerInput.MouseWheelY || inputIndex === PointerInput.MouseWheelZ) {\r\n return this._CreateWheelEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\r\n }\r\n // eslint-disable-next-line no-fallthrough\r\n case DeviceType.Touch:\r\n return this._CreatePointerEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo, pointerId);\r\n default:\r\n throw `Unable to generate event for device ${DeviceType[deviceType]}`;\r\n }\r\n }\r\n\r\n /**\r\n * Creates pointer event\r\n *\r\n * @param deviceType Type of device\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IUIEvent object (Pointer)\r\n */\r\n private static _CreatePointerEvent(\r\n deviceType: DeviceType,\r\n deviceSlot: number,\r\n inputIndex: number,\r\n currentState: Nullable<number>,\r\n deviceInputSystem: IDeviceInputSystem,\r\n elementToAttachTo?: any,\r\n pointerId?: number\r\n ): any {\r\n const evt = this._CreateMouseEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\r\n\r\n if (deviceType === DeviceType.Mouse) {\r\n evt.deviceType = DeviceType.Mouse;\r\n evt.pointerId = 1;\r\n evt.pointerType = \"mouse\";\r\n } else {\r\n evt.deviceType = DeviceType.Touch;\r\n evt.pointerId = pointerId ?? deviceSlot;\r\n evt.pointerType = \"touch\";\r\n }\r\n\r\n if (inputIndex === PointerInput.Move) {\r\n evt.type = \"pointermove\";\r\n } else if (inputIndex >= PointerInput.LeftClick && inputIndex <= PointerInput.RightClick) {\r\n evt.type = currentState === 1 ? \"pointerdown\" : \"pointerup\";\r\n evt.button = inputIndex - 2;\r\n }\r\n\r\n return evt;\r\n }\r\n\r\n /**\r\n * Create Mouse Wheel Event\r\n * @param deviceType Type of device\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IUIEvent object (Wheel)\r\n */\r\n private static _CreateWheelEvent(\r\n deviceType: DeviceType,\r\n deviceSlot: number,\r\n inputIndex: number,\r\n currentState: Nullable<number>,\r\n deviceInputSystem: IDeviceInputSystem,\r\n elementToAttachTo: any\r\n ): any {\r\n const evt = this._CreateMouseEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\r\n\r\n evt.type = \"wheel\";\r\n evt.deltaMode = EventConstants.DOM_DELTA_PIXEL;\r\n evt.deltaX = 0;\r\n evt.deltaY = 0;\r\n evt.deltaZ = 0;\r\n\r\n switch (inputIndex) {\r\n case PointerInput.MouseWheelX:\r\n evt.deltaX = currentState;\r\n break;\r\n case PointerInput.MouseWheelY:\r\n evt.deltaY = currentState;\r\n break;\r\n case PointerInput.MouseWheelZ:\r\n evt.deltaZ = currentState;\r\n break;\r\n }\r\n\r\n return evt;\r\n }\r\n\r\n /**\r\n * Create Mouse Event\r\n * @param deviceType Type of device\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IUIEvent object (Mouse)\r\n */\r\n private static _CreateMouseEvent(\r\n deviceType: DeviceType,\r\n deviceSlot: number,\r\n inputIndex: number,\r\n currentState: Nullable<number>,\r\n deviceInputSystem: IDeviceInputSystem,\r\n elementToAttachTo?: any\r\n ): any {\r\n const evt = this._CreateEvent(elementToAttachTo);\r\n const pointerX = deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.Horizontal);\r\n const pointerY = deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.Vertical);\r\n\r\n // Handle offsets/deltas based on existence of HTMLElement\r\n if (elementToAttachTo) {\r\n evt.movementX = 0;\r\n evt.movementY = 0;\r\n evt.offsetX = evt.movementX - elementToAttachTo.getBoundingClientRect().x;\r\n evt.offsetY = evt.movementY - elementToAttachTo.getBoundingClientRect().y;\r\n } else {\r\n evt.movementX = deviceInputSystem.pollInput(deviceType, deviceSlot, NativePointerInput.DeltaHorizontal); // DeltaHorizontal\r\n evt.movementY = deviceInputSystem.pollInput(deviceType, deviceSlot, NativePointerInput.DeltaVertical); // DeltaVertical\r\n evt.offsetX = 0;\r\n evt.offsetY = 0;\r\n }\r\n this._CheckNonCharacterKeys(evt, deviceInputSystem);\r\n\r\n evt.clientX = pointerX;\r\n evt.clientY = pointerY;\r\n evt.x = pointerX;\r\n evt.y = pointerY;\r\n\r\n evt.deviceType = deviceType;\r\n evt.deviceSlot = deviceSlot;\r\n evt.inputIndex = inputIndex;\r\n\r\n return evt;\r\n }\r\n\r\n /**\r\n * Create Keyboard Event\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IEvent object (Keyboard)\r\n */\r\n private static _CreateKeyboardEvent(inputIndex: number, currentState: Nullable<number>, deviceInputSystem: IDeviceInputSystem, elementToAttachTo?: any): any {\r\n const evt = this._CreateEvent(elementToAttachTo);\r\n this._CheckNonCharacterKeys(evt, deviceInputSystem);\r\n evt.deviceType = DeviceType.Keyboard;\r\n evt.deviceSlot = 0;\r\n evt.inputIndex = inputIndex;\r\n\r\n evt.type = currentState === 1 ? \"keydown\" : \"keyup\";\r\n evt.key = String.fromCharCode(inputIndex);\r\n evt.keyCode = inputIndex;\r\n\r\n return evt;\r\n }\r\n\r\n /**\r\n * Add parameters for non-character keys (Ctrl, Alt, Meta, Shift)\r\n * @param evt Event object to add parameters to\r\n * @param deviceInputSystem DeviceInputSystem to pull values from\r\n */\r\n private static _CheckNonCharacterKeys(evt: any, deviceInputSystem: IDeviceInputSystem): void {\r\n const isKeyboardActive = deviceInputSystem.isDeviceAvailable(DeviceType.Keyboard);\r\n const altKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_ALT_KEY) === 1;\r\n const ctrlKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_CTRL_KEY) === 1;\r\n const metaKey =\r\n isKeyboardActive &&\r\n (deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY1) === 1 ||\r\n deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY2) === 1 ||\r\n deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY3) === 1);\r\n const shiftKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_SHIFT_KEY) === 1;\r\n\r\n evt.altKey = altKey;\r\n evt.ctrlKey = ctrlKey;\r\n evt.metaKey = metaKey;\r\n evt.shiftKey = shiftKey;\r\n }\r\n\r\n /**\r\n * Create base event object\r\n * @param elementToAttachTo Value to use as event target\r\n * @returns\r\n */\r\n private static _CreateEvent(elementToAttachTo: any): any {\r\n const evt: { [k: string]: any } = {};\r\n evt.preventDefault = () => {};\r\n evt.target = elementToAttachTo;\r\n\r\n return evt;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"eventFactory.js","sourceRoot":"","sources":["../../../../lts/core/generated/DeviceInput/eventFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1F;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC3B;;;;;;;;;;OAUG;IACI,MAAM,CAAC,iBAAiB,CAC3B,UAAsB,EACtB,UAAkB,EAClB,UAAkB,EAClB,YAA8B,EAC9B,iBAAqC,EACrC,iBAAuB,EACvB,SAAkB;QAElB,QAAQ,UAAU,EAAE;YAChB,KAAK,UAAU,CAAC,QAAQ;gBACpB,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;YACrG,KAAK,UAAU,CAAC,KAAK;gBACjB,IAAI,UAAU,KAAK,YAAY,CAAC,WAAW,IAAI,UAAU,KAAK,YAAY,CAAC,WAAW,IAAI,UAAU,KAAK,YAAY,CAAC,WAAW,EAAE;oBAC/H,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;iBACzH;YACL,0CAA0C;YAC1C,KAAK,UAAU,CAAC,KAAK;gBACjB,OAAO,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;YACvI;gBACI,MAAM,uCAAuC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;SAC7E;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACK,MAAM,CAAC,mBAAmB,CA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AAC,EAAE,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAE1H,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;QACpB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACtB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACtB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,YAAY,CAAC,iBAAsB;QAC9C,MAAM,GAAG,GAAyB,EAAE,CAAC;QACrC,GAAG,CAAC,cAAc,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QAC9B,GAAG,CAAC,MAAM,GAAG,iBAAiB,CAAC;QAE/B,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import { Constants } from \"../Engines/constants\";\r\nimport type { IUIEvent } from \"../Events/deviceInputEvents\";\r\nimport { EventConstants } from \"../Events/deviceInputEvents\";\r\nimport type { Nullable } from \"../types\";\r\nimport { DeviceType, NativePointerInput, PointerInput } from \"./InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"./inputInterfaces\";\r\n\r\n/**\r\n * Class to wrap DeviceInputSystem data into an event object\r\n */\r\nexport class DeviceEventFactory {\r\n /**\r\n * Create device input events based on provided type and slot\r\n *\r\n * @param deviceType Type of device\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IUIEvent object\r\n */\r\n public static CreateDeviceEvent(\r\n deviceType: DeviceType,\r\n deviceSlot: number,\r\n inputIndex: number,\r\n currentState: Nullable<number>,\r\n deviceInputSystem: IDeviceInputSystem,\r\n elementToAttachTo?: any,\r\n pointerId?: number\r\n ): IUIEvent {\r\n switch (deviceType) {\r\n case DeviceType.Keyboard:\r\n return this._CreateKeyboardEvent(inputIndex, currentState, deviceInputSystem, elementToAttachTo);\r\n case DeviceType.Mouse:\r\n if (inputIndex === PointerInput.MouseWheelX || inputIndex === PointerInput.MouseWheelY || inputIndex === PointerInput.MouseWheelZ) {\r\n return this._CreateWheelEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\r\n }\r\n // eslint-disable-next-line no-fallthrough\r\n case DeviceType.Touch:\r\n return this._CreatePointerEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo, pointerId);\r\n default:\r\n throw `Unable to generate event for device ${DeviceType[deviceType]}`;\r\n }\r\n }\r\n\r\n /**\r\n * Creates pointer event\r\n *\r\n * @param deviceType Type of device\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IUIEvent object (Pointer)\r\n */\r\n private static _CreatePointerEvent(\r\n deviceType: DeviceType,\r\n deviceSlot: number,\r\n inputIndex: number,\r\n currentState: Nullable<number>,\r\n deviceInputSystem: IDeviceInputSystem,\r\n elementToAttachTo?: any,\r\n pointerId?: number\r\n ): any {\r\n const evt = this._CreateMouseEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\r\n\r\n if (deviceType === DeviceType.Mouse) {\r\n evt.deviceType = DeviceType.Mouse;\r\n evt.pointerId = 1;\r\n evt.pointerType = \"mouse\";\r\n } else {\r\n evt.deviceType = DeviceType.Touch;\r\n evt.pointerId = pointerId ?? deviceSlot;\r\n evt.pointerType = \"touch\";\r\n }\r\n\r\n if (inputIndex === PointerInput.Move) {\r\n evt.type = \"pointermove\";\r\n } else if (inputIndex >= PointerInput.LeftClick && inputIndex <= PointerInput.RightClick) {\r\n evt.type = currentState === 1 ? \"pointerdown\" : \"pointerup\";\r\n evt.button = inputIndex - 2;\r\n }\r\n\r\n return evt;\r\n }\r\n\r\n /**\r\n * Create Mouse Wheel Event\r\n * @param deviceType Type of device\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IUIEvent object (Wheel)\r\n */\r\n private static _CreateWheelEvent(\r\n deviceType: DeviceType,\r\n deviceSlot: number,\r\n inputIndex: number,\r\n currentState: Nullable<number>,\r\n deviceInputSystem: IDeviceInputSystem,\r\n elementToAttachTo: any\r\n ): any {\r\n const evt = this._CreateMouseEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\r\n\r\n // While WheelEvents don't generally have a pointerId, we used to add one in the InputManager\r\n // This line has been added to make the InputManager more platform-agnostic\r\n // Similar code exists in the WebDeviceInputSystem to handle browser created events\r\n evt.pointerId = 1;\r\n evt.type = \"wheel\";\r\n evt.deltaMode = EventConstants.DOM_DELTA_PIXEL;\r\n evt.deltaX = 0;\r\n evt.deltaY = 0;\r\n evt.deltaZ = 0;\r\n\r\n switch (inputIndex) {\r\n case PointerInput.MouseWheelX:\r\n evt.deltaX = currentState;\r\n break;\r\n case PointerInput.MouseWheelY:\r\n evt.deltaY = currentState;\r\n break;\r\n case PointerInput.MouseWheelZ:\r\n evt.deltaZ = currentState;\r\n break;\r\n }\r\n\r\n return evt;\r\n }\r\n\r\n /**\r\n * Create Mouse Event\r\n * @param deviceType Type of device\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IUIEvent object (Mouse)\r\n */\r\n private static _CreateMouseEvent(\r\n deviceType: DeviceType,\r\n deviceSlot: number,\r\n inputIndex: number,\r\n currentState: Nullable<number>,\r\n deviceInputSystem: IDeviceInputSystem,\r\n elementToAttachTo?: any\r\n ): any {\r\n const evt = this._CreateEvent(elementToAttachTo);\r\n const pointerX = deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.Horizontal);\r\n const pointerY = deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.Vertical);\r\n\r\n // Handle offsets/deltas based on existence of HTMLElement\r\n if (elementToAttachTo) {\r\n evt.movementX = 0;\r\n evt.movementY = 0;\r\n evt.offsetX = evt.movementX - elementToAttachTo.getBoundingClientRect().x;\r\n evt.offsetY = evt.movementY - elementToAttachTo.getBoundingClientRect().y;\r\n } else {\r\n evt.movementX = deviceInputSystem.pollInput(deviceType, deviceSlot, NativePointerInput.DeltaHorizontal); // DeltaHorizontal\r\n evt.movementY = deviceInputSystem.pollInput(deviceType, deviceSlot, NativePointerInput.DeltaVertical); // DeltaVertical\r\n evt.offsetX = 0;\r\n evt.offsetY = 0;\r\n }\r\n this._CheckNonCharacterKeys(evt, deviceInputSystem);\r\n\r\n evt.clientX = pointerX;\r\n evt.clientY = pointerY;\r\n evt.x = pointerX;\r\n evt.y = pointerY;\r\n\r\n evt.deviceType = deviceType;\r\n evt.deviceSlot = deviceSlot;\r\n evt.inputIndex = inputIndex;\r\n\r\n return evt;\r\n }\r\n\r\n /**\r\n * Create Keyboard Event\r\n * @param inputIndex Id of input to be checked\r\n * @param currentState Current value for given input\r\n * @param deviceInputSystem Reference to DeviceInputSystem\r\n * @param elementToAttachTo HTMLElement to reference as target for inputs\r\n * @returns IEvent object (Keyboard)\r\n */\r\n private static _CreateKeyboardEvent(inputIndex: number, currentState: Nullable<number>, deviceInputSystem: IDeviceInputSystem, elementToAttachTo?: any): any {\r\n const evt = this._CreateEvent(elementToAttachTo);\r\n this._CheckNonCharacterKeys(evt, deviceInputSystem);\r\n evt.deviceType = DeviceType.Keyboard;\r\n evt.deviceSlot = 0;\r\n evt.inputIndex = inputIndex;\r\n\r\n evt.type = currentState === 1 ? \"keydown\" : \"keyup\";\r\n evt.key = String.fromCharCode(inputIndex);\r\n evt.keyCode = inputIndex;\r\n\r\n return evt;\r\n }\r\n\r\n /**\r\n * Add parameters for non-character keys (Ctrl, Alt, Meta, Shift)\r\n * @param evt Event object to add parameters to\r\n * @param deviceInputSystem DeviceInputSystem to pull values from\r\n */\r\n private static _CheckNonCharacterKeys(evt: any, deviceInputSystem: IDeviceInputSystem): void {\r\n const isKeyboardActive = deviceInputSystem.isDeviceAvailable(DeviceType.Keyboard);\r\n const altKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_ALT_KEY) === 1;\r\n const ctrlKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_CTRL_KEY) === 1;\r\n const metaKey =\r\n isKeyboardActive &&\r\n (deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY1) === 1 ||\r\n deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY2) === 1 ||\r\n deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY3) === 1);\r\n const shiftKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_SHIFT_KEY) === 1;\r\n\r\n evt.altKey = altKey;\r\n evt.ctrlKey = ctrlKey;\r\n evt.metaKey = metaKey;\r\n evt.shiftKey = shiftKey;\r\n }\r\n\r\n /**\r\n * Create base event object\r\n * @param elementToAttachTo Value to use as event target\r\n * @returns\r\n */\r\n private static _CreateEvent(elementToAttachTo: any): any {\r\n const evt: { [k: string]: any } = {};\r\n evt.preventDefault = () => {};\r\n evt.target = elementToAttachTo;\r\n\r\n return evt;\r\n }\r\n}\r\n"]}