@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
@@ -2,6 +2,7 @@
2
2
  export * from "./core/constants.js";
3
3
 
4
4
  // core
5
+ export { default as ArrayNode } from "./core/ArrayNode.js";
5
6
  export { default as AssignNode } from "./core/AssignNode.js";
6
7
  export { default as AttributeNode } from "./core/AttributeNode.js";
7
8
  export { default as BypassNode } from "./core/BypassNode.js";
@@ -13,7 +14,6 @@ export {
13
14
  default as LightingModel,
14
15
  LightingModelDirectInput,
15
16
  LightingModelDirectRectAreaInput,
16
- LightingModelIndirectInput,
17
17
  LightingModelReflectedLight,
18
18
  } from "./core/LightingModel.js";
19
19
  export { default as MRTNode } from "./core/MRTNode.js";
@@ -37,6 +37,8 @@ export { default as OutputStructNode } from "./core/OutputStructNode.js";
37
37
  export { default as ParameterNode } from "./core/ParameterNode.js";
38
38
  export { default as PropertyNode } from "./core/PropertyNode.js";
39
39
  export { default as StackNode } from "./core/StackNode.js";
40
+ export { default as StructNode } from "./core/StructNode.js";
41
+ export { default as StructTypeNode } from "./core/StructTypeNode.js";
40
42
  export { default as TempNode } from "./core/TempNode.js";
41
43
  export { default as UniformGroupNode } from "./core/UniformGroupNode.js";
42
44
  export { default as UniformNode } from "./core/UniformNode.js";
@@ -55,6 +57,7 @@ export { default as JoinNode } from "./utils/JoinNode.js";
55
57
  export { default as LoopNode } from "./utils/LoopNode.js";
56
58
  export { default as MatcapUVNode } from "./utils/MatcapUVNode.js";
57
59
  export { default as MaxMipLevelNode } from "./utils/MaxMipLevelNode.js";
60
+ export { default as MemberNode } from "./utils/MemberNode.js";
58
61
  export { default as ReflectorNode, ReflectorNodeParameters } from "./utils/ReflectorNode.js";
59
62
  export { default as RemapNode } from "./utils/RemapNode.js";
60
63
  export { default as RotateNode } from "./utils/RotateNode.js";
@@ -115,7 +118,7 @@ export { default as ScriptableNode } from "./code/ScriptableNode.js";
115
118
  export { default as ScriptableValueNode } from "./code/ScriptableValueNode.js";
116
119
 
117
120
  // geometry
118
- export { default as RangeNode, RangeModeBound } from "./geometry/RangeNode.js";
121
+ export { default as RangeNode } from "./geometry/RangeNode.js";
119
122
 
120
123
  // gpgpu
121
124
  export { default as ComputeNode } from "./gpgpu/ComputeNode.js";
@@ -130,7 +133,7 @@ export { default as EnvironmentNode } from "./lighting/EnvironmentNode.js";
130
133
  export { default as HemisphereLightNode } from "./lighting/HemisphereLightNode.js";
131
134
  export { default as IESSpotLightNode } from "./lighting/IESSpotLightNode.js";
132
135
  export { default as IrradianceNode } from "./lighting/IrradianceNode.js";
133
- export { default as LightingContextNode } from "./lighting/LightingContextNode.js";
136
+ export { default as LightingContextNode, LightingContext } from "./lighting/LightingContextNode.js";
134
137
  export { default as LightingNode } from "./lighting/LightingNode.js";
135
138
  export { default as LightProbeNode } from "./lighting/LightProbeNode.js";
136
139
  export { default as LightsNode } from "./lighting/LightsNode.js";
three/src/nodes/TSL.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./core/OutputStructNode.js";
13
13
  export * from "./core/ParameterNode.js";
14
14
  export * from "./core/PropertyNode.js";
15
15
  export * from "./core/StackNode.js";
16
+ export * from "./core/StructNode.js";
16
17
  export * from "./core/UniformGroupNode.js";
17
18
  export * from "./core/UniformNode.js";
18
19
  export * from "./core/VaryingNode.js";
@@ -132,6 +133,7 @@ export * from "./accessors/Lights.js";
132
133
  export * from "./lighting/LightingContextNode.js";
133
134
  export * from "./lighting/LightsNode.js";
134
135
  export * from "./lighting/PointLightNode.js";
136
+ export * from "./lighting/PointShadowNode.js";
135
137
  export * from "./lighting/ShadowBaseNode.js";
