UNPKG

1.43 kBTypeScriptView Raw
1import { Box3 } from "../math/Box3.js";
2import { ColorRepresentation } from "../math/Color.js";
3import { LineSegments } from "../objects/LineSegments.js";
4
5/**
6 * Helper object to visualize a {@link THREE.Box3 | Box3}.
7 * @example
8 * ```typescript
9 * const box = new THREE.Box3();
10 * box.setFromCenterAndSize(new THREE.Vector3(1, 1, 1), new THREE.Vector3(2, 1, 3));
11 * const helper = new THREE.Box3Helper(box, 0xffff00);
12 * scene.add(helper);
13 * ```
14 * @see {@link https://threejs.org/docs/index.html#api/en/helpers/Box3Helper | Official Documentation}
15 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/helpers/Box3Helper.js | Source}
16 */
17export class Box3Helper extends LineSegments {
18 /**
19 * Creates a new wireframe box that represents the passed Box3.
20 * @param box The Box3 to show.
21 * @param color The box's color. Default `0xffff00`
22 */
23 constructor(box: Box3, color?: ColorRepresentation);
24
25 /**
26 * A Read-only _string_ to check if `this` object type.
27 * @remarks Sub-classes will update this value.
28 * @override
29 * @defaultValue `Box3Helper`
30 */
31 override readonly type: string | "Box3Helper";
32
33 /**
34 * The Box3 being visualized.
35 */
36 box: Box3;
37
38 /**
39 * Frees the GPU-related resources allocated by this instance
40 * @remarks
41 * Call this method whenever this instance is no longer used in your app.
42 */
43 dispose(): void;
44}