import { Object3D } from "three";
import { Behaviour } from "./Component.js";
/**
 * Automatically fades objects to transparent when they obscure a reference point from the camera's view.
 * Perfect for architectural visualization, third-person games, or any scenario where objects should
 * become see-through when blocking the view of important content.
 *
 * [![](https://cloud.needle.tools/-/media/1gbMOJLgTlXOug_g6xeKfg.gif)](https://engine.needle.tools/samples/see-through)
 *
 * **How it works:**
 * - Monitors the angle between the camera, this object, and a reference point
 * - When the object blocks the view to the reference point, it fades out
 * - Automatically affects all {@link Renderer} components on this object and children
 * - Supports both transparent fading and alpha hash (dithered) fading
 *
 * **Key Features:**
 * - Smooth fade transitions with configurable duration
 * - Optional alpha hash for maintaining opaque rendering (better performance)
 * - Automatic or manual update modes
 * - Disables raycasting when faded (objects become click-through)
 * - Preserves original material properties when re-enabled
 *
 * **Configuration:**
 * - `referencePoint` - Object to keep visible (defaults to scene root)
 * - `fadeDuration` - Transition speed (default: 0.05 seconds)
 * - `minAlpha` - Minimum opacity when faded (default: 0 = fully transparent)
 * - `useAlphaHash` - Use dithered transparency instead of true transparency (default: true)
 *
 * **Performance:**
 * - Materials are cloned once per renderer to avoid affecting shared materials
 * - Updates direction calculation every 20 frames by default (configurable via `autoUpdate`)
 * - Use `needsUpdate = true` to force immediate recalculation
 *
 * **Requirements:**
 * Requires at least one {@link Renderer} component on the same object or child objects.
 *
 * @example Make walls transparent when blocking view
 * ```ts
 * // Add to walls or obstacles
 * const seeThrough = wall.addComponent(SeeThrough);
 * seeThrough.referencePoint = player; // Keep player visible
 * seeThrough.fadeDuration = 0.2; // Smooth fade
 * seeThrough.minAlpha = 0.2; // Slightly visible when faded
 * ```
 *
 * @example Third-person camera with see-through objects
 * ```ts
 * const character = GameObject.findByName("Character");
 * const obstacles = GameObject.findByTag("Obstacle");
 *
 * for (const obstacle of obstacles) {
 *   const st = obstacle.addComponent(SeeThrough);
 *   st.referencePoint = character;
 *   st.useAlphaHash = true; // Better performance
 * }
 * ```
 *
 * @example Manual control of see-through effect
 * ```ts
 * const seeThrough = this.gameObject.getComponent(SeeThrough);
 * if (seeThrough) {
 *   seeThrough.autoUpdate = false; // Disable automatic fading
 *
 *   // Manually control transparency
 *   seeThrough.updateAlpha(0.5, 0.3); // Fade to 50% over 0.3 seconds
 *
 *   // Or use override for precise control
 *   seeThrough.overrideAlpha = 0.8; // Force 80% opacity
 * }
 * ```
 *
 * @summary Fades objects when they obscure the camera's view of a reference point
 * @category Rendering
 * @group Components
 * @see {@link Renderer} for material/rendering control (required)
 * @see {@link Camera} for camera setup and configuration
 * @see {@link OrbitControls} for camera controls in similar use cases
 * @link https://see-through-walls-z23hmxbz1kjfjn.needle.run/ for live demo
 * @link https://engine.needle.tools/samples/see-through for sample project
 */
export declare class SeeThrough extends Behaviour {
    /**
     * Assign a reference point - if this point will be obscured from the camera by this object then this object will fade out.
     * If no reference point is assigned the scene's root object will be used as reference point.
     */
    referencePoint: Object3D | null;
    /**
     * Fade Duration in seconds
     * @default 0.05
    */
    fadeDuration: number;
    /**
     * Minimum alpha value when fading out (0-1)
     * @default 0
     */
    minAlpha: number;
    /**
     * When useAlphaHash is enabled the object will fade out using alpha hashing, this means the object can stay opaque. If disabled the object will set to be transparent when fading out.
     * @default true
     */
    useAlphaHash: boolean;
    /**
     * Set this to force updating the reference point position and direction
     */
    set needsUpdate(val: boolean);
    get needsUpdate(): boolean;
    /**
     * Override the alpha value, -1 means no override
     * @default -1
     */
    overrideAlpha: number;
    /**
     *
     */
    autoUpdate: boolean;
    private readonly _referencePointVector;
    private readonly _referencePointDir;
    private _distance;
    private _renderer;
    private _needsUpdate;
    private _id;
    /** * @internal */
    onEnable(): void;
    /**  @internal */
    onDisable(): void;
    /**
     * @internal
     */
    update(): void;
    private updateDirection;
    /**
     * Update the alpha of the object's materials towards the target alpha over the given duration.
     * @param targetAlpha Target alpha value (0-1)
     * @param duration Duration in seconds to reach the target alpha. 0 means immediate. Default is the component's fadeDuration.
     */
    updateAlpha(targetAlpha: number, duration?: number): void;
}
