@types/three 0.171.0 → 0.172.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 (121) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -5
  3. three/examples/jsm/controls/ArcballControls.d.ts +1 -1
  4. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  5. three/examples/jsm/csm/CSMShadowNode.d.ts +2 -3
  6. three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +13 -0
  7. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  8. three/examples/jsm/lines/LineSegments2.d.ts +3 -1
  9. three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
  10. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
  11. three/examples/jsm/objects/InstancedPoints.d.ts +10 -0
  12. three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
  13. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
  14. three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
  15. three/package.json +2 -2
  16. three/src/Three.Core.d.ts +2 -1
  17. three/src/Three.TSL.d.ts +9 -4
  18. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  19. three/src/Three.WebGPU.d.ts +2 -2
  20. three/src/cameras/CubeCamera.d.ts +19 -2
  21. three/src/core/RenderTarget.d.ts +3 -5
  22. three/src/core/RenderTarget3D.d.ts +9 -0
  23. three/src/core/RenderTargetArray.d.ts +9 -0
  24. three/src/materials/Material.d.ts +3 -1
  25. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  26. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  27. three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
  28. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
  29. three/src/materials/nodes/NodeMaterial.d.ts +3 -0
  30. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +56 -0
  31. three/src/nodes/Nodes.d.ts +1 -6
  32. three/src/nodes/TSL.d.ts +2 -3
  33. three/src/nodes/accessors/Arrays.d.ts +3 -2
  34. three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
  35. three/src/nodes/accessors/BufferNode.d.ts +4 -4
  36. three/src/nodes/accessors/MaterialNode.d.ts +3 -3
  37. three/src/nodes/accessors/ModelNode.d.ts +10 -2
  38. three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
  39. three/src/nodes/accessors/StorageBufferNode.d.ts +5 -1
  40. three/src/nodes/accessors/TextureNode.d.ts +5 -0
  41. three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
  42. three/src/nodes/core/Node.d.ts +237 -0
  43. three/src/nodes/core/NodeAttribute.d.ts +13 -0
  44. three/src/nodes/core/NodeBuilder.d.ts +1 -2
  45. three/src/nodes/core/NodeCache.d.ts +21 -0
  46. three/src/nodes/core/NodeParser.d.ts +11 -0
  47. three/src/nodes/core/NodeUniform.d.ts +28 -0
  48. three/src/nodes/core/NodeVar.d.ts +12 -0
  49. three/src/nodes/core/NodeVarying.d.ts +14 -0
  50. three/src/nodes/core/StructTypeNode.d.ts +19 -1
  51. three/src/nodes/core/UniformNode.d.ts +44 -0
  52. three/src/nodes/core/VaryingNode.d.ts +3 -0
  53. three/src/nodes/core/constants.d.ts +35 -0
  54. three/src/nodes/display/PassNode.d.ts +1 -1
  55. three/src/nodes/fog/Fog.d.ts +26 -0
  56. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
  57. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
  58. three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
  59. three/src/nodes/lighting/ShadowNode.d.ts +2 -1
  60. three/src/nodes/math/MathNode.d.ts +13 -4
  61. three/src/nodes/tsl/TSLCore.d.ts +48 -16
  62. three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
  63. three/src/nodes/utils/LoopNode.d.ts +23 -2
  64. three/src/objects/ClippingGroup.d.ts +1 -1
  65. three/src/renderers/WebGLRenderer.d.ts +8 -8
  66. three/src/renderers/common/Animation.d.ts +30 -0
  67. three/src/renderers/common/Attributes.d.ts +31 -0
  68. three/src/renderers/common/Backend.d.ts +11 -0
  69. three/src/renderers/common/Background.d.ts +22 -0
  70. three/src/renderers/common/BindGroup.d.ts +15 -0
  71. three/src/renderers/common/Binding.d.ts +24 -0
  72. three/src/renderers/common/Bindings.d.ts +54 -0
  73. three/src/renderers/common/Buffer.d.ts +31 -0
  74. three/src/renderers/common/BufferUtils.d.ts +26 -0
  75. three/src/renderers/common/BundleGroup.d.ts +22 -0
  76. three/src/renderers/common/ChainMap.d.ts +31 -1
  77. three/src/renderers/common/ClippingContext.d.ts +45 -0
  78. three/src/renderers/common/Color4.d.ts +36 -0
  79. three/src/renderers/common/ComputePipeline.d.ts +12 -0
  80. three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
  81. three/src/renderers/common/DataMap.d.ts +30 -0
  82. three/src/renderers/common/Geometries.d.ts +52 -0
  83. three/src/renderers/common/Info.d.ts +27 -0
  84. three/src/renderers/common/Pipeline.d.ts +11 -0
  85. three/src/renderers/common/Pipelines.d.ts +104 -0
  86. three/src/renderers/common/ProgrammableStage.d.ts +19 -1
  87. three/src/renderers/common/RenderBundle.d.ts +15 -4
  88. three/src/renderers/common/RenderBundles.d.ts +20 -2
  89. three/src/renderers/common/RenderContext.d.ts +22 -0
  90. three/src/renderers/common/RenderContexts.d.ts +42 -3
  91. three/src/renderers/common/RenderList.d.ts +85 -0
  92. three/src/renderers/common/RenderLists.d.ts +21 -0
  93. three/src/renderers/common/RenderObject.d.ts +152 -1
  94. three/src/renderers/common/RenderObjects.d.ts +53 -0
  95. three/src/renderers/common/RenderPipeline.d.ts +13 -0
  96. three/src/renderers/common/Renderer.d.ts +583 -6
  97. three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
  98. three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
  99. three/src/renderers/common/Textures.d.ts +66 -0
  100. three/src/renderers/common/Uniform.d.ts +106 -0
  101. three/src/renderers/common/UniformBuffer.d.ts +12 -0
  102. three/src/renderers/common/UniformsGroup.d.ts +103 -0
  103. three/src/renderers/common/nodes/NodeBuilderState.d.ts +30 -0
  104. three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
  105. three/src/renderers/common/nodes/NodeUniform.d.ts +154 -0
  106. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
  107. three/src/renderers/common/nodes/Nodes.d.ts +185 -11
  108. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
  109. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
  110. three/src/textures/DataTexture.d.ts +2 -2
  111. three/src/textures/Texture.d.ts +3 -0
  112. three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
  113. three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
  114. three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
  115. three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
  116. three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
  117. three/src/Three.Legacy.d.ts +0 -20
  118. three/src/nodes/core/UniformGroup.d.ts +0 -7
  119. three/src/nodes/fog/FogExp2Node.d.ts +0 -14
  120. three/src/nodes/fog/FogNode.d.ts +0 -20
  121. three/src/nodes/fog/FogRangeNode.d.ts +0 -19
