diff --git a/resources/openbim-components.js b/resources/openbim-components.js index dbb521117..5b96ce0f3 100644 --- a/resources/openbim-components.js +++ b/resources/openbim-components.js @@ -100610,6 +100610,7 @@ class FragmentHighlighter extends Component { depthTest: true, }), autoHighlightOnClick: true, + cullHighlightMesh: true, }; this._mouseState = { down: false, @@ -100939,6 +100940,13 @@ class FragmentHighlighter extends Component { if (!fragment.fragments[name]) { const material = this.highlightMats[name]; const subFragment = fragment.addFragment(name, material); + if (this.config.cullHighlightMesh) { + const culler = this.components.tools.get(ScreenCuller); + if (name !== this.config.selectName && + name !== this.config.hoverName) { + culler.add(subFragment.mesh); + } + } if (fragment.blocks.count > 1) { subFragment.setInstance(0, { ids: Array.from(fragment.ids), diff --git a/src/fragments/FragmentHighlighter/index.ts b/src/fragments/FragmentHighlighter/index.ts index e64348ad1..523e301db 100644 --- a/src/fragments/FragmentHighlighter/index.ts +++ b/src/fragments/FragmentHighlighter/index.ts @@ -3,13 +3,19 @@ import { Fragment, FragmentMesh } from "bim-fragment"; import { Component, Disposable, - Updateable, Event, + Updateable, + Event, FragmentIdMap, Configurable, } from "../../base-types"; import { FragmentManager } from "../FragmentManager"; import { FragmentBoundingBox } from "../FragmentBoundingBox"; -import { Components, SimpleCamera, ToolComponent } from "../../core"; +import { + Components, + ScreenCuller, + SimpleCamera, + ToolComponent, +} from "../../core"; import { toCompositeID } from "../../utils"; import { PostproductionRenderer } from "../../navigation/PostproductionRenderer"; @@ -32,11 +38,12 @@ export interface FragmentHighlighterConfig { selectionMaterial: THREE.Material; hoverMaterial: THREE.Material; autoHighlightOnClick: boolean; + cullHighlightMesh: boolean; } export class FragmentHighlighter extends Component - implements Disposable, Updateable , Configurable + implements Disposable, Updateable, Configurable { static readonly uuid = "cb8a76f2-654a-4b50-80c6-66fd83cafd77" as const; @@ -98,6 +105,7 @@ export class FragmentHighlighter depthTest: true, }), autoHighlightOnClick: true, + cullHighlightMesh: true, }; private _mouseState = { @@ -468,6 +476,15 @@ export class FragmentHighlighter if (!fragment.fragments[name]) { const material = this.highlightMats[name]; const subFragment = fragment.addFragment(name, material); + if (this.config.cullHighlightMesh) { + const culler = this.components.tools.get(ScreenCuller); + if ( + name !== this.config.selectName && + name !== this.config.hoverName + ) { + culler.add(subFragment.mesh); + } + } if (fragment.blocks.count > 1) { subFragment.setInstance(0, { ids: Array.from(fragment.ids),