1 | import { ColorRepresentation } from "../math/Color.js";
|
2 | import { Light } from "./Light.js";
|
3 |
|
4 | /**
|
5 | * {@link RectAreaLight} emits light uniformly across the face a rectangular plane
|
6 | * @remarks
|
7 | * This light type can be used to simulate light sources such as bright windows or strip lighting.
|
8 | * Important Notes:
|
9 | * - There is no shadow support.
|
10 | * - Only {@link MeshStandardMaterial | MeshStandardMaterial} and {@link MeshPhysicalMaterial | MeshPhysicalMaterial} are supported.
|
11 | * - You have to include {@link https://threejs.org/examples/jsm/lights/RectAreaLightUniformsLib.js | RectAreaLightUniformsLib} into your scene and call `init()`.
|
12 | * @example
|
13 | * ```typescript
|
14 | * const width = 10;
|
15 | * const height = 10;
|
16 | * const intensity = 1;
|
17 | * const rectLight = new THREE.RectAreaLight(0xffffff, intensity, width, height);
|
18 | * rectLight.position.set(5, 5, 0);
|
19 | * rectLight.lookAt(0, 0, 0);
|
20 | * scene.add(rectLight)
|
21 | * const rectLightHelper = new RectAreaLightHelper(rectLight);
|
22 | * rectLight.add(rectLightHelper);
|
23 | * ```
|
24 | * @see Example: {@link https://threejs.org/examples/#webgl_lights_rectarealight | WebGL / {@link RectAreaLight} }
|
25 | * @see {@link https://threejs.org/docs/index.html#api/en/lights/RectAreaLight | Official Documentation}
|
26 | * @see {@link https://github.com/mrdoob/three.js/blob/master/src/lights/RectAreaLight.js | Source}
|
27 | */
|
28 | export class RectAreaLight extends Light<undefined> {
|
29 | /**
|
30 | * Creates a new {@link RectAreaLight}.
|
31 | * @param color Hexadecimal color of the light. Default `0xffffff` _(white)_.
|
32 | * @param intensity The light's intensity, or brightness. Expects a `Float`. Default `1`
|
33 | * @param width Width of the light. Expects a `Float`. Default `10`
|
34 | * @param height Height of the light. Expects a `Float`. Default `10`
|
35 | */
|
36 | constructor(color?: ColorRepresentation, intensity?: number, width?: number, height?: number);
|
37 |
|
38 | /**
|
39 | * Read-only flag to check if a given object is of type { RectAreaLight}.
|
40 | * This is a _constant_ value
|
41 | * `true`
|
42 | */
|
43 | readonly isRectAreaLight: true;
|
44 |
|
45 | /**
|
46 | * A Read-only _string_ to check if `this` object type.
|
47 | * @remarks Sub-classes will update this value.
|
48 | * @defaultValue `RectAreaLight`
|
49 | */
|
50 | override readonly type: string | "RectAreaLight";
|
51 |
|
52 | /**
|
53 | * The width of the light.
|
54 | * @remarks Expects a `Float`
|
55 | * @defaultValue `10`
|
56 | */
|
57 | width: number;
|
58 |
|
59 | /**
|
60 | * The height of the light.
|
61 | * @remarks Expects a `Float`
|
62 | * @defaultValue `10`
|
63 | */
|
64 | height: number;
|
65 |
|
66 | /**
|
67 | * The light's intensity.
|
68 | * @remarks Changing the intensity will also change the light's power.
|
69 | * When **{@link WebGLRenderer.useLegacyLights | legacy lighting mode} is disabled** — intensity is the luminance (brightness) of the light measured in nits (cd/m^2).
|
70 | * @remarks Expects a `Float`
|
71 | * @defaultValue `1`
|
72 | */
|
73 | intensity: number;
|
74 |
|
75 | /**
|
76 | * The light's power.
|
77 | * @remarks Changing the power will also change the light's intensity.
|
78 | * When **{@link WebGLRenderer.useLegacyLights | legacy lighting mode} is disabled** — power is the luminous power of the light measured in lumens (lm).
|
79 | * @remarks Expects a `Float`
|
80 | */
|
81 | power: number;
|
82 | }
|