@types/three 0.177.0 → 0.178.1

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 (178) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/capabilities/WebGL.d.ts +0 -11
  3. three/examples/jsm/controls/TransformControls.d.ts +16 -1
  4. three/examples/jsm/helpers/TextureHelper.d.ts +2 -2
  5. three/examples/jsm/helpers/TextureHelperGPU.d.ts +2 -2
  6. three/examples/jsm/loaders/SVGLoader.d.ts +1 -1
  7. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  8. three/examples/jsm/transpiler/AST.d.ts +77 -26
  9. three/examples/jsm/transpiler/TSLEncoder.d.ts +9 -3
  10. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +4 -4
  11. three/examples/jsm/tsl/display/BleachBypass.d.ts +2 -2
  12. three/examples/jsm/tsl/display/BloomNode.d.ts +2 -2
  13. three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +20 -0
  14. three/examples/jsm/tsl/display/DenoiseNode.d.ts +4 -4
  15. three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +6 -6
  16. three/examples/jsm/tsl/display/DotScreenNode.d.ts +2 -2
  17. three/examples/jsm/tsl/display/FXAANode.d.ts +3 -3
  18. three/examples/jsm/tsl/display/FilmNode.d.ts +4 -4
  19. three/examples/jsm/tsl/display/GTAONode.d.ts +3 -3
  20. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +5 -5
  21. three/examples/jsm/tsl/display/LensflareNode.d.ts +8 -8
  22. three/examples/jsm/tsl/display/Lut3DNode.d.ts +4 -4
  23. three/examples/jsm/tsl/display/MotionBlur.d.ts +4 -4
  24. three/examples/jsm/tsl/display/OutlineNode.d.ts +3 -3
  25. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +3 -3
  26. three/examples/jsm/tsl/display/SMAANode.d.ts +3 -3
  27. three/examples/jsm/tsl/display/SSRNode.d.ts +5 -5
  28. three/examples/jsm/tsl/display/Sepia.d.ts +2 -2
  29. three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +3 -3
  30. three/examples/jsm/tsl/display/TransitionNode.d.ts +4 -4
  31. three/examples/jsm/tsl/display/hashBlur.d.ts +5 -5
  32. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +5 -5
  33. three/package.json +2 -2
  34. three/src/Three.TSL.d.ts +9 -16
  35. three/src/Three.WebGPU.d.ts +2 -0
  36. three/src/constants.d.ts +13 -5
  37. three/src/core/BufferGeometry.d.ts +6 -1
  38. three/src/core/GLBufferAttribute.d.ts +18 -1
  39. three/src/helpers/AxesHelper.d.ts +3 -1
  40. three/src/materials/LineBasicMaterial.d.ts +66 -34
  41. three/src/materials/LineDashedMaterial.d.ts +41 -21
  42. three/src/materials/Material.d.ts +408 -398
  43. three/src/materials/MeshBasicMaterial.d.ts +101 -62
  44. three/src/materials/MeshDepthMaterial.d.ts +71 -32
  45. three/src/materials/MeshDistanceMaterial.d.ts +65 -29
  46. three/src/materials/MeshLambertMaterial.d.ts +179 -103
  47. three/src/materials/MeshMatcapMaterial.d.ts +97 -55
  48. three/src/materials/MeshNormalMaterial.d.ts +76 -41
  49. three/src/materials/MeshPhongMaterial.d.ts +164 -100
  50. three/src/materials/MeshPhysicalMaterial.d.ts +171 -111
  51. three/src/materials/MeshStandardMaterial.d.ts +178 -91
  52. three/src/materials/MeshToonMaterial.d.ts +130 -81
  53. three/src/materials/PointsMaterial.d.ts +77 -30
  54. three/src/materials/RawShaderMaterial.d.ts +12 -7
  55. three/src/materials/ShaderMaterial.d.ts +186 -98
  56. three/src/materials/ShadowMaterial.d.ts +49 -23
  57. three/src/materials/SpriteMaterial.d.ts +62 -33
  58. three/src/materials/nodes/Line2NodeMaterial.d.ts +87 -40
  59. three/src/materials/nodes/LineBasicNodeMaterial.d.ts +35 -16
  60. three/src/materials/nodes/LineDashedNodeMaterial.d.ts +75 -20
  61. three/src/materials/nodes/MeshBasicNodeMaterial.d.ts +49 -30
  62. three/src/materials/nodes/MeshLambertNodeMaterial.d.ts +49 -42
  63. three/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +38 -26
  64. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +36 -22
  65. three/src/materials/nodes/MeshPhongNodeMaterial.d.ts +68 -48
  66. three/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +240 -65
  67. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +99 -3
  68. three/src/materials/nodes/MeshStandardNodeMaterial.d.ts +83 -47
  69. three/src/materials/nodes/MeshToonNodeMaterial.d.ts +42 -36
  70. three/src/materials/nodes/NodeMaterial.d.ts +417 -56
  71. three/src/materials/nodes/NodeMaterials.d.ts +3 -2
  72. three/src/materials/nodes/PointsNodeMaterial.d.ts +31 -7
  73. three/src/materials/nodes/ShadowNodeMaterial.d.ts +38 -11
  74. three/src/materials/nodes/SpriteNodeMaterial.d.ts +68 -20
  75. three/src/materials/nodes/VolumeNodeMaterial.d.ts +50 -14
  76. three/src/math/Color.d.ts +1 -1
  77. three/src/nodes/Nodes.d.ts +1 -3
  78. three/src/nodes/TSL.d.ts +4 -3
  79. three/src/nodes/accessors/AccessorsUtils.d.ts +3 -3
  80. three/src/nodes/accessors/Bitangent.d.ts +0 -2
  81. three/src/nodes/accessors/CubeTextureNode.d.ts +7 -7
  82. three/src/nodes/accessors/Normal.d.ts +19 -5
  83. three/src/nodes/accessors/ReferenceBaseNode.d.ts +1 -1
  84. three/src/nodes/accessors/StorageBufferNode.d.ts +3 -2
  85. three/src/nodes/accessors/StorageTextureNode.d.ts +5 -5
  86. three/src/nodes/accessors/Tangent.d.ts +0 -2
  87. three/src/nodes/accessors/TangentUtils.d.ts +22 -0
  88. three/src/nodes/accessors/Texture3DNode.d.ts +5 -4
  89. three/src/nodes/accessors/TextureBicubic.d.ts +4 -2
  90. three/src/nodes/accessors/TextureNode.d.ts +16 -16
  91. three/src/nodes/accessors/TextureSizeNode.d.ts +3 -3
  92. three/src/nodes/accessors/UniformArrayNode.d.ts +2 -7
  93. three/src/nodes/code/FunctionCallNode.d.ts +3 -1
  94. three/src/nodes/code/FunctionNode.d.ts +2 -2
  95. three/src/nodes/code/ScriptableNode.d.ts +2 -2
  96. three/src/nodes/core/AssignNode.d.ts +2 -2
  97. three/src/nodes/core/AttributeNode.d.ts +1 -1
  98. three/src/nodes/core/BypassNode.d.ts +2 -2
  99. three/src/nodes/core/CacheNode.d.ts +0 -2
  100. three/src/nodes/core/ContextNode.d.ts +3 -3
  101. three/src/nodes/core/StackNode.d.ts +3 -13
  102. three/src/nodes/core/SubBuildNode.d.ts +15 -0
  103. three/src/nodes/core/VarNode.d.ts +4 -4
  104. three/src/nodes/core/VaryingNode.d.ts +3 -3
  105. three/src/nodes/display/BlendModes.d.ts +12 -12
  106. three/src/nodes/display/BumpMapNode.d.ts +4 -3
  107. three/src/nodes/display/ColorAdjustment.d.ts +17 -17
  108. three/src/nodes/display/ColorSpaceFunctions.d.ts +3 -3
  109. three/src/nodes/display/ColorSpaceNode.d.ts +4 -4
  110. three/src/nodes/display/FrontFacingNode.d.ts +1 -0
  111. three/src/nodes/display/PosterizeNode.d.ts +3 -3
  112. three/src/nodes/display/RenderOutputNode.d.ts +2 -2
  113. three/src/nodes/display/ScreenNode.d.ts +0 -10
  114. three/src/nodes/display/ToneMappingFunctions.d.ts +7 -7
  115. three/src/nodes/display/ToneMappingNode.d.ts +6 -6
  116. three/src/nodes/display/ViewportDepthTextureNode.d.ts +3 -3
  117. three/src/nodes/fog/Fog.d.ts +10 -10
  118. three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +4 -4
  119. three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +2 -2
  120. three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +4 -4
  121. three/src/nodes/geometry/RangeNode.d.ts +9 -2
  122. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +20 -20
  123. three/src/nodes/gpgpu/ComputeNode.d.ts +2 -2
  124. three/src/nodes/lighting/PointShadowNode.d.ts +11 -11
  125. three/src/nodes/lighting/ShadowFilterNode.d.ts +11 -11
  126. three/src/nodes/materialx/MaterialXNodes.d.ts +59 -59
  127. three/src/nodes/materialx/lib/mx_hsv.d.ts +3 -3
  128. three/src/nodes/materialx/lib/mx_noise.d.ts +206 -206
  129. three/src/nodes/materialx/lib/mx_transform_color.d.ts +2 -2
  130. three/src/nodes/math/ConditionalNode.d.ts +4 -19
  131. three/src/nodes/math/Hash.d.ts +2 -2
  132. three/src/nodes/math/MathNode.d.ts +21 -17
  133. three/src/nodes/math/OperatorNode.d.ts +41 -52
  134. three/src/nodes/math/TriNoise3D.d.ts +6 -6
  135. three/src/nodes/pmrem/PMREMNode.d.ts +3 -3
  136. three/src/nodes/pmrem/PMREMUtils.d.ts +20 -20
  137. three/src/nodes/procedural/Checker.d.ts +2 -2
  138. three/src/nodes/shapes/Shapes.d.ts +2 -2
  139. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  140. three/src/nodes/tsl/TSLCore.d.ts +176 -76
  141. three/src/nodes/utils/CubeMapNode.d.ts +2 -2
  142. three/src/nodes/utils/DebugNode.d.ts +2 -2
  143. three/src/nodes/utils/Discard.d.ts +2 -2
  144. three/src/nodes/utils/EquirectUV.d.ts +4 -0
  145. three/src/nodes/utils/LoopNode.d.ts +2 -7
  146. three/src/nodes/utils/MatcapUV.d.ts +4 -0
  147. three/src/nodes/utils/Oscillators.d.ts +5 -5
  148. three/src/nodes/utils/Packing.d.ts +3 -3
  149. three/src/nodes/utils/PostProcessingUtils.d.ts +9 -9
  150. three/src/nodes/utils/RTTNode.d.ts +3 -3
  151. three/src/nodes/utils/RemapNode.d.ts +9 -9
  152. three/src/nodes/utils/RotateNode.d.ts +3 -3
  153. three/src/nodes/utils/SampleNode.d.ts +16 -0
  154. three/src/nodes/utils/SpriteSheetUVNode.d.ts +4 -4
  155. three/src/nodes/utils/SpriteUtils.d.ts +2 -2
  156. three/src/nodes/utils/StorageArrayElementNode.d.ts +4 -3
  157. three/src/nodes/utils/TriplanarTextures.d.ts +20 -0
  158. three/src/nodes/utils/UVUtils.d.ts +8 -7
  159. three/src/nodes/utils/ViewportUtils.d.ts +2 -2
  160. three/src/objects/LOD.d.ts +1 -1
  161. three/src/renderers/WebGLRenderer.d.ts +1 -1
  162. three/src/renderers/common/Backend.d.ts +3 -3
  163. three/src/renderers/common/RenderObject.d.ts +10 -2
  164. three/src/renderers/common/Renderer.d.ts +5 -5
  165. three/src/renderers/common/Storage3DTexture.d.ts +40 -0
  166. three/src/renderers/common/StorageArrayTexture.d.ts +29 -0
  167. three/src/renderers/common/Textures.d.ts +2 -2
  168. three/src/renderers/common/XRRenderTarget.d.ts +3 -2
  169. three/src/renderers/common/nodes/NodeLibrary.d.ts +4 -9
  170. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +1 -1
  171. three/src/renderers/common/nodes/Nodes.d.ts +1 -1
  172. three/src/renderers/webgpu/WebGPURenderer.d.ts +3 -0
  173. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +65 -0
  174. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +9 -0
  175. three/src/nodes/utils/EquirectUVNode.d.ts +0 -8
  176. three/src/nodes/utils/MatcapUVNode.d.ts +0 -8
  177. three/src/nodes/utils/TriplanarTexturesNode.d.ts +0 -36
  178. three/src/renderers/common/nodes/StandardNodeLibrary.d.ts +0 -5
