import { IBimIfcLoaderElement } from './bim-ifc-loader-element';
import { BimIfcObject } from './bim-ifc-object';
import { Geometry3d, Geometry3dHandle } from './vertex-data-merge';
import type { CullOnCameraMovePredicate } from './CullOnCameraMovePredicate';
import type { GeometryBuilderRenderControl } from './GeometryBuilderRenderControl';
/**
 * Options for how the {@link IfcGeometryBuilder} behaves.
 * These options can be useful to control the execution of heavy operations such as {@link IfcGeometryBuilder.create} and {@link IfcGeometryBuilder.build}.
 * Avoid blocking the main thread for too long by adjusting {@link deadlineMs} and {@link sleepInMs}.
 * Decreasing these values will make the operations faster but may increase the risk of blocking the main thread.
 * Increasing them will make the main thread (UI) more responsive but the operations will take longer to complete.
 */
export interface IfcGeometryBuilderOptions {
    /** Number of milliseconds to execute before sleeping {@link sleepInMs} milliseconds. */
    deadlineMs: number;
    /** Number of milliseconds to sleep after having executed for more than {@link deadlineMs} milliseconds. */
    sleepInMs: number;
}
/**
 * Options for GeometryBuilder.
 */
export interface GeometryBuilderOptions {
    /**
     * The predicate function used to filter which {@link BimIfcObject} instances to include
     * in the geometry creation.
     */
    predicate: (ifcProduct: BimIfcObject) => unknown;
    /**
     * Predicate function used to decide which meshes can be culled when moving the camera.
     * @see {@link CullOnCameraMovePredicate}
     */
    cullOnCameraMovePredicate?: CullOnCameraMovePredicate;
}
/**
 * Represents the options for creating an {@link IfcGeometryBuilder}.
 */
export interface IfcGeometryBuilderCreateOptions extends GeometryBuilderOptions {
    /**
     * The IFC loader elements containing IFC products to create geometries from.
     */
    loaderElements: IBimIfcLoaderElement[];
    /**
     * Optional render control used by {@link IfcGeometryBuilder.build} to pause rendering
     * during geometry creation and periodically render progress frames.
     */
    renderControl?: GeometryBuilderRenderControl;
}
/**
 * Represents the build event data for the {@link IfcGeometryBuilder}.
 */
export declare class GeometryBuilderBuildEventData {
    totalGeometryCount: number;
    totalIndiceCount: number;
    /** @hidden */
    _geometry?: Geometry3d;
    processedIndiceCount: number;
    /**
     * Creates an instance of GeometryBuilderBuildEventData.
     * @param totalGeometryCount The total number of geometries being built.
     * @param totalIndiceCount The total number of indices being processed.
     */
    constructor(totalGeometryCount: number, totalIndiceCount: number);
    /**
     * Gets currently built geometry
     */
    get geometry(): Geometry3d;
    /**
     * Gets the progress of the build operation as a percentage.
     */
    get progress(): number;
}
/**
 * Represents a builder for creating geometries from IFC product meshes.
 */
