/** @packageDocumentation
 * @module Tiles
 */
import { ColorDef, RenderTexture } from "@itwin/core-common";
import { ClipVector, EllipsoidPatch, Point3d, Range1d, Range3d, Ray3d, Transform, Vector3d } from "@itwin/core-geometry";
import { GraphicBuilder } from "../../render/GraphicBuilder";
import { RealityMeshParams } from "../../render/RealityMeshParams";
import { RenderGraphic } from "../../render/RenderGraphic";
import { RenderMemory } from "../../render/RenderMemory";
import { RenderSystem } from "../../render/RenderSystem";
import { RenderTerrainGeometry, TerrainTexture } from "../../internal/render/RenderTerrain";
import { ViewingSpace } from "../../ViewingSpace";
import { ImageryMapTile, MapCartoRectangle, MapTileLoader, MapTileTree, QuadId, RealityTile, RealityTileParams, Tile, TileContent, TileDrawArgs, TileGraphicType, TraversalSelectionContext } from "../internal";
/** @internal */
export declare class PlanarTilePatch {
    corners: Point3d[];
    normal: Vector3d;
    private _chordHeight;
    constructor(corners: Point3d[], normal: Vector3d, _chordHeight: number);
    getRangeCorners(heightRange: Range1d, result: Point3d[]): Point3d[];
    getClipShape(): Point3d[];
}
/** @internal */
export type TilePatch = PlanarTilePatch | EllipsoidPatch;
/** Projects points within the rectangular region of a [[MapTile]] into 3d space.
 * @see [[MapTile.getProjection]] to obtain the projection for a [[MapTile]].
 * @public
 */
export declare abstract class MapTileProjection {
    /** The extents of the volume of space associated with the projected [[MapTile]]. */
    abstract get localRange(): Range3d;
    /** @alpha */
    abstract get transformFromLocal(): Transform;
    /** Given parametric coordinates in [0, 1] within the tile's rectangular region, and an elevation above the Earth,
     * compute the 3d position in space.
     */
    abstract getPoint(u: number, v: number, height: number, result?: Point3d): Point3d;
    /** @alpha */
    get ellipsoidPatch(): EllipsoidPatch | undefined;
    /** @alpha */
    getGlobalPoint(u: number, v: number, z: number, result?: Point3d): Point3d;
}
/** @alpha */
export declare class PlanarProjection extends MapTileProjection {
    private _bilinearPatch;
    transformFromLocal: Transform;
    localRange: Range3d;
    constructor(patch: PlanarTilePatch, heightRange?: Range1d);
    getPoint(u: number, v: number, z: number, result?: Point3d): Point3d;
}
/** @internal */
export interface TerrainTileContent extends TileContent {
    terrain?: {
        renderGeometry?: RenderTerrainGeometry;
        /** Used on leaves to support up-sampling. */
        mesh?: RealityMeshParams;
    };
}
/** A [[Tile]] belonging to a [[MapTileTree]] representing a rectangular region of a map of the Earth.
 * @public
 */
