@types/three 0.157.2 → 0.158.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.
Files changed (82) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +290 -0
  3. three/examples/jsm/controls/OrbitControls.d.ts +18 -0
  4. three/examples/jsm/libs/lil-gui.module.min.d.ts +5 -5
  5. three/examples/jsm/lights/IESSpotLight.d.ts +5 -0
  6. three/examples/jsm/loaders/IESLoader.d.ts +5 -0
  7. three/examples/jsm/loaders/KTX2Loader.d.ts +2 -1
  8. three/examples/jsm/loaders/LogLuvLoader.d.ts +1 -1
  9. three/examples/jsm/loaders/PCDLoader.d.ts +3 -3
  10. three/examples/jsm/math/Capsule.d.ts +0 -1
  11. three/examples/jsm/misc/MD2CharacterComplex.d.ts +9 -1
  12. three/examples/jsm/objects/BatchedMesh.d.ts +57 -0
  13. three/examples/jsm/objects/ReflectorForSSRPass.d.ts +1 -0
  14. three/examples/jsm/objects/Refractor.d.ts +2 -1
  15. three/examples/jsm/physics/AmmoPhysics.d.ts +2 -1
  16. three/examples/jsm/physics/RapierPhysics.d.ts +2 -1
  17. three/examples/jsm/renderers/SVGRenderer.d.ts +2 -1
  18. three/examples/jsm/renderers/common/Backend.d.ts +15 -0
  19. three/examples/jsm/renderers/common/Info.d.ts +15 -0
  20. three/examples/jsm/renderers/common/Renderer.d.ts +42 -0
  21. three/examples/jsm/renderers/webgpu/WebGPURenderer.d.ts +9 -0
  22. three/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts +1 -0
  23. three/examples/jsm/shaders/AfterimageShader.d.ts +1 -0
  24. three/examples/jsm/shaders/BasicShader.d.ts +1 -0
  25. three/examples/jsm/shaders/BlendShader.d.ts +1 -0
  26. three/examples/jsm/shaders/BokehShader.d.ts +1 -0
  27. three/examples/jsm/shaders/BokehShader2.d.ts +2 -0
  28. three/examples/jsm/shaders/BrightnessContrastShader.d.ts +1 -0
  29. three/examples/jsm/shaders/ColorCorrectionShader.d.ts +1 -0
  30. three/examples/jsm/shaders/DOFMipMapShader.d.ts +1 -0
  31. three/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +1 -0
  32. three/examples/jsm/shaders/ExposureShader.d.ts +11 -0
  33. three/examples/jsm/shaders/FXAAShader.d.ts +1 -0
  34. three/examples/jsm/shaders/FocusShader.d.ts +1 -0
  35. three/examples/jsm/shaders/FreiChenShader.d.ts +1 -0
  36. three/examples/jsm/shaders/GodRaysShader.d.ts +4 -0
  37. three/examples/jsm/shaders/HalftoneShader.d.ts +1 -0
  38. three/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +1 -0
  39. three/examples/jsm/shaders/HueSaturationShader.d.ts +1 -0
  40. three/examples/jsm/shaders/KaleidoShader.d.ts +1 -0
  41. three/examples/jsm/shaders/LuminosityHighPassShader.d.ts +1 -0
  42. three/examples/jsm/shaders/LuminosityShader.d.ts +1 -0
  43. three/examples/jsm/shaders/MMDToonShader.d.ts +15 -0
  44. three/examples/jsm/shaders/MirrorShader.d.ts +1 -0
  45. three/examples/jsm/shaders/NormalMapShader.d.ts +1 -0
  46. three/examples/jsm/shaders/OutputShader.d.ts +1 -0
  47. three/examples/jsm/shaders/SAOShader.d.ts +1 -0
  48. three/examples/jsm/shaders/SMAAShader.d.ts +3 -0
  49. three/examples/jsm/shaders/SSAOShader.d.ts +3 -0
  50. three/examples/jsm/shaders/SSRShader.d.ts +3 -0
  51. three/examples/jsm/shaders/SobelOperatorShader.d.ts +1 -0
  52. three/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts +1 -0
  53. three/examples/jsm/shaders/TechnicolorShader.d.ts +1 -0
  54. three/examples/jsm/shaders/TriangleBlurShader.d.ts +1 -0
  55. three/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +1 -0
  56. three/examples/jsm/shaders/VelocityShader.d.ts +1 -0
  57. three/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +1 -0
  58. three/examples/jsm/shaders/WaterRefractionShader.d.ts +1 -0
  59. three/examples/jsm/utils/GPUStatsPanel.d.ts +12 -0
  60. three/examples/jsm/utils/TextureUtils.d.ts +3 -0
  61. three/examples/jsm/utils/WorkerPool.d.ts +26 -0
  62. three/examples/jsm/webxr/XRButton.d.ts +1 -1
  63. three/examples/jsm/webxr/XREstimatedLight.d.ts +32 -0
  64. three/package.json +3 -2
  65. three/src/cameras/CubeCamera.d.ts +1 -2
  66. three/src/constants.d.ts +21 -10
  67. three/src/core/Object3D.d.ts +4 -4
  68. three/src/core/Raycaster.d.ts +1 -0
  69. three/src/extras/core/Curve.d.ts +1 -1
  70. three/src/geometries/CapsuleGeometry.d.ts +1 -1
  71. three/src/helpers/AxesHelper.d.ts +2 -2
  72. three/src/helpers/Box3Helper.d.ts +2 -2
  73. three/src/lights/Light.d.ts +1 -2
  74. three/src/materials/Material.d.ts +20 -2
  75. three/src/materials/MeshPhysicalMaterial.d.ts +8 -6
  76. three/src/math/ColorManagement.d.ts +1 -1
  77. three/src/math/Matrix4.d.ts +2 -1
  78. three/src/objects/SkinnedMesh.d.ts +9 -8
  79. three/src/renderers/WebGLRenderer.d.ts +12 -2
  80. three/src/scenes/Scene.d.ts +2 -2
  81. three/src/textures/DepthTexture.d.ts +3 -3
  82. three/src/textures/Texture.d.ts +2 -2