@@ -1,34 +1,39 @@
1
- import { Color, ColorRepresentation } from "../../math/Color.js";
1
+ import { Color } from "../../math/Color.js";
2
+ import { Matrix2 } from "../../math/Matrix2.js";
3
+ import { Matrix3 } from "../../math/Matrix3.js";
4
+ import { Matrix4 } from "../../math/Matrix4.js";
5
+ import { Vector2 } from "../../math/Vector2.js";
2
6
  import { Vector3 } from "../../math/Vector3.js";
7
+ import { Vector4 } from "../../math/Vector4.js";
3
8
  import ConstNode from "../core/ConstNode.js";
4
9
  import Node from "../core/Node.js";
5
10
  import NodeBuilder from "../core/NodeBuilder.js";
6
11
  import StackNode from "../core/StackNode.js";
7
- import ConvertNode from "../utils/ConvertNode.js";
12
+ import JoinNode from "../utils/JoinNode.js";
8
13
 
9
14
  export interface NodeElements {
10
15
  toStack: typeof Stack;
11
16
 
12
- toColor: typeof color;
13
- toFloat: typeof float;
14
- toInt: typeof int;
15
- toUint: typeof uint;
16
- toBool: typeof bool;
17
- toVec2: typeof vec2;
18
- toIvec2: typeof ivec2;
19
- toUvec2: typeof uvec2;
20
- toBvec2: typeof bvec2;
21
- toVec3: typeof vec3;
22
- toIvec3: typeof ivec3;
23
- toUvec3: typeof uvec3;
24
- toBvec3: typeof bvec3;
25
- toVec4: typeof vec4;
26
- toIvec4: typeof ivec4;
27
- toUvec4: typeof uvec4;
28
- toBvec4: typeof bvec4;
29
- toMat2: typeof mat2;
30
- toMat3: typeof mat3;
31
- toMat4: typeof mat4;
17
+ toColor: (node: Node) => ShaderNodeObject<Node>;
18
+ toFloat: (node: Node) => ShaderNodeObject<Node>;
19
+ toInt: (node: Node) => ShaderNodeObject<Node>;
20
+ toUint: (node: Node) => ShaderNodeObject<Node>;
21
+ toBool: (node: Node) => ShaderNodeObject<Node>;
22
+ toVec2: (node: Node) => ShaderNodeObject<Node>;
23
+ toIvec2: (node: Node) => ShaderNodeObject<Node>;
24
+ toUvec2: (node: Node) => ShaderNodeObject<Node>;
25
+ toBvec2: (node: Node) => ShaderNodeObject<Node>;
26
+ toVec3: (node: Node) => ShaderNodeObject<Node>;
27
+ toIvec3: (node: Node) => ShaderNodeObject<Node>;
28
+ toUvec3: (node: Node) => ShaderNodeObject<Node>;
29
+ toBvec3: (node: Node) => ShaderNodeObject<Node>;
30
+ toVec4: (node: Node) => ShaderNodeObject<Node>;
31
+ toIvec4: (node: Node) => ShaderNodeObject<Node>;
32
+ toUvec4: (node: Node) => ShaderNodeObject<Node>;
33
+ toBvec4: (node: Node) => ShaderNodeObject<Node>;
34
+ toMat2: (node: Node) => ShaderNodeObject<Node>;
35
+ toMat3: (node: Node) => ShaderNodeObject<Node>;
36
+ toMat4: (node: Node) => ShaderNodeObject<Node>;
32
37
 
33
38
  element: typeof element;
34
39
  convert: typeof convert;
@@ -89,11 +94,8 @@ export type ShaderNodeObject<T extends Node> =
89
94
  }
