@babylonjs/core 8.37.3 → 8.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/Animations/animation.d.ts +3 -1
  2. package/Animations/animation.js +5 -4
  3. package/Animations/animation.js.map +1 -1
  4. package/Behaviors/Cameras/autoRotationBehavior.d.ts +4 -0
  5. package/Behaviors/Cameras/autoRotationBehavior.js +7 -0
  6. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  7. package/Behaviors/Cameras/bouncingBehavior.d.ts +5 -0
  8. package/Behaviors/Cameras/bouncingBehavior.js +8 -0
  9. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  10. package/Behaviors/Cameras/framingBehavior.d.ts +4 -0
  11. package/Behaviors/Cameras/framingBehavior.js +7 -0
  12. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  13. package/Behaviors/Cameras/interpolatingBehavior.d.ts +7 -1
  14. package/Behaviors/Cameras/interpolatingBehavior.js +21 -6
  15. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  16. package/Behaviors/Meshes/attachToBoxBehavior.d.ts +5 -0
  17. package/Behaviors/Meshes/attachToBoxBehavior.js +8 -1
  18. package/Behaviors/Meshes/attachToBoxBehavior.js.map +1 -1
  19. package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +5 -2
  20. package/Behaviors/Meshes/baseSixDofDragBehavior.js +8 -0
  21. package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
  22. package/Behaviors/Meshes/fadeInOutBehavior.d.ts +5 -0
  23. package/Behaviors/Meshes/fadeInOutBehavior.js +6 -0
  24. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  25. package/Behaviors/Meshes/handConstraintBehavior.d.ts +5 -0
  26. package/Behaviors/Meshes/handConstraintBehavior.js +8 -0
  27. package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
  28. package/Behaviors/Meshes/multiPointerScaleBehavior.d.ts +5 -0
  29. package/Behaviors/Meshes/multiPointerScaleBehavior.js +8 -0
  30. package/Behaviors/Meshes/multiPointerScaleBehavior.js.map +1 -1
  31. package/Behaviors/Meshes/sixDofDragBehavior.js +1 -1
  32. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  33. package/Behaviors/Meshes/surfaceMagnetismBehavior.d.ts +5 -0
  34. package/Behaviors/Meshes/surfaceMagnetismBehavior.js +7 -0
  35. package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
  36. package/Behaviors/behavior.d.ts +4 -0
  37. package/Behaviors/behavior.js.map +1 -1
  38. package/Cameras/Inputs/geospatialCameraPointersInput.js +3 -5
  39. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  40. package/Cameras/geospatialCamera.d.ts +19 -1
  41. package/Cameras/geospatialCamera.js +117 -28
  42. package/Cameras/geospatialCamera.js.map +1 -1
  43. package/Cameras/geospatialCameraMovement.d.ts +7 -2
  44. package/Cameras/geospatialCameraMovement.js +46 -10
  45. package/Cameras/geospatialCameraMovement.js.map +1 -1
  46. package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +2 -1
  47. package/Engines/WebGPU/Extensions/engine.multiRender.js +5 -2
  48. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  49. package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -0
  50. package/Engines/WebGPU/webgpuTextureHelper.js +11 -0
  51. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  52. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -0
  53. package/Engines/WebGPU/webgpuTextureManager.js +100 -9
  54. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  55. package/Engines/abstractEngine.js +2 -2
  56. package/Engines/abstractEngine.js.map +1 -1
  57. package/Engines/renderTargetWrapper.js +6 -1
  58. package/Engines/renderTargetWrapper.js.map +1 -1
  59. package/Engines/thinEngine.js +1 -1
  60. package/Engines/thinEngine.js.map +1 -1
  61. package/Engines/webgpuEngine.d.ts +7 -4
  62. package/Engines/webgpuEngine.js +45 -16
  63. package/Engines/webgpuEngine.js.map +1 -1
  64. package/FrameGraph/Node/nodeRenderGraph.d.ts +22 -5
  65. package/FrameGraph/Node/nodeRenderGraph.js +39 -18
  66. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  67. package/FrameGraph/Passes/pass.d.ts +2 -0
  68. package/FrameGraph/Passes/pass.js +2 -0
  69. package/FrameGraph/Passes/pass.js.map +1 -1
  70. package/FrameGraph/Passes/renderPass.d.ts +2 -0
  71. package/FrameGraph/Passes/renderPass.js +4 -0
  72. package/FrameGraph/Passes/renderPass.js.map +1 -1
  73. package/FrameGraph/frameGraph.d.ts +13 -4
  74. package/FrameGraph/frameGraph.js +45 -5
  75. package/FrameGraph/frameGraph.js.map +1 -1
  76. package/FrameGraph/frameGraphRenderTarget.d.ts +1 -0
  77. package/FrameGraph/frameGraphRenderTarget.js +3 -0
  78. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  79. package/FrameGraph/frameGraphTask.d.ts +6 -0
  80. package/FrameGraph/frameGraphTask.js +15 -0
  81. package/FrameGraph/frameGraphTask.js.map +1 -1
  82. package/FrameGraph/frameGraphTypes.d.ts +2 -0
  83. package/FrameGraph/frameGraphTypes.js.map +1 -1
  84. package/Helpers/sceneHelpers.js +1 -1
  85. package/Helpers/sceneHelpers.js.map +1 -1
  86. package/Lights/index.d.ts +1 -0
  87. package/Lights/index.js +1 -0
  88. package/Lights/index.js.map +1 -1
  89. package/Lights/lightingVolume.d.ts +89 -0
  90. package/Lights/lightingVolume.js +426 -0
  91. package/Lights/lightingVolume.js.map +1 -0
  92. package/Materials/Node/nodeMaterial.js +8 -2
  93. package/Materials/Node/nodeMaterial.js.map +1 -1
  94. package/Materials/floatingOriginMatrixOverrides.js +6 -5
  95. package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
  96. package/Meshes/mesh.js +1 -1
  97. package/Meshes/mesh.js.map +1 -1
  98. package/Misc/screenshotTools.js +2 -8
  99. package/Misc/screenshotTools.js.map +1 -1
  100. package/Particles/Node/Blocks/index.d.ts +1 -0
  101. package/Particles/Node/Blocks/index.js +1 -0
  102. package/Particles/Node/Blocks/index.js.map +1 -1
  103. package/Particles/Node/Blocks/particleFloatToIntBlock.d.ts +46 -0
  104. package/Particles/Node/Blocks/particleFloatToIntBlock.js +120 -0
  105. package/Particles/Node/Blocks/particleFloatToIntBlock.js.map +1 -0
  106. package/Particles/Node/Blocks/systemBlock.d.ts +4 -4
  107. package/Particles/Node/Blocks/systemBlock.js +22 -16
  108. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  109. package/Particles/Node/nodeParticleBuildState.js +1 -1
  110. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  111. package/Particles/Node/nodeParticleSystemSet.helper.js +61 -30
  112. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  113. package/Particles/solidParticle.d.ts +9 -0
  114. package/Particles/solidParticle.js +11 -0
  115. package/Particles/solidParticle.js.map +1 -1
  116. package/Particles/solidParticleSystem.d.ts +28 -0
  117. package/Particles/solidParticleSystem.js +75 -0
  118. package/Particles/solidParticleSystem.js.map +1 -1
  119. package/Particles/thinParticleSystem.d.ts +6 -0
  120. package/Particles/thinParticleSystem.js +21 -12
  121. package/Particles/thinParticleSystem.js.map +1 -1
  122. package/ShadersWGSL/lightingVolume.compute.d.ts +5 -0
  123. package/ShadersWGSL/lightingVolume.compute.js +27 -0
  124. package/ShadersWGSL/lightingVolume.compute.js.map +1 -0
  125. package/package.json +1 -1
  126. package/scene.js +6 -4
  127. package/scene.js.map +1 -1
