@babylonjs-toolkit/next 9.25.1 → 9.28.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 (44) hide show
  1. package/lib/index.d.ts +35 -21
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +35 -21
  4. package/lib/particleconstantcurve.d.ts +3 -0
  5. package/lib/particleconstantcurve.d.ts.map +1 -0
  6. package/lib/particleconstantcurve.js +3 -0
  7. package/lib/particleconstantgradient.d.ts +3 -0
  8. package/lib/particleconstantgradient.d.ts.map +1 -0
  9. package/lib/particleconstantgradient.js +4 -0
  10. package/lib/particleemptytexture.d.ts +3 -0
  11. package/lib/particleemptytexture.d.ts.map +1 -0
  12. package/lib/particleemptytexture.js +1 -0
  13. package/lib/particlev2.d.ts +3 -0
  14. package/lib/particlev2.d.ts.map +1 -0
  15. package/lib/particlev2.js +1 -0
  16. package/lib/particlev3.d.ts +3 -0
  17. package/lib/particlev3.d.ts.map +1 -0
  18. package/lib/particlev3.js +1 -0
  19. package/lib/particlewhite.d.ts +3 -0
  20. package/lib/particlewhite.d.ts.map +1 -0
  21. package/lib/particlewhite.js +1 -0
  22. package/lib/project.d.ts +4 -118
  23. package/lib/project.d.ts.map +1 -1
  24. package/lib/project.js +65 -222
  25. package/lib/scenemanager.d.ts +6061 -831
  26. package/lib/scenemanager.d.ts.map +1 -1
  27. package/lib/scenemanager.js +44166 -15351
  28. package/lib/sgshadowdepth.d.ts +19 -0
  29. package/lib/sgshadowdepth.d.ts.map +1 -0
  30. package/lib/sgshadowdepth.js +214 -0
  31. package/lib/shadergraphfullscreen.d.ts +18 -0
  32. package/lib/shadergraphfullscreen.d.ts.map +1 -0
  33. package/lib/shadergraphfullscreen.js +22 -0
  34. package/lib/shadergraphlighttable.d.ts +7 -0
  35. package/lib/shadergraphlighttable.d.ts.map +1 -0
  36. package/lib/shadergraphlighttable.js +74 -0
  37. package/lib/unityscrollbar.d.ts.map +1 -1
  38. package/package.json +13 -13
  39. package/lib/iparticlesystemtransform.d.ts +0 -9
  40. package/lib/iparticlesystemtransform.d.ts.map +0 -1
  41. package/lib/iparticlesystemtransform.js +0 -1
  42. package/lib/perlin2d.d.ts +0 -9
  43. package/lib/perlin2d.d.ts.map +0 -1
  44. package/lib/perlin2d.js +0 -45
package/lib/project.js CHANGED
@@ -5,7 +5,7 @@ const TOOLKIT = (typeof window !== "undefined" && window.TOOLKIT) || _ToolkitRef
5
5
  if (typeof window !== "undefined" && !window.PROJECT)
6
6
  window.PROJECT = {};
7
7
  const PROJECT = (typeof window !== "undefined" && window.PROJECT) || {};
8
- import { ScriptComponent, SceneManager, AudioSource, Utilities, RigidbodyPhysics, InputController, ShurikenParticles, SearchType, UserInterface, RaycastVehicle, System, PlayerNumber, UserInputKey, WindowManager, UserInputAxis, UserInputOptions, CustomShaderMaterial, CustomShaderMaterialPlugin, RenderQuality } from './scenemanager';
8
+ import { ScriptComponent, SceneManager, AudioSource, Utilities, RigidbodyPhysics, InputController, ShurikenParticles, SearchType, UserInterface, RaycastVehicle, System, PlayerNumber, UserInputKey, WindowManager, UserInputAxis, UserInputOptions, CustomShaderMaterial, CustomShaderMaterialPlugin } from './scenemanager';
9
9
  import { LocalMessageBus } from './localmessagebus';
10
10
  import { EntityController } from './entitycontroller';
