@babylonjs/core 5.32.0 → 5.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (636) hide show
  1. package/Actions/abstractActionManager.d.ts +1 -1
  2. package/Actions/abstractActionManager.js +1 -1
  3. package/Actions/abstractActionManager.js.map +1 -1
  4. package/Actions/action.d.ts +1 -1
  5. package/Actions/action.js +1 -1
  6. package/Actions/action.js.map +1 -1
  7. package/Actions/actionManager.d.ts +18 -18
  8. package/Actions/actionManager.js +18 -18
  9. package/Actions/actionManager.js.map +1 -1
  10. package/Actions/directActions.d.ts +10 -10
  11. package/Actions/directActions.js +10 -10
  12. package/Actions/directActions.js.map +1 -1
  13. package/Actions/interpolateValueAction.d.ts +1 -1
  14. package/Actions/interpolateValueAction.js +1 -1
  15. package/Actions/interpolateValueAction.js.map +1 -1
  16. package/Animations/animatable.d.ts +2 -2
  17. package/Animations/animatable.js +2 -2
  18. package/Animations/animatable.js.map +1 -1
  19. package/Animations/animationGroup.d.ts +3 -3
  20. package/Animations/animationGroup.js +3 -3
  21. package/Animations/animationGroup.js.map +1 -1
  22. package/Animations/easing.d.ts +14 -14
  23. package/Animations/easing.js +13 -13
  24. package/Animations/easing.js.map +1 -1
  25. package/Audio/Interfaces/IAudioEngine.d.ts +2 -2
  26. package/Audio/Interfaces/IAudioEngine.js.map +1 -1
  27. package/Audio/Interfaces/ISoundOptions.d.ts +3 -3
  28. package/Audio/Interfaces/ISoundOptions.js.map +1 -1
  29. package/Audio/analyser.d.ts +1 -1
  30. package/Audio/analyser.js +1 -1
  31. package/Audio/analyser.js.map +1 -1
  32. package/Audio/audioEngine.d.ts +2 -2
  33. package/Audio/audioEngine.js +2 -2
  34. package/Audio/audioEngine.js.map +1 -1
  35. package/Audio/audioSceneComponent.d.ts +4 -4
  36. package/Audio/audioSceneComponent.js.map +1 -1
  37. package/Audio/sound.d.ts +13 -13
  38. package/Audio/sound.js +13 -13
  39. package/Audio/sound.js.map +1 -1
  40. package/Audio/soundTrack.d.ts +5 -5
  41. package/Audio/soundTrack.js +5 -5
  42. package/Audio/soundTrack.js.map +1 -1
  43. package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +1 -1
  44. package/BakedVertexAnimation/bakedVertexAnimationManager.js +1 -1
  45. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  46. package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
  47. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  48. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  49. package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
  50. package/Behaviors/Cameras/bouncingBehavior.js +1 -1
  51. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  52. package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
  53. package/Behaviors/Cameras/framingBehavior.js +1 -1
  54. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  55. package/Behaviors/Meshes/pointerDragBehavior.d.ts +8 -0
  56. package/Behaviors/Meshes/pointerDragBehavior.js +9 -3
  57. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  58. package/Bones/bone.d.ts +1 -1
  59. package/Bones/bone.js +1 -1
  60. package/Bones/bone.js.map +1 -1
  61. package/Bones/boneIKController.d.ts +1 -1
  62. package/Bones/boneIKController.js +1 -1
  63. package/Bones/boneIKController.js.map +1 -1
  64. package/Bones/boneLookController.d.ts +1 -1
  65. package/Bones/boneLookController.js +1 -1
  66. package/Bones/boneLookController.js.map +1 -1
  67. package/Bones/skeleton.d.ts +3 -3
  68. package/Bones/skeleton.js +2 -2
  69. package/Bones/skeleton.js.map +1 -1
  70. package/Cameras/Inputs/BaseCameraMouseWheelInput.js +2 -2
  71. package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
  72. package/Cameras/Inputs/BaseCameraPointersInput.js +2 -2
  73. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  74. package/Cameras/Inputs/arcRotateCameraGamepadInput.d.ts +1 -1
  75. package/Cameras/Inputs/arcRotateCameraGamepadInput.js +1 -1
  76. package/Cameras/Inputs/arcRotateCameraGamepadInput.js.map +1 -1
  77. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +1 -1
  78. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +1 -1
  79. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
  80. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.d.ts +1 -1
  81. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +3 -3
  82. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  83. package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +1 -1
  84. package/Cameras/Inputs/arcRotateCameraPointersInput.js +1 -1
  85. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  86. package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.d.ts +1 -1
  87. package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js +1 -1
  88. package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js.map +1 -1
  89. package/Cameras/Inputs/flyCameraKeyboardInput.d.ts +1 -1
  90. package/Cameras/Inputs/flyCameraKeyboardInput.js +1 -1
  91. package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
  92. package/Cameras/Inputs/flyCameraMouseInput.d.ts +2 -2
  93. package/Cameras/Inputs/flyCameraMouseInput.js +4 -4
  94. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  95. package/Cameras/Inputs/followCameraKeyboardMoveInput.d.ts +1 -1
  96. package/Cameras/Inputs/followCameraKeyboardMoveInput.js +1 -1
  97. package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
  98. package/Cameras/Inputs/followCameraMouseWheelInput.d.ts +1 -1
  99. package/Cameras/Inputs/followCameraMouseWheelInput.js +3 -3
  100. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  101. package/Cameras/Inputs/followCameraPointersInput.d.ts +1 -1
  102. package/Cameras/Inputs/followCameraPointersInput.js +1 -1
  103. package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
  104. package/Cameras/Inputs/freeCameraDeviceOrientationInput.d.ts +2 -2
  105. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +2 -2
  106. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
  107. package/Cameras/Inputs/freeCameraGamepadInput.d.ts +1 -1
  108. package/Cameras/Inputs/freeCameraGamepadInput.js +1 -1
  109. package/Cameras/Inputs/freeCameraGamepadInput.js.map +1 -1
  110. package/Cameras/Inputs/freeCameraKeyboardMoveInput.d.ts +1 -1
  111. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +1 -1
  112. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  113. package/Cameras/Inputs/freeCameraMouseInput.d.ts +3 -2
  114. package/Cameras/Inputs/freeCameraMouseInput.js +10 -7
  115. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  116. package/Cameras/Inputs/freeCameraMouseWheelInput.d.ts +1 -1
  117. package/Cameras/Inputs/freeCameraMouseWheelInput.js +1 -1
  118. package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
  119. package/Cameras/Inputs/freeCameraTouchInput.d.ts +2 -2
  120. package/Cameras/Inputs/freeCameraTouchInput.js +4 -4
  121. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  122. package/Cameras/Inputs/freeCameraVirtualJoystickInput.d.ts +1 -1
  123. package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +1 -1
  124. package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
  125. package/Cameras/Stereoscopic/anaglyphArcRotateCamera.d.ts +1 -1
  126. package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js +1 -1
  127. package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
  128. package/Cameras/Stereoscopic/anaglyphFreeCamera.d.ts +1 -1
  129. package/Cameras/Stereoscopic/anaglyphFreeCamera.js +1 -1
  130. package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
  131. package/Cameras/Stereoscopic/anaglyphGamepadCamera.d.ts +1 -1
  132. package/Cameras/Stereoscopic/anaglyphGamepadCamera.js +1 -1
  133. package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
  134. package/Cameras/Stereoscopic/anaglyphUniversalCamera.d.ts +1 -1
  135. package/Cameras/Stereoscopic/anaglyphUniversalCamera.js +1 -1
  136. package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
  137. package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.d.ts +1 -1
  138. package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js +1 -1
  139. package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
  140. package/Cameras/Stereoscopic/stereoscopicFreeCamera.d.ts +1 -1
  141. package/Cameras/Stereoscopic/stereoscopicFreeCamera.js +1 -1
  142. package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
  143. package/Cameras/Stereoscopic/stereoscopicGamepadCamera.d.ts +1 -1
  144. package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js +1 -1
  145. package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
  146. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.d.ts +1 -1
  147. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +1 -1
  148. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  149. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.d.ts +1 -1
  150. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js +1 -1
  151. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
  152. package/Cameras/VR/vrCameraMetrics.d.ts +1 -1
  153. package/Cameras/VR/vrCameraMetrics.js +1 -1
  154. package/Cameras/VR/vrCameraMetrics.js.map +1 -1
  155. package/Cameras/VR/vrDeviceOrientationArcRotateCamera.d.ts +1 -1
  156. package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js +1 -1
  157. package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
  158. package/Cameras/VR/vrDeviceOrientationFreeCamera.d.ts +1 -1
  159. package/Cameras/VR/vrDeviceOrientationFreeCamera.js +1 -1
  160. package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
  161. package/Cameras/VR/vrDeviceOrientationGamepadCamera.d.ts +1 -1
  162. package/Cameras/VR/vrDeviceOrientationGamepadCamera.js +1 -1
  163. package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
  164. package/Cameras/VR/vrExperienceHelper.d.ts +2 -2
  165. package/Cameras/VR/vrExperienceHelper.js +2 -2
  166. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  167. package/Cameras/VR/webVRCamera.d.ts +2 -2
  168. package/Cameras/VR/webVRCamera.js +2 -2
  169. package/Cameras/VR/webVRCamera.js.map +1 -1
  170. package/Cameras/arcRotateCamera.d.ts +9 -9
  171. package/Cameras/arcRotateCamera.js +9 -9
  172. package/Cameras/arcRotateCamera.js.map +1 -1
  173. package/Cameras/arcRotateCameraInputsManager.d.ts +1 -1
  174. package/Cameras/arcRotateCameraInputsManager.js +1 -1
  175. package/Cameras/arcRotateCameraInputsManager.js.map +1 -1
  176. package/Cameras/camera.d.ts +4 -4
  177. package/Cameras/camera.js +4 -4
  178. package/Cameras/camera.js.map +1 -1
  179. package/Cameras/cameraInputsManager.d.ts +1 -1
  180. package/Cameras/cameraInputsManager.js +1 -1
  181. package/Cameras/cameraInputsManager.js.map +1 -1
  182. package/Cameras/flyCamera.d.ts +1 -1
  183. package/Cameras/flyCamera.js +1 -1
  184. package/Cameras/flyCamera.js.map +1 -1
  185. package/Cameras/flyCameraInputsManager.d.ts +1 -1
  186. package/Cameras/flyCameraInputsManager.js +1 -1
  187. package/Cameras/flyCameraInputsManager.js.map +1 -1
  188. package/Cameras/followCamera.d.ts +4 -4
  189. package/Cameras/followCamera.js +4 -4
  190. package/Cameras/followCamera.js.map +1 -1
  191. package/Cameras/followCameraInputsManager.d.ts +1 -1
  192. package/Cameras/followCameraInputsManager.js +1 -1
  193. package/Cameras/followCameraInputsManager.js.map +1 -1
  194. package/Cameras/freeCamera.d.ts +3 -3
  195. package/Cameras/freeCamera.js +3 -3
  196. package/Cameras/freeCamera.js.map +1 -1
  197. package/Cameras/freeCameraInputsManager.d.ts +1 -1
  198. package/Cameras/freeCameraInputsManager.js +1 -1
  199. package/Cameras/freeCameraInputsManager.js.map +1 -1
  200. package/Cameras/gamepadCamera.d.ts +2 -2
  201. package/Cameras/gamepadCamera.js +2 -2
  202. package/Cameras/gamepadCamera.js.map +1 -1
  203. package/Cameras/targetCamera.d.ts +2 -2
  204. package/Cameras/targetCamera.js +2 -2
  205. package/Cameras/targetCamera.js.map +1 -1
  206. package/Cameras/touchCamera.d.ts +2 -2
  207. package/Cameras/touchCamera.js +2 -2
  208. package/Cameras/touchCamera.js.map +1 -1
  209. package/Cameras/universalCamera.d.ts +2 -2
  210. package/Cameras/universalCamera.js +2 -2
  211. package/Cameras/universalCamera.js.map +1 -1
  212. package/Cameras/virtualJoysticksCamera.d.ts +2 -2
  213. package/Cameras/virtualJoysticksCamera.js +2 -2
  214. package/Cameras/virtualJoysticksCamera.js.map +1 -1
  215. package/Collisions/pickingInfo.d.ts +1 -1
  216. package/Collisions/pickingInfo.js +1 -1
  217. package/Collisions/pickingInfo.js.map +1 -1
  218. package/Culling/Octrees/octree.d.ts +2 -2
  219. package/Culling/Octrees/octree.js +2 -2
  220. package/Culling/Octrees/octree.js.map +1 -1
  221. package/Culling/Octrees/octreeBlock.d.ts +1 -1
  222. package/Culling/Octrees/octreeBlock.js +1 -1
  223. package/Culling/Octrees/octreeBlock.js.map +1 -1
  224. package/Culling/Octrees/octreeSceneComponent.d.ts +3 -3
  225. package/Culling/Octrees/octreeSceneComponent.js +1 -1
  226. package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
  227. package/Culling/boundingInfo.d.ts +3 -3
  228. package/Culling/boundingInfo.js +2 -2
  229. package/Culling/boundingInfo.js.map +1 -1
  230. package/Debug/debugLayer.d.ts +1 -1
  231. package/Debug/debugLayer.js.map +1 -1
  232. package/Debug/rayHelper.d.ts +2 -2
  233. package/Debug/rayHelper.js +2 -2
  234. package/Debug/rayHelper.js.map +1 -1
  235. package/Engines/Extensions/engine.alpha.d.ts +2 -2
  236. package/Engines/Extensions/engine.alpha.js.map +1 -1
  237. package/Engines/Extensions/engine.multiRender.d.ts +2 -2
  238. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  239. package/Engines/Extensions/engine.query.d.ts +8 -8
  240. package/Engines/Extensions/engine.query.js.map +1 -1
  241. package/Engines/Extensions/engine.renderTarget.d.ts +1 -1
  242. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  243. package/Engines/Extensions/engine.uniformBuffer.d.ts +3 -3
  244. package/Engines/Extensions/engine.uniformBuffer.js.map +1 -1
  245. package/Engines/Extensions/engine.views.d.ts +2 -2
  246. package/Engines/Extensions/engine.views.js +1 -1
  247. package/Engines/Extensions/engine.views.js.map +1 -1
  248. package/Engines/Extensions/engine.webVR.d.ts +1 -1
  249. package/Engines/Extensions/engine.webVR.js.map +1 -1
  250. package/Engines/Processors/shaderProcessor.d.ts +2 -2
  251. package/Engines/Processors/shaderProcessor.js +2 -2
  252. package/Engines/Processors/shaderProcessor.js.map +1 -1
  253. package/Engines/WebGPU/webgpuShaderProcessor.js +11 -9
  254. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  255. package/Engines/constants.d.ts +17 -17
  256. package/Engines/constants.js +17 -17
  257. package/Engines/constants.js.map +1 -1
  258. package/Engines/engine.d.ts +12 -12
  259. package/Engines/engine.js +11 -11
  260. package/Engines/engine.js.map +1 -1
  261. package/Engines/nativeEngine.d.ts +2 -2
  262. package/Engines/nativeEngine.js +23 -2
  263. package/Engines/nativeEngine.js.map +1 -1
  264. package/Engines/nullEngine.d.ts +5 -5
  265. package/Engines/nullEngine.js +5 -5
  266. package/Engines/nullEngine.js.map +1 -1
  267. package/Engines/thinEngine.d.ts +8 -8
  268. package/Engines/thinEngine.js +6 -6
  269. package/Engines/thinEngine.js.map +1 -1
  270. package/Engines/webgpuEngine.d.ts +4 -4
  271. package/Engines/webgpuEngine.js +1 -1
  272. package/Engines/webgpuEngine.js.map +1 -1
  273. package/Gamepads/gamepadSceneComponent.d.ts +1 -1
  274. package/Gamepads/gamepadSceneComponent.js.map +1 -1
  275. package/Gizmos/gizmo.d.ts +6 -7
  276. package/Gizmos/gizmo.js +43 -36
  277. package/Gizmos/gizmo.js.map +1 -1
  278. package/Gizmos/planeRotationGizmo.js +17 -7
  279. package/Gizmos/planeRotationGizmo.js.map +1 -1
  280. package/Gizmos/positionGizmo.d.ts +4 -0
  281. package/Gizmos/positionGizmo.js +21 -0
  282. package/Gizmos/positionGizmo.js.map +1 -1
  283. package/Gizmos/rotationGizmo.d.ts +4 -0
  284. package/Gizmos/rotationGizmo.js +20 -0
  285. package/Gizmos/rotationGizmo.js.map +1 -1
  286. package/Gizmos/scaleGizmo.d.ts +2 -0
  287. package/Gizmos/scaleGizmo.js +10 -0
  288. package/Gizmos/scaleGizmo.js.map +1 -1
  289. package/Helpers/sceneHelpers.d.ts +7 -7
  290. package/Helpers/sceneHelpers.js.map +1 -1
  291. package/Inputs/scene.inputManager.js +34 -25
  292. package/Inputs/scene.inputManager.js.map +1 -1
  293. package/Instrumentation/engineInstrumentation.d.ts +2 -2
  294. package/Instrumentation/engineInstrumentation.js +2 -2
  295. package/Instrumentation/engineInstrumentation.js.map +1 -1
  296. package/Instrumentation/sceneInstrumentation.d.ts +2 -2
  297. package/Instrumentation/sceneInstrumentation.js +2 -2
  298. package/Instrumentation/sceneInstrumentation.js.map +1 -1
  299. package/Layers/effectLayerSceneComponent.d.ts +2 -2
  300. package/Layers/effectLayerSceneComponent.js.map +1 -1
  301. package/Layers/glowLayer.d.ts +1 -1
  302. package/Layers/glowLayer.js +1 -1
  303. package/Layers/glowLayer.js.map +1 -1
  304. package/LensFlares/lensFlare.d.ts +3 -3
  305. package/LensFlares/lensFlare.js +3 -3
  306. package/LensFlares/lensFlare.js.map +1 -1
  307. package/LensFlares/lensFlareSystem.d.ts +2 -2
  308. package/LensFlares/lensFlareSystem.js +2 -2
  309. package/LensFlares/lensFlareSystem.js.map +1 -1
  310. package/LensFlares/lensFlareSystemSceneComponent.d.ts +1 -1
  311. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  312. package/Lights/Shadows/shadowGenerator.d.ts +2 -2
  313. package/Lights/Shadows/shadowGenerator.js +2 -2
  314. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  315. package/Lights/directionalLight.d.ts +2 -2
  316. package/Lights/directionalLight.js +2 -2
  317. package/Lights/directionalLight.js.map +1 -1
  318. package/Lights/hemisphericLight.d.ts +1 -1
  319. package/Lights/hemisphericLight.js +1 -1
  320. package/Lights/hemisphericLight.js.map +1 -1
  321. package/Lights/light.d.ts +1 -1
  322. package/Lights/light.js +1 -1
  323. package/Lights/light.js.map +1 -1
  324. package/Lights/pointLight.d.ts +2 -2
  325. package/Lights/pointLight.js +2 -2
  326. package/Lights/pointLight.js.map +1 -1
  327. package/Lights/spotLight.d.ts +2 -2
  328. package/Lights/spotLight.js +2 -2
  329. package/Lights/spotLight.js.map +1 -1
  330. package/Loading/loadingScreen.d.ts +2 -2
  331. package/Loading/loadingScreen.js +1 -1
  332. package/Loading/loadingScreen.js.map +1 -1
  333. package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +1 -1
  334. package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -1
  335. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  336. package/Materials/Node/Blocks/reciprocalBlock.js +6 -2
  337. package/Materials/Node/Blocks/reciprocalBlock.js.map +1 -1
  338. package/Materials/PBR/pbrBaseMaterial.d.ts +1 -1
  339. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  340. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  341. package/Materials/PBR/pbrMaterial.d.ts +1 -1
  342. package/Materials/PBR/pbrMaterial.js +1 -1
  343. package/Materials/PBR/pbrMaterial.js.map +1 -1
  344. package/Materials/Textures/Packer/packer.d.ts +1 -1
  345. package/Materials/Textures/Packer/packer.js +1 -1
  346. package/Materials/Textures/Packer/packer.js.map +1 -1
  347. package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -2
  348. package/Materials/Textures/Procedurals/customProceduralTexture.js +2 -2
  349. package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
  350. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +2 -2
  351. package/Materials/Textures/Procedurals/proceduralTexture.js +2 -2
  352. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  353. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +1 -1
  354. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  355. package/Materials/Textures/cubeTexture.d.ts +2 -2
  356. package/Materials/Textures/cubeTexture.js +2 -2
  357. package/Materials/Textures/cubeTexture.js.map +1 -1
  358. package/Materials/Textures/dynamicTexture.d.ts +1 -1
  359. package/Materials/Textures/dynamicTexture.js +1 -1
  360. package/Materials/Textures/dynamicTexture.js.map +1 -1
  361. package/Materials/Textures/mirrorTexture.d.ts +3 -3
  362. package/Materials/Textures/mirrorTexture.js +3 -3
  363. package/Materials/Textures/mirrorTexture.js.map +1 -1
  364. package/Materials/Textures/refractionTexture.d.ts +3 -3
  365. package/Materials/Textures/refractionTexture.js +3 -3
  366. package/Materials/Textures/refractionTexture.js.map +1 -1
  367. package/Materials/Textures/texture.d.ts +10 -10
  368. package/Materials/Textures/texture.js +10 -10
  369. package/Materials/Textures/texture.js.map +1 -1
  370. package/Materials/Textures/videoTexture.d.ts +2 -2
  371. package/Materials/Textures/videoTexture.js +2 -2
  372. package/Materials/Textures/videoTexture.js.map +1 -1
  373. package/Materials/effect.d.ts +20 -2
  374. package/Materials/effect.js +28 -4
  375. package/Materials/effect.js.map +1 -1
  376. package/Materials/effectRenderer.js +1 -0
  377. package/Materials/effectRenderer.js.map +1 -1
  378. package/Materials/fresnelParameters.d.ts +1 -1
  379. package/Materials/fresnelParameters.js +1 -1
  380. package/Materials/fresnelParameters.js.map +1 -1
  381. package/Materials/material.d.ts +1 -1
  382. package/Materials/material.js.map +1 -1
  383. package/Materials/multiMaterial.d.ts +2 -2
  384. package/Materials/multiMaterial.js +2 -2
  385. package/Materials/multiMaterial.js.map +1 -1
  386. package/Materials/shaderMaterial.d.ts +2 -2
  387. package/Materials/shaderMaterial.js +2 -2
  388. package/Materials/shaderMaterial.js.map +1 -1
  389. package/Materials/shadowDepthWrapper.d.ts +1 -1
  390. package/Materials/shadowDepthWrapper.js +2 -2
  391. package/Materials/shadowDepthWrapper.js.map +1 -1
  392. package/Materials/standardMaterial.d.ts +18 -18
  393. package/Materials/standardMaterial.js +6 -6
  394. package/Materials/standardMaterial.js.map +1 -1
  395. package/Maths/math.path.d.ts +7 -7
  396. package/Maths/math.path.js +7 -7
  397. package/Maths/math.path.js.map +1 -1
  398. package/Maths/math.vector.d.ts +4 -4
  399. package/Maths/math.vector.js +4 -4
  400. package/Maths/math.vector.js.map +1 -1
  401. package/Meshes/Builders/boxBuilder.d.ts +3 -3
  402. package/Meshes/Builders/boxBuilder.js +3 -3
  403. package/Meshes/Builders/boxBuilder.js.map +1 -1
  404. package/Meshes/Builders/capsuleBuilder.d.ts +1 -1
  405. package/Meshes/Builders/capsuleBuilder.js +1 -1
  406. package/Meshes/Builders/capsuleBuilder.js.map +1 -1
  407. package/Meshes/Builders/cylinderBuilder.d.ts +2 -2
  408. package/Meshes/Builders/cylinderBuilder.js +2 -2
  409. package/Meshes/Builders/cylinderBuilder.js.map +1 -1
  410. package/Meshes/Builders/decalBuilder.d.ts +1 -1
  411. package/Meshes/Builders/decalBuilder.js +1 -1
  412. package/Meshes/Builders/decalBuilder.js.map +1 -1
  413. package/Meshes/Builders/discBuilder.d.ts +2 -2
  414. package/Meshes/Builders/discBuilder.js +2 -2
  415. package/Meshes/Builders/discBuilder.js.map +1 -1
  416. package/Meshes/Builders/geodesicBuilder.d.ts +1 -1
  417. package/Meshes/Builders/geodesicBuilder.js +1 -1
  418. package/Meshes/Builders/geodesicBuilder.js.map +1 -1
  419. package/Meshes/Builders/goldbergBuilder.d.ts +1 -1
  420. package/Meshes/Builders/goldbergBuilder.js +1 -1
  421. package/Meshes/Builders/goldbergBuilder.js.map +1 -1
  422. package/Meshes/Builders/groundBuilder.d.ts +4 -4
  423. package/Meshes/Builders/groundBuilder.js +4 -4
  424. package/Meshes/Builders/groundBuilder.js.map +1 -1
  425. package/Meshes/Builders/icoSphereBuilder.d.ts +2 -2
  426. package/Meshes/Builders/icoSphereBuilder.js +2 -2
  427. package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
  428. package/Meshes/Builders/latheBuilder.d.ts +2 -2
  429. package/Meshes/Builders/latheBuilder.js +2 -2
  430. package/Meshes/Builders/latheBuilder.js.map +1 -1
  431. package/Meshes/Builders/linesBuilder.d.ts +6 -6
  432. package/Meshes/Builders/linesBuilder.js +6 -6
  433. package/Meshes/Builders/linesBuilder.js.map +1 -1
  434. package/Meshes/Builders/planeBuilder.d.ts +2 -2
  435. package/Meshes/Builders/planeBuilder.js +2 -2
  436. package/Meshes/Builders/planeBuilder.js.map +1 -1
  437. package/Meshes/Builders/polygonBuilder.d.ts +1 -1
  438. package/Meshes/Builders/polygonBuilder.js +1 -1
  439. package/Meshes/Builders/polygonBuilder.js.map +1 -1
  440. package/Meshes/Builders/polyhedronBuilder.d.ts +3 -3
  441. package/Meshes/Builders/polyhedronBuilder.js +3 -3
  442. package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
  443. package/Meshes/Builders/ribbonBuilder.d.ts +4 -4
  444. package/Meshes/Builders/ribbonBuilder.js +4 -4
  445. package/Meshes/Builders/ribbonBuilder.js.map +1 -1
  446. package/Meshes/Builders/shapeBuilder.d.ts +9 -9
  447. package/Meshes/Builders/shapeBuilder.js +9 -9
  448. package/Meshes/Builders/shapeBuilder.js.map +1 -1
  449. package/Meshes/Builders/sphereBuilder.d.ts +2 -2
  450. package/Meshes/Builders/sphereBuilder.js +2 -2
  451. package/Meshes/Builders/sphereBuilder.js.map +1 -1
  452. package/Meshes/Builders/tiledBoxBuilder.d.ts +2 -2
  453. package/Meshes/Builders/tiledBoxBuilder.js +2 -2
  454. package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
  455. package/Meshes/Builders/tiledPlaneBuilder.d.ts +2 -2
  456. package/Meshes/Builders/tiledPlaneBuilder.js +2 -2
  457. package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
  458. package/Meshes/Builders/torusBuilder.d.ts +2 -2
  459. package/Meshes/Builders/torusBuilder.js +2 -2
  460. package/Meshes/Builders/torusBuilder.js.map +1 -1
  461. package/Meshes/Builders/torusKnotBuilder.d.ts +2 -2
  462. package/Meshes/Builders/torusKnotBuilder.js +2 -2
  463. package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
  464. package/Meshes/Builders/tubeBuilder.d.ts +4 -4
  465. package/Meshes/Builders/tubeBuilder.js +4 -4
  466. package/Meshes/Builders/tubeBuilder.js.map +1 -1
  467. package/Meshes/abstractMesh.d.ts +35 -35
  468. package/Meshes/abstractMesh.js +34 -34
  469. package/Meshes/abstractMesh.js.map +1 -1
  470. package/Meshes/instancedMesh.d.ts +3 -3
  471. package/Meshes/instancedMesh.js +1 -1
  472. package/Meshes/instancedMesh.js.map +1 -1
  473. package/Meshes/linesMesh.d.ts +2 -2
  474. package/Meshes/linesMesh.js +2 -2
  475. package/Meshes/linesMesh.js.map +1 -1
  476. package/Meshes/mesh.d.ts +36 -36
  477. package/Meshes/mesh.js +9 -17
  478. package/Meshes/mesh.js.map +1 -1
  479. package/Meshes/meshLODLevel.d.ts +1 -1
  480. package/Meshes/meshLODLevel.js +1 -1
  481. package/Meshes/meshLODLevel.js.map +1 -1
  482. package/Meshes/meshSimplification.d.ts +6 -6
  483. package/Meshes/meshSimplification.js +4 -4
  484. package/Meshes/meshSimplification.js.map +1 -1
  485. package/Meshes/meshSimplificationSceneComponent.d.ts +1 -1
  486. package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
  487. package/Meshes/polygonMesh.d.ts +2 -2
  488. package/Meshes/polygonMesh.js +2 -2
  489. package/Meshes/polygonMesh.js.map +1 -1
  490. package/Meshes/transformNode.d.ts +1 -1
  491. package/Meshes/transformNode.js +1 -1
  492. package/Meshes/transformNode.js.map +1 -1
  493. package/Misc/assetsManager.d.ts +2 -2
  494. package/Misc/assetsManager.js +2 -2
  495. package/Misc/assetsManager.js.map +1 -1
  496. package/Misc/iInspectable.d.ts +1 -1
  497. package/Misc/iInspectable.js.map +1 -1
  498. package/Misc/sceneOptimizer.d.ts +12 -12
  499. package/Misc/sceneOptimizer.js +12 -12
  500. package/Misc/sceneOptimizer.js.map +1 -1
  501. package/Misc/screenshotTools.d.ts +10 -10
  502. package/Misc/screenshotTools.js +10 -10
  503. package/Misc/screenshotTools.js.map +1 -1
  504. package/Misc/tools.d.ts +4 -4
  505. package/Misc/tools.js +4 -4
  506. package/Misc/tools.js.map +1 -1
  507. package/Misc/videoRecorder.d.ts +1 -1
  508. package/Misc/videoRecorder.js +1 -1
  509. package/Misc/videoRecorder.js.map +1 -1
  510. package/Morph/morphTarget.d.ts +1 -1
  511. package/Morph/morphTarget.js +1 -1
  512. package/Morph/morphTarget.js.map +1 -1
  513. package/Morph/morphTargetManager.d.ts +1 -1
  514. package/Morph/morphTargetManager.js +1 -1
  515. package/Morph/morphTargetManager.js.map +1 -1
  516. package/Offline/IOfflineProvider.d.ts +1 -1
  517. package/Offline/IOfflineProvider.js.map +1 -1
  518. package/Offline/database.d.ts +1 -1
  519. package/Offline/database.js +1 -1
  520. package/Offline/database.js.map +1 -1
  521. package/Particles/IParticleSystem.d.ts +1 -1
  522. package/Particles/IParticleSystem.js.map +1 -1
  523. package/Particles/baseParticleSystem.d.ts +1 -1
  524. package/Particles/baseParticleSystem.js +1 -1
  525. package/Particles/baseParticleSystem.js.map +1 -1
  526. package/Particles/gpuParticleSystem.d.ts +1 -1
  527. package/Particles/gpuParticleSystem.js +1 -1
  528. package/Particles/gpuParticleSystem.js.map +1 -1
  529. package/Particles/particleSystem.d.ts +2 -2
  530. package/Particles/particleSystem.js +2 -2
  531. package/Particles/particleSystem.js.map +1 -1
  532. package/Particles/solidParticleSystem.d.ts +15 -15
  533. package/Particles/solidParticleSystem.js +13 -13
  534. package/Particles/solidParticleSystem.js.map +1 -1
  535. package/Physics/IPhysicsEngine.d.ts +1 -1
  536. package/Physics/IPhysicsEngine.js.map +1 -1
  537. package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
  538. package/Physics/Plugins/ammoJSPlugin.js +1 -1
  539. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  540. package/Physics/physicsEngine.d.ts +1 -1
  541. package/Physics/physicsEngine.js +1 -1
  542. package/Physics/physicsEngine.js.map +1 -1
  543. package/Physics/physicsEngineComponent.d.ts +3 -3
  544. package/Physics/physicsEngineComponent.js +2 -2
  545. package/Physics/physicsEngineComponent.js.map +1 -1
  546. package/Physics/physicsHelper.d.ts +12 -12
  547. package/Physics/physicsHelper.js +6 -6
  548. package/Physics/physicsHelper.js.map +1 -1
  549. package/Physics/physicsImpostor.d.ts +3 -3
  550. package/Physics/physicsImpostor.js +1 -1
  551. package/Physics/physicsImpostor.js.map +1 -1
  552. package/Physics/physicsJoint.d.ts +9 -9
  553. package/Physics/physicsJoint.js +5 -5
  554. package/Physics/physicsJoint.js.map +1 -1
  555. package/Physics/physicsRaycastResult.d.ts +1 -1
  556. package/Physics/physicsRaycastResult.js +1 -1
  557. package/Physics/physicsRaycastResult.js.map +1 -1
  558. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.d.ts +1 -1
  559. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +1 -1
  560. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  561. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.d.ts +1 -1
  562. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +1 -1
  563. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  564. package/PostProcesses/RenderPipeline/postProcessRenderEffect.d.ts +1 -1
  565. package/PostProcesses/RenderPipeline/postProcessRenderEffect.js +1 -1
  566. package/PostProcesses/RenderPipeline/postProcessRenderEffect.js.map +1 -1
  567. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +2 -2
  568. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +1 -1
  569. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  570. package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.d.ts +2 -2
  571. package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js +2 -2
  572. package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js.map +1 -1
  573. package/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.d.ts +2 -2
  574. package/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js.map +1 -1
  575. package/PostProcesses/blackAndWhitePostProcess.d.ts +1 -1
  576. package/PostProcesses/blackAndWhitePostProcess.js +1 -1
  577. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  578. package/PostProcesses/fxaaPostProcess.d.ts +1 -1
  579. package/PostProcesses/fxaaPostProcess.js +1 -1
  580. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  581. package/PostProcesses/highlightsPostProcess.d.ts +2 -2
  582. package/PostProcesses/highlightsPostProcess.js +2 -2
  583. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  584. package/PostProcesses/imageProcessingPostProcess.d.ts +1 -1
  585. package/PostProcesses/imageProcessingPostProcess.js +1 -1
  586. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  587. package/PostProcesses/postProcess.d.ts +2 -2
  588. package/PostProcesses/postProcess.js +1 -1
  589. package/PostProcesses/postProcess.js.map +1 -1
  590. package/PostProcesses/postProcessManager.d.ts +1 -1
  591. package/PostProcesses/postProcessManager.js +1 -1
  592. package/PostProcesses/postProcessManager.js.map +1 -1
  593. package/PostProcesses/refractionPostProcess.d.ts +2 -2
  594. package/PostProcesses/refractionPostProcess.js +2 -2
  595. package/PostProcesses/refractionPostProcess.js.map +1 -1
  596. package/Probes/reflectionProbe.d.ts +2 -2
  597. package/Probes/reflectionProbe.js +1 -1
  598. package/Probes/reflectionProbe.js.map +1 -1
  599. package/Rendering/geometryBufferRenderer.js +2 -2
  600. package/Rendering/geometryBufferRenderer.js.map +1 -1
  601. package/Sprites/sprite.d.ts +1 -1
  602. package/Sprites/sprite.js +1 -1
  603. package/Sprites/sprite.js.map +1 -1
  604. package/Sprites/spriteManager.d.ts +2 -2
  605. package/Sprites/spriteManager.js +1 -1
  606. package/Sprites/spriteManager.js.map +1 -1
  607. package/Sprites/spritePackedManager.d.ts +1 -1
  608. package/Sprites/spritePackedManager.js +1 -1
  609. package/Sprites/spritePackedManager.js.map +1 -1
  610. package/Sprites/spriteSceneComponent.d.ts +1 -1
  611. package/Sprites/spriteSceneComponent.js.map +1 -1
  612. package/Sprites/thinSprite.d.ts +1 -1
  613. package/Sprites/thinSprite.js +1 -1
  614. package/Sprites/thinSprite.js.map +1 -1
  615. package/XR/webXRCamera.d.ts +1 -1
  616. package/XR/webXRCamera.js +1 -1
  617. package/XR/webXRCamera.js.map +1 -1
  618. package/XR/webXRExperienceHelper.d.ts +1 -1
  619. package/XR/webXRExperienceHelper.js +1 -1
  620. package/XR/webXRExperienceHelper.js.map +1 -1
  621. package/XR/webXRInputSource.d.ts +1 -1
  622. package/XR/webXRInputSource.js +1 -1
  623. package/XR/webXRInputSource.js.map +1 -1
  624. package/XR/webXRSessionManager.d.ts +1 -1
  625. package/XR/webXRSessionManager.js +1 -1
  626. package/XR/webXRSessionManager.js.map +1 -1
  627. package/abstractScene.d.ts +9 -9
  628. package/abstractScene.js +9 -9
  629. package/abstractScene.js.map +1 -1
  630. package/node.d.ts +6 -6
  631. package/node.js +5 -5
  632. package/node.js.map +1 -1
  633. package/package.json +1 -1
  634. package/scene.d.ts +29 -24
  635. package/scene.js +24 -18
  636. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"soundTrack.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Audio/soundTrack.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAgBrD;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAgBnB;;;;;OAKG;IACH,YAAY,KAAuB,EAAE,UAA8B,EAAE;QArBrE;;WAEG;QACI,OAAE,GAAW,CAAC,CAAC,CAAC;QAUf,mBAAc,GAAG,KAAK,CAAC;QAS3B,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC,gBAAgB,CAAC;QAC9C,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,eAAe,GAAG,IAAI,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;YACrD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAA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AC,eAAe,CAAC,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC;aACtD;SACJ;IACL,CAAC;IAED;;;;OAIG;IACI,8BAA8B;;QACjC,IAAI,MAAA,MAAM,CAAC,WAAW,0CAAE,cAAc,EAAE;YACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAClD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,8BAA8B,EAAE,CAAC;aAC5D;SACJ;IACL,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,QAAkB;;QACvC,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;SAC7C;QACD,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC;QACnC,IAAI,CAAA,MAAA,MAAM,CAAC,WAAW,0CAAE,cAAc,KAAI,IAAI,CAAC,gBAAgB,EAAE;YAC7D,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;SACnG;IACL,CAAC;CACJ","sourcesContent":["import type { Sound } from \"./sound\";\r\nimport type { Analyser } from \"./analyser\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n/**\r\n * Options allowed during the creation of a sound track.\r\n */\r\nexport interface ISoundTrackOptions {\r\n /**\r\n * The volume the sound track should take during creation\r\n */\r\n volume?: number;\r\n /**\r\n * Define if the sound track is the main sound track of the scene\r\n */\r\n mainTrack?: boolean;\r\n}\r\n\r\n/**\r\n * It could be useful to isolate your music & sounds on several tracks to better manage volume on a grouped instance of sounds.\r\n * It will be also used in a future release to apply effects on a specific track.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#using-sound-tracks\r\n */\r\nexport class SoundTrack {\r\n /**\r\n * The unique identifier of the sound track in the scene.\r\n */\r\n public id: number = -1;\r\n /**\r\n * The list of sounds included in the sound track.\r\n */\r\n public soundCollection: Array<Sound>;\r\n\r\n private _outputAudioNode: Nullable<GainNode>;\r\n private _scene: Scene;\r\n private _connectedAnalyser: Analyser;\r\n private _options: ISoundTrackOptions;\r\n private _isInitialized = false;\r\n\r\n /**\r\n * Creates a new sound track.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#using-sound-tracks\r\n * @param scene Define the scene the sound track belongs to\r\n * @param options\r\n */\r\n constructor(scene?: Nullable<Scene>, options: ISoundTrackOptions = {}) {\r\n scene = scene || EngineStore.LastCreatedScene;\r\n if (!scene) {\r\n return;\r\n }\r\n this._scene = scene;\r\n this.soundCollection = new Array();\r\n this._options = options;\r\n\r\n if (!this._options.mainTrack && this._scene.soundTracks) {\r\n this._scene.soundTracks.push(this);\r\n this.id = this._scene.soundTracks.length - 1;\r\n }\r\n }\r\n\r\n private _initializeSoundTrackAudioGraph() {\r\n if (Engine.audioEngine?.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n this._outputAudioNode = Engine.audioEngine.audioContext.createGain();\r\n this._outputAudioNode.connect(Engine.audioEngine.masterGain);\r\n\r\n if (this._options) {\r\n if (this._options.volume) {\r\n this._outputAudioNode.gain.value = this._options.volume;\r\n }\r\n }\r\n\r\n this._isInitialized = true;\r\n }\r\n }\r\n\r\n /**\r\n * Release the sound track and its associated resources\r\n */\r\n public dispose(): void {\r\n if (Engine.audioEngine && Engine.audioEngine.canUseWebAudio) {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n while (this.soundCollection.length) {\r\n this.soundCollection[0].dispose();\r\n }\r\n if (this._outputAudioNode) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode = null;\r\n }\r\n }\r\n\r\n /**\r\n * Adds a sound to this sound track\r\n * @param sound define the sound to add\r\n * @ignoreNaming\r\n */\r\n public addSound(sound: Sound): void {\r\n if (!this._isInitialized) {\r\n this._initializeSoundTrackAudioGraph();\r\n }\r\n if (Engine.audioEngine?.canUseWebAudio && this._outputAudioNode) {\r\n sound.connectToSoundTrackAudioNode(this._outputAudioNode);\r\n }\r\n if (sound.soundTrackId) {\r\n if (sound.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.removeSound(sound);\r\n } else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[sound.soundTrackId].removeSound(sound);\r\n }\r\n }\r\n\r\n this.soundCollection.push(sound);\r\n sound.soundTrackId = this.id;\r\n }\r\n\r\n /**\r\n * Removes a sound to this sound track\r\n * @param sound define the sound to remove\r\n * @ignoreNaming\r\n */\r\n public removeSound(sound: Sound): void {\r\n const index = this.soundCollection.indexOf(sound);\r\n if (index !== -1) {\r\n this.soundCollection.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Set a global volume for the full sound track.\r\n * @param newVolume Define the new volume of the sound track\r\n */\r\n public setVolume(newVolume: number): void {\r\n if (Engine.audioEngine?.canUseWebAudio && this._outputAudioNode) {\r\n this._outputAudioNode.gain.value = newVolume;\r\n }\r\n }\r\n\r\n /**\r\n * Switch the panning model to HRTF:\r\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n public switchPanningModelToHRTF(): void {\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n for (let i = 0; i < this.soundCollection.length; i++) {\r\n this.soundCollection[i].switchPanningModelToHRTF();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Switch the panning model to Equal Power:\r\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n public switchPanningModelToEqualPower(): void {\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n for (let i = 0; i < this.soundCollection.length; i++) {\r\n this.soundCollection[i].switchPanningModelToEqualPower();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Connect the sound track to an audio analyser allowing some amazing\r\n * synchronization between the sounds/music and your visualization (VuMeter for instance).\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#using-the-analyser\r\n * @param analyser The analyser to connect to the engine\r\n */\r\n public connectToAnalyser(analyser: Analyser): void {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n this._connectedAnalyser = analyser;\r\n if (Engine.audioEngine?.canUseWebAudio && this._outputAudioNode) {\r\n this._outputAudioNode.disconnect();\r\n this._connectedAnalyser.connectAudioNodes(this._outputAudioNode, Engine.audioEngine.masterGain);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"soundTrack.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Audio/soundTrack.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAgBrD;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAgBnB;;;;;OAKG;IACH,YAAY,KAAuB,EAAE,UAA8B,EAAE;QArBrE;;WAEG;QACI,OAAE,GAAW,CAAC,CAAC,CAAC;QAUf,mBAAc,GAAG,KAAK,CAAC;QAS3B,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC,gBAAgB,CAAC;QAC9C,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,eAAe,GAAG,IAAI,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAI,CAAC,IAAI,CA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ED;;;;OAIG;IACI,wBAAwB;;QAC3B,IAAI,MAAA,MAAM,CAAC,WAAW,0CAAE,cAAc,EAAE;YACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAClD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC;aACtD;SACJ;IACL,CAAC;IAED;;;;OAIG;IACI,8BAA8B;;QACjC,IAAI,MAAA,MAAM,CAAC,WAAW,0CAAE,cAAc,EAAE;YACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAClD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,8BAA8B,EAAE,CAAC;aAC5D;SACJ;IACL,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,QAAkB;;QACvC,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;SAC7C;QACD,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC;QACnC,IAAI,CAAA,MAAA,MAAM,CAAC,WAAW,0CAAE,cAAc,KAAI,IAAI,CAAC,gBAAgB,EAAE;YAC7D,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;SACnG;IACL,CAAC;CACJ","sourcesContent":["import type { Sound } from \"./sound\";\r\nimport type { Analyser } from \"./analyser\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n/**\r\n * Options allowed during the creation of a sound track.\r\n */\r\nexport interface ISoundTrackOptions {\r\n /**\r\n * The volume the sound track should take during creation\r\n */\r\n volume?: number;\r\n /**\r\n * Define if the sound track is the main sound track of the scene\r\n */\r\n mainTrack?: boolean;\r\n}\r\n\r\n/**\r\n * It could be useful to isolate your music & sounds on several tracks to better manage volume on a grouped instance of sounds.\r\n * It will be also used in a future release to apply effects on a specific track.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#using-sound-tracks\r\n */\r\nexport class SoundTrack {\r\n /**\r\n * The unique identifier of the sound track in the scene.\r\n */\r\n public id: number = -1;\r\n /**\r\n * The list of sounds included in the sound track.\r\n */\r\n public soundCollection: Array<Sound>;\r\n\r\n private _outputAudioNode: Nullable<GainNode>;\r\n private _scene: Scene;\r\n private _connectedAnalyser: Analyser;\r\n private _options: ISoundTrackOptions;\r\n private _isInitialized = false;\r\n\r\n /**\r\n * Creates a new sound track.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#using-sound-tracks\r\n * @param scene Define the scene the sound track belongs to\r\n * @param options\r\n */\r\n constructor(scene?: Nullable<Scene>, options: ISoundTrackOptions = {}) {\r\n scene = scene || EngineStore.LastCreatedScene;\r\n if (!scene) {\r\n return;\r\n }\r\n this._scene = scene;\r\n this.soundCollection = new Array();\r\n this._options = options;\r\n\r\n if (!this._options.mainTrack && this._scene.soundTracks) {\r\n this._scene.soundTracks.push(this);\r\n this.id = this._scene.soundTracks.length - 1;\r\n }\r\n }\r\n\r\n private _initializeSoundTrackAudioGraph() {\r\n if (Engine.audioEngine?.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n this._outputAudioNode = Engine.audioEngine.audioContext.createGain();\r\n this._outputAudioNode.connect(Engine.audioEngine.masterGain);\r\n\r\n if (this._options) {\r\n if (this._options.volume) {\r\n this._outputAudioNode.gain.value = this._options.volume;\r\n }\r\n }\r\n\r\n this._isInitialized = true;\r\n }\r\n }\r\n\r\n /**\r\n * Release the sound track and its associated resources\r\n */\r\n public dispose(): void {\r\n if (Engine.audioEngine && Engine.audioEngine.canUseWebAudio) {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n while (this.soundCollection.length) {\r\n this.soundCollection[0].dispose();\r\n }\r\n if (this._outputAudioNode) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode = null;\r\n }\r\n }\r\n\r\n /**\r\n * Adds a sound to this sound track\r\n * @param sound define the sound to add\r\n * @ignoreNaming\r\n */\r\n public addSound(sound: Sound): void {\r\n if (!this._isInitialized) {\r\n this._initializeSoundTrackAudioGraph();\r\n }\r\n if (Engine.audioEngine?.canUseWebAudio && this._outputAudioNode) {\r\n sound.connectToSoundTrackAudioNode(this._outputAudioNode);\r\n }\r\n if (sound.soundTrackId) {\r\n if (sound.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.removeSound(sound);\r\n } else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[sound.soundTrackId].removeSound(sound);\r\n }\r\n }\r\n\r\n this.soundCollection.push(sound);\r\n sound.soundTrackId = this.id;\r\n }\r\n\r\n /**\r\n * Removes a sound to this sound track\r\n * @param sound define the sound to remove\r\n * @ignoreNaming\r\n */\r\n public removeSound(sound: Sound): void {\r\n const index = this.soundCollection.indexOf(sound);\r\n if (index !== -1) {\r\n this.soundCollection.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Set a global volume for the full sound track.\r\n * @param newVolume Define the new volume of the sound track\r\n */\r\n public setVolume(newVolume: number): void {\r\n if (Engine.audioEngine?.canUseWebAudio && this._outputAudioNode) {\r\n this._outputAudioNode.gain.value = newVolume;\r\n }\r\n }\r\n\r\n /**\r\n * Switch the panning model to HRTF:\r\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public switchPanningModelToHRTF(): void {\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n for (let i = 0; i < this.soundCollection.length; i++) {\r\n this.soundCollection[i].switchPanningModelToHRTF();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Switch the panning model to Equal Power:\r\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public switchPanningModelToEqualPower(): void {\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n for (let i = 0; i < this.soundCollection.length; i++) {\r\n this.soundCollection[i].switchPanningModelToEqualPower();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Connect the sound track to an audio analyser allowing some amazing\r\n * synchronization between the sounds/music and your visualization (VuMeter for instance).\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#using-the-analyser\r\n * @param analyser The analyser to connect to the engine\r\n */\r\n public connectToAnalyser(analyser: Analyser): void {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n this._connectedAnalyser = analyser;\r\n if (Engine.audioEngine?.canUseWebAudio && this._outputAudioNode) {\r\n this._outputAudioNode.disconnect();\r\n this._connectedAnalyser.connectAudioNodes(this._outputAudioNode, Engine.audioEngine.masterGain);\r\n }\r\n }\r\n}\r\n"]}