export declare class IfcGeometryBuilder {
    readonly geometryBuildId: number;
    readonly loaderElements: IBimIfcLoaderElement[];
    private _mergeIds;
    private _ifcProductMeshCount;
    private _geometryCount;
    private _deadline;
    private _totalIndiceCount;
    private _geometryRefs;
    private readonly _renderControl;
    private static readonly _categoriesToExcludeFromCameraMoveCulling;
    /**
     * Creates an instance of IfcGeometryBuilder.
     * @param geometryBuildId The ID of the geometry build.
     * @param loaderElements The loader elements to build geometries from.
     * @param options The options for the geometry builder.
     */
    private constructor();
    /**
     * Options to control for how long the geometry builder behavior.
     */
    static readonly options: IfcGeometryBuilderOptions;
    /**
     * Creates an instance of {@link IfcGeometryBuilder}.
     * @remarks
     * The create method will traverse all {@link BimProduct} instances provided by
     * `o.loaderElements.entries()`.
     * Each {@link BimProduct} that has geometry, not all products do, has N {@link BimProductMesh} instances.
     * The {@link create} method will visit each such instance and assign a `mergeId` to each of them. This `mergeId`
     * will be identical for {@link BimProductMesh} instances that shall be merged into the same {@link Geometry3d} instance when {@link build} is called.
     * {@link BimProductMesh} instances that alredy have a `mergeId` will be ignored as it is assumed that has already been processed
     * by another {@link IfcGeometryBuilder} instance. It is also possible to ignore certain {@link BimProduct} instances by providing a
     * predicate function in `o.predicate`. This will allow the caller to filter out products that should not be included in the geometry creation.
     * For example, one might want to only include IFC products that are of a certain type or have a certain property set. Specifying a predicate function allows for this.
     *
     * When a {@link IfcGeometryBuilder} instance has been created, the caller can call {@link build} to start the geometry creation process. This is a very
     * CPU intensive process.
     *
     * One should always attempt to use as few {@link IfcGeometryBuilder} instances, to create {@link Geometry3d} instances, as possible.
     * The more {@link Geometry3d} instances that we add to {@link TwinfinityViewer}, by calling {@link TwinfinityViewer.addOrReplaceMesh}, the worse rendering
     * performance we will get. This is because the more geometries we have the more draw calls we will have. The more draw calls we have the worse performance we will get.
     * There is no fixed number of geometries that is the limit. It depends on the hardware and the complexity of the geometries.
     * @param o - The options for creating the geometry builder.
     * @returns A promise that resolves to an instance of `IfcGeometryBuilder`.
     */
    static create(o: IfcGeometryBuilderCreateOptions): Promise<IfcGeometryBuilder>;
    /**
     * Default {@link CullOnCameraMovePredicate} implementation.
     *
     * Keeps structurally important meshes (walls, floors, beams, etc.) and
     * low-polygon objects visible during camera movement. These exemptions
     * only apply when the mesh has no distance-based culling — meshes that
     * are already distance-culled are always movement-culled as well.
     */
    private static defaultCullOnCameraMovePredicate;
    /**
     * The number of IFC product meshes this builder will build geometries for.
     * @returns The number of meshes.
     */
    get ifcProductMeshCount(): number;
    /**
     * The number of geometries that will be built when {@link build} is called.
     * @returns The number of geometries.
     */
    get geometryCount(): number;
    /**
     * Gets the number of indices in the geometry. The number of triangles in the geometry is this number divided by 3.
     * @returns The total number of indices.
     */
    get indiceCount(): number;
    /**
     * Builds {@link Geometry3d} instance from all {@link BimProduct} instances that was included during the call to {@link create}.
     * This is a very CPU intensive operation.
     *
     * @remarks
     * Only access the {@link Geometry3d} instance inside the action callback. The {@link Geometry3d} instance, and all data accessable trhoug it,
     * will be invalid after the action callback has been invoked.
     * Each {@link Geometry3d} instance will contain the geometry from all {@link BimProductMesh} instances that share the same `mergeId`.
     *
     * @param action - The action to be invoked for each built {@link Geometry3d} instance. Call {@link TwinfinityViewer.addOrReplaceMesh} to add the geometry to the viewer.
     * The `eventData` parameter contains both the current {@link Geometry3d} instance that was built and information such as the current progress of the build operation.
     * See {@link GeometryBuilderBuildEventData} for more information.
     * @returns A promise that resolves to an array of {@link Geometry3dHandle} objects. These can be used to unload the geometries from {@link TwinfinityViewer}
     * by calling {@link TwinfinityViewer.removeMesh}.
     */
    build(action: (eventData: GeometryBuilderBuildEventData) => void): Promise<Geometry3dHandle[]>;
}
//# sourceMappingURL=IfcGeometryBuilder.d.ts.map