123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- import { Vector3 } from "../Maths/math.vector";
- import type { Color3 } from "../Maths/math.color";
- /**
- * Class representing spherical harmonics coefficients to the 3rd degree
- */
- export declare class SphericalHarmonics {
- /**
- * Defines whether or not the harmonics have been prescaled for rendering.
- */
- preScaled: boolean;
- /**
- * The l0,0 coefficients of the spherical harmonics
- */
- l00: Vector3;
- /**
- * The l1,-1 coefficients of the spherical harmonics
- */
- l1_1: Vector3;
- /**
- * The l1,0 coefficients of the spherical harmonics
- */
- l10: Vector3;
- /**
- * The l1,1 coefficients of the spherical harmonics
- */
- l11: Vector3;
- /**
- * The l2,-2 coefficients of the spherical harmonics
- */
- l2_2: Vector3;
- /**
- * The l2,-1 coefficients of the spherical harmonics
- */
- l2_1: Vector3;
- /**
- * The l2,0 coefficients of the spherical harmonics
- */
- l20: Vector3;
- /**
- * The l2,1 coefficients of the spherical harmonics
- */
- l21: Vector3;
- /**
- * The l2,2 coefficients of the spherical harmonics
- */
- l22: Vector3;
- /**
- * Adds a light to the spherical harmonics
- * @param direction the direction of the light
- * @param color the color of the light
- * @param deltaSolidAngle the delta solid angle of the light
- */
- addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
- /**
- * Scales the spherical harmonics by the given amount
- * @param scale the amount to scale
- */
- scaleInPlace(scale: number): void;
- /**
- * Convert from incident radiance (Li) to irradiance (E) by applying convolution with the cosine-weighted hemisphere.
- *
- * ```
- * E_lm = A_l * L_lm
- * ```
- *
- * In spherical harmonics this convolution amounts to scaling factors for each frequency band.
- * This corresponds to equation 5 in "An Efficient Representation for Irradiance Environment Maps", where
- * the scaling factors are given in equation 9.
- */
- convertIncidentRadianceToIrradiance(): void;
- /**
- * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation.
- *
- * ```
- * L = (1/pi) * E * rho
- * ```
- *
- * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually.
- */
- convertIrradianceToLambertianRadiance(): void;
- /**
- * Integrates the reconstruction coefficients directly in to the SH preventing further
- * required operations at run time.
- *
- * This is simply done by scaling back the SH with Ylm constants parameter.
- * The trigonometric part being applied by the shader at run time.
- */
- preScaleForRendering(): void;
- /**
- * update the spherical harmonics coefficients from the given array
- * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)
- * @returns the spherical harmonics (this)
- */
- updateFromArray(data: ArrayLike<ArrayLike<number>>): SphericalHarmonics;
- /**
- * update the spherical harmonics coefficients from the given floats array
- * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)
- * @returns the spherical harmonics (this)
- */
- updateFromFloatsArray(data: ArrayLike<number>): SphericalHarmonics;
- /**
- * Constructs a spherical harmonics from an array.
- * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)
- * @returns the spherical harmonics
- */
- static FromArray(data: ArrayLike<ArrayLike<number>>): SphericalHarmonics;
- /**
- * Gets the spherical harmonics from polynomial
- * @param polynomial the spherical polynomial
- * @returns the spherical harmonics
- */
- static FromPolynomial(polynomial: SphericalPolynomial): SphericalHarmonics;
- }
- /**
- * Class representing spherical polynomial coefficients to the 3rd degree
- */
- export declare class SphericalPolynomial {
- private _harmonics;
- /**
- * The spherical harmonics used to create the polynomials.
- */
- get preScaledHarmonics(): SphericalHarmonics;
- /**
- * The x coefficients of the spherical polynomial
- */
- x: Vector3;
- /**
- * The y coefficients of the spherical polynomial
- */
- y: Vector3;
- /**
- * The z coefficients of the spherical polynomial
- */
- z: Vector3;
- /**
- * The xx coefficients of the spherical polynomial
- */
- xx: Vector3;
- /**
- * The yy coefficients of the spherical polynomial
- */
- yy: Vector3;
- /**
- * The zz coefficients of the spherical polynomial
- */
- zz: Vector3;
- /**
- * The xy coefficients of the spherical polynomial
- */
- xy: Vector3;
- /**
- * The yz coefficients of the spherical polynomial
- */
- yz: Vector3;
- /**
- * The zx coefficients of the spherical polynomial
- */
- zx: Vector3;
- /**
- * Adds an ambient color to the spherical polynomial
- * @param color the color to add
- */
- addAmbient(color: Color3): void;
- /**
- * Scales the spherical polynomial by the given amount
- * @param scale the amount to scale
- */
- scaleInPlace(scale: number): void;
- /**
- * Updates the spherical polynomial from harmonics
- * @param harmonics the spherical harmonics
- * @returns the spherical polynomial
- */
- updateFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
- /**
- * Gets the spherical polynomial from harmonics
- * @param harmonics the spherical harmonics
- * @returns the spherical polynomial
- */
- static FromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
- /**
- * Constructs a spherical polynomial from an array.
- * @param data defines the 9x3 coefficients (x, y, z, xx, yy, zz, yz, zx, xy)
- * @returns the spherical polynomial
- */
- static FromArray(data: ArrayLike<ArrayLike<number>>): SphericalPolynomial;
- }
|