import { Point, Ray } from '@vertexvis/geometry';
import { Vector3 } from '@vertexvis/geometry';
import type { DecodedPng } from 'fast-png';
import { FrameCameraBase, FrameImageLike, ImageAttributesLike } from './frame';
import { Viewport } from './viewport';
/**
 * A `DepthBuffer` represents the depth information for a rendered frame. This
 * depth information can be used for checking if a world point is occluded by
 * geometry or getting a world position from a 2D viewport point without having
 * to do a server call.
 *
 * A depth buffer is represented by a 16-bit typed array, where each value is
 * a relative distance between the camera's near and far planes.
 */
export declare class DepthBuffer implements FrameImageLike {
    readonly camera: FrameCameraBase;
    readonly imageAttr: ImageAttributesLike;
    readonly pixels: Uint16Array;
    /**
     * A constant that specifies the maximum depth value that can be represented
     * by a depth buffer.
     */
    static MAX_DEPTH_VALUE: number;
    /**
     * Constructs a new depth buffer.
     *
     * @param camera The camera data that generated this depth buffer.
     * @param imageAttr The attributes of the depth buffer image.
     * @param pixels A 16-bit typed array of depth values.
     */
    constructor(camera: FrameCameraBase, imageAttr: ImageAttributesLike, pixels: Uint16Array);
    /**
     * Creates a `DepthBuffer` from a decoded PNG.
     *
     * @param png An object containing the width, height and raw PNG data.
     * @param camera The camera that generated the depth buffer image.
     * @param imageAttr The attributes of the depth buffer image.
     * @throws If the PNG is not a single channel, 16-bit image.
     * @returns A depth buffer.
     */
    static fromPng(png: Pick<DecodedPng, 'data'>, camera: FrameCameraBase, imageAttr: ImageAttributesLike): DepthBuffer;
    /**
     * Computes the depth from a 2D point within the coordinate space of the depth
     * buffer.
     *
     * For perspective cameras, the returned depth is a value that's between
     * the near and far planes of the camera.
  
     * For orthographic cameras, the returned depth is a value that's between
     * 0 and the distance between the near and far planes of the camera.
     *
     * @param point A 2D point within the viewport.
     * @param fallbackNormalizedDepth A fallback value if the depth is the max
     *   depth value, or cannot be determined.
     * @returns The depth at the point.
     */
    getDepthAtPoint(point: Point.Point, fallbackNormalizedDepth?: number): number;
    /**
     * Computes the maximum depth of visible geometry within the coordinate
     * space of the depth buffer.
     *
     * For perspective cameras, the maximum depth is the magnitude
     * of the far plane of the camera.
     *
     * For orthographic cameras, the maximum depth is the distance between
     * the near and far planes of the camera.
     *
     * @returns The maximum depth of visible geometry.
     */
    getMaxDepthOfGeometry(): number;
    /**
     * Computes a depth from a 2D point within the coordinate space of the frame.
     * The returned depth is a normalized value (`[0, 1]`) between the near and
     * far plane.
     *
     * @param point A 2D point within the frame.
     * @param fallbackNormalizedDepth A fallback value if the depth is the max
     *   depth value, or cannot be determined.
     * @returns A depth between 0 and 1.
     */
    getNormalizedDepthAtPoint(point: Point.Point, fallbackNormalizedDepth?: number): number;
    /**
     * Returns `true` if the point is in front of the far plane and the point is
     * inside the frame. This method is useful for checking if geometry exists at
     * a given 2D coordinate.
     *
     * @param point A 2D point within the frame.
     * @returns `true` if point is in front of far plane.
     */
    hitTest(point: Point.Point): boolean;
    /**
     * Computes a 3D point in world space coordinates from the depth value at the
     * given pixel and ray.
     *
     * @param point A pixel to use for reading a depth value.
     * @param ray A ray that specifies the origin and direction.
     * @param fallbackNormalizedDepth A fallback value if the depth is the max
     *   depth value, or cannot be determined.
     * @returns A point in world space coordinates.
     */
    getWorldPoint(point: Point.Point, ray: Ray.Ray, fallbackNormalizedDepth?: number): Vector3.Vector3;
    /**
     * Returns the distance from the camera to the given world point.
     *
     * @param worldPt A point in world space to determine the distance to.
     * @returns distance from the camera to the given world point.
     */
    distanceToPoint(worldPt: Vector3.Vector3): number;
    /**
     * Returns the depth of the closest geometry at the point in the
     * viewport (2D) corresponding to the given world point (3D).
     *
     * @param worldPt A point in world space to check.
     * @param viewport A viewport of the viewer.
     * @returns depth of the closest geometry at the corresponding point in the viewport.
     */
    depthOfClosestGeometry(worldPt: Vector3.Vector3, viewport: Viewport): number;
    /**
     * Returns `true` if the given point in world space is occluded by any
     * geometry.
     *
     * @param worldPt A point in world space to check.
     * @param viewport A viewport of the viewer.
     * @returns `true` if the world point is occluded. `false` otherwise.
     */
    isOccluded(worldPt: Vector3.Vector3, viewport: Viewport): boolean;
    /**
     * Returns `true` if the given point in world space is detached from geometry.
     *
     * @param worldPt A point in world space to check.
     * @param viewport A viewport of the viewer.
     * @returns `true` if the world point is detached from geometry. `false` otherwise.
     */
    isDetached(worldPt: Vector3.Vector3, viewport: Viewport): boolean;
}