@@ -235,14 +235,14 @@ export class Object3D<TEventMap extends Object3DEventMap = Object3DEventMap> ext
235
235
  * are not renderable and thus this callback is not executed for such objects.
236
236
  * @defaultValue `() => {}`
237
237
  */
238
- onBeforeRender: (
238
+ onBeforeRender(
239
239
  renderer: WebGLRenderer,
240
240
  scene: Scene,
241
241
  camera: Camera,
242
242
  geometry: BufferGeometry,
243
243
  material: Material,
244
244
  group: Group,
245
- ) => void;
245
+ ): void;
246
246
 
247
247
  /**
248
248
  * An optional callback that is executed immediately after a 3D object is rendered.
@@ -254,14 +254,14 @@ export class Object3D<TEventMap extends Object3DEventMap = Object3DEventMap> ext
254
254
  * are not renderable and thus this callback is not executed for such objects.
255
255
  * @defaultValue `() => {}`
256
256
  */
257
- onAfterRender: (
257
+ onAfterRender(
258
258
  renderer: WebGLRenderer,
259
259
  scene: Scene,
260
260
  camera: Camera,
261
261
  geometry: BufferGeometry,
262
262
  material: Material,
263
263
  group: Group,
264
- ) => void;
264
+ ): void;
265
265
 
266
266
  /**
267
267
  * The default {@link up} direction for objects, also used as the default position for {@link THREE.DirectionalLight | DirectionalLight},
@@ -31,6 +31,7 @@ export interface Intersection<TIntersected extends Object3D = Object3D> {
31
31
  normal?: Vector3;
32
32
  /** The index number of the instance where the ray intersects the {@link THREE.InstancedMesh | InstancedMesh } */
33
33
  instanceId?: number | undefined;
34
+ pointOnLine?: Vector3;
34
35
  }
35
36
 
