@types/three 0.178.0 → 0.179.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 (57) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +1 -2
  3. three/examples/jsm/exporters/USDZExporter.d.ts +1 -0
  4. three/examples/jsm/loaders/EXRLoader.d.ts +18 -5
  5. three/examples/jsm/loaders/USDLoader.d.ts +9 -0
  6. three/examples/jsm/loaders/USDZLoader.d.ts +11 -8
  7. three/examples/jsm/tsl/display/TRAANode.d.ts +22 -0
  8. three/package.json +4 -4
  9. three/src/Three.Core.d.ts +1 -0
  10. three/src/Three.TSL.d.ts +55 -13
  11. three/src/animation/KeyframeTrack.d.ts +7 -2
  12. three/src/animation/tracks/BooleanKeyframeTrack.d.ts +2 -2
  13. three/src/animation/tracks/StringKeyframeTrack.d.ts +2 -2
  14. three/src/cameras/Camera.d.ts +15 -8
  15. three/src/constants.d.ts +3 -1
  16. three/{examples/jsm/misc → src/core}/Timer.d.ts +3 -17
  17. three/src/helpers/SkeletonHelper.d.ts +7 -12
  18. three/src/loaders/FileLoader.d.ts +2 -2
  19. three/src/loaders/ImageBitmapLoader.d.ts +9 -9
  20. three/src/loaders/Loader.d.ts +1 -0
  21. three/src/loaders/LoadingManager.d.ts +23 -19
  22. three/src/materials/MeshPhysicalMaterial.d.ts +12 -0
  23. three/src/materials/nodes/Line2NodeMaterial.d.ts +0 -6
  24. three/src/materials/nodes/PointsNodeMaterial.d.ts +5 -0
  25. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +22 -1
  26. three/src/math/Frustum.d.ts +1 -1
  27. three/src/math/Line3.d.ts +1 -0
  28. three/src/math/Matrix4.d.ts +2 -0
  29. three/src/nodes/Nodes.d.ts +1 -0
  30. three/src/nodes/TSL.d.ts +1 -0
  31. three/src/nodes/accessors/TextureNode.d.ts +2 -0
  32. three/src/nodes/core/ContextNode.d.ts +7 -1
  33. three/src/nodes/core/Node.d.ts +9 -2
  34. three/src/nodes/core/UniformNode.d.ts +9 -0
  35. three/src/nodes/core/VarNode.d.ts +11 -1
  36. three/src/nodes/display/PassNode.d.ts +10 -0
  37. three/src/nodes/gpgpu/ComputeNode.d.ts +15 -6
  38. three/src/nodes/materialx/MaterialXNodes.d.ts +85 -20
  39. three/src/nodes/materialx/lib/mx_noise.d.ts +28 -0
  40. three/src/nodes/math/MathNode.d.ts +10 -2
  41. three/src/nodes/tsl/TSLCore.d.ts +16 -0
  42. three/src/nodes/utils/EventNode.d.ts +21 -0
  43. three/src/nodes/utils/RTTNode.d.ts +2 -0
  44. three/src/renderers/common/Color4.d.ts +2 -2
  45. three/src/renderers/common/Renderer.d.ts +16 -8
  46. three/src/renderers/common/SampledTexture.d.ts +2 -9
  47. three/src/renderers/common/Sampler.d.ts +9 -3
  48. three/src/renderers/common/Storage3DTexture.d.ts +2 -0
  49. three/src/renderers/common/StorageArrayTexture.d.ts +2 -0
  50. three/src/renderers/common/StorageTexture.d.ts +2 -0
  51. three/src/renderers/common/XRManager.d.ts +1 -0
  52. three/src/renderers/webgl/WebGLCapabilities.d.ts +2 -2
  53. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +0 -1
  54. three/src/renderers/webxr/WebXRDepthSensing.d.ts +4 -5
  55. three/src/renderers/webxr/WebXRManager.d.ts +4 -2
  56. three/src/textures/ExternalTexture.d.ts +11 -0
  57. three/examples/jsm/tsl/display/TRAAPassNode.d.ts +0 -15
@@ -35,7 +35,9 @@ export type MathNodeMethod1 =
35
35
  | typeof MathNode.TRUNC
36
36
  | typeof MathNode.FWIDTH
