@babylonjs/core 7.44.0 → 7.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Debug/debugLayer.d.ts +4 -0
- package/Debug/debugLayer.js +9 -0
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +2 -4
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -4
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/abstractEngine.d.ts +19 -1
- package/Engines/abstractEngine.js +48 -9
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +1 -1
- package/Engines/engine.js +2 -20
- package/Engines/engine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +2 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +1 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.d.ts +16 -12
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +63 -27
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.d.ts +72 -0
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +197 -0
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +4 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +9 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +4 -2
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +2 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +3 -2
- package/FrameGraph/Node/nodeRenderGraph.js +4 -3
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +4 -4
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.d.ts +8 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.d.ts +21 -0
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.js +31 -0
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.js.map +1 -0
- package/FrameGraph/Passes/pass.d.ts +1 -0
- package/FrameGraph/Passes/pass.js +4 -1
- package/FrameGraph/Passes/pass.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +81 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +304 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.d.ts +3 -40
- package/FrameGraph/Tasks/Layers/glowLayerTask.js +4 -158
- package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.d.ts +21 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js +32 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.d.ts +2 -2
- package/FrameGraph/Tasks/Misc/executeTask.js +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +5 -4
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +5 -4
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +2 -4
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +1 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +1 -0
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +2 -2
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +1 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +8 -2
- package/FrameGraph/frameGraph.js +31 -5
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +10 -0
- package/FrameGraph/frameGraphRenderContext.js +14 -0
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +3 -2
- package/FrameGraph/frameGraphTask.js +12 -2
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTypes.d.ts +4 -0
- package/FrameGraph/frameGraphTypes.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Helpers/environmentHelper.js +7 -6
- package/Helpers/environmentHelper.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +2 -14
- package/Layers/glowLayer.js +34 -36
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +13 -74
- package/Layers/highlightLayer.js +123 -309
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/index.d.ts +1 -0
- package/Layers/index.js +1 -0
- package/Layers/index.js.map +1 -1
- package/Layers/thinEffectLayer.d.ts +55 -2
- package/Layers/thinEffectLayer.js +66 -0
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Layers/thinGlowLayer.d.ts +3 -6
- package/Layers/thinGlowLayer.js +4 -1
- package/Layers/thinGlowLayer.js.map +1 -1
- package/Layers/thinHighlightLayer.d.ts +197 -0
- package/Layers/thinHighlightLayer.js +417 -0
- package/Layers/thinHighlightLayer.js.map +1 -0
- package/Materials/Node/nodeMaterial.js +2 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/effect.d.ts +5 -0
- package/Materials/effect.js +15 -0
- package/Materials/effect.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +4 -2
- package/Meshes/Compression/dracoCompression.js +24 -11
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/dracoCompressionWorker.js +4 -4
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.d.ts +5 -1
- package/Meshes/Compression/dracoEncoder.js +23 -17
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.types.d.ts +4 -4
- package/Meshes/Compression/dracoEncoder.types.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +17 -2
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/Compression/test/integration/draco.test.d.ts +1 -0
- package/Meshes/Compression/test/integration/draco.test.js +30 -0
- package/Meshes/Compression/test/integration/draco.test.js.map +1 -0
- package/Meshes/csg.js +4 -0
- package/Meshes/csg.js.map +1 -1
- package/Meshes/transformNode.d.ts +4 -1
- package/Meshes/transformNode.js +4 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/copyTextureToTexture.js +1 -1
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/screenshotTools.js +58 -5
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/tools.d.ts +21 -1
- package/Misc/tools.js +33 -0
- package/Misc/tools.js.map +1 -1
- package/Particles/particleHelper.js +2 -1
- package/Particles/particleHelper.js.map +1 -1
- package/Particles/particleSystemSet.d.ts +1 -0
- package/Particles/particleSystemSet.js +1 -0
- package/Particles/particleSystemSet.js.map +1 -1
- package/Particles/webgl2ParticleSystem.d.ts +1 -1
- package/Particles/webgl2ParticleSystem.js +1 -2
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/Rendering/depthRenderer.js +1 -1
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +5 -3
- package/Rendering/objectRenderer.js +5 -3
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/renderingManager.d.ts +4 -0
- package/Rendering/renderingManager.js +1 -0
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/ShadersInclude/intersectionFunctions.d.ts +5 -0
- package/Shaders/ShadersInclude/intersectionFunctions.js +14 -0
- package/Shaders/ShadersInclude/intersectionFunctions.js.map +1 -0
- package/Shaders/background.fragment.d.ts +1 -0
- package/Shaders/background.fragment.js +3 -5
- package/Shaders/background.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.js +14 -0
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.js.map +1 -0
- package/ShadersWGSL/background.fragment.d.ts +1 -0
- package/ShadersWGSL/background.fragment.js +3 -5
- package/ShadersWGSL/background.fragment.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +8 -7
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +4 -0
- package/types.js.map +1 -1
package/Layers/glowLayer.js
CHANGED
|
@@ -38,43 +38,43 @@ export class GlowLayer extends EffectLayer {
|
|
|
38
38
|
* Sets the kernel size of the blur.
|
|
39
39
|
*/
|
|
40
40
|
set blurKernelSize(value) {
|
|
41
|
-
this.
|
|
41
|
+
this._thinEffectLayer.blurKernelSize = value;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Gets the kernel size of the blur.
|
|
45
45
|
*/
|
|
46
46
|
get blurKernelSize() {
|
|
47
|
-
return this.
|
|
47
|
+
return this._thinEffectLayer.blurKernelSize;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Sets the glow intensity.
|
|
51
51
|
*/
|
|
52
52
|
set intensity(value) {
|
|
53
|
-
this.
|
|
53
|
+
this._thinEffectLayer.intensity = value;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Gets the glow intensity.
|
|
57
57
|
*/
|
|
58
58
|
get intensity() {
|
|
59
|
-
return this.
|
|
59
|
+
return this._thinEffectLayer.intensity;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Callback used to let the user override the color selection on a per mesh basis
|
|
63
63
|
*/
|
|
64
64
|
get customEmissiveColorSelector() {
|
|
65
|
-
return this.
|
|
65
|
+
return this._thinEffectLayer.customEmissiveColorSelector;
|
|
66
66
|
}
|
|
67
67
|
set customEmissiveColorSelector(value) {
|
|
68
|
-
this.
|
|
68
|
+
this._thinEffectLayer.customEmissiveColorSelector = value;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Callback used to let the user override the texture selection on a per mesh basis
|
|
72
72
|
*/
|
|
73
73
|
get customEmissiveTextureSelector() {
|
|
74
|
-
return this.
|
|
74
|
+
return this._thinEffectLayer.customEmissiveTextureSelector;
|
|
75
75
|
}
|
|
76
76
|
set customEmissiveTextureSelector(value) {
|
|
77
|
-
this.
|
|
77
|
+
this._thinEffectLayer.customEmissiveTextureSelector = value;
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Instantiates a new glow Layer and references it to the scene.
|
|
@@ -83,9 +83,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
83
83
|
* @param options Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)
|
|
84
84
|
*/
|
|
85
85
|
constructor(name, scene, options) {
|
|
86
|
-
|
|
87
|
-
super(name, scene, false, thinGlowLayer);
|
|
88
|
-
this._thinGlowLayer = thinGlowLayer;
|
|
86
|
+
super(name, scene, false, new ThinGlowLayer(name, scene, options));
|
|
89
87
|
// Adapt options
|
|
90
88
|
this._options = {
|
|
91
89
|
mainTextureRatio: GlowLayer.DefaultTextureRatio,
|
|
@@ -116,13 +114,13 @@ export class GlowLayer extends EffectLayer {
|
|
|
116
114
|
* to the main canvas at the end of the scene rendering.
|
|
117
115
|
*/
|
|
118
116
|
_createMergeEffect() {
|
|
119
|
-
return this.
|
|
117
|
+
return this._thinEffectLayer._createMergeEffect();
|
|
120
118
|
}
|
|
121
119
|
/**
|
|
122
120
|
* Creates the render target textures and post processes used in the glow layer.
|
|
123
121
|
*/
|
|
124
122
|
_createTextureAndPostProcesses() {
|
|
125
|
-
this.
|
|
123
|
+
this._thinEffectLayer._renderPassId = this._mainTexture.renderPassId;
|
|
126
124
|
let blurTextureWidth = this._mainTextureDesiredSize.width;
|
|
127
125
|
let blurTextureHeight = this._mainTextureDesiredSize.height;
|
|
128
126
|
blurTextureWidth = this._engine.needPOTTextures ? GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;
|
|
@@ -155,13 +153,13 @@ export class GlowLayer extends EffectLayer {
|
|
|
155
153
|
this._blurTexture2.renderParticles = false;
|
|
156
154
|
this._blurTexture2.ignoreCameraViewport = true;
|
|
157
155
|
this._textures = [this._blurTexture1, this._blurTexture2];
|
|
158
|
-
this.
|
|
156
|
+
this._thinEffectLayer.bindTexturesForCompose = (effect) => {
|
|
159
157
|
effect.setTexture("textureSampler", this._blurTexture1);
|
|
160
158
|
effect.setTexture("textureSampler2", this._blurTexture2);
|
|
161
159
|
effect.setFloat("offset", this.intensity);
|
|
162
160
|
};
|
|
163
|
-
this.
|
|
164
|
-
const thinBlurPostProcesses1 = this.
|
|
161
|
+
this._thinEffectLayer._createTextureAndPostProcesses();
|
|
162
|
+
const thinBlurPostProcesses1 = this._thinEffectLayer._postProcesses[0];
|
|
165
163
|
this._horizontalBlurPostprocess1 = new BlurPostProcess("GlowLayerHBP1", thinBlurPostProcesses1.direction, thinBlurPostProcesses1.kernel, {
|
|
166
164
|
samplingMode: Texture.BILINEAR_SAMPLINGMODE,
|
|
167
165
|
engine: this._scene.getEngine(),
|
|
@@ -176,7 +174,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
176
174
|
this._horizontalBlurPostprocess1.onApplyObservable.add((effect) => {
|
|
177
175
|
effect.setTexture("textureSampler", this._mainTexture);
|
|
178
176
|
});
|
|
179
|
-
const thinBlurPostProcesses2 = this.
|
|
177
|
+
const thinBlurPostProcesses2 = this._thinEffectLayer._postProcesses[1];
|
|
180
178
|
this._verticalBlurPostprocess1 = new BlurPostProcess("GlowLayerVBP1", thinBlurPostProcesses2.direction, thinBlurPostProcesses2.kernel, {
|
|
181
179
|
samplingMode: Texture.BILINEAR_SAMPLINGMODE,
|
|
182
180
|
engine: this._scene.getEngine(),
|
|
@@ -185,7 +183,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
185
183
|
textureType,
|
|
186
184
|
effectWrapper: thinBlurPostProcesses2,
|
|
187
185
|
});
|
|
188
|
-
const thinBlurPostProcesses3 = this.
|
|
186
|
+
const thinBlurPostProcesses3 = this._thinEffectLayer._postProcesses[2];
|
|
189
187
|
this._horizontalBlurPostprocess2 = new BlurPostProcess("GlowLayerHBP2", thinBlurPostProcesses3.direction, thinBlurPostProcesses3.kernel, {
|
|
190
188
|
samplingMode: Texture.BILINEAR_SAMPLINGMODE,
|
|
191
189
|
engine: this._scene.getEngine(),
|
|
@@ -200,7 +198,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
200
198
|
this._horizontalBlurPostprocess2.onApplyObservable.add((effect) => {
|
|
201
199
|
effect.setTexture("textureSampler", this._blurTexture1);
|
|
202
200
|
});
|
|
203
|
-
const thinBlurPostProcesses4 = this.
|
|
201
|
+
const thinBlurPostProcesses4 = this._thinEffectLayer._postProcesses[3];
|
|
204
202
|
this._verticalBlurPostprocess2 = new BlurPostProcess("GlowLayerVBP2", thinBlurPostProcesses4.direction, thinBlurPostProcesses4.kernel, {
|
|
205
203
|
samplingMode: Texture.BILINEAR_SAMPLINGMODE,
|
|
206
204
|
engine: this._scene.getEngine(),
|
|
@@ -236,7 +234,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
236
234
|
* @returns true if ready otherwise, false
|
|
237
235
|
*/
|
|
238
236
|
isReady(subMesh, useInstances) {
|
|
239
|
-
return this.
|
|
237
|
+
return this._thinEffectLayer.isReady(subMesh, useInstances);
|
|
240
238
|
}
|
|
241
239
|
/**
|
|
242
240
|
* @returns whether or not the layer needs stencil enabled during the mesh rendering.
|
|
@@ -251,14 +249,14 @@ export class GlowLayer extends EffectLayer {
|
|
|
251
249
|
* @returns true if it can be rendered otherwise false
|
|
252
250
|
*/
|
|
253
251
|
_canRenderMesh(mesh, material) {
|
|
254
|
-
return this.
|
|
252
|
+
return this._thinEffectLayer._canRenderMesh(mesh, material);
|
|
255
253
|
}
|
|
256
254
|
/**
|
|
257
255
|
* Implementation specific of rendering the generating effect on the main canvas.
|
|
258
256
|
* @param effect The effect used to render through
|
|
259
257
|
*/
|
|
260
258
|
_internalRender(effect) {
|
|
261
|
-
this.
|
|
259
|
+
this._thinEffectLayer._internalCompose(effect);
|
|
262
260
|
}
|
|
263
261
|
/**
|
|
264
262
|
* Sets the required values for both the emissive texture and and the main color.
|
|
@@ -267,7 +265,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
267
265
|
* @param material
|
|
268
266
|
*/
|
|
269
267
|
_setEmissiveTextureAndColor(mesh, subMesh, material) {
|
|
270
|
-
this.
|
|
268
|
+
this._thinEffectLayer._setEmissiveTextureAndColor(mesh, subMesh, material);
|
|
271
269
|
}
|
|
272
270
|
/**
|
|
273
271
|
* Returns true if the mesh should render, otherwise false.
|
|
@@ -275,42 +273,42 @@ export class GlowLayer extends EffectLayer {
|
|
|
275
273
|
* @returns true if it should render otherwise false
|
|
276
274
|
*/
|
|
277
275
|
_shouldRenderMesh(mesh) {
|
|
278
|
-
return this.
|
|
276
|
+
return this._thinEffectLayer._shouldRenderMesh(mesh);
|
|
279
277
|
}
|
|
280
278
|
/**
|
|
281
279
|
* Adds specific effects defines.
|
|
282
280
|
* @param defines The defines to add specifics to.
|
|
283
281
|
*/
|
|
284
282
|
_addCustomEffectDefines(defines) {
|
|
285
|
-
this.
|
|
283
|
+
this._thinEffectLayer._addCustomEffectDefines(defines);
|
|
286
284
|
}
|
|
287
285
|
/**
|
|
288
286
|
* Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.
|
|
289
287
|
* @param mesh The mesh to exclude from the glow layer
|
|
290
288
|
*/
|
|
291
289
|
addExcludedMesh(mesh) {
|
|
292
|
-
this.
|
|
290
|
+
this._thinEffectLayer.addExcludedMesh(mesh);
|
|
293
291
|
}
|
|
294
292
|
/**
|
|
295
293
|
* Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.
|
|
296
294
|
* @param mesh The mesh to remove
|
|
297
295
|
*/
|
|
298
296
|
removeExcludedMesh(mesh) {
|
|
299
|
-
this.
|
|
297
|
+
this._thinEffectLayer.removeExcludedMesh(mesh);
|
|
300
298
|
}
|
|
301
299
|
/**
|
|
302
300
|
* Add a mesh in the inclusion list to impact or being impacted by the glow layer.
|
|
303
301
|
* @param mesh The mesh to include in the glow layer
|
|
304
302
|
*/
|
|
305
303
|
addIncludedOnlyMesh(mesh) {
|
|
306
|
-
this.
|
|
304
|
+
this._thinEffectLayer.addIncludedOnlyMesh(mesh);
|
|
307
305
|
}
|
|
308
306
|
/**
|
|
309
307
|
* Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.
|
|
310
308
|
* @param mesh The mesh to remove
|
|
311
309
|
*/
|
|
312
310
|
removeIncludedOnlyMesh(mesh) {
|
|
313
|
-
this.
|
|
311
|
+
this._thinEffectLayer.removeIncludedOnlyMesh(mesh);
|
|
314
312
|
}
|
|
315
313
|
/**
|
|
316
314
|
* Determine if a given mesh will be used in the glow layer
|
|
@@ -318,7 +316,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
318
316
|
* @returns true if the mesh will be highlighted by the current glow layer
|
|
319
317
|
*/
|
|
320
318
|
hasMesh(mesh) {
|
|
321
|
-
return this.
|
|
319
|
+
return this._thinEffectLayer.hasMesh(mesh);
|
|
322
320
|
}
|
|
323
321
|
/**
|
|
324
322
|
* Defines whether the current material of the mesh should be use to render the effect.
|
|
@@ -326,21 +324,21 @@ export class GlowLayer extends EffectLayer {
|
|
|
326
324
|
* @returns true if the material of the mesh should be use to render the effect
|
|
327
325
|
*/
|
|
328
326
|
_useMeshMaterial(mesh) {
|
|
329
|
-
return this.
|
|
327
|
+
return this._thinEffectLayer._useMeshMaterial(mesh);
|
|
330
328
|
}
|
|
331
329
|
/**
|
|
332
330
|
* Add a mesh to be rendered through its own material and not with emissive only.
|
|
333
331
|
* @param mesh The mesh for which we need to use its material
|
|
334
332
|
*/
|
|
335
333
|
referenceMeshToUseItsOwnMaterial(mesh) {
|
|
336
|
-
this.
|
|
334
|
+
this._thinEffectLayer.referenceMeshToUseItsOwnMaterial(mesh);
|
|
337
335
|
}
|
|
338
336
|
/**
|
|
339
337
|
* Remove a mesh from being rendered through its own material and not with emissive only.
|
|
340
338
|
* @param mesh The mesh for which we need to not use its material
|
|
341
339
|
*/
|
|
342
340
|
unReferenceMeshFromUsingItsOwnMaterial(mesh) {
|
|
343
|
-
this.
|
|
341
|
+
this._thinEffectLayer.unReferenceMeshFromUsingItsOwnMaterial(mesh, this._mainTexture.renderPassId);
|
|
344
342
|
}
|
|
345
343
|
/**
|
|
346
344
|
* Free any resources and references associated to a mesh.
|
|
@@ -349,7 +347,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
349
347
|
* @internal
|
|
350
348
|
*/
|
|
351
349
|
_disposeMesh(mesh) {
|
|
352
|
-
this.
|
|
350
|
+
this._thinEffectLayer._disposeMesh(mesh);
|
|
353
351
|
}
|
|
354
352
|
/**
|
|
355
353
|
* Gets the class name of the effect layer
|
|
@@ -368,7 +366,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
368
366
|
let index;
|
|
369
367
|
// Included meshes
|
|
370
368
|
serializationObject.includedMeshes = [];
|
|
371
|
-
const includedOnlyMeshes = this.
|
|
369
|
+
const includedOnlyMeshes = this._thinEffectLayer._includedOnlyMeshes;
|
|
372
370
|
if (includedOnlyMeshes.length) {
|
|
373
371
|
for (index = 0; index < includedOnlyMeshes.length; index++) {
|
|
374
372
|
const mesh = this._scene.getMeshByUniqueId(includedOnlyMeshes[index]);
|
|
@@ -379,7 +377,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
379
377
|
}
|
|
380
378
|
// Excluded meshes
|
|
381
379
|
serializationObject.excludedMeshes = [];
|
|
382
|
-
const excludedMeshes = this.
|
|
380
|
+
const excludedMeshes = this._thinEffectLayer._excludedMeshes;
|
|
383
381
|
if (excludedMeshes.length) {
|
|
384
382
|
for (index = 0; index < excludedMeshes.length; index++) {
|
|
385
383
|
const mesh = this._scene.getMeshByUniqueId(excludedMeshes[index]);
|
package/Layers/glowLayer.js.map
CHANGED
|
@@ -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;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAchD,KAAK,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAU,IAAY;IACvD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7D,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,KAAK,SAAS,CAAC,UAAU,EAAE,CAAC;YAC9G,OAAa,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C,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 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 * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the glowing objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio?: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure resize independent blur. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * Enable MSAA by choosing the number of samples. Default: 1\r\n */\r\n mainTextureSamples?: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_BYTE\r\n */\r\n mainTextureType?: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer?: boolean;\r\n}\r\n\r\n/**\r\n * The glow layer Helps adding a glow effect around the emissive parts of a mesh.\r\n *\r\n * Once instantiated in a scene, by default, all the emissive meshes will glow.\r\n *\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\nexport class GlowLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the layer.\r\n */\r\n public static 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._thinGlowLayer.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._thinGlowLayer.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._thinGlowLayer.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._thinGlowLayer.intensity;\r\n }\r\n\r\n @serialize(\"options\")\r\n protected _options: IGlowLayerOptions;\r\n\r\n private readonly _thinGlowLayer: 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._thinGlowLayer.customEmissiveColorSelector;\r\n }\r\n\r\n public set customEmissiveColorSelector(value: (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void) {\r\n this._thinGlowLayer.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._thinGlowLayer.customEmissiveTextureSelector;\r\n }\r\n\r\n public set customEmissiveTextureSelector(value: (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture) {\r\n this._thinGlowLayer.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 const thinGlowLayer = new ThinGlowLayer(name, scene, options);\r\n\r\n super(name, scene, false, thinGlowLayer);\r\n\r\n this._thinGlowLayer = thinGlowLayer;\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._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer.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._thinGlowLayer._createTextureAndPostProcesses();\r\n\r\n const thinBlurPostProcesses1 = this._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer.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._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer.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._thinGlowLayer.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._thinGlowLayer.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._thinGlowLayer.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._thinGlowLayer.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._thinGlowLayer._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._thinGlowLayer.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._thinGlowLayer.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._thinGlowLayer._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._thinGlowLayer._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._thinGlowLayer._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"]}
|
|
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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AG,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,eAAe,CAAO,IAAI,CAAC,CAAC;YACnC,CAAC;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 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;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GlowLayer\", GlowLayer);\r\n"]}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { Observable } from "../Misc/observable";
|
|
2
2
|
import type { Nullable } from "../types";
|
|
3
|
-
import type { Camera } from "../Cameras/camera";
|
|
4
3
|
import { Scene } from "../scene";
|
|
5
4
|
import type { SubMesh } from "../Meshes/subMesh";
|
|
6
5
|
import type { AbstractMesh } from "../Meshes/abstractMesh";
|
|
7
6
|
import type { Mesh } from "../Meshes/mesh";
|
|
8
7
|
import type { Effect } from "../Materials/effect";
|
|
9
|
-
import { Material } from "../Materials/material";
|
|
8
|
+
import type { Material } from "../Materials/material";
|
|
10
9
|
import { EffectLayer } from "./effectLayer";
|
|
11
|
-
import { Color4
|
|
10
|
+
import type { Color4 } from "../Maths/math.color";
|
|
11
|
+
import { Color3 } from "../Maths/math.color";
|
|
12
|
+
import type { IThinHighlightLayerOptions } from "./thinHighlightLayer";
|
|
13
|
+
import { ThinHighlightLayer } from "./thinHighlightLayer";
|
|
12
14
|
declare module "../scene" {
|
|
13
15
|
interface Scene {
|
|
14
16
|
/**
|
|
@@ -23,53 +25,7 @@ declare module "../scene" {
|
|
|
23
25
|
* Highlight layer options. This helps customizing the behaviour
|
|
24
26
|
* of the highlight layer.
|
|
25
27
|
*/
|
|
26
|
-
export interface IHighlightLayerOptions {
|
|
27
|
-
/**
|
|
28
|
-
* Multiplication factor apply to the canvas size to compute the render target size
|
|
29
|
-
* used to generated the glowing objects (the smaller the faster). Default: 0.5
|
|
30
|
-
*/
|
|
31
|
-
mainTextureRatio: number;
|
|
32
|
-
/**
|
|
33
|
-
* Enforces a fixed size texture to ensure resize independent blur. Default: undefined
|
|
34
|
-
*/
|
|
35
|
-
mainTextureFixedSize?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
|
|
38
|
-
* of the picture to blur (the smaller the faster). Default: 0.5
|
|
39
|
-
*/
|
|
40
|
-
blurTextureSizeRatio: number;
|
|
41
|
-
/**
|
|
42
|
-
* How big in texel of the blur texture is the vertical blur. Default: 1
|
|
43
|
-
*/
|
|
44
|
-
blurVerticalSize: number;
|
|
45
|
-
/**
|
|
46
|
-
* How big in texel of the blur texture is the horizontal blur. Default: 1
|
|
47
|
-
*/
|
|
48
|
-
blurHorizontalSize: number;
|
|
49
|
-
/**
|
|
50
|
-
* Alpha blending mode used to apply the blur. Default: ALPHA_COMBINE
|
|
51
|
-
*/
|
|
52
|
-
alphaBlendingMode: number;
|
|
53
|
-
/**
|
|
54
|
-
* The camera attached to the layer. Default: null
|
|
55
|
-
*/
|
|
56
|
-
camera: Nullable<Camera>;
|
|
57
|
-
/**
|
|
58
|
-
* Should we display highlight as a solid stroke? Default: false
|
|
59
|
-
*/
|
|
60
|
-
isStroke?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* The rendering group to draw the layer in. Default: -1
|
|
63
|
-
*/
|
|
64
|
-
renderingGroupId: number;
|
|
65
|
-
/**
|
|
66
|
-
* The type of the main texture. Default: TEXTURETYPE_UNSIGNED_BYTE
|
|
67
|
-
*/
|
|
68
|
-
mainTextureType: number;
|
|
69
|
-
/**
|
|
70
|
-
* Use the GLSL code generation for the shader (even on WebGPU). Default is false
|
|
71
|
-
*/
|
|
72
|
-
forceGLSL: boolean;
|
|
28
|
+
export interface IHighlightLayerOptions extends IThinHighlightLayerOptions {
|
|
73
29
|
}
|
|
74
30
|
/**
|
|
75
31
|
* The highlight layer Helps adding a glow effect around a mesh.
|
|
@@ -88,23 +44,18 @@ export declare class HighlightLayer extends EffectLayer {
|
|
|
88
44
|
* The neutral color used during the preparation of the glow effect.
|
|
89
45
|
* This is black by default as the blend operation is a blend operation.
|
|
90
46
|
*/
|
|
91
|
-
static NeutralColor: Color4;
|
|
92
|
-
|
|
93
|
-
* Stencil value used for glowing meshes.
|
|
94
|
-
*/
|
|
95
|
-
static GlowingMeshStencilReference: number;
|
|
96
|
-
/**
|
|
97
|
-
* Stencil value used for the other meshes in the scene.
|
|
98
|
-
*/
|
|
99
|
-
static NormalMeshStencilReference: number;
|
|
47
|
+
static get NeutralColor(): Color4;
|
|
48
|
+
static set NeutralColor(value: Color4);
|
|
100
49
|
/**
|
|
101
50
|
* Specifies whether or not the inner glow is ACTIVE in the layer.
|
|
102
51
|
*/
|
|
103
|
-
innerGlow: boolean;
|
|
52
|
+
get innerGlow(): boolean;
|
|
53
|
+
set innerGlow(value: boolean);
|
|
104
54
|
/**
|
|
105
55
|
* Specifies whether or not the outer glow is ACTIVE in the layer.
|
|
106
56
|
*/
|
|
107
|
-
outerGlow: boolean;
|
|
57
|
+
get outerGlow(): boolean;
|
|
58
|
+
set outerGlow(value: boolean);
|
|
108
59
|
/**
|
|
109
60
|
* Specifies the horizontal size of the blur.
|
|
110
61
|
*/
|
|
@@ -129,14 +80,12 @@ export declare class HighlightLayer extends EffectLayer {
|
|
|
129
80
|
* An event triggered when the highlight layer has been blurred.
|
|
130
81
|
*/
|
|
131
82
|
onAfterBlurObservable: Observable<HighlightLayer>;
|
|
132
|
-
private _instanceGlowingMeshStencilReference;
|
|
133
83
|
private _options;
|
|
84
|
+
protected readonly _thinEffectLayer: ThinHighlightLayer;
|
|
134
85
|
private _downSamplePostprocess;
|
|
135
86
|
private _horizontalBlurPostprocess;
|
|
136
87
|
private _verticalBlurPostprocess;
|
|
137
88
|
private _blurTexture;
|
|
138
|
-
private _meshes;
|
|
139
|
-
private _excludedMeshes;
|
|
140
89
|
/**
|
|
141
90
|
* Instantiates a new highlight Layer and references it to the scene..
|
|
142
91
|
* @param name The name of the layer
|
|
@@ -144,7 +93,6 @@ export declare class HighlightLayer extends EffectLayer {
|
|
|
144
93
|
* @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
|
|
145
94
|
*/
|
|
146
95
|
constructor(name: string, scene?: Scene, options?: Partial<IHighlightLayerOptions>);
|
|
147
|
-
protected _importShadersAsync(): Promise<void>;
|
|
148
96
|
/**
|
|
149
97
|
* Get the effect name of the layer.
|
|
150
98
|
* @returns The effect name
|
|
@@ -239,11 +187,6 @@ export declare class HighlightLayer extends EffectLayer {
|
|
|
239
187
|
* Remove all the meshes currently referenced in the highlight layer
|
|
240
188
|
*/
|
|
241
189
|
removeAllMeshes(): void;
|
|
242
|
-
/**
|
|
243
|
-
* Force the stencil to the normal expected value for none glowing parts
|
|
244
|
-
* @param mesh
|
|
245
|
-
*/
|
|
246
|
-
private _defaultStencilReference;
|
|
247
190
|
/**
|
|
248
191
|
* Free any resources and references associated to a mesh.
|
|
249
192
|
* Internal use
|
|
@@ -251,10 +194,6 @@ export declare class HighlightLayer extends EffectLayer {
|
|
|
251
194
|
* @internal
|
|
252
195
|
*/
|
|
253
196
|
_disposeMesh(mesh: Mesh): void;
|
|
254
|
-
/**
|
|
255
|
-
* Dispose the highlight layer and free resources.
|
|
256
|
-
*/
|
|
257
|
-
dispose(): void;
|
|
258
197
|
/**
|
|
259
198
|
* Gets the class name of the effect layer
|
|
260
199
|
* @returns the string with the class name of the effect layer
|