@types/three 0.176.0 → 0.178.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 (214) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -1
  3. three/examples/jsm/capabilities/WebGL.d.ts +0 -11
  4. three/examples/jsm/controls/TransformControls.d.ts +16 -1
  5. three/examples/jsm/helpers/TextureHelper.d.ts +2 -2
  6. three/examples/jsm/helpers/TextureHelperGPU.d.ts +2 -2
  7. three/examples/jsm/loaders/LDrawLoader.d.ts +8 -3
  8. three/examples/jsm/loaders/SVGLoader.d.ts +1 -1
  9. three/examples/jsm/math/Octree.d.ts +3 -0
  10. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  11. three/examples/jsm/postprocessing/AfterimagePass.d.ts +13 -10
  12. three/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  13. three/examples/jsm/transpiler/AST.d.ts +77 -26
  14. three/examples/jsm/transpiler/TSLEncoder.d.ts +9 -3
  15. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +4 -4
  16. three/examples/jsm/tsl/display/BleachBypass.d.ts +2 -2
  17. three/examples/jsm/tsl/display/BloomNode.d.ts +2 -2
  18. three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +20 -0
  19. three/examples/jsm/tsl/display/DenoiseNode.d.ts +4 -4
  20. three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +6 -6
  21. three/examples/jsm/tsl/display/DotScreenNode.d.ts +2 -2
  22. three/examples/jsm/tsl/display/FXAANode.d.ts +3 -3
  23. three/examples/jsm/tsl/display/FilmNode.d.ts +4 -4
  24. three/examples/jsm/tsl/display/GTAONode.d.ts +3 -3
  25. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +5 -5
  26. three/examples/jsm/tsl/display/LensflareNode.d.ts +8 -8
  27. three/examples/jsm/tsl/display/Lut3DNode.d.ts +4 -4
  28. three/examples/jsm/tsl/display/MotionBlur.d.ts +4 -4
  29. three/examples/jsm/tsl/display/OutlineNode.d.ts +3 -3
  30. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +3 -3
  31. three/examples/jsm/tsl/display/SMAANode.d.ts +3 -3
  32. three/examples/jsm/tsl/display/SSRNode.d.ts +5 -5
  33. three/examples/jsm/tsl/display/Sepia.d.ts +2 -2
  34. three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +3 -3
  35. three/examples/jsm/tsl/display/TransitionNode.d.ts +4 -4
  36. three/examples/jsm/tsl/display/hashBlur.d.ts +10 -4
  37. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +5 -5
  38. three/package.json +3 -3
  39. three/src/Three.Core.d.ts +0 -2
  40. three/src/Three.TSL.d.ts +11 -18
  41. three/src/Three.WebGPU.Nodes.d.ts +1 -0
  42. three/src/Three.WebGPU.d.ts +3 -0
  43. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  44. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  45. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  46. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  47. three/src/constants.d.ts +13 -5
  48. three/src/core/BufferGeometry.d.ts +11 -2
  49. three/src/core/GLBufferAttribute.d.ts +18 -1
  50. three/src/core/RenderTarget.d.ts +3 -20
  51. three/src/extras/DataUtils.d.ts +4 -4
  52. three/src/geometries/CapsuleGeometry.d.ts +1 -0
  53. three/src/helpers/AxesHelper.d.ts +3 -1
  54. three/src/lights/SpotLightShadow.d.ts +2 -0
  55. three/src/lights/webgpu/ProjectorLight.d.ts +17 -0
  56. three/src/materials/LineBasicMaterial.d.ts +66 -34
  57. three/src/materials/LineDashedMaterial.d.ts +41 -21
  58. three/src/materials/Material.d.ts +408 -398
  59. three/src/materials/MeshBasicMaterial.d.ts +101 -62
  60. three/src/materials/MeshDepthMaterial.d.ts +71 -32
  61. three/src/materials/MeshDistanceMaterial.d.ts +65 -29
  62. three/src/materials/MeshLambertMaterial.d.ts +179 -103
  63. three/src/materials/MeshMatcapMaterial.d.ts +97 -55
  64. three/src/materials/MeshNormalMaterial.d.ts +76 -41
  65. three/src/materials/MeshPhongMaterial.d.ts +164 -100
  66. three/src/materials/MeshPhysicalMaterial.d.ts +164 -116
  67. three/src/materials/MeshStandardMaterial.d.ts +178 -91
  68. three/src/materials/MeshToonMaterial.d.ts +130 -81
  69. three/src/materials/PointsMaterial.d.ts +77 -30
  70. three/src/materials/RawShaderMaterial.d.ts +12 -7
  71. three/src/materials/ShaderMaterial.d.ts +186 -98
  72. three/src/materials/ShadowMaterial.d.ts +49 -23
  73. three/src/materials/SpriteMaterial.d.ts +62 -33
  74. three/src/materials/nodes/Line2NodeMaterial.d.ts +87 -40
  75. three/src/materials/nodes/LineBasicNodeMaterial.d.ts +35 -16
  76. three/src/materials/nodes/LineDashedNodeMaterial.d.ts +75 -20
  77. three/src/materials/nodes/MeshBasicNodeMaterial.d.ts +49 -30
  78. three/src/materials/nodes/MeshLambertNodeMaterial.d.ts +49 -42
  79. three/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +38 -26
  80. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +36 -22
  81. three/src/materials/nodes/MeshPhongNodeMaterial.d.ts +68 -48
  82. three/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +240 -65
  83. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +99 -3
  84. three/src/materials/nodes/MeshStandardNodeMaterial.d.ts +83 -47
  85. three/src/materials/nodes/MeshToonNodeMaterial.d.ts +42 -36
  86. three/src/materials/nodes/NodeMaterial.d.ts +418 -55
  87. three/src/materials/nodes/NodeMaterials.d.ts +3 -2
  88. three/src/materials/nodes/PointsNodeMaterial.d.ts +31 -7
  89. three/src/materials/nodes/ShadowNodeMaterial.d.ts +38 -11
  90. three/src/materials/nodes/SpriteNodeMaterial.d.ts +68 -18
  91. three/src/materials/nodes/VolumeNodeMaterial.d.ts +50 -14
  92. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +4 -0
  93. three/src/math/Box3.d.ts +8 -0
  94. three/src/math/Color.d.ts +1 -1
  95. three/src/math/ColorManagement.d.ts +12 -2
  96. three/src/math/Sphere.d.ts +8 -0
  97. three/src/math/Triangle.d.ts +3 -3
  98. three/src/nodes/Nodes.d.ts +2 -3
  99. three/src/nodes/TSL.d.ts +4 -3
  100. three/src/nodes/accessors/AccessorsUtils.d.ts +3 -3
  101. three/src/nodes/accessors/Bitangent.d.ts +0 -2
  102. three/src/nodes/accessors/CubeTextureNode.d.ts +16 -5
  103. three/src/nodes/accessors/Normal.d.ts +19 -5
  104. three/src/nodes/accessors/ReferenceBaseNode.d.ts +1 -1
  105. three/src/nodes/accessors/StorageBufferNode.d.ts +3 -2
  106. three/src/nodes/accessors/StorageTextureNode.d.ts +5 -5
  107. three/src/nodes/accessors/Tangent.d.ts +0 -2
  108. three/src/nodes/accessors/TangentUtils.d.ts +22 -0
  109. three/src/nodes/accessors/Texture3DNode.d.ts +5 -4
  110. three/src/nodes/accessors/TextureBicubic.d.ts +4 -2
  111. three/src/nodes/accessors/TextureNode.d.ts +24 -19
  112. three/src/nodes/accessors/TextureSizeNode.d.ts +3 -3
  113. three/src/nodes/accessors/UniformArrayNode.d.ts +2 -7
  114. three/src/nodes/code/FunctionCallNode.d.ts +3 -1
  115. three/src/nodes/code/FunctionNode.d.ts +2 -2
  116. three/src/nodes/code/ScriptableNode.d.ts +2 -2
  117. three/src/nodes/core/AssignNode.d.ts +7 -3
  118. three/src/nodes/core/AttributeNode.d.ts +1 -1
  119. three/src/nodes/core/BypassNode.d.ts +2 -2
  120. three/src/nodes/core/CacheNode.d.ts +1 -0
  121. three/src/nodes/core/ContextNode.d.ts +3 -3
  122. three/src/nodes/core/Node.d.ts +5 -4
  123. three/src/nodes/core/NodeUtils.d.ts +4 -0
  124. three/src/nodes/core/StackNode.d.ts +3 -13
  125. three/src/nodes/core/SubBuildNode.d.ts +15 -0
  126. three/src/nodes/core/VarNode.d.ts +4 -4
  127. three/src/nodes/core/VaryingNode.d.ts +3 -3
  128. three/src/nodes/display/BlendModes.d.ts +14 -10
  129. three/src/nodes/display/BumpMapNode.d.ts +4 -3
  130. three/src/nodes/display/ColorAdjustment.d.ts +17 -17
  131. three/src/nodes/display/ColorSpaceFunctions.d.ts +3 -3
  132. three/src/nodes/display/ColorSpaceNode.d.ts +6 -16
  133. three/src/nodes/display/FrontFacingNode.d.ts +1 -0
  134. three/src/nodes/display/PosterizeNode.d.ts +3 -3
  135. three/src/nodes/display/RenderOutputNode.d.ts +2 -2
  136. three/src/nodes/display/ScreenNode.d.ts +0 -10
  137. three/src/nodes/display/ToneMappingFunctions.d.ts +7 -7
  138. three/src/nodes/display/ToneMappingNode.d.ts +6 -6
  139. three/src/nodes/display/ViewportDepthTextureNode.d.ts +3 -3
  140. three/src/nodes/fog/Fog.d.ts +10 -10
  141. three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +4 -4
  142. three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +2 -2
  143. three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +4 -4
  144. three/src/nodes/geometry/RangeNode.d.ts +9 -2
  145. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +20 -20
  146. three/src/nodes/gpgpu/ComputeNode.d.ts +2 -2
  147. three/src/nodes/lighting/PointShadowNode.d.ts +11 -11
  148. three/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  149. three/src/nodes/lighting/ShadowFilterNode.d.ts +11 -11
  150. three/src/nodes/lighting/SpotLightNode.d.ts +15 -1
  151. three/src/nodes/materialx/MaterialXNodes.d.ts +59 -59
  152. three/src/nodes/materialx/lib/mx_hsv.d.ts +3 -3
  153. three/src/nodes/materialx/lib/mx_noise.d.ts +206 -206
  154. three/src/nodes/materialx/lib/mx_transform_color.d.ts +2 -2
  155. three/src/nodes/math/ConditionalNode.d.ts +4 -19
  156. three/src/nodes/math/Hash.d.ts +2 -2
  157. three/src/nodes/math/MathNode.d.ts +21 -17
  158. three/src/nodes/math/OperatorNode.d.ts +41 -52
  159. three/src/nodes/math/TriNoise3D.d.ts +6 -6
  160. three/src/nodes/pmrem/PMREMNode.d.ts +3 -3
  161. three/src/nodes/pmrem/PMREMUtils.d.ts +20 -20
  162. three/src/nodes/procedural/Checker.d.ts +2 -2
  163. three/src/nodes/shapes/Shapes.d.ts +2 -2
  164. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  165. three/src/nodes/tsl/TSLCore.d.ts +186 -81
  166. three/src/nodes/utils/CubeMapNode.d.ts +2 -2
  167. three/src/nodes/utils/DebugNode.d.ts +2 -2
  168. three/src/nodes/utils/Discard.d.ts +2 -2
  169. three/src/nodes/utils/EquirectUV.d.ts +4 -0
  170. three/src/nodes/utils/LoopNode.d.ts +2 -7
  171. three/src/nodes/utils/MatcapUV.d.ts +4 -0
  172. three/src/nodes/utils/Oscillators.d.ts +5 -5
  173. three/src/nodes/utils/Packing.d.ts +3 -3
  174. three/src/nodes/utils/PostProcessingUtils.d.ts +9 -9
  175. three/src/nodes/utils/RTTNode.d.ts +3 -3
  176. three/src/nodes/utils/ReflectorNode.d.ts +1 -0
  177. three/src/nodes/utils/RemapNode.d.ts +9 -9
  178. three/src/nodes/utils/RotateNode.d.ts +3 -3
  179. three/src/nodes/utils/SampleNode.d.ts +16 -0
  180. three/src/nodes/utils/SpriteSheetUVNode.d.ts +4 -4
  181. three/src/nodes/utils/SpriteUtils.d.ts +2 -2
  182. three/src/nodes/utils/StorageArrayElementNode.d.ts +4 -3
  183. three/src/nodes/utils/TriplanarTextures.d.ts +20 -0
  184. three/src/nodes/utils/UVUtils.d.ts +8 -7
  185. three/src/nodes/utils/ViewportUtils.d.ts +2 -2
  186. three/src/objects/LOD.d.ts +1 -1
  187. three/src/objects/Mesh.d.ts +8 -0
  188. three/src/objects/Sprite.d.ts +8 -0
  189. three/src/renderers/WebGLRenderer.d.ts +3 -3
  190. three/src/renderers/common/Backend.d.ts +3 -3
  191. three/src/renderers/common/RenderObject.d.ts +10 -2
  192. three/src/renderers/common/Renderer.d.ts +10 -5
  193. three/src/renderers/common/Storage3DTexture.d.ts +40 -0
  194. three/src/renderers/common/StorageArrayTexture.d.ts +29 -0
  195. three/src/renderers/common/Textures.d.ts +2 -2
  196. three/src/renderers/common/XRManager.d.ts +45 -0
  197. three/src/renderers/common/XRRenderTarget.d.ts +3 -2
  198. three/src/renderers/common/nodes/NodeLibrary.d.ts +4 -9
  199. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +1 -1
  200. three/src/renderers/common/nodes/Nodes.d.ts +1 -1
  201. three/src/renderers/webgpu/WebGPURenderer.d.ts +3 -0
  202. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +65 -0
  203. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -0
  204. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +10 -1
  205. three/src/textures/DepthTexture.d.ts +4 -2
  206. three/src/textures/Source.d.ts +20 -16
  207. three/src/textures/Texture.d.ts +69 -2
  208. three/examples/jsm/effects/PeppersGhostEffect.d.ts +0 -10
  209. three/src/core/RenderTargetArray.d.ts +0 -9
  210. three/src/nodes/utils/EquirectUVNode.d.ts +0 -8
  211. three/src/nodes/utils/MatcapUVNode.d.ts +0 -8
  212. three/src/nodes/utils/TriplanarTexturesNode.d.ts +0 -36
  213. three/src/renderers/common/nodes/StandardNodeLibrary.d.ts +0 -5
  214. three/src/textures/DepthArrayTexture.d.ts +0 -14
