@types/three 0.173.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 (84) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/animation/CCDIKSolver.d.ts +3 -2
  3. three/examples/jsm/loaders/MTLLoader.d.ts +2 -1
  4. three/examples/jsm/misc/Timer.d.ts +13 -2
  5. three/examples/jsm/objects/Reflector.d.ts +1 -0
  6. three/examples/jsm/tsl/math/Bayer.d.ts +4 -0
  7. three/examples/jsm/tsl/utils/Raymarching.d.ts +9 -0
  8. three/package.json +2 -2
  9. three/src/Three.TSL.d.ts +4 -0
  10. three/src/Three.d.ts +6 -1
  11. three/src/core/Raycaster.d.ts +4 -0
  12. three/src/extras/PMREMGenerator.d.ts +15 -2
  13. three/src/geometries/TorusGeometry.d.ts +5 -6
  14. three/src/materials/nodes/NodeMaterial.d.ts +2 -1
  15. three/src/materials/nodes/VolumeNodeMaterial.d.ts +14 -2
  16. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +4 -4
  17. three/src/nodes/Nodes.d.ts +1 -2
  18. three/src/nodes/TSL.d.ts +1 -0
  19. three/src/nodes/accessors/BufferAttributeNode.d.ts +25 -22
  20. three/src/nodes/accessors/Lights.d.ts +1 -1
  21. three/src/nodes/accessors/MaterialProperties.d.ts +5 -0
  22. three/src/nodes/accessors/ModelNode.d.ts +1 -0
  23. three/src/nodes/accessors/Object3DNode.d.ts +7 -5
  24. three/src/nodes/accessors/Texture3DNode.d.ts +2 -2
  25. three/src/nodes/core/LightingModel.d.ts +13 -28
  26. three/src/nodes/core/Node.d.ts +24 -24
  27. three/src/nodes/core/NodeAttribute.d.ts +3 -3
  28. three/src/nodes/core/NodeCache.d.ts +2 -2
  29. three/src/nodes/core/NodeParser.d.ts +1 -1
  30. three/src/nodes/core/NodeUniform.d.ts +4 -4
  31. three/src/nodes/core/NodeVar.d.ts +4 -4
  32. three/src/nodes/core/NodeVarying.d.ts +2 -2
  33. three/src/nodes/core/StructTypeNode.d.ts +2 -2
  34. three/src/nodes/core/UniformNode.d.ts +7 -7
  35. three/src/nodes/core/constants.d.ts +0 -1
  36. three/src/nodes/display/PassNode.d.ts +10 -1
  37. three/src/nodes/functions/BSDF/LTC.d.ts +5 -1
  38. three/src/nodes/functions/VolumetricLightingModel.d.ts +6 -0
  39. three/src/nodes/lighting/AnalyticLightNode.d.ts +13 -1
  40. three/src/nodes/lighting/LightingContextNode.d.ts +18 -4
  41. three/src/nodes/lighting/LightsNode.d.ts +24 -0
  42. three/src/nodes/lighting/PointLightNode.d.ts +8 -7
  43. three/src/nodes/lighting/ShadowBaseNode.d.ts +3 -0
  44. three/src/nodes/tsl/TSLCore.d.ts +3 -0
  45. three/src/nodes/utils/ReflectorNode.d.ts +1 -0
  46. three/src/objects/LOD.d.ts +4 -3
  47. three/src/renderers/common/Animation.d.ts +4 -4
  48. three/src/renderers/common/Attributes.d.ts +1 -1
  49. three/src/renderers/common/BindGroup.d.ts +2 -2
  50. three/src/renderers/common/Binding.d.ts +2 -2
  51. three/src/renderers/common/Buffer.d.ts +3 -3
  52. three/src/renderers/common/BufferUtils.d.ts +7 -8
  53. three/src/renderers/common/BundleGroup.d.ts +2 -2
  54. three/src/renderers/common/ChainMap.d.ts +3 -3
  55. three/src/renderers/common/ClippingContext.d.ts +3 -3
  56. three/src/renderers/common/Color4.d.ts +8 -8
  57. three/src/renderers/common/ComputePipeline.d.ts +1 -1
  58. three/src/renderers/common/DataMap.d.ts +2 -2
  59. three/src/renderers/common/Geometries.d.ts +4 -4
  60. three/src/renderers/common/Info.d.ts +2 -2
  61. three/src/renderers/common/Pipeline.d.ts +1 -1
  62. three/src/renderers/common/Pipelines.d.ts +9 -9
  63. three/src/renderers/common/ProgrammableStage.d.ts +4 -4
  64. three/src/renderers/common/RenderContext.d.ts +2 -2
  65. three/src/renderers/common/RenderContexts.d.ts +3 -3
  66. three/src/renderers/common/RenderList.d.ts +11 -11
  67. three/src/renderers/common/RenderObject.d.ts +13 -13
  68. three/src/renderers/common/RenderObjects.d.ts +3 -3
  69. three/src/renderers/common/RenderPipeline.d.ts +1 -1
  70. three/src/renderers/common/Renderer.d.ts +117 -91
  71. three/src/renderers/common/Textures.d.ts +6 -6
  72. three/src/renderers/common/TimestampQueryPool.d.ts +13 -1
  73. three/src/renderers/common/Uniform.d.ts +13 -13
  74. three/src/renderers/common/UniformBuffer.d.ts +1 -1
  75. three/src/renderers/common/UniformsGroup.d.ts +13 -13
  76. three/src/renderers/common/XRManager.d.ts +13 -15
  77. three/src/renderers/common/XRRenderTarget.d.ts +4 -4
  78. three/src/renderers/common/extras/PMREMGenerator.d.ts +9 -2
  79. three/src/renderers/common/nodes/NodeBuilderState.d.ts +3 -3
  80. three/src/renderers/common/nodes/NodeLibrary.d.ts +11 -11
  81. three/src/renderers/common/nodes/NodeUniform.d.ts +9 -9
  82. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +1 -1
  83. three/src/renderers/common/nodes/Nodes.d.ts +11 -11
  84. three/src/renderers/webgl/WebGLState.d.ts +7 -6
