@types/three 0.149.0 → 0.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. three/README.md +2 -2
  2. three/build/three.d.cts +2 -0
  3. three/build/three.d.ts +2 -0
  4. three/build/three.module.d.ts +2 -0
  5. three/examples/jsm/controls/OrbitControls.d.ts +8 -3
  6. three/examples/jsm/controls/TrackballControls.d.ts +2 -2
  7. three/examples/jsm/controls/TransformControls.d.ts +4 -4
  8. three/examples/jsm/helpers/OctreeHelper.d.ts +1 -1
  9. three/examples/jsm/libs/fflate.module.d.ts +1 -0
  10. three/examples/jsm/libs/lil-gui.module.min.d.ts +1 -0
  11. three/examples/jsm/libs/stats.module.d.ts +2 -23
  12. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +3 -4
  13. three/examples/jsm/objects/MarchingCubes.d.ts +1 -0
  14. three/examples/jsm/shaders/VelocityShader.d.ts +2 -2
  15. three/index.d.ts +1 -1
  16. three/package.json +19 -4
  17. three/src/Three.d.ts +0 -1
  18. three/src/constants.d.ts +394 -254
  19. three/src/core/BufferAttribute.d.ts +456 -85
  20. three/src/core/BufferGeometry.d.ts +235 -67
  21. three/src/core/Clock.d.ts +28 -20
  22. three/src/core/EventDispatcher.d.ts +20 -4
  23. three/src/core/GLBufferAttribute.d.ts +102 -8
  24. three/src/core/InstancedBufferAttribute.d.ts +13 -24
  25. three/src/core/InstancedBufferGeometry.d.ts +22 -4
  26. three/src/core/InstancedInterleavedBuffer.d.ts +10 -2
  27. three/src/core/InterleavedBuffer.d.ts +98 -14
  28. three/src/core/InterleavedBufferAttribute.d.ts +146 -7
  29. three/src/core/Layers.d.ts +61 -6
  30. three/src/core/Object3D.d.ts +236 -119
  31. three/src/core/Raycaster.d.ts +103 -27
  32. three/src/core/Uniform.d.ts +28 -11
  33. three/src/core/UniformsGroup.d.ts +10 -4
  34. three/src/extras/Earcut.d.ts +3 -4
  35. three/src/materials/MeshPhysicalMaterial.d.ts +13 -1
  36. three/src/math/Color.d.ts +157 -3
  37. three/src/math/ColorManagement.d.ts +13 -7
  38. three/src/renderers/WebGLRenderer.d.ts +2 -2
  39. three/src/utils.d.ts +5 -2
  40. three/examples/jsm/libs/fflate.module.min.d.ts +0 -1185
@@ -1,27 +1,121 @@
1
1
  /**
2
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/GLBufferAttribute.js|src/core/GLBufferAttribute.js}
2
+ * This buffer attribute class does not construct a VBO.
3
+ * Instead, it uses whatever VBO is passed in constructor and can later be altered via the {@link buffer | .buffer} property.
4
+ * @remarks
5
+ * It is required to pass additional params alongside the VBO
6
+ * Those are: the GL context, the GL data type, the number of components per vertex, the number of bytes per component, and the number of vertices.
7
+ * @remarks
8
+ * The most common use case for this class is when some kind of GPGPU calculation interferes or even produces the VBOs in question.
9
+ * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_glbufferattribute | WebGL / buffergeometry / glbufferattribute}
10
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/GLBufferAttribute | Official Documentation}
11
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/GLBufferAttribute.js | Source}
3
12
  */