@@ -1,14 +1,42 @@
1
1
  import UniformNode from "./UniformNode.js";
2
+ /**
3
+ * {@link NodeBuilder} is going to create instances of this class during the build process
4
+ * of nodes. They represent the final shader uniforms that are going to be generated
5
+ * by the builder. A dictionary of node uniforms is maintained in {@link NodeBuilder#uniforms}
6
+ * for this purpose.
7
+ */
2
8
  declare class NodeUniform<TValue> {
3
9
  readonly isNodeUniform: true;
4
10
  name: string;
5
11
  type: string | null;
6
12
  node: UniformNode<TValue>;
7
13
  needsUpdate: boolean | undefined;
14
+ /**
15
+ * Constructs a new node uniform.
16
+ *
17
+ * @param {String} name - The name of the uniform.
18
+ * @param {String} type - The type of the uniform.
19
+ * @param {UniformNode} node - An reference to the node.
20
+ */
8
21
  constructor(name: string, type: string | null, node: UniformNode<TValue>);
22
+ /**
23
+ * The value of the uniform node.
24
+ *
25
+ * @type {Any}
26
+ */
9
27
  get value(): TValue;
10
28
  set value(val: TValue);
29
+ /**
30
+ * The id of the uniform node.
31
+ *
32
+ * @type {Number}
33
+ */
11
34
  get id(): number;
35
+ /**
36
+ * The uniform node's group.
37
+ *
38
+ * @type {UniformGroupNode}
39
+ */
12
40
  get groupNode(): import("./UniformGroupNode.js").default;
13
41
  }
