@babylonjs/core 5.45.2 → 5.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (525) hide show
  1. package/Actions/condition.js +23 -23
  2. package/Actions/condition.js.map +1 -1
  3. package/Animations/animatable.js +48 -48
  4. package/Animations/animatable.js.map +1 -1
  5. package/Animations/animation.js +53 -53
  6. package/Animations/animation.js.map +1 -1
  7. package/Animations/animationGroup.js +53 -53
  8. package/Animations/animationGroup.js.map +1 -1
  9. package/Animations/runtimeAnimation.js +36 -36
  10. package/Animations/runtimeAnimation.js.map +1 -1
  11. package/Audio/audioEngine.js +14 -14
  12. package/Audio/audioEngine.js.map +1 -1
  13. package/Audio/audioSceneComponent.js +14 -14
  14. package/Audio/audioSceneComponent.js.map +1 -1
  15. package/Audio/sound.js +47 -47
  16. package/Audio/sound.js.map +1 -1
  17. package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +1 -1
  18. package/Behaviors/Meshes/fadeInOutBehavior.js +11 -11
  19. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  20. package/Behaviors/Meshes/pointerDragBehavior.js +34 -34
  21. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  22. package/Bones/bone.js +15 -15
  23. package/Bones/bone.js.map +1 -1
  24. package/Bones/boneIKController.js +9 -9
  25. package/Bones/boneIKController.js.map +1 -1
  26. package/Bones/boneLookController.js +50 -50
  27. package/Bones/boneLookController.js.map +1 -1
  28. package/Bones/skeleton.js +35 -35
  29. package/Bones/skeleton.js.map +1 -1
  30. package/Buffers/buffer.js +14 -14
  31. package/Buffers/buffer.js.map +1 -1
  32. package/Buffers/dataBuffer.js +6 -6
  33. package/Buffers/dataBuffer.js.map +1 -1
  34. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +42 -42
  35. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
  36. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +18 -18
  37. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  38. package/Cameras/VR/vrExperienceHelper.js +178 -178
  39. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  40. package/Cameras/arcRotateCamera.js +176 -176
  41. package/Cameras/arcRotateCamera.js.map +1 -1
  42. package/Cameras/camera.js +90 -90
  43. package/Cameras/camera.js.map +1 -1
  44. package/Cameras/flyCamera.js +82 -82
  45. package/Cameras/flyCamera.js.map +1 -1
  46. package/Cameras/freeCamera.js +54 -54
  47. package/Cameras/freeCamera.js.map +1 -1
  48. package/Compute/computeShader.js +12 -12
  49. package/Compute/computeShader.js.map +1 -1
  50. package/Culling/ray.d.ts +1 -1
  51. package/Debug/axesViewer.js +12 -12
  52. package/Debug/axesViewer.js.map +1 -1
  53. package/Debug/debugLayer.js +21 -21
  54. package/Debug/debugLayer.js.map +1 -1
  55. package/Debug/directionalLightFrustumViewer.js +20 -20
  56. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  57. package/Debug/rayHelper.js +10 -10
  58. package/Debug/rayHelper.js.map +1 -1
  59. package/Debug/skeletonViewer.js +81 -81
  60. package/Debug/skeletonViewer.js.map +1 -1
  61. package/DeviceInput/InputDevices/deviceSource.d.ts +1 -1
  62. package/DeviceInput/InputDevices/deviceSourceManager.js +31 -31
  63. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  64. package/DeviceInput/InputDevices/deviceTypes.d.ts +1 -1
  65. package/DeviceInput/internalDeviceSourceManager.d.ts +2 -2
  66. package/Engines/Extensions/engine.computeShader.d.ts +3 -3
  67. package/Engines/Extensions/engine.multiRender.js +1 -1
  68. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  69. package/Engines/Extensions/engine.query.d.ts +1 -1
  70. package/Engines/Extensions/engine.renderTarget.d.ts +1 -1
  71. package/Engines/Extensions/engine.renderTarget.js +1 -1
  72. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  73. package/Engines/Native/nativeDataStream.d.ts +1 -1
  74. package/Engines/Native/nativeHardwareTexture.js +3 -3
  75. package/Engines/Native/nativeHardwareTexture.js.map +1 -1
  76. package/Engines/Native/nativeInterfaces.d.ts +5 -5
  77. package/Engines/Native/nativePipelineContext.js +7 -7
  78. package/Engines/Native/nativePipelineContext.js.map +1 -1
  79. package/Engines/Native/nativeRenderTargetWrapper.js +6 -6
  80. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  81. package/Engines/Processors/shaderCodeInliner.js +4 -4
  82. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  83. package/Engines/Processors/shaderProcessingOptions.d.ts +1 -1
  84. package/Engines/WebGL/webGLHardwareTexture.js +3 -3
  85. package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
  86. package/Engines/WebGPU/webgpuBufferManager.js +3 -3
  87. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  88. package/Engines/WebGPU/webgpuCacheBindGroups.js +6 -6
  89. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  90. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +5 -5
  91. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  92. package/Engines/WebGPU/webgpuClearQuad.js +11 -11
  93. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  94. package/Engines/WebGPU/webgpuComputeContext.js +7 -7
  95. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  96. package/Engines/WebGPU/webgpuComputePipelineContext.js +4 -4
  97. package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
  98. package/Engines/WebGPU/webgpuDrawContext.js +7 -7
  99. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  100. package/Engines/WebGPU/webgpuHardwareTexture.js +9 -9
  101. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  102. package/Engines/WebGPU/webgpuMaterialContext.js +5 -5
  103. package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
  104. package/Engines/WebGPU/webgpuOcclusionQuery.js +10 -10
  105. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  106. package/Engines/WebGPU/webgpuPipelineContext.js +6 -6
  107. package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
  108. package/Engines/WebGPU/webgpuQuerySet.js +3 -3
  109. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  110. package/Engines/WebGPU/webgpuShaderProcessingContext.js +3 -3
  111. package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
  112. package/Engines/WebGPU/webgpuTextureHelper.js +3 -3
  113. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  114. package/Engines/WebGPU/webgpuTimestampQuery.js +3 -3
  115. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  116. package/Engines/engine.js +134 -134
  117. package/Engines/engine.js.map +1 -1
  118. package/Engines/nativeEngine.js +6 -6
  119. package/Engines/nativeEngine.js.map +1 -1
  120. package/Engines/nullEngine.js +25 -25
  121. package/Engines/nullEngine.js.map +1 -1
  122. package/Engines/renderTargetWrapper.js +25 -25
  123. package/Engines/renderTargetWrapper.js.map +1 -1
  124. package/Engines/thinEngine.js +243 -243
  125. package/Engines/thinEngine.js.map +1 -1
  126. package/Engines/webgpuEngine.js +132 -132
  127. package/Engines/webgpuEngine.js.map +1 -1
  128. package/Events/keyboardEvents.js +10 -10
  129. package/Events/keyboardEvents.js.map +1 -1
  130. package/Events/pointerEvents.js +9 -9
  131. package/Events/pointerEvents.js.map +1 -1
  132. package/Gamepads/Controllers/poseEnabledController.js +9 -9
  133. package/Gamepads/Controllers/poseEnabledController.js.map +1 -1
  134. package/Gamepads/Controllers/webVRController.js +13 -13
  135. package/Gamepads/Controllers/webVRController.js.map +1 -1
  136. package/Gamepads/gamepad.js +20 -20
  137. package/Gamepads/gamepad.js.map +1 -1
  138. package/Gizmos/axisDragGizmo.js +45 -45
  139. package/Gizmos/axisDragGizmo.js.map +1 -1
  140. package/Gizmos/axisScaleGizmo.js +12 -12
  141. package/Gizmos/axisScaleGizmo.js.map +1 -1
  142. package/Gizmos/boundingBoxGizmo.js +74 -74
  143. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  144. package/Gizmos/gizmo.js +34 -34
  145. package/Gizmos/gizmo.js.map +1 -1
  146. package/Gizmos/gizmoManager.js +40 -40
  147. package/Gizmos/gizmoManager.js.map +1 -1
  148. package/Gizmos/planeDragGizmo.js +23 -23
  149. package/Gizmos/planeDragGizmo.js.map +1 -1
  150. package/Gizmos/planeRotationGizmo.js +12 -12
  151. package/Gizmos/planeRotationGizmo.js.map +1 -1
  152. package/Gizmos/positionGizmo.js +40 -40
  153. package/Gizmos/positionGizmo.js.map +1 -1
  154. package/Gizmos/rotationGizmo.js +47 -47
  155. package/Gizmos/rotationGizmo.js.map +1 -1
  156. package/Gizmos/scaleGizmo.js +41 -41
  157. package/Gizmos/scaleGizmo.js.map +1 -1
  158. package/Helpers/environmentHelper.js +18 -18
  159. package/Helpers/environmentHelper.js.map +1 -1
  160. package/Helpers/textureDome.js +96 -96
  161. package/Helpers/textureDome.js.map +1 -1
  162. package/IAccessibilityTag.d.ts +2 -2
  163. package/Instrumentation/engineInstrumentation.js +21 -21
  164. package/Instrumentation/engineInstrumentation.js.map +1 -1
  165. package/Instrumentation/sceneInstrumentation.js +90 -90
  166. package/Instrumentation/sceneInstrumentation.js.map +1 -1
  167. package/Layers/effectLayer.js +48 -48
  168. package/Layers/effectLayer.js.map +1 -1
  169. package/Layers/glowLayer.js +32 -32
  170. package/Layers/glowLayer.js.map +1 -1
  171. package/Layers/highlightLayer.js +26 -26
  172. package/Layers/highlightLayer.js.map +1 -1
  173. package/Layers/layer.js +40 -40
  174. package/Layers/layer.js.map +1 -1
  175. package/LensFlares/lensFlare.js +15 -15
  176. package/LensFlares/lensFlare.js.map +1 -1
  177. package/LensFlares/lensFlareSystem.js +4 -4
  178. package/LensFlares/lensFlareSystem.js.map +1 -1
  179. package/Lights/Shadows/cascadedShadowGenerator.js +18 -18
  180. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  181. package/Lights/Shadows/shadowGenerator.js +115 -115
  182. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  183. package/Lights/directionalLight.js +31 -31
  184. package/Lights/directionalLight.js.map +1 -1
  185. package/Lights/light.js +72 -72
  186. package/Lights/light.js.map +1 -1
  187. package/Lights/pointLight.js +18 -18
  188. package/Lights/pointLight.js.map +1 -1
  189. package/Lights/spotLight.js +30 -30
  190. package/Lights/spotLight.js.map +1 -1
  191. package/Loading/sceneLoader.d.ts +1 -1
  192. package/Materials/Background/backgroundMaterial.js +124 -124
  193. package/Materials/Background/backgroundMaterial.js.map +1 -1
  194. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +8 -8
  195. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  196. package/Materials/Node/Blocks/Dual/lightBlock.js +14 -14
  197. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  198. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +9 -9
  199. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  200. package/Materials/Node/Blocks/Dual/textureBlock.js +26 -26
  201. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  202. package/Materials/Node/Blocks/Input/inputBlock.js +34 -34
  203. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  204. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +14 -14
  205. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  206. package/Materials/Node/Blocks/PBR/reflectionBlock.js +16 -16
  207. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  208. package/Materials/Node/Blocks/customBlock.js +7 -7
  209. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  210. package/Materials/Node/Blocks/gradientBlock.js +13 -13
  211. package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
  212. package/Materials/Node/Blocks/triPlanarBlock.js +30 -30
  213. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  214. package/Materials/Node/nodeMaterial.d.ts +1 -1
  215. package/Materials/Node/nodeMaterial.js +60 -60
  216. package/Materials/Node/nodeMaterial.js.map +1 -1
  217. package/Materials/Node/nodeMaterialBlock.js +35 -35
  218. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  219. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +50 -50
  220. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  221. package/Materials/PBR/pbrAnisotropicConfiguration.js +5 -5
  222. package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
  223. package/Materials/PBR/pbrBRDFConfiguration.js +4 -4
  224. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  225. package/Materials/PBR/pbrBaseMaterial.js +52 -52
  226. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  227. package/Materials/PBR/pbrBaseSimpleMaterial.js +17 -17
  228. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  229. package/Materials/PBR/pbrClearCoatConfiguration.js +5 -5
  230. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  231. package/Materials/PBR/pbrIridescenceConfiguration.js +5 -5
  232. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  233. package/Materials/PBR/pbrMaterial.js +209 -209
  234. package/Materials/PBR/pbrMaterial.js.map +1 -1
  235. package/Materials/PBR/pbrSheenConfiguration.js +5 -5
  236. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  237. package/Materials/PBR/pbrSpecularGlossinessMaterial.js +6 -6
  238. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  239. package/Materials/PBR/pbrSubSurfaceConfiguration.js +51 -51
  240. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  241. package/Materials/Textures/baseTexture.js +99 -99
  242. package/Materials/Textures/baseTexture.js.map +1 -1
  243. package/Materials/Textures/cubeTexture.js +61 -61
  244. package/Materials/Textures/cubeTexture.js.map +1 -1
  245. package/Materials/Textures/externalTexture.js +16 -16
  246. package/Materials/Textures/externalTexture.js.map +1 -1
  247. package/Materials/Textures/hdrCubeTexture.js +44 -44
  248. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  249. package/Materials/Textures/internalTexture.js +31 -31
  250. package/Materials/Textures/internalTexture.js.map +1 -1
  251. package/Materials/Textures/mirrorTexture.js +73 -73
  252. package/Materials/Textures/mirrorTexture.js.map +1 -1
  253. package/Materials/Textures/multiRenderTarget.js +47 -47
  254. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  255. package/Materials/Textures/rawTexture2DArray.js +6 -6
  256. package/Materials/Textures/rawTexture2DArray.js.map +1 -1
  257. package/Materials/Textures/renderTargetTexture.js +142 -142
  258. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  259. package/Materials/Textures/texture.d.ts +1 -1
  260. package/Materials/Textures/texture.js +26 -26
  261. package/Materials/Textures/texture.js.map +1 -1
  262. package/Materials/Textures/textureCreationOptions.d.ts +1 -1
  263. package/Materials/Textures/textureSampler.js +20 -20
  264. package/Materials/Textures/textureSampler.js.map +1 -1
  265. package/Materials/Textures/thinRenderTargetTexture.js +6 -6
  266. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  267. package/Materials/Textures/thinTexture.js +39 -39
  268. package/Materials/Textures/thinTexture.js.map +1 -1
  269. package/Materials/Textures/videoTexture.js +40 -40
  270. package/Materials/Textures/videoTexture.js.map +1 -1
  271. package/Materials/drawWrapper.js +6 -6
  272. package/Materials/drawWrapper.js.map +1 -1
  273. package/Materials/effect.js +18 -18
  274. package/Materials/effect.js.map +1 -1
  275. package/Materials/effectRenderer.js +9 -9
  276. package/Materials/effectRenderer.js.map +1 -1
  277. package/Materials/fresnelParameters.d.ts +2 -2
  278. package/Materials/fresnelParameters.js +13 -13
  279. package/Materials/fresnelParameters.js.map +1 -1
  280. package/Materials/material.detailMapConfiguration.js +5 -5
  281. package/Materials/material.detailMapConfiguration.js.map +1 -1
  282. package/Materials/material.js +223 -223
  283. package/Materials/material.js.map +1 -1
  284. package/Materials/materialPluginBase.js +5 -5
  285. package/Materials/materialPluginBase.js.map +1 -1
  286. package/Materials/materialPluginEvent.d.ts +14 -14
  287. package/Materials/materialPluginManager.d.ts +1 -1
  288. package/Materials/multiMaterial.js +16 -16
  289. package/Materials/multiMaterial.js.map +1 -1
  290. package/Materials/shadowDepthWrapper.js +14 -14
  291. package/Materials/shadowDepthWrapper.js.map +1 -1
  292. package/Materials/standardMaterial.js +100 -100
  293. package/Materials/standardMaterial.js.map +1 -1
  294. package/Materials/uniformBufferEffectCommonAccessor.js +3 -3
  295. package/Materials/uniformBufferEffectCommonAccessor.js.map +1 -1
  296. package/Maths/math.functions.js +2 -0
  297. package/Maths/math.functions.js.map +1 -1
  298. package/Maths/math.path.js +11 -11
  299. package/Maths/math.path.js.map +1 -1
  300. package/Maths/math.vector.d.ts +6 -7
  301. package/Maths/math.vector.js +48 -48
  302. package/Maths/math.vector.js.map +1 -1
  303. package/Meshes/Builders/goldbergBuilder.d.ts +2 -2
  304. package/Meshes/Compression/dracoCompression.js +23 -23
  305. package/Meshes/Compression/dracoCompression.js.map +1 -1
  306. package/Meshes/Compression/meshoptCompression.js +9 -9
  307. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  308. package/Meshes/abstractMesh.js +179 -179
  309. package/Meshes/abstractMesh.js.map +1 -1
  310. package/Meshes/geometry.js +32 -32
  311. package/Meshes/geometry.js.map +1 -1
  312. package/Meshes/goldbergMesh.d.ts +1 -1
  313. package/Meshes/linesMesh.js +3 -3
  314. package/Meshes/linesMesh.js.map +1 -1
  315. package/Meshes/mesh.js +165 -165
  316. package/Meshes/mesh.js.map +1 -1
  317. package/Meshes/mesh.vertexData.js.map +1 -1
  318. package/Meshes/polygonMesh.js +5 -5
  319. package/Meshes/polygonMesh.js.map +1 -1
  320. package/Meshes/subMesh.js +59 -59
  321. package/Meshes/subMesh.js.map +1 -1
  322. package/Meshes/transformNode.js +52 -52
  323. package/Meshes/transformNode.js.map +1 -1
  324. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.d.ts +1 -1
  325. package/Misc/PerformanceViewer/performanceViewerCollector.js +12 -12
  326. package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
  327. package/Misc/arrayTools.d.ts +1 -1
  328. package/Misc/copyTextureToTexture.js +3 -3
  329. package/Misc/copyTextureToTexture.js.map +1 -1
  330. package/Misc/coroutine.d.ts +5 -5
  331. package/Misc/deferred.js +9 -9
  332. package/Misc/deferred.js.map +1 -1
  333. package/Misc/depthReducer.js +7 -7
  334. package/Misc/depthReducer.js.map +1 -1
  335. package/Misc/environmentTextureTools.d.ts +1 -1
  336. package/Misc/error.d.ts +1 -1
  337. package/Misc/fileTools.d.ts +5 -5
  338. package/Misc/filesInput.js +6 -6
  339. package/Misc/filesInput.js.map +1 -1
  340. package/Misc/khronosTextureContainer2.js +9 -9
  341. package/Misc/khronosTextureContainer2.js.map +1 -1
  342. package/Misc/observable.js +12 -12
  343. package/Misc/observable.js.map +1 -1
  344. package/Misc/perfCounter.js +16 -16
  345. package/Misc/perfCounter.js.map +1 -1
  346. package/Misc/sceneOptimizer.js +76 -76
  347. package/Misc/sceneOptimizer.js.map +1 -1
  348. package/Misc/stringDictionary.d.ts +1 -1
  349. package/Misc/trajectoryClassifier.js +67 -67
  350. package/Misc/trajectoryClassifier.js.map +1 -1
  351. package/Misc/videoRecorder.js +15 -15
  352. package/Misc/videoRecorder.js.map +1 -1
  353. package/Misc/virtualJoystick.js +12 -12
  354. package/Misc/virtualJoystick.js.map +1 -1
  355. package/Morph/morphTarget.js +28 -28
  356. package/Morph/morphTarget.js.map +1 -1
  357. package/Morph/morphTargetManager.js +18 -18
  358. package/Morph/morphTargetManager.js.map +1 -1
  359. package/Offline/database.js +12 -12
  360. package/Offline/database.js.map +1 -1
  361. package/Particles/EmitterTypes/coneParticleEmitter.js +25 -25
  362. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  363. package/Particles/EmitterTypes/meshParticleEmitter.js +20 -20
  364. package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
  365. package/Particles/baseParticleSystem.js +232 -232
  366. package/Particles/baseParticleSystem.js.map +1 -1
  367. package/Particles/cloudPoint.js +9 -9
  368. package/Particles/cloudPoint.js.map +1 -1
  369. package/Particles/gpuParticleSystem.js +123 -123
  370. package/Particles/gpuParticleSystem.js.map +1 -1
  371. package/Particles/particleSystem.js +102 -102
  372. package/Particles/particleSystem.js.map +1 -1
  373. package/Particles/pointsCloudSystem.js +18 -18
  374. package/Particles/pointsCloudSystem.js.map +1 -1
  375. package/Particles/solidParticle.js +23 -23
  376. package/Particles/solidParticle.js.map +1 -1
  377. package/Physics/v1/physicsEngine.js +14 -14
  378. package/Physics/v1/physicsEngine.js.map +1 -1
  379. package/Physics/v1/physicsImpostor.js +149 -149
  380. package/Physics/v1/physicsImpostor.js.map +1 -1
  381. package/Physics/v2/physicsEngine.js +14 -14
  382. package/Physics/v2/physicsEngine.js.map +1 -1
  383. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +129 -129
  384. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  385. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +68 -68
  386. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  387. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +6 -6
  388. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  389. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +226 -225
  390. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  391. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +10 -10
  392. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  393. package/PostProcesses/anaglyphPostProcess.js +7 -7
  394. package/PostProcesses/anaglyphPostProcess.js.map +1 -1
  395. package/PostProcesses/blackAndWhitePostProcess.js +7 -7
  396. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  397. package/PostProcesses/bloomEffect.js +28 -28
  398. package/PostProcesses/bloomEffect.js.map +1 -1
  399. package/PostProcesses/bloomMergePostProcess.js +7 -7
  400. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  401. package/PostProcesses/blurPostProcess.js +32 -32
  402. package/PostProcesses/blurPostProcess.js.map +1 -1
  403. package/PostProcesses/chromaticAberrationPostProcess.js +7 -7
  404. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  405. package/PostProcesses/circleOfConfusionPostProcess.js +7 -7
  406. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  407. package/PostProcesses/colorCorrectionPostProcess.js +7 -7
  408. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  409. package/PostProcesses/convolutionPostProcess.js +7 -7
  410. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  411. package/PostProcesses/depthOfFieldBlurPostProcess.js +7 -7
  412. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  413. package/PostProcesses/depthOfFieldEffect.js +36 -36
  414. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  415. package/PostProcesses/depthOfFieldMergePostProcess.js +7 -7
  416. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  417. package/PostProcesses/extractHighlightsPostProcess.js +7 -7
  418. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  419. package/PostProcesses/filterPostProcess.js +7 -7
  420. package/PostProcesses/filterPostProcess.js.map +1 -1
  421. package/PostProcesses/grainPostProcess.js +7 -7
  422. package/PostProcesses/grainPostProcess.js.map +1 -1
  423. package/PostProcesses/imageProcessingPostProcess.js +42 -42
  424. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  425. package/PostProcesses/motionBlurPostProcess.js +41 -41
  426. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  427. package/PostProcesses/passPostProcess.js +15 -15
  428. package/PostProcesses/passPostProcess.js.map +1 -1
  429. package/PostProcesses/postProcess.d.ts +2 -2
  430. package/PostProcesses/postProcess.js +123 -123
  431. package/PostProcesses/postProcess.js.map +1 -1
  432. package/PostProcesses/refractionPostProcess.js +21 -21
  433. package/PostProcesses/refractionPostProcess.js.map +1 -1
  434. package/PostProcesses/screenSpaceCurvaturePostProcess.js +7 -7
  435. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  436. package/PostProcesses/screenSpaceReflectionPostProcess.js +19 -19
  437. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  438. package/PostProcesses/sharpenPostProcess.js +7 -7
  439. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  440. package/PostProcesses/stereoscopicInterlacePostProcess.js +14 -14
  441. package/PostProcesses/stereoscopicInterlacePostProcess.js.map +1 -1
  442. package/PostProcesses/tonemapPostProcess.js +7 -7
  443. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  444. package/PostProcesses/volumetricLightScatteringPostProcess.js +11 -11
  445. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  446. package/PostProcesses/vrDistortionCorrectionPostProcess.js +7 -7
  447. package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
  448. package/Rendering/depthPeelingRenderer.js +36 -36
  449. package/Rendering/depthPeelingRenderer.js.map +1 -1
  450. package/Rendering/depthRenderer.js +8 -8
  451. package/Rendering/depthRenderer.js.map +1 -1
  452. package/Rendering/edgesRenderer.js +34 -34
  453. package/Rendering/edgesRenderer.js.map +1 -1
  454. package/Rendering/fluidRenderer/fluidRenderer.js +8 -8
  455. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  456. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +3 -3
  457. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
  458. package/Rendering/fluidRenderer/fluidRenderingObject.js +19 -19
  459. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  460. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +12 -12
  461. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  462. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +18 -18
  463. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  464. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +68 -68
  465. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  466. package/Rendering/fluidRenderer/fluidRenderingTextures.js +29 -29
  467. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
  468. package/Rendering/geometryBufferRenderer.js +44 -44
  469. package/Rendering/geometryBufferRenderer.js.map +1 -1
  470. package/Rendering/prePassRenderer.js +51 -51
  471. package/Rendering/prePassRenderer.js.map +1 -1
  472. package/Rendering/renderingGroup.js +25 -25
  473. package/Rendering/renderingGroup.js.map +1 -1
  474. package/Rendering/renderingManager.js +21 -21
  475. package/Rendering/renderingManager.js.map +1 -1
  476. package/Rendering/subSurfaceConfiguration.js +18 -18
  477. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  478. package/Rendering/utilityLayerRenderer.js +76 -76
  479. package/Rendering/utilityLayerRenderer.js.map +1 -1
  480. package/Sprites/sprite.js +16 -16
  481. package/Sprites/sprite.js.map +1 -1
  482. package/Sprites/spriteManager.js +81 -81
  483. package/Sprites/spriteManager.js.map +1 -1
  484. package/Sprites/spriteMap.js +32 -32
  485. package/Sprites/spriteMap.js.map +1 -1
  486. package/Sprites/spriteRenderer.js +6 -6
  487. package/Sprites/spriteRenderer.js.map +1 -1
  488. package/Sprites/thinSprite.js +22 -22
  489. package/Sprites/thinSprite.js.map +1 -1
  490. package/States/stencilStateComposer.js +10 -10
  491. package/States/stencilStateComposer.js.map +1 -1
  492. package/XR/features/WebXRAnchorSystem.js +7 -7
  493. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  494. package/XR/features/WebXRControllerMovement.d.ts +3 -3
  495. package/XR/features/WebXRControllerMovement.js +97 -97
  496. package/XR/features/WebXRControllerMovement.js.map +1 -1
  497. package/XR/features/WebXRControllerPhysics.js +24 -24
  498. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  499. package/XR/features/WebXRControllerTeleportation.js +26 -26
  500. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  501. package/XR/features/WebXRDOMOverlay.d.ts +1 -1
  502. package/XR/features/WebXRFeaturePointSystem.js +6 -6
  503. package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
  504. package/XR/features/WebXRHandTracking.d.ts +1 -1
  505. package/XR/features/WebXRHandTracking.js +95 -95
  506. package/XR/features/WebXRHandTracking.js.map +1 -1
  507. package/XR/features/WebXRWalkingLocomotion.js +21 -21
  508. package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
  509. package/XR/motionController/webXRAbstractMotionController.d.ts +3 -3
  510. package/XR/motionController/webXRMotionControllerManager.d.ts +1 -1
  511. package/XR/native/nativeXRFrame.js +3 -3
  512. package/XR/native/nativeXRFrame.js.map +1 -1
  513. package/XR/webXRFeaturesManager.d.ts +1 -1
  514. package/XR/webXRLayerWrapper.d.ts +2 -2
  515. package/XR/webXRLayerWrapper.js +17 -17
  516. package/XR/webXRLayerWrapper.js.map +1 -1
  517. package/abstractScene.d.ts +2 -2
  518. package/node.d.ts +1 -1
  519. package/node.js +71 -71
  520. package/node.js.map +1 -1
  521. package/package.json +1 -1
  522. package/scene.js +777 -777
  523. package/scene.js.map +1 -1
  524. package/sceneComponent.d.ts +12 -12
  525. package/types.d.ts +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"sound.js","sourceRoot":"","sources":["../../../../lts/core/generated/Audio/sound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK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AC,WAAW,CAAC,aAAa,CAAC,CAAC;SACvC;QACD,IAAI,WAAW,CAAC,aAAa,EAAE;YAC3B,QAAQ,CAAC,kBAAkB,CAAC,WAAW,CAAC,cAAc,IAAI,GAAG,EAAE,WAAW,CAAC,cAAc,IAAI,GAAG,EAAE,WAAW,CAAC,aAAa,IAAI,CAAC,CAAC,CAAC;YAClI,IAAI,WAAW,CAAC,oBAAoB,EAAE;gBAClC,MAAM,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;gBACjF,QAAQ,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;aAC1D;SACJ;QACD,IAAI,WAAW,CAAC,eAAe,EAAE;YAC7B,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;YACrE,IAAI,aAAa,EAAE;gBACf,QAAQ,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;aACxC;SACJ;QAED,IAAI,WAAW,CAAC,QAAQ,EAAE;YACtB,QAAQ,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;SAC5C;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEO,UAAU,CAAC,KAAc;QAC7B,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE;YACxB,OAAO;SACV;QACD,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;SACzB;QACD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB,CAAC;;AA1jCD;;GAEG;AACW,mCAA6B,GAA2B,CAAC,CAAC,EAAE,EAAE;IACxE,MAAM,WAAW,CAAC,qBAAqB,CAAC,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport type { ISoundOptions } from \"./Interfaces/ISoundOptions\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n/**\r\n * Defines a sound that can be played in the application.\r\n * The sound can either be an ambient track or a simple sound played in reaction to a user action.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic\r\n */\r\nexport class Sound {\r\n /**\r\n * The name of the sound in the scene.\r\n */\r\n public name: string;\r\n /**\r\n * Does the sound autoplay once loaded.\r\n */\r\n public autoplay: boolean = false;\r\n\r\n private _loop = false;\r\n /**\r\n * Does the sound loop after it finishes playing once.\r\n */\r\n public get loop(): boolean {\r\n return this._loop;\r\n }\r\n\r\n public set loop(value: boolean) {\r\n if (value === this._loop) {\r\n return;\r\n }\r\n\r\n this._loop = value;\r\n this.updateOptions({ loop: value });\r\n }\r\n\r\n /**\r\n * Does the sound use a custom attenuation curve to simulate the falloff\r\n * happening when the source gets further away from the camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-your-own-custom-attenuation-function\r\n */\r\n public useCustomAttenuation: boolean = false;\r\n /**\r\n * The sound track id this sound belongs to.\r\n */\r\n public soundTrackId: number;\r\n /**\r\n * Is this sound currently played.\r\n */\r\n public isPlaying: boolean = false;\r\n /**\r\n * Is this sound currently paused.\r\n */\r\n public isPaused: boolean = false;\r\n /**\r\n * Define the reference distance the sound should be heard perfectly.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public refDistance: number = 1;\r\n /**\r\n * Define the roll off factor of spatial sounds.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public rolloffFactor: number = 1;\r\n /**\r\n * Define the max distance the sound should be heard (intensity just became 0 at this point).\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public maxDistance: number = 100;\r\n /**\r\n * Define the distance attenuation model the sound will follow.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public distanceModel: string = \"linear\";\r\n /**\r\n * @internal\r\n * Back Compat\r\n **/\r\n public onended: () => any;\r\n /**\r\n * Gets or sets an object used to store user defined information for the sound.\r\n */\r\n public metadata: any = null;\r\n\r\n /**\r\n * Observable event when the current playing sound finishes.\r\n */\r\n public onEndedObservable = new Observable<Sound>();\r\n\r\n /**\r\n * Gets the current time for the sound.\r\n */\r\n public get currentTime(): number {\r\n if (this._htmlAudioElement) {\r\n return this._htmlAudioElement.currentTime;\r\n }\r\n\r\n if (Engine.audioEngine?.audioContext && (this.isPlaying || this.isPaused)) {\r\n // The `_currentTime` member is only updated when the sound is paused. Add the time since the last start\r\n // to get the actual current time.\r\n const timeSinceLastStart = this.isPaused ? 0 : Engine.audioEngine.audioContext.currentTime - this._startTime;\r\n return this._currentTime + timeSinceLastStart;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Does this sound enables spatial sound.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public get spatialSound(): boolean {\r\n return this._spatialSound;\r\n }\r\n /**\r\n * Does this sound enables spatial sound.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public set spatialSound(newValue: boolean) {\r\n this._spatialSound = newValue;\r\n if (this._spatialSound && Engine.audioEngine?.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n this._createSpatialParameters();\r\n }\r\n }\r\n private _spatialSound: boolean = false;\r\n private _panningModel: string = \"equalpower\";\r\n private _playbackRate: number = 1;\r\n private _streaming: boolean = false;\r\n private _startTime: number = 0;\r\n private _currentTime: number = 0;\r\n private _position: Vector3 = Vector3.Zero();\r\n private _localDirection: Vector3 = new Vector3(1, 0, 0);\r\n private _volume: number = 1;\r\n private _isReadyToPlay: boolean = false;\r\n private _isDirectional: boolean = false;\r\n private _readyToPlayCallback: Nullable<() => any>;\r\n private _audioBuffer: Nullable<AudioBuffer>;\r\n private _soundSource: Nullable<AudioBufferSourceNode>;\r\n private _streamingSource: AudioNode;\r\n private _soundPanner: Nullable<PannerNode>;\r\n private _soundGain: Nullable<GainNode>;\r\n private _inputAudioNode: Nullable<AudioNode>;\r\n private _outputAudioNode: Nullable<AudioNode>;\r\n // Used if you'd like to create a directional sound.\r\n // If not set, the sound will be omnidirectional\r\n private _coneInnerAngle: number = 360;\r\n private _coneOuterAngle: number = 360;\r\n private _coneOuterGain: number = 0;\r\n private _scene: Scene;\r\n private _connectedTransformNode: Nullable<TransformNode>;\r\n private _customAttenuationFunction: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number;\r\n private _registerFunc: Nullable<(connectedMesh: TransformNode) => void>;\r\n private _isOutputConnected = false;\r\n private _htmlAudioElement: HTMLAudioElement;\r\n private _urlType: \"Unknown\" | \"String\" | \"Array\" | \"ArrayBuffer\" | \"MediaStream\" | \"AudioBuffer\" | \"MediaElement\" = \"Unknown\";\r\n private _length?: number;\r\n private _offset?: number;\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _SceneComponentInitialization: (scene: Scene) => void = (_) => {\r\n throw _WarnImport(\"AudioSceneComponent\");\r\n };\r\n\r\n /**\r\n * Create a sound and attach it to a scene\r\n * @param name Name of your sound\r\n * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer, it also works with MediaStreams and AudioBuffers\r\n * @param scene defines the scene the sound belongs to\r\n * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played\r\n * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming\r\n */\r\n constructor(name: string, urlOrArrayBuffer: any, scene?: Nullable<Scene>, readyToPlayCallback: Nullable<() => void> = null, options?: ISoundOptions) {\r\n this.name = name;\r\n scene = scene || EngineStore.LastCreatedScene;\r\n if (!scene) {\r\n return;\r\n }\r\n this._scene = scene;\r\n Sound._SceneComponentInitialization(scene);\r\n\r\n this._readyToPlayCallback = readyToPlayCallback;\r\n // Default custom attenuation function is a linear attenuation\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n this._customAttenuationFunction = (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => {\r\n if (currentDistance < maxDistance) {\r\n return currentVolume * (1 - currentDistance / maxDistance);\r\n } else {\r\n return 0;\r\n }\r\n };\r\n if (options) {\r\n this.autoplay = options.autoplay || false;\r\n this._loop = options.loop || false;\r\n // if volume === 0, we need another way to check this option\r\n if (options.volume !== undefined) {\r\n this._volume = options.volume;\r\n }\r\n this._spatialSound = options.spatialSound ?? false;\r\n this.maxDistance = options.maxDistance ?? 100;\r\n this.useCustomAttenuation = options.useCustomAttenuation ?? false;\r\n this.rolloffFactor = options.rolloffFactor || 1;\r\n this.refDistance = options.refDistance || 1;\r\n this.distanceModel = options.distanceModel || \"linear\";\r\n this._playbackRate = options.playbackRate || 1;\r\n this._streaming = options.streaming ?? false;\r\n this._length = options.length;\r\n this._offset = options.offset;\r\n }\r\n\r\n if (Engine.audioEngine?.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n this._soundGain = Engine.audioEngine.audioContext.createGain();\r\n this._soundGain!.gain.value = this._volume;\r\n this._inputAudioNode = this._soundGain;\r\n this._outputAudioNode = this._soundGain;\r\n if (this._spatialSound) {\r\n this._createSpatialParameters();\r\n }\r\n this._scene.mainSoundTrack.addSound(this);\r\n let validParameter = true;\r\n\r\n // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound\r\n if (urlOrArrayBuffer) {\r\n try {\r\n if (typeof urlOrArrayBuffer === \"string\") {\r\n this._urlType = \"String\";\r\n } else if (urlOrArrayBuffer instanceof ArrayBuffer) {\r\n this._urlType = \"ArrayBuffer\";\r\n } else if (urlOrArrayBuffer instanceof HTMLMediaElement) {\r\n this._urlType = \"MediaElement\";\r\n } else if (urlOrArrayBuffer instanceof MediaStream) {\r\n this._urlType = \"MediaStream\";\r\n } else if (urlOrArrayBuffer instanceof AudioBuffer) {\r\n this._urlType = \"AudioBuffer\";\r\n } else if (Array.isArray(urlOrArrayBuffer)) {\r\n this._urlType = \"Array\";\r\n }\r\n\r\n let urls: string[] = [];\r\n let codecSupportedFound = false;\r\n\r\n switch (this._urlType) {\r\n case \"MediaElement\":\r\n this._streaming = true;\r\n this._isReadyToPlay = true;\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaElementSource(urlOrArrayBuffer);\r\n\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n break;\r\n case \"MediaStream\":\r\n this._streaming = true;\r\n this._isReadyToPlay = true;\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaStreamSource(urlOrArrayBuffer);\r\n\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n break;\r\n case \"ArrayBuffer\":\r\n if ((<ArrayBuffer>urlOrArrayBuffer).byteLength > 0) {\r\n codecSupportedFound = true;\r\n this._soundLoaded(urlOrArrayBuffer);\r\n }\r\n break;\r\n case \"AudioBuffer\":\r\n this._audioBufferLoaded(urlOrArrayBuffer);\r\n break;\r\n case \"String\":\r\n urls.push(urlOrArrayBuffer);\r\n // eslint-disable-next-line no-fallthrough\r\n case \"Array\":\r\n if (urls.length === 0) {\r\n urls = urlOrArrayBuffer;\r\n }\r\n // If we found a supported format, we load it immediately and stop the loop\r\n for (let i = 0; i < urls.length; i++) {\r\n const url = urls[i];\r\n codecSupportedFound =\r\n (options && options.skipCodecCheck) ||\r\n (url.indexOf(\".mp3\", url.length - 4) !== -1 && Engine.audioEngine.isMP3supported) ||\r\n (url.indexOf(\".ogg\", url.length - 4) !== -1 && Engine.audioEngine.isOGGsupported) ||\r\n url.indexOf(\".wav\", url.length - 4) !== -1 ||\r\n url.indexOf(\".m4a\", url.length - 4) !== -1 ||\r\n url.indexOf(\".mp4\", url.length - 4) !== -1 ||\r\n url.indexOf(\"blob:\") !== -1;\r\n if (codecSupportedFound) {\r\n // Loading sound\r\n if (!this._streaming) {\r\n this._scene._loadFile(\r\n url,\r\n (data) => {\r\n this._soundLoaded(data as ArrayBuffer);\r\n },\r\n undefined,\r\n true,\r\n true,\r\n (exception) => {\r\n if (exception) {\r\n Logger.Error(\"XHR \" + exception.status + \" error on: \" + url + \".\");\r\n }\r\n Logger.Error(\"Sound creation aborted.\");\r\n this._scene.mainSoundTrack.removeSound(this);\r\n }\r\n );\r\n }\r\n // Streaming sound using HTML5 Audio tag\r\n else {\r\n this._htmlAudioElement = new Audio(url);\r\n this._htmlAudioElement.controls = false;\r\n this._htmlAudioElement.loop = this.loop;\r\n Tools.SetCorsBehavior(url, this._htmlAudioElement);\r\n this._htmlAudioElement.preload = \"auto\";\r\n this._htmlAudioElement.addEventListener(\"canplaythrough\", () => {\r\n this._isReadyToPlay = true;\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n });\r\n document.body.appendChild(this._htmlAudioElement);\r\n this._htmlAudioElement.load();\r\n }\r\n break;\r\n }\r\n }\r\n break;\r\n default:\r\n validParameter = false;\r\n break;\r\n }\r\n\r\n if (!validParameter) {\r\n Logger.Error(\"Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.\");\r\n } else {\r\n if (!codecSupportedFound) {\r\n this._isReadyToPlay = true;\r\n // Simulating a ready to play event to avoid breaking code path\r\n if (this._readyToPlayCallback) {\r\n setTimeout(() => {\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n } catch (ex) {\r\n Logger.Error(\"Unexpected error. Sound creation aborted.\");\r\n this._scene.mainSoundTrack.removeSound(this);\r\n }\r\n }\r\n } else {\r\n // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers\r\n this._scene.mainSoundTrack.addSound(this);\r\n if (Engine.audioEngine && !Engine.audioEngine.WarnedWebAudioUnsupported) {\r\n Logger.Error(\"Web Audio is not supported by your browser.\");\r\n Engine.audioEngine.WarnedWebAudioUnsupported = true;\r\n }\r\n // Simulating a ready to play event to avoid breaking code for non web audio browsers\r\n if (this._readyToPlayCallback) {\r\n setTimeout(() => {\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Release the sound and its associated resources\r\n */\r\n public dispose() {\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n if (this.isPlaying) {\r\n this.stop();\r\n }\r\n this._isReadyToPlay = false;\r\n if (this.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.removeSound(this);\r\n } else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[this.soundTrackId].removeSound(this);\r\n }\r\n if (this._soundGain) {\r\n this._soundGain.disconnect();\r\n this._soundGain = null;\r\n }\r\n if (this._soundPanner) {\r\n this._soundPanner.disconnect();\r\n this._soundPanner = null;\r\n }\r\n if (this._soundSource) {\r\n this._soundSource.disconnect();\r\n this._soundSource = null;\r\n }\r\n this._audioBuffer = null;\r\n\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n this._htmlAudioElement.src = \"\";\r\n document.body.removeChild(this._htmlAudioElement);\r\n }\r\n\r\n if (this._streamingSource) {\r\n this._streamingSource.disconnect();\r\n }\r\n\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._connectedTransformNode = null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets if the sounds is ready to be played or not.\r\n * @returns true if ready, otherwise false\r\n */\r\n public isReady(): boolean {\r\n return this._isReadyToPlay;\r\n }\r\n\r\n /**\r\n * Get the current class name.\r\n * @returns current class name\r\n */\r\n public getClassName(): string {\r\n return \"Sound\";\r\n }\r\n\r\n private _audioBufferLoaded(buffer: AudioBuffer) {\r\n if (!Engine.audioEngine?.audioContext) {\r\n return;\r\n }\r\n this._audioBuffer = buffer;\r\n this._isReadyToPlay = true;\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n }\r\n\r\n private _soundLoaded(audioData: ArrayBuffer) {\r\n if (!Engine.audioEngine?.audioContext) {\r\n return;\r\n }\r\n Engine.audioEngine.audioContext.decodeAudioData(\r\n audioData,\r\n (buffer) => {\r\n this._audioBufferLoaded(buffer);\r\n },\r\n (err: any) => {\r\n Logger.Error(\"Error while decoding audio data for: \" + this.name + \" / Error: \" + err);\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Sets the data of the sound from an audiobuffer\r\n * @param audioBuffer The audioBuffer containing the data\r\n */\r\n public setAudioBuffer(audioBuffer: AudioBuffer): void {\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n this._audioBuffer = audioBuffer;\r\n this._isReadyToPlay = true;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the current sounds options such as maxdistance, loop...\r\n * @param options A JSON object containing values named as the object properties\r\n */\r\n public updateOptions(options: ISoundOptions): void {\r\n if (options) {\r\n this.loop = options.loop ?? this.loop;\r\n this.maxDistance = options.maxDistance ?? this.maxDistance;\r\n this.useCustomAttenuation = options.useCustomAttenuation ?? this.useCustomAttenuation;\r\n this.rolloffFactor = options.rolloffFactor ?? this.rolloffFactor;\r\n this.refDistance = options.refDistance ?? this.refDistance;\r\n this.distanceModel = options.distanceModel ?? this.distanceModel;\r\n this._playbackRate = options.playbackRate ?? this._playbackRate;\r\n this._length = options.length ?? undefined;\r\n this._setOffset(options.offset ?? undefined);\r\n this.setVolume(options.volume ?? this._volume);\r\n this._updateSpatialParameters();\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n if (this._htmlAudioElement.loop !== this.loop) {\r\n this._htmlAudioElement.loop = this.loop;\r\n }\r\n } else {\r\n if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n if (this._soundSource.loop !== this.loop) {\r\n this._soundSource.loop = this.loop;\r\n }\r\n if (this._offset !== undefined && this._soundSource.loopStart !== this._offset) {\r\n this._soundSource.loopStart = this._offset;\r\n }\r\n if (this._length !== undefined && this._length !== this._soundSource.loopEnd) {\r\n this._soundSource.loopEnd = (this._offset! | 0) + this._length!;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _createSpatialParameters() {\r\n if (Engine.audioEngine?.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n if (this._scene.headphone) {\r\n this._panningModel = \"HRTF\";\r\n }\r\n this._soundPanner = this._soundPanner ?? Engine.audioEngine.audioContext.createPanner();\r\n if (this._soundPanner && this._outputAudioNode) {\r\n this._updateSpatialParameters();\r\n this._soundPanner.connect(this._outputAudioNode);\r\n this._inputAudioNode = this._soundPanner;\r\n }\r\n }\r\n }\r\n\r\n private _updateSpatialParameters() {\r\n if (this._spatialSound && this._soundPanner) {\r\n if (this.useCustomAttenuation) {\r\n // Tricks to disable in a way embedded Web Audio attenuation\r\n this._soundPanner.distanceModel = \"linear\";\r\n this._soundPanner.maxDistance = Number.MAX_VALUE;\r\n this._soundPanner.refDistance = 1;\r\n this._soundPanner.rolloffFactor = 1;\r\n this._soundPanner.panningModel = this._panningModel as any;\r\n } else {\r\n this._soundPanner.distanceModel = this.distanceModel as any;\r\n this._soundPanner.maxDistance = this.maxDistance;\r\n this._soundPanner.refDistance = this.refDistance;\r\n this._soundPanner.rolloffFactor = this.rolloffFactor;\r\n this._soundPanner.panningModel = this._panningModel as any;\r\n }\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() {\r\n this._panningModel = \"HRTF\";\r\n this._switchPanningModel();\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() {\r\n this._panningModel = \"equalpower\";\r\n this._switchPanningModel();\r\n }\r\n\r\n private _switchPanningModel() {\r\n if (Engine.audioEngine?.canUseWebAudio && this._spatialSound && this._soundPanner) {\r\n this._soundPanner.panningModel = this._panningModel as any;\r\n }\r\n }\r\n\r\n /**\r\n * Connect this sound to a sound track audio node like gain...\r\n * @param soundTrackAudioNode the sound track audio node to connect to\r\n */\r\n public connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void {\r\n if (Engine.audioEngine?.canUseWebAudio && this._outputAudioNode) {\r\n if (this._isOutputConnected) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode.connect(soundTrackAudioNode);\r\n this._isOutputConnected = true;\r\n }\r\n }\r\n\r\n /**\r\n * Transform this sound into a directional source\r\n * @param coneInnerAngle Size of the inner cone in degree\r\n * @param coneOuterAngle Size of the outer cone in degree\r\n * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)\r\n */\r\n public setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void {\r\n if (coneOuterAngle < coneInnerAngle) {\r\n Logger.Error(\"setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = coneInnerAngle;\r\n this._coneOuterAngle = coneOuterAngle;\r\n this._coneOuterGain = coneOuterGain;\r\n this._isDirectional = true;\r\n\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n public get directionalConeInnerAngle(): number {\r\n return this._coneInnerAngle;\r\n }\r\n\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n public set directionalConeInnerAngle(value: number) {\r\n if (value != this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n Logger.Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n\r\n this._coneInnerAngle = value;\r\n if (Engine.audioEngine?.canUseWebAudio && this._spatialSound && this._soundPanner) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n public get directionalConeOuterAngle(): number {\r\n return this._coneOuterAngle;\r\n }\r\n\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n public set directionalConeOuterAngle(value: number) {\r\n if (value != this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n Logger.Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n\r\n this._coneOuterAngle = value;\r\n if (Engine.audioEngine?.canUseWebAudio && this._spatialSound && this._soundPanner) {\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the position of the emitter if spatial sound is enabled\r\n * @param newPosition Defines the new position\r\n */\r\n public setPosition(newPosition: Vector3): void {\r\n if (newPosition.equals(this._position)) {\r\n return;\r\n }\r\n this._position.copyFrom(newPosition);\r\n\r\n if (Engine.audioEngine?.canUseWebAudio && this._spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.positionX.value = this._position.x;\r\n this._soundPanner.positionY.value = this._position.y;\r\n this._soundPanner.positionZ.value = this._position.z;\r\n }\r\n }\r\n\r\n /**\r\n * Sets the local direction of the emitter if spatial sound is enabled\r\n * @param newLocalDirection Defines the new local direction\r\n */\r\n public setLocalDirectionToMesh(newLocalDirection: Vector3): void {\r\n this._localDirection = newLocalDirection;\r\n\r\n if (Engine.audioEngine?.canUseWebAudio && this._connectedTransformNode && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n }\r\n\r\n private _updateDirection() {\r\n if (!this._connectedTransformNode || !this._soundPanner) {\r\n return;\r\n }\r\n\r\n const mat = this._connectedTransformNode.getWorldMatrix();\r\n const direction = Vector3.TransformNormal(this._localDirection, mat);\r\n direction.normalize();\r\n this._soundPanner.orientationX.value = direction.x;\r\n this._soundPanner.orientationY.value = direction.y;\r\n this._soundPanner.orientationZ.value = direction.z;\r\n }\r\n\r\n /** @internal */\r\n public updateDistanceFromListener() {\r\n if (Engine.audioEngine?.canUseWebAudio && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) {\r\n const distance = this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);\r\n this._soundGain.gain.value = this._customAttenuationFunction(this._volume, distance, this.maxDistance, this.refDistance, this.rolloffFactor);\r\n }\r\n }\r\n\r\n /**\r\n * Sets a new custom attenuation function for the sound.\r\n * @param callback Defines the function used for the attenuation\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-your-own-custom-attenuation-function\r\n */\r\n public setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void {\r\n this._customAttenuationFunction = callback;\r\n }\r\n\r\n /**\r\n * Play the sound\r\n * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.\r\n * @param offset (optional) Start the sound at a specific time in seconds\r\n * @param length (optional) Sound duration (in seconds)\r\n */\r\n public play(time?: number, offset?: number, length?: number): void {\r\n if (this._isReadyToPlay && this._scene.audioEnabled && Engine.audioEngine?.audioContext) {\r\n try {\r\n let startTime = time ? Engine.audioEngine?.audioContext.currentTime + time : Engine.audioEngine?.audioContext.currentTime;\r\n if (!this._soundSource || !this._streamingSource) {\r\n if (this._spatialSound && this._soundPanner) {\r\n if (!isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.positionX.value = this._position.x;\r\n this._soundPanner.positionY.value = this._position.y;\r\n this._soundPanner.positionZ.value = this._position.z;\r\n }\r\n if (this._isDirectional) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n this._soundPanner.coneOuterGain = this._coneOuterGain;\r\n if (this._connectedTransformNode) {\r\n this._updateDirection();\r\n } else {\r\n this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z);\r\n }\r\n }\r\n }\r\n }\r\n if (this._streaming) {\r\n if (!this._streamingSource) {\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement);\r\n this._htmlAudioElement.onended = () => {\r\n this._onended();\r\n };\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n this._streamingSource.disconnect();\r\n if (this._inputAudioNode) {\r\n this._streamingSource.connect(this._inputAudioNode);\r\n }\r\n if (this._htmlAudioElement) {\r\n // required to manage properly the new suspended default state of Chrome\r\n // When the option 'streaming: true' is used, we need first to wait for\r\n // the audio engine to be unlocked by a user gesture before trying to play\r\n // an HTML Audio element\r\n const tryToPlay = () => {\r\n if (Engine.audioEngine?.unlocked) {\r\n const playPromise = this._htmlAudioElement.play();\r\n\r\n // In browsers that don’t yet support this functionality,\r\n // playPromise won’t be defined.\r\n if (playPromise !== undefined) {\r\n playPromise.catch(() => {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n Engine.audioEngine?.lock();\r\n if (this.loop || this.autoplay) {\r\n Engine.audioEngine?.onAudioUnlockedObservable.addOnce(() => {\r\n tryToPlay();\r\n });\r\n }\r\n });\r\n }\r\n } else {\r\n if (this.loop || this.autoplay) {\r\n Engine.audioEngine?.onAudioUnlockedObservable.addOnce(() => {\r\n tryToPlay();\r\n });\r\n }\r\n }\r\n };\r\n tryToPlay();\r\n }\r\n } else {\r\n const tryToPlay = () => {\r\n if (Engine.audioEngine?.audioContext) {\r\n length = length || this._length;\r\n\r\n if (offset !== undefined) {\r\n this._setOffset(offset);\r\n }\r\n\r\n if (this._soundSource) {\r\n const oldSource = this._soundSource;\r\n oldSource.onended = () => {\r\n oldSource.disconnect();\r\n };\r\n }\r\n this._soundSource = Engine.audioEngine?.audioContext.createBufferSource();\r\n if (this._soundSource && this._inputAudioNode) {\r\n this._soundSource.buffer = this._audioBuffer;\r\n this._soundSource.connect(this._inputAudioNode);\r\n this._soundSource.loop = this.loop;\r\n if (offset !== undefined) {\r\n this._soundSource.loopStart = offset;\r\n }\r\n if (length !== undefined) {\r\n this._soundSource.loopEnd = (offset! | 0) + length!;\r\n }\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n this._soundSource.onended = () => {\r\n this._onended();\r\n };\r\n startTime = time ? Engine.audioEngine?.audioContext!.currentTime + time : Engine.audioEngine.audioContext!.currentTime;\r\n const actualOffset = ((this.isPaused ? this.currentTime : 0) + (this._offset ?? 0)) % this._soundSource!.buffer!.duration;\r\n this._soundSource!.start(startTime, actualOffset, this.loop ? undefined : length);\r\n }\r\n }\r\n };\r\n\r\n if (Engine.audioEngine?.audioContext.state === \"suspended\") {\r\n // Wait a bit for FF as context seems late to be ready.\r\n setTimeout(() => {\r\n if (Engine.audioEngine?.audioContext!.state === \"suspended\") {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n Engine.audioEngine.lock();\r\n if (this.loop || this.autoplay) {\r\n Engine.audioEngine.onAudioUnlockedObservable.addOnce(() => {\r\n tryToPlay();\r\n });\r\n }\r\n } else {\r\n tryToPlay();\r\n }\r\n }, 500);\r\n } else {\r\n tryToPlay();\r\n }\r\n }\r\n this._startTime = startTime;\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n } catch (ex) {\r\n Logger.Error(\"Error while trying to play audio: \" + this.name + \", \" + ex.message);\r\n }\r\n }\r\n }\r\n\r\n private _onended() {\r\n this.isPlaying = false;\r\n this._startTime = 0;\r\n this._currentTime = 0;\r\n if (this.onended) {\r\n this.onended();\r\n }\r\n this.onEndedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Stop the sound\r\n * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.\r\n */\r\n public stop(time?: number): void {\r\n if (this.isPlaying) {\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n // Test needed for Firefox or it will generate an Invalid State Error\r\n if (this._htmlAudioElement.currentTime > 0) {\r\n this._htmlAudioElement.currentTime = 0;\r\n }\r\n } else {\r\n this._streamingSource.disconnect();\r\n }\r\n this.isPlaying = false;\r\n } else if (Engine.audioEngine?.audioContext && this._soundSource) {\r\n const stopTime = time ? Engine.audioEngine.audioContext.currentTime + time : undefined;\r\n this._soundSource.onended = () => {\r\n this.isPlaying = false;\r\n this.isPaused = false;\r\n this._startTime = 0;\r\n this._currentTime = 0;\r\n if (this._soundSource) {\r\n this._soundSource.onended = () => void 0;\r\n }\r\n this._onended();\r\n };\r\n this._soundSource.stop(stopTime);\r\n }\r\n } else if (this.isPaused) {\r\n this.isPaused = false;\r\n this._startTime = 0;\r\n this._currentTime = 0;\r\n }\r\n }\r\n\r\n /**\r\n * Put the sound in pause\r\n */\r\n public pause(): void {\r\n if (this.isPlaying) {\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n } else {\r\n this._streamingSource.disconnect();\r\n }\r\n this.isPlaying = false;\r\n this.isPaused = true;\r\n } else if (Engine.audioEngine?.audioContext && this._soundSource) {\r\n this._soundSource.onended = () => void 0;\r\n this._soundSource.stop();\r\n this.isPlaying = false;\r\n this.isPaused = true;\r\n this._currentTime += Engine.audioEngine.audioContext.currentTime - this._startTime;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets a dedicated volume for this sounds\r\n * @param newVolume Define the new volume of the sound\r\n * @param time Define time for gradual change to new volume\r\n */\r\n public setVolume(newVolume: number, time?: number): void {\r\n if (Engine.audioEngine?.canUseWebAudio && this._soundGain) {\r\n if (time && Engine.audioEngine.audioContext) {\r\n this._soundGain.gain.cancelScheduledValues(Engine.audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, Engine.audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.linearRampToValueAtTime(newVolume, Engine.audioEngine.audioContext.currentTime + time);\r\n } else {\r\n this._soundGain.gain.value = newVolume;\r\n }\r\n }\r\n this._volume = newVolume;\r\n }\r\n\r\n /**\r\n * Set the sound play back rate\r\n * @param newPlaybackRate Define the playback rate the sound should be played at\r\n */\r\n public setPlaybackRate(newPlaybackRate: number): void {\r\n this._playbackRate = newPlaybackRate;\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n } else if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the sound play back rate.\r\n * @returns the play back rate of the sound\r\n */\r\n public getPlaybackRate(): number {\r\n return this._playbackRate;\r\n }\r\n\r\n /**\r\n * Gets the volume of the sound.\r\n * @returns the volume of the sound\r\n */\r\n public getVolume(): number {\r\n return this._volume;\r\n }\r\n\r\n /**\r\n * Attach the sound to a dedicated mesh\r\n * @param transformNode The transform node to connect the sound with\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#attaching-a-sound-to-a-mesh\r\n */\r\n public attachToMesh(transformNode: TransformNode): void {\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n }\r\n this._connectedTransformNode = transformNode;\r\n if (!this._spatialSound) {\r\n this._spatialSound = true;\r\n this._createSpatialParameters();\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n }\r\n this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode);\r\n this._registerFunc = (transformNode: TransformNode) => this._onRegisterAfterWorldMatrixUpdate(transformNode);\r\n this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc);\r\n }\r\n\r\n /**\r\n * Detach the sound from the previously attached mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#attaching-a-sound-to-a-mesh\r\n */\r\n public detachFromMesh() {\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n this._connectedTransformNode = null;\r\n }\r\n }\r\n\r\n private _onRegisterAfterWorldMatrixUpdate(node: TransformNode): void {\r\n if (!(<any>node).getBoundingInfo) {\r\n this.setPosition(node.absolutePosition);\r\n } else {\r\n const mesh = node as AbstractMesh;\r\n const boundingInfo = mesh.getBoundingInfo();\r\n this.setPosition(boundingInfo.boundingSphere.centerWorld);\r\n }\r\n if (Engine.audioEngine?.canUseWebAudio && this._isDirectional && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current sound in the scene.\r\n * @returns the new sound clone\r\n */\r\n public clone(): Nullable<Sound> {\r\n if (!this._streaming) {\r\n const setBufferAndRun = () => {\r\n if (this._isReadyToPlay) {\r\n clonedSound._audioBuffer = this.getAudioBuffer();\r\n clonedSound._isReadyToPlay = true;\r\n if (clonedSound.autoplay) {\r\n clonedSound.play(0, this._offset, this._length);\r\n }\r\n } else {\r\n setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n\r\n const currentOptions = {\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this._spatialSound,\r\n maxDistance: this.maxDistance,\r\n useCustomAttenuation: this.useCustomAttenuation,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n };\r\n\r\n const clonedSound = new Sound(this.name + \"_cloned\", new ArrayBuffer(0), this._scene, null, currentOptions);\r\n if (this.useCustomAttenuation) {\r\n clonedSound.setAttenuationFunction(this._customAttenuationFunction);\r\n }\r\n clonedSound.setPosition(this._position);\r\n clonedSound.setPlaybackRate(this._playbackRate);\r\n setBufferAndRun();\r\n\r\n return clonedSound;\r\n }\r\n // Can't clone a streaming sound\r\n else {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current underlying audio buffer containing the data\r\n * @returns the audio buffer\r\n */\r\n public getAudioBuffer(): Nullable<AudioBuffer> {\r\n return this._audioBuffer;\r\n }\r\n\r\n /**\r\n * Gets the WebAudio AudioBufferSourceNode, lets you keep track of and stop instances of this Sound.\r\n * @returns the source node\r\n */\r\n public getSoundSource(): Nullable<AudioBufferSourceNode> {\r\n return this._soundSource;\r\n }\r\n\r\n /**\r\n * Gets the WebAudio GainNode, gives you precise control over the gain of instances of this Sound.\r\n * @returns the gain node\r\n */\r\n public getSoundGain(): Nullable<GainNode> {\r\n return this._soundGain;\r\n }\r\n\r\n /**\r\n * Serializes the Sound in a JSON representation\r\n * @returns the JSON representation of the sound\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {\r\n name: this.name,\r\n url: this.name,\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this._spatialSound,\r\n maxDistance: this.maxDistance,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n playbackRate: this._playbackRate,\r\n panningModel: this._panningModel,\r\n soundTrackId: this.soundTrackId,\r\n metadata: this.metadata,\r\n };\r\n\r\n if (this._spatialSound) {\r\n if (this._connectedTransformNode) {\r\n serializationObject.connectedMeshId = this._connectedTransformNode.id;\r\n }\r\n\r\n serializationObject.position = this._position.asArray();\r\n serializationObject.refDistance = this.refDistance;\r\n serializationObject.distanceModel = this.distanceModel;\r\n\r\n serializationObject.isDirectional = this._isDirectional;\r\n serializationObject.localDirectionToMesh = this._localDirection.asArray();\r\n serializationObject.coneInnerAngle = this._coneInnerAngle;\r\n serializationObject.coneOuterAngle = this._coneOuterAngle;\r\n serializationObject.coneOuterGain = this._coneOuterGain;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse a JSON representation of a sound to instantiate in a given scene\r\n * @param parsedSound Define the JSON representation of the sound (usually coming from the serialize method)\r\n * @param scene Define the scene the new parsed sound should be created in\r\n * @param rootUrl Define the rooturl of the load in case we need to fetch relative dependencies\r\n * @param sourceSound Define a sound place holder if do not need to instantiate a new one\r\n * @returns the newly parsed sound\r\n */\r\n public static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound {\r\n const soundName = parsedSound.name;\r\n let soundUrl;\r\n\r\n if (parsedSound.url) {\r\n soundUrl = rootUrl + parsedSound.url;\r\n } else {\r\n soundUrl = rootUrl + soundName;\r\n }\r\n\r\n const options = {\r\n autoplay: parsedSound.autoplay,\r\n loop: parsedSound.loop,\r\n volume: parsedSound.volume,\r\n spatialSound: parsedSound.spatialSound,\r\n maxDistance: parsedSound.maxDistance,\r\n rolloffFactor: parsedSound.rolloffFactor,\r\n refDistance: parsedSound.refDistance,\r\n distanceModel: parsedSound.distanceModel,\r\n playbackRate: parsedSound.playbackRate,\r\n };\r\n\r\n let newSound: Sound;\r\n\r\n if (!sourceSound) {\r\n newSound = new Sound(\r\n soundName,\r\n soundUrl,\r\n scene,\r\n () => {\r\n scene.removePendingData(newSound);\r\n },\r\n options\r\n );\r\n scene.addPendingData(newSound);\r\n } else {\r\n const setBufferAndRun = () => {\r\n if (sourceSound._isReadyToPlay) {\r\n newSound._audioBuffer = sourceSound.getAudioBuffer();\r\n newSound._isReadyToPlay = true;\r\n if (newSound.autoplay) {\r\n newSound.play(0, newSound._offset, newSound._length);\r\n }\r\n } else {\r\n setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n\r\n newSound = new Sound(soundName, new ArrayBuffer(0), scene, null, options);\r\n setBufferAndRun();\r\n }\r\n\r\n if (parsedSound.position) {\r\n const soundPosition = Vector3.FromArray(parsedSound.position);\r\n newSound.setPosition(soundPosition);\r\n }\r\n if (parsedSound.isDirectional) {\r\n newSound.setDirectionalCone(parsedSound.coneInnerAngle || 360, parsedSound.coneOuterAngle || 360, parsedSound.coneOuterGain || 0);\r\n if (parsedSound.localDirectionToMesh) {\r\n const localDirectionToMesh = Vector3.FromArray(parsedSound.localDirectionToMesh);\r\n newSound.setLocalDirectionToMesh(localDirectionToMesh);\r\n }\r\n }\r\n if (parsedSound.connectedMeshId) {\r\n const connectedMesh = scene.getMeshById(parsedSound.connectedMeshId);\r\n if (connectedMesh) {\r\n newSound.attachToMesh(connectedMesh);\r\n }\r\n }\r\n\r\n if (parsedSound.metadata) {\r\n newSound.metadata = parsedSound.metadata;\r\n }\r\n\r\n return newSound;\r\n }\r\n\r\n private _setOffset(value?: number) {\r\n if (this._offset === value) {\r\n return;\r\n }\r\n if (this.isPaused) {\r\n this.stop();\r\n this.isPaused = false;\r\n }\r\n this._offset = value;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"sound.js","sourceRoot":"","sources":["../../../../lts/core/generated/Audio/sound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport type { ISoundOptions } from \"./Interfaces/ISoundOptions\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n/**\r\n * Defines a sound that can be played in the application.\r\n * The sound can either be an ambient track or a simple sound played in reaction to a user action.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic\r\n */\r\nexport class Sound {\r\n /**\r\n * The name of the sound in the scene.\r\n */\r\n public name: string;\r\n /**\r\n * Does the sound autoplay once loaded.\r\n */\r\n public autoplay: boolean = false;\r\n\r\n private _loop = false;\r\n /**\r\n * Does the sound loop after it finishes playing once.\r\n */\r\n public get loop(): boolean {\r\n return this._loop;\r\n }\r\n\r\n public set loop(value: boolean) {\r\n if (value === this._loop) {\r\n return;\r\n }\r\n\r\n this._loop = value;\r\n this.updateOptions({ loop: value });\r\n }\r\n\r\n /**\r\n * Does the sound use a custom attenuation curve to simulate the falloff\r\n * happening when the source gets further away from the camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-your-own-custom-attenuation-function\r\n */\r\n public useCustomAttenuation: boolean = false;\r\n /**\r\n * The sound track id this sound belongs to.\r\n */\r\n public soundTrackId: number;\r\n /**\r\n * Is this sound currently played.\r\n */\r\n public isPlaying: boolean = false;\r\n /**\r\n * Is this sound currently paused.\r\n */\r\n public isPaused: boolean = false;\r\n /**\r\n * Define the reference distance the sound should be heard perfectly.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public refDistance: number = 1;\r\n /**\r\n * Define the roll off factor of spatial sounds.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public rolloffFactor: number = 1;\r\n /**\r\n * Define the max distance the sound should be heard (intensity just became 0 at this point).\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public maxDistance: number = 100;\r\n /**\r\n * Define the distance attenuation model the sound will follow.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public distanceModel: string = \"linear\";\r\n /**\r\n * @internal\r\n * Back Compat\r\n **/\r\n public onended: () => any;\r\n /**\r\n * Gets or sets an object used to store user defined information for the sound.\r\n */\r\n public metadata: any = null;\r\n\r\n /**\r\n * Observable event when the current playing sound finishes.\r\n */\r\n public onEndedObservable = new Observable<Sound>();\r\n\r\n /**\r\n * Gets the current time for the sound.\r\n */\r\n public get currentTime(): number {\r\n if (this._htmlAudioElement) {\r\n return this._htmlAudioElement.currentTime;\r\n }\r\n\r\n if (Engine.audioEngine?.audioContext && (this.isPlaying || this.isPaused)) {\r\n // The `_currentTime` member is only updated when the sound is paused. Add the time since the last start\r\n // to get the actual current time.\r\n const timeSinceLastStart = this.isPaused ? 0 : Engine.audioEngine.audioContext.currentTime - this._startTime;\r\n return this._currentTime + timeSinceLastStart;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Does this sound enables spatial sound.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public get spatialSound(): boolean {\r\n return this._spatialSound;\r\n }\r\n /**\r\n * Does this sound enables spatial sound.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\r\n */\r\n public set spatialSound(newValue: boolean) {\r\n this._spatialSound = newValue;\r\n if (this._spatialSound && Engine.audioEngine?.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n this._createSpatialParameters();\r\n }\r\n }\r\n private _spatialSound: boolean = false;\r\n private _panningModel: string = \"equalpower\";\r\n private _playbackRate: number = 1;\r\n private _streaming: boolean = false;\r\n private _startTime: number = 0;\r\n private _currentTime: number = 0;\r\n private _position: Vector3 = Vector3.Zero();\r\n private _localDirection: Vector3 = new Vector3(1, 0, 0);\r\n private _volume: number = 1;\r\n private _isReadyToPlay: boolean = false;\r\n private _isDirectional: boolean = false;\r\n private _readyToPlayCallback: Nullable<() => any>;\r\n private _audioBuffer: Nullable<AudioBuffer>;\r\n private _soundSource: Nullable<AudioBufferSourceNode>;\r\n private _streamingSource: AudioNode;\r\n private _soundPanner: Nullable<PannerNode>;\r\n private _soundGain: Nullable<GainNode>;\r\n private _inputAudioNode: Nullable<AudioNode>;\r\n private _outputAudioNode: Nullable<AudioNode>;\r\n // Used if you'd like to create a directional sound.\r\n // If not set, the sound will be omnidirectional\r\n private _coneInnerAngle: number = 360;\r\n private _coneOuterAngle: number = 360;\r\n private _coneOuterGain: number = 0;\r\n private _scene: Scene;\r\n private _connectedTransformNode: Nullable<TransformNode>;\r\n private _customAttenuationFunction: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number;\r\n private _registerFunc: Nullable<(connectedMesh: TransformNode) => void>;\r\n private _isOutputConnected = false;\r\n private _htmlAudioElement: HTMLAudioElement;\r\n private _urlType: \"Unknown\" | \"String\" | \"Array\" | \"ArrayBuffer\" | \"MediaStream\" | \"AudioBuffer\" | \"MediaElement\" = \"Unknown\";\r\n private _length?: number;\r\n private _offset?: number;\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _SceneComponentInitialization: (scene: Scene) => void = (_) => {\r\n throw _WarnImport(\"AudioSceneComponent\");\r\n };\r\n\r\n /**\r\n * Create a sound and attach it to a scene\r\n * @param name Name of your sound\r\n * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer, it also works with MediaStreams and AudioBuffers\r\n * @param scene defines the scene the sound belongs to\r\n * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played\r\n * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming\r\n */\r\n constructor(name: string, urlOrArrayBuffer: any, scene?: Nullable<Scene>, readyToPlayCallback: Nullable<() => void> = null, options?: ISoundOptions) {\r\n this.name = name;\r\n scene = scene || EngineStore.LastCreatedScene;\r\n if (!scene) {\r\n return;\r\n }\r\n this._scene = scene;\r\n Sound._SceneComponentInitialization(scene);\r\n\r\n this._readyToPlayCallback = readyToPlayCallback;\r\n // Default custom attenuation function is a linear attenuation\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n this._customAttenuationFunction = (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => {\r\n if (currentDistance < maxDistance) {\r\n return currentVolume * (1 - currentDistance / maxDistance);\r\n } else {\r\n return 0;\r\n }\r\n };\r\n if (options) {\r\n this.autoplay = options.autoplay || false;\r\n this._loop = options.loop || false;\r\n // if volume === 0, we need another way to check this option\r\n if (options.volume !== undefined) {\r\n this._volume = options.volume;\r\n }\r\n this._spatialSound = options.spatialSound ?? false;\r\n this.maxDistance = options.maxDistance ?? 100;\r\n this.useCustomAttenuation = options.useCustomAttenuation ?? false;\r\n this.rolloffFactor = options.rolloffFactor || 1;\r\n this.refDistance = options.refDistance || 1;\r\n this.distanceModel = options.distanceModel || \"linear\";\r\n this._playbackRate = options.playbackRate || 1;\r\n this._streaming = options.streaming ?? false;\r\n this._length = options.length;\r\n this._offset = options.offset;\r\n }\r\n\r\n if (Engine.audioEngine?.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n this._soundGain = Engine.audioEngine.audioContext.createGain();\r\n this._soundGain!.gain.value = this._volume;\r\n this._inputAudioNode = this._soundGain;\r\n this._outputAudioNode = this._soundGain;\r\n if (this._spatialSound) {\r\n this._createSpatialParameters();\r\n }\r\n this._scene.mainSoundTrack.addSound(this);\r\n let validParameter = true;\r\n\r\n // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound\r\n if (urlOrArrayBuffer) {\r\n try {\r\n if (typeof urlOrArrayBuffer === \"string\") {\r\n this._urlType = \"String\";\r\n } else if (urlOrArrayBuffer instanceof ArrayBuffer) {\r\n this._urlType = \"ArrayBuffer\";\r\n } else if (urlOrArrayBuffer instanceof HTMLMediaElement) {\r\n this._urlType = \"MediaElement\";\r\n } else if (urlOrArrayBuffer instanceof MediaStream) {\r\n this._urlType = \"MediaStream\";\r\n } else if (urlOrArrayBuffer instanceof AudioBuffer) {\r\n this._urlType = \"AudioBuffer\";\r\n } else if (Array.isArray(urlOrArrayBuffer)) {\r\n this._urlType = \"Array\";\r\n }\r\n\r\n let urls: string[] = [];\r\n let codecSupportedFound = false;\r\n\r\n switch (this._urlType) {\r\n case \"MediaElement\":\r\n this._streaming = true;\r\n this._isReadyToPlay = true;\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaElementSource(urlOrArrayBuffer);\r\n\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n break;\r\n case \"MediaStream\":\r\n this._streaming = true;\r\n this._isReadyToPlay = true;\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaStreamSource(urlOrArrayBuffer);\r\n\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n break;\r\n case \"ArrayBuffer\":\r\n if ((<ArrayBuffer>urlOrArrayBuffer).byteLength > 0) {\r\n codecSupportedFound = true;\r\n this._soundLoaded(urlOrArrayBuffer);\r\n }\r\n break;\r\n case \"AudioBuffer\":\r\n this._audioBufferLoaded(urlOrArrayBuffer);\r\n break;\r\n case \"String\":\r\n urls.push(urlOrArrayBuffer);\r\n // eslint-disable-next-line no-fallthrough\r\n case \"Array\":\r\n if (urls.length === 0) {\r\n urls = urlOrArrayBuffer;\r\n }\r\n // If we found a supported format, we load it immediately and stop the loop\r\n for (let i = 0; i < urls.length; i++) {\r\n const url = urls[i];\r\n codecSupportedFound =\r\n (options && options.skipCodecCheck) ||\r\n (url.indexOf(\".mp3\", url.length - 4) !== -1 && Engine.audioEngine.isMP3supported) ||\r\n (url.indexOf(\".ogg\", url.length - 4) !== -1 && Engine.audioEngine.isOGGsupported) ||\r\n url.indexOf(\".wav\", url.length - 4) !== -1 ||\r\n url.indexOf(\".m4a\", url.length - 4) !== -1 ||\r\n url.indexOf(\".mp4\", url.length - 4) !== -1 ||\r\n url.indexOf(\"blob:\") !== -1;\r\n if (codecSupportedFound) {\r\n // Loading sound\r\n if (!this._streaming) {\r\n this._scene._loadFile(\r\n url,\r\n (data) => {\r\n this._soundLoaded(data as ArrayBuffer);\r\n },\r\n undefined,\r\n true,\r\n true,\r\n (exception) => {\r\n if (exception) {\r\n Logger.Error(\"XHR \" + exception.status + \" error on: \" + url + \".\");\r\n }\r\n Logger.Error(\"Sound creation aborted.\");\r\n this._scene.mainSoundTrack.removeSound(this);\r\n }\r\n );\r\n }\r\n // Streaming sound using HTML5 Audio tag\r\n else {\r\n this._htmlAudioElement = new Audio(url);\r\n this._htmlAudioElement.controls = false;\r\n this._htmlAudioElement.loop = this.loop;\r\n Tools.SetCorsBehavior(url, this._htmlAudioElement);\r\n this._htmlAudioElement.preload = \"auto\";\r\n this._htmlAudioElement.addEventListener(\"canplaythrough\", () => {\r\n this._isReadyToPlay = true;\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n });\r\n document.body.appendChild(this._htmlAudioElement);\r\n this._htmlAudioElement.load();\r\n }\r\n break;\r\n }\r\n }\r\n break;\r\n default:\r\n validParameter = false;\r\n break;\r\n }\r\n\r\n if (!validParameter) {\r\n Logger.Error(\"Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.\");\r\n } else {\r\n if (!codecSupportedFound) {\r\n this._isReadyToPlay = true;\r\n // Simulating a ready to play event to avoid breaking code path\r\n if (this._readyToPlayCallback) {\r\n setTimeout(() => {\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n } catch (ex) {\r\n Logger.Error(\"Unexpected error. Sound creation aborted.\");\r\n this._scene.mainSoundTrack.removeSound(this);\r\n }\r\n }\r\n } else {\r\n // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers\r\n this._scene.mainSoundTrack.addSound(this);\r\n if (Engine.audioEngine && !Engine.audioEngine.WarnedWebAudioUnsupported) {\r\n Logger.Error(\"Web Audio is not supported by your browser.\");\r\n Engine.audioEngine.WarnedWebAudioUnsupported = true;\r\n }\r\n // Simulating a ready to play event to avoid breaking code for non web audio browsers\r\n if (this._readyToPlayCallback) {\r\n setTimeout(() => {\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Release the sound and its associated resources\r\n */\r\n public dispose() {\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n if (this.isPlaying) {\r\n this.stop();\r\n }\r\n this._isReadyToPlay = false;\r\n if (this.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.removeSound(this);\r\n } else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[this.soundTrackId].removeSound(this);\r\n }\r\n if (this._soundGain) {\r\n this._soundGain.disconnect();\r\n this._soundGain = null;\r\n }\r\n if (this._soundPanner) {\r\n this._soundPanner.disconnect();\r\n this._soundPanner = null;\r\n }\r\n if (this._soundSource) {\r\n this._soundSource.disconnect();\r\n this._soundSource = null;\r\n }\r\n this._audioBuffer = null;\r\n\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n this._htmlAudioElement.src = \"\";\r\n document.body.removeChild(this._htmlAudioElement);\r\n }\r\n\r\n if (this._streamingSource) {\r\n this._streamingSource.disconnect();\r\n }\r\n\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._connectedTransformNode = null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets if the sounds is ready to be played or not.\r\n * @returns true if ready, otherwise false\r\n */\r\n public isReady(): boolean {\r\n return this._isReadyToPlay;\r\n }\r\n\r\n /**\r\n * Get the current class name.\r\n * @returns current class name\r\n */\r\n public getClassName(): string {\r\n return \"Sound\";\r\n }\r\n\r\n private _audioBufferLoaded(buffer: AudioBuffer) {\r\n if (!Engine.audioEngine?.audioContext) {\r\n return;\r\n }\r\n this._audioBuffer = buffer;\r\n this._isReadyToPlay = true;\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n }\r\n\r\n private _soundLoaded(audioData: ArrayBuffer) {\r\n if (!Engine.audioEngine?.audioContext) {\r\n return;\r\n }\r\n Engine.audioEngine.audioContext.decodeAudioData(\r\n audioData,\r\n (buffer) => {\r\n this._audioBufferLoaded(buffer);\r\n },\r\n (err: any) => {\r\n Logger.Error(\"Error while decoding audio data for: \" + this.name + \" / Error: \" + err);\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Sets the data of the sound from an audiobuffer\r\n * @param audioBuffer The audioBuffer containing the data\r\n */\r\n public setAudioBuffer(audioBuffer: AudioBuffer): void {\r\n if (Engine.audioEngine?.canUseWebAudio) {\r\n this._audioBuffer = audioBuffer;\r\n this._isReadyToPlay = true;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the current sounds options such as maxdistance, loop...\r\n * @param options A JSON object containing values named as the object properties\r\n */\r\n public updateOptions(options: ISoundOptions): void {\r\n if (options) {\r\n this.loop = options.loop ?? this.loop;\r\n this.maxDistance = options.maxDistance ?? this.maxDistance;\r\n this.useCustomAttenuation = options.useCustomAttenuation ?? this.useCustomAttenuation;\r\n this.rolloffFactor = options.rolloffFactor ?? this.rolloffFactor;\r\n this.refDistance = options.refDistance ?? this.refDistance;\r\n this.distanceModel = options.distanceModel ?? this.distanceModel;\r\n this._playbackRate = options.playbackRate ?? this._playbackRate;\r\n this._length = options.length ?? undefined;\r\n this._setOffset(options.offset ?? undefined);\r\n this.setVolume(options.volume ?? this._volume);\r\n this._updateSpatialParameters();\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n if (this._htmlAudioElement.loop !== this.loop) {\r\n this._htmlAudioElement.loop = this.loop;\r\n }\r\n } else {\r\n if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n if (this._soundSource.loop !== this.loop) {\r\n this._soundSource.loop = this.loop;\r\n }\r\n if (this._offset !== undefined && this._soundSource.loopStart !== this._offset) {\r\n this._soundSource.loopStart = this._offset;\r\n }\r\n if (this._length !== undefined && this._length !== this._soundSource.loopEnd) {\r\n this._soundSource.loopEnd = (this._offset! | 0) + this._length!;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _createSpatialParameters() {\r\n if (Engine.audioEngine?.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n if (this._scene.headphone) {\r\n this._panningModel = \"HRTF\";\r\n }\r\n this._soundPanner = this._soundPanner ?? Engine.audioEngine.audioContext.createPanner();\r\n if (this._soundPanner && this._outputAudioNode) {\r\n this._updateSpatialParameters();\r\n this._soundPanner.connect(this._outputAudioNode);\r\n this._inputAudioNode = this._soundPanner;\r\n }\r\n }\r\n }\r\n\r\n private _updateSpatialParameters() {\r\n if (this._spatialSound && this._soundPanner) {\r\n if (this.useCustomAttenuation) {\r\n // Tricks to disable in a way embedded Web Audio attenuation\r\n this._soundPanner.distanceModel = \"linear\";\r\n this._soundPanner.maxDistance = Number.MAX_VALUE;\r\n this._soundPanner.refDistance = 1;\r\n this._soundPanner.rolloffFactor = 1;\r\n this._soundPanner.panningModel = this._panningModel as any;\r\n } else {\r\n this._soundPanner.distanceModel = this.distanceModel as any;\r\n this._soundPanner.maxDistance = this.maxDistance;\r\n this._soundPanner.refDistance = this.refDistance;\r\n this._soundPanner.rolloffFactor = this.rolloffFactor;\r\n this._soundPanner.panningModel = this._panningModel as any;\r\n }\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() {\r\n this._panningModel = \"HRTF\";\r\n this._switchPanningModel();\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() {\r\n this._panningModel = \"equalpower\";\r\n this._switchPanningModel();\r\n }\r\n\r\n private _switchPanningModel() {\r\n if (Engine.audioEngine?.canUseWebAudio && this._spatialSound && this._soundPanner) {\r\n this._soundPanner.panningModel = this._panningModel as any;\r\n }\r\n }\r\n\r\n /**\r\n * Connect this sound to a sound track audio node like gain...\r\n * @param soundTrackAudioNode the sound track audio node to connect to\r\n */\r\n public connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void {\r\n if (Engine.audioEngine?.canUseWebAudio && this._outputAudioNode) {\r\n if (this._isOutputConnected) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode.connect(soundTrackAudioNode);\r\n this._isOutputConnected = true;\r\n }\r\n }\r\n\r\n /**\r\n * Transform this sound into a directional source\r\n * @param coneInnerAngle Size of the inner cone in degree\r\n * @param coneOuterAngle Size of the outer cone in degree\r\n * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)\r\n */\r\n public setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void {\r\n if (coneOuterAngle < coneInnerAngle) {\r\n Logger.Error(\"setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = coneInnerAngle;\r\n this._coneOuterAngle = coneOuterAngle;\r\n this._coneOuterGain = coneOuterGain;\r\n this._isDirectional = true;\r\n\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n public get directionalConeInnerAngle(): number {\r\n return this._coneInnerAngle;\r\n }\r\n\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n public set directionalConeInnerAngle(value: number) {\r\n if (value != this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n Logger.Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n\r\n this._coneInnerAngle = value;\r\n if (Engine.audioEngine?.canUseWebAudio && this._spatialSound && this._soundPanner) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n public get directionalConeOuterAngle(): number {\r\n return this._coneOuterAngle;\r\n }\r\n\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n public set directionalConeOuterAngle(value: number) {\r\n if (value != this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n Logger.Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n\r\n this._coneOuterAngle = value;\r\n if (Engine.audioEngine?.canUseWebAudio && this._spatialSound && this._soundPanner) {\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the position of the emitter if spatial sound is enabled\r\n * @param newPosition Defines the new position\r\n */\r\n public setPosition(newPosition: Vector3): void {\r\n if (newPosition.equals(this._position)) {\r\n return;\r\n }\r\n this._position.copyFrom(newPosition);\r\n\r\n if (Engine.audioEngine?.canUseWebAudio && this._spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.positionX.value = this._position.x;\r\n this._soundPanner.positionY.value = this._position.y;\r\n this._soundPanner.positionZ.value = this._position.z;\r\n }\r\n }\r\n\r\n /**\r\n * Sets the local direction of the emitter if spatial sound is enabled\r\n * @param newLocalDirection Defines the new local direction\r\n */\r\n public setLocalDirectionToMesh(newLocalDirection: Vector3): void {\r\n this._localDirection = newLocalDirection;\r\n\r\n if (Engine.audioEngine?.canUseWebAudio && this._connectedTransformNode && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n }\r\n\r\n private _updateDirection() {\r\n if (!this._connectedTransformNode || !this._soundPanner) {\r\n return;\r\n }\r\n\r\n const mat = this._connectedTransformNode.getWorldMatrix();\r\n const direction = Vector3.TransformNormal(this._localDirection, mat);\r\n direction.normalize();\r\n this._soundPanner.orientationX.value = direction.x;\r\n this._soundPanner.orientationY.value = direction.y;\r\n this._soundPanner.orientationZ.value = direction.z;\r\n }\r\n\r\n /** @internal */\r\n public updateDistanceFromListener() {\r\n if (Engine.audioEngine?.canUseWebAudio && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) {\r\n const distance = this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);\r\n this._soundGain.gain.value = this._customAttenuationFunction(this._volume, distance, this.maxDistance, this.refDistance, this.rolloffFactor);\r\n }\r\n }\r\n\r\n /**\r\n * Sets a new custom attenuation function for the sound.\r\n * @param callback Defines the function used for the attenuation\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-your-own-custom-attenuation-function\r\n */\r\n public setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void {\r\n this._customAttenuationFunction = callback;\r\n }\r\n\r\n /**\r\n * Play the sound\r\n * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.\r\n * @param offset (optional) Start the sound at a specific time in seconds\r\n * @param length (optional) Sound duration (in seconds)\r\n */\r\n public play(time?: number, offset?: number, length?: number): void {\r\n if (this._isReadyToPlay && this._scene.audioEnabled && Engine.audioEngine?.audioContext) {\r\n try {\r\n let startTime = time ? Engine.audioEngine?.audioContext.currentTime + time : Engine.audioEngine?.audioContext.currentTime;\r\n if (!this._soundSource || !this._streamingSource) {\r\n if (this._spatialSound && this._soundPanner) {\r\n if (!isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.positionX.value = this._position.x;\r\n this._soundPanner.positionY.value = this._position.y;\r\n this._soundPanner.positionZ.value = this._position.z;\r\n }\r\n if (this._isDirectional) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n this._soundPanner.coneOuterGain = this._coneOuterGain;\r\n if (this._connectedTransformNode) {\r\n this._updateDirection();\r\n } else {\r\n this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z);\r\n }\r\n }\r\n }\r\n }\r\n if (this._streaming) {\r\n if (!this._streamingSource) {\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement);\r\n this._htmlAudioElement.onended = () => {\r\n this._onended();\r\n };\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n this._streamingSource.disconnect();\r\n if (this._inputAudioNode) {\r\n this._streamingSource.connect(this._inputAudioNode);\r\n }\r\n if (this._htmlAudioElement) {\r\n // required to manage properly the new suspended default state of Chrome\r\n // When the option 'streaming: true' is used, we need first to wait for\r\n // the audio engine to be unlocked by a user gesture before trying to play\r\n // an HTML Audio element\r\n const tryToPlay = () => {\r\n if (Engine.audioEngine?.unlocked) {\r\n const playPromise = this._htmlAudioElement.play();\r\n\r\n // In browsers that don’t yet support this functionality,\r\n // playPromise won’t be defined.\r\n if (playPromise !== undefined) {\r\n playPromise.catch(() => {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n Engine.audioEngine?.lock();\r\n if (this.loop || this.autoplay) {\r\n Engine.audioEngine?.onAudioUnlockedObservable.addOnce(() => {\r\n tryToPlay();\r\n });\r\n }\r\n });\r\n }\r\n } else {\r\n if (this.loop || this.autoplay) {\r\n Engine.audioEngine?.onAudioUnlockedObservable.addOnce(() => {\r\n tryToPlay();\r\n });\r\n }\r\n }\r\n };\r\n tryToPlay();\r\n }\r\n } else {\r\n const tryToPlay = () => {\r\n if (Engine.audioEngine?.audioContext) {\r\n length = length || this._length;\r\n\r\n if (offset !== undefined) {\r\n this._setOffset(offset);\r\n }\r\n\r\n if (this._soundSource) {\r\n const oldSource = this._soundSource;\r\n oldSource.onended = () => {\r\n oldSource.disconnect();\r\n };\r\n }\r\n this._soundSource = Engine.audioEngine?.audioContext.createBufferSource();\r\n if (this._soundSource && this._inputAudioNode) {\r\n this._soundSource.buffer = this._audioBuffer;\r\n this._soundSource.connect(this._inputAudioNode);\r\n this._soundSource.loop = this.loop;\r\n if (offset !== undefined) {\r\n this._soundSource.loopStart = offset;\r\n }\r\n if (length !== undefined) {\r\n this._soundSource.loopEnd = (offset! | 0) + length!;\r\n }\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n this._soundSource.onended = () => {\r\n this._onended();\r\n };\r\n startTime = time ? Engine.audioEngine?.audioContext!.currentTime + time : Engine.audioEngine.audioContext!.currentTime;\r\n const actualOffset = ((this.isPaused ? this.currentTime : 0) + (this._offset ?? 0)) % this._soundSource!.buffer!.duration;\r\n this._soundSource!.start(startTime, actualOffset, this.loop ? undefined : length);\r\n }\r\n }\r\n };\r\n\r\n if (Engine.audioEngine?.audioContext.state === \"suspended\") {\r\n // Wait a bit for FF as context seems late to be ready.\r\n setTimeout(() => {\r\n if (Engine.audioEngine?.audioContext!.state === \"suspended\") {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n Engine.audioEngine.lock();\r\n if (this.loop || this.autoplay) {\r\n Engine.audioEngine.onAudioUnlockedObservable.addOnce(() => {\r\n tryToPlay();\r\n });\r\n }\r\n } else {\r\n tryToPlay();\r\n }\r\n }, 500);\r\n } else {\r\n tryToPlay();\r\n }\r\n }\r\n this._startTime = startTime;\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n } catch (ex) {\r\n Logger.Error(\"Error while trying to play audio: \" + this.name + \", \" + ex.message);\r\n }\r\n }\r\n }\r\n\r\n private _onended() {\r\n this.isPlaying = false;\r\n this._startTime = 0;\r\n this._currentTime = 0;\r\n if (this.onended) {\r\n this.onended();\r\n }\r\n this.onEndedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Stop the sound\r\n * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.\r\n */\r\n public stop(time?: number): void {\r\n if (this.isPlaying) {\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n // Test needed for Firefox or it will generate an Invalid State Error\r\n if (this._htmlAudioElement.currentTime > 0) {\r\n this._htmlAudioElement.currentTime = 0;\r\n }\r\n } else {\r\n this._streamingSource.disconnect();\r\n }\r\n this.isPlaying = false;\r\n } else if (Engine.audioEngine?.audioContext && this._soundSource) {\r\n const stopTime = time ? Engine.audioEngine.audioContext.currentTime + time : undefined;\r\n this._soundSource.onended = () => {\r\n this.isPlaying = false;\r\n this.isPaused = false;\r\n this._startTime = 0;\r\n this._currentTime = 0;\r\n if (this._soundSource) {\r\n this._soundSource.onended = () => void 0;\r\n }\r\n this._onended();\r\n };\r\n this._soundSource.stop(stopTime);\r\n }\r\n } else if (this.isPaused) {\r\n this.isPaused = false;\r\n this._startTime = 0;\r\n this._currentTime = 0;\r\n }\r\n }\r\n\r\n /**\r\n * Put the sound in pause\r\n */\r\n public pause(): void {\r\n if (this.isPlaying) {\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n } else {\r\n this._streamingSource.disconnect();\r\n }\r\n this.isPlaying = false;\r\n this.isPaused = true;\r\n } else if (Engine.audioEngine?.audioContext && this._soundSource) {\r\n this._soundSource.onended = () => void 0;\r\n this._soundSource.stop();\r\n this.isPlaying = false;\r\n this.isPaused = true;\r\n this._currentTime += Engine.audioEngine.audioContext.currentTime - this._startTime;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets a dedicated volume for this sounds\r\n * @param newVolume Define the new volume of the sound\r\n * @param time Define time for gradual change to new volume\r\n */\r\n public setVolume(newVolume: number, time?: number): void {\r\n if (Engine.audioEngine?.canUseWebAudio && this._soundGain) {\r\n if (time && Engine.audioEngine.audioContext) {\r\n this._soundGain.gain.cancelScheduledValues(Engine.audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, Engine.audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.linearRampToValueAtTime(newVolume, Engine.audioEngine.audioContext.currentTime + time);\r\n } else {\r\n this._soundGain.gain.value = newVolume;\r\n }\r\n }\r\n this._volume = newVolume;\r\n }\r\n\r\n /**\r\n * Set the sound play back rate\r\n * @param newPlaybackRate Define the playback rate the sound should be played at\r\n */\r\n public setPlaybackRate(newPlaybackRate: number): void {\r\n this._playbackRate = newPlaybackRate;\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n } else if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the sound play back rate.\r\n * @returns the play back rate of the sound\r\n */\r\n public getPlaybackRate(): number {\r\n return this._playbackRate;\r\n }\r\n\r\n /**\r\n * Gets the volume of the sound.\r\n * @returns the volume of the sound\r\n */\r\n public getVolume(): number {\r\n return this._volume;\r\n }\r\n\r\n /**\r\n * Attach the sound to a dedicated mesh\r\n * @param transformNode The transform node to connect the sound with\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#attaching-a-sound-to-a-mesh\r\n */\r\n public attachToMesh(transformNode: TransformNode): void {\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n }\r\n this._connectedTransformNode = transformNode;\r\n if (!this._spatialSound) {\r\n this._spatialSound = true;\r\n this._createSpatialParameters();\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n }\r\n this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode);\r\n this._registerFunc = (transformNode: TransformNode) => this._onRegisterAfterWorldMatrixUpdate(transformNode);\r\n this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc);\r\n }\r\n\r\n /**\r\n * Detach the sound from the previously attached mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#attaching-a-sound-to-a-mesh\r\n */\r\n public detachFromMesh() {\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n this._connectedTransformNode = null;\r\n }\r\n }\r\n\r\n private _onRegisterAfterWorldMatrixUpdate(node: TransformNode): void {\r\n if (!(<any>node).getBoundingInfo) {\r\n this.setPosition(node.absolutePosition);\r\n } else {\r\n const mesh = node as AbstractMesh;\r\n const boundingInfo = mesh.getBoundingInfo();\r\n this.setPosition(boundingInfo.boundingSphere.centerWorld);\r\n }\r\n if (Engine.audioEngine?.canUseWebAudio && this._isDirectional && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current sound in the scene.\r\n * @returns the new sound clone\r\n */\r\n public clone(): Nullable<Sound> {\r\n if (!this._streaming) {\r\n const setBufferAndRun = () => {\r\n if (this._isReadyToPlay) {\r\n clonedSound._audioBuffer = this.getAudioBuffer();\r\n clonedSound._isReadyToPlay = true;\r\n if (clonedSound.autoplay) {\r\n clonedSound.play(0, this._offset, this._length);\r\n }\r\n } else {\r\n setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n\r\n const currentOptions = {\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this._spatialSound,\r\n maxDistance: this.maxDistance,\r\n useCustomAttenuation: this.useCustomAttenuation,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n };\r\n\r\n const clonedSound = new Sound(this.name + \"_cloned\", new ArrayBuffer(0), this._scene, null, currentOptions);\r\n if (this.useCustomAttenuation) {\r\n clonedSound.setAttenuationFunction(this._customAttenuationFunction);\r\n }\r\n clonedSound.setPosition(this._position);\r\n clonedSound.setPlaybackRate(this._playbackRate);\r\n setBufferAndRun();\r\n\r\n return clonedSound;\r\n }\r\n // Can't clone a streaming sound\r\n else {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current underlying audio buffer containing the data\r\n * @returns the audio buffer\r\n */\r\n public getAudioBuffer(): Nullable<AudioBuffer> {\r\n return this._audioBuffer;\r\n }\r\n\r\n /**\r\n * Gets the WebAudio AudioBufferSourceNode, lets you keep track of and stop instances of this Sound.\r\n * @returns the source node\r\n */\r\n public getSoundSource(): Nullable<AudioBufferSourceNode> {\r\n return this._soundSource;\r\n }\r\n\r\n /**\r\n * Gets the WebAudio GainNode, gives you precise control over the gain of instances of this Sound.\r\n * @returns the gain node\r\n */\r\n public getSoundGain(): Nullable<GainNode> {\r\n return this._soundGain;\r\n }\r\n\r\n /**\r\n * Serializes the Sound in a JSON representation\r\n * @returns the JSON representation of the sound\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {\r\n name: this.name,\r\n url: this.name,\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this._spatialSound,\r\n maxDistance: this.maxDistance,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n playbackRate: this._playbackRate,\r\n panningModel: this._panningModel,\r\n soundTrackId: this.soundTrackId,\r\n metadata: this.metadata,\r\n };\r\n\r\n if (this._spatialSound) {\r\n if (this._connectedTransformNode) {\r\n serializationObject.connectedMeshId = this._connectedTransformNode.id;\r\n }\r\n\r\n serializationObject.position = this._position.asArray();\r\n serializationObject.refDistance = this.refDistance;\r\n serializationObject.distanceModel = this.distanceModel;\r\n\r\n serializationObject.isDirectional = this._isDirectional;\r\n serializationObject.localDirectionToMesh = this._localDirection.asArray();\r\n serializationObject.coneInnerAngle = this._coneInnerAngle;\r\n serializationObject.coneOuterAngle = this._coneOuterAngle;\r\n serializationObject.coneOuterGain = this._coneOuterGain;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse a JSON representation of a sound to instantiate in a given scene\r\n * @param parsedSound Define the JSON representation of the sound (usually coming from the serialize method)\r\n * @param scene Define the scene the new parsed sound should be created in\r\n * @param rootUrl Define the rooturl of the load in case we need to fetch relative dependencies\r\n * @param sourceSound Define a sound place holder if do not need to instantiate a new one\r\n * @returns the newly parsed sound\r\n */\r\n public static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound {\r\n const soundName = parsedSound.name;\r\n let soundUrl;\r\n\r\n if (parsedSound.url) {\r\n soundUrl = rootUrl + parsedSound.url;\r\n } else {\r\n soundUrl = rootUrl + soundName;\r\n }\r\n\r\n const options = {\r\n autoplay: parsedSound.autoplay,\r\n loop: parsedSound.loop,\r\n volume: parsedSound.volume,\r\n spatialSound: parsedSound.spatialSound,\r\n maxDistance: parsedSound.maxDistance,\r\n rolloffFactor: parsedSound.rolloffFactor,\r\n refDistance: parsedSound.refDistance,\r\n distanceModel: parsedSound.distanceModel,\r\n playbackRate: parsedSound.playbackRate,\r\n };\r\n\r\n let newSound: Sound;\r\n\r\n if (!sourceSound) {\r\n newSound = new Sound(\r\n soundName,\r\n soundUrl,\r\n scene,\r\n () => {\r\n scene.removePendingData(newSound);\r\n },\r\n options\r\n );\r\n scene.addPendingData(newSound);\r\n } else {\r\n const setBufferAndRun = () => {\r\n if (sourceSound._isReadyToPlay) {\r\n newSound._audioBuffer = sourceSound.getAudioBuffer();\r\n newSound._isReadyToPlay = true;\r\n if (newSound.autoplay) {\r\n newSound.play(0, newSound._offset, newSound._length);\r\n }\r\n } else {\r\n setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n\r\n newSound = new Sound(soundName, new ArrayBuffer(0), scene, null, options);\r\n setBufferAndRun();\r\n }\r\n\r\n if (parsedSound.position) {\r\n const soundPosition = Vector3.FromArray(parsedSound.position);\r\n newSound.setPosition(soundPosition);\r\n }\r\n if (parsedSound.isDirectional) {\r\n newSound.setDirectionalCone(parsedSound.coneInnerAngle || 360, parsedSound.coneOuterAngle || 360, parsedSound.coneOuterGain || 0);\r\n if (parsedSound.localDirectionToMesh) {\r\n const localDirectionToMesh = Vector3.FromArray(parsedSound.localDirectionToMesh);\r\n newSound.setLocalDirectionToMesh(localDirectionToMesh);\r\n }\r\n }\r\n if (parsedSound.connectedMeshId) {\r\n const connectedMesh = scene.getMeshById(parsedSound.connectedMeshId);\r\n if (connectedMesh) {\r\n newSound.attachToMesh(connectedMesh);\r\n }\r\n }\r\n\r\n if (parsedSound.metadata) {\r\n newSound.metadata = parsedSound.metadata;\r\n }\r\n\r\n return newSound;\r\n }\r\n\r\n private _setOffset(value?: number) {\r\n if (this._offset === value) {\r\n return;\r\n }\r\n if (this.isPaused) {\r\n this.stop();\r\n this.isPaused = false;\r\n }\r\n this._offset = value;\r\n }\r\n}\r\n"]}
