@onerjs/core 8.47.1 → 8.47.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animation.js +2 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.js +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animatorAvatar.js +13 -12
- package/Animations/animatorAvatar.js.map +1 -1
- package/Animations/easing.js +1 -1
- package/Animations/easing.js.map +1 -1
- package/Animations/pathCursor.js +1 -2
- package/Animations/pathCursor.js.map +1 -1
- package/Layers/selectionOutlineLayer.d.ts +7 -0
- package/Layers/selectionOutlineLayer.js +18 -1
- package/Layers/selectionOutlineLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.js +16 -3
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.d.ts +6 -0
- package/Lights/Clustered/clusteredLightContainer.js +42 -0
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Lights/light.d.ts +7 -0
- package/Lights/light.js +10 -0
- package/Lights/light.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +13 -3
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +10 -0
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Meshes/mesh.js +29 -2
- package/Meshes/mesh.js.map +1 -1
- package/Misc/greasedLineTools.js +5 -0
- package/Misc/greasedLineTools.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.js +2 -4
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/package.json +1 -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AS,EAAE;8DAGX;AAUD;IADC,SAAS,EAAE;+DAGX;AAOO;IADP,SAAS,CAAC,SAAS,CAAC;uDACqC;AAoT9D,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3 } 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 { type Effect } from \"../Materials/effect\";\r\nimport { type Material } from \"../Materials/material\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { type IThinSelectionOutlineLayerOptions, ThinSelectionOutlineLayer } from \"./thinSelectionOutlineLayer\";\r\nimport { type Color3 } from \"../Maths/math.color\";\r\n\r\nimport \"../Rendering/depthRendererSceneComponent\";\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 selection outline layer of the scene with a given name.\r\n * @param name The name of the selection outline layer to look for.\r\n * @returns The selection outline layer if found otherwise null.\r\n */\r\n getSelectionOutlineLayerByName(name: string): Nullable<SelectionOutlineLayer>;\r\n }\r\n}\r\n\r\nScene.prototype.getSelectionOutlineLayerByName = function (name: string): Nullable<SelectionOutlineLayer> {\r\n for (let index = 0; index < this.effectLayers?.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === SelectionOutlineLayer.EffectName) {\r\n return (<any>this.effectLayers[index]) as SelectionOutlineLayer;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Selection outline layer options. This helps customizing the behaviour\r\n * of the selection outline layer.\r\n */\r\nexport interface ISelectionOutlineLayerOptions extends IThinSelectionOutlineLayerOptions {\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/**\r\n * The selection outline layer Helps adding a outline 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 * outlined meshes to your scene.\r\n */\r\nexport class SelectionOutlineLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the selection outline layer.\r\n */\r\n public static get EffectName() {\r\n return ThinSelectionOutlineLayer.EffectName;\r\n }\r\n\r\n /**\r\n * The outline color (default (1, 0.5, 0))\r\n */\r\n @serializeAsColor3()\r\n public get outlineColor(): Color3 {\r\n return this._thinEffectLayer.outlineColor;\r\n }\r\n\r\n public set outlineColor(value: Color3) {\r\n this._thinEffectLayer.outlineColor = value;\r\n }\r\n\r\n /**\r\n * The thickness of the edges (default: 2.0)\r\n */\r\n @serialize()\r\n public get outlineThickness(): number {\r\n return this._thinEffectLayer.outlineThickness;\r\n }\r\n\r\n public set outlineThickness(value: number) {\r\n this._thinEffectLayer.outlineThickness = value;\r\n }\r\n\r\n /**\r\n * The strength of the occlusion effect (default: 0.8)\r\n */\r\n @serialize()\r\n public get occlusionStrength(): number {\r\n return this._thinEffectLayer.occlusionStrength;\r\n }\r\n\r\n public set occlusionStrength(value: number) {\r\n this._thinEffectLayer.occlusionStrength = value;\r\n }\r\n\r\n /**\r\n * The occlusion threshold (default: 0.01)\r\n */\r\n @serialize()\r\n public get occlusionThreshold(): number {\r\n return this._thinEffectLayer.occlusionThreshold;\r\n }\r\n\r\n public set occlusionThreshold(value: number) {\r\n this._thinEffectLayer.occlusionThreshold = value;\r\n }\r\n\r\n @serialize(\"options\")\r\n private _options: Required<ISelectionOutlineLayerOptions>;\r\n\r\n protected override readonly _thinEffectLayer: ThinSelectionOutlineLayer;\r\n\r\n /**\r\n * Instantiates a new selection outline 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 ISelectionOutlineLayerOptions for more information)\r\n */\r\n public constructor(name: string, scene?: Scene, options?: Partial<ISelectionOutlineLayerOptions>) {\r\n super(name, scene, options !== undefined ? !!options.forceGLSL : false, new ThinSelectionOutlineLayer(name, scene, options));\r\n\r\n // Adapt options\r\n this._options = {\r\n mainTextureRatio: 1.0,\r\n mainTextureFixedSize: 0,\r\n alphaBlendingMode: Constants.ALPHA_COMBINE,\r\n camera: null,\r\n mainTextureSamples: 1,\r\n renderingGroupId: -1,\r\n mainTextureType: Constants.TEXTURETYPE_FLOAT,\r\n mainTextureFormat: Constants.TEXTUREFORMAT_RG,\r\n forceGLSL: false,\r\n storeCameraSpaceZ: false,\r\n outlineMethod: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL,\r\n ...options,\r\n };\r\n\r\n // Fall back to a supported mask texture type if the device doesn't support rendering to float framebuffers\r\n // or linear filtering of float textures (e.g. OES_texture_float_linear missing on some iOS versions)\r\n if (this._options.mainTextureType === Constants.TEXTURETYPE_FLOAT && !(this._engine.getCaps().textureFloatRender && this._engine.getCaps().textureFloatLinearFiltering)) {\r\n this._options.mainTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n }\r\n if (this._options.mainTextureType === Constants.TEXTURETYPE_HALF_FLOAT && !this._engine.getCaps().textureHalfFloatRender && !this._options.storeCameraSpaceZ) {\r\n this._options.mainTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\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 this._scene.enableDepthRenderer();\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 SelectionOutlineLayer.EffectName;\r\n }\r\n\r\n protected override _numInternalDraws(): number {\r\n return 1; // draw depth mask on main pass and outline on merge pass\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 selection outline layer.\r\n */\r\n protected _createTextureAndPostProcesses(): void {\r\n this._textures = [];\r\n\r\n this._thinEffectLayer.bindTexturesForCompose = (effect: Effect): void => {\r\n effect.setTexture(\"maskSampler\", this._mainTexture);\r\n const depthRenderer = this._scene.enableDepthRenderer();\r\n effect.setTexture(\"depthSampler\", depthRenderer.getDepthMap());\r\n\r\n const mainTextureDesiredSize = this._mainTextureDesiredSize;\r\n this._thinEffectLayer.textureWidth = mainTextureDesiredSize.width;\r\n this._thinEffectLayer.textureHeight = mainTextureDesiredSize.height;\r\n };\r\n\r\n this._thinEffectLayer._createTextureAndPostProcesses();\r\n\r\n this._postProcesses = [];\r\n\r\n this._mainTexture.samples = this._options.mainTextureSamples;\r\n this._mainTexture.onAfterUnbindObservable.add(() => {\r\n // glow layer and highlight layer both call this._scene.postProcessManager.directRender\r\n // when you call this._scene.postProcessManager.directRender, it has 4 side effects:\r\n // 1. binds the framebuffer\r\n // 2. setAlphaMode(ALPHA_DISABLE)\r\n // 3. setDepthBuffer(true)\r\n // 4. setDepthWrite(true)\r\n // glow layer and highlight layer are restore framebuffer and depends on other side effects\r\n // but for now 3 and 4 are not needed to resolve the state management issue, so we just restore alpha mode\r\n this._scene.getEngine().setAlphaMode(Constants.ALPHA_DISABLE);\r\n });\r\n }\r\n\r\n /**\r\n * Creates the main texture for the effect layer.\r\n */\r\n protected override _createMainTexture(): void {\r\n super._createMainTexture();\r\n // set the render list for selective rendering\r\n this._mainTexture.renderList = this._thinEffectLayer._selection;\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 * Determine if a given mesh will be highlighted by the current SelectionOutlineLayer\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be highlighted by the current SelectionOutlineLayer\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 * Remove all the meshes currently referenced in the selection outline layer\r\n */\r\n public clearSelection(): void {\r\n this._thinEffectLayer.clearSelection();\r\n this._mainTexture.renderList = this._thinEffectLayer._selection; // update render list\r\n }\r\n\r\n /**\r\n * Adds mesh or group of mesh to the current selection\r\n *\r\n * If a group of meshes is provided, they will outline as a single unit\r\n * @param meshOrGroup Meshes to add to the selection\r\n */\r\n public addSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void {\r\n this._thinEffectLayer.addSelection(meshOrGroup);\r\n }\r\n\r\n /**\r\n * Adds mesh or group of mesh to the current selection\r\n * @param meshOrGroup Meshes to remove from the selection\r\n */\r\n public removeSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void {\r\n this._thinEffectLayer.removeSelection(meshOrGroup);\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 \"SelectionOutlineLayer\";\r\n }\r\n\r\n /**\r\n * Serializes this SelectionOutline layer\r\n * @returns a serialized SelectionOutline layer object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.SelectionOutlineLayer\";\r\n\r\n // Selected meshes\r\n serializationObject.selection = [];\r\n\r\n const selection = this._thinEffectLayer._selection;\r\n if (selection) {\r\n const meshUniqueIdToSelectionId = this._thinEffectLayer._meshUniqueIdToSelectionId;\r\n\r\n // selection can be sparse since _removeMesh can remove entries\r\n const selectionMap: {\r\n [uniqueId: number]: {\r\n meshIds: string[];\r\n };\r\n } = {};\r\n\r\n for (let i = 0; i < selection.length; ++i) {\r\n const mesh = selection[i];\r\n const selectionId = meshUniqueIdToSelectionId[mesh.uniqueId];\r\n\r\n if (!selectionMap[selectionId]) {\r\n selectionMap[selectionId] = {\r\n meshIds: [],\r\n };\r\n }\r\n selectionMap[selectionId].meshIds.push(mesh.id);\r\n }\r\n serializationObject.selection = selectionMap;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a SelectionOutline layer from parsed SelectionOutline layer data\r\n * @param parsedSelectionOutlineLayer defines the SelectionOutline layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the SelectionOutline layer information\r\n * @returns a parsed SelectionOutline layer\r\n */\r\n public static override Parse(parsedSelectionOutlineLayer: any, scene: Scene, rootUrl: string): SelectionOutlineLayer {\r\n const selectionOutlineLayer = SerializationHelper.Parse(\r\n () => new SelectionOutlineLayer(parsedSelectionOutlineLayer.name, scene, parsedSelectionOutlineLayer.options),\r\n parsedSelectionOutlineLayer,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n const selectionMap = parsedSelectionOutlineLayer.selection as { [uniqueId: number]: { meshIds: string[] } };\r\n\r\n // Selected meshes\r\n for (const outlinedMeshes of Object.values(selectionMap)) {\r\n const meshes: AbstractMesh[] = [];\r\n for (let meshIndex = 0; meshIndex < outlinedMeshes.meshIds.length; meshIndex++) {\r\n const meshId = outlinedMeshes.meshIds[meshIndex];\r\n const mesh = scene.getMeshById(meshId);\r\n if (mesh) {\r\n meshes.push(mesh);\r\n }\r\n }\r\n\r\n selectionOutlineLayer.addSelection(meshes);\r\n }\r\n\r\n return selectionOutlineLayer;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SelectionOutlineLayer\", SelectionOutlineLayer);\r\n"]}
|
|
1
|
+
{"version":3,"file":"selectionOutlineLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/selectionOutlineLayer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM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AAY,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,qBAAqB,CAAC;IACjC,CAAC;CACJ;AAlXG;IADC,iBAAiB,EAAE;yDAGnB;AAUD;IADC,SAAS,EAAE;6DAGX;AAUD;IADC,SAAS,EAAE;8DAGX;AAUD;IADC,SAAS,EAAE;+DAGX;AAOO;IADP,SAAS,CAAC,SAAS,CAAC;uDACqC;AAuU9D,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3 } 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 { type Effect } from \"../Materials/effect\";\r\nimport { type Material } from \"../Materials/material\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\nimport { type IThinSelectionOutlineLayerOptions, ThinSelectionOutlineLayer } from \"./thinSelectionOutlineLayer\";\r\nimport { type Color3 } from \"../Maths/math.color\";\r\n\r\nimport \"../Rendering/depthRendererSceneComponent\";\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 selection outline layer of the scene with a given name.\r\n * @param name The name of the selection outline layer to look for.\r\n * @returns The selection outline layer if found otherwise null.\r\n */\r\n getSelectionOutlineLayerByName(name: string): Nullable<SelectionOutlineLayer>;\r\n }\r\n}\r\n\r\nScene.prototype.getSelectionOutlineLayerByName = function (name: string): Nullable<SelectionOutlineLayer> {\r\n for (let index = 0; index < this.effectLayers?.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === SelectionOutlineLayer.EffectName) {\r\n return (<any>this.effectLayers[index]) as SelectionOutlineLayer;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Selection outline layer options. This helps customizing the behaviour\r\n * of the selection outline layer.\r\n */\r\nexport interface ISelectionOutlineLayerOptions extends IThinSelectionOutlineLayerOptions {\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/**\r\n * The selection outline layer Helps adding a outline 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 * outlined meshes to your scene.\r\n */\r\nexport class SelectionOutlineLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the selection outline layer.\r\n */\r\n public static get EffectName() {\r\n return ThinSelectionOutlineLayer.EffectName;\r\n }\r\n\r\n /**\r\n * The outline color (default (1, 0.5, 0))\r\n */\r\n @serializeAsColor3()\r\n public get outlineColor(): Color3 {\r\n return this._thinEffectLayer.outlineColor;\r\n }\r\n\r\n public set outlineColor(value: Color3) {\r\n this._thinEffectLayer.outlineColor = value;\r\n }\r\n\r\n /**\r\n * The thickness of the edges (default: 2.0)\r\n */\r\n @serialize()\r\n public get outlineThickness(): number {\r\n return this._thinEffectLayer.outlineThickness;\r\n }\r\n\r\n public set outlineThickness(value: number) {\r\n this._thinEffectLayer.outlineThickness = value;\r\n }\r\n\r\n /**\r\n * The strength of the occlusion effect (default: 0.8)\r\n */\r\n @serialize()\r\n public get occlusionStrength(): number {\r\n return this._thinEffectLayer.occlusionStrength;\r\n }\r\n\r\n public set occlusionStrength(value: number) {\r\n this._thinEffectLayer.occlusionStrength = value;\r\n }\r\n\r\n /**\r\n * The occlusion threshold (default: 0.01)\r\n */\r\n @serialize()\r\n public get occlusionThreshold(): number {\r\n return this._thinEffectLayer.occlusionThreshold;\r\n }\r\n\r\n public set occlusionThreshold(value: number) {\r\n this._thinEffectLayer.occlusionThreshold = value;\r\n }\r\n\r\n @serialize(\"options\")\r\n private _options: Required<ISelectionOutlineLayerOptions>;\r\n\r\n protected override readonly _thinEffectLayer: ThinSelectionOutlineLayer;\r\n\r\n /**\r\n * Instantiates a new selection outline 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 ISelectionOutlineLayerOptions for more information)\r\n */\r\n public constructor(name: string, scene?: Scene, options?: Partial<ISelectionOutlineLayerOptions>) {\r\n super(name, scene, options !== undefined ? !!options.forceGLSL : false, new ThinSelectionOutlineLayer(name, scene, options));\r\n\r\n // Adapt options\r\n this._options = {\r\n mainTextureRatio: 1.0,\r\n mainTextureFixedSize: 0,\r\n alphaBlendingMode: Constants.ALPHA_COMBINE,\r\n camera: null,\r\n mainTextureSamples: 1,\r\n renderingGroupId: -1,\r\n mainTextureType: Constants.TEXTURETYPE_FLOAT,\r\n mainTextureFormat: Constants.TEXTUREFORMAT_RG,\r\n forceGLSL: false,\r\n storeCameraSpaceZ: false,\r\n outlineMethod: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL,\r\n ...options,\r\n };\r\n\r\n // Fall back to a supported mask texture type if the device doesn't support rendering to float framebuffers\r\n // or linear filtering of float textures (e.g. OES_texture_float_linear missing on some iOS versions)\r\n if (this._options.mainTextureType === Constants.TEXTURETYPE_FLOAT && !(this._engine.getCaps().textureFloatRender && this._engine.getCaps().textureFloatLinearFiltering)) {\r\n this._options.mainTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n }\r\n if (this._options.mainTextureType === Constants.TEXTURETYPE_HALF_FLOAT && !this._engine.getCaps().textureHalfFloatRender && !this._options.storeCameraSpaceZ) {\r\n this._options.mainTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\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 * Checks if the layer is ready to render.\r\n * When selections are active, this also lazily creates the depth renderer\r\n * and checks that its depth map is ready.\r\n * @returns true if the layer is ready\r\n */\r\n public override isLayerReady(): boolean {\r\n if (!super.isLayerReady()) {\r\n return false;\r\n }\r\n\r\n if (this.shouldRender()) {\r\n const depthRenderer = this._scene.enableDepthRenderer();\r\n if (!depthRenderer.getDepthMap().isReadyForRendering()) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\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 SelectionOutlineLayer.EffectName;\r\n }\r\n\r\n protected override _numInternalDraws(): number {\r\n return 1; // draw depth mask on main pass and outline on merge pass\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 selection outline layer.\r\n */\r\n protected _createTextureAndPostProcesses(): void {\r\n this._textures = [];\r\n\r\n this._thinEffectLayer.bindTexturesForCompose = (effect: Effect): void => {\r\n effect.setTexture(\"maskSampler\", this._mainTexture);\r\n const depthRenderer = this._scene.enableDepthRenderer();\r\n effect.setTexture(\"depthSampler\", depthRenderer.getDepthMap());\r\n\r\n const mainTextureDesiredSize = this._mainTextureDesiredSize;\r\n this._thinEffectLayer.textureWidth = mainTextureDesiredSize.width;\r\n this._thinEffectLayer.textureHeight = mainTextureDesiredSize.height;\r\n };\r\n\r\n this._thinEffectLayer._createTextureAndPostProcesses();\r\n\r\n this._postProcesses = [];\r\n\r\n this._mainTexture.samples = this._options.mainTextureSamples;\r\n this._mainTexture.onAfterUnbindObservable.add(() => {\r\n // glow layer and highlight layer both call this._scene.postProcessManager.directRender\r\n // when you call this._scene.postProcessManager.directRender, it has 4 side effects:\r\n // 1. binds the framebuffer\r\n // 2. setAlphaMode(ALPHA_DISABLE)\r\n // 3. setDepthBuffer(true)\r\n // 4. setDepthWrite(true)\r\n // glow layer and highlight layer are restore framebuffer and depends on other side effects\r\n // but for now 3 and 4 are not needed to resolve the state management issue, so we just restore alpha mode\r\n this._scene.getEngine().setAlphaMode(Constants.ALPHA_DISABLE);\r\n });\r\n }\r\n\r\n /**\r\n * Creates the main texture for the effect layer.\r\n */\r\n protected override _createMainTexture(): void {\r\n super._createMainTexture();\r\n // set the render list for selective rendering\r\n this._mainTexture.renderList = this._thinEffectLayer._selection;\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 * Determine if a given mesh will be highlighted by the current SelectionOutlineLayer\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be highlighted by the current SelectionOutlineLayer\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 * Remove all the meshes currently referenced in the selection outline layer\r\n */\r\n public clearSelection(): void {\r\n this._thinEffectLayer.clearSelection();\r\n this._mainTexture.renderList = this._thinEffectLayer._selection; // update render list\r\n }\r\n\r\n /**\r\n * Adds mesh or group of mesh to the current selection\r\n *\r\n * If a group of meshes is provided, they will outline as a single unit\r\n * @param meshOrGroup Meshes to add to the selection\r\n */\r\n public addSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void {\r\n this._thinEffectLayer.addSelection(meshOrGroup);\r\n }\r\n\r\n /**\r\n * Adds mesh or group of mesh to the current selection\r\n * @param meshOrGroup Meshes to remove from the selection\r\n */\r\n public removeSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void {\r\n this._thinEffectLayer.removeSelection(meshOrGroup);\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 \"SelectionOutlineLayer\";\r\n }\r\n\r\n /**\r\n * Serializes this SelectionOutline layer\r\n * @returns a serialized SelectionOutline layer object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.SelectionOutlineLayer\";\r\n\r\n // Selected meshes\r\n serializationObject.selection = [];\r\n\r\n const selection = this._thinEffectLayer._selection;\r\n if (selection) {\r\n const meshUniqueIdToSelectionId = this._thinEffectLayer._meshUniqueIdToSelectionId;\r\n\r\n // selection can be sparse since _removeMesh can remove entries\r\n const selectionMap: {\r\n [uniqueId: number]: {\r\n meshIds: string[];\r\n };\r\n } = {};\r\n\r\n for (let i = 0; i < selection.length; ++i) {\r\n const mesh = selection[i];\r\n const selectionId = meshUniqueIdToSelectionId[mesh.uniqueId];\r\n\r\n if (!selectionMap[selectionId]) {\r\n selectionMap[selectionId] = {\r\n meshIds: [],\r\n };\r\n }\r\n selectionMap[selectionId].meshIds.push(mesh.id);\r\n }\r\n serializationObject.selection = selectionMap;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a SelectionOutline layer from parsed SelectionOutline layer data\r\n * @param parsedSelectionOutlineLayer defines the SelectionOutline layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the SelectionOutline layer information\r\n * @returns a parsed SelectionOutline layer\r\n */\r\n public static override Parse(parsedSelectionOutlineLayer: any, scene: Scene, rootUrl: string): SelectionOutlineLayer {\r\n const selectionOutlineLayer = SerializationHelper.Parse(\r\n () => new SelectionOutlineLayer(parsedSelectionOutlineLayer.name, scene, parsedSelectionOutlineLayer.options),\r\n parsedSelectionOutlineLayer,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n const selectionMap = parsedSelectionOutlineLayer.selection as { [uniqueId: number]: { meshIds: string[] } };\r\n\r\n // Selected meshes\r\n for (const outlinedMeshes of Object.values(selectionMap)) {\r\n const meshes: AbstractMesh[] = [];\r\n for (let meshIndex = 0; meshIndex < outlinedMeshes.meshIds.length; meshIndex++) {\r\n const meshId = outlinedMeshes.meshIds[meshIndex];\r\n const mesh = scene.getMeshById(meshId);\r\n if (mesh) {\r\n meshes.push(mesh);\r\n }\r\n }\r\n\r\n selectionOutlineLayer.addSelection(meshes);\r\n }\r\n\r\n return selectionOutlineLayer;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SelectionOutlineLayer\", SelectionOutlineLayer);\r\n"]}
|
|
@@ -516,10 +516,15 @@ export class ThinSelectionOutlineLayer extends ThinEffectLayer {
|
|
|
516
516
|
_clearMeshSelection(mesh) {
|
|
517
517
|
if (mesh._userInstancedBuffersStorage) {
|
|
518
518
|
const kind = ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName;
|
|
519
|
-
// Dispose per-pass VBOs for
|
|
519
|
+
// Dispose per-pass VBOs for ALL render passes (WebGPU).
|
|
520
|
+
// _processInstancedBuffers creates per-pass VBOs for every render pass
|
|
521
|
+
// that renders this mesh (main scene, depth renderer, etc.), not just
|
|
522
|
+
// this layer's own passes. We must clean them all up to avoid using
|
|
523
|
+
// a destroyed GPU buffer on the next submit.
|
|
520
524
|
if (mesh._userInstancedBuffersStorage.renderPasses) {
|
|
521
|
-
for (const passId
|
|
522
|
-
const
|
|
525
|
+
for (const passId in mesh._userInstancedBuffersStorage.renderPasses) {
|
|
526
|
+
const renderPassId = Number(passId);
|
|
527
|
+
const passVBOs = mesh._userInstancedBuffersStorage.renderPasses[renderPassId];
|
|
523
528
|
if (passVBOs?.[kind]) {
|
|
524
529
|
passVBOs[kind].dispose();
|
|
525
530
|
delete passVBOs[kind];
|
|
@@ -544,6 +549,14 @@ export class ThinSelectionOutlineLayer extends ThinEffectLayer {
|
|
|
544
549
|
if (this._isDef(mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {
|
|
545
550
|
delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];
|
|
546
551
|
}
|
|
552
|
+
// In WebGPU non-compat mode, cached render bundles (fastBundle) bake
|
|
553
|
+
// vertex-buffer GPU handles at record time. Because the new VBO has
|
|
554
|
+
// the same format (and thus the same hashCode), the pipeline cache
|
|
555
|
+
// won't detect the change and would replay the stale bundle.
|
|
556
|
+
// Resetting the draw cache forces new bundles to be recorded.
|
|
557
|
+
if (this._engine.isWebGPU && !this._engine.compatibilityMode) {
|
|
558
|
+
mesh.resetDrawCache();
|
|
559
|
+
}
|
|
547
560
|
if (this._selection) {
|
|
548
561
|
const index = this._selection.indexOf(mesh);
|
|
549
562
|
if (~index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinSelectionOutlineLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/thinSelectionOutlineLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAE9H,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,0CAA0C,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAG/K,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAgC,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyBlF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IAmD1D;;;;;;OAMG;IACH,YAAmB,IAAY,EAAE,KAAa,EAAE,OAAoD,EAAE,gBAAgB,GAAG,KAAK;QAC1H,KAAK,CAAC,IAAI,EAAE,KAA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IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpB,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,gCAAgC,CAAC,CAAC;YACxF,CAAC;iBAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBAC9B,IAAa,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;YAC3G,CAAC;YAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC/B,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AA/xBD;;GAEG;AACoB,oCAAU,GAAG,uBAAuB,AAA1B,CAA2B;AAE5D;;;GAGG;AACoB,0DAAgC,GAAG,qBAAqB,AAAxB,CAAyB","sourcesContent":["import { VertexBuffer } from \"../Buffers/buffer\";\nimport { Camera } from \"../Cameras/camera\";\nimport { Constants } from \"../Engines/constants\";\nimport { type ThinEngine } from \"../Engines/thinEngine\";\nimport { AddClipPlaneUniforms, BindClipPlane, PrepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper\";\nimport { type Effect, type IEffectCreationOptions } from \"../Materials/effect\";\nimport { EffectFallbacks } from \"../Materials/effectFallbacks\";\nimport { Material } from \"../Materials/material\";\nimport { BindBonesParameters, BindMorphTargetParameters, PrepareDefinesAndAttributesForMorphTargets, PushAttributesForInstances } from \"../Materials/materialHelper.functions\";\nimport { ShaderLanguage } from \"../Materials/shaderLanguage\";\nimport { type BaseTexture } from \"../Materials/Textures/baseTexture\";\nimport { Color3, Color4 } from \"../Maths/math.color\";\nimport { type AbstractMesh } from \"../Meshes/abstractMesh\";\nimport { type InstancedMesh } from \"../Meshes/instancedMesh\";\nimport { type Mesh } from \"../Meshes/mesh\";\nimport { type SubMesh } from \"../Meshes/subMesh\";\nimport { type Scene } from \"../scene\";\nimport { type Nullable } from \"../types\";\nimport { type IThinEffectLayerOptions, ThinEffectLayer } from \"./thinEffectLayer\";\n\n/**\n * Selection outline layer options. This helps customizing the behaviour\n * of the selection outline layer.\n */\nexport interface IThinSelectionOutlineLayerOptions extends IThinEffectLayerOptions {\n /**\n * Use the GLSL code generation for the shader (even on WebGPU). Default is false\n */\n forceGLSL?: boolean;\n\n /**\n * Specifies whether the depth stored is the Z coordinate in camera space.\n */\n storeCameraSpaceZ?: boolean;\n\n /**\n * Outline method to use (default: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL)\n *\n * @see {@link Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL}\n */\n outlineMethod?: number;\n}\n\n/**\n * @internal\n */\nexport class ThinSelectionOutlineLayer extends ThinEffectLayer {\n /**\n * Effect Name of the layer.\n */\n public static readonly EffectName = \"SelectionOutlineLayer\";\n\n /**\n * Name of the instance selection ID attribute\n * @internal\n */\n public static readonly InstanceSelectionIdAttributeName = \"instanceSelectionId\";\n\n /**\n * The outline color\n */\n public outlineColor: Color3 = new Color3(1, 0.5, 0);\n\n /**\n * The thickness of the edges\n */\n public outlineThickness: number = 2.0;\n\n /**\n * The strength of the occlusion effect (default: 0.8)\n */\n public occlusionStrength: number = 0.8;\n\n /**\n * The occlusion threshold (default: 0.0001)\n */\n public occlusionThreshold: number = 0.0001;\n\n /**\n * The width of the source texture\n */\n public textureWidth: number = 0;\n\n /**\n * The height of the source texture\n */\n public textureHeight: number = 0;\n\n /** @internal */\n public override _options: Required<IThinSelectionOutlineLayerOptions>;\n\n /** @internal */\n public readonly _meshUniqueIdToSelectionId: number[] = [];\n /** @internal */\n public _selection: Nullable<AbstractMesh[]> = [];\n private _nextSelectionId = 1;\n\n /**\n * Instantiates a new selection outline Layer and references it to the scene..\n * @param name The name of the layer\n * @param scene The scene to use the layer in\n * @param options Sets of none mandatory options to use with the layer (see IThinSelectionOutlineLayerOptions for more information)\n * @param dontCheckIfReady Specifies if the layer should disable checking whether all the post processes are ready (default: false). To save performance, this should be set to true and you should call `isReady` manually before rendering to the layer.\n */\n public constructor(name: string, scene?: Scene, options?: Partial<IThinSelectionOutlineLayerOptions>, dontCheckIfReady = false) {\n super(name, scene, options !== undefined ? !!options.forceGLSL : false);\n\n // Adapt options\n this._options = {\n mainTextureRatio: 1.0,\n mainTextureFixedSize: 0,\n alphaBlendingMode: Constants.ALPHA_COMBINE,\n camera: null,\n renderingGroupId: -1,\n forceGLSL: false,\n mainTextureType: Constants.TEXTURETYPE_FLOAT,\n mainTextureFormat: Constants.TEXTUREFORMAT_RG,\n storeCameraSpaceZ: false,\n outlineMethod: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL,\n ...options,\n };\n\n // Fall back to a supported mask texture type if the device doesn't support rendering to float framebuffers\n // or linear filtering of float textures (e.g. OES_texture_float_linear missing on some iOS versions)\n if (this._options.mainTextureType === Constants.TEXTURETYPE_FLOAT && !(this._engine.getCaps().textureFloatRender && this._engine.getCaps().textureFloatLinearFiltering)) {\n this._options.mainTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\n }\n if (\n this._options.mainTextureType === Constants.TEXTURETYPE_HALF_FLOAT &&\n !(this._engine.getCaps().textureHalfFloatRender && this._engine.getCaps().textureHalfFloatLinearFiltering)\n ) {\n this._options.mainTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\n }\n\n // When using an 8-bit render target, we cannot reliably store camera-space Z in the mask texture:\n // depth would be clamped/quantized, breaking occlusion comparisons. In that case, force-disable\n // storeCameraSpaceZ so the layer falls back to the supported behavior.\n if (this._options.storeCameraSpaceZ && this._options.mainTextureType === Constants.TEXTURETYPE_UNSIGNED_BYTE) {\n this._options.storeCameraSpaceZ = false;\n }\n // set clear color\n this.neutralColor = new Color4(0.0, this._options.storeCameraSpaceZ ? 0.0 : 1.0, 0.0, 1.0);\n\n // Initialize the layer\n this._init(this._options);\n\n // Do not render as long as no meshes have been added\n this._shouldRender = false;\n\n if (dontCheckIfReady) {\n // When dontCheckIfReady is true, we are in the new ThinXXX layer mode, so we must call _createTextureAndPostProcesses ourselves (it is called by EffectLayer otherwise)\n this._createTextureAndPostProcesses();\n }\n }\n\n /**\n * Gets the class name of the effect layer\n * @returns the string with the class name of the effect layer\n */\n public getClassName(): string {\n return \"SelectionOutlineLayer\";\n }\n\n private _isDef(val: any) {\n return val !== void 0 && val !== null;\n }\n\n /** @internal */\n public override _internalIsSubMeshReady(subMesh: SubMesh, useInstances: boolean, _emissiveTexture: Nullable<BaseTexture>): boolean {\n const engine = this._scene.getEngine();\n const mesh = subMesh.getMesh();\n\n const renderingMaterial = mesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\n\n if (renderingMaterial) {\n return renderingMaterial.isReadyForSubMesh(mesh, subMesh, useInstances);\n }\n\n const material = subMesh.getMaterial();\n\n if (!material) {\n return false;\n }\n\n // selection outline layer is not compatible with custom materials\n // if (this._useMeshMaterial(subMesh.getRenderingMesh())) {\n // return material.isReadyForSubMesh(subMesh.getMesh(), subMesh, useInstances);\n // }\n\n const defines: string[] = [];\n\n const attribs = [VertexBuffer.PositionKind];\n\n let uv1 = false;\n let uv2 = false;\n const color = false;\n\n // Alpha test\n if (material.needAlphaTestingForMesh(mesh)) {\n defines.push(\"#define ALPHATEST\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n attribs.push(VertexBuffer.UVKind);\n defines.push(\"#define UV1\");\n uv1 = true;\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\n attribs.push(VertexBuffer.UV2Kind);\n defines.push(\"#define UV2\");\n uv2 = true;\n }\n }\n\n // Bones\n const fallbacks = new EffectFallbacks();\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (mesh.numBoneInfluencers > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\n\n const skeleton = mesh.skeleton;\n if (skeleton && skeleton.isUsingTextureForMatrices) {\n defines.push(\"#define BONETEXTURE\");\n } else {\n defines.push(\"#define BonesPerMesh \" + (skeleton ? skeleton.bones.length + 1 : 0));\n }\n\n if (mesh.numBoneInfluencers > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n } else {\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\n }\n\n // Morph targets\n const numMorphInfluencers = mesh.morphTargetManager\n ? PrepareDefinesAndAttributesForMorphTargets(\n mesh.morphTargetManager,\n defines,\n attribs,\n mesh,\n true, // usePositionMorph\n false, // useNormalMorph\n false, // useTangentMorph\n uv1, // useUVMorph\n uv2, // useUV2Morph\n color // useColorMorph\n )\n : 0;\n\n // Instances\n if (useInstances) {\n defines.push(\"#define INSTANCES\");\n PushAttributesForInstances(attribs);\n if (subMesh.getRenderingMesh().hasThinInstances) {\n defines.push(\"#define THIN_INSTANCES\");\n }\n }\n\n // Baked vertex animations\n const bvaManager = mesh.bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n defines.push(\"#define BAKED_VERTEX_ANIMATION_TEXTURE\");\n if (useInstances) {\n attribs.push(\"bakedVertexAnimationSettingsInstanced\");\n }\n }\n\n // ClipPlanes\n PrepareStringDefinesForClipPlanes(material, this._scene, defines);\n\n // Selection ID\n if (useInstances) {\n attribs.push(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName);\n }\n\n this._addCustomEffectDefines(defines);\n\n // Get correct effect\n const drawWrapper = subMesh._getDrawWrapper(undefined, true)!;\n const cachedDefines = drawWrapper.defines as string;\n const join = defines.join(\"\\n\");\n if (cachedDefines !== join) {\n const uniforms = [\n \"world\",\n \"mBones\",\n \"viewProjection\",\n \"view\",\n \"morphTargetInfluences\",\n \"morphTargetCount\",\n \"boneTextureInfo\",\n \"diffuseMatrix\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n \"bakedVertexAnimationSettings\",\n \"bakedVertexAnimationTextureSizeInverted\",\n \"bakedVertexAnimationTime\",\n \"bakedVertexAnimationTexture\",\n \"depthValues\",\n \"selectionId\",\n ];\n\n AddClipPlaneUniforms(uniforms);\n\n drawWrapper.setEffect(\n this._engine.createEffect(\n \"selection\",\n <IEffectCreationOptions>{\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: [],\n samplers: [\"diffuseSampler\", \"boneSampler\", \"morphTargets\", \"bakedVertexAnimationTexture\"],\n defines: join,\n fallbacks: fallbacks,\n onCompiled: null,\n onError: null,\n indexParameters: { maxSimultaneousMorphTargets: numMorphInfluencers },\n shaderLanguage: this._shaderLanguage,\n extraInitializationsAsync: this._shadersLoaded\n ? undefined\n : async () => {\n await this._importShadersAsync();\n this._shadersLoaded = true;\n },\n },\n this._engine\n ),\n join\n );\n }\n\n const effectIsReady = drawWrapper.effect!.isReady();\n\n return effectIsReady && (this._dontCheckIfReady || (!this._dontCheckIfReady && this.isLayerReady()));\n }\n\n protected override async _importShadersAsync(): Promise<void> {\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\n await Promise.all([\n import(\"../ShadersWGSL/selection.vertex\"),\n import(\"../ShadersWGSL/selection.fragment\"),\n import(\"../ShadersWGSL/glowMapMerge.vertex\"),\n import(\"../ShadersWGSL/selectionOutline.fragment\"),\n ]);\n } else {\n await Promise.all([\n import(\"../Shaders/selection.vertex\"),\n import(\"../Shaders/selection.fragment\"),\n import(\"../Shaders/glowMapMerge.vertex\"),\n import(\"../Shaders/selectionOutline.fragment\"),\n ]);\n }\n\n await super._importShadersAsync();\n }\n\n /**\n * Get the effect name of the layer.\n * @returns The effect name\n */\n public override getEffectName(): string {\n return ThinSelectionOutlineLayer.EffectName;\n }\n\n /** @internal */\n public override _createMergeEffect(): Effect {\n const defines: string[] = [];\n switch (this._options.outlineMethod) {\n case Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL:\n defines.push(\"#define OUTLINELAYER_SAMPLING_TRIDIRECTIONAL\");\n break;\n case Constants.OUTLINELAYER_SAMPLING_OCTADIRECTIONAL:\n defines.push(\"#define OUTLINELAYER_SAMPLING_OCTADIRECTIONAL\");\n break;\n }\n const join = defines.join(\"\\n\");\n\n return this._engine.createEffect(\n {\n // glowMapMerge vertex is just a basic vertex shader for drawing a quad. so we reuse it here\n vertex: \"glowMapMerge\",\n // selection outline fragment does computation of outline with alpha channel for blending\n fragment: \"selectionOutline\",\n },\n <IEffectCreationOptions>{\n attributes: [VertexBuffer.PositionKind],\n uniformsNames: [\"screenSize\", \"outlineColor\", \"outlineThickness\", \"occlusionStrength\", \"occlusionThreshold\"],\n samplers: [\"maskSampler\", \"depthSampler\"],\n defines: join,\n fallbacks: null,\n onCompiled: null,\n onError: null,\n shaderLanguage: this._shaderLanguage,\n extraInitializationsAsync: this._shadersLoaded\n ? undefined\n : async () => {\n await this._importShadersAsync();\n this._shadersLoaded = true;\n },\n },\n this._engine\n );\n }\n\n /** @internal */\n public override _createTextureAndPostProcesses(): void {\n // we don't need to create a texture for this layer. since all computation is done in the merge effect\n }\n\n /**\n * Checks for the readiness of the element composing the layer.\n * @param subMesh the mesh to check for\n * @param useInstances specify whether or not to use instances to render the mesh\n * @returns true if ready otherwise, false\n */\n public override isReady(subMesh: SubMesh, useInstances: boolean): boolean {\n const material = subMesh.getMaterial();\n const mesh = subMesh.getRenderingMesh();\n\n if (!material || !mesh || !this._selection) {\n return false;\n }\n\n return super._isSubMeshReady(subMesh, useInstances, null);\n }\n\n /** @internal */\n public override _canRenderMesh(_mesh: AbstractMesh, _material: Material): boolean {\n return true;\n }\n\n protected override _renderSubMesh(subMesh: SubMesh, enableAlphaMode: boolean = false): void {\n if (!this._internalShouldRender()) {\n return;\n }\n\n const material = subMesh.getMaterial();\n const ownerMesh = subMesh.getMesh();\n const replacementMesh = subMesh.getReplacementMesh();\n const renderingMesh = subMesh.getRenderingMesh();\n const effectiveMesh = subMesh.getEffectiveMesh();\n const scene = this._scene;\n const engine = scene.getEngine();\n\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n\n if (!material) {\n return;\n }\n\n // Do not block in blend mode.\n if (!this._canRenderMesh(renderingMesh, material)) {\n return;\n }\n\n // Culling\n let sideOrientation = material._getEffectiveOrientation(renderingMesh);\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n\n const reverse = sideOrientation === Material.ClockWiseSideOrientation;\n engine.setState(material.backFaceCulling, material.zOffset, undefined, reverse, material.cullBackFaces, undefined, material.zOffsetUnits);\n\n // Managing instances\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!replacementMesh);\n if (batch.mustReturn) {\n return;\n }\n\n // Early Exit per mesh\n if (!this._shouldRenderMesh(renderingMesh)) {\n return;\n }\n\n const hardwareInstancedRendering =\n batch.hardwareInstancedRendering[subMesh._id] ||\n renderingMesh.hasThinInstances ||\n (!!renderingMesh._userInstancedBuffersStorage &&\n ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName in renderingMesh._userInstancedBuffersStorage.vertexBuffers);\n\n this._setEmissiveTextureAndColor(renderingMesh, subMesh, material);\n\n this.onBeforeRenderMeshToEffect.notifyObservers(ownerMesh);\n\n // selection outline layer is not compatible with custom materials\n // if (this._useMeshMaterial(renderingMesh)) {\n // subMesh.getMaterial()!._glowModeEnabled = true;\n // renderingMesh.render(subMesh, enableAlphaMode, replacementMesh || undefined);\n // subMesh.getMaterial()!._glowModeEnabled = false;\n // } else\n if (this._isSubMeshReady(subMesh, hardwareInstancedRendering, this._emissiveTextureAndColor.texture)) {\n const renderingMaterial = effectiveMesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\n\n let drawWrapper = subMesh._getDrawWrapper();\n if (!drawWrapper && renderingMaterial) {\n drawWrapper = renderingMaterial._getDrawWrapper();\n }\n\n if (!drawWrapper) {\n return;\n }\n\n const effect = drawWrapper.effect!;\n\n engine.enableEffect(drawWrapper);\n if (!hardwareInstancedRendering) {\n renderingMesh._bind(subMesh, effect, material.fillMode);\n }\n\n if (!renderingMaterial) {\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n if (this._options.storeCameraSpaceZ) {\n effect.setMatrix(\"view\", scene.getViewMatrix());\n } else {\n const camera = this.camera || scene.activeCamera;\n if (camera) {\n const cameraIsOrtho = camera.mode === Camera.ORTHOGRAPHIC_CAMERA;\n\n let minZ: number, maxZ: number;\n\n if (cameraIsOrtho) {\n minZ = !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n } else {\n minZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? camera.minZ : engine.isNDCHalfZRange ? 0 : camera.minZ;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : camera.maxZ;\n }\n\n effect.setFloat2(\"depthValues\", minZ, minZ + maxZ);\n }\n }\n effect.setMatrix(\"world\", effectiveMesh.getWorldMatrix());\n } else {\n renderingMaterial.bindForSubMesh(effectiveMesh.getWorldMatrix(), effectiveMesh as Mesh, subMesh);\n }\n\n if (!renderingMaterial) {\n // Alpha test\n if (material && material.needAlphaTestingForMesh(effectiveMesh)) {\n const alphaTexture = material.getAlphaTestTexture();\n if (alphaTexture) {\n effect.setTexture(\"diffuseSampler\", alphaTexture);\n effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\n }\n }\n\n // Bones\n BindBonesParameters(renderingMesh, effect);\n\n // Morph targets\n BindMorphTargetParameters(renderingMesh, effect);\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\n renderingMesh.morphTargetManager._bind(effect);\n }\n\n // Baked vertex animations\n const bvaManager = subMesh.getMesh().bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n bvaManager.bind(effect, hardwareInstancedRendering);\n }\n\n // Alpha mode\n if (enableAlphaMode) {\n engine.setAlphaMode(material.alphaMode);\n }\n\n // Clip planes\n BindClipPlane(effect, material, scene);\n\n // Selection ID\n let selectionId = this._meshUniqueIdToSelectionId[renderingMesh.uniqueId];\n // When using LOD, the rendering mesh is the LOD mesh, not the source mesh.\n // Look up the selection ID from the master (source) mesh.\n if (selectionId === undefined && renderingMesh._masterMesh) {\n selectionId = this._meshUniqueIdToSelectionId[renderingMesh._masterMesh.uniqueId];\n if (selectionId === undefined) {\n selectionId = renderingMesh._masterMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n }\n if (!renderingMesh.hasInstances && !renderingMesh.hasThinInstances && !renderingMesh.isAnInstance && selectionId !== undefined) {\n effect.setFloat(\"selectionId\", selectionId);\n }\n }\n\n // Draw\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, world) =>\n effect.setMatrix(\"world\", world)\n );\n } else {\n // Need to reset refresh rate of the main map\n this._objectRenderer.resetRefreshCounter();\n }\n\n this.onAfterRenderMeshToEffect.notifyObservers(ownerMesh);\n }\n\n /** @internal */\n public override _internalCompose(effect: Effect, _renderIndex: number): void {\n // Texture\n this.bindTexturesForCompose(effect);\n effect.setFloat2(\"screenSize\", this.textureWidth, this.textureHeight);\n effect.setColor3(\"outlineColor\", this.outlineColor);\n effect.setFloat(\"outlineThickness\", this.outlineThickness);\n effect.setFloat(\"occlusionStrength\", this.occlusionStrength);\n effect.setFloat(\"occlusionThreshold\", this.occlusionThreshold);\n\n // Cache\n const engine = this._engine;\n const previousStencilBuffer = engine.getStencilBuffer();\n\n // Draw order\n engine.setStencilBuffer(false);\n\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\n\n // Draw order\n engine.setStencilBuffer(previousStencilBuffer);\n }\n\n /** @internal */\n public override _setEmissiveTextureAndColor(_mesh: Mesh, _subMesh: SubMesh, _material: Material): void {\n // we don't use emissive texture or color for this layer\n }\n\n /**\n * Returns true if the layer contains information to display, otherwise false.\n * @returns true if the glow layer should be rendered\n */\n public override shouldRender(): boolean {\n return this._selection && super.shouldRender() ? true : false;\n }\n\n /** @internal */\n public override _shouldRenderMesh(mesh: Mesh): boolean {\n // Use the base class check (renderingGroupId) rather than this.hasMesh,\n // because LOD meshes won't be in _selection but still need to render.\n return super.hasMesh(mesh);\n }\n\n /** @internal */\n public override _addCustomEffectDefines(defines: string[]): void {\n if (this._options.storeCameraSpaceZ) {\n defines.push(\"#define STORE_CAMERASPACE_Z\");\n }\n }\n\n /**\n * Determine if a given mesh will be used in the current effect.\n * @param mesh mesh to test\n * @returns true if the mesh will be used\n */\n public override hasMesh(mesh: AbstractMesh): boolean {\n if (!super.hasMesh(mesh) || !this._selection) {\n return false;\n }\n return this._selection.indexOf(mesh) !== -1;\n }\n\n /** @internal */\n public override _useMeshMaterial(_mesh: AbstractMesh): boolean {\n return false;\n }\n\n private _clearMeshSelection(mesh: Mesh): void {\n if (mesh._userInstancedBuffersStorage) {\n const kind = ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName;\n\n // Dispose per-pass VBOs for this layer's own render passes only (WebGPU)\n if (mesh._userInstancedBuffersStorage.renderPasses) {\n for (const passId of this._objectRenderer.renderPassIds) {\n const passVBOs = mesh._userInstancedBuffersStorage.renderPasses[passId];\n if (passVBOs?.[kind]) {\n passVBOs[kind]!.dispose();\n delete passVBOs[kind];\n }\n }\n }\n\n mesh._userInstancedBuffersStorage.vertexBuffers[kind]?.dispose();\n\n const vao = mesh._userInstancedBuffersStorage.vertexArrayObjects?.[kind];\n if (vao) {\n // invalidate VAO is very important to keep sync between VAO and vertex buffers\n (this._engine as ThinEngine).releaseVertexArrayObject(vao);\n delete mesh._userInstancedBuffersStorage.vertexArrayObjects![kind];\n }\n\n delete mesh._userInstancedBuffersStorage.data[kind];\n delete mesh._userInstancedBuffersStorage.vertexBuffers[kind];\n delete mesh._userInstancedBuffersStorage.strides[kind];\n delete mesh._userInstancedBuffersStorage.sizes[kind];\n\n if (Object.keys(mesh._userInstancedBuffersStorage.vertexBuffers).length === 0) {\n mesh._userInstancedBuffersStorage = undefined!;\n }\n }\n if (this._isDef(mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n if (this._selection) {\n const index = this._selection.indexOf(mesh);\n if (~index) {\n this._selection.splice(index, 1);\n }\n }\n }\n\n /**\n * Remove all the meshes currently referenced in the selection outline layer\n */\n public clearSelection(): void {\n if (!this._selection) {\n return;\n }\n\n for (let index = 0; index < this._selection.length; ++index) {\n const mesh = this._selection[index] as Mesh;\n this._clearMeshSelection(mesh);\n if (this._isDef(mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n }\n this._selection.length = 0;\n this._meshUniqueIdToSelectionId.length = 0;\n\n this._nextSelectionId = 1;\n\n this._shouldRender = false;\n }\n\n /**\n * Adds mesh or group of mesh to the current selection\n *\n * If a group of meshes is provided, they will outline as a single unit\n * @param meshOrGroup Meshes to add to the selection\n */\n public addSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void {\n if (!this._selection) {\n return;\n }\n\n const nextId = this._nextSelectionId;\n\n const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];\n if (group.length === 0) {\n return;\n }\n\n for (let meshIndex = 0; meshIndex < group.length; ++meshIndex) {\n const mesh = group[meshIndex];\n\n this._selection.push(mesh); // add to render list\n\n if (mesh.hasInstances || mesh.isAnInstance) {\n const sourceMesh = (mesh as InstancedMesh).sourceMesh ?? (mesh as Mesh);\n\n if (!this._isDef(sourceMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n sourceMesh.registerInstancedBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, 1);\n }\n\n mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] = nextId;\n } else if (mesh.hasThinInstances) {\n const thinInstanceCount = (mesh as Mesh).thinInstanceCount;\n const selectionIdData = new Float32Array(thinInstanceCount);\n for (let i = 0; i < thinInstanceCount; i++) {\n selectionIdData[i] = nextId;\n }\n (mesh as Mesh).thinInstanceSetBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, selectionIdData, 1);\n } else {\n this._meshUniqueIdToSelectionId[mesh.uniqueId] = nextId;\n }\n }\n this._nextSelectionId += 1;\n\n this._shouldRender = true;\n }\n\n /**\n * Adds mesh or group of mesh to the current selection\n * @param meshOrGroup Meshes to remove from the selection\n */\n\n public removeSelection(meshOrGroup: AbstractMesh | AbstractMesh[]) {\n if (!this._selection) {\n return;\n }\n const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];\n if (group.length === 0) {\n return;\n }\n for (let i = 0; i < group.length; i++) {\n const mesh = group[i] as Mesh;\n this._clearMeshSelection(mesh);\n delete this._meshUniqueIdToSelectionId[mesh.uniqueId];\n }\n if (!this._selection || !this._selection.length) {\n this._meshUniqueIdToSelectionId.length = 0;\n\n this._nextSelectionId = 1;\n\n this._shouldRender = false;\n }\n }\n\n /**\n * Free any resources and references associated to a mesh.\n * Internal use\n * @param mesh The mesh to free.\n * @internal\n */\n public _disposeMesh(mesh: Mesh): void {\n const selection = this._selection;\n if (!selection) {\n return;\n }\n\n const index = selection.indexOf(mesh);\n if (index !== -1) {\n selection.splice(index, 1);\n\n if (mesh.hasInstances) {\n mesh.removeVerticesData(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName);\n } else if (mesh.hasThinInstances) {\n (mesh as Mesh).thinInstanceSetBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, null);\n }\n\n if (selection.length === 0) {\n this._shouldRender = false;\n }\n }\n }\n\n /**\n * Dispose the effect layer and free resources.\n */\n public override dispose(): void {\n this.clearSelection();\n this._selection = null;\n\n super.dispose();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"thinSelectionOutlineLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/thinSelectionOutlineLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAE9H,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,0CAA0C,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAG/K,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAgC,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyBlF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IAmD1D;;;;;;OAMG;IACH,YAAmB,IAAY,EAAE,KAAa,EAAE,OAAoD,EAAE,gBAAgB,GAAG,KAAK;QAC1H,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QA/C5E;;WAEG;QACI,iBAAY,GAAW,IAAI,MAAM,CAAC,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QAED,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAE3B,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpB,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,gCAAgC,CAAC,CAAC;YACxF,CAAC;iBAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBAC9B,IAAa,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;YAC3G,CAAC;YAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC/B,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AA7yBD;;GAEG;AACoB,oCAAU,GAAG,uBAAuB,AAA1B,CAA2B;AAE5D;;;GAGG;AACoB,0DAAgC,GAAG,qBAAqB,AAAxB,CAAyB","sourcesContent":["import { VertexBuffer } from \"../Buffers/buffer\";\nimport { Camera } from \"../Cameras/camera\";\nimport { Constants } from \"../Engines/constants\";\nimport { type ThinEngine } from \"../Engines/thinEngine\";\nimport { AddClipPlaneUniforms, BindClipPlane, PrepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper\";\nimport { type Effect, type IEffectCreationOptions } from \"../Materials/effect\";\nimport { EffectFallbacks } from \"../Materials/effectFallbacks\";\nimport { Material } from \"../Materials/material\";\nimport { BindBonesParameters, BindMorphTargetParameters, PrepareDefinesAndAttributesForMorphTargets, PushAttributesForInstances } from \"../Materials/materialHelper.functions\";\nimport { ShaderLanguage } from \"../Materials/shaderLanguage\";\nimport { type BaseTexture } from \"../Materials/Textures/baseTexture\";\nimport { Color3, Color4 } from \"../Maths/math.color\";\nimport { type AbstractMesh } from \"../Meshes/abstractMesh\";\nimport { type InstancedMesh } from \"../Meshes/instancedMesh\";\nimport { type Mesh } from \"../Meshes/mesh\";\nimport { type SubMesh } from \"../Meshes/subMesh\";\nimport { type Scene } from \"../scene\";\nimport { type Nullable } from \"../types\";\nimport { type IThinEffectLayerOptions, ThinEffectLayer } from \"./thinEffectLayer\";\n\n/**\n * Selection outline layer options. This helps customizing the behaviour\n * of the selection outline layer.\n */\nexport interface IThinSelectionOutlineLayerOptions extends IThinEffectLayerOptions {\n /**\n * Use the GLSL code generation for the shader (even on WebGPU). Default is false\n */\n forceGLSL?: boolean;\n\n /**\n * Specifies whether the depth stored is the Z coordinate in camera space.\n */\n storeCameraSpaceZ?: boolean;\n\n /**\n * Outline method to use (default: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL)\n *\n * @see {@link Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL}\n */\n outlineMethod?: number;\n}\n\n/**\n * @internal\n */\nexport class ThinSelectionOutlineLayer extends ThinEffectLayer {\n /**\n * Effect Name of the layer.\n */\n public static readonly EffectName = \"SelectionOutlineLayer\";\n\n /**\n * Name of the instance selection ID attribute\n * @internal\n */\n public static readonly InstanceSelectionIdAttributeName = \"instanceSelectionId\";\n\n /**\n * The outline color\n */\n public outlineColor: Color3 = new Color3(1, 0.5, 0);\n\n /**\n * The thickness of the edges\n */\n public outlineThickness: number = 2.0;\n\n /**\n * The strength of the occlusion effect (default: 0.8)\n */\n public occlusionStrength: number = 0.8;\n\n /**\n * The occlusion threshold (default: 0.0001)\n */\n public occlusionThreshold: number = 0.0001;\n\n /**\n * The width of the source texture\n */\n public textureWidth: number = 0;\n\n /**\n * The height of the source texture\n */\n public textureHeight: number = 0;\n\n /** @internal */\n public override _options: Required<IThinSelectionOutlineLayerOptions>;\n\n /** @internal */\n public readonly _meshUniqueIdToSelectionId: number[] = [];\n /** @internal */\n public _selection: Nullable<AbstractMesh[]> = [];\n private _nextSelectionId = 1;\n\n /**\n * Instantiates a new selection outline Layer and references it to the scene..\n * @param name The name of the layer\n * @param scene The scene to use the layer in\n * @param options Sets of none mandatory options to use with the layer (see IThinSelectionOutlineLayerOptions for more information)\n * @param dontCheckIfReady Specifies if the layer should disable checking whether all the post processes are ready (default: false). To save performance, this should be set to true and you should call `isReady` manually before rendering to the layer.\n */\n public constructor(name: string, scene?: Scene, options?: Partial<IThinSelectionOutlineLayerOptions>, dontCheckIfReady = false) {\n super(name, scene, options !== undefined ? !!options.forceGLSL : false);\n\n // Adapt options\n this._options = {\n mainTextureRatio: 1.0,\n mainTextureFixedSize: 0,\n alphaBlendingMode: Constants.ALPHA_COMBINE,\n camera: null,\n renderingGroupId: -1,\n forceGLSL: false,\n mainTextureType: Constants.TEXTURETYPE_FLOAT,\n mainTextureFormat: Constants.TEXTUREFORMAT_RG,\n storeCameraSpaceZ: false,\n outlineMethod: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL,\n ...options,\n };\n\n // Fall back to a supported mask texture type if the device doesn't support rendering to float framebuffers\n // or linear filtering of float textures (e.g. OES_texture_float_linear missing on some iOS versions)\n if (this._options.mainTextureType === Constants.TEXTURETYPE_FLOAT && !(this._engine.getCaps().textureFloatRender && this._engine.getCaps().textureFloatLinearFiltering)) {\n this._options.mainTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\n }\n if (\n this._options.mainTextureType === Constants.TEXTURETYPE_HALF_FLOAT &&\n !(this._engine.getCaps().textureHalfFloatRender && this._engine.getCaps().textureHalfFloatLinearFiltering)\n ) {\n this._options.mainTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\n }\n\n // When using an 8-bit render target, we cannot reliably store camera-space Z in the mask texture:\n // depth would be clamped/quantized, breaking occlusion comparisons. In that case, force-disable\n // storeCameraSpaceZ so the layer falls back to the supported behavior.\n if (this._options.storeCameraSpaceZ && this._options.mainTextureType === Constants.TEXTURETYPE_UNSIGNED_BYTE) {\n this._options.storeCameraSpaceZ = false;\n }\n // set clear color\n this.neutralColor = new Color4(0.0, this._options.storeCameraSpaceZ ? 0.0 : 1.0, 0.0, 1.0);\n\n // Initialize the layer\n this._init(this._options);\n\n // Do not render as long as no meshes have been added\n this._shouldRender = false;\n\n if (dontCheckIfReady) {\n // When dontCheckIfReady is true, we are in the new ThinXXX layer mode, so we must call _createTextureAndPostProcesses ourselves (it is called by EffectLayer otherwise)\n this._createTextureAndPostProcesses();\n }\n }\n\n /**\n * Gets the class name of the effect layer\n * @returns the string with the class name of the effect layer\n */\n public getClassName(): string {\n return \"SelectionOutlineLayer\";\n }\n\n private _isDef(val: any) {\n return val !== void 0 && val !== null;\n }\n\n /** @internal */\n public override _internalIsSubMeshReady(subMesh: SubMesh, useInstances: boolean, _emissiveTexture: Nullable<BaseTexture>): boolean {\n const engine = this._scene.getEngine();\n const mesh = subMesh.getMesh();\n\n const renderingMaterial = mesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\n\n if (renderingMaterial) {\n return renderingMaterial.isReadyForSubMesh(mesh, subMesh, useInstances);\n }\n\n const material = subMesh.getMaterial();\n\n if (!material) {\n return false;\n }\n\n // selection outline layer is not compatible with custom materials\n // if (this._useMeshMaterial(subMesh.getRenderingMesh())) {\n // return material.isReadyForSubMesh(subMesh.getMesh(), subMesh, useInstances);\n // }\n\n const defines: string[] = [];\n\n const attribs = [VertexBuffer.PositionKind];\n\n let uv1 = false;\n let uv2 = false;\n const color = false;\n\n // Alpha test\n if (material.needAlphaTestingForMesh(mesh)) {\n defines.push(\"#define ALPHATEST\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n attribs.push(VertexBuffer.UVKind);\n defines.push(\"#define UV1\");\n uv1 = true;\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\n attribs.push(VertexBuffer.UV2Kind);\n defines.push(\"#define UV2\");\n uv2 = true;\n }\n }\n\n // Bones\n const fallbacks = new EffectFallbacks();\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (mesh.numBoneInfluencers > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\n\n const skeleton = mesh.skeleton;\n if (skeleton && skeleton.isUsingTextureForMatrices) {\n defines.push(\"#define BONETEXTURE\");\n } else {\n defines.push(\"#define BonesPerMesh \" + (skeleton ? skeleton.bones.length + 1 : 0));\n }\n\n if (mesh.numBoneInfluencers > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n } else {\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\n }\n\n // Morph targets\n const numMorphInfluencers = mesh.morphTargetManager\n ? PrepareDefinesAndAttributesForMorphTargets(\n mesh.morphTargetManager,\n defines,\n attribs,\n mesh,\n true, // usePositionMorph\n false, // useNormalMorph\n false, // useTangentMorph\n uv1, // useUVMorph\n uv2, // useUV2Morph\n color // useColorMorph\n )\n : 0;\n\n // Instances\n if (useInstances) {\n defines.push(\"#define INSTANCES\");\n PushAttributesForInstances(attribs);\n if (subMesh.getRenderingMesh().hasThinInstances) {\n defines.push(\"#define THIN_INSTANCES\");\n }\n }\n\n // Baked vertex animations\n const bvaManager = mesh.bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n defines.push(\"#define BAKED_VERTEX_ANIMATION_TEXTURE\");\n if (useInstances) {\n attribs.push(\"bakedVertexAnimationSettingsInstanced\");\n }\n }\n\n // ClipPlanes\n PrepareStringDefinesForClipPlanes(material, this._scene, defines);\n\n // Selection ID\n if (useInstances) {\n attribs.push(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName);\n }\n\n this._addCustomEffectDefines(defines);\n\n // Get correct effect\n const drawWrapper = subMesh._getDrawWrapper(undefined, true)!;\n const cachedDefines = drawWrapper.defines as string;\n const join = defines.join(\"\\n\");\n if (cachedDefines !== join) {\n const uniforms = [\n \"world\",\n \"mBones\",\n \"viewProjection\",\n \"view\",\n \"morphTargetInfluences\",\n \"morphTargetCount\",\n \"boneTextureInfo\",\n \"diffuseMatrix\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n \"bakedVertexAnimationSettings\",\n \"bakedVertexAnimationTextureSizeInverted\",\n \"bakedVertexAnimationTime\",\n \"bakedVertexAnimationTexture\",\n \"depthValues\",\n \"selectionId\",\n ];\n\n AddClipPlaneUniforms(uniforms);\n\n drawWrapper.setEffect(\n this._engine.createEffect(\n \"selection\",\n <IEffectCreationOptions>{\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: [],\n samplers: [\"diffuseSampler\", \"boneSampler\", \"morphTargets\", \"bakedVertexAnimationTexture\"],\n defines: join,\n fallbacks: fallbacks,\n onCompiled: null,\n onError: null,\n indexParameters: { maxSimultaneousMorphTargets: numMorphInfluencers },\n shaderLanguage: this._shaderLanguage,\n extraInitializationsAsync: this._shadersLoaded\n ? undefined\n : async () => {\n await this._importShadersAsync();\n this._shadersLoaded = true;\n },\n },\n this._engine\n ),\n join\n );\n }\n\n const effectIsReady = drawWrapper.effect!.isReady();\n\n return effectIsReady && (this._dontCheckIfReady || (!this._dontCheckIfReady && this.isLayerReady()));\n }\n\n protected override async _importShadersAsync(): Promise<void> {\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\n await Promise.all([\n import(\"../ShadersWGSL/selection.vertex\"),\n import(\"../ShadersWGSL/selection.fragment\"),\n import(\"../ShadersWGSL/glowMapMerge.vertex\"),\n import(\"../ShadersWGSL/selectionOutline.fragment\"),\n ]);\n } else {\n await Promise.all([\n import(\"../Shaders/selection.vertex\"),\n import(\"../Shaders/selection.fragment\"),\n import(\"../Shaders/glowMapMerge.vertex\"),\n import(\"../Shaders/selectionOutline.fragment\"),\n ]);\n }\n\n await super._importShadersAsync();\n }\n\n /**\n * Get the effect name of the layer.\n * @returns The effect name\n */\n public override getEffectName(): string {\n return ThinSelectionOutlineLayer.EffectName;\n }\n\n /** @internal */\n public override _createMergeEffect(): Effect {\n const defines: string[] = [];\n switch (this._options.outlineMethod) {\n case Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL:\n defines.push(\"#define OUTLINELAYER_SAMPLING_TRIDIRECTIONAL\");\n break;\n case Constants.OUTLINELAYER_SAMPLING_OCTADIRECTIONAL:\n defines.push(\"#define OUTLINELAYER_SAMPLING_OCTADIRECTIONAL\");\n break;\n }\n const join = defines.join(\"\\n\");\n\n return this._engine.createEffect(\n {\n // glowMapMerge vertex is just a basic vertex shader for drawing a quad. so we reuse it here\n vertex: \"glowMapMerge\",\n // selection outline fragment does computation of outline with alpha channel for blending\n fragment: \"selectionOutline\",\n },\n <IEffectCreationOptions>{\n attributes: [VertexBuffer.PositionKind],\n uniformsNames: [\"screenSize\", \"outlineColor\", \"outlineThickness\", \"occlusionStrength\", \"occlusionThreshold\"],\n samplers: [\"maskSampler\", \"depthSampler\"],\n defines: join,\n fallbacks: null,\n onCompiled: null,\n onError: null,\n shaderLanguage: this._shaderLanguage,\n extraInitializationsAsync: this._shadersLoaded\n ? undefined\n : async () => {\n await this._importShadersAsync();\n this._shadersLoaded = true;\n },\n },\n this._engine\n );\n }\n\n /** @internal */\n public override _createTextureAndPostProcesses(): void {\n // we don't need to create a texture for this layer. since all computation is done in the merge effect\n }\n\n /**\n * Checks for the readiness of the element composing the layer.\n * @param subMesh the mesh to check for\n * @param useInstances specify whether or not to use instances to render the mesh\n * @returns true if ready otherwise, false\n */\n public override isReady(subMesh: SubMesh, useInstances: boolean): boolean {\n const material = subMesh.getMaterial();\n const mesh = subMesh.getRenderingMesh();\n\n if (!material || !mesh || !this._selection) {\n return false;\n }\n\n return super._isSubMeshReady(subMesh, useInstances, null);\n }\n\n /** @internal */\n public override _canRenderMesh(_mesh: AbstractMesh, _material: Material): boolean {\n return true;\n }\n\n protected override _renderSubMesh(subMesh: SubMesh, enableAlphaMode: boolean = false): void {\n if (!this._internalShouldRender()) {\n return;\n }\n\n const material = subMesh.getMaterial();\n const ownerMesh = subMesh.getMesh();\n const replacementMesh = subMesh.getReplacementMesh();\n const renderingMesh = subMesh.getRenderingMesh();\n const effectiveMesh = subMesh.getEffectiveMesh();\n const scene = this._scene;\n const engine = scene.getEngine();\n\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n\n if (!material) {\n return;\n }\n\n // Do not block in blend mode.\n if (!this._canRenderMesh(renderingMesh, material)) {\n return;\n }\n\n // Culling\n let sideOrientation = material._getEffectiveOrientation(renderingMesh);\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n\n const reverse = sideOrientation === Material.ClockWiseSideOrientation;\n engine.setState(material.backFaceCulling, material.zOffset, undefined, reverse, material.cullBackFaces, undefined, material.zOffsetUnits);\n\n // Managing instances\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!replacementMesh);\n if (batch.mustReturn) {\n return;\n }\n\n // Early Exit per mesh\n if (!this._shouldRenderMesh(renderingMesh)) {\n return;\n }\n\n const hardwareInstancedRendering =\n batch.hardwareInstancedRendering[subMesh._id] ||\n renderingMesh.hasThinInstances ||\n (!!renderingMesh._userInstancedBuffersStorage &&\n ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName in renderingMesh._userInstancedBuffersStorage.vertexBuffers);\n\n this._setEmissiveTextureAndColor(renderingMesh, subMesh, material);\n\n this.onBeforeRenderMeshToEffect.notifyObservers(ownerMesh);\n\n // selection outline layer is not compatible with custom materials\n // if (this._useMeshMaterial(renderingMesh)) {\n // subMesh.getMaterial()!._glowModeEnabled = true;\n // renderingMesh.render(subMesh, enableAlphaMode, replacementMesh || undefined);\n // subMesh.getMaterial()!._glowModeEnabled = false;\n // } else\n if (this._isSubMeshReady(subMesh, hardwareInstancedRendering, this._emissiveTextureAndColor.texture)) {\n const renderingMaterial = effectiveMesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\n\n let drawWrapper = subMesh._getDrawWrapper();\n if (!drawWrapper && renderingMaterial) {\n drawWrapper = renderingMaterial._getDrawWrapper();\n }\n\n if (!drawWrapper) {\n return;\n }\n\n const effect = drawWrapper.effect!;\n\n engine.enableEffect(drawWrapper);\n if (!hardwareInstancedRendering) {\n renderingMesh._bind(subMesh, effect, material.fillMode);\n }\n\n if (!renderingMaterial) {\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n if (this._options.storeCameraSpaceZ) {\n effect.setMatrix(\"view\", scene.getViewMatrix());\n } else {\n const camera = this.camera || scene.activeCamera;\n if (camera) {\n const cameraIsOrtho = camera.mode === Camera.ORTHOGRAPHIC_CAMERA;\n\n let minZ: number, maxZ: number;\n\n if (cameraIsOrtho) {\n minZ = !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n } else {\n minZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? camera.minZ : engine.isNDCHalfZRange ? 0 : camera.minZ;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : camera.maxZ;\n }\n\n effect.setFloat2(\"depthValues\", minZ, minZ + maxZ);\n }\n }\n effect.setMatrix(\"world\", effectiveMesh.getWorldMatrix());\n } else {\n renderingMaterial.bindForSubMesh(effectiveMesh.getWorldMatrix(), effectiveMesh as Mesh, subMesh);\n }\n\n if (!renderingMaterial) {\n // Alpha test\n if (material && material.needAlphaTestingForMesh(effectiveMesh)) {\n const alphaTexture = material.getAlphaTestTexture();\n if (alphaTexture) {\n effect.setTexture(\"diffuseSampler\", alphaTexture);\n effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\n }\n }\n\n // Bones\n BindBonesParameters(renderingMesh, effect);\n\n // Morph targets\n BindMorphTargetParameters(renderingMesh, effect);\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\n renderingMesh.morphTargetManager._bind(effect);\n }\n\n // Baked vertex animations\n const bvaManager = subMesh.getMesh().bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n bvaManager.bind(effect, hardwareInstancedRendering);\n }\n\n // Alpha mode\n if (enableAlphaMode) {\n engine.setAlphaMode(material.alphaMode);\n }\n\n // Clip planes\n BindClipPlane(effect, material, scene);\n\n // Selection ID\n let selectionId = this._meshUniqueIdToSelectionId[renderingMesh.uniqueId];\n // When using LOD, the rendering mesh is the LOD mesh, not the source mesh.\n // Look up the selection ID from the master (source) mesh.\n if (selectionId === undefined && renderingMesh._masterMesh) {\n selectionId = this._meshUniqueIdToSelectionId[renderingMesh._masterMesh.uniqueId];\n if (selectionId === undefined) {\n selectionId = renderingMesh._masterMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n }\n if (!renderingMesh.hasInstances && !renderingMesh.hasThinInstances && !renderingMesh.isAnInstance && selectionId !== undefined) {\n effect.setFloat(\"selectionId\", selectionId);\n }\n }\n\n // Draw\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, world) =>\n effect.setMatrix(\"world\", world)\n );\n } else {\n // Need to reset refresh rate of the main map\n this._objectRenderer.resetRefreshCounter();\n }\n\n this.onAfterRenderMeshToEffect.notifyObservers(ownerMesh);\n }\n\n /** @internal */\n public override _internalCompose(effect: Effect, _renderIndex: number): void {\n // Texture\n this.bindTexturesForCompose(effect);\n effect.setFloat2(\"screenSize\", this.textureWidth, this.textureHeight);\n effect.setColor3(\"outlineColor\", this.outlineColor);\n effect.setFloat(\"outlineThickness\", this.outlineThickness);\n effect.setFloat(\"occlusionStrength\", this.occlusionStrength);\n effect.setFloat(\"occlusionThreshold\", this.occlusionThreshold);\n\n // Cache\n const engine = this._engine;\n const previousStencilBuffer = engine.getStencilBuffer();\n\n // Draw order\n engine.setStencilBuffer(false);\n\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\n\n // Draw order\n engine.setStencilBuffer(previousStencilBuffer);\n }\n\n /** @internal */\n public override _setEmissiveTextureAndColor(_mesh: Mesh, _subMesh: SubMesh, _material: Material): void {\n // we don't use emissive texture or color for this layer\n }\n\n /**\n * Returns true if the layer contains information to display, otherwise false.\n * @returns true if the glow layer should be rendered\n */\n public override shouldRender(): boolean {\n return this._selection && super.shouldRender() ? true : false;\n }\n\n /** @internal */\n public override _shouldRenderMesh(mesh: Mesh): boolean {\n // Use the base class check (renderingGroupId) rather than this.hasMesh,\n // because LOD meshes won't be in _selection but still need to render.\n return super.hasMesh(mesh);\n }\n\n /** @internal */\n public override _addCustomEffectDefines(defines: string[]): void {\n if (this._options.storeCameraSpaceZ) {\n defines.push(\"#define STORE_CAMERASPACE_Z\");\n }\n }\n\n /**\n * Determine if a given mesh will be used in the current effect.\n * @param mesh mesh to test\n * @returns true if the mesh will be used\n */\n public override hasMesh(mesh: AbstractMesh): boolean {\n if (!super.hasMesh(mesh) || !this._selection) {\n return false;\n }\n return this._selection.indexOf(mesh) !== -1;\n }\n\n /** @internal */\n public override _useMeshMaterial(_mesh: AbstractMesh): boolean {\n return false;\n }\n\n private _clearMeshSelection(mesh: Mesh): void {\n if (mesh._userInstancedBuffersStorage) {\n const kind = ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName;\n\n // Dispose per-pass VBOs for ALL render passes (WebGPU).\n // _processInstancedBuffers creates per-pass VBOs for every render pass\n // that renders this mesh (main scene, depth renderer, etc.), not just\n // this layer's own passes. We must clean them all up to avoid using\n // a destroyed GPU buffer on the next submit.\n if (mesh._userInstancedBuffersStorage.renderPasses) {\n for (const passId in mesh._userInstancedBuffersStorage.renderPasses) {\n const renderPassId = Number(passId);\n const passVBOs = mesh._userInstancedBuffersStorage.renderPasses[renderPassId];\n if (passVBOs?.[kind]) {\n passVBOs[kind]!.dispose();\n delete passVBOs[kind];\n }\n }\n }\n\n mesh._userInstancedBuffersStorage.vertexBuffers[kind]?.dispose();\n\n const vao = mesh._userInstancedBuffersStorage.vertexArrayObjects?.[kind];\n if (vao) {\n // invalidate VAO is very important to keep sync between VAO and vertex buffers\n (this._engine as ThinEngine).releaseVertexArrayObject(vao);\n delete mesh._userInstancedBuffersStorage.vertexArrayObjects![kind];\n }\n\n delete mesh._userInstancedBuffersStorage.data[kind];\n delete mesh._userInstancedBuffersStorage.vertexBuffers[kind];\n delete mesh._userInstancedBuffersStorage.strides[kind];\n delete mesh._userInstancedBuffersStorage.sizes[kind];\n\n if (Object.keys(mesh._userInstancedBuffersStorage.vertexBuffers).length === 0) {\n mesh._userInstancedBuffersStorage = undefined!;\n }\n }\n if (this._isDef(mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n\n // In WebGPU non-compat mode, cached render bundles (fastBundle) bake\n // vertex-buffer GPU handles at record time. Because the new VBO has\n // the same format (and thus the same hashCode), the pipeline cache\n // won't detect the change and would replay the stale bundle.\n // Resetting the draw cache forces new bundles to be recorded.\n if (this._engine.isWebGPU && !this._engine.compatibilityMode) {\n mesh.resetDrawCache();\n }\n if (this._selection) {\n const index = this._selection.indexOf(mesh);\n if (~index) {\n this._selection.splice(index, 1);\n }\n }\n }\n\n /**\n * Remove all the meshes currently referenced in the selection outline layer\n */\n public clearSelection(): void {\n if (!this._selection) {\n return;\n }\n\n for (let index = 0; index < this._selection.length; ++index) {\n const mesh = this._selection[index] as Mesh;\n this._clearMeshSelection(mesh);\n if (this._isDef(mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n }\n this._selection.length = 0;\n this._meshUniqueIdToSelectionId.length = 0;\n\n this._nextSelectionId = 1;\n\n this._shouldRender = false;\n }\n\n /**\n * Adds mesh or group of mesh to the current selection\n *\n * If a group of meshes is provided, they will outline as a single unit\n * @param meshOrGroup Meshes to add to the selection\n */\n public addSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void {\n if (!this._selection) {\n return;\n }\n\n const nextId = this._nextSelectionId;\n\n const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];\n if (group.length === 0) {\n return;\n }\n\n for (let meshIndex = 0; meshIndex < group.length; ++meshIndex) {\n const mesh = group[meshIndex];\n\n this._selection.push(mesh); // add to render list\n\n if (mesh.hasInstances || mesh.isAnInstance) {\n const sourceMesh = (mesh as InstancedMesh).sourceMesh ?? (mesh as Mesh);\n\n if (!this._isDef(sourceMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n sourceMesh.registerInstancedBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, 1);\n }\n\n mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] = nextId;\n } else if (mesh.hasThinInstances) {\n const thinInstanceCount = (mesh as Mesh).thinInstanceCount;\n const selectionIdData = new Float32Array(thinInstanceCount);\n for (let i = 0; i < thinInstanceCount; i++) {\n selectionIdData[i] = nextId;\n }\n (mesh as Mesh).thinInstanceSetBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, selectionIdData, 1);\n } else {\n this._meshUniqueIdToSelectionId[mesh.uniqueId] = nextId;\n }\n }\n this._nextSelectionId += 1;\n\n this._shouldRender = true;\n }\n\n /**\n * Adds mesh or group of mesh to the current selection\n * @param meshOrGroup Meshes to remove from the selection\n */\n\n public removeSelection(meshOrGroup: AbstractMesh | AbstractMesh[]) {\n if (!this._selection) {\n return;\n }\n const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];\n if (group.length === 0) {\n return;\n }\n for (let i = 0; i < group.length; i++) {\n const mesh = group[i] as Mesh;\n this._clearMeshSelection(mesh);\n delete this._meshUniqueIdToSelectionId[mesh.uniqueId];\n }\n if (!this._selection || !this._selection.length) {\n this._meshUniqueIdToSelectionId.length = 0;\n\n this._nextSelectionId = 1;\n\n this._shouldRender = false;\n }\n }\n\n /**\n * Free any resources and references associated to a mesh.\n * Internal use\n * @param mesh The mesh to free.\n * @internal\n */\n public _disposeMesh(mesh: Mesh): void {\n const selection = this._selection;\n if (!selection) {\n return;\n }\n\n const index = selection.indexOf(mesh);\n if (index !== -1) {\n selection.splice(index, 1);\n\n if (mesh.hasInstances) {\n mesh.removeVerticesData(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName);\n } else if (mesh.hasThinInstances) {\n (mesh as Mesh).thinInstanceSetBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, null);\n }\n\n if (selection.length === 0) {\n this._shouldRender = false;\n }\n }\n }\n\n /**\n * Dispose the effect layer and free resources.\n */\n public override dispose(): void {\n this.clearSelection();\n this._selection = null;\n\n super.dispose();\n }\n}\n"]}
|
|
@@ -102,4 +102,10 @@ export declare class ClusteredLightContainer extends Light {
|
|
|
102
102
|
transferToNodeMaterialEffect(_effect: Effect): Light;
|
|
103
103
|
prepareLightSpecificDefines(defines: any, lightIndex: number): void;
|
|
104
104
|
_isReady(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Serializes the ClusteredLightContainer to a JSON object, including all child lights.
|
|
107
|
+
* @returns the serialized object
|
|
108
|
+
*/
|
|
109
|
+
serialize(): any;
|
|
110
|
+
protected _onParsed(parsedLight: any, scene: Scene): void;
|
|
105
111
|
}
|
|
@@ -492,6 +492,45 @@ export class ClusteredLightContainer extends Light {
|
|
|
492
492
|
this._updateBatches();
|
|
493
493
|
return this._proxyMesh.isReady(true, true);
|
|
494
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* Serializes the ClusteredLightContainer to a JSON object, including all child lights.
|
|
497
|
+
* @returns the serialized object
|
|
498
|
+
*/
|
|
499
|
+
serialize() {
|
|
500
|
+
const serializationObject = super.serialize();
|
|
501
|
+
// Serialize child lights inline so they round-trip with the container.
|
|
502
|
+
// Child lights are removed from scene.lights by addLight(), so the scene
|
|
503
|
+
// serializer would not reach them on its own.
|
|
504
|
+
serializationObject.clusteredLights = [];
|
|
505
|
+
for (const light of this._lights) {
|
|
506
|
+
if (!light.doNotSerialize) {
|
|
507
|
+
serializationObject.clusteredLights.push(light.serialize());
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
return serializationObject;
|
|
511
|
+
}
|
|
512
|
+
_onParsed(parsedLight, scene) {
|
|
513
|
+
if (parsedLight.clusteredLights) {
|
|
514
|
+
// Parse child lights first, but defer addLight() until after the loader
|
|
515
|
+
// fixup passes (parent resolution, excluded/included mesh resolution)
|
|
516
|
+
// have run on scene.lights. addLight() removes lights from scene.lights,
|
|
517
|
+
// which would cause those fixups to miss the child lights.
|
|
518
|
+
const parsedChildLights = [];
|
|
519
|
+
for (const parsedChildLight of parsedLight.clusteredLights) {
|
|
520
|
+
const childLight = Light.Parse(parsedChildLight, scene);
|
|
521
|
+
if (childLight) {
|
|
522
|
+
parsedChildLights.push(childLight);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (parsedChildLights.length > 0) {
|
|
526
|
+
scene.onDataLoadedObservable.addOnce(() => {
|
|
527
|
+
for (const childLight of parsedChildLights) {
|
|
528
|
+
this.addLight(childLight);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
495
534
|
}
|
|
496
535
|
/** @internal */
|
|
497
536
|
ClusteredLightContainer._SceneComponentInitialization = () => {
|
|
@@ -503,6 +542,9 @@ __decorate([
|
|
|
503
542
|
__decorate([
|
|
504
543
|
serialize()
|
|
505
544
|
], ClusteredLightContainer.prototype, "verticalTiles", null);
|
|
545
|
+
__decorate([
|
|
546
|
+
serialize()
|
|
547
|
+
], ClusteredLightContainer.prototype, "depthSlices", null);
|
|
506
548
|
__decorate([
|
|
507
549
|
serialize()
|
|
508
550
|
], ClusteredLightContainer.prototype, "maxRange", null);
|