@@ -1,36 +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
- toGlobal: (node: Node) => Node;
11
-
12
15
  toStack: typeof Stack;
13
16
 
14
- toColor: typeof color;
15
- toFloat: typeof float;
16
- toInt: typeof int;
17
- toUint: typeof uint;
18
- toBool: typeof bool;
19
- toVec2: typeof vec2;
20
- toIvec2: typeof ivec2;
21
- toUvec2: typeof uvec2;
22
- toBvec2: typeof bvec2;
23
- toVec3: typeof vec3;
24
- toIvec3: typeof ivec3;
25
- toUvec3: typeof uvec3;
26
- toBvec3: typeof bvec3;
27
- toVec4: typeof vec4;
28
- toIvec4: typeof ivec4;
29
- toUvec4: typeof uvec4;
30
- toBvec4: typeof bvec4;
31
- toMat2: typeof mat2;
32
- toMat3: typeof mat3;
33
- 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>;
34
37
 
35
38
  element: typeof element;
36
39
  convert: typeof convert;
@@ -91,11 +94,8 @@ export type ShaderNodeObject<T extends Node> =
91
94
  }
92
95
  & Swizzable<T>;
93
96
 
94
- /** anything that can be passed to {@link nodeObject} and returns a proxy */
95
- export type NodeRepresentation<T extends Node = Node> = number | boolean | Vector3 | Node | ShaderNodeObject<T>;
96
-
97
97
  /** anything that can be passed to {@link nodeObject} */
