@onerjs/core 8.32.7 → 8.32.9

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 (112) hide show
  1. package/Audio/sound.js +0 -1
  2. package/Audio/sound.js.map +1 -1
  3. package/AudioV2/abstractAudio/abstractSoundSource.js +12 -4
  4. package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
  5. package/AudioV2/webAudio/webAudioStaticSound.js +10 -3
  6. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  7. package/Engines/Extensions/engine.prefilteredCubeTexture.js +1 -1
  8. package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
  9. package/Engines/abstractEngine.js +2 -2
  10. package/Engines/abstractEngine.js.map +1 -1
  11. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +1 -1
  12. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
  13. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +18 -0
  14. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +105 -15
  15. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  16. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +7 -7
  17. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  18. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +1 -1
  19. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
  20. package/FrameGraph/Passes/pass.d.ts +11 -2
  21. package/FrameGraph/Passes/pass.js +14 -2
  22. package/FrameGraph/Passes/pass.js.map +1 -1
  23. package/FrameGraph/Passes/renderPass.d.ts +4 -2
  24. package/FrameGraph/Passes/renderPass.js +5 -2
  25. package/FrameGraph/Passes/renderPass.js.map +1 -1
  26. package/FrameGraph/Tasks/Layers/baseLayerTask.js +27 -31
  27. package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
  28. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +41 -1
  29. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +122 -0
  30. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  31. package/FrameGraph/Tasks/Texture/clearTextureTask.js +6 -4
  32. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  33. package/FrameGraph/frameGraph.js +3 -0
  34. package/FrameGraph/frameGraph.js.map +1 -1
  35. package/FrameGraph/frameGraphRenderTarget.js +1 -0
  36. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  37. package/FrameGraph/frameGraphTask.d.ts +2 -0
  38. package/FrameGraph/frameGraphTask.js +11 -0
  39. package/FrameGraph/frameGraphTask.js.map +1 -1
  40. package/FrameGraph/frameGraphTypes.d.ts +8 -0
  41. package/FrameGraph/frameGraphTypes.js.map +1 -1
  42. package/Layers/effectLayer.d.ts +1 -1
  43. package/Layers/effectLayer.js.map +1 -1
  44. package/Layers/glowLayer.js +2 -0
  45. package/Layers/glowLayer.js.map +1 -1
  46. package/Layers/highlightLayer.js +2 -0
  47. package/Layers/highlightLayer.js.map +1 -1
  48. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +9 -0
  49. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +66 -22
  50. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  51. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +3 -6
  52. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  53. package/Materials/materialHelper.functions.js +2 -8
  54. package/Materials/materialHelper.functions.js.map +1 -1
  55. package/Materials/shaderMaterial.js +2 -2
  56. package/Materials/shaderMaterial.js.map +1 -1
  57. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +16 -6
  58. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +37 -33
  59. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  60. package/Misc/snapshotRenderingHelper.js +10 -0
  61. package/Misc/snapshotRenderingHelper.js.map +1 -1
  62. package/Rendering/depthPeelingRenderer.d.ts +7 -78
  63. package/Rendering/depthPeelingRenderer.js +12 -398
  64. package/Rendering/depthPeelingRenderer.js.map +1 -1
  65. package/Rendering/depthPeelingSceneComponent.d.ts +3 -3
  66. package/Rendering/depthPeelingSceneComponent.js.map +1 -1
  67. package/Rendering/depthRenderer.js +9 -1
  68. package/Rendering/depthRenderer.js.map +1 -1
  69. package/Rendering/index.d.ts +1 -0
  70. package/Rendering/index.js +1 -0
  71. package/Rendering/index.js.map +1 -1
  72. package/Rendering/objectRenderer.d.ts +20 -0
  73. package/Rendering/objectRenderer.js +17 -1
  74. package/Rendering/objectRenderer.js.map +1 -1
  75. package/Rendering/renderingGroup.d.ts +10 -3
  76. package/Rendering/renderingGroup.js +24 -13
  77. package/Rendering/renderingGroup.js.map +1 -1
  78. package/Rendering/renderingManager.d.ts +6 -2
  79. package/Rendering/renderingManager.js +8 -2
  80. package/Rendering/renderingManager.js.map +1 -1
  81. package/Rendering/thinDepthPeelingRenderer.d.ts +120 -0
  82. package/Rendering/thinDepthPeelingRenderer.js +469 -0
  83. package/Rendering/thinDepthPeelingRenderer.js.map +1 -0
  84. package/Shaders/ShadersInclude/gaussianSplatting.js +1 -1
  85. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  86. package/Shaders/gaussianSplatting.vertex.js +2 -2
  87. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  88. package/Shaders/gaussianSplattingDepth.fragment.js +9 -2
  89. package/Shaders/gaussianSplattingDepth.fragment.js.map +1 -1
  90. package/Shaders/gaussianSplattingDepth.vertex.js +13 -2
  91. package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
  92. package/Shaders/oitFinalSimpleBlend.fragment.d.ts +5 -0
  93. package/Shaders/oitFinalSimpleBlend.fragment.js +12 -0
  94. package/Shaders/oitFinalSimpleBlend.fragment.js.map +1 -0
  95. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +1 -5
  96. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  97. package/ShadersWGSL/gaussianSplatting.vertex.js +2 -2
  98. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  99. package/ShadersWGSL/gaussianSplattingDepth.fragment.js +12 -3
  100. package/ShadersWGSL/gaussianSplattingDepth.fragment.js.map +1 -1
  101. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +13 -2
  102. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  103. package/ShadersWGSL/iblVoxelGrid.vertex.d.ts +1 -0
  104. package/ShadersWGSL/iblVoxelGrid.vertex.js +15 -8
  105. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  106. package/ShadersWGSL/oitFinalSimpleBlend.fragment.d.ts +5 -0
  107. package/ShadersWGSL/oitFinalSimpleBlend.fragment.js +13 -0
  108. package/ShadersWGSL/oitFinalSimpleBlend.fragment.js.map +1 -0
  109. package/node.d.ts +2 -0
  110. package/node.js +5 -0
  111. package/node.js.map +1 -1
  112. package/package.json +1 -1
