@babylonjs/core 7.26.5 → 7.27.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 (167) 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/material.d.ts +2 -2
  40. package/Materials/material.decalMapConfiguration.d.ts +1 -1
  41. package/Materials/material.decalMapConfiguration.js +1 -1
  42. package/Materials/material.decalMapConfiguration.js.map +1 -1
  43. package/Materials/material.js.map +1 -1
  44. package/Materials/shaderMaterial.d.ts +5 -0
  45. package/Materials/shaderMaterial.js +7 -0
  46. package/Materials/shaderMaterial.js.map +1 -1
  47. package/Maths/math.color.d.ts +20 -0
  48. package/Maths/math.color.js +41 -12
  49. package/Maths/math.color.js.map +1 -1
  50. package/Meshes/Builders/greasedLineBuilder.d.ts +16 -0
  51. package/Meshes/Builders/greasedLineBuilder.js +1 -1
  52. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  53. package/Meshes/Builders/groundBuilder.d.ts +1 -0
  54. package/Meshes/Builders/groundBuilder.js +2 -2
  55. package/Meshes/Builders/groundBuilder.js.map +1 -1
  56. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  57. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  58. package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
  59. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  60. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
  61. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  62. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +3 -0
  63. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +86 -1
  64. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  65. package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +4 -0
  66. package/Meshes/Node/Blocks/Sources/nullBlock.js +8 -0
  67. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +13 -0
  69. package/Meshes/Node/Blocks/Sources/planeBlock.js +41 -3
  70. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  71. package/Meshes/Node/Blocks/debugBlock.js +1 -1
  72. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  73. package/Meshes/Node/Blocks/geometryElbowBlock.js +1 -1
  74. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  75. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +4 -0
  76. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +47 -1
  77. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  78. package/Meshes/geometry.d.ts +2 -2
  79. package/Meshes/geometry.js.map +1 -1
  80. package/Meshes/meshUVSpaceRenderer.d.ts +3 -2
  81. package/Meshes/meshUVSpaceRenderer.js +15 -3
  82. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  83. package/Misc/greasedLineTools.d.ts +3 -1
  84. package/Misc/greasedLineTools.js +17 -2
  85. package/Misc/greasedLineTools.js.map +1 -1
  86. package/Misc/index.d.ts +2 -0
  87. package/Misc/index.js +2 -0
  88. package/Misc/index.js.map +1 -1
  89. package/Misc/screenshotTools.js +3 -2
  90. package/Misc/screenshotTools.js.map +1 -1
  91. package/Misc/textureTools.js +20 -4
  92. package/Misc/textureTools.js.map +1 -1
  93. package/Morph/morphTargetManager.d.ts +2 -2
  94. package/Morph/morphTargetManager.js.map +1 -1
  95. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +3 -1
  96. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +49 -10
  97. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  98. package/PostProcesses/postProcess.d.ts +2 -2
  99. package/PostProcesses/postProcess.js.map +1 -1
  100. package/Probes/reflectionProbe.d.ts +5 -5
  101. package/Probes/reflectionProbe.js +3 -3
  102. package/Probes/reflectionProbe.js.map +1 -1
  103. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +8 -2
  104. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  105. package/Rendering/fluidRenderer/fluidRenderer.d.ts +2 -2
  106. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  107. package/Rendering/geometryBufferRenderer.d.ts +30 -0
  108. package/Rendering/geometryBufferRenderer.js +100 -18
  109. package/Rendering/geometryBufferRenderer.js.map +1 -1
  110. package/Rendering/prePassRendererSceneComponent.d.ts +2 -2
  111. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  112. package/Rendering/screenSpaceReflections2Configuration.d.ts +4 -0
  113. package/Rendering/screenSpaceReflections2Configuration.js +6 -2
  114. package/Rendering/screenSpaceReflections2Configuration.js.map +1 -1
  115. package/Rendering/subSurfaceSceneComponent.d.ts +2 -2
  116. package/Rendering/subSurfaceSceneComponent.js.map +1 -1
  117. package/Shaders/ShadersInclude/screenSpaceRayTrace.js +28 -3
  118. package/Shaders/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
  119. package/Shaders/geometry.fragment.js +4 -5
  120. package/Shaders/geometry.fragment.js.map +1 -1
  121. package/Shaders/iblShadowVoxelTracing.fragment.js +12 -2
  122. package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
  123. package/Shaders/lod.fragment.js +2 -2
  124. package/Shaders/lod.fragment.js.map +1 -1
  125. package/Shaders/lodCube.fragment.js +2 -2
  126. package/Shaders/lodCube.fragment.js.map +1 -1
  127. package/Shaders/screenSpaceReflection2.fragment.js +7 -2
  128. package/Shaders/screenSpaceReflection2.fragment.js.map +1 -1
  129. package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js +8 -1
  130. package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -1
  131. package/Shaders/spriteMap.fragment.js +18 -6
  132. package/Shaders/spriteMap.fragment.js.map +1 -1
  133. package/Shaders/spriteMap.vertex.js +1 -1
  134. package/Shaders/spriteMap.vertex.js.map +1 -1
  135. package/ShadersWGSL/ShadersInclude/screenSpaceRayTrace.js +30 -4
  136. package/ShadersWGSL/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
  137. package/ShadersWGSL/geometry.fragment.js +6 -7
  138. package/ShadersWGSL/geometry.fragment.js.map +1 -1
  139. package/ShadersWGSL/lod.fragment.d.ts +5 -0
  140. package/ShadersWGSL/lod.fragment.js +11 -0
  141. package/ShadersWGSL/lod.fragment.js.map +1 -0
  142. package/ShadersWGSL/lodCube.fragment.d.ts +5 -0
  143. package/ShadersWGSL/lodCube.fragment.js +30 -0
  144. package/ShadersWGSL/lodCube.fragment.js.map +1 -0
  145. package/ShadersWGSL/screenSpaceReflection2.fragment.js +7 -2
  146. package/ShadersWGSL/screenSpaceReflection2.fragment.js.map +1 -1
  147. package/ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js +8 -1
  148. package/ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -1
  149. package/Sprites/spriteMap.d.ts +16 -0
  150. package/Sprites/spriteMap.js +17 -0
  151. package/Sprites/spriteMap.js.map +1 -1
  152. package/assetContainer.d.ts +143 -3
  153. package/assetContainer.js +129 -8
  154. package/assetContainer.js.map +1 -1
  155. package/index.d.ts +0 -1
  156. package/index.js +0 -1
  157. package/index.js.map +1 -1
  158. package/node.d.ts +2 -2
  159. package/node.js.map +1 -1
  160. package/package.json +1 -1
  161. package/scene.d.ts +99 -14
  162. package/scene.js +114 -23
  163. package/scene.js.map +1 -1
  164. package/sceneComponent.d.ts +3 -3
  165. package/sceneComponent.js.map +1 -1
  166. package/abstractScene.js +0 -117
  167. package/abstractScene.js.map +0 -1
@@ -15,12 +15,18 @@ import type { Light } from "./Lights/light";
15
15
  import type { Node } from "./node";
16
16
  import type { PostProcess } from "./PostProcesses/postProcess";
17
17
  import type { Animation } from "./Animations/animation";
18
+ import type { Sound } from "./Audio/sound";
19
+ import type { Layer } from "./Layers/layer";
20
+ import type { EffectLayer } from "./Layers/effectLayer";
21
+ import type { ReflectionProbe } from "./Probes/reflectionProbe";
22
+ import type { LensFlareSystem } from "./LensFlares/lensFlareSystem";
23
+ import type { ProceduralTexture } from "./Materials/Textures/Procedurals/proceduralTexture";
18
24
  /**
19
- * Base class of the scene acting as a container for the different elements composing a scene.
25
+ * Interface defining container for the different elements composing a scene.
20
26
  * This class is dynamically extended by the different components of the scene increasing
21
27
  * flexibility and reducing coupling
22
28
  */
