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