@babylonjs/core 7.27.0 → 7.27.2

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 (144) hide show
  1. package/Animations/animationGroup.d.ts +2 -2
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Audio/audioSceneComponent.d.ts +5 -9
  4. package/Audio/audioSceneComponent.js.map +1 -1
  5. package/Bones/skeleton.d.ts +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +2 -0
  8. package/Cameras/camera.js +2 -0
  9. package/Cameras/camera.js.map +1 -1
  10. package/Engines/WebGPU/webgpuSnapshotRendering.js +3 -0
  11. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/{abstractScene.d.ts → IAssetContainer.d.ts} +33 -6
  15. package/IAssetContainer.js +2 -0
  16. package/IAssetContainer.js.map +1 -0
  17. package/Layers/effectLayerSceneComponent.d.ts +6 -6
  18. package/Layers/effectLayerSceneComponent.js +3 -3
  19. package/Layers/effectLayerSceneComponent.js.map +1 -1
  20. package/Layers/glowLayer.d.ts +3 -3
  21. package/Layers/glowLayer.js +2 -2
  22. package/Layers/glowLayer.js.map +1 -1
  23. package/Layers/highlightLayer.d.ts +3 -3
  24. package/Layers/highlightLayer.js +2 -2
  25. package/Layers/highlightLayer.js.map +1 -1
  26. package/Layers/layerSceneComponent.d.ts +5 -5
  27. package/Layers/layerSceneComponent.js.map +1 -1
  28. package/LensFlares/lensFlareSystemSceneComponent.d.ts +6 -6
  29. package/LensFlares/lensFlareSystemSceneComponent.js +6 -6
  30. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  31. package/Lights/Shadows/shadowGeneratorSceneComponent.d.ts +3 -3
  32. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  33. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +1 -1
  34. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  35. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +2 -2
  36. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  37. package/Materials/Textures/baseTexture.d.ts +2 -2
  38. package/Materials/Textures/baseTexture.js.map +1 -1
  39. package/Materials/effectRenderer.d.ts +1 -0
  40. package/Materials/effectRenderer.js +2 -0
  41. package/Materials/effectRenderer.js.map +1 -1
  42. package/Materials/material.d.ts +2 -2
  43. package/Materials/material.decalMapConfiguration.d.ts +1 -1
  44. package/Materials/material.decalMapConfiguration.js +1 -1
  45. package/Materials/material.decalMapConfiguration.js.map +1 -1
  46. package/Materials/material.js.map +1 -1
  47. package/Materials/shaderMaterial.d.ts +5 -0
  48. package/Materials/shaderMaterial.js +7 -0
  49. package/Materials/shaderMaterial.js.map +1 -1
  50. package/Maths/math.color.d.ts +20 -0
  51. package/Maths/math.color.js +41 -12
  52. package/Maths/math.color.js.map +1 -1
  53. package/Meshes/Builders/greasedLineBuilder.d.ts +16 -0
  54. package/Meshes/Builders/greasedLineBuilder.js +1 -1
  55. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  56. package/Meshes/Builders/groundBuilder.d.ts +1 -0
  57. package/Meshes/Builders/groundBuilder.js +2 -2
  58. package/Meshes/Builders/groundBuilder.js.map +1 -1
  59. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  60. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  61. package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
  62. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  63. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
  64. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  65. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +3 -0
  66. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +86 -1
  67. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +4 -0
  69. package/Meshes/Node/Blocks/Sources/nullBlock.js +8 -0
  70. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  71. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +13 -0
  72. package/Meshes/Node/Blocks/Sources/planeBlock.js +41 -3
  73. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  74. package/Meshes/Node/Blocks/debugBlock.js +1 -1
  75. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  76. package/Meshes/Node/Blocks/geometryElbowBlock.js +1 -1
  77. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +4 -0
  79. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +47 -1
  80. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  81. package/Meshes/geometry.d.ts +2 -2
  82. package/Meshes/geometry.js.map +1 -1
  83. package/Meshes/mesh.d.ts +7 -0
  84. package/Meshes/mesh.js +15 -0
  85. package/Meshes/mesh.js.map +1 -1
  86. package/Meshes/meshUVSpaceRenderer.d.ts +3 -2
  87. package/Meshes/meshUVSpaceRenderer.js +15 -3
  88. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  89. package/Misc/greasedLineTools.d.ts +3 -1
  90. package/Misc/greasedLineTools.js +17 -2
  91. package/Misc/greasedLineTools.js.map +1 -1
  92. package/Misc/index.d.ts +2 -0
  93. package/Misc/index.js +2 -0
  94. package/Misc/index.js.map +1 -1
  95. package/Misc/screenshotTools.js +3 -2
  96. package/Misc/screenshotTools.js.map +1 -1
  97. package/Misc/textureTools.js +20 -4
  98. package/Misc/textureTools.js.map +1 -1
  99. package/Morph/morphTargetManager.d.ts +2 -2
  100. package/Morph/morphTargetManager.js.map +1 -1
  101. package/PostProcesses/postProcess.d.ts +2 -2
  102. package/PostProcesses/postProcess.js.map +1 -1
  103. package/Probes/reflectionProbe.d.ts +5 -5
  104. package/Probes/reflectionProbe.js +3 -3
  105. package/Probes/reflectionProbe.js.map +1 -1
  106. package/Rendering/fluidRenderer/fluidRenderer.d.ts +2 -2
  107. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  108. package/Rendering/prePassRendererSceneComponent.d.ts +2 -2
  109. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  110. package/Rendering/subSurfaceSceneComponent.d.ts +2 -2
  111. package/Rendering/subSurfaceSceneComponent.js.map +1 -1
  112. package/Shaders/lod.fragment.js +2 -2
  113. package/Shaders/lod.fragment.js.map +1 -1
  114. package/Shaders/lodCube.fragment.js +2 -2
  115. package/Shaders/lodCube.fragment.js.map +1 -1
  116. package/Shaders/spriteMap.fragment.js +18 -6
  117. package/Shaders/spriteMap.fragment.js.map +1 -1
  118. package/Shaders/spriteMap.vertex.js +1 -1
  119. package/Shaders/spriteMap.vertex.js.map +1 -1
  120. package/ShadersWGSL/lod.fragment.d.ts +5 -0
  121. package/ShadersWGSL/lod.fragment.js +11 -0
  122. package/ShadersWGSL/lod.fragment.js.map +1 -0
  123. package/ShadersWGSL/lodCube.fragment.d.ts +5 -0
  124. package/ShadersWGSL/lodCube.fragment.js +30 -0
  125. package/ShadersWGSL/lodCube.fragment.js.map +1 -0
  126. package/Sprites/spriteMap.d.ts +16 -0
  127. package/Sprites/spriteMap.js +17 -0
  128. package/Sprites/spriteMap.js.map +1 -1
  129. package/assetContainer.d.ts +143 -3
  130. package/assetContainer.js +129 -8
  131. package/assetContainer.js.map +1 -1
  132. package/index.d.ts +0 -1
  133. package/index.js +0 -1
  134. package/index.js.map +1 -1
  135. package/node.d.ts +2 -2
  136. package/node.js.map +1 -1
  137. package/package.json +1 -1
  138. package/scene.d.ts +103 -14
  139. package/scene.js +170 -71
  140. package/scene.js.map +1 -1
  141. package/sceneComponent.d.ts +3 -3
  142. package/sceneComponent.js.map +1 -1
  143. package/abstractScene.js +0 -117
  144. package/abstractScene.js.map +0 -1
