@types/three 0.155.1 → 0.156.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 (94) hide show
  1. three/README.md +2 -2
  2. three/examples/jsm/animation/CCDIKSolver.d.ts +7 -7
  3. three/examples/jsm/controls/ArcballControls.d.ts +7 -1
  4. three/examples/jsm/controls/DragControls.d.ts +9 -1
  5. three/examples/jsm/controls/FlyControls.d.ts +5 -1
  6. three/examples/jsm/controls/OrbitControls.d.ts +15 -17
  7. three/examples/jsm/controls/TrackballControls.d.ts +7 -1
  8. three/examples/jsm/controls/TransformControls.d.ts +35 -2
  9. three/examples/jsm/curves/NURBSCurve.d.ts +8 -2
  10. three/examples/jsm/environments/DebugEnvironment.d.ts +5 -0
  11. three/examples/jsm/interactive/InteractiveGroup.d.ts +14 -1
  12. three/examples/jsm/interactive/SelectionHelper.d.ts +1 -0
  13. three/examples/jsm/libs/lil-gui.module.min.d.ts +609 -1
  14. three/examples/jsm/libs/tween.module.d.ts +219 -2
  15. three/examples/jsm/loaders/3DMLoader.d.ts +1 -8
  16. three/examples/jsm/loaders/3MFLoader.d.ts +1 -8
  17. three/examples/jsm/loaders/AMFLoader.d.ts +1 -8
  18. three/examples/jsm/loaders/BVHLoader.d.ts +1 -8
  19. three/examples/jsm/loaders/ColladaLoader.d.ts +1 -8
  20. three/examples/jsm/loaders/DRACOLoader.d.ts +1 -8
  21. three/examples/jsm/loaders/FBXLoader.d.ts +1 -8
  22. three/examples/jsm/loaders/FontLoader.d.ts +1 -8
  23. three/examples/jsm/loaders/GCodeLoader.d.ts +1 -8
  24. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -9
  25. three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +5 -5
  26. three/examples/jsm/loaders/KMZLoader.d.ts +1 -8
  27. three/examples/jsm/loaders/LDrawLoader.d.ts +1 -8
  28. three/examples/jsm/loaders/LUT3dlLoader.d.ts +1 -8
  29. three/examples/jsm/loaders/LUTCubeLoader.d.ts +1 -8
  30. three/examples/jsm/loaders/LWOLoader.d.ts +1 -8
  31. three/examples/jsm/loaders/LottieLoader.d.ts +4 -5
  32. three/examples/jsm/loaders/MD2Loader.d.ts +1 -8
  33. three/examples/jsm/loaders/MDDLoader.d.ts +1 -8
  34. three/examples/jsm/loaders/MMDLoader.d.ts +1 -8
  35. three/examples/jsm/loaders/MTLLoader.d.ts +1 -9
  36. three/examples/jsm/loaders/NRRDLoader.d.ts +1 -7
  37. three/examples/jsm/loaders/OBJLoader.d.ts +1 -8
  38. three/examples/jsm/loaders/PCDLoader.d.ts +1 -8
  39. three/examples/jsm/loaders/PDBLoader.d.ts +1 -8
  40. three/examples/jsm/loaders/PLYLoader.d.ts +1 -8
  41. three/examples/jsm/loaders/STLLoader.d.ts +1 -8
  42. three/examples/jsm/loaders/SVGLoader.d.ts +1 -8
  43. three/examples/jsm/loaders/TDSLoader.d.ts +1 -8
  44. three/examples/jsm/loaders/TGALoader.d.ts +0 -7
  45. three/examples/jsm/loaders/TTFLoader.d.ts +1 -8
  46. three/examples/jsm/loaders/TiltLoader.d.ts +1 -8
  47. three/examples/jsm/loaders/USDZLoader.d.ts +1 -9
  48. three/examples/jsm/loaders/VOXLoader.d.ts +1 -8
  49. three/examples/jsm/loaders/VRMLLoader.d.ts +1 -8
  50. three/examples/jsm/loaders/VTKLoader.d.ts +1 -8
  51. three/examples/jsm/loaders/XYZLoader.d.ts +1 -8
  52. three/examples/jsm/nodes/loaders/NodeLoader.d.ts +1 -9
  53. three/examples/jsm/postprocessing/FilmPass.d.ts +1 -1
  54. three/examples/jsm/postprocessing/RenderPass.d.ts +15 -5
  55. three/examples/jsm/postprocessing/SAOPass.d.ts +1 -10
  56. three/examples/jsm/postprocessing/SSAOPass.d.ts +2 -5
  57. three/examples/jsm/shaders/FilmShader.d.ts +1 -3
  58. three/examples/jsm/shaders/SAOShader.d.ts +0 -2
  59. three/examples/jsm/shaders/SSAOShader.d.ts +0 -1
  60. three/examples/jsm/webxr/XREstimatedLight.d.ts +7 -2
  61. three/index.d.ts +1 -2
  62. three/package.json +4 -6
  63. three/src/Three.d.ts +4 -0
  64. three/src/animation/AnimationMixer.d.ts +6 -1
  65. three/src/constants.d.ts +7 -1
  66. three/src/core/BufferGeometry.d.ts +1 -1
  67. three/src/core/EventDispatcher.d.ts +30 -12
  68. three/src/core/Object3D.d.ts +17 -12
  69. three/src/core/RenderTarget.d.ts +1 -1
  70. three/src/core/UniformsGroup.d.ts +1 -1
  71. three/src/extras/core/Path.d.ts +1 -1
  72. three/src/loaders/AnimationLoader.d.ts +3 -10
  73. three/src/loaders/AudioLoader.d.ts +1 -10
  74. three/src/loaders/BufferGeometryLoader.d.ts +3 -13
  75. three/src/loaders/CompressedTextureLoader.d.ts +4 -6
  76. three/src/loaders/CubeTextureLoader.d.ts +5 -7
  77. three/src/loaders/DataTextureLoader.d.ts +4 -6
  78. three/src/loaders/FileLoader.d.ts +1 -8
  79. three/src/loaders/ImageBitmapLoader.d.ts +1 -9
  80. three/src/loaders/ImageLoader.d.ts +3 -5
  81. three/src/loaders/Loader.d.ts +8 -6
  82. three/src/loaders/MaterialLoader.d.ts +4 -11
  83. three/src/loaders/ObjectLoader.d.ts +15 -29
  84. three/src/loaders/TextureLoader.d.ts +4 -6
  85. three/src/materials/Material.d.ts +1 -1
  86. three/src/objects/Group.d.ts +2 -2
  87. three/src/objects/InstancedMesh.d.ts +11 -6
  88. three/src/objects/Mesh.d.ts +4 -5
  89. three/src/renderers/webxr/WebXRController.d.ts +21 -3
  90. three/src/renderers/webxr/WebXRManager.d.ts +10 -1
  91. three/src/textures/Texture.d.ts +4 -4
  92. three/src/utils.d.ts +1 -0
  93. three/examples/jsm/loaders/BasisTextureLoader.d.ts +0 -32
  94. three/examples/jsm/loaders/IFCLoader.d.ts +0 -675
