@types/three 0.162.0 → 0.164.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 (98) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/animation/CCDIKSolver.d.ts +19 -6
  3. three/examples/jsm/controls/OrbitControls.d.ts +1 -1
  4. three/examples/jsm/exporters/USDZExporter.d.ts +8 -1
  5. three/examples/jsm/geometries/TextGeometry.d.ts +8 -0
  6. three/examples/jsm/interactive/SelectionBox.d.ts +1 -0
  7. three/examples/jsm/loaders/FontLoader.d.ts +18 -4
  8. three/examples/jsm/loaders/LUT3dlLoader.d.ts +1 -2
  9. three/examples/jsm/loaders/LUTCubeLoader.d.ts +1 -2
  10. three/examples/jsm/loaders/RGBMLoader.d.ts +5 -0
  11. three/examples/jsm/loaders/TTFLoader.d.ts +5 -3
  12. three/examples/jsm/math/Octree.d.ts +2 -1
  13. three/examples/jsm/nodes/Nodes.d.ts +33 -5
  14. three/examples/jsm/nodes/accessors/AccessorsUtils.d.ts +2 -0
  15. three/examples/jsm/nodes/accessors/BatchNode.d.ts +14 -0
  16. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +2 -1
  17. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +84 -1
  18. three/examples/jsm/nodes/accessors/RendererReferenceNode.d.ts +16 -0
  19. three/examples/jsm/nodes/accessors/TextureNode.d.ts +11 -1
  20. three/examples/jsm/nodes/code/CodeNode.d.ts +7 -2
  21. three/examples/jsm/nodes/code/FunctionNode.d.ts +10 -4
  22. three/examples/jsm/nodes/core/LightingModel.d.ts +1 -0
  23. three/examples/jsm/nodes/core/Node.d.ts +7 -3
  24. three/examples/jsm/nodes/core/NodeBuilder.d.ts +1 -1
  25. three/examples/jsm/nodes/core/NodeUtils.d.ts +1 -1
  26. three/examples/jsm/nodes/core/OutputStructNode.d.ts +12 -0
  27. three/examples/jsm/nodes/core/PropertyNode.d.ts +10 -0
  28. three/examples/jsm/nodes/display/PassNode.d.ts +2 -0
  29. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +12 -0
  30. three/examples/jsm/nodes/fog/FogNode.d.ts +10 -5
  31. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +9 -5
  32. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +3 -1
  33. three/examples/jsm/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts +10 -0
  34. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +7 -2
  35. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts +16 -0
  36. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +10 -2
  37. three/examples/jsm/nodes/functions/ShadowMaskModel.d.ts +9 -0
  38. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +3 -2
  39. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +3 -2
  40. three/examples/jsm/nodes/lighting/AnalyticLightNode.d.ts +0 -2
  41. three/examples/jsm/nodes/lighting/IrradianceNode.d.ts +8 -0
  42. three/examples/jsm/nodes/lighting/LightUtils.d.ts +7 -2
  43. three/examples/jsm/nodes/materials/Materials.d.ts +2 -0
  44. three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.d.ts +23 -0
  45. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +24 -14
  46. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +9 -2
  47. three/examples/jsm/nodes/materials/ShadowNodeMaterial.d.ts +15 -0
  48. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +36 -32
  49. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +3 -4
  50. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +127 -6
  51. three/examples/jsm/nodes/materialx/lib/mx_transform_color.d.ts +4 -0
  52. three/examples/jsm/nodes/pmrem/PMREMNode.d.ts +20 -0
  53. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +6 -3
  54. three/examples/jsm/objects/QuadMesh.d.ts +5 -8
  55. three/examples/jsm/physics/JoltPhysics.d.ts +10 -0
  56. three/examples/jsm/postprocessing/RenderTransitionPass.d.ts +33 -0
  57. three/examples/jsm/renderers/common/Info.d.ts +3 -7
  58. three/examples/jsm/renderers/common/PostProcessing.d.ts +3 -1
  59. three/examples/jsm/renderers/common/Renderer.d.ts +11 -5
  60. three/examples/jsm/renderers/common/extras/PMREMGenerator.d.ts +8 -0
  61. three/examples/jsm/renderers/webgl/WebGLBackend.d.ts +4 -0
  62. three/examples/jsm/utils/SceneUtils.d.ts +18 -0
  63. three/examples/jsm/webxr/OculusHandModel.d.ts +5 -2
  64. three/examples/jsm/webxr/XRHandModelFactory.d.ts +8 -2
  65. three/index.d.ts +1 -1
  66. three/package.json +4 -4
  67. three/src/Three.d.ts +0 -1
  68. three/src/cameras/Camera.d.ts +3 -0
  69. three/src/constants.d.ts +10 -40
  70. three/src/core/Object3D.d.ts +6 -5
  71. three/src/core/RenderTarget.d.ts +25 -10
  72. three/src/materials/Material.d.ts +46 -23
  73. three/src/materials/MeshPhysicalMaterial.d.ts +65 -51
  74. three/src/materials/ShaderMaterial.d.ts +2 -17
  75. three/src/objects/BatchedMesh.d.ts +11 -1
  76. three/src/objects/InstancedMesh.d.ts +1 -1
  77. three/src/objects/SkinnedMesh.d.ts +0 -2
  78. three/src/renderers/WebGLRenderer.d.ts +2 -2
  79. three/src/renderers/shaders/ShaderChunk.d.ts +0 -1
  80. three/src/renderers/webgl/WebGLAttributes.d.ts +1 -2
  81. three/src/renderers/webgl/WebGLBindingStates.d.ts +1 -8
  82. three/src/renderers/webgl/WebGLBufferRenderer.d.ts +6 -3
  83. three/src/renderers/webgl/WebGLCapabilities.d.ts +13 -6
  84. three/src/renderers/webgl/WebGLExtensions.d.ts +1 -3
  85. three/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +7 -1
  86. three/src/renderers/webgl/WebGLLights.d.ts +1 -2
  87. three/src/renderers/webgl/WebGLPrograms.d.ts +2 -9
  88. three/src/renderers/webgl/WebGLState.d.ts +1 -3
  89. three/src/renderers/webgl/WebGLUtils.d.ts +0 -2
  90. three/src/scenes/Scene.d.ts +6 -0
  91. three/src/textures/Data3DTexture.d.ts +0 -1
  92. three/src/textures/DataArrayTexture.d.ts +0 -1
  93. three/src/textures/DepthTexture.d.ts +0 -3
  94. three/src/textures/Texture.d.ts +13 -7
  95. three/src/textures/types.d.ts +4 -4
  96. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +0 -12
  97. three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.d.ts +0 -3
  98. three/src/renderers/WebGL1Renderer.d.ts +0 -6
