@types/three 0.183.1 → 0.184.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 (127) hide show
  1. three/README.md +2 -2
  2. three/examples/jsm/Addons.d.ts +11 -0
  3. three/examples/jsm/controls/FirstPersonControls.d.ts +5 -10
  4. three/examples/jsm/controls/TransformControls.d.ts +24 -0
  5. three/examples/jsm/geometries/TextGeometry.d.ts +43 -71
  6. three/examples/jsm/helpers/LightProbeGridHelper.d.ts +12 -0
  7. three/examples/jsm/inspector/Extension.d.ts +9 -0
  8. three/examples/jsm/inspector/Inspector.d.ts +21 -2
  9. three/examples/jsm/inspector/RendererInspector.d.ts +7 -2
  10. three/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts +20 -0
  11. three/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts +11 -0
  12. three/examples/jsm/inspector/tabs/Parameters.d.ts +22 -1
  13. three/examples/jsm/inspector/ui/Tab.d.ts +5 -1
  14. three/examples/jsm/inspector/ui/Values.d.ts +23 -3
  15. three/examples/jsm/interaction/InteractionManager.d.ts +18 -0
  16. three/examples/jsm/lighting/DynamicLighting.d.ts +16 -0
  17. three/examples/jsm/lighting/LightProbeGrid.d.ts +34 -0
  18. three/examples/jsm/loaders/ColladaLoader.d.ts +1 -0
  19. three/examples/jsm/loaders/EXRLoader.d.ts +2 -0
  20. three/examples/jsm/loaders/LDrawLoader.d.ts +1 -1
  21. three/examples/jsm/loaders/VTKLoader.d.ts +6 -0
  22. three/examples/jsm/objects/Reflector.d.ts +1 -2
  23. three/examples/jsm/objects/SkyMesh.d.ts +1 -0
  24. three/examples/jsm/tsl/WebGLNodesHandler.d.ts +14 -0
  25. three/examples/jsm/tsl/display/FSR1Node.d.ts +17 -0
  26. three/examples/jsm/tsl/display/SharpenNode.d.ts +22 -0
  27. three/examples/jsm/tsl/display/TAAUNode.d.ts +31 -0
  28. three/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts +21 -0
  29. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +1 -1
  30. three/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts +9 -0
  31. three/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts +9 -0
  32. three/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts +9 -0
  33. three/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts +9 -0
  34. three/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts +9 -0
  35. three/examples/jsm/utils/ColorUtils.d.ts +5 -0
  36. three/examples/jsm/utils/SceneOptimizer.d.ts +18 -0
  37. three/examples/jsm/webxr/XRHandMeshModel.d.ts +1 -0
  38. three/package.json +4 -5
  39. three/src/Three.Core.d.ts +13 -1
  40. three/src/Three.TSL.d.ts +7 -1
  41. three/src/Three.WebGPU.Nodes.d.ts +8 -4
  42. three/src/Three.WebGPU.d.ts +11 -4
  43. three/src/Three.d.ts +0 -11
  44. three/src/animation/AnimationMixer.d.ts +3 -1
  45. three/src/audio/AudioContext.d.ts +2 -2
  46. three/src/core/BufferAttribute.d.ts +13 -1
  47. three/src/core/RenderTarget.d.ts +8 -1
  48. three/src/core/UniformsGroup.d.ts +7 -1
  49. three/src/extras/Controls.d.ts +5 -1
  50. three/src/geometries/ExtrudeGeometry.d.ts +39 -53
  51. three/src/loaders/FileLoader.d.ts +2 -2
  52. three/src/materials/Material.d.ts +5 -1
  53. three/src/materials/MeshToonMaterial.d.ts +1 -1
  54. three/src/materials/nodes/Line2NodeMaterial.d.ts +7 -0
  55. three/src/materials/nodes/VolumeNodeMaterial.d.ts +1 -1
  56. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +11 -1
  57. three/src/math/ColorManagement.d.ts +1 -1
  58. three/src/math/Matrix2.d.ts +1 -1
  59. three/src/math/Matrix3.d.ts +1 -1
  60. three/src/math/Matrix4.d.ts +1 -1
  61. three/src/math/Plane.d.ts +1 -1
  62. three/src/math/Vector2.d.ts +2 -1
  63. three/src/math/Vector3.d.ts +2 -1
  64. three/src/math/Vector4.d.ts +2 -1
  65. three/src/nodes/Nodes.d.ts +0 -1
  66. three/src/nodes/TSL.d.ts +1 -1
  67. three/src/nodes/accessors/BufferAttributeNode.d.ts +1 -1
  68. three/src/nodes/core/Node.d.ts +37 -9
  69. three/src/nodes/core/StackNode.d.ts +1 -1
  70. three/src/nodes/core/StructTypeNode.d.ts +0 -4
  71. three/src/nodes/core/UniformGroupNode.d.ts +4 -3
  72. three/src/nodes/core/UniformNode.d.ts +3 -0
  73. three/src/nodes/core/VarNode.d.ts +16 -10
  74. three/src/nodes/display/ViewportDepthTextureNode.d.ts +1 -3
  75. three/src/nodes/display/ViewportTextureNode.d.ts +5 -5
  76. three/src/nodes/functions/ShadowMaskModel.d.ts +2 -2
  77. three/src/nodes/gpgpu/BarrierNode.d.ts +2 -0
  78. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +16 -7
  79. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -2
  80. three/src/nodes/materialx/lib/mx_noise.d.ts +4 -5
  81. three/src/nodes/math/MathNode.d.ts +64 -6
  82. three/src/nodes/tsl/TSLBase.d.ts +1 -1
  83. three/src/nodes/tsl/TSLCore.d.ts +568 -160
  84. three/src/nodes/utils/ConvertNode.d.ts +9 -2
  85. three/src/nodes/utils/EventNode.d.ts +6 -0
  86. three/src/nodes/utils/JoinNode.d.ts +9 -5
  87. three/src/nodes/utils/LoopNode.d.ts +1 -2
  88. three/src/nodes/utils/{RemapNode.d.ts → Remap.d.ts} +6 -22
  89. three/src/objects/BatchedMesh.d.ts +2 -0
  90. three/src/objects/InstancedMesh.d.ts +6 -6
  91. three/src/objects/SkinnedMesh.d.ts +3 -0
  92. three/src/renderers/WebGLRenderer.d.ts +10 -1
  93. three/src/renderers/common/Animation.d.ts +2 -2
  94. three/src/renderers/common/Attributes.d.ts +9 -1
  95. three/src/renderers/common/Backend.d.ts +4 -0
  96. three/src/renderers/common/Background.d.ts +2 -2
  97. three/src/renderers/common/BindGroup.d.ts +0 -6
  98. three/src/renderers/common/Bindings.d.ts +2 -2
  99. three/src/renderers/common/CanvasTarget.d.ts +3 -1
  100. three/src/renderers/common/ComputePipeline.d.ts +1 -1
  101. three/src/renderers/common/Info.d.ts +132 -1
  102. three/src/renderers/common/InspectorBase.d.ts +7 -1
  103. three/src/renderers/common/Pipelines.d.ts +19 -3
  104. three/src/renderers/common/ReadbackBuffer.d.ts +63 -0
  105. three/src/renderers/common/RenderBundle.d.ts +4 -1
  106. three/src/renderers/common/RenderBundles.d.ts +3 -1
  107. three/src/renderers/common/RenderObject.d.ts +2 -2
  108. three/src/renderers/common/RenderObjects.d.ts +3 -3
  109. three/src/renderers/common/Renderer.d.ts +29 -16
  110. three/src/renderers/common/XRManager.d.ts +1 -7
  111. three/src/renderers/common/nodes/NodeManager.d.ts +51 -11
  112. three/src/renderers/shaders/ShaderChunk.d.ts +1 -0
  113. three/src/renderers/shaders/UniformsLib.d.ts +5 -1
  114. three/src/renderers/webgl/WebGLBufferRenderer.d.ts +0 -6
  115. three/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +0 -6
  116. three/src/renderers/webgl/WebGLPrograms.d.ts +5 -0
  117. three/src/renderers/webgl-fallback/WebGLBackend.d.ts +2 -0
  118. three/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +19 -0
  119. three/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts +51 -0
  120. three/src/renderers/webgpu/WebGPUBackend.d.ts +9 -4
  121. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +6 -0
  122. three/src/renderers/webxr/WebXRController.d.ts +5 -1
  123. three/src/renderers/webxr/WebXRManager.d.ts +3 -1
  124. three/src/scenes/Scene.d.ts +2 -2
  125. three/src/textures/ExternalTexture.d.ts +3 -2
  126. three/src/textures/HTMLTexture.d.ts +27 -0
  127. three/src/textures/Texture.d.ts +16 -1