@@ -3,6 +3,7 @@ import { Vector3 } from "../Maths/math.vector.js";
3
3
  import { Color4 } from "../Maths/math.color.js";
4
4
  import { Mesh } from "../Meshes/mesh.js";
5
5
  import type { Scene, IDisposable } from "../scene.js";
6
+ import type { Observer } from "../Misc/observable.js";
6
7
  import { DepthSortedParticle, SolidParticle, ModelShape, SolidParticleVertex } from "./solidParticle.js";
7
8
  import type { TargetCamera } from "../Cameras/targetCamera.js";
8
9
  import { BoundingInfo } from "../Culling/boundingInfo.js";
@@ -147,6 +148,15 @@ export declare class SolidParticleSystem implements IDisposable {
147
148
  protected _autoUpdateSubMeshes: boolean;
148
149
  protected _tmpVertex: SolidParticleVertex;
149
150
  protected _recomputeInvisibles: boolean;
151
+ protected _started: boolean;
152
+ protected _stopped: boolean;
153
+ protected _onBeforeRenderObserver: Nullable<Observer<Scene>>;
154
+ /**
155
+ * The overall motion speed (0.01 is default update speed, faster updates = faster animation)
156
+ */
157
+ updateSpeed: number;
158
+ /** @internal */
159
+ protected _scaledUpdateSpeed: number;
150
160
  /**
151
161
  * Creates a SPS (Solid Particle System) object.
152
162
  * @param name (String) is the SPS name, this will be the underlying mesh name.
@@ -601,4 +611,22 @@ export declare class SolidParticleSystem implements IDisposable {
601
611
  * @param update the boolean update value actually passed to setParticles()
602
612
  */
603
613
  afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
614
+ /**
615
+ * Starts the particle system and begins to emit.
616
+ * This will call buildMesh(), initParticles(), setParticles() and register the update loop.
617
+ * @param delay defines the delay in milliseconds before starting the system (0 by default)
618
+ */
619
+ start(delay?: number): void;
620
+ /**
621
+ * Stops the particle system.
622
+ */
623
+ stop(): void;
624
+ /**
625
+ * Gets if the particle system is started
626
+ */
627
+ get started(): boolean;
628
+ /**
629
+ * Gets if the particle system is stopped
630
+ */
631
+ get stopped(): boolean;
604
632
  }
