@types/three 0.149.0 → 0.150.1
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.
- three/README.md +2 -2
- three/build/three.d.cts +2 -0
- three/build/three.d.ts +2 -0
- three/build/three.module.d.ts +2 -0
- three/examples/jsm/controls/OrbitControls.d.ts +5 -0
- three/examples/jsm/controls/TransformControls.d.ts +1 -5
- three/examples/jsm/geometries/TextGeometry.d.ts +92 -15
- three/examples/jsm/helpers/OctreeHelper.d.ts +1 -1
- three/examples/jsm/libs/fflate.module.d.ts +1 -0
- three/examples/jsm/libs/lil-gui.module.min.d.ts +1 -0
- three/examples/jsm/libs/stats.module.d.ts +2 -23
- three/examples/jsm/loaders/EXRLoader.d.ts +3 -2
- three/examples/jsm/misc/GPUComputationRenderer.d.ts +4 -2
- three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +3 -4
- three/examples/jsm/objects/MarchingCubes.d.ts +1 -0
- three/examples/jsm/shaders/VelocityShader.d.ts +2 -2
- three/index.d.ts +1 -1
- three/package.json +19 -4
- three/src/Three.d.ts +0 -1
- three/src/audio/Audio.d.ts +184 -20
- three/src/audio/AudioAnalyser.d.ts +42 -4
- three/src/audio/AudioContext.d.ts +12 -1
- three/src/audio/AudioListener.d.ts +76 -8
- three/src/audio/PositionalAudio.d.ts +86 -5
- three/src/cameras/ArrayCamera.d.ts +23 -2
- three/src/cameras/Camera.d.ts +42 -13
- three/src/cameras/CubeCamera.d.ts +49 -1
- three/src/cameras/OrthographicCamera.d.ts +77 -25
- three/src/cameras/PerspectiveCamera.d.ts +132 -56
- three/src/cameras/StereoCamera.d.ts +29 -2
- three/src/constants.d.ts +790 -245
- three/src/core/BufferAttribute.d.ts +456 -85
- three/src/core/BufferGeometry.d.ts +237 -67
- three/src/core/Clock.d.ts +28 -20
- three/src/core/EventDispatcher.d.ts +20 -4
- three/src/core/GLBufferAttribute.d.ts +102 -8
- three/src/core/InstancedBufferAttribute.d.ts +13 -24
- three/src/core/InstancedBufferGeometry.d.ts +22 -4
- three/src/core/InstancedInterleavedBuffer.d.ts +10 -2
- three/src/core/InterleavedBuffer.d.ts +98 -14
- three/src/core/InterleavedBufferAttribute.d.ts +146 -7
- three/src/core/Layers.d.ts +61 -6
- three/src/core/Object3D.d.ts +244 -123
- three/src/core/Raycaster.d.ts +104 -27
- three/src/core/Uniform.d.ts +28 -11
- three/src/core/UniformsGroup.d.ts +10 -4
- three/src/extras/Earcut.d.ts +3 -4
- three/src/geometries/BoxGeometry.d.ts +39 -16
- three/src/geometries/CapsuleGeometry.d.ts +35 -12
- three/src/geometries/CircleGeometry.d.ts +38 -12
- three/src/geometries/ConeGeometry.d.ts +45 -10
- three/src/geometries/CylinderGeometry.d.ts +41 -19
- three/src/geometries/DodecahedronGeometry.d.ts +14 -5
- three/src/geometries/EdgesGeometry.d.ts +30 -8
- three/src/geometries/ExtrudeGeometry.d.ts +93 -12
- three/src/geometries/IcosahedronGeometry.d.ts +15 -5
- three/src/geometries/LatheGeometry.d.ts +41 -12
- three/src/geometries/OctahedronGeometry.d.ts +14 -5
- three/src/geometries/PlaneGeometry.d.ts +35 -12
- three/src/geometries/PolyhedronGeometry.d.ts +41 -12
- three/src/geometries/RingGeometry.d.ts +39 -16
- three/src/geometries/ShapeGeometry.d.ts +44 -4
- three/src/geometries/SphereGeometry.d.ts +43 -21
- three/src/geometries/TetrahedronGeometry.d.ts +14 -5
- three/src/geometries/TorusGeometry.d.ts +35 -13
- three/src/geometries/TorusKnotGeometry.d.ts +39 -16
- three/src/geometries/TubeGeometry.d.ts +63 -15
- three/src/geometries/WireframeGeometry.d.ts +30 -4
- three/src/materials/MeshPhysicalMaterial.d.ts +13 -1
- three/src/math/Color.d.ts +157 -3
- three/src/math/ColorManagement.d.ts +13 -7
- three/src/objects/Bone.d.ts +30 -3
- three/src/objects/Group.d.ts +37 -1
- three/src/objects/InstancedMesh.d.ts +122 -3
- three/src/objects/LOD.d.ts +62 -18
- three/src/objects/Line.d.ts +67 -4
- three/src/objects/LineLoop.d.ts +26 -1
- three/src/objects/LineSegments.d.ts +21 -9
- three/src/objects/Mesh.d.ts +60 -4
- three/src/objects/Points.d.ts +39 -8
- three/src/objects/Skeleton.d.ts +89 -3
- three/src/objects/SkinnedMesh.d.ts +122 -3
- three/src/objects/Sprite.d.ts +51 -4
- three/src/renderers/WebGLRenderTarget.d.ts +9 -3
- three/src/renderers/WebGLRenderer.d.ts +2 -2
- three/src/scenes/Fog.d.ts +59 -7
- three/src/scenes/FogExp2.d.ts +41 -6
- three/src/scenes/Scene.d.ts +45 -22
- three/src/textures/CanvasTexture.d.ts +35 -13
- three/src/textures/CompressedArrayTexture.d.ts +39 -5
- three/src/textures/CompressedTexture.d.ts +49 -20
- three/src/textures/CubeTexture.d.ts +71 -18
- three/src/textures/Data3DTexture.d.ts +74 -10
- three/src/textures/DataArrayTexture.d.ts +83 -9
- three/src/textures/DataTexture.d.ts +81 -26
- three/src/textures/DepthTexture.d.ts +71 -15
- three/src/textures/FramebufferTexture.d.ts +57 -2
- three/src/textures/Source.d.ts +23 -13
- three/src/textures/Texture.d.ts +289 -73
- three/src/textures/VideoTexture.d.ts +69 -13
- three/src/textures/types.d.ts +9 -0
- three/src/utils.d.ts +5 -2
- three/examples/jsm/libs/fflate.module.min.d.ts +0 -1185
|
@@ -9,190 +9,360 @@ import { Vector2 } from './../math/Vector2';
|
|
|
9
9
|
import { Vector3 } from './../math/Vector3';
|
|
10
10
|
import { EventDispatcher } from './EventDispatcher';
|
|
11
11
|
import { BuiltinShaderAttributeName } from '../constants';
|
|
12
|
+
import * as BufferGeometryUtils from '../../examples/jsm/utils/BufferGeometryUtils';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* A representation of mesh, line, or point geometry
|
|
16
|
+
* Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU.
|
|
17
|
+
* @remarks
|
|
18
|
+
* To read and edit data in BufferGeometry attributes, see {@link THREE.BufferAttribute | BufferAttribute} documentation.
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const geometry = new THREE.BufferGeometry();
|
|
22
|
+
* // create a simple square shape. We duplicate the top left and bottom right
|
|
23
|
+
* // vertices because each vertex needs to appear once per triangle.
|
|
24
|
+
* const vertices = new Float32Array([
|
|
25
|
+
* -1.0, -1.0, 1.0,
|
|
26
|
+
* 1.0, -1.0, 1.0,
|
|
27
|
+
* 1.0, 1.0, 1.0,
|
|
17
28
|
*
|
|
18
|
-
*
|
|
29
|
+
* 1.0, 1.0, 1.0,
|
|
30
|
+
* -1.0, 1.0, 1.0,
|
|
31
|
+
* -1.0, -1.0, 1.0]);
|
|
32
|
+
* // itemSize = 3 because there are 3 values (components) per vertex
|
|
33
|
+
* geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
|
34
|
+
* const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
|
|
35
|
+
* const mesh = new THREE.Mesh(geometry, material);
|
|
36
|
+
* ```
|
|
37
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry | Mesh with non-indexed faces}
|
|
38
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_indexed | Mesh with indexed faces}
|
|
39
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_lines | Lines}
|
|
40
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_lines_indexed | Indexed Lines}
|
|
41
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_custom_attributes_particles | Particles}
|
|
42
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_rawshader | Raw Shaders}
|
|
43
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/core/BufferGeometry | Official Documentation}
|
|
44
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js | Source}
|
|
19
45
|
*/
|
|
20
46
|
export class BufferGeometry extends EventDispatcher {
|
|
21
47
|
/**
|
|
22
|
-
* This creates a new BufferGeometry
|
|
48
|
+
* This creates a new {@link THREE.BufferGeometry | BufferGeometry} object.
|
|
23
49
|
*/
|
|
24
50
|
constructor();
|
|
25
51
|
|
|
26
52
|
/**
|
|
27
|
-
* Unique number
|
|
53
|
+
* Unique number for this {@link THREE.BufferGeometry | BufferGeometry} instance.
|
|
54
|
+
* @remarks Expects a `Integer`
|
|
28
55
|
*/
|
|
29
56
|
id: number;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
|
|
60
|
+
* @remarks This gets automatically assigned and shouldn't be edited.
|
|
61
|
+
*/
|
|
30
62
|
uuid: string;
|
|
31
63
|
|
|
32
64
|
/**
|
|
33
|
-
* @
|
|
65
|
+
* Optional name for this {@link THREE.BufferGeometry | BufferGeometry} instance.
|
|
66
|
+
* @defaultValue `''`
|
|
34
67
|
*/
|
|
35
68
|
name: string;
|
|
36
69
|
|
|
37
70
|
/**
|
|
38
|
-
*
|
|
71
|
+
* A Read-only _string_ to check if `this` object type.
|
|
72
|
+
* @remarks Sub-classes will update this value.
|
|
73
|
+
* @defaultValue `BufferGeometry`
|
|
39
74
|
*/
|
|
40
|
-
type: string;
|
|
75
|
+
readonly type: string | 'BufferGeometry';
|
|
41
76
|
|
|
42
77
|
/**
|
|
43
|
-
*
|
|
78
|
+
* Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles".
|
|
79
|
+
* Each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face.
|
|
80
|
+
* If this attribute is not set, the {@link THREE.WebGLRenderer | renderer} assumes that each three contiguous positions represent a single triangle.
|
|
81
|
+
* @defaultValue `null`
|
|
44
82
|
*/
|
|
45
83
|
index: BufferAttribute | null;
|
|
46
84
|
|
|
47
85
|
/**
|
|
48
|
-
* @
|
|
86
|
+
* This hashmap has as id the name of the attribute to be set and as value the {@link THREE.BufferAttribute | buffer} to set it to. Rather than accessing this property directly,
|
|
87
|
+
* use {@link setAttribute | .setAttribute} and {@link getAttribute | .getAttribute} to access attributes of this geometry.
|
|
88
|
+
* @defaultValue `{}`
|
|
49
89
|
*/
|
|
50
90
|
attributes: {
|
|
51
|
-
[name: string]: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute;
|
|
91
|
+
[name: string]: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute; // TODO Replace for 'Record<>'
|
|
52
92
|
};
|
|
53
93
|
|
|
54
94
|
/**
|
|
55
|
-
* @
|
|
95
|
+
* Hashmap of {@link THREE.BufferAttribute | BufferAttributes} holding details of the geometry's morph targets.
|
|
96
|
+
* @remarks
|
|
97
|
+
* Once the geometry has been rendered, the morph attribute data cannot be changed.
|
|
98
|
+
* You will have to call {@link dispose | .dispose}(), and create a new instance of {@link THREE.BufferGeometry | BufferGeometry}.
|
|
99
|
+
* @defaultValue `{}`
|
|
56
100
|
*/
|
|
57
101
|
morphAttributes: {
|
|
58
|
-
[name: string]: Array<BufferAttribute | InterleavedBufferAttribute>;
|
|
102
|
+
[name: string]: Array<BufferAttribute | InterleavedBufferAttribute>; // TODO Replace for 'Record<>'
|
|
59
103
|
};
|
|
60
104
|
|
|
61
105
|
/**
|
|
62
|
-
*
|
|
106
|
+
* Used to control the morph target behavior; when set to true, the morph target data is treated as relative offsets, rather than as absolute positions/normals.
|
|
107
|
+
* @defaultValue `false`
|
|
63
108
|
*/
|
|
64
109
|
morphTargetsRelative: boolean;
|
|
65
110
|
|
|
66
111
|
/**
|
|
67
|
-
*
|
|
112
|
+
* Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. This allows an array of materials to be used with the geometry.
|
|
113
|
+
* @remarks Every vertex and index must belong to exactly one group — groups must not share vertices or indices, and must not leave vertices or indices unused.
|
|
114
|
+
* @remarks Use {@link addGroup | .addGroup} to add groups, rather than modifying this array directly.
|
|
115
|
+
* @defaultValue `[]`
|
|
68
116
|
*/
|
|
69
|
-
groups: Array<{
|
|
117
|
+
groups: Array<{
|
|
118
|
+
/**
|
|
119
|
+
* Specifies the first element in this draw call – the first vertex for non-indexed geometry, otherwise the first triangle index.
|
|
120
|
+
* @remarks Expects a `Integer`
|
|
121
|
+
*/
|
|
122
|
+
start: number;
|
|
123
|
+
/**
|
|
124
|
+
* Specifies how many vertices (or indices) are included.
|
|
125
|
+
* @remarks Expects a `Integer`
|
|
126
|
+
*/
|
|
127
|
+
count: number;
|
|
128
|
+
/**
|
|
129
|
+
* Specifies the material array index to use.
|
|
130
|
+
* @remarks Expects a `Integer`
|
|
131
|
+
*/
|
|
132
|
+
materialIndex?: number | undefined;
|
|
133
|
+
}>;
|
|
70
134
|
|
|
71
135
|
/**
|
|
72
|
-
* @
|
|
136
|
+
* Bounding box for the {@link THREE.BufferGeometry | BufferGeometry}, which can be calculated with {@link computeBoundingBox | .computeBoundingBox()}.
|
|
137
|
+
* @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
138
|
+
* @defaultValue `null`
|
|
73
139
|
*/
|
|
74
140
|
boundingBox: Box3 | null;
|
|
75
141
|
|
|
76
142
|
/**
|
|
77
|
-
* @
|
|
143
|
+
* Bounding sphere for the {@link THREE.BufferGeometry | BufferGeometry}, which can be calculated with {@link computeBoundingSphere | .computeBoundingSphere()}.
|
|
144
|
+
* @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
145
|
+
* @defaultValue `null`
|
|
78
146
|
*/
|
|
79
147
|
boundingSphere: Sphere | null;
|
|
80
148
|
|
|
81
149
|
/**
|
|
82
|
-
*
|
|
150
|
+
* Determines the part of the geometry to render. This should not be set directly, instead use {@link setDrawRange | .setDrawRange(...)}.
|
|
151
|
+
* @remarks For non-indexed {@link THREE.BufferGeometry | BufferGeometry}, count is the number of vertices to render.
|
|
152
|
+
* @remarks For indexed {@link THREE.BufferGeometry | BufferGeometry}, count is the number of indices to render.
|
|
153
|
+
* @defaultValue `{ start: 0, count: Infinity }`
|
|
83
154
|
*/
|
|
84
155
|
drawRange: { start: number; count: number };
|
|
85
156
|
|
|
86
157
|
/**
|
|
87
|
-
*
|
|
158
|
+
* An object that can be used to store custom data about the BufferGeometry. It should not hold references to functions as these will not be cloned.
|
|
159
|
+
* @defaultValue `{}`
|
|
88
160
|
*/
|
|
89
161
|
userData: { [key: string]: any };
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Read-only flag to check if a given object is of type {@link BufferGeometry}.
|
|
165
|
+
* @remarks This is a _constant_ value
|
|
166
|
+
* @defaultValue `true`
|
|
167
|
+
*/
|
|
90
168
|
readonly isBufferGeometry: true;
|
|
91
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Return the {@link index | .index} buffer.
|
|
172
|
+
*/
|
|
92
173
|
getIndex(): BufferAttribute | null;
|
|
93
|
-
setIndex(index: BufferAttribute | number[] | null): BufferGeometry;
|
|
94
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Set the {@link THREE.BufferGeometry.index | .index} buffer.
|
|
177
|
+
* @param index
|
|
178
|
+
*/
|
|
179
|
+
setIndex(index: BufferAttribute | number[] | null): this;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Sets an {@link attributes | attribute} to this geometry with the specified name.
|
|
183
|
+
* @remarks
|
|
184
|
+
* Use this rather than the attributes property, because an internal hashmap of {@link attributes | .attributes} is maintained to speed up iterating over attributes.
|
|
185
|
+
* @param name
|
|
186
|
+
* @param attribute
|
|
187
|
+
*/
|
|
95
188
|
setAttribute(
|
|
96
189
|
name: BuiltinShaderAttributeName | (string & {}),
|
|
97
190
|
attribute: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute,
|
|
98
|
-
):
|
|
191
|
+
): this;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Returns the {@link attributes | attribute} with the specified name.
|
|
195
|
+
* @param name
|
|
196
|
+
*/
|
|
99
197
|
getAttribute(
|
|
100
198
|
name: BuiltinShaderAttributeName | (string & {}),
|
|
101
199
|
): BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Deletes the {@link attributes | attribute} with the specified name.
|
|
203
|
+
* @param name
|
|
204
|
+
*/
|
|
102
205
|
deleteAttribute(name: BuiltinShaderAttributeName | (string & {})): BufferGeometry;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Returns true if the {@link attributes | attribute} with the specified name exists.
|
|
209
|
+
* @param name
|
|
210
|
+
*/
|
|
103
211
|
hasAttribute(name: BuiltinShaderAttributeName | (string & {})): boolean;
|
|
104
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Adds a group to this geometry
|
|
215
|
+
* @see the {@link BufferGeometry.groups | groups} property for details.
|
|
216
|
+
* @param start
|
|
217
|
+
* @param count
|
|
218
|
+
* @param materialIndex
|
|
219
|
+
*/
|
|
105
220
|
addGroup(start: number, count: number, materialIndex?: number): void;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Clears all groups.
|
|
224
|
+
*/
|
|
106
225
|
clearGroups(): void;
|
|
107
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Set the {@link drawRange | .drawRange} property
|
|
229
|
+
* @remarks For non-indexed BufferGeometry, count is the number of vertices to render
|
|
230
|
+
* @remarks For indexed BufferGeometry, count is the number of indices to render.
|
|
231
|
+
* @param start
|
|
232
|
+
* @param count is the number of vertices or indices to render. Expects a `Integer`
|
|
233
|
+
*/
|
|
108
234
|
setDrawRange(start: number, count: number): void;
|
|
109
235
|
|
|
110
236
|
/**
|
|
111
|
-
*
|
|
237
|
+
* Applies the matrix transform to the geometry.
|
|
238
|
+
* @param matrix
|
|
239
|
+
*/
|
|
240
|
+
applyMatrix4(matrix: Matrix4): this;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Applies the rotation represented by the quaternion to the geometry.
|
|
244
|
+
* @param quaternion
|
|
112
245
|
*/
|
|
113
|
-
|
|
114
|
-
applyQuaternion(q: Quaternion): BufferGeometry;
|
|
246
|
+
applyQuaternion(quaternion: Quaternion): this;
|
|
115
247
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop.
|
|
250
|
+
* @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
|
|
251
|
+
* @param angle radians. Expects a `Float`
|
|
252
|
+
*/
|
|
253
|
+
rotateX(angle: number): this;
|
|
122
254
|
|
|
123
|
-
|
|
255
|
+
/**
|
|
256
|
+
* Rotate the geometry about the Y axis.
|
|
257
|
+
* @remarks This is typically done as a one time operation, and not during a loop.
|
|
258
|
+
* @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
|
|
259
|
+
* @param angle radians. Expects a `Float`
|
|
260
|
+
*/
|
|
261
|
+
rotateY(angle: number): this;
|
|
124
262
|
|
|
125
|
-
|
|
263
|
+
/**
|
|
264
|
+
* Rotate the geometry about the Z axis.
|
|
265
|
+
* @remarks This is typically done as a one time operation, and not during a loop.
|
|
266
|
+
* @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
|
|
267
|
+
* @param angle radians. Expects a `Float`
|
|
268
|
+
*/
|
|
269
|
+
rotateZ(angle: number): this;
|
|
126
270
|
|
|
127
271
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
272
|
+
* Translate the geometry.
|
|
273
|
+
* @remarks This is typically done as a one time operation, and not during a loop.
|
|
274
|
+
* @remarks Use {@link THREE.Object3D.position | Object3D.position} for typical real-time mesh rotation.
|
|
275
|
+
* @param x Expects a `Float`
|
|
276
|
+
* @param y Expects a `Float`
|
|
277
|
+
* @param z Expects a `Float`
|
|
130
278
|
*/
|
|
131
|
-
|
|
279
|
+
translate(x: number, y: number, z: number): this;
|
|
132
280
|
|
|
133
281
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
282
|
+
* Scale the geometry data.
|
|
283
|
+
* @remarks This is typically done as a one time operation, and not during a loop.
|
|
284
|
+
* @remarks Use {@link THREE.Object3D.scale | Object3D.scale} for typical real-time mesh scaling.
|
|
285
|
+
* @param x Expects a `Float`
|
|
286
|
+
* @param y Expects a `Float`
|
|
287
|
+
* @param z Expects a `Float`
|
|
136
288
|
*/
|
|
137
|
-
|
|
289
|
+
scale(x: number, y: number, z: number): this;
|
|
138
290
|
|
|
139
291
|
/**
|
|
140
|
-
*
|
|
292
|
+
* Rotates the geometry to face a point in space.
|
|
293
|
+
* @remarks This is typically done as a one time operation, and not during a loop.
|
|
294
|
+
* @remarks Use {@link THREE.Object3D.lookAt | Object3D.lookAt} for typical real-time mesh usage.
|
|
295
|
+
* @param vector A world vector to look at.
|
|
141
296
|
*/
|
|
142
|
-
|
|
297
|
+
lookAt(vector: Vector3): this;
|
|
143
298
|
|
|
144
299
|
/**
|
|
145
|
-
*
|
|
300
|
+
* Center the geometry based on the bounding box.
|
|
146
301
|
*/
|
|
147
|
-
|
|
302
|
+
center(): this;
|
|
148
303
|
|
|
149
|
-
|
|
304
|
+
/**
|
|
305
|
+
* Sets the attributes for this BufferGeometry from an array of points.
|
|
306
|
+
* @param points
|
|
307
|
+
*/
|
|
308
|
+
setFromPoints(points: Vector3[] | Vector2[]): this;
|
|
150
309
|
|
|
151
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Computes bounding box of the geometry, updating {@link boundingBox | .boundingBox} attribute.
|
|
312
|
+
* @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
313
|
+
*/
|
|
314
|
+
computeBoundingBox(): void;
|
|
152
315
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Computes bounding sphere of the geometry, updating {@link boundingSphere | .boundingSphere} attribute.
|
|
318
|
+
* @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
319
|
+
*/
|
|
320
|
+
computeBoundingSphere(): void;
|
|
156
321
|
|
|
157
322
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
323
|
+
* Calculates and adds a tangent attribute to this geometry.
|
|
324
|
+
* The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined
|
|
325
|
+
* @remarks
|
|
326
|
+
* When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
|
|
327
|
+
* {@link BufferGeometryUtils.computeMikkTSpaceTangents} instead.
|
|
160
328
|
*/
|
|
161
|
-
|
|
329
|
+
computeTangents(): void;
|
|
162
330
|
|
|
163
331
|
/**
|
|
164
|
-
*
|
|
332
|
+
* Computes vertex normals by averaging face normals.
|
|
165
333
|
*/
|
|
166
|
-
|
|
334
|
+
computeVertexNormals(): void;
|
|
167
335
|
|
|
168
336
|
/**
|
|
169
|
-
*
|
|
337
|
+
* Every normal vector in a geometry will have a magnitude of 1
|
|
338
|
+
* @remarks This will correct lighting on the geometry surfaces.
|
|
170
339
|
*/
|
|
171
|
-
|
|
340
|
+
normalizeNormals(): void;
|
|
172
341
|
|
|
173
342
|
/**
|
|
174
|
-
*
|
|
343
|
+
* Return a non-index version of an indexed BufferGeometry.
|
|
175
344
|
*/
|
|
176
|
-
|
|
345
|
+
toNonIndexed(): BufferGeometry;
|
|
177
346
|
|
|
178
347
|
/**
|
|
179
|
-
*
|
|
348
|
+
* Convert the buffer geometry to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
|
|
180
349
|
*/
|
|
181
|
-
|
|
350
|
+
toJSON(): {};
|
|
182
351
|
|
|
183
352
|
/**
|
|
184
|
-
*
|
|
353
|
+
* Creates a clone of this BufferGeometry
|
|
185
354
|
*/
|
|
186
|
-
|
|
355
|
+
clone(): this;
|
|
187
356
|
|
|
188
357
|
/**
|
|
189
|
-
*
|
|
358
|
+
* Copies another BufferGeometry to this BufferGeometry.
|
|
359
|
+
* @param source
|
|
190
360
|
*/
|
|
191
|
-
|
|
192
|
-
addAttribute(name: any, array: any, itemSize: any): any;
|
|
361
|
+
copy(source: BufferGeometry): this;
|
|
193
362
|
|
|
194
363
|
/**
|
|
195
|
-
*
|
|
364
|
+
* Frees the GPU-related resources allocated by this instance.
|
|
365
|
+
* @remarks Call this method whenever this instance is no longer used in your app.
|
|
196
366
|
*/
|
|
197
|
-
|
|
367
|
+
dispose(): void;
|
|
198
368
|
}
|
three/src/core/Clock.d.ts
CHANGED
|
@@ -1,64 +1,72 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Object for keeping track of time
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Object for keeping track of time
|
|
3
|
+
* @remarks
|
|
4
|
+
* This uses {@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now | performance.now} if it is available,
|
|
5
|
+
* otherwise it reverts to the less accurate {@link https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/now | Date.now}.
|
|
6
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/core/Clock | Official Documentation}
|
|
7
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js | Source}
|
|
5
8
|
*/
|
|
6
9
|
export class Clock {
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
11
|
+
* Create a new instance of {@link THREE.Clock | Clock}
|
|
12
|
+
* @param autoStart - Whether to automatically start the clock when {@link getDelta | .getDelta()} is called for the first time. Default `true`
|
|
9
13
|
*/
|
|
10
14
|
constructor(autoStart?: boolean);
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
|
-
* If set, starts the clock automatically when
|
|
14
|
-
* @
|
|
17
|
+
* If set, starts the clock automatically when {@link getDelta | .getDelta()} is called for the first time.
|
|
18
|
+
* @defaultValue `true`
|
|
15
19
|
*/
|
|
16
20
|
autoStart: boolean;
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @default 0
|
|
23
|
+
* Holds the time at which the clock's {@link start | .start()} method was last called.
|
|
24
|
+
* @defaultValue `0`
|
|
22
25
|
*/
|
|
23
26
|
startTime: number;
|
|
24
27
|
|
|
25
28
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @default 0
|
|
29
|
+
* Holds the time at which the clock's {@link start | .start()}, {@link getElapsedTime | .getElapsedTime()} or {@link getDelta | .getDelta()} methods were last called.
|
|
30
|
+
* @defaultValue `0`
|
|
29
31
|
*/
|
|
30
32
|
oldTime: number;
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @default 0
|
|
35
|
+
* Keeps track of the total time that the clock has been running.
|
|
36
|
+
* @defaultValue `0`
|
|
36
37
|
*/
|
|
37
38
|
elapsedTime: number;
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
41
|
+
* Whether the clock is running or not.
|
|
42
|
+
* @defaultValue `false`
|
|
42
43
|
*/
|
|
43
44
|
running: boolean;
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* Starts clock.
|
|
48
|
+
* @remarks
|
|
49
|
+
* Also sets the {@link startTime | .startTime} and {@link oldTime | .oldTime} to the current time,
|
|
50
|
+
* sets {@link elapsedTime | .elapsedTime} to `0` and {@link running | .running} to `true`.
|
|
47
51
|
*/
|
|
48
52
|
start(): void;
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
|
-
* Stops clock.
|
|
55
|
+
* Stops clock and sets {@link oldTime | oldTime} to the current time.
|
|
52
56
|
*/
|
|
53
57
|
stop(): void;
|
|
54
58
|
|
|
55
59
|
/**
|
|
56
|
-
* Get the seconds passed since the clock started.
|
|
60
|
+
* Get the seconds passed since the clock started and sets {@link oldTime | .oldTime} to the current time.
|
|
61
|
+
* @remarks
|
|
62
|
+
* If {@link autoStart | .autoStart} is `true` and the clock is not running, also starts the clock.
|
|
57
63
|
*/
|
|
58
64
|
getElapsedTime(): number;
|
|
59
65
|
|
|
60
66
|
/**
|
|
61
|
-
* Get the seconds passed since the
|
|
67
|
+
* Get the seconds passed since the time {@link oldTime | .oldTime} was set and sets {@link oldTime | .oldTime} to the current time.
|
|
68
|
+
* @remarks
|
|
69
|
+
* If {@link autoStart | .autoStart} is `true` and the clock is not running, also starts the clock.
|
|
62
70
|
*/
|
|
63
71
|
getDelta(): number;
|
|
64
72
|
}
|
|
@@ -13,12 +13,28 @@ export type EventListener<E, T, U> = (event: E & { type: T } & { target: U }) =>
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* JavaScript events for custom objects
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Adding events to a custom object
|
|
19
|
+
* class Car extends EventDispatcher {
|
|
20
|
+
* start() {
|
|
21
|
+
* this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
|
|
22
|
+
* }
|
|
23
|
+
* };
|
|
24
|
+
* // Using events with the custom object
|
|
25
|
+
* const car = new Car();
|
|
26
|
+
* car.addEventListener( 'start', ( event ) => {
|
|
27
|
+
* alert( event.message );
|
|
28
|
+
* } );
|
|
29
|
+
* car.start();
|
|
30
|
+
* ```
|
|
31
|
+
* @see {@link https://github.com/mrdoob/eventdispatcher.js | mrdoob EventDispatcher on GitHub}
|
|
32
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/core/EventDispatcher | Official Documentation}
|
|
33
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/EventDispatcher.js | Source}
|
|
18
34
|
*/
|
|
19
35
|
export class EventDispatcher<E extends BaseEvent = Event> {
|
|
20
36
|
/**
|
|
21
|
-
* Creates
|
|
37
|
+
* Creates {@link THREE.EventDispatcher | EventDispatcher} object.
|
|
22
38
|
*/
|
|
23
39
|
constructor();
|
|
24
40
|
|
|
@@ -45,7 +61,7 @@ export class EventDispatcher<E extends BaseEvent = Event> {
|
|
|
45
61
|
|
|
46
62
|
/**
|
|
47
63
|
* Fire an event type.
|
|
48
|
-
* @param
|
|
64
|
+
* @param event The event that gets fired.
|
|
49
65
|
*/
|
|
50
66
|
dispatchEvent(event: E): void;
|
|
51
67
|
}
|