@@ -7,65 +7,60 @@ import { Vector3 } from "../math/Vector3.js";
7
7
  export interface ExtrudeGeometryOptions {
8
8
  /**
9
9
  * Number of points on the curves.
10
- * Expects a `Integer`.
11
- * @defaultValue `12`
10
+ * @default 12
12
11
  */
13
12
  curveSegments?: number | undefined;
14
13
 
15
14
  /**
16
15
  * Number of points used for subdividing segments along the depth of the extruded spline.
17
- * @defaultValue `1`
16
+ * @default 1
18
17
  */
19
18
  steps?: number | undefined;
20
19
 
21
20
  /**
22
21
  * Depth to extrude the shape.
23
- * @defaultValue `1`
22
+ * @default 1
24
23
  */
25
24
  depth?: number | undefined;
26
25
 
27
26
  /**
28
- * Turn on bevel. Applying beveling to the shape.
29
- * @defaultValue `true`
27
+ * Whether to beveling to the shape or not.
28
+ * @default true
30
29
  */
31
30
  bevelEnabled?: boolean | undefined;
32
31
 
33
32
  /**
34
33
  * How deep into the original shape the bevel goes.
35
- * Expects a `Float`.
36
- * @defaultValue `0.2`
34
+ * @default 0.2
37
35
  */
38
36
  bevelThickness?: number | undefined;
39
37
 
40
38
  /**
41
- * Distance from the shape outline that the bevel extends
42
- * Expects a `Float`.
43
- * @defaultValue `bevelThickness - 0.1`
39
+ * Distance from the shape outline that the bevel extends.
40
+ * @default bevelThickness-0.1
44
41
  */
45
42
  bevelSize?: number | undefined;
46
43
 
47
44
  /**
48
45
  * Distance from the shape outline that the bevel starts.
49
- * Expects a `Float`.
50
- * @defaultValue `0`
46
+ * @default 0
51
47
  */
52
48
  bevelOffset?: number | undefined;
53
49
 
54
50
  /**
55
- * Number of bevel layers/segments.
56
- * Expects a `Integer`.
57
- * @defaultValue `3`
51
+ * Number of bevel layers.
52
+ * @default 3
58
53
  */
59
54
  bevelSegments?: number | undefined;
60
55
 
61
56
  /**
62
- * A 3D spline path along which the shape should be extruded.
63
- * @remarks Bevels not supported for path extrusion.
57
+ * A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion.
58
+ * @default undefined
64
59
  */
65
60
  extrudePath?: Curve<Vector3> | undefined;
66
61
 
67
62
  /**
68
- * A object that provides UV generator functions.
63
+ * An object that provides UV generator functions for custom UV generation.
69
64
  */
70
65
  UVGenerator?: UVGenerator | undefined;
71
66
  }