90
95
  & Swizzable<T>;
91
96
 
92
- /** anything that can be passed to {@link nodeObject} and returns a proxy */
93
- export type NodeRepresentation<T extends Node = Node> = number | boolean | Vector3 | Node | ShaderNodeObject<T>;
94
-
95
97
  /** anything that can be passed to {@link nodeObject} */
96
- export type NodeObjectOption = NodeRepresentation | string;
98
+ export type NodeObjectOption = Node | number | string;
97
99
 
98
100
  // same logic as in ShaderNodeObject: number,boolean,node->ShaderNodeObject, otherwise do nothing
99
101
  export type NodeObject<T> = T extends Node ? ShaderNodeObject<T>
@@ -101,7 +103,7 @@ export type NodeObject<T> = T extends Node ? ShaderNodeObject<T>
101
103
  : T;
102
104
 
103
105
  // opposite of NodeObject: node -> node|ShaderNodeObject|boolean|number, otherwise do nothing
104
- type Proxied<T> = T extends Node ? NodeRepresentation<T> : T;
106
+ type Proxied<T> = T extends Node | number ? Node | number : T;
105
107
  // https://github.com/microsoft/TypeScript/issues/42435#issuecomment-765557874
106
108
  export type ProxiedTuple<T extends readonly [...unknown[]]> = [...{ [index in keyof T]: Proxied<T[index]> }];
