@babylonjs/core 5.22.1 → 5.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/Actions/abstractActionManager.d.ts +6 -6
  2. package/Actions/abstractActionManager.js +1 -1
  3. package/Actions/abstractActionManager.js.map +1 -1
  4. package/Actions/actionManager.d.ts +5 -5
  5. package/Actions/actionManager.js +5 -5
  6. package/Actions/actionManager.js.map +1 -1
  7. package/Animations/animatable.js +2 -1
  8. package/Animations/animatable.js.map +1 -1
  9. package/Animations/animation.js +137 -139
  10. package/Animations/animation.js.map +1 -1
  11. package/Animations/animationGroup.d.ts +3 -3
  12. package/Animations/animationGroup.js +3 -3
  13. package/Animations/animationGroup.js.map +1 -1
  14. package/Animations/runtimeAnimation.js +6 -7
  15. package/Animations/runtimeAnimation.js.map +1 -1
  16. package/Audio/audioSceneComponent.d.ts +1 -1
  17. package/Audio/audioSceneComponent.js.map +1 -1
  18. package/Audio/sound.d.ts +2 -1
  19. package/Audio/sound.js +21 -9
  20. package/Audio/sound.js.map +1 -1
  21. package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
  22. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  23. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  24. package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
  25. package/Behaviors/Cameras/bouncingBehavior.js +1 -1
  26. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  27. package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
  28. package/Behaviors/Cameras/framingBehavior.js +1 -1
  29. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  30. package/Bones/bone.d.ts +1 -1
  31. package/Bones/bone.js +1 -1
  32. package/Bones/bone.js.map +1 -1
  33. package/Bones/skeleton.d.ts +2 -2
  34. package/Bones/skeleton.js +11 -5
  35. package/Bones/skeleton.js.map +1 -1
  36. package/Cameras/Inputs/BaseCameraMouseWheelInput.js +3 -22
  37. package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
  38. package/Cameras/Inputs/BaseCameraPointersInput.js +3 -3
  39. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  40. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +1 -11
  41. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  42. package/Cameras/Inputs/flyCameraMouseInput.js +3 -3
  43. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  44. package/Cameras/Inputs/followCameraMouseWheelInput.js +1 -4
  45. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  46. package/Cameras/Inputs/freeCameraMouseInput.js +3 -3
  47. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  48. package/Cameras/arcRotateCamera.d.ts +1 -1
  49. package/Cameras/arcRotateCamera.js +1 -1
  50. package/Cameras/arcRotateCamera.js.map +1 -1
  51. package/Cameras/camera.d.ts +2 -2
  52. package/Cameras/camera.js +2 -2
  53. package/Cameras/camera.js.map +1 -1
  54. package/Cameras/freeCamera.d.ts +1 -1
  55. package/Cameras/freeCamera.js +1 -1
  56. package/Cameras/freeCamera.js.map +1 -1
  57. package/Cameras/gamepadCamera.d.ts +1 -1
  58. package/Cameras/gamepadCamera.js +1 -1
  59. package/Cameras/gamepadCamera.js.map +1 -1
  60. package/Cameras/targetCamera.d.ts +1 -1
  61. package/Cameras/targetCamera.js +1 -1
  62. package/Cameras/targetCamera.js.map +1 -1
  63. package/Cameras/touchCamera.d.ts +1 -1
  64. package/Cameras/touchCamera.js +1 -1
  65. package/Cameras/touchCamera.js.map +1 -1
  66. package/Cameras/universalCamera.d.ts +1 -1
  67. package/Cameras/universalCamera.js +1 -1
  68. package/Cameras/universalCamera.js.map +1 -1
  69. package/Cameras/virtualJoysticksCamera.d.ts +1 -1
  70. package/Cameras/virtualJoysticksCamera.js +1 -1
  71. package/Cameras/virtualJoysticksCamera.js.map +1 -1
  72. package/Culling/boundingBox.d.ts +2 -2
  73. package/Culling/boundingBox.js +2 -2
  74. package/Culling/boundingBox.js.map +1 -1
  75. package/Culling/ray.d.ts +1 -1
  76. package/Culling/ray.js +1 -1
  77. package/Culling/ray.js.map +1 -1
  78. package/Debug/debugLayer.d.ts +1 -1
  79. package/Debug/debugLayer.js +1 -1
  80. package/Debug/debugLayer.js.map +1 -1
  81. package/DeviceInput/webDeviceInputSystem.js +20 -2
  82. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  83. package/Engines/Extensions/engine.multiRender.js +8 -10
  84. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  85. package/Engines/Extensions/engine.query.d.ts +2 -2
  86. package/Engines/Extensions/engine.query.js.map +1 -1
  87. package/Engines/ICanvas.d.ts +11 -0
  88. package/Engines/ICanvas.js.map +1 -1
  89. package/Engines/WebGL/webGLPipelineContext.d.ts +29 -19
  90. package/Engines/WebGL/webGLPipelineContext.js +99 -311
  91. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  92. package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
  93. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  94. package/Engines/engine.d.ts +2 -2
  95. package/Engines/engine.js +2 -2
  96. package/Engines/engine.js.map +1 -1
  97. package/Engines/nativeEngine.d.ts +2 -2
  98. package/Engines/nativeEngine.js +2 -2
  99. package/Engines/nativeEngine.js.map +1 -1
  100. package/Engines/renderTargetWrapper.d.ts +1 -0
  101. package/Engines/renderTargetWrapper.js +5 -2
  102. package/Engines/renderTargetWrapper.js.map +1 -1
  103. package/Engines/thinEngine.d.ts +6 -5
  104. package/Engines/thinEngine.js +11 -7
  105. package/Engines/thinEngine.js.map +1 -1
  106. package/Engines/webgpuEngine.js +4 -1
  107. package/Engines/webgpuEngine.js.map +1 -1
  108. package/Events/clipboardEvents.d.ts +1 -1
  109. package/Events/clipboardEvents.js +1 -1
  110. package/Events/clipboardEvents.js.map +1 -1
  111. package/Events/deviceInputEvents.d.ts +11 -4
  112. package/Events/deviceInputEvents.js.map +1 -1
  113. package/Gamepads/Controllers/windowsMotionController.d.ts +1 -1
  114. package/Gamepads/Controllers/windowsMotionController.js +1 -1
  115. package/Gamepads/Controllers/windowsMotionController.js.map +1 -1
  116. package/Gizmos/boundingBoxGizmo.d.ts +4 -0
  117. package/Gizmos/boundingBoxGizmo.js +6 -0
  118. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  119. package/Inputs/scene.inputManager.js +4 -4
  120. package/Inputs/scene.inputManager.js.map +1 -1
  121. package/Layers/effectLayer.d.ts +3 -3
  122. package/Layers/effectLayer.js +1 -1
  123. package/Layers/effectLayer.js.map +1 -1
  124. package/Layers/glowLayer.d.ts +3 -3
  125. package/Layers/glowLayer.js +2 -2
  126. package/Layers/glowLayer.js.map +1 -1
  127. package/Layers/highlightLayer.d.ts +3 -3
  128. package/Layers/highlightLayer.js +2 -2
  129. package/Layers/highlightLayer.js.map +1 -1
  130. package/Lights/directionalLight.d.ts +2 -2
  131. package/Lights/directionalLight.js +2 -2
  132. package/Lights/directionalLight.js.map +1 -1
  133. package/Lights/hemisphericLight.d.ts +3 -3
  134. package/Lights/hemisphericLight.js +3 -3
  135. package/Lights/hemisphericLight.js.map +1 -1
  136. package/Lights/light.d.ts +2 -2
  137. package/Lights/light.js +2 -2
  138. package/Lights/light.js.map +1 -1
  139. package/Lights/lightConstants.d.ts +1 -1
  140. package/Lights/lightConstants.js +1 -1
  141. package/Lights/lightConstants.js.map +1 -1
  142. package/Loading/Plugins/babylonFileLoader.js +3 -0
  143. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  144. package/Loading/sceneLoader.d.ts +1 -1
  145. package/Loading/sceneLoader.js.map +1 -1
  146. package/Materials/Background/backgroundMaterial.js +4 -0
  147. package/Materials/Background/backgroundMaterial.js.map +1 -1
  148. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -1
  149. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  150. package/Materials/Node/nodeMaterial.d.ts +1 -1
  151. package/Materials/Node/nodeMaterial.js +5 -1
  152. package/Materials/Node/nodeMaterial.js.map +1 -1
  153. package/Materials/PBR/pbrBaseMaterial.js +4 -1
  154. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  155. package/Materials/Textures/Filtering/hdrFiltering.d.ts +1 -1
  156. package/Materials/Textures/Filtering/hdrFiltering.js +1 -1
  157. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  158. package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
  159. package/Materials/Textures/Procedurals/customProceduralTexture.js +9 -3
  160. package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
  161. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +9 -9
  162. package/Materials/Textures/Procedurals/proceduralTexture.js +9 -9
  163. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  164. package/Materials/Textures/colorGradingTexture.d.ts +1 -1
  165. package/Materials/Textures/colorGradingTexture.js +1 -1
  166. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  167. package/Materials/Textures/cubeTexture.d.ts +2 -2
  168. package/Materials/Textures/cubeTexture.js +2 -2
  169. package/Materials/Textures/cubeTexture.js.map +1 -1
  170. package/Materials/Textures/rawCubeTexture.d.ts +1 -1
  171. package/Materials/Textures/rawCubeTexture.js +1 -1
  172. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  173. package/Materials/Textures/renderTargetTexture.d.ts +3 -5
  174. package/Materials/Textures/renderTargetTexture.js +19 -19
  175. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  176. package/Materials/colorCurves.d.ts +3 -3
  177. package/Materials/colorCurves.js +3 -3
  178. package/Materials/colorCurves.js.map +1 -1
  179. package/Materials/effect.d.ts +27 -27
  180. package/Materials/effect.js +22 -288
  181. package/Materials/effect.js.map +1 -1
  182. package/Materials/fresnelParameters.d.ts +1 -1
  183. package/Materials/fresnelParameters.js +1 -1
  184. package/Materials/fresnelParameters.js.map +1 -1
  185. package/Materials/imageProcessingConfiguration.d.ts +4 -4
  186. package/Materials/imageProcessingConfiguration.js +4 -4
  187. package/Materials/imageProcessingConfiguration.js.map +1 -1
  188. package/Materials/shaderMaterial.d.ts +25 -25
  189. package/Materials/shaderMaterial.js +25 -25
  190. package/Materials/shaderMaterial.js.map +1 -1
  191. package/Materials/standardMaterial.js +4 -1
  192. package/Materials/standardMaterial.js.map +1 -1
  193. package/Maths/index.d.ts +1 -0
  194. package/Maths/index.js +1 -0
  195. package/Maths/index.js.map +1 -1
  196. package/Maths/math.functions.d.ts +2 -2
  197. package/Maths/math.functions.js +2 -2
  198. package/Maths/math.functions.js.map +1 -1
  199. package/Maths/math.polar.d.ts +77 -0
  200. package/Maths/math.polar.js +114 -0
  201. package/Maths/math.polar.js.map +1 -0
  202. package/Maths/math.scalar.d.ts +2 -2
  203. package/Maths/math.scalar.js +2 -2
  204. package/Maths/math.scalar.js.map +1 -1
  205. package/Maths/math.vector.d.ts +13 -12
  206. package/Maths/math.vector.js +13 -12
  207. package/Maths/math.vector.js.map +1 -1
  208. package/Meshes/abstractMesh.d.ts +1 -1
  209. package/Meshes/abstractMesh.js +13 -2
  210. package/Meshes/abstractMesh.js.map +1 -1
  211. package/Meshes/geometry.d.ts +3 -3
  212. package/Meshes/geometry.js +3 -3
  213. package/Meshes/geometry.js.map +1 -1
  214. package/Meshes/groundMesh.d.ts +5 -4
  215. package/Meshes/groundMesh.js +5 -4
  216. package/Meshes/groundMesh.js.map +1 -1
  217. package/Meshes/instancedMesh.d.ts +1 -1
  218. package/Meshes/instancedMesh.js +1 -1
  219. package/Meshes/instancedMesh.js.map +1 -1
  220. package/Meshes/mesh.d.ts +3 -3
  221. package/Meshes/mesh.js +7 -3
  222. package/Meshes/mesh.js.map +1 -1
  223. package/Meshes/subMesh.d.ts +1 -1
  224. package/Meshes/subMesh.js +1 -1
  225. package/Meshes/subMesh.js.map +1 -1
  226. package/Meshes/thinInstanceMesh.d.ts +1 -1
  227. package/Meshes/thinInstanceMesh.js.map +1 -1
  228. package/Meshes/transformNode.js +6 -0
  229. package/Meshes/transformNode.js.map +1 -1
  230. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +2 -2
  231. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -2
  232. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  233. package/Misc/HighDynamicRange/hdr.d.ts +3 -3
  234. package/Misc/HighDynamicRange/hdr.js +3 -3
  235. package/Misc/HighDynamicRange/hdr.js.map +1 -1
  236. package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -1
  237. package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
  238. package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
  239. package/Misc/arrayTools.d.ts +13 -12
  240. package/Misc/arrayTools.js +70 -39
  241. package/Misc/arrayTools.js.map +1 -1
  242. package/Misc/assetsManager.d.ts +3 -3
  243. package/Misc/assetsManager.js +3 -3
  244. package/Misc/assetsManager.js.map +1 -1
  245. package/Misc/basis.js +17 -3
  246. package/Misc/basis.js.map +1 -1
  247. package/Misc/environmentTextureTools.d.ts +4 -4
  248. package/Misc/environmentTextureTools.js +5 -5
  249. package/Misc/environmentTextureTools.js.map +1 -1
  250. package/Misc/fileTools.d.ts +3 -3
  251. package/Misc/fileTools.js +19 -12
  252. package/Misc/fileTools.js.map +1 -1
  253. package/Misc/logger.js +1 -1
  254. package/Misc/logger.js.map +1 -1
  255. package/Misc/observable.d.ts +1 -1
  256. package/Misc/observable.js +1 -1
  257. package/Misc/observable.js.map +1 -1
  258. package/Misc/performanceMonitor.d.ts +3 -3
  259. package/Misc/performanceMonitor.js +3 -3
  260. package/Misc/performanceMonitor.js.map +1 -1
  261. package/Misc/rgbdTextureTools.d.ts +1 -1
  262. package/Misc/rgbdTextureTools.js +1 -1
  263. package/Misc/rgbdTextureTools.js.map +1 -1
  264. package/Misc/sceneOptimizer.d.ts +7 -7
  265. package/Misc/sceneOptimizer.js +7 -7
  266. package/Misc/sceneOptimizer.js.map +1 -1
  267. package/Misc/stringDictionary.d.ts +6 -6
  268. package/Misc/stringDictionary.js +6 -6
  269. package/Misc/stringDictionary.js.map +1 -1
  270. package/Misc/textureTools.d.ts +4 -4
  271. package/Misc/textureTools.js +4 -4
  272. package/Misc/textureTools.js.map +1 -1
  273. package/Misc/tools.d.ts +6 -6
  274. package/Misc/tools.js +6 -6
  275. package/Misc/tools.js.map +1 -1
  276. package/Misc/videoRecorder.d.ts +1 -1
  277. package/Misc/videoRecorder.js +1 -1
  278. package/Misc/videoRecorder.js.map +1 -1
  279. package/Offline/database.js +3 -3
  280. package/Offline/database.js.map +1 -1
  281. package/Particles/IParticleSystem.d.ts +1 -1
  282. package/Particles/IParticleSystem.js.map +1 -1
  283. package/Particles/gpuParticleSystem.d.ts +1 -1
  284. package/Particles/gpuParticleSystem.js +1 -1
  285. package/Particles/gpuParticleSystem.js.map +1 -1
  286. package/Particles/particleSystem.d.ts +1 -1
  287. package/Particles/particleSystem.js +1 -1
  288. package/Particles/particleSystem.js.map +1 -1
  289. package/Particles/solidParticleSystem.d.ts +4 -0
  290. package/Particles/solidParticleSystem.js +25 -3
  291. package/Particles/solidParticleSystem.js.map +1 -1
  292. package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
  293. package/Physics/Plugins/ammoJSPlugin.js +1 -1
  294. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  295. package/Physics/Plugins/oimoJSPlugin.js +1 -1
  296. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  297. package/Physics/physicsEngineComponent.d.ts +1 -1
  298. package/Physics/physicsEngineComponent.js +1 -1
  299. package/Physics/physicsEngineComponent.js.map +1 -1
  300. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +3 -3
  301. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  302. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +1 -2
  303. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  304. package/PostProcesses/blurPostProcess.d.ts +3 -3
  305. package/PostProcesses/blurPostProcess.js +3 -3
  306. package/PostProcesses/blurPostProcess.js.map +1 -1
  307. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +3 -3
  308. package/PostProcesses/volumetricLightScatteringPostProcess.js +3 -3
  309. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  310. package/Rendering/depthPeelingRenderer.d.ts +1 -0
  311. package/Rendering/depthPeelingRenderer.js +32 -5
  312. package/Rendering/depthPeelingRenderer.js.map +1 -1
  313. package/Rendering/edgesRenderer.d.ts +2 -2
  314. package/Rendering/edgesRenderer.js +1 -1
  315. package/Rendering/edgesRenderer.js.map +1 -1
  316. package/Rendering/geometryBufferRenderer.d.ts +4 -2
  317. package/Rendering/geometryBufferRenderer.js +5 -3
  318. package/Rendering/geometryBufferRenderer.js.map +1 -1
  319. package/Rendering/geometryBufferRendererSceneComponent.d.ts +2 -1
  320. package/Rendering/geometryBufferRendererSceneComponent.js +3 -2
  321. package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
  322. package/Rendering/prePassRenderer.d.ts +11 -3
  323. package/Rendering/prePassRenderer.js +18 -3
  324. package/Rendering/prePassRenderer.js.map +1 -1
  325. package/Rendering/subSurfaceConfiguration.d.ts +2 -2
  326. package/Rendering/subSurfaceConfiguration.js +2 -2
  327. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  328. package/Sprites/spriteSceneComponent.js +4 -1
  329. package/Sprites/spriteSceneComponent.js.map +1 -1
  330. package/XR/features/WebXRControllerTeleportation.d.ts +4 -0
  331. package/XR/features/WebXRControllerTeleportation.js +24 -19
  332. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  333. package/XR/motionController/webXRAbstractMotionController.d.ts +2 -2
  334. package/XR/motionController/webXRAbstractMotionController.js +2 -2
  335. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  336. package/XR/motionController/webXRControllerComponent.d.ts +1 -1
  337. package/XR/motionController/webXRControllerComponent.js +1 -1
  338. package/XR/motionController/webXRControllerComponent.js.map +1 -1
  339. package/XR/motionController/webXRMotionControllerManager.d.ts +3 -3
  340. package/XR/motionController/webXRMotionControllerManager.js +3 -3
  341. package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
  342. package/node.d.ts +4 -4
  343. package/node.js +3 -3
  344. package/node.js.map +1 -1
  345. package/package.json +1 -1
  346. package/readme.md +0 -4
  347. package/scene.d.ts +80 -63
  348. package/scene.js +92 -46
  349. package/scene.js.map +1 -1
  350. package/sceneComponent.d.ts +1 -1
  351. package/sceneComponent.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Offline/database.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,kDAAkD;AAClD,MAAM,CAAC,sBAAsB,GAAG,CAAC,UAAkB,EAAE,uBAAkD,EAAE,oBAAoB,GAAG,KAAK,EAAE,EAAE;IACrI,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,uBAAuB,EAAE,oBAAoB,CAAC,CAAC;AACnF,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAmCjB;;;;;OAKG;IACH,YAAY,UAAkB,EAAE,uBAAkD,EAAE,oBAAoB,GAAG,KAAK;QA/BhH,4DAA4D;QACpD,gBAAW,GAAe,CAAC,OAAO,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,S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AAM,CAAC,CAAC;IAChF,MAAM,WAAW,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/D,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEa,+BAAsB,GAAG,CAAC,GAAW,EAAU,EAAE;IAC5D,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAChG,OAAO,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;KACzD;SAAM;QACH,OAAO,GAAG,CAAC;KACd;AACL,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { GetTGAHeader } from \"../Misc/tga\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { IOfflineProvider } from \"./IOfflineProvider\";\r\nimport { WebRequest } from \"../Misc/webRequest\";\r\n\r\n// Sets the default offline provider to Babylon.js\r\nEngine.OfflineProviderFactory = (urlToScene: string, callbackManifestChecked: (checked: boolean) => any, disableManifestCheck = false) => {\r\n return new Database(urlToScene, callbackManifestChecked, disableManifestCheck);\r\n};\r\n\r\n/**\r\n * Class used to enable access to IndexedDB\r\n * @see https://doc.babylonjs.com/how_to/caching_resources_in_indexeddb\r\n */\r\nexport class Database implements IOfflineProvider {\r\n private _currentSceneUrl: string;\r\n private _db: Nullable<IDBDatabase>;\r\n private _enableSceneOffline: boolean;\r\n private _enableTexturesOffline: boolean;\r\n private _manifestVersionFound: number;\r\n private _mustUpdateRessources: boolean;\r\n private _hasReachedQuota: boolean;\r\n private _isSupported: boolean;\r\n\r\n // Handling various flavors of prefixed version of IndexedDB\r\n private _idbFactory = <IDBFactory>(typeof indexedDB !== \"undefined\" ? indexedDB : undefined);\r\n\r\n /** Gets a boolean indicating if the user agent supports blob storage (this value will be updated after creating the first Database object) */\r\n private static _IsUASupportingBlobStorage = true;\r\n\r\n /**\r\n * Gets a boolean indicating if Database storage is enabled (off by default)\r\n */\r\n static IDBStorageEnabled = false;\r\n\r\n /**\r\n * Gets a boolean indicating if scene must be saved in the database\r\n */\r\n public get enableSceneOffline(): boolean {\r\n return this._enableSceneOffline;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if textures must be saved in the database\r\n */\r\n public get enableTexturesOffline(): boolean {\r\n return this._enableTexturesOffline;\r\n }\r\n\r\n /**\r\n * Creates a new Database\r\n * @param urlToScene defines the url to load the scene\r\n * @param callbackManifestChecked defines the callback to use when manifest is checked\r\n * @param disableManifestCheck defines a boolean indicating that we want to skip the manifest validation (it will be considered validated and up to date)\r\n */\r\n constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any, disableManifestCheck = false) {\r\n this._currentSceneUrl = Database._ReturnFullUrlLocation(urlToScene);\r\n this._db = null;\r\n this._enableSceneOffline = false;\r\n this._enableTexturesOffline = false;\r\n this._manifestVersionFound = 0;\r\n this._mustUpdateRessources = false;\r\n this._hasReachedQuota = false;\r\n\r\n if (!Database.IDBStorageEnabled) {\r\n callbackManifestChecked(true);\r\n } else {\r\n if (disableManifestCheck) {\r\n this._enableSceneOffline = true;\r\n this._enableTexturesOffline = true;\r\n this._manifestVersionFound = 1;\r\n Tools.SetImmediate(() => {\r\n callbackManifestChecked(true);\r\n });\r\n } else {\r\n this._checkManifestFile(callbackManifestChecked);\r\n }\r\n }\r\n }\r\n\r\n private static _ParseURL = (url: string) => {\r\n const a = document.createElement(\"a\");\r\n a.href = url;\r\n const urlWithoutHash = url.substring(0, url.lastIndexOf(\"#\"));\r\n const fileName = url.substring(urlWithoutHash.lastIndexOf(\"/\") + 1, url.length);\r\n const absLocation = url.substring(0, url.indexOf(fileName, 0));\r\n return absLocation;\r\n };\r\n\r\n private static _ReturnFullUrlLocation = (url: string): string => {\r\n if (url.indexOf(\"http:/\") === -1 && url.indexOf(\"https:/\") === -1 && typeof window !== \"undefined\") {\r\n return Database._ParseURL(window.location.href) + url;\r\n } else {\r\n return url;\r\n }\r\n };\r\n\r\n private _checkManifestFile(callbackManifestChecked: (checked: boolean) => any) {\r\n const noManifestFile = () => {\r\n this._enableSceneOffline = false;\r\n this._enableTexturesOffline = false;\r\n callbackManifestChecked(false);\r\n };\r\n\r\n const createManifestURL = (): string => {\r\n try {\r\n // make sure we have a valid URL.\r\n if (typeof URL === \"function\" && this._currentSceneUrl.indexOf(\"http\") === 0) {\r\n // we don't have the base url, so the URL string must have a protocol\r\n const url = new URL(this._currentSceneUrl);\r\n url.pathname += \".manifest\";\r\n return url.toString();\r\n }\r\n } catch (e) {\r\n // defensive - if this fails for any reason, fall back to the older method\r\n }\r\n\r\n return `${this._currentSceneUrl}.manifest`;\r\n };\r\n\r\n let timeStampUsed = false;\r\n let manifestURL = createManifestURL();\r\n\r\n const xhr = new WebRequest();\r\n\r\n if (navigator.onLine) {\r\n // Adding a timestamp to by-pass browsers' cache\r\n timeStampUsed = true;\r\n manifestURL = manifestURL + (manifestURL.match(/\\?/) == null ? \"?\" : \"&\") + Date.now();\r\n }\r\n xhr.open(\"GET\", manifestURL);\r\n\r\n xhr.addEventListener(\r\n \"load\",\r\n () => {\r\n if (xhr.status === 200 || Database._ValidateXHRData(xhr, 1)) {\r\n try {\r\n const manifestFile = JSON.parse(xhr.response);\r\n this._enableSceneOffline = manifestFile.enableSceneOffline;\r\n this._enableTexturesOffline = manifestFile.enableTexturesOffline && Database._IsUASupportingBlobStorage;\r\n if (manifestFile.version && !isNaN(parseInt(manifestFile.version))) {\r\n this._manifestVersionFound = manifestFile.version;\r\n }\r\n callbackManifestChecked(true);\r\n } catch (ex) {\r\n noManifestFile();\r\n }\r\n } else {\r\n noManifestFile();\r\n }\r\n },\r\n false\r\n );\r\n\r\n xhr.addEventListener(\r\n \"error\",\r\n () => {\r\n if (timeStampUsed) {\r\n timeStampUsed = false;\r\n // Let's retry without the timeStamp\r\n // It could fail when coupled with HTML5 Offline API\r\n const retryManifestURL = createManifestURL();\r\n xhr.open(\"GET\", retryManifestURL);\r\n xhr.send();\r\n } else {\r\n noManifestFile();\r\n }\r\n },\r\n false\r\n );\r\n\r\n try {\r\n xhr.send();\r\n } catch (ex) {\r\n Logger.Error(\"Error on XHR send request.\");\r\n callbackManifestChecked(false);\r\n }\r\n }\r\n\r\n /**\r\n * Open the database and make it available\r\n * @param successCallback defines the callback to call on success\r\n * @param errorCallback defines the callback to call on error\r\n */\r\n public open(successCallback: () => void, errorCallback: () => void): void {\r\n const handleError = () => {\r\n this._isSupported = false;\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n };\r\n\r\n if (!this._idbFactory || !(this._enableSceneOffline || this._enableTexturesOffline)) {\r\n // Your browser doesn't support IndexedDB\r\n this._isSupported = false;\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n } else {\r\n // If the DB hasn't been opened or created yet\r\n if (!this._db) {\r\n this._hasReachedQuota = false;\r\n this._isSupported = true;\r\n\r\n const request: IDBOpenDBRequest = this._idbFactory.open(\"babylonjs\", 1);\r\n\r\n // Could occur if user is blocking the quota for the DB and/or doesn't grant access to IndexedDB\r\n request.onerror = () => {\r\n handleError();\r\n };\r\n\r\n // executes when a version change transaction cannot complete due to other active transactions\r\n request.onblocked = () => {\r\n Logger.Error(\"IDB request blocked. Please reload the page.\");\r\n handleError();\r\n };\r\n\r\n // DB has been opened successfully\r\n request.onsuccess = () => {\r\n this._db = request.result;\r\n successCallback();\r\n };\r\n\r\n // Initialization of the DB. Creating Scenes & Textures stores\r\n request.onupgradeneeded = (event: IDBVersionChangeEvent) => {\r\n this._db = (<any>event.target).result;\r\n if (this._db) {\r\n try {\r\n this._db.createObjectStore(\"scenes\", { keyPath: \"sceneUrl\" });\r\n this._db.createObjectStore(\"versions\", { keyPath: \"sceneUrl\" });\r\n this._db.createObjectStore(\"textures\", { keyPath: \"textureUrl\" });\r\n } catch (ex) {\r\n Logger.Error(\"Error while creating object stores. Exception: \" + ex.message);\r\n handleError();\r\n }\r\n }\r\n };\r\n }\r\n // DB has already been created and opened\r\n else {\r\n if (successCallback) {\r\n successCallback();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Loads an image from the database\r\n * @param url defines the url to load from\r\n * @param image defines the target DOM image\r\n */\r\n public loadImage(url: string, image: HTMLImageElement) {\r\n const completeURL = Database._ReturnFullUrlLocation(url);\r\n\r\n const saveAndLoadImage = () => {\r\n if (!this._hasReachedQuota && this._db !== null) {\r\n // the texture is not yet in the DB, let's try to save it\r\n this._saveImageIntoDBAsync(completeURL, image);\r\n }\r\n // If the texture is not in the DB and we've reached the DB quota limit\r\n // let's load it directly from the web\r\n else {\r\n image.src = url;\r\n }\r\n };\r\n\r\n if (!this._mustUpdateRessources) {\r\n this._loadImageFromDBAsync(completeURL, image, saveAndLoadImage);\r\n }\r\n // First time we're download the images or update requested in the manifest file by a version change\r\n else {\r\n saveAndLoadImage();\r\n }\r\n }\r\n\r\n private _loadImageFromDBAsync(url: string, image: HTMLImageElement, notInDBCallback: () => any) {\r\n if (this._isSupported && this._db !== null) {\r\n let texture: any;\r\n const transaction: IDBTransaction = this._db.transaction([\"textures\"]);\r\n\r\n transaction.onabort = () => {\r\n image.src = url;\r\n };\r\n\r\n transaction.oncomplete = () => {\r\n let blobTextureURL: string;\r\n if (texture && typeof URL === \"function\") {\r\n blobTextureURL = URL.createObjectURL(texture.data);\r\n image.onerror = () => {\r\n Logger.Error(\"Error loading image from blob URL: \" + blobTextureURL + \" switching back to web url: \" + url);\r\n image.src = url;\r\n };\r\n image.src = blobTextureURL;\r\n } else {\r\n notInDBCallback();\r\n }\r\n };\r\n\r\n const getRequest: IDBRequest = transaction.objectStore(\"textures\").get(url);\r\n\r\n getRequest.onsuccess = (event) => {\r\n texture = (<any>event.target).result;\r\n };\r\n getRequest.onerror = () => {\r\n Logger.Error(\"Error loading texture \" + url + \" from DB.\");\r\n image.src = url;\r\n };\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n image.src = url;\r\n }\r\n }\r\n\r\n private _saveImageIntoDBAsync(url: string, image: HTMLImageElement) {\r\n let blob: Blob;\r\n\r\n if (this._isSupported) {\r\n // In case of error (type not supported or quota exceeded), we're at least sending back XHR data to allow texture loading later on\r\n const generateBlobUrl = () => {\r\n let blobTextureURL;\r\n\r\n if (blob && typeof URL === \"function\") {\r\n try {\r\n blobTextureURL = URL.createObjectURL(blob);\r\n } catch (ex) {\r\n // Chrome is raising a type error if we're setting the oneTimeOnly parameter\r\n blobTextureURL = URL.createObjectURL(blob);\r\n }\r\n }\r\n\r\n if (blobTextureURL) {\r\n image.src = blobTextureURL;\r\n }\r\n };\r\n\r\n if (Database._IsUASupportingBlobStorage) {\r\n // Create XHR\r\n const xhr = new WebRequest();\r\n\r\n xhr.open(\"GET\", url);\r\n xhr.responseType = \"blob\";\r\n\r\n xhr.addEventListener(\r\n \"load\",\r\n () => {\r\n if (xhr.status === 200 && this._db) {\r\n // Blob as response\r\n blob = xhr.response;\r\n\r\n const transaction = this._db.transaction([\"textures\"], \"readwrite\");\r\n\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = (event) => {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n const srcElement = <any>(event.srcElement || event.target);\r\n const error = srcElement.error;\r\n if (error && error.name === \"QuotaExceededError\") {\r\n this._hasReachedQuota = true;\r\n }\r\n } catch (ex) {}\r\n generateBlobUrl();\r\n };\r\n\r\n transaction.oncomplete = () => {\r\n generateBlobUrl();\r\n };\r\n\r\n const newTexture = { textureUrl: url, data: blob };\r\n\r\n try {\r\n // Put the blob into the dabase\r\n const addRequest = transaction.objectStore(\"textures\").put(newTexture);\r\n addRequest.onsuccess = () => {};\r\n addRequest.onerror = () => {\r\n generateBlobUrl();\r\n };\r\n } catch (ex) {\r\n // \"DataCloneError\" generated by Chrome when you try to inject blob into IndexedDB\r\n if (ex.code === 25) {\r\n Database._IsUASupportingBlobStorage = false;\r\n this._enableTexturesOffline = false;\r\n }\r\n image.src = url;\r\n }\r\n } else {\r\n image.src = url;\r\n }\r\n },\r\n false\r\n );\r\n\r\n xhr.addEventListener(\r\n \"error\",\r\n () => {\r\n Logger.Error(\"Error in XHR request in BABYLON.Database.\");\r\n image.src = url;\r\n },\r\n false\r\n );\r\n\r\n xhr.send();\r\n } else {\r\n image.src = url;\r\n }\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or Babylon.js database is not open.\");\r\n image.src = url;\r\n }\r\n }\r\n\r\n private _checkVersionFromDB(url: string, versionLoaded: (version: number) => void) {\r\n const updateVersion = () => {\r\n // the version is not yet in the DB or we need to update it\r\n this._saveVersionIntoDBAsync(url, versionLoaded);\r\n };\r\n this._loadVersionFromDBAsync(url, versionLoaded, updateVersion);\r\n }\r\n\r\n private _loadVersionFromDBAsync(url: string, callback: (version: number) => void, updateInDBCallback: () => void) {\r\n if (this._isSupported && this._db) {\r\n let version: any;\r\n try {\r\n const transaction = this._db.transaction([\"versions\"]);\r\n\r\n transaction.oncomplete = () => {\r\n if (version) {\r\n // If the version in the JSON file is different from the version in DB\r\n if (this._manifestVersionFound !== version.data) {\r\n this._mustUpdateRessources = true;\r\n updateInDBCallback();\r\n } else {\r\n callback(version.data);\r\n }\r\n }\r\n // version was not found in DB\r\n else {\r\n this._mustUpdateRessources = true;\r\n updateInDBCallback();\r\n }\r\n };\r\n\r\n transaction.onabort = () => {\r\n callback(-1);\r\n };\r\n\r\n const getRequest = transaction.objectStore(\"versions\").get(url);\r\n\r\n getRequest.onsuccess = (event) => {\r\n version = (<any>event.target).result;\r\n };\r\n getRequest.onerror = () => {\r\n Logger.Error(\"Error loading version for scene \" + url + \" from DB.\");\r\n callback(-1);\r\n };\r\n } catch (ex) {\r\n Logger.Error(\"Error while accessing 'versions' object store (READ OP). Exception: \" + ex.message);\r\n callback(-1);\r\n }\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or Babylon.js database is not open.\");\r\n callback(-1);\r\n }\r\n }\r\n\r\n private _saveVersionIntoDBAsync(url: string, callback: (version: number) => void) {\r\n if (this._isSupported && !this._hasReachedQuota && this._db) {\r\n try {\r\n // Open a transaction to the database\r\n const transaction = this._db.transaction([\"versions\"], \"readwrite\");\r\n\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = (event) => {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n const error = (<any>event.srcElement)[\"error\"];\r\n if (error && error.name === \"QuotaExceededError\") {\r\n this._hasReachedQuota = true;\r\n }\r\n } catch (ex) {}\r\n callback(-1);\r\n };\r\n\r\n transaction.oncomplete = () => {\r\n callback(this._manifestVersionFound);\r\n };\r\n\r\n const newVersion = { sceneUrl: url, data: this._manifestVersionFound };\r\n\r\n // Put the scene into the database\r\n const addRequest = transaction.objectStore(\"versions\").put(newVersion);\r\n addRequest.onsuccess = () => {};\r\n addRequest.onerror = () => {\r\n Logger.Error(\"Error in DB add version request in BABYLON.Database.\");\r\n };\r\n } catch (ex) {\r\n Logger.Error(\"Error while accessing 'versions' object store (WRITE OP). Exception: \" + ex.message);\r\n callback(-1);\r\n }\r\n } else {\r\n callback(-1);\r\n }\r\n }\r\n\r\n /**\r\n * Loads a file from database\r\n * @param url defines the URL to load from\r\n * @param sceneLoaded defines a callback to call on success\r\n * @param progressCallBack defines a callback to call when progress changed\r\n * @param errorCallback defines a callback to call on error\r\n * @param useArrayBuffer defines a boolean to use array buffer instead of text string\r\n */\r\n public loadFile(url: string, sceneLoaded: (data: any) => void, progressCallBack?: (data: any) => void, errorCallback?: () => void, useArrayBuffer?: boolean): void {\r\n const completeUrl = Database._ReturnFullUrlLocation(url);\r\n\r\n const saveAndLoadFile = () => {\r\n // the scene is not yet in the DB, let's try to save it\r\n this._saveFileAsync(completeUrl, sceneLoaded, progressCallBack, useArrayBuffer, errorCallback);\r\n };\r\n\r\n this._checkVersionFromDB(completeUrl, (version) => {\r\n if (version !== -1) {\r\n if (!this._mustUpdateRessources) {\r\n this._loadFileAsync(completeUrl, sceneLoaded, saveAndLoadFile);\r\n } else {\r\n this._saveFileAsync(completeUrl, sceneLoaded, progressCallBack, useArrayBuffer, errorCallback);\r\n }\r\n } else {\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n }\r\n });\r\n }\r\n\r\n private _loadFileAsync(url: string, callback: (data?: any) => void, notInDBCallback: () => void) {\r\n if (this._isSupported && this._db) {\r\n let targetStore: string;\r\n if (url.indexOf(\".babylon\") !== -1) {\r\n targetStore = \"scenes\";\r\n } else {\r\n targetStore = \"textures\";\r\n }\r\n\r\n let file: any;\r\n const transaction = this._db.transaction([targetStore]);\r\n\r\n transaction.oncomplete = () => {\r\n if (file) {\r\n callback(file.data);\r\n }\r\n // file was not found in DB\r\n else {\r\n notInDBCallback();\r\n }\r\n };\r\n\r\n transaction.onabort = () => {\r\n notInDBCallback();\r\n };\r\n\r\n const getRequest = transaction.objectStore(targetStore).get(url);\r\n\r\n getRequest.onsuccess = (event) => {\r\n file = (<any>event.target).result;\r\n };\r\n getRequest.onerror = () => {\r\n Logger.Error(\"Error loading file \" + url + \" from DB.\");\r\n notInDBCallback();\r\n };\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n callback();\r\n }\r\n }\r\n\r\n private _saveFileAsync(\r\n url: string,\r\n callback: (data?: any) => void,\r\n progressCallback?: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any,\r\n useArrayBuffer?: boolean,\r\n errorCallback?: (data?: any) => void\r\n ) {\r\n if (this._isSupported) {\r\n let targetStore: string;\r\n if (url.indexOf(\".babylon\") !== -1) {\r\n targetStore = \"scenes\";\r\n } else {\r\n targetStore = \"textures\";\r\n }\r\n\r\n // Create XHR\r\n const xhr = new WebRequest();\r\n let fileData: any;\r\n xhr.open(\"GET\", url + (url.match(/\\?/) == null ? \"?\" : \"&\") + Date.now());\r\n\r\n if (useArrayBuffer) {\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n if (progressCallback) {\r\n xhr.onprogress = progressCallback;\r\n }\r\n\r\n xhr.addEventListener(\r\n \"load\",\r\n () => {\r\n if (xhr.status === 200 || (xhr.status < 400 && Database._ValidateXHRData(xhr, !useArrayBuffer ? 1 : 6))) {\r\n // Blob as response\r\n fileData = !useArrayBuffer ? xhr.responseText : xhr.response;\r\n\r\n if (!this._hasReachedQuota && this._db) {\r\n // Open a transaction to the database\r\n const transaction = this._db.transaction([targetStore], \"readwrite\");\r\n\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = (event) => {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n const error = (<any>event.srcElement)[\"error\"];\r\n if (error && error.name === \"QuotaExceededError\") {\r\n this._hasReachedQuota = true;\r\n }\r\n } catch (ex) {}\r\n callback(fileData);\r\n };\r\n\r\n transaction.oncomplete = () => {\r\n callback(fileData);\r\n };\r\n\r\n let newFile;\r\n if (targetStore === \"scenes\") {\r\n newFile = { sceneUrl: url, data: fileData, version: this._manifestVersionFound };\r\n } else {\r\n newFile = { textureUrl: url, data: fileData };\r\n }\r\n\r\n try {\r\n // Put the scene into the database\r\n const addRequest = transaction.objectStore(targetStore).put(newFile);\r\n addRequest.onsuccess = () => {};\r\n addRequest.onerror = () => {\r\n Logger.Error(\"Error in DB add file request in BABYLON.Database.\");\r\n };\r\n } catch (ex) {\r\n callback(fileData);\r\n }\r\n } else {\r\n callback(fileData);\r\n }\r\n } else {\r\n if (xhr.status >= 400 && errorCallback) {\r\n errorCallback(xhr);\r\n } else {\r\n callback();\r\n }\r\n }\r\n },\r\n false\r\n );\r\n\r\n xhr.addEventListener(\r\n \"error\",\r\n () => {\r\n Logger.Error(\"error on XHR request.\");\r\n errorCallback && errorCallback();\r\n },\r\n false\r\n );\r\n\r\n xhr.send();\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or Babylon.js database is not open.\");\r\n errorCallback && errorCallback();\r\n }\r\n }\r\n\r\n /**\r\n * Validates if xhr data is correct\r\n * @param xhr defines the request to validate\r\n * @param dataType defines the expected data type\r\n * @returns true if data is correct\r\n */\r\n private static _ValidateXHRData(xhr: WebRequest, dataType = 7): boolean {\r\n // 1 for text (.babylon, manifest and shaders), 2 for TGA, 4 for DDS, 7 for all\r\n\r\n try {\r\n if (dataType & 1) {\r\n if (xhr.responseText && xhr.responseText.length > 0) {\r\n return true;\r\n } else if (dataType === 1) {\r\n return false;\r\n }\r\n }\r\n\r\n if (dataType & 2) {\r\n // Check header width and height since there is no \"TGA\" magic number\r\n const tgaHeader = GetTGAHeader(xhr.response);\r\n\r\n if (tgaHeader.width && tgaHeader.height && tgaHeader.width > 0 && tgaHeader.height > 0) {\r\n return true;\r\n } else if (dataType === 2) {\r\n return false;\r\n }\r\n }\r\n\r\n if (dataType & 4) {\r\n // Check for the \"DDS\" magic number\r\n const ddsHeader = new Uint8Array(xhr.response, 0, 3);\r\n\r\n if (ddsHeader[0] === 68 && ddsHeader[1] === 68 && ddsHeader[2] === 83) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n } catch (e) {\r\n // Global protection\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Offline/database.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MA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GAEG;AACI,0BAAiB,GAAG,KAAK,CAAC;AA+ClB,kBAAS,GAAG,CAAC,GAAW,EAAE,EAAE;IACvC,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;IACb,MAAM,cAAc,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAChF,MAAM,WAAW,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/D,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEa,+BAAsB,GAAG,CAAC,GAAW,EAAU,EAAE;IAC5D,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAChG,OAAO,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;KACzD;SAAM;QACH,OAAO,GAAG,CAAC;KACd;AACL,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { GetTGAHeader } from \"../Misc/tga\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport type { IOfflineProvider } from \"./IOfflineProvider\";\r\nimport { WebRequest } from \"../Misc/webRequest\";\r\n\r\n// Sets the default offline provider to Babylon.js\r\nEngine.OfflineProviderFactory = (urlToScene: string, callbackManifestChecked: (checked: boolean) => any, disableManifestCheck = false) => {\r\n return new Database(urlToScene, callbackManifestChecked, disableManifestCheck);\r\n};\r\n\r\n/**\r\n * Class used to enable access to IndexedDB\r\n * @see https://doc.babylonjs.com/how_to/caching_resources_in_indexeddb\r\n */\r\nexport class Database implements IOfflineProvider {\r\n private _currentSceneUrl: string;\r\n private _db: Nullable<IDBDatabase>;\r\n private _enableSceneOffline: boolean;\r\n private _enableTexturesOffline: boolean;\r\n private _manifestVersionFound: number;\r\n private _mustUpdateRessources: boolean;\r\n private _hasReachedQuota: boolean;\r\n private _isSupported: boolean;\r\n\r\n // Handling various flavors of prefixed version of IndexedDB\r\n private _idbFactory = <IDBFactory>(typeof indexedDB !== \"undefined\" ? indexedDB : undefined);\r\n\r\n /** Gets a boolean indicating if the user agent supports blob storage (this value will be updated after creating the first Database object) */\r\n private static _IsUASupportingBlobStorage = true;\r\n\r\n /**\r\n * Gets a boolean indicating if Database storage is enabled (off by default)\r\n */\r\n static IDBStorageEnabled = false;\r\n\r\n /**\r\n * Gets a boolean indicating if scene must be saved in the database\r\n */\r\n public get enableSceneOffline(): boolean {\r\n return this._enableSceneOffline;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if textures must be saved in the database\r\n */\r\n public get enableTexturesOffline(): boolean {\r\n return this._enableTexturesOffline;\r\n }\r\n\r\n /**\r\n * Creates a new Database\r\n * @param urlToScene defines the url to load the scene\r\n * @param callbackManifestChecked defines the callback to use when manifest is checked\r\n * @param disableManifestCheck defines a boolean indicating that we want to skip the manifest validation (it will be considered validated and up to date)\r\n */\r\n constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any, disableManifestCheck = false) {\r\n this._currentSceneUrl = Database._ReturnFullUrlLocation(urlToScene);\r\n this._db = null;\r\n this._enableSceneOffline = false;\r\n this._enableTexturesOffline = false;\r\n this._manifestVersionFound = 0;\r\n this._mustUpdateRessources = false;\r\n this._hasReachedQuota = false;\r\n\r\n if (!Database.IDBStorageEnabled) {\r\n callbackManifestChecked(true);\r\n } else {\r\n if (disableManifestCheck) {\r\n this._enableSceneOffline = true;\r\n this._enableTexturesOffline = true;\r\n this._manifestVersionFound = 1;\r\n Tools.SetImmediate(() => {\r\n callbackManifestChecked(true);\r\n });\r\n } else {\r\n this._checkManifestFile(callbackManifestChecked);\r\n }\r\n }\r\n }\r\n\r\n private static _ParseURL = (url: string) => {\r\n const a = document.createElement(\"a\");\r\n a.href = url;\r\n const urlWithoutHash = url.substring(0, url.lastIndexOf(\"#\"));\r\n const fileName = url.substring(urlWithoutHash.lastIndexOf(\"/\") + 1, url.length);\r\n const absLocation = url.substring(0, url.indexOf(fileName, 0));\r\n return absLocation;\r\n };\r\n\r\n private static _ReturnFullUrlLocation = (url: string): string => {\r\n if (url.indexOf(\"http:/\") === -1 && url.indexOf(\"https:/\") === -1 && typeof window !== \"undefined\") {\r\n return Database._ParseURL(window.location.href) + url;\r\n } else {\r\n return url;\r\n }\r\n };\r\n\r\n private _checkManifestFile(callbackManifestChecked: (checked: boolean) => any) {\r\n const noManifestFile = () => {\r\n this._enableSceneOffline = false;\r\n this._enableTexturesOffline = false;\r\n callbackManifestChecked(false);\r\n };\r\n\r\n const createManifestURL = (): string => {\r\n try {\r\n // make sure we have a valid URL.\r\n if (typeof URL === \"function\" && this._currentSceneUrl.indexOf(\"http\") === 0) {\r\n // we don't have the base url, so the URL string must have a protocol\r\n const url = new URL(this._currentSceneUrl);\r\n url.pathname += \".manifest\";\r\n return url.toString();\r\n }\r\n } catch (e) {\r\n // defensive - if this fails for any reason, fall back to the older method\r\n }\r\n\r\n return `${this._currentSceneUrl}.manifest`;\r\n };\r\n\r\n let timeStampUsed = false;\r\n let manifestURL = createManifestURL();\r\n\r\n const xhr = new WebRequest();\r\n\r\n if (navigator.onLine) {\r\n // Adding a timestamp to by-pass browsers' cache\r\n timeStampUsed = true;\r\n manifestURL = manifestURL + (manifestURL.match(/\\?/) == null ? \"?\" : \"&\") + Date.now();\r\n }\r\n xhr.open(\"GET\", manifestURL);\r\n\r\n xhr.addEventListener(\r\n \"load\",\r\n () => {\r\n if (xhr.status === 200 || Database._ValidateXHRData(xhr, 1)) {\r\n try {\r\n const manifestFile = JSON.parse(xhr.response);\r\n this._enableSceneOffline = manifestFile.enableSceneOffline;\r\n this._enableTexturesOffline = manifestFile.enableTexturesOffline && Database._IsUASupportingBlobStorage;\r\n if (manifestFile.version && !isNaN(parseInt(manifestFile.version))) {\r\n this._manifestVersionFound = manifestFile.version;\r\n }\r\n callbackManifestChecked(true);\r\n } catch (ex) {\r\n noManifestFile();\r\n }\r\n } else {\r\n noManifestFile();\r\n }\r\n },\r\n false\r\n );\r\n\r\n xhr.addEventListener(\r\n \"error\",\r\n () => {\r\n if (timeStampUsed) {\r\n timeStampUsed = false;\r\n // Let's retry without the timeStamp\r\n // It could fail when coupled with HTML5 Offline API\r\n const retryManifestURL = createManifestURL();\r\n xhr.open(\"GET\", retryManifestURL);\r\n xhr.send();\r\n } else {\r\n noManifestFile();\r\n }\r\n },\r\n false\r\n );\r\n\r\n try {\r\n xhr.send();\r\n } catch (ex) {\r\n Logger.Error(\"Error on XHR send request.\");\r\n callbackManifestChecked(false);\r\n }\r\n }\r\n\r\n /**\r\n * Open the database and make it available\r\n * @param successCallback defines the callback to call on success\r\n * @param errorCallback defines the callback to call on error\r\n */\r\n public open(successCallback: () => void, errorCallback: () => void): void {\r\n const handleError = () => {\r\n this._isSupported = false;\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n };\r\n\r\n if (!this._idbFactory || !(this._enableSceneOffline || this._enableTexturesOffline)) {\r\n // Your browser doesn't support IndexedDB\r\n this._isSupported = false;\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n } else {\r\n // If the DB hasn't been opened or created yet\r\n if (!this._db) {\r\n this._hasReachedQuota = false;\r\n this._isSupported = true;\r\n\r\n const request: IDBOpenDBRequest = this._idbFactory.open(\"babylonjs\", 1);\r\n\r\n // Could occur if user is blocking the quota for the DB and/or doesn't grant access to IndexedDB\r\n request.onerror = () => {\r\n handleError();\r\n };\r\n\r\n // executes when a version change transaction cannot complete due to other active transactions\r\n request.onblocked = () => {\r\n Logger.Error(\"IDB request blocked. Please reload the page.\");\r\n handleError();\r\n };\r\n\r\n // DB has been opened successfully\r\n request.onsuccess = () => {\r\n this._db = request.result;\r\n successCallback();\r\n };\r\n\r\n // Initialization of the DB. Creating Scenes & Textures stores\r\n request.onupgradeneeded = (event: IDBVersionChangeEvent) => {\r\n this._db = (<any>event.target).result;\r\n if (this._db) {\r\n try {\r\n this._db.createObjectStore(\"scenes\", { keyPath: \"sceneUrl\" });\r\n this._db.createObjectStore(\"versions\", { keyPath: \"sceneUrl\" });\r\n this._db.createObjectStore(\"textures\", { keyPath: \"textureUrl\" });\r\n } catch (ex) {\r\n Logger.Error(\"Error while creating object stores. Exception: \" + ex.message);\r\n handleError();\r\n }\r\n }\r\n };\r\n }\r\n // DB has already been created and opened\r\n else {\r\n if (successCallback) {\r\n successCallback();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Loads an image from the database\r\n * @param url defines the url to load from\r\n * @param image defines the target DOM image\r\n */\r\n public loadImage(url: string, image: HTMLImageElement) {\r\n const completeURL = Database._ReturnFullUrlLocation(url);\r\n\r\n const saveAndLoadImage = () => {\r\n if (!this._hasReachedQuota && this._db !== null) {\r\n // the texture is not yet in the DB, let's try to save it\r\n this._saveImageIntoDBAsync(completeURL, image);\r\n }\r\n // If the texture is not in the DB and we've reached the DB quota limit\r\n // let's load it directly from the web\r\n else {\r\n image.src = url;\r\n }\r\n };\r\n\r\n if (!this._mustUpdateRessources) {\r\n this._loadImageFromDBAsync(completeURL, image, saveAndLoadImage);\r\n }\r\n // First time we're download the images or update requested in the manifest file by a version change\r\n else {\r\n saveAndLoadImage();\r\n }\r\n }\r\n\r\n private _loadImageFromDBAsync(url: string, image: HTMLImageElement, notInDBCallback: () => any) {\r\n if (this._isSupported && this._db !== null) {\r\n let texture: any;\r\n const transaction: IDBTransaction = this._db.transaction([\"textures\"]);\r\n\r\n transaction.onabort = () => {\r\n image.src = url;\r\n };\r\n\r\n transaction.oncomplete = () => {\r\n let blobTextureURL: string;\r\n if (texture && typeof URL === \"function\") {\r\n blobTextureURL = URL.createObjectURL(texture.data);\r\n image.onerror = () => {\r\n Logger.Error(\"Error loading image from blob URL: \" + blobTextureURL + \" switching back to web url: \" + url);\r\n image.src = url;\r\n };\r\n image.src = blobTextureURL;\r\n } else {\r\n notInDBCallback();\r\n }\r\n };\r\n\r\n const getRequest: IDBRequest = transaction.objectStore(\"textures\").get(url);\r\n\r\n getRequest.onsuccess = (event) => {\r\n texture = (<any>event.target).result;\r\n };\r\n getRequest.onerror = () => {\r\n Logger.Error(\"Error loading texture \" + url + \" from DB.\");\r\n image.src = url;\r\n };\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n image.src = url;\r\n }\r\n }\r\n\r\n private _saveImageIntoDBAsync(url: string, image: HTMLImageElement) {\r\n let blob: Blob;\r\n\r\n if (this._isSupported) {\r\n // In case of error (type not supported or quota exceeded), we're at least sending back XHR data to allow texture loading later on\r\n const generateBlobUrl = () => {\r\n let blobTextureURL;\r\n\r\n if (blob && typeof URL === \"function\") {\r\n try {\r\n blobTextureURL = URL.createObjectURL(blob);\r\n } catch (ex) {\r\n // Chrome is raising a type error if we're setting the oneTimeOnly parameter\r\n blobTextureURL = URL.createObjectURL(blob);\r\n }\r\n }\r\n\r\n if (blobTextureURL) {\r\n image.src = blobTextureURL;\r\n }\r\n };\r\n\r\n if (Database._IsUASupportingBlobStorage) {\r\n // Create XHR\r\n const xhr = new WebRequest();\r\n\r\n xhr.open(\"GET\", url);\r\n xhr.responseType = \"blob\";\r\n\r\n xhr.addEventListener(\r\n \"load\",\r\n () => {\r\n if (xhr.status === 200 && this._db) {\r\n // Blob as response\r\n blob = xhr.response;\r\n\r\n const transaction = this._db.transaction([\"textures\"], \"readwrite\");\r\n\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = (event) => {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n const srcElement = <any>event.target;\r\n const error = srcElement.error;\r\n if (error && error.name === \"QuotaExceededError\") {\r\n this._hasReachedQuota = true;\r\n }\r\n } catch (ex) {}\r\n generateBlobUrl();\r\n };\r\n\r\n transaction.oncomplete = () => {\r\n generateBlobUrl();\r\n };\r\n\r\n const newTexture = { textureUrl: url, data: blob };\r\n\r\n try {\r\n // Put the blob into the dabase\r\n const addRequest = transaction.objectStore(\"textures\").put(newTexture);\r\n addRequest.onsuccess = () => {};\r\n addRequest.onerror = () => {\r\n generateBlobUrl();\r\n };\r\n } catch (ex) {\r\n // \"DataCloneError\" generated by Chrome when you try to inject blob into IndexedDB\r\n if (ex.code === 25) {\r\n Database._IsUASupportingBlobStorage = false;\r\n this._enableTexturesOffline = false;\r\n }\r\n image.src = url;\r\n }\r\n } else {\r\n image.src = url;\r\n }\r\n },\r\n false\r\n );\r\n\r\n xhr.addEventListener(\r\n \"error\",\r\n () => {\r\n Logger.Error(\"Error in XHR request in BABYLON.Database.\");\r\n image.src = url;\r\n },\r\n false\r\n );\r\n\r\n xhr.send();\r\n } else {\r\n image.src = url;\r\n }\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or Babylon.js database is not open.\");\r\n image.src = url;\r\n }\r\n }\r\n\r\n private _checkVersionFromDB(url: string, versionLoaded: (version: number) => void) {\r\n const updateVersion = () => {\r\n // the version is not yet in the DB or we need to update it\r\n this._saveVersionIntoDBAsync(url, versionLoaded);\r\n };\r\n this._loadVersionFromDBAsync(url, versionLoaded, updateVersion);\r\n }\r\n\r\n private _loadVersionFromDBAsync(url: string, callback: (version: number) => void, updateInDBCallback: () => void) {\r\n if (this._isSupported && this._db) {\r\n let version: any;\r\n try {\r\n const transaction = this._db.transaction([\"versions\"]);\r\n\r\n transaction.oncomplete = () => {\r\n if (version) {\r\n // If the version in the JSON file is different from the version in DB\r\n if (this._manifestVersionFound !== version.data) {\r\n this._mustUpdateRessources = true;\r\n updateInDBCallback();\r\n } else {\r\n callback(version.data);\r\n }\r\n }\r\n // version was not found in DB\r\n else {\r\n this._mustUpdateRessources = true;\r\n updateInDBCallback();\r\n }\r\n };\r\n\r\n transaction.onabort = () => {\r\n callback(-1);\r\n };\r\n\r\n const getRequest = transaction.objectStore(\"versions\").get(url);\r\n\r\n getRequest.onsuccess = (event) => {\r\n version = (<any>event.target).result;\r\n };\r\n getRequest.onerror = () => {\r\n Logger.Error(\"Error loading version for scene \" + url + \" from DB.\");\r\n callback(-1);\r\n };\r\n } catch (ex) {\r\n Logger.Error(\"Error while accessing 'versions' object store (READ OP). Exception: \" + ex.message);\r\n callback(-1);\r\n }\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or Babylon.js database is not open.\");\r\n callback(-1);\r\n }\r\n }\r\n\r\n private _saveVersionIntoDBAsync(url: string, callback: (version: number) => void) {\r\n if (this._isSupported && !this._hasReachedQuota && this._db) {\r\n try {\r\n // Open a transaction to the database\r\n const transaction = this._db.transaction([\"versions\"], \"readwrite\");\r\n\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = (event) => {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n const error = (<any>event.target)[\"error\"];\r\n if (error && error.name === \"QuotaExceededError\") {\r\n this._hasReachedQuota = true;\r\n }\r\n } catch (ex) {}\r\n callback(-1);\r\n };\r\n\r\n transaction.oncomplete = () => {\r\n callback(this._manifestVersionFound);\r\n };\r\n\r\n const newVersion = { sceneUrl: url, data: this._manifestVersionFound };\r\n\r\n // Put the scene into the database\r\n const addRequest = transaction.objectStore(\"versions\").put(newVersion);\r\n addRequest.onsuccess = () => {};\r\n addRequest.onerror = () => {\r\n Logger.Error(\"Error in DB add version request in BABYLON.Database.\");\r\n };\r\n } catch (ex) {\r\n Logger.Error(\"Error while accessing 'versions' object store (WRITE OP). Exception: \" + ex.message);\r\n callback(-1);\r\n }\r\n } else {\r\n callback(-1);\r\n }\r\n }\r\n\r\n /**\r\n * Loads a file from database\r\n * @param url defines the URL to load from\r\n * @param sceneLoaded defines a callback to call on success\r\n * @param progressCallBack defines a callback to call when progress changed\r\n * @param errorCallback defines a callback to call on error\r\n * @param useArrayBuffer defines a boolean to use array buffer instead of text string\r\n */\r\n public loadFile(url: string, sceneLoaded: (data: any) => void, progressCallBack?: (data: any) => void, errorCallback?: () => void, useArrayBuffer?: boolean): void {\r\n const completeUrl = Database._ReturnFullUrlLocation(url);\r\n\r\n const saveAndLoadFile = () => {\r\n // the scene is not yet in the DB, let's try to save it\r\n this._saveFileAsync(completeUrl, sceneLoaded, progressCallBack, useArrayBuffer, errorCallback);\r\n };\r\n\r\n this._checkVersionFromDB(completeUrl, (version) => {\r\n if (version !== -1) {\r\n if (!this._mustUpdateRessources) {\r\n this._loadFileAsync(completeUrl, sceneLoaded, saveAndLoadFile);\r\n } else {\r\n this._saveFileAsync(completeUrl, sceneLoaded, progressCallBack, useArrayBuffer, errorCallback);\r\n }\r\n } else {\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n }\r\n });\r\n }\r\n\r\n private _loadFileAsync(url: string, callback: (data?: any) => void, notInDBCallback: () => void) {\r\n if (this._isSupported && this._db) {\r\n let targetStore: string;\r\n if (url.indexOf(\".babylon\") !== -1) {\r\n targetStore = \"scenes\";\r\n } else {\r\n targetStore = \"textures\";\r\n }\r\n\r\n let file: any;\r\n const transaction = this._db.transaction([targetStore]);\r\n\r\n transaction.oncomplete = () => {\r\n if (file) {\r\n callback(file.data);\r\n }\r\n // file was not found in DB\r\n else {\r\n notInDBCallback();\r\n }\r\n };\r\n\r\n transaction.onabort = () => {\r\n notInDBCallback();\r\n };\r\n\r\n const getRequest = transaction.objectStore(targetStore).get(url);\r\n\r\n getRequest.onsuccess = (event) => {\r\n file = (<any>event.target).result;\r\n };\r\n getRequest.onerror = () => {\r\n Logger.Error(\"Error loading file \" + url + \" from DB.\");\r\n notInDBCallback();\r\n };\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n callback();\r\n }\r\n }\r\n\r\n private _saveFileAsync(\r\n url: string,\r\n callback: (data?: any) => void,\r\n progressCallback?: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any,\r\n useArrayBuffer?: boolean,\r\n errorCallback?: (data?: any) => void\r\n ) {\r\n if (this._isSupported) {\r\n let targetStore: string;\r\n if (url.indexOf(\".babylon\") !== -1) {\r\n targetStore = \"scenes\";\r\n } else {\r\n targetStore = \"textures\";\r\n }\r\n\r\n // Create XHR\r\n const xhr = new WebRequest();\r\n let fileData: any;\r\n xhr.open(\"GET\", url + (url.match(/\\?/) == null ? \"?\" : \"&\") + Date.now());\r\n\r\n if (useArrayBuffer) {\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n\r\n if (progressCallback) {\r\n xhr.onprogress = progressCallback;\r\n }\r\n\r\n xhr.addEventListener(\r\n \"load\",\r\n () => {\r\n if (xhr.status === 200 || (xhr.status < 400 && Database._ValidateXHRData(xhr, !useArrayBuffer ? 1 : 6))) {\r\n // Blob as response\r\n fileData = !useArrayBuffer ? xhr.responseText : xhr.response;\r\n\r\n if (!this._hasReachedQuota && this._db) {\r\n // Open a transaction to the database\r\n const transaction = this._db.transaction([targetStore], \"readwrite\");\r\n\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = (event) => {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n const error = (<any>event.target)[\"error\"];\r\n if (error && error.name === \"QuotaExceededError\") {\r\n this._hasReachedQuota = true;\r\n }\r\n } catch (ex) {}\r\n callback(fileData);\r\n };\r\n\r\n transaction.oncomplete = () => {\r\n callback(fileData);\r\n };\r\n\r\n let newFile;\r\n if (targetStore === \"scenes\") {\r\n newFile = { sceneUrl: url, data: fileData, version: this._manifestVersionFound };\r\n } else {\r\n newFile = { textureUrl: url, data: fileData };\r\n }\r\n\r\n try {\r\n // Put the scene into the database\r\n const addRequest = transaction.objectStore(targetStore).put(newFile);\r\n addRequest.onsuccess = () => {};\r\n addRequest.onerror = () => {\r\n Logger.Error(\"Error in DB add file request in BABYLON.Database.\");\r\n };\r\n } catch (ex) {\r\n callback(fileData);\r\n }\r\n } else {\r\n callback(fileData);\r\n }\r\n } else {\r\n if (xhr.status >= 400 && errorCallback) {\r\n errorCallback(xhr);\r\n } else {\r\n callback();\r\n }\r\n }\r\n },\r\n false\r\n );\r\n\r\n xhr.addEventListener(\r\n \"error\",\r\n () => {\r\n Logger.Error(\"error on XHR request.\");\r\n errorCallback && errorCallback();\r\n },\r\n false\r\n );\r\n\r\n xhr.send();\r\n } else {\r\n Logger.Error(\"Error: IndexedDB not supported by your browser or Babylon.js database is not open.\");\r\n errorCallback && errorCallback();\r\n }\r\n }\r\n\r\n /**\r\n * Validates if xhr data is correct\r\n * @param xhr defines the request to validate\r\n * @param dataType defines the expected data type\r\n * @returns true if data is correct\r\n */\r\n private static _ValidateXHRData(xhr: WebRequest, dataType = 7): boolean {\r\n // 1 for text (.babylon, manifest and shaders), 2 for TGA, 4 for DDS, 7 for all\r\n\r\n try {\r\n if (dataType & 1) {\r\n if (xhr.responseText && xhr.responseText.length > 0) {\r\n return true;\r\n } else if (dataType === 1) {\r\n return false;\r\n }\r\n }\r\n\r\n if (dataType & 2) {\r\n // Check header width and height since there is no \"TGA\" magic number\r\n const tgaHeader = GetTGAHeader(xhr.response);\r\n\r\n if (tgaHeader.width && tgaHeader.height && tgaHeader.width > 0 && tgaHeader.height > 0) {\r\n return true;\r\n } else if (dataType === 2) {\r\n return false;\r\n }\r\n }\r\n\r\n if (dataType & 4) {\r\n // Check for the \"DDS\" magic number\r\n const ddsHeader = new Uint8Array(xhr.response, 0, 3);\r\n\r\n if (ddsHeader[0] === 68 && ddsHeader[1] === 68 && ddsHeader[2] === 83) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n } catch (e) {\r\n // Global protection\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n"]}
