@babylonjs/core 5.25.0 → 5.26.1

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 (109) hide show
  1. package/Audio/audioEngine.js +1 -2
  2. package/Audio/audioEngine.js.map +1 -1
  3. package/Cameras/Inputs/freeCameraDeviceOrientationInput.d.ts +4 -1
  4. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +17 -4
  5. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
  6. package/Cameras/VR/vrExperienceHelper.js +1 -24
  7. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  8. package/Culling/Octrees/octreeSceneComponent.js +1 -5
  9. package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
  10. package/DeviceInput/webDeviceInputSystem.js +0 -18
  11. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  12. package/Engines/Extensions/engine.cubeTexture.js +3 -2
  13. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  14. package/Engines/engine.js +3 -34
  15. package/Engines/engine.js.map +1 -1
  16. package/Engines/thinEngine.js +2 -14
  17. package/Engines/thinEngine.js.map +1 -1
  18. package/Gamepads/gamepadManager.js +2 -2
  19. package/Gamepads/gamepadManager.js.map +1 -1
  20. package/Layers/layer.d.ts +7 -0
  21. package/Layers/layer.js +11 -0
  22. package/Layers/layer.js.map +1 -1
  23. package/Layers/layerSceneComponent.d.ts +4 -2
  24. package/Layers/layerSceneComponent.js +27 -11
  25. package/Layers/layerSceneComponent.js.map +1 -1
  26. package/Loading/loadingScreen.js +6 -6
  27. package/Loading/loadingScreen.js.map +1 -1
  28. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +1 -2
  29. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  30. package/Materials/Textures/renderTargetTexture.js +3 -0
  31. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  32. package/Materials/Textures/thinRenderTargetTexture.js +1 -1
  33. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  34. package/Materials/Textures/videoTexture.js +2 -2
  35. package/Materials/Textures/videoTexture.js.map +1 -1
  36. package/Materials/material.js +5 -2
  37. package/Materials/material.js.map +1 -1
  38. package/Materials/materialHelper.js +1 -6
  39. package/Materials/materialHelper.js.map +1 -1
  40. package/Maths/math.vector.d.ts +47 -10
  41. package/Maths/math.vector.js +89 -10
  42. package/Maths/math.vector.js.map +1 -1
  43. package/Meshes/instancedMesh.js +1 -1
  44. package/Meshes/instancedMesh.js.map +1 -1
  45. package/Meshes/mesh.d.ts +1 -1
  46. package/Meshes/mesh.js +4 -6
  47. package/Meshes/mesh.js.map +1 -1
  48. package/Meshes/subMesh.d.ts +2 -0
  49. package/Meshes/subMesh.js +2 -0
  50. package/Meshes/subMesh.js.map +1 -1
  51. package/Misc/tools.d.ts +9 -0
  52. package/Misc/tools.js +14 -5
  53. package/Misc/tools.js.map +1 -1
  54. package/Misc/virtualJoystick.js +0 -1
  55. package/Misc/virtualJoystick.js.map +1 -1
  56. package/Particles/IParticleSystem.d.ts +6 -0
  57. package/Particles/IParticleSystem.js.map +1 -1
  58. package/Particles/baseParticleSystem.d.ts +8 -0
  59. package/Particles/baseParticleSystem.js +12 -0
  60. package/Particles/baseParticleSystem.js.map +1 -1
  61. package/Particles/gpuParticleSystem.d.ts +1 -1
  62. package/Particles/gpuParticleSystem.js +12 -2
  63. package/Particles/gpuParticleSystem.js.map +1 -1
  64. package/Particles/particleSystem.d.ts +1 -1
  65. package/Particles/particleSystem.js +17 -2
  66. package/Particles/particleSystem.js.map +1 -1
  67. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +1 -1
  68. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  69. package/Rendering/renderingManager.d.ts +11 -0
  70. package/Rendering/renderingManager.js +55 -9
  71. package/Rendering/renderingManager.js.map +1 -1
  72. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +2 -2
  73. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
  74. package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js +1 -1
  75. package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -1
  76. package/Shaders/ShadersInclude/vertexColorMixing.js +1 -1
  77. package/Shaders/ShadersInclude/vertexColorMixing.js.map +1 -1
  78. package/Shaders/color.fragment.js +3 -2
  79. package/Shaders/color.fragment.js.map +1 -1
  80. package/Shaders/color.vertex.js +1 -1
  81. package/Shaders/color.vertex.js.map +1 -1
  82. package/Shaders/default.fragment.js +3 -3
  83. package/Shaders/default.fragment.js.map +1 -1
  84. package/Shaders/default.vertex.js +1 -1
  85. package/Shaders/default.vertex.js.map +1 -1
  86. package/Shaders/gpuRenderParticles.fragment.d.ts +2 -0
  87. package/Shaders/gpuRenderParticles.fragment.js +8 -1
  88. package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
  89. package/Shaders/gpuRenderParticles.vertex.d.ts +2 -0
  90. package/Shaders/gpuRenderParticles.vertex.js +4 -0
  91. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  92. package/Shaders/particles.fragment.d.ts +2 -0
  93. package/Shaders/particles.fragment.js +8 -1
  94. package/Shaders/particles.fragment.js.map +1 -1
  95. package/Shaders/particles.vertex.d.ts +2 -0
  96. package/Shaders/particles.vertex.js +4 -0
  97. package/Shaders/particles.vertex.js.map +1 -1
  98. package/Shaders/pbr.vertex.js +1 -1
  99. package/Shaders/pbr.vertex.js.map +1 -1
  100. package/Sprites/spriteManager.d.ts +4 -0
  101. package/Sprites/spriteManager.js +2 -0
  102. package/Sprites/spriteManager.js.map +1 -1
  103. package/package.json +1 -1
  104. package/scene.d.ts +14 -0
  105. package/scene.js +37 -12
  106. package/scene.js.map +1 -1
  107. package/sceneComponent.d.ts +2 -0
  108. package/sceneComponent.js +2 -0
  109. package/sceneComponent.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"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AG,IAAI,CAAC;SACjC;IACL,CAAC;;AA5kBD,4FAA4F;AAC7E,oCAAoB,GAAW,CAAC,CAAC;AACjC,oCAAoB,GAAW,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport { StringDictionary } from \"./stringDictionary\";\r\n\r\n// Mainly based on these 2 articles :\r\n// Creating an universal virtual touch joystick working for all Touch models thanks to Hand.JS : http://blogs.msdn.com/b/davrous/archive/2013/02/22/creating-an-universal-virtual-touch-joystick-working-for-all-touch-models-thanks-to-hand-js.aspx\r\n// & on Seb Lee-Delisle original work: http://seb.ly/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/\r\n\r\n/**\r\n * Defines the potential axis of a Joystick\r\n */\r\nexport enum JoystickAxis {\r\n /** X axis */\r\n X,\r\n /** Y axis */\r\n Y,\r\n /** Z axis */\r\n Z,\r\n}\r\n\r\n/**\r\n * Represents the different customization options available\r\n * for VirtualJoystick\r\n */\r\ninterface VirtualJoystickCustomizations {\r\n /**\r\n * Size of the joystick's puck\r\n */\r\n puckSize: number;\r\n /**\r\n * Size of the joystick's container\r\n */\r\n containerSize: number;\r\n /**\r\n * Color of the joystick && puck\r\n */\r\n color: string;\r\n /**\r\n * Image URL for the joystick's puck\r\n */\r\n puckImage?: string;\r\n /**\r\n * Image URL for the joystick's container\r\n */\r\n containerImage?: string;\r\n /**\r\n * Defines the unmoving position of the joystick container\r\n */\r\n position?: { x: number; y: number };\r\n /**\r\n * Defines whether or not the joystick container is always visible\r\n */\r\n alwaysVisible: boolean;\r\n /**\r\n * Defines whether or not to limit the movement of the puck to the joystick's container\r\n */\r\n limitToContainer: boolean;\r\n}\r\n\r\n/**\r\n * Class used to define virtual joystick (used in touch mode)\r\n */\r\nexport class VirtualJoystick {\r\n /**\r\n * Gets or sets a boolean indicating that left and right values must be inverted\r\n */\r\n public reverseLeftRight: boolean;\r\n /**\r\n * Gets or sets a boolean indicating that up and down values must be inverted\r\n */\r\n public reverseUpDown: boolean;\r\n /**\r\n * Gets the offset value for the position (ie. the change of the position value)\r\n */\r\n public deltaPosition: Vector3;\r\n /**\r\n * Gets a boolean indicating if the virtual joystick was pressed\r\n */\r\n public pressed: boolean;\r\n /**\r\n * Canvas the virtual joystick will render onto, default z-index of this is 5\r\n */\r\n public static Canvas: Nullable<HTMLCanvasElement>;\r\n\r\n /**\r\n * boolean indicating whether or not the joystick's puck's movement should be limited to the joystick's container area\r\n */\r\n public limitToContainer: boolean;\r\n\r\n // Used to draw the virtual joystick inside a 2D canvas on top of the WebGL rendering canvas\r\n private static _GlobalJoystickIndex: number = 0;\r\n private static _AlwaysVisibleSticks: number = 0;\r\n private static _VJCanvasContext: CanvasRenderingContext2D;\r\n private static _VJCanvasWidth: number;\r\n private static _VJCanvasHeight: number;\r\n private static _HalfWidth: number;\r\n private static _GetDefaultOptions(): VirtualJoystickCustomizations {\r\n return {\r\n puckSize: 40,\r\n containerSize: 60,\r\n color: \"cyan\",\r\n puckImage: undefined,\r\n containerImage: undefined,\r\n position: undefined,\r\n alwaysVisible: false,\r\n limitToContainer: false,\r\n };\r\n }\r\n\r\n private _action: () => any;\r\n private _axisTargetedByLeftAndRight: JoystickAxis;\r\n private _axisTargetedByUpAndDown: JoystickAxis;\r\n private _joystickSensibility: number;\r\n private _inversedSensibility: number;\r\n private _joystickPointerId: number;\r\n private _joystickColor: string;\r\n private _joystickPointerPos: Vector2;\r\n private _joystickPreviousPointerPos: Vector2;\r\n private _joystickPointerStartPos: Vector2;\r\n private _deltaJoystickVector: Vector2;\r\n private _leftJoystick: boolean;\r\n private _touches: StringDictionary<{ x: number; y: number; prevX: number; prevY: number } | PointerEvent>;\r\n private _joystickPosition: Nullable<Vector2>;\r\n private _alwaysVisible: boolean;\r\n private _puckImage: HTMLImageElement;\r\n private _containerImage: HTMLImageElement;\r\n\r\n // size properties\r\n private _joystickPuckSize: number;\r\n private _joystickContainerSize: number;\r\n private _clearPuckSize: number;\r\n private _clearContainerSize: number;\r\n private _clearPuckSizeOffset: number;\r\n private _clearContainerSizeOffset: number;\r\n\r\n private _onPointerDownHandlerRef: (e: PointerEvent) => any;\r\n private _onPointerMoveHandlerRef: (e: PointerEvent) => any;\r\n private _onPointerUpHandlerRef: (e: PointerEvent) => any;\r\n private _onResize: (e: any) => any;\r\n\r\n /**\r\n * Creates a new virtual joystick\r\n * @param leftJoystick defines that the joystick is for left hand (false by default)\r\n * @param customizations Defines the options we want to customize the VirtualJoystick\r\n */\r\n constructor(leftJoystick?: boolean, customizations?: Partial<VirtualJoystickCustomizations>) {\r\n const options = {\r\n ...VirtualJoystick._GetDefaultOptions(),\r\n ...customizations,\r\n };\r\n\r\n if (leftJoystick) {\r\n this._leftJoystick = true;\r\n } else {\r\n this._leftJoystick = false;\r\n }\r\n\r\n VirtualJoystick._GlobalJoystickIndex++;\r\n\r\n // By default left & right arrow keys are moving the X\r\n // and up & down keys are moving the Y\r\n this._axisTargetedByLeftAndRight = JoystickAxis.X;\r\n this._axisTargetedByUpAndDown = JoystickAxis.Y;\r\n\r\n this.reverseLeftRight = false;\r\n this.reverseUpDown = false;\r\n\r\n // collections of pointers\r\n this._touches = new StringDictionary<{ x: number; y: number; prevX: number; prevY: number } | PointerEvent>();\r\n this.deltaPosition = Vector3.Zero();\r\n\r\n this._joystickSensibility = 25;\r\n this._inversedSensibility = 1 / (this._joystickSensibility / 1000);\r\n\r\n this._onResize = () => {\r\n VirtualJoystick._VJCanvasWidth = window.innerWidth;\r\n VirtualJoystick._VJCanvasHeight = window.innerHeight;\r\n if (VirtualJoystick.Canvas) {\r\n VirtualJoystick.Canvas.width = VirtualJoystick._VJCanvasWidth;\r\n VirtualJoystick.Canvas.height = VirtualJoystick._VJCanvasHeight;\r\n }\r\n VirtualJoystick._HalfWidth = VirtualJoystick._VJCanvasWidth / 2;\r\n };\r\n\r\n // injecting a canvas element on top of the canvas 3D game\r\n if (!VirtualJoystick.Canvas) {\r\n window.addEventListener(\"resize\", this._onResize, false);\r\n VirtualJoystick.Canvas = document.createElement(\"canvas\");\r\n VirtualJoystick._VJCanvasWidth = window.innerWidth;\r\n VirtualJoystick._VJCanvasHeight = window.innerHeight;\r\n VirtualJoystick.Canvas.width = window.innerWidth;\r\n VirtualJoystick.Canvas.height = window.innerHeight;\r\n VirtualJoystick.Canvas.style.width = \"100%\";\r\n VirtualJoystick.Canvas.style.height = \"100%\";\r\n VirtualJoystick.Canvas.style.position = \"absolute\";\r\n VirtualJoystick.Canvas.style.backgroundColor = \"transparent\";\r\n VirtualJoystick.Canvas.style.top = \"0px\";\r\n VirtualJoystick.Canvas.style.left = \"0px\";\r\n VirtualJoystick.Canvas.style.zIndex = \"5\";\r\n (VirtualJoystick.Canvas.style as any).msTouchAction = \"none\";\r\n VirtualJoystick.Canvas.style.touchAction = \"none\"; // fix https://forum.babylonjs.com/t/virtualjoystick-needs-to-set-style-touch-action-none-explicitly/9562\r\n // Support for jQuery PEP polyfill\r\n VirtualJoystick.Canvas.setAttribute(\"touch-action\", \"none\");\r\n const context = VirtualJoystick.Canvas.getContext(\"2d\");\r\n\r\n if (!context) {\r\n throw new Error(\"Unable to create canvas for virtual joystick\");\r\n }\r\n\r\n VirtualJoystick._VJCanvasContext = context;\r\n VirtualJoystick._VJCanvasContext.strokeStyle = \"#ffffff\";\r\n VirtualJoystick._VJCanvasContext.lineWidth = 2;\r\n document.body.appendChild(VirtualJoystick.Canvas);\r\n }\r\n VirtualJoystick._HalfWidth = VirtualJoystick.Canvas.width / 2;\r\n this.pressed = false;\r\n this.limitToContainer = options.limitToContainer;\r\n\r\n // default joystick color\r\n this._joystickColor = options.color;\r\n\r\n // default joystick size\r\n this.containerSize = options.containerSize;\r\n this.puckSize = options.puckSize;\r\n\r\n if (options.position) {\r\n this.setPosition(options.position.x, options.position.y);\r\n }\r\n if (options.puckImage) {\r\n this.setPuckImage(options.puckImage);\r\n }\r\n if (options.containerImage) {\r\n this.setContainerImage(options.containerImage);\r\n }\r\n if (options.alwaysVisible) {\r\n VirtualJoystick._AlwaysVisibleSticks++;\r\n }\r\n\r\n // must come after position potentially set\r\n this.alwaysVisible = options.alwaysVisible;\r\n\r\n this._joystickPointerId = -1;\r\n // current joystick position\r\n this._joystickPointerPos = new Vector2(0, 0);\r\n this._joystickPreviousPointerPos = new Vector2(0, 0);\r\n // origin joystick position\r\n this._joystickPointerStartPos = new Vector2(0, 0);\r\n this._deltaJoystickVector = new Vector2(0, 0);\r\n\r\n this._onPointerDownHandlerRef = (evt) => {\r\n this._onPointerDown(evt);\r\n };\r\n this._onPointerMoveHandlerRef = (evt) => {\r\n this._onPointerMove(evt);\r\n };\r\n this._onPointerUpHandlerRef = (evt) => {\r\n this._onPointerUp(evt);\r\n };\r\n\r\n VirtualJoystick.Canvas.addEventListener(\"pointerdown\", this._onPointerDownHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\"pointermove\", this._onPointerMoveHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\"pointerup\", this._onPointerUpHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\"pointerout\", this._onPointerUpHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\r\n \"contextmenu\",\r\n (evt) => {\r\n evt.preventDefault(); // Disables system menu\r\n },\r\n false\r\n );\r\n requestAnimationFrame(() => {\r\n this._drawVirtualJoystick();\r\n });\r\n }\r\n\r\n /**\r\n * Defines joystick sensibility (ie. the ratio between a physical move and virtual joystick position change)\r\n * @param newJoystickSensibility defines the new sensibility\r\n */\r\n public setJoystickSensibility(newJoystickSensibility: number) {\r\n this._joystickSensibility = newJoystickSensibility;\r\n this._inversedSensibility = 1 / (this._joystickSensibility / 1000);\r\n }\r\n\r\n private _onPointerDown(e: PointerEvent) {\r\n let positionOnScreenCondition: boolean;\r\n\r\n e.preventDefault();\r\n\r\n if (this._leftJoystick === true) {\r\n positionOnScreenCondition = e.clientX < VirtualJoystick._HalfWidth;\r\n } else {\r\n positionOnScreenCondition = e.clientX > VirtualJoystick._HalfWidth;\r\n }\r\n\r\n if (positionOnScreenCondition && this._joystickPointerId < 0) {\r\n // First contact will be dedicated to the virtual joystick\r\n this._joystickPointerId = e.pointerId;\r\n\r\n if (this._joystickPosition) {\r\n this._joystickPointerStartPos = this._joystickPosition.clone();\r\n this._joystickPointerPos = this._joystickPosition.clone();\r\n this._joystickPreviousPointerPos = this._joystickPosition.clone();\r\n\r\n // in case the user only clicks down && doesn't move:\r\n // this ensures the delta is properly set\r\n this._onPointerMove(e);\r\n } else {\r\n this._joystickPointerStartPos.x = e.clientX;\r\n this._joystickPointerStartPos.y = e.clientY;\r\n this._joystickPointerPos = this._joystickPointerStartPos.clone();\r\n this._joystickPreviousPointerPos = this._joystickPointerStartPos.clone();\r\n }\r\n\r\n this._deltaJoystickVector.x = 0;\r\n this._deltaJoystickVector.y = 0;\r\n this.pressed = true;\r\n this._touches.add(e.pointerId.toString(), e);\r\n } else {\r\n // You can only trigger the action buttons with a joystick declared\r\n if (VirtualJoystick._GlobalJoystickIndex < 2 && this._action) {\r\n this._action();\r\n this._touches.add(e.pointerId.toString(), { x: e.clientX, y: e.clientY, prevX: e.clientX, prevY: e.clientY });\r\n }\r\n }\r\n }\r\n\r\n private _onPointerMove(e: PointerEvent) {\r\n // If the current pointer is the one associated to the joystick (first touch contact)\r\n if (this._joystickPointerId == e.pointerId) {\r\n // limit to container if need be\r\n if (this.limitToContainer) {\r\n const vector = new Vector2(e.clientX - this._joystickPointerStartPos.x, e.clientY - this._joystickPointerStartPos.y);\r\n const distance = vector.length();\r\n\r\n if (distance > this.containerSize) {\r\n vector.scaleInPlace(this.containerSize / distance);\r\n }\r\n\r\n this._joystickPointerPos.x = this._joystickPointerStartPos.x + vector.x;\r\n this._joystickPointerPos.y = this._joystickPointerStartPos.y + vector.y;\r\n } else {\r\n this._joystickPointerPos.x = e.clientX;\r\n this._joystickPointerPos.y = e.clientY;\r\n }\r\n\r\n // create delta vector\r\n this._deltaJoystickVector = this._joystickPointerPos.clone();\r\n this._deltaJoystickVector = this._deltaJoystickVector.subtract(this._joystickPointerStartPos);\r\n\r\n // if a joystick is always visible, there will be clipping issues if\r\n // you drag the puck from one over the container of the other\r\n if (0 < VirtualJoystick._AlwaysVisibleSticks) {\r\n if (this._leftJoystick) {\r\n this._joystickPointerPos.x = Math.min(VirtualJoystick._HalfWidth, this._joystickPointerPos.x);\r\n } else {\r\n this._joystickPointerPos.x = Math.max(VirtualJoystick._HalfWidth, this._joystickPointerPos.x);\r\n }\r\n }\r\n\r\n const directionLeftRight = this.reverseLeftRight ? -1 : 1;\r\n const deltaJoystickX = (directionLeftRight * this._deltaJoystickVector.x) / this._inversedSensibility;\r\n switch (this._axisTargetedByLeftAndRight) {\r\n case JoystickAxis.X:\r\n this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n case JoystickAxis.Y:\r\n this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n case JoystickAxis.Z:\r\n this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n }\r\n const directionUpDown = this.reverseUpDown ? 1 : -1;\r\n const deltaJoystickY = (directionUpDown * this._deltaJoystickVector.y) / this._inversedSensibility;\r\n switch (this._axisTargetedByUpAndDown) {\r\n case JoystickAxis.X:\r\n this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n case JoystickAxis.Y:\r\n this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n case JoystickAxis.Z:\r\n this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n }\r\n } else {\r\n const data = this._touches.get(e.pointerId.toString());\r\n if (data) {\r\n (data as any).x = e.clientX;\r\n (data as any).y = e.clientY;\r\n }\r\n }\r\n }\r\n\r\n private _onPointerUp(e: PointerEvent) {\r\n if (this._joystickPointerId == e.pointerId) {\r\n this._clearPreviousDraw();\r\n\r\n this._joystickPointerId = -1;\r\n this.pressed = false;\r\n } else {\r\n const touch = <{ x: number; y: number; prevX: number; prevY: number }>this._touches.get(e.pointerId.toString());\r\n if (touch) {\r\n VirtualJoystick._VJCanvasContext.clearRect(touch.prevX - 44, touch.prevY - 44, 88, 88);\r\n }\r\n }\r\n this._deltaJoystickVector.x = 0;\r\n this._deltaJoystickVector.y = 0;\r\n\r\n this._touches.remove(e.pointerId.toString());\r\n }\r\n\r\n /**\r\n * Change the color of the virtual joystick\r\n * @param newColor a string that must be a CSS color value (like \"red\") or the hexa value (like \"#FF0000\")\r\n */\r\n public setJoystickColor(newColor: string) {\r\n this._joystickColor = newColor;\r\n }\r\n\r\n /**\r\n * Size of the joystick's container\r\n */\r\n public set containerSize(newSize: number) {\r\n this._joystickContainerSize = newSize;\r\n this._clearContainerSize = ~~(this._joystickContainerSize * 2.1);\r\n this._clearContainerSizeOffset = ~~(this._clearContainerSize / 2);\r\n }\r\n public get containerSize() {\r\n return this._joystickContainerSize;\r\n }\r\n\r\n /**\r\n * Size of the joystick's puck\r\n */\r\n public set puckSize(newSize: number) {\r\n this._joystickPuckSize = newSize;\r\n this._clearPuckSize = ~~(this._joystickPuckSize * 2.1);\r\n this._clearPuckSizeOffset = ~~(this._clearPuckSize / 2);\r\n }\r\n public get puckSize() {\r\n return this._joystickPuckSize;\r\n }\r\n\r\n /**\r\n * Clears the set position of the joystick\r\n */\r\n public clearPosition() {\r\n this.alwaysVisible = false;\r\n\r\n this._joystickPosition = null;\r\n }\r\n\r\n /**\r\n * Defines whether or not the joystick container is always visible\r\n */\r\n public set alwaysVisible(value: boolean) {\r\n if (this._alwaysVisible === value) {\r\n return;\r\n }\r\n\r\n if (value && this._joystickPosition) {\r\n VirtualJoystick._AlwaysVisibleSticks++;\r\n\r\n this._alwaysVisible = true;\r\n } else {\r\n VirtualJoystick._AlwaysVisibleSticks--;\r\n\r\n this._alwaysVisible = false;\r\n }\r\n }\r\n public get alwaysVisible() {\r\n return this._alwaysVisible;\r\n }\r\n\r\n /**\r\n * Sets the constant position of the Joystick container\r\n * @param x X axis coordinate\r\n * @param y Y axis coordinate\r\n */\r\n public setPosition(x: number, y: number) {\r\n // just in case position is moved while the container is visible\r\n if (this._joystickPointerStartPos) {\r\n this._clearPreviousDraw();\r\n }\r\n\r\n this._joystickPosition = new Vector2(x, y);\r\n }\r\n\r\n /**\r\n * Defines a callback to call when the joystick is touched\r\n * @param action defines the callback\r\n */\r\n public setActionOnTouch(action: () => any) {\r\n this._action = action;\r\n }\r\n\r\n /**\r\n * Defines which axis you'd like to control for left & right\r\n * @param axis defines the axis to use\r\n */\r\n public setAxisForLeftRight(axis: JoystickAxis) {\r\n switch (axis) {\r\n case JoystickAxis.X:\r\n case JoystickAxis.Y:\r\n case JoystickAxis.Z:\r\n this._axisTargetedByLeftAndRight = axis;\r\n break;\r\n default:\r\n this._axisTargetedByLeftAndRight = JoystickAxis.X;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Defines which axis you'd like to control for up & down\r\n * @param axis defines the axis to use\r\n */\r\n public setAxisForUpDown(axis: JoystickAxis) {\r\n switch (axis) {\r\n case JoystickAxis.X:\r\n case JoystickAxis.Y:\r\n case JoystickAxis.Z:\r\n this._axisTargetedByUpAndDown = axis;\r\n break;\r\n default:\r\n this._axisTargetedByUpAndDown = JoystickAxis.Y;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Clears the canvas from the previous puck / container draw\r\n */\r\n private _clearPreviousDraw() {\r\n const jp = this._joystickPosition || this._joystickPointerStartPos;\r\n\r\n // clear container pixels\r\n VirtualJoystick._VJCanvasContext.clearRect(\r\n jp.x - this._clearContainerSizeOffset,\r\n jp.y - this._clearContainerSizeOffset,\r\n this._clearContainerSize,\r\n this._clearContainerSize\r\n );\r\n\r\n // clear puck pixels\r\n VirtualJoystick._VJCanvasContext.clearRect(\r\n this._joystickPreviousPointerPos.x - this._clearPuckSizeOffset,\r\n this._joystickPreviousPointerPos.y - this._clearPuckSizeOffset,\r\n this._clearPuckSize,\r\n this._clearPuckSize\r\n );\r\n }\r\n\r\n /**\r\n * Loads `urlPath` to be used for the container's image\r\n * @param urlPath defines the urlPath of an image to use\r\n */\r\n public setContainerImage(urlPath: string) {\r\n const image = new Image();\r\n image.src = urlPath;\r\n\r\n image.onload = () => (this._containerImage = image);\r\n }\r\n\r\n /**\r\n * Loads `urlPath` to be used for the puck's image\r\n * @param urlPath defines the urlPath of an image to use\r\n */\r\n public setPuckImage(urlPath: string) {\r\n const image = new Image();\r\n image.src = urlPath;\r\n\r\n image.onload = () => (this._puckImage = image);\r\n }\r\n\r\n /**\r\n * Draws the Virtual Joystick's container\r\n */\r\n private _drawContainer() {\r\n const jp = this._joystickPosition || this._joystickPointerStartPos;\r\n\r\n this._clearPreviousDraw();\r\n\r\n if (this._containerImage) {\r\n VirtualJoystick._VJCanvasContext.drawImage(this._containerImage, jp.x - this.containerSize, jp.y - this.containerSize, this.containerSize * 2, this.containerSize * 2);\r\n } else {\r\n // outer container\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.strokeStyle = this._joystickColor;\r\n VirtualJoystick._VJCanvasContext.lineWidth = 2;\r\n VirtualJoystick._VJCanvasContext.arc(jp.x, jp.y, this.containerSize, 0, Math.PI * 2, true);\r\n VirtualJoystick._VJCanvasContext.stroke();\r\n VirtualJoystick._VJCanvasContext.closePath();\r\n\r\n // inner container\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.lineWidth = 6;\r\n VirtualJoystick._VJCanvasContext.strokeStyle = this._joystickColor;\r\n VirtualJoystick._VJCanvasContext.arc(jp.x, jp.y, this.puckSize, 0, Math.PI * 2, true);\r\n VirtualJoystick._VJCanvasContext.stroke();\r\n VirtualJoystick._VJCanvasContext.closePath();\r\n }\r\n }\r\n\r\n /**\r\n * Draws the Virtual Joystick's puck\r\n */\r\n private _drawPuck() {\r\n if (this._puckImage) {\r\n VirtualJoystick._VJCanvasContext.drawImage(\r\n this._puckImage,\r\n this._joystickPointerPos.x - this.puckSize,\r\n this._joystickPointerPos.y - this.puckSize,\r\n this.puckSize * 2,\r\n this.puckSize * 2\r\n );\r\n } else {\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.strokeStyle = this._joystickColor;\r\n VirtualJoystick._VJCanvasContext.lineWidth = 2;\r\n VirtualJoystick._VJCanvasContext.arc(this._joystickPointerPos.x, this._joystickPointerPos.y, this.puckSize, 0, Math.PI * 2, true);\r\n VirtualJoystick._VJCanvasContext.stroke();\r\n VirtualJoystick._VJCanvasContext.closePath();\r\n }\r\n }\r\n\r\n private _drawVirtualJoystick() {\r\n if (this.alwaysVisible) {\r\n this._drawContainer();\r\n }\r\n\r\n if (this.pressed) {\r\n this._touches.forEach((key, touch) => {\r\n if ((<PointerEvent>touch).pointerId === this._joystickPointerId) {\r\n if (!this.alwaysVisible) {\r\n this._drawContainer();\r\n }\r\n\r\n this._drawPuck();\r\n\r\n // store current pointer for next clear\r\n this._joystickPreviousPointerPos = this._joystickPointerPos.clone();\r\n } else {\r\n VirtualJoystick._VJCanvasContext.clearRect((<any>touch).prevX - 44, (<any>touch).prevY - 44, 88, 88);\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.fillStyle = \"white\";\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.strokeStyle = \"red\";\r\n VirtualJoystick._VJCanvasContext.lineWidth = 6;\r\n VirtualJoystick._VJCanvasContext.arc(touch.x, touch.y, 40, 0, Math.PI * 2, true);\r\n VirtualJoystick._VJCanvasContext.stroke();\r\n VirtualJoystick._VJCanvasContext.closePath();\r\n (<any>touch).prevX = touch.x;\r\n (<any>touch).prevY = touch.y;\r\n }\r\n });\r\n }\r\n requestAnimationFrame(() => {\r\n this._drawVirtualJoystick();\r\n });\r\n }\r\n\r\n /**\r\n * Release internal HTML canvas\r\n */\r\n public releaseCanvas() {\r\n if (VirtualJoystick.Canvas) {\r\n VirtualJoystick.Canvas.removeEventListener(\"pointerdown\", this._onPointerDownHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener(\"pointermove\", this._onPointerMoveHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener(\"pointerup\", this._onPointerUpHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener(\"pointerout\", this._onPointerUpHandlerRef);\r\n window.removeEventListener(\"resize\", this._onResize);\r\n document.body.removeChild(VirtualJoystick.Canvas);\r\n VirtualJoystick.Canvas = null;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"virtualJoystick.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/virtualJoystick.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qCAAqC;AACrC,oPAAoP;AACpP,qHAAqH;AAErH;;GAEG;AACH,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACpB,aAAa;IACb,yCAAC,CAAA;IACD,aAAa;IACb,yCAAC,CAAA;IACD,aAAa;IACb,yCAAC,CAAA;AACL,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;AAyCD;;GAEG;AACH,MAAM,OAAO,eAAe;IA8ExB;;;;OAIG;IACH,YAAY,YAAsB,EAAE,cAAuD;QACvF,MAAM,OAAO,GAAG;YACZ,GAAG,eAAe,CAAC,kBAAkB,EAAE;YACvC,GAAG,cAAc;SACpB,CAAC;QAEF,IAAI,YAAY,EAAE;YACd,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC7B;aAAM;YACH,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;SAC9B;QAED,eAAe,CAAC,oBAAoB,EAAE,CAAC;QAEvC,sDAAsD;QACtD,sCAAsC;QACtC,IAAI,CAAC,2BAA2B,GAAG,YAAY,CAAC,CAAC,CAAC;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,WAAW,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACrF,eAAe,CAAC,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACtF,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YACrD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAClD,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC;SACjC;IACL,CAAC;;AA3kBD,4FAA4F;AAC7E,oCAAoB,GAAW,CAAC,CAAC;AACjC,oCAAoB,GAAW,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport { StringDictionary } from \"./stringDictionary\";\r\n\r\n// Mainly based on these 2 articles :\r\n// Creating an universal virtual touch joystick working for all Touch models thanks to Hand.JS : http://blogs.msdn.com/b/davrous/archive/2013/02/22/creating-an-universal-virtual-touch-joystick-working-for-all-touch-models-thanks-to-hand-js.aspx\r\n// & on Seb Lee-Delisle original work: http://seb.ly/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/\r\n\r\n/**\r\n * Defines the potential axis of a Joystick\r\n */\r\nexport enum JoystickAxis {\r\n /** X axis */\r\n X,\r\n /** Y axis */\r\n Y,\r\n /** Z axis */\r\n Z,\r\n}\r\n\r\n/**\r\n * Represents the different customization options available\r\n * for VirtualJoystick\r\n */\r\ninterface VirtualJoystickCustomizations {\r\n /**\r\n * Size of the joystick's puck\r\n */\r\n puckSize: number;\r\n /**\r\n * Size of the joystick's container\r\n */\r\n containerSize: number;\r\n /**\r\n * Color of the joystick && puck\r\n */\r\n color: string;\r\n /**\r\n * Image URL for the joystick's puck\r\n */\r\n puckImage?: string;\r\n /**\r\n * Image URL for the joystick's container\r\n */\r\n containerImage?: string;\r\n /**\r\n * Defines the unmoving position of the joystick container\r\n */\r\n position?: { x: number; y: number };\r\n /**\r\n * Defines whether or not the joystick container is always visible\r\n */\r\n alwaysVisible: boolean;\r\n /**\r\n * Defines whether or not to limit the movement of the puck to the joystick's container\r\n */\r\n limitToContainer: boolean;\r\n}\r\n\r\n/**\r\n * Class used to define virtual joystick (used in touch mode)\r\n */\r\nexport class VirtualJoystick {\r\n /**\r\n * Gets or sets a boolean indicating that left and right values must be inverted\r\n */\r\n public reverseLeftRight: boolean;\r\n /**\r\n * Gets or sets a boolean indicating that up and down values must be inverted\r\n */\r\n public reverseUpDown: boolean;\r\n /**\r\n * Gets the offset value for the position (ie. the change of the position value)\r\n */\r\n public deltaPosition: Vector3;\r\n /**\r\n * Gets a boolean indicating if the virtual joystick was pressed\r\n */\r\n public pressed: boolean;\r\n /**\r\n * Canvas the virtual joystick will render onto, default z-index of this is 5\r\n */\r\n public static Canvas: Nullable<HTMLCanvasElement>;\r\n\r\n /**\r\n * boolean indicating whether or not the joystick's puck's movement should be limited to the joystick's container area\r\n */\r\n public limitToContainer: boolean;\r\n\r\n // Used to draw the virtual joystick inside a 2D canvas on top of the WebGL rendering canvas\r\n private static _GlobalJoystickIndex: number = 0;\r\n private static _AlwaysVisibleSticks: number = 0;\r\n private static _VJCanvasContext: CanvasRenderingContext2D;\r\n private static _VJCanvasWidth: number;\r\n private static _VJCanvasHeight: number;\r\n private static _HalfWidth: number;\r\n private static _GetDefaultOptions(): VirtualJoystickCustomizations {\r\n return {\r\n puckSize: 40,\r\n containerSize: 60,\r\n color: \"cyan\",\r\n puckImage: undefined,\r\n containerImage: undefined,\r\n position: undefined,\r\n alwaysVisible: false,\r\n limitToContainer: false,\r\n };\r\n }\r\n\r\n private _action: () => any;\r\n private _axisTargetedByLeftAndRight: JoystickAxis;\r\n private _axisTargetedByUpAndDown: JoystickAxis;\r\n private _joystickSensibility: number;\r\n private _inversedSensibility: number;\r\n private _joystickPointerId: number;\r\n private _joystickColor: string;\r\n private _joystickPointerPos: Vector2;\r\n private _joystickPreviousPointerPos: Vector2;\r\n private _joystickPointerStartPos: Vector2;\r\n private _deltaJoystickVector: Vector2;\r\n private _leftJoystick: boolean;\r\n private _touches: StringDictionary<{ x: number; y: number; prevX: number; prevY: number } | PointerEvent>;\r\n private _joystickPosition: Nullable<Vector2>;\r\n private _alwaysVisible: boolean;\r\n private _puckImage: HTMLImageElement;\r\n private _containerImage: HTMLImageElement;\r\n\r\n // size properties\r\n private _joystickPuckSize: number;\r\n private _joystickContainerSize: number;\r\n private _clearPuckSize: number;\r\n private _clearContainerSize: number;\r\n private _clearPuckSizeOffset: number;\r\n private _clearContainerSizeOffset: number;\r\n\r\n private _onPointerDownHandlerRef: (e: PointerEvent) => any;\r\n private _onPointerMoveHandlerRef: (e: PointerEvent) => any;\r\n private _onPointerUpHandlerRef: (e: PointerEvent) => any;\r\n private _onResize: (e: any) => any;\r\n\r\n /**\r\n * Creates a new virtual joystick\r\n * @param leftJoystick defines that the joystick is for left hand (false by default)\r\n * @param customizations Defines the options we want to customize the VirtualJoystick\r\n */\r\n constructor(leftJoystick?: boolean, customizations?: Partial<VirtualJoystickCustomizations>) {\r\n const options = {\r\n ...VirtualJoystick._GetDefaultOptions(),\r\n ...customizations,\r\n };\r\n\r\n if (leftJoystick) {\r\n this._leftJoystick = true;\r\n } else {\r\n this._leftJoystick = false;\r\n }\r\n\r\n VirtualJoystick._GlobalJoystickIndex++;\r\n\r\n // By default left & right arrow keys are moving the X\r\n // and up & down keys are moving the Y\r\n this._axisTargetedByLeftAndRight = JoystickAxis.X;\r\n this._axisTargetedByUpAndDown = JoystickAxis.Y;\r\n\r\n this.reverseLeftRight = false;\r\n this.reverseUpDown = false;\r\n\r\n // collections of pointers\r\n this._touches = new StringDictionary<{ x: number; y: number; prevX: number; prevY: number } | PointerEvent>();\r\n this.deltaPosition = Vector3.Zero();\r\n\r\n this._joystickSensibility = 25;\r\n this._inversedSensibility = 1 / (this._joystickSensibility / 1000);\r\n\r\n this._onResize = () => {\r\n VirtualJoystick._VJCanvasWidth = window.innerWidth;\r\n VirtualJoystick._VJCanvasHeight = window.innerHeight;\r\n if (VirtualJoystick.Canvas) {\r\n VirtualJoystick.Canvas.width = VirtualJoystick._VJCanvasWidth;\r\n VirtualJoystick.Canvas.height = VirtualJoystick._VJCanvasHeight;\r\n }\r\n VirtualJoystick._HalfWidth = VirtualJoystick._VJCanvasWidth / 2;\r\n };\r\n\r\n // injecting a canvas element on top of the canvas 3D game\r\n if (!VirtualJoystick.Canvas) {\r\n window.addEventListener(\"resize\", this._onResize, false);\r\n VirtualJoystick.Canvas = document.createElement(\"canvas\");\r\n VirtualJoystick._VJCanvasWidth = window.innerWidth;\r\n VirtualJoystick._VJCanvasHeight = window.innerHeight;\r\n VirtualJoystick.Canvas.width = window.innerWidth;\r\n VirtualJoystick.Canvas.height = window.innerHeight;\r\n VirtualJoystick.Canvas.style.width = \"100%\";\r\n VirtualJoystick.Canvas.style.height = \"100%\";\r\n VirtualJoystick.Canvas.style.position = \"absolute\";\r\n VirtualJoystick.Canvas.style.backgroundColor = \"transparent\";\r\n VirtualJoystick.Canvas.style.top = \"0px\";\r\n VirtualJoystick.Canvas.style.left = \"0px\";\r\n VirtualJoystick.Canvas.style.zIndex = \"5\";\r\n VirtualJoystick.Canvas.style.touchAction = \"none\"; // fix https://forum.babylonjs.com/t/virtualjoystick-needs-to-set-style-touch-action-none-explicitly/9562\r\n // Support for jQuery PEP polyfill\r\n VirtualJoystick.Canvas.setAttribute(\"touch-action\", \"none\");\r\n const context = VirtualJoystick.Canvas.getContext(\"2d\");\r\n\r\n if (!context) {\r\n throw new Error(\"Unable to create canvas for virtual joystick\");\r\n }\r\n\r\n VirtualJoystick._VJCanvasContext = context;\r\n VirtualJoystick._VJCanvasContext.strokeStyle = \"#ffffff\";\r\n VirtualJoystick._VJCanvasContext.lineWidth = 2;\r\n document.body.appendChild(VirtualJoystick.Canvas);\r\n }\r\n VirtualJoystick._HalfWidth = VirtualJoystick.Canvas.width / 2;\r\n this.pressed = false;\r\n this.limitToContainer = options.limitToContainer;\r\n\r\n // default joystick color\r\n this._joystickColor = options.color;\r\n\r\n // default joystick size\r\n this.containerSize = options.containerSize;\r\n this.puckSize = options.puckSize;\r\n\r\n if (options.position) {\r\n this.setPosition(options.position.x, options.position.y);\r\n }\r\n if (options.puckImage) {\r\n this.setPuckImage(options.puckImage);\r\n }\r\n if (options.containerImage) {\r\n this.setContainerImage(options.containerImage);\r\n }\r\n if (options.alwaysVisible) {\r\n VirtualJoystick._AlwaysVisibleSticks++;\r\n }\r\n\r\n // must come after position potentially set\r\n this.alwaysVisible = options.alwaysVisible;\r\n\r\n this._joystickPointerId = -1;\r\n // current joystick position\r\n this._joystickPointerPos = new Vector2(0, 0);\r\n this._joystickPreviousPointerPos = new Vector2(0, 0);\r\n // origin joystick position\r\n this._joystickPointerStartPos = new Vector2(0, 0);\r\n this._deltaJoystickVector = new Vector2(0, 0);\r\n\r\n this._onPointerDownHandlerRef = (evt) => {\r\n this._onPointerDown(evt);\r\n };\r\n this._onPointerMoveHandlerRef = (evt) => {\r\n this._onPointerMove(evt);\r\n };\r\n this._onPointerUpHandlerRef = (evt) => {\r\n this._onPointerUp(evt);\r\n };\r\n\r\n VirtualJoystick.Canvas.addEventListener(\"pointerdown\", this._onPointerDownHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\"pointermove\", this._onPointerMoveHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\"pointerup\", this._onPointerUpHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\"pointerout\", this._onPointerUpHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\r\n \"contextmenu\",\r\n (evt) => {\r\n evt.preventDefault(); // Disables system menu\r\n },\r\n false\r\n );\r\n requestAnimationFrame(() => {\r\n this._drawVirtualJoystick();\r\n });\r\n }\r\n\r\n /**\r\n * Defines joystick sensibility (ie. the ratio between a physical move and virtual joystick position change)\r\n * @param newJoystickSensibility defines the new sensibility\r\n */\r\n public setJoystickSensibility(newJoystickSensibility: number) {\r\n this._joystickSensibility = newJoystickSensibility;\r\n this._inversedSensibility = 1 / (this._joystickSensibility / 1000);\r\n }\r\n\r\n private _onPointerDown(e: PointerEvent) {\r\n let positionOnScreenCondition: boolean;\r\n\r\n e.preventDefault();\r\n\r\n if (this._leftJoystick === true) {\r\n positionOnScreenCondition = e.clientX < VirtualJoystick._HalfWidth;\r\n } else {\r\n positionOnScreenCondition = e.clientX > VirtualJoystick._HalfWidth;\r\n }\r\n\r\n if (positionOnScreenCondition && this._joystickPointerId < 0) {\r\n // First contact will be dedicated to the virtual joystick\r\n this._joystickPointerId = e.pointerId;\r\n\r\n if (this._joystickPosition) {\r\n this._joystickPointerStartPos = this._joystickPosition.clone();\r\n this._joystickPointerPos = this._joystickPosition.clone();\r\n this._joystickPreviousPointerPos = this._joystickPosition.clone();\r\n\r\n // in case the user only clicks down && doesn't move:\r\n // this ensures the delta is properly set\r\n this._onPointerMove(e);\r\n } else {\r\n this._joystickPointerStartPos.x = e.clientX;\r\n this._joystickPointerStartPos.y = e.clientY;\r\n this._joystickPointerPos = this._joystickPointerStartPos.clone();\r\n this._joystickPreviousPointerPos = this._joystickPointerStartPos.clone();\r\n }\r\n\r\n this._deltaJoystickVector.x = 0;\r\n this._deltaJoystickVector.y = 0;\r\n this.pressed = true;\r\n this._touches.add(e.pointerId.toString(), e);\r\n } else {\r\n // You can only trigger the action buttons with a joystick declared\r\n if (VirtualJoystick._GlobalJoystickIndex < 2 && this._action) {\r\n this._action();\r\n this._touches.add(e.pointerId.toString(), { x: e.clientX, y: e.clientY, prevX: e.clientX, prevY: e.clientY });\r\n }\r\n }\r\n }\r\n\r\n private _onPointerMove(e: PointerEvent) {\r\n // If the current pointer is the one associated to the joystick (first touch contact)\r\n if (this._joystickPointerId == e.pointerId) {\r\n // limit to container if need be\r\n if (this.limitToContainer) {\r\n const vector = new Vector2(e.clientX - this._joystickPointerStartPos.x, e.clientY - this._joystickPointerStartPos.y);\r\n const distance = vector.length();\r\n\r\n if (distance > this.containerSize) {\r\n vector.scaleInPlace(this.containerSize / distance);\r\n }\r\n\r\n this._joystickPointerPos.x = this._joystickPointerStartPos.x + vector.x;\r\n this._joystickPointerPos.y = this._joystickPointerStartPos.y + vector.y;\r\n } else {\r\n this._joystickPointerPos.x = e.clientX;\r\n this._joystickPointerPos.y = e.clientY;\r\n }\r\n\r\n // create delta vector\r\n this._deltaJoystickVector = this._joystickPointerPos.clone();\r\n this._deltaJoystickVector = this._deltaJoystickVector.subtract(this._joystickPointerStartPos);\r\n\r\n // if a joystick is always visible, there will be clipping issues if\r\n // you drag the puck from one over the container of the other\r\n if (0 < VirtualJoystick._AlwaysVisibleSticks) {\r\n if (this._leftJoystick) {\r\n this._joystickPointerPos.x = Math.min(VirtualJoystick._HalfWidth, this._joystickPointerPos.x);\r\n } else {\r\n this._joystickPointerPos.x = Math.max(VirtualJoystick._HalfWidth, this._joystickPointerPos.x);\r\n }\r\n }\r\n\r\n const directionLeftRight = this.reverseLeftRight ? -1 : 1;\r\n const deltaJoystickX = (directionLeftRight * this._deltaJoystickVector.x) / this._inversedSensibility;\r\n switch (this._axisTargetedByLeftAndRight) {\r\n case JoystickAxis.X:\r\n this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n case JoystickAxis.Y:\r\n this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n case JoystickAxis.Z:\r\n this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n }\r\n const directionUpDown = this.reverseUpDown ? 1 : -1;\r\n const deltaJoystickY = (directionUpDown * this._deltaJoystickVector.y) / this._inversedSensibility;\r\n switch (this._axisTargetedByUpAndDown) {\r\n case JoystickAxis.X:\r\n this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n case JoystickAxis.Y:\r\n this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n case JoystickAxis.Z:\r\n this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n }\r\n } else {\r\n const data = this._touches.get(e.pointerId.toString());\r\n if (data) {\r\n (data as any).x = e.clientX;\r\n (data as any).y = e.clientY;\r\n }\r\n }\r\n }\r\n\r\n private _onPointerUp(e: PointerEvent) {\r\n if (this._joystickPointerId == e.pointerId) {\r\n this._clearPreviousDraw();\r\n\r\n this._joystickPointerId = -1;\r\n this.pressed = false;\r\n } else {\r\n const touch = <{ x: number; y: number; prevX: number; prevY: number }>this._touches.get(e.pointerId.toString());\r\n if (touch) {\r\n VirtualJoystick._VJCanvasContext.clearRect(touch.prevX - 44, touch.prevY - 44, 88, 88);\r\n }\r\n }\r\n this._deltaJoystickVector.x = 0;\r\n this._deltaJoystickVector.y = 0;\r\n\r\n this._touches.remove(e.pointerId.toString());\r\n }\r\n\r\n /**\r\n * Change the color of the virtual joystick\r\n * @param newColor a string that must be a CSS color value (like \"red\") or the hexa value (like \"#FF0000\")\r\n */\r\n public setJoystickColor(newColor: string) {\r\n this._joystickColor = newColor;\r\n }\r\n\r\n /**\r\n * Size of the joystick's container\r\n */\r\n public set containerSize(newSize: number) {\r\n this._joystickContainerSize = newSize;\r\n this._clearContainerSize = ~~(this._joystickContainerSize * 2.1);\r\n this._clearContainerSizeOffset = ~~(this._clearContainerSize / 2);\r\n }\r\n public get containerSize() {\r\n return this._joystickContainerSize;\r\n }\r\n\r\n /**\r\n * Size of the joystick's puck\r\n */\r\n public set puckSize(newSize: number) {\r\n this._joystickPuckSize = newSize;\r\n this._clearPuckSize = ~~(this._joystickPuckSize * 2.1);\r\n this._clearPuckSizeOffset = ~~(this._clearPuckSize / 2);\r\n }\r\n public get puckSize() {\r\n return this._joystickPuckSize;\r\n }\r\n\r\n /**\r\n * Clears the set position of the joystick\r\n */\r\n public clearPosition() {\r\n this.alwaysVisible = false;\r\n\r\n this._joystickPosition = null;\r\n }\r\n\r\n /**\r\n * Defines whether or not the joystick container is always visible\r\n */\r\n public set alwaysVisible(value: boolean) {\r\n if (this._alwaysVisible === value) {\r\n return;\r\n }\r\n\r\n if (value && this._joystickPosition) {\r\n VirtualJoystick._AlwaysVisibleSticks++;\r\n\r\n this._alwaysVisible = true;\r\n } else {\r\n VirtualJoystick._AlwaysVisibleSticks--;\r\n\r\n this._alwaysVisible = false;\r\n }\r\n }\r\n public get alwaysVisible() {\r\n return this._alwaysVisible;\r\n }\r\n\r\n /**\r\n * Sets the constant position of the Joystick container\r\n * @param x X axis coordinate\r\n * @param y Y axis coordinate\r\n */\r\n public setPosition(x: number, y: number) {\r\n // just in case position is moved while the container is visible\r\n if (this._joystickPointerStartPos) {\r\n this._clearPreviousDraw();\r\n }\r\n\r\n this._joystickPosition = new Vector2(x, y);\r\n }\r\n\r\n /**\r\n * Defines a callback to call when the joystick is touched\r\n * @param action defines the callback\r\n */\r\n public setActionOnTouch(action: () => any) {\r\n this._action = action;\r\n }\r\n\r\n /**\r\n * Defines which axis you'd like to control for left & right\r\n * @param axis defines the axis to use\r\n */\r\n public setAxisForLeftRight(axis: JoystickAxis) {\r\n switch (axis) {\r\n case JoystickAxis.X:\r\n case JoystickAxis.Y:\r\n case JoystickAxis.Z:\r\n this._axisTargetedByLeftAndRight = axis;\r\n break;\r\n default:\r\n this._axisTargetedByLeftAndRight = JoystickAxis.X;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Defines which axis you'd like to control for up & down\r\n * @param axis defines the axis to use\r\n */\r\n public setAxisForUpDown(axis: JoystickAxis) {\r\n switch (axis) {\r\n case JoystickAxis.X:\r\n case JoystickAxis.Y:\r\n case JoystickAxis.Z:\r\n this._axisTargetedByUpAndDown = axis;\r\n break;\r\n default:\r\n this._axisTargetedByUpAndDown = JoystickAxis.Y;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Clears the canvas from the previous puck / container draw\r\n */\r\n private _clearPreviousDraw() {\r\n const jp = this._joystickPosition || this._joystickPointerStartPos;\r\n\r\n // clear container pixels\r\n VirtualJoystick._VJCanvasContext.clearRect(\r\n jp.x - this._clearContainerSizeOffset,\r\n jp.y - this._clearContainerSizeOffset,\r\n this._clearContainerSize,\r\n this._clearContainerSize\r\n );\r\n\r\n // clear puck pixels\r\n VirtualJoystick._VJCanvasContext.clearRect(\r\n this._joystickPreviousPointerPos.x - this._clearPuckSizeOffset,\r\n this._joystickPreviousPointerPos.y - this._clearPuckSizeOffset,\r\n this._clearPuckSize,\r\n this._clearPuckSize\r\n );\r\n }\r\n\r\n /**\r\n * Loads `urlPath` to be used for the container's image\r\n * @param urlPath defines the urlPath of an image to use\r\n */\r\n public setContainerImage(urlPath: string) {\r\n const image = new Image();\r\n image.src = urlPath;\r\n\r\n image.onload = () => (this._containerImage = image);\r\n }\r\n\r\n /**\r\n * Loads `urlPath` to be used for the puck's image\r\n * @param urlPath defines the urlPath of an image to use\r\n */\r\n public setPuckImage(urlPath: string) {\r\n const image = new Image();\r\n image.src = urlPath;\r\n\r\n image.onload = () => (this._puckImage = image);\r\n }\r\n\r\n /**\r\n * Draws the Virtual Joystick's container\r\n */\r\n private _drawContainer() {\r\n const jp = this._joystickPosition || this._joystickPointerStartPos;\r\n\r\n this._clearPreviousDraw();\r\n\r\n if (this._containerImage) {\r\n VirtualJoystick._VJCanvasContext.drawImage(this._containerImage, jp.x - this.containerSize, jp.y - this.containerSize, this.containerSize * 2, this.containerSize * 2);\r\n } else {\r\n // outer container\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.strokeStyle = this._joystickColor;\r\n VirtualJoystick._VJCanvasContext.lineWidth = 2;\r\n VirtualJoystick._VJCanvasContext.arc(jp.x, jp.y, this.containerSize, 0, Math.PI * 2, true);\r\n VirtualJoystick._VJCanvasContext.stroke();\r\n VirtualJoystick._VJCanvasContext.closePath();\r\n\r\n // inner container\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.lineWidth = 6;\r\n VirtualJoystick._VJCanvasContext.strokeStyle = this._joystickColor;\r\n VirtualJoystick._VJCanvasContext.arc(jp.x, jp.y, this.puckSize, 0, Math.PI * 2, true);\r\n VirtualJoystick._VJCanvasContext.stroke();\r\n VirtualJoystick._VJCanvasContext.closePath();\r\n }\r\n }\r\n\r\n /**\r\n * Draws the Virtual Joystick's puck\r\n */\r\n private _drawPuck() {\r\n if (this._puckImage) {\r\n VirtualJoystick._VJCanvasContext.drawImage(\r\n this._puckImage,\r\n this._joystickPointerPos.x - this.puckSize,\r\n this._joystickPointerPos.y - this.puckSize,\r\n this.puckSize * 2,\r\n this.puckSize * 2\r\n );\r\n } else {\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.strokeStyle = this._joystickColor;\r\n VirtualJoystick._VJCanvasContext.lineWidth = 2;\r\n VirtualJoystick._VJCanvasContext.arc(this._joystickPointerPos.x, this._joystickPointerPos.y, this.puckSize, 0, Math.PI * 2, true);\r\n VirtualJoystick._VJCanvasContext.stroke();\r\n VirtualJoystick._VJCanvasContext.closePath();\r\n }\r\n }\r\n\r\n private _drawVirtualJoystick() {\r\n if (this.alwaysVisible) {\r\n this._drawContainer();\r\n }\r\n\r\n if (this.pressed) {\r\n this._touches.forEach((key, touch) => {\r\n if ((<PointerEvent>touch).pointerId === this._joystickPointerId) {\r\n if (!this.alwaysVisible) {\r\n this._drawContainer();\r\n }\r\n\r\n this._drawPuck();\r\n\r\n // store current pointer for next clear\r\n this._joystickPreviousPointerPos = this._joystickPointerPos.clone();\r\n } else {\r\n VirtualJoystick._VJCanvasContext.clearRect((<any>touch).prevX - 44, (<any>touch).prevY - 44, 88, 88);\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.fillStyle = \"white\";\r\n VirtualJoystick._VJCanvasContext.beginPath();\r\n VirtualJoystick._VJCanvasContext.strokeStyle = \"red\";\r\n VirtualJoystick._VJCanvasContext.lineWidth = 6;\r\n VirtualJoystick._VJCanvasContext.arc(touch.x, touch.y, 40, 0, Math.PI * 2, true);\r\n VirtualJoystick._VJCanvasContext.stroke();\r\n VirtualJoystick._VJCanvasContext.closePath();\r\n (<any>touch).prevX = touch.x;\r\n (<any>touch).prevY = touch.y;\r\n }\r\n });\r\n }\r\n requestAnimationFrame(() => {\r\n this._drawVirtualJoystick();\r\n });\r\n }\r\n\r\n /**\r\n * Release internal HTML canvas\r\n */\r\n public releaseCanvas() {\r\n if (VirtualJoystick.Canvas) {\r\n VirtualJoystick.Canvas.removeEventListener(\"pointerdown\", this._onPointerDownHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener(\"pointermove\", this._onPointerMoveHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener(\"pointerup\", this._onPointerUpHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener(\"pointerout\", this._onPointerUpHandlerRef);\r\n window.removeEventListener(\"resize\", this._onResize);\r\n document.body.removeChild(VirtualJoystick.Canvas);\r\n VirtualJoystick.Canvas = null;\r\n }\r\n }\r\n}\r\n"]}