@@ -1,8 +1,129 @@
1
- import { Fn } from "../../code/FunctionNode.js";
2
1
  import Node from "../../core/Node.js";
3
- import { ShaderNodeObject } from "../../shadernode/ShaderNode.js";
2
+ import VarNode from "../../core/VarNode.js";
3
+ import { NodeRepresentation, ShaderNodeObject } from "../../shadernode/ShaderNode.js";
4
4
 
5
- export function mx_perlin_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>;
6
- export function mx_cell_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>;
7
- export function mx_worley_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>;
8
- export function mx_fractal_noise_float(...params: Fn<[Node, Node, Node, Node]>): ShaderNodeObject<Node>;
5
+ export const mx_select: (
6
+ b_immutable: NodeRepresentation,
7
+ t_immutable: NodeRepresentation,
8
+ f_immutable: NodeRepresentation,
9
+ ) => ShaderNodeObject<Node>;
10
+ export const mx_negate_if: (
11
+ val_immutable: NodeRepresentation,
12
+ b_immutable: NodeRepresentation,
13
+ ) => ShaderNodeObject<Node>;
14
+ export const mx_floor: (x_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
15
+ export const mx_floorfrac: (x_immutable: NodeRepresentation, i: ShaderNodeObject<VarNode>) => ShaderNodeObject<Node>;
16
+ export const mx_bilerp: (
17
+ v0_immutable: NodeRepresentation,
18
+ v1_immutable: NodeRepresentation,
19
+ v2_immutable: NodeRepresentation,
20
+ v3_immutable: NodeRepresentation,
21
+ s_immutable: NodeRepresentation,
22
+ t_immutable: NodeRepresentation,
23
+ ) => ShaderNodeObject<Node>;
24
+ export const mx_trilerp: (
25
+ v0_immutable: NodeRepresentation,
26
+ v1_immutable: NodeRepresentation,
27
+ v2_immutable: NodeRepresentation,
28
+ v3_immutable: NodeRepresentation,
29
+ v4_immutable: NodeRepresentation,
30
+ v5_immutable: NodeRepresentation,
31
+ v6_immutable: NodeRepresentation,
32
+ v7_immutable: NodeRepresentation,
33
+ s_immutable: NodeRepresentation,
34
+ t_immutable: NodeRepresentation,
35
+ r_immutable: NodeRepresentation,
36
+ ) => ShaderNodeObject<Node>;
37
+ export const mx_gradient_float: (
38
+ hash_immutable: NodeRepresentation,
39
+ x_immutable: NodeRepresentation,
40
+ y_immutable: NodeRepresentation,
41
+ z_immutable?: NodeRepresentation,
42
+ ) => ShaderNodeObject<Node>;
43
+ export const mx_gradient_vec3: (
44
+ hash_immutable: NodeRepresentation,
45
+ x_immutable: NodeRepresentation,
46
+ y_immutable: NodeRepresentation,
47
+ z_immutable?: NodeRepresentation,
48
+ ) => ShaderNodeObject<Node>;
49
+ export const mx_gradient_scale2d: (v_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
50
+ export const mx_gradient_scale3d: (v_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
51
+ export const mx_rotl32: (x_immutable: NodeRepresentation, k_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
52
+ export const mx_bjmix: (
53
+ a: ShaderNodeObject<VarNode>,
54
+ b: ShaderNodeObject<VarNode>,
55
+ c: ShaderNodeObject<VarNode>,
56
+ ) => ShaderNodeObject<Node>;
57
+ export const mx_bjfinal: (
58
+ a_immutable: NodeRepresentation,
59
+ b_immutable: NodeRepresentation,
60
+ c_immutable: NodeRepresentation,
61
+ ) => ShaderNodeObject<Node>;
62
+ export const mx_bits_to_01: (bits_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
63
+ export const mx_fade: (t_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
64
+ export const mx_hash_int: (
65
+ x_immutable: NodeRepresentation,
66
+ y_immutable?: NodeRepresentation,
67
+ z_immutable?: NodeRepresentation,
68
+ xx_immutable?: NodeRepresentation,
69
+ yy_immutable?: NodeRepresentation,
70
+ ) => ShaderNodeObject<Node>;
71
+ export const mx_hash_vec3: (
72
+ x_immutable: NodeRepresentation,
73
+ y_immutable: NodeRepresentation,
74
+ z_immutable?: NodeRepresentation,
75
+ ) => ShaderNodeObject<Node>;
76
+ export const mx_perlin_noise_float: (p_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
77
+ export const mx_perlin_noise_vec3: (p_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
78
+ export const mx_cell_noise_float: (p_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
79
+ export const mx_cell_noise_vec3: (p_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
80
+ export const mx_fractal_noise_float: (
81
+ p_immutable: NodeRepresentation,
82
+ octaves_immutable: NodeRepresentation,
83
+ lacunarity_immutable: NodeRepresentation,
84
+ diminish_immutable: NodeRepresentation,
85
+ ) => ShaderNodeObject<Node>;
86
+ export const mx_fractal_noise_vec3: (
87
+ p_immutable: NodeRepresentation,
88
+ octaves_immutable: NodeRepresentation,
89
+ lacunarity_immutable: NodeRepresentation,
90
+ diminish_immutable: NodeRepresentation,
91
+ ) => ShaderNodeObject<Node>;
92
+ export const mx_fractal_noise_vec2: (
93
+ p_immutable: NodeRepresentation,
94
+ octaves_immutable: NodeRepresentation,
95
+ lacunarity_immutable: NodeRepresentation,
96
+ diminish_immutable: NodeRepresentation,
97
+ ) => ShaderNodeObject<Node>;
98
+ export const mx_fractal_noise_vec4: (
99
+ p_immutable: NodeRepresentation,
100
+ octaves_immutable: NodeRepresentation,
101
+ lacunarity_immutable: NodeRepresentation,
102
+ diminish_immutable: NodeRepresentation,
103
+ ) => ShaderNodeObject<Node>;
104
+ export const mx_worley_distance: (
105
+ p_immutable: NodeRepresentation,
106
+ x_immutable: NodeRepresentation,
107
+ y_immutable: NodeRepresentation,
108
+ z_immutable: NodeRepresentation,
109
+ xoff_immutable: NodeRepresentation,
110
+ yoff_immutable: NodeRepresentation,
111
+ zoff_immutable: NodeRepresentation,
112
+ jitter_immutable: NodeRepresentation,
113
+ metric_immutable: NodeRepresentation,
114
+ ) => ShaderNodeObject<Node>;
115
+ export const mx_worley_noise_float: (
116
+ p_immutable: NodeRepresentation,
117
+ jitter_immutable: NodeRepresentation,
118
+ metric_immutable: NodeRepresentation,
119
+ ) => ShaderNodeObject<Node>;
120
+ export const mx_worley_noise_vec2: (
121
+ p_immutable: NodeRepresentation,
122
+ jitter_immutable: NodeRepresentation,
123
+ metric_immutable: NodeRepresentation,
124
+ ) => ShaderNodeObject<Node>;
125
+ export const mx_worley_noise_vec3: (
126
+ p_immutable: NodeRepresentation,
127
+ jitter_immutable: NodeRepresentation,
128
+ metric_immutable: NodeRepresentation,
129
+ ) => ShaderNodeObject<Node>;
@@ -0,0 +1,4 @@
1
+ import Node from "../../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../../shadernode/ShaderNode.js";
3
+
4
+ export const mx_srgb_texture_to_lin_rec709: (color_immutable: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -0,0 +1,20 @@
1
+ import { Texture } from "three";
2
+ import Node from "../core/Node.js";
3
+ import TempNode from "../core/TempNode.js";
4
+ import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
5
+
6
+ export default class PMREMNode extends TempNode {
7
+ uvNode: Node | null;
8
+ levelNode: Node | null;
9
+
10
+ constructor(value: Texture, uvNode?: Node | null, levelNode?: Node | null);
11
+
12
+ set value(value: Texture);
13
+ get value(): Texture;
14
+ }
15
+
16
+ export const pmremTexture: (
17
+ value: Texture,
18
+ uvNode?: NodeRepresentation,
19
+ levelNode?: NodeRepresentation,
20
+ ) => ShaderNodeObject<PMREMNode>;
@@ -53,8 +53,8 @@ export type Swizzable<T extends Node = Node> =
53
53
  export type ShaderNodeObject<T extends Node> =
54
54
  & T
55
55
  & {
56
- [Key in keyof NodeElements]: NodeElements[Key] extends (node: T, ...args: infer Args) => infer R
57
- ? (...args: Args) => R
56
+ [Key in keyof NodeElements]: T extends { [K in Key]: infer M } ? M
57
+ : NodeElements[Key] extends (node: T, ...args: infer Args) => infer R ? (...args: Args) => R
58
58
  : never;
59
59
  }
60
60
  & Swizzable<T>;
@@ -198,9 +198,12 @@ export function nodeImmutable<T>(
198
198
  ): ShaderNodeObject<ConstructedNode<T>>;
199
199
 
200
200
  export function tslFn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
201
+ export function tslFn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
202
+ jsFunc: (args: T) => R,
203
+ ): (...args: ProxiedTuple<T>) => R;
201
204
  export function tslFn<T extends AnyObject, R extends Node = ShaderNodeObject<Node>>(
202
205
  jsFunc: (args: T) => R,
203
- ): (args: T) => R;
206
+ ): (args: ProxiedObject<T>) => R;
204
207
 
205
208
  export function append(node: Node): Node;
206
209
 
@@ -1,15 +1,12 @@
1
- import { Material } from "three";
1
+ import { Material, Mesh, OrthographicCamera } from "three";
2
2
  import Renderer from "../renderers/common/Renderer.js";
3
3
 
4
- export default class QuadMesh {
5
- constructor(material?: Material | null);
4
+ export default class QuadMesh extends Mesh {
5
+ camera: OrthographicCamera;
6
6
 
7
- dispose(): void;
7
+ constructor(material?: Material | null);
8
8
 
9
9
  renderAsync(renderer: Renderer): Promise<void>;
10
10
 
11
- get material(): Material;
12
- set material(value: Material);
13
-
14
- get render(): (renderer: Renderer) => Promise<void>;
11
+ render(renderer: Renderer): void;
15
12
  }
@@ -0,0 +1,10 @@
1
+ import { Mesh, Object3D, Vector3Like } from "three";
2
+
3
+ export interface JoltPhysicsObject {
4
+ addScene: (scene: Object3D) => void;
5
+ addMesh: (mesh: Mesh, mass?: number, restitution?: number) => void;
6
+ setMeshPosition: (mesh: Mesh, position: Vector3Like, index?: number) => void;
7
+ setMeshVelocity: (mesh: Mesh, velocity: Vector3Like, index?: number) => void;
8
+ }
9
+
10
+ export function JoltPhysics(): Promise<JoltPhysicsObject>;
@@ -0,0 +1,33 @@
1
+ import { Camera, Object3D, ShaderMaterial, Texture, WebGLRenderer, WebGLRenderTarget } from "three";
2
+ import { FullScreenQuad, Pass } from "./Pass.js";
3
+
4
+ export class RenderTransitionPass extends Pass {
5
+ material: ShaderMaterial;
6
+ fsQuad: FullScreenQuad;
7
+
8
+ sceneA: Object3D;
9
+ cameraA: Camera;
10
+ sceneB: Object3D;
11
+ cameraB: Camera;
12
+
13
+ renderTargetA: WebGLRenderTarget;
14
+ renderTargetB: WebGLRenderTarget;
15
+
16
+ constructor(sceneA: Object3D, cameraA: Camera, sceneB: Object3D, cameraB: Camera);
17
+
18
+ setTransition(value: number): void;
19
+
20
+ useTexture(value: boolean): void;
21
+
22
+ setTexture(value: Texture | null): void;
23
+
24
+ setTextureThreshold(value: number): void;
25
+
26
+ setSize(width: number, height: number): void;
27
+
28
+ render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void;
29
+
30
+ dispose(): void;
31
+
32
+ createMaterial(): ShaderMaterial;
33
+ }
@@ -6,19 +6,15 @@ export default class Info {
6
6
  frame: number;
7
7
  calls: number;
8
8
 
9
- render: { calls: number; drawCalls: number; triangles: number; points: number; lines: number };
9
+ render: { calls: number; drawCalls: number; triangles: number; points: number; lines: number; timestamp: number };
10
10
 
11
- compute: { calls: number; computeCalls: number };
11
+ compute: { calls: number; computeCalls: number; timestamp: number };
12
12
 
13
13
  memory: { geometries: number; textures: number };
14
14
 
15
- timestamp: { compute: number; render: number };
16
-
17
15
  update(object: Object3D, count: number, instanceCount: number): void;
18
16
 
19
- updateTimestamp(type: keyof typeof this.timestamp, time: number): void;
20
-
21
- resetCompute(): void;
17
+ updateTimestamp(type: "render" | "compute", time: number): void;
22
18
 
23
19
  reset(): void;
24
20
 
@@ -7,5 +7,7 @@ export default class PostProcessing {
7
7
 
8
8
  constructor(renderer: Renderer, outputNode?: Node);
9
9
 
10
- render(): Promise<void>;
10
+ render(): void;
11
+
12
+ renderAsync(): Promise<void>;
11
13
  }
@@ -12,6 +12,7 @@ import {
12
12
  RenderTarget,
13
13
  Scene,
14
14
  ShadowMapType,
15
+ Texture,
15
16
  ToneMapping,
16
17
  Vector2,
17
18
  Vector4,
@@ -90,20 +91,20 @@ export default class Renderer {
90
91
  depth: boolean;
91
92
 
92
93
  /**
93
- * @default true
94
+ * @default false
94
95
  */
95
96
  stencil: boolean;
96
97
 
97
98
  clippingPlanes: readonly Plane[];
98
99
 
100
+ toneMappingNode: Node | null;
101
+
99
102
  info: Info;
100
103
 
101
104
  shadowMap: { enabled: boolean; type: ShadowMapType };
102
105
 
103
106
  xr: { enabled: boolean };
104
107
 
105
- toneMappingNode?: Node;
106
-
107
108
  localClippingEnabled?: boolean;
108
109
 
109
110
  constructor(backend: Backend, parameters?: RendererParameters);
@@ -251,9 +252,9 @@ export default class Renderer {
251
252
 
252
253
  dispose(): void;
253
254
 
254
- setRenderTarget(renderTarget: RenderTarget, activeCubeFace?: number, activeMipmapLevel?: number): void;
255
+ setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void;
255
256
 
256
- getRenderTarget(): RenderTarget;
257
+ getRenderTarget(): RenderTarget | null;
257
258
 
258
259
  setRenderObjectFunction(renderObjectFunction: () => {}): void;
259
260
 
@@ -264,16 +265,21 @@ export default class Renderer {
264
265
  */
265
266
  computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
266
267
 
268
+ hasFeatureAsync(name: string): Promise<boolean>;
269
+
267
270
  hasFeature(name: string): boolean;
268
271
 
269
272
  copyFramebufferToTexture(framebufferTexture: FramebufferTexture): void;
270
273
 
274
+ copyTextureToTexture(position: Vector2, srcTexture: Texture, dstTexture: Texture, level?: number): void;
275
+
271
276
  readRenderTargetPixelsAsync(
272
277
  renderTarget: RenderTarget,
273
278
  x: number,
274
279
  y: number,
275
280
  width: number,
276
281
  height: number,
282
+ index?: number,
277
283
  ): Promise<Float32Array | Uint16Array | Uint8Array | Int8Array | Int16Array | Uint32Array | Int32Array>;
278
284
 
279
285
  renderObject(
@@ -0,0 +1,8 @@
1
+ import { RenderTarget, Scene } from "three";
2
+ import Renderer from "../Renderer.js";
3
+
4
+ export default class PMREMGenerator {
5
+ constructor(renderer: Renderer);
6
+
7
+ fromScene(scene: Scene, sigma?: number, near?: number, far?: number): RenderTarget;
8
+ }
@@ -1,6 +1,10 @@
1
1
  import { CoordinateSystem } from "three";
2
2
  import Backend, { BackendParameters } from "../common/Backend.js";
3
3
 
4
+ export interface WebGLBackendParameters extends BackendParameters {
5
+ trackTimestamp?: boolean | undefined;
6
+ }
7
+
4
8
  export default class WebGLBackend extends Backend {
5
9
  constructor(parameters?: BackendParameters);
6
10
 
@@ -31,3 +31,21 @@ export function reduceVertices<TValue>(
31
31
  func: (value: TValue, vertex: Vector3) => TValue,
32
32
  initialValue: TValue,
33
33
  ): TValue;
34
+
35
+ /**
36
+ * @param object Object to traverse.
37
+ * @yields Objects that passed the filter condition.
38
+ */
39
+ export function traverseGenerator(object: Object3D): Generator<Object3D, void, unknown>;
40
+
41
+ /**
42
+ * @param object Object to traverse.
43
+ * @yields Objects that passed the filter condition.
44
+ */
45
+ export function traverseVisibleGenerator(object: Object3D): Generator<Object3D, void, unknown>;
46
+
47
+ /**
48
+ * @param object Object to traverse.
49
+ * @yields Objects that passed the filter condition.
50
+ */
51
+ export function traverseAncestorsGenerator(object: Object3D): Generator<Object3D, void, unknown>;
@@ -1,14 +1,17 @@
1
- import { Mesh, Object3D, Texture, Vector3 } from "three";
1
+ import { Loader, Mesh, Object3D, Texture, Vector3 } from "three";
2
+ import { GLTF } from "../loaders/GLTFLoader.js";
2
3
  import { XRHandMeshModel } from "./XRHandMeshModel.js";
3
4
 
4
5
  export class OculusHandModel extends Object3D {
5
6
  controller: Object3D;
6
7
  motionController: XRHandMeshModel | null;
7
8
  envMap: Texture | null;
9
+ loader: Loader<GLTF> | null;
10
+ onLoad?: ((object: Object3D) => void) | null;
8
11
 
9
12
  mesh: Mesh | null;
10
13
 
11
- constructor(controller: Object3D);
14
+ constructor(controller: Object3D, loader?: Loader<GLTF> | null, onLoad?: ((object: Object3D) => void) | null);
12
15
 
13
16
  updateMatrixWorld(force?: boolean): void;
14
17
 
@@ -1,5 +1,6 @@
1
- import { Group, Object3D } from "three";
1
+ import { Group, Loader, Object3D } from "three";
2
2
 
3
+ import { GLTF } from "../loaders/GLTFLoader.js";
3
4
  import { XRHandMeshModel } from "./XRHandMeshModel.js";
4
5
  import { XRHandPrimitiveModel, XRHandPrimitiveModelOptions } from "./XRHandPrimitiveModel.js";
5
6
 
@@ -12,9 +13,14 @@ export class XRHandModel extends Object3D {
12
13
  }
13
14
 
14
15
  export class XRHandModelFactory {
16
+ gltfLoader: Loader<GLTF> | null;
15
17
  path: string | null;
18
+ onLoad?: ((object: Object3D) => void) | null;
16
19
 
17
- constructor();
20
+ constructor(
21
+ gltfLoader?: Loader<GLTF> | null,
22
+ onLoad?: ((object: Object3D) => void) | null,
23
+ );
18
24
 
19
25
  setPath(path: string | null): this;
20
26
 
three/index.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  // Periodically, the updates from the repository are pushed to DefinitelyTyped
4
4
  // and released in the @types/three npm package.
5
5
 
6
- export * from "./src/Three";
6
+ export * from "./src/Three.js";
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.162.0",
3
+ "version": "0.164.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -42,9 +42,9 @@
42
42
  "@tweenjs/tween.js": "~23.1.1",
43
43
  "@types/stats.js": "*",
44
44
  "@types/webxr": "*",
45
- "fflate": "~0.6.10",
45
+ "fflate": "~0.8.2",
46
46
  "meshoptimizer": "~0.18.1"
47
47
  },
48
- "typesPublisherContentHash": "a113c91d5796d4919f38171319b51f9ac52586ca55d8dcbb08da2d5cfeeef84d",
49
- "typeScriptVersion": "4.6"
48
+ "typesPublisherContentHash": "58c6d9927d6ac01a5c65fdd023a998d808d352da3e1d79f7bb0b3b290f2d5443",
49
+ "typeScriptVersion": "4.7"
50
50
  }
three/src/Three.d.ts CHANGED
@@ -203,7 +203,6 @@ export * from "./renderers/webgl/WebGLTextures.js";
203
203
  export * from "./renderers/webgl/WebGLUniforms.js";
204
204
  export * from "./renderers/webgl/WebGLUniformsGroups.js";
205
205
  export { WebGLUtils } from "./renderers/webgl/WebGLUtils.js";
206
- export * from "./renderers/WebGL1Renderer.js";
207
206
  export * from "./renderers/WebGL3DRenderTarget.js";
208
207
  export * from "./renderers/WebGLArrayRenderTarget.js";
209
208
  export * from "./renderers/WebGLCubeRenderTarget.js";
@@ -3,6 +3,7 @@ import { Layers } from "../core/Layers.js";
3
3
  import { Object3D } from "../core/Object3D.js";
4
4
  import { Matrix4 } from "../math/Matrix4.js";
5
5
  import { Vector3 } from "../math/Vector3.js";
6
+ import { Vector4 } from "../math/Vector4.js";
6
7
 
7
8
  /**
8
9
  * Abstract base class for cameras
@@ -62,6 +63,8 @@ export class Camera extends Object3D {
62
63
 
63
64
  coordinateSystem: CoordinateSystem;
64
65
 
66
+ viewport?: Vector4;
67
+
65
68
  /**
66
69
  * Returns a {@link THREE.Vector3 | Vector3} representing the world space direction in which the {@link Camera} is looking.
67
70
  * @remarks Note: A {@link Camera} looks down its local, negative z-axis.
three/src/constants.d.ts CHANGED
@@ -336,6 +336,7 @@ export const HalfFloatType: 1016;
336
336
  export const UnsignedShort4444Type: 1017;
337
337
  export const UnsignedShort5551Type: 1018;
338
338
  export const UnsignedInt248Type: 1020;
339
+ export const UnsignedInt5999Type: 35902;
339
340
 
340
341
  export type AttributeGPUType = typeof FloatType | typeof IntType;
341
342
 
@@ -356,7 +357,8 @@ export type TextureDataType =
356
357
  | typeof HalfFloatType
357
358
  | typeof UnsignedShort4444Type
358
359
  | typeof UnsignedShort5551Type
359
- | typeof UnsignedInt248Type;
360
+ | typeof UnsignedInt248Type
361
+ | typeof UnsignedInt5999Type;
360
362
 
361
363
  ///////////////////////////////////////////////////////////////////////////////
362
364
  // Pixel formats
@@ -364,7 +366,9 @@ export type TextureDataType =
364
366
  /** {@link AlphaFormat} discards the red, green and blue components and reads just the alpha component. */
365
367
  export const AlphaFormat: 1021;
366
368
 
367
- /** {@link RGBAFormat} discards the green and blue components and reads just the red component. (Can only be used with a WebGL 2 rendering context). */
369
+ export const RGBFormat: 1022;
370
+
371
+ /** {@link RGBAFormat} is the default and reads the red, green, blue and alpha components. */
368
372
  export const RGBAFormat: 1023;
369
373
 
370
374
  /**
@@ -395,27 +399,23 @@ export const DepthStencilFormat: 1027;
395
399
 
396
400
  /**
397
401
  * {@link RedFormat} discards the green and blue components and reads just the red component.
398
- * @remarks Can only be used with a WebGL 2 rendering context.
399
402
  */
400
403
  export const RedFormat: 1028;
401
404
 
402
405
  /**
403
406
  * {@link RedIntegerFormat} discards the green and blue components and reads just the red component.
404
407
  * The texels are read as integers instead of floating point.
405
- * @remarks Can only be used with a WebGL 2 rendering context.
406
408
  */
407
409
  export const RedIntegerFormat: 1029;
408
410
 
409
411
  /**
410
412
  * {@link RGFormat} discards the alpha, and blue components and reads the red, and green components.
411
- * @remarks Can only be used with a WebGL 2 rendering context.
412
413
  */
413
414
  export const RGFormat: 1030;
414
415
 
415
416
  /**
416
417
  * {@link RGIntegerFormat} discards the alpha, and blue components and reads the red, and green components.
417
418
  * The texels are read as integers instead of floating point.
418
- * @remarks Can only be used with a WebGL 2 rendering context.
419
419
  */
420
420
  export const RGIntegerFormat: 1031;
421
421
 
@@ -425,35 +425,15 @@ export const RGIntegerFormat: 1031;
425
425
  */
426
426
  export const RGBAIntegerFormat: 1033;
427
427
 
428
- export const _SRGBAFormat: 1035; // fallback for WebGL 1
429
-
430
- /**
431
- * Texture Pixel Formats Modes. Compatible only with {@link WebGLRenderingContext | WebGL 1 Rendering Context}.
432
- * @remarks Note that the texture must have the correct {@link THREE.Texture.type} set, as described in {@link TextureDataType}.
433
- * @see {@link WebGLRenderingContext.texImage2D} for details.
434
- * @see {@link WebGL2PixelFormat} and {@link PixelFormat}
435
- * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
436
- */
437
- export type WebGL1PixelFormat =
438
- | typeof AlphaFormat
439
- | typeof LuminanceFormat
440
- | typeof LuminanceAlphaFormat
441
- | typeof DepthFormat
442
- | typeof DepthStencilFormat
443
- | typeof RedFormat
444
- | typeof RedIntegerFormat
445
- | typeof RGFormat
446
- | typeof _SRGBAFormat;
447
-
448
428
  /**
449
- * Texture Pixel Formats Modes. Compatible only with {@link WebGL2RenderingContext | WebGL 2 Rendering Context}.
429
+ * All Texture Pixel Formats Modes.
450
430
  * @remarks Note that the texture must have the correct {@link THREE.Texture.type} set, as described in {@link TextureDataType}.
451
431
  * @see {@link WebGLRenderingContext.texImage2D} for details.
452
- * @see {@link WebGL2PixelFormat} and {@link PixelFormat}
453
432
  * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
454
433
  */
455
- export type WebGL2PixelFormat =
434
+ export type PixelFormat =
456
435
  | typeof AlphaFormat
436
+ | typeof RGBFormat
457
437
  | typeof RGBAFormat
458
438
  | typeof LuminanceFormat
459
439
  | typeof LuminanceAlphaFormat
@@ -463,17 +443,7 @@ export type WebGL2PixelFormat =
463
443
  | typeof RedIntegerFormat
464
444
  | typeof RGFormat
465
445
  | typeof RGIntegerFormat
466
- | typeof RGBAIntegerFormat
467
- | typeof _SRGBAFormat;
468
-
469
- /**
470
- * All Texture Pixel Formats Modes.
471
- * @remarks Note that the texture must have the correct {@link THREE.Texture.type} set, as described in {@link TextureDataType}.
472
- * @see {@link WebGLRenderingContext.texImage2D} for details.
473
- * @see {@link WebGL1PixelFormat} and {@link WebGL2PixelFormat}
474
- * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
475
- */
476
- export type PixelFormat = WebGL1PixelFormat | WebGL2PixelFormat;
446
+ | typeof RGBAIntegerFormat;
477
447
 
478
448
  /**
479
449
  * All Texture Pixel Formats Modes for {@link THREE.DepthTexture}.
@@ -617,10 +617,11 @@ export class Object3D<TEventMap extends Object3DEventMap = Object3DEventMap> ext
617
617
  clone(recursive?: boolean): this;
618
618
 
619
619
  /**
620
- * Copy the given object into this object
621
- * @remarks Note: event listeners and user-defined callbacks ({@link onAfterRender | .onAfterRender} and {@link onBeforeRender | .onBeforeRender}) are not copied.
622
- * @param source
623
- * @param recursive If true, descendants of the object are also copied. Default `true`
620
+ * Copies the given object into this object.
621
+ * @remarks Event listeners and user-defined callbacks ({@link .onAfterRender} and {@link .onBeforeRender}) are not copied.
622
+ * @param object
623
+ * @param recursive If set to `true`, descendants of the object are copied next to the existing ones. If set to
624
+ * `false`, descendants are left unchanged. Default is `true`.
624
625
  */
625
- copy(source: this, recursive?: boolean): this;
626
+ copy(object: Object3D, recursive?: boolean): this;
626
627
  }