@@ -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;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAIhF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACj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;QACL,CAAC;QAED,kBAAkB;QAClB,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACrE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,IAAI,IAAI,EAAE,CAAC;gBACP,EAAE,CAAC,mBAAmB,CAAO,IAAI,CAAC,CAAC;YACvC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,CAAC;IACd,CAAC;;AAzdD;;GAEG;AACW,+BAAqB,GAAG,EAAE,CAAC;AAEzC;;GAEG;AACW,6BAAmB,GAAG,GAAG,CAAC;AAaxC;IADC,SAAS,EAAE;+CAGX;AAaD;IADC,SAAS,EAAE;0CAGX;AAGS;IADT,SAAS,CAAC,SAAS,CAAC;2CACiB;AAmb1C,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 { Scene } from \"../scene\";\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 type { Material } from \"../Materials/material\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess\";\r\nimport type { IThinGlowLayerOptions } from \"./thinGlowLayer\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { Color4 } from \"core/Maths/math.color\";\r\n\r\nimport \"../Layers/effectLayerSceneComponent\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport { ThinGlowLayer } from \"./thinGlowLayer\";\r\nimport type { ThinBlurPostProcess } from \"core/PostProcesses/thinBlurPostProcess\";\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\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 extends IThinGlowLayerOptions {\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 * 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 get EffectName() {\r\n return ThinGlowLayer.EffectName;\r\n }\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 this._thinEffectLayer.blurKernelSize = value;\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._thinEffectLayer.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._thinEffectLayer.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._thinEffectLayer.intensity;\r\n }\r\n\r\n @serialize(\"options\")\r\n protected _options: IGlowLayerOptions;\r\n\r\n protected override readonly _thinEffectLayer: ThinGlowLayer;\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 * Callback used to let the user override the color selection on a per mesh basis\r\n */\r\n public get customEmissiveColorSelector(): (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void {\r\n return this._thinEffectLayer.customEmissiveColorSelector;\r\n }\r\n\r\n public set customEmissiveColorSelector(value: (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void) {\r\n this._thinEffectLayer.customEmissiveColorSelector = value;\r\n }\r\n\r\n /**\r\n * Callback used to let the user override the texture selection on a per mesh basis\r\n */\r\n public get customEmissiveTextureSelector(): (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture {\r\n return this._thinEffectLayer.customEmissiveTextureSelector;\r\n }\r\n\r\n public set customEmissiveTextureSelector(value: (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture) {\r\n this._thinEffectLayer.customEmissiveTextureSelector = value;\r\n }\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, false, new ThinGlowLayer(name, scene, options));\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_BYTE,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init(this._options);\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 return this._thinEffectLayer._createMergeEffect();\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 this._thinEffectLayer._renderPassId = this._mainTexture.renderPassId;\r\n\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_BYTE;\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 this._thinEffectLayer.bindTexturesForCompose = (effect: Effect) => {\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\r\n this._thinEffectLayer._createTextureAndPostProcesses();\r\n\r\n const thinBlurPostProcesses1 = this._thinEffectLayer._postProcesses[0] as ThinBlurPostProcess;\r\n this._horizontalBlurPostprocess1 = new BlurPostProcess(\"GlowLayerHBP1\", thinBlurPostProcesses1.direction, thinBlurPostProcesses1.kernel, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n textureType,\r\n effectWrapper: thinBlurPostProcesses1,\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 const thinBlurPostProcesses2 = this._thinEffectLayer._postProcesses[1] as ThinBlurPostProcess;\r\n this._verticalBlurPostprocess1 = new BlurPostProcess(\"GlowLayerVBP1\", thinBlurPostProcesses2.direction, thinBlurPostProcesses2.kernel, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n textureType,\r\n effectWrapper: thinBlurPostProcesses2,\r\n });\r\n\r\n const thinBlurPostProcesses3 = this._thinEffectLayer._postProcesses[2] as ThinBlurPostProcess;\r\n this._horizontalBlurPostprocess2 = new BlurPostProcess(\"GlowLayerHBP2\", thinBlurPostProcesses3.direction, thinBlurPostProcesses3.kernel, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n textureType,\r\n effectWrapper: thinBlurPostProcesses3,\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 const thinBlurPostProcesses4 = this._thinEffectLayer._postProcesses[3] as ThinBlurPostProcess;\r\n this._verticalBlurPostprocess2 = new BlurPostProcess(\"GlowLayerVBP2\", thinBlurPostProcesses4.direction, thinBlurPostProcesses4.kernel, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n textureType,\r\n effectWrapper: thinBlurPostProcesses4,\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 * 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 return this._thinEffectLayer.isReady(subMesh, useInstances);\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 this._thinEffectLayer._canRenderMesh(mesh, material);\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 this._thinEffectLayer._internalCompose(effect);\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 this._thinEffectLayer._setEmissiveTextureAndColor(mesh, subMesh, material);\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._thinEffectLayer._shouldRenderMesh(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 this._thinEffectLayer._addCustomEffectDefines(defines);\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 this._thinEffectLayer.addExcludedMesh(mesh);\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 this._thinEffectLayer.removeExcludedMesh(mesh);\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 this._thinEffectLayer.addIncludedOnlyMesh(mesh);\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 this._thinEffectLayer.removeIncludedOnlyMesh(mesh);\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 return this._thinEffectLayer.hasMesh(mesh);\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 return this._thinEffectLayer._useMeshMaterial(mesh);\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 this._thinEffectLayer.referenceMeshToUseItsOwnMaterial(mesh);\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 this._thinEffectLayer.unReferenceMeshFromUsingItsOwnMaterial(mesh, 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._thinEffectLayer._disposeMesh(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 const includedOnlyMeshes = this._thinEffectLayer._includedOnlyMeshes;\r\n if (includedOnlyMeshes.length) {\r\n for (index = 0; index < includedOnlyMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(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 const excludedMeshes = this._thinEffectLayer._excludedMeshes;\r\n if (excludedMeshes.length) {\r\n for (index = 0; index < excludedMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(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;\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,CAAC,SAAS,CAAC;2CACiB;AAsb1C,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 { Scene } from \"../scene\";\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 type { Material } from \"../Materials/material\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess\";\r\nimport type { IThinGlowLayerOptions } from \"./thinGlowLayer\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { Color4 } from \"core/Maths/math.color\";\r\n\r\nimport \"../Layers/effectLayerSceneComponent\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport { ThinGlowLayer } from \"./thinGlowLayer\";\r\nimport type { ThinBlurPostProcess } from \"core/PostProcesses/thinBlurPostProcess\";\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\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 extends IThinGlowLayerOptions {\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 * 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 get EffectName() {\r\n return ThinGlowLayer.EffectName;\r\n }\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 this._thinEffectLayer.blurKernelSize = value;\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._thinEffectLayer.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._thinEffectLayer.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._thinEffectLayer.intensity;\r\n }\r\n\r\n @serialize(\"options\")\r\n protected _options: IGlowLayerOptions;\r\n\r\n protected override readonly _thinEffectLayer: ThinGlowLayer;\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 * Callback used to let the user override the color selection on a per mesh basis\r\n */\r\n public get customEmissiveColorSelector(): (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void {\r\n return this._thinEffectLayer.customEmissiveColorSelector;\r\n }\r\n\r\n public set customEmissiveColorSelector(value: (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void) {\r\n this._thinEffectLayer.customEmissiveColorSelector = value;\r\n }\r\n\r\n /**\r\n * Callback used to let the user override the texture selection on a per mesh basis\r\n */\r\n public get customEmissiveTextureSelector(): (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture {\r\n return this._thinEffectLayer.customEmissiveTextureSelector;\r\n }\r\n\r\n public set customEmissiveTextureSelector(value: (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture) {\r\n this._thinEffectLayer.customEmissiveTextureSelector = value;\r\n }\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, false, new ThinGlowLayer(name, scene, options));\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_BYTE,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init(this._options);\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 return this._thinEffectLayer._createMergeEffect();\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 this._thinEffectLayer._renderPassId = this._mainTexture.renderPassId;\r\n\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_BYTE;\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 this._thinEffectLayer.bindTexturesForCompose = (effect: Effect) => {\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\r\n this._thinEffectLayer._createTextureAndPostProcesses();\r\n\r\n const thinBlurPostProcesses1 = this._thinEffectLayer._postProcesses[0] as ThinBlurPostProcess;\r\n this._horizontalBlurPostprocess1 = new BlurPostProcess(\"GlowLayerHBP1\", thinBlurPostProcesses1.direction, thinBlurPostProcesses1.kernel, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n textureType,\r\n effectWrapper: thinBlurPostProcesses1,\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 const thinBlurPostProcesses2 = this._thinEffectLayer._postProcesses[1] as ThinBlurPostProcess;\r\n this._verticalBlurPostprocess1 = new BlurPostProcess(\"GlowLayerVBP1\", thinBlurPostProcesses2.direction, thinBlurPostProcesses2.kernel, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n textureType,\r\n effectWrapper: thinBlurPostProcesses2,\r\n });\r\n\r\n const thinBlurPostProcesses3 = this._thinEffectLayer._postProcesses[2] as ThinBlurPostProcess;\r\n this._horizontalBlurPostprocess2 = new BlurPostProcess(\"GlowLayerHBP2\", thinBlurPostProcesses3.direction, thinBlurPostProcesses3.kernel, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n textureType,\r\n effectWrapper: thinBlurPostProcesses3,\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 const thinBlurPostProcesses4 = this._thinEffectLayer._postProcesses[3] as ThinBlurPostProcess;\r\n this._verticalBlurPostprocess2 = new BlurPostProcess(\"GlowLayerVBP2\", thinBlurPostProcesses4.direction, thinBlurPostProcesses4.kernel, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n textureType,\r\n effectWrapper: thinBlurPostProcesses4,\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 this._mainTextureCreatedSize.width = this._mainTextureDesiredSize.width;\r\n this._mainTextureCreatedSize.height = this._mainTextureDesiredSize.height;\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 return this._thinEffectLayer.isReady(subMesh, useInstances);\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 this._thinEffectLayer._canRenderMesh(mesh, material);\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 this._thinEffectLayer._internalCompose(effect);\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 this._thinEffectLayer._setEmissiveTextureAndColor(mesh, subMesh, material);\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._thinEffectLayer._shouldRenderMesh(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 this._thinEffectLayer._addCustomEffectDefines(defines);\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 this._thinEffectLayer.addExcludedMesh(mesh);\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 this._thinEffectLayer.removeExcludedMesh(mesh);\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 this._thinEffectLayer.addIncludedOnlyMesh(mesh);\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 this._thinEffectLayer.removeIncludedOnlyMesh(mesh);\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 return this._thinEffectLayer.hasMesh(mesh);\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 return this._thinEffectLayer._useMeshMaterial(mesh);\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 this._thinEffectLayer.referenceMeshToUseItsOwnMaterial(mesh);\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 this._thinEffectLayer.unReferenceMeshFromUsingItsOwnMaterial(mesh, 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._thinEffectLayer._disposeMesh(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 const includedOnlyMeshes = this._thinEffectLayer._includedOnlyMeshes;\r\n if (includedOnlyMeshes.length) {\r\n for (index = 0; index < includedOnlyMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(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 const excludedMeshes = this._thinEffectLayer._excludedMeshes;\r\n if (excludedMeshes.length) {\r\n for (index = 0; index < excludedMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(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"]}
@@ -282,6 +282,8 @@ export class HighlightLayer extends EffectLayer {
282
282
  this._postProcesses.map((pp) => {
283
283
  pp.autoClear = false;
284
284
  });
285
+ this._mainTextureCreatedSize.width = this._mainTextureDesiredSize.width;
286
+ this._mainTextureCreatedSize.height = this._mainTextureDesiredSize.height;
285
287
  }
