import * as THREE from "three";
import type { BimTilesRenderer } from "./BimTilesRenderer";
import { TileObject } from "../Constants";
import { BimTilesMaterial, BimTilesPickMaterial, BimTilesTransparentMaterial, BimTilesHighlightMaterial } from "../../../core/materials";
/**
 * Object state type, which can be "Hidden", "Transparent", "Highlighted" or "Hovered".
 * Each tile object (maps to a userId) has a "color" (4 bytes) value that contains
 * State types, opacity value, etc.
 * - State types are stored in color.r
 *   - bit 0: Hidden
 *   - bit 1: Transparent
 *   - bit 2: Highlighted
 *   - bit 3: Hovered
 *   - bits 4-7: not used for now
 * - Opacity value is stored in color.g (value between 0 to 255)
 * - color.b for transparent effect (used by cloned mesh), currently only bit 0 is used.
 * - color.a is not used for now
 *
 * All tile object states of a tileset are stored in a stateTexture,
 * which will be send to GPU, thus GPU knows which tile object should
 * be hidden/transparent/highlighted/hovered.
 */
export declare enum StateType {
    /**
     * Hide a tile object.
     */
    Hidden = 0,
    /**
     * Transparent is implemented by cloning objects' mesh (don't clone geometry) and
     * apply a transparent material.
     */
    Transparent = 1,
    /**
     * We implement highlight by cloning mesh and apply a highlight material.
     * There can be transparent objects and highlighted objects in the same time.
     * But, one object is either transparent or highlighted.
     */
    Highlighted = 2,
    /** Hovered (1 bit in color.r, same as other {@link StateType} flags). */
    Hovered = 3
}
/** Hover fade-in duration in milliseconds (must match `HOVER_FADE_DURATION_MS` in shader). */
export declare const HOVER_FADE_DURATION_MS = 300;
export declare class BimTilesMaterialManager {
    protected batchMaterialMap: Map<string, BimTilesMaterial>;
    protected instanceMaterialMap: Map<string, BimTilesMaterial>;
    tileRenderer: BimTilesRenderer;
    highlightMesh?: THREE.Mesh;
    /** Wall-clock milliseconds (`performance.now()`) when the current hover fade-in started. */
    private hoverFadeStartMs?;
    constructor(tileRenderer: BimTilesRenderer, modelCfg: any);
    createBatchMaterial(materialId: string, params?: THREE.MeshStandardMaterialParameters, hasBarycentric?: boolean): BimTilesMaterial | undefined;
    createInstanceMaterial(materialId: string, params?: THREE.MeshStandardMaterialParameters, hasBarycentric?: boolean): BimTilesMaterial | undefined;
    get highlightMaterial(): BimTilesHighlightMaterial;
    get transparentMaterial(): BimTilesTransparentMaterial;
    get pickMaterial(): BimTilesPickMaterial;
    /**
     * Updates state.
     * @param opacity Useful for StateType.Transparent, and when flag is true.
     */
    updateState(state: StateType, userIds: number[], flag: boolean, opacity?: number): void;
    /**
     * Sets current tileset visible or invisible.
     */
    setHidden(flag: boolean): void;
    /**
     * Sets current tileset's opacity.
     * @param opacity A value between 0 and 1, and will be converted to 0-255.
     * opacity is 1 means to clear opacity.
     */
    setOpacity(opacity: number): void;
    /**
     * Clears hovered object.
     * We don't store the hovered userId, simply clear the flag for all userIds.
     */
    clearHovered(): void;
    /**
     * Updates hover fade-in uniforms. Call once per frame while hover may be animating.
     * @returns true while fade-in is in progress (caller should keep rendering).
     */
    updateHoverFade(nowMs: number): boolean;
    private beginHoverFade;
    private syncHoverUniforms;
    private applyHoverUniformsToMaterial;
    updateHighlightMesh(): void;
    clearHighlightMesh(): void;
    clearState(state: StateType): void;
    setDoubleSidedMaterials(): void;
    revertDoubleSidedMaterials(): void;
    setClipPlanes(planes: THREE.Plane[]): void;
    resetState(): void;
    updateMaterialStates(): void;
    dispose(): void;
    /**
     * Checks if there is any visible object.
     */
    hasVisibleObject(): boolean;
    /**
     * Checks if there is any invisible object.
     */
    hasInvisibleObject(): boolean;
    /**
     * Get transparent userIds.
     */
    getTransparentUserIds(): number[];
    /**
     * Get highlight userIds.
     */
    getHighlightUserIds(): number[];
    /**
     * Gets the hovered object if any.
     */
    getHoveredObject(): TileObject | undefined;
}