@@ -1,15 +1,8 @@
1
1
  import { Points, Loader, LoadingManager } from '../../../src/Three.js';
2
2
 
3
- export class PCDLoader extends Loader {
3
+ export class PCDLoader extends Loader<Points> {
4
4
  constructor(manager?: LoadingManager);
5
5
  littleEndian: boolean;
6
6
 
7
- load(
8
- url: string,
9
- onLoad: (points: Points) => void,
10
- onProgress?: (event: ProgressEvent) => void,
11
- onError?: (event: ErrorEvent) => void,
12
- ): void;
13
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Points>;
14
7
  parse(data: ArrayBuffer | string): Points;
15
8
  }
@@ -8,15 +8,8 @@ export interface PDB {
8
8
  };
9
9
  }
10
10
 
11
- export class PDBLoader extends Loader {
11
+ export class PDBLoader extends Loader<PDB> {
12
12
  constructor(manager?: LoadingManager);
13
13
 
14
- load(
15
- url: string,
16
- onLoad: (pdb: PDB) => void,
17
- onProgress?: (event: ProgressEvent) => void,
18
- onError?: (event: ErrorEvent) => void,
19
- ): void;
20
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<PDB>;
21
14
  parse(text: string): PDB;
22
15
  }
@@ -1,17 +1,10 @@
1
1
  import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js';
2
2
 
3
- export class PLYLoader extends Loader {
3
+ export class PLYLoader extends Loader<BufferGeometry> {
4
4
  constructor(manager?: LoadingManager);
5
5
  propertyNameMapping: object;
6
6
  customPropertyMapping: Record<string, any>;
7
7
 
8
- load(
9
- url: string,
10
- onLoad: (geometry: BufferGeometry) => void,
11
- onProgress?: (event: ProgressEvent) => void,
12
- onError?: (event: ErrorEvent) => void,
13
- ): void;
14
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<BufferGeometry>;
15
8
  setPropertyNameMapping(mapping: object): void;
16
9
  setCustomPropertyNameMapping(mapping: Record<string, any>): void;
17
10
  parse(data: ArrayBuffer | string): BufferGeometry;
@@ -1,14 +1,7 @@
1
1
  import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js';
2
2
 
3
- export class STLLoader extends Loader {
3
+ export class STLLoader extends Loader<BufferGeometry> {
4
4
  constructor(manager?: LoadingManager);
5
5
 
6
- load(
7
- url: string,
8
- onLoad: (geometry: BufferGeometry) => void,
9
- onProgress?: (event: ProgressEvent) => void,
10
- onError?: (event: ErrorEvent) => void,
11
- ): void;
12
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<BufferGeometry>;
13
6
  parse(data: ArrayBuffer | string): BufferGeometry;
14
7
  }
@@ -21,19 +21,12 @@ export interface StrokeStyle {
21
21
  strokeMiterLimit: number;
22
22
  }
23
23
 
24
- export class SVGLoader extends Loader {
24
+ export class SVGLoader extends Loader<SVGResult> {
25
25
  constructor(manager?: LoadingManager);
26
26
 
27
27
  defaultDPI: number;
28
28
  defaultUnit: string;
29
29
 
30
- load(
31
- url: string,
32
- onLoad: (data: SVGResult) => void,
33
- onProgress?: (event: ProgressEvent) => void,
34
- onError?: (event: ErrorEvent) => void,
35
- ): void;
36
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<SVGResult>;
37
30
  parse(text: string): SVGResult;
38
31
 
39
32
  static getStrokeStyle(
@@ -1,6 +1,6 @@
1
1
  import { Color, Group, Loader, LoadingManager, Material, Mesh, Texture } from '../../../src/Three.js';
2
2
 
3
- export class TDSLoader extends Loader {
3
+ export class TDSLoader extends Loader<Group> {
4
4
  constructor(manager?: LoadingManager);
5
5
  debug: boolean;
6
6
  group: Group;
@@ -9,13 +9,6 @@ export class TDSLoader extends Loader {
9
9
  meshes: Mesh[];
10
10
  position: number;
11
11
 
12
- load(
13
- url: string,
14
- onLoad: (object: Group) => void,
15
- onProgress?: (event: ProgressEvent) => void,
16
- onError?: (event: ErrorEvent) => void,
17
- ): void;
18
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Group>;
19
12
  parse(arraybuffer: ArrayBuffer, path: string): Group;
20
13
 
21
14
  debugMessage(message: object): void;
@@ -3,12 +3,5 @@ import { DataTexture, DataTextureLoader, LoadingManager } from '../../../src/Thr
3
3
  export class TGALoader extends DataTextureLoader {
4
4
  constructor(manager?: LoadingManager);
5
5
 
6
- load(
7
- url: string,
8
- onLoad?: (texture: DataTexture, texData: object) => void,
9
- onProgress?: (event: ProgressEvent) => void,
10
- onError?: (event: ErrorEvent) => void,
11
- ): DataTexture;
12
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<DataTexture>;
13
6
  parse(data: ArrayBuffer): DataTexture;
14
7
  }
@@ -1,15 +1,8 @@
1
1
  import { Loader, LoadingManager } from '../../../src/Three.js';
2
2
 
3
- export class TTFLoader extends Loader {
3
+ export class TTFLoader extends Loader<object> {
4
4
  constructor(manager?: LoadingManager);
5
5
  reversed: boolean;
6
6
 
7
- load(
8
- url: string,
9
- onLoad: (json: object) => void,
10
- onProgress?: (event: ProgressEvent) => void,
11
- onError?: (event: ErrorEvent) => void,
12
- ): void;
13
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<object>;
14
7
  parse(arraybuffer: ArrayBuffer): object;
15
8
  }
@@ -1,14 +1,7 @@
1
1
  import { Loader, LoadingManager, Group } from '../../../src/Three.js';
2
2
 
3
- export class TiltLoader extends Loader {
3
+ export class TiltLoader extends Loader<Group> {
4
4
  constructor(manager?: LoadingManager);
5
5
 
6
- load(
7
- url: string,
8
- onLoad: (object: Group) => void,
9
- onProgress?: (event: ProgressEvent) => void,
10
- onError?: (event: ErrorEvent) => void,
11
- ): void;
12
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Group>;
13
6
  parse(data: ArrayBuffer): Group;
14
7
  }
@@ -4,16 +4,8 @@ export class USDAParser {
4
4
  parse(text: string): object;
5
5
  }
6
6
 
7
- export class USDZLoader extends Loader {
7
+ export class USDZLoader extends Loader<Mesh> {
8
8
  constructor(manager?: LoadingManager);
9
9
 
10
- load(
11
- url: string,
12
- onLoad: (usdz: Mesh) => void,
13
- onProgress?: (event: ProgressEvent) => void,
14
- onError?: (event: ErrorEvent) => void,
15
- ): void;
16
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Mesh>;
17
-
18
10
  parse(buffer: ArrayBuffer | string): THREE.Group;
19
11
  }
@@ -6,16 +6,9 @@ export interface Chunk {
6
6
  data: Uint8Array;
7
7
  }
8
8
 
9
- export class VOXLoader extends Loader {
9
+ export class VOXLoader extends Loader<Chunk[]> {
10
10
  constructor(manager?: LoadingManager);
11
11
 
12
- load(
13
- url: string,
14
- onLoad: (chunks: Chunk[]) => void,
15
- onProgress?: (event: ProgressEvent) => void,
16
- onError?: (event: ErrorEvent) => void,
17
- ): void;
18
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Chunk[]>;
19
12
  parse(data: ArrayBuffer): object[];
20
13
  }
21
14
 
@@ -1,14 +1,7 @@
1
1
  import { Scene, Loader, LoadingManager } from '../../../src/Three.js';
2
2
 
3
- export class VRMLLoader extends Loader {
3
+ export class VRMLLoader extends Loader<Scene> {
4
4
  constructor(manager?: LoadingManager);
5
5
 
6
- load(
7
- url: string,
8
- onLoad: (scene: Scene) => void,
9
- onProgress?: (event: ProgressEvent) => void,
10
- onError?: (event: ErrorEvent) => void,
11
- ): void;
12
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Scene>;
13
6
  parse(data: string, path: string): Scene;
14
7
  }
@@ -1,14 +1,7 @@
1
1
  import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js';
2
2
 
3
- export class VTKLoader extends Loader {
3
+ export class VTKLoader extends Loader<BufferGeometry> {
4
4
  constructor(manager?: LoadingManager);
5
5
 
6
- load(
7
- url: string,
8
- onLoad: (geometry: BufferGeometry) => void,
9
- onProgress?: (event: ProgressEvent) => void,
10
- onError?: (event: ErrorEvent) => void,
11
- ): void;
12
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<BufferGeometry>;
13
6
  parse(data: ArrayBuffer | string, path: string): BufferGeometry;
14
7
  }
@@ -1,14 +1,7 @@
1
1
  import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js';
2
2
 
3
- export class XYZLoader extends Loader {
3
+ export class XYZLoader extends Loader<BufferGeometry> {
4
4
  constructor(manager?: LoadingManager);
5
5
 
6
- load(
7
- url: string,
8
- onLoad: (geometry: BufferGeometry) => void,
9
- onProgress?: (event: ProgressEvent) => void,
10
- onError?: (event: ErrorEvent) => void,
11
- ): void;
12
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<BufferGeometry>;
13
6
  parse(data: string, onLoad: (geometry: BufferGeometry) => void): object;
14
7
  }
@@ -5,17 +5,9 @@ export interface NodeLoaderResult {
5
5
  [hash: string]: Node;
6
6
  }
7
7
 
8
- export default class NodeLoader extends Loader {
8
+ export default class NodeLoader extends Loader<NodeLoaderResult> {
9
9
  constructor(manager?: LoadingManager);
10
10
 
11
- load(
12
- url: string,
13
- onLoad: (gltf: NodeLoaderResult) => void,
14
- onProgress?: (event: ProgressEvent) => void,
15
- onError?: (event: ErrorEvent) => void,
16
- ): void;
17
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<NodeLoaderResult>;
18
-
19
11
  parseNodes(json: AnyJson): NodeLoaderResult;
20
12
  parse(json: AnyJson): Node;
21
13
  setTextures(textures: { [key: string]: Texture }): this;
@@ -3,7 +3,7 @@ import { ShaderMaterial } from '../../../src/Three.js';
3
3
  import { Pass, FullScreenQuad } from './Pass.js';
4
4
 
5
5
  export class FilmPass extends Pass {
6
- constructor(noiseIntensity?: number, scanlinesIntensity?: number, scanlinesCount?: number, grayscale?: boolean);
6
+ constructor(intensity?: number, grayscale?: boolean);
7
7
  uniforms: object;
8
8
  material: ShaderMaterial;
9
9
  fsQuad: FullScreenQuad;
@@ -1,13 +1,23 @@
1
1
  import { Scene, Camera, Material, Color } from '../../../src/Three.js';
2
2
 
3
- import { Pass, FullScreenQuad } from './Pass.js';
3
+ import { Pass } from './Pass.js';
4
4
 
5
5
  export class RenderPass extends Pass {
6
- constructor(scene: Scene, camera: Camera, overrideMaterial?: Material, clearColor?: Color, clearAlpha?: number);
6
+ constructor(
7
+ scene: Scene,
8
+ camera: Camera,
9
+ overrideMaterial?: Material | null,
10
+ clearColor?: Color | null,
11
+ clearAlpha?: number | null,
12
+ );
13
+
7
14
  scene: Scene;
8
15
  camera: Camera;
9
- overrideMaterial: Material;
10
- clearColor: Color;
11
- clearAlpha: number;
16
+
17
+ overrideMaterial: Material | null;
18
+
19
+ clearColor: Color | null;
20
+ clearAlpha: number | null;
21
+
12
22
  clearDepth: boolean;
13
23
  }
@@ -2,7 +2,6 @@ import {
2
2
  Scene,
3
3
  Camera,
4
4
  Material,
5
- MeshDepthMaterial,
6
5
  MeshNormalMaterial,
7
6
  ShaderMaterial,
8
7
  Color,
@@ -15,10 +14,8 @@ import {
15
14
  import { Pass, FullScreenQuad } from './Pass.js';
16
15
 
17
16
  export enum OUTPUT {
18
- Beauty,
19
17
  Default,
20
18
  SAO,
21
- Depth,
22
19
  Normal,
23
20
  }
24
21
 
@@ -36,27 +33,21 @@ export interface SAOPassParams {
36
33
  }
37
34
 
38
35
  export class SAOPass extends Pass {
39
- constructor(scene: Scene, camera: Camera, depthTexture?: boolean, useNormals?: boolean, resolution?: Vector2);
36
+ constructor(scene: Scene, camera: Camera, resolution?: Vector2);
40
37
  scene: Scene;
41
38
  camera: Camera;
42
- supportsDepthTextureExtension: boolean;
43
- supportsNormalTexture: boolean;
44
39
  originalClearColor: Color;
45
40
  oldClearColor: Color;
46
41
  oldClearAlpha: number;
47
42
  resolution: Vector2;
48
43
  saoRenderTarget: WebGLRenderTarget;
49
44
  blurIntermediateRenderTarget: WebGLRenderTarget;
50
- beautyRenderTarget: WebGLRenderTarget;
51
45
  normalRenderTarget: WebGLRenderTarget;
52
- depthRenderTarget: WebGLRenderTarget;
53
- depthMaterial: MeshDepthMaterial;
54
46
  normalMaterial: MeshNormalMaterial;
55
47
  saoMaterial: ShaderMaterial;
56
48
  vBlurMaterial: ShaderMaterial;
57
49
  hBlurMaterial: ShaderMaterial;
58
50
  materialCopy: ShaderMaterial;
59
- depthCopy: ShaderMaterial;
60
51
  fsQuad: FullScreenQuad;
61
52
  params: SAOPassParams;
62
53
 
@@ -18,26 +18,23 @@ export enum SSAOPassOUTPUT {
18
18
  Default,
19
19
  SSAO,
20
20
  Blur,
21
- Beauty,
22
21
  Depth,
23
22
  Normal,
24
23
  }
25
24
 
26
25
  export class SSAOPass extends Pass {
27
- constructor(scene: Scene, camera: Camera, width?: number, height?: number);
26
+ constructor(scene: Scene, camera: Camera, width?: number, height?: number, kernelSize?: number);
28
27
  scene: Scene;
29
28
  camera: Camera;
30
29
  width: number;
31
30
  height: boolean;
32
31
  clear: boolean;
33
32
  kernelRadius: number;
34
- kernelSize: number;
35
33
  kernel: Vector3[];
36
34
  noiseTexture: DataTexture;
37
35
  output: SSAOPassOUTPUT;
38
36
  minDistance: number;
39
37
  maxDistance: number;
40
- beautyRenderTarget: WebGLRenderTarget;
41
38
  normalRenderTarget: WebGLRenderTarget;
42
39
  ssaoRenderTarget: WebGLRenderTarget;
43
40
  blurRenderTarget: WebGLRenderTarget;
@@ -52,7 +49,7 @@ export class SSAOPass extends Pass {
52
49
  static OUTPUT: typeof SSAOPassOUTPUT;
53
50
 
54
51
  dipose(): void;
55
- generateSampleKernel(): Vector3[];
52
+ generateSampleKernel(kernelSize: number): Vector3[];
56
53
  generateRandomKernelRotations(): void;
57
54
  renderPass(
58
55
  renderer: WebGLRenderer,
@@ -4,9 +4,7 @@ export const FilmShader: {
4
4
  uniforms: {
5
5
  tDiffuse: IUniform;
6
6
  time: IUniform;
7
- nIntensity: IUniform;
8
- sIntensity: IUniform;
9
- sCount: IUniform;
7
+ intensity: IUniform;
10
8
  grayscale: IUniform;
11
9
  };
12
10
  vertexShader: string;
@@ -4,9 +4,7 @@ export const SAOShader: {
4
4
  defines: {
5
5
  NUM_SAMPLES: number;
6
6
  NUM_RINGS: number;
7
- NORMAL_TEXTURE: number;
8
7
  DIFFUSE_TEXTURE: number;
9
- DEPTH_PACKING: number;
10
8
  PERSPECTIVE_CAMERA: number;
11
9
  };
12
10
  uniforms: {
@@ -6,7 +6,6 @@ export const SSAOShader: {
6
6
  KERNEL_SIZE: number;
7
7
  };
8
8
  uniforms: {
9
- tDiffuse: IUniform;
10
9
  tNormal: IUniform;
11
10
  tDepth: IUniform;
12
11
  tNoise: IUniform;
@@ -1,4 +1,4 @@
1
- import { DirectionalLight, Group, LightProbe, Texture, WebGLRenderer } from '../../../src/Three.js';
1
+ import { DirectionalLight, Group, LightProbe, Texture, WebGLRenderer, Object3DEventMap } from '../../../src/Three.js';
2
2
 
3
3
  export class SessionLightProbe {
4
4
  xrLight: XREstimatedLight;
@@ -23,7 +23,12 @@ export class SessionLightProbe {
23
23
  dispose: () => void;
24
24
  }
25
25
 
26
- export class XREstimatedLight extends Group {
26
+ export interface XREstimatedLightEventMap extends Object3DEventMap {
27
+ estimationstart: {};
28
+ estimationend: {};
29
+ }
30
+
31
+ export class XREstimatedLight extends Group<XREstimatedLightEventMap> {
27
32
  lightProbe: LightProbe;
28
33
  directionalLight: DirectionalLight;
29
34
  environment: Texture;
three/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- // Type definitions for three 0.155
1
+ // Type definitions for three 0.156
2
2
  // Project: https://threejs.org/
3
3
  // Definitions by: Josh Ellis <https://github.com/joshuaellis>
4
4
  // Nathan Bierema <https://github.com/Methuselah96>
5
5
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
- // Minimum TypeScript Version: 4.4
7
6
 
8
7
  // To update three.js type definition, please make changes to the repository at:
9
8
  // https://github.com/three-types/three-ts-types.
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.155.1",
3
+ "version": "0.156.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -25,15 +25,13 @@
25
25
  },
26
26
  "scripts": {},
27
27
  "dependencies": {
28
- "@tweenjs/tween.js": "~18.6.4",
29
28
  "@types/stats.js": "*",
30
29
  "@types/webxr": "*",
31
- "fflate": "~0.6.9",
32
- "lil-gui": "~0.17.0",
30
+ "fflate": "~0.6.10",
33
31
  "meshoptimizer": "~0.18.1"
34
32
  },
35
- "typesPublisherContentHash": "e95ca925c70bfdbc8f8ae36c5d54552fba9db84a9fa72acb7f66e8234540c623",
36
- "typeScriptVersion": "4.4",
33
+ "typesPublisherContentHash": "c7fc65a1fef93103d5e9db486206657217d03ee8c514a14ecd05aaa469b45a0c",
34
+ "typeScriptVersion": "4.3",
37
35
  "exports": {
38
36
  ".": {
39
37
  "import": "./build/three.module.js",
three/src/Three.d.ts CHANGED
@@ -234,3 +234,7 @@ export * from './textures/DepthTexture.js';
234
234
  export * from './textures/FramebufferTexture.js';
235
235
  export * from './textures/Source.js';
236
236
  export * from './textures/Texture.js';
237
+ /**
238
+ * Utils
239
+ */
240
+ export { createCanvasElement } from './utils.js';
@@ -5,7 +5,12 @@ import { EventDispatcher } from './../core/EventDispatcher.js';
5
5
  import { Object3D } from '../core/Object3D.js';
6
6
  import { AnimationObjectGroup } from './AnimationObjectGroup.js';
7
7
 
8
- export class AnimationMixer extends EventDispatcher {
8
+ export interface AnimationMixerEventMap {
9
+ loop: { action: AnimationAction; loopDelta: number };
10
+ finished: { action: AnimationAction; direction: number };
11
+ }
12
+
13
+ export class AnimationMixer extends EventDispatcher<AnimationMixerEventMap> {
9
14
  constructor(root: Object3D | AnimationObjectGroup);
10
15
 
11
16
  /**
three/src/constants.d.ts CHANGED
@@ -596,6 +596,8 @@ export const RGBA_ASTC_12x12_Format: 37821;
596
596
  * @remarks Require support for the _EXT_texture_compression_bptc_ WebGL extension.
597
597
  */
598
598
  export const RGBA_BPTC_Format: 36492;
599
+ export const RGB_BPTC_SIGNED_Format = 36494;
600
+ export const RGB_BPTC_UNSIGNED_Format = 36495;
599
601
 
600
602
  // RGTC compressed texture formats
601
603
  export const RED_RGTC1_Format: 36283;
@@ -634,6 +636,8 @@ export type CompressedPixelFormat =
634
636
  | typeof RGBA_ASTC_12x10_Format
635
637
  | typeof RGBA_ASTC_12x12_Format
636
638
  | typeof RGBA_BPTC_Format
639
+ | typeof RGB_BPTC_SIGNED_Format
640
+ | typeof RGB_BPTC_UNSIGNED_Format
637
641
  | typeof RED_RGTC1_Format
638
642
  | typeof SIGNED_RED_RGTC1_Format
639
643
  | typeof RED_GREEN_RGTC2_Format
@@ -712,11 +716,13 @@ export const NoColorSpace: '';
712
716
  export const SRGBColorSpace: 'srgb';
713
717
  export const LinearSRGBColorSpace: 'srgb-linear';
714
718
  export const DisplayP3ColorSpace: 'display-p3';
719
+ export const LinearDisplayP3ColorSpace = 'display-p3-linear';
715
720
  export type ColorSpace =
716
721
  | typeof NoColorSpace
717
722
  | typeof SRGBColorSpace
718
723
  | typeof LinearSRGBColorSpace
719
- | typeof DisplayP3ColorSpace;
724
+ | typeof DisplayP3ColorSpace
725
+ | typeof LinearDisplayP3ColorSpace;
720
726
 
721
727
  // Stencil Op types
722
728
  export const ZeroStencilOp: 0;
@@ -75,7 +75,7 @@ export type NormalOrGLBufferAttributes = Record<
75
75
  */
76
76
  export class BufferGeometry<
77
77
  Attributes extends NormalOrGLBufferAttributes = NormalBufferAttributes,
78
- > extends EventDispatcher {
78
+ > extends EventDispatcher<{ dispose: {} }> {
79
79
  /**
80
80
  * This creates a new {@link THREE.BufferGeometry | BufferGeometry} object.
81
81
  */
@@ -1,15 +1,21 @@
1
- export interface BaseEvent {
2
- type: string;
1
+ /**
2
+ * The minimal basic Event that can be dispatched by a {@link EventDispatcher<>}.
3
+ */
4
+ export interface BaseEvent<TEventType extends string = string> {
5
+ readonly type: TEventType;
3
6
  }
4
7
 
5
8
  /**
6
- * Event object.
9
+ * The minimal expected contract of a fired Event that was dispatched by a {@link EventDispatcher<>}.
7
10
  */
8
- export interface Event extends BaseEvent {
9
- target?: any;
10
- [attachment: string]: any;
11
+ export interface Event<TEventType extends string = string, TTarget = unknown> {
12
+ readonly type: TEventType;
13
+ readonly target: TTarget;
11
14
  }
12
- export type EventListener<E, T, U> = (event: E & { type: T } & { target: U }) => void;
15
+
16
+ export type EventListener<TEventData, TEventType extends string, TTarget> = (
17
+ event: TEventData & Event<TEventType, TTarget>,
18
+ ) => void;
13
19
 
14
20
  /**
15
21
  * JavaScript events for custom objects
@@ -32,7 +38,7 @@ export type EventListener<E, T, U> = (event: E & { type: T } & { target: U }) =>
32
38
  * @see {@link https://threejs.org/docs/index.html#api/en/core/EventDispatcher | Official Documentation}
33
39
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/EventDispatcher.js | Source}
34
40
  */
35
- export class EventDispatcher<E extends BaseEvent = Event> {
41
+ export class EventDispatcher<TEventMap extends {} = {}> {
36
42
  /**
37
43
  * Creates {@link THREE.EventDispatcher | EventDispatcher} object.
38
44
  */
@@ -43,25 +49,37 @@ export class EventDispatcher<E extends BaseEvent = Event> {
43
49
  * @param type The type of event to listen to.
44
50
  * @param listener The function that gets called when the event is fired.
45
51
  */
46
- addEventListener<T extends E['type']>(type: T, listener: EventListener<E, T, this>): void;
52
+ addEventListener<T extends Extract<keyof TEventMap, string>>(
53
+ type: T,
54
+ listener: EventListener<TEventMap[T], T, this>,
55
+ ): void;
56
+ addEventListener<T extends string>(type: T, listener: EventListener<{}, T, this>): void;
47
57
 
48
58
  /**
49
59
  * Checks if listener is added to an event type.
50
60
  * @param type The type of event to listen to.
51
61
  * @param listener The function that gets called when the event is fired.
52
62
  */
53
- hasEventListener<T extends E['type']>(type: T, listener: EventListener<E, T, this>): boolean;
63
+ hasEventListener<T extends Extract<keyof TEventMap, string>>(
64
+ type: T,
65
+ listener: EventListener<TEventMap[T], T, this>,
66
+ ): boolean;
67
+ hasEventListener<T extends string>(type: T, listener: EventListener<{}, T, this>): boolean;
54
68
 
55
69
  /**
56
70
  * Removes a listener from an event type.
57
71
  * @param type The type of the listener that gets removed.
58
72
  * @param listener The listener function that gets removed.
59
73
  */
60
- removeEventListener<T extends E['type']>(type: T, listener: EventListener<E, T, this>): void;
74
+ removeEventListener<T extends Extract<keyof TEventMap, string>>(
75
+ type: T,
76
+ listener: EventListener<TEventMap[T], T, this>,
77
+ ): void;
78
+ removeEventListener<T extends string>(type: T, listener: EventListener<{}, T, this>): void;
61
79
 
62
80
  /**
63
81
  * Fire an event type.
64
82
  * @param event The event that gets fired.
65
83
  */
66
- dispatchEvent(event: E): void;
84
+ dispatchEvent<T extends Extract<keyof TEventMap, string>>(event: BaseEvent<T> & TEventMap[T]): void;
67
85
  }