@babylonjs/core 8.45.2 → 8.45.4

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 (78) hide show
  1. package/AudioV2/webAudio/components/webAudioParameterComponent.js +1 -3
  2. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  3. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +4 -0
  4. package/Cameras/Inputs/geospatialCameraPointersInput.js +56 -3
  5. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  6. package/Cameras/geospatialCamera.d.ts +3 -2
  7. package/Cameras/geospatialCamera.js +4 -4
  8. package/Cameras/geospatialCamera.js.map +1 -1
  9. package/Cameras/touchCamera.js +1 -1
  10. package/Cameras/touchCamera.js.map +1 -1
  11. package/Engines/Native/nativeHelpers.js +7 -0
  12. package/Engines/Native/nativeHelpers.js.map +1 -1
  13. package/Engines/Native/nativeInterfaces.d.ts +2 -0
  14. package/Engines/Native/nativeInterfaces.js.map +1 -1
  15. package/Engines/abstractEngine.js +2 -2
  16. package/Engines/abstractEngine.js.map +1 -1
  17. package/FrameGraph/Node/nodeRenderGraph.d.ts +0 -5
  18. package/FrameGraph/Node/nodeRenderGraph.js +0 -7
  19. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  20. package/FrameGraph/frameGraph.d.ts +0 -6
  21. package/FrameGraph/frameGraph.js +0 -23
  22. package/FrameGraph/frameGraph.js.map +1 -1
  23. package/FrameGraph/frameGraphObjectList.d.ts +0 -1
  24. package/FrameGraph/frameGraphObjectList.js +0 -1
  25. package/FrameGraph/frameGraphObjectList.js.map +1 -1
  26. package/FrameGraph/frameGraphRenderContext.d.ts +0 -1
  27. package/FrameGraph/frameGraphRenderContext.js +0 -1
  28. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  29. package/FrameGraph/frameGraphRenderTarget.d.ts +0 -1
  30. package/FrameGraph/frameGraphRenderTarget.js +0 -1
  31. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  32. package/FrameGraph/frameGraphTask.d.ts +0 -1
  33. package/FrameGraph/frameGraphTask.js +0 -1
  34. package/FrameGraph/frameGraphTask.js.map +1 -1
  35. package/FrameGraph/frameGraphTextureManager.d.ts +0 -1
  36. package/FrameGraph/frameGraphTextureManager.js +0 -1
  37. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  38. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +6 -0
  39. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +100 -41
  40. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  41. package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +4 -14
  42. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +9 -27
  43. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
  44. package/Particles/Node/Blocks/index.d.ts +2 -1
  45. package/Particles/Node/Blocks/index.js +2 -1
  46. package/Particles/Node/Blocks/index.js.map +1 -1
  47. package/Particles/Node/Blocks/particleLocalVariableBlock.d.ts +2 -0
  48. package/Particles/Node/Blocks/particleLocalVariableBlock.js +22 -10
  49. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
  50. package/Particles/Node/Blocks/particleMathBlock.d.ts +4 -0
  51. package/Particles/Node/Blocks/particleMathBlock.js +4 -0
  52. package/Particles/Node/Blocks/particleMathBlock.js.map +1 -1
  53. package/Particles/Node/Blocks/{particleModuloBlock.d.ts → particleNumberMathBlock.d.ts} +27 -4
  54. package/Particles/Node/Blocks/particleNumberMathBlock.js +149 -0
  55. package/Particles/Node/Blocks/particleNumberMathBlock.js.map +1 -0
  56. package/Particles/Node/Blocks/particleVectorMathBlock.d.ts +54 -0
  57. package/Particles/Node/Blocks/particleVectorMathBlock.js +116 -0
  58. package/Particles/Node/Blocks/particleVectorMathBlock.js.map +1 -0
  59. package/Particles/Node/Blocks/systemBlock.d.ts +8 -0
  60. package/Particles/Node/Blocks/systemBlock.js +34 -6
  61. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  62. package/Particles/Node/nodeParticleSystemSet.helper.js +63 -4
  63. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  64. package/Particles/baseParticleSystem.d.ts +8 -1
  65. package/Particles/baseParticleSystem.js +8 -1
  66. package/Particles/baseParticleSystem.js.map +1 -1
  67. package/Particles/particle.d.ts +4 -0
  68. package/Particles/particle.js +3 -0
  69. package/Particles/particle.js.map +1 -1
  70. package/Particles/particleSystem.d.ts +12 -0
  71. package/Particles/particleSystem.js +12 -0
  72. package/Particles/particleSystem.js.map +1 -1
  73. package/Particles/thinParticleSystem.d.ts +10 -0
  74. package/Particles/thinParticleSystem.js +10 -1
  75. package/Particles/thinParticleSystem.js.map +1 -1
  76. package/package.json +1 -1
  77. package/Particles/Node/Blocks/particleModuloBlock.js +0 -98
  78. package/Particles/Node/Blocks/particleModuloBlock.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import { Color4 } from "../../Maths/math.color.js";