@@ -10,7 +10,7 @@ import type { PickingInfo } from "../../Collisions/pickingInfo";
10
10
  /**
11
11
  * Data store to track virtual pointers movement
12
12
  */
13
- declare type VirtualMeshInfo = {
13
+ type VirtualMeshInfo = {
14
14
  dragging: boolean;
15
15
  moving: boolean;
16
16
  dragMesh: AbstractMesh;
@@ -2,6 +2,17 @@
2
2
  * A behavior that when attached to a mesh will allow the mesh to fade in and out
3
3
  */
4
4
  export class FadeInOutBehavior {
5
+ /**
6
+ * Time in milliseconds to delay before fading in (Default: 0)
7
+ * Will set both fade in and out delay to the same value
8
+ */
9
+ get delay() {
10
+ return this.fadeInDelay;
11
+ }
12
+ set delay(value) {
13
+ this.fadeInDelay = value;
14
+ this.fadeOutDelay = value;
15
+ }
5
16
  /**
6
17
  * Instantiates the FadeInOutBehavior
7
18
  */
@@ -52,17 +63,6 @@ export class FadeInOutBehavior {
52
63
  }
53
64
  };
54
65
  }
55
- /**
56
- * Time in milliseconds to delay before fading in (Default: 0)
57
- * Will set both fade in and out delay to the same value
58
- */
59
- get delay() {
60
- return this.fadeInDelay;
61
- }
62
- set delay(value) {
63
- this.fadeInDelay = value;
64
- this.fadeOutDelay = value;
65
- }
66
66
  /**
67
67
  * The name of the behavior
68
68
  */
@@ -1 +1 @@
1
- {"version":3,"file":"fadeInOutBehavior.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Behaviors/Meshes/fadeInOutBehavior.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IA0C1B;;OAEG;IACH;QA5CA;;WAEG;QACI,gBAAW,GAAG,CAAC,CAAC;QAEvB;;WAEG;QACI,iBAAY,GAAG,CAAC,CAAC;QAExB;;WAEG;QACI,eAAU,GAAG,GAAG,CAAC;QAExB;;WAEG;QACI,gBAAW,GAAG,GAAG,CAAC;QAejB,0BAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,aAAQ,GAAG,KAAK,CAAC;QACjB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAmB,IAAI,CAAC;QAElC,WAAM,GAAW,CAAC,CAAC;QACnB,UAAK,GAAW,GAAG,CAAC;QA0Ep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AAC;SACjC;aAAM,IAAI,IAAI,CAAC,UAAW,CAAC,UAAU,IAAI,CAAC,EAAE;YACzC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;SACxB;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IA4BO,iBAAiB,CAAC,IAAkB,EAAE,KAAa;QACvD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAChC,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,eAAe;;QACnB,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;YAC/B,IAAI,CAAC,uBAAuB,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,QAAQ,GAAG,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACzG;IACL,CAAC;IAEO,eAAe;;QACnB,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAC9B,MAAA,IAAI,CAAC,UAAU,0CAAE,QAAQ,GAAG,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YAC1F,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC;SACvC;IACL,CAAC;CACJ","sourcesContent":["import type { Behavior } from \"../behavior\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"core/Misc\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to fade in and out\r\n */\r\nexport class FadeInOutBehavior implements Behavior<Mesh> {\r\n /**\r\n * Time in milliseconds to delay before fading in (Default: 0)\r\n */\r\n public fadeInDelay = 0;\r\n\r\n /**\r\n * Time in milliseconds to delay before fading out (Default: 0)\r\n */\r\n public fadeOutDelay = 0;\r\n\r\n /**\r\n * Time in milliseconds for the mesh to fade in (Default: 300)\r\n */\r\n public fadeInTime = 300;\r\n\r\n /**\r\n * Time in milliseconds for the mesh to fade out (Default: 300)\r\n */\r\n public fadeOutTime = 300;\r\n\r\n /**\r\n * Time in milliseconds to delay before fading in (Default: 0)\r\n * Will set both fade in and out delay to the same value\r\n */\r\n public get delay(): number {\r\n return this.fadeInDelay;\r\n }\r\n\r\n public set delay(value: number) {\r\n this.fadeInDelay = value;\r\n this.fadeOutDelay = value;\r\n }\r\n\r\n private _millisecondsPerFrame = 1000 / 60;\r\n private _hovered = false;\r\n private _hoverValue = 0;\r\n private _ownerNode: Nullable<Mesh> = null;\r\n private _onBeforeRenderObserver: Nullable<Observer<Scene>> | undefined;\r\n private _delay: number = 0;\r\n private _time: number = 300;\r\n\r\n /**\r\n * Instantiates the FadeInOutBehavior\r\n */\r\n constructor() {}\r\n\r\n /**\r\n * The name of the behavior\r\n */\r\n public get name(): string {\r\n return \"FadeInOut\";\r\n }\r\n\r\n /**\r\n * Initializes the behavior\r\n */\r\n public init() {}\r\n\r\n /**\r\n * Attaches the fade behavior on the passed in mesh\r\n * @param ownerNode The mesh that will be faded in/out once attached\r\n */\r\n public attach(ownerNode: Mesh): void {\r\n this._ownerNode = ownerNode;\r\n this._setAllVisibility(this._ownerNode, 0);\r\n }\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n public detach(): void {\r\n this._ownerNode = null;\r\n }\r\n\r\n /**\r\n * Triggers the mesh to begin fading in (or out)\r\n * @param fadeIn if the object should fade in or out (true to fade in)\r\n */\r\n public fadeIn(fadeIn: boolean = true) {\r\n this._delay = fadeIn ? this.fadeInDelay : this.fadeOutDelay;\r\n this._time = fadeIn ? this.fadeInTime : this.fadeOutTime;\r\n\r\n // Cancel any pending updates\r\n this._detachObserver();\r\n\r\n // If fading in and already visible or fading out and already not visible do nothing\r\n if (this._ownerNode && ((fadeIn && this._ownerNode.visibility >= 1) || (!fadeIn && this._ownerNode.visibility <= 0))) {\r\n return;\r\n }\r\n\r\n this._hovered = fadeIn;\r\n if (!this._hovered) {\r\n // Make the delay the negative of fadeout delay so the hoverValue is kept above 1 until\r\n // fadeOutDelay has elapsed\r\n this._delay *= -1;\r\n }\r\n\r\n // Reset the hoverValue. This is necessary because we may have been fading out, e.g. but not yet reached\r\n // the delay, so the hover value is greater than 1\r\n if (this._ownerNode!.visibility >= 1) {\r\n this._hoverValue = this._time;\r\n } else if (this._ownerNode!.visibility <= 0) {\r\n this._hoverValue = 0;\r\n }\r\n this._update();\r\n }\r\n\r\n /**\r\n * Triggers the mesh to begin fading out\r\n */\r\n public fadeOut() {\r\n this.fadeIn(false);\r\n }\r\n\r\n private _update = () => {\r\n if (this._ownerNode) {\r\n this._hoverValue += this._hovered ? this._millisecondsPerFrame : -this._millisecondsPerFrame;\r\n\r\n this._setAllVisibility(this._ownerNode, (this._hoverValue - this._delay) / this._time);\r\n\r\n if (this._ownerNode.visibility > 1) {\r\n this._setAllVisibility(this._ownerNode, 1);\r\n if (this._hoverValue > this._time) {\r\n this._hoverValue = this._time;\r\n this._detachObserver();\r\n return;\r\n }\r\n } else if (this._ownerNode.visibility < 0) {\r\n this._setAllVisibility(this._ownerNode, 0);\r\n if (this._hoverValue < 0) {\r\n this._hoverValue = 0;\r\n this._detachObserver();\r\n return;\r\n }\r\n }\r\n\r\n this._attachObserver();\r\n }\r\n };\r\n\r\n private _setAllVisibility(mesh: AbstractMesh, value: number) {\r\n mesh.visibility = value;\r\n mesh.getChildMeshes().forEach((c) => {\r\n this._setAllVisibility(c, value);\r\n });\r\n }\r\n\r\n private _attachObserver() {\r\n if (!this._onBeforeRenderObserver) {\r\n this._onBeforeRenderObserver = this._ownerNode?.getScene().onBeforeRenderObservable.add(this._update);\r\n }\r\n }\r\n\r\n private _detachObserver() {\r\n if (this._onBeforeRenderObserver) {\r\n this._ownerNode?.getScene().onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n this._onBeforeRenderObserver = null;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"fadeInOutBehavior.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Behaviors/Meshes/fadeInOutBehavior.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAqB1B;;;OAGG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC9B,CAAC;IAUD;;OAEG;IACH;QA5CA;;WAEG;QACI,gBAAW,GAAG,CAAC,CAAC;QAEvB;;WAEG;QACI,iBAAY,GAAG,CAAC,CAAC;QAExB;;WAEG;QACI,eAAU,GAAG,GAAG,CAAC;QAExB;;WAEG;QACI,gBAAW,GAAG,GAAG,CAAC;QAejB,0BAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,aAAQ,GAAG,KAAK,CAAC;QACjB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAmB,IAAI,CAAC;QAElC,WAAM,GAAW,CAAC,CAAC;QACnB,UAAK,GAAW,GAAG,CAAC;QA0EpB,YAAO,GAAG,GAAG,EAAE;YACnB,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjB,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC;gBAE7F,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,K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uBAAuB,EAAE;YAC/B,IAAI,CAAC,uBAAuB,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,QAAQ,GAAG,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACzG;IACL,CAAC;IAEO,eAAe;;QACnB,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAC9B,MAAA,IAAI,CAAC,UAAU,0CAAE,QAAQ,GAAG,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YAC1F,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC;SACvC;IACL,CAAC;CACJ","sourcesContent":["import type { Behavior } from \"../behavior\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"core/Misc\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to fade in and out\r\n */\r\nexport class FadeInOutBehavior implements Behavior<Mesh> {\r\n /**\r\n * Time in milliseconds to delay before fading in (Default: 0)\r\n */\r\n public fadeInDelay = 0;\r\n\r\n /**\r\n * Time in milliseconds to delay before fading out (Default: 0)\r\n */\r\n public fadeOutDelay = 0;\r\n\r\n /**\r\n * Time in milliseconds for the mesh to fade in (Default: 300)\r\n */\r\n public fadeInTime = 300;\r\n\r\n /**\r\n * Time in milliseconds for the mesh to fade out (Default: 300)\r\n */\r\n public fadeOutTime = 300;\r\n\r\n /**\r\n * Time in milliseconds to delay before fading in (Default: 0)\r\n * Will set both fade in and out delay to the same value\r\n */\r\n public get delay(): number {\r\n return this.fadeInDelay;\r\n }\r\n\r\n public set delay(value: number) {\r\n this.fadeInDelay = value;\r\n this.fadeOutDelay = value;\r\n }\r\n\r\n private _millisecondsPerFrame = 1000 / 60;\r\n private _hovered = false;\r\n private _hoverValue = 0;\r\n private _ownerNode: Nullable<Mesh> = null;\r\n private _onBeforeRenderObserver: Nullable<Observer<Scene>> | undefined;\r\n private _delay: number = 0;\r\n private _time: number = 300;\r\n\r\n /**\r\n * Instantiates the FadeInOutBehavior\r\n */\r\n constructor() {}\r\n\r\n /**\r\n * The name of the behavior\r\n */\r\n public get name(): string {\r\n return \"FadeInOut\";\r\n }\r\n\r\n /**\r\n * Initializes the behavior\r\n */\r\n public init() {}\r\n\r\n /**\r\n * Attaches the fade behavior on the passed in mesh\r\n * @param ownerNode The mesh that will be faded in/out once attached\r\n */\r\n public attach(ownerNode: Mesh): void {\r\n this._ownerNode = ownerNode;\r\n this._setAllVisibility(this._ownerNode, 0);\r\n }\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n public detach(): void {\r\n this._ownerNode = null;\r\n }\r\n\r\n /**\r\n * Triggers the mesh to begin fading in (or out)\r\n * @param fadeIn if the object should fade in or out (true to fade in)\r\n */\r\n public fadeIn(fadeIn: boolean = true) {\r\n this._delay = fadeIn ? this.fadeInDelay : this.fadeOutDelay;\r\n this._time = fadeIn ? this.fadeInTime : this.fadeOutTime;\r\n\r\n // Cancel any pending updates\r\n this._detachObserver();\r\n\r\n // If fading in and already visible or fading out and already not visible do nothing\r\n if (this._ownerNode && ((fadeIn && this._ownerNode.visibility >= 1) || (!fadeIn && this._ownerNode.visibility <= 0))) {\r\n return;\r\n }\r\n\r\n this._hovered = fadeIn;\r\n if (!this._hovered) {\r\n // Make the delay the negative of fadeout delay so the hoverValue is kept above 1 until\r\n // fadeOutDelay has elapsed\r\n this._delay *= -1;\r\n }\r\n\r\n // Reset the hoverValue. This is necessary because we may have been fading out, e.g. but not yet reached\r\n // the delay, so the hover value is greater than 1\r\n if (this._ownerNode!.visibility >= 1) {\r\n this._hoverValue = this._time;\r\n } else if (this._ownerNode!.visibility <= 0) {\r\n this._hoverValue = 0;\r\n }\r\n this._update();\r\n }\r\n\r\n /**\r\n * Triggers the mesh to begin fading out\r\n */\r\n public fadeOut() {\r\n this.fadeIn(false);\r\n }\r\n\r\n private _update = () => {\r\n if (this._ownerNode) {\r\n this._hoverValue += this._hovered ? this._millisecondsPerFrame : -this._millisecondsPerFrame;\r\n\r\n this._setAllVisibility(this._ownerNode, (this._hoverValue - this._delay) / this._time);\r\n\r\n if (this._ownerNode.visibility > 1) {\r\n this._setAllVisibility(this._ownerNode, 1);\r\n if (this._hoverValue > this._time) {\r\n this._hoverValue = this._time;\r\n this._detachObserver();\r\n return;\r\n }\r\n } else if (this._ownerNode.visibility < 0) {\r\n this._setAllVisibility(this._ownerNode, 0);\r\n if (this._hoverValue < 0) {\r\n this._hoverValue = 0;\r\n this._detachObserver();\r\n return;\r\n }\r\n }\r\n\r\n this._attachObserver();\r\n }\r\n };\r\n\r\n private _setAllVisibility(mesh: AbstractMesh, value: number) {\r\n mesh.visibility = value;\r\n mesh.getChildMeshes().forEach((c) => {\r\n this._setAllVisibility(c, value);\r\n });\r\n }\r\n\r\n private _attachObserver() {\r\n if (!this._onBeforeRenderObserver) {\r\n this._onBeforeRenderObserver = this._ownerNode?.getScene().onBeforeRenderObservable.add(this._update);\r\n }\r\n }\r\n\r\n private _detachObserver() {\r\n if (this._onBeforeRenderObserver) {\r\n this._ownerNode?.getScene().onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n this._onBeforeRenderObserver = null;\r\n }\r\n }\r\n}\r\n"]}
@@ -10,6 +10,40 @@ import { CreatePlane } from "../../Meshes/Builders/planeBuilder.js";
10
10
  * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events
11
11
  */
12
12
  export class PointerDragBehavior {
13
+ /**
14
+ * Get or set the currentDraggingPointerId
15
+ * @deprecated Please use currentDraggingPointerId instead
16
+ */
17
+ get currentDraggingPointerID() {
18
+ return this.currentDraggingPointerId;
19
+ }
20
+ set currentDraggingPointerID(currentDraggingPointerID) {
21
+ this.currentDraggingPointerId = currentDraggingPointerID;
22
+ }
23
+ /**
24
+ * If the drag behavior will react to drag events (Default: true)
25
+ */
26
+ set enabled(value) {
27
+ if (value != this._enabled) {
28
+ this.onEnabledObservable.notifyObservers(value);
29
+ }
30
+ this._enabled = value;
31
+ }
32
+ get enabled() {
33
+ return this._enabled;
34
+ }
35
+ /**
36
+ * Gets the options used by the behavior
37
+ */
38
+ get options() {
39
+ return this._options;
40
+ }
41
+ /**
42
+ * Sets the options used by the behavior
43
+ */
44
+ set options(options) {
45
+ this._options = options;
46
+ }
13
47
  /**
14
48
  * Creates a pointer drag behavior that can be attached to a mesh
15
49
  * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)
@@ -128,40 +162,6 @@ export class PointerDragBehavior {
128
162
  throw "Multiple drag modes specified in dragBehavior options. Only one expected";
129
163
  }
130
164
  }
131
- /**
132
- * Get or set the currentDraggingPointerId
133
- * @deprecated Please use currentDraggingPointerId instead
134
- */
135
- get currentDraggingPointerID() {
136
- return this.currentDraggingPointerId;
137
- }
138
- set currentDraggingPointerID(currentDraggingPointerID) {
139
- this.currentDraggingPointerId = currentDraggingPointerID;
140
- }
141
- /**
142
- * If the drag behavior will react to drag events (Default: true)
143
- */
144
- set enabled(value) {
145
- if (value != this._enabled) {
146
- this.onEnabledObservable.notifyObservers(value);
147
- }
148
- this._enabled = value;
149
- }
150
- get enabled() {
151
- return this._enabled;
152
- }
153
- /**
154
- * Gets the options used by the behavior
155
- */
156
- get options() {
157
- return this._options;
158
- }
159
- /**
160
- * Sets the options used by the behavior
161
- */
162
- set options(options) {
163
- this._options = options;
164
- }
165
165
  /**
166
166
  * The name of the behavior
167
167
  */