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