import { Color } from "../math/color.ts"; import { Vector3d } from "../math/vector3d.ts"; import Renderable from "../renderable/renderable.js"; /** * Options accepted by the {@link Light3d} constructor. * @category Lighting */ export interface Light3dOptions { /** * light type: `"directional"` (a sun), `"ambient"` (a flat fill added to * every lit pixel), `"point"` (radiates from `position` with quadratic * falloff over `range`) or `"spot"` (a point light confined to a cone * along `direction`). */ type?: "directional" | "ambient" | "point" | "spot"; /** * World-space direction the light TRAVELS ALONG — not the direction it * comes from (directional lights, and the cone axis of spot lights). * * Render space is **Y-down**, so a sun overhead shining onto the scene * travels *downward* and its Y is **positive**: `[-0.35, 0.8, 0.45]` is a * late-afternoon sun. A negative Y lights everything from underneath, * which reads instantly as wrong and is the usual mistake here. * * Either an `[x, y, z]` array or a {@link Vector3d} — as * {@link Light3dOptions.color} already takes several forms. The vector is * READ, not retained: {@link Light3d#direction} remains the engine's own, * and normalized, so mutating what you passed in afterwards changes * nothing. */ direction?: [number, number, number] | Vector3d; /** * World-space position (point and spot lights), as an `[x, y, z]` array or * a {@link Vector3d}. Y-down again: a lamp above the floor has a * **smaller** y than the floor. */ position?: [number, number, number] | Vector3d; /** * light color — a {@link Color}, a CSS color string, or an `[r, g, b]` * array with components in `0..1` (the glTF convention). Defaults to white. */ color?: Color | string | [number, number, number]; /** scalar multiplier on the light's contribution. Defaults to `1`. */ intensity?: number; /** * falloff distance in world units (point and spot lights): the light * fades quadratically from full strength at its position to zero at * `range` — the same stylized model as {@link Light2d}'s radius, not a * physical inverse-square. Defaults to `1000`. */ range?: number; /** * spot cone: angle (radians) from the axis where the light is at full * strength. Defaults to `0`. */ innerConeAngle?: number; /** * spot cone: angle (radians) from the axis where the light reaches * zero, fading smoothly from `innerConeAngle`. Defaults to `π/4`. */ outerConeAngle?: number; } export declare class Light3d extends Renderable { /** `"directional"`, `"ambient"`, `"point"` or `"spot"`. */ type: "directional" | "ambient" | "point" | "spot"; /** * world-space travel direction (directional lights, spot cone axis); * kept normalized. */ direction: Vector3d; /** world-space position (point and spot lights). */ position: Vector3d; /** the light color. */ color: Color; /** scalar multiplier on the light's contribution. */ intensity: number; /** * falloff distance in world units (point/spot) — full strength at the * position, zero at `range`. */ range: number; /** spot cone inner angle (radians) — full strength inside it. */ innerConeAngle: number; /** spot cone outer angle (radians) — zero beyond it. */ outerConeAngle: number; /** * @param [options] - see {@link Light3dOptions} */ constructor(options?: Light3dOptions); } //# sourceMappingURL=light3d.d.ts.map