136
138
  export * from "./lighting/ShadowNode.js";
137
139
 
@@ -142,6 +144,9 @@ export * from "./pmrem/PMREMUtils.js";
142
144
  // procedural
143
145
  export * from "./procedural/Checker.js";
144
146
 
147
+ // shapes
148
+ export * from "./shapes/Shapes.js";
149
+
145
150
  // materialX
146
151
  export * from "./materialx/MaterialXNodes.js";
147
152
 
@@ -1,7 +1,14 @@
1
1
  import { TypedArray } from "../../core/BufferAttribute.js";
2
+ import { Struct } from "../core/StructNode.js";
2
3
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
4
  import StorageBufferNode from "./StorageBufferNode.js";
4
5
 
5
- export const attributeArray: (count: TypedArray | number, type?: string) => ShaderNodeObject<StorageBufferNode>;
6
+ export const attributeArray: (
7
+ count: TypedArray | number,
8
+ type?: string | Struct,
9
+ ) => ShaderNodeObject<StorageBufferNode>;
6
10
 
7
- export const instancedArray: (count: TypedArray | number, type?: string) => ShaderNodeObject<StorageBufferNode>;
11
+ export const instancedArray: (
12
+ count: TypedArray | number,
13
+ type?: string | Struct,
14
+ ) => ShaderNodeObject<StorageBufferNode>;
@@ -4,7 +4,6 @@ import { InterleavedBuffer } from "../../core/InterleavedBuffer.js";
4
4
  import { InterleavedBufferAttribute } from "../../core/InterleavedBufferAttribute.js";
5
5
  import InputNode from "../core/InputNode.js";
6
6
  import NodeBuilder from "../core/NodeBuilder.js";
7
- /** @module BufferAttributeNode **/
8
7
  /**
9
8
  * In earlier `three.js` versions it was only possible to define attribute data
10
9
  * on geometry level. With `BufferAttributeNode`, it is also possible to do this
@@ -40,9 +39,9 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
40
39
  * Constructs a new buffer attribute node.
41
40
  *
42
41
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} value - The attribute data.
43
- * @param {String?} [bufferType=null] - The buffer type (e.g. `'vec3'`).
44
- * @param {Number} [bufferStride=0] - The buffer stride.
45
- * @param {Number} [bufferOffset=0] - The buffer offset.
42
+ * @param {?string} [bufferType=null] - The buffer type (e.g. `'vec3'`).
43
+ * @param {number} [bufferStride=0] - The buffer stride.
44
+ * @param {number} [bufferOffset=0] - The buffer offset.
46
45
  */