export declare class MapTile extends RealityTile {
    private static _maxParentHeightDepth;
    private _imageryTiles?;
    private _hiddenTiles?;
    private _highResolutionReplacementTiles?;
    /** @internal */
    everLoaded: boolean;
    /** @internal */
    protected _heightRange: Range1d | undefined;
    /** @internal */
    protected _renderGeometry?: RenderTerrainGeometry;
    /** @internal */
    protected _mesh?: RealityMeshParams;
    /** @internal */
    get isReady(): boolean;
    /** @internal */
    get hasGraphics(): boolean;
    /** @internal */
    get renderGeometry(): RenderTerrainGeometry | undefined;
    /** @internal */
    get mesh(): RealityMeshParams | undefined;
    /** @internal */
    get loadableTerrainTile(): MapTile;
    /** @internal */
    get isPlanar(): boolean;
    /** @internal */
    get imageryTiles(): ImageryMapTile[] | undefined;
    /** List of selected tiles but are currently in hidden state (i.e. scale range visibility)
     * @internal
     */
    get hiddenImageryTiles(): ImageryMapTile[] | undefined;
    /** List of leafs tiles that have been selected as a replacement for missing high resolution tiles.
     * When this list is non-empty this means we are past the maximum LOD available of the tile tree.
     * By using those tiles, you are likely to get a display where tiles looks pixelated..
     * in some cases this is preferred to have no tile at all.
     * @internal
     */
    get highResolutionReplacementTiles(): ImageryMapTile[] | undefined;
    /** The [[MapTileTree]] to which this tile belongs. */
    readonly mapTree: MapTileTree;
    /** Uniquely identifies this tile within its [[mapTree]]. */
    readonly quadId: QuadId;
    private _patch;
    /** The area of the surface of the Earth that this tile represents. */
    readonly rectangle: MapCartoRectangle;
    /** @internal */
    protected _cornerRays?: Ray3d[];
    /** @internal */
    constructor(params: RealityTileParams, mapTree: MapTileTree, quadId: QuadId, patch: TilePatch, rectangle: MapCartoRectangle, heightRange: Range1d | undefined, cornerRays: Ray3d[] | undefined);
    /** @internal */
    getRangeCorners(result: Point3d[]): Point3d[];
    /** @internal */
    getSizeProjectionCorners(): Point3d[] | undefined;
    /** @internal */
    markUsed(args: TileDrawArgs): void;
    /** @internal */
    get graphicType(): TileGraphicType;
    /** @internal */
    get mapLoader(): MapTileLoader;
    /** @internal */
    get isUpsampled(): boolean;
    /** @internal */
    tileFromQuadId(quadId: QuadId): MapTile | undefined;
    private get _forceDepthBuffer();
    /** @internal */
    addBoundingGraphic(builder: GraphicBuilder, color: ColorDef): void;
    /** @internal */
    getContentClip(): ClipVector | undefined;
    /** @internal */
    setNotFound(): void;
    /** @internal */
    getGraphic(_system: RenderSystem, _texture: RenderTexture): RenderGraphic | undefined;
    /** For globe tiles displaying less then depth 2 appears distorted
     * @internal
     */
    get isDisplayable(): boolean;
    /** @internal */
    isOccluded(viewingSpace: ViewingSpace): boolean;
    /** @internal */
    protected _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void;
    private createGlobeChildren;
    /** @internal */
    static computeRangeCorners(corners: Point3d[], normal: Vector3d, chordHeight: number, result?: Point3d[], heightRange?: Range1d): Point3d[];
    /** @internal */
    isRegionCulled(args: TileDrawArgs): boolean;
    /** The default pixel-size calculation for reality tiles uses the geometric mean of the projected
     * x and y ranges: `sqrt(xRange * yRange)`. For non-planar globe tiles, the projected surface corners
     * can be significantly anisotropic, causing the geometric mean to underestimate screen coverage.
     * Additionally, the projected pixel size scales linearly with viewport width-- on narrow viewports
     * the reduced scale can push the geometric mean below `maximumSize`, stopping refinement at depth 3
     * before reaching the planar imagery tiles at depth 8+.
     *
     * This override uses `max(xRange, yRange)` for non-planar tiles, which correctly reflects the tile's
     * actual screen extent for LOD decisions.
     * @internal
     */
    computeVisibilityFactor(args: TileDrawArgs): number;
    /** @internal */
    isContentCulled(args: TileDrawArgs): boolean;
    private clearImageryTiles;
    /** @internal */
    produceGraphics(): RenderGraphic | undefined;
    /** @internal */
    getClipShape(): Point3d[];
    /** @internal */
    protected _collectStatistics(stats: RenderMemory.Statistics): void;
    /** Height range is along with the tile corners to detect if tile intersects view frustum.
     * Range will be single value fo ron-terrain tiles -- if terrain tile is not loaded it will
     * inherit height from ancestors.
     * @internal
     */
    get heightRange(): Range1d | undefined;
    /** @internal */
    get mapTilingScheme(): import("./MapTilingScheme").MapTilingScheme;
    /** Adjust the minimum and maximum elevations of the terrain within this tile. */
    adjustHeights(minHeight: number, maxHeight: number): void;
    /** Obtain a [[MapTileProjection]] to project positions within this tile's area into 3d space. */
    getProjection(heightRange?: Range1d): MapTileProjection;
    /** @internal */
    get baseImageryIsReady(): boolean;
    /** @internal */
    get imageryIsReady(): boolean;
    /** Select secondary (imagery) tiles
     * @internal
     */
    selectSecondaryTiles(args: TileDrawArgs, context: TraversalSelectionContext): void;
    private static _scratchRectangle1;
    private static _scratchRectangle2;
    /** The height range for terrain tiles is not known until the tiles are unloaded.  We use "ApproximateTerrainHeight" for first 6 levels but below
     * that the tiles inherit height range from parents.  This is problematic as tiles with large height range will be unnecessarily selected as
     * they apparently intersect view frustum.   To avoid this force loading of terrain tiles if they exceed "_maxParentHightDepth".
     * @internal
     */
    protected forceSelectRealityTile(): boolean;
    /** @internal */
    protected minimumVisibleFactor(): number;
    private static _scratchThisDiagonal;
    private static _scratchDrapeDiagonal;
    /** @internal */
    getDrapeTextures(): TerrainTexture[] | undefined;
    private static _scratchIntersectRange;
    private computeDrapeTexture;
    /** @internal */
    setContent(content: TerrainTileContent): void;
    /** @internal */
    freeMemory(): void;
    /** @internal */
    disposeContents(): void;
}
/** A child tile that has no content of its own available. It instead produces content by up-sampling the content of an ancestor tile.
 * @internal
  */
export declare class UpsampledMapTile extends MapTile {
    /** The ancestor tile whose content will be up-sampled. */
    private readonly _loadableTile;
    constructor(params: RealityTileParams, mapTree: MapTileTree, quadId: QuadId, patch: TilePatch, rectangle: MapCartoRectangle, heightRange: Range1d | undefined, cornerRays: Ray3d[] | undefined, loadableTile: MapTile);
    get isUpsampled(): boolean;
    get isEmpty(): boolean;
    get loadableTile(): RealityTile;
    private upsampleFromParent;
    get renderGeometry(): RenderTerrainGeometry | undefined;
    get isLoading(): boolean;
    get isQueued(): boolean;
    get isNotFound(): boolean;
    get isReady(): boolean;
    markUsed(args: TileDrawArgs): void;
}
//# sourceMappingURL=MapTile.d.ts.map