/** @internal NOTE: Internal APIs. Subject to change. Use of these APIs in production applications is not supported. */
import { BimProductMesh } from './BimProductMesh';
import { IBimIfcLoaderElement } from './bim-ifc-loader-element';
import { RgbaComponent } from './rgba';
import { Material, AbstractMesh, Color4 } from './babylonjs-import';
import { Writeable } from '../Types';
import { TextureObject } from './texture-object';
import { Scene } from './babylonjs-import';
import { Uint32Bits } from '../Uint32Bits';
import { DitheringOptions } from './VisualSettings';
import { BabylonMeshDepthMaterial } from './CustomBabylonMaterials/BabylonMeshDepthMaterial';
import { IfcMeshDepthMaterial } from './CustomBabylonMaterials/IfcMeshDepthMaterial';
import { GlobalState } from './GlobalIfcProductMeshesRenderInfo';
/**
 * Stores the platform endianess.
 */
export declare const endianess: string;
/**
 * Manages materials and textures used by Twinfinity for rendering of IFC products and other objects.
 */
export declare class Materials {
    private _isBackfaceCullingEnabled;
    readonly globalRenderState: GlobalState;
    private static readonly _outOfColorTexturePixelIndices;
    private readonly _tmp;
    private readonly _ifcProductColorTexture;
    private readonly _ifcProductPropertiesTexture;
    private readonly _ditheringTexture;
    private readonly _materialCache;
    /**
     * Lookup for BimProductMesh instances. Used to find a BimProductMesh instance by colorTexturePixelIndex.
     * We use a IndexedMap instead of a Map because we know that the keys are sequential numbers starting from 0.
     * Lookups are faster in a IndexedMap than in a Map and we do a lot of them.
     * We may get holes in the map if meshes are
     */
    private readonly _bimObjectLookup;
    /**
     * Pool of colorPixelIdex identifiers. _colorPixelIndexPool.get() will start returning -1 when no more
     * indices can be created (maxCount reached).
     * 0 is reserved and is typically used to indicate that a object does not have a color texture pixel index.
     */
    private readonly _colorTexturePixelIndexPool;
    private _state;
    private static readonly _reservedGpuPickClearColorRgba;
    private _onIsBackfaceCullingEnabled;
    /**
     * Materials constructor.
     */
    constructor(_isBackfaceCullingEnabled?: boolean);
    /**  Color used to as scene.clearColor when doing gpu picking. */
    readonly reservedGpuPickClearColor: Color4;
    /**
     * Gets a value indicating whether backface culling is enabled.
     * Backface culling is a rendering technique used to improve performance
     * by not drawing polygons facing away from the camera.
     * @returns {boolean} `true` if backface culling is enabled; otherwise, `false`.
     */
    get isBackfaceCullingEnabled(): boolean;
    /**
     * Sets the backface culling state for the material.
     * @param value A boolean indicating whether backface culling is enabled.
     * If true, backface culling is enabled; otherwise, it is disabled.
     */
    set isBackfaceCullingEnabled(value: boolean);
    /** Maximum number of Ifc products and {@link TextureObject} instances material can hold. */
    get maxObjectCount(): number;
    /**
     * Number of objects (IFC products or {@link TextureObject}) this instance currently holds. Cannot be
     * higher than {@link maxObjectCount}.
     */
    get objectCount(): number;
    /** Number of objects (IFC products or {@link TextureObject}) that can still be added to this instance  */
    get availableObjectCount(): number;
    /**
     * Changed whenever colors or properties on objects, managed by this {@link Materials} instance, change.
     * Useful when performing checks (for exemple during rendering) to determine if something has changed between one frame and another.
     * Let your code keep a reference to {@link state}. Whenever
     * you need to check whether something has changed just compare your local reference with {@link state}. If they differ
     * then colors or properties of objects have changed since the last frame. Dont forget to update the local reference afterwards.
     */
    get state(): Record<string, never>;
    /**
     * Makes any animated textures change to the next animation frame.
     * @hidden
     * @internal NOTE: Internal APIs. Subject to change. Use of these APIs in production applications is not supported.
     * */
    updateAnimatedTextures(): void;
    /**
     * Deletes a {@link TextureObject}.
     * @param textureObject Object to delete.
     * @returns True if deleted, otherwise false.
     */
    deleteGpuTextureObject(textureObject: TextureObject | number): boolean;
    /**
     * Create a {@link TextureObject}.
     * @returns A valid {@link TextureObject} or undefined if the maximum number of gpu texture objects have been reached.
     */
    createGpuTextureObject(): TextureObject | undefined;
    add(ifcFiles: IBimIfcLoaderElement[]): void;
    clear(): void;
    dispose(): void;
    /**
     * Retrieves a BimProductMesh object by its ID.
     * @param id The ID of the  {@link BimProductMesh}. The alpha component is masked away as it is not part of the ID.
     * The ID is converted to an unsigned value to handle values above 2^31 correctly.
     * @returns The {@link BimProductMesh} object associated with the given ID, or undefined if not found.
     */
    getBimProductAndMeshById(id: number): BimProductMesh | undefined;
    getGpuPickingMaterial(sceneOrMesh: Scene | AbstractMesh): Material;
    getOutlineMaterial(sceneOrMesh: Scene | AbstractMesh): Material;
    private getIdWriterMaterial;
    private static createGpuPickingMaterial;
    /**
     * Creates a custom depth material that is used for Babylon meshes for two reasons:
     * 1) It correctly excludes the invisible fragments from the IFC meshes
     * 2) It uses a camera with a nearplane that is further away, to increase precision and thereforce reduce z fighting for effects that use depth textures written to with this material
     * @param scene The scene for which  the depth material should be created
     * @param storeNonLinearDepth Whether the custom depth material should write the depth linearly or logarithmically
     * @returns The custom depth material, which was created for the scene
     */
    getBabylonMeshCustomDepthMaterial(scene: Scene, storeNonLinearDepth: boolean): BabylonMeshDepthMaterial;
    /**
     * Creates a custom depth material that is used for IFC meshes instead of Babylons normal depth material for two reasons:
     * 1) It correctly excludes the invisible fragments from the IFC meshes
     * 2) It uses a camera with a nearplane that is further away, to increase precision and thereforce reduce z fighting for effects that use depth textures written to with this material
     * @param scene The scene for which  the depth material should be created
     * @param storeNonLinearDepth Wheter the custom depth material should write the depth linearly or logarithmic
     * @returns The custom depth material, which was created for the scene
     */
    getIFCMeshCustomDepthMaterial(scene: Scene, storeNonLinearDepth: boolean): IfcMeshDepthMaterial;
    /**
     * Converts an integer pixel value to an RGBA array and sets the alpha value in place.
     * @template T A writable array-like type that will hold the RGBA values.
     * @param pixelValue The integer pixel value to be converted.
     * @param alpha The alpha value to be set in the resulting RGBA array.
     * @param dst The destination array where the RGBA values will be stored.
     * @returns The destination array with the RGBA values and the specified alpha value.
     */
    intToGpuPickRgbaInPlace<T extends Writeable<ArrayLike<number>>>(pixelValue: number, alpha: number, dst: T): T;
    /**
     * Converts RGB components of a pixel array to a 32-bit unsigned integer.
     * @param pixels An array-like object containing pixel data.
     * @param offset The offset within the pixel array to start reading RGB components.
     * @returns The 32-bit integer representation of the RGB components.
     */
    gpuPickRgbToInt32(pixels: ArrayLike<number>, offset: number): number;
    /**
     * Sets various on/off properties pertaining to rendering of a {@link BimProductMesh} instance.
     * A mask representing the bits that you want to flip,
     * Legend:
     * idw: Depth write, single bit, represents a bool, wheter the object is written into the postprocess depth buffer or not
     * v: Visibility, 1 bit wheter the object is visible or not
     * o: Outline, 1 bit wheter the object is outlined or not
     * h: Highlight, 2 bits for a total of 3 different highlight colors, or no highlight if all bits are turned off
     * cpi: Clip plane ignore
     * s: Shininess, 4 bits, represents a number
     * 0: unused bit
     * [0|0|0|0 0|0|0|0] [0|0|0|0 0|0|0|0] [0|0|0|0 s|s|s|s] [0|0|cpi|o h|h|v|idw]
     * @param mesh Mesh to read/write properties for.
     * @returns A {@link Uint32Bits} instance. Use to manipulate the bits in the property mask for the {@link BimProductAndMesh} instance.
     */
    renderPropertiesFor(mesh: BimProductMesh): Uint32Bits;
    setColor(mesh: BimProductMesh, color: ArrayLike<number>): boolean;
    copyColorTo(mesh: BimProductMesh, dst: Writeable<ArrayLike<number>>, dstOffset?: number): void;
    getColorComponent(mesh: BimProductMesh, colorComponent: RgbaComponent): number;
    get(isTransparent: boolean, scene: Scene): Material;
    updateDitherTexture(ditherOptions: DitheringOptions): void;
    private toSideOrientation;
    private onTextureUpdate;
}
//# sourceMappingURL=materials.d.ts.map