@@ -121,6 +121,13 @@ export class SolidParticleSystem {
121
121
  this._materialSortFunction = (p1, p2) => p1.materialIndex - p2.materialIndex;
122
122
  this._autoUpdateSubMeshes = false;
123
123
  this._recomputeInvisibles = false;
124
+ this._started = false;
125
+ this._stopped = false;
126
+ this._onBeforeRenderObserver = null;
127
+ /**
128
+ * The overall motion speed (0.01 is default update speed, faster updates = faster animation)
129
+ */
130
+ this.updateSpeed = 0.01;
124
131
  this.name = name;
125
132
  this._scene = scene || EngineStore.LastCreatedScene;
126
133
  this._camera = scene.activeCamera;
@@ -942,8 +949,20 @@ export class SolidParticleSystem {
942
949
  const vpos = (index / 3) | 0;
943
950
  colorIndex = vpos * 4;
944
951
  uvIndex = vpos * 2;
952
+ // Calculate scaled update speed based on animation ratio (for FPS independence)
953
+ if (this._started && !this._stopped) {
954
+ this._scaledUpdateSpeed = this.updateSpeed * (this._scene?.getAnimationRatio() || 1);
955
+ }
945
956
  for (let p = start; p <= end; p++) {
946
957
  const particle = this.particles[p];
958
+ // Update particle age and check lifetime
959
+ if (this._started && !this._stopped) {
960
+ particle.age += this._scaledUpdateSpeed;
961
+ // Only check lifetime if it's finite (Infinity means particle never dies)
962
+ if (isFinite(particle.lifeTime) && particle.age >= particle.lifeTime) {
963
+ particle.alive = false;
964
+ }
965
+ }
947
966
  // call to custom user function to update the particle properties
948
967
  this.updateParticle(particle);
949
968
  const shape = particle._model._shape;
@@ -1279,6 +1298,7 @@ export class SolidParticleSystem {
1279
1298
  * Disposes the SPS.
1280
1299
  */
1281
1300
  dispose() {
1301
+ this.stop();
1282
1302
  this.mesh.dispose();
1283
1303
  this.vars = null;
1284
1304
  // drop references to internal big arrays for the GC
@@ -1770,5 +1790,60 @@ export class SolidParticleSystem {
1770
1790
  */
1771
1791
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1772
1792
  afterUpdateParticles(start, stop, update) { }
1793
+ /**
1794
+ * Starts the particle system and begins to emit.
1795
+ * This will call buildMesh(), initParticles(), setParticles() and register the update loop.
1796
+ * @param delay defines the delay in milliseconds before starting the system (0 by default)
1797
+ */
1798
+ start(delay = 0) {
1799
+ if (this._started) {
1800
+ return;
1801
+ }
1802
+ if (delay > 0) {
1803
+ setTimeout(() => {
1804
+ this.start(0);
1805
+ }, delay);
1806
+ return;
1807
+ }
1808
+ this.buildMesh();
1809
+ this.initParticles();
1810
+ this.setParticles();
1811
+ this._started = true;
1812
+ this._stopped = false;
1813
+ // Register update loop
1814
+ if (this._scene) {
1815
+ this._onBeforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {
1816
+ if (this._started && !this._stopped) {
1817
+ this.setParticles();
1818
+ }
1819
+ });
1820
+ }
1821
+ }
1822
+ /**
1823
+ * Stops the particle system.
1824
+ */
1825
+ stop() {
1826
+ if (this._stopped) {
1827
+ return;
1828
+ }
1829
+ this._stopped = true;
1830
+ // Unregister update loop
1831
+ if (this._onBeforeRenderObserver && this._scene) {
1832
+ this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);
1833
+ this._onBeforeRenderObserver = null;
1834
+ }
1835
+ }
1836
+ /**
1837
+ * Gets if the particle system is started
1838
+ */
1839
+ get started() {
1840
+ return this._started;
1841
+ }
1842
+ /**
1843
+ * Gets if the particle system is stopped
1844
+ */
1845
+ get stopped() {
1846
+ return this._stopped;
1847
+ }
1773
1848
  }
1774
1849
  //# sourceMappingURL=solidParticleSystem.js.map