@@ -307,7 +307,7 @@ export interface IParticleSystem {
307
307
  isStopping(): boolean;
308
308
  /**
309
309
  * Is this system ready to be used/rendered
310
- * @return true if the system is ready
310
+ * @returns true if the system is ready
311
311
  */
312
312
  isReady(): boolean;
313
313
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"IParticleSystem.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Particles/IParticleSystem.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport type { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type {\r\n BoxParticleEmitter,\r\n IParticleEmitterType,\r\n PointParticleEmitter,\r\n HemisphericParticleEmitter,\r\n SphereParticleEmitter,\r\n SphereDirectedParticleEmitter,\r\n CylinderParticleEmitter,\r\n ConeParticleEmitter,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"../Particles/EmitterTypes/index\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient } from \"../Misc/gradients\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Observable } from \"../Misc/observable\";\r\n\r\ndeclare type Animation = import(\"../Animations/animation\").Animation;\r\ndeclare type AbstractMesh = import(\"../Meshes/abstractMesh\").AbstractMesh;\r\n\r\n/**\r\n * Interface representing a particle system in Babylon.js.\r\n * This groups the common functionalities that needs to be implemented in order to create a particle system.\r\n * A particle system represents a way to manage particles from their emission to their animation and rendering.\r\n */\r\nexport interface IParticleSystem {\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n animations: Animation[];\r\n /**\r\n * The id of the Particle system.\r\n */\r\n id: string;\r\n /**\r\n * The name of the Particle system.\r\n */\r\n name: string;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n emitter: Nullable<AbstractMesh | Vector3>;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n isBillboardBased: boolean;\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n renderingGroupId: number;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n updateSpeed: number;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n targetStopDuration: number;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE, ParticleSystem.BLENDMODE_STANDARD or ParticleSystem.BLENDMODE_ADD.\r\n */\r\n blendMode: number;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n minLifeTime: number;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n maxLifeTime: number;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n minSize: number;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n maxSize: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n minScaleX: number;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n maxScaleX: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n minScaleY: number;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n maxScaleY: number;\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color1: Color4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color2: Color4;\r\n\r\n /**\r\n * Color the particle will have at the end of its lifetime.\r\n */\r\n colorDead: Color4;\r\n\r\n /**\r\n * The maximum number of particles to emit per frame until we reach the activeParticleCount value\r\n */\r\n emitRate: number;\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n minEmitPower: number;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n maxEmitPower: number;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n minAngularSpeed: number;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n maxAngularSpeed: number;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n minInitialRotation: number;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n maxInitialRotation: number;\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n particleEmitterType: Nullable<IParticleEmitterType>;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n startDelay: number;\r\n /**\r\n * Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0\r\n */\r\n preWarmCycles: number;\r\n /**\r\n * Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)\r\n */\r\n preWarmStepOffset: number;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n spriteCellChangeSpeed: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n startSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n endSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines whether the sprite animation is looping\r\n */\r\n spriteCellLoop: boolean;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n spriteCellWidth: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n spriteCellHeight: number;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n spriteRandomStartCell: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture\r\n */\r\n isAnimationSheetEnabled: boolean;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n translationPivot: Vector2;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n noiseTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n noiseStrength: Vector3;\r\n\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n billboardMode: number;\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n limitVelocityDamping: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n beginAnimationOnStart: boolean;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n beginAnimationFrom: number;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n beginAnimationTo: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n beginAnimationLoop: boolean;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n disposeOnStop: boolean;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n manualEmitCount: number;\r\n\r\n /**\r\n * Specifies if the particles are updated in emitter local space or world space\r\n */\r\n isLocal: boolean;\r\n\r\n /** Snippet ID if the particle system was created from the snippet server */\r\n snippetId: string;\r\n\r\n /** Gets or sets a matrix to use to compute projection */\r\n defaultProjectionMatrix: Matrix;\r\n\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n getCapacity(): number;\r\n\r\n /**\r\n * Gets the number of particles active at the same time.\r\n * @returns The number of active particles.\r\n */\r\n getActiveCount(): number;\r\n\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n isStarted(): boolean;\r\n\r\n /**\r\n * Animates the particle system for this frame.\r\n */\r\n animate(): void;\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n render(): number;\r\n /**\r\n * Dispose the particle system and frees its associated resources.\r\n * @param disposeTexture defines if the particle texture must be disposed as well (true by default)\r\n */\r\n dispose(disposeTexture?: boolean): void;\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n onDisposeObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is stopped\r\n */\r\n onStoppedObservable: Observable<IParticleSystem>;\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n clone(name: string, newEmitter: any): Nullable<IParticleSystem>;\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n serialize(serializeTexture: boolean): any;\r\n /**\r\n * Rebuild the particle system\r\n */\r\n rebuild(): void;\r\n\r\n /** Force the system to rebuild all gradients that need to be resync */\r\n forceRefreshGradients(): void;\r\n\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n start(delay?: number): void;\r\n\r\n /**\r\n * Stops the particle system.\r\n */\r\n stop(): void;\r\n\r\n /**\r\n * Remove all active particles\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Gets a boolean indicating that the system is stopping\r\n * @returns true if the system is currently stopping\r\n */\r\n isStopping(): boolean;\r\n\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @return true if the system is ready\r\n */\r\n isReady(): boolean;\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n getClassName(): string;\r\n /**\r\n * Gets the custom effect used to render the particles\r\n * @param blendMode Blend mode for which the effect should be retrieved\r\n * @returns The effect\r\n */\r\n getCustomEffect(blendMode: number): Nullable<Effect>;\r\n /**\r\n * Sets the custom effect used to render the particles\r\n * @param effect The effect to set\r\n * @param blendMode Blend mode for which the effect should be set\r\n */\r\n setCustomEffect(effect: Nullable<Effect>, blendMode: number): void;\r\n\r\n /**\r\n * Fill the defines array according to the current settings of the particle system\r\n * @param defines Array to be updated\r\n * @param blendMode blend mode to take into account when updating the array\r\n */\r\n fillDefines(defines: Array<string>, blendMode: number): void;\r\n /**\r\n * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system\r\n * @param uniforms Uniforms array to fill\r\n * @param attributes Attributes array to fill\r\n * @param samplers Samplers array to fill\r\n */\r\n fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;\r\n /**\r\n * Observable that will be called just before the particles are drawn\r\n */\r\n onBeforeDrawParticlesObservable: Observable<Nullable<Effect>>;\r\n /**\r\n * Gets the name of the particle vertex shader\r\n */\r\n vertexShaderName: string;\r\n\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeColorGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n getSizeGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n getAngularSpeedGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeAngularSpeedGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n getVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n getLimitVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLimitVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeDragGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n getDragGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeEmitRateGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n getEmitRateGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeStartSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n getStartSizeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLifeTimeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n getLifeTimeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n addRampGradient(gradient: number, color: Color3): IParticleSystem;\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to update this list\r\n * @returns the list of ramp gradients\r\n */\r\n getRampGradients(): Nullable<Array<Color3Gradient>>;\r\n\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see https://doc.babylonjs.com/babylon101/particles#ramp-gradients\r\n */\r\n useRampGradients: boolean;\r\n\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n getColorRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n getAlphaRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createHemisphericEmitter(radius: number, radiusRange: number): HemisphericParticleEmitter;\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createSphereEmitter(radius: number, radiusRange: number): SphereParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n createDirectedSphereEmitter(radius: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n createCylinderEmitter(radius: number, height: number, radiusRange: number, directionRandomizer: number): CylinderParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n createDirectedCylinderEmitter(radius: number, height: number, radiusRange: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n createConeEmitter(radius: number, angle: number): ConeParticleEmitter;\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n getScene(): Nullable<Scene>;\r\n}\r\n"]}
1
+ {"version":3,"file":"IParticleSystem.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Particles/IParticleSystem.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport type { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type {\r\n BoxParticleEmitter,\r\n IParticleEmitterType,\r\n PointParticleEmitter,\r\n HemisphericParticleEmitter,\r\n SphereParticleEmitter,\r\n SphereDirectedParticleEmitter,\r\n CylinderParticleEmitter,\r\n ConeParticleEmitter,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"../Particles/EmitterTypes/index\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient } from \"../Misc/gradients\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Observable } from \"../Misc/observable\";\r\n\r\ndeclare type Animation = import(\"../Animations/animation\").Animation;\r\ndeclare type AbstractMesh = import(\"../Meshes/abstractMesh\").AbstractMesh;\r\n\r\n/**\r\n * Interface representing a particle system in Babylon.js.\r\n * This groups the common functionalities that needs to be implemented in order to create a particle system.\r\n * A particle system represents a way to manage particles from their emission to their animation and rendering.\r\n */\r\nexport interface IParticleSystem {\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n animations: Animation[];\r\n /**\r\n * The id of the Particle system.\r\n */\r\n id: string;\r\n /**\r\n * The name of the Particle system.\r\n */\r\n name: string;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n emitter: Nullable<AbstractMesh | Vector3>;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n isBillboardBased: boolean;\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n renderingGroupId: number;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n updateSpeed: number;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n targetStopDuration: number;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE, ParticleSystem.BLENDMODE_STANDARD or ParticleSystem.BLENDMODE_ADD.\r\n */\r\n blendMode: number;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n minLifeTime: number;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n maxLifeTime: number;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n minSize: number;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n maxSize: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n minScaleX: number;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n maxScaleX: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n minScaleY: number;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n maxScaleY: number;\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color1: Color4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color2: Color4;\r\n\r\n /**\r\n * Color the particle will have at the end of its lifetime.\r\n */\r\n colorDead: Color4;\r\n\r\n /**\r\n * The maximum number of particles to emit per frame until we reach the activeParticleCount value\r\n */\r\n emitRate: number;\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n minEmitPower: number;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n maxEmitPower: number;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n minAngularSpeed: number;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n maxAngularSpeed: number;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n minInitialRotation: number;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n maxInitialRotation: number;\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n particleEmitterType: Nullable<IParticleEmitterType>;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n startDelay: number;\r\n /**\r\n * Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0\r\n */\r\n preWarmCycles: number;\r\n /**\r\n * Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)\r\n */\r\n preWarmStepOffset: number;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n spriteCellChangeSpeed: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n startSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n endSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines whether the sprite animation is looping\r\n */\r\n spriteCellLoop: boolean;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n spriteCellWidth: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n spriteCellHeight: number;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n spriteRandomStartCell: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture\r\n */\r\n isAnimationSheetEnabled: boolean;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n translationPivot: Vector2;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n noiseTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n noiseStrength: Vector3;\r\n\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n billboardMode: number;\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n limitVelocityDamping: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n beginAnimationOnStart: boolean;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n beginAnimationFrom: number;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n beginAnimationTo: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n beginAnimationLoop: boolean;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n disposeOnStop: boolean;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n manualEmitCount: number;\r\n\r\n /**\r\n * Specifies if the particles are updated in emitter local space or world space\r\n */\r\n isLocal: boolean;\r\n\r\n /** Snippet ID if the particle system was created from the snippet server */\r\n snippetId: string;\r\n\r\n /** Gets or sets a matrix to use to compute projection */\r\n defaultProjectionMatrix: Matrix;\r\n\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n getCapacity(): number;\r\n\r\n /**\r\n * Gets the number of particles active at the same time.\r\n * @returns The number of active particles.\r\n */\r\n getActiveCount(): number;\r\n\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n isStarted(): boolean;\r\n\r\n /**\r\n * Animates the particle system for this frame.\r\n */\r\n animate(): void;\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n render(): number;\r\n /**\r\n * Dispose the particle system and frees its associated resources.\r\n * @param disposeTexture defines if the particle texture must be disposed as well (true by default)\r\n */\r\n dispose(disposeTexture?: boolean): void;\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n onDisposeObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is stopped\r\n */\r\n onStoppedObservable: Observable<IParticleSystem>;\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n clone(name: string, newEmitter: any): Nullable<IParticleSystem>;\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n serialize(serializeTexture: boolean): any;\r\n /**\r\n * Rebuild the particle system\r\n */\r\n rebuild(): void;\r\n\r\n /** Force the system to rebuild all gradients that need to be resync */\r\n forceRefreshGradients(): void;\r\n\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n start(delay?: number): void;\r\n\r\n /**\r\n * Stops the particle system.\r\n */\r\n stop(): void;\r\n\r\n /**\r\n * Remove all active particles\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Gets a boolean indicating that the system is stopping\r\n * @returns true if the system is currently stopping\r\n */\r\n isStopping(): boolean;\r\n\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @returns true if the system is ready\r\n */\r\n isReady(): boolean;\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n getClassName(): string;\r\n /**\r\n * Gets the custom effect used to render the particles\r\n * @param blendMode Blend mode for which the effect should be retrieved\r\n * @returns The effect\r\n */\r\n getCustomEffect(blendMode: number): Nullable<Effect>;\r\n /**\r\n * Sets the custom effect used to render the particles\r\n * @param effect The effect to set\r\n * @param blendMode Blend mode for which the effect should be set\r\n */\r\n setCustomEffect(effect: Nullable<Effect>, blendMode: number): void;\r\n\r\n /**\r\n * Fill the defines array according to the current settings of the particle system\r\n * @param defines Array to be updated\r\n * @param blendMode blend mode to take into account when updating the array\r\n */\r\n fillDefines(defines: Array<string>, blendMode: number): void;\r\n /**\r\n * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system\r\n * @param uniforms Uniforms array to fill\r\n * @param attributes Attributes array to fill\r\n * @param samplers Samplers array to fill\r\n */\r\n fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;\r\n /**\r\n * Observable that will be called just before the particles are drawn\r\n */\r\n onBeforeDrawParticlesObservable: Observable<Nullable<Effect>>;\r\n /**\r\n * Gets the name of the particle vertex shader\r\n */\r\n vertexShaderName: string;\r\n\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeColorGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n getSizeGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n getAngularSpeedGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeAngularSpeedGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n getVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n getLimitVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLimitVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeDragGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n getDragGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeEmitRateGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n getEmitRateGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeStartSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n getStartSizeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLifeTimeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n getLifeTimeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n addRampGradient(gradient: number, color: Color3): IParticleSystem;\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to update this list\r\n * @returns the list of ramp gradients\r\n */\r\n getRampGradients(): Nullable<Array<Color3Gradient>>;\r\n\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see https://doc.babylonjs.com/babylon101/particles#ramp-gradients\r\n */\r\n useRampGradients: boolean;\r\n\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n getColorRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n getAlphaRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createHemisphericEmitter(radius: number, radiusRange: number): HemisphericParticleEmitter;\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createSphereEmitter(radius: number, radiusRange: number): SphereParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n createDirectedSphereEmitter(radius: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n createCylinderEmitter(radius: number, height: number, radiusRange: number, directionRandomizer: number): CylinderParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n createDirectedCylinderEmitter(radius: number, height: number, radiusRange: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n createConeEmitter(radius: number, angle: number): ConeParticleEmitter;\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n getScene(): Nullable<Scene>;\r\n}\r\n"]}
@@ -88,7 +88,7 @@ export declare class GPUParticleSystem extends BaseParticleSystem implements IDi
88
88
  defaultProjectionMatrix: Matrix;
89
89
  /**
90
90
  * Is this system ready to be used/rendered
91
- * @return true if the system is ready
91
+ * @returns true if the system is ready
92
92
  */
93
93
  isReady(): boolean;
94
94
  /**
@@ -170,7 +170,7 @@ export class GPUParticleSystem extends BaseParticleSystem {
170
170
  }
171
171
  /**
172
172
  * Is this system ready to be used/rendered
173
- * @return true if the system is ready
173
+ * @returns true if the system is ready
174
174
  */
175
175
  isReady() {
176
176
  if (!this.emitter || (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.isReady()) || !this.particleTexture || !this.particleTexture.isReady()) {