UNPKG

@types/three

Version:
47 lines (44 loc) 1.84 kB
import { JSONMeta } from "../core/Object3D.js"; import { SphericalHarmonics3 } from "../math/SphericalHarmonics3.js"; import { Light, LightJSON } from "./Light.js"; export interface LightProbeJSON extends LightJSON { sh: number[]; } /** * Light probes are an alternative way of adding light to a 3D scene. Unlike * classical light sources (e.g. directional, point or spot lights), light * probes do not emit light. Instead they store information about light * passing through 3D space. During rendering, the light that hits a 3D * object is approximated by using the data from the light probe. * * Light probes are usually created from (radiance) environment maps. The * class {@link LightProbeGenerator} can be used to create light probes from * cube textures or render targets. However, light estimation data could also * be provided in other forms e.g. by WebXR. This enables the rendering of * augmented reality content that reacts to real world lighting. * * The current probe implementation in three.js supports so-called diffuse * light probes. This type of light probe is functionally equivalent to an * irradiance environment map. */ export class LightProbe extends Light { /** * Constructs a new light probe. * * @param {SphericalHarmonics3} sh - The spherical harmonics which represents encoded lighting information. * @param {number} [intensity=1] - The light's strength/intensity. */ constructor(sh?: SphericalHarmonics3, intensity?: number); /** * This flag can be used for type testing. * * @default true */ readonly isLightProbe: boolean; /** * A light probe uses spherical harmonics to encode lighting information. */ sh: SphericalHarmonics3; copy(source: LightProbe): this; toJSON(meta?: JSONMeta): LightProbeJSON; }