@types/three 0.144.0 → 0.147.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.
Files changed (100) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/animation/CCDIKSolver.d.ts +9 -4
  3. three/examples/jsm/animation/MMDPhysics.d.ts +6 -1
  4. three/examples/jsm/controls/OrbitControls.d.ts +198 -2
  5. three/examples/jsm/csm/CSMHelper.d.ts +1 -0
  6. three/examples/jsm/helpers/OctreeHelper.d.ts +3 -0
  7. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  8. three/examples/jsm/helpers/VertexTangentsHelper.d.ts +2 -0
  9. three/examples/jsm/interactive/SelectionHelper.d.ts +1 -0
  10. three/examples/jsm/loaders/PCDLoader.d.ts +1 -1
  11. three/examples/jsm/loaders/PLYLoader.d.ts +2 -0
  12. three/examples/jsm/loaders/RGBELoader.d.ts +0 -1
  13. three/examples/jsm/loaders/USDZLoader.d.ts +18 -0
  14. three/examples/jsm/nodes/Nodes.d.ts +21 -2
  15. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +18 -0
  16. three/examples/jsm/nodes/accessors/NormalNode.d.ts +1 -6
  17. three/examples/jsm/nodes/accessors/PositionNode.d.ts +2 -0
  18. three/examples/jsm/nodes/accessors/TangentNode.d.ts +18 -0
  19. three/examples/jsm/nodes/core/NodeBuilder.d.ts +8 -3
  20. three/examples/jsm/nodes/core/NodeVarying.d.ts +8 -0
  21. three/examples/jsm/nodes/core/constants.d.ts +13 -13
  22. three/examples/jsm/nodes/display/BlendModeNode.d.ts +32 -0
  23. three/examples/jsm/nodes/display/PosterizeNode.d.ts +8 -0
  24. three/examples/jsm/nodes/display/ViewportNode.d.ts +23 -0
  25. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +94 -0
  26. three/examples/jsm/nodes/materialx/{functions/lib → lib}/mx_hsv.d.ts +1 -1
  27. three/examples/jsm/nodes/materialx/{functions/lib → lib}/mx_noise.d.ts +1 -1
  28. three/examples/jsm/nodes/math/MathNode.d.ts +1 -2
  29. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +24 -2
  30. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +38 -0
  31. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +6 -0
  32. three/examples/jsm/nodes/utils/RemapNode.d.ts +13 -0
  33. three/examples/jsm/nodes/utils/TimerNode.d.ts +6 -1
  34. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +22 -0
  35. three/examples/jsm/objects/ShadowMesh.d.ts +6 -3
  36. three/examples/jsm/postprocessing/AdaptiveToneMappingPass.d.ts +2 -2
  37. three/examples/jsm/postprocessing/AfterimagePass.d.ts +3 -3
  38. three/examples/jsm/postprocessing/BloomPass.d.ts +3 -3
  39. three/examples/jsm/postprocessing/BokehPass.d.ts +2 -4
  40. three/examples/jsm/postprocessing/ClearPass.d.ts +1 -1
  41. three/examples/jsm/postprocessing/CubeTexturePass.d.ts +1 -1
  42. three/examples/jsm/postprocessing/DotScreenPass.d.ts +2 -2
  43. three/examples/jsm/postprocessing/EffectComposer.d.ts +2 -1
  44. three/examples/jsm/postprocessing/FilmPass.d.ts +2 -2
  45. three/examples/jsm/postprocessing/GlitchPass.d.ts +2 -2
  46. three/examples/jsm/postprocessing/HalftonePass.d.ts +2 -2
  47. three/examples/jsm/postprocessing/MaskPass.d.ts +1 -1
  48. three/examples/jsm/postprocessing/OutlinePass.d.ts +2 -2
  49. three/examples/jsm/postprocessing/Pass.d.ts +2 -0
  50. three/examples/jsm/postprocessing/RenderPass.d.ts +1 -1
  51. three/examples/jsm/postprocessing/RenderPixelatedPass.d.ts +28 -0
  52. three/examples/jsm/postprocessing/SAOPass.d.ts +2 -2
  53. three/examples/jsm/postprocessing/SMAAPass.d.ts +2 -2
  54. three/examples/jsm/postprocessing/SSAARenderPass.d.ts +2 -2
  55. three/examples/jsm/postprocessing/SSAOPass.d.ts +2 -2
  56. three/examples/jsm/postprocessing/SavePass.d.ts +2 -2
  57. three/examples/jsm/postprocessing/ShaderPass.d.ts +2 -2
  58. three/examples/jsm/postprocessing/TexturePass.d.ts +2 -2
  59. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +2 -2
  60. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +5 -4
  61. three/examples/jsm/shaders/VelocityShader.d.ts +13 -0
  62. three/examples/jsm/utils/BufferGeometryUtils.d.ts +11 -0
  63. three/examples/jsm/utils/SceneUtils.d.ts +9 -1
  64. three/examples/jsm/webxr/OculusHandPointerModel.d.ts +2 -2
  65. three/index.d.ts +1 -1
  66. three/package.json +3 -3
  67. three/src/Three.d.ts +2 -0
  68. three/src/core/Object3D.d.ts +9 -1
  69. three/src/helpers/ArrowHelper.d.ts +4 -0
  70. three/src/helpers/Box3Helper.d.ts +2 -0
  71. three/src/helpers/BoxHelper.d.ts +2 -0
  72. three/src/helpers/GridHelper.d.ts +1 -4
  73. three/src/helpers/PlaneHelper.d.ts +2 -0
  74. three/src/helpers/PolarGridHelper.d.ts +2 -0
  75. three/src/helpers/SkeletonHelper.d.ts +2 -0
  76. three/src/lights/PointLight.d.ts +1 -1
  77. three/src/lights/SpotLight.d.ts +7 -1
  78. three/src/loaders/DataTextureLoader.d.ts +1 -1
  79. three/src/materials/MeshLambertMaterial.d.ts +1 -1
  80. three/src/math/ColorManagement.d.ts +11 -1
  81. three/src/math/Euler.d.ts +13 -11
  82. three/src/math/Matrix3.d.ts +46 -0
  83. three/src/math/Quaternion.d.ts +10 -1
  84. three/src/objects/LOD.d.ts +22 -2
  85. three/src/renderers/WebGL3DRenderTarget.d.ts +1 -1
  86. three/src/renderers/WebGLArrayRenderTarget.d.ts +1 -1
  87. three/src/renderers/WebGLCubeRenderTarget.d.ts +1 -1
  88. three/src/renderers/WebGLMultipleRenderTargets.d.ts +1 -1
  89. three/src/renderers/WebGLRenderTarget.d.ts +1 -1
  90. three/src/renderers/WebGLRenderer.d.ts +1 -5
  91. three/src/renderers/shaders/UniformsLib.d.ts +3 -2
  92. three/src/renderers/webgl/WebGLCapabilities.d.ts +1 -0
  93. three/src/renderers/webxr/WebXRController.d.ts +6 -1
  94. three/src/renderers/webxr/WebXRManager.d.ts +8 -0
  95. three/src/scenes/Scene.d.ts +16 -5
  96. three/src/textures/CanvasTexture.d.ts +2 -2
  97. three/src/textures/CompressedArrayTexture.d.ts +17 -0
  98. three/src/textures/Texture.d.ts +10 -2
  99. three/examples/jsm/nodes/core/NodeVary.d.ts +0 -6
  100. three/examples/jsm/shaders/PixelShader.d.ts +0 -11
