@onerjs/core 8.37.8 → 8.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Layers/selectionOutlineLayer.d.ts +5 -0
- package/Layers/selectionOutlineLayer.js +7 -0
- package/Layers/selectionOutlineLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +6 -0
- package/Layers/thinSelectionOutlineLayer.js +52 -20
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +4 -0
- package/Meshes/abstractMesh.js +4 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/subMesh.js +5 -1
- package/Meshes/subMesh.js.map +1 -1
- package/package.json +1 -1
|
@@ -152,6 +152,11 @@ export declare class SelectionOutlineLayer extends EffectLayer {
|
|
|
152
152
|
* @param meshOrGroup Meshes to add to the selection
|
|
153
153
|
*/
|
|
154
154
|
addSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void;
|
|
155
|
+
/**
|
|
156
|
+
* Adds mesh or group of mesh to the current selection
|
|
157
|
+
* @param meshOrGroup Meshes to remove from the selection
|
|
158
|
+
*/
|
|
159
|
+
removeSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void;
|
|
155
160
|
/**
|
|
156
161
|
* Free any resources and references associated to a mesh.
|
|
157
162
|
* Internal use
|
|
@@ -231,6 +231,13 @@ export class SelectionOutlineLayer extends EffectLayer {
|
|
|
231
231
|
addSelection(meshOrGroup) {
|
|
232
232
|
this._thinEffectLayer.addSelection(meshOrGroup);
|
|
233
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Adds mesh or group of mesh to the current selection
|
|
236
|
+
* @param meshOrGroup Meshes to remove from the selection
|
|
237
|
+
*/
|
|
238
|
+
removeSelection(meshOrGroup) {
|
|
239
|
+
this._thinEffectLayer.removeSelection(meshOrGroup);
|
|
240
|
+
}
|
|
234
241
|
/**
|
|
235
242
|
* Free any resources and references associated to a mesh.
|
|
236
243
|
* Internal use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectionOutlineLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/selectionOutlineLayer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAMjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAexE,KAAK,CAAC,SAAS,CAAC,8BAA8B,GAAG,UAAU,IAAY;IACnE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7D,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,KAAK,qBAAqB,CAAC,UAAU,EAAE,CAAC;YAC1H,OAAa,IAAI,CAAC,YAAY,CAAC,KAAK,CAA2B,CAAC;QACpE,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAaF;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IAClD;;OAEG;IACI,MAAM,KAAK,UAAU;QACxB,OAAO,yBAAyB,CAAC,UAAU,CAAC;IAChD,CAAC;IAED;;OAEG;IAEH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC;IAC9C,CAAC;IAED,IAAW,YAAY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AC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC;gBAC7E,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBACjD,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBACvC,IAAI,IAAI,EAAE,CAAC;oBACP,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,CAAC;YACL,CAAC;YAED,qBAAqB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,qBAAqB,CAAC;IACjC,CAAC;CACJ;AA7UG;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;AAkS9D,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 } from \"./thinSelectionOutlineLayer\";\r\nimport { ThinSelectionOutlineLayer } from \"./thinSelectionOutlineLayer\";\r\nimport type { Color3 } from \"../Maths/math.color\";\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 ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init(this._options);\r\n\r\n // Do not render as long as no meshes have been added\r\n this._shouldRender = false;\r\n\r\n 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 * 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,oBAAoB,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAMjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM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CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,CAAC;YACL,CAAC;YAED,qBAAqB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,qBAAqB,CAAC;IACjC,CAAC;CACJ;AArVG;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;AA0S9D,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 } from \"./thinSelectionOutlineLayer\";\r\nimport { ThinSelectionOutlineLayer } from \"./thinSelectionOutlineLayer\";\r\nimport type { Color3 } from \"../Maths/math.color\";\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 ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init(this._options);\r\n\r\n // Do not render as long as no meshes have been added\r\n this._shouldRender = false;\r\n\r\n 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"]}
|
|
@@ -123,10 +123,16 @@ export declare class ThinSelectionOutlineLayer extends ThinEffectLayer {
|
|
|
123
123
|
hasMesh(mesh: AbstractMesh): boolean;
|
|
124
124
|
/** @internal */
|
|
125
125
|
_useMeshMaterial(_mesh: AbstractMesh): boolean;
|
|
126
|
+
private _clearMeshSelection;
|
|
126
127
|
/**
|
|
127
128
|
* Remove all the meshes currently referenced in the selection outline layer
|
|
128
129
|
*/
|
|
129
130
|
clearSelection(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Adds mesh or group of mesh to the current selection
|
|
133
|
+
* @param meshOrGroup Meshes to remove from the selection
|
|
134
|
+
*/
|
|
135
|
+
removeSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void;
|
|
130
136
|
/**
|
|
131
137
|
* Adds mesh or group of mesh to the current selection
|
|
132
138
|
*
|
|
@@ -469,6 +469,34 @@ export class ThinSelectionOutlineLayer extends ThinEffectLayer {
|
|
|
469
469
|
_useMeshMaterial(_mesh) {
|
|
470
470
|
return false;
|
|
471
471
|
}
|
|
472
|
+
_clearMeshSelection(mesh) {
|
|
473
|
+
if (mesh._userInstancedBuffersStorage) {
|
|
474
|
+
const kind = ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName;
|
|
475
|
+
mesh._userInstancedBuffersStorage.vertexBuffers[kind]?.dispose();
|
|
476
|
+
const vao = mesh._userInstancedBuffersStorage.vertexArrayObjects?.[kind];
|
|
477
|
+
if (vao) {
|
|
478
|
+
// invalidate VAO is very important to keep sync between VAO and vertex buffers
|
|
479
|
+
this._engine.releaseVertexArrayObject(vao);
|
|
480
|
+
delete mesh._userInstancedBuffersStorage.vertexArrayObjects[kind];
|
|
481
|
+
}
|
|
482
|
+
delete mesh._userInstancedBuffersStorage.data[kind];
|
|
483
|
+
delete mesh._userInstancedBuffersStorage.vertexBuffers[kind];
|
|
484
|
+
delete mesh._userInstancedBuffersStorage.strides[kind];
|
|
485
|
+
delete mesh._userInstancedBuffersStorage.sizes[kind];
|
|
486
|
+
if (Object.keys(mesh._userInstancedBuffersStorage.vertexBuffers).length === 0) {
|
|
487
|
+
mesh._userInstancedBuffersStorage = undefined;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if (mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] !== undefined) {
|
|
491
|
+
delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];
|
|
492
|
+
}
|
|
493
|
+
if (this._selection) {
|
|
494
|
+
const index = this._selection.indexOf(mesh);
|
|
495
|
+
if (~index) {
|
|
496
|
+
this._selection.splice(index, 1);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
472
500
|
/**
|
|
473
501
|
* Remove all the meshes currently referenced in the selection outline layer
|
|
474
502
|
*/
|
|
@@ -478,32 +506,36 @@ export class ThinSelectionOutlineLayer extends ThinEffectLayer {
|
|
|
478
506
|
}
|
|
479
507
|
for (let index = 0; index < this._selection.length; ++index) {
|
|
480
508
|
const mesh = this._selection[index];
|
|
481
|
-
|
|
482
|
-
const kind = ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName;
|
|
483
|
-
mesh._userInstancedBuffersStorage.vertexBuffers[kind]?.dispose();
|
|
484
|
-
const vao = mesh._userInstancedBuffersStorage.vertexArrayObjects?.[kind];
|
|
485
|
-
if (vao) {
|
|
486
|
-
// invalidate VAO is very important to keep sync between VAO and vertex buffers
|
|
487
|
-
this._engine.releaseVertexArrayObject(vao);
|
|
488
|
-
delete mesh._userInstancedBuffersStorage.vertexArrayObjects[kind];
|
|
489
|
-
}
|
|
490
|
-
delete mesh._userInstancedBuffersStorage.data[kind];
|
|
491
|
-
delete mesh._userInstancedBuffersStorage.vertexBuffers[kind];
|
|
492
|
-
delete mesh._userInstancedBuffersStorage.strides[kind];
|
|
493
|
-
delete mesh._userInstancedBuffersStorage.sizes[kind];
|
|
494
|
-
if (Object.keys(mesh._userInstancedBuffersStorage.vertexBuffers).length === 0) {
|
|
495
|
-
mesh._userInstancedBuffersStorage = undefined;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
if (mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] !== undefined) {
|
|
499
|
-
delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];
|
|
500
|
-
}
|
|
509
|
+
this._clearMeshSelection(mesh);
|
|
501
510
|
}
|
|
502
511
|
this._selection = [];
|
|
503
512
|
this._meshUniqueIdToSelectionId.length = 0;
|
|
504
513
|
this._nextSelectionId = 1;
|
|
505
514
|
this._shouldRender = false;
|
|
506
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* Adds mesh or group of mesh to the current selection
|
|
518
|
+
* @param meshOrGroup Meshes to remove from the selection
|
|
519
|
+
*/
|
|
520
|
+
removeSelection(meshOrGroup) {
|
|
521
|
+
if (!this._selection) {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];
|
|
525
|
+
if (group.length === 0) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
for (let i = 0; i < group.length; i++) {
|
|
529
|
+
const mesh = group[i];
|
|
530
|
+
this._clearMeshSelection(mesh);
|
|
531
|
+
delete this._meshUniqueIdToSelectionId[mesh.uniqueId];
|
|
532
|
+
}
|
|
533
|
+
if (!this._selection || !this._selection.length) {
|
|
534
|
+
this._meshUniqueIdToSelectionId.length = 0;
|
|
535
|
+
this._nextSelectionId = 1;
|
|
536
|
+
this._shouldRender = false;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
507
539
|
/**
|
|
508
540
|
* Adds mesh or group of mesh to the current selection
|
|
509
541
|
*
|
|
@@ -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,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I,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AAhrBD;;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, 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 } from \"./thinEffectLayer\";\nimport { 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/**\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 ...options,\n };\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 /** @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 \"boneTextureWidth\",\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 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: \"\",\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 = batch.hardwareInstancedRendering[subMesh._id] || renderingMesh.hasThinInstances || !!renderingMesh._userInstancedBuffersStorage;\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 const selectionId = this._meshUniqueIdToSelectionId[renderingMesh.uniqueId];\n if (!renderingMesh.hasInstances && !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 return this.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 // we control selection as RTT render list\n return super.hasMesh(mesh);\n }\n\n /** @internal */\n public override _useMeshMaterial(_mesh: AbstractMesh): boolean {\n return false;\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 if (mesh._userInstancedBuffersStorage) {\n const kind = ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName;\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 (mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] !== undefined) {\n delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n }\n this._selection = [];\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 (sourceMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] === undefined) {\n sourceMesh.registerInstancedBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, 1);\n }\n\n mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] = nextId;\n } else {\n this._meshUniqueIdToSelectionId[mesh.uniqueId] = nextId;\n }\n }\n this._nextSelectionId += 1;\n\n this._shouldRender = true;\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 }\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,O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B,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AArtBD;;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, 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 } from \"./thinEffectLayer\";\nimport { 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/**\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 ...options,\n };\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 /** @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 \"boneTextureWidth\",\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 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: \"\",\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 = batch.hardwareInstancedRendering[subMesh._id] || renderingMesh.hasThinInstances || !!renderingMesh._userInstancedBuffersStorage;\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 const selectionId = this._meshUniqueIdToSelectionId[renderingMesh.uniqueId];\n if (!renderingMesh.hasInstances && !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 return this.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 // we control selection as RTT render list\n return super.hasMesh(mesh);\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 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 (mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] !== undefined) {\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 }\n this._selection = [];\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 * @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 * 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 (sourceMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] === undefined) {\n sourceMesh.registerInstancedBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, 1);\n }\n\n mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] = nextId;\n } else {\n this._meshUniqueIdToSelectionId[mesh.uniqueId] = nextId;\n }\n }\n this._nextSelectionId += 1;\n\n this._shouldRender = true;\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 }\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"]}
|
package/Meshes/abstractMesh.d.ts
CHANGED
|
@@ -362,6 +362,10 @@ export declare abstract class AbstractMesh extends TransformNode implements IDis
|
|
|
362
362
|
* Control if the material should be rendered
|
|
363
363
|
*/
|
|
364
364
|
materialEnabled: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* Control if the camera should render material
|
|
367
|
+
*/
|
|
368
|
+
doNotRenderMaterialCameraUniqueIds: number[];
|
|
365
369
|
/** Gets or sets current material */
|
|
366
370
|
get material(): Nullable<Material>;
|
|
367
371
|
set material(value: Nullable<Material>);
|
package/Meshes/abstractMesh.js
CHANGED
|
@@ -669,6 +669,10 @@ export class AbstractMesh extends TransformNode {
|
|
|
669
669
|
* Control if the material should be rendered
|
|
670
670
|
*/
|
|
671
671
|
this.materialEnabled = true;
|
|
672
|
+
/**
|
|
673
|
+
* Control if the camera should render material
|
|
674
|
+
*/
|
|
675
|
+
this.doNotRenderMaterialCameraUniqueIds = [];
|
|
672
676
|
/** Defines color to use when rendering outline */
|
|
673
677
|
this.outlineColor = Color3.Red();
|
|
674
678
|
/** Define width to use when rendering outline */
|