import { PluginConfig, THREE } from "@x-viewer/core"; import { type BaseViewer, Plugin } from "@x-viewer/core"; import { BaseSection } from "../sections/BaseSection"; /** * Section type */ export declare enum SectionType { ObjectsBoxSection = "ObjectsBoxSection", PickPlaneSection = "PickPlaneSection", AxisPlaneSection = "AxisPlaneSection" } /** * Section plugin config. */ export interface SectionPluginConfig extends Partial { capsVisible?: boolean; capsColor?: THREE.ColorRepresentation; /** * Automatically skip non-closed (non-manifold) meshes during the cap * stencil pass. Open meshes such as terrain surfaces, glass panes and * sky domes leave unbalanced back/front fragment counts and otherwise * fill regions that are not really part of the model's cross-section. * * Detection is done per `BufferGeometry` via an edge-share check and the * result is cached on `geometry.userData._sectionCapClosed`. Explicit * overrides via `setSkipSectionCap(mesh, true|false)` always win. * * Defaults to `true`. */ autoSkipNonClosedMeshes?: boolean; } export declare const DEFAULT_CAPS_VISIBLE = true; export declare const DEFAULT_CAPS_COLOR = 10265519; export declare const DEFAULT_AUTO_SKIP_NON_CLOSED = true; /** * Section plugin, can be used by Viewer3d and BimTilesViewer. */ export declare class SectionPlugin extends Plugin { static readonly DEFAULT_ID = "SectionPlugin"; constructor(viewer: BaseViewer, cfg?: SectionPluginConfig); protected get raycaster(): THREE.Raycaster; /** * Activates one of "ObjectsBoxSection", "AxisPlaneSection" or "PickPlaneSection" Section * @param {SectionType} type * @param clippingObjectIds */ activate(type: SectionType): void; /** * @description Deactivate Section plugin * @param keepSectionState Keep objects being clipped even after deactived. */ deactivate(keepSectionState?: boolean): void; /** * Resets section to initial state. */ reset(): void; /** * Sets gizmo and section plane mesh visibility. */ setSectionPlaneVisible(visible: boolean): void; /** * Sets section cut opening fill visibility. */ setCapsVisible(visible: boolean): void; /** * Gets section cut opening fill visibility. */ getCapsVisible(): boolean; /** * Sets section cut opening fill color. */ setCapsColor(color: THREE.ColorRepresentation): void; /** * Excludes (or force-includes) a subtree from the section cap stencil * pass. * * Stencil capping relies on each contributing mesh being a closed solid * so that back-/front-face fragment counts cancel outside the cut. * Non-closed meshes (terrain surfaces, glass panes, sky domes, single- * sided floor tiles, ...) otherwise leave a permanent imbalance and * fill regions of the cap that are not really part of the model's * cross-section. * * By default the plugin auto-detects this via an edge-share manifold * test (`autoSkipNonClosedMeshes`). Use this method to override the * decision for a subtree: * - `skip = true` → always exclude from the stencil pass. * - `skip = false` → always include, even if auto-detection would * have marked it as non-closed. * - `skip = "auto"` → clear the override and fall back to auto-detect. */ setSkipSectionCap(object: THREE.Object3D, skip?: boolean | "auto"): void; /** * Enables/disables automatic detection of non-closed meshes for the * section cap stencil pass. See `autoSkipNonClosedMeshes` in * `SectionPluginConfig` for details. */ setAutoSkipNonClosedMeshes(enabled: boolean): void; /** * Returns the nearest ancestor whose mesh children should be treated as * one logical cap object. By default this is `mesh.parent` (e.g. an * IFC element like `Wall_-_Timber_Clad_<418079>` that contains many * small face quads). The model group root is never returned so that * meshes that sit directly under the root are still tested * individually. */ static findCapGroup(mesh: THREE.Object3D, modelRoot?: THREE.Object3D): THREE.Object3D | undefined; /** * Checks whether the union of all `THREE.Mesh` descendants of `group` * forms a closed (edge-manifold) surface. Vertex positions are binned * with a tolerance so that meshes that share a seam by coordinate (the * usual case for IFC→glTF face quads) are correctly stitched. * Result is cached on `group.userData._sectionCapClosed`. */ static isGroupClosedManifold(group: THREE.Object3D): boolean; /** * * @returns {boolean} Is Section active */ isActive(): boolean; /** * Gets the active section type. */ getActiveSectionType(): SectionType | undefined; /** * Gets the active section. */ getActiveSection(): BaseSection | undefined; /** * Sets clipping object ids for all sections. * @param ids * @returns * @description Set the id of the object that needs to be clipping for all section */ setClippingObjectIds(ids?: number[]): void; /** * Sets clipping object ids for a specific SectionType. * @param ids * @returns * @description Set the id of the object that needs to be clipping for section by section type */ setClippingObjectIdsForType(type: SectionType, ids?: number[]): void; /** * Destroies this plugin. */ destroy(): void; }