@@ -8,17 +8,37 @@ export class LOD extends Object3D {
8
8
 
9
9
  type: 'LOD';
10
10
 
11
- levels: Array<{ distance: number; object: Object3D }>;
11
+ /**
12
+ *
13
+ * An array of level objects
14
+ *
15
+ * Each level is an object with the following properties:
16
+ *
17
+ * - object - The Object3D to display at this level.
18
+ * - distance - The distance at which to display this level of detail.
19
+ * - hysteresis - Threshold used to avoid flickering at LOD boundaries, as a fraction of distance.
20
+ */
21
+ levels: Array<{ distance: number; hysteresis: number; object: Object3D }>;
22
+
12
23
  autoUpdate: boolean;
13
24
  readonly isLOD: true;
14
25
 
15
- addLevel(object: Object3D, distance?: number): this;
26
+ /**
27
+ * Adds a mesh that will display at a certain distance and greater. Typically the further away the distance, the lower the detail on the mesh.
28
+ *
29
+ * @param object The Object3D to display at this level.
30
+ * @param distance The distance at which to display this level of detail. Default 0.0.
31
+ * @param hysteresis Threshold used to avoid flickering at LOD boundaries, as a fraction of distance. Default 0.0.
32
+ */
33
+ addLevel(object: Object3D, distance?: number, hysteresis?: number): this;
34
+
16
35
  getCurrentLevel(): number;
17
36
  getObjectForDistance(distance: number): Object3D | null;
18
37
  raycast(raycaster: Raycaster, intersects: Intersection[]): void;
19
38
  update(camera: Camera): void;
20
39
  toJSON(meta: any): any;
21
40
 
41
+ // TODO: Remove this
22
42
  /**
23
43
  * @deprecated Use {@link LOD#levels .levels} instead.
24
44
  */
@@ -12,7 +12,7 @@ export class WebGL3DRenderTarget extends WebGLRenderTarget {
12
12
  * @param height the height of the render target, in pixels.
13
13
  * @param depth the depth of the render target.
14
14
  */
15
- constructor(width: number, height: number, depth: number);
15
+ constructor(width?: number, height?: number, depth?: number);
16
16
 
17
17
  /**
18
18
  * The depth of the render target.
@@ -12,7 +12,7 @@ export class WebGLArrayRenderTarget extends WebGLRenderTarget {
12
12
  * @param height the height of the render target, in pixels.
13
13
  * @param depth the depth/layer count of the render target.
14
14
  */
15
- constructor(width: number, height: number, depth: number);
15
+ constructor(width?: number, height?: number, depth?: number);
16
16
 
17
17
  /**
18
18
  * The depth of the render target.
@@ -4,7 +4,7 @@ import { Texture } from './../textures/Texture';
4
4
  import { CubeTexture } from './../textures/CubeTexture';
5
5
 
6
6
  export class WebGLCubeRenderTarget extends WebGLRenderTarget {
7
- constructor(size: number, options?: WebGLRenderTargetOptions);
7
+ constructor(size?: number, options?: WebGLRenderTargetOptions);
8
8
 
9
9
  texture: CubeTexture;
10
10
 
@@ -18,7 +18,7 @@ export class WebGLMultipleRenderTargets extends EventDispatcher {
18
18
  * @param options object that holds texture parameters for an auto-generated target texture and depthBuffer/stencilBuffer booleans.
19
19
  * For an explanation of the texture parameters see {@link Texture}.
20
20
  */
21
- constructor(width: number, height: number, count: number, options?: WebGLRenderTargetOptions);
21
+ constructor(width?: number, height?: number, count?: number, options?: WebGLRenderTargetOptions);
22
22
 
23
23
  setSize(width: number, height: number, depth?: number): this;
24
24
  copy(source: WebGLMultipleRenderTargets): this;
@@ -26,7 +26,7 @@ export interface WebGLRenderTargetOptions {
26
26
  }
27
27
 
28
28
  export class WebGLRenderTarget extends EventDispatcher {
29
- constructor(width: number, height: number, options?: WebGLRenderTargetOptions);
29
+ constructor(width?: number, height?: number, options?: WebGLRenderTargetOptions);
30
30
 
31
31
  width: number;
32
32
  height: number;
@@ -17,7 +17,7 @@ import { Material } from './../materials/Material';
17
17
  import { ToneMapping, ShadowMapType, CullFace, TextureEncoding } from '../constants';
18
18
  import { WebXRManager } from '../renderers/webxr/WebXRManager';
19
19
  import { BufferGeometry } from './../core/BufferGeometry';
20
- import { Texture } from '../textures/Texture';
20
+ import { OffscreenCanvas, Texture } from '../textures/Texture';
21
21
  import { Data3DTexture } from '../textures/Data3DTexture';
22
22
  import { Vector3 } from '../math/Vector3';
23
23
  import { Box3 } from '../math/Box3';
@@ -31,10 +31,6 @@ export interface Renderer {
31
31
  setSize(width: number, height: number, updateStyle?: boolean): void;
32
32
  }
33
33
 
34
- /** This is only available in worker JS contexts, not the DOM. */
35
- // tslint:disable-next-line:no-empty-interface
36
- export interface OffscreenCanvas extends EventTarget {}
37
-
38
34
  export interface WebGLRendererParameters {
39
35
  /**
40
36
  * A Canvas where the renderer draws its output.
@@ -19,8 +19,9 @@ export let UniformsLib: {
19
19
  envMap: IUniform;
20
20
  flipEnvMap: IUniform;
21
21
  reflectivity: IUniform;
22
- refractionRatio: IUniform;
23
- maxMipLevel: IUniform;
22
+ ior: IUniform;
23
+ refractRatio: IUniform;
24
+ backgroundBlurriness: IUniform;
24
25
  };
25
26
  aomap: {
26
27
  aoMap: IUniform;
@@ -20,6 +20,7 @@ export class WebGLCapabilities {
20
20
  vertexTextures: boolean;
21
21
  floatFragmentTextures: boolean;
22
22
  floatVertexTextures: boolean;
23
+ maxSamples: number;
23
24
 
24
25
  getMaxAnisotropy(): number;
25
26
  getMaxPrecision(precision: string): string;
@@ -3,7 +3,11 @@ import { Vector3 } from '../../math/Vector3';
3
3
 
4
4
  export type XRControllerEventType = XRSessionEventType | XRInputSourceEventType | 'disconnected' | 'connected';
5
5
 
6
- export type XRHandJoints = Record<XRHandJoint, number>;
6
+ export class XRJointSpace extends Group {
7
+ readonly jointRadius: number | undefined;
8
+ }
9
+
10
+ export type XRHandJoints = Record<XRHandJoint, XRJointSpace>;
7
11
 
8
12
  export interface XRHandInputState {
9
13
  pinching: boolean;
@@ -35,6 +39,7 @@ export class WebXRController {
35
39
  getTargetRaySpace(): XRTargetRaySpace;
36
40
  getGripSpace(): XRGripSpace;
37
41
  dispatchEvent(event: { type: XRControllerEventType; data?: XRInputSource }): this;
42
+ connect(inputSource: XRInputSource): this;
38
43
  disconnect(inputSource: XRInputSource): this;
39
44
  update(inputSource: XRInputSource, frame: XRFrame, referenceSpace: XRReferenceSpace): this;
40
45
  }
@@ -1,3 +1,5 @@
1
+ // https://threejs.org/docs/#api/en/renderers/webxr/WebXRManager
2
+
1
3
  /// <reference types="webxr" />
2
4
 
3
5
  import { Vector4 } from '../../math/Vector4';
@@ -44,5 +46,11 @@ export class WebXRManager extends EventDispatcher {
44
46
  setAnimationLoop(callback: XRFrameRequestCallback | null): void;
45
47
  getFoveation(): number | undefined;
46
48
  setFoveation(foveation: number): void;
49
+
50
+ /**
51
+ * Returns the set of planes detected by WebXR's plane detection API.
52
+ */
53
+ getPlanes(): Set<XRPlane>;
54
+
47
55
  dispose(): void;
48
56
  }
@@ -1,3 +1,5 @@
1
+ // https://threejs.org/docs/?q=scene#api/en/scenes/Scene
2
+
1
3
  import { FogBase } from './Fog';
2
4
  import { Material } from './../materials/Material';
3
5
  import { Object3D } from './../core/Object3D';
@@ -23,15 +25,24 @@ export class Scene extends Object3D {
23
25
  fog: FogBase | null;
24
26
 
25
27
  /**
26
- * If not null, it will force everything in the scene to be rendered with that material. Default is null.
27
- * @default null
28
+ * Sets the blurriness of the background. Only influences environment maps assigned to Scene.background. Valid input is a float between 0 and 1.
29
+ *
30
+ * @default 0
28
31
  */
29
- overrideMaterial: Material | null;
32
+ backgroundBlurriness: number;
33
+
34
+ /**
35
+ * Attenuates the color of the background. Only applies to background textures.
36
+ *
37
+ * @default 1
38
+ */
39
+ backgroundIntensity: number;
30
40
 
31
41
  /**
32
- * @default true
42
+ * If not null, it will force everything in the scene to be rendered with that material. Default is null.
43
+ * @default null
33
44
  */
34
- autoUpdate: boolean;
45
+ overrideMaterial: Material | null;
35
46
 
36
47
  /**
37
48
  * @default null
@@ -1,4 +1,4 @@
1
- import { Texture } from './Texture';
1
+ import { OffscreenCanvas, Texture } from './Texture';
2
2
  import { Mapping, Wrapping, TextureFilter, PixelFormat, TextureDataType } from '../constants';
3
3
 
4
4
  export class CanvasTexture extends Texture {
@@ -15,7 +15,7 @@ export class CanvasTexture extends Texture {
15
15
  * @param [encoding=THREE.LinearEncoding]
16
16
  */
17
17
  constructor(
18
- canvas: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap,
18
+ canvas: TexImageSource | OffscreenCanvas,
19
19
  mapping?: Mapping,
20
20
  wrapS?: Wrapping,
21
21
  wrapT?: Wrapping,
@@ -0,0 +1,17 @@
1
+ import { CompressedPixelFormat, TextureDataType, Wrapping } from '../constants';
2
+ import { CompressedTexture } from './CompressedTexture.js';
3
+
4
+ export class CompressedArrayTexture extends CompressedTexture {
5
+ isCompressedArrayTexture: true;
6
+
7
+ wrapR: Wrapping;
8
+
9
+ constructor(
10
+ mipmaps: ImageData[],
11
+ width: number,
12
+ height: number,
13
+ depth: number,
14
+ format?: CompressedPixelFormat,
15
+ type?: TextureDataType,
16
+ );
17
+ }
@@ -1,3 +1,5 @@
1
+ // https://threejs.org/docs/?q=texture#api/en/textures/Texture
2
+
1
3
  import { Vector2 } from './../math/Vector2';
2
4
  import { Matrix3 } from './../math/Matrix3';
3
5
  import { Source } from './Source';
@@ -12,6 +14,10 @@ import {
12
14
  TextureEncoding,
13
15
  } from '../constants';
14
16
 
17
+ /** Shim for OffscreenCanvas. */
18
+ // tslint:disable-next-line:no-empty-interface
19
+ export interface OffscreenCanvas extends EventTarget {}
20
+
15
21
  export class Texture extends EventDispatcher {
16
22
  /**
17
23
  * @param [image]
@@ -22,11 +28,11 @@ export class Texture extends EventDispatcher {
22
28
  * @param [minFilter=THREE.LinearMipmapLinearFilter]
23
29
  * @param [format=THREE.RGBAFormat]
24
30
  * @param [type=THREE.UnsignedByteType]
25
- * @param [anisotropy=1]
31
+ * @param [anisotropy=THREE.Texture.DEFAULT_ANISOTROPY]
26
32
  * @param [encoding=THREE.LinearEncoding]
27
33
  */
28
34
  constructor(
29
- image?: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement,
35
+ image?: TexImageSource | OffscreenCanvas,
30
36
  mapping?: Mapping,
31
37
  wrapS?: Wrapping,
32
38
  wrapT?: Wrapping,
@@ -199,6 +205,8 @@ export class Texture extends EventDispatcher {
199
205
  readonly isTexture: true;
200
206
 
201
207
  onUpdate: () => void;
208
+
209
+ static DEFAULT_ANISOTROPY: number;
202
210
  static DEFAULT_IMAGE: any;
203
211
  static DEFAULT_MAPPING: any;
204
212
 
@@ -1,6 +0,0 @@
1
- export default class NodeVary {
2
- name: string;
3
- type: string;
4
- isNodeVary: boolean;
5
- constructor(name: string, type: string);
6
- }
@@ -1,11 +0,0 @@
1
- import { IUniform } from '../../../src/Three';
2
-
3
- export const PixelShader: {
4
- uniforms: {
5
- tDiffuse: IUniform;
6
- resolution: IUniform;
7
- pixelSize: IUniform;
8
- };
9
- vertexShader: string;
10
- fragmentShader: string;
11
- };