107
109
  export type ProxiedObject<T> = { [index in keyof T]: Proxied<T[index]> };
@@ -152,7 +154,7 @@ type OverloadedConstructorsOf<T> = T extends {
152
154
  type AnyConstructors = Constructors<any, any, any, any>;
153
155
 
154
156
  /**
155
- * Returns all constructors where the first paramter is assignable to given "scope"
157
+ * Returns all constructors where the first parameter is assignable to given "scope"
156
158
  */
157
159
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
158
160
  type FilterConstructorsByScope<T extends AnyConstructors, S> = {
@@ -171,7 +173,7 @@ type ConstructorUnion<T extends AnyConstructors> =
171
173
  | Exclude<T["d"], undefined>;
172
174
 
173
175
  /**
174
- * Extract list of possible scopes - union of the first paramter
176
+ * Extract list of possible scopes - union of the first parameter
175
177
  * of all constructors, should it be string
176
178
  */
177
179
  type ExtractScopes<T extends AnyConstructors> =
@@ -184,8 +186,6 @@ type GetConstructorsByScope<T, S> = ConstructorUnion<FilterConstructorsByScope<O
184
186
  type GetConstructors<T> = ConstructorUnion<OverloadedConstructorsOf<T>>;
185
187
  type GetPossibleScopes<T> = ExtractScopes<OverloadedConstructorsOf<T>>;
186
188
 
187
- export type ConvertType = (...params: unknown[]) => ShaderNodeObject<Node>;
188
-
189
189
  type NodeArray<T extends NodeObjectOption[]> = { [index in keyof T]: NodeObject<T[index]> };
190
190
  type NodeObjects<T> = { [key in keyof T]: T[key] extends NodeObjectOption ? NodeObject<T[key]> : T[key] };
191
191
  type ConstructedNode<T> = T extends new(...args: any[]) => infer R ? (R extends Node ? R : never) : never;
@@ -202,9 +202,9 @@ export const defined: (v: unknown) => unknown;
202
202
  export const getConstNodeType: (value: NodeOrType) => string | null;
203
203
 
204
204
  export class ShaderNode<T = {}, R extends Node = Node> {
205
- constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => NodeRepresentation);
205
+ constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => Node);
206
206
  call: (
207
- inputs: { [key in keyof T]: T[key] extends NodeRepresentation ? ShaderNodeObject<Node> | Node : T[key] },
207
+ inputs: { [key in keyof T]: T[key] extends Node ? ShaderNodeObject<Node> | Node : T[key] },
208
208
  builder?: NodeBuilder,
209
209
  ) => ShaderNodeObject<R>;
210
210
  }
@@ -255,7 +255,7 @@ interface ShaderNodeFn<Args extends readonly unknown[]> {
255
255
 
256
256
  setLayout: (layout: Layout) => this;
257
257
 
258
- once: (namespace?: string | null) => this;
258
+ once: (subBuilds?: string[] | null) => this;
259
259
  }
