import type { Vector3 } from '@holoscript/core'; /** * AdvancedLighting.ts * * Advanced light types beyond point / directional / spot: * - Area lights: rectangle, disk, tube (LTC approximation) * - IES light profiles (photometric, from .ies tabular data) * - Emissive mesh lights * - Light cookies (projected texture masks) * - Caustic intensity configuration * * All calculations are CPU-side (uniform / config helpers). * No WebGPU — fully testable in Vitest. * * @module rendering */ export type Vec3 = [number, number, number]; export type Vec2 = [number, number]; export type AreaLightShape = 'rectangle' | 'disk' | 'tube'; export type LightType = 'point' | 'spot' | 'directional' | 'area' | 'ies' | 'emissive_mesh'; export interface AreaLightConfig { shape: AreaLightShape; /** Half-extents for rectangle [w, h], radius for disk, [r, length] for tube */ size: Vec2; /** Two-sided emission */ twoSided: boolean; } export interface IESProfile { id: string; /** Vertical angles (0–180°) */ verticalAngles: number[]; /** Horizontal angles (0–360°) */ horizontalAngles: number[]; /** Candela values [horizontal][vertical] */ candela: number[][]; /** Maximum candela (for normalisation) */ maxCandela: number; } export interface LightCookie { /** Cookie texture width */ width: number; /** Cookie texture height */ height: number; /** RGBA pixel data (Float32Array, linear) */ pixels: Float32Array; } export interface CausticConfig { intensity: number; sampleCount: number; animationSpeed: number; } export interface AdvancedLight { id: string; type: LightType; position: Vector3; direction: Vector3; color: [number, number, number]; intensity: number; range: number; enabled: boolean; area?: AreaLightConfig; ies?: IESProfile; cookie?: LightCookie; caustic?: CausticConfig; /** Mesh geometry ID for emissive mesh lights */ meshId?: string; } /** * Parse a simplified IES LM-63 candela table. * Expects lines: "vertical_angles\nhorizontal_angles\ncandela_values..." * * For production use this would parse the full IES spec; here we handle * the minimal tabular data format used in tests. */ export declare function parseIESProfile(id: string, vertAngles: number[], horizAngles: number[], candela: number[][]): IESProfile; /** * Sample an IES profile for a given vertical + horizontal angle (degrees). * Returns normalised intensity [0–1]. */ export declare function sampleIES(profile: IESProfile, vertDeg: number, horizDeg: number): number; /** * Compute solid angle subtended by a rectangular area light. * All positions in world space. */ export declare function rectSolidAngle(surfacePos: Vector3, lightPos: Vector3, right: Vector3, up: Vector3, halfWidth: number, halfHeight: number): number; /** * Disk area light — solid angle approximation. */ export declare function diskSolidAngle(surfacePos: Vector3, lightPos: Vector3, radius: number): number; /** * Build a simple circular light cookie (sharp circular spot). */ export declare function buildCircleCookie(width: number, height: number, edgeSoftness?: number): LightCookie; /** * Sample a light cookie at UV coordinates [0–1]. * Returns [r, g, b, a]. */ export declare function sampleCookie(cookie: LightCookie, u: number, v: number): [number, number, number, number]; export declare class AdvancedLightingManager { private lights; addLight(config: Partial & { type: LightType; }): AdvancedLight; removeLight(id: string): boolean; getLight(id: string): AdvancedLight | undefined; getLightCount(): number; getEnabledCount(): number; getLightsByType(type: LightType): AdvancedLight[]; /** * Set a light cookie on an existing light. */ setCookie(id: string, cookie: LightCookie): void; /** * Set an IES profile on an existing light. */ setIES(id: string, profile: IESProfile): void; /** * Get total emissive power from all enabled emissive mesh lights. */ getTotalEmissivePower(): number; clear(): void; } //# sourceMappingURL=AdvancedLighting.d.ts.map