@@ -197,6 +197,10 @@ export interface IParticleSystem {
197
197
  * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED
198
198
  */
199
199
  billboardMode: number;
200
+ /**
201
+ * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.
202
+ */
203
+ useLogarithmicDepth: boolean;
200
204
  /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */
201
205
  limitVelocityDamping: number;
202
206
  /**
@@ -231,6 +235,8 @@ export interface IParticleSystem {
231
235
  snippetId: string;
232
236
  /** Gets or sets a matrix to use to compute projection */
233
237
  defaultProjectionMatrix: Matrix;
238
+ /** @internal */
239
+ _wasDispatched: boolean;
234
240
  /**
235
241
  * Gets the maximum number of particles active at the same time.
236
242
  * @returns The max number of active particles.
@@ -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 * @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"]}
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 /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n useLogarithmicDepth: boolean;\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 /** @internal */\r\n _wasDispatched: boolean;\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"]}
@@ -163,6 +163,8 @@ export declare class BaseParticleSystem {
163
163
  * automatic start to happen and let you decide when to start emitting particles.
164
164
  */
165
165
  preventAutoStart: boolean;
166
+ /** @internal */
167
+ _wasDispatched: boolean;
166
168
  protected _rootUrl: string;
167
169
  private _noiseTexture;
168
170
  /**
@@ -246,6 +248,12 @@ export declare class BaseParticleSystem {
246
248
  */
247
249
  get isAnimationSheetEnabled(): boolean;
248
250
  set isAnimationSheetEnabled(value: boolean);
251
+ private _useLogarithmicDepth;
252
+ /**
253
+ * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.
254
+ */
255
+ get useLogarithmicDepth(): boolean;
256
+ set useLogarithmicDepth(value: boolean);
249
257
  /**
250
258
  * Get hosting scene
251
259
  * @returns the scene
@@ -119,6 +119,8 @@ export class BaseParticleSystem {
119
119
  * automatic start to happen and let you decide when to start emitting particles.
120
120
  */
121
121
  this.preventAutoStart = false;
122
+ /** @internal */
123
+ this._wasDispatched = false;
122
124
  this._rootUrl = "";
123
125
  /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */
124
126
  this.noiseStrength = new Vector3(10, 10, 10);
@@ -189,6 +191,7 @@ export class BaseParticleSystem {
189
191
  * Gets or sets a world offset applied to all particles
190
192
  */
191
193
  this.worldOffset = new Vector3(0, 0, 0);
194
+ this._useLogarithmicDepth = false;
192
195
  /**
193
196
  * You can use gravity if you want to give an orientation to your particles.
194
197
  */
@@ -266,6 +269,15 @@ export class BaseParticleSystem {
266
269
  this._isAnimationSheetEnabled = value;
267
270
  this._reset();
268
271
  }
272
+ /**
273
+ * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.
274
+ */
275
+ get useLogarithmicDepth() {
276
+ return this._useLogarithmicDepth;
277
+ }
278
+ set useLogarithmicDepth(value) {
279
+ this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;
280
+ }
269
281
  /**
270
282
  * Get hosting scene
271
283
  * @returns the scene