package/scene.js CHANGED
@@ -5,7 +5,6 @@ import { SmartArrayNoDuplicate, SmartArray } from "./Misc/smartArray.js";
5
5
  import { StringDictionary } from "./Misc/stringDictionary.js";
6
6
  import { Tags } from "./Misc/tags.js";
7
7
  import { Vector3, Matrix, TmpVectors } from "./Maths/math.vector.js";
8
- import { AbstractScene } from "./abstractScene.js";
9
8
  import { ImageProcessingConfiguration } from "./Materials/imageProcessingConfiguration.js";
10
9
  import { UniformBuffer } from "./Materials/uniformBuffer.js";
11
10
  import { PickingInfo } from "./Collisions/pickingInfo.js";
@@ -44,7 +43,7 @@ export var ScenePerformancePriority;
44
43
  * Represents a scene to be rendered by the engine.
45
44
  * @see https://doc.babylonjs.com/features/featuresDeepDive/scene
46
45
  */
47
- export class Scene extends AbstractScene {
46
+ export class Scene {
48
47
  // eslint-disable-next-line jsdoc/require-returns-check
49
48
  /**
50
49
  * Factory used to create the default material.
@@ -62,26 +61,6 @@ export class Scene extends AbstractScene {
62
61
  static CollisionCoordinatorFactory() {
63
62
  throw _WarnImport("DefaultCollisionCoordinator");
64
63
  }
65
- /**
66
- * Texture used in all pbr material as the reflection texture.
67
- * As in the majority of the scene they are the same (exception for multi room and so on),
68
- * this is easier to reference from here than from all the materials.
69
- */
70
- get environmentTexture() {
71
- return this._environmentTexture;
72
- }
73
- /**
74
- * Texture used in all pbr material as the reflection texture.
75
- * As in the majority of the scene they are the same (exception for multi room and so on),
76
- * this is easier to set here than in all the materials.
77
- */
78
- set environmentTexture(value) {
79
- if (this._environmentTexture === value) {
80
- return;
81
- }
82
- this._environmentTexture = value;
83
- this.markAllMaterialsAsDirty(1);
84
- }
85
64
  /**
86
65
  * Default image processing configuration used either in the rendering
87
66
  * Forward main pass or through the imageProcessingPostProcess if present.
@@ -164,6 +143,38 @@ export class Scene extends AbstractScene {
164
143
  get forcePointsCloud() {
165
144
  return this._forcePointsCloud;
166
145
  }
146
+ /**
147
+ * Texture used in all pbr material as the reflection texture.
148
+ * As in the majority of the scene they are the same (exception for multi room and so on),
149
+ * this is easier to reference from here than from all the materials.
150
+ */
151
+ get environmentTexture() {
152
+ return this._environmentTexture;
153
+ }
154
+ /**
155
+ * Texture used in all pbr material as the reflection texture.
156
+ * As in the majority of the scene they are the same (exception for multi room and so on),
157
+ * this is easier to set here than in all the materials.
158
+ */
159
+ set environmentTexture(value) {
160
+ if (this._environmentTexture === value) {
161
+ return;
162
+ }
163
+ this._environmentTexture = value;
164
+ this.markAllMaterialsAsDirty(1);
165
+ }
166
+ /**
167
+ * @returns all meshes, lights, cameras, transformNodes and bones
168
+ */
169
+ getNodes() {
170
+ let nodes = [];
171
+ nodes = nodes.concat(this.meshes);
172
+ nodes = nodes.concat(this.lights);
173
+ nodes = nodes.concat(this.cameras);
174
+ nodes = nodes.concat(this.transformNodes); // dummies
175
+ this.skeletons.forEach((skeleton) => (nodes = nodes.concat(skeleton.bones)));
176
+ return nodes;
177
+ }
167
178
  /**
168
179
  * Gets or sets the animation properties override
169
180
  */
@@ -600,7 +611,6 @@ export class Scene extends AbstractScene {
600
611
  * @param options defines the scene options
601
612
  */
602
613
  constructor(engine, options) {
603
- super();
604
614
  // Members
605
615
  /** @internal */
606
616
  this._inputManager = new InputManager(this);
@@ -641,6 +651,87 @@ export class Scene extends AbstractScene {
641
651
  this._forceWireframe = false;
642
652
  this._skipFrustumClipping = false;
643
653
  this._forcePointsCloud = false;
654
+ /**
655
+ * Gets the list of root nodes (ie. nodes with no parent)
656
+ */
657
+ this.rootNodes = [];
658
+ /** All of the cameras added to this scene
659
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
660
+ */
661
+ this.cameras = [];
662
+ /**
663
+ * All of the lights added to this scene
664
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
665
+ */
666
+ this.lights = [];
667
+ /**
668
+ * All of the (abstract) meshes added to this scene
669
+ */
670
+ this.meshes = [];
671
+ /**
672
+ * The list of skeletons added to the scene
673
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
674
+ */
675
+ this.skeletons = [];
676
+ /**
677
+ * All of the particle systems added to this scene
678
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro
679
+ */
680
+ this.particleSystems = [];
681
+ /**
682
+ * Gets a list of Animations associated with the scene
683
+ */
684
+ this.animations = [];
685
+ /**
686
+ * All of the animation groups added to this scene
687
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
688
+ */
689
+ this.animationGroups = [];
690
+ /**
691
+ * All of the multi-materials added to this scene
692
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials
693
+ */
694
+ this.multiMaterials = [];
695
+ /**
696
+ * All of the materials added to this scene
697
+ * In the context of a Scene, it is not supposed to be modified manually.
698
+ * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.
699
+ * Note also that the order of the Material within the array is not significant and might change.
700
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
701
+ */
702
+ this.materials = [];
703
+ /**
704
+ * The list of morph target managers added to the scene
705
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph
706
+ */
707
+ this.morphTargetManagers = [];
708
+ /**
709
+ * The list of geometries used in the scene.
710
+ */
711
+ this.geometries = [];
712
+ /**
713
+ * All of the transform nodes added to this scene
714
+ * In the context of a Scene, it is not supposed to be modified manually.
715
+ * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.
716
+ * Note also that the order of the TransformNode within the array is not significant and might change.
717
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
718
+ */
719
+ this.transformNodes = [];
720
+ /**
721
+ * ActionManagers available on the scene.
722
+ * @deprecated
723
+ */
724
+ this.actionManagers = [];
725
+ /**
726
+ * Textures to keep.
727
+ */
728
+ this.textures = [];
729
+ /** @internal */
730
+ this._environmentTexture = null;
731
+ /**
732
+ * The list of postprocesses added to the scene
733
+ */
734
+ this.postProcesses = [];
644
735
  /**
645
736
  * Gets or sets a boolean indicating if animations are enabled
646
737
  */
@@ -3734,59 +3825,67 @@ export class Scene extends AbstractScene {
3734
3825
  }
3735
3826
  // Before render
3736
3827
  this.onBeforeRenderObservable.notifyObservers(this);
3737
- const engine = this.getEngine();
3738
- // Customs render targets
3739
- this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);
3740
- const currentActiveCamera = this.activeCameras?.length ? this.activeCameras[0] : this.activeCamera;
3741
- if (this.renderTargetsEnabled) {
3742
- Tools.StartPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0);
3743
- this._intermediateRendering = true;
3744
- for (let customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {
3745
- const renderTarget = this.customRenderTargets[customIndex];
3746
- if (renderTarget._shouldRender()) {
3747
- this._renderId++;
3748
- this.activeCamera = renderTarget.activeCamera || this.activeCamera;
3749
- if (!this.activeCamera) {
3750
- throw new Error("Active camera not set");
3828
+ // Custom render function?
3829
+ if (this.customRenderFunction) {
3830
+ this._renderId++;
3831
+ this._engine.currentRenderPassId = 0;
3832
+ this.customRenderFunction();
3833
+ }
3834
+ else {
3835
+ const engine = this.getEngine();
3836
+ // Customs render targets
3837
+ this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);
3838
+ const currentActiveCamera = this.activeCameras?.length ? this.activeCameras[0] : this.activeCamera;
3839
+ if (this.renderTargetsEnabled) {
3840
+ Tools.StartPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0);
3841
+ this._intermediateRendering = true;
3842
+ for (let customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {
3843
+ const renderTarget = this.customRenderTargets[customIndex];
3844
+ if (renderTarget._shouldRender()) {
3845
+ this._renderId++;
3846
+ this.activeCamera = renderTarget.activeCamera || this.activeCamera;
3847
+ if (!this.activeCamera) {
3848
+ throw new Error("Active camera not set");
3849
+ }
3850
+ // Viewport
3851
+ engine.setViewport(this.activeCamera.viewport);
3852
+ // Camera
3853
+ this.updateTransformMatrix();
3854
+ renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);
3751
3855
  }
3752
- // Viewport
3753
- engine.setViewport(this.activeCamera.viewport);
3754
- // Camera
3755
- this.updateTransformMatrix();
3756
- renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);
3757
3856
  }
3857
+ Tools.EndPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0);
3858
+ this._intermediateRendering = false;
3859
+ this._renderId++;
3758
3860
  }
3759
- Tools.EndPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0);
3760
- this._intermediateRendering = false;
3761
- this._renderId++;
3762
- }
3763
- this._engine.currentRenderPassId = currentActiveCamera?.renderPassId ?? 0;
3764
- // Restore back buffer
3765
- this.activeCamera = currentActiveCamera;
3766
- if (this._activeCamera && this._activeCamera.cameraRigMode !== 22 && !this.prePass) {
3767
- this._bindFrameBuffer(this._activeCamera, false);
3768
- }
3769
- this.onAfterRenderTargetsRenderObservable.notifyObservers(this);
3770
- for (const step of this._beforeClearStage) {
3771
- step.action();
3772
- }
3773
- // Clear
3774
- this._clearFrameBuffer(this.activeCamera);
3775
- // Collects render targets from external components.
3776
- for (const step of this._gatherRenderTargetsStage) {
3777
- step.action(this._renderTargets);
3778
- }
3779
- // Multi-cameras?
3780
- if (this.activeCameras && this.activeCameras.length > 0) {
3781
- for (let cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
3782
- this._processSubCameras(this.activeCameras[cameraIndex], cameraIndex > 0);
3861
+ this._engine.currentRenderPassId = currentActiveCamera?.renderPassId ?? 0;
3862
+ // Restore back buffer
3863
+ this.activeCamera = currentActiveCamera;
3864
+ if (this._activeCamera && this._activeCamera.cameraRigMode !== 22 && !this.prePass) {
3865
+ this._bindFrameBuffer(this._activeCamera, false);
3783
3866
  }
3784
- }
3785
- else {
3786
- if (!this.activeCamera) {
3787
- throw new Error("No camera defined");
3867
+ this.onAfterRenderTargetsRenderObservable.notifyObservers(this);
3868
+ for (const step of this._beforeClearStage) {
3869
+ step.action();
3870
+ }
3871
+ // Clear
3872
+ this._clearFrameBuffer(this.activeCamera);
3873
+ // Collects render targets from external components.
3874
+ for (const step of this._gatherRenderTargetsStage) {
3875
+ step.action(this._renderTargets);
3876
+ }
3877
+ // Multi-cameras?
3878
+ if (this.activeCameras && this.activeCameras.length > 0) {
3879
+ for (let cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
3880
+ this._processSubCameras(this.activeCameras[cameraIndex], cameraIndex > 0);
3881
+ }
3882
+ }
3883
+ else {
3884
+ if (!this.activeCamera) {
3885
+ throw new Error("No camera defined");
3886
+ }
3887
+ this._processSubCameras(this.activeCamera, !!this.activeCamera.outputRenderTarget);
3788
3888
  }
3789
- this._processSubCameras(this.activeCamera, !!this.activeCamera.outputRenderTarget);
3790
3889
  }
3791
3890
  // Intersection checks
3792
3891
  this._checkIntersections();