14
42
  export default NodeUniform;
@@ -1,7 +1,19 @@
1
+ /**
2
+ * {@link NodeBuilder} is going to create instances of this class during the build process
3
+ * of nodes. They represent the final shader variables that are going to be generated
4
+ * by the builder. A dictionary of node variables is maintained in {@link NodeBuilder#vars} for
5
+ * this purpose.
6
+ */
1
7
  declare class NodeVar {
2
8
  readonly isNodeVar: true;
3
9
  name: string;
4
10
  type: string | null;
11
+ /**
12
+ * Constructs a new node variable.
13
+ *
14
+ * @param {String} name - The name of the variable.
15
+ * @param {String} type - The type of the variable.
16
+ */
5
17
  constructor(name: string, type: string | null);
6
18
  }
7
19
  export default NodeVar;
@@ -1,7 +1,21 @@
1
1
  import NodeVar from "./NodeVar.js";
2
+ /**
3
+ * {@link NodeBuilder} is going to create instances of this class during the build process
4
+ * of nodes. They represent the final shader varyings that are going to be generated
5
+ * by the builder. An array of node varyings is maintained in {@link NodeBuilder#varyings} for
6
+ * this purpose.
7
+ *
8
+ * @augments NodeVar
9
+ */
2
10
  declare class NodeVarying extends NodeVar {
3
11
  needsInterpolation: boolean;
4
12
  readonly isNodeVarying: true;
13
+ /**
14
+ * Constructs a new node varying.
15
+ *
16
+ * @param {String} name - The name of the varying.
17
+ * @param {String} type - The type of the varying.
18
+ */
5
19
  constructor(name: string, type: string | null);
6
20
  }
7
21
  export default NodeVarying;
@@ -1,9 +1,27 @@
1
1
  import Node from "./Node.js";
2
+ /**
3
+ * {@link NodeBuilder} is going to create instances of this class during the build process
4
+ * of nodes. They represent the final shader struct data that are going to be generated
5
+ * by the builder. A dictionary of struct types is maintained in {@link NodeBuilder#structs}
6
+ * for this purpose.
7
+ */
2
8
  declare class StructTypeNode extends Node {
3
9
  static get type(): string;
10
+ name: string;
4
11
  types: string[];
5
12
  readonly isStructTypeNode: true;
6
- constructor(types: string[]);
13
+ /**
14
+ * Constructs a new struct type node.
15
+ *
16
+ * @param {String} name - The name of the struct.
17
+ * @param {Array<String>} types - An array of types.
18
+ */
19
+ constructor(name: string, types: string[]);
20
+ /**
21
+ * Returns the member types.
22
+ *
23
+ * @return {Array<String>} The types.
24
+ */
7
25
  getMemberTypes(): string[];
8
26
  }
9
27
  export default StructTypeNode;
@@ -4,20 +4,64 @@ import Node from "./Node.js";
4
4
  import NodeBuilder from "./NodeBuilder.js";
5
5
  import NodeFrame from "./NodeFrame.js";
6
6
  import UniformGroupNode from "./UniformGroupNode.js";
7
+ /** @module UniformNode **/
8
+ /**
9
+ * Class for representing a uniform.
10
+ *
11
+ * @augments InputNode
12
+ */
7
13
  declare class UniformNode<TValue> extends InputNode<TValue> {
8
14
  static get type(): string;
9
15
  readonly isUniformNode: true;
10
16
  name: string;
11
17
  groupNode: UniformGroupNode;
18
+ /**
19
+ * Constructs a new uniform node.
20
+ *
21
+ * @param {Any} value - The value of this node. Usually a JS primitive or three.js object (vector, matrix, color, texture).
22
+ * @param {String?} nodeType - The node type. If no explicit type is defined, the node tries to derive the type from its value.
23
+ */
12
24
  constructor(value: TValue, nodeType?: string | null);
25
+ /**
26
+ * Sets the {@link UniformNode#name} property.
27
+ *
28
+ * @param {String} name - The name of the uniform.
29
+ * @return {UniformNode} A reference to this node.
30
+ */
13
31
  label(name: string): this;
32
+ /**
33
+ * Sets the {@link UniformNode#groupNode} property.
34
+ *
35
+ * @param {UniformGroupNode} group - The uniform group.
36
+ * @return {UniformNode} A reference to this node.
37
+ */
14
38
  setGroup(group: UniformGroupNode): this;
39
+ /**
40
+ * Returns the {@link UniformNode#groupNode}.
41
+ *
42
+ * @return {UniformGroupNode} The uniform group.
43
+ */
15
44
  getGroup(): UniformGroupNode;
45
+ /**
46
+ * By default, this method returns the result of {@link Node#getHash} but derived
47
+ * classes might overwrite this method with a different implementation.
48
+ *
49
+ * @param {NodeBuilder} builder - The current node builder.
50
+ * @return {String} The uniform hash.
51
+ */
16
52
  getUniformHash(builder: NodeBuilder): string;
17
53
  onUpdate(callback: (frame: NodeFrame, self: this) => TValue | undefined, updateType: NodeUpdateType): this;
18
54
  generate(builder: NodeBuilder, output: string | null): string;
19
55
  }
