@types/three 0.148.1 → 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.
- 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 +8 -3
- three/examples/jsm/controls/TrackballControls.d.ts +2 -2
- three/examples/jsm/controls/TransformControls.d.ts +4 -4
- three/examples/jsm/helpers/OctreeHelper.d.ts +1 -1
- three/examples/jsm/helpers/ViewHelper.d.ts +16 -0
- 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/HDRCubeTextureLoader.d.ts +1 -1
- three/examples/jsm/loaders/IFCLoader.d.ts +1 -0
- three/examples/jsm/loaders/USDZLoader.d.ts +1 -0
- three/examples/jsm/loaders/VOXLoader.d.ts +1 -1
- three/examples/jsm/nodes/loaders/NodeLoader.d.ts +1 -0
- 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 +1 -5
- three/src/constants.d.ts +395 -253
- three/src/core/BufferAttribute.d.ts +456 -85
- three/src/core/BufferGeometry.d.ts +241 -70
- three/src/core/Clock.d.ts +28 -20
- three/src/core/EventDispatcher.d.ts +20 -4
- three/src/core/GLBufferAttribute.d.ts +105 -7
- 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 +252 -119
- three/src/core/Raycaster.d.ts +103 -27
- three/src/core/Uniform.d.ts +30 -13
- three/src/core/UniformsGroup.d.ts +10 -4
- three/src/extras/Earcut.d.ts +3 -4
- three/src/helpers/CameraHelper.d.ts +43 -0
- three/src/lights/DirectionalLight.d.ts +3 -1
- three/src/lights/HemisphereLight.d.ts +3 -1
- three/src/lights/SpotLight.d.ts +3 -1
- three/src/loaders/CubeTextureLoader.d.ts +1 -1
- three/src/loaders/Loader.d.ts +1 -2
- three/src/materials/Material.d.ts +9 -2
- 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/math/Euler.d.ts +2 -3
- three/src/objects/Mesh.d.ts +2 -2
- three/src/renderers/WebGLRenderer.d.ts +2 -2
- three/src/renderers/webgl/WebGLAttributes.d.ts +4 -3
- three/src/renderers/webgl/WebGLClipping.d.ts +3 -1
- three/src/renderers/webxr/WebXRManager.d.ts +2 -2
- three/src/textures/Data3DTexture.d.ts +2 -2
- three/src/utils.d.ts +5 -2
- three/examples/jsm/libs/fflate.module.min.d.ts +0 -1185
- three/src/renderers/WebGLMultisampleRenderTarget.d.ts +0 -6
- three/src/textures/DataTexture2DArray.d.ts +0 -6
- three/src/textures/DataTexture3D.d.ts +0 -6
three/src/core/Object3D.d.ts
CHANGED
|
@@ -15,184 +15,216 @@ import { BufferGeometry } from './BufferGeometry';
|
|
|
15
15
|
import { AnimationClip } from '../animation/AnimationClip';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* This is the base class for most objects in three.js and provides a set of properties and methods for manipulating objects in 3D space.
|
|
19
|
+
* @remarks Note that this can be used for grouping objects via the {@link THREE.Object3D.add | .add()} method which adds the object as a child,
|
|
20
|
+
* however it is better to use {@link THREE.Group | Group} for this.
|
|
21
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/core/Object3D | Official Documentation}
|
|
22
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Object3D.js | Source}
|
|
19
23
|
*/
|
|
20
24
|
export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
|
|
25
|
+
/**
|
|
26
|
+
* This creates a new {@link Object3D} object.
|
|
27
|
+
*/
|
|
21
28
|
constructor();
|
|
22
29
|
|
|
23
30
|
/**
|
|
24
|
-
* Unique number
|
|
31
|
+
* Unique number for this object instance.
|
|
32
|
+
* @remarks Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object.
|
|
33
|
+
* @remarks Expects a `Integer`
|
|
25
34
|
*/
|
|
26
|
-
id: number;
|
|
35
|
+
readonly id: number;
|
|
27
36
|
|
|
37
|
+
/**
|
|
38
|
+
* {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
|
|
39
|
+
* @remarks This gets automatically assigned and shouldn't be edited.
|
|
40
|
+
*/
|
|
28
41
|
uuid: string;
|
|
29
42
|
|
|
30
43
|
/**
|
|
31
44
|
* Optional name of the object (doesn't need to be unique).
|
|
32
|
-
* @
|
|
45
|
+
* @defaultValue `''`
|
|
33
46
|
*/
|
|
34
47
|
name: string;
|
|
35
48
|
|
|
36
49
|
/**
|
|
37
|
-
* @
|
|
50
|
+
* @defaultValue `Object3D`
|
|
38
51
|
*/
|
|
39
|
-
type: string;
|
|
52
|
+
type: string; // TODO Replace for "Object3D" // TODO add readonly
|
|
40
53
|
|
|
41
54
|
/**
|
|
42
|
-
* Object's parent in the scene graph.
|
|
43
|
-
* @
|
|
55
|
+
* Object's parent in the {@link https://en.wikipedia.org/wiki/Scene_graph | scene graph}.
|
|
56
|
+
* @remarks An object can have at most one parent.
|
|
57
|
+
* @defaultValue `null`
|
|
44
58
|
*/
|
|
45
59
|
parent: Object3D | null;
|
|
46
60
|
|
|
47
61
|
/**
|
|
48
62
|
* Array with object's children.
|
|
49
|
-
* @
|
|
63
|
+
* @see {@link THREE.Object3DGroup | Group} for info on manually grouping objects.
|
|
64
|
+
* @defaultValue `[]`
|
|
50
65
|
*/
|
|
66
|
+
|
|
51
67
|
children: Object3D[];
|
|
52
68
|
|
|
53
69
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @
|
|
70
|
+
* This is used by the {@link lookAt | lookAt} method, for example, to determine the orientation of the result.
|
|
71
|
+
* @defaultValue {@link DEFAULT_UP | Object3D.DEFAULT_UP} - that is `(0, 1, 0)`.
|
|
56
72
|
*/
|
|
57
73
|
up: Vector3;
|
|
58
74
|
|
|
59
75
|
/**
|
|
60
76
|
* Object's local position.
|
|
61
|
-
* @
|
|
77
|
+
* @defaultValue `new THREE.Vector3()` - that is `(0, 0, 0)`.
|
|
62
78
|
*/
|
|
63
79
|
readonly position: Vector3;
|
|
64
80
|
|
|
65
81
|
/**
|
|
66
|
-
* Object's local rotation (Euler angles), in radians.
|
|
67
|
-
* @
|
|
82
|
+
* Object's local rotation ({@link https://en.wikipedia.org/wiki/Euler_angles | Euler angles}), in radians.
|
|
83
|
+
* @defaultValue `new THREE.Euler()` - that is `(0, 0, 0, Euler.DEFAULT_ORDER)`.
|
|
68
84
|
*/
|
|
69
85
|
readonly rotation: Euler;
|
|
70
86
|
|
|
71
87
|
/**
|
|
72
|
-
* Object's local rotation as a Quaternion.
|
|
73
|
-
* @
|
|
88
|
+
* Object's local rotation as a {@link THREE.Quaternion | Quaternion}.
|
|
89
|
+
* @defaultValue `new THREE.Quaternion()` - that is `(0, 0, 0, 1)`.
|
|
74
90
|
*/
|
|
75
91
|
readonly quaternion: Quaternion;
|
|
76
92
|
|
|
77
93
|
/**
|
|
78
|
-
*
|
|
79
|
-
* @
|
|
94
|
+
* The object's local scale.
|
|
95
|
+
* @defaultValue `new THREE.Vector3( 1, 1, 1 )`
|
|
80
96
|
*/
|
|
81
97
|
readonly scale: Vector3;
|
|
82
98
|
|
|
83
99
|
/**
|
|
84
|
-
* @
|
|
100
|
+
* @defaultValue `new THREE.Matrix4()`
|
|
85
101
|
*/
|
|
86
102
|
readonly modelViewMatrix: Matrix4;
|
|
87
103
|
|
|
88
104
|
/**
|
|
89
|
-
* @
|
|
105
|
+
* @defaultValue `new THREE.Matrix3()`
|
|
90
106
|
*/
|
|
91
107
|
readonly normalMatrix: Matrix3;
|
|
92
108
|
|
|
93
109
|
/**
|
|
94
|
-
*
|
|
95
|
-
* @
|
|
110
|
+
* The local transform matrix.
|
|
111
|
+
* @defaultValue `new THREE.Matrix4()`
|
|
96
112
|
*/
|
|
97
113
|
matrix: Matrix4;
|
|
98
114
|
|
|
99
115
|
/**
|
|
100
|
-
* The global transform of the object.
|
|
101
|
-
* @
|
|
116
|
+
* The global transform of the object.
|
|
117
|
+
* @remarks If the {@link Object3D} has no parent, then it's identical to the local transform {@link THREE.Object3D.matrix | .matrix}.
|
|
118
|
+
* @defaultValue `new THREE.Matrix4()`
|
|
102
119
|
*/
|
|
103
120
|
matrixWorld: Matrix4;
|
|
104
121
|
|
|
105
122
|
/**
|
|
106
|
-
* When this is set, it calculates the matrix of position, (rotation or quaternion) and
|
|
107
|
-
* recalculates the matrixWorld property.
|
|
108
|
-
* @
|
|
123
|
+
* When this is set, it calculates the matrix of position, (rotation or quaternion) and
|
|
124
|
+
* scale every frame and also recalculates the matrixWorld property.
|
|
125
|
+
* @defaultValue {@link DEFAULT_MATRIX_AUTO_UPDATE} - that is `(true)`.
|
|
109
126
|
*/
|
|
110
127
|
matrixAutoUpdate: boolean;
|
|
111
128
|
|
|
112
129
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* @
|
|
130
|
+
* If set, then the renderer checks every frame if the object and its children need matrix updates.
|
|
131
|
+
* When it isn't, then you have to maintain all matrices in the object and its children yourself.
|
|
132
|
+
* @defaultValue {@link DEFAULT_MATRIX_WORLD_AUTO_UPDATE} - that is `(true)`.
|
|
116
133
|
*/
|
|
117
134
|
matrixWorldAutoUpdate: boolean;
|
|
118
135
|
|
|
119
136
|
/**
|
|
120
137
|
* When this is set, it calculates the matrixWorld in that frame and resets this property to false.
|
|
121
|
-
* @
|
|
138
|
+
* @defaultValue `false`
|
|
122
139
|
*/
|
|
123
140
|
matrixWorldNeedsUpdate: boolean;
|
|
124
141
|
|
|
125
142
|
/**
|
|
126
|
-
*
|
|
143
|
+
* The layer membership of the object.
|
|
144
|
+
* @remarks The object is only visible if it has at least one layer in common with the {@link THREE.Object3DCamera | Camera} in use.
|
|
145
|
+
* @remarks This property can also be used to filter out unwanted objects in ray-intersection tests when using {@link THREE.Raycaster | Raycaster}.
|
|
146
|
+
* @defaultValue `new THREE.Layers()`
|
|
127
147
|
*/
|
|
128
148
|
layers: Layers;
|
|
129
149
|
|
|
130
150
|
/**
|
|
131
|
-
* Object gets rendered if true
|
|
132
|
-
* @
|
|
151
|
+
* Object gets rendered if `true`.
|
|
152
|
+
* @defaultValue `true`
|
|
133
153
|
*/
|
|
134
154
|
visible: boolean;
|
|
135
155
|
|
|
136
156
|
/**
|
|
137
|
-
*
|
|
138
|
-
* @
|
|
157
|
+
* Whether the object gets rendered into shadow map.
|
|
158
|
+
* @defaultValue `false`
|
|
139
159
|
*/
|
|
140
160
|
castShadow: boolean;
|
|
141
161
|
|
|
142
162
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @
|
|
163
|
+
* Whether the material receives shadows.
|
|
164
|
+
* @defaultValue `false`
|
|
145
165
|
*/
|
|
146
166
|
receiveShadow: boolean;
|
|
147
167
|
|
|
148
168
|
/**
|
|
149
169
|
* When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
|
|
150
|
-
* If set to false the object gets rendered every frame even if it is not in the frustum of the camera.
|
|
151
|
-
* @
|
|
170
|
+
* If set to `false` the object gets rendered every frame even if it is not in the frustum of the camera.
|
|
171
|
+
* @defaultValue `true`
|
|
152
172
|
*/
|
|
153
173
|
frustumCulled: boolean;
|
|
154
174
|
|
|
155
175
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
|
|
159
|
-
* @
|
|
176
|
+
* This value allows the default rendering order of {@link https://en.wikipedia.org/wiki/Scene_graph | scene graph}
|
|
177
|
+
* objects to be overridden although opaque and transparent objects remain sorted independently.
|
|
178
|
+
* @remarks When this property is set for an instance of {@link Group | Group}, all descendants objects will be sorted and rendered together.
|
|
179
|
+
* @remarks Sorting is from lowest to highest renderOrder.
|
|
180
|
+
* @defaultValue `0`
|
|
160
181
|
*/
|
|
161
182
|
renderOrder: number;
|
|
162
183
|
|
|
163
184
|
/**
|
|
164
|
-
* Array with animation clips.
|
|
165
|
-
* @
|
|
185
|
+
* Array with object's animation clips.
|
|
186
|
+
* @defaultValue `[]`
|
|
166
187
|
*/
|
|
167
188
|
animations: AnimationClip[];
|
|
168
189
|
|
|
169
190
|
/**
|
|
170
|
-
* An object that can be used to store custom data about the
|
|
171
|
-
* @
|
|
191
|
+
* An object that can be used to store custom data about the {@link Object3D}.
|
|
192
|
+
* @remarks It should not hold references to _functions_ as these **will not** be cloned.
|
|
193
|
+
* @default `{}`
|
|
172
194
|
*/
|
|
173
|
-
userData: { [key: string]: any };
|
|
195
|
+
userData: { [key: string]: any }; // TODO Replace this to a Record?
|
|
174
196
|
|
|
175
197
|
/**
|
|
176
|
-
* Custom depth material to be used when rendering to the depth map.
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
198
|
+
* Custom depth material to be used when rendering to the depth map.
|
|
199
|
+
* @remarks Can only be used in context of meshes.
|
|
200
|
+
* @remarks When shadow-casting with a {@link THREE.DirectionalLight | DirectionalLight} or {@link THREE.SpotLight | SpotLight},
|
|
201
|
+
* if you are modifying vertex positions in the vertex shader you must specify a customDepthMaterial for proper shadows.
|
|
202
|
+
* @defaultValue `undefined`
|
|
180
203
|
*/
|
|
181
|
-
customDepthMaterial
|
|
204
|
+
customDepthMaterial?: Material | undefined;
|
|
182
205
|
|
|
183
206
|
/**
|
|
184
|
-
* Same as customDepthMaterial, but used with PointLight.
|
|
207
|
+
* Same as {@link customDepthMaterial}, but used with {@link THREE.Object3DPointLight | PointLight}.
|
|
208
|
+
* @defaultValue `undefined`
|
|
185
209
|
*/
|
|
186
|
-
customDistanceMaterial
|
|
210
|
+
customDistanceMaterial?: Material | undefined;
|
|
187
211
|
|
|
188
212
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
213
|
+
* Flag to check if a given object is of type {@link Object3D}.
|
|
214
|
+
* @remarks This is a _constant_ value
|
|
215
|
+
* @defaultValue `true`
|
|
191
216
|
*/
|
|
192
217
|
readonly isObject3D: true;
|
|
193
218
|
|
|
194
219
|
/**
|
|
195
|
-
*
|
|
220
|
+
* An optional callback that is executed immediately before a 3D object is rendered.
|
|
221
|
+
* @remarks This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
|
|
222
|
+
* @remarks Please notice that this callback is only executed for `renderable` 3D objects.
|
|
223
|
+
* Meaning 3D objects which define their visual appearance with geometries and materials like
|
|
224
|
+
* instances of {@link THREE.Object3DMesh | Mesh}, {@link THREE.Object3DLine | Line}, {@link THREE.Object3DPoints | Points} or {@link THREE.Object3DSprite | Sprite}.
|
|
225
|
+
* Instances of {@link THREE.Object3DObject3D | Object3D}, {@link THREE.Object3DGroup | Group} or {@link THREE.Object3DBone | Bone}
|
|
226
|
+
* are not renderable and thus this callback is not executed for such objects.
|
|
227
|
+
* @defaultValue `() => {}`
|
|
196
228
|
*/
|
|
197
229
|
onBeforeRender: (
|
|
198
230
|
renderer: WebGLRenderer,
|
|
@@ -204,7 +236,14 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
|
|
|
204
236
|
) => void;
|
|
205
237
|
|
|
206
238
|
/**
|
|
207
|
-
*
|
|
239
|
+
* An optional callback that is executed immediately after a 3D object is rendered.
|
|
240
|
+
* @remarks This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
|
|
241
|
+
* @remarks Please notice that this callback is only executed for `renderable` 3D objects.
|
|
242
|
+
* Meaning 3D objects which define their visual appearance with geometries and materials like
|
|
243
|
+
* instances of {@link THREE.Object3DMesh | Mesh}, {@link THREE.Object3DLine | Line}, {@link THREE.Object3DPoints | Points} or {@link THREE.Object3DSprite | Sprite}.
|
|
244
|
+
* Instances of {@link THREE.Object3DObject3D | Object3D}, {@link THREE.Object3DGroup | Group} or {@link THREE.Object3DBone | Bone}
|
|
245
|
+
* are not renderable and thus this callback is not executed for such objects.
|
|
246
|
+
* @defaultValue `() => {}`
|
|
208
247
|
*/
|
|
209
248
|
onAfterRender: (
|
|
210
249
|
renderer: WebGLRenderer,
|
|
@@ -215,133 +254,166 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
|
|
|
215
254
|
group: Group,
|
|
216
255
|
) => void;
|
|
217
256
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
257
|
+
/**
|
|
258
|
+
* The default {@link up} direction for objects, also used as the default position for {@link THREE.DirectionalLight | DirectionalLight},
|
|
259
|
+
* {@link THREE.HemisphereLight | HemisphereLight} and {@link THREE.Spotlight | Spotlight} (which creates lights shining from the top down).
|
|
260
|
+
* @defaultValue `new THREE.Vector3( 0, 1, 0)`
|
|
261
|
+
*/
|
|
262
|
+
static DEFAULT_UP: Vector3;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* The default setting for {@link matrixAutoUpdate} for newly created Object3Ds.
|
|
266
|
+
* @defaultValue `true`
|
|
267
|
+
*/
|
|
268
|
+
static DEFAULT_MATRIX_AUTO_UPDATE: boolean;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* The default setting for {@link matrixWorldAutoUpdate} for newly created Object3Ds.
|
|
272
|
+
* @defaultValue `true`
|
|
273
|
+
*/
|
|
274
|
+
static DEFAULT_MATRIX_WORLD_AUTO_UPDATE: boolean;
|
|
221
275
|
|
|
222
276
|
/**
|
|
223
277
|
* Applies the matrix transform to the object and updates the object's position, rotation and scale.
|
|
278
|
+
* @param matrix
|
|
224
279
|
*/
|
|
225
280
|
applyMatrix4(matrix: Matrix4): void;
|
|
226
281
|
|
|
227
282
|
/**
|
|
228
283
|
* Applies the rotation represented by the quaternion to the object.
|
|
284
|
+
* @param quaternion
|
|
229
285
|
*/
|
|
230
286
|
applyQuaternion(quaternion: Quaternion): this;
|
|
231
287
|
|
|
232
288
|
/**
|
|
233
|
-
* axis
|
|
234
|
-
* angle -- angle in radians
|
|
289
|
+
* Calls {@link THREE.Quaternion.setFromAxisAngle | setFromAxisAngle}({@link axis}, {@link angle}) on the {@link quaternion | .quaternion}.
|
|
235
290
|
* @param axis A normalized vector in object space.
|
|
236
|
-
* @param angle
|
|
291
|
+
* @param angle Angle in radians. Expects a `Float`
|
|
237
292
|
*/
|
|
238
293
|
setRotationFromAxisAngle(axis: Vector3, angle: number): void;
|
|
239
294
|
|
|
240
295
|
/**
|
|
241
|
-
* Calls
|
|
296
|
+
* Calls {@link THREE.Quaternion.setFromEuler | setFromEuler}({@link euler}) on the {@link quaternion | .quaternion}.
|
|
242
297
|
* @param euler Euler angle specifying rotation amount.
|
|
243
298
|
*/
|
|
244
299
|
setRotationFromEuler(euler: Euler): void;
|
|
245
300
|
|
|
246
301
|
/**
|
|
247
|
-
* Calls setFromRotationMatrix(m) on the .quaternion.
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* @param m rotate the quaternion by the rotation component of the matrix.
|
|
302
|
+
* Calls {@link THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix}({@link m}) on the {@link quaternion | .quaternion}.
|
|
303
|
+
* @remarks Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
|
|
304
|
+
* @param m Rotate the quaternion by the rotation component of the matrix.
|
|
251
305
|
*/
|
|
252
306
|
setRotationFromMatrix(m: Matrix4): void;
|
|
253
307
|
|
|
254
308
|
/**
|
|
255
|
-
* Copy the given
|
|
256
|
-
* @param q
|
|
309
|
+
* Copy the given {@link THREE.Quaternion | Quaternion} into {@link quaternion | .quaternion}.
|
|
310
|
+
* @param q Normalized Quaternion.
|
|
257
311
|
*/
|
|
258
312
|
setRotationFromQuaternion(q: Quaternion): void;
|
|
259
313
|
|
|
260
314
|
/**
|
|
261
|
-
* Rotate an object along an axis in object space.
|
|
262
|
-
* @
|
|
263
|
-
* @param
|
|
315
|
+
* Rotate an object along an axis in object space.
|
|
316
|
+
* @remarks The axis is assumed to be normalized.
|
|
317
|
+
* @param axis A normalized vector in object space.
|
|
318
|
+
* @param angle The angle in radians. Expects a `Float`
|
|
264
319
|
*/
|
|
265
320
|
rotateOnAxis(axis: Vector3, angle: number): this;
|
|
266
321
|
|
|
267
322
|
/**
|
|
268
|
-
* Rotate an object along an axis in world space.
|
|
269
|
-
* @
|
|
270
|
-
* @
|
|
323
|
+
* Rotate an object along an axis in world space.
|
|
324
|
+
* @remarks The axis is assumed to be normalized
|
|
325
|
+
* @remarks Method Assumes no rotated parent.
|
|
326
|
+
* @param axis A normalized vector in world space.
|
|
327
|
+
* @param angle The angle in radians. Expects a `Float`
|
|
271
328
|
*/
|
|
272
329
|
rotateOnWorldAxis(axis: Vector3, angle: number): this;
|
|
273
330
|
|
|
274
331
|
/**
|
|
275
|
-
* Rotates the object around
|
|
276
|
-
* @param
|
|
332
|
+
* Rotates the object around _x_ axis in local space.
|
|
333
|
+
* @param rad The angle to rotate in radians. Expects a `Float`
|
|
277
334
|
*/
|
|
278
335
|
rotateX(angle: number): this;
|
|
279
336
|
|
|
280
337
|
/**
|
|
281
|
-
* Rotates the object around
|
|
282
|
-
* @param
|
|
338
|
+
* Rotates the object around _y_ axis in local space.
|
|
339
|
+
* @param rad The angle to rotate in radians. Expects a `Float`
|
|
283
340
|
*/
|
|
284
341
|
rotateY(angle: number): this;
|
|
285
342
|
|
|
286
343
|
/**
|
|
287
|
-
* Rotates the object around
|
|
288
|
-
* @param
|
|
344
|
+
* Rotates the object around _z_ axis in local space.
|
|
345
|
+
* @param rad The angle to rotate in radians. Expects a `Float`
|
|
289
346
|
*/
|
|
290
347
|
rotateZ(angle: number): this;
|
|
291
348
|
|
|
292
349
|
/**
|
|
293
|
-
* Translate an object by distance along an axis in object space
|
|
294
|
-
* @
|
|
295
|
-
* @param
|
|
350
|
+
* Translate an object by distance along an axis in object space
|
|
351
|
+
* @remarks The axis is assumed to be normalized.
|
|
352
|
+
* @param axis A normalized vector in object space.
|
|
353
|
+
* @param distance The distance to translate. Expects a `Float`
|
|
296
354
|
*/
|
|
297
355
|
translateOnAxis(axis: Vector3, distance: number): this;
|
|
298
356
|
|
|
299
357
|
/**
|
|
300
|
-
* Translates object along x axis by distance.
|
|
301
|
-
* @param distance
|
|
358
|
+
* Translates object along x axis in object space by {@link distance} units.
|
|
359
|
+
* @param distance Expects a `Float`
|
|
302
360
|
*/
|
|
303
361
|
translateX(distance: number): this;
|
|
304
362
|
|
|
305
363
|
/**
|
|
306
|
-
* Translates object along
|
|
307
|
-
* @param distance
|
|
364
|
+
* Translates object along _y_ axis in object space by {@link distance} units.
|
|
365
|
+
* @param distance Expects a `Float`
|
|
308
366
|
*/
|
|
309
367
|
translateY(distance: number): this;
|
|
310
368
|
|
|
311
369
|
/**
|
|
312
|
-
* Translates object along
|
|
313
|
-
* @param distance
|
|
370
|
+
* Translates object along _z_ axis in object space by {@link distance} units.
|
|
371
|
+
* @param distance Expects a `Float`
|
|
314
372
|
*/
|
|
315
373
|
translateZ(distance: number): this;
|
|
316
374
|
|
|
317
375
|
/**
|
|
318
|
-
*
|
|
319
|
-
* @param vector A local
|
|
376
|
+
* Converts the vector from this object's local space to world space.
|
|
377
|
+
* @param vector A vector representing a position in this object's local space.
|
|
320
378
|
*/
|
|
321
379
|
localToWorld(vector: Vector3): Vector3;
|
|
322
380
|
|
|
323
381
|
/**
|
|
324
|
-
*
|
|
325
|
-
* @param vector A world
|
|
382
|
+
* Converts the vector from world space to this object's local space.
|
|
383
|
+
* @param vector A vector representing a position in world space.
|
|
326
384
|
*/
|
|
327
385
|
worldToLocal(vector: Vector3): Vector3;
|
|
328
386
|
|
|
329
387
|
/**
|
|
330
|
-
* Optionally, the x, y and z components of the world space position.
|
|
331
388
|
* Rotates the object to face a point in world space.
|
|
332
|
-
* This method does not support objects having non-uniformly-scaled parent(s).
|
|
333
|
-
* @param vector A world
|
|
389
|
+
* @remarks This method does not support objects having non-uniformly-scaled parent(s).
|
|
390
|
+
* @param vector A vector representing a position in world space to look at.
|
|
334
391
|
*/
|
|
335
392
|
lookAt(vector: Vector3): void;
|
|
393
|
+
/**
|
|
394
|
+
* Rotates the object to face a point in world space.
|
|
395
|
+
* @remarks This method does not support objects having non-uniformly-scaled parent(s).
|
|
396
|
+
* @param x Expects a `Float`
|
|
397
|
+
* @param y Expects a `Float`
|
|
398
|
+
* @param z Expects a `Float`
|
|
399
|
+
*/
|
|
336
400
|
lookAt(x: number, y: number, z: number): void;
|
|
337
401
|
|
|
338
402
|
/**
|
|
339
|
-
* Adds
|
|
403
|
+
* Adds another {@link Object3D} as child of this {@link Object3D}.
|
|
404
|
+
* @remarks An arbitrary number of objects may be added
|
|
405
|
+
* @remarks Any current parent on an {@link object} passed in here will be removed, since an {@link Object3D} can have at most one parent.
|
|
406
|
+
* @see {@link attach}
|
|
407
|
+
* @see {@link THREE.Group | Group} for info on manually grouping objects.
|
|
408
|
+
* @param object
|
|
340
409
|
*/
|
|
341
410
|
add(...object: Object3D[]): this;
|
|
342
411
|
|
|
343
412
|
/**
|
|
344
|
-
* Removes
|
|
413
|
+
* Removes a {@link Object3D} as child of this {@link Object3D}.
|
|
414
|
+
* @remarks An arbitrary number of objects may be removed.
|
|
415
|
+
* @see {@link THREE.Group | Group} for info on manually grouping objects.
|
|
416
|
+
* @param object
|
|
345
417
|
*/
|
|
346
418
|
remove(...object: Object3D[]): this;
|
|
347
419
|
|
|
@@ -356,19 +428,26 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
|
|
|
356
428
|
clear(): this;
|
|
357
429
|
|
|
358
430
|
/**
|
|
359
|
-
* Adds
|
|
431
|
+
* Adds a {@link Object3D} as a child of this, while maintaining the object's world transform.
|
|
432
|
+
* @remarks Note: This method does not support scene graphs having non-uniformly-scaled nodes(s).
|
|
433
|
+
* @see {@link add}
|
|
434
|
+
* @param object
|
|
360
435
|
*/
|
|
361
436
|
attach(object: Object3D): this;
|
|
362
437
|
|
|
363
438
|
/**
|
|
364
|
-
* Searches through
|
|
365
|
-
* @
|
|
439
|
+
* Searches through an object and its children, starting with the object itself, and returns the first with a matching id.
|
|
440
|
+
* @remarks Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object.
|
|
441
|
+
* @see {@link id}
|
|
442
|
+
* @param id Unique number of the object instance. Expects a `Integer`
|
|
366
443
|
*/
|
|
367
444
|
getObjectById(id: number): Object3D | undefined;
|
|
368
445
|
|
|
369
446
|
/**
|
|
370
|
-
* Searches through
|
|
371
|
-
* @
|
|
447
|
+
* Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
|
|
448
|
+
* @remarks Note that for most objects the name is an empty string by default
|
|
449
|
+
* @remarks You will have to set it manually to make use of this method.
|
|
450
|
+
* @param name String to match to the children's Object3D.name property.
|
|
372
451
|
*/
|
|
373
452
|
getObjectByName(name: string): Object3D | undefined;
|
|
374
453
|
|
|
@@ -383,24 +462,66 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
|
|
|
383
462
|
|
|
384
463
|
/**
|
|
385
464
|
* Searches through an object and its children, starting with the object itself,
|
|
386
|
-
* and returns
|
|
387
|
-
*
|
|
388
|
-
* @param
|
|
389
|
-
* @param value - value of the given property.
|
|
465
|
+
* and returns the first with a property that matches the value given.
|
|
466
|
+
* @param name The property name to search for.
|
|
467
|
+
* @param value Value of the given property.
|
|
390
468
|
*/
|
|
391
469
|
getObjectsByProperty(name: string, value: any): Object3D[];
|
|
392
470
|
|
|
471
|
+
/**
|
|
472
|
+
* Returns a vector representing the position of the object in world space.
|
|
473
|
+
* @param target The result will be copied into this Vector3.
|
|
474
|
+
*/
|
|
393
475
|
getWorldPosition(target: Vector3): Vector3;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Returns a quaternion representing the rotation of the object in world space.
|
|
479
|
+
* @param target The result will be copied into this Quaternion.
|
|
480
|
+
*/
|
|
394
481
|
getWorldQuaternion(target: Quaternion): Quaternion;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Returns a vector of the scaling factors applied to the object for each axis in world space.
|
|
485
|
+
* @param target The result will be copied into this Vector3.
|
|
486
|
+
*/
|
|
395
487
|
getWorldScale(target: Vector3): Vector3;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Returns a vector representing the direction of object's positive z-axis in world space.
|
|
491
|
+
* @param target The result will be copied into this Vector3.
|
|
492
|
+
*/
|
|
396
493
|
getWorldDirection(target: Vector3): Vector3;
|
|
397
494
|
|
|
495
|
+
/**
|
|
496
|
+
* Abstract (empty) method to get intersections between a casted ray and this object
|
|
497
|
+
* @remarks Subclasses such as {@link THREE.Mesh | Mesh}, {@link THREE.Line | Line}, and {@link THREE.Points | Points} implement this method in order to use raycasting.
|
|
498
|
+
* @see {@link THREE.Raycaster | Raycaster}
|
|
499
|
+
* @param raycaster
|
|
500
|
+
* @param intersects
|
|
501
|
+
* @defaultValue `() => {}`
|
|
502
|
+
*/
|
|
398
503
|
raycast(raycaster: Raycaster, intersects: Intersection[]): void;
|
|
399
504
|
|
|
505
|
+
/**
|
|
506
|
+
* Executes the callback on this object and all descendants.
|
|
507
|
+
* @remarks Note: Modifying the scene graph inside the callback is discouraged.
|
|
508
|
+
* @param callback A function with as first argument an {@link Object3D} object.
|
|
509
|
+
*/
|
|
400
510
|
traverse(callback: (object: Object3D) => any): void;
|
|
401
511
|
|
|
512
|
+
/**
|
|
513
|
+
* Like traverse, but the callback will only be executed for visible objects
|
|
514
|
+
* @remarks Descendants of invisible objects are not traversed.
|
|
515
|
+
* @remarks Note: Modifying the scene graph inside the callback is discouraged.
|
|
516
|
+
* @param callback A function with as first argument an {@link Object3D} object.
|
|
517
|
+
*/
|
|
402
518
|
traverseVisible(callback: (object: Object3D) => any): void;
|
|
403
519
|
|
|
520
|
+
/**
|
|
521
|
+
* Executes the callback on all ancestors.
|
|
522
|
+
* @remarks Note: Modifying the scene graph inside the callback is discouraged.
|
|
523
|
+
* @param callback A function with as first argument an {@link Object3D} object.
|
|
524
|
+
*/
|
|
404
525
|
traverseAncestors(callback: (object: Object3D) => any): void;
|
|
405
526
|
|
|
406
527
|
/**
|
|
@@ -409,25 +530,37 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
|
|
|
409
530
|
updateMatrix(): void;
|
|
410
531
|
|
|
411
532
|
/**
|
|
412
|
-
* Updates global transform of the object
|
|
533
|
+
* Updates the global transform of the object.
|
|
534
|
+
* And will update the object descendants if {@link matrixWorldNeedsUpdate | .matrixWorldNeedsUpdate} is set to true or if the {@link force} parameter is set to `true`.
|
|
535
|
+
* @param force A boolean that can be used to bypass {@link matrixWorldAutoUpdate | .matrixWorldAutoUpdate}, to recalculate the world matrix of the object and descendants on the current frame.
|
|
536
|
+
* Useful if you cannot wait for the renderer to update it on the next frame, assuming {@link matrixWorldAutoUpdate | .matrixWorldAutoUpdate} set to `true`.
|
|
413
537
|
*/
|
|
414
538
|
updateMatrixWorld(force?: boolean): void;
|
|
415
539
|
|
|
416
540
|
/**
|
|
417
541
|
* Updates the global transform of the object.
|
|
418
|
-
* @param updateParents
|
|
419
|
-
* @param updateChildren
|
|
542
|
+
* @param updateParents Recursively updates global transform of ancestors.
|
|
543
|
+
* @param updateChildren Recursively updates global transform of descendants.
|
|
420
544
|
*/
|
|
421
545
|
updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void;
|
|
422
546
|
|
|
547
|
+
/**
|
|
548
|
+
* Convert the object to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
|
|
549
|
+
* @param meta Object containing metadata such as materials, textures or images for the object.
|
|
550
|
+
*/
|
|
423
551
|
toJSON(meta?: { geometries: any; materials: any; textures: any; images: any }): any;
|
|
424
552
|
|
|
553
|
+
/**
|
|
554
|
+
* Returns a clone of this object and optionally all descendants.
|
|
555
|
+
* @param recursive If true, descendants of the object are also cloned. Default `true`
|
|
556
|
+
*/
|
|
425
557
|
clone(recursive?: boolean): this;
|
|
426
558
|
|
|
427
559
|
/**
|
|
428
|
-
*
|
|
429
|
-
* @
|
|
430
|
-
* @param
|
|
560
|
+
* Copy the given object into this object
|
|
561
|
+
* @remarks Note: event listeners and user-defined callbacks ({@link onAfterRender | .onAfterRender} and {@link onBeforeRender | .onBeforeRender}) are not copied.
|
|
562
|
+
* @param source
|
|
563
|
+
* @param recursive If true, descendants of the object are also copied. Default `true`
|
|
431
564
|
*/
|
|
432
|
-
copy(source:
|
|
565
|
+
copy(source: Object3D, recursive?: boolean): this;
|
|
433
566
|
}
|