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