47
46
  constructor(
48
47
  value: TypedArray | InterleavedBuffer | BufferAttribute,
@@ -55,7 +54,7 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
55
54
  * and thus the hash should be shared as well.
56
55
  *
57
56
  * @param {NodeBuilder} builder - The current node builder.
58
- * @return {String} The hash.
57
+ * @return {string} The hash.
59
58
  */
60
59
  getHash(builder: NodeBuilder): string;
61
60
  /**
@@ -63,7 +62,7 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
63
62
  * the buffer attribute.
64
63
  *
65
64
  * @param {NodeBuilder} builder - The current node builder.
66
- * @return {String} The node type.
65
+ * @return {string} The node type.
67
66
  */
68
67
  getNodeType(builder: NodeBuilder): string | null;
69
68
  /**
@@ -78,27 +77,27 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
78
77
  * Generates the code snippet of the buffer attribute node.
79
78
  *
80
79
  * @param {NodeBuilder} builder - The current node builder.
81
- * @return {String} The generated code snippet.
80
+ * @return {string} The generated code snippet.
82
81
  */
83
82
  generate(builder: NodeBuilder): string | null | undefined;
84
83
  /**
85
84
  * Overwrites the default implementation to return a fixed value `'bufferAttribute'`.
86
85
  *
87
86
  * @param {NodeBuilder} builder - The current node builder.
88
- * @return {String} The input type.
87
+ * @return {string} The input type.
89
88
  */
90
89
  getInputType(): string;
91
90
  /**
92
91
  * Sets the `usage` property to the given value.
93
92
  *
94
- * @param {Number} value - The usage to set.
93
+ * @param {number} value - The usage to set.
95
94
  * @return {BufferAttributeNode} A reference to this node.
96
95
  */
97
96
  setUsage(value: Usage): this;
98
97
  /**
99
98
  * Sets the `instanced` property to the given value.
100
99
  *
101
- * @param {Number} value - The value to set.
100
+ * @param {boolean} value - The value to set.
102
101
  * @return {BufferAttributeNode} A reference to this node.
103
102
  */
104
103
  setInstanced(value: boolean): this;
@@ -107,11 +106,12 @@ export default BufferAttributeNode;
107
106
  /**
108
107
  * TSL function for creating a buffer attribute node.
109
108
  *
109
+ * @tsl
110
110
  * @function
111
111
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
112
- * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
113
- * @param {Number} [stride=0] - The buffer stride.
114
- * @param {Number} [offset=0] - The buffer offset.
112
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
113
+ * @param {number} [stride=0] - The buffer stride.
114
+ * @param {number} [offset=0] - The buffer offset.
115
115
  * @returns {BufferAttributeNode}
116
116
  */
117
117
  export declare const bufferAttribute: (
@@ -124,11 +124,12 @@ export declare const bufferAttribute: (
124
124
  * TSL function for creating a buffer attribute node but with dynamic draw usage.
125
125
  * Use this function if attribute data are updated per frame.
126
126
  *
127
+ * @tsl
127
128
  * @function
128
129
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
129
- * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
130
- * @param {Number} [stride=0] - The buffer stride.
131
- * @param {Number} [offset=0] - The buffer offset.
130
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
131
+ * @param {number} [stride=0] - The buffer stride.
132
+ * @param {number} [offset=0] - The buffer offset.
132
133
  * @returns {BufferAttributeNode}
133
134
  */
134
135
  export declare const dynamicBufferAttribute: (
@@ -140,11 +141,12 @@ export declare const dynamicBufferAttribute: (
140
141
  /**
141
142
  * TSL function for creating a buffer attribute node but with enabled instancing
142
143
  *
144
+ * @tsl
143
145
  * @function
144
146
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
145
- * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
146
- * @param {Number} [stride=0] - The buffer stride.
147
- * @param {Number} [offset=0] - The buffer offset.
147
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
148
+ * @param {number} [stride=0] - The buffer stride.
149
+ * @param {number} [offset=0] - The buffer offset.
148
150
  * @returns {BufferAttributeNode}
149
151
  */
150
152
  export declare const instancedBufferAttribute: (
@@ -156,11 +158,12 @@ export declare const instancedBufferAttribute: (
156
158
  /**
157
159
  * TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing
158
160
  *
161
+ * @tsl
159
162
  * @function
160
163
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
161
- * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
162
- * @param {Number} [stride=0] - The buffer stride.
163
- * @param {Number} [offset=0] - The buffer offset.
164
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
165
+ * @param {number} [stride=0] - The buffer stride.
166
+ * @param {number} [offset=0] - The buffer offset.
164
167
  * @returns {BufferAttributeNode}
165
168
  */
166
169
  export declare const instancedDynamicBufferAttribute: (
@@ -4,6 +4,7 @@ import { Vector3 } from "../../math/Vector3.js";
4
4
  import UniformNode from "../core/UniformNode.js";
5
5
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
6
6
 
7
+ export const cameraIndex: ShaderNodeObject<UniformNode<number>>;
7
8
  export const cameraNear: ShaderNodeObject<UniformNode<number>>;
8
9
  export const cameraFar: ShaderNodeObject<UniformNode<number>>;
9
10
  export const cameraProjectionMatrix: ShaderNodeObject<UniformNode<Matrix4>>;
@@ -4,7 +4,7 @@ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
4
 
5
5
  export function lightShadowMatrix(light: Light): ShaderNodeObject<Node>;
6
6
 
7
- export function lightProjectionUV(light: Light): ShaderNodeObject<Node>;
7
+ export function lightProjectionUV(light: Light, position?: Node): ShaderNodeObject<Node>;
8
8
 
9
9
  export function lightPosition(light: Light): ShaderNodeObject<Node>;
10
10
 
@@ -37,7 +37,7 @@ export type MaterialNodeScope =
37
37
  | typeof MaterialNode.LINE_GAP_SIZE
38
38
  | typeof MaterialNode.LINE_WIDTH
39
39
  | typeof MaterialNode.LINE_DASH_OFFSET
40
- | typeof MaterialNode.POINT_WIDTH
40
+ | typeof MaterialNode.POINT_SIZE
41
41
  | typeof MaterialNode.DISPERSION
42
42
  | typeof MaterialNode.LIGHT_MAP
43
43
  | typeof MaterialNode.AO
@@ -77,7 +77,7 @@ export default class MaterialNode extends Node {
77
77
  static LINE_GAP_SIZE: "gapSize";
78
78
  static LINE_WIDTH: "linewidth";
79
79
  static LINE_DASH_OFFSET: "dashOffset";
80
- static POINT_WIDTH: "pointWidth";
80
+ static POINT_SIZE: "size";
81
81
  static DISPERSION: "dispersion";
82
82
  static LIGHT_MAP: "light";
83
83
  static AO: "ao";
@@ -122,7 +122,7 @@ export const materialLineDashSize: ShaderNodeObject<MaterialNode>;
122
122
  export const materialLineGapSize: ShaderNodeObject<MaterialNode>;
123
123
  export const materialLineWidth: ShaderNodeObject<MaterialNode>;
124
124
  export const materialLineDashOffset: ShaderNodeObject<MaterialNode>;
125
- export const materialPointWidth: ShaderNodeObject<MaterialNode>;
125
+ export const materialPointSize: ShaderNodeObject<MaterialNode>;
126
126
  export const materialDispersion: ShaderNodeObject<MaterialNode>;
127
127
  export const materialLightMap: ShaderNodeObject<MaterialNode>;
128
128
  export const materialAO: ShaderNodeObject<MaterialNode>;
@@ -1,4 +1,9 @@
1
+ import { Matrix4 } from "../../math/Matrix4.js";
1
2
  import UniformNode from "../core/UniformNode.js";
2
3
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
4
 
4
5
  export const materialRefractionRatio: ShaderNodeObject<UniformNode<number>>;
6
+
7
+ export const materialEnvIntensity: ShaderNodeObject<UniformNode<number>>;
8
+
9
+ export const materialEnvRotation: ShaderNodeObject<UniformNode<Matrix4>>;
@@ -16,6 +16,7 @@ export const modelWorldMatrix: ShaderNodeObject<ModelNode>;
16
16
  export const modelPosition: ShaderNodeObject<ModelNode>;
17
17
  export const modelScale: ShaderNodeObject<ModelNode>;
18
18
  export const modelViewPosition: ShaderNodeObject<ModelNode>;
19
+ export const modelRadius: ShaderNodeObject<ModelNode>;
19
20
  export const modelNormalMatrix: ShaderNodeObject<Node>;
20
21
  export const modelWorldMatrixInverse: ShaderNodeObject<UniformNode<Matrix4>>;
21
22
 
@@ -13,10 +13,12 @@ export default class Object3DNode extends Node {
13
13
  static SCALE: "scale";
14
14
  static VIEW_POSITION: "viewPosition";
15
15
  static DIRECTION: "direction";
16
+ static RADIUS: "radius";
16
17
  }
17
18
 
18
- export const objectDirection: (object3d: Object3D) => ShaderNodeObject<Object3DNode>;
19
- export const objectWorldMatrix: (object3d: Object3D) => ShaderNodeObject<Object3DNode>;
20
- export const objectPosition: (object3d: Object3D) => ShaderNodeObject<Object3DNode>;
21
- export const objectScale: (object3d: Object3D) => ShaderNodeObject<Object3DNode>;
22
- export const objectViewPosition: (object3d: Object3D) => ShaderNodeObject<Object3DNode>;
19
+ export const objectDirection: (object3d?: Object3D | null) => ShaderNodeObject<Object3DNode>;
20
+ export const objectWorldMatrix: (object3d?: Object3D | null) => ShaderNodeObject<Object3DNode>;
21
+ export const objectPosition: (object3d?: Object3D | null) => ShaderNodeObject<Object3DNode>;
22
+ export const objectScale: (object3d?: Object3D | null) => ShaderNodeObject<Object3DNode>;
23
+ export const objectViewPosition: (object3d?: Object3D | null) => ShaderNodeObject<Object3DNode>;
24
+ export const objectRadius: (object3d?: Object3D | null) => ShaderNodeObject<Object3DNode>;
@@ -1,6 +1,8 @@
1
1
  import StorageBufferAttribute from "../../renderers/common/StorageBufferAttribute.js";
2
2
  import StorageInstancedBufferAttribute from "../../renderers/common/StorageInstancedBufferAttribute.js";
3
3
  import { NodeAccess } from "../core/constants.js";
4
+ import { Struct } from "../core/StructNode.js";
5
+ import StructTypeNode from "../core/StructTypeNode.js";
4
6
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
5
7
  import StorageArrayElementNode from "../utils/StorageArrayElementNode.js";
6
8
  import BufferNode from "./BufferNode.js";
@@ -8,6 +10,8 @@ import BufferNode from "./BufferNode.js";
8
10
  export default class StorageBufferNode extends BufferNode<StorageBufferAttribute | StorageInstancedBufferAttribute> {
9
11
  readonly isStorageBufferNode: true;
10
12
 
13
+ structTypeNode: StructTypeNode | null;
14
+
11
15
  access: NodeAccess;
12
16
  isAtomic: boolean;
13
17
  isPBO: boolean;
@@ -16,7 +20,7 @@ export default class StorageBufferNode extends BufferNode<StorageBufferAttribute
16
20
 
17
21
  constructor(
18
22
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
19
- bufferType?: string | null,
23
+ bufferType?: string | Struct | null,
20
24
  bufferCount?: number,
21
25
  );
22
26
 
@@ -37,7 +41,7 @@ export default class StorageBufferNode extends BufferNode<StorageBufferAttribute
37
41
 
38
42
  export const storage: (
39
43
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
40
- type?: string | null,
44
+ type?: string | Struct | null,
41
45
  count?: number,
42
46
  ) => ShaderNodeObject<StorageBufferNode>;
43
47
 
@@ -46,6 +50,6 @@ export const storage: (
46
50
  */
47
51
  export const storageObject: (
48
52
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
49
- type?: string | null,
53
+ type?: string | Struct | null,
50
54
  count?: number,
51
55
  ) => ShaderNodeObject<StorageBufferNode>;
@@ -12,6 +12,6 @@ export default class Texture3DNode extends TextureNode {
12
12
 
13
13
  export const texture3D: (
14
14
  value: Texture,
15
- uvNode?: NodeRepresentation,
16
- levelNode?: NodeRepresentation,
15
+ uvNode?: NodeRepresentation | null,
16
+ levelNode?: NodeRepresentation | null,
17
17
  ) => ShaderNodeObject<Texture3DNode>;
@@ -0,0 +1,26 @@
1
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import Node from "./Node.js";
3
+ import TempNode from "./TempNode.js";
4
+
5
+ declare class ArrayNode extends TempNode {
6
+ count: number;
7
+ values: Node[];
8
+ readonly isArrayNode: true;
9
+
10
+ constructor(nodeType: string, count: number, values: Node[]);
11
+ }
12
+
13
+ export default ArrayNode;
14
+
15
+ interface ArrayFunction {
16
+ (values: Node[]): ShaderNodeObject<ArrayNode>;
17
+ (nodeType: string, count: number): ShaderNodeObject<ArrayNode>;
18
+ }
19
+
20
+ export const array: ArrayFunction;
21
+
22
+ declare module "../tsl/TSLCore.js" {
23
+ interface NodeElements {
24
+ toArray: typeof array;
25
+ }
26
+ }
@@ -1,6 +1,6 @@
1
+ import { DirectLightData, DirectRectAreaLightData } from "../lighting/LightsNode.js";
1
2
  import Node from "./Node.js";
2
3
  import NodeBuilder from "./NodeBuilder.js";
3
- import StackNode from "./StackNode.js";
4
4
 
5
5
  export interface LightingModelReflectedLight {
6
6
  directDiffuse: Node;
@@ -9,38 +9,23 @@ export interface LightingModelReflectedLight {
9
9
  indirectSpecular: Node;
10
10
  }
11
11
 
12
- export interface LightingModelDirectInput {
13
- lightDirection: Node;
14
- lightColor: Node;
12
+ export interface LightingModelDirectInput extends DirectLightData {
13
+ lightNode: Node;
15
14
  reflectedLight: LightingModelReflectedLight;
16
15
  }
17
16
 
18
- export interface LightingModelDirectRectAreaInput {
19
- lightColor: Node;
20
- lightPosition: Node;
21
- halfWidth: Node;
22
- halfHeight: Node;
17
+ export interface LightingModelDirectRectAreaInput extends DirectRectAreaLightData {
18
+ lightNode: Node;
23
19
  reflectedLight: LightingModelReflectedLight;
24
- ltc_1: Node;
25
- ltc_2: Node;
26
20
  }
27
21
 
28
- export interface LightingModelIndirectInput {
29
- radiance: Node;
30
- irradiance: Node;
31
- iblIrradiance: Node;
32
- ambientOcclusion: Node;
33
- reflectedLight: LightingModelReflectedLight;
34
- backdrop: Node;
35
- backdropAlpha: Node;
36
- outgoingLight: Node;
22
+ declare class LightingModel {
23
+ start(builder: NodeBuilder): void;
24
+ finish(builder: NodeBuilder): void;
25
+ direct(lightData: LightingModelDirectInput, builder: NodeBuilder): void;
26
+ directRectArea(lightData: LightingModelDirectRectAreaInput, builder: NodeBuilder): void;
27
+ indirect(builder: NodeBuilder): void;
28
+ ambientOcclusion(builder: NodeBuilder): void;
37
29
  }
38
30
 
39
- export default class LightingModel {
40
- start(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
41
- finish(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
42
- direct(input: LightingModelDirectInput, stack: StackNode, builder: NodeBuilder): void;
43
- directRectArea(input: LightingModelDirectRectAreaInput, stack: StackNode, builder: NodeBuilder): void;
44
- indirect(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
45
- ambientOcclusion(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
46
- }
31
+ export default LightingModel;
@@ -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,14 +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
+ /**
245
+ * Returns the node member type for the given name.
246
+ *
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.
250
+ */
251
+ getMemberType(builder: NodeBuilder, name: string): string;
244
252
  /**
245
253
  * Returns the node's type.
246
254
  *
247
255
  * @param {NodeBuilder} builder - The current node builder.
248
- * @return {String} The type of the node.
256
+ * @return {string} The type of the node.
249
257
  */
250
258
  getNodeType(builder: NodeBuilder): string | null;
251
259
  /**
@@ -264,7 +272,7 @@ declare class Node extends EventDispatcher<{
264
272
  * The output node must be returned in the `return` statement.
265
273
  *
266
274
  * @param {NodeBuilder} builder - The current node builder.
267
- * @return {Node?} The output node.
275
+ * @return {?Node} The output node.
268
276
  */
269
277
  setup(builder: NodeBuilder): unknown;
270
278
  /**
@@ -279,8 +287,8 @@ declare class Node extends EventDispatcher<{
279
287
  * This state builds the output node and returns the resulting shader string.
280
288
  *
281
289
  * @param {NodeBuilder} builder - The current node builder.
282
- * @param {String?} output - Can be used to define the output type.
283
- * @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.
284
292
  */
285
293
  generate(builder: NodeBuilder, output?: string | null): string | null | undefined;
286
294
  /**
@@ -289,7 +297,7 @@ declare class Node extends EventDispatcher<{
289
297
  *
290
298
  * @abstract
291
299
  * @param {NodeFrame} frame - A reference to the current node frame.
292
- * @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).
293
301
  */
294
302
  updateBefore(frame: NodeFrame): void;
295
303
  /**
@@ -298,7 +306,7 @@ declare class Node extends EventDispatcher<{
298
306
  *
299
307
  * @abstract
300
308
  * @param {NodeFrame} frame - A reference to the current node frame.
301
- * @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).
302
310
  */
303
311
  updateAfter(frame: NodeFrame): void;
304
312
  /**
@@ -307,7 +315,7 @@ declare class Node extends EventDispatcher<{
307
315
  *
308
316
  * @abstract
309
317
  * @param {NodeFrame} frame - A reference to the current node frame.
310
- * @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).
311
319
  */
312
320
  update(frame: NodeFrame): void;
313
321
  /**
@@ -315,14 +323,14 @@ declare class Node extends EventDispatcher<{
315
323
  * on the current build stage (setup, analyze or generate).
316
324
  *
317
325
  * @param {NodeBuilder} builder - The current node builder.
318
- * @param {String?} output - Can be used to define the output type.
319
- * @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.
320
328
  */
321
329
  build(builder: NodeBuilder, output?: string | null): string | null;
322
330
  /**
323
331
  * Returns the child nodes as a JSON object.
324
332
  *
325
- * @return {Object} The serialized child objects as JSON.
333
+ * @return {Array<Object>} An iterable list of serialized child objects as JSON.
326
334
  */
327
335
  getSerializeChildren(): Generator<import("./NodeUtils.js").NodeChild, void, unknown>;
328
336
  /**
@@ -340,7 +348,7 @@ declare class Node extends EventDispatcher<{
340
348
  /**
341
349
  * Serializes the node into the three.js JSON Object/Scene format.
342
350
  *
343
- * @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.
344
352
  * @return {Object} The serialized node.
345
353
  */
346
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
  }