20
56
  export default UniformNode;
57
+ /**
58
+ * TSL function for creating a uniform node.
59
+ *
60
+ * @function
61
+ * @param {Any} arg1 - The value of this node. Usually a JS primitive or three.js object (vector, matrix, color, texture).
62
+ * @param {String?} arg2 - The node type. If no explicit type is defined, the node tries to derive the type from its value.
63
+ * @returns {UniformNode}
64
+ */
21
65
  export declare const uniform: <TValue>(
22
66
  arg1: InputNode<TValue> | TValue,
23
67
  arg2?: Node | string,
@@ -14,8 +14,11 @@ export default class VaryingNode extends Node {
14
14
 
15
15
  export const varying: (node: NodeRepresentation, name?: string) => ShaderNodeObject<VaryingNode>;
16
16
 
17
+ export const vertexStage: (node: NodeRepresentation) => ShaderNodeObject<VaryingNode>;
18
+
17
19
  declare module "../tsl/TSLCore.js" {
18
20
  interface NodeElements {
19
21
  varying: typeof varying;
22
+ vertexStage: typeof vertexStage;
20
23
  }
21
24
  }
@@ -1,13 +1,41 @@
1
+ /** @module NodeConstants **/
2
+ /**
3
+ * Possible shader stages.
4
+ *
5
+ * @property {string} VERTEX The vertex shader stage.
6
+ * @property {string} FRAGMENT The fragment shader stage.
7
+ */
1
8
  export declare const NodeShaderStage: {
2
9
  readonly VERTEX: "vertex";
3
10
  readonly FRAGMENT: "fragment";
4
11
  };
12
+ /**
13
+ * Update types of a node.
14
+ *
15
+ * @property {string} NONE The update method is not executed.
16
+ * @property {string} FRAME The update method is executed per frame.
17
+ * @property {string} RENDER The update method is executed per render. A frame might be produced by multiple render calls so this value allows more detailed updates than FRAME.
18
+ * @property {string} OBJECT The update method is executed per {@link Object3D} that uses the node for rendering.
19
+ */
5
20
  export declare const NodeUpdateType: {
6
21
  readonly NONE: "none";
7
22
  readonly FRAME: "frame";
8
23
  readonly RENDER: "render";
9
24
  readonly OBJECT: "object";
10
25
  };
26
+ /**
27
+ * Data types of a node.
28
+ *
29
+ * @property {string} BOOLEAN Boolean type.
30
+ * @property {string} INTEGER Integer type.
31
+ * @property {string} FLOAT Float type.
32
+ * @property {string} VECTOR2 Two-dimensional vector type.
33
+ * @property {string} VECTOR3 Three-dimensional vector type.
34
+ * @property {string} VECTOR4 Four-dimensional vector type.
35
+ * @property {string} MATRIX2 2x2 matrix type.
36
+ * @property {string} MATRIX3 3x3 matrix type.
37
+ * @property {string} MATRIX4 4x4 matrix type.
38
+ */
11
39
  export declare const NodeType: {
12
40
  readonly BOOLEAN: "bool";
13
41
  readonly INTEGER: "int";
@@ -19,6 +47,13 @@ export declare const NodeType: {
19
47
  readonly MATRIX3: "mat3";
20
48
  readonly MATRIX4: "mat4";
21
49
  };
50
+ /**
51
+ * Access types of a node. These are relevant for compute and storage usage.
52
+ *
53
+ * @property {string} READ_ONLY Read-only access
54
+ * @property {string} WRITE_ONLY Write-only access.
55
+ * @property {string} READ_WRITE Read and write access.
56
+ */
22
57
  export declare const NodeAccess: {
23
58
  readonly READ_ONLY: "readOnly";
24
59
  readonly WRITE_ONLY: "writeOnly";
@@ -68,4 +68,4 @@ export default PassNode;
68
68
 
69
69
  export const pass: (scene: Scene, camera: Camera, options?: RenderTargetOptions) => ShaderNodeObject<PassNode>;
70
70
  export const passTexture: (pass: PassNode, texture: Texture) => ShaderNodeObject<PassTextureNode>;
71
- export const depthPass: (scene: Scene, camera: Camera) => ShaderNodeObject<PassNode>;
71
+ export const depthPass: (scene: Scene, camera: Camera, options?: RenderTargetOptions) => ShaderNodeObject<PassNode>;
@@ -0,0 +1,26 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const rangeFogFactor: (near: NodeRepresentation, far: NodeRepresentation) => ShaderNodeObject<Node>;
5
+
6
+ export const densityFogFactor: (density: NodeRepresentation) => ShaderNodeObject<Node>;
7
+
8
+ export const fog: (color: NodeRepresentation, factor: NodeRepresentation) => ShaderNodeObject<Node>;
9
+
10
+ /**
11
+ * @deprecated
12
+ */
13
+ export function rangeFog(
14
+ color: NodeRepresentation,
15
+ near: NodeRepresentation,
16
+ far: NodeRepresentation,
17
+ ): ShaderNodeObject<Node>;
18
+
19
+ /**
20
+ * @deprecated
21
+ */
22
+ export function densityFog(
23
+ color: NodeRepresentation,
24
+ near: NodeRepresentation,
25
+ far: NodeRepresentation,
26
+ ): ShaderNodeObject<Node>;
@@ -8,18 +8,23 @@ export default class ComputeNode extends Node {
8
8
  count: number;
9
9
  workgroupSize: number[];
10
10
  dispatchCount: number;
11
+ name: string;
11
12
 
12
13
  onInitFunction: ((args: { renderer: Renderer }) => void) | null;
13
14
 
14
15
  constructor(computeNode: Node, count: number, workgroupSize?: number[]);
15
16
 
17
+ label(name: string): void;
18
+
19
+ updateDispatchCount(): void;
20
+
16
21
  onInit(callback: ((args: { renderer: Renderer }) => void) | null): void;
17
22
  }
18
23
 
19
24
  export const compute: (
20
25
  node: NodeRepresentation,
21
26
  count: number,
22
- workgroupSize: number[],
27
+ workgroupSize?: number[],
23
28
  ) => ShaderNodeObject<ComputeNode>;
24
29
 
25
30
  declare module "../tsl/TSLCore.js" {
@@ -7,6 +7,8 @@ declare class WorkgroupInfoNode extends Node {
7
7
 
8
8
  readonly isWorkgroupInfoNode: true;
9
9
 
10
+ elementType: string;
11
+
10
12
  scope: string;
11
13
 
12
14
  constructor(scope: string, bufferType: string, bufferCount?: number);
@@ -0,0 +1,15 @@
1
+ import { Light } from "../../lights/Light.js";
2
+ import Node from "../core/Node.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
+
5
+ declare class ShadowBaseNode extends Node {
6
+ light: Light;
7
+
8
+ readonly isShadowBasedNode: true;
9
+
10
+ constructor(light: Light);
11
+ }
12
+
13
+ export const shadowPositionWorld: ShaderNodeObject<Node>;
14
+
15
+ export default ShadowBaseNode;
@@ -2,6 +2,7 @@ import { Light } from "../../lights/Light.js";
2
2
  import { LightShadow } from "../../lights/LightShadow.js";
3
3
  import Node from "../core/Node.js";
4
4
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
5
+ import ShadowBaseNode from "./ShadowBaseNode.js";
5
6
 
6
7
  export const BasicShadowFilter: (
7
8
  depthTexture: NodeRepresentation,
@@ -25,7 +26,7 @@ export const VSMShadowFilter: (
25
26
  shadowCoord: NodeRepresentation,
26
27
  ) => ShaderNodeObject<Node>;
27
28
 
28
- declare class ShadowNode extends Node {
29
+ declare class ShadowNode extends ShadowBaseNode {
29
30
  constructor(light: Light, shadow: LightShadow | null);
30
31
  }
31
32
 
@@ -37,7 +37,6 @@ export type MathNodeMethod1 =
37
37
  | typeof MathNode.TRANSPOSE;
38
38
 
39
39
  export type MathNodeMethod2 =
40
- | typeof MathNode.ATAN2
41
40
  | typeof MathNode.MIN
42
41
  | typeof MathNode.MAX
43
42
  | typeof MathNode.MOD
@@ -99,7 +98,6 @@ export default class MathNode extends TempNode {
99
98
 
100
99
  // 2 inputs
101
100
 
102
- static ATAN2: "atan2";
103
101
  static MIN: "min";
104
102
  static MAX: "max";
105
103
  static MOD: "mod";
@@ -157,7 +155,7 @@ export const cos: Unary;
157
155
  export const tan: Unary;
158
156
  export const asin: Unary;
159
157
  export const acos: Unary;
160
- export const atan: Unary;
158
+ export const atan: (a: NodeRepresentation, b?: NodeRepresentation) => ShaderNodeObject<MathNode>;
161
159
  export const abs: Unary;
162
160
  export const sign: Unary;
163
161
  export const length: Unary;
@@ -174,7 +172,6 @@ export const transpose: Unary;
174
172
 
175
173
  type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
176
174
 
177
- export const atan2: Binary;
178
175
  export const min: Binary;
179
176
  export const max: Binary;
180
177
  export const mod: Binary;
@@ -210,6 +207,18 @@ export const rand: (uv: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
210
207
  export const mixElement: Ternary;
211
208
  export const smoothstepElement: Ternary;
212
209
 
210
+ /**
211
+ * @deprecated
212
+ */
213
+ export const atan2: Binary;
214
+
215
+ // GLSL alias function
216
+
217
+ export const faceforward: typeof faceForward;
218
+ export const inversesqrt: typeof inverseSqrt;
219
+
220
+ // Method chaining
221
+
213
222
  declare module "../tsl/TSLCore.js" {
214
223
  interface NodeElements {
215
224
  all: typeof all;
@@ -35,15 +35,29 @@ export interface NodeElements {
35
35
 
36
36
  export function addMethodChaining(name: string, nodeElement: unknown): void;
37
37
 
38
- export type SwizzleCharacter = "x" | "y" | "z" | "w" | "r" | "g" | "b" | "a" | "s" | "t" | "p" | "q";
39
-
40
- export type SwizzleOption = Exclude<
41
- | `${SwizzleCharacter}`
42
- | `${SwizzleCharacter}${SwizzleCharacter}`
43
- | `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`
44
- | `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`,
45
- "abs" | "sqrt"
46
- >;
38
+ type XYZWCharacter = "x" | "y" | "z" | "w";
39
+ type RGBACharacter = "r" | "g" | "b" | "a";
40
+ type STPQCharacter = "s" | "t" | "p" | "q";
41
+
42
+ type XYZWSwizzle =
43
+ | `${XYZWCharacter}`
44
+ | `${XYZWCharacter}${XYZWCharacter}`
45
+ | `${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}`
46
+ | `${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}`;
47
+
48
+ type RGBASwizzle =
49
+ | `${RGBACharacter}`
50
+ | `${RGBACharacter}${RGBACharacter}`
51
+ | `${RGBACharacter}${RGBACharacter}${RGBACharacter}`
52
+ | `${RGBACharacter}${RGBACharacter}${RGBACharacter}${RGBACharacter}`;
53
+
54
+ type STPQSwizzle =
55
+ | `${STPQCharacter}`
56
+ | `${STPQCharacter}${STPQCharacter}`
57
+ | `${STPQCharacter}${STPQCharacter}${STPQCharacter}`
58
+ | `${STPQCharacter}${STPQCharacter}${STPQCharacter}${STPQCharacter}`;
59
+
60
+ export type SwizzleOption = XYZWSwizzle | RGBASwizzle | STPQSwizzle;
47
61
 
48
62
  export type Swizzable<T extends Node = Node> =
49
63
  & T
@@ -172,6 +186,11 @@ type ConstructedNode<T> = T extends new(...args: any[]) => infer R ? (R extends
172
186
 
173
187
  export type NodeOrType = Node | string;
174
188
 
189
+ declare class ShaderCallNodeInternal extends Node {
190
+ }
191
+
192
+ declare class ShaderNodeInternal extends Node {}
193
+
175
194
  export const defined: (v: unknown) => unknown;
176
195
 
177
196
  export const getConstNodeType: (value: NodeOrType) => string | null;
@@ -209,13 +228,26 @@ export function nodeImmutable<T>(
209
228
  ...params: ProxiedTuple<GetConstructors<T>>
210
229
  ): ShaderNodeObject<ConstructedNode<T>>;
211
230
 
212
- export function Fn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
213
- export function Fn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
214
- jsFunc: (args: T) => R,
215
- ): (...args: ProxiedTuple<T>) => R;
216
- export function Fn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
217
- jsFunc: (args: T) => R,
218
- ): (args: ProxiedObject<T>) => R;
231
+ interface Layout {
232
+ name: string;
233
+ type: string;
234
+ inputs: { name: string; type: string }[];
235
+ }
236
+
237
+ interface ShaderNodeFn<Args extends readonly unknown[]> {
238
+ (...args: Args): ShaderNodeObject<ShaderCallNodeInternal>;
239
+ shaderNode: ShaderNodeObject<ShaderNodeInternal>;
240
+ setLayout: (layout: Layout) => this;
241
+ once: () => this;
242
+ }
243
+
244
+ export function Fn(jsFunc: () => void): ShaderNodeFn<[]>;
245
+ export function Fn<T extends readonly unknown[]>(
246
+ jsFunc: (args: T) => void,
247
+ ): ShaderNodeFn<ProxiedTuple<T>>;
248
+ export function Fn<T extends { readonly [key: string]: unknown }>(
249
+ jsFunc: (args: T) => void,
250
+ ): ShaderNodeFn<[ProxiedObject<T>]>;
219
251
 
220
252
  /**
221
253
  * @deprecated tslFn() has been renamed to Fn()
@@ -1,8 +1,8 @@
1
1
  import { Node, TempNode } from "../Nodes.js";
2
- import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
4
  export default class EquirectUVNode extends TempNode {
5
5
  constructor(dirNode?: ShaderNodeObject<Node>);
6
6
  }
7
7
 
8
- export const equirectUV: ShaderNodeObject<EquirectUVNode>;
8
+ export const equirectUV: (dirNode?: NodeRepresentation) => ShaderNodeObject<EquirectUVNode>;
@@ -1,6 +1,18 @@
1
1
  import Node from "../core/Node.js";
2
2
  import NodeBuilder from "../core/NodeBuilder.js";
3
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
+
5
+ interface LoopNodeObjectParameter {
6
+ // TODO Expand to other types and update loop function types appropriately
7
+ type?: "int" | "uint";
8
+ // TODO The variable name should affect the type of the loop function
9
+ // name?: string;
10
+ start: number | Node;
11
+ end: number | Node;
12
+ condition: string;
13
+ }
14
+
15
+ type LoopNodeParameter = Node | number | LoopNodeObjectParameter;
4
16
 
5
17
  declare class LoopNode extends Node {
6
18
  params: unknown[];
@@ -12,7 +24,16 @@ declare class LoopNode extends Node {
12
24
 
13
25
  export default LoopNode;
14
26
 
15
- export const Loop: (...params: unknown[]) => ShaderNodeObject<Node>;
27
+ interface Loop {
28
+ (i: LoopNodeParameter, func: (inputs: { readonly i: number }) => void): ShaderNodeObject<Node>;
29
+ (
30
+ i: LoopNodeParameter,
31
+ j: LoopNodeParameter,
32
+ func: (inputs: { readonly i: number; readonly j: number }) => void,
33
+ ): ShaderNodeObject<Node>;
34
+ }
35
+
36
+ export const Loop: Loop;
16
37
  export const Continue: () => ShaderNodeObject<Node>;
17
38
  export const Break: () => ShaderNodeObject<Node>;
18
39
 
@@ -2,7 +2,7 @@ import { Plane } from "../math/Plane.js";
2
2
  import { Group } from "./Group.js";
3
3
 
4
4
  /**
5
- * A special version of the Group object that defines clipping planes for decendant objects. ClippingGroups can be
5
+ * A special version of the Group object that defines clipping planes for descendant objects. ClippingGroups can be
6
6
  * nested, with clipping planes accumulating by type: intersection or union.
7
7
  */
8
8
  declare class ClippingGroup extends Group {
@@ -26,13 +26,6 @@ import { WebGLState } from "./webgl/WebGLState.js";
26
26
  import { WebGLRenderTarget } from "./WebGLRenderTarget.js";
27
27
  import { WebXRManager } from "./webxr/WebXRManager.js";
28
28
 
29
- export interface Renderer {
30
- domElement: HTMLCanvasElement;
31
-
32
- render(scene: Object3D, camera: Camera): void;
33
- setSize(width: number, height: number, updateStyle?: boolean): void;
34
- }
35
-
36
29
  export interface WebGLRendererParameters extends WebGLCapabilitiesParameters {
37
30
  /**
38
31
  * A Canvas where the renderer draws its output.
@@ -115,7 +108,7 @@ export interface WebGLDebug {
115
108
  *
116
109
  * see {@link https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLRenderer.js|src/renderers/WebGLRenderer.js}
117
110
  */
118
- export class WebGLRenderer implements Renderer {
111
+ export class WebGLRenderer {
119
112
  /**
120
113
  * parameters is an optional object with properties defining the renderer's behavior.
121
114
  * The constructor also accepts no parameters at all.
@@ -198,6 +191,13 @@ export class WebGLRenderer implements Renderer {
198
191
  */
199
192
  toneMappingExposure: number;
200
193
 
194
+ /**
195
+ * The normalized resolution scale for the transmission render target, measured in percentage of viewport
196
+ * dimensions. Lowering this value can result in significant improvements to {@link MeshPhysicalMaterial}
197
+ * transmission performance. Default is `1`.
198
+ */
199
+ transmissionResolutionScale: number;
200
+
201
201
  info: WebGLInfo;
202
202
 
203
203
  shadowMap: WebGLShadowMap;
@@ -4,17 +4,47 @@ interface AnimationContext {
4
4
  requestAnimationFrame(callback: FrameRequestCallback, frame?: XRFrame): number;
5
5
  cancelAnimationFrame(handle: number): void;
6
6
  }
7
+ /**
8
+ * This module manages the internal animation loop of the renderer.
9
+ *
10
+ * @private
11
+ */
7
12
  declare class Animation {
8
13
  nodes: Nodes;
9
14
  info: Info;
10
15
  _context: AnimationContext;
11
16
  _animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
12
17
  _requestId: number | null;
18
+ /**
19
+ * Constructs a new animation loop management component.
20
+ *
21
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
22
+ * @param {Info} info - Renderer component for managing metrics and monitoring data.
23
+ */
13
24
  constructor(nodes: Nodes, info: Info);
25
+ /**
26
+ * Starts the internal animation loop.
27
+ */
14
28
  start(): void;
29
+ /**
30
+ * Stops the internal animation loop.
31
+ */
15
32
  stop(): void;
33
+ /**
34
+ * Defines the user-level animation loop.
35
+ *
36
+ * @param {Function} callback - The animation loop.
37
+ */
16
38
  setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): void;
39
+ /**
40
+ * Defines the context in which `requestAnimationFrame()` is executed.
41
+ *
42
+ * @param {Window|XRSession} context - The context to set.
43
+ */
17
44
  setContext(context: AnimationContext): void;
45
+ /**
46
+ * Frees all internal resources and stops the animation loop.
47
+ */
18
48
  dispose(): void;
19
49
  }
20
50
  export default Animation;