286
288
  /**
287
289
  * @returns whether or not the layer needs stencil enabled during the mesh rendering.
@@ -1 +1 @@
1
- {"version":3,"file":"highlightLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/highlightLayer.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,SA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X;AAUD;IADC,SAAS,EAAE;+CAGX;AAwBD;IADC,SAAS,EAAE;wDAGX;AAMD;IADC,SAAS,EAAE;sDAGX;AAaO;IADP,SAAS,CAAC,SAAS,CAAC;gDAC8B;AAkZvD,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { Observable } from \"../Misc/observable\";\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 type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { PostProcessOptions } from \"../PostProcesses/postProcess\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { PassPostProcess } from \"../PostProcesses/passPostProcess\";\r\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { Color4 } from \"../Maths/math.color\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\n\r\nimport type { ThinPassPostProcess } from \"core/PostProcesses/thinPassPostProcess\";\r\nimport type { ThinBlurPostProcess } from \"core/PostProcesses/thinBlurPostProcess\";\r\nimport type { IThinHighlightLayerOptions } from \"./thinHighlightLayer\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport { ThinHighlightLayer } from \"./thinHighlightLayer\";\r\nimport { ThinGlowBlurPostProcess } from \"./thinEffectLayer\";\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /**\r\n * Return a the first highlight layer of the scene with a given name.\r\n * @param name The name of the highlight layer to look for.\r\n * @returns The highlight layer if found otherwise null.\r\n */\r\n getHighlightLayerByName(name: string): Nullable<HighlightLayer>;\r\n }\r\n}\r\n\r\nScene.prototype.getHighlightLayerByName = function (name: string): Nullable<HighlightLayer> {\r\n for (let index = 0; index < this.effectLayers?.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === HighlightLayer.EffectName) {\r\n return (<any>this.effectLayers[index]) as HighlightLayer;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\ninterface IBlurPostProcess extends PostProcess {\r\n kernel: number;\r\n}\r\n\r\n/**\r\n * Special Glow Blur post process only blurring the alpha channel\r\n * It enforces keeping the most luminous color in the color channel.\r\n */\r\nclass GlowBlurPostProcess extends PostProcess {\r\n protected override _effectWrapper: ThinGlowBlurPostProcess;\r\n\r\n constructor(\r\n name: string,\r\n public direction: Vector2,\r\n public kernel: number,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera> = null,\r\n samplingMode: number = Texture.BILINEAR_SAMPLINGMODE,\r\n engine?: AbstractEngine,\r\n reusable?: boolean\r\n ) {\r\n const localOptions = {\r\n uniforms: ThinGlowBlurPostProcess.Uniforms,\r\n size: typeof options === \"number\" ? options : undefined,\r\n camera,\r\n samplingMode,\r\n engine,\r\n reusable,\r\n ...(options as PostProcessOptions),\r\n };\r\n\r\n super(name, ThinGlowBlurPostProcess.FragmentUrl, {\r\n effectWrapper: typeof options === \"number\" || !options.effectWrapper ? new ThinGlowBlurPostProcess(name, engine, direction, kernel, localOptions) : undefined,\r\n ...localOptions,\r\n });\r\n\r\n this.onApplyObservable.add(() => {\r\n this._effectWrapper.textureWidth = this.width;\r\n this._effectWrapper.textureHeight = this.height;\r\n });\r\n }\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/glowBlurPostProcess.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/glowBlurPostProcess.fragment\"));\r\n }\r\n\r\n super._gatherImports(useWebGPU, list);\r\n }\r\n}\r\n\r\n/**\r\n * Highlight layer options. This helps customizing the behaviour\r\n * of the highlight layer.\r\n */\r\nexport interface IHighlightLayerOptions extends IThinHighlightLayerOptions {}\r\n\r\n/**\r\n * The highlight layer Helps adding a glow effect around a mesh.\r\n *\r\n * Once instantiated in a scene, simply use the addMesh or removeMesh method to add or remove\r\n * glowy meshes to your scene.\r\n *\r\n * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!\r\n */\r\nexport class HighlightLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the highlight layer.\r\n */\r\n public static readonly EffectName = \"HighlightLayer\";\r\n\r\n /**\r\n * The neutral color used during the preparation of the glow effect.\r\n * This is black by default as the blend operation is a blend operation.\r\n */\r\n public static get NeutralColor() {\r\n return ThinHighlightLayer.NeutralColor;\r\n }\r\n\r\n public static set NeutralColor(value: Color4) {\r\n ThinHighlightLayer.NeutralColor = value;\r\n }\r\n\r\n /**\r\n * Specifies whether or not the inner glow is ACTIVE in the layer.\r\n */\r\n @serialize()\r\n public get innerGlow() {\r\n return this._thinEffectLayer.innerGlow;\r\n }\r\n\r\n public set innerGlow(value: boolean) {\r\n this._thinEffectLayer.innerGlow = value;\r\n }\r\n\r\n /**\r\n * Specifies whether or not the outer glow is ACTIVE in the layer.\r\n */\r\n @serialize()\r\n public get outerGlow() {\r\n return this._thinEffectLayer.outerGlow;\r\n }\r\n\r\n public set outerGlow(value: boolean) {\r\n this._thinEffectLayer.outerGlow = value;\r\n }\r\n\r\n /**\r\n * Specifies the horizontal size of the blur.\r\n */\r\n public set blurHorizontalSize(value: number) {\r\n this._thinEffectLayer.blurHorizontalSize = value;\r\n }\r\n\r\n /**\r\n * Specifies the vertical size of the blur.\r\n */\r\n public set blurVerticalSize(value: number) {\r\n this._thinEffectLayer.blurVerticalSize = value;\r\n }\r\n\r\n /**\r\n * Gets the horizontal size of the blur.\r\n */\r\n @serialize()\r\n public get blurHorizontalSize(): number {\r\n return this._thinEffectLayer.blurHorizontalSize;\r\n }\r\n\r\n /**\r\n * Gets the vertical size of the blur.\r\n */\r\n @serialize()\r\n public get blurVerticalSize(): number {\r\n return this._thinEffectLayer.blurVerticalSize;\r\n }\r\n\r\n /**\r\n * An event triggered when the highlight layer is being blurred.\r\n */\r\n public onBeforeBlurObservable = new Observable<HighlightLayer>();\r\n\r\n /**\r\n * An event triggered when the highlight layer has been blurred.\r\n */\r\n public onAfterBlurObservable = new Observable<HighlightLayer>();\r\n\r\n @serialize(\"options\")\r\n private _options: Required<IHighlightLayerOptions>;\r\n\r\n protected override readonly _thinEffectLayer: ThinHighlightLayer;\r\n private _downSamplePostprocess: PassPostProcess;\r\n private _horizontalBlurPostprocess: IBlurPostProcess;\r\n private _verticalBlurPostprocess: IBlurPostProcess;\r\n private _blurTexture: RenderTargetTexture;\r\n\r\n /**\r\n * Instantiates a new highlight 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 IHighlightLayerOptions for more information)\r\n */\r\n constructor(name: string, scene?: Scene, options?: Partial<IHighlightLayerOptions>) {\r\n super(name, scene, options !== undefined ? !!options.forceGLSL : false, new ThinHighlightLayer(name, scene, options));\r\n\r\n // Warn on stencil\r\n if (!this._engine.isStencilEnable) {\r\n Logger.Warn(\"Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }\");\r\n }\r\n\r\n // Adapt options\r\n this._options = {\r\n mainTextureRatio: 0.5,\r\n blurTextureSizeRatio: 0.5,\r\n mainTextureFixedSize: 0,\r\n blurHorizontalSize: 1.0,\r\n blurVerticalSize: 1.0,\r\n alphaBlendingMode: Constants.ALPHA_COMBINE,\r\n camera: null,\r\n renderingGroupId: -1,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n forceGLSL: false,\r\n isStroke: false,\r\n ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init(this._options);\r\n\r\n // Do not render as long as no meshes have been added\r\n this._shouldRender = false;\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 HighlightLayer.EffectName;\r\n }\r\n\r\n protected override _numInternalDraws(): number {\r\n return 2; // we need two rendering, one for the inner glow and the other for the outer glow\r\n }\r\n\r\n /**\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 * @returns The effect created\r\n */\r\n protected _createMergeEffect(): Effect {\r\n return this._thinEffectLayer._createMergeEffect();\r\n }\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the highlight layer.\r\n */\r\n protected _createTextureAndPostProcesses(): void {\r\n let blurTextureWidth = this._mainTextureDesiredSize.width * this._options.blurTextureSizeRatio;\r\n let blurTextureHeight = this._mainTextureDesiredSize.height * this._options.blurTextureSizeRatio;\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_BYTE;\r\n }\r\n\r\n this._blurTexture = new RenderTargetTexture(\r\n \"HighlightLayerBlurRTT\",\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._blurTexture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture.anisotropicFilteringLevel = 16;\r\n this._blurTexture.updateSamplingMode(Texture.TRILINEAR_SAMPLINGMODE);\r\n this._blurTexture.renderParticles = false;\r\n this._blurTexture.ignoreCameraViewport = true;\r\n\r\n this._textures = [this._blurTexture];\r\n\r\n this._thinEffectLayer.bindTexturesForCompose = (effect: Effect) => {\r\n effect.setTexture(\"textureSampler\", this._blurTexture);\r\n };\r\n\r\n this._thinEffectLayer._createTextureAndPostProcesses();\r\n\r\n if (this._options.alphaBlendingMode === Constants.ALPHA_COMBINE) {\r\n this._downSamplePostprocess = new PassPostProcess(\"HighlightLayerPPP\", {\r\n size: this._options.blurTextureSizeRatio,\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n effectWrapper: this._thinEffectLayer._postProcesses[0] as ThinPassPostProcess,\r\n });\r\n this._downSamplePostprocess.externalTextureSamplerBinding = true;\r\n this._downSamplePostprocess.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._mainTexture);\r\n });\r\n\r\n this._horizontalBlurPostprocess = new GlowBlurPostProcess(\"HighlightLayerHBP\", new Vector2(1.0, 0), this._options.blurHorizontalSize, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n effectWrapper: this._thinEffectLayer._postProcesses[1] as ThinGlowBlurPostProcess,\r\n });\r\n this._horizontalBlurPostprocess.onApplyObservable.add((effect) => {\r\n effect.setFloat2(\"screenSize\", blurTextureWidth, blurTextureHeight);\r\n });\r\n\r\n this._verticalBlurPostprocess = new GlowBlurPostProcess(\"HighlightLayerVBP\", new Vector2(0, 1.0), this._options.blurVerticalSize, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n effectWrapper: this._thinEffectLayer._postProcesses[2] as ThinGlowBlurPostProcess,\r\n });\r\n this._verticalBlurPostprocess.onApplyObservable.add((effect) => {\r\n effect.setFloat2(\"screenSize\", blurTextureWidth, blurTextureHeight);\r\n });\r\n\r\n this._postProcesses = [this._downSamplePostprocess, this._horizontalBlurPostprocess, this._verticalBlurPostprocess];\r\n } else {\r\n this._horizontalBlurPostprocess = new BlurPostProcess(\"HighlightLayerHBP\", new Vector2(1.0, 0), this._options.blurHorizontalSize / 2, {\r\n size: {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n textureType,\r\n effectWrapper: this._thinEffectLayer._postProcesses[0] as ThinBlurPostProcess,\r\n });\r\n this._horizontalBlurPostprocess.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._mainTexture);\r\n });\r\n\r\n this._verticalBlurPostprocess = new BlurPostProcess(\"HighlightLayerVBP\", new Vector2(0, 1.0), this._options.blurVerticalSize / 2, {\r\n size: {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n textureType,\r\n });\r\n\r\n this._postProcesses = [this._horizontalBlurPostprocess, this._verticalBlurPostprocess];\r\n }\r\n\r\n this._mainTexture.onAfterUnbindObservable.add(() => {\r\n this.onBeforeBlurObservable.notifyObservers(this);\r\n\r\n const internalTexture = this._blurTexture.renderTarget;\r\n if (internalTexture) {\r\n this._scene.postProcessManager.directRender(this._postProcesses, internalTexture, true);\r\n this._engine.unBindFramebuffer(internalTexture, true);\r\n }\r\n\r\n this.onAfterBlurObservable.notifyObservers(this);\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 whether or not the layer needs stencil enabled during the mesh rendering.\r\n */\r\n public needStencil(): boolean {\r\n return this._thinEffectLayer.needStencil();\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 return this._thinEffectLayer.isReady(subMesh, useInstances);\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 * @param renderIndex\r\n */\r\n protected _internalRender(effect: Effect, renderIndex: number): void {\r\n this._thinEffectLayer._internalCompose(effect, renderIndex);\r\n }\r\n\r\n /**\r\n * @returns true if the layer contains information to display, otherwise false.\r\n */\r\n public override shouldRender(): boolean {\r\n return this._thinEffectLayer.shouldRender();\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._thinEffectLayer._shouldRenderMesh(mesh);\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 this._thinEffectLayer._canRenderMesh(mesh, material);\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 this._thinEffectLayer._addCustomEffectDefines(defines);\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 this._thinEffectLayer._setEmissiveTextureAndColor(mesh, subMesh, material);\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 highlight layer.\r\n * @param mesh The mesh to exclude from the highlight layer\r\n */\r\n public addExcludedMesh(mesh: Mesh) {\r\n this._thinEffectLayer.addExcludedMesh(mesh);\r\n }\r\n\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.\r\n * @param mesh The mesh to highlight\r\n */\r\n public removeExcludedMesh(mesh: Mesh) {\r\n this._thinEffectLayer.removeExcludedMesh(mesh);\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be highlighted by the current HighlightLayer\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be highlighted by the current HighlightLayer\r\n */\r\n public override hasMesh(mesh: AbstractMesh): boolean {\r\n return this._thinEffectLayer.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Add a mesh in the highlight layer in order to make it glow with the chosen color.\r\n * @param mesh The mesh to highlight\r\n * @param color The color of the highlight\r\n * @param glowEmissiveOnly Extract the glow from the emissive texture\r\n */\r\n public addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly = false) {\r\n this._thinEffectLayer.addMesh(mesh, color, glowEmissiveOnly);\r\n }\r\n\r\n /**\r\n * Remove a mesh from the highlight layer in order to make it stop glowing.\r\n * @param mesh The mesh to highlight\r\n */\r\n public removeMesh(mesh: Mesh) {\r\n this._thinEffectLayer.removeMesh(mesh);\r\n }\r\n\r\n /**\r\n * Remove all the meshes currently referenced in the highlight layer\r\n */\r\n public removeAllMeshes(): void {\r\n this._thinEffectLayer.removeAllMeshes();\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._thinEffectLayer._disposeMesh(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 \"HighlightLayer\";\r\n }\r\n\r\n /**\r\n * Serializes this Highlight layer\r\n * @returns a serialized Highlight layer object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.HighlightLayer\";\r\n\r\n // Highlighted meshes\r\n serializationObject.meshes = [];\r\n\r\n const meshes = this._thinEffectLayer._meshes;\r\n if (meshes) {\r\n for (const m in meshes) {\r\n const mesh = meshes[m];\r\n\r\n if (mesh) {\r\n serializationObject.meshes.push({\r\n glowEmissiveOnly: mesh.glowEmissiveOnly,\r\n color: mesh.color.asArray(),\r\n meshId: mesh.mesh.id,\r\n });\r\n }\r\n }\r\n }\r\n\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n\r\n const excludedMeshes = this._thinEffectLayer._excludedMeshes;\r\n if (excludedMeshes) {\r\n for (const e in excludedMeshes) {\r\n const excludedMesh = excludedMeshes[e];\r\n\r\n if (excludedMesh) {\r\n serializationObject.excludedMeshes.push(excludedMesh.mesh.id);\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Highlight layer from parsed Highlight layer data\r\n * @param parsedHightlightLayer defines the Highlight layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the Highlight layer information\r\n * @returns a parsed Highlight layer\r\n */\r\n public static override Parse(parsedHightlightLayer: any, scene: Scene, rootUrl: string): HighlightLayer {\r\n const hl = SerializationHelper.Parse(() => new HighlightLayer(parsedHightlightLayer.name, scene, parsedHightlightLayer.options), parsedHightlightLayer, scene, rootUrl);\r\n let index;\r\n\r\n // Excluded meshes\r\n for (index = 0; index < parsedHightlightLayer.excludedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedHightlightLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n hl.addExcludedMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n // Included meshes\r\n for (index = 0; index < parsedHightlightLayer.meshes.length; index++) {\r\n const highlightedMesh = parsedHightlightLayer.meshes[index];\r\n const mesh = scene.getMeshById(highlightedMesh.meshId);\r\n\r\n if (mesh) {\r\n hl.addMesh(<Mesh>mesh, Color3.FromArray(highlightedMesh.color), highlightedMesh.glowEmissiveOnly);\r\n }\r\n }\r\n\r\n return hl;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.HighlightLayer\", HighlightLayer);\r\n"]}
1
+ {"version":3,"file":"highlightLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/highlightLayer.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAO/C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yB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I,CAAC,CAAC;YACnC,CAAC;QACL,CAAC;QAED,kBAAkB;QAClB,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACnE,MAAM,eAAe,GAAG,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAEvD,IAAI,IAAI,EAAE,CAAC;gBACP,EAAE,CAAC,OAAO,CAAO,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;YACtG,CAAC;QACL,CAAC;QAED,OAAO,EAAE,CAAC;IACd,CAAC;;AApeD;;GAEG;AACoB,yBAAU,GAAG,gBAAgB,AAAnB,CAAoB;AAkBrD;IADC,SAAS,EAAE;+CAGX;AAUD;IADC,SAAS,EAAE;+CAGX;AAwBD;IADC,SAAS,EAAE;wDAGX;AAMD;IADC,SAAS,EAAE;sDAGX;AAaO;IADP,SAAS,CAAC,SAAS,CAAC;gDAC8B;AAqZvD,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { Observable } from \"../Misc/observable\";\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 type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { PostProcessOptions } from \"../PostProcesses/postProcess\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { PassPostProcess } from \"../PostProcesses/passPostProcess\";\r\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { Color4 } from \"../Maths/math.color\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\n\r\nimport type { ThinPassPostProcess } from \"core/PostProcesses/thinPassPostProcess\";\r\nimport type { ThinBlurPostProcess } from \"core/PostProcesses/thinBlurPostProcess\";\r\nimport type { IThinHighlightLayerOptions } from \"./thinHighlightLayer\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport { ThinHighlightLayer } from \"./thinHighlightLayer\";\r\nimport { ThinGlowBlurPostProcess } from \"./thinEffectLayer\";\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /**\r\n * Return a the first highlight layer of the scene with a given name.\r\n * @param name The name of the highlight layer to look for.\r\n * @returns The highlight layer if found otherwise null.\r\n */\r\n getHighlightLayerByName(name: string): Nullable<HighlightLayer>;\r\n }\r\n}\r\n\r\nScene.prototype.getHighlightLayerByName = function (name: string): Nullable<HighlightLayer> {\r\n for (let index = 0; index < this.effectLayers?.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === HighlightLayer.EffectName) {\r\n return (<any>this.effectLayers[index]) as HighlightLayer;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\ninterface IBlurPostProcess extends PostProcess {\r\n kernel: number;\r\n}\r\n\r\n/**\r\n * Special Glow Blur post process only blurring the alpha channel\r\n * It enforces keeping the most luminous color in the color channel.\r\n */\r\nclass GlowBlurPostProcess extends PostProcess {\r\n protected override _effectWrapper: ThinGlowBlurPostProcess;\r\n\r\n constructor(\r\n name: string,\r\n public direction: Vector2,\r\n public kernel: number,\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera> = null,\r\n samplingMode: number = Texture.BILINEAR_SAMPLINGMODE,\r\n engine?: AbstractEngine,\r\n reusable?: boolean\r\n ) {\r\n const localOptions = {\r\n uniforms: ThinGlowBlurPostProcess.Uniforms,\r\n size: typeof options === \"number\" ? options : undefined,\r\n camera,\r\n samplingMode,\r\n engine,\r\n reusable,\r\n ...(options as PostProcessOptions),\r\n };\r\n\r\n super(name, ThinGlowBlurPostProcess.FragmentUrl, {\r\n effectWrapper: typeof options === \"number\" || !options.effectWrapper ? new ThinGlowBlurPostProcess(name, engine, direction, kernel, localOptions) : undefined,\r\n ...localOptions,\r\n });\r\n\r\n this.onApplyObservable.add(() => {\r\n this._effectWrapper.textureWidth = this.width;\r\n this._effectWrapper.textureHeight = this.height;\r\n });\r\n }\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/glowBlurPostProcess.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/glowBlurPostProcess.fragment\"));\r\n }\r\n\r\n super._gatherImports(useWebGPU, list);\r\n }\r\n}\r\n\r\n/**\r\n * Highlight layer options. This helps customizing the behaviour\r\n * of the highlight layer.\r\n */\r\nexport interface IHighlightLayerOptions extends IThinHighlightLayerOptions {}\r\n\r\n/**\r\n * The highlight layer Helps adding a glow effect around a mesh.\r\n *\r\n * Once instantiated in a scene, simply use the addMesh or removeMesh method to add or remove\r\n * glowy meshes to your scene.\r\n *\r\n * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!\r\n */\r\nexport class HighlightLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the highlight layer.\r\n */\r\n public static readonly EffectName = \"HighlightLayer\";\r\n\r\n /**\r\n * The neutral color used during the preparation of the glow effect.\r\n * This is black by default as the blend operation is a blend operation.\r\n */\r\n public static get NeutralColor() {\r\n return ThinHighlightLayer.NeutralColor;\r\n }\r\n\r\n public static set NeutralColor(value: Color4) {\r\n ThinHighlightLayer.NeutralColor = value;\r\n }\r\n\r\n /**\r\n * Specifies whether or not the inner glow is ACTIVE in the layer.\r\n */\r\n @serialize()\r\n public get innerGlow() {\r\n return this._thinEffectLayer.innerGlow;\r\n }\r\n\r\n public set innerGlow(value: boolean) {\r\n this._thinEffectLayer.innerGlow = value;\r\n }\r\n\r\n /**\r\n * Specifies whether or not the outer glow is ACTIVE in the layer.\r\n */\r\n @serialize()\r\n public get outerGlow() {\r\n return this._thinEffectLayer.outerGlow;\r\n }\r\n\r\n public set outerGlow(value: boolean) {\r\n this._thinEffectLayer.outerGlow = value;\r\n }\r\n\r\n /**\r\n * Specifies the horizontal size of the blur.\r\n */\r\n public set blurHorizontalSize(value: number) {\r\n this._thinEffectLayer.blurHorizontalSize = value;\r\n }\r\n\r\n /**\r\n * Specifies the vertical size of the blur.\r\n */\r\n public set blurVerticalSize(value: number) {\r\n this._thinEffectLayer.blurVerticalSize = value;\r\n }\r\n\r\n /**\r\n * Gets the horizontal size of the blur.\r\n */\r\n @serialize()\r\n public get blurHorizontalSize(): number {\r\n return this._thinEffectLayer.blurHorizontalSize;\r\n }\r\n\r\n /**\r\n * Gets the vertical size of the blur.\r\n */\r\n @serialize()\r\n public get blurVerticalSize(): number {\r\n return this._thinEffectLayer.blurVerticalSize;\r\n }\r\n\r\n /**\r\n * An event triggered when the highlight layer is being blurred.\r\n */\r\n public onBeforeBlurObservable = new Observable<HighlightLayer>();\r\n\r\n /**\r\n * An event triggered when the highlight layer has been blurred.\r\n */\r\n public onAfterBlurObservable = new Observable<HighlightLayer>();\r\n\r\n @serialize(\"options\")\r\n private _options: Required<IHighlightLayerOptions>;\r\n\r\n protected override readonly _thinEffectLayer: ThinHighlightLayer;\r\n private _downSamplePostprocess: PassPostProcess;\r\n private _horizontalBlurPostprocess: IBlurPostProcess;\r\n private _verticalBlurPostprocess: IBlurPostProcess;\r\n private _blurTexture: RenderTargetTexture;\r\n\r\n /**\r\n * Instantiates a new highlight 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 IHighlightLayerOptions for more information)\r\n */\r\n constructor(name: string, scene?: Scene, options?: Partial<IHighlightLayerOptions>) {\r\n super(name, scene, options !== undefined ? !!options.forceGLSL : false, new ThinHighlightLayer(name, scene, options));\r\n\r\n // Warn on stencil\r\n if (!this._engine.isStencilEnable) {\r\n Logger.Warn(\"Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }\");\r\n }\r\n\r\n // Adapt options\r\n this._options = {\r\n mainTextureRatio: 0.5,\r\n blurTextureSizeRatio: 0.5,\r\n mainTextureFixedSize: 0,\r\n blurHorizontalSize: 1.0,\r\n blurVerticalSize: 1.0,\r\n alphaBlendingMode: Constants.ALPHA_COMBINE,\r\n camera: null,\r\n renderingGroupId: -1,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n forceGLSL: false,\r\n isStroke: false,\r\n ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init(this._options);\r\n\r\n // Do not render as long as no meshes have been added\r\n this._shouldRender = false;\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 HighlightLayer.EffectName;\r\n }\r\n\r\n protected override _numInternalDraws(): number {\r\n return 2; // we need two rendering, one for the inner glow and the other for the outer glow\r\n }\r\n\r\n /**\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 * @returns The effect created\r\n */\r\n protected _createMergeEffect(): Effect {\r\n return this._thinEffectLayer._createMergeEffect();\r\n }\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the highlight layer.\r\n */\r\n protected _createTextureAndPostProcesses(): void {\r\n let blurTextureWidth = this._mainTextureDesiredSize.width * this._options.blurTextureSizeRatio;\r\n let blurTextureHeight = this._mainTextureDesiredSize.height * this._options.blurTextureSizeRatio;\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_BYTE;\r\n }\r\n\r\n this._blurTexture = new RenderTargetTexture(\r\n \"HighlightLayerBlurRTT\",\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._blurTexture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture.anisotropicFilteringLevel = 16;\r\n this._blurTexture.updateSamplingMode(Texture.TRILINEAR_SAMPLINGMODE);\r\n this._blurTexture.renderParticles = false;\r\n this._blurTexture.ignoreCameraViewport = true;\r\n\r\n this._textures = [this._blurTexture];\r\n\r\n this._thinEffectLayer.bindTexturesForCompose = (effect: Effect) => {\r\n effect.setTexture(\"textureSampler\", this._blurTexture);\r\n };\r\n\r\n this._thinEffectLayer._createTextureAndPostProcesses();\r\n\r\n if (this._options.alphaBlendingMode === Constants.ALPHA_COMBINE) {\r\n this._downSamplePostprocess = new PassPostProcess(\"HighlightLayerPPP\", {\r\n size: this._options.blurTextureSizeRatio,\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n effectWrapper: this._thinEffectLayer._postProcesses[0] as ThinPassPostProcess,\r\n });\r\n this._downSamplePostprocess.externalTextureSamplerBinding = true;\r\n this._downSamplePostprocess.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._mainTexture);\r\n });\r\n\r\n this._horizontalBlurPostprocess = new GlowBlurPostProcess(\"HighlightLayerHBP\", new Vector2(1.0, 0), this._options.blurHorizontalSize, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n effectWrapper: this._thinEffectLayer._postProcesses[1] as ThinGlowBlurPostProcess,\r\n });\r\n this._horizontalBlurPostprocess.onApplyObservable.add((effect) => {\r\n effect.setFloat2(\"screenSize\", blurTextureWidth, blurTextureHeight);\r\n });\r\n\r\n this._verticalBlurPostprocess = new GlowBlurPostProcess(\"HighlightLayerVBP\", new Vector2(0, 1.0), this._options.blurVerticalSize, {\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n effectWrapper: this._thinEffectLayer._postProcesses[2] as ThinGlowBlurPostProcess,\r\n });\r\n this._verticalBlurPostprocess.onApplyObservable.add((effect) => {\r\n effect.setFloat2(\"screenSize\", blurTextureWidth, blurTextureHeight);\r\n });\r\n\r\n this._postProcesses = [this._downSamplePostprocess, this._horizontalBlurPostprocess, this._verticalBlurPostprocess];\r\n } else {\r\n this._horizontalBlurPostprocess = new BlurPostProcess(\"HighlightLayerHBP\", new Vector2(1.0, 0), this._options.blurHorizontalSize / 2, {\r\n size: {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n textureType,\r\n effectWrapper: this._thinEffectLayer._postProcesses[0] as ThinBlurPostProcess,\r\n });\r\n this._horizontalBlurPostprocess.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._mainTexture);\r\n });\r\n\r\n this._verticalBlurPostprocess = new BlurPostProcess(\"HighlightLayerVBP\", new Vector2(0, 1.0), this._options.blurVerticalSize / 2, {\r\n size: {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n samplingMode: Texture.BILINEAR_SAMPLINGMODE,\r\n engine: this._scene.getEngine(),\r\n textureType,\r\n });\r\n\r\n this._postProcesses = [this._horizontalBlurPostprocess, this._verticalBlurPostprocess];\r\n }\r\n\r\n this._mainTexture.onAfterUnbindObservable.add(() => {\r\n this.onBeforeBlurObservable.notifyObservers(this);\r\n\r\n const internalTexture = this._blurTexture.renderTarget;\r\n if (internalTexture) {\r\n this._scene.postProcessManager.directRender(this._postProcesses, internalTexture, true);\r\n this._engine.unBindFramebuffer(internalTexture, true);\r\n }\r\n\r\n this.onAfterBlurObservable.notifyObservers(this);\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 this._mainTextureCreatedSize.width = this._mainTextureDesiredSize.width;\r\n this._mainTextureCreatedSize.height = this._mainTextureDesiredSize.height;\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 this._thinEffectLayer.needStencil();\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 return this._thinEffectLayer.isReady(subMesh, useInstances);\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 * @param renderIndex\r\n */\r\n protected _internalRender(effect: Effect, renderIndex: number): void {\r\n this._thinEffectLayer._internalCompose(effect, renderIndex);\r\n }\r\n\r\n /**\r\n * @returns true if the layer contains information to display, otherwise false.\r\n */\r\n public override shouldRender(): boolean {\r\n return this._thinEffectLayer.shouldRender();\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._thinEffectLayer._shouldRenderMesh(mesh);\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 this._thinEffectLayer._canRenderMesh(mesh, material);\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 this._thinEffectLayer._addCustomEffectDefines(defines);\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 this._thinEffectLayer._setEmissiveTextureAndColor(mesh, subMesh, material);\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 highlight layer.\r\n * @param mesh The mesh to exclude from the highlight layer\r\n */\r\n public addExcludedMesh(mesh: Mesh) {\r\n this._thinEffectLayer.addExcludedMesh(mesh);\r\n }\r\n\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.\r\n * @param mesh The mesh to highlight\r\n */\r\n public removeExcludedMesh(mesh: Mesh) {\r\n this._thinEffectLayer.removeExcludedMesh(mesh);\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be highlighted by the current HighlightLayer\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be highlighted by the current HighlightLayer\r\n */\r\n public override hasMesh(mesh: AbstractMesh): boolean {\r\n return this._thinEffectLayer.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Add a mesh in the highlight layer in order to make it glow with the chosen color.\r\n * @param mesh The mesh to highlight\r\n * @param color The color of the highlight\r\n * @param glowEmissiveOnly Extract the glow from the emissive texture\r\n */\r\n public addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly = false) {\r\n this._thinEffectLayer.addMesh(mesh, color, glowEmissiveOnly);\r\n }\r\n\r\n /**\r\n * Remove a mesh from the highlight layer in order to make it stop glowing.\r\n * @param mesh The mesh to highlight\r\n */\r\n public removeMesh(mesh: Mesh) {\r\n this._thinEffectLayer.removeMesh(mesh);\r\n }\r\n\r\n /**\r\n * Remove all the meshes currently referenced in the highlight layer\r\n */\r\n public removeAllMeshes(): void {\r\n this._thinEffectLayer.removeAllMeshes();\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._thinEffectLayer._disposeMesh(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 \"HighlightLayer\";\r\n }\r\n\r\n /**\r\n * Serializes this Highlight layer\r\n * @returns a serialized Highlight layer object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.HighlightLayer\";\r\n\r\n // Highlighted meshes\r\n serializationObject.meshes = [];\r\n\r\n const meshes = this._thinEffectLayer._meshes;\r\n if (meshes) {\r\n for (const m in meshes) {\r\n const mesh = meshes[m];\r\n\r\n if (mesh) {\r\n serializationObject.meshes.push({\r\n glowEmissiveOnly: mesh.glowEmissiveOnly,\r\n color: mesh.color.asArray(),\r\n meshId: mesh.mesh.id,\r\n });\r\n }\r\n }\r\n }\r\n\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n\r\n const excludedMeshes = this._thinEffectLayer._excludedMeshes;\r\n if (excludedMeshes) {\r\n for (const e in excludedMeshes) {\r\n const excludedMesh = excludedMeshes[e];\r\n\r\n if (excludedMesh) {\r\n serializationObject.excludedMeshes.push(excludedMesh.mesh.id);\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Highlight layer from parsed Highlight layer data\r\n * @param parsedHightlightLayer defines the Highlight layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the Highlight layer information\r\n * @returns a parsed Highlight layer\r\n */\r\n public static override Parse(parsedHightlightLayer: any, scene: Scene, rootUrl: string): HighlightLayer {\r\n const hl = SerializationHelper.Parse(() => new HighlightLayer(parsedHightlightLayer.name, scene, parsedHightlightLayer.options), parsedHightlightLayer, scene, rootUrl);\r\n let index;\r\n\r\n // Excluded meshes\r\n for (index = 0; index < parsedHightlightLayer.excludedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedHightlightLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n hl.addExcludedMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n // Included meshes\r\n for (index = 0; index < parsedHightlightLayer.meshes.length; index++) {\r\n const highlightedMesh = parsedHightlightLayer.meshes[index];\r\n const mesh = scene.getMeshById(highlightedMesh.meshId);\r\n\r\n if (mesh) {\r\n hl.addMesh(<Mesh>mesh, Color3.FromArray(highlightedMesh.color), highlightedMesh.glowEmissiveOnly);\r\n }\r\n }\r\n\r\n return hl;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.HighlightLayer\", HighlightLayer);\r\n"]}
@@ -7,6 +7,7 @@ import type { Matrix } from "../../Maths/math.vector.js";
7
7
  import type { GaussianSplattingMesh } from "../../Meshes/GaussianSplatting/gaussianSplattingMesh.js";
8
8
  import { PushMaterial } from "../../Materials/pushMaterial.js";
9
9
  import { ShadowDepthWrapper } from "../../Materials/shadowDepthWrapper.js";
10
+ import { ShaderMaterial } from "../../Materials/shaderMaterial.js";
10
11
  import "../../Shaders/gaussianSplatting.fragment.js";
11
12
  import "../../Shaders/gaussianSplatting.vertex.js";
12
13
  import "../../ShadersWGSL/gaussianSplatting.fragment.js";
@@ -94,6 +95,14 @@ export declare class GaussianSplattingMaterial extends PushMaterial {
94
95
  * @param subMesh defines the submesh to bind the material to
95
96
  */
96
97
  bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
98
+ protected static _BindEffectUniforms(gsMesh: GaussianSplattingMesh, gsMaterial: GaussianSplattingMaterial, shaderMaterial: ShaderMaterial, scene: Scene): void;
99
+ /**
100
+ * Create a depth rendering material for a Gaussian Splatting mesh
101
+ * @param scene scene it belongs to
102
+ * @param shaderLanguage GLSL or WGSL
103
+ * @returns depth rendering shader material
104
+ */
105
+ makeDepthRenderingMaterial(scene: Scene, shaderLanguage: ShaderLanguage): ShaderMaterial;
97
106
  protected static _MakeGaussianSplattingShadowDepthWrapper(scene: Scene, shaderLanguage: ShaderLanguage): ShadowDepthWrapper;
98
107
  /**
99
108
  * Clones the material.
@@ -226,7 +226,6 @@ export class GaussianSplattingMaterial extends PushMaterial {
226
226
  }
227
227
  }
228
228
  effect.setFloat2("focal", focal, focal);
229
- effect.setVector3("viewDirectionFactor", gsMesh.viewDirectionFactor);
230
229
  effect.setFloat("kernelSize", gsMaterial && gsMaterial.kernelSize ? gsMaterial.kernelSize : GaussianSplattingMaterial.KernelSize);
231
230
  effect.setFloat("alpha", gsMaterial.alpha);
232
231
  scene.bindEyePosition(effect, "eyePosition", true);
@@ -284,6 +283,70 @@ export class GaussianSplattingMaterial extends PushMaterial {
284
283
  }
285
284
  this._afterBind(mesh, this._activeEffect, subMesh);
286
285
  }
286
+ static _BindEffectUniforms(gsMesh, gsMaterial, shaderMaterial, scene) {
287
+ const engine = scene.getEngine();
288
+ const effect = shaderMaterial.getEffect();
289
+ gsMesh.getMeshUniformBuffer().bindToEffect(effect, "Mesh");
290
+ shaderMaterial.bindView(effect);
291
+ shaderMaterial.bindViewProjection(effect);
292
+ const renderWidth = engine.getRenderWidth();
293
+ const renderHeight = engine.getRenderHeight();
294
+ effect.setFloat2("invViewport", 1 / renderWidth, 1 / renderHeight);
295
+ const projection = scene.getProjectionMatrix();
296
+ const t = projection.m[5];
297
+ const focal = (renderWidth * t) / 2.0;
298
+ effect.setFloat2("focal", focal, focal);
299
+ effect.setFloat("kernelSize", gsMaterial && gsMaterial.kernelSize ? gsMaterial.kernelSize : GaussianSplattingMaterial.KernelSize);
300
+ effect.setFloat("alpha", gsMaterial.alpha);
301
+ let minZ, maxZ;
302
+ const camera = scene.activeCamera;
303
+ if (!camera) {
304
+ return;
305
+ }
306
+ const cameraIsOrtho = camera.mode === Camera.ORTHOGRAPHIC_CAMERA;
307
+ if (cameraIsOrtho) {
308
+ minZ = !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;
309
+ maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;
310
+ }
311
+ else {
312
+ minZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? camera.minZ : engine.isNDCHalfZRange ? 0 : camera.minZ;
313
+ maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : camera.maxZ;
314
+ }
315
+ effect.setFloat2("depthValues", minZ, minZ + maxZ);
316
+ if (gsMesh.covariancesATexture) {
317
+ const textureSize = gsMesh.covariancesATexture.getSize();
318
+ effect.setFloat2("dataTextureSize", textureSize.width, textureSize.height);
319
+ effect.setTexture("covariancesATexture", gsMesh.covariancesATexture);
320
+ effect.setTexture("covariancesBTexture", gsMesh.covariancesBTexture);
321
+ effect.setTexture("centersTexture", gsMesh.centersTexture);
322
+ effect.setTexture("colorsTexture", gsMesh.colorsTexture);
323
+ }
324
+ }
325
+ /**
326
+ * Create a depth rendering material for a Gaussian Splatting mesh
327
+ * @param scene scene it belongs to
328
+ * @param shaderLanguage GLSL or WGSL
329
+ * @returns depth rendering shader material
330
+ */
331
+ makeDepthRenderingMaterial(scene, shaderLanguage) {
332
+ const shaderMaterial = new ShaderMaterial("gaussianSplattingDepthRender", scene, {
333
+ vertex: "gaussianSplattingDepth",
334
+ fragment: "gaussianSplattingDepth",
335
+ }, {
336
+ attributes: GaussianSplattingMaterial._Attribs,
337
+ uniforms: GaussianSplattingMaterial._Uniforms,
338
+ samplers: GaussianSplattingMaterial._Samplers,
339
+ uniformBuffers: GaussianSplattingMaterial._UniformBuffers,
340
+ shaderLanguage: shaderLanguage,
341
+ defines: ["#define DEPTH_RENDER"],
342
+ });
343
+ shaderMaterial.onBindObservable.add((mesh) => {
344
+ const gsMaterial = mesh.material;
345
+ const gsMesh = mesh;
346
+ GaussianSplattingMaterial._BindEffectUniforms(gsMesh, gsMaterial, shaderMaterial, scene);
347
+ });
348
+ return shaderMaterial;
349
+ }
287
350
  static _MakeGaussianSplattingShadowDepthWrapper(scene, shaderLanguage) {
288
351
  const shaderMaterial = new ShaderMaterial("gaussianSplattingDepth", scene, {
289
352
  vertex: "gaussianSplattingDepth",
@@ -299,28 +362,9 @@ export class GaussianSplattingMaterial extends PushMaterial {
299
362
  standalone: true,
300
363
  });
301
364
  shaderMaterial.onBindObservable.add((mesh) => {
302
- const effect = shaderMaterial.getEffect();
303
365
  const gsMaterial = mesh.material;
304
366
  const gsMesh = mesh;
305
- mesh.getMeshUniformBuffer().bindToEffect(effect, "Mesh");
306
- shaderMaterial.bindView(effect);
307
- shaderMaterial.bindViewProjection(effect);
308
- const shadowmapWidth = scene.getEngine().getRenderWidth();
309
- const shadowmapHeight = scene.getEngine().getRenderHeight();
310
- effect.setFloat2("invViewport", 1 / shadowmapWidth, 1 / shadowmapHeight);
311
- const projection = scene.getProjectionMatrix();
312
- const t = projection.m[5];
313
- const focal = (shadowmapWidth * t) / 2.0;
314
- effect.setFloat2("focal", focal, focal);
315
- effect.setFloat("kernelSize", gsMaterial && gsMaterial.kernelSize ? gsMaterial.kernelSize : GaussianSplattingMaterial.KernelSize);
316
- if (gsMesh.covariancesATexture) {
317
- const textureSize = gsMesh.covariancesATexture.getSize();
318
- effect.setFloat2("dataTextureSize", textureSize.width, textureSize.height);
319
- effect.setTexture("covariancesATexture", gsMesh.covariancesATexture);
320
- effect.setTexture("covariancesBTexture", gsMesh.covariancesBTexture);
321
- effect.setTexture("centersTexture", gsMesh.centersTexture);
322
- effect.setTexture("colorsTexture", gsMesh.colorsTexture);
323
- }
367
+ GaussianSplattingMaterial._BindEffectUniforms(gsMesh, gsMaterial, shaderMaterial, scene);
324
368
  });
325
369
  return shadowDepthWrapper;
326
370
  }
@@ -382,8 +426,8 @@ GaussianSplattingMaterial._Uniforms = [
382
426
  "focal",
383
427
  "eyePosition",
384
428
  "kernelSize",
385
- "viewDirectionFactor",
386
429
  "alpha",
430
+ "depthValues",
387
431
  ];
388
432
  RegisterClass("BABYLON.GaussianSplattingMaterial", GaussianSplattingMaterial);
389
433
  //# sourceMappingURL=gaussianSplattingMaterial.js.map