37
37
  | typeof MathNode.BITCAST
38
- | typeof MathNode.TRANSPOSE;
38
+ | typeof MathNode.TRANSPOSE
39
+ | typeof MathNode.DETERMINANT
40
+ | typeof MathNode.INVERSE;
39
41
 
40
42
  export type MathNodeMethod2 =
41
43
  | typeof MathNode.MIN
@@ -95,6 +97,8 @@ export default class MathNode extends TempNode {
95
97
  static FWIDTH: "fwidth";
96
98
  static BITCAST: "bitcast";
97
99
  static TRANSPOSE: "transpose";
100
+ static DETERMINANT: "determinant";
101
+ static INVERSE: "inverse";
98
102
 
99
103
  // 2 inputs
100
104
 
@@ -175,6 +179,8 @@ export const reciprocal: Unary;
175
179
  export const trunc: Unary;
176
180
  export const fwidth: Unary;
177
181
  export const transpose: Unary;
182
+ export const determinant: (x: Node) => ShaderNodeObject<MathNode>;
183
+ export const inverse: (x: Node) => ShaderNodeObject<MathNode>;
178
184
 
179
185
  type Binary = (a: MathNodeParameter, b: MathNodeParameter) => ShaderNodeObject<MathNode>;
180
186
 
@@ -194,7 +200,7 @@ export const reflect: Binary;
194
200
  export const distance: Binary;
195
201
  export const difference: Binary;
196
202
  export const dot: Binary;
197
- export const cross: Binary;
203
+ export const cross: (x: Node, y: Node) => ShaderNodeObject<MathNode>;
198
204
  export const pow: Binary;
199
205
  export const pow2: Unary;
200
206
  export const pow3: Unary;
@@ -291,6 +297,8 @@ declare module "../tsl/TSLCore.js" {
291
297
  saturate: typeof saturate;
292
298
  cbrt: typeof cbrt;
293
299
  transpose: typeof transpose;
300
+ determinant: typeof determinant;
301
+ inverse: typeof inverse;
294
302
  rand: typeof rand;
295
303
  }
296
304
  }
@@ -210,6 +210,7 @@ export class ShaderNode<T = {}, R extends Node = Node> {
210
210
  }
211
211
 
212
212
  export function nodeObject<T extends NodeObjectOption>(obj: T): NodeObject<T>;
213
+ export function nodeObjectIntent<T extends NodeObjectOption>(obj: T): NodeObject<T>;
213
214
  export function nodeObjects<T>(obj: T): NodeObjects<T>;
214
215
 
215
216
  export function nodeArray<T extends NodeObjectOption[]>(obj: readonly [...T]): NodeArray<T>;
@@ -234,6 +235,21 @@ export function nodeImmutable<T>(
234
235
  ...params: ProxiedTuple<GetConstructors<T>>
235
236
  ): ShaderNodeObject<ConstructedNode<T>>;
236
237
 