23
- export declare abstract class AbstractScene {
29
+ export interface IAssetContainer {
24
30
  /**
25
31
  * Gets the list of root nodes (ie. nodes with no parent)
26
32
  */
@@ -96,19 +102,40 @@ export declare abstract class AbstractScene {
96
102
  * Textures to keep.
97
103
  */
98
104
  textures: BaseTexture[];
99
- /** @internal */
100
- protected _environmentTexture: Nullable<BaseTexture>;
101
105
  /**
102
106
  * Texture used in all pbr material as the reflection texture.
103
107
  * As in the majority of the scene they are the same (exception for multi room and so on),
104
108
  * this is easier to reference from here than from all the materials.
105
109
  */
106
- get environmentTexture(): Nullable<BaseTexture>;
107
- set environmentTexture(value: Nullable<BaseTexture>);
110
+ environmentTexture: Nullable<BaseTexture>;
108
111
  /**
109
112
  * The list of postprocesses added to the scene
110
113
  */
111
114
  postProcesses: PostProcess[];
115
+ /**
116
+ * The list of sound added to the scene
117
+ */
118
+ sounds: Nullable<Sound[]>;
119
+ /**
120
+ * The list of effect layers added to the scene
121
+ */
122
+ effectLayers: EffectLayer[];
123
+ /**
124
+ * The list of layers added to the scene
125
+ */
126
+ layers: Layer[];
127
+ /**
128
+ * The list of reflection probes added to the scene
129
+ */
130
+ reflectionProbes: ReflectionProbe[];
131
+ /**
132
+ * The list of lens flare system added to the scene
133
+ */
134
+ lensFlareSystems: LensFlareSystem[];
135
+ /**
136
+ * The list of procedural textures added to the scene
137
+ */
138
+ proceduralTextures: ProceduralTexture[];
112
139
  /**
113
140
  * @returns all meshes, lights, cameras, transformNodes and bones
114
141
  */
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAssetContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAssetContainer.js","sourceRoot":"","sources":["../../../dev/core/src/IAssetContainer.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"./types\";\r\nimport type { AbstractMesh } from \"./Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"./Meshes/transformNode\";\r\nimport type { Geometry } from \"./Meshes/geometry\";\r\nimport type { Skeleton } from \"./Bones/skeleton\";\r\nimport type { MorphTargetManager } from \"./Morph/morphTargetManager\";\r\nimport type { IParticleSystem } from \"./Particles/IParticleSystem\";\r\nimport type { AnimationGroup } from \"./Animations/animationGroup\";\r\nimport type { BaseTexture } from \"./Materials/Textures/baseTexture\";\r\nimport type { Material } from \"./Materials/material\";\r\nimport type { MultiMaterial } from \"./Materials/multiMaterial\";\r\nimport type { AbstractActionManager } from \"./Actions/abstractActionManager\";\r\nimport type { Camera } from \"./Cameras/camera\";\r\nimport type { Light } from \"./Lights/light\";\r\nimport type { Node } from \"./node\";\r\nimport type { PostProcess } from \"./PostProcesses/postProcess\";\r\nimport type { Animation } from \"./Animations/animation\";\r\nimport type { Sound } from \"./Audio/sound\";\r\nimport type { Layer } from \"./Layers/layer\";\r\nimport type { EffectLayer } from \"./Layers/effectLayer\";\r\nimport type { ReflectionProbe } from \"./Probes/reflectionProbe\";\r\nimport type { LensFlareSystem } from \"./LensFlares/lensFlareSystem\";\r\nimport type { ProceduralTexture } from \"./Materials/Textures/Procedurals/proceduralTexture\";\r\n/**\r\n * Interface defining container for the different elements composing a scene.\r\n * This class is dynamically extended by the different components of the scene increasing\r\n * flexibility and reducing coupling\r\n */\r\nexport interface IAssetContainer {\r\n /**\r\n * Gets the list of root nodes (ie. nodes with no parent)\r\n */\r\n rootNodes: Node[];\r\n\r\n /** All of the cameras added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\r\n */\r\n cameras: Camera[];\r\n\r\n /**\r\n * All of the lights added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\n lights: Light[];\r\n\r\n /**\r\n * All of the (abstract) meshes added to this scene\r\n */\r\n meshes: AbstractMesh[];\r\n\r\n /**\r\n * The list of skeletons added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\r\n */\r\n skeletons: Skeleton[];\r\n\r\n /**\r\n * All of the particle systems added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\r\n */\r\n particleSystems: IParticleSystem[];\r\n\r\n /**\r\n * Gets a list of Animations associated with the scene\r\n */\r\n animations: Animation[];\r\n\r\n /**\r\n * All of the animation groups added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\r\n */\r\n animationGroups: AnimationGroup[];\r\n\r\n /**\r\n * All of the multi-materials added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\r\n */\r\n multiMaterials: MultiMaterial[];\r\n\r\n /**\r\n * All of the materials added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\r\n * Note also that the order of the Material within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\r\n */\r\n materials: Material[];\r\n\r\n /**\r\n * The list of morph target managers added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\r\n */\r\n morphTargetManagers: MorphTargetManager[];\r\n\r\n /**\r\n * The list of geometries used in the scene.\r\n */\r\n geometries: Geometry[];\r\n\r\n /**\r\n * All of the transform nodes added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\r\n * Note also that the order of the TransformNode within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\r\n */\r\n transformNodes: TransformNode[];\r\n\r\n /**\r\n * ActionManagers available on the scene.\r\n * @deprecated\r\n */\r\n actionManagers: AbstractActionManager[];\r\n\r\n /**\r\n * Textures to keep.\r\n */\r\n textures: BaseTexture[];\r\n\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n environmentTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * The list of postprocesses added to the scene\r\n */\r\n postProcesses: PostProcess[];\r\n\r\n /**\r\n * The list of sound added to the scene\r\n */\r\n sounds: Nullable<Sound[]>;\r\n\r\n /**\r\n * The list of effect layers added to the scene\r\n */\r\n effectLayers: EffectLayer[];\r\n\r\n /**\r\n * The list of layers added to the scene\r\n */\r\n layers: Layer[];\r\n\r\n /**\r\n * The list of reflection probes added to the scene\r\n */\r\n reflectionProbes: ReflectionProbe[];\r\n\r\n /**\r\n * The list of lens flare system added to the scene\r\n */\r\n lensFlareSystems: LensFlareSystem[];\r\n\r\n /**\r\n * The list of procedural textures added to the scene\r\n */\r\n proceduralTextures: ProceduralTexture[];\r\n\r\n /**\r\n * @returns all meshes, lights, cameras, transformNodes and bones\r\n */\r\n getNodes(): Array<Node>;\r\n}\r\n"]}
@@ -1,9 +1,9 @@
1
- import type { Scene } from "../scene";
1
+ import { Scene } from "../scene";
2
2
  import type { ISceneSerializableComponent } from "../sceneComponent";
3
3
  import { EffectLayer } from "./effectLayer";
4
- import { AbstractScene } from "../abstractScene";
5
- declare module "../abstractScene" {
6
- interface AbstractScene {
4
+ import type { IAssetContainer } from "../IAssetContainer.js";
5
+ declare module "../scene" {
6
+ interface Scene {
7
7
  /**
8
8
  * The list of effect layers (highlights/glow) added to the scene
9
9
  * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer
@@ -63,13 +63,13 @@ export declare class EffectLayerSceneComponent implements ISceneSerializableComp
63
63
  * Adds all the elements from the container to the scene
64
64
  * @param container the container holding the elements
65
65
  */
66
- addFromContainer(container: AbstractScene): void;
66
+ addFromContainer(container: IAssetContainer): void;
67
67
  /**
68
68
  * Removes all the elements in the container from the scene
69
69
  * @param container contains the elements to remove
70
70
  * @param dispose if the removed element should be disposed (default: false)
71
71
  */
72
- removeFromContainer(container: AbstractScene, dispose?: boolean): void;
72
+ removeFromContainer(container: IAssetContainer, dispose?: boolean): void;
73
73
  /**
74
74
  * Disposes the component and the associated resources.
75
75
  */
@@ -1,7 +1,7 @@
1
1
  import { Camera } from "../Cameras/camera.js";
2
+ import { Scene } from "../scene.js";
2
3
  import { SceneComponentConstants } from "../sceneComponent.js";
3
4
  import { EffectLayer } from "./effectLayer.js";
4
- import { AbstractScene } from "../abstractScene.js";
5
5
  import { EngineStore } from "../Engines/engineStore.js";
6
6
  import { AddParser } from "../Loading/Plugins/babylonFileParser.function.js";
7
7
  // Adds the parser to the scene parsers.
@@ -16,14 +16,14 @@ AddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData, scene, containe
16
16
  }
17
17
  }
18
18
  });
19
- AbstractScene.prototype.removeEffectLayer = function (toRemove) {
19
+ Scene.prototype.removeEffectLayer = function (toRemove) {
20
20
  const index = this.effectLayers.indexOf(toRemove);
21
21
  if (index !== -1) {
22
22
  this.effectLayers.splice(index, 1);
23
23
  }
24
24
  return index;
25
25
  };
26
- AbstractScene.prototype.addEffectLayer = function (newEffectLayer) {
26
+ Scene.prototype.addEffectLayer = function (newEffectLayer) {
27
27
  this.effectLayers.push(newEffectLayer);
28
28
  };
29
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"effectLayerSceneComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/effectLayerSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA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wB;QAClC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAEnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;YACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC9B,IAAI,WAAW,CAAC,gBAAgB,KAAK,gBAAgB,EAAE;oBACnD,IAAI,WAAW,CAAC,YAAY,EAAE,EAAE;wBAC5B,WAAW,CAAC,MAAM,EAAE,CAAC;qBACxB;iBACJ;aACJ;YACD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;SACrC;IACL,CAAC;IAEO,WAAW;QACf,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAClB;IACL,CAAC;IACO,mBAAmB,CAAC,KAAa;QACrC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,0BAA0B,EAAE,IAAI,IAAI,CAAC,cAAc,EAAE;YACjE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACrB;IACL,CAAC;CACJ;AAED,WAAW,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IACzD,IAAI,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,gBAAgB,CAA8B,CAAC;IAC3G,IAAI,CAAC,SAAS,EAAE;QACZ,SAAS,GAAG,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC;QACjD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { ISceneSerializableComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { AddParser } from \"core/Loading/Plugins/babylonFileParser.function\";\r\n\r\n// Adds the parser to the scene parsers.\r\nAddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n if (parsedData.effectLayers) {\r\n if (!container.effectLayers) {\r\n container.effectLayers = [] as EffectLayer[];\r\n }\r\n\r\n for (let index = 0; index < parsedData.effectLayers.length; index++) {\r\n const effectLayer = EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);\r\n container.effectLayers.push(effectLayer);\r\n }\r\n }\r\n});\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * The list of effect layers (highlights/glow) added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\n effectLayers: Array<EffectLayer>;\r\n\r\n /**\r\n * Removes the given effect layer from this scene.\r\n * @param toRemove defines the effect layer to remove\r\n * @returns the index of the removed effect layer\r\n */\r\n removeEffectLayer(toRemove: EffectLayer): number;\r\n\r\n /**\r\n * Adds the given effect layer to this scene\r\n * @param newEffectLayer defines the effect layer to add\r\n */\r\n addEffectLayer(newEffectLayer: EffectLayer): void;\r\n }\r\n}\r\n\r\nAbstractScene.prototype.removeEffectLayer = function (toRemove: EffectLayer): number {\r\n const index = this.effectLayers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.effectLayers.splice(index, 1);\r\n }\r\n\r\n return index;\r\n};\r\n\r\nAbstractScene.prototype.addEffectLayer = function (newEffectLayer: EffectLayer): void {\r\n this.effectLayers.push(newEffectLayer);\r\n};\r\n\r\n/**\r\n * Defines the layer scene component responsible to manage any effect layers\r\n * in a given scene.\r\n */\r\nexport class EffectLayerSceneComponent implements ISceneSerializableComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_EFFECTLAYER;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n private _engine: AbstractEngine;\r\n private _renderEffects = false;\r\n private _needStencil = false;\r\n private _previousStencilState = false;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene?: Scene) {\r\n this.scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this.scene) {\r\n return;\r\n }\r\n this._engine = this.scene.getEngine();\r\n this.scene.effectLayers = [] as EffectLayer[];\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._isReadyForMeshStage.registerStep(SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh);\r\n\r\n this.scene._cameraDrawRenderTargetStage.registerStep(SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture);\r\n\r\n this.scene._beforeCameraDrawStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil);\r\n\r\n this.scene._afterRenderingGroupDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup);\r\n\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack);\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n const layers = this.scene.effectLayers;\r\n for (const effectLayer of layers) {\r\n effectLayer._rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n // Effect layers\r\n serializationObject.effectLayers = [];\r\n\r\n const layers = this.scene.effectLayers;\r\n for (const effectLayer of layers) {\r\n if (effectLayer.serialize) {\r\n serializationObject.effectLayers.push(effectLayer.serialize());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n public addFromContainer(container: AbstractScene): void {\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach((o) => {\r\n this.scene.addEffectLayer(o);\r\n });\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n public removeFromContainer(container: AbstractScene, dispose?: boolean): void {\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach((o) => {\r\n this.scene.removeEffectLayer(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n const layers = this.scene.effectLayers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n }\r\n\r\n private _isReadyForMesh(mesh: AbstractMesh, hardwareInstancedRendering: boolean): boolean {\r\n const currentRenderPassId = this._engine.currentRenderPassId;\r\n const layers = this.scene.effectLayers;\r\n for (const layer of layers) {\r\n if (!layer.hasMesh(mesh)) {\r\n continue;\r\n }\r\n\r\n const renderTarget = <RenderTargetTexture>(<any>layer)._mainTexture;\r\n this._engine.currentRenderPassId = renderTarget.renderPassId;\r\n\r\n for (const subMesh of mesh.subMeshes) {\r\n if (!layer.isReady(subMesh, hardwareInstancedRendering)) {\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n return false;\r\n }\r\n }\r\n }\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n return true;\r\n }\r\n\r\n private _renderMainTexture(camera: Camera): boolean {\r\n this._renderEffects = false;\r\n this._needStencil = false;\r\n\r\n let needRebind = false;\r\n\r\n const layers = this.scene.effectLayers;\r\n if (layers && layers.length > 0) {\r\n this._previousStencilState = this._engine.getStencilBuffer();\r\n for (const effectLayer of layers) {\r\n if (\r\n effectLayer.shouldRender() &&\r\n (!effectLayer.camera ||\r\n (effectLayer.camera.cameraRigMode === Camera.RIG_MODE_NONE && camera === effectLayer.camera) ||\r\n (effectLayer.camera.cameraRigMode !== Camera.RIG_MODE_NONE && effectLayer.camera._rigCameras.indexOf(camera) > -1))\r\n ) {\r\n this._renderEffects = true;\r\n this._needStencil = this._needStencil || effectLayer.needStencil();\r\n\r\n const renderTarget = <RenderTargetTexture>(<any>effectLayer)._mainTexture;\r\n if (renderTarget._shouldRender()) {\r\n this.scene.incrementRenderId();\r\n renderTarget.render(false, false);\r\n needRebind = true;\r\n }\r\n }\r\n }\r\n\r\n this.scene.incrementRenderId();\r\n }\r\n\r\n return needRebind;\r\n }\r\n\r\n private _setStencil() {\r\n // Activate effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(true);\r\n }\r\n }\r\n\r\n private _setStencilBack() {\r\n // Restore effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(this._previousStencilState);\r\n }\r\n }\r\n\r\n private _draw(renderingGroupId: number): void {\r\n if (this._renderEffects) {\r\n this._engine.setDepthBuffer(false);\r\n\r\n const layers = this.scene.effectLayers;\r\n for (let i = 0; i < layers.length; i++) {\r\n const effectLayer = layers[i];\r\n if (effectLayer.renderingGroupId === renderingGroupId) {\r\n if (effectLayer.shouldRender()) {\r\n effectLayer.render();\r\n }\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n }\r\n\r\n private _drawCamera(): void {\r\n if (this._renderEffects) {\r\n this._draw(-1);\r\n }\r\n }\r\n private _drawRenderingGroup(index: number): void {\r\n if (!this.scene._isInIntermediateRendering() && this._renderEffects) {\r\n this._draw(index);\r\n }\r\n }\r\n}\r\n\r\nEffectLayer._SceneComponentInitialization = (scene: Scene) => {\r\n let component = scene._getComponent(SceneComponentConstants.NAME_EFFECTLAYER) as EffectLayerSceneComponent;\r\n if (!component) {\r\n component = new EffectLayerSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n"]}
1
+ {"version":3,"file":"effectLayerSceneComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/effectLayerSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,yDAAwD;AAG5E,wCAAwC;AACxC,SAAS,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,CAAC,UAAe,EAAE,KAAY,EAAE,SAAyB,EAAE,OAAe,EAAE,EAAE;IAC9H,IAAI,UAAU,CAAC,YAAY,EAAE;QACzB,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE;YACzB,SAAS,CAAC,YAAY,GAAG,EAAmB,CAAC;SAChD;QAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACjE,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,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B,CAAC,KAAa;QACrC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,0BAA0B,EAAE,IAAI,IAAI,CAAC,cAAc,EAAE;YACjE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACrB;IACL,CAAC;CACJ;AAED,WAAW,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IACzD,IAAI,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,gBAAgB,CAA8B,CAAC;IAC3G,IAAI,CAAC,SAAS,EAAE;QACZ,SAAS,GAAG,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC;QACjD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import { Camera } from \"../Cameras/camera\";\r\nimport { Scene } from \"../scene\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { ISceneSerializableComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { AddParser } from \"core/Loading/Plugins/babylonFileParser.function\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\n\r\n// Adds the parser to the scene parsers.\r\nAddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n if (parsedData.effectLayers) {\r\n if (!container.effectLayers) {\r\n container.effectLayers = [] as EffectLayer[];\r\n }\r\n\r\n for (let index = 0; index < parsedData.effectLayers.length; index++) {\r\n const effectLayer = EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);\r\n container.effectLayers.push(effectLayer);\r\n }\r\n }\r\n});\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /**\r\n * The list of effect layers (highlights/glow) added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\n effectLayers: Array<EffectLayer>;\r\n\r\n /**\r\n * Removes the given effect layer from this scene.\r\n * @param toRemove defines the effect layer to remove\r\n * @returns the index of the removed effect layer\r\n */\r\n removeEffectLayer(toRemove: EffectLayer): number;\r\n\r\n /**\r\n * Adds the given effect layer to this scene\r\n * @param newEffectLayer defines the effect layer to add\r\n */\r\n addEffectLayer(newEffectLayer: EffectLayer): void;\r\n }\r\n}\r\n\r\nScene.prototype.removeEffectLayer = function (toRemove: EffectLayer): number {\r\n const index = this.effectLayers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.effectLayers.splice(index, 1);\r\n }\r\n\r\n return index;\r\n};\r\n\r\nScene.prototype.addEffectLayer = function (newEffectLayer: EffectLayer): void {\r\n this.effectLayers.push(newEffectLayer);\r\n};\r\n\r\n/**\r\n * Defines the layer scene component responsible to manage any effect layers\r\n * in a given scene.\r\n */\r\nexport class EffectLayerSceneComponent implements ISceneSerializableComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_EFFECTLAYER;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n private _engine: AbstractEngine;\r\n private _renderEffects = false;\r\n private _needStencil = false;\r\n private _previousStencilState = false;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene?: Scene) {\r\n this.scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this.scene) {\r\n return;\r\n }\r\n this._engine = this.scene.getEngine();\r\n this.scene.effectLayers = [] as EffectLayer[];\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._isReadyForMeshStage.registerStep(SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh);\r\n\r\n this.scene._cameraDrawRenderTargetStage.registerStep(SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture);\r\n\r\n this.scene._beforeCameraDrawStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil);\r\n\r\n this.scene._afterRenderingGroupDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup);\r\n\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack);\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n const layers = this.scene.effectLayers;\r\n for (const effectLayer of layers) {\r\n effectLayer._rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n // Effect layers\r\n serializationObject.effectLayers = [];\r\n\r\n const layers = this.scene.effectLayers;\r\n for (const effectLayer of layers) {\r\n if (effectLayer.serialize) {\r\n serializationObject.effectLayers.push(effectLayer.serialize());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n public addFromContainer(container: IAssetContainer): void {\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach((o) => {\r\n this.scene.addEffectLayer(o);\r\n });\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n public removeFromContainer(container: IAssetContainer, dispose?: boolean): void {\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach((o) => {\r\n this.scene.removeEffectLayer(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n const layers = this.scene.effectLayers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n }\r\n\r\n private _isReadyForMesh(mesh: AbstractMesh, hardwareInstancedRendering: boolean): boolean {\r\n const currentRenderPassId = this._engine.currentRenderPassId;\r\n const layers = this.scene.effectLayers;\r\n for (const layer of layers) {\r\n if (!layer.hasMesh(mesh)) {\r\n continue;\r\n }\r\n\r\n const renderTarget = <RenderTargetTexture>(<any>layer)._mainTexture;\r\n this._engine.currentRenderPassId = renderTarget.renderPassId;\r\n\r\n for (const subMesh of mesh.subMeshes) {\r\n if (!layer.isReady(subMesh, hardwareInstancedRendering)) {\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n return false;\r\n }\r\n }\r\n }\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n return true;\r\n }\r\n\r\n private _renderMainTexture(camera: Camera): boolean {\r\n this._renderEffects = false;\r\n this._needStencil = false;\r\n\r\n let needRebind = false;\r\n\r\n const layers = this.scene.effectLayers;\r\n if (layers && layers.length > 0) {\r\n this._previousStencilState = this._engine.getStencilBuffer();\r\n for (const effectLayer of layers) {\r\n if (\r\n effectLayer.shouldRender() &&\r\n (!effectLayer.camera ||\r\n (effectLayer.camera.cameraRigMode === Camera.RIG_MODE_NONE && camera === effectLayer.camera) ||\r\n (effectLayer.camera.cameraRigMode !== Camera.RIG_MODE_NONE && effectLayer.camera._rigCameras.indexOf(camera) > -1))\r\n ) {\r\n this._renderEffects = true;\r\n this._needStencil = this._needStencil || effectLayer.needStencil();\r\n\r\n const renderTarget = <RenderTargetTexture>(<any>effectLayer)._mainTexture;\r\n if (renderTarget._shouldRender()) {\r\n this.scene.incrementRenderId();\r\n renderTarget.render(false, false);\r\n needRebind = true;\r\n }\r\n }\r\n }\r\n\r\n this.scene.incrementRenderId();\r\n }\r\n\r\n return needRebind;\r\n }\r\n\r\n private _setStencil() {\r\n // Activate effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(true);\r\n }\r\n }\r\n\r\n private _setStencilBack() {\r\n // Restore effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(this._previousStencilState);\r\n }\r\n }\r\n\r\n private _draw(renderingGroupId: number): void {\r\n if (this._renderEffects) {\r\n this._engine.setDepthBuffer(false);\r\n\r\n const layers = this.scene.effectLayers;\r\n for (let i = 0; i < layers.length; i++) {\r\n const effectLayer = layers[i];\r\n if (effectLayer.renderingGroupId === renderingGroupId) {\r\n if (effectLayer.shouldRender()) {\r\n effectLayer.render();\r\n }\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n }\r\n\r\n private _drawCamera(): void {\r\n if (this._renderEffects) {\r\n this._draw(-1);\r\n }\r\n }\r\n private _drawRenderingGroup(index: number): void {\r\n if (!this.scene._isInIntermediateRendering() && this._renderEffects) {\r\n this._draw(index);\r\n }\r\n }\r\n}\r\n\r\nEffectLayer._SceneComponentInitialization = (scene: Scene) => {\r\n let component = scene._getComponent(SceneComponentConstants.NAME_EFFECTLAYER) as EffectLayerSceneComponent;\r\n if (!component) {\r\n component = new EffectLayerSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { Nullable } from "../types";
2
2
  import type { Camera } from "../Cameras/camera";
3
- import type { Scene } from "../scene";
3
+ import { Scene } from "../scene";
4
4
  import type { SubMesh } from "../Meshes/subMesh";
5
5
  import type { AbstractMesh } from "../Meshes/abstractMesh";
6
6
  import type { Mesh } from "../Meshes/mesh";
@@ -10,8 +10,8 @@ import { Material } from "../Materials/material";
10
10
  import { EffectLayer } from "./effectLayer";
11
11
  import { Color4 } from "../Maths/math.color";
12
12
  import "../Layers/effectLayerSceneComponent";
13
- declare module "../abstractScene" {
14
- interface AbstractScene {
13
+ declare module "../scene" {
14
+ interface Scene {
15
15
  /**
16
16
  * Return the first glow layer of the scene with a given name.
17
17
  * @param name The name of the glow layer to look for.
@@ -1,6 +1,7 @@
1
1
  import { __decorate } from "../tslib.es6.js";
2
2
  /* eslint-disable @typescript-eslint/no-unused-vars */
3
3
  import { serialize } from "../Misc/decorators.js";
4
+ import { Scene } from "../scene.js";
4
5
  import { Vector2 } from "../Maths/math.vector.js";
5
6
  import { VertexBuffer } from "../Buffers/buffer.js";
6
7
  import { Texture } from "../Materials/Textures/texture.js";
@@ -8,14 +9,13 @@ import { RenderTargetTexture } from "../Materials/Textures/renderTargetTexture.j
8
9
  import { Material } from "../Materials/material.js";
9
10
  import { BlurPostProcess } from "../PostProcesses/blurPostProcess.js";
10
11
  import { EffectLayer } from "./effectLayer.js";
11
- import { AbstractScene } from "../abstractScene.js";
12
12
 
13
13
  import { RegisterClass } from "../Misc/typeStore.js";
14
14
  import { Color4 } from "../Maths/math.color.js";
15
15
  import "../Layers/effectLayerSceneComponent.js";
16
16
  import { SerializationHelper } from "../Misc/decorators.serialization.js";
17
17
  import { GetExponentOfTwo } from "../Misc/tools.functions.js";
18
- AbstractScene.prototype.getGlowLayerByName = function (name) {
18
+ Scene.prototype.getGlowLayerByName = function (name) {
19
19
  for (let index = 0; index < this.effectLayers?.length; index++) {
20
20
  if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {
21
21
  return this.effectLayers[index];
@@ -1 +1 @@
1
- {"version":3,"file":"glowLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/glowLayer.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,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,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACjJ,IAAI,KAAK,CAAC;QAEV,kBAAkB;QAClB,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACpE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,IAAI,IAAI,EAAE;gBACN,EAAE,CAAC,eAAe,CAAO,IAAI,CAAC,CAAC;aAClC;SACJ;QAED,kBAAkB;QAClB,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACpE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,IAAI,IAAI,EAAE;gBACN,EAAE,CAAC,mBAAmB,CAAO,IAAI,CAAC,CAAC;aACtC;SACJ;QAED,OAAO,EAAE,CAAC;IACd,CAAC;;AA3nBD;;GAEG;AACoB,oBAAU,GAAG,WAAW,AAAd,CAAe;AAEhD;;GAEG;AACW,+BAAqB,GAAG,EAAE,AAAL,CAAM;AAEzC;;GAEG;AACW,6BAAmB,GAAG,GAAG,AAAN,CAAO;AAuBxC;IADC,SAAS,EAAE;+CAGX;AAaD;IADC,SAAS,EAAE;0CAGX;AAGO;IADP,SAAS,CAAC,SAAS,CAAC;2CACe;AAskBxC,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Material } from \"../Materials/material\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { PBRMaterial } from \"../Materials/PBR/pbrMaterial\";\r\n\r\nimport \"../Layers/effectLayerSceneComponent\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * Return the first glow layer of the scene with a given name.\r\n * @param name The name of the glow layer to look for.\r\n * @returns The glow layer if found otherwise null.\r\n */\r\n getGlowLayerByName(name: string): Nullable<GlowLayer>;\r\n }\r\n}\r\n\r\nAbstractScene.prototype.getGlowLayerByName = function (name: string): Nullable<GlowLayer> {\r\n for (let index = 0; index < this.effectLayers?.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {\r\n return (<any>this.effectLayers[index]) as GlowLayer;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Glow layer options. This helps customizing the behaviour\r\n * of the glow layer.\r\n */\r\nexport interface IGlowLayerOptions {\r\n /**\r\n * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the glowing objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure resize independent blur. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * How big is the kernel of the blur texture. Default: 32\r\n */\r\n blurKernelSize: number;\r\n\r\n /**\r\n * The camera attached to the layer. Default: null\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * Enable MSAA by choosing the number of samples. Default: 1\r\n */\r\n mainTextureSamples?: number;\r\n\r\n /**\r\n * The rendering group to draw the layer in. Default: -1\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * Forces the merge step to be done in ldr (clamp values > 1). Default: false\r\n */\r\n ldrMerge?: boolean;\r\n\r\n /**\r\n * Defines the blend mode used by the merge. Default: ALPHA_ADD\r\n */\r\n alphaBlendingMode?: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_INT\r\n */\r\n mainTextureType: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer: boolean;\r\n}\r\n\r\n/**\r\n * The glow layer Helps adding a glow effect around the emissive parts of a mesh.\r\n *\r\n * Once instantiated in a scene, by default, all the emissive meshes will glow.\r\n *\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\nexport class GlowLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the layer.\r\n */\r\n public static readonly EffectName = \"GlowLayer\";\r\n\r\n /**\r\n * The default blur kernel size used for the glow.\r\n */\r\n public static DefaultBlurKernelSize = 32;\r\n\r\n /**\r\n * The default texture size ratio used for the glow.\r\n */\r\n public static DefaultTextureRatio = 0.5;\r\n\r\n /**\r\n * Sets the kernel size of the blur.\r\n */\r\n public set blurKernelSize(value: number) {\r\n if (value === this._options.blurKernelSize) {\r\n return;\r\n }\r\n\r\n this._options.blurKernelSize = value;\r\n\r\n const effectiveKernel = this._getEffectiveBlurKernelSize();\r\n this._horizontalBlurPostprocess1.kernel = effectiveKernel;\r\n this._verticalBlurPostprocess1.kernel = effectiveKernel;\r\n this._horizontalBlurPostprocess2.kernel = effectiveKernel;\r\n this._verticalBlurPostprocess2.kernel = effectiveKernel;\r\n }\r\n\r\n /**\r\n * Gets the kernel size of the blur.\r\n */\r\n @serialize()\r\n public get blurKernelSize(): number {\r\n return this._options.blurKernelSize;\r\n }\r\n\r\n /**\r\n * Sets the glow intensity.\r\n */\r\n public set intensity(value: number) {\r\n this._intensity = value;\r\n }\r\n\r\n /**\r\n * Gets the glow intensity.\r\n */\r\n @serialize()\r\n public get intensity(): number {\r\n return this._intensity;\r\n }\r\n\r\n @serialize(\"options\")\r\n private _options: IGlowLayerOptions;\r\n\r\n private _intensity: number = 1.0;\r\n private _horizontalBlurPostprocess1: BlurPostProcess;\r\n private _verticalBlurPostprocess1: BlurPostProcess;\r\n private _horizontalBlurPostprocess2: BlurPostProcess;\r\n private _verticalBlurPostprocess2: BlurPostProcess;\r\n private _blurTexture1: RenderTargetTexture;\r\n private _blurTexture2: RenderTargetTexture;\r\n private _postProcesses1: PostProcess[];\r\n private _postProcesses2: PostProcess[];\r\n\r\n private _includedOnlyMeshes: number[] = [];\r\n private _excludedMeshes: number[] = [];\r\n private _meshesUsingTheirOwnMaterials: number[] = [];\r\n\r\n /**\r\n * Callback used to let the user override the color selection on a per mesh basis\r\n */\r\n public customEmissiveColorSelector: (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void;\r\n /**\r\n * Callback used to let the user override the texture selection on a per mesh basis\r\n */\r\n public customEmissiveTextureSelector: (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture;\r\n\r\n /**\r\n * Instantiates a new glow Layer and references it to the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param options Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)\r\n */\r\n constructor(name: string, scene?: Scene, options?: Partial<IGlowLayerOptions>) {\r\n super(name, scene);\r\n this.neutralColor = new Color4(0, 0, 0, 1);\r\n\r\n // Adapt options\r\n this._options = {\r\n mainTextureRatio: GlowLayer.DefaultTextureRatio,\r\n blurKernelSize: 32,\r\n mainTextureFixedSize: undefined,\r\n camera: null,\r\n mainTextureSamples: 1,\r\n renderingGroupId: -1,\r\n ldrMerge: false,\r\n alphaBlendingMode: Constants.ALPHA_ADD,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_INT,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init({\r\n alphaBlendingMode: this._options.alphaBlendingMode,\r\n camera: this._options.camera,\r\n mainTextureFixedSize: this._options.mainTextureFixedSize,\r\n mainTextureRatio: this._options.mainTextureRatio,\r\n renderingGroupId: this._options.renderingGroupId,\r\n mainTextureType: this._options.mainTextureType,\r\n generateStencilBuffer: this._options.generateStencilBuffer,\r\n });\r\n }\r\n\r\n protected override async _importShadersAsync() {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([\r\n import(\"../ShadersWGSL/glowMapMerge.fragment\"),\r\n import(\"../ShadersWGSL/glowMapMerge.vertex\"),\r\n import(\"../ShadersWGSL/glowBlurPostProcess.fragment\"),\r\n ]);\r\n } else {\r\n await Promise.all([import(\"../Shaders/glowMapMerge.fragment\"), import(\"../Shaders/glowMapMerge.vertex\"), import(\"../Shaders/glowBlurPostProcess.fragment\")]);\r\n }\r\n\r\n await super._importShadersAsync();\r\n }\r\n\r\n /**\r\n * Get the effect name of the layer.\r\n * @returns The effect name\r\n */\r\n public getEffectName(): string {\r\n return GlowLayer.EffectName;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n */\r\n protected _createMergeEffect(): Effect {\r\n let defines = \"#define EMISSIVE \\n\";\r\n if (this._options.ldrMerge) {\r\n defines += \"#define LDR \\n\";\r\n }\r\n\r\n // Effect\r\n return this._engine.createEffect(\r\n \"glowMapMerge\",\r\n [VertexBuffer.PositionKind],\r\n [\"offset\"],\r\n [\"textureSampler\", \"textureSampler2\"],\r\n defines,\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this.shaderLanguage,\r\n this._shadersLoaded\r\n ? undefined\r\n : async () => {\r\n await this._importShadersAsync();\r\n this._shadersLoaded = true;\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the glow layer.\r\n */\r\n protected _createTextureAndPostProcesses(): void {\r\n let blurTextureWidth = this._mainTextureDesiredSize.width;\r\n let blurTextureHeight = this._mainTextureDesiredSize.height;\r\n blurTextureWidth = this._engine.needPOTTextures ? GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\r\n blurTextureHeight = this._engine.needPOTTextures ? GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\r\n\r\n let textureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else {\r\n textureType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n this._blurTexture1 = new RenderTargetTexture(\r\n \"GlowLayerBlurRTT\",\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n this._scene,\r\n false,\r\n true,\r\n textureType\r\n );\r\n this._blurTexture1.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture1.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture1.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._blurTexture1.renderParticles = false;\r\n this._blurTexture1.ignoreCameraViewport = true;\r\n\r\n const blurTextureWidth2 = Math.floor(blurTextureWidth / 2);\r\n const blurTextureHeight2 = Math.floor(blurTextureHeight / 2);\r\n\r\n this._blurTexture2 = new RenderTargetTexture(\r\n \"GlowLayerBlurRTT2\",\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n this._scene,\r\n false,\r\n true,\r\n textureType\r\n );\r\n this._blurTexture2.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture2.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture2.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._blurTexture2.renderParticles = false;\r\n this._blurTexture2.ignoreCameraViewport = true;\r\n\r\n this._textures = [this._blurTexture1, this._blurTexture2];\r\n\r\n const effectiveKernel = this._getEffectiveBlurKernelSize();\r\n this._horizontalBlurPostprocess1 = new BlurPostProcess(\r\n \"GlowLayerHBP1\",\r\n new Vector2(1.0, 0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n this._horizontalBlurPostprocess1.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess1.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess1.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess1.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._mainTexture);\r\n });\r\n\r\n this._verticalBlurPostprocess1 = new BlurPostProcess(\r\n \"GlowLayerVBP1\",\r\n new Vector2(0, 1.0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n\r\n this._horizontalBlurPostprocess2 = new BlurPostProcess(\r\n \"GlowLayerHBP2\",\r\n new Vector2(1.0, 0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n this._horizontalBlurPostprocess2.width = blurTextureWidth2;\r\n this._horizontalBlurPostprocess2.height = blurTextureHeight2;\r\n this._horizontalBlurPostprocess2.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess2.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n });\r\n\r\n this._verticalBlurPostprocess2 = new BlurPostProcess(\r\n \"GlowLayerVBP2\",\r\n new Vector2(0, 1.0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n\r\n this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1];\r\n this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n\r\n this._mainTexture.samples = this._options.mainTextureSamples!;\r\n this._mainTexture.onAfterUnbindObservable.add(() => {\r\n const internalTexture = this._blurTexture1.renderTarget;\r\n if (internalTexture) {\r\n this._scene.postProcessManager.directRender(this._postProcesses1, internalTexture, true);\r\n\r\n const internalTexture2 = this._blurTexture2.renderTarget;\r\n if (internalTexture2) {\r\n this._scene.postProcessManager.directRender(this._postProcesses2, internalTexture2, true);\r\n }\r\n this._engine.unBindFramebuffer(internalTexture2 ?? internalTexture, true);\r\n }\r\n });\r\n\r\n // Prevent autoClear.\r\n this._postProcesses.map((pp) => {\r\n pp.autoClear = false;\r\n });\r\n }\r\n\r\n /**\r\n * @returns The blur kernel size used by the glow.\r\n * Note: The value passed in the options is divided by 2 for back compatibility.\r\n */\r\n private _getEffectiveBlurKernelSize() {\r\n return this._options.blurKernelSize / 2;\r\n }\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @returns true if ready otherwise, false\r\n */\r\n public isReady(subMesh: SubMesh, useInstances: boolean): boolean {\r\n const material = subMesh.getMaterial();\r\n const mesh = subMesh.getRenderingMesh();\r\n\r\n if (!material || !mesh) {\r\n return false;\r\n }\r\n\r\n const emissiveTexture = (<any>material).emissiveTexture;\r\n return super._isReady(subMesh, useInstances, emissiveTexture);\r\n }\r\n\r\n /**\r\n * @returns whether or not the layer needs stencil enabled during the mesh rendering.\r\n */\r\n public needStencil(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n protected override _canRenderMesh(mesh: AbstractMesh, material: Material): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n */\r\n protected _internalRender(effect: Effect): void {\r\n // Texture\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n effect.setTexture(\"textureSampler2\", this._blurTexture2);\r\n effect.setFloat(\"offset\", this._intensity);\r\n\r\n // Cache\r\n const engine = this._engine;\r\n const previousStencilBuffer = engine.getStencilBuffer();\r\n\r\n // Draw order\r\n engine.setStencilBuffer(false);\r\n\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n\r\n // Draw order\r\n engine.setStencilBuffer(previousStencilBuffer);\r\n }\r\n\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n * @param mesh\r\n * @param subMesh\r\n * @param material\r\n */\r\n protected _setEmissiveTextureAndColor(mesh: Mesh, subMesh: SubMesh, material: Material): void {\r\n let textureLevel = 1.0;\r\n\r\n if (this.customEmissiveTextureSelector) {\r\n this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(mesh, subMesh, material);\r\n } else {\r\n if (material) {\r\n this._emissiveTextureAndColor.texture = (<any>material).emissiveTexture;\r\n if (this._emissiveTextureAndColor.texture) {\r\n textureLevel = this._emissiveTextureAndColor.texture.level;\r\n }\r\n } else {\r\n this._emissiveTextureAndColor.texture = null;\r\n }\r\n }\r\n\r\n if (this.customEmissiveColorSelector) {\r\n this.customEmissiveColorSelector(mesh, subMesh, material, this._emissiveTextureAndColor.color);\r\n } else {\r\n if ((<any>material).emissiveColor) {\r\n const emissiveIntensity = (<PBRMaterial>material).emissiveIntensity ?? 1;\r\n textureLevel *= emissiveIntensity;\r\n this._emissiveTextureAndColor.color.set(\r\n (<any>material).emissiveColor.r * textureLevel,\r\n (<any>material).emissiveColor.g * textureLevel,\r\n (<any>material).emissiveColor.b * textureLevel,\r\n material.alpha\r\n );\r\n } else {\r\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n protected override _shouldRenderMesh(mesh: Mesh): boolean {\r\n return this.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n protected override _addCustomEffectDefines(defines: string[]): void {\r\n defines.push(\"#define GLOW\");\r\n }\r\n\r\n /**\r\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to exclude from the glow layer\r\n */\r\n public addExcludedMesh(mesh: Mesh): void {\r\n if (this._excludedMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._excludedMeshes.push(mesh.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n public removeExcludedMesh(mesh: Mesh): void {\r\n const index = this._excludedMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._excludedMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a mesh in the inclusion list to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to include in the glow layer\r\n */\r\n public addIncludedOnlyMesh(mesh: Mesh): void {\r\n if (this._includedOnlyMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._includedOnlyMeshes.push(mesh.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n public removeIncludedOnlyMesh(mesh: Mesh): void {\r\n const index = this._includedOnlyMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._includedOnlyMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be used in the glow layer\r\n * @param mesh The mesh to test\r\n * @returns true if the mesh will be highlighted by the current glow layer\r\n */\r\n public override hasMesh(mesh: AbstractMesh): boolean {\r\n if (!super.hasMesh(mesh)) {\r\n return false;\r\n }\r\n\r\n // Included Mesh\r\n if (this._includedOnlyMeshes.length) {\r\n return this._includedOnlyMeshes.indexOf(mesh.uniqueId) !== -1;\r\n }\r\n\r\n // Excluded Mesh\r\n if (this._excludedMeshes.length) {\r\n return this._excludedMeshes.indexOf(mesh.uniqueId) === -1;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Defines whether the current material of the mesh should be use to render the effect.\r\n * @param mesh defines the current mesh to render\r\n * @returns true if the material of the mesh should be use to render the effect\r\n */\r\n protected override _useMeshMaterial(mesh: AbstractMesh): boolean {\r\n if (this._meshesUsingTheirOwnMaterials.length == 0) {\r\n return false;\r\n }\r\n return this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId) > -1;\r\n }\r\n\r\n /**\r\n * Add a mesh to be rendered through its own material and not with emissive only.\r\n * @param mesh The mesh for which we need to use its material\r\n */\r\n public referenceMeshToUseItsOwnMaterial(mesh: AbstractMesh): void {\r\n mesh.resetDrawCache(this._mainTexture.renderPassId);\r\n\r\n this._meshesUsingTheirOwnMaterials.push(mesh.uniqueId);\r\n\r\n mesh.onDisposeObservable.add(() => {\r\n this._disposeMesh(mesh as Mesh);\r\n });\r\n }\r\n\r\n /**\r\n * Remove a mesh from being rendered through its own material and not with emissive only.\r\n * @param mesh The mesh for which we need to not use its material\r\n */\r\n public unReferenceMeshFromUsingItsOwnMaterial(mesh: AbstractMesh): void {\r\n let index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\r\n while (index >= 0) {\r\n this._meshesUsingTheirOwnMaterials.splice(index, 1);\r\n index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\r\n }\r\n mesh.resetDrawCache(this._mainTexture.renderPassId);\r\n }\r\n\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n * @internal\r\n */\r\n public _disposeMesh(mesh: Mesh): void {\r\n this.removeIncludedOnlyMesh(mesh);\r\n this.removeExcludedMesh(mesh);\r\n }\r\n\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n public override getClassName(): string {\r\n return \"GlowLayer\";\r\n }\r\n\r\n /**\r\n * Serializes this glow layer\r\n * @returns a serialized glow layer object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.GlowLayer\";\r\n\r\n let index;\r\n\r\n // Included meshes\r\n serializationObject.includedMeshes = [];\r\n\r\n if (this._includedOnlyMeshes.length) {\r\n for (index = 0; index < this._includedOnlyMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(this._includedOnlyMeshes[index]);\r\n if (mesh) {\r\n serializationObject.includedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n\r\n if (this._excludedMeshes.length) {\r\n for (index = 0; index < this._excludedMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(this._excludedMeshes[index]);\r\n if (mesh) {\r\n serializationObject.excludedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Glow Layer from parsed glow layer data\r\n * @param parsedGlowLayer defines glow layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the glow layer information\r\n * @returns a parsed Glow Layer\r\n */\r\n public static override Parse(parsedGlowLayer: any, scene: Scene, rootUrl: string): GlowLayer {\r\n const gl = SerializationHelper.Parse(() => new GlowLayer(parsedGlowLayer.name, scene, parsedGlowLayer.options), parsedGlowLayer, scene, rootUrl);\r\n let index;\r\n\r\n // Excluded meshes\r\n for (index = 0; index < parsedGlowLayer.excludedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedGlowLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n gl.addExcludedMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n // Included meshes\r\n for (index = 0; index < parsedGlowLayer.includedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedGlowLayer.includedMeshes[index]);\r\n if (mesh) {\r\n gl.addIncludedOnlyMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n return gl;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GlowLayer\", GlowLayer);\r\n"]}
1
+ {"version":3,"file":"glowLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/glowLayer.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAA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IAAI,KAAK,CAAC;QAEV,kBAAkB;QAClB,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACpE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,IAAI,IAAI,EAAE;gBACN,EAAE,CAAC,eAAe,CAAO,IAAI,CAAC,CAAC;aAClC;SACJ;QAED,kBAAkB;QAClB,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACpE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,IAAI,IAAI,EAAE;gBACN,EAAE,CAAC,mBAAmB,CAAO,IAAI,CAAC,CAAC;aACtC;SACJ;QAED,OAAO,EAAE,CAAC;IACd,CAAC;;AA3nBD;;GAEG;AACoB,oBAAU,GAAG,WAAW,AAAd,CAAe;AAEhD;;GAEG;AACW,+BAAqB,GAAG,EAAE,AAAL,CAAM;AAEzC;;GAEG;AACW,6BAAmB,GAAG,GAAG,AAAN,CAAO;AAuBxC;IADC,SAAS,EAAE;+CAGX;AAaD;IADC,SAAS,EAAE;0CAGX;AAGO;IADP,SAAS,CAAC,SAAS,CAAC;2CACe;AAskBxC,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Scene } from \"../scene\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Material } from \"../Materials/material\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { PBRMaterial } from \"../Materials/PBR/pbrMaterial\";\r\n\r\nimport \"../Layers/effectLayerSceneComponent\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /**\r\n * Return the first glow layer of the scene with a given name.\r\n * @param name The name of the glow layer to look for.\r\n * @returns The glow layer if found otherwise null.\r\n */\r\n getGlowLayerByName(name: string): Nullable<GlowLayer>;\r\n }\r\n}\r\n\r\nScene.prototype.getGlowLayerByName = function (name: string): Nullable<GlowLayer> {\r\n for (let index = 0; index < this.effectLayers?.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {\r\n return (<any>this.effectLayers[index]) as GlowLayer;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Glow layer options. This helps customizing the behaviour\r\n * of the glow layer.\r\n */\r\nexport interface IGlowLayerOptions {\r\n /**\r\n * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the glowing objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure resize independent blur. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * How big is the kernel of the blur texture. Default: 32\r\n */\r\n blurKernelSize: number;\r\n\r\n /**\r\n * The camera attached to the layer. Default: null\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * Enable MSAA by choosing the number of samples. Default: 1\r\n */\r\n mainTextureSamples?: number;\r\n\r\n /**\r\n * The rendering group to draw the layer in. Default: -1\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * Forces the merge step to be done in ldr (clamp values > 1). Default: false\r\n */\r\n ldrMerge?: boolean;\r\n\r\n /**\r\n * Defines the blend mode used by the merge. Default: ALPHA_ADD\r\n */\r\n alphaBlendingMode?: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_INT\r\n */\r\n mainTextureType: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer: boolean;\r\n}\r\n\r\n/**\r\n * The glow layer Helps adding a glow effect around the emissive parts of a mesh.\r\n *\r\n * Once instantiated in a scene, by default, all the emissive meshes will glow.\r\n *\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\nexport class GlowLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the layer.\r\n */\r\n public static readonly EffectName = \"GlowLayer\";\r\n\r\n /**\r\n * The default blur kernel size used for the glow.\r\n */\r\n public static DefaultBlurKernelSize = 32;\r\n\r\n /**\r\n * The default texture size ratio used for the glow.\r\n */\r\n public static DefaultTextureRatio = 0.5;\r\n\r\n /**\r\n * Sets the kernel size of the blur.\r\n */\r\n public set blurKernelSize(value: number) {\r\n if (value === this._options.blurKernelSize) {\r\n return;\r\n }\r\n\r\n this._options.blurKernelSize = value;\r\n\r\n const effectiveKernel = this._getEffectiveBlurKernelSize();\r\n this._horizontalBlurPostprocess1.kernel = effectiveKernel;\r\n this._verticalBlurPostprocess1.kernel = effectiveKernel;\r\n this._horizontalBlurPostprocess2.kernel = effectiveKernel;\r\n this._verticalBlurPostprocess2.kernel = effectiveKernel;\r\n }\r\n\r\n /**\r\n * Gets the kernel size of the blur.\r\n */\r\n @serialize()\r\n public get blurKernelSize(): number {\r\n return this._options.blurKernelSize;\r\n }\r\n\r\n /**\r\n * Sets the glow intensity.\r\n */\r\n public set intensity(value: number) {\r\n this._intensity = value;\r\n }\r\n\r\n /**\r\n * Gets the glow intensity.\r\n */\r\n @serialize()\r\n public get intensity(): number {\r\n return this._intensity;\r\n }\r\n\r\n @serialize(\"options\")\r\n private _options: IGlowLayerOptions;\r\n\r\n private _intensity: number = 1.0;\r\n private _horizontalBlurPostprocess1: BlurPostProcess;\r\n private _verticalBlurPostprocess1: BlurPostProcess;\r\n private _horizontalBlurPostprocess2: BlurPostProcess;\r\n private _verticalBlurPostprocess2: BlurPostProcess;\r\n private _blurTexture1: RenderTargetTexture;\r\n private _blurTexture2: RenderTargetTexture;\r\n private _postProcesses1: PostProcess[];\r\n private _postProcesses2: PostProcess[];\r\n\r\n private _includedOnlyMeshes: number[] = [];\r\n private _excludedMeshes: number[] = [];\r\n private _meshesUsingTheirOwnMaterials: number[] = [];\r\n\r\n /**\r\n * Callback used to let the user override the color selection on a per mesh basis\r\n */\r\n public customEmissiveColorSelector: (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void;\r\n /**\r\n * Callback used to let the user override the texture selection on a per mesh basis\r\n */\r\n public customEmissiveTextureSelector: (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture;\r\n\r\n /**\r\n * Instantiates a new glow Layer and references it to the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param options Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)\r\n */\r\n constructor(name: string, scene?: Scene, options?: Partial<IGlowLayerOptions>) {\r\n super(name, scene);\r\n this.neutralColor = new Color4(0, 0, 0, 1);\r\n\r\n // Adapt options\r\n this._options = {\r\n mainTextureRatio: GlowLayer.DefaultTextureRatio,\r\n blurKernelSize: 32,\r\n mainTextureFixedSize: undefined,\r\n camera: null,\r\n mainTextureSamples: 1,\r\n renderingGroupId: -1,\r\n ldrMerge: false,\r\n alphaBlendingMode: Constants.ALPHA_ADD,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_INT,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init({\r\n alphaBlendingMode: this._options.alphaBlendingMode,\r\n camera: this._options.camera,\r\n mainTextureFixedSize: this._options.mainTextureFixedSize,\r\n mainTextureRatio: this._options.mainTextureRatio,\r\n renderingGroupId: this._options.renderingGroupId,\r\n mainTextureType: this._options.mainTextureType,\r\n generateStencilBuffer: this._options.generateStencilBuffer,\r\n });\r\n }\r\n\r\n protected override async _importShadersAsync() {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([\r\n import(\"../ShadersWGSL/glowMapMerge.fragment\"),\r\n import(\"../ShadersWGSL/glowMapMerge.vertex\"),\r\n import(\"../ShadersWGSL/glowBlurPostProcess.fragment\"),\r\n ]);\r\n } else {\r\n await Promise.all([import(\"../Shaders/glowMapMerge.fragment\"), import(\"../Shaders/glowMapMerge.vertex\"), import(\"../Shaders/glowBlurPostProcess.fragment\")]);\r\n }\r\n\r\n await super._importShadersAsync();\r\n }\r\n\r\n /**\r\n * Get the effect name of the layer.\r\n * @returns The effect name\r\n */\r\n public getEffectName(): string {\r\n return GlowLayer.EffectName;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n */\r\n protected _createMergeEffect(): Effect {\r\n let defines = \"#define EMISSIVE \\n\";\r\n if (this._options.ldrMerge) {\r\n defines += \"#define LDR \\n\";\r\n }\r\n\r\n // Effect\r\n return this._engine.createEffect(\r\n \"glowMapMerge\",\r\n [VertexBuffer.PositionKind],\r\n [\"offset\"],\r\n [\"textureSampler\", \"textureSampler2\"],\r\n defines,\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this.shaderLanguage,\r\n this._shadersLoaded\r\n ? undefined\r\n : async () => {\r\n await this._importShadersAsync();\r\n this._shadersLoaded = true;\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the glow layer.\r\n */\r\n protected _createTextureAndPostProcesses(): void {\r\n let blurTextureWidth = this._mainTextureDesiredSize.width;\r\n let blurTextureHeight = this._mainTextureDesiredSize.height;\r\n blurTextureWidth = this._engine.needPOTTextures ? GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\r\n blurTextureHeight = this._engine.needPOTTextures ? GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\r\n\r\n let textureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else {\r\n textureType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n this._blurTexture1 = new RenderTargetTexture(\r\n \"GlowLayerBlurRTT\",\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n this._scene,\r\n false,\r\n true,\r\n textureType\r\n );\r\n this._blurTexture1.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture1.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture1.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._blurTexture1.renderParticles = false;\r\n this._blurTexture1.ignoreCameraViewport = true;\r\n\r\n const blurTextureWidth2 = Math.floor(blurTextureWidth / 2);\r\n const blurTextureHeight2 = Math.floor(blurTextureHeight / 2);\r\n\r\n this._blurTexture2 = new RenderTargetTexture(\r\n \"GlowLayerBlurRTT2\",\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n this._scene,\r\n false,\r\n true,\r\n textureType\r\n );\r\n this._blurTexture2.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture2.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture2.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._blurTexture2.renderParticles = false;\r\n this._blurTexture2.ignoreCameraViewport = true;\r\n\r\n this._textures = [this._blurTexture1, this._blurTexture2];\r\n\r\n const effectiveKernel = this._getEffectiveBlurKernelSize();\r\n this._horizontalBlurPostprocess1 = new BlurPostProcess(\r\n \"GlowLayerHBP1\",\r\n new Vector2(1.0, 0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n this._horizontalBlurPostprocess1.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess1.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess1.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess1.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._mainTexture);\r\n });\r\n\r\n this._verticalBlurPostprocess1 = new BlurPostProcess(\r\n \"GlowLayerVBP1\",\r\n new Vector2(0, 1.0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n\r\n this._horizontalBlurPostprocess2 = new BlurPostProcess(\r\n \"GlowLayerHBP2\",\r\n new Vector2(1.0, 0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n this._horizontalBlurPostprocess2.width = blurTextureWidth2;\r\n this._horizontalBlurPostprocess2.height = blurTextureHeight2;\r\n this._horizontalBlurPostprocess2.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess2.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n });\r\n\r\n this._verticalBlurPostprocess2 = new BlurPostProcess(\r\n \"GlowLayerVBP2\",\r\n new Vector2(0, 1.0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n\r\n this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1];\r\n this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n\r\n this._mainTexture.samples = this._options.mainTextureSamples!;\r\n this._mainTexture.onAfterUnbindObservable.add(() => {\r\n const internalTexture = this._blurTexture1.renderTarget;\r\n if (internalTexture) {\r\n this._scene.postProcessManager.directRender(this._postProcesses1, internalTexture, true);\r\n\r\n const internalTexture2 = this._blurTexture2.renderTarget;\r\n if (internalTexture2) {\r\n this._scene.postProcessManager.directRender(this._postProcesses2, internalTexture2, true);\r\n }\r\n this._engine.unBindFramebuffer(internalTexture2 ?? internalTexture, true);\r\n }\r\n });\r\n\r\n // Prevent autoClear.\r\n this._postProcesses.map((pp) => {\r\n pp.autoClear = false;\r\n });\r\n }\r\n\r\n /**\r\n * @returns The blur kernel size used by the glow.\r\n * Note: The value passed in the options is divided by 2 for back compatibility.\r\n */\r\n private _getEffectiveBlurKernelSize() {\r\n return this._options.blurKernelSize / 2;\r\n }\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @returns true if ready otherwise, false\r\n */\r\n public isReady(subMesh: SubMesh, useInstances: boolean): boolean {\r\n const material = subMesh.getMaterial();\r\n const mesh = subMesh.getRenderingMesh();\r\n\r\n if (!material || !mesh) {\r\n return false;\r\n }\r\n\r\n const emissiveTexture = (<any>material).emissiveTexture;\r\n return super._isReady(subMesh, useInstances, emissiveTexture);\r\n }\r\n\r\n /**\r\n * @returns whether or not the layer needs stencil enabled during the mesh rendering.\r\n */\r\n public needStencil(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n protected override _canRenderMesh(mesh: AbstractMesh, material: Material): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n */\r\n protected _internalRender(effect: Effect): void {\r\n // Texture\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n effect.setTexture(\"textureSampler2\", this._blurTexture2);\r\n effect.setFloat(\"offset\", this._intensity);\r\n\r\n // Cache\r\n const engine = this._engine;\r\n const previousStencilBuffer = engine.getStencilBuffer();\r\n\r\n // Draw order\r\n engine.setStencilBuffer(false);\r\n\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n\r\n // Draw order\r\n engine.setStencilBuffer(previousStencilBuffer);\r\n }\r\n\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n * @param mesh\r\n * @param subMesh\r\n * @param material\r\n */\r\n protected _setEmissiveTextureAndColor(mesh: Mesh, subMesh: SubMesh, material: Material): void {\r\n let textureLevel = 1.0;\r\n\r\n if (this.customEmissiveTextureSelector) {\r\n this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(mesh, subMesh, material);\r\n } else {\r\n if (material) {\r\n this._emissiveTextureAndColor.texture = (<any>material).emissiveTexture;\r\n if (this._emissiveTextureAndColor.texture) {\r\n textureLevel = this._emissiveTextureAndColor.texture.level;\r\n }\r\n } else {\r\n this._emissiveTextureAndColor.texture = null;\r\n }\r\n }\r\n\r\n if (this.customEmissiveColorSelector) {\r\n this.customEmissiveColorSelector(mesh, subMesh, material, this._emissiveTextureAndColor.color);\r\n } else {\r\n if ((<any>material).emissiveColor) {\r\n const emissiveIntensity = (<PBRMaterial>material).emissiveIntensity ?? 1;\r\n textureLevel *= emissiveIntensity;\r\n this._emissiveTextureAndColor.color.set(\r\n (<any>material).emissiveColor.r * textureLevel,\r\n (<any>material).emissiveColor.g * textureLevel,\r\n (<any>material).emissiveColor.b * textureLevel,\r\n material.alpha\r\n );\r\n } else {\r\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n protected override _shouldRenderMesh(mesh: Mesh): boolean {\r\n return this.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n protected override _addCustomEffectDefines(defines: string[]): void {\r\n defines.push(\"#define GLOW\");\r\n }\r\n\r\n /**\r\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to exclude from the glow layer\r\n */\r\n public addExcludedMesh(mesh: Mesh): void {\r\n if (this._excludedMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._excludedMeshes.push(mesh.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n public removeExcludedMesh(mesh: Mesh): void {\r\n const index = this._excludedMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._excludedMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a mesh in the inclusion list to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to include in the glow layer\r\n */\r\n public addIncludedOnlyMesh(mesh: Mesh): void {\r\n if (this._includedOnlyMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._includedOnlyMeshes.push(mesh.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n public removeIncludedOnlyMesh(mesh: Mesh): void {\r\n const index = this._includedOnlyMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._includedOnlyMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be used in the glow layer\r\n * @param mesh The mesh to test\r\n * @returns true if the mesh will be highlighted by the current glow layer\r\n */\r\n public override hasMesh(mesh: AbstractMesh): boolean {\r\n if (!super.hasMesh(mesh)) {\r\n return false;\r\n }\r\n\r\n // Included Mesh\r\n if (this._includedOnlyMeshes.length) {\r\n return this._includedOnlyMeshes.indexOf(mesh.uniqueId) !== -1;\r\n }\r\n\r\n // Excluded Mesh\r\n if (this._excludedMeshes.length) {\r\n return this._excludedMeshes.indexOf(mesh.uniqueId) === -1;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Defines whether the current material of the mesh should be use to render the effect.\r\n * @param mesh defines the current mesh to render\r\n * @returns true if the material of the mesh should be use to render the effect\r\n */\r\n protected override _useMeshMaterial(mesh: AbstractMesh): boolean {\r\n if (this._meshesUsingTheirOwnMaterials.length == 0) {\r\n return false;\r\n }\r\n return this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId) > -1;\r\n }\r\n\r\n /**\r\n * Add a mesh to be rendered through its own material and not with emissive only.\r\n * @param mesh The mesh for which we need to use its material\r\n */\r\n public referenceMeshToUseItsOwnMaterial(mesh: AbstractMesh): void {\r\n mesh.resetDrawCache(this._mainTexture.renderPassId);\r\n\r\n this._meshesUsingTheirOwnMaterials.push(mesh.uniqueId);\r\n\r\n mesh.onDisposeObservable.add(() => {\r\n this._disposeMesh(mesh as Mesh);\r\n });\r\n }\r\n\r\n /**\r\n * Remove a mesh from being rendered through its own material and not with emissive only.\r\n * @param mesh The mesh for which we need to not use its material\r\n */\r\n public unReferenceMeshFromUsingItsOwnMaterial(mesh: AbstractMesh): void {\r\n let index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\r\n while (index >= 0) {\r\n this._meshesUsingTheirOwnMaterials.splice(index, 1);\r\n index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\r\n }\r\n mesh.resetDrawCache(this._mainTexture.renderPassId);\r\n }\r\n\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n * @internal\r\n */\r\n public _disposeMesh(mesh: Mesh): void {\r\n this.removeIncludedOnlyMesh(mesh);\r\n this.removeExcludedMesh(mesh);\r\n }\r\n\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n public override getClassName(): string {\r\n return \"GlowLayer\";\r\n }\r\n\r\n /**\r\n * Serializes this glow layer\r\n * @returns a serialized glow layer object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.GlowLayer\";\r\n\r\n let index;\r\n\r\n // Included meshes\r\n serializationObject.includedMeshes = [];\r\n\r\n if (this._includedOnlyMeshes.length) {\r\n for (index = 0; index < this._includedOnlyMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(this._includedOnlyMeshes[index]);\r\n if (mesh) {\r\n serializationObject.includedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n\r\n if (this._excludedMeshes.length) {\r\n for (index = 0; index < this._excludedMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(this._excludedMeshes[index]);\r\n if (mesh) {\r\n serializationObject.excludedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Glow Layer from parsed glow layer data\r\n * @param parsedGlowLayer defines glow layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the glow layer information\r\n * @returns a parsed Glow Layer\r\n */\r\n public static override Parse(parsedGlowLayer: any, scene: Scene, rootUrl: string): GlowLayer {\r\n const gl = SerializationHelper.Parse(() => new GlowLayer(parsedGlowLayer.name, scene, parsedGlowLayer.options), parsedGlowLayer, scene, rootUrl);\r\n let index;\r\n\r\n // Excluded meshes\r\n for (index = 0; index < parsedGlowLayer.excludedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedGlowLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n gl.addExcludedMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n // Included meshes\r\n for (index = 0; index < parsedGlowLayer.includedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedGlowLayer.includedMeshes[index]);\r\n if (mesh) {\r\n gl.addIncludedOnlyMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n return gl;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GlowLayer\", GlowLayer);\r\n"]}
@@ -1,7 +1,7 @@
1
1
  import { Observable } from "../Misc/observable";
2
2
  import type { Nullable } from "../types";
3
3
  import type { Camera } from "../Cameras/camera";
4
- import type { Scene } from "../scene";
4
+ import { Scene } from "../scene";
5
5
  import type { SubMesh } from "../Meshes/subMesh";
6
6
  import type { AbstractMesh } from "../Meshes/abstractMesh";
7
7
  import type { Mesh } from "../Meshes/mesh";
@@ -9,8 +9,8 @@ import type { Effect } from "../Materials/effect";
9
9
  import { Material } from "../Materials/material";
10
10
  import { EffectLayer } from "./effectLayer";
11
11
  import { Color4, Color3 } from "../Maths/math.color";
12
- declare module "../abstractScene" {
13
- interface AbstractScene {
12
+ declare module "../scene" {
13
+ interface Scene {
14
14
  /**
15
15
  * Return a the first highlight layer of the scene with a given name.
16
16
  * @param name The name of the highlight layer to look for.
@@ -2,6 +2,7 @@ import { __decorate } from "../tslib.es6.js";
2
2
  /* eslint-disable @typescript-eslint/no-unused-vars */
3
3
  import { serialize } from "../Misc/decorators.js";
4
4
  import { Observable } from "../Misc/observable.js";
5
+ import { Scene } from "../scene.js";
5
6
  import { Vector2 } from "../Maths/math.vector.js";
6
7
  import { VertexBuffer } from "../Buffers/buffer.js";
7
8
  import { Material } from "../Materials/material.js";
@@ -11,14 +12,13 @@ import { PostProcess } from "../PostProcesses/postProcess.js";
11
12
  import { PassPostProcess } from "../PostProcesses/passPostProcess.js";
12
13
  import { BlurPostProcess } from "../PostProcesses/blurPostProcess.js";
13
14
  import { EffectLayer } from "./effectLayer.js";
14
- import { AbstractScene } from "../abstractScene.js";
15
15
 
16
16
  import { Logger } from "../Misc/logger.js";
17
17
  import { RegisterClass } from "../Misc/typeStore.js";
18
18
  import { Color4, Color3 } from "../Maths/math.color.js";
19
19
  import { SerializationHelper } from "../Misc/decorators.serialization.js";
20
20
  import { GetExponentOfTwo } from "../Misc/tools.functions.js";
21
- AbstractScene.prototype.getHighlightLayerByName = function (name) {
21
+ Scene.prototype.getHighlightLayerByName = function (name) {
22
22
  for (let index = 0; index < this.effectLayers?.length; index++) {
23
23
  if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === HighlightLayer.EffectName) {
24
24
  return this.effectLayers[index];