@types/three 0.137.0 → 0.140.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 (146) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/{WebGL.d.ts → capabilities/WebGL.d.ts} +3 -1
  3. three/examples/jsm/controls/OrbitControls.d.ts +1 -2
  4. three/examples/jsm/controls/TransformControls.d.ts +41 -1
  5. three/examples/jsm/curves/CurveExtras.d.ts +52 -54
  6. three/examples/jsm/exporters/EXRExporter.d.ts +21 -0
  7. three/examples/jsm/exporters/GLTFExporter.d.ts +102 -5
  8. three/examples/jsm/helpers/OctreeHelper.d.ts +14 -0
  9. three/examples/jsm/interactive/HTMLMesh.d.ts +1 -0
  10. three/examples/jsm/loaders/GLTFLoader.d.ts +8 -10
  11. three/examples/jsm/loaders/LUT3dlLoader.d.ts +2 -2
  12. three/examples/jsm/loaders/LUTCubeLoader.d.ts +2 -2
  13. three/examples/jsm/loaders/VOXLoader.d.ts +2 -2
  14. three/examples/jsm/objects/Reflector.d.ts +12 -1
  15. three/examples/jsm/objects/Refractor.d.ts +12 -1
  16. three/examples/jsm/postprocessing/LUTPass.d.ts +3 -3
  17. three/examples/jsm/postprocessing/SSAARenderPass.d.ts +1 -1
  18. three/examples/jsm/postprocessing/SavePass.d.ts +1 -1
  19. three/examples/jsm/utils/BufferGeometryUtils.d.ts +8 -0
  20. three/examples/jsm/utils/SceneUtils.d.ts +3 -1
  21. three/examples/jsm/utils/SkeletonUtils.d.ts +15 -11
  22. three/index.d.ts +6 -5
  23. three/package.json +3 -3
  24. three/src/Three.d.ts +7 -0
  25. three/src/animation/AnimationUtils.d.ts +1 -1
  26. three/src/constants.d.ts +6 -4
  27. three/src/core/BufferGeometry.d.ts +0 -2
  28. three/src/core/InstancedBufferGeometry.d.ts +0 -4
  29. three/src/core/Raycaster.d.ts +2 -2
  30. three/src/core/Uniform.d.ts +0 -1
  31. three/src/extras/DataUtils.d.ts +1 -0
  32. three/src/extras/Earcut.d.ts +4 -0
  33. three/src/geometries/CapsuleGeometry.d.ts +27 -0
  34. three/src/geometries/Geometries.d.ts +1 -0
  35. three/src/materials/Material.d.ts +0 -15
  36. three/src/materials/MeshBasicMaterial.d.ts +7 -0
  37. three/src/materials/MeshLambertMaterial.d.ts +7 -0
  38. three/src/materials/MeshMatcapMaterial.d.ts +7 -1
  39. three/src/materials/MeshPhongMaterial.d.ts +7 -1
  40. three/src/materials/MeshStandardMaterial.d.ts +7 -7
  41. three/src/materials/MeshToonMaterial.d.ts +7 -0
  42. three/src/materials/PointsMaterial.d.ts +7 -0
  43. three/src/materials/ShadowMaterial.d.ts +7 -0
  44. three/src/materials/SpriteMaterial.d.ts +7 -0
  45. three/src/math/Color.d.ts +22 -10
  46. three/src/math/ColorManagement.d.ts +18 -0
  47. three/src/math/Euler.d.ts +2 -1
  48. three/src/math/Plane.d.ts +0 -1
  49. three/src/math/Quaternion.d.ts +2 -0
  50. three/src/math/Vector3.d.ts +5 -0
  51. three/src/renderers/WebGL3DRenderTarget.d.ts +28 -0
  52. three/src/renderers/WebGLArrayRenderTarget.d.ts +28 -0
  53. three/src/renderers/WebGLMultipleRenderTargets.d.ts +9 -1
  54. three/src/renderers/WebGLMultisampleRenderTarget.d.ts +5 -12
  55. three/src/renderers/WebGLRenderTarget.d.ts +7 -2
  56. three/src/renderers/WebGLRenderer.d.ts +4 -5
  57. three/src/renderers/webgl/WebGLUtils.d.ts +2 -2
  58. three/src/scenes/Scene.d.ts +0 -15
  59. three/src/textures/CompressedTexture.d.ts +2 -1
  60. three/src/textures/Data3DTexture.d.ts +33 -0
  61. three/src/textures/DataArrayTexture.d.ts +33 -0
  62. three/src/textures/DataTexture.d.ts +2 -1
  63. three/src/textures/DataTexture2DArray.d.ts +5 -32
  64. three/src/textures/DataTexture3D.d.ts +5 -32
  65. three/src/textures/DepthTexture.d.ts +2 -1
  66. three/src/textures/Source.d.ts +39 -0
  67. three/src/textures/Texture.d.ts +30 -3
  68. three/examples/jsm/loaders/VRMLoader.d.ts +0 -19
  69. three/examples/jsm/nodes/Nodes.d.ts +0 -106
  70. three/examples/jsm/nodes/accessors/CameraNode.d.ts +0 -29
  71. three/examples/jsm/nodes/accessors/ColorsNode.d.ts +0 -10
  72. three/examples/jsm/nodes/accessors/LightNode.d.ts +0 -12
  73. three/examples/jsm/nodes/accessors/NormalNode.d.ts +0 -13
  74. three/examples/jsm/nodes/accessors/PositionNode.d.ts +0 -15
  75. three/examples/jsm/nodes/accessors/ReflectNode.d.ts +0 -12
  76. three/examples/jsm/nodes/accessors/ResolutionNode.d.ts +0 -14
  77. three/examples/jsm/nodes/accessors/ScreenUVNode.d.ts +0 -11
  78. three/examples/jsm/nodes/accessors/UVNode.d.ts +0 -10
  79. three/examples/jsm/nodes/core/AttributeNode.d.ts +0 -13
  80. three/examples/jsm/nodes/core/ConstNode.d.ts +0 -22
  81. three/examples/jsm/nodes/core/ExpressionNode.d.ts +0 -5
  82. three/examples/jsm/nodes/core/FunctionCallNode.d.ts +0 -17
  83. three/examples/jsm/nodes/core/FunctionNode.d.ts +0 -28
  84. three/examples/jsm/nodes/core/InputNode.d.ts +0 -12
  85. three/examples/jsm/nodes/core/Node.d.ts +0 -34
  86. three/examples/jsm/nodes/core/NodeBuilder.d.ts +0 -149
  87. three/examples/jsm/nodes/core/NodeFrame.d.ts +0 -17
  88. three/examples/jsm/nodes/core/NodeLib.d.ts +0 -22
  89. three/examples/jsm/nodes/core/NodeUniform.d.ts +0 -17
  90. three/examples/jsm/nodes/core/NodeUtils.d.ts +0 -7
  91. three/examples/jsm/nodes/core/StructNode.d.ts +0 -19
  92. three/examples/jsm/nodes/core/TempNode.d.ts +0 -23
  93. three/examples/jsm/nodes/core/VarNode.d.ts +0 -12
  94. three/examples/jsm/nodes/effects/BlurNode.d.ts +0 -31
  95. three/examples/jsm/nodes/effects/ColorAdjustmentNode.d.ts +0 -27
  96. three/examples/jsm/nodes/effects/LuminanceNode.d.ts +0 -18
  97. three/examples/jsm/nodes/inputs/BoolNode.d.ts +0 -19
  98. three/examples/jsm/nodes/inputs/ColorNode.d.ts +0 -21
  99. three/examples/jsm/nodes/inputs/CubeTextureNode.d.ts +0 -17
  100. three/examples/jsm/nodes/inputs/FloatNode.d.ts +0 -19
  101. three/examples/jsm/nodes/inputs/IntNode.d.ts +0 -19
  102. three/examples/jsm/nodes/inputs/Matrix3Node.d.ts +0 -22
  103. three/examples/jsm/nodes/inputs/Matrix4Node.d.ts +0 -22
  104. three/examples/jsm/nodes/inputs/PropertyNode.d.ts +0 -10
  105. three/examples/jsm/nodes/inputs/RTTNode.d.ts +0 -27
  106. three/examples/jsm/nodes/inputs/ReflectorNode.d.ts +0 -21
  107. three/examples/jsm/nodes/inputs/ScreenNode.d.ts +0 -11
  108. three/examples/jsm/nodes/inputs/TextureNode.d.ts +0 -20
  109. three/examples/jsm/nodes/inputs/Vector2Node.d.ts +0 -21
  110. three/examples/jsm/nodes/inputs/Vector3Node.d.ts +0 -21
  111. three/examples/jsm/nodes/inputs/Vector4Node.d.ts +0 -21
  112. three/examples/jsm/nodes/materials/BasicNodeMaterial.d.ts +0 -11
  113. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -21
  114. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +0 -28
  115. three/examples/jsm/nodes/materials/PhongNodeMaterial.d.ts +0 -21
  116. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +0 -12
  117. three/examples/jsm/nodes/materials/StandardNodeMaterial.d.ts +0 -25
  118. three/examples/jsm/nodes/materials/nodes/BasicNode.d.ts +0 -15
  119. three/examples/jsm/nodes/materials/nodes/MeshStandardNode.d.ts +0 -25
  120. three/examples/jsm/nodes/materials/nodes/PhongNode.d.ts +0 -14
  121. three/examples/jsm/nodes/materials/nodes/RawNode.d.ts +0 -10
  122. three/examples/jsm/nodes/materials/nodes/SpriteNode.d.ts +0 -13
  123. three/examples/jsm/nodes/materials/nodes/StandardNode.d.ts +0 -15
  124. three/examples/jsm/nodes/math/CondNode.d.ts +0 -26
  125. three/examples/jsm/nodes/math/MathNode.d.ts +0 -57
  126. three/examples/jsm/nodes/math/OperatorNode.d.ts +0 -17
  127. three/examples/jsm/nodes/misc/BumpMapNode.d.ts +0 -21
  128. three/examples/jsm/nodes/misc/NormalMapNode.d.ts +0 -19
  129. three/examples/jsm/nodes/misc/TextureCubeNode.d.ts +0 -21
  130. three/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts +0 -18
  131. three/examples/jsm/nodes/postprocessing/NodePass.d.ts +0 -15
  132. three/examples/jsm/nodes/postprocessing/NodePostProcessing.d.ts +0 -26
  133. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +0 -17
  134. three/examples/jsm/nodes/procedural/NoiseNode.d.ts +0 -17
  135. three/examples/jsm/nodes/utils/BypassNode.d.ts +0 -11
  136. three/examples/jsm/nodes/utils/ColorSpaceNode.d.ts +0 -55
  137. three/examples/jsm/nodes/utils/JoinNode.d.ts +0 -15
  138. three/examples/jsm/nodes/utils/MaxMIPLevelNode.d.ts +0 -11
  139. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +0 -17
  140. three/examples/jsm/nodes/utils/SubSlot.d.ts +0 -9
  141. three/examples/jsm/nodes/utils/SwitchNode.d.ts +0 -11
  142. three/examples/jsm/nodes/utils/TimerNode.d.ts +0 -19
  143. three/examples/jsm/nodes/utils/UVTransformNode.d.ts +0 -15
  144. three/examples/jsm/nodes/utils/VelocityNode.d.ts +0 -28
  145. three/examples/jsm/objects/ReflectorRTT.d.ts +0 -6
  146. three/examples/jsm/postprocessing/SSRrPass.d.ts +0 -121