@@ -81,13 +81,13 @@ declare class Node extends EventDispatcher<{
81
81
  /**
82
82
  * Constructs a new node.
83
83
  *
84
- * @param {String?} nodeType - The node type.
84
+ * @param {?string} nodeType - The node type.
85
85
  */
86
86
  constructor(nodeType?: string | null);
87
87
  /**
88
88
  * Set this property to `true` when the node should be regenerated.
89
89
  *
90
- * @type {Boolean}
90
+ * @type {boolean}
91
91
  * @default false
92
92
  * @param {boolean} value
93
93
  */
@@ -95,7 +95,7 @@ declare class Node extends EventDispatcher<{
95
95
  /**
96
96
  * The type of the class. The value is usually the constructor name.
97
97
  *
98
- * @type {String}
98
+ * @type {string}
99
99
  * @readonly
100
100
  */
101
101
  get type(): string | undefined;
@@ -103,7 +103,7 @@ declare class Node extends EventDispatcher<{
103
103
  * Convenient method for defining {@link Node#update}.
104
104
  *
105
105
  * @param {Function} callback - The update method.
106
- * @param {String} updateType - The update type.
106
+ * @param {string} updateType - The update type.
107
107
  * @return {Node} A reference to this node.
108
108
  */
109
109
  onUpdate(callback: (this: this, frame: NodeFrame) => unknown, updateType: NodeUpdateType): this;
@@ -149,8 +149,8 @@ declare class Node extends EventDispatcher<{
149
149
  * Nodes might refer to other objects like materials. This method allows to dynamically update the reference
150
150
  * to such objects based on a given state (e.g. the current node frame or builder).
151
151
  *
152
- * @param {Any} state - This method can be invocated in different contexts so `state` can refer to any object type.
153
- * @return {Any} The updated reference.
152
+ * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type.
153
+ * @return {any} The updated reference.
154
154
  */
155
155
  updateReference(state: NodeBuilder | NodeFrame): unknown;
156
156
  /**
@@ -159,7 +159,7 @@ declare class Node extends EventDispatcher<{
159
159
  * global status.
160
160
  *
161
161
  * @param {NodeBuilder} builder - The current node builder.
162
- * @return {Boolean} Whether this node is global or not.
162
+ * @return {boolean} Whether this node is global or not.
163
163
  */
164
164
  isGlobal(builder: NodeBuilder): boolean;
165
165
  /**
@@ -189,14 +189,14 @@ declare class Node extends EventDispatcher<{
189
189
  /**
190
190
  * Returns the cache key for this node.
191
191
  *
192
- * @param {Boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced.
193
- * @return {Number} The cache key of the node.
192
+ * @param {boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced.
193
+ * @return {number} The cache key of the node.
194
194
  */
195
195
  getCacheKey(force?: boolean): number;
196
196
  /**
197
197
  * Generate a custom cache key for this node.
198
198
  *
199
- * @return {Number} The cache key of the node.
199
+ * @return {number} The cache key of the node.
200
200
  */
201
201
  customCacheKey(): number;
202
202
  /**
@@ -211,7 +211,7 @@ declare class Node extends EventDispatcher<{
211
211
  * depending on their implementation.
212
212
  *
213
213
  * @param {NodeBuilder} builder - The current node builder.
214
- * @return {String} The hash.
214
+ * @return {string} The hash.
215
215
  */
216
216
  getHash(builder: NodeBuilder): string;
217
217
  /**
@@ -238,22 +238,22 @@ declare class Node extends EventDispatcher<{
238
238
  * these elements.
239
239
  *
240
240
  * @param {NodeBuilder} builder - The current node builder.
241
- * @return {String} The type of the node.
241
+ * @return {string} The type of the node.
242
242
  */
243
243
  getElementType(builder: NodeBuilder): "bool" | "int" | "float" | "vec2" | "vec3" | "vec4" | "uint" | null;
244
244
  /**
245
245
  * Returns the node member type for the given name.
246
246
  *
247
247
  * @param {NodeBuilder} builder - The current node builder.
248
- * @param {String} name - The name of the member.
249
- * @return {String} The type of the node.
248
+ * @param {string} name - The name of the member.
249
+ * @return {string} The type of the node.
250
250
  */
251
251
  getMemberType(builder: NodeBuilder, name: string): string;
252
252
  /**
253
253
  * Returns the node's type.
254
254
  *
255
255
  * @param {NodeBuilder} builder - The current node builder.
256
- * @return {String} The type of the node.
256
+ * @return {string} The type of the node.
257
257
  */
258
258
  getNodeType(builder: NodeBuilder): string | null;
259
259
  /**
@@ -272,7 +272,7 @@ declare class Node extends EventDispatcher<{
272
272
  * The output node must be returned in the `return` statement.
273
273
  *
274
274
  * @param {NodeBuilder} builder - The current node builder.
275
- * @return {Node?} The output node.
275
+ * @return {?Node} The output node.
276
276
  */
277
277
  setup(builder: NodeBuilder): unknown;
278
278
  /**
@@ -287,8 +287,8 @@ declare class Node extends EventDispatcher<{
287
287
  * This state builds the output node and returns the resulting shader string.
288
288
  *
289
289
  * @param {NodeBuilder} builder - The current node builder.
290
- * @param {String?} output - Can be used to define the output type.
291
- * @return {String?} The generated shader string.
290
+ * @param {?string} output - Can be used to define the output type.
291
+ * @return {?string} The generated shader string.
292
292
  */
293
293
  generate(builder: NodeBuilder, output?: string | null): string | null | undefined;
294
294
  /**
@@ -297,7 +297,7 @@ declare class Node extends EventDispatcher<{
297
297
  *
298
298
  * @abstract
299
299
  * @param {NodeFrame} frame - A reference to the current node frame.
300
- * @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
300
+ * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
301
301
  */
302
302
  updateBefore(frame: NodeFrame): void;
303
303
  /**
@@ -306,7 +306,7 @@ declare class Node extends EventDispatcher<{
306
306
  *
307
307
  * @abstract
308
308
  * @param {NodeFrame} frame - A reference to the current node frame.
309
- * @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
309
+ * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
310
310
  */
311
311
  updateAfter(frame: NodeFrame): void;
312
312
  /**
@@ -315,7 +315,7 @@ declare class Node extends EventDispatcher<{
315
315
  *
316
316
  * @abstract
317
317
  * @param {NodeFrame} frame - A reference to the current node frame.
318
- * @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
318
+ * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
319
319
  */
320
320
  update(frame: NodeFrame): void;
321
321
  /**
@@ -323,8 +323,8 @@ declare class Node extends EventDispatcher<{
323
323
  * on the current build stage (setup, analyze or generate).
324
324
  *
325
325
  * @param {NodeBuilder} builder - The current node builder.
326
- * @param {String?} output - Can be used to define the output type.
327
- * @return {String?} When this method is executed in the setup or analyze stage, `null` is returned. In the generate stage, the generated shader string.
326
+ * @param {?string} output - Can be used to define the output type.
327
+ * @return {?string} When this method is executed in the setup or analyze stage, `null` is returned. In the generate stage, the generated shader string.
328
328
  */
329
329
  build(builder: NodeBuilder, output?: string | null): string | null;
330
330
  /**
@@ -348,7 +348,7 @@ declare class Node extends EventDispatcher<{
348
348
  /**
349
349
  * Serializes the node into the three.js JSON Object/Scene format.
350
350
  *
351
- * @param {Object?} meta - An optional JSON object that already holds serialized data from other scene objects.
351
+ * @param {?Object} meta - An optional JSON object that already holds serialized data from other scene objects.
352
352
  * @return {Object} The serialized node.
353
353
  */
354
354
  toJSON(meta?: NodeJSONMeta | string): NodeJSONOutputData;
@@ -13,9 +13,9 @@ declare class NodeAttribute {
13
13
  /**
14
14
  * Constructs a new node attribute.
15
15
  *
16
- * @param {String} name - The name of the attribute.
17
- * @param {String} type - The type of the attribute.
18
- * @param {Node?} node - An optional reference to the node.
16
+ * @param {string} name - The name of the attribute.
17
+ * @param {string} type - The type of the attribute.
18
+ * @param {?Node} node - An optional reference to the node.
19
19
  */
20
20
  constructor(name: string, type: string | null, node?: Node | null);
21
21
  }
@@ -51,14 +51,14 @@ declare class NodeCache {
51
51
  /**
52
52
  * Constructs a new node cache.
53
53
  *
54
- * @param {NodeCache?} parent - A reference to a parent cache.
54
+ * @param {?NodeCache} parent - A reference to a parent cache.
55
55
  */
56
56
  constructor(parent?: NodeCache | null);
57
57
  /**
58
58
  * Returns the data for the given node.
59
59
  *
60
60
  * @param {Node} node - The node.
61
- * @return {Object?} The data for the node.
61
+ * @return {?Object} The data for the node.
62
62
  */
63
63
  getData(node: Node): NodeData | undefined;
64
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
  /**
@@ -13,10 +13,10 @@ declare class NodeVar {
13
13
  /**
14
14
  * Constructs a new node variable.
15
15
  *
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
+ * @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.
20
20
  */
21
21
  constructor(name: string, type: string, readOnly?: boolean, count?: number | null);
22
22
  }
@@ -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
  }
@@ -1,6 +1,5 @@
1
1
  import Node from "./Node.js";
2
2
  import NodeBuilder from "./NodeBuilder.js";
3
- /** @module StructTypeNode **/
4
3
  export interface MembersLayout {
5
4
  [name: string]: string | {
6
5
  type: string;
@@ -36,11 +35,12 @@ declare class StructTypeNode extends Node {
36
35
  * Returns the length of the struct.
37
36
  * The length is calculated by summing the lengths of the struct's members.
38
37
  *
39
- * @returns {Number} The length of the struct.
38
+ * @returns {number} The length of the struct.
40
39
  */
41
40
  getLength(): number;
42
41
  getMemberType(builder: NodeBuilder, name: string): string;
43
42
  getNodeType(builder: NodeBuilder): string;
43
+ setup(builder: NodeBuilder): void;
44
44
  generate(builder: NodeBuilder): string;
45
45
  }
46
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>(
@@ -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,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>;
@@ -67,6 +67,9 @@ export type Swizzable<T extends Node = Node> =
67
67
  & {
68
68
  [Key in SwizzleOption | number]: ShaderNodeObject<Node>;
69
69
  }
70
+ & {
71
+ [Key in SwizzleOption as `set${Uppercase<Key>}`]: (value: Node) => ShaderNodeObject<Node>;
72
+ }
70
73
  & {
71
74
  [Key in SwizzleOption as `flip${Uppercase<Key>}`]: () => ShaderNodeObject<Node>;
72
75
  };
@@ -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
 
@@ -20,8 +20,9 @@ export interface LODJSON extends Object3DJSON {
20
20
  * @remarks
21
21
  * Typically you would create, say, three meshes, one for far away (low detail), one for mid range (medium detail) and one for close up (high detail).
22
22
  * @example
23
- * ```typescript
24
- * const {@link LOD} = new THREE.LOD();
23
+ * const lod = new THREE.LOD();
24
+ * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
25
+ *
25
26
  * //Create spheres with 3 levels of detail and create new {@link LOD} levels for them
26
27
  * for (let i = 0; i & lt; 3; i++) {
27
28
  * const geometry = new THREE.IcosahedronGeometry(10, 3 - i)
@@ -29,7 +30,7 @@ export interface LODJSON extends Object3DJSON {
29
30
  * lod.addLevel(mesh, i * 75);
30
31
  * }
31
32
  * scene.add(lod);
32
- * ```
33
+ *
33
34
  * @see Example: {@link https://threejs.org/examples/#webgl_lod | webgl / {@link LOD} }
34
35
  * @see {@link https://threejs.org/docs/index.html#api/en/objects/LOD | Official Documentation}
35
36
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/LOD.js | Source}
@@ -1,7 +1,7 @@
1
1
  import Info from "./Info.js";
2
2
  import Nodes from "./nodes/Nodes.js";
3
3
  export interface AnimationContext {
4
- requestAnimationFrame(callback: FrameRequestCallback, frame?: XRFrame): number;
4
+ requestAnimationFrame(callback: FrameRequestCallback, xrFrame?: XRFrame): number;
5
5
  cancelAnimationFrame(handle: number): void;
6
6
  }
7
7
  /**
@@ -13,7 +13,7 @@ declare class Animation {
13
13
  nodes: Nodes;
14
14
  info: Info;
15
15
  _context: AnimationContext;
16
- _animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
16
+ _animationLoop: ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null;
17
17
  _requestId: number | null;
18
18
  /**
19
19
  * Constructs a new animation loop management component.
@@ -35,13 +35,13 @@ declare class Animation {
35
35
  *
36
36
  * @return {Function} The animation loop.
37
37
  */
38
- getAnimationLoop(): ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
38
+ getAnimationLoop(): ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null;
39
39
  /**
40
40
  * Defines the user-level animation loop.
41
41
  *
42
42
  * @param {Function} callback - The animation loop.
43
43
  */
44
- setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): void;
44
+ setAnimationLoop(callback: ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null): void;
45
45
  /**
46
46
  * Returns the animation context.
47
47
  *
@@ -38,7 +38,7 @@ declare class Attributes extends DataMap<{
38
38
  * for new attributes and updates data for existing ones.
39
39
  *
40
40
  * @param {BufferAttribute} attribute - The attribute to update.
41
- * @param {Number} type - The attribute type.
41
+ * @param {number} type - The attribute type.
42
42
  */
43
43
  update(attribute: BufferAttribute | InterleavedBufferAttribute, type: AttributeType): void;
44
44
  /**
@@ -16,9 +16,9 @@ declare class BindGroup {
16
16
  /**
17
17
  * Constructs a new bind group.
18
18
  *
19
- * @param {String} name - The bind group's name.
19
+ * @param {string} name - The bind group's name.
20
20
  * @param {Array<Binding>} bindings - An array of bindings.
21
- * @param {Number} index - The group index.
21
+ * @param {number} index - The group index.
22
22
  * @param {Array<Binding>} bindingsReference - An array of reference bindings.
23
23
  */
24
24
  constructor(