UNPKG

2.74 kBTypeScriptView Raw
1import { Color, ColorRepresentation } from "../math/Color.js";
2import { Vector3 } from "../math/Vector3.js";
3import { Light } from "./Light.js";
4
5/**
6 * A light source positioned directly above the scene, with color fading from the sky color to the ground color.
7 * @remarks This light cannot be used to cast shadows.
8 * @example
9 * ```typescript
10 * const light = new THREE.HemisphereLight(0xffffbb, 0x080820, 1);
11 * scene.add(light);
12 * ```
13 * @see Example: {@link https://threejs.org/examples/#webgl_animation_skinning_blending | animation / skinning / blending }
14 * @see Example: {@link https://threejs.org/examples/#webgl_lights_hemisphere | lights / hemisphere }
15 * @see Example: {@link https://threejs.org/examples/#misc_controls_pointerlock | controls / pointerlock }
16 * @see Example: {@link https://threejs.org/examples/#webgl_loader_collada_kinematics | loader / collada / kinematics }
17 * @see Example: {@link https://threejs.org/examples/#webgl_loader_stl | loader / stl }
18 * @see {@link https://threejs.org/docs/index.html#api/en/lights/HemisphereLight | Official Documentation}
19 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/lights/HemisphereLight.js | Source}
20 */
21export class HemisphereLight extends Light<undefined> {
22 /**
23 * Creates a new {@link HemisphereLight}.
24 * @param skyColor Hexadecimal color of the sky. Expects a `Integer`. Default `0xffffff` _(white)_.
25 * @param groundColor Hexadecimal color of the ground. Expects a `Integer`. Default `0xffffff` _(white)_.
26 * @param intensity Numeric value of the light's strength/intensity. Expects a `Float`. Default `1`.
27 */
28 constructor(skyColor?: ColorRepresentation, groundColor?: ColorRepresentation, intensity?: number);
29
30 /**
31 * Read-only flag to check if a given object is of type {@link HemisphereLight}.
32 * @remarks This is a _constant_ value
33 * @defaultValue `true`
34 */
35 readonly isHemisphereLight: true;
36
37 /**
38 * A Read-only _string_ to check if `this` object type.
39 * @remarks Sub-classes will update this value.
40 * @defaultValue `HemisphereLight`
41 */
42 override readonly type: string | "HemisphereLight";
43
44 /**
45 * This is set equal to {@link THREE.Object3D.DEFAULT_UP}, so that the light shines from the top down.
46 * @defaultValue {@link Object3D.DEFAULT_UP} _(0, 1, 0)_
47 */
48 override readonly position: Vector3;
49
50 /**
51 * The light's sky color, as passed in the constructor.
52 * @defaultValue `new THREE.Color()` set to white _(0xffffff)_.
53 */
54 override color: Color;
55
56 /**
57 * The light's ground color, as passed in the constructor.
58 * @defaultValue `new THREE.Color()` set to white _(0xffffff)_.
59 */
60 groundColor: Color;
61}