2
2
  import { Vector2, Vector3 } from "../../Maths/math.vector.js";
3
+ import { AbstractMesh } from "../../Meshes/abstractMesh.js";
3
4
  import { FactorGradient } from "../../Misc/gradients.js";
4
5
  import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
5
6
  import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
@@ -27,12 +28,15 @@ import { SetupSpriteSheetBlock } from "./Blocks/Emitters/setupSpriteSheetBlock.j
27
28
  import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
28
29
  import { UpdateAngleBlock } from "./Blocks/Update/updateAngleBlock.js";
29
30
  import { BasicSpriteUpdateBlock } from "./Blocks/Update/basicSpriteUpdateBlock.js";
31
+ import { UpdateAttractorBlock } from "./Blocks/Update/updateAttractorBlock.js";
30
32
  import { UpdateColorBlock } from "./Blocks/Update/updateColorBlock.js";
31
33
  import { UpdateDirectionBlock } from "./Blocks/Update/updateDirectionBlock.js";
34
+ import { UpdateFlowMapBlock } from "./Blocks/Update/updateFlowMapBlock.js";
32
35
  import { UpdateNoiseBlock } from "./Blocks/Update/updateNoiseBlock.js";
33
36
  import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
34
37
  import { UpdateSizeBlock } from "./Blocks/Update/updateSizeBlock.js";
35
38
  import { UpdateRemapBlock } from "./Blocks/Update/updateRemapBlock.js";
