@onerjs/core 8.36.4 → 8.36.5

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.
@@ -21,6 +21,16 @@ declare module "../scene.js" {
21
21
  getHighlightLayerByName(name: string): Nullable<HighlightLayer>;
22
22
  }
23
23
  }
24
+ interface IHighlightLayerMesh {
25
+ /**
26
+ * The glowy mesh
27
+ */
28
+ mesh: Mesh;
29
+ /**
30
+ * The color of the glow
31
+ */
32
+ color: Color3;
33
+ }
24
34
  /**
25
35
  * Highlight layer options. This helps customizing the behaviour
26
36
  * of the highlight layer.
@@ -180,9 +190,9 @@ export declare class HighlightLayer extends EffectLayer {
180
190
  addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
181
191
  /**
182
192
  * Get all meshes from the highlight layer
183
- * @returns Mesh[]
193
+ * @returns IHighlightLayerMesh[]
184
194
  */
185
- getAllMeshes(): Mesh[];
195
+ getAllMeshes(): IHighlightLayerMesh[];
186
196
  /**
187
197
  * Remove a mesh from the highlight layer in order to make it stop glowing.
188
198
  * @param mesh The mesh to highlight
@@ -218,3 +228,4 @@ export declare class HighlightLayer extends EffectLayer {
218
228
  */
219
229
  static Parse(parsedHightlightLayer: any, scene: Scene, rootUrl: string): HighlightLayer;
220
230
  }
231
+ export {};
@@ -380,15 +380,18 @@ export class HighlightLayer extends EffectLayer {
380
380
  }
381
381
  /**
382
382
  * Get all meshes from the highlight layer
383
- * @returns Mesh[]
383
+ * @returns IHighlightLayerMesh[]
384
384
  */
385
385
  getAllMeshes() {
386
386
  return this._thinEffectLayer._meshes
387
387
  ? Object.values(this._thinEffectLayer._meshes)
388
- .map((mesh) => {
389
- return mesh?.mesh;
390
- })
391
388
  .filter(Boolean)
389
+ .map((item) => {
390
+ return {
391
+ mesh: item.mesh,
392
+ color: item.color,
393
+ };
394
+ })
392
395
  : [];
393
396
  }
394
397
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"highlightLayer.js","source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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;;AAlfD;;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;AAmavD,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 * Get all meshes from the highlight layer\r\n * @returns Mesh[]\r\n */\r\n public getAllMeshes(): Mesh[] {\r\n return this._thinEffectLayer._meshes\r\n ? Object.values(this._thinEffectLayer._meshes)\r\n .map((mesh) => {\r\n return mesh?.mesh!;\r\n })\r\n .filter(Boolean)\r\n : [];\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":"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C,eAAe,CAAO,IAAI,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;;AArfD;;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;AAsavD,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\ninterface IHighlightLayerMesh {\r\n /**\r\n * The glowy mesh\r\n */\r\n mesh: Mesh;\r\n /**\r\n * The color of the glow\r\n */\r\n color: Color3;\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 * Get all meshes from the highlight layer\r\n * @returns IHighlightLayerMesh[]\r\n */\r\n public getAllMeshes(): IHighlightLayerMesh[] {\r\n return this._thinEffectLayer._meshes\r\n ? Object.values(this._thinEffectLayer._meshes)\r\n .filter(Boolean)\r\n .map((item) => {\r\n return {\r\n mesh: item!.mesh,\r\n color: item!.color,\r\n };\r\n })\r\n : [];\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onerjs/core",
3
- "version": "8.36.4",
3
+ "version": "8.36.5",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",