@@ -51,7 +51,7 @@ export interface IBakedVertexAnimationManager {
51
51
  }
52
52
  /**
53
53
  * This class is used to animate meshes using a baked vertex animation texture
54
- * @see https://doc.babylonjs.com/divingDeeper/animation/baked_texture_animations
54
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/baked_texture_animations
55
55
  * @since 5.0
56
56
  */
57
57
  export declare class BakedVertexAnimationManager implements IBakedVertexAnimationManager {
@@ -4,7 +4,7 @@ import { Vector4 } from "../Maths/math.vector.js";
4
4
  import { EngineStore } from "../Engines/engineStore.js";
5
5
  /**
6
6
  * This class is used to animate meshes using a baked vertex animation texture
7
- * @see https://doc.babylonjs.com/divingDeeper/animation/baked_texture_animations
7
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/baked_texture_animations
8
8
  * @since 5.0
9
9
  */
10
10
  export class BakedVertexAnimationManager {
@@ -1 +1 @@
1
- {"version":3,"file":"bakedVertexAnimationManager.js","sourceRoot":"","sources":["../../../../../lts/core/generated/BakedVertexAnimation/bakedVertexAnimationManager.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAwDrD;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IA+BpC;;;OAGG;IACH,YAAY,KAAuB;QAhC3B,aAAQ,GAA0B,IAAI,CAAC;QAQvC,eAAU,GAAG,IAAI,CAAC;QAC1B;;WAEG;QAGI,cAAS,GAAG,IAAI,CAAC;QAQxB;;WAEG;QAEI,SAAI,GAAG,CAAC,CAAC;QAOZ,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC,gBAAgB,CAAC;QAC9C,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,mBAAmB,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,gBAAgB;IACT,+BAA+B;QAClC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YACnC,IAAU,IAAK,CAAC,2BAA2B,KAAK,IAAI,EAAE;gBAClD,IAAI,CAAC,+BAA+B,EAAE,CAAC;aAC1C;SACJ;IACL,CAAC;IAED;;;;OAIG;IACI,IAAI,CAAC,MAAc,EAAE,YAAY,GA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K,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,OAAO,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnD,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;CACJ;AAjIG;IAFC,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,iCAAiC,CAAC;4DACd;AAQtC;IAFC,SAAS,EAAE;IACX,gBAAgB,CAAC,iCAAiC,CAAC;8DAC5B;AAMxB;IADC,SAAS,EAAE;wEACwB;AAMpC;IADC,SAAS,EAAE;yDACI","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { serialize, expandToProperty, serializeAsTexture, SerializationHelper } from \"../Misc/decorators\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Vector4 } from \"../Maths/math.vector\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n/**\r\n * Interface for baked vertex animation texture, see BakedVertexAnimationManager\r\n * @since 5.0\r\n */\r\nexport interface IBakedVertexAnimationManager {\r\n /**\r\n * The vertex animation texture\r\n */\r\n texture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the edgesRenderer is active\r\n */\r\n isEnabled: boolean;\r\n\r\n /**\r\n * The animation parameters for the mesh. See setAnimationParameters()\r\n */\r\n animationParameters: Vector4;\r\n\r\n /**\r\n * The time counter, to pick the correct animation frame.\r\n */\r\n time: number;\r\n\r\n /**\r\n * Binds to the effect.\r\n * @param effect The effect to bind to.\r\n * @param useInstances True when it's an instance.\r\n */\r\n bind(effect: Effect, useInstances: boolean): void;\r\n\r\n /**\r\n * Sets animation parameters.\r\n * @param startFrame The first frame of the animation.\r\n * @param endFrame The last frame of the animation.\r\n * @param offset The offset when starting the animation.\r\n * @param speedFramesPerSecond The frame rate.\r\n */\r\n setAnimationParameters(startFrame: number, endFrame: number, offset: number, speedFramesPerSecond: number): void;\r\n\r\n /**\r\n * Disposes the resources of the manager.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n dispose(forceDisposeTextures?: boolean): void;\r\n\r\n /**\r\n * Get the current class name useful for serialization or dynamic coding.\r\n * @returns \"BakedVertexAnimationManager\"\r\n */\r\n getClassName(): string;\r\n}\r\n\r\n/**\r\n * This class is used to animate meshes using a baked vertex animation texture\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/baked_texture_animations\r\n * @since 5.0\r\n */\r\nexport class BakedVertexAnimationManager implements IBakedVertexAnimationManager {\r\n private _scene: Scene;\r\n\r\n private _texture: Nullable<BaseTexture> = null;\r\n /**\r\n * The vertex animation texture\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markSubMeshesAsAttributesDirty\")\r\n public texture: Nullable<BaseTexture>;\r\n\r\n private _isEnabled = true;\r\n /**\r\n * Enable or disable the vertex animation manager\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markSubMeshesAsAttributesDirty\")\r\n public isEnabled = true;\r\n\r\n /**\r\n * The animation parameters for the mesh. See setAnimationParameters()\r\n */\r\n @serialize()\r\n public animationParameters: Vector4;\r\n\r\n /**\r\n * The time counter, to pick the correct animation frame.\r\n */\r\n @serialize()\r\n public time = 0;\r\n\r\n /**\r\n * Creates a new BakedVertexAnimationManager\r\n * @param scene defines the current scene\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 this.animationParameters = new Vector4(0, 0, 0, 30);\r\n }\r\n\r\n /** @internal */\r\n public _markSubMeshesAsAttributesDirty(): void {\r\n for (const mesh of this._scene.meshes) {\r\n if ((<any>mesh).bakedVertexAnimationManager === this) {\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Binds to the effect.\r\n * @param effect The effect to bind to.\r\n * @param useInstances True when it's an instance.\r\n */\r\n public bind(effect: Effect, useInstances = false): void {\r\n if (!this._texture || !this._isEnabled) {\r\n return;\r\n }\r\n\r\n const size = this._texture.getSize();\r\n effect.setFloat2(\"bakedVertexAnimationTextureSizeInverted\", 1.0 / size.width, 1.0 / size.height);\r\n effect.setFloat(\"bakedVertexAnimationTime\", this.time);\r\n\r\n if (!useInstances) {\r\n effect.setVector4(\"bakedVertexAnimationSettings\", this.animationParameters);\r\n }\r\n\r\n effect.setTexture(\"bakedVertexAnimationTexture\", this._texture);\r\n }\r\n\r\n /**\r\n * Clone the current manager\r\n * @returns a new BakedVertexAnimationManager\r\n */\r\n public clone(): BakedVertexAnimationManager {\r\n const copy = new BakedVertexAnimationManager(this._scene);\r\n this.copyTo(copy);\r\n return copy;\r\n }\r\n\r\n /**\r\n * Sets animation parameters.\r\n * @param startFrame The first frame of the animation.\r\n * @param endFrame The last frame of the animation.\r\n * @param offset The offset when starting the animation.\r\n * @param speedFramesPerSecond The frame rate.\r\n */\r\n public setAnimationParameters(startFrame: number, endFrame: number, offset: number = 0, speedFramesPerSecond: number = 30): void {\r\n this.animationParameters = new Vector4(startFrame, endFrame, offset, speedFramesPerSecond);\r\n }\r\n\r\n /**\r\n * Disposes the resources of the manager.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n public dispose(forceDisposeTextures?: boolean): void {\r\n if (forceDisposeTextures) {\r\n this._texture?.dispose();\r\n }\r\n }\r\n\r\n /**\r\n * Get the current class name useful for serialization or dynamic coding.\r\n * @returns \"BakedVertexAnimationManager\"\r\n */\r\n public getClassName(): string {\r\n return \"BakedVertexAnimationManager\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current instance into another one.\r\n * @param vatMap define the instance where to copy the info\r\n */\r\n public copyTo(vatMap: BakedVertexAnimationManager): void {\r\n SerializationHelper.Clone(() => vatMap, this);\r\n }\r\n\r\n /**\r\n * Serializes this vertex animation instance\r\n * @returns - An object with the serialized instance.\r\n */\r\n public serialize(): any {\r\n return SerializationHelper.Serialize(this);\r\n }\r\n\r\n /**\r\n * Parses a vertex animation setting from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n public parse(source: any, scene: Scene, rootUrl: string): void {\r\n SerializationHelper.Parse(() => this, source, scene, rootUrl);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"bakedVertexAnimationManager.js","sourceRoot":"","sources":["../../../../../lts/core/generated/BakedVertexAnimation/bakedVertexAnimationManager.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAwDrD;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IA+BpC;;;OAGG;IACH,YAAY,KAAuB;QAhC3B,aAAQ,GAA0B,IAAI,CAAC;QAQvC,eAAU,GAAG,IAAI,CAAC;QAC1B;;WAEG;QAGI,cAAS,GAAG,IAAI,CAAC;QAQxB;;WAEG;QAEI,SAAI,GAAG,CAAC,CAAC;QAOZ,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC,gBAAgB,CAAC;QAC9C,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,mBAAmB,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,gBAAgB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OAAO,CAAC,oBAA8B;;QACzC,IAAI,oBAAoB,EAAE;YACtB,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,EAAE,CAAC;SAC5B;IACL,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,6BAA6B,CAAC;IACzC,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,MAAmC;QAC7C,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,OAAO,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnD,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;CACJ;AAjIG;IAFC,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,iCAAiC,CAAC;4DACd;AAQtC;IAFC,SAAS,EAAE;IACX,gBAAgB,CAAC,iCAAiC,CAAC;8DAC5B;AAMxB;IADC,SAAS,EAAE;wEACwB;AAMpC;IADC,SAAS,EAAE;yDACI","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { serialize, expandToProperty, serializeAsTexture, SerializationHelper } from \"../Misc/decorators\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Vector4 } from \"../Maths/math.vector\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n/**\r\n * Interface for baked vertex animation texture, see BakedVertexAnimationManager\r\n * @since 5.0\r\n */\r\nexport interface IBakedVertexAnimationManager {\r\n /**\r\n * The vertex animation texture\r\n */\r\n texture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the edgesRenderer is active\r\n */\r\n isEnabled: boolean;\r\n\r\n /**\r\n * The animation parameters for the mesh. See setAnimationParameters()\r\n */\r\n animationParameters: Vector4;\r\n\r\n /**\r\n * The time counter, to pick the correct animation frame.\r\n */\r\n time: number;\r\n\r\n /**\r\n * Binds to the effect.\r\n * @param effect The effect to bind to.\r\n * @param useInstances True when it's an instance.\r\n */\r\n bind(effect: Effect, useInstances: boolean): void;\r\n\r\n /**\r\n * Sets animation parameters.\r\n * @param startFrame The first frame of the animation.\r\n * @param endFrame The last frame of the animation.\r\n * @param offset The offset when starting the animation.\r\n * @param speedFramesPerSecond The frame rate.\r\n */\r\n setAnimationParameters(startFrame: number, endFrame: number, offset: number, speedFramesPerSecond: number): void;\r\n\r\n /**\r\n * Disposes the resources of the manager.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n dispose(forceDisposeTextures?: boolean): void;\r\n\r\n /**\r\n * Get the current class name useful for serialization or dynamic coding.\r\n * @returns \"BakedVertexAnimationManager\"\r\n */\r\n getClassName(): string;\r\n}\r\n\r\n/**\r\n * This class is used to animate meshes using a baked vertex animation texture\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/baked_texture_animations\r\n * @since 5.0\r\n */\r\nexport class BakedVertexAnimationManager implements IBakedVertexAnimationManager {\r\n private _scene: Scene;\r\n\r\n private _texture: Nullable<BaseTexture> = null;\r\n /**\r\n * The vertex animation texture\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markSubMeshesAsAttributesDirty\")\r\n public texture: Nullable<BaseTexture>;\r\n\r\n private _isEnabled = true;\r\n /**\r\n * Enable or disable the vertex animation manager\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markSubMeshesAsAttributesDirty\")\r\n public isEnabled = true;\r\n\r\n /**\r\n * The animation parameters for the mesh. See setAnimationParameters()\r\n */\r\n @serialize()\r\n public animationParameters: Vector4;\r\n\r\n /**\r\n * The time counter, to pick the correct animation frame.\r\n */\r\n @serialize()\r\n public time = 0;\r\n\r\n /**\r\n * Creates a new BakedVertexAnimationManager\r\n * @param scene defines the current scene\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 this.animationParameters = new Vector4(0, 0, 0, 30);\r\n }\r\n\r\n /** @internal */\r\n public _markSubMeshesAsAttributesDirty(): void {\r\n for (const mesh of this._scene.meshes) {\r\n if ((<any>mesh).bakedVertexAnimationManager === this) {\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Binds to the effect.\r\n * @param effect The effect to bind to.\r\n * @param useInstances True when it's an instance.\r\n */\r\n public bind(effect: Effect, useInstances = false): void {\r\n if (!this._texture || !this._isEnabled) {\r\n return;\r\n }\r\n\r\n const size = this._texture.getSize();\r\n effect.setFloat2(\"bakedVertexAnimationTextureSizeInverted\", 1.0 / size.width, 1.0 / size.height);\r\n effect.setFloat(\"bakedVertexAnimationTime\", this.time);\r\n\r\n if (!useInstances) {\r\n effect.setVector4(\"bakedVertexAnimationSettings\", this.animationParameters);\r\n }\r\n\r\n effect.setTexture(\"bakedVertexAnimationTexture\", this._texture);\r\n }\r\n\r\n /**\r\n * Clone the current manager\r\n * @returns a new BakedVertexAnimationManager\r\n */\r\n public clone(): BakedVertexAnimationManager {\r\n const copy = new BakedVertexAnimationManager(this._scene);\r\n this.copyTo(copy);\r\n return copy;\r\n }\r\n\r\n /**\r\n * Sets animation parameters.\r\n * @param startFrame The first frame of the animation.\r\n * @param endFrame The last frame of the animation.\r\n * @param offset The offset when starting the animation.\r\n * @param speedFramesPerSecond The frame rate.\r\n */\r\n public setAnimationParameters(startFrame: number, endFrame: number, offset: number = 0, speedFramesPerSecond: number = 30): void {\r\n this.animationParameters = new Vector4(startFrame, endFrame, offset, speedFramesPerSecond);\r\n }\r\n\r\n /**\r\n * Disposes the resources of the manager.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n public dispose(forceDisposeTextures?: boolean): void {\r\n if (forceDisposeTextures) {\r\n this._texture?.dispose();\r\n }\r\n }\r\n\r\n /**\r\n * Get the current class name useful for serialization or dynamic coding.\r\n * @returns \"BakedVertexAnimationManager\"\r\n */\r\n public getClassName(): string {\r\n return \"BakedVertexAnimationManager\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current instance into another one.\r\n * @param vatMap define the instance where to copy the info\r\n */\r\n public copyTo(vatMap: BakedVertexAnimationManager): void {\r\n SerializationHelper.Clone(() => vatMap, this);\r\n }\r\n\r\n /**\r\n * Serializes this vertex animation instance\r\n * @returns - An object with the serialized instance.\r\n */\r\n public serialize(): any {\r\n return SerializationHelper.Serialize(this);\r\n }\r\n\r\n /**\r\n * Parses a vertex animation setting from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n public parse(source: any, scene: Scene, rootUrl: string): void {\r\n SerializationHelper.Parse(() => this, source, scene, rootUrl);\r\n }\r\n}\r\n"]}
@@ -3,7 +3,7 @@ import type { ArcRotateCamera } from "../../Cameras/arcRotateCamera";
3
3
  import type { Nullable } from "../../types";
4
4
  /**
5
5
  * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.
6
- * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior
6
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#autorotation-behavior
7
7
  */
8
8
  export declare class AutoRotationBehavior implements Behavior<ArcRotateCamera> {
9
9
  /**
@@ -3,7 +3,7 @@ import { PrecisionDate } from "../../Misc/precisionDate.js";
3
3
  import { Epsilon } from "../../Maths/math.constants.js";
4
4
  /**
5
5
  * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.
6
- * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior
6
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#autorotation-behavior
7
7
  */
8
8
  export class AutoRotationBehavior {
9
9
  constructor() {
@@ -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,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,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB,CAAC,KAAa;QACtC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,o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AED,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"]}
1
+ {"version":3,"file":"autoRotationBehavior.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Behaviors/Cameras/autoRotationBehavior.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,C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C3C,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/features/featuresDeepDive/behaviors/cameraBehaviors#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"]}
@@ -3,7 +3,7 @@ import type { ArcRotateCamera } from "../../Cameras/arcRotateCamera";
3
3
  import { BackEase } from "../../Animations/easing";
4
4
  /**
5
5
  * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius
6
- * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior
6
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#bouncing-behavior
7
7
  */
8
8
  export declare class BouncingBehavior implements Behavior<ArcRotateCamera> {
9
9
  /**
@@ -2,7 +2,7 @@ import { BackEase, EasingFunction } from "../../Animations/easing.js";
2
2
  import { Animation } from "../../Animations/animation.js";
3
3
  /**
4
4
  * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius
5
- * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior
5
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#bouncing-behavior
6
6
  */
7
7
  export class BouncingBehavior {
8
8
  constructor() {
@@ -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,UAAU,CAAC;IACtB,CAAC;IA6BD;;OAEG;IACH,IAAW,mBAAmB;QAC1B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,IAAW,mBAAmB,CAAC,KAAc;QACzC,IAAI,IAAI,CAAC,oBAAoB,KAAK,KAAK,EAAE;YACrC,OAAO;SACV;QAED,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAElC,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;QACpC,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QAED,IAAI,KAAK,EAAE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\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"]}
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,UAAU,CAAC;IACtB,CAAC;IA6BD;;OAEG;IACH,IAAW,mBAAmB;QAC1B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,IAAW,mBAAmB,CAAC,KAAc;QACzC,IAAI,IAAI,CAAC,oBAAoB,KAAK,KAAK,EAAE;YACrC,OAAO;SACV;QAED,IAAI,CAAC,oBAAoB,G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AC;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/features/featuresDeepDive/behaviors/cameraBehaviors#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"]}
@@ -7,7 +7,7 @@ import type { AbstractMesh } from "../../Meshes/abstractMesh";
7
7
  import { Vector3 } from "../../Maths/math.vector";
8
8
  /**
9
9
  * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.
10
- * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior
10
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior
11
11
  */
12
12
  export declare class FramingBehavior implements Behavior<ArcRotateCamera> {
13
13
  /**
@@ -6,7 +6,7 @@ import { Vector3, Vector2 } from "../../Maths/math.vector.js";
6
6
  import { Animation } from "../../Animations/animation.js";
7
7
  /**
8
8
  * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.
9
- * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior
9
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior
10
10
  */
11
11
  export class FramingBehavior {
12
12
  constructor() {
@@ -1 +1 @@
1
- {"version":3,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tB,IAAI,CAAC,eAAe,CAAC,UAAU,GAAG,EAAE,CAAC;SACxC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC7B,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;gBACtB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC;gBAC3C,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aAC/B;YACD,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;SAC7B;IACL,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,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;;AA3fD;;GAEG;AACW,8BAAc,GAAG,IAAI,eAAe,EAAE,CAAC;AAErD;;GAEG;AACW,0BAAU,GAAG,cAAc,CAAC,oBAAoB,CAAC;AAqf/D,UAAU;AAEV;;GAEG;AACW,oCAAoB,GAAG,CAAC,CAAC;AAEvC;;GAEG;AACW,mCAAmB,GAAG,CAAC,CAAC","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport { ExponentialEase, EasingFunction } from \"../../Animations/easing\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { PointerInfoPre } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\n\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport type { Animatable } from \"../../Animations/animatable\";\r\nimport { Animation } from \"../../Animations/animation\";\r\n\r\n/**\r\n * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\nexport class FramingBehavior implements Behavior<ArcRotateCamera> {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n public get name(): string {\r\n return \"Framing\";\r\n }\r\n\r\n /**\r\n * An event triggered when the animation to zoom on target mesh has ended\r\n */\r\n public onTargetFramingAnimationEndObservable = new Observable<void>();\r\n\r\n private _mode = FramingBehavior.FitFrustumSidesMode;\r\n private _radiusScale = 1.0;\r\n private _positionScale = 0.5;\r\n private _defaultElevation = 0.3;\r\n private _elevationReturnTime = 1500;\r\n private _elevationReturnWaitTime = 1000;\r\n private _zoomStopsAnimation = false;\r\n private _framingTime = 1500;\r\n\r\n /**\r\n * The easing function used by animations\r\n */\r\n public static EasingFunction = new ExponentialEase();\r\n\r\n /**\r\n * The easing mode used by animations\r\n */\r\n public static EasingMode = EasingFunction.EASINGMODE_EASEINOUT;\r\n\r\n /**\r\n * Sets the current mode used by the behavior\r\n */\r\n public set mode(mode: number) {\r\n this._mode = mode;\r\n }\r\n\r\n /**\r\n * Gets current mode used by the behavior.\r\n */\r\n public get mode(): number {\r\n return this._mode;\r\n }\r\n\r\n /**\r\n * Sets the scale applied to the radius (1 by default)\r\n */\r\n public set radiusScale(radius: number) {\r\n this._radiusScale = radius;\r\n }\r\n\r\n /**\r\n * Gets the scale applied to the radius\r\n */\r\n public get radiusScale(): number {\r\n return this._radiusScale;\r\n }\r\n\r\n /**\r\n * Sets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n public set positionScale(scale: number) {\r\n this._positionScale = scale;\r\n }\r\n\r\n /**\r\n * Gets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n public get positionScale(): number {\r\n return this._positionScale;\r\n }\r\n\r\n /**\r\n * Sets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n public set defaultElevation(elevation: number) {\r\n this._defaultElevation = elevation;\r\n }\r\n\r\n /**\r\n * Gets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n public get defaultElevation() {\r\n return this._defaultElevation;\r\n }\r\n\r\n /**\r\n * Sets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n public set elevationReturnTime(speed: number) {\r\n this._elevationReturnTime = speed;\r\n }\r\n\r\n /**\r\n * Gets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n public get elevationReturnTime(): number {\r\n return this._elevationReturnTime;\r\n }\r\n\r\n /**\r\n * Sets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n public set elevationReturnWaitTime(time: number) {\r\n this._elevationReturnWaitTime = time;\r\n }\r\n\r\n /**\r\n * Gets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n public get elevationReturnWaitTime(): number {\r\n return this._elevationReturnWaitTime;\r\n }\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 transition time when framing the mesh, in milliseconds\r\n */\r\n public set framingTime(time: number) {\r\n this._framingTime = time;\r\n }\r\n\r\n /**\r\n * Gets the transition time when framing the mesh, in milliseconds\r\n */\r\n public get framingTime() {\r\n return this._framingTime;\r\n }\r\n\r\n /**\r\n * Define if the behavior should automatically change the configured\r\n * camera limits and sensibilities.\r\n */\r\n public autoCorrectCameraLimitsAndSensibility = true;\r\n\r\n // Default behavior functions\r\n private _onPrePointerObservableObserver: Nullable<Observer<PointerInfoPre>>;\r\n private _onAfterCheckInputsObserver: Nullable<Observer<Camera>>;\r\n private _onMeshTargetChangedObserver: Nullable<Observer<Nullable<AbstractMesh>>>;\r\n private _attachedCamera: Nullable<ArcRotateCamera>;\r\n private _isPointerDown = false;\r\n private _lastInteractionTime = -Infinity;\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 FramingBehavior.EasingFunction.setEasingMode(FramingBehavior.EasingMode);\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._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add((mesh) => {\r\n if (mesh) {\r\n this.zoomOnMesh(mesh, undefined, () => {\r\n this.onTargetFramingAnimationEndObservable.notifyObservers();\r\n });\r\n }\r\n });\r\n\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\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 // Maintain the camera above the ground. If the user pulls the camera beneath the ground plane, lift it\r\n // back to the default position after a given timeout\r\n this._maintainCameraAboveGround();\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\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 if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n\r\n this._attachedCamera = null;\r\n }\r\n\r\n // Framing control\r\n private _animatables = new Array<Animatable>();\r\n private _betaIsAnimating = false;\r\n private _betaTransition: Animation;\r\n private _radiusTransition: Animation;\r\n private _vectorTransition: Animation;\r\n\r\n /**\r\n * Targets the given mesh and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n public zoomOnMesh(mesh: AbstractMesh, focusOnOriginXZ: boolean = false, onAnimationEnd: Nullable<() => void> = null): void {\r\n mesh.computeWorldMatrix(true);\r\n\r\n const boundingBox = mesh.getBoundingInfo().boundingBox;\r\n this.zoomOnBoundingInfo(boundingBox.minimumWorld, boundingBox.maximumWorld, focusOnOriginXZ, onAnimationEnd);\r\n }\r\n\r\n /**\r\n * Targets the given mesh with its children and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n public zoomOnMeshHierarchy(mesh: AbstractMesh, focusOnOriginXZ: boolean = false, onAnimationEnd: Nullable<() => void> = null): void {\r\n mesh.computeWorldMatrix(true);\r\n\r\n const boundingBox = mesh.getHierarchyBoundingVectors(true);\r\n this.zoomOnBoundingInfo(boundingBox.min, boundingBox.max, focusOnOriginXZ, onAnimationEnd);\r\n }\r\n\r\n /**\r\n * Targets the given meshes with their children and updates zoom level accordingly.\r\n * @param meshes The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n public zoomOnMeshesHierarchy(meshes: AbstractMesh[], focusOnOriginXZ: boolean = false, onAnimationEnd: Nullable<() => void> = null): void {\r\n const min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n for (let i = 0; i < meshes.length; i++) {\r\n const boundingInfo = meshes[i].getHierarchyBoundingVectors(true);\r\n Vector3.CheckExtends(boundingInfo.min, min, max);\r\n Vector3.CheckExtends(boundingInfo.max, min, max);\r\n }\r\n\r\n this.zoomOnBoundingInfo(min, max, focusOnOriginXZ, onAnimationEnd);\r\n }\r\n\r\n /**\r\n * Targets the bounding box info defined by its extends and updates zoom level accordingly.\r\n * @param minimumWorld Determines the smaller position of the bounding box extend\r\n * @param maximumWorld Determines the bigger position of the bounding box extend\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n public zoomOnBoundingInfo(minimumWorld: Vector3, maximumWorld: Vector3, focusOnOriginXZ: boolean = false, onAnimationEnd: Nullable<() => void> = null): void {\r\n let zoomTarget: Vector3;\r\n\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n\r\n // Find target by interpolating from bottom of bounding box in world-space to top via framingPositionY\r\n const bottom = minimumWorld.y;\r\n const top = maximumWorld.y;\r\n const zoomTargetY = bottom + (top - bottom) * this._positionScale;\r\n const radiusWorld = maximumWorld.subtract(minimumWorld).scale(0.5);\r\n\r\n if (focusOnOriginXZ) {\r\n zoomTarget = new Vector3(0, zoomTargetY, 0);\r\n } else {\r\n const centerWorld = minimumWorld.add(radiusWorld);\r\n zoomTarget = new Vector3(centerWorld.x, zoomTargetY, centerWorld.z);\r\n }\r\n\r\n if (!this._vectorTransition) {\r\n this._vectorTransition = Animation.CreateAnimation(\"target\", Animation.ANIMATIONTYPE_VECTOR3, 60, FramingBehavior.EasingFunction);\r\n }\r\n\r\n this._betaIsAnimating = true;\r\n let animatable = Animation.TransitionTo(\"target\", zoomTarget, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime);\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n\r\n // sets the radius and lower radius bounds\r\n // Small delta ensures camera is not always at lower zoom limit.\r\n let radius = 0;\r\n if (this._mode === FramingBehavior.FitFrustumSidesMode) {\r\n const position = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n this._attachedCamera.lowerRadiusLimit = radiusWorld.length() + this._attachedCamera.minZ;\r\n }\r\n radius = position;\r\n } else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n radius = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility && this._attachedCamera.lowerRadiusLimit === null) {\r\n this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;\r\n }\r\n }\r\n\r\n // Set sensibilities\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n const extend = maximumWorld.subtract(minimumWorld).length();\r\n this._attachedCamera.panningSensibility = 5000 / extend;\r\n this._attachedCamera.wheelPrecision = 100 / radius;\r\n }\r\n\r\n // transition to new radius\r\n if (!this._radiusTransition) {\r\n this._radiusTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n\r\n animatable = Animation.TransitionTo(\"radius\", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, () => {\r\n this.stopAllAnimations();\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n\r\n if (this._attachedCamera && this._attachedCamera.useInputToRestoreState) {\r\n this._attachedCamera.storeState();\r\n }\r\n });\r\n\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n }\r\n\r\n /**\r\n * Calculates the lowest radius for the camera based on the bounding box of the mesh.\r\n * @param minimumWorld\r\n * @param maximumWorld\r\n * @returns The minimum distance from the primary mesh's center point at which the camera must be kept in order\r\n *\t\t to fully enclose the mesh in the viewing frustum.\r\n */\r\n protected _calculateLowerRadiusFromModelBoundingSphere(minimumWorld: Vector3, maximumWorld: Vector3): number {\r\n const size = maximumWorld.subtract(minimumWorld);\r\n const boxVectorGlobalDiagonal = size.length();\r\n const frustumSlope: Vector2 = this._getFrustumSlope();\r\n\r\n // Formula for setting distance\r\n // (Good explanation: http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene)\r\n const radiusWithoutFraming = boxVectorGlobalDiagonal * 0.5;\r\n\r\n // Horizon distance\r\n const radius = radiusWithoutFraming * this._radiusScale;\r\n const distanceForHorizontalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.x * frustumSlope.x));\r\n const distanceForVerticalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.y * frustumSlope.y));\r\n let distance = Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);\r\n const camera = this._attachedCamera;\r\n\r\n if (!camera) {\r\n return 0;\r\n }\r\n\r\n if (camera.lowerRadiusLimit && this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n // Don't exceed the requested limit\r\n distance = distance < camera.lowerRadiusLimit ? camera.lowerRadiusLimit : distance;\r\n }\r\n\r\n // Don't exceed the upper radius limit\r\n if (camera.upperRadiusLimit) {\r\n distance = distance > camera.upperRadiusLimit ? camera.upperRadiusLimit : distance;\r\n }\r\n\r\n return distance;\r\n }\r\n\r\n /**\r\n * Keeps the camera above the ground plane. If the user pulls the camera below the ground plane, the camera\r\n * is automatically returned to its default position (expected to be above ground plane).\r\n */\r\n private _maintainCameraAboveGround(): void {\r\n if (this._elevationReturnTime < 0) {\r\n return;\r\n }\r\n\r\n const timeSinceInteraction = PrecisionDate.Now - this._lastInteractionTime;\r\n const defaultBeta = Math.PI * 0.5 - this._defaultElevation;\r\n const limitBeta = Math.PI * 0.5;\r\n\r\n // Bring the camera back up if below the ground plane\r\n if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > limitBeta && timeSinceInteraction >= this._elevationReturnWaitTime) {\r\n this._betaIsAnimating = true;\r\n\r\n //Transition to new position\r\n this.stopAllAnimations();\r\n\r\n if (!this._betaTransition) {\r\n this._betaTransition = Animation.CreateAnimation(\"beta\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n\r\n const animatabe = Animation.TransitionTo(\r\n \"beta\",\r\n defaultBeta,\r\n this._attachedCamera,\r\n this._attachedCamera.getScene(),\r\n 60,\r\n this._betaTransition,\r\n this._elevationReturnTime,\r\n () => {\r\n this._clearAnimationLocks();\r\n this.stopAllAnimations();\r\n }\r\n );\r\n\r\n if (animatabe) {\r\n this._animatables.push(animatabe);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns the frustum slope based on the canvas ratio and camera FOV\r\n * @returns The frustum slope represented as a Vector2 with X and Y slopes\r\n */\r\n private _getFrustumSlope(): Vector2 {\r\n // Calculate the viewport ratio\r\n // Aspect Ratio is Height/Width.\r\n const camera = this._attachedCamera;\r\n\r\n if (!camera) {\r\n return Vector2.Zero();\r\n }\r\n\r\n const engine = camera.getScene().getEngine();\r\n const aspectRatio = engine.getAspectRatio(camera);\r\n\r\n // Camera FOV is the vertical field of view (top-bottom) in radians.\r\n // Slope of the frustum top/bottom planes in view space, relative to the forward vector.\r\n const frustumSlopeY = Math.tan(camera.fov / 2);\r\n\r\n // Slope of the frustum left/right planes in view space, relative to the forward vector.\r\n // Provides the amount that one side (e.g. left) of the frustum gets wider for every unit\r\n // along the forward vector.\r\n const frustumSlopeX = frustumSlopeY * aspectRatio;\r\n\r\n return new Vector2(frustumSlopeX, frustumSlopeY);\r\n }\r\n\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the arcCamera properties.\r\n */\r\n private _clearAnimationLocks(): void {\r\n this._betaIsAnimating = false;\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.isUserIsMoving) {\r\n this._lastInteractionTime = PrecisionDate.Now;\r\n this.stopAllAnimations();\r\n this._clearAnimationLocks();\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\r\n while (this._animatables.length) {\r\n if (this._animatables[0]) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n }\r\n this._animatables.shift();\r\n }\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the user is moving the camera\r\n */\r\n public get isUserIsMoving(): 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 // Statics\r\n\r\n /**\r\n * The camera can move all the way towards the mesh.\r\n */\r\n public static IgnoreBoundsSizeMode = 0;\r\n\r\n /**\r\n * The camera is not allowed to zoom closer to the mesh than the point at which the adjusted bounding sphere touches the frustum sides\r\n */\r\n public static FitFrustumSidesMode = 1;\r\n}\r\n"]}
1
+ {"version":3,"file":"framingBehavior.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Behaviors/Cameras/framingBehavior.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,eAAe;IAA5B;QAQI;;WAEG;QACI,0CAAqC,GAAG,IAAI,UAAU,EAAQ,CAAC;QAE9D,UAAK,GAAG,eAAe,CAAC,mBAAmB,CAAC;QAC5C,iBAAY,GAAG,GAAG,CAAC;QACnB,mBAAc,GAAG,GAAG,CAAC;QACrB,sBAAiB,GAAG,GAAG,CAAC;QACxB,yBAAoB,GAAG,IAAI,CAAC;QAC5B,6BAAwB,GAAG,IAAI,CAAC;QAChC,wBAAmB,GAAG,KAAK,CAAC;QAC5B,iBAAY,GAAG,IAAI,CAAC;QAgI5B;;;WAGG;QACI,0CAAqC,GAAG,IAAI,CAAC;QAO5C,mBAAc,GAAG,KAAK,CAAC;QACvB,yBAAoB,GAAG,CAAC,QAAQ,CAAC;QAyEzC,kBAAkB;QACV,iBAAY,GAAG,IAAI,KAAK,EAAc,CAAC;QACvC,qBAAgB,GAAG,KAAK,CAAC;IAmTrC,CAAC;IA7hBG;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,SAAS,CAAC;IACrB,CAAC;IA0BD;;OAEG;IACH,IAAW,IAAI,CAAC,IAAY;Q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EAAE,CAAC;SAC/B;IACL,CAAC;IAED;;OAEG;IACI,iBAAiB;QACpB,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,eAAe,CAAC,UAAU,GAAG,EAAE,CAAC;SACxC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC7B,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;gBACtB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC;gBAC3C,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aAC/B;YACD,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;SAC7B;IACL,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,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;;AA3fD;;GAEG;AACW,8BAAc,GAAG,IAAI,eAAe,EAAE,CAAC;AAErD;;GAEG;AACW,0BAAU,GAAG,cAAc,CAAC,oBAAoB,CAAC;AAqf/D,UAAU;AAEV;;GAEG;AACW,oCAAoB,GAAG,CAAC,CAAC;AAEvC;;GAEG;AACW,mCAAmB,GAAG,CAAC,CAAC","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport { ExponentialEase, EasingFunction } from \"../../Animations/easing\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { PointerInfoPre } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\n\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport type { Animatable } from \"../../Animations/animatable\";\r\nimport { Animation } from \"../../Animations/animation\";\r\n\r\n/**\r\n * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior\r\n */\r\nexport class FramingBehavior implements Behavior<ArcRotateCamera> {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n public get name(): string {\r\n return \"Framing\";\r\n }\r\n\r\n /**\r\n * An event triggered when the animation to zoom on target mesh has ended\r\n */\r\n public onTargetFramingAnimationEndObservable = new Observable<void>();\r\n\r\n private _mode = FramingBehavior.FitFrustumSidesMode;\r\n private _radiusScale = 1.0;\r\n private _positionScale = 0.5;\r\n private _defaultElevation = 0.3;\r\n private _elevationReturnTime = 1500;\r\n private _elevationReturnWaitTime = 1000;\r\n private _zoomStopsAnimation = false;\r\n private _framingTime = 1500;\r\n\r\n /**\r\n * The easing function used by animations\r\n */\r\n public static EasingFunction = new ExponentialEase();\r\n\r\n /**\r\n * The easing mode used by animations\r\n */\r\n public static EasingMode = EasingFunction.EASINGMODE_EASEINOUT;\r\n\r\n /**\r\n * Sets the current mode used by the behavior\r\n */\r\n public set mode(mode: number) {\r\n this._mode = mode;\r\n }\r\n\r\n /**\r\n * Gets current mode used by the behavior.\r\n */\r\n public get mode(): number {\r\n return this._mode;\r\n }\r\n\r\n /**\r\n * Sets the scale applied to the radius (1 by default)\r\n */\r\n public set radiusScale(radius: number) {\r\n this._radiusScale = radius;\r\n }\r\n\r\n /**\r\n * Gets the scale applied to the radius\r\n */\r\n public get radiusScale(): number {\r\n return this._radiusScale;\r\n }\r\n\r\n /**\r\n * Sets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n public set positionScale(scale: number) {\r\n this._positionScale = scale;\r\n }\r\n\r\n /**\r\n * Gets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n public get positionScale(): number {\r\n return this._positionScale;\r\n }\r\n\r\n /**\r\n * Sets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n public set defaultElevation(elevation: number) {\r\n this._defaultElevation = elevation;\r\n }\r\n\r\n /**\r\n * Gets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n public get defaultElevation() {\r\n return this._defaultElevation;\r\n }\r\n\r\n /**\r\n * Sets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n public set elevationReturnTime(speed: number) {\r\n this._elevationReturnTime = speed;\r\n }\r\n\r\n /**\r\n * Gets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n public get elevationReturnTime(): number {\r\n return this._elevationReturnTime;\r\n }\r\n\r\n /**\r\n * Sets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n public set elevationReturnWaitTime(time: number) {\r\n this._elevationReturnWaitTime = time;\r\n }\r\n\r\n /**\r\n * Gets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n public get elevationReturnWaitTime(): number {\r\n return this._elevationReturnWaitTime;\r\n }\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 transition time when framing the mesh, in milliseconds\r\n */\r\n public set framingTime(time: number) {\r\n this._framingTime = time;\r\n }\r\n\r\n /**\r\n * Gets the transition time when framing the mesh, in milliseconds\r\n */\r\n public get framingTime() {\r\n return this._framingTime;\r\n }\r\n\r\n /**\r\n * Define if the behavior should automatically change the configured\r\n * camera limits and sensibilities.\r\n */\r\n public autoCorrectCameraLimitsAndSensibility = true;\r\n\r\n // Default behavior functions\r\n private _onPrePointerObservableObserver: Nullable<Observer<PointerInfoPre>>;\r\n private _onAfterCheckInputsObserver: Nullable<Observer<Camera>>;\r\n private _onMeshTargetChangedObserver: Nullable<Observer<Nullable<AbstractMesh>>>;\r\n private _attachedCamera: Nullable<ArcRotateCamera>;\r\n private _isPointerDown = false;\r\n private _lastInteractionTime = -Infinity;\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 FramingBehavior.EasingFunction.setEasingMode(FramingBehavior.EasingMode);\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._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add((mesh) => {\r\n if (mesh) {\r\n this.zoomOnMesh(mesh, undefined, () => {\r\n this.onTargetFramingAnimationEndObservable.notifyObservers();\r\n });\r\n }\r\n });\r\n\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\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 // Maintain the camera above the ground. If the user pulls the camera beneath the ground plane, lift it\r\n // back to the default position after a given timeout\r\n this._maintainCameraAboveGround();\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\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 if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n\r\n this._attachedCamera = null;\r\n }\r\n\r\n // Framing control\r\n private _animatables = new Array<Animatable>();\r\n private _betaIsAnimating = false;\r\n private _betaTransition: Animation;\r\n private _radiusTransition: Animation;\r\n private _vectorTransition: Animation;\r\n\r\n /**\r\n * Targets the given mesh and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n public zoomOnMesh(mesh: AbstractMesh, focusOnOriginXZ: boolean = false, onAnimationEnd: Nullable<() => void> = null): void {\r\n mesh.computeWorldMatrix(true);\r\n\r\n const boundingBox = mesh.getBoundingInfo().boundingBox;\r\n this.zoomOnBoundingInfo(boundingBox.minimumWorld, boundingBox.maximumWorld, focusOnOriginXZ, onAnimationEnd);\r\n }\r\n\r\n /**\r\n * Targets the given mesh with its children and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n public zoomOnMeshHierarchy(mesh: AbstractMesh, focusOnOriginXZ: boolean = false, onAnimationEnd: Nullable<() => void> = null): void {\r\n mesh.computeWorldMatrix(true);\r\n\r\n const boundingBox = mesh.getHierarchyBoundingVectors(true);\r\n this.zoomOnBoundingInfo(boundingBox.min, boundingBox.max, focusOnOriginXZ, onAnimationEnd);\r\n }\r\n\r\n /**\r\n * Targets the given meshes with their children and updates zoom level accordingly.\r\n * @param meshes The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n public zoomOnMeshesHierarchy(meshes: AbstractMesh[], focusOnOriginXZ: boolean = false, onAnimationEnd: Nullable<() => void> = null): void {\r\n const min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n for (let i = 0; i < meshes.length; i++) {\r\n const boundingInfo = meshes[i].getHierarchyBoundingVectors(true);\r\n Vector3.CheckExtends(boundingInfo.min, min, max);\r\n Vector3.CheckExtends(boundingInfo.max, min, max);\r\n }\r\n\r\n this.zoomOnBoundingInfo(min, max, focusOnOriginXZ, onAnimationEnd);\r\n }\r\n\r\n /**\r\n * Targets the bounding box info defined by its extends and updates zoom level accordingly.\r\n * @param minimumWorld Determines the smaller position of the bounding box extend\r\n * @param maximumWorld Determines the bigger position of the bounding box extend\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n public zoomOnBoundingInfo(minimumWorld: Vector3, maximumWorld: Vector3, focusOnOriginXZ: boolean = false, onAnimationEnd: Nullable<() => void> = null): void {\r\n let zoomTarget: Vector3;\r\n\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n\r\n // Find target by interpolating from bottom of bounding box in world-space to top via framingPositionY\r\n const bottom = minimumWorld.y;\r\n const top = maximumWorld.y;\r\n const zoomTargetY = bottom + (top - bottom) * this._positionScale;\r\n const radiusWorld = maximumWorld.subtract(minimumWorld).scale(0.5);\r\n\r\n if (focusOnOriginXZ) {\r\n zoomTarget = new Vector3(0, zoomTargetY, 0);\r\n } else {\r\n const centerWorld = minimumWorld.add(radiusWorld);\r\n zoomTarget = new Vector3(centerWorld.x, zoomTargetY, centerWorld.z);\r\n }\r\n\r\n if (!this._vectorTransition) {\r\n this._vectorTransition = Animation.CreateAnimation(\"target\", Animation.ANIMATIONTYPE_VECTOR3, 60, FramingBehavior.EasingFunction);\r\n }\r\n\r\n this._betaIsAnimating = true;\r\n let animatable = Animation.TransitionTo(\"target\", zoomTarget, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime);\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n\r\n // sets the radius and lower radius bounds\r\n // Small delta ensures camera is not always at lower zoom limit.\r\n let radius = 0;\r\n if (this._mode === FramingBehavior.FitFrustumSidesMode) {\r\n const position = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n this._attachedCamera.lowerRadiusLimit = radiusWorld.length() + this._attachedCamera.minZ;\r\n }\r\n radius = position;\r\n } else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n radius = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility && this._attachedCamera.lowerRadiusLimit === null) {\r\n this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;\r\n }\r\n }\r\n\r\n // Set sensibilities\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n const extend = maximumWorld.subtract(minimumWorld).length();\r\n this._attachedCamera.panningSensibility = 5000 / extend;\r\n this._attachedCamera.wheelPrecision = 100 / radius;\r\n }\r\n\r\n // transition to new radius\r\n if (!this._radiusTransition) {\r\n this._radiusTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n\r\n animatable = Animation.TransitionTo(\"radius\", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, () => {\r\n this.stopAllAnimations();\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n\r\n if (this._attachedCamera && this._attachedCamera.useInputToRestoreState) {\r\n this._attachedCamera.storeState();\r\n }\r\n });\r\n\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n }\r\n\r\n /**\r\n * Calculates the lowest radius for the camera based on the bounding box of the mesh.\r\n * @param minimumWorld\r\n * @param maximumWorld\r\n * @returns The minimum distance from the primary mesh's center point at which the camera must be kept in order\r\n *\t\t to fully enclose the mesh in the viewing frustum.\r\n */\r\n protected _calculateLowerRadiusFromModelBoundingSphere(minimumWorld: Vector3, maximumWorld: Vector3): number {\r\n const size = maximumWorld.subtract(minimumWorld);\r\n const boxVectorGlobalDiagonal = size.length();\r\n const frustumSlope: Vector2 = this._getFrustumSlope();\r\n\r\n // Formula for setting distance\r\n // (Good explanation: http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene)\r\n const radiusWithoutFraming = boxVectorGlobalDiagonal * 0.5;\r\n\r\n // Horizon distance\r\n const radius = radiusWithoutFraming * this._radiusScale;\r\n const distanceForHorizontalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.x * frustumSlope.x));\r\n const distanceForVerticalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.y * frustumSlope.y));\r\n let distance = Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);\r\n const camera = this._attachedCamera;\r\n\r\n if (!camera) {\r\n return 0;\r\n }\r\n\r\n if (camera.lowerRadiusLimit && this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n // Don't exceed the requested limit\r\n distance = distance < camera.lowerRadiusLimit ? camera.lowerRadiusLimit : distance;\r\n }\r\n\r\n // Don't exceed the upper radius limit\r\n if (camera.upperRadiusLimit) {\r\n distance = distance > camera.upperRadiusLimit ? camera.upperRadiusLimit : distance;\r\n }\r\n\r\n return distance;\r\n }\r\n\r\n /**\r\n * Keeps the camera above the ground plane. If the user pulls the camera below the ground plane, the camera\r\n * is automatically returned to its default position (expected to be above ground plane).\r\n */\r\n private _maintainCameraAboveGround(): void {\r\n if (this._elevationReturnTime < 0) {\r\n return;\r\n }\r\n\r\n const timeSinceInteraction = PrecisionDate.Now - this._lastInteractionTime;\r\n const defaultBeta = Math.PI * 0.5 - this._defaultElevation;\r\n const limitBeta = Math.PI * 0.5;\r\n\r\n // Bring the camera back up if below the ground plane\r\n if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > limitBeta && timeSinceInteraction >= this._elevationReturnWaitTime) {\r\n this._betaIsAnimating = true;\r\n\r\n //Transition to new position\r\n this.stopAllAnimations();\r\n\r\n if (!this._betaTransition) {\r\n this._betaTransition = Animation.CreateAnimation(\"beta\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n\r\n const animatabe = Animation.TransitionTo(\r\n \"beta\",\r\n defaultBeta,\r\n this._attachedCamera,\r\n this._attachedCamera.getScene(),\r\n 60,\r\n this._betaTransition,\r\n this._elevationReturnTime,\r\n () => {\r\n this._clearAnimationLocks();\r\n this.stopAllAnimations();\r\n }\r\n );\r\n\r\n if (animatabe) {\r\n this._animatables.push(animatabe);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns the frustum slope based on the canvas ratio and camera FOV\r\n * @returns The frustum slope represented as a Vector2 with X and Y slopes\r\n */\r\n private _getFrustumSlope(): Vector2 {\r\n // Calculate the viewport ratio\r\n // Aspect Ratio is Height/Width.\r\n const camera = this._attachedCamera;\r\n\r\n if (!camera) {\r\n return Vector2.Zero();\r\n }\r\n\r\n const engine = camera.getScene().getEngine();\r\n const aspectRatio = engine.getAspectRatio(camera);\r\n\r\n // Camera FOV is the vertical field of view (top-bottom) in radians.\r\n // Slope of the frustum top/bottom planes in view space, relative to the forward vector.\r\n const frustumSlopeY = Math.tan(camera.fov / 2);\r\n\r\n // Slope of the frustum left/right planes in view space, relative to the forward vector.\r\n // Provides the amount that one side (e.g. left) of the frustum gets wider for every unit\r\n // along the forward vector.\r\n const frustumSlopeX = frustumSlopeY * aspectRatio;\r\n\r\n return new Vector2(frustumSlopeX, frustumSlopeY);\r\n }\r\n\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the arcCamera properties.\r\n */\r\n private _clearAnimationLocks(): void {\r\n this._betaIsAnimating = false;\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.isUserIsMoving) {\r\n this._lastInteractionTime = PrecisionDate.Now;\r\n this.stopAllAnimations();\r\n this._clearAnimationLocks();\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\r\n while (this._animatables.length) {\r\n if (this._animatables[0]) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n }\r\n this._animatables.shift();\r\n }\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the user is moving the camera\r\n */\r\n public get isUserIsMoving(): 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 // Statics\r\n\r\n /**\r\n * The camera can move all the way towards the mesh.\r\n */\r\n public static IgnoreBoundsSizeMode = 0;\r\n\r\n /**\r\n * The camera is not allowed to zoom closer to the mesh than the point at which the adjusted bounding sphere touches the frustum sides\r\n */\r\n public static FitFrustumSidesMode = 1;\r\n}\r\n"]}
@@ -65,6 +65,8 @@ export declare class PointerDragBehavior implements Behavior<AbstractMesh> {
65
65
  * * dragDistance along the drag axis
66
66
  * * dragPlaneNormal normal of the current drag plane used during the drag
67
67
  * * dragPlanePoint in world space where the drag intersects the drag plane
68
+ *
69
+ * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
68
70
  */
69
71
  onDragObservable: Observable<{
70
72
  delta: Vector3;
@@ -75,6 +77,9 @@ export declare class PointerDragBehavior implements Behavior<AbstractMesh> {
75
77
  }>;
76
78
  /**
77
79
  * Fires each time a drag begins (eg. mouse down on mesh)
80
+ * * dragPlanePoint in world space where the drag intersects the drag plane
81
+ *
82
+ * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
78
83
  */
79
84
  onDragStartObservable: Observable<{
80
85
  dragPlanePoint: Vector3;
@@ -82,6 +87,9 @@ export declare class PointerDragBehavior implements Behavior<AbstractMesh> {
82
87
  }>;
83
88
  /**
84
89
  * Fires each time a drag ends (eg. mouse release after drag)
90
+ * * dragPlanePoint in world space where the drag intersects the drag plane
91
+ *
92
+ * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
85
93
  */
86
94
  onDragEndObservable: Observable<{
87
95
  dragPlanePoint: Vector3;
@@ -56,14 +56,22 @@ export class PointerDragBehavior {
56
56
  * * dragDistance along the drag axis
57
57
  * * dragPlaneNormal normal of the current drag plane used during the drag
58
58
  * * dragPlanePoint in world space where the drag intersects the drag plane
59
+ *
60
+ * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
59
61
  */
60
62
  this.onDragObservable = new Observable();
61
63
  /**
62
64
  * Fires each time a drag begins (eg. mouse down on mesh)
65
+ * * dragPlanePoint in world space where the drag intersects the drag plane
66
+ *
67
+ * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
63
68
  */
64
69
  this.onDragStartObservable = new Observable();
65
70
  /**
66
71
  * Fires each time a drag ends (eg. mouse release after drag)
72
+ * * dragPlanePoint in world space where the drag intersects the drag plane
73
+ *
74
+ * (if validatedDrag is used, the position of the attached mesh might not equal dragPlanePoint)
67
75
  */
68
76
  this.onDragEndObservable = new Observable();
69
77
  /**
@@ -200,7 +208,6 @@ export class PointerDragBehavior {
200
208
  // If behavior is disabled before releaseDrag is ever called, call it now.
201
209
  if (this._attachedToElement) {
202
210
  this.releaseDrag();
203
- this._activeDragButton = -1;
204
211
  }
205
212
  return;
206
213
  }
@@ -224,7 +231,6 @@ export class PointerDragBehavior {
224
231
  this.currentDraggingPointerId == pointerInfo.event.pointerId &&
225
232
  this._activeDragButton === pointerInfo.event.button) {
226
233
  this.releaseDrag();
227
- this._activeDragButton = -1;
228
234
  }
229
235
  }
230
236
  else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {
@@ -282,6 +288,7 @@ export class PointerDragBehavior {
282
288
  this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerId });
283
289
  }
284
290
  this.currentDraggingPointerId = -1;
291
+ this._activeDragButton = -1;
285
292
  this._moving = false;
286
293
  // Reattach camera controls
287
294
  if (this.detachCameraControls && this._attachedToElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {
@@ -488,7 +495,6 @@ export class PointerDragBehavior {
488
495
  this._dragPlane.dispose();
489
496
  }
490
497
  this.releaseDrag();
491
- this._activeDragButton = -1;
492
498
  }
493
499
  }
494
500
  PointerDragBehavior._AnyMouseId = -2;