39
+ import { GenerateBase64StringFromPixelData } from "../../Misc/copyTools.js";
36
40
  /**
37
41
  * Converts a ParticleSystem to a NodeParticleSystemSet.
38
42
  * @param name The name of the node particle system set.
@@ -368,6 +372,12 @@ function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
368
372
  context.scaledDirection = _UpdateParticleDragGradientBlockGroup(oldSystem._dragGradients, context);
369
373
  }
370
374
  updatedParticle = _UpdateParticlePositionBlockGroup(updatedParticle, oldSystem.isLocal, context);
375
+ if (oldSystem.attractors && oldSystem.attractors.length > 0) {
376
+ updatedParticle = _UpdateParticleAttractorBlockGroup(updatedParticle, oldSystem.attractors);
377
+ }
378
+ if (oldSystem.flowMap) {
379
+ updatedParticle = _UpdateParticleFlowMapBlockGroup(updatedParticle, oldSystem.flowMap, oldSystem.flowMapStrength);
380
+ }
371
381
  if (oldSystem._limitVelocityGradients && oldSystem._limitVelocityGradients.length > 0 && oldSystem.limitVelocityDamping !== 0) {
372
382
  updatedParticle = _UpdateParticleVelocityLimitGradientBlockGroup(updatedParticle, oldSystem._limitVelocityGradients, oldSystem.limitVelocityDamping, context);
373
383
  }
@@ -582,6 +592,46 @@ function _UpdateParticlePositionBlockGroup(inputParticle, isLocal, context) {
582
592
  }
583
593
  return updatePosition.output;
584
594
  }
595
+ /**
596
+ * Creates the group of blocks that represent the particle attractor update
597
+ * @param inputParticle The input particle to update
598
+ * @param attractors The attractors (if any)
599
+ * @returns The output of the group of blocks that represent the particle attractor update
600
+ */
601
+ function _UpdateParticleAttractorBlockGroup(inputParticle, attractors) {
602
+ let outputParticle = inputParticle;
603
+ // Chain update attractor blocks for each attractor
604
+ for (let i = 0; i < attractors.length; i++) {
605
+ const attractor = attractors[i];
606
+ const attractorBlock = new UpdateAttractorBlock(`Attractor Block ${i}`);
607
+ outputParticle.connectTo(attractorBlock.particle);
608
+ _CreateAndConnectInput("Attractor Position", attractor.position.clone(), attractorBlock.attractor);
609
+ _CreateAndConnectInput("Attractor Strength", attractor.strength, attractorBlock.strength);
610
+ outputParticle = attractorBlock.output;
611
+ }
612
+ return outputParticle;
613
+ }
614
+ /**
615
+ * Creates the group of blocks that represent the particle flow map update
616
+ * @param inputParticle The input particle to update
617
+ * @param flowMap The flow map data
618
+ * @param flowMapStrength The strength of the flow map
619
+ * @returns The output of the group of blocks that represent the particle flow map update
620
+ */
621
+ function _UpdateParticleFlowMapBlockGroup(inputParticle, flowMap, flowMapStrength) {
622
+ // Create the flow map update block
623
+ const updateFlowMapBlock = new UpdateFlowMapBlock("Flow Map Update");
624
+ inputParticle.connectTo(updateFlowMapBlock.particle);
625
+ // Create a texture block from the flow map data
626
+ // The FlowMap only stores raw pixel data, so we need to convert it to a base64 data URL
627
+ // Y has to be flipped as the texture data is flipped between CPU (canvas, Y=0 at top) and GPU (texture, Y=0 at bottom)
628
+ const flowMapTextureBlock = new ParticleTextureSourceBlock("Flow Map Texture");
629
+ flowMapTextureBlock.serializedCachedData = true;
630
+ flowMapTextureBlock.textureDataUrl = GenerateBase64StringFromPixelData(flowMap.data, { width: flowMap.width, height: flowMap.height }, true) ?? "";
631
+ flowMapTextureBlock.texture.connectTo(updateFlowMapBlock.flowMap);
632
+ _CreateAndConnectInput("Flow Map Strength", flowMapStrength, updateFlowMapBlock.strength);
633
+ return updateFlowMapBlock.output;
634
+ }
585
635
  /**
586
636
  * Creates the group of blocks that represent the particle size update
587
637
  * @param inputParticle The input particle to update
@@ -748,21 +798,30 @@ function _SystemBlockGroup(updateParticleOutput, oldSystem, context) {
748
798
  newSystem.preWarmCycles = oldSystem.preWarmCycles;
749
799
  newSystem.preWarmStepOffset = oldSystem.preWarmStepOffset;
750
800
  newSystem.isBillboardBased = oldSystem.isBillboardBased;
801
+ newSystem.billBoardMode = oldSystem.billboardMode;
751
802
  newSystem.isLocal = oldSystem.isLocal;
752
803
  newSystem.disposeOnStop = oldSystem.disposeOnStop;
753
- _SystemEmitRateValue(oldSystem.getEmitRateGradients(), oldSystem.targetStopDuration, oldSystem.emitRate, newSystem, context);
754
- const texture = oldSystem.particleTexture;
755
- if (texture) {
756
- _CreateTextureBlock(texture).connectTo(newSystem.texture);
804
+ if (oldSystem.emitter) {
805
+ _SystemEmitterPosition(oldSystem.emitter, newSystem);
757
806
  }
807
+ _SystemEmitRateValue(oldSystem.getEmitRateGradients(), oldSystem.targetStopDuration, oldSystem.emitRate, newSystem, context);
758
808
  _SystemTargetStopDuration(oldSystem.targetStopDuration, newSystem, context);
759
809
  const rampGradients = oldSystem.getRampGradients();
760
810
  if (rampGradients && rampGradients.length > 0) {
761
811
  _SystemRampGradientsBlockGroup(rampGradients, newSystem);
762
812
  }
813
+ const texture = oldSystem.particleTexture;
814
+ if (texture) {
815
+ _CreateTextureBlock(texture).connectTo(newSystem.texture);
816
+ }
763
817
  updateParticleOutput.connectTo(newSystem.particle);
764
818
  return newSystem;
765
819
  }
820
+ function _SystemEmitterPosition(emitter, newSystem) {
821
+ if (emitter) {
822
+ _CreateAndConnectInput("Emitter Position", emitter instanceof AbstractMesh ? emitter.position.clone() : emitter.clone(), newSystem.emitterPosition, NodeParticleBlockConnectionPointTypes.Vector3);
823
+ }
824
+ }
766
825
  function _SystemEmitRateValue(emitGradients, targetStopDuration, emitRate, newSystem, context) {
767
826
  if (emitGradients && emitGradients.length > 0 && targetStopDuration > 0) {
768
827
  // Create the emit gradients