@babylonjs/core 5.23.0 → 5.24.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.
- package/Actions/abstractActionManager.d.ts +6 -6
- package/Actions/abstractActionManager.js +1 -1
- package/Actions/abstractActionManager.js.map +1 -1
- package/Actions/actionManager.d.ts +5 -5
- package/Actions/actionManager.js +5 -5
- package/Actions/actionManager.js.map +1 -1
- package/Animations/animationGroup.d.ts +3 -3
- package/Animations/animationGroup.js +3 -3
- package/Animations/animationGroup.js.map +1 -1
- package/Audio/audioSceneComponent.d.ts +1 -1
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
- package/Behaviors/Cameras/framingBehavior.js +1 -1
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Bones/bone.d.ts +1 -1
- package/Bones/bone.js +1 -1
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.d.ts +2 -2
- package/Bones/skeleton.js +2 -2
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +1 -1
- package/Cameras/arcRotateCamera.js +1 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +2 -2
- package/Cameras/camera.js +2 -2
- package/Cameras/camera.js.map +1 -1
- package/Cameras/freeCamera.d.ts +1 -1
- package/Cameras/freeCamera.js +1 -1
- package/Cameras/freeCamera.js.map +1 -1
- package/Cameras/gamepadCamera.d.ts +1 -1
- package/Cameras/gamepadCamera.js +1 -1
- package/Cameras/gamepadCamera.js.map +1 -1
- package/Cameras/targetCamera.d.ts +1 -1
- package/Cameras/targetCamera.js +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Cameras/touchCamera.d.ts +1 -1
- package/Cameras/touchCamera.js +1 -1
- package/Cameras/touchCamera.js.map +1 -1
- package/Cameras/universalCamera.d.ts +1 -1
- package/Cameras/universalCamera.js +1 -1
- package/Cameras/universalCamera.js.map +1 -1
- package/Cameras/virtualJoysticksCamera.d.ts +1 -1
- package/Cameras/virtualJoysticksCamera.js +1 -1
- package/Cameras/virtualJoysticksCamera.js.map +1 -1
- package/Culling/boundingBox.d.ts +2 -2
- package/Culling/boundingBox.js +2 -2
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/ray.d.ts +1 -1
- package/Culling/ray.js +1 -1
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +8 -10
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.query.d.ts +2 -2
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/ICanvas.d.ts +11 -0
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/WebGL/webGLPipelineContext.d.ts +29 -19
- package/Engines/WebGL/webGLPipelineContext.js +99 -311
- package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/engine.d.ts +2 -2
- package/Engines/engine.js +2 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +2 -2
- package/Engines/nativeEngine.js +2 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +1 -0
- package/Engines/renderTargetWrapper.js +5 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +6 -5
- package/Engines/thinEngine.js +11 -7
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +4 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/clipboardEvents.d.ts +1 -1
- package/Events/clipboardEvents.js +1 -1
- package/Events/clipboardEvents.js.map +1 -1
- package/Gamepads/Controllers/windowsMotionController.d.ts +1 -1
- package/Gamepads/Controllers/windowsMotionController.js +1 -1
- package/Gamepads/Controllers/windowsMotionController.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +4 -0
- package/Gizmos/boundingBoxGizmo.js +6 -0
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Layers/effectLayer.d.ts +3 -3
- package/Layers/effectLayer.js +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +3 -3
- package/Layers/glowLayer.js +2 -2
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +3 -3
- package/Layers/highlightLayer.js +2 -2
- package/Layers/highlightLayer.js.map +1 -1
- package/Lights/directionalLight.d.ts +2 -2
- package/Lights/directionalLight.js +2 -2
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/hemisphericLight.d.ts +3 -3
- package/Lights/hemisphericLight.js +3 -3
- package/Lights/hemisphericLight.js.map +1 -1
- package/Lights/light.d.ts +2 -2
- package/Lights/light.js +2 -2
- package/Lights/light.js.map +1 -1
- package/Lights/lightConstants.d.ts +1 -1
- package/Lights/lightConstants.js +1 -1
- package/Lights/lightConstants.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +1 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -1
- package/Materials/Node/nodeMaterial.js +2 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -1
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.d.ts +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.js +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.js +9 -3
- package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.d.ts +9 -9
- package/Materials/Textures/Procedurals/proceduralTexture.js +9 -9
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.d.ts +1 -1
- package/Materials/Textures/colorGradingTexture.js +1 -1
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +2 -2
- package/Materials/Textures/cubeTexture.js +2 -2
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.d.ts +1 -1
- package/Materials/Textures/rawCubeTexture.js +1 -1
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +3 -5
- package/Materials/Textures/renderTargetTexture.js +19 -19
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/colorCurves.d.ts +3 -3
- package/Materials/colorCurves.js +3 -3
- package/Materials/colorCurves.js.map +1 -1
- package/Materials/effect.d.ts +27 -27
- package/Materials/effect.js +22 -288
- package/Materials/effect.js.map +1 -1
- package/Materials/fresnelParameters.d.ts +1 -1
- package/Materials/fresnelParameters.js +1 -1
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/imageProcessingConfiguration.d.ts +4 -4
- package/Materials/imageProcessingConfiguration.js +4 -4
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +25 -25
- package/Materials/shaderMaterial.js +25 -25
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +1 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/index.d.ts +1 -0
- package/Maths/index.js +1 -0
- package/Maths/index.js.map +1 -1
- package/Maths/math.functions.d.ts +2 -2
- package/Maths/math.functions.js +2 -2
- package/Maths/math.functions.js.map +1 -1
- package/Maths/math.polar.d.ts +77 -0
- package/Maths/math.polar.js +114 -0
- package/Maths/math.polar.js.map +1 -0
- package/Maths/math.scalar.d.ts +2 -2
- package/Maths/math.scalar.js +2 -2
- package/Maths/math.scalar.js.map +1 -1
- package/Maths/math.vector.d.ts +13 -12
- package/Maths/math.vector.js +13 -12
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -1
- package/Meshes/abstractMesh.js +9 -4
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +3 -3
- package/Meshes/geometry.js +3 -3
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +1 -1
- package/Meshes/instancedMesh.js +1 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +3 -3
- package/Meshes/mesh.js +7 -3
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +1 -1
- package/Meshes/subMesh.js +1 -1
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.d.ts +1 -1
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/transformNode.js +3 -0
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +2 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.d.ts +3 -3
- package/Misc/HighDynamicRange/hdr.js +3 -3
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
- package/Misc/arrayTools.d.ts +13 -12
- package/Misc/arrayTools.js +70 -39
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/assetsManager.d.ts +3 -3
- package/Misc/assetsManager.js +3 -3
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +1 -1
- package/Misc/basis.js.map +1 -1
- package/Misc/environmentTextureTools.d.ts +4 -4
- package/Misc/environmentTextureTools.js +5 -5
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.d.ts +3 -3
- package/Misc/fileTools.js +19 -12
- package/Misc/fileTools.js.map +1 -1
- package/Misc/observable.d.ts +1 -1
- package/Misc/observable.js +1 -1
- package/Misc/observable.js.map +1 -1
- package/Misc/performanceMonitor.d.ts +3 -3
- package/Misc/performanceMonitor.js +3 -3
- package/Misc/performanceMonitor.js.map +1 -1
- package/Misc/rgbdTextureTools.d.ts +1 -1
- package/Misc/rgbdTextureTools.js +1 -1
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/Misc/sceneOptimizer.d.ts +7 -7
- package/Misc/sceneOptimizer.js +7 -7
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/stringDictionary.d.ts +6 -6
- package/Misc/stringDictionary.js +6 -6
- package/Misc/stringDictionary.js.map +1 -1
- package/Misc/textureTools.d.ts +4 -4
- package/Misc/textureTools.js +4 -4
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.d.ts +6 -6
- package/Misc/tools.js +6 -6
- package/Misc/tools.js.map +1 -1
- package/Misc/videoRecorder.d.ts +1 -1
- package/Misc/videoRecorder.js +1 -1
- package/Misc/videoRecorder.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +1 -1
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +1 -1
- package/Particles/gpuParticleSystem.js +1 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +1 -1
- package/Particles/particleSystem.js +1 -1
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +4 -0
- package/Particles/solidParticleSystem.js +25 -3
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
- package/Physics/Plugins/ammoJSPlugin.js +1 -1
- package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/Plugins/oimoJSPlugin.js +1 -1
- package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
- package/Physics/physicsEngineComponent.d.ts +1 -1
- package/Physics/physicsEngineComponent.js +1 -1
- package/Physics/physicsEngineComponent.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +3 -3
- package/PostProcesses/blurPostProcess.js +3 -3
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +3 -3
- package/PostProcesses/volumetricLightScatteringPostProcess.js +3 -3
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/depthPeelingRenderer.d.ts +1 -0
- package/Rendering/depthPeelingRenderer.js +32 -5
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.d.ts +2 -2
- package/Rendering/edgesRenderer.js +1 -1
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.d.ts +4 -2
- package/Rendering/geometryBufferRenderer.js +5 -3
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/geometryBufferRendererSceneComponent.d.ts +2 -1
- package/Rendering/geometryBufferRendererSceneComponent.js +3 -2
- package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +11 -3
- package/Rendering/prePassRenderer.js +18 -3
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.d.ts +2 -2
- package/Rendering/subSurfaceConfiguration.js +2 -2
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +4 -0
- package/XR/features/WebXRControllerTeleportation.js +24 -19
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.d.ts +2 -2
- package/XR/motionController/webXRAbstractMotionController.js +2 -2
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/motionController/webXRControllerComponent.d.ts +1 -1
- package/XR/motionController/webXRControllerComponent.js +1 -1
- package/XR/motionController/webXRControllerComponent.js.map +1 -1
- package/XR/motionController/webXRMotionControllerManager.d.ts +3 -3
- package/XR/motionController/webXRMotionControllerManager.js +3 -3
- package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
- package/node.d.ts +4 -4
- package/node.js +3 -3
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +61 -61
- package/scene.js +58 -46
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animationGroup.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Animations/animationGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAU1B;;;OAGG;IACI,YAAY;QACf,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAQ,EAAE,CAAC;QACpC,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QAC3D,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAE9C,OAAO,mBAAmB,CAAC;IAC/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AC,mBAAmB,CAAC,MAAM,CAAC;YACzE,GAAG,IAAI,wBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC;SACvD;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import type { Animatable } from \"./animatable\";\r\nimport { Animation } from \"./animation\";\r\nimport type { IAnimationKey } from \"./animationKey\";\r\n\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport { Tags } from \"../Misc/tags\";\r\n\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nexport class TargetedAnimation {\r\n /**\r\n * Animation to perform\r\n */\r\n public animation: Animation;\r\n /**\r\n * Target to animate\r\n */\r\n public target: any;\r\n\r\n /**\r\n * Returns the string \"TargetedAnimation\"\r\n * @returns \"TargetedAnimation\"\r\n */\r\n public getClassName(): string {\r\n return \"TargetedAnimation\";\r\n }\r\n\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n\r\n return serializationObject;\r\n }\r\n}\r\n\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nexport class AnimationGroup implements IDisposable {\r\n private _scene: Scene;\r\n\r\n private _targetedAnimations = new Array<TargetedAnimation>();\r\n private _animatables = new Array<Animatable>();\r\n private _from = Number.MAX_VALUE;\r\n private _to = -Number.MAX_VALUE;\r\n private _isStarted: boolean;\r\n private _isPaused: boolean;\r\n private _speedRatio = 1;\r\n private _loopAnimation = false;\r\n private _isAdditive = false;\r\n\r\n /** @hidden */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n public onAnimationEndObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n public onAnimationLoopObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when all animations have looped\r\n */\r\n public onAnimationGroupLoopObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n public onAnimationGroupEndObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n public onAnimationGroupPauseObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n public onAnimationGroupPlayObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n public metadata: any = null;\r\n\r\n /**\r\n * Gets the first frame\r\n */\r\n public get from(): number {\r\n return this._from;\r\n }\r\n\r\n /**\r\n * Gets the last frame\r\n */\r\n public get to(): number {\r\n return this._to;\r\n }\r\n\r\n /**\r\n * Define if the animations are started\r\n */\r\n public get isStarted(): boolean {\r\n return this._isStarted;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n public get isPlaying(): boolean {\r\n return this._isStarted && !this._isPaused;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public get speedRatio(): number {\r\n return this._speedRatio;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public set speedRatio(value: number) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n\r\n this._speedRatio = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n public get loopAnimation(): boolean {\r\n return this._loopAnimation;\r\n }\r\n\r\n public set loopAnimation(value: boolean) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n\r\n this._loopAnimation = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should be evaluated additively\r\n */\r\n public get isAdditive(): boolean {\r\n return this._isAdditive;\r\n }\r\n\r\n public set isAdditive(value: boolean) {\r\n if (this._isAdditive === value) {\r\n return;\r\n }\r\n\r\n this._isAdditive = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.isAdditive = this._isAdditive;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n public get targetedAnimations(): Array<TargetedAnimation> {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n public get animatables(): Array<Animatable> {\r\n return this._animatables;\r\n }\r\n\r\n /**\r\n * Gets the list of target animations\r\n */\r\n public get children() {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/groupAnimations\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n */\r\n public constructor(\r\n /** The name of the animation group */\r\n public name: string,\r\n scene: Nullable<Scene> = null\r\n ) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\r\n this.uniqueId = this._scene.getUniqueId();\r\n\r\n this._scene.addAnimationGroup(this);\r\n }\r\n\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n public addTargetedAnimation(animation: Animation, target: any): TargetedAnimation {\r\n const targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n\r\n const keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n\r\n this._targetedAnimations.push(targetedAnimation);\r\n\r\n return targetedAnimation;\r\n }\r\n\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n public normalize(beginFrame: Nullable<number> = null, endFrame: Nullable<number> = null): AnimationGroup {\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const keys = targetedAnimation.animation.getKeys();\r\n const startKey = keys[0];\r\n const endKey = keys[keys.length - 1];\r\n\r\n if (startKey.frame > beginFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation,\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n\r\n if (endKey.frame < endFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.inTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation,\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n\r\n return this;\r\n }\r\n\r\n private _animationLoopCount: number;\r\n private _animationLoopFlags: boolean[] = [];\r\n\r\n private _processLoop(animatable: Animatable, targetedAnimation: TargetedAnimation, index: number) {\r\n animatable.onAnimationLoop = () => {\r\n this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n\r\n if (this._animationLoopFlags[index]) {\r\n return;\r\n }\r\n\r\n this._animationLoopFlags[index] = true;\r\n\r\n this._animationLoopCount++;\r\n if (this._animationLoopCount === this._targetedAnimations.length) {\r\n this.onAnimationGroupLoopObservable.notifyObservers(this);\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @param isAdditive defines the additive state for the resulting animatables (optional)\r\n * @returns the current animation group\r\n */\r\n public start(loop = false, speedRatio = 1, from?: number, to?: number, isAdditive?: boolean): AnimationGroup {\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n\r\n this._loopAnimation = loop;\r\n\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const animatable = this._scene.beginDirectAnimation(\r\n targetedAnimation.target,\r\n [targetedAnimation.animation],\r\n from !== undefined ? from : this._from,\r\n to !== undefined ? to : this._to,\r\n loop,\r\n speedRatio,\r\n undefined,\r\n undefined,\r\n isAdditive !== undefined ? isAdditive : this._isAdditive\r\n );\r\n animatable.onAnimationEnd = () => {\r\n this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n this._checkAnimationGroupEnded(animatable);\r\n };\r\n\r\n this._processLoop(animatable, targetedAnimation, index);\r\n this._animatables.push(animatable);\r\n }\r\n\r\n this._speedRatio = speedRatio;\r\n\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n public pause(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n this._isPaused = true;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n public play(loop?: boolean): AnimationGroup {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n } else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n\r\n this._isPaused = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n public reset(): AnimationGroup {\r\n if (!this._isStarted) {\r\n this.play();\r\n this.goToFrame(0);\r\n this.stop();\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n public restart(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n public stop(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n const list = this._animatables.slice();\r\n for (let index = 0; index < list.length; index++) {\r\n list[index].stop();\r\n }\r\n\r\n this._isStarted = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Set animation weight for all animatables\r\n * @param weight defines the weight to use\r\n * @return the animationGroup\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n public setWeightForAllAnimatables(weight: number): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with (null to stop synchronizing)\r\n * @return the animationGroup\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n public syncAllAnimationsWith(root: Nullable<Animatable>): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @return the animationGroup\r\n */\r\n public goToFrame(frame: number): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispose all associated resources\r\n */\r\n public dispose(): void {\r\n this._targetedAnimations.length = 0;\r\n this._animatables.length = 0;\r\n\r\n // Remove from scene\r\n const index = this._scene.animationGroups.indexOf(this);\r\n\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.animationGroups.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationGroupLoopObservable.clear();\r\n }\r\n\r\n private _checkAnimationGroupEnded(animatable: Animatable) {\r\n // animatable should be taken out of the array\r\n const idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @param cloneAnimations defines if the animations should be cloned or referenced\r\n * @returns the new animation group\r\n */\r\n public clone(newName: string, targetConverter?: (oldTarget: any) => any, cloneAnimations = false): AnimationGroup {\r\n const newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n\r\n for (const targetAnimation of this._targetedAnimations) {\r\n newGroup.addTargetedAnimation(\r\n cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation,\r\n targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target\r\n );\r\n }\r\n\r\n return newGroup;\r\n }\r\n\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n public static Parse(parsedAnimationGroup: any, scene: Scene): AnimationGroup {\r\n const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n const animation = Animation.Parse(targetedAnimation.animation);\r\n const id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") {\r\n // morph target animation\r\n const morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n } else {\r\n const targetNode = scene.getNodeById(id);\r\n\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);\r\n }\r\n\r\n if (parsedAnimationGroup.metadata !== undefined) {\r\n animationGroup.metadata = parsedAnimationGroup.metadata;\r\n }\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\r\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\r\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\r\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\r\n */\r\n public static MakeAnimationAdditive(sourceAnimationGroup: AnimationGroup, referenceFrame = 0, range?: string, cloneOriginal = false, clonedName?: string): AnimationGroup {\r\n let animationGroup = sourceAnimationGroup;\r\n if (cloneOriginal) {\r\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\r\n }\r\n\r\n const targetedAnimations = animationGroup.targetedAnimations;\r\n for (let index = 0; index < targetedAnimations.length; index++) {\r\n const targetedAnimation = targetedAnimations[index];\r\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\r\n }\r\n\r\n animationGroup.isAdditive = true;\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n public getClassName(): string {\r\n return \"AnimationGroup\";\r\n }\r\n\r\n /**\r\n * Creates a detailed string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n public toString(fullDetails?: boolean): string {\r\n let ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"animationGroup.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Animations/animationGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAU1B;;;OAGG;IACI,YAAY;QACf,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAQ,EAAE,C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AAG,IAAI,CAAC,GAAG,CAAC;YAC3B,GAAG,IAAI,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC;YACzC,GAAG,IAAI,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;YAC3C,GAAG,IAAI,+BAA+B,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACzE,GAAG,IAAI,wBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC;SACvD;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import type { Animatable } from \"./animatable\";\r\nimport { Animation } from \"./animation\";\r\nimport type { IAnimationKey } from \"./animationKey\";\r\n\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport { Tags } from \"../Misc/tags\";\r\n\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nexport class TargetedAnimation {\r\n /**\r\n * Animation to perform\r\n */\r\n public animation: Animation;\r\n /**\r\n * Target to animate\r\n */\r\n public target: any;\r\n\r\n /**\r\n * Returns the string \"TargetedAnimation\"\r\n * @returns \"TargetedAnimation\"\r\n */\r\n public getClassName(): string {\r\n return \"TargetedAnimation\";\r\n }\r\n\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n\r\n return serializationObject;\r\n }\r\n}\r\n\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nexport class AnimationGroup implements IDisposable {\r\n private _scene: Scene;\r\n\r\n private _targetedAnimations = new Array<TargetedAnimation>();\r\n private _animatables = new Array<Animatable>();\r\n private _from = Number.MAX_VALUE;\r\n private _to = -Number.MAX_VALUE;\r\n private _isStarted: boolean;\r\n private _isPaused: boolean;\r\n private _speedRatio = 1;\r\n private _loopAnimation = false;\r\n private _isAdditive = false;\r\n\r\n /** @hidden */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n public onAnimationEndObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n public onAnimationLoopObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when all animations have looped\r\n */\r\n public onAnimationGroupLoopObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n public onAnimationGroupEndObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n public onAnimationGroupPauseObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n public onAnimationGroupPlayObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n public metadata: any = null;\r\n\r\n /**\r\n * Gets the first frame\r\n */\r\n public get from(): number {\r\n return this._from;\r\n }\r\n\r\n /**\r\n * Gets the last frame\r\n */\r\n public get to(): number {\r\n return this._to;\r\n }\r\n\r\n /**\r\n * Define if the animations are started\r\n */\r\n public get isStarted(): boolean {\r\n return this._isStarted;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n public get isPlaying(): boolean {\r\n return this._isStarted && !this._isPaused;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public get speedRatio(): number {\r\n return this._speedRatio;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public set speedRatio(value: number) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n\r\n this._speedRatio = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n public get loopAnimation(): boolean {\r\n return this._loopAnimation;\r\n }\r\n\r\n public set loopAnimation(value: boolean) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n\r\n this._loopAnimation = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should be evaluated additively\r\n */\r\n public get isAdditive(): boolean {\r\n return this._isAdditive;\r\n }\r\n\r\n public set isAdditive(value: boolean) {\r\n if (this._isAdditive === value) {\r\n return;\r\n }\r\n\r\n this._isAdditive = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.isAdditive = this._isAdditive;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n public get targetedAnimations(): Array<TargetedAnimation> {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n public get animatables(): Array<Animatable> {\r\n return this._animatables;\r\n }\r\n\r\n /**\r\n * Gets the list of target animations\r\n */\r\n public get children() {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/groupAnimations\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n */\r\n public constructor(\r\n /** The name of the animation group */\r\n public name: string,\r\n scene: Nullable<Scene> = null\r\n ) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\r\n this.uniqueId = this._scene.getUniqueId();\r\n\r\n this._scene.addAnimationGroup(this);\r\n }\r\n\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n public addTargetedAnimation(animation: Animation, target: any): TargetedAnimation {\r\n const targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n\r\n const keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n\r\n this._targetedAnimations.push(targetedAnimation);\r\n\r\n return targetedAnimation;\r\n }\r\n\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n public normalize(beginFrame: Nullable<number> = null, endFrame: Nullable<number> = null): AnimationGroup {\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const keys = targetedAnimation.animation.getKeys();\r\n const startKey = keys[0];\r\n const endKey = keys[keys.length - 1];\r\n\r\n if (startKey.frame > beginFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation,\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n\r\n if (endKey.frame < endFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.inTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation,\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n\r\n return this;\r\n }\r\n\r\n private _animationLoopCount: number;\r\n private _animationLoopFlags: boolean[] = [];\r\n\r\n private _processLoop(animatable: Animatable, targetedAnimation: TargetedAnimation, index: number) {\r\n animatable.onAnimationLoop = () => {\r\n this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n\r\n if (this._animationLoopFlags[index]) {\r\n return;\r\n }\r\n\r\n this._animationLoopFlags[index] = true;\r\n\r\n this._animationLoopCount++;\r\n if (this._animationLoopCount === this._targetedAnimations.length) {\r\n this.onAnimationGroupLoopObservable.notifyObservers(this);\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @param isAdditive defines the additive state for the resulting animatables (optional)\r\n * @returns the current animation group\r\n */\r\n public start(loop = false, speedRatio = 1, from?: number, to?: number, isAdditive?: boolean): AnimationGroup {\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n\r\n this._loopAnimation = loop;\r\n\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const animatable = this._scene.beginDirectAnimation(\r\n targetedAnimation.target,\r\n [targetedAnimation.animation],\r\n from !== undefined ? from : this._from,\r\n to !== undefined ? to : this._to,\r\n loop,\r\n speedRatio,\r\n undefined,\r\n undefined,\r\n isAdditive !== undefined ? isAdditive : this._isAdditive\r\n );\r\n animatable.onAnimationEnd = () => {\r\n this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n this._checkAnimationGroupEnded(animatable);\r\n };\r\n\r\n this._processLoop(animatable, targetedAnimation, index);\r\n this._animatables.push(animatable);\r\n }\r\n\r\n this._speedRatio = speedRatio;\r\n\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n public pause(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n this._isPaused = true;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n public play(loop?: boolean): AnimationGroup {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n } else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n\r\n this._isPaused = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n public reset(): AnimationGroup {\r\n if (!this._isStarted) {\r\n this.play();\r\n this.goToFrame(0);\r\n this.stop();\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n public restart(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n public stop(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n const list = this._animatables.slice();\r\n for (let index = 0; index < list.length; index++) {\r\n list[index].stop();\r\n }\r\n\r\n this._isStarted = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Set animation weight for all animatables\r\n * @param weight defines the weight to use\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n public setWeightForAllAnimatables(weight: number): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with (null to stop synchronizing)\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n public syncAllAnimationsWith(root: Nullable<Animatable>): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @returns the animationGroup\r\n */\r\n public goToFrame(frame: number): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispose all associated resources\r\n */\r\n public dispose(): void {\r\n this._targetedAnimations.length = 0;\r\n this._animatables.length = 0;\r\n\r\n // Remove from scene\r\n const index = this._scene.animationGroups.indexOf(this);\r\n\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.animationGroups.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationGroupLoopObservable.clear();\r\n }\r\n\r\n private _checkAnimationGroupEnded(animatable: Animatable) {\r\n // animatable should be taken out of the array\r\n const idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @param cloneAnimations defines if the animations should be cloned or referenced\r\n * @returns the new animation group\r\n */\r\n public clone(newName: string, targetConverter?: (oldTarget: any) => any, cloneAnimations = false): AnimationGroup {\r\n const newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n\r\n for (const targetAnimation of this._targetedAnimations) {\r\n newGroup.addTargetedAnimation(\r\n cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation,\r\n targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target\r\n );\r\n }\r\n\r\n return newGroup;\r\n }\r\n\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n public static Parse(parsedAnimationGroup: any, scene: Scene): AnimationGroup {\r\n const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n const animation = Animation.Parse(targetedAnimation.animation);\r\n const id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") {\r\n // morph target animation\r\n const morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n } else {\r\n const targetNode = scene.getNodeById(id);\r\n\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);\r\n }\r\n\r\n if (parsedAnimationGroup.metadata !== undefined) {\r\n animationGroup.metadata = parsedAnimationGroup.metadata;\r\n }\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\r\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\r\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\r\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\r\n */\r\n public static MakeAnimationAdditive(sourceAnimationGroup: AnimationGroup, referenceFrame = 0, range?: string, cloneOriginal = false, clonedName?: string): AnimationGroup {\r\n let animationGroup = sourceAnimationGroup;\r\n if (cloneOriginal) {\r\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\r\n }\r\n\r\n const targetedAnimations = animationGroup.targetedAnimations;\r\n for (let index = 0; index < targetedAnimations.length; index++) {\r\n const targetedAnimation = targetedAnimations[index];\r\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\r\n }\r\n\r\n animationGroup.isAdditive = true;\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n public getClassName(): string {\r\n return \"AnimationGroup\";\r\n }\r\n\r\n /**\r\n * Creates a detailed string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n public toString(fullDetails?: boolean): string {\r\n let ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n }\r\n}\r\n"]}
|
|
@@ -34,7 +34,7 @@ declare module "../scene" {
|
|
|
34
34
|
/**
|
|
35
35
|
* Gets a sound using a given name
|
|
36
36
|
* @param name defines the name to search for
|
|
37
|
-
* @
|
|
37
|
+
* @returns the found sound or null if not found at all.
|
|
38
38
|
*/
|
|
39
39
|
getSoundByName(name: string): Nullable<Sound>;
|
|
40
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aud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CAAC,EAAE,EAAE;wBAClE,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;wBACtD,IAAI,KAAK,CAAC,oBAAoB,EAAE;4BAC5B,KAAK,CAAC,0BAA0B,EAAE,CAAC;yBACtC;qBACJ;iBACJ;aACJ;SACJ;IACL,CAAC;;AApUc,oCAAgB,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAuU5D,KAAK,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IACnD,IAAI,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IACpE,IAAI,CAAC,KAAK,EAAE;QACR,KAAK,GAAG,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAC9B;AACL,CAAC,CAAC","sourcesContent":["import { Sound } from \"./sound\";\r\nimport { SoundTrack } from \"./soundTrack\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport type { ISceneSerializableComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { Scene } from \"../scene\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\n\r\nimport \"./audioEngine\";\r\nimport { PrecisionDate } from \"../Misc/precisionDate\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n// Adds the parser to the scene parsers.\r\nAbstractScene.AddParser(SceneComponentConstants.NAME_AUDIO, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n // TODO: add sound\r\n let loadedSounds: Sound[] = [];\r\n let loadedSound: Sound;\r\n container.sounds = container.sounds || [];\r\n if (parsedData.sounds !== undefined && parsedData.sounds !== null) {\r\n for (let index = 0, cache = parsedData.sounds.length; index < cache; index++) {\r\n const parsedSound = parsedData.sounds[index];\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n if (!parsedSound.url) {\r\n parsedSound.url = parsedSound.name;\r\n }\r\n if (!loadedSounds[parsedSound.url]) {\r\n loadedSound = Sound.Parse(parsedSound, scene, rootUrl);\r\n loadedSounds[parsedSound.url] = loadedSound;\r\n container.sounds.push(loadedSound);\r\n } else {\r\n container.sounds.push(Sound.Parse(parsedSound, scene, rootUrl, loadedSounds[parsedSound.url]));\r\n }\r\n } else {\r\n container.sounds.push(new Sound(parsedSound.name, null, scene));\r\n }\r\n }\r\n }\r\n\r\n loadedSounds = [];\r\n});\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * The list of sounds used in the scene.\r\n */\r\n sounds: Nullable<Array<Sound>>;\r\n }\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /**\r\n * @hidden\r\n * Backing field\r\n */\r\n _mainSoundTrack: SoundTrack;\r\n /**\r\n * The main sound track played by the scene.\r\n * It contains your primary collection of sounds.\r\n */\r\n mainSoundTrack: SoundTrack;\r\n /**\r\n * The list of sound tracks added to the scene\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\n soundTracks: Nullable<Array<SoundTrack>>;\r\n\r\n /**\r\n * Gets a sound using a given name\r\n * @param name defines the name to search for\r\n * @return the found sound or null if not found at all.\r\n */\r\n getSoundByName(name: string): Nullable<Sound>;\r\n\r\n /**\r\n * Gets or sets if audio support is enabled\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\n audioEnabled: boolean;\r\n\r\n /**\r\n * Gets or sets if audio will be output to headphones\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\n headphone: boolean;\r\n\r\n /**\r\n * Gets or sets custom audio listener position provider\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\n audioListenerPositionProvider: Nullable<() => Vector3>;\r\n\r\n /**\r\n * Gets or sets a refresh rate when using 3D audio positioning\r\n */\r\n audioPositioningRefreshRate: number;\r\n }\r\n}\r\n\r\nObject.defineProperty(Scene.prototype, \"mainSoundTrack\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n if (!this._mainSoundTrack) {\r\n this._mainSoundTrack = new SoundTrack(this, { mainTrack: true });\r\n }\r\n\r\n return this._mainSoundTrack;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nScene.prototype.getSoundByName = function (name: string): Nullable<Sound> {\r\n let index: number;\r\n for (index = 0; index < this.mainSoundTrack.soundCollection.length; index++) {\r\n if (this.mainSoundTrack.soundCollection[index].name === name) {\r\n return this.mainSoundTrack.soundCollection[index];\r\n }\r\n }\r\n\r\n if (this.soundTracks) {\r\n for (let sdIndex = 0; sdIndex < this.soundTracks.length; sdIndex++) {\r\n for (index = 0; index < this.soundTracks[sdIndex].soundCollection.length; index++) {\r\n if (this.soundTracks[sdIndex].soundCollection[index].name === name) {\r\n return this.soundTracks[sdIndex].soundCollection[index];\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nObject.defineProperty(Scene.prototype, \"audioEnabled\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n return compo.audioEnabled;\r\n },\r\n set: function (this: Scene, value: boolean) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n if (value) {\r\n compo.enableAudio();\r\n } else {\r\n compo.disableAudio();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(Scene.prototype, \"headphone\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n return compo.headphone;\r\n },\r\n set: function (this: Scene, value: boolean) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n if (value) {\r\n compo.switchAudioModeForHeadphones();\r\n } else {\r\n compo.switchAudioModeForNormalSpeakers();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(Scene.prototype, \"audioListenerPositionProvider\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n return compo.audioListenerPositionProvider;\r\n },\r\n set: function (this: Scene, value: () => Vector3) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n if (typeof value !== \"function\") {\r\n throw new Error(\"The value passed to [Scene.audioListenerPositionProvider] must be a function that returns a Vector3\");\r\n } else {\r\n compo.audioListenerPositionProvider = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(Scene.prototype, \"audioPositioningRefreshRate\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n return compo.audioPositioningRefreshRate;\r\n },\r\n set: function (this: Scene, value: number) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n compo.audioPositioningRefreshRate = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Defines the sound scene component responsible to manage any sounds\r\n * in a given scene.\r\n */\r\nexport class AudioSceneComponent implements ISceneSerializableComponent {\r\n private static _CameraDirection = new Vector3(0, 0, -1);\r\n\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_AUDIO;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n private _audioEnabled = true;\r\n /**\r\n * Gets whether audio is enabled or not.\r\n * Please use related enable/disable method to switch state.\r\n */\r\n public get audioEnabled(): boolean {\r\n return this._audioEnabled;\r\n }\r\n\r\n private _headphone = false;\r\n /**\r\n * Gets whether audio is outputting to headphone or not.\r\n * Please use the according Switch methods to change output.\r\n */\r\n public get headphone(): boolean {\r\n return this._headphone;\r\n }\r\n\r\n /**\r\n * Gets or sets a refresh rate when using 3D audio positioning\r\n */\r\n public audioPositioningRefreshRate = 500;\r\n\r\n private _audioListenerPositionProvider: Nullable<() => Vector3> = null;\r\n /**\r\n * Gets the current audio listener position provider\r\n */\r\n public get audioListenerPositionProvider(): Nullable<() => Vector3> {\r\n return this._audioListenerPositionProvider;\r\n }\r\n /**\r\n * Sets a custom listener position for all sounds in the scene\r\n * By default, this is the position of the first active camera\r\n */\r\n public set audioListenerPositionProvider(value: Nullable<() => Vector3>) {\r\n this._audioListenerPositionProvider = value;\r\n }\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene?: Nullable<Scene>) {\r\n scene = scene || EngineStore.LastCreatedScene;\r\n if (!scene) {\r\n return;\r\n }\r\n this.scene = scene;\r\n\r\n scene.soundTracks = new Array<SoundTrack>();\r\n scene.sounds = new Array<Sound>();\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._afterRenderStage.registerStep(SceneComponentConstants.STEP_AFTERRENDER_AUDIO, this, this._afterRender);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n // Nothing to do here. (Not rendering related)\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n serializationObject.sounds = [];\r\n\r\n if (this.scene.soundTracks) {\r\n for (let index = 0; index < this.scene.soundTracks.length; index++) {\r\n const soundtrack = this.scene.soundTracks[index];\r\n\r\n for (let soundId = 0; soundId < soundtrack.soundCollection.length; soundId++) {\r\n serializationObject.sounds.push(soundtrack.soundCollection[soundId].serialize());\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n public addFromContainer(container: AbstractScene): void {\r\n if (!container.sounds) {\r\n return;\r\n }\r\n container.sounds.forEach((sound) => {\r\n sound.play();\r\n sound.autoplay = true;\r\n this.scene.mainSoundTrack.addSound(sound);\r\n });\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n public removeFromContainer(container: AbstractScene, dispose = false): void {\r\n if (!container.sounds) {\r\n return;\r\n }\r\n container.sounds.forEach((sound) => {\r\n sound.stop();\r\n sound.autoplay = false;\r\n this.scene.mainSoundTrack.removeSound(sound);\r\n if (dispose) {\r\n sound.dispose();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n const scene = this.scene;\r\n if (scene._mainSoundTrack) {\r\n scene.mainSoundTrack.dispose();\r\n }\r\n\r\n if (scene.soundTracks) {\r\n for (let scIndex = 0; scIndex < scene.soundTracks.length; scIndex++) {\r\n scene.soundTracks[scIndex].dispose();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Disables audio in the associated scene.\r\n */\r\n public disableAudio() {\r\n const scene = this.scene;\r\n this._audioEnabled = false;\r\n\r\n if (Engine.audioEngine && Engine.audioEngine.audioContext) {\r\n Engine.audioEngine.audioContext.suspend();\r\n }\r\n\r\n let i: number;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n scene.mainSoundTrack.soundCollection[i].pause();\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (let j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n scene.soundTracks[i].soundCollection[j].pause();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enables audio in the associated scene.\r\n */\r\n public enableAudio() {\r\n const scene = this.scene;\r\n this._audioEnabled = true;\r\n\r\n if (Engine.audioEngine && Engine.audioEngine.audioContext) {\r\n Engine.audioEngine.audioContext.resume();\r\n }\r\n\r\n let i: number;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n if (scene.mainSoundTrack.soundCollection[i].isPaused) {\r\n scene.mainSoundTrack.soundCollection[i].play();\r\n }\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (let j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n if (scene.soundTracks[i].soundCollection[j].isPaused) {\r\n scene.soundTracks[i].soundCollection[j].play();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Switch audio to headphone output.\r\n */\r\n public switchAudioModeForHeadphones() {\r\n const scene = this.scene;\r\n this._headphone = true;\r\n\r\n scene.mainSoundTrack.switchPanningModelToHRTF();\r\n if (scene.soundTracks) {\r\n for (let i = 0; i < scene.soundTracks.length; i++) {\r\n scene.soundTracks[i].switchPanningModelToHRTF();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Switch audio to normal speakers.\r\n */\r\n public switchAudioModeForNormalSpeakers() {\r\n const scene = this.scene;\r\n this._headphone = false;\r\n\r\n scene.mainSoundTrack.switchPanningModelToEqualPower();\r\n\r\n if (scene.soundTracks) {\r\n for (let i = 0; i < scene.soundTracks.length; i++) {\r\n scene.soundTracks[i].switchPanningModelToEqualPower();\r\n }\r\n }\r\n }\r\n\r\n private _cachedCameraDirection = new Vector3();\r\n private _cachedCameraPosition = new Vector3();\r\n private _lastCheck = 0;\r\n private _invertMatrixTemp = new Matrix();\r\n private _cameraDirectionTemp = new Vector3();\r\n\r\n private _afterRender() {\r\n const now = PrecisionDate.Now;\r\n if (this._lastCheck && now - this._lastCheck < this.audioPositioningRefreshRate) {\r\n return;\r\n }\r\n\r\n this._lastCheck = now;\r\n\r\n const scene = this.scene;\r\n if (!this._audioEnabled || !scene._mainSoundTrack || !scene.soundTracks || (scene._mainSoundTrack.soundCollection.length === 0 && scene.soundTracks.length === 1)) {\r\n return;\r\n }\r\n\r\n const audioEngine = Engine.audioEngine;\r\n\r\n if (!audioEngine) {\r\n return;\r\n }\r\n\r\n if (audioEngine.audioContext) {\r\n // A custom listener position provider was set\r\n // Use the users provided position instead of camera's\r\n if (this._audioListenerPositionProvider) {\r\n const position: Vector3 = this._audioListenerPositionProvider();\r\n // Make sure all coordinates were provided\r\n position.x = position.x || 0;\r\n position.y = position.y || 0;\r\n position.z = position.z || 0;\r\n // Set the listener position\r\n audioEngine.audioContext.listener.setPosition(position.x, position.y, position.z);\r\n } else {\r\n let listeningCamera: Nullable<Camera>;\r\n\r\n if (scene.activeCameras && scene.activeCameras.length > 0) {\r\n listeningCamera = scene.activeCameras[0];\r\n } else {\r\n listeningCamera = scene.activeCamera;\r\n }\r\n\r\n // Check if there is a listening camera\r\n if (listeningCamera) {\r\n // Set the listener position to the listening camera global position\r\n if (!this._cachedCameraPosition.equals(listeningCamera.globalPosition)) {\r\n this._cachedCameraPosition.copyFrom(listeningCamera.globalPosition);\r\n audioEngine.audioContext.listener.setPosition(listeningCamera.globalPosition.x, listeningCamera.globalPosition.y, listeningCamera.globalPosition.z);\r\n }\r\n\r\n // for VR cameras\r\n if (listeningCamera.rigCameras && listeningCamera.rigCameras.length > 0) {\r\n listeningCamera = listeningCamera.rigCameras[0];\r\n }\r\n listeningCamera.getViewMatrix().invertToRef(this._invertMatrixTemp);\r\n Vector3.TransformNormalToRef(AudioSceneComponent._CameraDirection, this._invertMatrixTemp, this._cameraDirectionTemp);\r\n this._cameraDirectionTemp.normalize();\r\n // To avoid some errors on GearVR\r\n if (!isNaN(this._cameraDirectionTemp.x) && !isNaN(this._cameraDirectionTemp.y) && !isNaN(this._cameraDirectionTemp.z)) {\r\n if (!this._cachedCameraDirection.equals(this._cameraDirectionTemp)) {\r\n this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp);\r\n audioEngine.audioContext.listener.setOrientation(this._cameraDirectionTemp.x, this._cameraDirectionTemp.y, this._cameraDirectionTemp.z, 0, 1, 0);\r\n }\r\n }\r\n }\r\n // Otherwise set the listener position to 0, 0 ,0\r\n else {\r\n // Set the listener position\r\n audioEngine.audioContext.listener.setPosition(0, 0, 0);\r\n }\r\n }\r\n\r\n let i: number;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n const sound = scene.mainSoundTrack.soundCollection[i];\r\n if (sound.useCustomAttenuation) {\r\n sound.updateDistanceFromListener();\r\n }\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (let j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n const sound = scene.soundTracks[i].soundCollection[j];\r\n if (sound.useCustomAttenuation) {\r\n sound.updateDistanceFromListener();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nSound._SceneComponentInitialization = (scene: Scene) => {\r\n let compo = scene._getComponent(SceneComponentConstants.NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(scene);\r\n scene._addComponent(compo);\r\n }\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"audioSceneComponent.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Audio/audioSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,wCAAwC;AACxC,aAAa,CAAC,SAAS,CAAC,uBAAuB,CAAC,UAAU,EAAE,CAAC,UAAe,EAAE,KAAY,EAAE,SAAyB,EAAE,OAAe,EAAE,EAAE;IACtI,kBAAkB;IAClB,IAAI,YAAY,GAAY,EAAE,CAAC;IAC/B,IAAI,WAAkB,CAAC;IACvB,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;IAC1C,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,KAAK,IAAI,EAAE;QAC/D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,KA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,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBAClE,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;wBACtD,IAAI,KAAK,CAAC,oBAAoB,EAAE;4BAC5B,KAAK,CAAC,0BAA0B,EAAE,CAAC;yBACtC;qBACJ;iBACJ;aACJ;SACJ;IACL,CAAC;;AApUc,oCAAgB,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAuU5D,KAAK,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IACnD,IAAI,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IACpE,IAAI,CAAC,KAAK,EAAE;QACR,KAAK,GAAG,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAC9B;AACL,CAAC,CAAC","sourcesContent":["import { Sound } from \"./sound\";\r\nimport { SoundTrack } from \"./soundTrack\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport type { ISceneSerializableComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { Scene } from \"../scene\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\n\r\nimport \"./audioEngine\";\r\nimport { PrecisionDate } from \"../Misc/precisionDate\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n// Adds the parser to the scene parsers.\r\nAbstractScene.AddParser(SceneComponentConstants.NAME_AUDIO, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n // TODO: add sound\r\n let loadedSounds: Sound[] = [];\r\n let loadedSound: Sound;\r\n container.sounds = container.sounds || [];\r\n if (parsedData.sounds !== undefined && parsedData.sounds !== null) {\r\n for (let index = 0, cache = parsedData.sounds.length; index < cache; index++) {\r\n const parsedSound = parsedData.sounds[index];\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n if (!parsedSound.url) {\r\n parsedSound.url = parsedSound.name;\r\n }\r\n if (!loadedSounds[parsedSound.url]) {\r\n loadedSound = Sound.Parse(parsedSound, scene, rootUrl);\r\n loadedSounds[parsedSound.url] = loadedSound;\r\n container.sounds.push(loadedSound);\r\n } else {\r\n container.sounds.push(Sound.Parse(parsedSound, scene, rootUrl, loadedSounds[parsedSound.url]));\r\n }\r\n } else {\r\n container.sounds.push(new Sound(parsedSound.name, null, scene));\r\n }\r\n }\r\n }\r\n\r\n loadedSounds = [];\r\n});\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * The list of sounds used in the scene.\r\n */\r\n sounds: Nullable<Array<Sound>>;\r\n }\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /**\r\n * @hidden\r\n * Backing field\r\n */\r\n _mainSoundTrack: SoundTrack;\r\n /**\r\n * The main sound track played by the scene.\r\n * It contains your primary collection of sounds.\r\n */\r\n mainSoundTrack: SoundTrack;\r\n /**\r\n * The list of sound tracks added to the scene\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\n soundTracks: Nullable<Array<SoundTrack>>;\r\n\r\n /**\r\n * Gets a sound using a given name\r\n * @param name defines the name to search for\r\n * @returns the found sound or null if not found at all.\r\n */\r\n getSoundByName(name: string): Nullable<Sound>;\r\n\r\n /**\r\n * Gets or sets if audio support is enabled\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\n audioEnabled: boolean;\r\n\r\n /**\r\n * Gets or sets if audio will be output to headphones\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\n headphone: boolean;\r\n\r\n /**\r\n * Gets or sets custom audio listener position provider\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\n audioListenerPositionProvider: Nullable<() => Vector3>;\r\n\r\n /**\r\n * Gets or sets a refresh rate when using 3D audio positioning\r\n */\r\n audioPositioningRefreshRate: number;\r\n }\r\n}\r\n\r\nObject.defineProperty(Scene.prototype, \"mainSoundTrack\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n if (!this._mainSoundTrack) {\r\n this._mainSoundTrack = new SoundTrack(this, { mainTrack: true });\r\n }\r\n\r\n return this._mainSoundTrack;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nScene.prototype.getSoundByName = function (name: string): Nullable<Sound> {\r\n let index: number;\r\n for (index = 0; index < this.mainSoundTrack.soundCollection.length; index++) {\r\n if (this.mainSoundTrack.soundCollection[index].name === name) {\r\n return this.mainSoundTrack.soundCollection[index];\r\n }\r\n }\r\n\r\n if (this.soundTracks) {\r\n for (let sdIndex = 0; sdIndex < this.soundTracks.length; sdIndex++) {\r\n for (index = 0; index < this.soundTracks[sdIndex].soundCollection.length; index++) {\r\n if (this.soundTracks[sdIndex].soundCollection[index].name === name) {\r\n return this.soundTracks[sdIndex].soundCollection[index];\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nObject.defineProperty(Scene.prototype, \"audioEnabled\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n return compo.audioEnabled;\r\n },\r\n set: function (this: Scene, value: boolean) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n if (value) {\r\n compo.enableAudio();\r\n } else {\r\n compo.disableAudio();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(Scene.prototype, \"headphone\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n return compo.headphone;\r\n },\r\n set: function (this: Scene, value: boolean) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n if (value) {\r\n compo.switchAudioModeForHeadphones();\r\n } else {\r\n compo.switchAudioModeForNormalSpeakers();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(Scene.prototype, \"audioListenerPositionProvider\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n return compo.audioListenerPositionProvider;\r\n },\r\n set: function (this: Scene, value: () => Vector3) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n if (typeof value !== \"function\") {\r\n throw new Error(\"The value passed to [Scene.audioListenerPositionProvider] must be a function that returns a Vector3\");\r\n } else {\r\n compo.audioListenerPositionProvider = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(Scene.prototype, \"audioPositioningRefreshRate\", {\r\n get: function (this: Scene) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n return compo.audioPositioningRefreshRate;\r\n },\r\n set: function (this: Scene, value: number) {\r\n let compo = this._getComponent(SceneComponentConstants.NAME_AUDIO) as AudioSceneComponent;\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n\r\n compo.audioPositioningRefreshRate = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Defines the sound scene component responsible to manage any sounds\r\n * in a given scene.\r\n */\r\nexport class AudioSceneComponent implements ISceneSerializableComponent {\r\n private static _CameraDirection = new Vector3(0, 0, -1);\r\n\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_AUDIO;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n private _audioEnabled = true;\r\n /**\r\n * Gets whether audio is enabled or not.\r\n * Please use related enable/disable method to switch state.\r\n */\r\n public get audioEnabled(): boolean {\r\n return this._audioEnabled;\r\n }\r\n\r\n private _headphone = false;\r\n /**\r\n * Gets whether audio is outputting to headphone or not.\r\n * Please use the according Switch methods to change output.\r\n */\r\n public get headphone(): boolean {\r\n return this._headphone;\r\n }\r\n\r\n /**\r\n * Gets or sets a refresh rate when using 3D audio positioning\r\n */\r\n public audioPositioningRefreshRate = 500;\r\n\r\n private _audioListenerPositionProvider: Nullable<() => Vector3> = null;\r\n /**\r\n * Gets the current audio listener position provider\r\n */\r\n public get audioListenerPositionProvider(): Nullable<() => Vector3> {\r\n return this._audioListenerPositionProvider;\r\n }\r\n /**\r\n * Sets a custom listener position for all sounds in the scene\r\n * By default, this is the position of the first active camera\r\n */\r\n public set audioListenerPositionProvider(value: Nullable<() => Vector3>) {\r\n this._audioListenerPositionProvider = value;\r\n }\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene?: Nullable<Scene>) {\r\n scene = scene || EngineStore.LastCreatedScene;\r\n if (!scene) {\r\n return;\r\n }\r\n this.scene = scene;\r\n\r\n scene.soundTracks = new Array<SoundTrack>();\r\n scene.sounds = new Array<Sound>();\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._afterRenderStage.registerStep(SceneComponentConstants.STEP_AFTERRENDER_AUDIO, this, this._afterRender);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n // Nothing to do here. (Not rendering related)\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n serializationObject.sounds = [];\r\n\r\n if (this.scene.soundTracks) {\r\n for (let index = 0; index < this.scene.soundTracks.length; index++) {\r\n const soundtrack = this.scene.soundTracks[index];\r\n\r\n for (let soundId = 0; soundId < soundtrack.soundCollection.length; soundId++) {\r\n serializationObject.sounds.push(soundtrack.soundCollection[soundId].serialize());\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n public addFromContainer(container: AbstractScene): void {\r\n if (!container.sounds) {\r\n return;\r\n }\r\n container.sounds.forEach((sound) => {\r\n sound.play();\r\n sound.autoplay = true;\r\n this.scene.mainSoundTrack.addSound(sound);\r\n });\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n public removeFromContainer(container: AbstractScene, dispose = false): void {\r\n if (!container.sounds) {\r\n return;\r\n }\r\n container.sounds.forEach((sound) => {\r\n sound.stop();\r\n sound.autoplay = false;\r\n this.scene.mainSoundTrack.removeSound(sound);\r\n if (dispose) {\r\n sound.dispose();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n const scene = this.scene;\r\n if (scene._mainSoundTrack) {\r\n scene.mainSoundTrack.dispose();\r\n }\r\n\r\n if (scene.soundTracks) {\r\n for (let scIndex = 0; scIndex < scene.soundTracks.length; scIndex++) {\r\n scene.soundTracks[scIndex].dispose();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Disables audio in the associated scene.\r\n */\r\n public disableAudio() {\r\n const scene = this.scene;\r\n this._audioEnabled = false;\r\n\r\n if (Engine.audioEngine && Engine.audioEngine.audioContext) {\r\n Engine.audioEngine.audioContext.suspend();\r\n }\r\n\r\n let i: number;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n scene.mainSoundTrack.soundCollection[i].pause();\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (let j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n scene.soundTracks[i].soundCollection[j].pause();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enables audio in the associated scene.\r\n */\r\n public enableAudio() {\r\n const scene = this.scene;\r\n this._audioEnabled = true;\r\n\r\n if (Engine.audioEngine && Engine.audioEngine.audioContext) {\r\n Engine.audioEngine.audioContext.resume();\r\n }\r\n\r\n let i: number;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n if (scene.mainSoundTrack.soundCollection[i].isPaused) {\r\n scene.mainSoundTrack.soundCollection[i].play();\r\n }\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (let j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n if (scene.soundTracks[i].soundCollection[j].isPaused) {\r\n scene.soundTracks[i].soundCollection[j].play();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Switch audio to headphone output.\r\n */\r\n public switchAudioModeForHeadphones() {\r\n const scene = this.scene;\r\n this._headphone = true;\r\n\r\n scene.mainSoundTrack.switchPanningModelToHRTF();\r\n if (scene.soundTracks) {\r\n for (let i = 0; i < scene.soundTracks.length; i++) {\r\n scene.soundTracks[i].switchPanningModelToHRTF();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Switch audio to normal speakers.\r\n */\r\n public switchAudioModeForNormalSpeakers() {\r\n const scene = this.scene;\r\n this._headphone = false;\r\n\r\n scene.mainSoundTrack.switchPanningModelToEqualPower();\r\n\r\n if (scene.soundTracks) {\r\n for (let i = 0; i < scene.soundTracks.length; i++) {\r\n scene.soundTracks[i].switchPanningModelToEqualPower();\r\n }\r\n }\r\n }\r\n\r\n private _cachedCameraDirection = new Vector3();\r\n private _cachedCameraPosition = new Vector3();\r\n private _lastCheck = 0;\r\n private _invertMatrixTemp = new Matrix();\r\n private _cameraDirectionTemp = new Vector3();\r\n\r\n private _afterRender() {\r\n const now = PrecisionDate.Now;\r\n if (this._lastCheck && now - this._lastCheck < this.audioPositioningRefreshRate) {\r\n return;\r\n }\r\n\r\n this._lastCheck = now;\r\n\r\n const scene = this.scene;\r\n if (!this._audioEnabled || !scene._mainSoundTrack || !scene.soundTracks || (scene._mainSoundTrack.soundCollection.length === 0 && scene.soundTracks.length === 1)) {\r\n return;\r\n }\r\n\r\n const audioEngine = Engine.audioEngine;\r\n\r\n if (!audioEngine) {\r\n return;\r\n }\r\n\r\n if (audioEngine.audioContext) {\r\n // A custom listener position provider was set\r\n // Use the users provided position instead of camera's\r\n if (this._audioListenerPositionProvider) {\r\n const position: Vector3 = this._audioListenerPositionProvider();\r\n // Make sure all coordinates were provided\r\n position.x = position.x || 0;\r\n position.y = position.y || 0;\r\n position.z = position.z || 0;\r\n // Set the listener position\r\n audioEngine.audioContext.listener.setPosition(position.x, position.y, position.z);\r\n } else {\r\n let listeningCamera: Nullable<Camera>;\r\n\r\n if (scene.activeCameras && scene.activeCameras.length > 0) {\r\n listeningCamera = scene.activeCameras[0];\r\n } else {\r\n listeningCamera = scene.activeCamera;\r\n }\r\n\r\n // Check if there is a listening camera\r\n if (listeningCamera) {\r\n // Set the listener position to the listening camera global position\r\n if (!this._cachedCameraPosition.equals(listeningCamera.globalPosition)) {\r\n this._cachedCameraPosition.copyFrom(listeningCamera.globalPosition);\r\n audioEngine.audioContext.listener.setPosition(listeningCamera.globalPosition.x, listeningCamera.globalPosition.y, listeningCamera.globalPosition.z);\r\n }\r\n\r\n // for VR cameras\r\n if (listeningCamera.rigCameras && listeningCamera.rigCameras.length > 0) {\r\n listeningCamera = listeningCamera.rigCameras[0];\r\n }\r\n listeningCamera.getViewMatrix().invertToRef(this._invertMatrixTemp);\r\n Vector3.TransformNormalToRef(AudioSceneComponent._CameraDirection, this._invertMatrixTemp, this._cameraDirectionTemp);\r\n this._cameraDirectionTemp.normalize();\r\n // To avoid some errors on GearVR\r\n if (!isNaN(this._cameraDirectionTemp.x) && !isNaN(this._cameraDirectionTemp.y) && !isNaN(this._cameraDirectionTemp.z)) {\r\n if (!this._cachedCameraDirection.equals(this._cameraDirectionTemp)) {\r\n this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp);\r\n audioEngine.audioContext.listener.setOrientation(this._cameraDirectionTemp.x, this._cameraDirectionTemp.y, this._cameraDirectionTemp.z, 0, 1, 0);\r\n }\r\n }\r\n }\r\n // Otherwise set the listener position to 0, 0 ,0\r\n else {\r\n // Set the listener position\r\n audioEngine.audioContext.listener.setPosition(0, 0, 0);\r\n }\r\n }\r\n\r\n let i: number;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n const sound = scene.mainSoundTrack.soundCollection[i];\r\n if (sound.useCustomAttenuation) {\r\n sound.updateDistanceFromListener();\r\n }\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (let j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n const sound = scene.soundTracks[i].soundCollection[j];\r\n if (sound.useCustomAttenuation) {\r\n sound.updateDistanceFromListener();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nSound._SceneComponentInitialization = (scene: Scene) => {\r\n let compo = scene._getComponent(SceneComponentConstants.NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(scene);\r\n scene._addComponent(compo);\r\n }\r\n};\r\n"]}
|
|
@@ -83,7 +83,7 @@ export declare class AutoRotationBehavior implements Behavior<ArcRotateCamera> {
|
|
|
83
83
|
private _reachTargetAlpha;
|
|
84
84
|
/**
|
|
85
85
|
* Returns true if user is scrolling.
|
|
86
|
-
* @
|
|
86
|
+
* @returns true if user is scrolling.
|
|
87
87
|
*/
|
|
88
88
|
private _userIsZooming;
|
|
89
89
|
private _lastFrameRadius;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoRotationBehavior.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Behaviors/Cameras/autoRotationBehavior.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAAjC;QAQY,wBAAmB,GAAG,KAAK,CAAC;QAC5B,uBAAkB,GAAG,IAAI,CAAC;QAC1B,0BAAqB,GAAG,IAAI,CAAC;QAC7B,4BAAuB,GAAG,IAAI,CAAC;QAEhC,gBAAW,GAAqB,IAAI,CAAC;QAqEpC,mBAAc,GAAG,KAAK,CAAC;QACvB,mBAAc,GAAqB,IAAI,CAAC;QACxC,yBAAoB,GAAG,CAAC,QAAQ,CAAC;QACjC,yBAAoB,GAAW,CAAC,C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C;SAC1B;QAED,gGAAgG;QAChG,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;QACpD,OAAO,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;IAC9E,CAAC;IAED;;OAEG;IACK,qBAAqB;QACzB,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,kCAAkC,EAAE,EAAE;YACpE,IAAI,CAAC,oBAAoB,GAAG,aAAa,CAAC,GAAG,CAAC;SACjD;IACL,CAAC;IAED,QAAQ;IACA,aAAa;QACjB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACvB,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,CACH,IAAI,CAAC,eAAe,CAAC,mBAAmB,KAAK,CAAC;YAC9C,IAAI,CAAC,eAAe,CAAC,kBAAkB,KAAK,CAAC;YAC7C,IAAI,CAAC,eAAe,CAAC,oBAAoB,KAAK,CAAC;YAC/C,IAAI,CAAC,eAAe,CAAC,gBAAgB,KAAK,CAAC;YAC3C,IAAI,CAAC,eAAe,CAAC,gBAAgB,KAAK,CAAC;YAC3C,IAAI,CAAC,cAAc,CACtB,CAAC;IACN,CAAC;CACJ","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport type { PointerInfoPre } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\n\r\n/**\r\n * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\nexport class AutoRotationBehavior implements Behavior<ArcRotateCamera> {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n public get name(): string {\r\n return \"AutoRotation\";\r\n }\r\n\r\n private _zoomStopsAnimation = false;\r\n private _idleRotationSpeed = 0.05;\r\n private _idleRotationWaitTime = 2000;\r\n private _idleRotationSpinupTime = 2000;\r\n\r\n public targetAlpha: Nullable<number> = null;\r\n\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n public set zoomStopsAnimation(flag: boolean) {\r\n this._zoomStopsAnimation = flag;\r\n }\r\n\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n public get zoomStopsAnimation(): boolean {\r\n return this._zoomStopsAnimation;\r\n }\r\n\r\n /**\r\n * Sets the default speed at which the camera rotates around the model.\r\n */\r\n public set idleRotationSpeed(speed: number) {\r\n this._idleRotationSpeed = speed;\r\n }\r\n\r\n /**\r\n * Gets the default speed at which the camera rotates around the model.\r\n */\r\n public get idleRotationSpeed() {\r\n return this._idleRotationSpeed;\r\n }\r\n\r\n /**\r\n * Sets the time (in milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n public set idleRotationWaitTime(time: number) {\r\n this._idleRotationWaitTime = time;\r\n }\r\n\r\n /**\r\n * Gets the time (milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n public get idleRotationWaitTime() {\r\n return this._idleRotationWaitTime;\r\n }\r\n\r\n /**\r\n * Sets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n public set idleRotationSpinupTime(time: number) {\r\n this._idleRotationSpinupTime = time;\r\n }\r\n\r\n /**\r\n * Gets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n public get idleRotationSpinupTime() {\r\n return this._idleRotationSpinupTime;\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the camera is currently rotating because of this behavior\r\n */\r\n public get rotationInProgress(): boolean {\r\n return Math.abs(this._cameraRotationSpeed) > 0;\r\n }\r\n\r\n // Default behavior functions\r\n private _onPrePointerObservableObserver: Nullable<Observer<PointerInfoPre>>;\r\n private _onAfterCheckInputsObserver: Nullable<Observer<Camera>>;\r\n private _attachedCamera: Nullable<ArcRotateCamera>;\r\n private _isPointerDown = false;\r\n private _lastFrameTime: Nullable<number> = null;\r\n private _lastInteractionTime = -Infinity;\r\n private _cameraRotationSpeed: number = 0;\r\n\r\n /**\r\n * Initializes the behavior.\r\n */\r\n public init(): void {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n public attach(camera: ArcRotateCamera): void {\r\n this._attachedCamera = camera;\r\n const scene = this._attachedCamera.getScene();\r\n\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add((pointerInfoPre) => {\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERDOWN) {\r\n this._isPointerDown = true;\r\n return;\r\n }\r\n\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERUP) {\r\n this._isPointerDown = false;\r\n }\r\n });\r\n\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\r\n if (this._reachTargetAlpha()) {\r\n return;\r\n }\r\n const now = PrecisionDate.Now;\r\n let dt = 0;\r\n if (this._lastFrameTime != null) {\r\n dt = now - this._lastFrameTime;\r\n }\r\n this._lastFrameTime = now;\r\n\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n this._applyUserInteraction();\r\n\r\n const timeToRotation = now - this._lastInteractionTime - this._idleRotationWaitTime;\r\n const scale = Math.max(Math.min(timeToRotation / this._idleRotationSpinupTime, 1), 0);\r\n this._cameraRotationSpeed = this._idleRotationSpeed * scale;\r\n\r\n // Step camera rotation by rotation speed\r\n if (this._attachedCamera) {\r\n this._attachedCamera.alpha -= this._cameraRotationSpeed * (dt / 1000);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n public detach(): void {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n const scene = this._attachedCamera.getScene();\r\n\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n this._attachedCamera = null;\r\n }\r\n\r\n /**\r\n * Force-reset the last interaction time\r\n * @param customTime an optional time that will be used instead of the current last interaction time. For example `Date.now()`\r\n */\r\n public resetLastInteractionTime(customTime?: number): void {\r\n this._lastInteractionTime = customTime ?? PrecisionDate.Now;\r\n }\r\n\r\n /**\r\n * Returns true if camera alpha reaches the target alpha\r\n * @returns true if camera alpha reaches the target alpha\r\n */\r\n private _reachTargetAlpha(): boolean {\r\n if (this._attachedCamera && this.targetAlpha) {\r\n return Math.abs(this._attachedCamera.alpha - this.targetAlpha) < Epsilon;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns true if user is scrolling.\r\n * @return true if user is scrolling.\r\n */\r\n private _userIsZooming(): boolean {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialRadiusOffset !== 0;\r\n }\r\n\r\n private _lastFrameRadius = 0;\r\n private _shouldAnimationStopForInteraction(): boolean {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n\r\n let zoomHasHitLimit = false;\r\n if (this._lastFrameRadius === this._attachedCamera.radius && this._attachedCamera.inertialRadiusOffset !== 0) {\r\n zoomHasHitLimit = true;\r\n }\r\n\r\n // Update the record of previous radius - works as an approx. indicator of hitting radius limits\r\n this._lastFrameRadius = this._attachedCamera.radius;\r\n return this._zoomStopsAnimation ? zoomHasHitLimit : this._userIsZooming();\r\n }\r\n\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n private _applyUserInteraction(): void {\r\n if (this._userIsMoving() && !this._shouldAnimationStopForInteraction()) {\r\n this._lastInteractionTime = PrecisionDate.Now;\r\n }\r\n }\r\n\r\n // Tools\r\n private _userIsMoving(): boolean {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n\r\n return (\r\n this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown\r\n );\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"autoRotationBehavior.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Behaviors/Cameras/autoRotationBehavior.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAAjC;QAQY,wBAAmB,GAAG,KAAK,CAAC;QAC5B,uBAAkB,GAAG,IAAI,CAAC;QAC1B,0BAAqB,GAAG,IAAI,CAAC;QAC7B,4BAAuB,GAAG,IAAI,CAAC;QAEhC,gBAAW,GAAqB,IAAI,CAAC;QAqEpC,mBAAc,GAAG,KAAK,CAAC;QACvB,mBAAc,GAAqB,IAAI,CAAC;QACxC,yBAAoB,GAAG,CAAC,QAAQ,CAAC;QACjC,yBAAoB,GAAW,CAAC,CAAC;QAoGjC,qBAAgB,GAAG,CAAC,CAAC;IAwCjC,CAAC;IAhOG;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,cAAc,CAAC;IAC1B,CAAC;IASD;;OAEG;IACH,IAAW,kBAAkB,CAAC,IAAa;QACvC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,mBAAmB,C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I,CAAC,kCAAkC,EAAE,EAAE;YACpE,IAAI,CAAC,oBAAoB,GAAG,aAAa,CAAC,GAAG,CAAC;SACjD;IACL,CAAC;IAED,QAAQ;IACA,aAAa;QACjB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACvB,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,CACH,IAAI,CAAC,eAAe,CAAC,mBAAmB,KAAK,CAAC;YAC9C,IAAI,CAAC,eAAe,CAAC,kBAAkB,KAAK,CAAC;YAC7C,IAAI,CAAC,eAAe,CAAC,oBAAoB,KAAK,CAAC;YAC/C,IAAI,CAAC,eAAe,CAAC,gBAAgB,KAAK,CAAC;YAC3C,IAAI,CAAC,eAAe,CAAC,gBAAgB,KAAK,CAAC;YAC3C,IAAI,CAAC,cAAc,CACtB,CAAC;IACN,CAAC;CACJ","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport type { PointerInfoPre } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\n\r\n/**\r\n * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\nexport class AutoRotationBehavior implements Behavior<ArcRotateCamera> {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n public get name(): string {\r\n return \"AutoRotation\";\r\n }\r\n\r\n private _zoomStopsAnimation = false;\r\n private _idleRotationSpeed = 0.05;\r\n private _idleRotationWaitTime = 2000;\r\n private _idleRotationSpinupTime = 2000;\r\n\r\n public targetAlpha: Nullable<number> = null;\r\n\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n public set zoomStopsAnimation(flag: boolean) {\r\n this._zoomStopsAnimation = flag;\r\n }\r\n\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n public get zoomStopsAnimation(): boolean {\r\n return this._zoomStopsAnimation;\r\n }\r\n\r\n /**\r\n * Sets the default speed at which the camera rotates around the model.\r\n */\r\n public set idleRotationSpeed(speed: number) {\r\n this._idleRotationSpeed = speed;\r\n }\r\n\r\n /**\r\n * Gets the default speed at which the camera rotates around the model.\r\n */\r\n public get idleRotationSpeed() {\r\n return this._idleRotationSpeed;\r\n }\r\n\r\n /**\r\n * Sets the time (in milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n public set idleRotationWaitTime(time: number) {\r\n this._idleRotationWaitTime = time;\r\n }\r\n\r\n /**\r\n * Gets the time (milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n public get idleRotationWaitTime() {\r\n return this._idleRotationWaitTime;\r\n }\r\n\r\n /**\r\n * Sets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n public set idleRotationSpinupTime(time: number) {\r\n this._idleRotationSpinupTime = time;\r\n }\r\n\r\n /**\r\n * Gets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n public get idleRotationSpinupTime() {\r\n return this._idleRotationSpinupTime;\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the camera is currently rotating because of this behavior\r\n */\r\n public get rotationInProgress(): boolean {\r\n return Math.abs(this._cameraRotationSpeed) > 0;\r\n }\r\n\r\n // Default behavior functions\r\n private _onPrePointerObservableObserver: Nullable<Observer<PointerInfoPre>>;\r\n private _onAfterCheckInputsObserver: Nullable<Observer<Camera>>;\r\n private _attachedCamera: Nullable<ArcRotateCamera>;\r\n private _isPointerDown = false;\r\n private _lastFrameTime: Nullable<number> = null;\r\n private _lastInteractionTime = -Infinity;\r\n private _cameraRotationSpeed: number = 0;\r\n\r\n /**\r\n * Initializes the behavior.\r\n */\r\n public init(): void {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n public attach(camera: ArcRotateCamera): void {\r\n this._attachedCamera = camera;\r\n const scene = this._attachedCamera.getScene();\r\n\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add((pointerInfoPre) => {\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERDOWN) {\r\n this._isPointerDown = true;\r\n return;\r\n }\r\n\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERUP) {\r\n this._isPointerDown = false;\r\n }\r\n });\r\n\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\r\n if (this._reachTargetAlpha()) {\r\n return;\r\n }\r\n const now = PrecisionDate.Now;\r\n let dt = 0;\r\n if (this._lastFrameTime != null) {\r\n dt = now - this._lastFrameTime;\r\n }\r\n this._lastFrameTime = now;\r\n\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n this._applyUserInteraction();\r\n\r\n const timeToRotation = now - this._lastInteractionTime - this._idleRotationWaitTime;\r\n const scale = Math.max(Math.min(timeToRotation / this._idleRotationSpinupTime, 1), 0);\r\n this._cameraRotationSpeed = this._idleRotationSpeed * scale;\r\n\r\n // Step camera rotation by rotation speed\r\n if (this._attachedCamera) {\r\n this._attachedCamera.alpha -= this._cameraRotationSpeed * (dt / 1000);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n public detach(): void {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n const scene = this._attachedCamera.getScene();\r\n\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n this._attachedCamera = null;\r\n }\r\n\r\n /**\r\n * Force-reset the last interaction time\r\n * @param customTime an optional time that will be used instead of the current last interaction time. For example `Date.now()`\r\n */\r\n public resetLastInteractionTime(customTime?: number): void {\r\n this._lastInteractionTime = customTime ?? PrecisionDate.Now;\r\n }\r\n\r\n /**\r\n * Returns true if camera alpha reaches the target alpha\r\n * @returns true if camera alpha reaches the target alpha\r\n */\r\n private _reachTargetAlpha(): boolean {\r\n if (this._attachedCamera && this.targetAlpha) {\r\n return Math.abs(this._attachedCamera.alpha - this.targetAlpha) < Epsilon;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns true if user is scrolling.\r\n * @returns true if user is scrolling.\r\n */\r\n private _userIsZooming(): boolean {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialRadiusOffset !== 0;\r\n }\r\n\r\n private _lastFrameRadius = 0;\r\n private _shouldAnimationStopForInteraction(): boolean {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n\r\n let zoomHasHitLimit = false;\r\n if (this._lastFrameRadius === this._attachedCamera.radius && this._attachedCamera.inertialRadiusOffset !== 0) {\r\n zoomHasHitLimit = true;\r\n }\r\n\r\n // Update the record of previous radius - works as an approx. indicator of hitting radius limits\r\n this._lastFrameRadius = this._attachedCamera.radius;\r\n return this._zoomStopsAnimation ? zoomHasHitLimit : this._userIsZooming();\r\n }\r\n\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n private _applyUserInteraction(): void {\r\n if (this._userIsMoving() && !this._shouldAnimationStopForInteraction()) {\r\n this._lastInteractionTime = PrecisionDate.Now;\r\n }\r\n }\r\n\r\n // Tools\r\n private _userIsMoving(): boolean {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n\r\n return (\r\n this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -63,7 +63,7 @@ export declare class BouncingBehavior implements Behavior<ArcRotateCamera> {
|
|
|
63
63
|
/**
|
|
64
64
|
* Checks if the camera radius is at the specified limit. Takes into account animation locks.
|
|
65
65
|
* @param radiusLimit The limit to check against.
|
|
66
|
-
* @
|
|
66
|
+
* @returns Bool to indicate if at limit.
|
|
67
67
|
*/
|
|
68
68
|
private _isRadiusAtLimit;
|
|
69
69
|
/**
|
|
@@ -108,7 +108,7 @@ export class BouncingBehavior {
|
|
|
108
108
|
/**
|
|
109
109
|
* Checks if the camera radius is at the specified limit. Takes into account animation locks.
|
|
110
110
|
* @param radiusLimit The limit to check against.
|
|
111
|
-
* @
|
|
111
|
+
* @returns Bool to indicate if at limit.
|
|
112
112
|
*/
|
|
113
113
|
_isRadiusAtLimit(radiusLimit) {
|
|
114
114
|
if (!this._attachedCamera) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bouncingBehavior.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Behaviors/Cameras/bouncingBehavior.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QAkBI;;WAEG;QACI,uBAAkB,GAAG,GAAG,CAAC;QAEhC;;WAEG;QACI,+BAA0B,GAAG,CAAC,CAAC;QAEtC;;WAEG;QACI,+BAA0B,GAAG,CAAC,CAAC,CAAC;QAE/B,yBAAoB,GAAG,KAAK,CAAC;QA6FrC,aAAa;QACL,uBAAkB,GAAY,KAAK,CAAC;QACpC,4BAAuB,GAAwB,IAAI,CAAC;QACpD,iBAAY,GAAG,IAAI,KAAK,EAAc,CAAC;IAgFnD,CAAC;IAhNG;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,UA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,CAAC,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3C,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;SAC7B;IACL,CAAC;;AAxMD;;GAEG;AACW,+BAAc,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;AAEjD;;GAEG;AACW,2BAAU,GAAG,cAAc,CAAC,kBAAkB,CAAC","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport { BackEase, EasingFunction } from \"../../Animations/easing\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Animatable } from \"../../Animations/animatable\";\r\nimport { Animation } from \"../../Animations/animation\";\r\n\r\n/**\r\n * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\nexport class BouncingBehavior implements Behavior<ArcRotateCamera> {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n public get name(): string {\r\n return \"Bouncing\";\r\n }\r\n\r\n /**\r\n * The easing function used by animations\r\n */\r\n public static EasingFunction = new BackEase(0.3);\r\n\r\n /**\r\n * The easing mode used by animations\r\n */\r\n public static EasingMode = EasingFunction.EASINGMODE_EASEOUT;\r\n\r\n /**\r\n * The duration of the animation, in milliseconds\r\n */\r\n public transitionDuration = 450;\r\n\r\n /**\r\n * Length of the distance animated by the transition when lower radius is reached\r\n */\r\n public lowerRadiusTransitionRange = 2;\r\n\r\n /**\r\n * Length of the distance animated by the transition when upper radius is reached\r\n */\r\n public upperRadiusTransitionRange = -2;\r\n\r\n private _autoTransitionRange = false;\r\n\r\n /**\r\n * Gets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n */\r\n public get autoTransitionRange(): boolean {\r\n return this._autoTransitionRange;\r\n }\r\n\r\n /**\r\n * Sets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n * Transition ranges will be set to 5% of the bounding box diagonal in world space\r\n */\r\n public set autoTransitionRange(value: boolean) {\r\n if (this._autoTransitionRange === value) {\r\n return;\r\n }\r\n\r\n this._autoTransitionRange = value;\r\n\r\n const camera = this._attachedCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n\r\n if (value) {\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add((mesh) => {\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n mesh.computeWorldMatrix(true);\r\n const diagonal = mesh.getBoundingInfo().diagonalLength;\r\n\r\n this.lowerRadiusTransitionRange = diagonal * 0.05;\r\n this.upperRadiusTransitionRange = diagonal * 0.05;\r\n });\r\n } else if (this._onMeshTargetChangedObserver) {\r\n camera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n }\r\n\r\n // Connection\r\n private _attachedCamera: Nullable<ArcRotateCamera>;\r\n private _onAfterCheckInputsObserver: Nullable<Observer<Camera>>;\r\n private _onMeshTargetChangedObserver: Nullable<Observer<Nullable<AbstractMesh>>>;\r\n\r\n /**\r\n * Initializes the behavior.\r\n */\r\n public init(): void {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n public attach(camera: ArcRotateCamera): void {\r\n this._attachedCamera = camera;\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n\r\n // Add the bounce animation to the lower radius limit\r\n if (this._isRadiusAtLimit(this._attachedCamera.lowerRadiusLimit)) {\r\n this._applyBoundRadiusAnimation(this.lowerRadiusTransitionRange);\r\n }\r\n\r\n // Add the bounce animation to the upper radius limit\r\n if (this._isRadiusAtLimit(this._attachedCamera.upperRadiusLimit)) {\r\n this._applyBoundRadiusAnimation(this.upperRadiusTransitionRange);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n public detach(): void {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n }\r\n\r\n // Animations\r\n private _radiusIsAnimating: boolean = false;\r\n private _radiusBounceTransition: Nullable<Animation> = null;\r\n private _animatables = new Array<Animatable>();\r\n private _cachedWheelPrecision: number;\r\n\r\n /**\r\n * Checks if the camera radius is at the specified limit. Takes into account animation locks.\r\n * @param radiusLimit The limit to check against.\r\n * @return Bool to indicate if at limit.\r\n */\r\n private _isRadiusAtLimit(radiusLimit: Nullable<number>): boolean {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n\r\n if (this._attachedCamera.radius === radiusLimit && !this._radiusIsAnimating) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Applies an animation to the radius of the camera, extending by the radiusDelta.\r\n * @param radiusDelta The delta by which to animate to. Can be negative.\r\n */\r\n private _applyBoundRadiusAnimation(radiusDelta: number): void {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n\r\n if (!this._radiusBounceTransition) {\r\n BouncingBehavior.EasingFunction.setEasingMode(BouncingBehavior.EasingMode);\r\n this._radiusBounceTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, BouncingBehavior.EasingFunction);\r\n }\r\n // Prevent zoom until bounce has completed\r\n this._cachedWheelPrecision = this._attachedCamera.wheelPrecision;\r\n this._attachedCamera.wheelPrecision = Infinity;\r\n this._attachedCamera.inertialRadiusOffset = 0;\r\n\r\n // Animate to the radius limit\r\n this.stopAllAnimations();\r\n this._radiusIsAnimating = true;\r\n const animatable = Animation.TransitionTo(\r\n \"radius\",\r\n this._attachedCamera.radius + radiusDelta,\r\n this._attachedCamera,\r\n this._attachedCamera.getScene(),\r\n 60,\r\n this._radiusBounceTransition,\r\n this.transitionDuration,\r\n () => this._clearAnimationLocks()\r\n );\r\n\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n }\r\n\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the camera properties.\r\n */\r\n protected _clearAnimationLocks(): void {\r\n this._radiusIsAnimating = false;\r\n\r\n if (this._attachedCamera) {\r\n this._attachedCamera.wheelPrecision = this._cachedWheelPrecision;\r\n }\r\n }\r\n\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n public stopAllAnimations(): void {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n this._animatables.shift();\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"bouncingBehavior.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Behaviors/Cameras/bouncingBehavior.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QAkBI;;WAEG;QACI,uBAAkB,GAAG,GAAG,CAAC;QAEhC;;WAEG;QACI,+BAA0B,GAAG,CAAC,CAAC;QAEtC;;WAEG;QACI,+BAA0B,GAAG,CAAC,CAAC,CAAC;QAE/B,yBAAoB,GAAG,KAAK,CAAC;QA6FrC,aAAa;QACL,uBAAkB,GAAY,KAAK,CAA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;YACtB,IAAI,CAAC,eAAe,CAAC,UAAU,GAAG,EAAE,CAAC;SACxC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC7B,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3C,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;SAC7B;IACL,CAAC;;AAxMD;;GAEG;AACW,+BAAc,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;AAEjD;;GAEG;AACW,2BAAU,GAAG,cAAc,CAAC,kBAAkB,CAAC","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport { BackEase, EasingFunction } from \"../../Animations/easing\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Animatable } from \"../../Animations/animatable\";\r\nimport { Animation } from \"../../Animations/animation\";\r\n\r\n/**\r\n * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\nexport class BouncingBehavior implements Behavior<ArcRotateCamera> {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n public get name(): string {\r\n return \"Bouncing\";\r\n }\r\n\r\n /**\r\n * The easing function used by animations\r\n */\r\n public static EasingFunction = new BackEase(0.3);\r\n\r\n /**\r\n * The easing mode used by animations\r\n */\r\n public static EasingMode = EasingFunction.EASINGMODE_EASEOUT;\r\n\r\n /**\r\n * The duration of the animation, in milliseconds\r\n */\r\n public transitionDuration = 450;\r\n\r\n /**\r\n * Length of the distance animated by the transition when lower radius is reached\r\n */\r\n public lowerRadiusTransitionRange = 2;\r\n\r\n /**\r\n * Length of the distance animated by the transition when upper radius is reached\r\n */\r\n public upperRadiusTransitionRange = -2;\r\n\r\n private _autoTransitionRange = false;\r\n\r\n /**\r\n * Gets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n */\r\n public get autoTransitionRange(): boolean {\r\n return this._autoTransitionRange;\r\n }\r\n\r\n /**\r\n * Sets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n * Transition ranges will be set to 5% of the bounding box diagonal in world space\r\n */\r\n public set autoTransitionRange(value: boolean) {\r\n if (this._autoTransitionRange === value) {\r\n return;\r\n }\r\n\r\n this._autoTransitionRange = value;\r\n\r\n const camera = this._attachedCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n\r\n if (value) {\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add((mesh) => {\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n mesh.computeWorldMatrix(true);\r\n const diagonal = mesh.getBoundingInfo().diagonalLength;\r\n\r\n this.lowerRadiusTransitionRange = diagonal * 0.05;\r\n this.upperRadiusTransitionRange = diagonal * 0.05;\r\n });\r\n } else if (this._onMeshTargetChangedObserver) {\r\n camera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n }\r\n\r\n // Connection\r\n private _attachedCamera: Nullable<ArcRotateCamera>;\r\n private _onAfterCheckInputsObserver: Nullable<Observer<Camera>>;\r\n private _onMeshTargetChangedObserver: Nullable<Observer<Nullable<AbstractMesh>>>;\r\n\r\n /**\r\n * Initializes the behavior.\r\n */\r\n public init(): void {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n public attach(camera: ArcRotateCamera): void {\r\n this._attachedCamera = camera;\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n\r\n // Add the bounce animation to the lower radius limit\r\n if (this._isRadiusAtLimit(this._attachedCamera.lowerRadiusLimit)) {\r\n this._applyBoundRadiusAnimation(this.lowerRadiusTransitionRange);\r\n }\r\n\r\n // Add the bounce animation to the upper radius limit\r\n if (this._isRadiusAtLimit(this._attachedCamera.upperRadiusLimit)) {\r\n this._applyBoundRadiusAnimation(this.upperRadiusTransitionRange);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n public detach(): void {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n }\r\n\r\n // Animations\r\n private _radiusIsAnimating: boolean = false;\r\n private _radiusBounceTransition: Nullable<Animation> = null;\r\n private _animatables = new Array<Animatable>();\r\n private _cachedWheelPrecision: number;\r\n\r\n /**\r\n * Checks if the camera radius is at the specified limit. Takes into account animation locks.\r\n * @param radiusLimit The limit to check against.\r\n * @returns Bool to indicate if at limit.\r\n */\r\n private _isRadiusAtLimit(radiusLimit: Nullable<number>): boolean {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n\r\n if (this._attachedCamera.radius === radiusLimit && !this._radiusIsAnimating) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Applies an animation to the radius of the camera, extending by the radiusDelta.\r\n * @param radiusDelta The delta by which to animate to. Can be negative.\r\n */\r\n private _applyBoundRadiusAnimation(radiusDelta: number): void {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n\r\n if (!this._radiusBounceTransition) {\r\n BouncingBehavior.EasingFunction.setEasingMode(BouncingBehavior.EasingMode);\r\n this._radiusBounceTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, BouncingBehavior.EasingFunction);\r\n }\r\n // Prevent zoom until bounce has completed\r\n this._cachedWheelPrecision = this._attachedCamera.wheelPrecision;\r\n this._attachedCamera.wheelPrecision = Infinity;\r\n this._attachedCamera.inertialRadiusOffset = 0;\r\n\r\n // Animate to the radius limit\r\n this.stopAllAnimations();\r\n this._radiusIsAnimating = true;\r\n const animatable = Animation.TransitionTo(\r\n \"radius\",\r\n this._attachedCamera.radius + radiusDelta,\r\n this._attachedCamera,\r\n this._attachedCamera.getScene(),\r\n 60,\r\n this._radiusBounceTransition,\r\n this.transitionDuration,\r\n () => this._clearAnimationLocks()\r\n );\r\n\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n }\r\n\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the camera properties.\r\n */\r\n protected _clearAnimationLocks(): void {\r\n this._radiusIsAnimating = false;\r\n\r\n if (this._attachedCamera) {\r\n this._attachedCamera.wheelPrecision = this._cachedWheelPrecision;\r\n }\r\n }\r\n\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n public stopAllAnimations(): void {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n this._animatables.shift();\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -164,7 +164,7 @@ export declare class FramingBehavior implements Behavior<ArcRotateCamera> {
|
|
|
164
164
|
* Calculates the lowest radius for the camera based on the bounding box of the mesh.
|
|
165
165
|
* @param minimumWorld
|
|
166
166
|
* @param maximumWorld
|
|
167
|
-
* @
|
|
167
|
+
* @returns The minimum distance from the primary mesh's center point at which the camera must be kept in order
|
|
168
168
|
* to fully enclose the mesh in the viewing frustum.
|
|
169
169
|
*/
|
|
170
170
|
protected _calculateLowerRadiusFromModelBoundingSphere(minimumWorld: Vector3, maximumWorld: Vector3): number;
|
|
@@ -309,7 +309,7 @@ export class FramingBehavior {
|
|
|
309
309
|
* Calculates the lowest radius for the camera based on the bounding box of the mesh.
|
|
310
310
|
* @param minimumWorld
|
|
311
311
|
* @param maximumWorld
|
|
312
|
-
* @
|
|
312
|
+
* @returns The minimum distance from the primary mesh's center point at which the camera must be kept in order
|
|
313
313
|
* to fully enclose the mesh in the viewing frustum.
|
|
314
314
|
*/
|
|
315
315
|
_calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld) {
|