11
11
  import { LinesMeshRenderer } from './linesmeshrenderer';
@@ -4052,7 +4052,6 @@ export class StandardKartEffects extends ScriptComponent {
4052
4052
  }
4053
4053
  if (this.kart == null)
4054
4054
  return;
4055
- this.ensureSimulationSpace();
4056
4055
  const dt = this.getDeltaTime();
4057
4056
  this.tickDriftEffects();
4058
4057
  this.tickBoostEffects();
@@ -4238,54 +4237,13 @@ export class StandardKartEffects extends ScriptComponent {
4238
4237
  const model = this.findChildNode(this.modelNodeName);
4239
4238
  return (model != null) ? model : this.transform;
4240
4239
  }
4241
- applySimulationSpace(group) {
4242
- if (group.systems.length === 0)
4243
- return true;
4244
- const local = (group.simulationSpace === 0);
4245
- let applied = 0;
4246
- for (let i = 0; i < group.systems.length; i++) {
4247
- const system = group.systems[i];
4248
- if (system == null || typeof system.getParticleSystem !== "function")
4249
- continue;
4250
- const particles = system.getParticleSystem();
4251
- if (particles == null || typeof particles.isLocal !== "boolean")
4252
- continue;
4253
- particles.isLocal = local;
4254
- applied++;
4255
- }
4256
- return applied === group.systems.length;
4257
- }
4258
- ensureSimulationSpace() {
4259
- this.groups.forEach((group) => {
4260
- if (group.simulationSpaceApplied === true)
4261
- return;
4262
- if (this.applySimulationSpace(group) !== true)
4263
- return;
4264
- this.repairInvertedSizeRange(group);
4265
- group.simulationSpaceApplied = true;
4266
- });
4267
- }
4268
- repairInvertedSizeRange(group) {
4269
- for (let i = 0; i < group.systems.length; i++) {
4270
- const system = group.systems[i];
4271
- if (system == null || typeof system.getParticleSystem !== "function")
4272
- continue;
4273
- const particles = system.getParticleSystem();
4274
- if (particles == null)
4275
- continue;
4276
- if (typeof particles.minSize !== "number" || typeof particles.maxSize !== "number")
4277
- continue;
4278
- if (particles.minSize > particles.maxSize)
4279
- particles.maxSize = particles.minSize;
4280
- }
4281
- }
4282
4240
  resolveSimulationSpace(group, kind) {
4283
4241
  if (group.placeholder === true) {
4284
4242
  const properties = StandardKartEffects.PlaceholderProperties(kind, 0);
4285
4243
  return properties?.main?.simulationSpace ?? 0;
4286
4244
  }
4287
4245
  for (let i = 0; i < group.systems.length; i++) {
4288
- const authored = group.systems[i]?.m_systemProperties?.main?.simulationSpace;
4246
+ const authored = group.systems[i]?.getProperties?.()?.main?.simulationSpace;
4289
4247
  if (typeof authored === "number")
4290
4248
  return authored;
4291
4249
  }
@@ -4315,7 +4273,7 @@ export class StandardKartEffects extends ScriptComponent {
4315
4273
  }
4316
4274
  registerGroup(key, nodeName, parent, count, offset, kind) {
4317
4275
  const found = (parent != null) ? this.findNamedChildOf(parent, nodeName) : this.findChildNode(nodeName);
4318
- const group = { name: key, mount: found, systems: [], playing: false, placeholder: false, simulationSpace: 0, simulationSpaceApplied: false };
4276
+ const group = { name: key, mount: found, systems: [], playing: false, placeholder: false, simulationSpace: 0 };
4319
4277
  if (found != null) {
4320
4278
  group.systems = this.collectParticleComponents(found);
4321
4279
  }
@@ -4675,6 +4633,7 @@ export class RaceTrackManager extends ScriptComponent {
4675
4633
  this.p3n = 0;
4676
4634
  this.i = 0;
4677
4635
  this.drawDebugLines = false;
4636
+ RaceTrackManager.LiveManagers++;
4678
4637
  }
4679
4638
  awake() {
4680
4639
  this.trackNodes = this.getProperty("TrackNodes", this.trackNodes);
@@ -4860,6 +4819,19 @@ export class RaceTrackManager extends ScriptComponent {
4860
4819
  }
4861
4820
  }
4862
4821
  destroy() {
4822
+ const owner = this.scene;
4823
+ const owned = (node) => (node != null && node.getScene() === owner);
4824
+ if (owned(RaceTrackManager.WinnerTransform))
4825
+ RaceTrackManager.WinnerTransform = null;
4826
+ if (RaceTrackManager.CheckPointList != null && RaceTrackManager.CheckPointList.some(owned))
4827
+ RaceTrackManager.CheckPointList = null;
4828
+ if (RaceTrackManager.PlayerVehicleList != null) {
4829
+ const vehicles = RaceTrackManager.PlayerVehicleList.filter((node) => !owned(node));
4830
+ RaceTrackManager.PlayerVehicleList = (vehicles.length > 0) ? vehicles : null;
4831
+ }
4832
+ RaceTrackManager.LiveManagers = Math.max(0, RaceTrackManager.LiveManagers - 1);
4833
+ if (RaceTrackManager.LiveManagers === 0)
4834
+ RaceTrackManager._EventBus = null;
4863
4835
  }
4864
4836
  getRoutePoint(distance) {
4865
4837
  const result = new RoutePoint();
@@ -4981,6 +4953,7 @@ RaceTrackManager.CheckPointList = null;
4981
4953
  RaceTrackManager.LeaderBoardList = null;
4982
4954
  RaceTrackManager.PlayerVehicleList = null;
4983
4955
  RaceTrackManager._EventBus = null;
4956
+ RaceTrackManager.LiveManagers = 0;
4984
4957
  export class RemoteCarController extends ScriptComponent {
4985
4958
  constructor() {
4986
4959
  super(...arguments);
@@ -5497,6 +5470,20 @@ export class SkidMarkManager extends ScriptComponent {
5497
5470
  }
5498
5471
  start() { SkidMarkManager.CreateSkidMarkManager(this.scene); }
5499
5472
  update() { SkidMarkManager.UpdateSkidMarkManager(); }
5473
+ destroy() {
5474
+ if (SkidMarkManager.SkidMarkMesh == null || SkidMarkManager.SkidMarkMesh.getScene() !== this.scene)
5475
+ return;
5476
+ SkidMarkManager.SkidMarkMesh = null;
5477
+ SkidMarkManager.SkidMarkSections = null;
5478
+ SkidMarkManager.SkidBufferPositions = null;
5479
+ SkidMarkManager.SkidBufferNormals = null;
5480
+ SkidMarkManager.SkidBufferTangents = null;
5481
+ SkidMarkManager.SkidBufferColors = null;
5482
+ SkidMarkManager.SkidBufferUvs = null;
5483
+ SkidMarkManager.SkidBufferIndices = null;
5484
+ SkidMarkManager.SkidMarkIndex = 0;
5485
+ SkidMarkManager.SkidMarkUpdated = false;
5486
+ }
5500
5487
  static AddSkidMarkSegment(pos, normal, intensity, lastIndex) {
5501
5488
  if (SkidMarkManager.SkidMarkMesh == null)
5502
5489
  return null;
@@ -9981,7 +9968,11 @@ export class VehicleNetworkLabel extends ScriptComponent {
9981
9968
  }
9982
9969
  static GetFullscreenUI(scene, sampling = BABYLON.Texture.BILINEAR_SAMPLINGMODE) {
9983
9970
  if (VehicleNetworkLabel.AdvDynamicTexture == null) {
9984
- VehicleNetworkLabel.AdvDynamicTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("Default-Screen-UI", true, scene, sampling);
9971
+ const ui = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("Default-Screen-UI", true, scene, sampling);
9972
+ VehicleNetworkLabel.AdvDynamicTexture = ui;
9973
+ if (scene != null)
9974
+ scene.onDisposeObservable.addOnce(() => { if (VehicleNetworkLabel.AdvDynamicTexture === ui)
9975
+ VehicleNetworkLabel.AdvDynamicTexture = null; });
9985
9976
  }
9986
9977
  return VehicleNetworkLabel.AdvDynamicTexture;
9987
9978
  }
@@ -10147,10 +10138,6 @@ export class VertexSplatPlugin extends CustomShaderMaterialPlugin {
10147
10138
  }
10148
10139
  }
10149
10140
  export class DefaultCameraSystem extends ScriptComponent {
10150
- static GetRenderingPipeline() { return DefaultCameraSystem.renderingPipeline; }
10151
- ;
10152
- static GetScreenSpacePipeline() { return DefaultCameraSystem.screenSpacePipeline; }
10153
- ;
10154
10141
  static IsCameraSystemReady() { return DefaultCameraSystem.cameraReady; }
10155
10142
  isMainCamera() { return this.mainCamera; }
10156
10143
  getCameraType() { return this.cameraType; }
@@ -10170,7 +10157,6 @@ export class DefaultCameraSystem extends ScriptComponent {
10170
10157
  this.setPointerLock = false;
10171
10158
  this.setCameraTarget = null;
10172
10159
  this.setSpatialAudio = true;
10173
- this.editorPostProcessing = null;
10174
10160
  this.m_cameraRig = null;
10175
10161
  this.targetCameraOffset = new BABYLON.Vector3(0, 0, 0);
10176
10162
  this.cameraNode = null;
@@ -10205,7 +10191,6 @@ export class DefaultCameraSystem extends ScriptComponent {
10205
10191
  this.arcRotateConfig = this.getProperty("arcRotateConfig", this.arcRotateConfig);
10206
10192
  this.multiPlayerSetup = this.getProperty("multiPlayerSetup", this.multiPlayerSetup);
10207
10193
  this.cameraController = this.getProperty("cameraController", this.cameraController);
10208
- this.editorPostProcessing = this.getProperty("renderingPipeline", this.editorPostProcessing);
10209
10194
  this.cleanCameraSystemState();
10210
10195
  if (this.fullScreenToggle === 0) {
10211
10196
  InputController.OnKeyboardPress(UserInputKey.F, () => {
@@ -10473,140 +10458,6 @@ export class DefaultCameraSystem extends ScriptComponent {
10473
10458
  }
10474
10459
  }
10475
10460
  }
10476
- const quality = RenderQuality.High;
10477
- const allowProcessing = (quality === RenderQuality.High);
10478
- if (allowProcessing === true && this.editorPostProcessing != null && this.editorPostProcessing.usePostProcessing === true) {
10479
- const existingPipeline = DefaultCameraSystem.FindExistingRenderingPipeline(this.scene);
10480
- if (existingPipeline != null) {
10481
- DefaultCameraSystem.renderingPipeline = existingPipeline;
10482
- BABYLON.Tools.Log("DefaultCameraSystem: reusing rendering pipeline '" + existingPipeline.name + "' (post-processing volume values win)");
10483
- }
10484
- if (existingPipeline == null)
10485
- DefaultCameraSystem.renderingPipeline = new BABYLON.DefaultRenderingPipeline("DefaultCameraSystem", this.editorPostProcessing.highDynamicRange, this.scene, this.scene.cameras, true);
10486
- if (existingPipeline == null && DefaultCameraSystem.renderingPipeline.isSupported === true) {
10487
- const defaultPipeline = DefaultCameraSystem.renderingPipeline;
10488
- defaultPipeline.samples = this.editorPostProcessing.screenAntiAliasing.msaaSamples;
10489
- defaultPipeline.imageProcessingEnabled = this.editorPostProcessing.imageProcessingConfig.imageProcessing;
10490
- if (defaultPipeline.imageProcessingEnabled) {
10491
- defaultPipeline.imageProcessing.contrast = this.editorPostProcessing.imageProcessingConfig.imageContrast;
10492
- defaultPipeline.imageProcessing.exposure = this.editorPostProcessing.imageProcessingConfig.imageExposure;
10493
- defaultPipeline.imageProcessing.toneMappingEnabled = this.editorPostProcessing.imageProcessingConfig.toneMapping;
10494
- defaultPipeline.imageProcessing.toneMappingType = this.editorPostProcessing.imageProcessingConfig.toneMapType;
10495
- defaultPipeline.imageProcessing.vignetteEnabled = this.editorPostProcessing.imageProcessingConfig.vignetteEnabled;
10496
- if (defaultPipeline.imageProcessing.vignetteEnabled) {
10497
- defaultPipeline.imageProcessing.vignetteBlendMode = this.editorPostProcessing.imageProcessingConfig.vignetteBlendMode;
10498
- defaultPipeline.imageProcessing.vignetteCameraFov = this.editorPostProcessing.imageProcessingConfig.vignetteCameraFov;
10499
- defaultPipeline.imageProcessing.vignetteCentreX = this.editorPostProcessing.imageProcessingConfig.vignetteCentreX;
10500
- defaultPipeline.imageProcessing.vignetteCentreY = this.editorPostProcessing.imageProcessingConfig.vignetteCentreY;
10501
- defaultPipeline.imageProcessing.vignetteStretch = this.editorPostProcessing.imageProcessingConfig.vignetteStretch;
10502
- defaultPipeline.imageProcessing.vignetteWeight = this.editorPostProcessing.imageProcessingConfig.vignetteWeight;
10503
- if (this.editorPostProcessing.imageProcessingConfig.vignetteColor != null) {
10504
- const vcolor = Utilities.ParseColor4(this.editorPostProcessing.imageProcessingConfig.vignetteColor);
10505
- if (vcolor != null)
10506
- defaultPipeline.imageProcessing.vignetteColor = vcolor;
10507
- }
10508
- }
10509
- defaultPipeline.imageProcessing.colorGradingEnabled = this.editorPostProcessing.imageProcessingConfig.useColorGrading;
10510
- if (defaultPipeline.imageProcessing.colorGradingEnabled) {
10511
- if (this.editorPostProcessing.imageProcessingConfig.setGradingTexture != null) {
10512
- const colorGradingTexture = Utilities.ParseTexture(this.editorPostProcessing.imageProcessingConfig.setGradingTexture, this.scene, true, false);
10513
- colorGradingTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
10514
- colorGradingTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
10515
- defaultPipeline.imageProcessing.colorGradingTexture = colorGradingTexture;
10516
- defaultPipeline.imageProcessing.colorGradingWithGreenDepth = false;
10517
- }
10518
- }
10519
- defaultPipeline.imageProcessing.colorCurvesEnabled = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.curvesEnabled;
10520
- if (defaultPipeline.imageProcessing.colorCurvesEnabled) {
10521
- var curve = new BABYLON.ColorCurves();
10522
- curve.globalDensity = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.globalDen;
10523
- curve.globalExposure = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.globalExp;
10524
- curve.globalHue = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.globalHue;
10525
- curve.globalSaturation = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.globalSat;
10526
- curve.highlightsDensity = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.highlightsDen;
10527
- curve.highlightsExposure = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.highlightsExp;
10528
- curve.highlightsHue = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.highlightsHue;
10529
- curve.highlightsSaturation = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.highlightsSat;
10530
- curve.midtonesDensity = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.midtonesDen;
10531
- curve.midtonesExposure = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.midtonesExp;
10532
- curve.midtonesHue = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.midtonesHue;
10533
- curve.midtonesSaturation = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.midtonesSat;
10534
- curve.shadowsDensity = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.shadowsDen;
10535
- curve.shadowsExposure = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.shadowsExp;
10536
- curve.shadowsHue = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.shadowsHue;
10537
- curve.shadowsSaturation = this.editorPostProcessing.imageProcessingConfig.imagingColorCurves.shadowsSat;
10538
- defaultPipeline.imageProcessing.colorCurves = curve;
10539
- }
10540
- }
10541
- defaultPipeline.bloomEnabled = this.editorPostProcessing.bloomEffectProperties.bloomEnabled;
10542
- if (defaultPipeline.bloomEnabled) {
10543
- defaultPipeline.bloomKernel = this.editorPostProcessing.bloomEffectProperties.bloomKernel;
10544
- defaultPipeline.bloomScale = this.editorPostProcessing.bloomEffectProperties.bloomScale;
10545
- defaultPipeline.bloomWeight = this.editorPostProcessing.bloomEffectProperties.bloomWeight;
10546
- defaultPipeline.bloomThreshold = this.editorPostProcessing.bloomEffectProperties.bloomThreshold;
10547
- }
10548
- defaultPipeline.chromaticAberrationEnabled = this.editorPostProcessing.chromaticAberration.aberrationEnabled;
10549
- if (defaultPipeline.chromaticAberrationEnabled) {
10550
- defaultPipeline.chromaticAberration.aberrationAmount = this.editorPostProcessing.chromaticAberration.aberrationAmount;
10551
- defaultPipeline.chromaticAberration.adaptScaleToCurrentViewport = this.editorPostProcessing.chromaticAberration.adaptScaleViewport;
10552
- defaultPipeline.chromaticAberration.alphaMode = this.editorPostProcessing.chromaticAberration.alphaMode;
10553
- defaultPipeline.chromaticAberration.alwaysForcePOT = this.editorPostProcessing.chromaticAberration.alwaysForcePOT;
10554
- defaultPipeline.chromaticAberration.enablePixelPerfectMode = this.editorPostProcessing.chromaticAberration.pixelPerfectMode;
10555
- defaultPipeline.chromaticAberration.forceFullscreenViewport = this.editorPostProcessing.chromaticAberration.fullscreenViewport;
10556
- }
10557
- defaultPipeline.depthOfFieldEnabled = this.editorPostProcessing.focalDepthOfField.depthOfField;
10558
- if (defaultPipeline.depthOfFieldEnabled && defaultPipeline.depthOfField.isSupported) {
10559
- defaultPipeline.depthOfFieldBlurLevel = this.editorPostProcessing.focalDepthOfField.blurLevel;
10560
- defaultPipeline.depthOfField.fStop = this.editorPostProcessing.focalDepthOfField.focalStop;
10561
- defaultPipeline.depthOfField.focalLength = this.editorPostProcessing.focalDepthOfField.focalLength;
10562
- defaultPipeline.depthOfField.focusDistance = this.editorPostProcessing.focalDepthOfField.focusDistance;
10563
- defaultPipeline.depthOfField.lensSize = this.editorPostProcessing.focalDepthOfField.maxLensSize;
10564
- }
10565
- defaultPipeline.fxaaEnabled = this.editorPostProcessing.screenAntiAliasing.fxaaEnabled;
10566
- if (defaultPipeline.fxaaEnabled) {
10567
- defaultPipeline.fxaa.samples = this.editorPostProcessing.screenAntiAliasing.fxaaSamples;
10568
- defaultPipeline.fxaa.adaptScaleToCurrentViewport = this.editorPostProcessing.screenAntiAliasing.fxaaScaling;
10569
- }
10570
- defaultPipeline.glowLayerEnabled = this.editorPostProcessing.glowLayerProperties.glowEnabled;
10571
- if (defaultPipeline.glowLayerEnabled) {
10572
- defaultPipeline.glowLayer.intensity = this.editorPostProcessing.glowLayerProperties.glowIntensity;
10573
- defaultPipeline.glowLayer.blurKernelSize = this.editorPostProcessing.glowLayerProperties.blurKernelSize;
10574
- }
10575
- defaultPipeline.grainEnabled = this.editorPostProcessing.grainEffectProperties.grainEnabled;
10576
- if (defaultPipeline.grainEnabled) {
10577
- defaultPipeline.grain.animated = this.editorPostProcessing.grainEffectProperties.grainAnimated;
10578
- defaultPipeline.grain.intensity = this.editorPostProcessing.grainEffectProperties.grainIntensity;
10579
- defaultPipeline.grain.adaptScaleToCurrentViewport = this.editorPostProcessing.grainEffectProperties.adaptScaleViewport;
10580
- }
10581
- defaultPipeline.sharpenEnabled = this.editorPostProcessing.sharpEffectProperties.sharpenEnabled;
10582
- if (defaultPipeline.sharpenEnabled) {
10583
- defaultPipeline.sharpen.edgeAmount = this.editorPostProcessing.sharpEffectProperties.sharpEdgeAmount;
10584
- defaultPipeline.sharpen.colorAmount = this.editorPostProcessing.sharpEffectProperties.sharpColorAmount;
10585
- defaultPipeline.sharpen.adaptScaleToCurrentViewport = this.editorPostProcessing.sharpEffectProperties.adaptScaleViewport;
10586
- }
10587
- }
10588
- else {
10589
- SceneManager.LogWarning("Babylon.js default rendering pipeline not supported");
10590
- }
10591
- if (this.editorPostProcessing.screenSpaceRendering != null && this.editorPostProcessing.screenSpaceRendering.SSAO === true) {
10592
- const ssaoRatio = {
10593
- ssaoRatio: this.editorPostProcessing.screenSpaceRendering.SSAORatio,
10594
- combineRatio: this.editorPostProcessing.screenSpaceRendering.combineRatio
10595
- };
10596
- DefaultCameraSystem.screenSpacePipeline = new BABYLON.SSAORenderingPipeline("DefaultCameraSystem-SSAO", this.scene, ssaoRatio, this.scene.cameras);
10597
- if (DefaultCameraSystem.screenSpacePipeline.isSupported === true) {
10598
- const ssaoPipeline = DefaultCameraSystem.screenSpacePipeline;
10599
- ssaoPipeline.fallOff = this.editorPostProcessing.screenSpaceRendering.fallOff;
10600
- ssaoPipeline.area = this.editorPostProcessing.screenSpaceRendering.area;
10601
- ssaoPipeline.radius = this.editorPostProcessing.screenSpaceRendering.radius;
10602
- ssaoPipeline.totalStrength = this.editorPostProcessing.screenSpaceRendering.totalStrength;
10603
- ssaoPipeline.base = this.editorPostProcessing.screenSpaceRendering.baseValue;
10604
- }
10605
- else {
10606
- SceneManager.LogWarning("Babylon.js SSAO rendering pipeline not supported");
10607
- }
10608
- }
10609
- }
10610
10461
  DefaultCameraSystem.cameraReady = true;
10611
10462
  }
10612
10463
  updateCameraSystemState() {
@@ -10650,40 +10501,23 @@ export class DefaultCameraSystem extends ScriptComponent {
10650
10501
  this.immersiveOptions = null;
10651
10502
  this.cameraPivot = null;
10652
10503
  this.cameraNode = null;
10653
- if (DefaultCameraSystem.renderingPipeline != null) {
10654
- if (DefaultCameraSystem.renderingPipeline.name === "DefaultCameraSystem") {
10655
- try {
10656
- DefaultCameraSystem.renderingPipeline.dispose();
10657
- }
10658
- catch (e) { }
10659
- }
10660
- DefaultCameraSystem.renderingPipeline = null;
10661
- }
10662
- if (DefaultCameraSystem.screenSpacePipeline != null) {
10663
- try {
10664
- DefaultCameraSystem.screenSpacePipeline.dispose();
10665
- }
10666
- catch (e) { }
10667
- DefaultCameraSystem.screenSpacePipeline = null;
10668
- }
10669
- }
10670
- static FindExistingRenderingPipeline(scene) {
10671
- const manager = scene.postProcessRenderPipelineManager;
10672
- if (manager == null)
10673
- return null;
10674
- const pipelines = manager.supportedPipelines || [];
10675
- const preferred = scene.activeCamera;
10676
- let fallback = null;
10677
- for (const pipeline of pipelines) {
10678
- if (!(pipeline instanceof BABYLON.DefaultRenderingPipeline))
10679
- continue;
10680
- const cameras = pipeline.cameras || [];
10681
- if (preferred != null && cameras.indexOf(preferred) >= 0)
10682
- return pipeline;
10683
- if (fallback == null && cameras.length > 0)
10684
- fallback = pipeline;
10685
- }
10686
- return fallback;
10504
+ const owner = this.scene;
10505
+ const owned = (camera) => (camera != null && owner != null && camera.getScene() === owner);
10506
+ if (owned(DefaultCameraSystem.PlayerOneCamera))
10507
+ DefaultCameraSystem.PlayerOneCamera = null;
10508
+ if (owned(DefaultCameraSystem.PlayerTwoCamera))
10509
+ DefaultCameraSystem.PlayerTwoCamera = null;
10510
+ if (owned(DefaultCameraSystem.PlayerThreeCamera))
10511
+ DefaultCameraSystem.PlayerThreeCamera = null;
10512
+ if (owned(DefaultCameraSystem.PlayerFourCamera))
10513
+ DefaultCameraSystem.PlayerFourCamera = null;
10514
+ if (DefaultCameraSystem.multiPlayerCameras != null && DefaultCameraSystem.multiPlayerCameras.some(owned))
10515
+ DefaultCameraSystem.multiPlayerCameras = null;
10516
+ const xr = DefaultCameraSystem.XRExperienceHelper;
10517
+ if (xr != null && xr.baseExperience != null && xr.baseExperience.sessionManager != null && xr.baseExperience.sessionManager.scene === owner)
10518
+ DefaultCameraSystem.XRExperienceHelper = null;
10519
+ if (DefaultCameraSystem.cameraInstance === this)
10520
+ DefaultCameraSystem.cameraInstance = null;
10687
10521
  }
10688
10522
  getCameraPivotPosition() { return (this.cameraPivot != null) ? this.cameraPivot.position : null; }
10689
10523
  getCameraPivotRotation() { return (this.cameraPivot != null) ? this.cameraPivot.rotationQuaternion : null; }
@@ -11074,8 +10908,6 @@ DefaultCameraSystem.stereoCameras = true;
11074
10908
  DefaultCameraSystem.startupMode = 1;
11075
10909
  DefaultCameraSystem.cameraReady = false;
11076
10910
  DefaultCameraSystem.cameraInstance = null;
11077
- DefaultCameraSystem.renderingPipeline = null;
11078
- DefaultCameraSystem.screenSpacePipeline = null;
11079
10911
  DefaultCameraSystem.OnXRExperienceHelperObservable = new BABYLON.Observable();
11080
10912
  DefaultCameraSystem.FOLLOW_SPEED = 1.0;
11081
10913
  export class DebugInformation extends ScriptComponent {
@@ -11493,6 +11325,8 @@ export class MobileInputController extends ScriptComponent {
11493
11325
  }
11494
11326
  }
11495
11327
  destroy() {
11328
+ if (MobileInputController.StaticInstance === this)
11329
+ MobileInputController.StaticInstance = null;
11496
11330
  if (this.m_leftStick != null) {
11497
11331
  this.m_leftStick.dispose();
11498
11332
  this.m_leftStick = null;
@@ -14879,6 +14713,15 @@ export class SceneSoundSystem extends ScriptComponent {
14879
14713
  if (soundNode != null)
14880
14714
  SceneSoundSystem._SFX = SceneManager.FindScriptComponent(soundNode, "PROJECT.SoundManager");
14881
14715
  }
14716
+ destroy() {
14717
+ const owner = this.scene;
14718
+ const music = SceneSoundSystem._MUSIC;
14719
+ if (music != null && (music.scene == null || music.scene === owner))
14720
+ SceneSoundSystem._MUSIC = null;
14721
+ const sfx = SceneSoundSystem._SFX;
14722
+ if (sfx != null && (sfx.scene == null || sfx.scene === owner))
14723
+ SceneSoundSystem._SFX = null;
14724
+ }
14882
14725
  }
14883
14726
  SceneSoundSystem._MUSIC = null;
14884
14727
  SceneSoundSystem._SFX = null;