98
- export type NodeObjectOption = NodeRepresentation | string;
98
+ export type NodeObjectOption = Node | number | string;
99
99
 
100
100
  // same logic as in ShaderNodeObject: number,boolean,node->ShaderNodeObject, otherwise do nothing
101
101
  export type NodeObject<T> = T extends Node ? ShaderNodeObject<T>
@@ -103,7 +103,7 @@ export type NodeObject<T> = T extends Node ? ShaderNodeObject<T>
103
103
  : T;
104
104
 
105
105
  // opposite of NodeObject: node -> node|ShaderNodeObject|boolean|number, otherwise do nothing
106
- type Proxied<T> = T extends Node ? NodeRepresentation<T> : T;
106
+ type Proxied<T> = T extends Node | number ? Node | number : T;
107
107
  // https://github.com/microsoft/TypeScript/issues/42435#issuecomment-765557874
108
108
  export type ProxiedTuple<T extends readonly [...unknown[]]> = [...{ [index in keyof T]: Proxied<T[index]> }];
109
109
  export type ProxiedObject<T> = { [index in keyof T]: Proxied<T[index]> };
@@ -154,7 +154,7 @@ type OverloadedConstructorsOf<T> = T extends {
154
154
  type AnyConstructors = Constructors<any, any, any, any>;
155
155
 
156
156
  /**
157
- * 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"
158
158
  */
159
159
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
160
160
  type FilterConstructorsByScope<T extends AnyConstructors, S> = {
@@ -173,7 +173,7 @@ type ConstructorUnion<T extends AnyConstructors> =
173
173
  | Exclude<T["d"], undefined>;
174
174
 
175
175
  /**
176
- * Extract list of possible scopes - union of the first paramter
176
+ * Extract list of possible scopes - union of the first parameter
177
177
  * of all constructors, should it be string
178
178
  */
179
179
  type ExtractScopes<T extends AnyConstructors> =
@@ -186,8 +186,6 @@ type GetConstructorsByScope<T, S> = ConstructorUnion<FilterConstructorsByScope<O
186
186
  type GetConstructors<T> = ConstructorUnion<OverloadedConstructorsOf<T>>;
187
187
  type GetPossibleScopes<T> = ExtractScopes<OverloadedConstructorsOf<T>>;
188
188
 
189
- export type ConvertType = (...params: unknown[]) => ShaderNodeObject<Node>;
190
-
191
189
  type NodeArray<T extends NodeObjectOption[]> = { [index in keyof T]: NodeObject<T[index]> };
192
190
  type NodeObjects<T> = { [key in keyof T]: T[key] extends NodeObjectOption ? NodeObject<T[key]> : T[key] };
193
191
  type ConstructedNode<T> = T extends new(...args: any[]) => infer R ? (R extends Node ? R : never) : never;
@@ -204,9 +202,9 @@ export const defined: (v: unknown) => unknown;
204
202
  export const getConstNodeType: (value: NodeOrType) => string | null;
205
203
 
206
204
  export class ShaderNode<T = {}, R extends Node = Node> {
207
- constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => NodeRepresentation);
205
+ constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => Node);
208
206
  call: (
209
- 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] },
210
208
  builder?: NodeBuilder,