260
260
 
261
261
  export function Fn(jsFunc: (builder: NodeBuilder) => void): ShaderNodeFn<[]>;
@@ -271,67 +271,167 @@ export const setCurrentStack: (stack: StackNode | null) => void;
271
271
  export const getCurrentStack: () => StackNode | null;
272
272
 
273
273
  export const If: (boolNode: Node, method: () => void) => StackNode;
274
- export const Switch: (expression: NodeRepresentation) => StackNode;
274
+ export const Switch: (expression: Node) => StackNode;
275
275
 
276
276
  export function Stack(node: Node): Node;
277
277
 
278
278
  interface ColorFunction {
279
- (color?: ColorRepresentation): ShaderNodeObject<ConstNode<Color>>;
279
+ // The first branch in `ConvertType` will forward the parameters to the `Color` constructor if there are no
280
+ // parameters or all the parameters are non-objects
281
+ (color?: string | number): ShaderNodeObject<ConstNode<Color>>;
280
282
  (r: number, g: number, b: number): ShaderNodeObject<ConstNode<Color>>;
281
- (node: Node): ShaderNodeObject<ConvertNode>;
283
+
284
+ // The second branch does not apply because `cacheMap` is `null`
285
+
286
+ // The third branch will be triggered if there is a single parameter.
287
+ (color: Color): ShaderNodeObject<ConstNode<Color>>;
288
+ (node: Node): ShaderNodeObject<Node>;
289
+
290
+ // The fall-through branch will be triggered if there is more than one parameter, or one of the parameters is an
291
+ // object. Not sure which cases are worth considering here.
282
292
  }
283
293
 
284
294
  export const color: ColorFunction;
285
295
 
286
- export const float: ConvertType;
287
- export const int: ConvertType;
288
- export const uint: ConvertType;
289
- export const bool: ConvertType;
296
+ interface NumberFunction {
297
+ (value?: number): ShaderNodeObject<ConstNode<number>>;
298
+ (node: Node): ShaderNodeObject<Node>;
299
+ }
300
+
301
+ export const float: NumberFunction;
302
+ export const int: NumberFunction;
303
+ export const uint: NumberFunction;
304
+
305
+ interface BooleanFunction {
306
+ (value?: boolean): ShaderNodeObject<ConstNode<boolean>>;
307
+ (node: Node): ShaderNodeObject<Node>;
308
+ }
309
+
310
+ export const bool: BooleanFunction;
311
+
312
+ interface Vector2Function {
313
+ // The first branch in `ConvertType` will forward the parameters to the `Vector2` constructor if there are no
314
+ // parameters or all the parameters are non-objects
315
+ (x?: number, y?: number): ShaderNodeObject<ConstNode<Vector2>>;
316
+
317
+ // The second branch does not apply because `cacheMap` is `null`
318
+
319
+ // The third branch will be triggered if there is a single parameter.
320
+ (value: Vector2): ShaderNodeObject<ConstNode<Vector2>>;
321
+ (node: Node): ShaderNodeObject<Node>;
322
+
323
+ // The fall-through branch will be triggered if there is more than one parameter, or one of the parameters is an
324
+ // object.
325
+ (x: Node | number, y: Node | number): ShaderNodeObject<JoinNode>;
326
+ }
327
+
328
+ export const vec2: Vector2Function;
329
+ export const ivec2: Vector2Function;
330
+ export const uvec2: Vector2Function;
331
+ export const bvec2: (node: Node) => ShaderNodeObject<Node>;
332
+
333
+ interface Vector3Function {
334
+ // The first branch in `ConvertType` will forward the parameters to the `Vector3` constructor if there are no
335
+ // parameters or all the parameters are non-objects
336
+ (x?: number, y?: number, z?: number): ShaderNodeObject<ConstNode<Vector3>>;
337
+
338
+ // The second branch does not apply because `cacheMap` is `null`
339
+
340
+ // The third branch will be triggered if there is a single parameter.
341
+ (value: Vector3): ShaderNodeObject<ConstNode<Vector3>>;
342
+ (node: Node): ShaderNodeObject<Node>;
290
343
 
291
- export const vec2: ConvertType;
292
- export const ivec2: ConvertType;
293
- export const uvec2: ConvertType;
294
- export const bvec2: ConvertType;
344
+ // The fall-through branch will be triggered if there is more than one parameter, or one of the parameters is an
345
+ // object.
346
+ (x: Node | number, y: Node | number, z?: Node | number): ShaderNodeObject<JoinNode>;
347
+ }
348
+
349
+ export const vec3: Vector3Function;
350
+ export const ivec3: Vector3Function;
351
+ export const uvec3: Vector3Function;
352
+ export const bvec3: (node: Node) => ShaderNodeObject<Node>;
353
+
354
+ interface Vector4Function {
355
+ // The first branch in `ConvertType` will forward the parameters to the `Vector4` constructor if there are no
356
+ // parameters or all the parameters are non-objects
357
+ (x?: number, y?: number, z?: number, w?: number): ShaderNodeObject<ConstNode<Vector4>>;
358
+
359
+ // The second branch does not apply because `cacheMap` is `null`
360
+
361
+ // The third branch will be triggered if there is a single parameter.
362
+ (value: Vector4): ShaderNodeObject<ConstNode<Vector4>>;
363
+ (node: Node): ShaderNodeObject<Node>;
295
364
 
296
- export const vec3: ConvertType;
297
- export const ivec3: ConvertType;
298
- export const uvec3: ConvertType;
299
- export const bvec3: ConvertType;
365
+ // The fall-through branch will be triggered if there is more than one parameter, or one of the parameters is an
366
+ // object.
367
+ (x: Node | number, y: Node | number, z?: Node | number, w?: Node | number): ShaderNodeObject<JoinNode>;
368
+ }
300
369
 
