UNPKG

2.67 kBTypeScriptView Raw
1import { Object3D } from "../core/Object3D.js";
2import { HemisphereLight } from "../lights/HemisphereLight.js";
3import { MeshBasicMaterial } from "../materials/MeshBasicMaterial.js";
4import { ColorRepresentation } from "../math/Color.js";
5import { Matrix4 } from "../math/Matrix4.js";
6
7/**
8 * Creates a visual aid consisting of a spherical {@link THREE.Mesh | Mesh} for a {@link THREE.HemisphereLight | HemisphereLight}.
9 * @example
10 * ```typescript
11 * const light = new THREE.HemisphereLight(0xffffbb, 0x080820, 1);
12 * const helper = new THREE.HemisphereLightHelper(light, 5);
13 * scene.add(helper);
14 * ```
15 * @see {@link https://threejs.org/docs/index.html#api/en/helpers/HemisphereLightHelper | Official Documentation}
16 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/helpers/HemisphereLightHelper.js | Source}
17 */
18export class HemisphereLightHelper extends Object3D {
19 /**
20 * Create a new instance of {@link HemisphereLightHelper}
21 * @param light The light being visualized.
22 * @param size Thr sphere size
23 * @param color If this is not the set the helper will take the color of the light.
24 */
25 constructor(light: HemisphereLight, size: number, color?: ColorRepresentation);
26
27 /**
28 * A Read-only _string_ to check if `this` object type.
29 * @remarks Sub-classes will update this value.
30 * @override
31 * @defaultValue `HemisphereLightHelper`
32 */
33 override readonly type: string | "HemisphereLightHelper";
34
35 /**
36 * Reference to the HemisphereLight being visualized.
37 */
38 light: HemisphereLight;
39
40 /**
41 * Reference to the {@link THREE.HemisphereLight.matrixWorld | light.matrixWorld}.
42 */
43 matrix: Matrix4;
44
45 /**
46 * Is set to `false`, as the helper is using the {@link THREE.HemisphereLight.matrixWorld | light.matrixWorld}.
47 * @see {@link THREE.Object3D.matrixAutoUpdate | Object3D.matrixAutoUpdate}.
48 * @defaultValue `false`.
49 */
50 override matrixAutoUpdate: boolean;
51
52 material: MeshBasicMaterial; // TODO: Double check if this need to be exposed or not.
53
54 /**
55 * The color parameter passed in the constructor.
56 * @remarks If this is changed, the helper's color will update the next time {@link update} is called.
57 * @defaultValue `undefined`
58 */
59 color: ColorRepresentation | undefined;
60
61 /**
62 * Updates the helper to match the position and direction of the {@link .light | HemisphereLight}.
63 */
64 update(): void;
65
66 /**
67 * Frees the GPU-related resources allocated by this instance
68 * @remarks
69 * Call this method whenever this instance is no longer used in your app.
70 */
71 dispose(): void;
72}