4
-
5
13
  export class GLBufferAttribute {
6
- constructor(buffer: WebGLBuffer, type: number, itemSize: number, elementSize: 1 | 2 | 4, count: number);
14
+ /**
15
+ * This creates a new GLBufferAttribute object.
16
+ * @param buffer Must be a {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer | WebGLBuffer}. See {@link GLBufferAttribute.buffer | .buffer}
17
+ * @param type One of {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types | WebGL Data Types}. See {@link GLBufferAttribute.type | .type}
18
+ * @param itemSize How many values make up each item (vertex). See {@link GLBufferAttribute.itemSize | .itemSize}
19
+ * @param elementSize `1`, `2` or `4`. The corresponding size (in bytes) for the given {@link type} param. See {@link GLBufferAttribute.elementSize | .elementSize}
20
+ * @param count The expected number of vertices in VBO. See {@link GLBufferAttribute.count | .count}
21
+ */
22
+ constructor(buffer: WebGLBuffer, type: GLenum, itemSize: number, elementSize: 1 | 2 | 4, count: number);
23
+
24
+ /**
25
+ * Read-only flag to check if a given object is of type {@link GLBufferAttribute}.
26
+ * @remarks This is a _constant_ value
27
+ * @defaultValue `true`
28
+ */
29
+ readonly isGLBufferAttribute: true;
7
30
 
8
31
  /**
9
- * @default ''
32
+ * Optional name for this attribute instance.
33
+ * @defaultValue `""`
10
34
  */
11
35
  name: string;
36
+
37
+ /**
38
+ * The current {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer | WebGLBuffer} instance.
39
+ */
12
40
  buffer: WebGLBuffer;
13
- type: number;
41
+
42
+ /**
43
+ * A {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types | WebGL Data Type} describing the underlying VBO contents.
44
+ *
45
+ * #### WebGL Data Type (`GLenum`)
46
+ * - gl.BYTE: 0x1400
47
+ * - gl.UNSIGNED_BYTE: 0x1401
48
+ * - gl.SHORT: 0x1402
49
+ * - gl.UNSIGNED_SHORT: 0x1403
50
+ * - gl.INT: 0x1404
51
+ * - gl.UNSIGNED_INT: 0x1405
52
+ * - gl.FLOAT: 0x1406
53
+ * @remarks Set this property together with {@link elementSize | .elementSize}. The recommended way is using the {@link setType | .setType()} method.
54
+ * @remarks Expects a `DataType` `GLenum` _possible values:_ `0x1400` `0x1401` `0x1402` `0x1403` `0x1404` `0x1405` `0x1406`
55
+ */
56
+ type: GLenum;
57
+
58
+ /**
59
+ * How many values make up each item (vertex).
60
+ * @remarks The number of values of the array that should be associated with a particular vertex.
61
+ * For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
62
+ * @remarks Expects a `Integer`
63
+ */
14
64
  itemSize: number;
65
+
66
+ /**
67
+ * Stores the corresponding size in bytes for the current {@link type | .type} property value.
68
+ *
69
+ * The corresponding size (_in bytes_) for the given "type" param.
70
+ * #### WebGL Data Type (`GLenum`)
71
+ * - gl.BYTE: 1
72
+ * - gl.UNSIGNED_BYTE: 1
73
+ * - gl.SHORT: 2
74
+ * - gl.UNSIGNED_SHORT: 2
75
+ * - gl.INT: 4
76
+ * - gl.UNSIGNED_INT: 4
77
+ * - gl.FLOAT: 4
78
+ * @remarks Set this property together with {@link type | .type}. The recommended way is using the {@link setType | .setType} method.
79
+ * @see `constructor`` for a list of known type sizes.
80
+ * @remarks Expects a `1`, `2` or `4`
81
+ */
15
82
  elementSize: 1 | 2 | 4;
83
+
84
+ /**
85
+ * The expected number of vertices in VBO.
86
+ * @remarks Expects a `Integer`
87
+ */
16
88
  count: number;
17
- version: number;
18
89
 
19
- readonly isGLBufferAttribute: true;
90
+ /**
91
+ * A version number, incremented every time the needsUpdate property is set to true.
92
+ * @remarks Expects a `Integer`
93
+ */
94
+ version: number;
20
95
 
96
+ /**
97
+ * Setting this to true increments {@link version | .version}.
98
+ * @remarks _set-only property_.
99
+ */
21
100
  set needsUpdate(value: boolean);
22
101
 
102
+ /**
103
+ * Sets the {@link buffer | .buffer} property.
104
+ */
23
105
  setBuffer(buffer: WebGLBuffer): this;
24
- setType(type: number, elementSize: 1 | 2 | 4): this;
106
+
107
+ /**
108
+ * Sets the both {@link GLBufferAttribute.type | type} and {@link GLBufferAttribute.elementSize | elementSize} properties.
109
+ */
110
+ setType(type: GLenum, elementSize: 1 | 2 | 4): this;
111
+
112
+ /**
113
+ * Sets the {@link GLBufferAttribute.itemSize | itemSize} property.
114
+ */
25
115
  setItemSize(itemSize: number): this;
116
+
117
+ /**
118
+ * Sets the {@link GLBufferAttribute.count | count} property.
119
+ */
26
120
  setCount(count: number): this;
27
121
  }