three/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 27 Jan 2022 22:31:34 GMT
11
+ * Last updated: Tue, 03 May 2022 17:01:38 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `THREE`
14
14
 
@@ -1,7 +1,9 @@
1
- export namespace WEBGL {
1
+ declare namespace WEBGL {
2
2
  function isWebGLAvailable(): boolean;
3
3
  function isWebGL2Available(): boolean;
4
4
  function getWebGLErrorMessage(): HTMLElement;
5
5
  function getWebGL2ErrorMessage(): HTMLElement;
6
6
  function getErrorMessage(version: number): HTMLElement;
7
7
  }
8
+
9
+ export default WEBGL;
@@ -42,7 +42,6 @@ export class OrbitControls {
42
42
  autoRotate: boolean;
43
43
  autoRotateSpeed: number;
44
44
 
45
- enableKeys: boolean;
46
45
  keys: { LEFT: string; UP: string; RIGHT: string; BOTTOM: string };
47
46
  mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
48
47
  touches: { ONE: TOUCH; TWO: TOUCH };
@@ -53,7 +52,7 @@ export class OrbitControls {
53
52
 
54
53
  update(): boolean;
55
54
 
56
- listenToKeyEvents(domElement: HTMLElement): void;
55
+ listenToKeyEvents(domElement: HTMLElement | Window): void;
57
56
 
58
57
  saveState(): void;
59
58
 
@@ -1,4 +1,4 @@
1
- import { Object3D, Camera, MOUSE, Raycaster } from '../../../src/Three';
1
+ import { Object3D, Camera, MOUSE, Raycaster, Mesh, Vector3, Quaternion } from '../../../src/Three';
2
2
 
3
3
  export class TransformControls extends Object3D {
4
4
  constructor(object: Camera, domElement?: HTMLElement);
@@ -40,3 +40,43 @@ export class TransformControls extends Object3D {
40
40
  reset(): void;
41
41
  dispose(): void;
42
42
  }
43
+
44
+ export class TransformControlsGizmo extends Object3D {
45
+ type: 'TransformControlsGizmo';
46
+ isTransformControlsGizmo: true;
47
+
48
+ gizmo: {
49
+ translate: Object3D;
50
+ rotate: Object3D;
51
+ scale: Object3D;
52
+ };
53
+ helper: {
54
+ translate: Object3D;
55
+ rotate: Object3D;
56
+ scale: Object3D;
57
+ };
58
+ picker: {
59
+ translate: Object3D;
60
+ rotate: Object3D;
61
+ scale: Object3D;
62
+ };
63
+
64
+ constructor();
65
+ }
66
+
67
+ export class TransformControlsPlane extends Mesh {
68
+ type: 'TransformControlsPlane';
69
+ isTransformControlsPlane: true;
70
+
71
+ constructor();
72
+
73
+ mode: 'translate' | 'scale' | 'rotate';
74
+
75
+ axis: 'X' | 'Y' | 'Z' | 'XY' | 'YZ' | 'XZ' | 'XYZ' | 'E';
76
+
77
+ space: 'local' | 'world';
78
+
79
+ eye: Vector3;
80
+ worldPosition: Vector3;
81
+ worldQuaternion: Quaternion;
82
+ }
@@ -1,70 +1,68 @@
1
1
  import { Curve, Vector3 } from '../../../src/Three';
2
2
 
3
- export namespace Curves {
4
- class GrannyKnot extends Curve<Vector3> {
5
- constructor();
6
- }
3
+ export class GrannyKnot extends Curve<Vector3> {
4
+ constructor();
5
+ }
7
6
 
8
- class HeartCurve extends Curve<Vector3> {
9
- constructor(scale?: number);
10
- scale: number;
11
- }
7
+ export class HeartCurve extends Curve<Vector3> {
8
+ constructor(scale?: number);
9
+ scale: number;
10
+ }
12
11
 
13
- class VivianiCurve extends Curve<Vector3> {
14
- constructor(scale?: number);
15
- scale: number;
16
- }
12
+ export class VivianiCurve extends Curve<Vector3> {
13
+ constructor(scale?: number);
14
+ scale: number;
15
+ }
17
16
 
18
- class KnotCurve extends Curve<Vector3> {
19
- constructor();
20
- }
17
+ export class KnotCurve extends Curve<Vector3> {
18
+ constructor();
19
+ }
21
20
 
22
- class HelixCurve extends Curve<Vector3> {
23
- constructor();
24
- }
21
+ export class HelixCurve extends Curve<Vector3> {
22
+ constructor();
23
+ }
25
24
 
26
- class TrefoilKnot extends Curve<Vector3> {
27
- constructor(scale?: number);
28
- scale: number;
29
- }
25
+ export class TrefoilKnot extends Curve<Vector3> {
26
+ constructor(scale?: number);
27
+ scale: number;
28
+ }
30
29
 
31
- class TorusKnot extends Curve<Vector3> {
32
- constructor(scale?: number);
33
- scale: number;
34
- }
30
+ export class TorusKnot extends Curve<Vector3> {
31
+ constructor(scale?: number);
32
+ scale: number;
33
+ }
35
34
 
36
- class CinquefoilKnot extends Curve<Vector3> {
37
- constructor(scale?: number);
38
- scale: number;
39
- }
35
+ export class CinquefoilKnot extends Curve<Vector3> {
36
+ constructor(scale?: number);
37
+ scale: number;
38
+ }
40
39
 
41
- class TrefoilPolynomialKnot extends Curve<Vector3> {
42
- constructor(scale?: number);
43
- scale: number;
44
- }
40
+ export class TrefoilPolynomialKnot extends Curve<Vector3> {
41
+ constructor(scale?: number);
42
+ scale: number;
43
+ }
45
44
 
46
- class FigureEightPolynomialKnot extends Curve<Vector3> {
47
- constructor(scale?: number);
48
- scale: number;
49
- }
45
+ export class FigureEightPolynomialKnot extends Curve<Vector3> {
46
+ constructor(scale?: number);
47
+ scale: number;
48
+ }
50
49
 
51
- class DecoratedTorusKnot4a extends Curve<Vector3> {
52
- constructor(scale?: number);
53
- scale: number;
54
- }
50
+ export class DecoratedTorusKnot4a extends Curve<Vector3> {
51
+ constructor(scale?: number);
52
+ scale: number;
53
+ }
55
54
 
56
- class DecoratedTorusKnot4b extends Curve<Vector3> {
57
- constructor(scale?: number);
58
- scale: number;
59
- }
55
+ export class DecoratedTorusKnot4b extends Curve<Vector3> {
56
+ constructor(scale?: number);
57
+ scale: number;
58
+ }
60
59
 
61
- class DecoratedTorusKnot5a extends Curve<Vector3> {
62
- constructor(scale?: number);
63
- scale: number;
64
- }
60
+ export class DecoratedTorusKnot5a extends Curve<Vector3> {
61
+ constructor(scale?: number);
62
+ scale: number;
63
+ }
65
64
 
66
- class DecoratedTorusKnot5c extends Curve<Vector3> {
67
- constructor(scale?: number);
68
- scale: number;
69
- }
65
+ export class DecoratedTorusKnot5c extends Curve<Vector3> {
66
+ constructor(scale?: number);
67
+ scale: number;
70
68
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @author sciecode / https://github.com/sciecode
3
+ *
4
+ * EXR format references:
5
+ * https://www.openexr.com/documentation/openexrfilelayout.pdf
6
+ */
7
+
8
+ import { WebGLRenderer, WebGLRenderTarget, TextureDataType } from '../../../src/Three';
9
+
10
+ export const NO_COMPRESSION: 0;
11
+ export const ZIPS_COMPRESSION: 2;
12
+ export const ZIP_COMPRESSION: 3;
13
+
14
+ export interface EXRExporterParseOptions {
15
+ compression?: number;
16
+ type?: TextureDataType;
17
+ }
18
+
19
+ export class EXRExporter {
20
+ parse(renderer: WebGLRenderer, renderTarget: WebGLRenderTarget, options?: EXRExporterParseOptions): Uint8Array;
21
+ }
@@ -1,20 +1,117 @@
1
- import { Object3D, AnimationClip } from '../../../src/Three';
1
+ import { Object3D, AnimationClip, Texture, Material, Mesh } from '../../../src/Three';
2
2
 
3
3
  export interface GLTFExporterOptions {
4
- binary?: boolean;
4
+ /**
5
+ * Export position, rotation and scale instead of matrix per node. Default is false
6
+ */
5
7
  trs?: boolean;
8
+
9
+ /**
10
+ * Export only visible objects. Default is true.
11
+ */
6
12
  onlyVisible?: boolean;
13
+
14
+ /**
15
+ * Export just the attributes within the drawRange, if defined, instead of exporting the whole array. Default is true.
16
+ */
7
17
  truncateDrawRange?: boolean;
18
+
19
+ /**
20
+ * Export in binary (.glb) format, returning an ArrayBuffer. Default is false.
21
+ */
22
+ binary?: boolean;
23
+
24
+ /**
25
+ * Export with images embedded into the glTF asset. Default is true.
26
+ */
8
27
  embedImages?: boolean;
28
+
29
+ /**
30
+ * Restricts the image maximum size (both width and height) to the given value. This option works only if embedImages is true. Default is Infinity.
31
+ */
32
+ maxTextureSize?: number;
33
+
34
+ /**
35
+ * List of animations to be included in the export.
36
+ */
9
37
  animations?: AnimationClip[];
38
+
39
+ /**
40
+ * Generate indices for non-index geometry and export with them. Default is false.
41
+ */
10
42
  forceIndices?: boolean;
11
- forcePowerOfTwoTextures?: boolean;
43
+
44
+ /**
45
+ * Export custom glTF extensions defined on an object's userData.gltfExtensions property. Default is false.
46
+ */
12
47
  includeCustomExtensions?: boolean;
13
48
  }
14
49
 
15
50
  export class GLTFExporter {
16
51
  constructor();
17
52
 
18
- parse(input: Object3D, onCompleted: (gltf: object) => void, options: GLTFExporterOptions): void;
19
- parseAsync(input: Object3D, options: GLTFExporterOptions): Promise<void>;
53
+ register(callback: (writer: GLTFWriter) => GLTFExporterPlugin): this;
54
+ unregister(callback: (writer: GLTFWriter) => GLTFExporterPlugin): this;
55
+
56
+ /**
57
+ * Generates a .gltf (JSON) or .glb (binary) output from the input (Scenes or Objects)
58
+ *
59
+ * @param input Scenes or objects to export. Valid options:
60
+ * - Export scenes
61
+ * ```js
62
+ * exporter.parse( scene1, ... )
63
+ * exporter.parse( [ scene1, scene2 ], ... )
64
+ * ```
65
+ * - Export objects (It will create a new Scene to hold all the objects)
66
+ * ```js
67
+ * exporter.parse( object1, ... )
68
+ * exporter.parse( [ object1, object2 ], ... )
69
+ * ```
70
+ * - Mix scenes and objects (It will export the scenes as usual but it will create a new scene to hold all the single objects).
71
+ * ```js
72
+ * exporter.parse( [ scene1, object1, object2, scene2 ], ... )
73
+ * ```
74
+ * @param onDone Will be called when the export completes. The argument will be the generated glTF JSON or binary ArrayBuffer.
75
+ * @param onError Will be called if there are any errors during the gltf generation.
76
+ * @param options Export options
77
+ */
78
+ parse(
79
+ input: Object3D | Object3D[],
80
+ onDone: (gltf: ArrayBuffer | { [key: string]: any }) => void,
81
+ onError: (error: ErrorEvent) => void,
82
+ options?: GLTFExporterOptions,
83
+ ): void;
84
+
85
+ parseAsync(
86
+ input: Object3D | Object3D[],
87
+ options?: GLTFExporterOptions,
88
+ ): Promise<ArrayBuffer | { [key: string]: any }>;
89
+ }
90
+
91
+ export class GLTFWriter {
92
+ constructor();
93
+
94
+ setPlugins(plugins: GLTFExporterPlugin[]);
95
+
96
+ /**
97
+ * Parse scenes and generate GLTF output
98
+ *
99
+ * @param input Scene or Array of THREE.Scenes
100
+ * @param onDone Callback on completed
101
+ * @param options options
102
+ */
103
+ write(
104
+ input: Object3D | Object3D[],
105
+ onDone: (gltf: ArrayBuffer | { [key: string]: any }) => void,
106
+ options?: GLTFExporterOptions,
107
+ ): Promise<void>;
108
+ }
109
+
110
+ export interface GLTFExporterPlugin {
111
+ writeTexture?: (map: Texture, textureDef: { [key: string]: any }) => void;
112
+ writeMaterial?: (material: Material, materialDef: { [key: string]: any }) => void;
113
+ writeMesh?: (mesh: Mesh, meshDef: { [key: string]: any }) => void;
114
+ writeNode?: (object: Object3D, nodeDef: { [key: string]: any }) => void;
115
+ beforeParse?: (input: Object3D | Object3D[]) => void;
116
+ afterParse?: (input: Object3D | Object3D[]) => void;
20
117
  }
@@ -0,0 +1,14 @@
1
+ import { ColorRepresentation, LineSegments } from '../../../src/Three';
2
+ import { Octree } from '../math/Octree';
3
+
4
+ export class OctreeHelper extends LineSegments {
5
+ constructor(octree: Octree, color: ColorRepresentation);
6
+
7
+ octree: Octree;
8
+ color: ColorRepresentation;
9
+
10
+ /**
11
+ * @default 'OctreeHelper'
12
+ */
13
+ type: 'OctreeHelper' | string;
14
+ }
@@ -2,4 +2,5 @@ import { Mesh } from 'three';
2
2
 
3
3
  export class HTMLMesh extends Mesh {
4
4
  constructor(dom: HTMLElement);
5
+ dispose(): void;
5
6
  }
@@ -91,25 +91,23 @@ export class GLTFParser {
91
91
 
92
92
  fileLoader: FileLoader;
93
93
  textureLoader: TextureLoader | ImageBitmapLoader;
94
- plugins: GLTFLoaderPlugin;
94
+ plugins: { [name: string]: GLTFLoaderPlugin };
95
95
  extensions: { [name: string]: any };
96
96
  associations: Map<Object3D | Material | Texture, GLTFReference>;
97
97
 
98
+ setExtensions(extensions: { [name: string]: any }): void;
99
+ setPlugins(plugins: { [name: string]: GLTFLoaderPlugin }): void;
100
+
101
+ parse(onLoad: (gltf: GLTF) => void, onError?: (event: ErrorEvent) => void): void;
102
+
98
103
  getDependency: (type: string, index: number) => Promise<any>;
99
104
  getDependencies: (type: string) => Promise<any[]>;
100
105
  loadBuffer: (bufferIndex: number) => Promise<ArrayBuffer>;
101
106
  loadBufferView: (bufferViewIndex: number) => Promise<ArrayBuffer>;
102
107
  loadAccessor: (accessorIndex: number) => Promise<BufferAttribute | InterleavedBufferAttribute>;
103
108
  loadTexture: (textureIndex: number) => Promise<Texture>;
104
- loadTextureImage: (
105
- textureIndex: number,
106
- /**
107
- * GLTF.Image
108
- * See: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/image.schema.json
109
- */
110
- source: { [key: string]: any },
111
- loader: Loader,
112
- ) => Promise<Texture>;
109
+ loadTextureImage: (textureIndex: number, sourceIndex: number, loader: Loader) => Promise<Texture>;
110
+ loadImageSource: (sourceIndex: number, loader: Loader) => Promise<Texture>;
113
111
  assignTexture: (
114
112
  materialParams: { [key: string]: any },
115
113
  mapName: string,
@@ -1,9 +1,9 @@
1
- import { Loader, LoadingManager, DataTexture, DataTexture3D } from '../../../src/Three';
1
+ import { Loader, LoadingManager, DataTexture, Data3DTexture } from '../../../src/Three';
2
2
 
3
3
  export interface LUT3dlResult {
4
4
  size: number;
5
5
  texture: DataTexture;
6
- texture3D: DataTexture3D;
6
+ texture3D: Data3DTexture;
7
7
  }
8
8
 
9
9
  export class LUT3dlLoader extends Loader {
@@ -1,4 +1,4 @@
1
- import { Loader, LoadingManager, Vector3, DataTexture, DataTexture3D } from '../../../src/Three';
1
+ import { Loader, LoadingManager, Vector3, DataTexture, Data3DTexture } from '../../../src/Three';
2
2
 
3
3
  export interface LUTCubeResult {
4
4
  title: string;
@@ -6,7 +6,7 @@ export interface LUTCubeResult {
6
6
  domainMin: Vector3;
7
7
  domainMax: Vector3;
8
8
  texture: DataTexture;
9
- texture3D: DataTexture3D;
9
+ texture3D: Data3DTexture;
10
10
  }
11
11
 
12
12
  export class LUTCubeLoader extends Loader {
@@ -1,4 +1,4 @@
1
- import { DataTexture3D, Mesh, Loader, LoadingManager } from '../../../src/Three';
1
+ import { Data3DTexture, Mesh, Loader, LoadingManager } from '../../../src/Three';
2
2
 
3
3
  export interface Chunk {
4
4
  palette: number[];
@@ -23,6 +23,6 @@ export class VOXMesh extends Mesh {
23
23
  constructor(chunk: Chunk);
24
24
  }
25
25
 
26
- export class VOXDataTexture3D extends DataTexture3D {
26
+ export class VOXData3DTexture extends Data3DTexture {
27
27
  constructor(chunk: Chunk);
28
28
  }
@@ -1,4 +1,11 @@
1
- import { Mesh, BufferGeometry, ColorRepresentation, TextureEncoding, WebGLRenderTarget } from '../../../src/Three';
1
+ import {
2
+ Mesh,
3
+ BufferGeometry,
4
+ ColorRepresentation,
5
+ TextureEncoding,
6
+ WebGLRenderTarget,
7
+ PerspectiveCamera,
8
+ } from '../../../src/Three';
2
9
 
3
10
  export interface ReflectorOptions {
4
11
  color?: ColorRepresentation;
@@ -7,9 +14,13 @@ export interface ReflectorOptions {
7
14
  clipBias?: number;
8
15
  shader?: object;
9
16
  encoding?: TextureEncoding;
17
+ multisample?: number;
10
18
  }
11
19
 
12
20
  export class Reflector extends Mesh {
21
+ type: 'Reflector';
22
+ camera: PerspectiveCamera;
23
+
13
24
  constructor(geometry?: BufferGeometry, options?: ReflectorOptions);
14
25
 
15
26
  getRenderTarget(): WebGLRenderTarget;
@@ -1,4 +1,11 @@
1
- import { Mesh, BufferGeometry, ColorRepresentation, TextureEncoding, WebGLRenderTarget } from '../../../src/Three';
1
+ import {
2
+ Mesh,
3
+ BufferGeometry,
4
+ ColorRepresentation,
5
+ TextureEncoding,
6
+ WebGLRenderTarget,
7
+ PerspectiveCamera,
8
+ } from '../../../src/Three';
2
9
 
3
10
  export interface RefractorOptions {
4
11
  color?: ColorRepresentation;
@@ -7,9 +14,13 @@ export interface RefractorOptions {
7
14
  clipBias?: number;
8
15
  shader?: object;
9
16
  encoding?: TextureEncoding;
17
+ multisample?: number;
10
18
  }
11
19
 
12
20
  export class Refractor extends Mesh {
21
+ type: 'Refractor';
22
+ camera: PerspectiveCamera;
23
+
13
24
  constructor(geometry?: BufferGeometry, options?: RefractorOptions);
14
25
 
15
26
  getRenderTarget(): WebGLRenderTarget;
@@ -1,13 +1,13 @@
1
- import { DataTexture, DataTexture3D } from '../../../src/Three';
1
+ import { DataTexture, Data3DTexture } from '../../../src/Three';
2
2
  import { ShaderPass } from './ShaderPass';
3
3
 
4
4
  export interface LUTPassParameters {
5
- lut?: DataTexture | DataTexture3D;
5
+ lut?: DataTexture | Data3DTexture;
6
6
  intensity?: number;
7
7
  }
8
8
 
9
9
  export class LUTPass extends ShaderPass {
10
- lut?: DataTexture | DataTexture3D;
10
+ lut?: DataTexture | Data3DTexture;
11
11
  intensity?: number;
12
12
  constructor(params: LUTPassParameters);
13
13
  }
@@ -3,7 +3,7 @@ import { Scene, Camera, ColorRepresentation, ShaderMaterial, WebGLRenderTarget }
3
3
  import { Pass } from './Pass';
4
4
 
5
5
  export class SSAARenderPass extends Pass {
6
- constructor(scene: Scene, camera: Camera, clearColor: ColorRepresentation, clearAlpha: number);
6
+ constructor(scene: Scene, camera: Camera, clearColor?: ColorRepresentation, clearAlpha?: number);
7
7
  scene: Scene;
8
8
  camera: Camera;
9
9
  sampleLevel: number;
@@ -3,7 +3,7 @@ import { ShaderMaterial, WebGLRenderTarget } from '../../../src/Three';
3
3
  import { Pass } from './Pass';
4
4
 
5
5
  export class SavePass extends Pass {
6
- constructor(renderTarget: WebGLRenderTarget);
6
+ constructor(renderTarget?: WebGLRenderTarget);
7
7
  textureID: string;
8
8
  renderTarget: WebGLRenderTarget;
9
9
  uniforms: object;
@@ -15,3 +15,11 @@ export function estimateBytesUsed(geometry: BufferGeometry): number;
15
15
  export function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
16
16
  export function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: TrianglesDrawModes): BufferGeometry;
17
17
  export function computeMorphedAttributes(object: Mesh | Line | Points): object;
18
+ export function computeMikkTSpaceTangents(
19
+ geometry: BufferGeometry,
20
+ MikkTSpace: unknown,
21
+ negateSign?: boolean,
22
+ ): BufferGeometry;
23
+ export function mergeGroups(geometry: BufferGeometry): BufferGeometry;
24
+ export function deinterleaveAttribute(geometry: BufferGeometry): void;
25
+ export function deinterleaveGeometry(geometry: BufferGeometry): void;
@@ -1,4 +1,4 @@
1
- import { BufferGeometry, Group, InstancedMesh, Material, Object3D, Scene } from '../../../src/Three';
1
+ import { BufferGeometry, Group, InstancedMesh, Material, Object3D, Scene, Mesh } from '../../../src/Three';
2
2
 
3
3
  export function createMeshesFromInstancedMesh(instancedMesh: InstancedMesh): Group;
4
4
  export function createMultiMaterialObject(geometry: BufferGeometry, materials: Material[]): Group;
@@ -10,3 +10,5 @@ export function detach(child: Object3D, parent: Object3D, scene: Scene): void;
10
10
  * @deprecated Use parent.attach( child ) instead.
11
11
  */
12
12
  export function attach(child: Object3D, scene: Scene, parent: Object3D): void;
13
+
14
+ export function createMeshesFromMultiMaterialMesh(mesh: Mesh): Group;
@@ -1,30 +1,34 @@
1
1
  import { AnimationClip, Bone, Matrix4, Object3D, Skeleton, SkeletonHelper } from '../../../src/Three';
2
2
 
3
3
  export namespace SkeletonUtils {
4
- function retarget(target: Object3D | Skeleton, source: Object3D | Skeleton, options: {}): void;
4
+ export function retarget(target: Object3D | Skeleton, source: Object3D | Skeleton, options: {}): void;
5
5
 
6
- function retargetClip(
6
+ export function retargetClip(
7
7
  target: Skeleton | Object3D,
8
8
  source: Skeleton | Object3D,
9
9
  clip: AnimationClip,
10
10
  options: {},
11
11
  ): AnimationClip;
12
12
 
13
- function getHelperFromSkeleton(skeleton: Skeleton): SkeletonHelper;
13
+ export function getHelperFromSkeleton(skeleton: Skeleton): SkeletonHelper;
14
14
 
15
- function getSkeletonOffsets(target: Object3D | Skeleton, source: Object3D | Skeleton, options: {}): Matrix4[];
15
+ export function getSkeletonOffsets(
16
+ target: Object3D | Skeleton,
17
+ source: Object3D | Skeleton,
18
+ options: {},
19
+ ): Matrix4[];
16
20
 
17
- function renameBones(skeleton: Skeleton, names: {}): any;
21
+ export function renameBones(skeleton: Skeleton, names: {}): any;
18
22
 
19
- function getBones(skeleton: Skeleton | Bone[]): Bone[];
23
+ export function getBones(skeleton: Skeleton | Bone[]): Bone[];
20
24
 
21
- function getBoneByName(name: string, skeleton: Skeleton): Bone;
25
+ export function getBoneByName(name: string, skeleton: Skeleton): Bone;
22
26
 
23
- function getNearestBone(bone: Bone, names: {}): Bone;
27
+ export function getNearestBone(bone: Bone, names: {}): Bone;
24
28
 
25
- function findBoneTrackData(name: string, tracks: any[]): {};
29
+ export function findBoneTrackData(name: string, tracks: any[]): {};
26
30
 
27
- function getEqualsBonesNames(skeleton: Skeleton, targetSkeleton: Skeleton): string[];
31
+ export function getEqualsBonesNames(skeleton: Skeleton, targetSkeleton: Skeleton): string[];
28
32
 
29
- function clone(source: Object3D): Object3D;
33
+ export function clone(source: Object3D): Object3D;
30
34
  }
three/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
- // Type definitions for three 0.137
1
+ // Type definitions for three 0.140
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
6
  // Minimum TypeScript Version: 3.6
7
7
 
8
+ // To update three.js type definition, please make changes to the repository at:
9
+ // https://github.com/three-types/three-ts-types.
10
+ // Periodically, the updates from the repository are pushed to DefinitelyTyped
11
+ // and released in the @types/three npm package.
12
+
8
13
  export * from './src/Three';
9
14
 
10
- /*~ If this module is a UMD module that exposes a global variable 'myLib' when
11
- *~ loaded outside a module loader environment, declare that global here.
12
- *~ Otherwise, delete this declaration.
13
- */
14
15
  export as namespace THREE;
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.137.0",
3
+ "version": "0.140.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,6 +25,6 @@
25
25
  },
26
26
  "scripts": {},
27
27
  "dependencies": {},
28
- "typesPublisherContentHash": "dad1fe1dce939480949b1f93552d8ca03cab08b655aca66703302855e9fb414d",
29
- "typeScriptVersion": "3.8"
28
+ "typesPublisherContentHash": "0003f52bd6b42bfc5b77be02ad5eee29a50d1ddc25ce1b64506a2253f0420782",
29
+ "typeScriptVersion": "3.9"
30
30
  }