301
- export const vec4: ConvertType;
302
- export const ivec4: ConvertType;
303
- export const uvec4: ConvertType;
304
- export const bvec4: ConvertType;
370
+ export const vec4: Vector4Function;
371
+ export const ivec4: Vector4Function;
372
+ export const uvec4: Vector4Function;
373
+ export const bvec4: (node: Node) => ShaderNodeObject<Node>;
305
374
 
306
- export const mat2: ConvertType;
307
- export const mat3: ConvertType;
308
- export const mat4: ConvertType;
375
+ interface Matrix2Function {
376
+ (value: Matrix2): ShaderNodeObject<ConstNode<Matrix2>>;
377
+ (node: Node): ShaderNodeObject<Node>;
378
+ }
379
+
380
+ export const mat2: Matrix2Function;
381
+
382
+ interface Matrix3Function {
383
+ (value: Matrix3): ShaderNodeObject<ConstNode<Matrix3>>;
384
+ (
385
+ n11: number,
386
+ n12: number,
387
+ n13: number,
388
+ n21: number,
389
+ n22: number,
390
+ n23: number,
391
+ n31: number,
392
+ n32: number,
393
+ n33: number,
394
+ ): ShaderNodeObject<ConstNode<Matrix3>>;
395
+ (): ShaderNodeObject<ConstNode<Matrix3>>;
396
+ (node: Node): ShaderNodeObject<Node>;
397
+ }
398
+
399
+ export const mat3: Matrix3Function;
400
+
401
+ interface Matrix4Function {
402
+ (value: Matrix4): ShaderNodeObject<ConstNode<Matrix4>>;
403
+ (
404
+ n11: number,
405
+ n12: number,
406
+ n13: number,
407
+ n14: number,
408
+ n21: number,
409
+ n22: number,
410
+ n23: number,
411
+ n24: number,
412
+ n31: number,
413
+ n32: number,
414
+ n33: number,
415
+ n34: number,
416
+ n41: number,
417
+ n42: number,
418
+ n43: number,
419
+ n44: number,
420
+ ): ShaderNodeObject<ConstNode<Matrix4>>;
421
+ (): ShaderNodeObject<ConstNode<Matrix4>>;
422
+ (node: Node): ShaderNodeObject<Node>;
423
+ }
424
+
425
+ export const mat4: Matrix4Function;
309
426
 
310
427
  export const string: (value?: string) => ShaderNodeObject<ConstNode<string>>;
311
428
  export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<ArrayBuffer>>;
312
429
 
313
- export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
314
- export const convert: (node: NodeRepresentation, types: string) => ShaderNodeObject<Node>;
315
- export const split: (node: NodeRepresentation, channels?: string) => ShaderNodeObject<Node>;
430
+ export const element: (node: Node, indexNode: Node) => ShaderNodeObject<Node>;
431
+ export const convert: (node: Node, types: string) => ShaderNodeObject<Node>;
432
+ export const split: (node: Node, channels?: string) => ShaderNodeObject<Node>;
316
433
 
317
434
  /**
318
435
  * @deprecated append() has been renamed to Stack().
319
436
  */
320
437
  export const append: (node: Node) => Node;
321
-
322
- /**
323
- * @deprecated tslFn() has been renamed to Fn()
324
- */
325
- export function tslFn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
326
- /**
327
- * @deprecated tslFn() has been renamed to Fn()
328
- */
329
- export function tslFn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
330
- jsFunc: (args: T) => R,
331
- ): (...args: ProxiedTuple<T>) => R;
332
- /**
333
- * @deprecated tslFn() has been renamed to Fn()
334
- */
335
- export function tslFn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
336
- jsFunc: (args: T) => R,
337
- ): (args: ProxiedObject<T>) => R;
@@ -1,6 +1,6 @@
1
1
  import Node from "../core/Node.js";
2
2
  import TempNode from "../core/TempNode.js";
3
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
4
 
