UNPKG

2.14 kBTypeScriptView Raw
1import { Vector3 } from "./Vector3.js";
2
3export class SphericalHarmonics3 {
4 constructor();
5
6 /**
7 * @default [new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(),
8 * new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3()]
9 */
10 coefficients: Vector3[];
11 readonly isSphericalHarmonics3: true;
12
13 set(coefficients: Vector3[]): SphericalHarmonics3;
14 zero(): SphericalHarmonics3;
15 add(sh: SphericalHarmonics3): SphericalHarmonics3;
16 addScaledSH(sh: SphericalHarmonics3, s: number): SphericalHarmonics3;
17 scale(s: number): SphericalHarmonics3;
18 lerp(sh: SphericalHarmonics3, alpha: number): SphericalHarmonics3;
19 equals(sh: SphericalHarmonics3): boolean;
20 copy(sh: SphericalHarmonics3): SphericalHarmonics3;
21 clone(): this;
22
23 /**
24 * Sets the values of this spherical harmonics from the provided array or array-like.
25 * @param array the source array or array-like.
26 * @param offset (optional) offset into the array. Default is 0.
27 */
28 fromArray(array: number[] | ArrayLike<number>, offset?: number): this;
29
30 /**
31 * Returns an array with the values of this spherical harmonics, or copies them into the provided array.
32 * @param array (optional) array to store the spherical harmonics to. If this is not provided, a new array will be created.
33 * @param offset (optional) optional offset into the array.
34 * @return The created or provided array.
35 */
36 toArray(array?: number[], offset?: number): number[];
37
38 /**
39 * Returns an array with the values of this spherical harmonics, or copies them into the provided array-like.
40 * @param array array-like to store the spherical harmonics to.
41 * @param offset (optional) optional offset into the array-like.
42 * @return The provided array-like.
43 */
44 toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>;
45
46 getAt(normal: Vector3, target: Vector3): Vector3;
47 getIrradianceAt(normal: Vector3, target: Vector3): Vector3;
48
49 static getBasisAt(normal: Vector3, shBasis: number[]): void;
50}