UNPKG

2.91 kBTypeScriptView Raw
1import { BufferGeometry, NormalOrGLBufferAttributes } from "../core/BufferGeometry.js";
2import { Object3D, Object3DEventMap } from "../core/Object3D.js";
3import { Material } from "../materials/Material.js";
4
5/**
6 * A class for displaying {@link Points}
7 * @remarks
8 * The {@link Points} are rendered by the {@link THREE.WebGLRenderer | WebGLRenderer} using {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements | gl.POINTS}.
9 * @see {@link https://threejs.org/docs/index.html#api/en/objects/Points | Official Documentation}
10 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/Points.js | Source}
11 */
12export class Points<
13 TGeometry extends BufferGeometry<NormalOrGLBufferAttributes> = BufferGeometry,
14 TMaterial extends Material | Material[] = Material | Material[],
15 TEventMap extends Object3DEventMap = Object3DEventMap,
16> extends Object3D<TEventMap> {
17 /**
18 * Create a new instance of {@link Points}
19 * @param geometry An instance of {@link THREE.BufferGeometry | BufferGeometry}. Default {@link THREE.BufferGeometry | `new THREE.BufferGeometry()`}.
20 * @param material A single or an array of {@link THREE.Material | Material}. Default {@link THREE.PointsMaterial | `new THREE.PointsMaterial()`}.
21 */
22 constructor(geometry?: TGeometry, material?: TMaterial);
23
24 /**
25 * Read-only flag to check if a given object is of type {@link Points}.
26 * @remarks This is a _constant_ value
27 * @defaultValue `true`
28 */
29 readonly isPoints: true;
30
31 /**
32 * @override
33 * @defaultValue `Points`
34 */
35 override readonly type: string | "Points";
36
37 /**
38 * An array of weights typically from `0-1` that specify how much of the morph is applied.
39 * @defaultValue `undefined`, _but reset to a blank array by {@link updateMorphTargets | .updateMorphTargets()}._
40 */
41 morphTargetInfluences?: number[] | undefined;
42
43 /**
44 * A dictionary of morphTargets based on the `morphTarget.name` property.
45 * @defaultValue `undefined`, _but rebuilt by {@link updateMorphTargets | .updateMorphTargets()}._
46 */
47 morphTargetDictionary?: { [key: string]: number } | undefined;
48
49 /**
50 * An instance of {@link THREE.BufferGeometry | BufferGeometry} (or derived classes), defining the object's structure.
51 * @remarks each vertex designates the position of a particle in the system.
52 */
53 geometry: TGeometry;
54
55 /**
56 * An instance of {@link THREE.Material | Material}, defining the object's appearance.
57 * @defaultValue {@link THREE.PointsMaterial | `new THREE.PointsMaterial()`}, _with randomised colour_.
58 */
59 material: TMaterial;
60
61 /**
62 * Updates the morphTargets to have no influence on the object
63 * @remarks Resets the {@link morphTargetInfluences} and {@link morphTargetDictionary} properties.
64 */
65 updateMorphTargets(): void;
66}