@types/three 0.172.0 → 0.174.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 (124) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/animation/CCDIKSolver.d.ts +3 -2
  3. three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
  4. three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
  5. three/examples/jsm/loaders/MTLLoader.d.ts +2 -1
  6. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
  7. three/examples/jsm/misc/Timer.d.ts +13 -2
  8. three/examples/jsm/objects/Reflector.d.ts +1 -0
  9. three/examples/jsm/tsl/math/Bayer.d.ts +4 -0
  10. three/examples/jsm/tsl/utils/Raymarching.d.ts +9 -0
  11. three/examples/jsm/webxr/XRButton.d.ts +4 -2
  12. three/package.json +2 -2
  13. three/src/Three.Core.d.ts +2 -0
  14. three/src/Three.TSL.d.ts +13 -1
  15. three/src/Three.d.ts +6 -1
  16. three/src/animation/AnimationClip.d.ts +1 -1
  17. three/src/cameras/ArrayCamera.d.ts +7 -6
  18. three/src/cameras/Camera.d.ts +7 -7
  19. three/src/constants.d.ts +6 -0
  20. three/src/core/BufferAttribute.d.ts +5 -0
  21. three/src/core/Raycaster.d.ts +4 -0
  22. three/src/extras/PMREMGenerator.d.ts +15 -2
  23. three/src/geometries/TorusGeometry.d.ts +5 -6
  24. three/src/materials/nodes/NodeMaterial.d.ts +2 -1
  25. three/src/materials/nodes/NodeMaterials.d.ts +0 -4
  26. three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
  27. three/src/materials/nodes/VolumeNodeMaterial.d.ts +14 -2
  28. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +5 -4
  29. three/src/math/Matrix4.d.ts +2 -1
  30. three/src/nodes/Nodes.d.ts +6 -3
  31. three/src/nodes/TSL.d.ts +5 -0
  32. three/src/nodes/accessors/Arrays.d.ts +9 -2
  33. three/src/nodes/accessors/BufferAttributeNode.d.ts +25 -22
  34. three/src/nodes/accessors/Camera.d.ts +1 -0
  35. three/src/nodes/accessors/Lights.d.ts +1 -1
  36. three/src/nodes/accessors/MaterialNode.d.ts +3 -3
  37. three/src/nodes/accessors/MaterialProperties.d.ts +5 -0
  38. three/src/nodes/accessors/ModelNode.d.ts +1 -0
  39. three/src/nodes/accessors/Object3DNode.d.ts +7 -5
  40. three/src/nodes/accessors/StorageBufferNode.d.ts +7 -3
  41. three/src/nodes/accessors/Texture3DNode.d.ts +2 -2
  42. three/src/nodes/core/ArrayNode.d.ts +26 -0
  43. three/src/nodes/core/LightingModel.d.ts +13 -28
  44. three/src/nodes/core/Node.d.ts +31 -23
  45. three/src/nodes/core/NodeAttribute.d.ts +3 -3
  46. three/src/nodes/core/NodeCache.d.ts +4 -3
  47. three/src/nodes/core/NodeParser.d.ts +1 -1
  48. three/src/nodes/core/NodeUniform.d.ts +4 -4
  49. three/src/nodes/core/NodeVar.d.ts +8 -4
  50. three/src/nodes/core/NodeVarying.d.ts +2 -2
  51. three/src/nodes/core/StructNode.d.ts +21 -0
  52. three/src/nodes/core/StructType.d.ts +8 -0
  53. three/src/nodes/core/StructTypeNode.d.ts +33 -14
  54. three/src/nodes/core/UniformNode.d.ts +7 -7
  55. three/src/nodes/core/VarNode.d.ts +8 -1
  56. three/src/nodes/core/VaryingNode.d.ts +9 -0
  57. three/src/nodes/core/constants.d.ts +0 -1
  58. three/src/nodes/display/PassNode.d.ts +10 -1
  59. three/src/nodes/functions/BSDF/LTC.d.ts +5 -1
  60. three/src/nodes/functions/VolumetricLightingModel.d.ts +6 -0
  61. three/src/nodes/geometry/RangeNode.d.ts +6 -11
  62. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
  63. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
  64. three/src/nodes/lighting/AnalyticLightNode.d.ts +13 -1
  65. three/src/nodes/lighting/LightingContextNode.d.ts +18 -4
  66. three/src/nodes/lighting/LightsNode.d.ts +24 -0
  67. three/src/nodes/lighting/PointLightNode.d.ts +8 -7
  68. three/src/nodes/lighting/ShadowBaseNode.d.ts +3 -0
  69. three/src/nodes/math/MathNode.d.ts +2 -0
  70. three/src/nodes/math/OperatorNode.d.ts +2 -0
  71. three/src/nodes/shapes/Shapes.d.ts +4 -0
  72. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  73. three/src/nodes/tsl/TSLCore.d.ts +19 -3
  74. three/src/nodes/utils/MemberNode.d.ts +11 -0
  75. three/src/nodes/utils/ReflectorNode.d.ts +1 -0
  76. three/src/objects/BatchedMesh.d.ts +1 -0
  77. three/src/objects/InstancedMesh.d.ts +4 -3
  78. three/src/objects/LOD.d.ts +4 -3
  79. three/src/renderers/WebGLRenderer.d.ts +2 -2
  80. three/src/renderers/common/Animation.d.ts +16 -4
  81. three/src/renderers/common/Attributes.d.ts +1 -1
  82. three/src/renderers/common/BindGroup.d.ts +2 -2
  83. three/src/renderers/common/Binding.d.ts +2 -2
  84. three/src/renderers/common/Buffer.d.ts +3 -3
  85. three/src/renderers/common/BufferUtils.d.ts +8 -9
  86. three/src/renderers/common/BundleGroup.d.ts +3 -3
  87. three/src/renderers/common/ChainMap.d.ts +8 -8
  88. three/src/renderers/common/ClippingContext.d.ts +3 -3
  89. three/src/renderers/common/Color4.d.ts +12 -8
  90. three/src/renderers/common/ComputePipeline.d.ts +1 -1
  91. three/src/renderers/common/DataMap.d.ts +2 -2
  92. three/src/renderers/common/Geometries.d.ts +4 -4
  93. three/src/renderers/common/Info.d.ts +2 -13
  94. three/src/renderers/common/Pipeline.d.ts +1 -1
  95. three/src/renderers/common/Pipelines.d.ts +10 -10
  96. three/src/renderers/common/PostProcessing.d.ts +1 -1
  97. three/src/renderers/common/ProgrammableStage.d.ts +4 -4
  98. three/src/renderers/common/RenderContext.d.ts +8 -6
  99. three/src/renderers/common/RenderContexts.d.ts +16 -24
  100. three/src/renderers/common/RenderList.d.ts +11 -11
  101. three/src/renderers/common/RenderObject.d.ts +24 -16
  102. three/src/renderers/common/RenderObjects.d.ts +3 -3
  103. three/src/renderers/common/RenderPipeline.d.ts +1 -1
  104. three/src/renderers/common/Renderer.d.ts +139 -96
  105. three/src/renderers/common/Textures.d.ts +6 -6
  106. three/src/renderers/common/TimestampQueryPool.d.ts +43 -0
  107. three/src/renderers/common/Uniform.d.ts +39 -13
  108. three/src/renderers/common/UniformBuffer.d.ts +1 -1
  109. three/src/renderers/common/UniformsGroup.d.ts +13 -13
  110. three/src/renderers/common/XRManager.d.ts +194 -0
  111. three/src/renderers/common/XRRenderTarget.d.ts +23 -0
  112. three/src/renderers/common/extras/PMREMGenerator.d.ts +9 -2
  113. three/src/renderers/common/nodes/NodeBuilderState.d.ts +6 -6
  114. three/src/renderers/common/nodes/NodeLibrary.d.ts +11 -11
  115. three/src/renderers/common/nodes/NodeUniform.d.ts +39 -8
  116. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +1 -1
  117. three/src/renderers/common/nodes/Nodes.d.ts +19 -18
  118. three/src/renderers/webgl/WebGLState.d.ts +7 -6
  119. three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
  120. three/src/textures/Texture.d.ts +2 -5
  121. three/src/textures/VideoFrameTexture.d.ts +27 -0
  122. three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +0 -13
  123. three/examples/jsm/objects/InstancedPoints.d.ts +0 -10
  124. three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