5
5
  declare class CubeMapNode extends TempNode {
6
6
  envNode: Node;
@@ -10,4 +10,4 @@ declare class CubeMapNode extends TempNode {
10
10
 
11
11
  export default CubeMapNode;
12
12
 
13
- export const cubeMapNode: (envNode: NodeRepresentation) => ShaderNodeObject<CubeMapNode>;
13
+ export const cubeMapNode: (envNode: Node) => ShaderNodeObject<CubeMapNode>;
@@ -1,7 +1,7 @@
1
1
  import Node from "../core/Node.js";
2
2
  import NodeBuilder from "../core/NodeBuilder.js";
3
3
  import TempNode from "../core/TempNode.js";
4
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
4
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
5
5
 
6
6
  declare class DebugNode extends TempNode {
7
7
  constructor(node: Node, callback?: ((code: string) => void) | null);
@@ -10,7 +10,7 @@ declare class DebugNode extends TempNode {
10
10
  export default DebugNode;
11
11
 
12
12
  export const debug: (
13
- node: NodeRepresentation,
13
+ node: Node,
14
14
  callback?: ((node: NodeBuilder, code: string) => void) | null,
15
15
  ) => ShaderNodeObject<DebugNode>;
16
16
 
@@ -1,7 +1,7 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const Discard: (conditional?: NodeRepresentation) => ShaderNodeObject<Node>;
4
+ export const Discard: (conditional?: Node) => ShaderNodeObject<Node>;
5
5
  export const Return: () => ShaderNodeObject<Node>;
6
6
 
7
7
  declare module "../tsl/TSLCore.js" {
@@ -0,0 +1,4 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const equirectUV: (dirNode?: Node) => ShaderNodeObject<Node>;
@@ -4,12 +4,12 @@ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
4
 
5
5
  interface LoopNodeObjectParameter {
6
6
  // TODO Expand to other types and update loop function types appropriately
7
- type?: "int" | "uint";
7
+ type?: "int" | "uint" | "float";
8
8
  // TODO The variable name should affect the type of the loop function
9
9
  // name?: string;
10
10
  start: number | Node;
11
11
  end: number | Node;
12
- condition: string;
12
+ condition?: string;
13
13
  }
14
14
 
15
15
  type LoopNodeParameter = Node | number | LoopNodeObjectParameter;
@@ -36,8 +36,3 @@ interface Loop {
36
36
  export const Loop: Loop;
37
37
  export const Continue: () => ShaderNodeObject<Node>;
38
38
  export const Break: () => ShaderNodeObject<Node>;
39
-
40
- /**
41
- * @deprecated loop() has been renamed to Loop()
42
- */
43
- export const loop: (...params: unknown[]) => ShaderNodeObject<Node>;
@@ -0,0 +1,4 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const matcapUV: ShaderNodeObject<Node>;
@@ -1,7 +1,7 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const oscSine: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
5
- export const oscSquare: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
6
- export const oscTriangle: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
7
- export const oscSawtooth: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
4
+ export const oscSine: (timeNode?: Node) => ShaderNodeObject<Node>;
5
+ export const oscSquare: (timeNode?: Node) => ShaderNodeObject<Node>;
6
+ export const oscTriangle: (timeNode?: Node) => ShaderNodeObject<Node>;
7
+ export const oscSawtooth: (timeNode?: Node) => ShaderNodeObject<Node>;
@@ -1,5 +1,5 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const directionToColor: (node: NodeRepresentation) => ShaderNodeObject<Node>;
5
- export const colorToDirection: (node: NodeRepresentation) => ShaderNodeObject<Node>;
4
+ export const directionToColor: (node: Node) => ShaderNodeObject<Node>;
5
+ export const colorToDirection: (node: Node) => ShaderNodeObject<Node>;
@@ -1,5 +1,5 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
4
  /**
5
5
  * Computes a position in view space based on a fragment's screen position expressed as uv coordinates, the fragments
@@ -11,9 +11,9 @@ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
11
11
  * @return {vec3} The fragments position in view space.
12
12
  */
13
13
  export const getViewPosition: (
14
- screenPosition: NodeRepresentation,
15
- depth: NodeRepresentation,
16
- projectionMatrixInverse: NodeRepresentation,
14
+ screenPosition: Node,
15
+ depth: Node,
16
+ projectionMatrixInverse: Node,
17
17
  ) => ShaderNodeObject<Node>;
18
18
 
19
19
  /**
@@ -25,8 +25,8 @@ export const getViewPosition: (
25
25
  * @return {vec2} The fragment's screen position expressed as uv coordinates.
26
26
  */
27
27
  export const getScreenPosition: (
28
- viewPosition: NodeRepresentation,
29
- projectionMatrix: NodeRepresentation,
28
+ viewPosition: Node,
29
+ projectionMatrix: Node,
30
30
  ) => ShaderNodeObject<Node>;
31
31
 
32
32
  /**
@@ -39,7 +39,7 @@ export const getScreenPosition: (
39
39
  * @return {vec3} The computed normal vector.
40
40
  */
41
41
  export const getNormalFromDepth: (
42
- uv: NodeRepresentation,
43
- depthTexture: NodeRepresentation,
44
- projectionMatrixInverse: NodeRepresentation,
42
+ uv: Node,
43
+ depthTexture: Node,
44
+ projectionMatrixInverse: Node,
45
45
  ) => ShaderNodeObject<Node>;
@@ -2,7 +2,7 @@ import { TextureDataType } from "../../constants.js";
2
2
  import { RenderTarget } from "../../core/RenderTarget.js";
3
3
  import TextureNode from "../accessors/TextureNode.js";
4
4
  import Node from "../core/Node.js";
5
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
5
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
6
6
 
7
7
  export interface RTTNodeOptions {
8
8
  type: TextureDataType;
@@ -22,7 +22,7 @@ declare class RTTNode extends TextureNode {
22
22
 
23
23
  constructor(node: Node, width?: number | null, height?: number | null, options?: RTTNodeOptions);
24
24
 
25
- get autoSize(): boolean;
25
+ get autoResize(): boolean;
26
26
 
27
27
  setSize(width: number | null, height: number | null): void;
28
28
 
@@ -32,7 +32,7 @@ declare class RTTNode extends TextureNode {
32
32
  export default RTTNode;
33
33
 
34
34
  export const rtt: (
35
- node: NodeRepresentation,
35
+ node: Node,
36
36
  width?: number | null,
37
37
  height?: number | null,
38
38
  options?: RTTNodeOptions,
@@ -1,5 +1,5 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
4
  export default class RemapNode extends Node {
5
5
  node: Node;
@@ -15,17 +15,17 @@ export default class RemapNode extends Node {
15
15
 
16
16
  export const remap: (
17
17
  node: Node,
18
- inLowNode: NodeRepresentation,
19
- inHighNode: NodeRepresentation,
20
- outLowNode?: NodeRepresentation,
21
- outHighNode?: NodeRepresentation,
18
+ inLowNode: Node | number,
19
+ inHighNode: Node | number,
20
+ outLowNode?: Node | number,
21
+ outHighNode?: Node | number,
22
22
  ) => ShaderNodeObject<RemapNode>;
23
23
  export const remapClamp: (
24
24
  node: Node,
25
- inLowNode: NodeRepresentation,
26
- inHighNode: NodeRepresentation,
27
- outLowNode?: NodeRepresentation,
28
- outHighNode?: NodeRepresentation,
25
+ inLowNode: Node | number,
26
+ inHighNode: Node | number,
27
+ outLowNode?: Node | number,
28
+ outHighNode?: Node | number,
29
29
  ) => ShaderNodeObject<RemapNode>;
30
30
 
31
31
  declare module "../tsl/TSLCore.js" {
@@ -1,6 +1,6 @@
1
1
  import Node from "../core/Node.js";
2
2
  import TempNode from "../core/TempNode.js";
3
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
4
 
5
5
  export default class RotateNode extends TempNode {
6
6
  positionNode: Node;
@@ -10,6 +10,6 @@ export default class RotateNode extends TempNode {
10
10
  }
11
11
 
12
12
  export const rotate: (
13
- positionNode: NodeRepresentation,
14
- rotationNode: NodeRepresentation,
13
+ positionNode: Node,
14
+ rotationNode: Node | number,
15
15
  ) => ShaderNodeObject<RotateNode>;
@@ -0,0 +1,16 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ declare class SampleNode extends Node {
5
+ callback: (uv: Node) => Node;
6
+
7
+ readonly isSampleNode: true;
8
+
9
+ constructor(callback: (uv: Node) => Node);
10
+
11
+ sample(uv: Node): Node;
12
+ }
13
+
14
+ export default SampleNode;
15
+
16
+ export const sample: (callback: (uv: Node) => Node) => ShaderNodeObject<SampleNode>;
@@ -1,5 +1,5 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
4
  export default class SpriteSheetUVNode extends Node {
5
5
  countNode: Node;
@@ -10,7 +10,7 @@ export default class SpriteSheetUVNode extends Node {
10
10
  }
11
11
 
12
12
  export const spritesheetUV: (
13
- countNode: NodeRepresentation,
14
- uvNode: NodeRepresentation | null,
15
- frameNode: NodeRepresentation | null,
13
+ countNode: Node,
14
+ uvNode: Node | null,
15
+ frameNode: Node | null,
16
16
  ) => ShaderNodeObject<SpriteSheetUVNode>;
@@ -1,6 +1,6 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
4
  export const billboarding: (
5
- args?: { position?: NodeRepresentation | null; horizontal?: boolean; vertical?: boolean },
5
+ args?: { position?: Node | null; horizontal?: boolean; vertical?: boolean },
6
6
  ) => ShaderNodeObject<Node>;
@@ -1,5 +1,6 @@
1
1
  import StorageBufferNode from "../accessors/StorageBufferNode.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import Node from "../core/Node.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
4
  import ArrayElementNode from "./ArrayElementNode.js";
4
5
 
5
6
  export default class StorageArrayElementNode extends ArrayElementNode {
@@ -14,6 +15,6 @@ export default class StorageArrayElementNode extends ArrayElementNode {
14
15
  }
15
16
 
16
17
  export const storageElement: (
17
- storageBufferNode: NodeRepresentation,
18
- indexNode: NodeRepresentation,
18
+ storageBufferNode: Node,
19
+ indexNode: Node,
19
20
  ) => ShaderNodeObject<StorageArrayElementNode>;
@@ -0,0 +1,20 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const triplanarTextures: (
5
+ textureXNode: Node,
6
+ textureYNode?: Node | null,
7
+ textureZNode?: Node | null,
8
+ scaleNode?: Node,
9
+ positionNode?: Node,
10
+ normalNode?: Node,
11
+ ) => ShaderNodeObject<Node>;
12
+
13
+ export const triplanarTexture: (
14
+ textureXNode: Node,
15
+ textureYNode?: Node | null,
16
+ textureZNode?: Node | null,
17
+ scaleNode?: Node,
18
+ positionNode?: Node,
19
+ normalNode?: Node,
20
+ ) => ShaderNodeObject<Node>;