238
+ export function nodeProxyIntent<T>(
239
+ nodeClass: T,
240
+ ): (...params: ProxiedTuple<GetConstructors<T>>) => ShaderNodeObject<ConstructedNode<T>>;
241
+
242
+ export function nodeProxyIntent<T, S extends GetPossibleScopes<T>>(
243
+ nodeClass: T,
244
+ scope: S,
245
+ ): (...params: ProxiedTuple<RemoveTail<GetConstructorsByScope<T, S>>>) => ShaderNodeObject<ConstructedNode<T>>;
246
+
247
+ export function nodeProxyIntent<T, S extends GetPossibleScopes<T>>(
248
+ nodeClass: T,
249
+ scope: S,
250
+ factor: NodeObjectOption,
251
+ ): (...params: ProxiedTuple<RemoveHeadAndTail<GetConstructorsByScope<T, S>>>) => ShaderNodeObject<ConstructedNode<T>>;
252
+
237
253
  interface Layout {
238
254
  name: string;
239
255
  type: string;
@@ -0,0 +1,21 @@
1
+ import Node from "../core/Node.js";
2
+ import NodeFrame from "../core/NodeFrame.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
+
5
+ export type EventNodeType = typeof EventNode.OBJECT | typeof EventNode.MATERIAL;
6
+
7
+ declare class EventNode extends Node {
8
+ eventType: EventNodeType;
9
+ callback: (frame: NodeFrame) => void;
10
+
11
+ constructor(eventType: EventNodeType, callback: (frame: NodeFrame) => void);
12
+
13
+ static OBJECT: "object";
14
+ static MATERIAL: "material";
15
+ }
16
+
17
+ export default EventNode;
18
+
19
+ export const OnObjectUpdate: (callback: (frame: NodeFrame) => void) => ShaderNodeObject<Node>;
20
+
21
+ export const OnMaterialUpdate: (callback: (frame: NodeFrame) => void) => ShaderNodeObject<Node>;
@@ -9,6 +9,8 @@ export interface RTTNodeOptions {
9
9
  }
10
10
 
11
11
  declare class RTTNode extends TextureNode {
12
+ readonly isRTTNode: true;
13
+
12
14
  node: Node;
13
15
  width: number | null;
14
16
  height: number | null;
@@ -27,8 +27,8 @@ declare class Color4 extends Color {
27
27
  * string argument to this method.
28
28
  *
29
29
  * @param {number|string|Color} r - The red value.
30
- * @param {number} g - The green value.
31
- * @param {number} b - The blue value.
30
+ * @param {number} [g] - The green value.
31
+ * @param {number} [b] - The blue value.
32
32
  * @param {number} [a=1] - The alpha value.
33
33
  * @return {Color4} A reference to this object.
34
34
  */
@@ -625,15 +625,15 @@ declare class Renderer {
625
625
  */
626
626
  clearStencilAsync(): Promise<void>;
627
627
  /**
628
- * The current output tone mapping of the renderer. When a render target is set,
629
- * the output tone mapping is always `NoToneMapping`.
628
+ * The current tone mapping of the renderer. When not producing screen output,
629
+ * the tone mapping is always `NoToneMapping`.
630
630
  *
631
631
  * @type {number}
632
632
  */
633
633
  get currentToneMapping(): ToneMapping;
634
634
  /**
635
- * The current output color space of the renderer. When a render target is set,
636
- * the output color space is always `LinearSRGBColorSpace`.
635
+ * The current color space of the renderer. When not producing screen output,
636
+ * the color space is always the working color space.
637
637
  *
638
638
  * @type {string}
639
639
  */
@@ -742,17 +742,25 @@ declare class Renderer {
742
742
  * if the renderer has been initialized.
743
743
  *
744
744
  * @param {Node|Array<Node>} computeNodes - The compute node(s).
745
+ * @param {Array<number>|number} [dispatchSizeOrCount=null] - Array with [ x, y, z ] values for dispatch or a single number for the count.
745
746
  * @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized.
746
747
  */
747
- compute(computeNodes: ComputeNode | ComputeNode[]): Promise<void> | undefined;
748
+ compute(
749
+ computeNodes: ComputeNode | ComputeNode[],
750
+ dispatchSizeOrCount?: number[] | number | null,
751
+ ): Promise<void> | undefined;
748
752
  /**
749
753
  * Execute a single or an array of compute nodes.
750
754
  *
751
755
  * @async
752
756
  * @param {Node|Array<Node>} computeNodes - The compute node(s).
757
+ * @param {Array<number>|number} [dispatchSizeOrCount=null] - Array with [ x, y, z ] values for dispatch or a single number for the count.
753
758
  * @return {Promise} A Promise that resolve when the compute has finished.
754
759
  */
755
- computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
760
+ computeAsync(
761
+ computeNodes: ComputeNode | ComputeNode[],
762
+ dispatchSizeOrCount?: number[] | number | null,
763
+ ): Promise<void>;
756
764
  /**
757
765
  * Checks if the given feature is supported by the selected backend.
758
766
  *
@@ -938,7 +946,7 @@ declare class Renderer {
938
946
  * @param {LightsNode} lightsNode - The current lights node.
939
947
  * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
940
948
  * @param {ClippingContext} clippingContext - The clipping context.
941
- * @param {?string} [passId=null] - An optional ID for identifying the pass.
949
+ * @param {string} [passId] - An optional ID for identifying the pass.
942
950
  */
943
951
  _renderObjectDirect(
944
952
  object: Object3D,
@@ -962,7 +970,7 @@ declare class Renderer {
962
970
  * @param {LightsNode} lightsNode - The current lights node.
963
971
  * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
964
972
  * @param {ClippingContext} clippingContext - The clipping context.
965
- * @param {?string} [passId=null] - An optional ID for identifying the pass.
973
+ * @param {string} [passId] - An optional ID for identifying the pass.
966
974
  */
967
975
  _createObjectPipeline(
968
976
  object: Object3D,
@@ -1,21 +1,14 @@
1
1
  import { Texture } from "../../textures/Texture.js";
2
- import Binding from "./Binding.js";
2
+ import Sampler from "./Sampler.js";
3
3
 
4
- declare class SampledTexture extends Binding {
4
+ declare class SampledTexture extends Sampler {
5
5
  id: number;
6
6
 
7
- texture: Texture | null;
8
- version: number;
9
7
  store: boolean;
10
- generation: number | null;
11
8
 
12
9
  readonly isSampledTexture: true;
13
10
 
14
11
  constructor(name: string, texture: Texture | null);
15
-
16
- needsBindingsUpdate(generation: number): boolean;
17
-
18
- update(): boolean;
19
12
  }
20
13
 
21
14
  declare class SampledArrayTexture extends SampledTexture {
@@ -1,11 +1,17 @@
1
- import TextureNode from "../../nodes/accessors/TextureNode.js";
1
+ import { Texture } from "../../textures/Texture.js";
2
2
  import Binding from "./Binding.js";
3
3
 
4
4
  declare class Sampler extends Binding {
5
- texture: TextureNode | null;
6
5
  version: number;
6
+
7
+ generation: number | null;
8
+
7
9
  readonly isSampler: true;
8
- constructor(name: string, texture: TextureNode | null);
10
+
11
+ constructor(name: string, texture: Texture | null);
12
+
13
+ set texture(value: Texture | null);
14
+ get texture(): Texture | null;
9
15
  }
10
16
 
11
17
  export default Sampler;
@@ -35,6 +35,8 @@ declare class Storage3DTexture extends Texture {
35
35
  * @param {number} [depth=1] - The storage texture's depth.
36
36
  */
37
37
  constructor(width?: number, height?: number, depth?: number);
38
+
39
+ setSize(width: number, height: number, depth: number): void;
38
40
  }
39
41
 
40
42
  export default Storage3DTexture;
@@ -24,6 +24,8 @@ declare class Storage3DTexture extends Texture {
24
24
  * @param {number} [depth=1] - The storage texture's depth.
25
25
  */
26
26
  constructor(width?: number, height?: number, depth?: number);
27
+
28
+ setSize(width: number, height: number, depth: number): void;
27
29
  }
28
30
 
29
31
  export default Storage3DTexture;
@@ -2,4 +2,6 @@ import { Texture } from "../../textures/Texture.js";
2
2
 
3
3
  export default class StorageTexture extends Texture {
4
4
  constructor(width?: number, height?: number);
5
+
6
+ setSize(width: number, height: number, depth: number): void;
5
7
  }
@@ -79,6 +79,7 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
79
79
  _xrRenderTarget: XRRenderTarget | null;
80
80
  _layers: XRLayerObject[];
81
81
  _supportsLayers: boolean;
82
+ _supportsGlBinding: boolean;
82
83
  _frameBufferTargets:
83
84
  | WeakMap<XRRenderTarget, {
84
85
  frameBufferTarget: RenderTarget | null;
@@ -14,7 +14,7 @@ export interface WebGLCapabilitiesParameters {
14
14
  /**
15
15
  * default is false.
16
16
  */
17
- reverseDepthBuffer?: boolean | undefined;
17
+ reversedDepthBuffer?: boolean | undefined;
18
18
  }
19
19
 
20
20
  export class WebGLCapabilities {
@@ -30,7 +30,7 @@ export class WebGLCapabilities {
30
30
 
31
31
  precision: string;
32
32
  logarithmicDepthBuffer: boolean;
33
- reverseDepthBuffer: boolean;
33
+ reversedDepthBuffer: boolean;
34
34
 
35
35
  maxTextures: number;
36
36
  maxVertexTextures: number;
@@ -19,7 +19,6 @@ export default class WGSLNodeBuilder extends NodeBuilder {
19
19
  builtins: { [key in BuiltinStage]: Map<string, BuiltinType> };
20
20
  uniformGroups: { [key in NodeShaderStage]: NodeUniformsGroup };
21
21
 
22
- needsToWorkingColorSpace(texture: Texture): boolean;
23
22
  _generateTextureSample(
24
23
  texture: Texture,
25
24
  textureProperty: string,
@@ -1,10 +1,9 @@
1
1
  import { Mesh } from "../../objects/Mesh.js";
2
- import { Texture } from "../../textures/Texture.js";
3
- import { WebGLRenderer } from "../WebGLRenderer.js";
2
+ import { ExternalTexture } from "../../textures/ExternalTexture.js";
4
3
  import { WebXRArrayCamera } from "./WebXRManager.js";
5
4
 
6
5
  export class WebXRDepthSensing {
7
- texture: Texture | null;
6
+ texture: ExternalTexture | null;
8
7
  mesh: Mesh | null;
9
8
 
10
9
  depthNear: number;
@@ -12,11 +11,11 @@ export class WebXRDepthSensing {
12
11
 
13
12
  constructor();
14
13
 
15
- init(renderer: WebGLRenderer, depthData: XRWebGLDepthInformation, renderState: XRRenderState): void;
14
+ init(depthData: XRWebGLDepthInformation, renderState: XRRenderState): void;
16
15
 
17
16
  getMesh(cameraXR: WebXRArrayCamera): Mesh | null;
18
17
 
19
18
  reset(): void;
20
19
 
21
- getDepthTexture(): Texture | null;
20
+ getDepthTexture(): ExternalTexture | null;
22
21
  }
@@ -5,7 +5,7 @@ import { PerspectiveCamera } from "../../cameras/PerspectiveCamera.js";
5
5
  import { EventDispatcher } from "../../core/EventDispatcher.js";
6
6
  import { Vector4 } from "../../math/Vector4.js";
7
7
  import { Mesh } from "../../objects/Mesh.js";
8
- import { Texture } from "../../textures/Texture.js";
8
+ import { ExternalTexture } from "../../textures/ExternalTexture.js";
9
9
  import { WebGLRenderer } from "../WebGLRenderer.js";
10
10
  import { XRGripSpace, XRHandSpace, XRTargetRaySpace } from "./WebXRController.js";
11
11
 
@@ -65,7 +65,7 @@ export class WebXRManager extends EventDispatcher<WebXRManagerEventMap> {
65
65
 
66
66
  getEnvironmentBlendMode: () => XREnvironmentBlendMode | undefined;
67
67
 
68
- getDepthTexture: () => Texture | null;
68
+ getDepthTexture: () => ExternalTexture | null;
69
69
 
70
70
  updateCamera: (camera: PerspectiveCamera) => void;
71
71
 
@@ -79,6 +79,8 @@ export class WebXRManager extends EventDispatcher<WebXRManagerEventMap> {
79
79
 
80
80
  getDepthSensingMesh: () => Mesh | null;
81
81
 
82
+ getCameraTexture: (xrCamera: WebXRCamera) => ExternalTexture | undefined;
83
+
82
84
  setAnimationLoop: (callback: XRFrameRequestCallback | null) => void;
83
85
 
84
86
  dispose: () => void;
@@ -0,0 +1,11 @@
1
+ import { Texture } from "./Texture.js";
2
+
3
+ declare class ExternalTexture extends Texture {
4
+ sourceTexture: WebGLTexture | null;
5
+
6
+ readonly isExternalTexture: true;
7
+
8
+ constructor(sourceTexture?: WebGLTexture | null);
9
+ }
10
+
11
+ export { ExternalTexture };
@@ -1,15 +0,0 @@
1
- import { ShaderNodeObject } from "three/tsl";
2
- import { Camera, ColorRepresentation, PassNode, Scene } from "three/webgpu";
3
-
4
- declare class TRAAPassNode extends PassNode {
5
- readonly isTRAAPassNode: true;
6
-
7
- clearColor: ColorRepresentation;
8
- clearAlpha: number;
9
-
10
- constructor(scene: Scene, camera: Camera);
11
- }
12
-
13
- export default TRAAPassNode;
14
-
15
- export const traaPass: (scene: Scene, camera: Camera) => ShaderNodeObject<TRAAPassNode>;