@@ -2,36 +2,25 @@ import { BufferGeometry } from './BufferGeometry';
2
2
  import { BufferAttribute } from './BufferAttribute';
3
3
 
4
4
  /**
5
- * see {@link https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/BufferGeometryUtils.js|examples/jsm/utils/BufferGeometryUtils.js}
5
+ * An instanced version of {@link THREE.InstancedBufferAttributeBufferAttribute | BufferAttribute}.
6
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/InstancedBufferAttribute | Official Documentation}
7
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferAttribute.js | Source}
6
8
  */
7
- export namespace BufferGeometryUtils {
8
- function mergeBufferGeometries(geometries: BufferGeometry[]): BufferGeometry;
9
- function computeTangents(geometry: BufferGeometry): null;
10
- function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
11
- }
12
-
13
- /**
14
- * @deprecated
15
- */
16
- export namespace GeometryUtils {
17
- /**
18
- * @deprecated Use {@link Geometry#merge geometry.merge( geometry2, matrix, materialIndexOffset )} instead.
19
- */
20
- function merge(geometry1: any, geometry2: any, materialIndexOffset?: any): any;
9
+ export class InstancedBufferAttribute extends BufferAttribute {
21
10
  /**
22
- * @deprecated Use {@link Geometry#center geometry.center()} instead.
11
+ * Create a new instance of {@link THREE.InstancedBufferAttribute | InstancedBufferAttribute}
12
+ * @param array
13
+ * @param itemSize
14
+ * @param normalized
15
+ * @param meshPerAttribute
23
16
  */
24
- function center(geometry: any): any;
25
- }
26
-
27
- /**
28
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferAttribute.js|src/core/InstancedBufferAttribute.js}
29
- */
30
- export class InstancedBufferAttribute extends BufferAttribute {
31
17
  constructor(array: ArrayLike<number>, itemSize: number, normalized?: boolean, meshPerAttribute?: number);
32
18
 
33
19
  /**
34
- * @default 1
20
+ * Defines how often a value of this buffer attribute should be repeated.
21
+ * A value of one means that each value of the instanced attribute is used for a single instance.
22
+ * A value of two means that each value is used for two consecutive instances (and so on).
23
+ * @defaultValue `1`
35
24
  */
36
25
  meshPerAttribute: number;
37
26
  }
@@ -1,20 +1,38 @@
1
1
  import { BufferGeometry } from './BufferGeometry';
2
2
 
3
3
  /**
4
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferGeometry.js|src/core/InstancedBufferGeometry.js}
4
+ * An instanced version of {@link THREE.BufferGeometry | BufferGeometry}.
5
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/InstancedBufferGeometry | Official Documentation}
6
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferGeometry.js | Source}
5
7
  */
6
8
  export class InstancedBufferGeometry extends BufferGeometry {
9
+ /**
10
+ * Create a new instance of {@link InstancedBufferGeometry}
11
+ */
7
12
  constructor();
8
13
 
9
14
  /**
10
- * @default 'InstancedBufferGeometry
15
+ * @defaultValue `InstancedBufferGeometry`
11
16
  */
12
17
  type: string;
13
18
 
14
- isInstancedBufferGeometry: boolean;
19
+ /**
20
+ * Read-only flag to check if a given object is of type {@link InstancedBufferGeometry}.
21
+ * @remarks This is a _constant_ value
22
+ * @defaultValue `true`
23
+ */
24
+ readonly isInstancedBufferGeometry: true;
15
25
 
16
26
  /**
17
- * @default Infinity
27
+ *
28
+ * @defaultValue `Infinity`
18
29
  */
19
30
  instanceCount: number;
31
+
32
+ /**
33
+ * Copies the given {@link InstancedBufferGeometry} to this instance.
34
+ * @param source
35
+ * @override
36
+ */
37
+ copy(source: InstancedBufferGeometry): this;
20
38
  }
@@ -1,13 +1,21 @@
1
1
  import { InterleavedBuffer } from './InterleavedBuffer';
2
2
 
3
3
  /**
4
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedInterleavedBuffer.js|src/core/InstancedInterleavedBuffer.js}
4
+ * An instanced version of {@link THREE.InterleavedBuffer | InterleavedBuffer}.
5
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/InstancedInterleavedBuffer | Official Documentation}
6
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedInterleavedBuffer.js | Source}
5
7
  */
6
8
  export class InstancedInterleavedBuffer extends InterleavedBuffer {
9
+ /**
10
+ * Create a new instance of {@link InstancedInterleavedBuffer}
11
+ * @param array
12
+ * @param itemSize
13
+ * @param meshPerAttribute
14
+ */
7
15
  constructor(array: ArrayLike<number>, stride: number, meshPerAttribute?: number);
8
16
 
9
17
  /**
10
- * @default 1
18
+ * @defaultValue `1`
11
19
  */
12
20
  meshPerAttribute: number;
13
21
  }
@@ -2,44 +2,128 @@ import { InterleavedBufferAttribute } from './InterleavedBufferAttribute';
2
2
  import { Usage } from '../constants';
3
3
 
4
4
  /**
5
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBuffer.js|src/core/InterleavedBuffer.js}
5
+ * **"Interleaved"** means that multiple attributes, possibly of different types, (e.g., _position, normal, uv, color_) are packed into a single array buffer.
6
+ * An introduction into interleaved arrays can be found here: {@link https://blog.tojicode.com/2011/05/interleaved-array-basics.html | Interleaved array basics}
7
+ * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_points_interleaved | webgl / buffergeometry / points / interleaved}
8
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/InterleavedBuffer | Official Documentation}
9
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBuffer.js | Source}
6
10
  */
7
11
  export class InterleavedBuffer {
12
+ /**
13
+ * Create a new instance of {@link InterleavedBuffer}
14
+ * @param array A {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | TypedArray} with a shared buffer. Stores the geometry data.
15
+ * @param stride The number of typed-array elements per vertex. Expects a `Integer`
16
+ */
8
17
  constructor(array: ArrayLike<number>, stride: number);
9
18
 
19
+ /**
20
+ * A {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | TypedArray} with a shared buffer. Stores the geometry data.
21
+ */
10
22
  array: ArrayLike<number>;
23
+
24
+ /**
25
+ * The number of {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | TypedArray} elements per vertex.
26
+ * @remarks Expects a `Integer`
27
+ */
11
28
  stride: number;
12
29
 
13
30
  /**
14
- * @default THREE.StaticDrawUsage
31
+ * Defines the intended usage pattern of the data store for optimization purposes.
32
+ * Corresponds to the {@link BufferAttribute.usage | usage} parameter of
33
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData | WebGLRenderingContext.bufferData}.
34
+ * @remarks
35
+ * After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
36
+ * @see {@link https://threejs.org/docs/index.html#api/en/constants/BufferAttributeUsage | Buffer Attribute Usage Constants} for all possible values.
37
+ * @see {@link BufferAttribute.setUsage | setUsage}
38
+ * @defaultValue {@link THREE.StaticDrawUsage | THREE.StaticDrawUsage}.
15
39
  */
16
40
  usage: Usage;
17
41
 
18
42
  /**
19
- * @default { offset: number; count: number }
43
+ * Object containing offset and count.
44
+ * @defaultValue `{ offset: number = 0; count: number = -1 }`
20
45
  */
21
- updateRange: { offset: number; count: number };
46
+ updateRange: {
47
+ /** @defaultValue `0` */
48
+ offset: number;
49
+ /** @defaultValue `-1` */
50
+ count: number;
51
+ };
22
52
 
23
53
  /**
24
- * @default 0
54
+ * A version number, incremented every time the {@link BufferAttribute.needsUpdate | needsUpdate} property is set to true.
55
+ * @remarks Expects a `Integer`
56
+ * @defaultValue `0`
25
57
  */
26
58
  version: number;
27
59
 
28
- length: number;
29
-
30
60
  /**
31
- * @default 0
61
+ * Gives the total number of elements in the array.
62
+ * @remarks Expects a `Integer`
63
+ * @defaultValue 0
32
64
  */
33
65
  count: number;
34
- needsUpdate: boolean;
66
+
67
+ /**
68
+ * Flag to indicate that this attribute has changed and should be re-sent to the GPU.
69
+ * Set this to true when you modify the value of the array.
70
+ * @remarks Setting this to true also increments the {@link BufferAttribute.version | version}.
71
+ * @remarks _set-only property_.
72
+ */
73
+ set needsUpdate(value: boolean);
74
+
75
+ /**
76
+ * {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
77
+ * @remarks This gets automatically assigned and shouldn't be edited.
78
+ */
35
79
  uuid: string;
36
80
 
37
- setUsage(usage: Usage): InterleavedBuffer;
38
- clone(data: object): InterleavedBuffer;
81
+ /**
82
+ * Calls {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set | TypedArray.set}( {@link value}, {@link offset} )
83
+ * on the {@link BufferAttribute.array | array}.
84
+ * @param value The source `TypedArray`.
85
+ * @param offset index of the {@link BufferAttribute.array | array} at which to start copying. Expects a `Integer`. Default `0`.
86
+ * @throws `RangeError` When {@link offset} is negative or is too large.
87
+ */
88
+ set(value: ArrayLike<number>, offset: number): this;
89
+
90
+ /**
91
+ * Set {@link BufferAttribute.usage | usage}
92
+ * @remarks
93
+ * After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
94
+ * @see {@link https://threejs.org/docs/index.html#api/en/constants/BufferAttributeUsage | Buffer Attribute Usage Constants} for all possible values.
95
+ * @see {@link BufferAttribute.usage | usage}
96
+ * @param value Corresponds to the {@link BufferAttribute.usage | usage} parameter of
97
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData | WebGLRenderingContext.bufferData}.
98
+ */
99
+ setUsage(value: Usage): this;
100
+
101
+ /**
102
+ * Copies another {@link InterleavedBuffer} to this {@link InterleavedBuffer} instance.
103
+ * @param source
104
+ */
39
105
  copy(source: InterleavedBuffer): this;
40
- copyAt(index1: number, attribute: InterleavedBufferAttribute, index2: number): InterleavedBuffer;
41
- set(value: ArrayLike<number>, index: number): InterleavedBuffer;
42
- toJSON(data: object): {
106
+
107
+ /**
108
+ * Copies data from {@link attribute}[{@link index2}] to {@link InterleavedBuffer.array | array}[{@link index1}].
109
+ * @param index1 Expects a `Integer`
110
+ * @param attribute
111
+ * @param index2 Expects a `Integer`
112
+ */
113
+ copyAt(index1: number, attribute: InterleavedBufferAttribute, index2: number): this;
114
+
115
+ /**
116
+ * Creates a clone of this {@link InterleavedBuffer}.
117
+ * @param data This object holds shared array buffers required for properly cloning geometries with interleaved attributes.
118
+ */
119
+ clone(data: {}): InterleavedBuffer;
120
+
121
+ /**
122
+ * Serializes this {@link InterleavedBuffer}.
123
+ * Converting to {@link https://github.com/mrdoob/three.js/wiki/JSON-Geometry-format-4 | JSON Geometry format v4},
124
+ * @param data This object holds shared array buffers required for properly serializing geometries with interleaved attributes.
125
+ */
126
+ toJSON(data: {}): {
43
127
  uuid: string;
44
128
  buffer: string;
45
129
  type: string;
@@ -2,51 +2,190 @@ import { BufferAttribute } from './BufferAttribute';
2
2
  import { InterleavedBuffer } from './InterleavedBuffer';
3
3
  import { Matrix4 } from './../math/Matrix4';
4
4
  import { Matrix } from './../math/Matrix3';
5
+
5
6
  /**
6
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBufferAttribute.js|src/core/InterleavedBufferAttribute.js}
7
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/InterleavedBufferAttribute | Official Documentation}
8
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBufferAttribute.js | Source}
7
9
  */
8
10
  export class InterleavedBufferAttribute {
11
+ /**
12
+ * Create a new instance of {@link THREE.InterleavedBufferAttribute | InterleavedBufferAttribute}.
13
+ * @param interleavedBuffer
14
+ * @param itemSize
15
+ * @param offset
16
+ * @param normalized Default `false`.
17
+ */
9
18
  constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number, normalized?: boolean);
10
19
 
11
20
  /**
12
- * @default ''
21
+ * Optional name for this attribute instance.
22
+ * @defaultValue `''`
13
23
  */
14
24
  name: string;
25
+
26
+ /**
27
+ * The {@link InterleavedBuffer | InterleavedBuffer} instance passed in the constructor.
28
+ */
15
29
  data: InterleavedBuffer;
30
+
31
+ /**
32
+ * How many values make up each item.
33
+ * @remarks Expects a `Integer`
34
+ */
16
35
  itemSize: number;
36
+
37
+ /**
38
+ * The offset in the underlying array buffer where an item starts.
39
+ * @remarks Expects a `Integer`
40
+ */
17
41
  offset: number;
18
42
 
19
43
  /**
20
- * @default false
44
+ * @defaultValue `false`
21
45
  */
22
46
  normalized: boolean;
23
47
 
48
+ /**
49
+ * The value of {@link data | .data}.{@link InterleavedBuffer.count | count}.
50
+ * If the buffer is storing a 3-component item (such as a _position, normal, or color_), then this will count the number of such items stored.
51
+ * @remarks _get-only property_.
52
+ * @remarks Expects a `Integer`
53
+ */
24
54
  get count(): number;
55
+
56
+ /**
57
+ * The value of {@link InterleavedBufferAttribute.data | data}.{@link InterleavedBuffer.array | array}.
58
+ * @remarks _get-only property_.
59
+ */
25
60
  get array(): ArrayLike<number>;
61
+
62
+ /**
63
+ * Flag to indicate that the {@link data | .data} ({@link InterleavedBuffer}) attribute has changed and should be re-sent to the GPU.
64
+ * @remarks Setting this to have the same result of setting true also increments the {@link InterleavedBuffer.needsUpdate | InterleavedBuffer.needsUpdate} of {@link data | .data}.
65
+ * @remarks Setting this to true also increments the {@link InterleavedBuffer.version | InterleavedBuffer.version}.
66
+ * @remarks _set-only property_.
67
+ */
26
68
  set needsUpdate(value: boolean);
27
69
 
70
+ /**
71
+ * Read-only flag to check if a given object is of type {@link InterleavedBufferAttribute}.
72
+ * @remarks This is a _constant_ value
73
+ * @defaultValue `true`
74
+ */
28
75
  readonly isInterleavedBufferAttribute: true;
29
76
 
77
+ /**
78
+ * Applies matrix {@link Matrix4 | m} to every Vector3 element of this InterleavedBufferAttribute.
79
+ * @param m
80
+ */
30
81
  applyMatrix4(m: Matrix4): this;
31
- clone(data?: object): BufferAttribute;
82
+
83
+ /**
84
+ * Applies normal matrix {@link Matrix3 | m} to every Vector3 element of this InterleavedBufferAttribute.
85
+ * @param m
86
+ */
87
+ applyNormalMatrix(matrix: Matrix): this;
88
+
89
+ /**
90
+ * Applies matrix {@link Matrix4 | m} to every Vector3 element of this InterleavedBufferAttribute, interpreting the elements as a direction vectors.
91
+ * @param m
92
+ */
93
+ transformDirection(matrix: Matrix): this;
94
+
95
+ /**
96
+ * Returns the x component of the item at the given index.
97
+ * @param index Expects a `Integer`
98
+ */
32
99
  getX(index: number): number;
100
+
101
+ /**
102
+ * Sets the x component of the item at the given index.
103
+ * @param index Expects a `Integer`
104
+ * @param x Expects a `Float`
105
+ */
33
106
  setX(index: number, x: number): this;
107
+
108
+ /**
109
+ * Returns the y component of the item at the given index.
110
+ * @param index Expects a `Integer`
111
+ */
34
112
  getY(index: number): number;
113
+
114
+ /**
115
+ * Sets the y component of the item at the given index.
116
+ * @param index Expects a `Integer`
117
+ * @param y Expects a `Float`
118
+ */
35
119
  setY(index: number, y: number): this;
120
+
121
+ /**
122
+ * Returns the z component of the item at the given index.
123
+ * @param index Expects a `Integer`
124
+ */
36
125
  getZ(index: number): number;
126
+
127
+ /**
128
+ * Sets the z component of the item at the given index.
129
+ * @param index Expects a `Integer`
130
+ * @param z Expects a `Float`
131
+ */
37
132
  setZ(index: number, z: number): this;
133
+
134
+ /**
135
+ * Returns the w component of the item at the given index.
136
+ * @param index Expects a `Integer`
137
+ */
38
138
  getW(index: number): number;
139
+
140
+ /**
141
+ * Sets the w component of the item at the given index.
142
+ * @param index Expects a `Integer`
143
+ * @param w Expects a `Float`
144
+ */
39
145
  setW(index: number, z: number): this;
146
+
147
+ /**
148
+ * Sets the x and y components of the item at the given index.
149
+ * @param index Expects a `Integer`
150
+ * @param x Expects a `Float`
151
+ * @param y Expects a `Float`
152
+ */
40
153
  setXY(index: number, x: number, y: number): this;
154
+ /**
155
+ * Sets the x, y and z components of the item at the given index.
156
+ * @param index Expects a `Integer`
157
+ * @param x Expects a `Float`
158
+ * @param y Expects a `Float`
159
+ * @param z Expects a `Float`
160
+ */
41
161
  setXYZ(index: number, x: number, y: number, z: number): this;
162
+
163
+ /**
164
+ * Sets the x, y, z and w components of the item at the given index.
165
+ * @param index Expects a `Integer`
166
+ * @param x Expects a `Float`
167
+ * @param y Expects a `Float`
168
+ * @param z Expects a `Float`
169
+ * @param w Expects a `Float`
170
+ */
42
171
  setXYZW(index: number, x: number, y: number, z: number, w: number): this;
43
- toJSON(data?: object): {
172
+
173
+ /**
174
+ * Creates a clone of this {@link InterleavedBufferAttribute}.
175
+ * @param data This object holds shared array buffers required for properly cloning geometries with interleaved attributes.
176
+ */
177
+ clone(data?: {}): BufferAttribute;
178
+
179
+ /**
180
+ * Serializes this {@link InterleavedBufferAttribute}.
181
+ * Converting to {@link https://github.com/mrdoob/three.js/wiki/JSON-Geometry-format-4 | JSON Geometry format v4},
182
+ * @param data This object holds shared array buffers required for properly serializing geometries with interleaved attributes.
183
+ */
184
+ toJSON(data?: {}): {
44
185
  isInterleavedBufferAttribute: true;
45
186
  itemSize: number;
46
187
  data: string;
47
188
  offset: number;
48
189
  normalized: boolean;
49
190
  };
50
- applyNormalMatrix(matrix: Matrix): this;
51
- transformDirection(matrix: Matrix): this;
52
191
  }
@@ -1,17 +1,72 @@
1
+ /**
2
+ * A {@link THREE.Layers | Layers} object assigns an {@link THREE.Object3D | Object3D} to 1 or more of 32 layers numbered `0` to `31` - internally the
3
+ * layers are stored as a {@link https://en.wikipedia.org/wiki/Mask_(computing) | bit mask}, and
4
+ * by default all Object3Ds are a member of layer `0`.
5
+ * @remarks
6
+ * This can be used to control visibility - an object must share a layer with a {@link Camera | camera} to be visible when that camera's view is rendered.
7
+ * @remarks
8
+ * All classes that inherit from {@link THREE.Object3D | Object3D} have an {@link THREE.Object3D.layers | Object3D.layers} property which is an instance of this class.
9
+ * @see Example: {@link https://threejs.org/examples/#webgl_layers | WebGL / layers}
10
+ * @see Example: {@link https://threejs.org/examples/#webxr_vr_layers | Webxr / vr / layers}
11
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/Layers | Official Documentation}
12
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Layers.js | Source}
13
+ */
1
14
  export class Layers {
15
+ /**
16
+ * Create a new Layers object, with membership initially set to layer 0.
17
+ */
2
18
  constructor();
3
19
 
4
20
  /**
5
- * @default 1 | 0
21
+ * A bit mask storing which of the 32 layers this layers object is currently a member of.
22
+ * @defaultValue `1 | 0`
23
+ * @remarks Expects a `Integer`
6
24
  */
7
25
  mask: number;
8
26
 
9
- set(channel: number): void;
10
- enable(channel: number): void;
27
+ /**
28
+ * Set membership to `layer`, and remove membership all other layers.
29
+ * @param layer An integer from 0 to 31.
30
+ */
31
+ set(layer: number): void;
32
+
33
+ /**
34
+ * Add membership of this `layer`.
35
+ * @param layer An integer from 0 to 31.
36
+ */
37
+ enable(layer: number): void;
38
+
39
+ /**
40
+ * Add membership to all layers.
41
+ */
11
42
  enableAll(): void;
12
- toggle(channel: number): void;
13
- disable(channel: number): void;
43
+
44
+ /**
45
+ * Toggle membership of `layer`.
46
+ * @param layer An integer from 0 to 31.
47
+ */
48
+ toggle(layer: number): void;
49
+
50
+ /**
51
+ * Remove membership of this `layer`.
52
+ * @param layer An integer from 0 to 31.
53
+ */
54
+ disable(layer: number): void;
55
+
56
+ /**
57
+ * Remove membership from all layers.
58
+ */
14
59
  disableAll(): void;
60
+
61
+ /**
62
+ * Returns true if this and the passed `layers` object have at least one layer in common.
63
+ * @param layers A Layers object
64
+ */
15
65
  test(layers: Layers): boolean;
16
- isEnabled(channel: number): boolean;
66
+
67
+ /**
68
+ * Returns true if the given layer is enabled.
69
+ * @param layer An integer from 0 to 31.
70
+ */
71
+ isEnabled(layer: number): boolean;
17
72
  }