@@ -90,38 +85,27 @@ export interface UVGenerator {
90
85
 
91
86
  /**
92
87
  * Creates extruded geometry from a path shape.
93
- * @remarks This object extrudes a 2D shape to a 3D geometry.
94
- * @remarks When creating a Mesh with this geometry, if you'd like to have a separate material used for its face and its extruded sides, you can use an array of materials
95
- * @remarks The first material will be applied to the face; the second material will be applied to the sides.
96
- * @example
97
- * ```typescript
88
+ *
89
+ * ```js
98
90
  * const length = 12, width = 8;
91
+ *
99
92
  * const shape = new THREE.Shape();
100
- * shape.moveTo(0, 0);
101
- * shape.lineTo(0, width);
102
- * shape.lineTo(length, width);
103
- * shape.lineTo(length, 0);
104
- * shape.lineTo(0, 0);
105
- * const extrudeSettings = {
106
- * steps: 2,
107
- * depth: 16,
108
- * bevelEnabled: true,
109
- * bevelThickness: 1,
110
- * bevelSize: 1,
111
- * bevelOffset: 0,
112
- * bevelSegments: 1
113
- * };
114
- * const geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings);
115
- * const material = new THREE.MeshBasicMaterial({
116
- * color: 0x00ff00
117
- * });
118
- * const mesh = new THREE.Mesh(geometry, material);
119
- * scene.add(mesh);
93
+ * shape.moveTo( 0,0 );
94
+ * shape.lineTo( 0, width );
95
+ * shape.lineTo( length, width );
96
+ * shape.lineTo( length, 0 );
97
+ * shape.lineTo( 0, 0 );
98
+ *
99
+ * const geometry = new THREE.ExtrudeGeometry( shape );
100
+ * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
101
+ * const mesh = new THREE.Mesh( geometry, material ) ;
102
+ * scene.add( mesh );
120
103
  * ```
121
- * @see {@link https://threejs.org/docs/index.html#api/en/geometries/ExtrudeGeometry | Official Documentation}
122
- * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/ExtrudeGeometry.js | Source}
104
+ *
105
+ * @augments BufferGeometry
106
+ * @demo scenes/geometry-browser.html#ExtrudeGeometry
123
107
  */
124
- export class ExtrudeGeometry extends BufferGeometry {
108
+ declare class ExtrudeGeometry extends BufferGeometry {
125
109
  /**
126
110
  * Create a new instance of {@link ExtrudeGeometry}
127
111
  * @param shapes Shape or an array of shapes. Default `new Shape([new Vector2(0.5, 0.5), new Vector2(-0.5, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)])`.
@@ -137,16 +121,18 @@ export class ExtrudeGeometry extends BufferGeometry {
137
121
  override readonly type: string | "ExtrudeGeometry";
138
122
 
139
123
  /**
140
- * An object with a property for each of the constructor parameters.
141
- * @remarks Any modification after instantiation does not change the geometry.
124
+ * Holds the constructor parameters that have been
125
+ * used to generate the geometry. Any modification
126
+ * after instantiation does not change the geometry.
127
+ *
128
+ * @type {Object}
142
129
  */
143
130
  readonly parameters: {
144
131
  readonly shapes: Shape | Shape[];
145
132
  readonly options: ExtrudeGeometryOptions;
146
133
  };
147
134
 
148
- addShape(shape: Shape): void;
149
-
150
- /** @internal */
151
- static fromJSON(data: {}, shapes: unknown): ExtrudeGeometry;
135
+ copy(source: ExtrudeGeometry): this;
152
136
  }
137
+
138
+ export { ExtrudeGeometry };
@@ -1,12 +1,12 @@
1
1
  import { Loader } from "./Loader.js";
2
2
  import { LoadingManager } from "./LoadingManager.js";
3
3
 
4
- export class FileLoader extends Loader<string | ArrayBuffer> {
4
+ export class FileLoader<TData = string | ArrayBuffer> extends Loader<TData> {
5
5
  constructor(manager?: LoadingManager);
6
6
 
7
7
  load(
8
8
  url: string,
9
- onLoad?: (data: string | ArrayBuffer) => void,
9
+ onLoad?: (data: TData) => void,
10
10
  onProgress?: (event: ProgressEvent) => void,
11
11
  onError?: (err: unknown) => void,
12
12
  ): void;
@@ -519,6 +519,10 @@ export interface MaterialJSON {
519
519
  images?: SourceJSON[];
520
520
  }
521
521
 
522
+ export interface MaterialEventMap {
523
+ dispose: {};
524
+ }
525
+
522
526
  /**
523
527
  * Abstract base class for materials.
524
528
  *
@@ -526,7 +530,7 @@ export interface MaterialJSON {
526
530
  *
527
531
  * @abstract
528
532
  */
529
- export class Material extends EventDispatcher<{ dispose: {} }> {
533
+ export class Material<TEventMap extends MaterialEventMap = MaterialEventMap> extends EventDispatcher<TEventMap> {
530
534
  /**
531
535
  * This flag can be used for type testing.
532
536
  *
@@ -21,7 +21,7 @@ export interface MeshToonMaterialProperties extends MaterialProperties {
21
21
  map: Texture | null;
22
22
  /**
23
23
  * Gradient map for toon shading. It's required to set
24
- * {@link Texture#minFilter} and {@link Texture#magFilter} to {@linkNearestFilter}
24
+ * {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}
25
25
  * when using this type of texture.
26
26
  *
27
27
  * @default null
@@ -82,6 +82,13 @@ declare class Line2NodeMaterial extends NodeMaterial {
82
82
  */
83
83
  readonly isLine2NodeMaterial: boolean;
84
84
  setValues(values?: Line2NodeMaterialParameters): void;
85
+ /**
86
+ * Copies the properties of the given material to this instance.
87
+ *
88
+ * @param {Line2NodeMaterial} source - The material to copy.
89
+ * @return {Line2NodeMaterial} A reference to this material.
90
+ */
91
+ copy(source: Line2NodeMaterial): this;
85
92
  }
86
93
 
87
94
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -22,7 +22,7 @@ export interface VolumeNodeMaterialNodeProperties extends NodeMaterialNodeProper
22
22
  *
23
23
  * @default null
24
24
  */
25
- scatteringNode: (params: { positionRay: Node }) => Node | null;
25
+ scatteringNode: (params: { positionRay: Node<"vec3"> }) => Node | null;
26
26
  }
27
27
 
28
28
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -1,4 +1,5 @@
1
1
  import { BufferAttribute } from "../../../core/BufferAttribute.js";
2
+ import { BufferGeometry } from "../../../core/BufferGeometry.js";
2
3
  import { Light } from "../../../lights/Light.js";
3
4
  import NodeBuilder from "../../../nodes/core/NodeBuilder.js";
4
5
  import NodeFrame from "../../../nodes/core/NodeFrame.js";
@@ -88,6 +89,14 @@ declare class NodeMaterialObserver {
88
89
  * @return {boolean} Whether the node builder's material uses node properties or not.
89
90
  */
90
91
  containsNode(builder: NodeBuilder): boolean;
92
+ /**
93
+ * Returns a geometry data structure holding the geometry property values for
94
+ * monitoring.
95
+ *
96
+ * @param {BufferGeometry} geometry - The geometry.
97
+ * @return {Object} An object for monitoring geometry properties.
98
+ */
99
+ getGeometryData(geometry: BufferGeometry): unknown;
91
100
  /**
92
101
  * Returns a material data structure holding the material property values for
93
102
  * monitoring.
@@ -101,9 +110,10 @@ declare class NodeMaterialObserver {
101
110
  *
102
111
  * @param {RenderObject} renderObject - The render object.
103
112
  * @param {Array<Light>} lightsData - The current material lights.
113
+ * @param {number} renderId - The current render ID.
104
114
  * @return {boolean} Whether the given render object has changed its state or not.
105
115
  */
106
- equals(renderObject: RenderObject, lightsData: Light[]): boolean;
116
+ equals(renderObject: RenderObject, lightsData: Light[], renderId: number): boolean;
107
117
  /**
108
118
  * Returns the lights data for the given material lights.
109
119
  *
@@ -37,7 +37,7 @@ export interface ColorManagement {
37
37
 
38
38
  getTransfer: (colorSpace: string) => ColorSpaceTransfer;
39
39
 
40
- getLuminanceCoefficients: (target: Vector3, colorSpace?: string) => [number, number, number];
40
+ getLuminanceCoefficients: (target: Vector3, colorSpace?: string) => Vector3;
41
41
 
42
42
  define: (colorSpaces: Record<string, ColorSpaceDefinition>) => void;
43
43
 
@@ -12,7 +12,7 @@ export type Matrix2Tuple = [
12
12
  * const m = new Matrix2();
13
13
  */
14
14
  export class Matrix2 {
15
- readonly isMatrix2: true;
15
+ static readonly isMatrix2: boolean;
16
16
 
17
17
  /**
18
18
  * A {@link https://en.wikipedia.org/wiki/Row-_and_column-major_order column-major} list of matrix values.
@@ -17,7 +17,7 @@ export type Matrix3Tuple = [
17
17
  ];
18
18
 
19
19
  export class Matrix3 {
20
- readonly isMatrix3: true;
20
+ static readonly isMatrix3: boolean;
21
21
 
22
22
  /**
23
23
  * Array with matrix values.
@@ -42,7 +42,7 @@ export type Matrix4Tuple = [
42
42
  * m.multiply( m3 );
43
43
  */
44
44
  export class Matrix4 {
45
- readonly isMatrix4: true;
45
+ static readonly isMatrix4: boolean;
46
46
 
47
47
  /**
48
48
  * Array with matrix values.
three/src/math/Plane.d.ts CHANGED
@@ -31,7 +31,7 @@ export class Plane {
31
31
  distanceToPoint(point: Vector3): number;
32
32
  distanceToSphere(sphere: Sphere): number;
33
33
  projectPoint(point: Vector3, target: Vector3): Vector3;
34
- intersectLine(line: Line3, target: Vector3): Vector3 | null;
34
+ intersectLine(line: Line3, target: Vector3, clampToLine?: boolean): Vector3 | null;
35
35
  intersectsLine(line: Line3): boolean;
36
36
  intersectsBox(box: Box3): boolean;
37
37
  intersectsSphere(sphere: Sphere): boolean;
@@ -12,6 +12,8 @@ export interface Vector2Like {
12
12
  * 2D vector.
13
13
  */
14
14
  export class Vector2 {
15
+ static readonly isVector2: boolean;
16
+
15
17
  constructor(x?: number, y?: number);
16
18
 
17
19
  /**
@@ -25,7 +27,6 @@ export class Vector2 {
25
27
  y: number;
26
28
  width: number;
27
29
  height: number;
28
- readonly isVector2: true;
29
30
 
30
31
  /**
31
32
  * Sets value of this vector.
@@ -29,6 +29,8 @@ export interface Vector3Like {
29
29
  * c.crossVectors( a, b );
30
30
  */
31
31
  export class Vector3 {
32
+ static readonly isVector3: boolean;
33
+
32
34
  constructor(x?: number, y?: number, z?: number);
33
35
 
34
36
  /**
@@ -45,7 +47,6 @@ export class Vector3 {
45
47
  * @default 0
46
48
  */
47
49
  z: number;
48
- readonly isVector3: true;
49
50
 
50
51
  /**
51
52
  * Sets value of this vector.
@@ -15,6 +15,8 @@ export interface Vector4Like {
15
15
  * 4D vector.
16
16
  */
17
17
  export class Vector4 {
18
+ static readonly isVector4: boolean;
19
+
18
20
  constructor(x?: number, y?: number, z?: number, w?: number);
19
21
 
20
22
  /**
@@ -39,7 +41,6 @@ export class Vector4 {
39
41
 
40
42
  width: number;
41
43
  height: number;
42
- readonly isVector4: true;
43
44
 
44
45
  /**
45
46
  * Sets value of this vector.
@@ -165,7 +165,6 @@ export { default as LoopNode } from "./utils/LoopNode.js";
165
165
  export { default as MaxMipLevelNode } from "./utils/MaxMipLevelNode.js";
166
166
  export { default as MemberNode } from "./utils/MemberNode.js";
167
167
  export { default as ReflectorNode, ReflectorNodeParameters } from "./utils/ReflectorNode.js";
168
- export { default as RemapNode } from "./utils/RemapNode.js";
169
168
  export { default as RotateNode } from "./utils/RotateNode.js";
170
169
  export { default as RTTNode, RTTNodeOptions } from "./utils/RTTNode.js";
171
170
  export { default as SampleNode } from "./utils/SampleNode.js";
three/src/nodes/TSL.d.ts CHANGED
@@ -38,7 +38,7 @@ export * from "./utils/Oscillators.js";
38
38
  export * from "./utils/Packing.js";
39
39
  export * from "./utils/PostProcessingUtils.js";
40
40
  export * from "./utils/ReflectorNode.js";
41
- export * from "./utils/RemapNode.js";
41
+ export * from "./utils/Remap.js";
42
42
  export * from "./utils/RotateNode.js";
43
43
  export * from "./utils/RTTNode.js";
44
44
  export * from "./utils/SampleNode.js";
@@ -109,7 +109,7 @@ declare class BufferAttributeNodeClass extends InputNode<unknown, TypedArray | I
109
109
  * @param {NodeBuilder} builder - The current node builder.
110
110
  * @return {string} The node type.
111
111
  */
112
- getNodeType(builder: NodeBuilder): string;
112
+ generateNodeType(builder: NodeBuilder): string;
113
113
  /**
114
114
  * Depending on which value was passed to the node, `setup()` behaves
115
115
  * differently. If no instance of `BufferAttribute` was passed, the method
@@ -70,12 +70,16 @@ export interface NodeChild {
70
70
  childNode: Node;
71
71
  }
72
72
 
73
+ export interface NodeClassEventMap {
74
+ dispose: {};
75
+ }
76
+
73
77
  /**
74
78
  * Base class for all nodes.
75
79
  *
76
80
  * @augments EventDispatcher
77
81
  */
78
- declare class NodeClass extends EventDispatcher<{ dispose: {} }> {
82
+ declare class NodeClass<TEventMap extends NodeClassEventMap = NodeClassEventMap> extends EventDispatcher<TEventMap> {
79
83
  static get type(): string;
80
84
  /**
81
85
  * Constructs a new node.
@@ -111,13 +115,6 @@ declare class NodeClass extends EventDispatcher<{ dispose: {} }> {
111
115
  * @default 'none'
112
116
  */
113
117
  updateAfterType: NodeUpdateType;
114
- /**
115
- * The UUID of the node.
116
- *
117
- * @type {string}
118
- * @readonly
119
- */
120
- readonly uuid: string;
121
118
  /**
122
119
  * The version of the node. The version automatically is increased when {@link Node#needsUpdate} is set to `true`.
123
120
  *
@@ -165,6 +162,14 @@ declare class NodeClass extends EventDispatcher<{ dispose: {} }> {
165
162
  * @default null
166
163
  */
167
164
  private _cacheKey;
165
+ /**
166
+ * The UUID of the node.
167
+ *
168
+ * @type {string}
169
+ * @default null
170
+ * @private
171
+ */
172
+ private _uuid;
168
173
  /**
169
174
  * The cache key's version.
170
175
  *
@@ -173,6 +178,13 @@ declare class NodeClass extends EventDispatcher<{ dispose: {} }> {
173
178
  * @default 0
174
179
  */
175
180
  private _cacheKeyVersion;
181
+ /**
182
+ * The unique ID of the node.
183
+ *
184
+ * @type {number}
185
+ * @readonly
186
+ */
187
+ readonly id: number;
176
188
  /**
177
189
  * The stack trace of the node for debugging purposes.
178
190
  *
@@ -188,6 +200,13 @@ declare class NodeClass extends EventDispatcher<{ dispose: {} }> {
188
200
  * @param {boolean} value
189
201
  */
190
202
  set needsUpdate(value: boolean);
203
+ /**
204
+ * The UUID of the node.
205
+ *
206
+ * @type {string}
207
+ * @readonly
208
+ */
209
+ get uuid(): string;
191
210
  /**
192
211
  * The type of the class. The value is usually the constructor name.
193
212
  *
@@ -354,9 +373,18 @@ declare class NodeClass extends EventDispatcher<{ dispose: {} }> {
354
373
  * Returns the node's type.
355
374
  *
356
375
  * @param {NodeBuilder} builder - The current node builder.
376
+ * @param {string} [output=null] - The output of the node.
377
+ * @return {string} The type of the node.
378
+ */
379
+ getNodeType(builder: NodeBuilder, output?: string): string;
380
+ /**
381
+ * Returns the node's type.
382
+ *
383
+ * @param {NodeBuilder} builder - The current node builder.
384
+ * @param {string} [output=null] - The output of the node.
357
385
  * @return {string} The type of the node.
358
386
  */
359
- getNodeType(builder: NodeBuilder): string;
387
+ generateNodeType(builder: NodeBuilder, output?: string): string;
360
388
  /**
361
389
  * This method is used during the build process of a node and ensures
362
390
  * equal nodes are not built multiple times but just once. For example if
@@ -15,7 +15,7 @@ declare class StackNode extends Node {
15
15
 
16
16
  Switch(expression: Node): this;
17
17
 
18
- Case(...params: Node[]): this;
18
+ Case(...params: [...Node[], () => void]): this;
19
19
 
20
20
  Default(method: () => void): this;
21
21
  }
@@ -51,10 +51,6 @@ declare class StructTypeNode extends Node {
51
51
  * @returns {number} The length of the struct.
52
52
  */
53
53
  getLength(): number;
54
- getMemberType(builder: NodeBuilder, name: string): string;
55
- getNodeType(builder: NodeBuilder): string;
56
- setup(builder: NodeBuilder): undefined;
57
- generate(builder: NodeBuilder): string;
58
54
  }
59
55
 
60
56
  export default StructTypeNode;
@@ -1,3 +1,4 @@
1
+ import { NodeUpdateType } from "./constants.js";
1
2
  import Node from "./Node.js";
2
3
 
3
4
  export default class UniformGroupNode extends Node {
@@ -8,13 +9,13 @@ export default class UniformGroupNode extends Node {
8
9
 
9
10
  readonly isUniformGroup: true;
10
11
 
11
- constructor(name: string, shared?: boolean);
12
+ constructor(name: string, shared?: boolean, order?: number, updateType?: NodeUpdateType | null);
12
13
 
13
14
  set needsUpdate(value: boolean);
14
15
  }
15
16
 
16
- export const uniformGroup: (name: string) => UniformGroupNode;
17
- export const sharedUniformGroup: (name: string) => UniformGroupNode;
17
+ export const uniformGroup: (name: string, order?: number, updateType?: NodeUpdateType | null) => UniformGroupNode;
18
+ export const sharedUniformGroup: (name: string, order?: number, updateType?: NodeUpdateType | null) => UniformGroupNode;
18
19
 
19
20
  export const frameGroup: UniformGroupNode;
20
21
  export const renderGroup: UniformGroupNode;
@@ -6,10 +6,12 @@ import { Vector2 } from "../../math/Vector2.js";
6
6
  import { Vector3 } from "../../math/Vector3.js";
7
7
  import { Vector4 } from "../../math/Vector4.js";
8
8
  import { NodeUpdateType } from "./constants.js";
9
+ import ConstNode from "./ConstNode.js";
9
10
  import InputNode from "./InputNode.js";
10
11
  import NodeBuilder from "./NodeBuilder.js";
11
12
  import NodeFrame from "./NodeFrame.js";
12
13
  import UniformGroupNode from "./UniformGroupNode.js";
14
+ import VarNode from "./VarNode.js";
13
15
 
14
16
  /**
15
17
  * Class for representing a uniform.
@@ -99,6 +101,7 @@ interface Uniform {
99
101
  (value: Matrix4): UniformNode<"mat4", Matrix4>;
100
102
  (value: Color): UniformNode<"color", Color>;
101
103
  <TNodeType, TValue>(value: InputNode<TNodeType, TValue>): UniformNode<TNodeType, TValue>;
104
+ <TNodeType, TValue>(value: VarNode<TNodeType, ConstNode<TNodeType, TValue>>): UniformNode<TNodeType, TValue>;
102
105
  }
103
106
 
104
107
  /**
@@ -1,7 +1,7 @@
1
1
  import Node from "./Node.js";
2
2
 
3
- interface VarNodeInterface {
4
- node: Node;
3
+ interface VarNodeInterface<TNode> {
4
+ node: TNode;
5
5
  name: string | null;
6
6
 
7
7
  readonly isVarNode: true;
@@ -15,25 +15,31 @@ interface VarNodeInterface {
15
15
  }
16
16
 
17
17
  declare const VarNode: {
18
- new<TNodeType>(node: Node<TNodeType>, name?: string | null, readOnly?: boolean): VarNode<TNodeType>;
18
+ new<TNodeType, TNode>(node: TNode, name?: string | null, readOnly?: boolean): VarNode<TNodeType, TNode>;
19
19
  };
20
20
 
21
- type VarNode<TNodeType = unknown> = Node<TNodeType> & VarNodeInterface;
21
+ type VarNode<TNodeType, TNode> = Node<TNodeType> & VarNodeInterface<TNode>;
22
22
 
23
23
  export default VarNode;
24
24
 
25
- export const Var: <TNodeType>(node: Node<TNodeType>, name?: string | null) => VarNode<TNodeType>;
25
+ export const Var: <TNodeType, TNode extends Node<TNodeType>>(
26
+ node: TNode,
27
+ name?: string | null,
28
+ ) => VarNode<TNodeType, TNode>;
26
29
 
27
- export const Const: <TNodeType>(node: Node<TNodeType>, name?: string | null) => VarNode<TNodeType>;
30
+ export const Const: <TNodeType, TNode extends Node<TNodeType>>(
31
+ node: TNode,
32
+ name?: string | null,
33
+ ) => VarNode<TNodeType, TNode>;
28
34
 
29
- export const VarIntent: <TNodeType>(node: Node<TNodeType>) => Node<TNodeType>;
35
+ export const VarIntent: <TNodeType, TNode extends Node<TNodeType>>(node: TNode) => VarNode<TNodeType, TNode>;
30
36
 
31
37
  declare module "./Node.js" {
32
38
  interface NodeExtensions<TNodeType> {
33
- toVar: (name?: string | null) => VarNode<TNodeType>;
39
+ toVar: (name?: string | null) => VarNode<TNodeType, this>;
34
40
 
35
- toConst: (name?: string | null) => VarNode<TNodeType>;
41
+ toConst: (name?: string | null) => VarNode<TNodeType, this>;
36
42
 
37
- toVarIntent: () => Node<TNodeType>;
43
+ toVarIntent: () => VarNode<TNodeType, this>;
38
44
  }
39
45
  }
@@ -3,9 +3,7 @@ import Node from "../core/Node.js";
3
3
  import ViewportTextureNode from "./ViewportTextureNode.js";
4
4
 
5
5
  declare class ViewportDepthTextureNode extends ViewportTextureNode {
6
- constructor(uvNode?: Node, levelNode?: Node | null);
7
-
8
- getTextureForReference(): DepthTexture;
6
+ constructor(uvNode?: Node, levelNode?: Node | null, depthTexture?: DepthTexture | null);
9
7
  }
10
8
 
11
9
  export default ViewportDepthTextureNode;
@@ -1,5 +1,5 @@
1
1
  import { RenderTarget } from "../../core/RenderTarget.js";
2
- import { FramebufferTexture } from "../../textures/FramebufferTexture.js";
2
+ import CanvasTarget from "../../renderers/common/CanvasTarget.js";
3
3
  import { Texture } from "../../textures/Texture.js";
4
4
  import TextureNode from "../accessors/TextureNode.js";
5
5
  import { NodeUpdateType } from "../core/constants.js";
@@ -12,9 +12,9 @@ declare class ViewportTextureNode extends TextureNode {
12
12
 
13
13
  updateBeforeType: NodeUpdateType;
14
14
 
15
- constructor(uvNode?: Node, levelNode?: Node | null, framebufferTexture?: FramebufferTexture | null);
15
+ constructor(uvNode?: Node, levelNode?: Node | null, framebufferTexture?: Texture | null);
16
16
 
17
- getTextureForReference(reference?: RenderTarget | null): Texture;
17
+ getTextureForReference(reference?: RenderTarget | CanvasTarget | null): Texture;
18
18
  }
19
19
 
20
20
  export default ViewportTextureNode;
@@ -22,12 +22,12 @@ export default ViewportTextureNode;
22
22
  export const viewportTexture: (
23
23
  uvNode?: Node,
24
24
  levelNode?: Node | null,
25
- framebufferTexture?: FramebufferTexture | null,
25
+ framebufferTexture?: Texture | null,
26
26
  ) => ViewportTextureNode;
27
27
  export const viewportMipTexture: (
28
28
  uvNode?: Node,
29
29
  levelNode?: Node | null,
30
- framebufferTexture?: FramebufferTexture | null,
30
+ framebufferTexture?: Texture | null,
31
31
  ) => Node;
32
32
 
33
33
  export const viewportOpaqueMipTexture: (uv?: Node, level?: Node | null) => Node;