211
209
  ) => ShaderNodeObject<R>;
212
210
  }
@@ -248,17 +246,24 @@ interface Layout {
248
246
 
249
247
  interface ShaderNodeFn<Args extends readonly unknown[]> {
250
248
  (...args: Args): ShaderNodeObject<ShaderCallNodeInternal>;
249
+
251
250
  shaderNode: ShaderNodeObject<ShaderNodeInternal>;
251
+ id: number;
252
+
253
+ getNodeType: (builder: NodeBuilder) => string | null;
254
+ getCacheKey: (force?: boolean) => number;
255
+
252
256
  setLayout: (layout: Layout) => this;
253
- once: () => this;
257
+
258
+ once: (subBuilds?: string[] | null) => this;
254
259
  }
255
260
 
256
- export function Fn(jsFunc: () => void): ShaderNodeFn<[]>;
261
+ export function Fn(jsFunc: (builder: NodeBuilder) => void): ShaderNodeFn<[]>;
257
262
  export function Fn<T extends readonly unknown[]>(
258
- jsFunc: (args: T) => void,
263
+ jsFunc: (args: T, builder: NodeBuilder) => void,
259
264
  ): ShaderNodeFn<ProxiedTuple<T>>;
260
265
  export function Fn<T extends { readonly [key: string]: unknown }>(
261
- jsFunc: (args: T) => void,
266
+ jsFunc: (args: T, builder: NodeBuilder) => void,
262
267
  ): ShaderNodeFn<[ProxiedObject<T>]>;
263
268
 
264
269
  export const setCurrentStack: (stack: StackNode | null) => void;
@@ -266,67 +271,167 @@ export const setCurrentStack: (stack: StackNode | null) => void;
266
271
  export const getCurrentStack: () => StackNode | null;
267
272
 
268
273
  export const If: (boolNode: Node, method: () => void) => StackNode;
269
- export const Switch: (expression: NodeRepresentation) => StackNode;
274
+ export const Switch: (expression: Node) => StackNode;
270
275
 
271
276
  export function Stack(node: Node): Node;
272
277
 
273
278
  interface ColorFunction {
274
- (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>>;
275
282
  (r: number, g: number, b: number): ShaderNodeObject<ConstNode<Color>>;
276
- (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.
277
292
  }
278
293
 
279
294
  export const color: ColorFunction;
280
295
 
281
- export const float: ConvertType;
282
- export const int: ConvertType;
283
- export const uint: ConvertType;
284
- 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>>;
285
316
 
286
- export const vec2: ConvertType;
287
- export const ivec2: ConvertType;
288
- export const uvec2: ConvertType;
289
- export const bvec2: ConvertType;
317
+ // The second branch does not apply because `cacheMap` is `null`
290
318
 
291
- export const vec3: ConvertType;
292
- export const ivec3: ConvertType;
293
- export const uvec3: ConvertType;
294
- export const bvec3: ConvertType;
319
+ // The third branch will be triggered if there is a single parameter.
320
+ (value: Vector2): ShaderNodeObject<ConstNode<Vector2>>;
321
+ (node: Node): ShaderNodeObject<Node>;
295
322
 
296
- export const vec4: ConvertType;
297
- export const ivec4: ConvertType;
298
- export const uvec4: ConvertType;
299
- export const bvec4: ConvertType;
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
+ }
300
327
 
301
- export const mat2: ConvertType;
302
- export const mat3: ConvertType;
303
- export const mat4: ConvertType;
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>;
343
+
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>;
364
+
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
+ }
369
+
370
+ export const vec4: Vector4Function;
371
+ export const ivec4: Vector4Function;
372
+ export const uvec4: Vector4Function;
373
+ export const bvec4: (node: Node) => ShaderNodeObject<Node>;
374
+
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;
304
426
 
305
427
  export const string: (value?: string) => ShaderNodeObject<ConstNode<string>>;
306
428
  export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<ArrayBuffer>>;
307
429
 
308
- export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
309
- export const convert: (node: NodeRepresentation, types: string) => ShaderNodeObject<Node>;
310
- 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>;
311
433
 
312
434
  /**
313
435
  * @deprecated append() has been renamed to Stack().
314
436
  */
315
437
  export const append: (node: Node) => Node;
316
-
317
- /**
318
- * @deprecated tslFn() has been renamed to Fn()
319
- */
320
- export function tslFn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
321
- /**
322
- * @deprecated tslFn() has been renamed to Fn()
323
- */
324
- export function tslFn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
325
- jsFunc: (args: T) => R,
326
- ): (...args: ProxiedTuple<T>) => R;
327
- /**
328
- * @deprecated tslFn() has been renamed to Fn()
329
- */
330
- export function tslFn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
331
- jsFunc: (args: T) => R,
332
- ): (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,
@@ -33,6 +33,7 @@ declare class ReflectorBaseNode extends Node {
33
33
  virtualCameras: WeakMap<Camera, Camera>;
34
34
  renderTargets: Map<Camera, RenderTarget>;
35
35
  forceUpdate: boolean;
36
+ hasOutput: boolean;
36
37
 
37
38
  constructor(textureNode: TextureNode, parameters?: ReflectorNodeParameters);
38
39
 
@@ -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>;