36
37
  export interface RaycasterParameters {
@@ -82,7 +82,7 @@ export abstract class Curve<T extends Vector> {
82
82
  getLengths(divisions?: number): number[];
83
83
 
84
84
  /**
85
- * Update the cumlative segment distance cache
85
+ * Update the cumulative segment distance cache
86
86
  * @remarks
87
87
  * The method must be called every time {@link Curve} parameters are changed
88
88
  * If an updated {@link Curve} is part of a composed {@link Curve} like {@link THREE.CurvePath | CurvePath},
@@ -20,7 +20,7 @@ export class CapsuleGeometry extends BufferGeometry {
20
20
  * Create a new instance of {@link CapsuleGeometry}
21
21
  * @param radius Radius of the capsule. Expects a `Float`. Default `1`
22
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`
23
+ * @param capSegments Number of curve segments used to build the caps. Expects a `Integer`. Default `4`
24
24
  * @param radialSegments Number of segmented faces around the circumference of the capsule. Expects a `Integer`. Default `8`
25
25
  */
26
26
  constructor(radius?: number, length?: number, capSegments?: number, radialSegments?: number);
@@ -1,4 +1,4 @@
1
- import { Color } from '../math/Color.js';
1
+ import { ColorRepresentation } from '../math/Color.js';
2
2
  import { LineSegments } from './../objects/LineSegments.js';
3
3
 
4
4
  /**
@@ -39,7 +39,7 @@ export class AxesHelper extends LineSegments {
39
39
  * @param yAxisColor
40
40
  * @param zAxisColor
41
41
  */
42
- setColors(xAxisColor: Color, yAxisColor: Color, zAxisColor: Color): this;
42
+ setColors(xAxisColor: ColorRepresentation, yAxisColor: ColorRepresentation, zAxisColor: ColorRepresentation): this;
43
43
 
44
44
  /**
45
45
  * Frees the GPU-related resources allocated by this instance
@@ -1,5 +1,5 @@
1
1
  import { Box3 } from './../math/Box3.js';
2
- import { Color } from './../math/Color.js';
2
+ import { ColorRepresentation } from './../math/Color.js';
3
3
  import { LineSegments } from './../objects/LineSegments.js';
4
4
 
5
5
  /**
@@ -20,7 +20,7 @@ export class Box3Helper extends LineSegments {
20
20
  * @param box The Box3 to show.
21
21
  * @param color The box's color. Default `0xffff00`
22
22
  */
23
- constructor(box: Box3, color?: Color);
23
+ constructor(box: Box3, color?: ColorRepresentation);
24
24
 
25
25
  /**
26
26
  * A Read-only _string_ to check if `this` object type.
@@ -38,8 +38,7 @@ export abstract class Light<TShadowSupport extends LightShadow | undefined = Lig
38
38
 
39
39
  /**
40
40
  * The light's intensity, or strength.
41
- * When {@link THREE.WebGLRenderer.useLegacyLights | legacy lighting mode} is disabled, the units of intensity depend on the type of light.
42
- * @remarks Expects a `Float`
41
+ * The units of intensity depend on the type of light.
43
42
  * @defaultValue `1`
44
43
  */
45
44
  intensity: number;
@@ -13,11 +13,14 @@ import {
13
13
  StencilOp,
14
14
  PixelFormat,
15
15
  } from '../constants.js';
16
+ import { Color, ColorRepresentation } from '../math/Color.js';
16
17
 
17
18
  export interface MaterialParameters {
18
19
  alphaHash?: boolean | undefined;
19
20
  alphaTest?: number | undefined;
20
21
  alphaToCoverage?: boolean | undefined;
22
+ blendAlpha?: number | undefined;
23
+ blendColor?: ColorRepresentation | undefined;
21
24
  blendDst?: BlendingDstFactor | undefined;
22
25
  blendDstAlpha?: number | undefined;
23
26
  blendEquation?: BlendingEquation | undefined;
@@ -86,6 +89,20 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
86
89
  */
87
90
  alphaToCoverage: boolean;
88
91
 
92
+ /**
93
+ * Represents the alpha value of the constant blend color. This property has only an effect when using custom
94
+ * blending with {@link ConstantAlphaFactor} or {@link OneMinusConstantAlphaFactor}.
95
+ * @default 0
96
+ */
97
+ blendAlpha: number;
98
+
99
+ /**
100
+ * Represent the RGB values of the constant blend color. This property has only an effect when using custom
101
+ * blending with {@link ConstantColorFactor} or {@link OneMinusConstantColorFactor}.
102
+ * @default 0x000000
103
+ */
104
+ blendColor: Color;
105
+
89
106
  /**
90
107
  * Blending destination. It's one of the blending mode constants defined in Three.js. Default is {@link OneMinusSrcAlphaFactor}.
91
108
  * @default THREE.OneMinusSrcAlphaFactor
@@ -141,7 +158,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
141
158
  * See the WebGL / clipping /intersection example. Default is null.
142
159
  * @default null
143
160
  */
144
- clippingPlanes: Plane[];
161
+ clippingPlanes: Plane[] | null;
145
162
 
146
163
  /**
147
164
  * Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.
@@ -169,7 +186,8 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
169
186
  depthFunc: DepthModes;
170
187
 
171
188
  /**
172
- * Whether to have depth test enabled when rendering this material. Default is true.
189
+ * Whether to have depth test enabled when rendering this material. When the depth test is disabled, the depth write
190
+ * will also be implicitly disabled.
173
191
  * @default true
174
192
  */
175
193
  depthTest: boolean;
@@ -1,7 +1,7 @@
1
- import { Texture } from './../textures/Texture.js';
2
- import { Vector2 } from './../math/Vector2.js';
1
+ import { Texture } from '../textures/Texture.js';
2
+ import { Vector2 } from '../math/Vector2.js';
3
3
  import { MeshStandardMaterialParameters, MeshStandardMaterial } from './MeshStandardMaterial.js';
4
- import { Color } from './../math/Color.js';
4
+ import { Color, ColorRepresentation } from '../math/Color.js';
5
5
 
6
6
  export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialParameters {
7
7
  clearcoat?: number | undefined;
@@ -15,7 +15,7 @@ export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialPara
15
15
  ior?: number | undefined;
16
16
 
17
17
  sheen?: number | undefined;
18
- sheenColor?: Color | undefined;
18
+ sheenColor?: ColorRepresentation | undefined;
19
19
  sheenColorMap?: Texture | null | undefined;
20
20
  sheenRoughness?: number | undefined;
21
21
  sheenRoughnessMap?: Texture | null | undefined;
@@ -27,10 +27,10 @@ export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialPara
27
27
  thicknessMap?: Texture | null | undefined;
28
28
 
29
29
  attenuationDistance?: number | undefined;
30
- attenuationColor?: Color | undefined;
30
+ attenuationColor?: ColorRepresentation | undefined;
31
31
 
32
32
  specularIntensity?: number | undefined;
33
- specularColor?: Color | undefined;
33
+ specularColor?: ColorRepresentation | undefined;
34
34
  specularIntensityMap?: Texture | null | undefined;
35
35
  specularColorMap?: Texture | null | undefined;
36
36
 
@@ -48,6 +48,8 @@ export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialPara
48
48
  export class MeshPhysicalMaterial extends MeshStandardMaterial {
49
49
  constructor(parameters?: MeshPhysicalMaterialParameters);
50
50
 
51
+ isMeshPhysicalMaterial: boolean;
52
+
51
53
  /**
52
54
  * @default 'MeshPhysicalMaterial'
53
55
  */
@@ -26,7 +26,7 @@ export interface ColorManagement {
26
26
  * @default LinearSRGBColorSpace
27
27
  */
28
28
  get workingColorSpace(): WorkingColorSpace;
29
- set workingSpaceColor(colorSpace: WorkingColorSpace);
29
+ set workingColorSpace(colorSpace: WorkingColorSpace);
30
30
 
31
31
  convert: (color: Color, sourceColorSpace: DefinedColorSpace, targetColorSpace: DefinedColorSpace) => Color;
32
32
 
@@ -156,7 +156,8 @@ export class Matrix4 implements Matrix {
156
156
  /**
157
157
  * Sets the position component for this matrix from vector v.
158
158
  */
159
- setPosition(v: Vector3 | number, y?: number, z?: number): Matrix4;
159
+ setPosition(v: Vector3): Matrix4;
160
+ setPosition(x: number, y: number, z: number): Matrix4;
160
161
 
161
162
  /**
162
163
  * Inverts this matrix.
@@ -1,11 +1,12 @@
1
- import { Material } from './../materials/Material.js';
1
+ import { Material } from '../materials/Material.js';
2
2
  import { Box3 } from '../math/Box3.js';
3
- import { Matrix4 } from './../math/Matrix4.js';
4
- import { Vector3 } from './../math/Vector3.js';
3
+ import { Matrix4 } from '../math/Matrix4.js';
4
+ import { Vector3 } from '../math/Vector3.js';
5
5
  import { Skeleton } from './Skeleton.js';
6
6
  import { Mesh } from './Mesh.js';
7
7
  import { BufferGeometry } from '../core/BufferGeometry.js';
8
8
  import { Sphere } from '../math/Sphere.js';
9
+ import { BindMode } from '../constants.js';
9
10
 
10
11
  /**
11
12
  * A mesh that has a {@link THREE.Skeleton | Skeleton} with {@link Bone | bones} that can then be used to animate the vertices of the geometry.
@@ -72,12 +73,12 @@ export class SkinnedMesh<
72
73
  override readonly type: string | 'SkinnedMesh';
73
74
 
74
75
  /**
75
- * Either `attached` or `detached`.
76
- * - `attached` uses the {@link THREE.SkinnedMesh.matrixWorld | SkinnedMesh.matrixWorld} property for the base transform matrix of the bones.
77
- * - `detached` uses the {@link THREE.SkinnedMesh.bindMatrix | SkinnedMesh.bindMatrix}.
78
- * @defaultValue `attached`.
76
+ * Either {@link AttachedBindMode} or {@link DetachedBindMode}. {@link AttachedBindMode} means the skinned mesh
77
+ * shares the same world space as the skeleton. This is not true when using {@link DetachedBindMode} which is useful
78
+ * when sharing a skeleton across multiple skinned meshes.
79
+ * @defaultValue `AttachedBindMode`
79
80
  */
80
- bindMode: 'attached' | 'detached';
81
+ bindMode: BindMode;
81
82
 
82
83
  /**
83
84
  * The base matrix that is used for the bound bone transforms.
@@ -370,9 +370,19 @@ export class WebGLRenderer implements Renderer {
370
370
  animate(callback: () => void): void;
371
371
 
372
372
  /**
373
- * Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first rendering.
373
+ * Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first
374
+ * rendering. If you want to add a 3D object to an existing scene, use the third optional parameter for applying the
375
+ * target scene.
376
+ * Note that the (target) scene's lighting should be configured before calling this method.
374
377
  */
375
- compile(scene: Object3D, camera: Camera): void;
378
+ compile: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Set<Material>;
379
+
380
+ /**
381
+ * Asynchronous version of {@link compile}(). The method returns a Promise that resolves when the given scene can be
382
+ * rendered without unnecessary stalling due to shader compilation.
383
+ * This method makes use of the KHR_parallel_shader_compile WebGL extension.
384
+ */
385
+ compileAsync: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Promise<Object3D>;
376
386
 
377
387
  /**
378
388
  * Render a scene or an object using a camera.
@@ -1,6 +1,6 @@
1
1
  import { FogBase } from './Fog.js';
2
- import { Material } from './../materials/Material.js';
3
- import { Object3D } from './../core/Object3D.js';
2
+ import { Material } from '../materials/Material.js';
3
+ import { Object3D } from '../core/Object3D.js';
4
4
  import { Color } from '../math/Color.js';
5
5
  import { Texture } from '../textures/Texture.js';
6
6
  import { CubeTexture } from '../Three.js';
@@ -3,7 +3,7 @@ import {
3
3
  Mapping,
4
4
  Wrapping,
5
5
  TextureDataType,
6
- DeepTexturePixelFormat,
6
+ DepthTexturePixelFormat,
7
7
  MagnificationTextureFilter,
8
8
  MinificationTextureFilter,
9
9
  TextureComparisonFunction,
@@ -42,7 +42,7 @@ export class DepthTexture extends Texture {
42
42
  magFilter?: MagnificationTextureFilter,
43
43
  minFilter?: MinificationTextureFilter,
44
44
  anisotropy?: number,
45
- format?: DeepTexturePixelFormat,
45
+ format?: DepthTexturePixelFormat,
46
46
  );
47
47
 
48
48
  /**
@@ -88,7 +88,7 @@ export class DepthTexture extends Texture {
88
88
  * @see {@link Texture.format | Texture.format}
89
89
  * @defaultValue {@link THREE.DepthFormat}.
90
90
  */
91
- format: DeepTexturePixelFormat;
91
+ format: DepthTexturePixelFormat;
92
92
 
93
93
  /**
94
94
  * @override
@@ -201,8 +201,8 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
201
201
 
202
202
  /**
203
203
  * These define how elements of a 2D texture, or texels, are read by shaders.
204
- * @remarks All {@link Texture} types except {@link THREE.DeepTexture} and {@link THREE.CompressedPixelFormat} expect the _values_ be {@link THREE.PixelFormat}
205
- * @remarks {@link DeepTexture} expect the _values_ be {@link THREE.CubeTextureMapping}
204
+ * @remarks All {@link Texture} types except {@link THREE.DepthTexture} and {@link THREE.CompressedPixelFormat} expect the _values_ be {@link THREE.PixelFormat}
205
+ * @remarks {@link DepthTexture} expect the _values_ be {@link THREE.CubeTextureMapping}
206
206
  * @remarks {@link CompressedPixelFormat} expect the _values_ be {@link THREE.CubeTextureMapping}
207
207
  * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
208
208
  * @see {@link THREE.PixelFormat}