@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/Raycaster.d.ts
CHANGED
|
@@ -14,72 +14,132 @@ export interface Face {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface Intersection<TIntersected extends Object3D = Object3D> {
|
|
17
|
+
/** Distance between the origin of the ray and the intersection */
|
|
17
18
|
distance: number;
|
|
18
19
|
distanceToRay?: number | undefined;
|
|
20
|
+
/** Point of intersection, in world coordinates */
|
|
19
21
|
point: Vector3;
|
|
20
22
|
index?: number | undefined;
|
|
23
|
+
/** Intersected face */
|
|
21
24
|
face?: Face | null | undefined;
|
|
25
|
+
/** Index of the intersected face */
|
|
22
26
|
faceIndex?: number | undefined;
|
|
27
|
+
/** The intersected object */
|
|
23
28
|
object: TIntersected;
|
|
24
29
|
uv?: Vector2 | undefined;
|
|
25
30
|
uv2?: Vector2 | undefined;
|
|
31
|
+
/** The index number of the instance where the ray intersects the {@link THREE.InstancedMesh | InstancedMesh } */
|
|
26
32
|
instanceId?: number | undefined;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
export interface RaycasterParameters {
|
|
30
36
|
Mesh?: any;
|
|
31
37
|
Line?: { threshold: number } | undefined;
|
|
38
|
+
Line2?: { threshold: number } | undefined;
|
|
32
39
|
LOD?: any;
|
|
33
40
|
Points?: { threshold: number } | undefined;
|
|
34
41
|
Sprite?: any;
|
|
35
42
|
}
|
|
36
43
|
|
|
44
|
+
/**
|
|
45
|
+
* This class is designed to assist with {@link https://en.wikipedia.org/wiki/Ray_casting | raycasting}
|
|
46
|
+
* @remarks
|
|
47
|
+
* Raycasting is used for mouse picking (working out what objects in the 3d space the mouse is over) amongst other things.
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const raycaster = new THREE.Raycaster();
|
|
51
|
+
* const pointer = new THREE.Vector2();
|
|
52
|
+
*
|
|
53
|
+
* function onPointerMove(event) {
|
|
54
|
+
* // calculate pointer position in normalized device coordinates (-1 to +1) for both components
|
|
55
|
+
* pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
|
|
56
|
+
* pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* function render() {
|
|
60
|
+
* // update the picking ray with the camera and pointer position
|
|
61
|
+
* raycaster.setFromCamera(pointer, camera);
|
|
62
|
+
* // calculate objects intersecting the picking ray
|
|
63
|
+
* const intersects = raycaster.intersectObjects(scene.children);
|
|
64
|
+
* for (let i = 0; i & lt; intersects.length; i++) {
|
|
65
|
+
* intersects[i].object.material.color.set(0xff0000);
|
|
66
|
+
* }
|
|
67
|
+
* renderer.render(scene, camera);
|
|
68
|
+
* }
|
|
69
|
+
* window.addEventListener('pointermove', onPointerMove);
|
|
70
|
+
* window.requestAnimationFrame(render);
|
|
71
|
+
* ```
|
|
72
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_cubes | Raycasting to a Mesh}
|
|
73
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_cubes_ortho | Raycasting to a Mesh in using an OrthographicCamera}
|
|
74
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_buffergeometry | Raycasting to a Mesh with BufferGeometry}
|
|
75
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_instancing_raycast | Raycasting to a InstancedMesh}
|
|
76
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_lines | Raycasting to a Line}
|
|
77
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_raycasting_points | Raycasting to Points}
|
|
78
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_geometry_terrain_raycast | Terrain raycasting}
|
|
79
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_voxelpainter | Raycasting to paint voxels}
|
|
80
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_raycaster_texture | Raycast to a Texture}
|
|
81
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/core/Raycaster | Official Documentation}
|
|
82
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Raycaster.js | Source}
|
|
83
|
+
*/
|
|
37
84
|
export class Raycaster {
|
|
38
85
|
/**
|
|
39
|
-
* This creates a new
|
|
40
|
-
* @param origin The origin vector where the ray casts from.
|
|
41
|
-
* @param direction The direction vector that gives direction to the ray. Should be normalized.
|
|
42
|
-
* @param near All results returned are further away than near. Near can't be negative.
|
|
43
|
-
* @param far All results returned are closer
|
|
86
|
+
* This creates a new {@link Raycaster} object.
|
|
87
|
+
* @param origin The origin vector where the ray casts from. Default `new Vector3()`
|
|
88
|
+
* @param direction The direction vector that gives direction to the ray. Should be normalized. Default `new Vector3(0, 0, -1)`
|
|
89
|
+
* @param near All results returned are further away than near. Near can't be negative. Expects a `Float`. Default `0`
|
|
90
|
+
* @param far All results returned are closer than far. Far can't be lower than near. Expects a `Float`. Default `Infinity`
|
|
44
91
|
*/
|
|
45
92
|
constructor(origin?: Vector3, direction?: Vector3, near?: number, far?: number);
|
|
46
93
|
|
|
47
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* The {@link THREE.RaycasterRay | Ray} used for the raycasting.
|
|
96
|
+
*/
|
|
48
97
|
ray: Ray;
|
|
49
98
|
|
|
50
99
|
/**
|
|
51
|
-
* The near factor of the raycaster. This value indicates which objects can be discarded based on the
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
100
|
+
* The near factor of the raycaster. This value indicates which objects can be discarded based on the distance.
|
|
101
|
+
* This value shouldn't be negative and should be smaller than the far property.
|
|
102
|
+
* @remarks Expects a `Float`
|
|
103
|
+
* @defaultValue `0`
|
|
54
104
|
*/
|
|
55
105
|
near: number;
|
|
56
106
|
|
|
57
107
|
/**
|
|
58
|
-
* The far factor of the raycaster. This value indicates which objects can be discarded based on the
|
|
59
|
-
*
|
|
60
|
-
* @
|
|
108
|
+
* The far factor of the raycaster. This value indicates which objects can be discarded based on the distance.
|
|
109
|
+
* This value shouldn't be negative and should be larger than the near property.
|
|
110
|
+
* @remarks Expects a `Float`
|
|
111
|
+
* @defaultValue `Infinity`
|
|
61
112
|
*/
|
|
62
113
|
far: number;
|
|
63
114
|
|
|
64
115
|
/**
|
|
65
|
-
* The camera to use when raycasting against view-dependent objects such as billboarded objects like Sprites
|
|
66
|
-
* can be set manually or is set when calling
|
|
116
|
+
* The camera to use when raycasting against view-dependent objects such as billboarded objects like {@link THREE.Sprites | Sprites}.
|
|
117
|
+
* This field can be set manually or is set when calling {@link setFromCamera}.
|
|
118
|
+
* @defaultValue `null`
|
|
67
119
|
*/
|
|
68
120
|
camera: Camera;
|
|
69
121
|
|
|
70
122
|
/**
|
|
71
|
-
* Used by Raycaster to selectively ignore 3D objects when performing intersection tests.
|
|
72
|
-
*
|
|
123
|
+
* Used by {@link Raycaster} to selectively ignore 3D objects when performing intersection tests.
|
|
124
|
+
* The following code example ensures that only 3D objects on layer `1` will be honored by the instance of Raycaster.
|
|
125
|
+
* ```
|
|
126
|
+
* raycaster.layers.set( 1 );
|
|
127
|
+
* object.layers.enable( 1 );
|
|
128
|
+
* ```
|
|
129
|
+
* @defaultValue `new THREE.Layers()` - See {@link THREE.Layers | Layers}.
|
|
73
130
|
*/
|
|
74
131
|
layers: Layers;
|
|
75
132
|
|
|
76
133
|
/**
|
|
77
|
-
*
|
|
134
|
+
* An data object where threshold is the precision of the {@link Raycaster} when intersecting objects, in world units.
|
|
135
|
+
* @defaultValue `{ Mesh: {}, Line: { threshold: 1 }, LOD: {}, Points: { threshold: 1 }, Sprite: {} }`
|
|
78
136
|
*/
|
|
79
137
|
params: RaycasterParameters;
|
|
80
138
|
|
|
81
139
|
/**
|
|
82
|
-
* Updates the ray with a new origin and direction
|
|
140
|
+
* Updates the ray with a new origin and direction
|
|
141
|
+
* @remarks
|
|
142
|
+
* Please note that this method only copies the values from the arguments.
|
|
83
143
|
* @param origin The origin vector where the ray casts from.
|
|
84
144
|
* @param direction The normalized direction vector that gives direction to the ray.
|
|
85
145
|
*/
|
|
@@ -90,13 +150,22 @@ export class Raycaster {
|
|
|
90
150
|
* @param coords 2D coordinates of the mouse, in normalized device coordinates (NDC)---X and Y components should be between -1 and 1.
|
|
91
151
|
* @param camera camera from which the ray should originate
|
|
92
152
|
*/
|
|
93
|
-
setFromCamera(coords:
|
|
153
|
+
setFromCamera(coords: Vector2, camera: Camera): void;
|
|
94
154
|
|
|
95
155
|
/**
|
|
96
|
-
* Checks all intersection between the ray and the object with or without the descendants
|
|
156
|
+
* Checks all intersection between the ray and the object with or without the descendants
|
|
157
|
+
* @remarks Intersections are returned sorted by distance, closest first
|
|
158
|
+
* @remarks {@link Raycaster} delegates to the {@link Object3D.raycast | raycast} method of the passed object, when evaluating whether the ray intersects the object or not
|
|
159
|
+
* This allows {@link THREE.Mesh | meshes} to respond differently to ray casting than {@link THREE.Line | lines} and {@link THREE.Points | pointclouds}.
|
|
160
|
+
* **Note** that for meshes, faces must be pointed towards the origin of the {@link Raycaster.ray | ray} in order to be detected;
|
|
161
|
+
* intersections of the ray passing through the back of a face will not be detected
|
|
162
|
+
* To raycast against both faces of an object, you'll want to set the {@link Mesh.material | material}'s {@link Material.side | side} property to `THREE.DoubleSide`.
|
|
163
|
+
* @see {@link intersectObjects | .intersectObjects()}.
|
|
97
164
|
* @param object The object to check for intersection with the ray.
|
|
98
|
-
* @param recursive If true, it also checks all descendants. Otherwise it only checks
|
|
99
|
-
* @param optionalTarget
|
|
165
|
+
* @param recursive If true, it also checks all descendants. Otherwise it only checks intersection with the object. Default `true`
|
|
166
|
+
* @param optionalTarget Target to set the result. Otherwise a new {@link Array | Array} is instantiated.
|
|
167
|
+
* If set, you must clear this array prior to each call (i.e., array.length = 0;). Default `[]`
|
|
168
|
+
* @returns An array of intersections is returned.
|
|
100
169
|
*/
|
|
101
170
|
intersectObject<TIntersected extends Object3D>(
|
|
102
171
|
object: Object3D,
|
|
@@ -105,12 +174,20 @@ export class Raycaster {
|
|
|
105
174
|
): Array<Intersection<TIntersected>>;
|
|
106
175
|
|
|
107
176
|
/**
|
|
108
|
-
* Checks all intersection between the ray and the objects with or without the descendants
|
|
109
|
-
* Intersections are returned sorted by distance, closest first
|
|
110
|
-
* Intersections are of the same form as those returned by .intersectObject.
|
|
177
|
+
* Checks all intersection between the ray and the objects with or without the descendants
|
|
178
|
+
* @remarks Intersections are returned sorted by distance, closest first
|
|
179
|
+
* @remarks Intersections are of the same form as those returned by {@link intersectObject | .intersectObject()}.
|
|
180
|
+
* @remarks {@link Raycaster} delegates to the {@link Object3D.raycast | raycast} method of the passed object, when evaluating whether the ray intersects the object or not
|
|
181
|
+
* This allows {@link THREE.Mesh | meshes} to respond differently to ray casting than {@link THREE.Line | lines} and {@link THREE.Points | pointclouds}.
|
|
182
|
+
* **Note** that for meshes, faces must be pointed towards the origin of the {@link Raycaster.ray | ray} in order to be detected;
|
|
183
|
+
* intersections of the ray passing through the back of a face will not be detected
|
|
184
|
+
* To raycast against both faces of an object, you'll want to set the {@link Mesh.material | material}'s {@link Material.side | side} property to `THREE.DoubleSide`.
|
|
185
|
+
* @see {@link intersectObject | .intersectObject()}.
|
|
111
186
|
* @param objects The objects to check for intersection with the ray.
|
|
112
|
-
* @param recursive If true, it also checks all descendants of the objects. Otherwise it only checks
|
|
113
|
-
* @param optionalTarget
|
|
187
|
+
* @param recursive If true, it also checks all descendants of the objects. Otherwise it only checks intersection with the objects. Default `true`
|
|
188
|
+
* @param optionalTarget Target to set the result. Otherwise a new {@link Array | Array} is instantiated.
|
|
189
|
+
* If set, you must clear this array prior to each call (i.e., array.length = 0;). Default `[]`
|
|
190
|
+
* @returns An array of intersections is returned.
|
|
114
191
|
*/
|
|
115
192
|
intersectObjects<TIntersected extends Object3D>(
|
|
116
193
|
objects: Object3D[],
|
three/src/core/Uniform.d.ts
CHANGED
|
@@ -1,21 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uniforms are global GLSL variables.
|
|
3
|
+
* They are passed to shader programs.
|
|
4
|
+
* @example
|
|
5
|
+
* When declaring a uniform of a {@link THREE.ShaderMaterial | ShaderMaterial}, it is declared by value or by object.
|
|
6
|
+
* ```typescript
|
|
7
|
+
* uniforms: {
|
|
8
|
+
* time: {
|
|
9
|
+
* value: 1.0
|
|
10
|
+
* },
|
|
11
|
+
* resolution: new Uniform(new Vector2())
|
|
12
|
+
* };
|
|
13
|
+
* ```
|
|
14
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_nodes_materials_instance_uniform | WebGL2 / nodes / materials / instance / uniform}
|
|
15
|
+
* @see Example: {@link https://threejs.org/examples/#webgpu_instance_uniform| WebGPU / instance / uniform}
|
|
16
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/core/Uniform | Official Documentation}
|
|
17
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Uniform.js | Source}
|
|
18
|
+
*/
|
|
1
19
|
export class Uniform<T = any> {
|
|
2
|
-
constructor(value: T);
|
|
3
20
|
/**
|
|
4
|
-
* @
|
|
21
|
+
* Create a new instance of {@link THREE.Uniform | Uniform}
|
|
22
|
+
* @param value An object containing the value to set up the uniform. It's type must be one of the Uniform Types described above.
|
|
5
23
|
*/
|
|
6
|
-
constructor(
|
|
24
|
+
constructor(value: T);
|
|
25
|
+
|
|
7
26
|
/**
|
|
8
|
-
*
|
|
27
|
+
* Current value of the uniform.
|
|
9
28
|
*/
|
|
10
|
-
type: string;
|
|
11
29
|
value: T;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use {@link Object3D#onBeforeRender object.onBeforeRender()} instead.
|
|
14
|
-
*/
|
|
15
|
-
dynamic: boolean;
|
|
16
30
|
|
|
17
31
|
/**
|
|
18
|
-
*
|
|
32
|
+
* Returns a clone of this uniform.
|
|
33
|
+
* @remarks
|
|
34
|
+
* If the uniform's {@link value} property is an {@link Object | Object} with a `clone()` method, this is used,
|
|
35
|
+
* otherwise the value is copied by assignment Array values are **shared** between cloned {@link THREE.UniformUniform | Uniform}s.
|
|
19
36
|
*/
|
|
20
|
-
|
|
37
|
+
clone(): Uniform<T>;
|
|
21
38
|
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { EventDispatcher } from './EventDispatcher';
|
|
2
2
|
import { Uniform } from './Uniform';
|
|
3
|
-
|
|
4
3
|
import { Usage } from '../constants';
|
|
5
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @see Example: {@link https://threejs.org/examples/#webgl2_ubo | WebGL2 / UBO}
|
|
7
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/UniformsGroup.js | Source}
|
|
8
|
+
*/
|
|
6
9
|
export class UniformsGroup extends EventDispatcher {
|
|
7
|
-
|
|
10
|
+
constructor();
|
|
11
|
+
|
|
12
|
+
readonly isUniformsGroup: true;
|
|
13
|
+
|
|
8
14
|
id: number;
|
|
15
|
+
|
|
9
16
|
usage: Usage;
|
|
10
|
-
uniforms: Uniform[];
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
uniforms: Uniform[];
|
|
13
19
|
|
|
14
20
|
add(uniform: Uniform): this;
|
|
15
21
|
|
three/src/extras/Earcut.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
export const Earcut: {
|
|
2
|
+
triangulate(data: number[], holeIndices?: number[], dim?: number): number[];
|
|
3
|
+
};
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import { BufferGeometry } from '../core/BufferGeometry';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* {@link BoxGeometry} is a geometry class for a rectangular cuboid with a given 'width', 'height', and 'depth'
|
|
5
|
+
* @remarks On creation, the cuboid is centred on the origin, with each edge parallel to one of the axes.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const geometry = new THREE.BoxGeometry(1, 1, 1);
|
|
9
|
+
* const material = new THREE.MeshBasicMaterial({
|
|
10
|
+
* color: 0x00ff00
|
|
11
|
+
* });
|
|
12
|
+
* const cube = new THREE.Mesh(geometry, material);
|
|
13
|
+
* scene.add(cube);
|
|
14
|
+
* ```
|
|
15
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/geometries/BoxGeometry | Official Documentation}
|
|
16
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/BoxGeometry.js | Source}
|
|
17
|
+
*/
|
|
3
18
|
export class BoxGeometry extends BufferGeometry {
|
|
4
19
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
20
|
+
* Create a new instance of {@link BoxGeometry}
|
|
21
|
+
* @param width Width; that is, the length of the edges parallel to the X axis. Optional; Expects a `Float`. Default `1`
|
|
22
|
+
* @param height Height; that is, the length of the edges parallel to the Y axis. Optional; Expects a `Float`. Default `1`
|
|
23
|
+
* @param depth Depth; that is, the length of the edges parallel to the Z axis. Optional; Expects a `Float`. Default `1`
|
|
24
|
+
* @param widthSegments Number of segmented rectangular faces along the width of the sides. Optional; Expects a `Integer`. Default `1`
|
|
25
|
+
* @param heightSegments Number of segmented rectangular faces along the height of the sides. Optional; Expects a `Integer`. Default `1`
|
|
26
|
+
* @param depthSegments Number of segmented rectangular faces along the depth of the sides. Optional; Expects a `Integer`. Default `1`
|
|
11
27
|
*/
|
|
12
28
|
constructor(
|
|
13
29
|
width?: number,
|
|
@@ -19,18 +35,25 @@ export class BoxGeometry extends BufferGeometry {
|
|
|
19
35
|
);
|
|
20
36
|
|
|
21
37
|
/**
|
|
22
|
-
*
|
|
38
|
+
* A Read-only _string_ to check if `this` object type.
|
|
39
|
+
* @remarks Sub-classes will update this value.
|
|
40
|
+
* @defaultValue `BoxGeometry`
|
|
23
41
|
*/
|
|
24
|
-
type: string;
|
|
42
|
+
override readonly type: string | 'BoxGeometry';
|
|
25
43
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
/**
|
|
45
|
+
* An object with a property for each of the constructor parameters.
|
|
46
|
+
* @remarks Any modification after instantiation does not change the geometry.
|
|
47
|
+
*/
|
|
48
|
+
readonly parameters: {
|
|
49
|
+
readonly width: number;
|
|
50
|
+
readonly height: number;
|
|
51
|
+
readonly depth: number;
|
|
52
|
+
readonly widthSegments: number;
|
|
53
|
+
readonly heightSegments: number;
|
|
54
|
+
readonly depthSegments: number;
|
|
33
55
|
};
|
|
34
56
|
|
|
35
|
-
|
|
57
|
+
/** @internal */
|
|
58
|
+
static fromJSON(data: {}): BoxGeometry;
|
|
36
59
|
}
|
|
@@ -1,25 +1,48 @@
|
|
|
1
1
|
import { BufferGeometry } from '../core/BufferGeometry';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* {@link CapsuleGeometry} is a geometry class for a capsule with given radii and height
|
|
5
|
+
* @remarks It is constructed using a lathe.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const geometry = new THREE.CapsuleGeometry(1, 1, 4, 8);
|
|
9
|
+
* const material = new THREE.MeshBasicMaterial({
|
|
10
|
+
* color: 0x00ff00
|
|
11
|
+
* });
|
|
12
|
+
* const capsule = new THREE.Mesh(geometry, material);
|
|
13
|
+
* scene.add(capsule);
|
|
14
|
+
* ```
|
|
15
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/geometries/CapsuleGeometry | Official Documentation}
|
|
16
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/CapsuleGeometry.js | Source}
|
|
17
|
+
*/
|
|
3
18
|
export class CapsuleGeometry extends BufferGeometry {
|
|
4
19
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
20
|
+
* Create a new instance of {@link CapsuleGeometry}
|
|
21
|
+
* @param radius Radius of the capsule. Expects a `Float`. Default `1`
|
|
22
|
+
* @param length Length of the middle section. Expects a `Float`. Default `1`
|
|
23
|
+
* @param capSubdivisions Number of curve segments used to build the caps. Expects a `Integer`. Default `4`
|
|
24
|
+
* @param radialSegments Number of segmented faces around the circumference of the capsule. Expects a `Integer`. Default `8`
|
|
9
25
|
*/
|
|
10
26
|
constructor(radius?: number, length?: number, capSegments?: number, radialSegments?: number);
|
|
11
27
|
|
|
12
28
|
/**
|
|
13
|
-
*
|
|
29
|
+
* A Read-only _string_ to check if `this` object type.
|
|
30
|
+
* @remarks Sub-classes will update this value.
|
|
31
|
+
* @defaultValue `CapsuleGeometry`
|
|
14
32
|
*/
|
|
15
|
-
type: string;
|
|
33
|
+
override readonly type: string | 'CapsuleGeometry';
|
|
16
34
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
/**
|
|
36
|
+
* An object with a property for each of the constructor parameters.
|
|
37
|
+
* @remarks Any modification after instantiation does not change the geometry.
|
|
38
|
+
*/
|
|
39
|
+
readonly parameters: {
|
|
40
|
+
readonly radius: number;
|
|
41
|
+
readonly length: number;
|
|
42
|
+
readonly capSegments: number;
|
|
43
|
+
readonly radialSegments: number;
|
|
22
44
|
};
|
|
23
45
|
|
|
24
|
-
|
|
46
|
+
/** @internal */
|
|
47
|
+
static fromJSON(data: {}): CapsuleGeometry;
|
|
25
48
|
}
|
|
@@ -1,25 +1,51 @@
|
|
|
1
1
|
import { BufferGeometry } from '../core/BufferGeometry';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* {@link CircleGeometry} is a simple shape of Euclidean geometry
|
|
5
|
+
* @remarks
|
|
6
|
+
* It is constructed from a number of triangular segments that are oriented around a central point and extend as far out as a given radius
|
|
7
|
+
* It is built counter-clockwise from a start angle and a given central angle
|
|
8
|
+
* It can also be used to create regular polygons, where the number of segments determines the number of sides.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const geometry = new THREE.CircleGeometry(5, 32);
|
|
12
|
+
* const material = new THREE.MeshBasicMaterial({
|
|
13
|
+
* color: 0xffff00
|
|
14
|
+
* });
|
|
15
|
+
* const circle = new THREE.Mesh(geometry, material);
|
|
16
|
+
* scene.add(circle);
|
|
17
|
+
* ```
|
|
18
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/geometries/CircleGeometry | Official Documentation}
|
|
19
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/CircleGeometry.js | Source}
|
|
20
|
+
*/
|
|
3
21
|
export class CircleGeometry extends BufferGeometry {
|
|
4
22
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
23
|
+
* Create a new instance of {@link CircleGeometry}
|
|
24
|
+
* @param radius Radius of the circle. Expects a `Float`. Default `1`
|
|
25
|
+
* @param segments Number of segments (triangles). Expects a `Integer`. Minimum `3`. Default `32`
|
|
26
|
+
* @param thetaStart Start angle for first segment. Expects a `Float`. Default `0`, _(three o'clock position)_.
|
|
27
|
+
* @param thetaLength The central angle, often called theta, of the circular sector. Expects a `Float`. Default `Math.PI * 2`, _which makes for a complete circle_.
|
|
9
28
|
*/
|
|
10
29
|
constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number);
|
|
11
30
|
|
|
12
31
|
/**
|
|
13
|
-
*
|
|
32
|
+
* A Read-only _string_ to check if `this` object type.
|
|
33
|
+
* @remarks Sub-classes will update this value.
|
|
34
|
+
* @defaultValue `CircleGeometry`
|
|
14
35
|
*/
|
|
15
|
-
type: string;
|
|
36
|
+
override readonly type: string | 'CircleGeometry';
|
|
16
37
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
/**
|
|
39
|
+
* An object with a property for each of the constructor parameters.
|
|
40
|
+
* @remarks Any modification after instantiation does not change the geometry.
|
|
41
|
+
*/
|
|
42
|
+
readonly parameters: {
|
|
43
|
+
readonly radius: number;
|
|
44
|
+
readonly segments: number;
|
|
45
|
+
readonly thetaStart: number;
|
|
46
|
+
readonly thetaLength: number;
|
|
22
47
|
};
|
|
23
48
|
|
|
24
|
-
|
|
49
|
+
/** @internal */
|
|
50
|
+
static fromJSON(data: {}): CircleGeometry;
|
|
25
51
|
}
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { CylinderGeometry } from './CylinderGeometry';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A class for generating cone geometries.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const geometry = new THREE.ConeGeometry(5, 20, 32);
|
|
8
|
+
* const material = new THREE.MeshBasicMaterial({
|
|
9
|
+
* color: 0xffff00
|
|
10
|
+
* });
|
|
11
|
+
* const cone = new THREE.Mesh(geometry, material);
|
|
12
|
+
* scene.add(cone);
|
|
13
|
+
* ```
|
|
14
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/geometries/ConeGeometry | Official Documentation}
|
|
15
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/ConeGeometry.js | Source}
|
|
16
|
+
*/
|
|
3
17
|
export class ConeGeometry extends CylinderGeometry {
|
|
4
18
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
19
|
+
* Create a new instance of {@link ConeGeometry}
|
|
20
|
+
* @param radius Radius of the cone base. Expects a `Float`. Default `1`
|
|
21
|
+
* @param height Height of the cone. Expects a `Float`. Default `1`
|
|
22
|
+
* @param radialSegments Number of segmented faces around the circumference of the cone. Expects a `Integer`. Default `32`
|
|
23
|
+
* @param heightSegments Number of rows of faces along the height of the cone. Expects a `Integer`. Default `1`
|
|
24
|
+
* @param openEnded A Boolean indicating whether the base of the cone is open or capped. Default `false`, _meaning capped_.
|
|
25
|
+
* @param thetaStart Start angle for first segment. Expects a `Float`. Default `0`, _(three o'clock position)_.
|
|
26
|
+
* @param thetaLength The central angle, often called theta, of the circular sector. Expects a `Float`. Default `Math.PI * 2`, _which makes for a complete cone_.
|
|
12
27
|
*/
|
|
13
28
|
constructor(
|
|
14
29
|
radius?: number,
|
|
@@ -21,9 +36,29 @@ export class ConeGeometry extends CylinderGeometry {
|
|
|
21
36
|
);
|
|
22
37
|
|
|
23
38
|
/**
|
|
24
|
-
*
|
|
39
|
+
* A Read-only _string_ to check if `this` object type.
|
|
40
|
+
* @remarks Sub-classes will update this value.
|
|
41
|
+
* @defaultValue `ConeGeometry`
|
|
25
42
|
*/
|
|
26
|
-
type: string;
|
|
43
|
+
override readonly type: string | 'ConeGeometry';
|
|
27
44
|
|
|
28
|
-
|
|
45
|
+
/**
|
|
46
|
+
* An object with a property for each of the constructor parameters.
|
|
47
|
+
* @remarks {@link radiusTop} and {@link radiusBottom} are from base {@link THREE.CylinderGeometry} class.
|
|
48
|
+
* @remarks Any modification after instantiation does not change the geometry.
|
|
49
|
+
*/
|
|
50
|
+
override readonly parameters: {
|
|
51
|
+
readonly radius: number;
|
|
52
|
+
readonly radiusTop: number;
|
|
53
|
+
readonly radiusBottom: number;
|
|
54
|
+
readonly height: number;
|
|
55
|
+
readonly radialSegments: number;
|
|
56
|
+
readonly heightSegments: number;
|
|
57
|
+
readonly openEnded: boolean;
|
|
58
|
+
readonly thetaStart: number;
|
|
59
|
+
readonly thetaLength: number;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
static fromJSON(data: {}): ConeGeometry;
|
|
29
64
|
}
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import { BufferGeometry } from '../core/BufferGeometry';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A class for generating cylinder geometries.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const geometry = new THREE.CylinderGeometry(5, 5, 20, 32);
|
|
8
|
+
* const material = new THREE.MeshBasicMaterial({
|
|
9
|
+
* color: 0xffff00
|
|
10
|
+
* });
|
|
11
|
+
* const cylinder = new THREE.Mesh(geometry, material);
|
|
12
|
+
* scene.add(cylinder);
|
|
13
|
+
* ```
|
|
14
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/geometries/CylinderGeometry | Official Documentation}
|
|
15
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/CylinderGeometry.js | Source}
|
|
16
|
+
*/
|
|
3
17
|
export class CylinderGeometry extends BufferGeometry {
|
|
4
18
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
19
|
+
* Create a new instance of {@link CylinderGeometry}
|
|
20
|
+
* @param radiusTop Radius of the cylinder at the top. Default `1`
|
|
21
|
+
* @param radiusBottom Radius of the cylinder at the bottom. Default `1`
|
|
22
|
+
* @param height Height of the cylinder. Default `1`
|
|
23
|
+
* @param radialSegments Number of segmented faces around the circumference of the cylinder. Default `32`
|
|
24
|
+
* @param heightSegments Number of rows of faces along the height of the cylinder. Expects a `Integer`. Default `1`
|
|
25
|
+
* @param openEnded A Boolean indicating whether the ends of the cylinder are open or capped. Default `false`, _meaning capped_.
|
|
26
|
+
* @param thetaStart Start angle for first segment. Default `0`, _(three o'clock position)_.
|
|
27
|
+
* @param thetaLength The central angle, often called theta, of the circular sector. Default `Math.PI * 2`, _which makes for a complete cylinder.
|
|
13
28
|
*/
|
|
14
29
|
constructor(
|
|
15
30
|
radiusTop?: number,
|
|
@@ -23,20 +38,27 @@ export class CylinderGeometry extends BufferGeometry {
|
|
|
23
38
|
);
|
|
24
39
|
|
|
25
40
|
/**
|
|
26
|
-
*
|
|
41
|
+
* A Read-only _string_ to check if `this` object type.
|
|
42
|
+
* @remarks Sub-classes will update this value.
|
|
43
|
+
* @defaultValue `CylinderGeometry`
|
|
27
44
|
*/
|
|
28
|
-
type: string;
|
|
45
|
+
override readonly type: string | 'CylinderGeometry';
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
/**
|
|
48
|
+
* An object with a property for each of the constructor parameters.
|
|
49
|
+
* @remarks Any modification after instantiation does not change the geometry.
|
|
50
|
+
*/
|
|
51
|
+
readonly parameters: {
|
|
52
|
+
readonly radiusTop: number;
|
|
53
|
+
readonly radiusBottom: number;
|
|
54
|
+
readonly height: number;
|
|
55
|
+
readonly radialSegments: number;
|
|
56
|
+
readonly heightSegments: number;
|
|
57
|
+
readonly openEnded: boolean;
|
|
58
|
+
readonly thetaStart: number;
|
|
59
|
+
readonly thetaLength: number;
|
|
39
60
|
};
|
|
40
61
|
|
|
62
|
+
/** @internal */
|
|
41
63
|
static fromJSON(data: any): CylinderGeometry;
|
|
42
64
|
}
|