UNPKG

1.57 kBTypeScriptView Raw
1import { BufferGeometry } from "../core/BufferGeometry.js";
2
3/**
4 * This can be used as a helper object to view a {@link BufferGeometry | geometry} as a wireframe.
5 * @example
6 * ```typescript
7 * const geometry = new THREE.SphereGeometry(100, 100, 100);
8 * const wireframe = new THREE.WireframeGeometry(geometry);
9 * const line = new THREE.LineSegments(wireframe);
10 * line.material.depthTest = false;
11 * line.material.opacity = 0.25;
12 * line.material.transparent = true;
13 * scene.add(line);
14 * ```
15 * @see Example: {@link https://threejs.org/examples/#webgl_helpers | helpers}
16 * @see {@link https://threejs.org/docs/index.html#api/en/geometries/WireframeGeometry | Official Documentation}
17 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/WireframeGeometry.js | Source}
18 */
19export class WireframeGeometry<TBufferGeometry extends BufferGeometry = BufferGeometry> extends BufferGeometry {
20 /**
21 * Create a new instance of {@link WireframeGeometry}
22 * @param geometry Any geometry object. Default `null`.
23 */
24 constructor(geometry?: TBufferGeometry);
25
26 /**
27 * A Read-only _string_ to check if `this` object type.
28 * @remarks Sub-classes will update this value.
29 * @defaultValue `WireframeGeometry`
30 */
31 override readonly type: string | "WireframeGeometry";
32
33 /**
34 * An object with a property for each of the constructor parameters.
35 * @remarks Any modification after instantiation does not change the geometry.
36 */
37 readonly parameters: {
38 readonly geometry: TBufferGeometry;
39 };
40}