@@ -7,6 +7,7 @@ import NodeCode from "./NodeCode.js";
7
7
  import NodeUniform from "./NodeUniform.js";
8
8
  import NodeVar from "./NodeVar.js";
9
9
  import NodeVarying from "./NodeVarying.js";
10
+ import StructType from "./StructType.js";
10
11
  export interface ShaderStageNodeData {
11
12
  properties?:
12
13
  | (
@@ -20,7 +21,7 @@ export interface ShaderStageNodeData {
20
21
  )
21
22
  | undefined;
22
23
  bufferAttribute?: NodeAttribute | undefined;
23
- structType?: Node | undefined;
24
+ structType?: StructType | undefined;
24
25
  uniform?: NodeUniform<unknown> | undefined;
25
26
  variable?: NodeVar | undefined;
26
27
  varying?: NodeVarying | undefined;
@@ -50,14 +51,14 @@ declare class NodeCache {
50
51
  /**
51
52
  * Constructs a new node cache.
52
53
  *
53
- * @param {NodeCache?} parent - A reference to a parent cache.
54
+ * @param {?NodeCache} parent - A reference to a parent cache.
54
55
  */
55
56
  constructor(parent?: NodeCache | null);
56
57
  /**
57
58
  * Returns the data for the given node.
58
59
  *
59
60
  * @param {Node} node - The node.
60
- * @return {Object?} The data for the node.
61
+ * @return {?Object} The data for the node.
61
62
  */
62
63
  getData(node: Node): NodeData | undefined;
63
64
  getData(node: TypedArray | InterleavedBuffer | BufferAttribute): BufferAttributeData | undefined;
@@ -8,7 +8,7 @@ declare abstract class NodeParser {
8
8
  * The method parses the given native code an returns a node function.
9
9
  *
10
10
  * @abstract
11
- * @param {String} source - The native shader code.
11
+ * @param {string} source - The native shader code.
12
12
  * @return {NodeFunction} A node function.
13
13
  */
14
14
  abstract parseFunction(source: string): NodeFunction;
@@ -14,22 +14,22 @@ declare class NodeUniform<TValue> {
14
14
  /**
15
15
  * Constructs a new node uniform.
16
16
  *
17
- * @param {String} name - The name of the uniform.
18
- * @param {String} type - The type of the uniform.
17
+ * @param {string} name - The name of the uniform.
18
+ * @param {string} type - The type of the uniform.
19
19
  * @param {UniformNode} node - An reference to the node.
20
20
  */
21
21
  constructor(name: string, type: string | null, node: UniformNode<TValue>);
22
22
  /**
23
23
  * The value of the uniform node.
24
24
  *
25
- * @type {Any}
25
+ * @type {any}
26
26
  */
27
27
  get value(): TValue;
28
28
  set value(val: TValue);
29
29
  /**
30
30
  * The id of the uniform node.
31
31
  *
32
- * @type {Number}
32
+ * @type {number}
33
33
  */
34
34
  get id(): number;
35
35
  /**
@@ -7,13 +7,17 @@
7
7
  declare class NodeVar {
8
8
  readonly isNodeVar: true;
9
9
  name: string;
10
- type: string | null;
10
+ type: string;
11
+ readOnly: boolean;
12
+ count: number | null;
11
13
  /**
12
14
  * Constructs a new node variable.
13
15
  *
14
- * @param {String} name - The name of the variable.
15
- * @param {String} type - The type of the variable.
16
+ * @param {string} name - The name of the variable.
17
+ * @param {string} type - The type of the variable.
18
+ * @param {boolean} [readOnly=false] - The read-only flag.
19
+ * @param {?number} [count=null] - The size.
16
20
  */
17
- constructor(name: string, type: string | null);
21
+ constructor(name: string, type: string, readOnly?: boolean, count?: number | null);
18
22
  }
19
23
  export default NodeVar;
@@ -13,8 +13,8 @@ declare class NodeVarying extends NodeVar {
13
13
  /**
14
14
  * Constructs a new node varying.
15
15
  *
16
- * @param {String} name - The name of the varying.
17
- * @param {String} type - The type of the varying.
16
+ * @param {string} name - The name of the varying.
17
+ * @param {string} type - The type of the varying.
18
18
  */
19
19
  constructor(name: string, type: string | null);
20
20
  }
@@ -0,0 +1,21 @@
1
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import Node from "./Node.js";
3
+ import StructTypeNode, { MembersLayout } from "./StructTypeNode.js";
4
+
5
+ declare class StructNode extends Node {
6
+ values: Node[];
7
+
8
+ constructor(structLayoutNode: StructTypeNode, values: Node[]);
9
+ }
10
+
11
+ export default StructNode;
12
+
13
+ export interface Struct {
14
+ (): ShaderNodeObject<StructNode>;
15
+ (values: Node[]): ShaderNodeObject<StructNode>;
16
+ (...values: Node[]): ShaderNodeObject<StructNode>;
17
+ layout: StructTypeNode;
18
+ isStruct: true;
19
+ }
20
+
21
+ export const struct: (membersLayout: MembersLayout, name?: string | null) => Struct;
@@ -0,0 +1,8 @@
1
+ import { MemberLayout } from "./StructTypeNode.js";
2
+ declare class StructType {
3
+ name: string;
4
+ members: MemberLayout[];
5
+ output: boolean;
6
+ constructor(name: string, members: MemberLayout[]);
7
+ }
8
+ export default StructType;
@@ -1,27 +1,46 @@
1
1
  import Node from "./Node.js";
2
+ import NodeBuilder from "./NodeBuilder.js";
3
+ export interface MembersLayout {
4
+ [name: string]: string | {
5
+ type: string;
6
+ atomic?: boolean;
7
+ };
8
+ }
9
+ export interface MemberLayout {
10
+ name: string;
11
+ type: string;
12
+ atomic: boolean;
13
+ }
2
14
  /**
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.
15
+ * Represents a struct type node in the node-based system.
16
+ * This class is used to define and manage the layout and types of struct members.
17
+ * It extends the base Node class and provides methods to get the length of the struct,
18
+ * retrieve member types, and generate the struct type for a builder.
19
+ *
20
+ * @augments Node
7
21
  */
8
22
  declare class StructTypeNode extends Node {
9
23
  static get type(): string;
10
- name: string;
11
- types: string[];
12
- readonly isStructTypeNode: true;
24
+ membersLayout: MemberLayout[];
25
+ name: string | null;
26
+ readonly isStructLayoutNode: true;
13
27
  /**
14
- * Constructs a new struct type node.
28
+ * Creates an instance of StructTypeNode.
15
29
  *
16
- * @param {String} name - The name of the struct.
17
- * @param {Array<String>} types - An array of types.
30
+ * @param {Object} membersLayout - The layout of the members for the struct.
31
+ * @param {string} [name=null] - The optional name of the struct.
18
32
  */
19
- constructor(name: string, types: string[]);
33
+ constructor(membersLayout: MembersLayout, name?: string | null);
20
34
  /**
21
- * Returns the member types.
35
+ * Returns the length of the struct.
36
+ * The length is calculated by summing the lengths of the struct's members.
22
37
  *
23
- * @return {Array<String>} The types.
38
+ * @returns {number} The length of the struct.
24
39
  */
25
- getMemberTypes(): string[];
40
+ getLength(): number;
41
+ getMemberType(builder: NodeBuilder, name: string): string;
42
+ getNodeType(builder: NodeBuilder): string;
43
+ setup(builder: NodeBuilder): void;
44
+ generate(builder: NodeBuilder): string;
26
45
  }
27
46
  export default StructTypeNode;
@@ -4,7 +4,6 @@ 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
7
  /**
9
8
  * Class for representing a uniform.
10
9
  *
@@ -18,14 +17,14 @@ declare class UniformNode<TValue> extends InputNode<TValue> {
18
17
  /**
19
18
  * Constructs a new uniform node.
20
19
  *
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.
20
+ * @param {any} value - The value of this node. Usually a JS primitive or three.js object (vector, matrix, color, texture).
21
+ * @param {?string} nodeType - The node type. If no explicit type is defined, the node tries to derive the type from its value.
23
22
  */
24
23
  constructor(value: TValue, nodeType?: string | null);
25
24
  /**
26
25
  * Sets the {@link UniformNode#name} property.
27
26
  *
28
- * @param {String} name - The name of the uniform.
27
+ * @param {string} name - The name of the uniform.
29
28
  * @return {UniformNode} A reference to this node.
30
29
  */
31
30
  label(name: string): this;
@@ -47,7 +46,7 @@ declare class UniformNode<TValue> extends InputNode<TValue> {
47
46
  * classes might overwrite this method with a different implementation.
48
47
  *
49
48
  * @param {NodeBuilder} builder - The current node builder.
50
- * @return {String} The uniform hash.
49
+ * @return {string} The uniform hash.
51
50
  */
52
51
  getUniformHash(builder: NodeBuilder): string;
53
52
  onUpdate(callback: (frame: NodeFrame, self: this) => TValue | undefined, updateType: NodeUpdateType): this;
@@ -57,9 +56,10 @@ export default UniformNode;
57
56
  /**
58
57
  * TSL function for creating a uniform node.
59
58
  *
59
+ * @tsl
60
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.
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
63
  * @returns {UniformNode}
64
64
  */
65
65
  export declare const uniform: <TValue>(
@@ -7,12 +7,19 @@ export default class VarNode extends Node {
7
7
 
8
8
  readonly isVarNode: true;
9
9
 
10
- constructor(node: Node, name?: string | null);
10
+ readOnly: boolean;
11
+
12
+ constructor(node: Node, name?: string | null, readOnly?: boolean);
11
13
  }
12
14
 
15
+ export const Var: (node: Node, name?: string | null) => ShaderNodeObject<VarNode>;
16
+
17
+ export const Const: (node: Node, name?: string | null) => ShaderNodeObject<VarNode>;
18
+
13
19
  declare module "../tsl/TSLCore.js" {
14
20
  interface NodeElements {
15
21
  toVar: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
22
+ toConst: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
16
23
  }
17
24
  }
18
25
 
@@ -18,7 +18,16 @@ export const vertexStage: (node: NodeRepresentation) => ShaderNodeObject<Varying
18
18
 
19
19
  declare module "../tsl/TSLCore.js" {
20
20
  interface NodeElements {
21
+ toVarying: typeof varying;
22
+ toVertexStage: typeof vertexStage;
23
+
24
+ /**
25
+ * @deprecated .varying() has been renamed to .toVarying().
26
+ */
21
27
  varying: typeof varying;
28
+ /**
29
+ * @deprecated .vertexStage() has been renamed to .toVertexStage().
30
+ */
22
31
  vertexStage: typeof vertexStage;
23
32
  }
24
33
  }
@@ -1,4 +1,3 @@
1
- /** @module NodeConstants **/
2
1
  /**
3
2
  * Possible shader stages.
4
3
  *
@@ -1,4 +1,5 @@
1
1
  import { Camera } from "../../cameras/Camera.js";
2
+ import { Layers } from "../../core/Layers.js";
2
3
  import { RenderTarget, RenderTargetOptions } from "../../core/RenderTarget.js";
3
4
  import { Scene } from "../../scenes/Scene.js";
4
5
  import { Texture } from "../../textures/Texture.js";
@@ -34,6 +35,14 @@ declare class PassNode extends TempNode {
34
35
 
35
36
  constructor(scope: PassNodeScope, scene: Scene, camera: Camera, options?: RenderTargetOptions);
36
37
 
38
+ setResolution(resolution: number): this;
39
+
40
+ getResolution(): number;
41
+
42
+ setLayers(layers: Layers): this;
43
+
44
+ getLayers(): Layers;
45
+
37
46
  setMRT(mrt: MRTNode | null): this;
38
47
 
39
48
  getMRT(): MRTNode | null;
@@ -44,7 +53,7 @@ declare class PassNode extends TempNode {
44
53
 
45
54
  toggleTexture(name: string): void;
46
55
 
47
- getTextureNode(name?: string): ShaderNodeObject<Node>;
56
+ getTextureNode(name?: string): ShaderNodeObject<TextureNode>;
48
57
 
49
58
  getPreviousTextureNode(name?: string): ShaderNodeObject<Node>;
50
59
 
@@ -6,4 +6,8 @@ declare const LTC_Evaluate: (
6
6
  args: { N: Node; V: Node; P: Node; mInv: Node; p0: Node; p1: Node; p2: Node; p3: Node },
7
7
  ) => Node;
8
8
 
9
- export { LTC_Evaluate, LTC_Uv };
9
+ declare const LTC_Evaluate_Volume: (
10
+ args: { P: Node; p0: Node; p1: Node; p2: Node; p3: Node },
11
+ ) => Node;
12
+
13
+ export { LTC_Evaluate, LTC_Evaluate_Volume, LTC_Uv };
@@ -0,0 +1,6 @@
1
+ import LightingModel from "../core/LightingModel.js";
2
+
3
+ declare class VolumetricLightingModel extends LightingModel {
4
+ }
5
+
6
+ export default VolumetricLightingModel;
@@ -1,19 +1,14 @@
1
- import { Color } from "../../math/Color.js";
2
- import { Vector2 } from "../../math/Vector2.js";
3
- import { Vector3 } from "../../math/Vector3.js";
4
- import { Vector4 } from "../../math/Vector4.js";
5
1
  import Node from "../core/Node.js";
6
2
  import NodeBuilder from "../core/NodeBuilder.js";
7
- import { ShaderNodeObject } from "../tsl/TSLCore.js";
8
-
9
- export type RangeModeBound = number | Color | Vector2 | Vector3 | Vector4;
3
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
10
4
 
11
5
  export default class RangeNode extends Node {
12
- min: RangeModeBound;
13
- max: RangeModeBound;
6
+ minNode: Node;
7
+ maxNode: Node;
8
+
9
+ constructor(minNode: Node, maxNode: Node);
14
10
 
15
- constructor(min: RangeModeBound, max: RangeModeBound);
16
11
  getVectorLength(builder: NodeBuilder): number;
17
12
  }
18
13
 
19
- export const range: (min: RangeModeBound, max: RangeModeBound) => ShaderNodeObject<RangeNode>;
14
+ export const range: (minNode: NodeRepresentation, maxNode: NodeRepresentation) => ShaderNodeObject<RangeNode>;
@@ -39,6 +39,11 @@ export const atomicFunc: (
39
39
  storeNode?: NodeRepresentation | null,
40
40
  ) => ShaderNodeObject<AtomicFunctionNode>;
41
41
 
42
+ export const atomicLoad: (
43
+ pointerNode: NodeRepresentation,
44
+ storeNode?: NodeRepresentation | null,
45
+ ) => ShaderNodeObject<AtomicFunctionNode>;
46
+
42
47
  export const atomicStore: (
43
48
  pointerNode: NodeRepresentation,
44
49
  valueNode: NodeRepresentation,
@@ -9,5 +9,6 @@ export default ComputeBuiltinNode;
9
9
 
10
10
  export const numWorkgroups: ShaderNodeObject<ComputeBuiltinNode>;
11
11
  export const workgroupId: ShaderNodeObject<ComputeBuiltinNode>;
12
+ export const globalId: ShaderNodeObject<ComputeBuiltinNode>;
12
13
  export const localId: ShaderNodeObject<ComputeBuiltinNode>;
13
14
  export const subgroupSize: ShaderNodeObject<ComputeBuiltinNode>;
@@ -1,7 +1,9 @@
1
1
  import { Light } from "../../lights/Light.js";
2
2
  import Node from "../core/Node.js";
3
+ import NodeBuilder from "../core/NodeBuilder.js";
3
4
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
5
  import LightingNode from "./LightingNode.js";
6
+ import { DirectLightData, DirectRectAreaLightData } from "./LightsNode.js";
5
7
  import ShadowNode from "./ShadowNode.js";
6
8
 
7
9
  declare module "../../lights/LightShadow.js" {
@@ -10,10 +12,20 @@ declare module "../../lights/LightShadow.js" {
10
12
  }
11
13
  }
12
14
 
13
- export default class AnalyticLightNode<T extends Light> extends LightingNode {
15
+ declare class AnalyticLightNode<T extends Light> extends LightingNode {
14
16
  light: T | null;
15
17
 
16
18
  constructor(light?: T | null);
17
19
 
20
+ getLightVector(builder: NodeBuilder): Node;
21
+
22
+ setupDirect(builder: NodeBuilder): DirectLightData | undefined;
23
+
24
+ setupDirectRectArea(builder: NodeBuilder): DirectRectAreaLightData | undefined;
25
+
18
26
  setupShadowNode(): ShaderNodeObject<ShadowNode>;
27
+
28
+ setupShadow(builder: NodeBuilder): void;
19
29
  }
30
+
31
+ export default AnalyticLightNode;
@@ -1,7 +1,18 @@
1
1
  import ContextNode from "../core/ContextNode.js";
2
- import LightingModel, { LightingModelIndirectInput } from "../core/LightingModel.js";
2
+ import LightingModel, { LightingModelReflectedLight } from "../core/LightingModel.js";
3
3
  import Node from "../core/Node.js";
4
4
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
5
+ import LightsNode from "./LightsNode.js";
6
+
7
+ export interface LightingContext {
8
+ radiance: Node;
9
+ irradiance: Node;
10
+ iblIrradiance: Node;
11
+ ambientOcclusion: Node;
12
+ reflectedLight: LightingModelReflectedLight;
13
+ backdrop: Node;
14
+ backdropAlpha: Node;
15
+ }
5
16
 
6
17
  export default class LightingContextNode extends ContextNode {
7
18
  lightingModelNode: LightingModel | null;
@@ -9,13 +20,16 @@ export default class LightingContextNode extends ContextNode {
9
20
  backdropAlphaNode: Node | null;
10
21
 
11
22
  constructor(
12
- node: Node,
23
+ lightsNode: LightsNode,
13
24
  lightingModel?: LightingModel | null,
14
25
  backdropNode?: Node | null,
15
26
  backdropAlphaNode?: Node | null,
16
27
  );
17
28
 
18
- getContext(): LightingModelIndirectInput;
29
+ getContext(): LightingContext;
19
30
  }
20
31
 
21
- export const lightingContext: (node: Node, lightingModelNode?: LightingModel) => ShaderNodeObject<LightingContextNode>;
32
+ export const lightingContext: (
33
+ node: LightsNode,
34
+ lightingModelNode?: LightingModel,
35
+ ) => ShaderNodeObject<LightingContextNode>;
@@ -4,13 +4,37 @@ import { NodeBuilder } from "../Nodes.js";
4
4
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
5
5
  import LightingNode from "./LightingNode.js";
6
6
 
7
+ export interface DirectLightData {
8
+ lightDirection: Node;
9
+ lightColor: Node;
10
+ }
11
+
12
+ export interface DirectRectAreaLightData {
13
+ lightColor: Node;
14
+ lightPosition: Node;
15
+ halfWidth: Node;
16
+ halfHeight: Node;
17
+ ltc_1: Node;
18
+ ltc_2: Node;
19
+ }
20
+
7
21
  declare class LightsNode extends Node {
22
+ totalDiffuseNode: Node;
23
+ totalSpecularNode: Node;
24
+ outgoingLightNode: Node;
25
+
8
26
  constructor();
9
27
 
10
28
  setupLightsNode(builder: NodeBuilder): void;
11
29
 
30
+ setupDirectLight(builder: NodeBuilder, lightNode: Node, lightData: DirectLightData): void;
31
+
32
+ setupDirectRectAreaLight(builder: NodeBuilder, lightNode: Node, lightData: DirectRectAreaLightData): void;
33
+
12
34
  setupLights(builder: NodeBuilder, lightNodes: LightingNode[]): void;
13
35
 
36
+ getLightNodes(): LightingNode[];
37
+
14
38
  setLights(lights: Light[]): this;
15
39
 
16
40
  getLights(): Light[];
@@ -1,15 +1,16 @@
1
1
  import { PointLight } from "../../lights/PointLight.js";
2
2
  import Node from "../core/Node.js";
3
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
4
  import AnalyticLightNode from "./AnalyticLightNode.js";
5
+ import { DirectLightData } from "./LightsNode.js";
5
6
  import PointShadowNode from "./PointShadowNode.js";
6
7
 
7
- export const directPointLight: (
8
- color: NodeRepresentation,
9
- lightViewPosition: NodeRepresentation,
10
- cutoffDistance: NodeRepresentation,
11
- decayExponent: NodeRepresentation,
12
- ) => ShaderNodeObject<Node>;
8
+ export const directPointLight: (params: {
9
+ color: ShaderNodeObject<Node>;
10
+ lightViewPosition: ShaderNodeObject<Node>;
11
+ cutoffDistance: ShaderNodeObject<Node>;
12
+ decayExponent: ShaderNodeObject<Node>;
13
+ }) => DirectLightData;
13
14
 
14
15
  declare class PointLightNode extends AnalyticLightNode<PointLight> {
15
16
  cutoffDistanceNode: Node;
@@ -1,5 +1,6 @@
1
1
  import { Light } from "../../lights/Light.js";
2
2
  import Node from "../core/Node.js";
3
+ import NodeBuilder from "../core/NodeBuilder.js";
3
4
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
5
 
5
6
  declare class ShadowBaseNode extends Node {
@@ -8,6 +9,8 @@ declare class ShadowBaseNode extends Node {
8
9
  readonly isShadowBasedNode: true;
9
10
 
10
11
  constructor(light: Light);
12
+
13
+ setupShadowPosition(builder: NodeBuilder): void;
11
14
  }
12
15
 
13
16
  export const shadowPositionWorld: ShaderNodeObject<Node>;
@@ -122,6 +122,8 @@ export default class MathNode extends TempNode {
122
122
  bNode: Node | null;
123
123
  cNode: Node | null;
124
124
 
125
+ readonly isMathNode: true;
126
+
125
127
  constructor(method: MathNodeMethod1, aNode: Node);
126
128
  constructor(method: MathNodeMethod2, aNode: Node, bNode: Node);
127
129
  constructor(method: MathNodeMethod3, aNode: Node, bNode: Node, cNode: Node);
@@ -28,6 +28,8 @@ export default class OperatorNode extends TempNode {
28
28
  bNode: Node;
29
29
  op: OperatorNodeOp;
30
30
 
31
+ readonly isOperatorNode: true;
32
+
31
33
  constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]);
32
34
  }
33
35
 
@@ -0,0 +1,4 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const shapeCircle: (coord?: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -1,6 +1,7 @@
1
1
  export * from "../accessors/BufferAttributeNode.js";
2
2
  export * from "../code/ExpressionNode.js";
3
3
  export * from "../code/FunctionCallNode.js";
4
+ export * from "../core/ArrayNode.js";
4
5
  export * from "../core/AssignNode.js";
5
6
  export * from "../core/BypassNode.js";
6
7
  export * from "../core/CacheNode.js";
@@ -1,7 +1,10 @@
1
+ import { Color, ColorRepresentation } from "../../math/Color.js";
2
+ import { Vector3 } from "../../math/Vector3.js";
1
3
  import ConstNode from "../core/ConstNode.js";
2
4
  import Node from "../core/Node.js";
3
5
  import NodeBuilder from "../core/NodeBuilder.js";
4
6
  import StackNode from "../core/StackNode.js";
7
+ import ConvertNode from "../utils/ConvertNode.js";
5
8
 
6
9
  export interface NodeElements {
7
10
  toGlobal: (node: Node) => Node;
@@ -64,6 +67,9 @@ export type Swizzable<T extends Node = Node> =
64
67
  & {
65
68
  [Key in SwizzleOption | number]: ShaderNodeObject<Node>;
66
69
  }
70
+ & {
71
+ [Key in SwizzleOption as `set${Uppercase<Key>}`]: (value: Node) => ShaderNodeObject<Node>;
72
+ }
67
73
  & {
68
74
  [Key in SwizzleOption as `flip${Uppercase<Key>}`]: () => ShaderNodeObject<Node>;
69
75
  };
@@ -84,7 +90,7 @@ export type ShaderNodeObject<T extends Node> =
84
90
  & Swizzable<T>;
85
91
 
86
92
  /** anything that can be passed to {@link nodeObject} and returns a proxy */
87
- export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | ShaderNodeObject<T>;
93
+ export type NodeRepresentation<T extends Node = Node> = number | boolean | Vector3 | Node | ShaderNodeObject<T>;
88
94
 
89
95
  /** anything that can be passed to {@link nodeObject} */
90
96
  export type NodeObjectOption = NodeRepresentation | string;
@@ -231,7 +237,11 @@ export function nodeImmutable<T>(
231
237
  interface Layout {
232
238
  name: string;
233
239
  type: string;
234
- inputs: { name: string; type: string }[];
240
+ inputs: {
241
+ name: string;
242
+ type: string;
243
+ qualifier?: "in" | "out" | "inout";
244
+ }[];
235
245
  }
236
246
 
237
247
  interface ShaderNodeFn<Args extends readonly unknown[]> {
@@ -274,7 +284,13 @@ export const If: (boolNode: Node, method: () => void) => StackNode;
274
284
 
275
285
  export function append(node: Node): Node;
276
286
 
277
- export const color: ConvertType;
287
+ interface ColorFunction {
288
+ (color?: ColorRepresentation): ShaderNodeObject<ConstNode<Color>>;
289
+ (r: number, g: number, b: number): ShaderNodeObject<ConstNode<Color>>;
290
+ (node: Node): ShaderNodeObject<ConvertNode>;
291
+ }
292
+
293
+ export const color: ColorFunction;
278
294
 
279
295
  export const float: ConvertType;
280
296
  export const int: ConvertType;
@@ -0,0 +1,11 @@
1
+ import Node from "../core/Node.js";
2
+
3
+ declare class MemberNode extends Node {
4
+ node: Node;
5
+ property: string;
6
+ readonly isMemberNode: true;
7
+
8
+ constructor(node: Node, property: string);
9
+ }
10
+
11
+ export default MemberNode;
@@ -32,6 +32,7 @@ declare class ReflectorBaseNode extends Node {
32
32
 
33
33
  virtualCameras: WeakMap<Camera, Camera>;
34
34
  renderTargets: WeakMap<Camera, RenderTarget>;
35
+ forceUpdate: boolean;
35
36
 
36
37
  constructor(textureNode: TextureNode, parameters?: ReflectorNodeParameters);
37
38