@types/three 0.170.0 → 0.172.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. three/README.md +1 -1
  2. three/build/three.core.d.ts +1 -0
  3. three/build/three.core.min.d.ts +1 -0
  4. three/build/three.tsl.d.ts +1 -0
  5. three/build/three.tsl.min.d.ts +1 -0
  6. three/examples/jsm/Addons.d.ts +0 -5
  7. three/examples/jsm/controls/ArcballControls.d.ts +6 -1
  8. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  9. three/examples/jsm/controls/TransformControls.d.ts +1 -1
  10. three/examples/jsm/csm/CSMShadowNode.d.ts +2 -4
  11. three/examples/jsm/exporters/GLTFExporter.d.ts +23 -7
  12. three/examples/jsm/geometries/DecalGeometry.d.ts +1 -1
  13. three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +13 -0
  14. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  15. three/examples/jsm/lines/LineSegments2.d.ts +3 -1
  16. three/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +1 -1
  17. three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
  18. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
  19. three/examples/jsm/objects/InstancedPoints.d.ts +10 -0
  20. three/examples/jsm/objects/SkyMesh.d.ts +2 -2
  21. three/examples/jsm/objects/Water2Mesh.d.ts +13 -2
  22. three/examples/jsm/objects/WaterMesh.d.ts +11 -2
  23. three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
  24. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
  25. three/examples/jsm/tsl/display/AfterImageNode.d.ts +2 -1
  26. three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +1 -1
  27. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +2 -2
  28. three/examples/jsm/tsl/display/BleachBypass.d.ts +2 -1
  29. three/examples/jsm/tsl/display/BloomNode.d.ts +2 -1
  30. three/examples/jsm/tsl/display/DenoiseNode.d.ts +3 -4
  31. three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +2 -1
  32. three/examples/jsm/tsl/display/DotScreenNode.d.ts +2 -2
  33. three/examples/jsm/tsl/display/FXAANode.d.ts +2 -1
  34. three/examples/jsm/tsl/display/FilmNode.d.ts +2 -1
  35. three/examples/jsm/tsl/display/GTAONode.d.ts +5 -8
  36. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +2 -2
  37. three/examples/jsm/tsl/display/LensflareNode.d.ts +2 -2
  38. three/examples/jsm/tsl/display/Lut3DNode.d.ts +2 -2
  39. three/examples/jsm/tsl/display/MotionBlur.d.ts +2 -1
  40. three/examples/jsm/tsl/display/OutlineNode.d.ts +2 -2
  41. three/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts +1 -1
  42. three/examples/jsm/tsl/display/PixelationPassNode.d.ts +2 -2
  43. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +2 -1
  44. three/examples/jsm/tsl/display/SMAANode.d.ts +2 -1
  45. three/examples/jsm/tsl/display/SSAAPassNode.d.ts +2 -2
  46. three/examples/jsm/tsl/display/SSRNode.d.ts +2 -2
  47. three/examples/jsm/tsl/display/Sepia.d.ts +2 -1
  48. three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +2 -1
  49. three/examples/jsm/tsl/display/StereoCompositePassNode.d.ts +1 -2
  50. three/examples/jsm/tsl/display/StereoPassNode.d.ts +2 -2
  51. three/examples/jsm/tsl/display/TRAAPassNode.d.ts +2 -2
  52. three/examples/jsm/tsl/display/TransitionNode.d.ts +2 -1
  53. three/examples/jsm/tsl/display/hashBlur.d.ts +2 -1
  54. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +2 -1
  55. three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
  56. three/package.json +4 -4
  57. three/src/Three.Core.d.ts +159 -0
  58. three/src/Three.TSL.d.ts +533 -0
  59. three/src/Three.WebGPU.Nodes.d.ts +14 -195
  60. three/src/Three.WebGPU.d.ts +14 -196
  61. three/src/Three.d.ts +2 -158
  62. three/src/animation/AnimationClip.d.ts +3 -1
  63. three/src/cameras/CubeCamera.d.ts +19 -2
  64. three/src/core/Clock.d.ts +4 -6
  65. three/src/core/InterleavedBuffer.d.ts +12 -0
  66. three/src/core/RenderTarget.d.ts +3 -5
  67. three/src/core/RenderTarget3D.d.ts +9 -0
  68. three/src/core/RenderTargetArray.d.ts +9 -0
  69. three/src/materials/Material.d.ts +9 -5
  70. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  71. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  72. three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
  73. three/src/materials/nodes/LineDashedNodeMaterial.d.ts +3 -0
  74. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
  75. three/src/materials/nodes/NodeMaterial.d.ts +7 -1
  76. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +56 -0
  77. three/src/nodes/Nodes.d.ts +2 -7
  78. three/src/nodes/TSL.d.ts +10 -5
  79. three/src/nodes/accessors/Arrays.d.ts +7 -0
  80. three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
  81. three/src/nodes/accessors/BufferNode.d.ts +4 -4
  82. three/src/nodes/accessors/BuiltinNode.d.ts +14 -0
  83. three/src/nodes/accessors/ClippingNode.d.ts +6 -0
  84. three/src/nodes/accessors/InstanceNode.d.ts +15 -3
  85. three/src/nodes/accessors/InstancedMeshNode.d.ts +11 -0
  86. three/src/nodes/accessors/Lights.d.ts +15 -0
  87. three/src/nodes/accessors/MaterialNode.d.ts +3 -3
  88. three/src/nodes/accessors/ModelNode.d.ts +10 -2
  89. three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
  90. three/src/nodes/accessors/StorageBufferNode.d.ts +25 -12
  91. three/src/nodes/accessors/StorageTextureNode.d.ts +5 -3
  92. three/src/nodes/accessors/TextureNode.d.ts +5 -0
  93. three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
  94. three/src/nodes/core/IndexNode.d.ts +2 -0
  95. three/src/nodes/core/Node.d.ts +237 -0
  96. three/src/nodes/core/NodeAttribute.d.ts +13 -0
  97. three/src/nodes/core/NodeBuilder.d.ts +1 -2
  98. three/src/nodes/core/NodeCache.d.ts +21 -0
  99. three/src/nodes/core/NodeParser.d.ts +11 -0
  100. three/src/nodes/core/NodeUniform.d.ts +28 -0
  101. three/src/nodes/core/NodeUtils.d.ts +7 -0
  102. three/src/nodes/core/NodeVar.d.ts +12 -0
  103. three/src/nodes/core/NodeVarying.d.ts +14 -0
  104. three/src/nodes/core/StackNode.d.ts +6 -1
  105. three/src/nodes/core/StructTypeNode.d.ts +19 -1
  106. three/src/nodes/core/UniformNode.d.ts +44 -0
  107. three/src/nodes/core/VaryingNode.d.ts +3 -0
  108. three/src/nodes/core/constants.d.ts +41 -0
  109. three/src/nodes/display/BlendModes.d.ts +32 -0
  110. three/src/nodes/display/PassNode.d.ts +1 -1
  111. three/src/nodes/display/ScreenNode.d.ts +5 -0
  112. three/src/nodes/display/ViewportDepthNode.d.ts +3 -1
  113. three/src/nodes/fog/Fog.d.ts +26 -0
  114. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +88 -0
  115. three/src/nodes/gpgpu/BarrierNode.d.ts +12 -0
  116. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +13 -0
  117. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
  118. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +19 -0
  119. three/src/nodes/lighting/AnalyticLightNode.d.ts +11 -0
  120. three/src/nodes/lighting/LightsNode.d.ts +2 -2
  121. three/src/nodes/lighting/PointLightNode.d.ts +3 -0
  122. three/src/nodes/lighting/PointShadowNode.d.ts +30 -0
  123. three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
  124. three/src/nodes/lighting/ShadowNode.d.ts +28 -4
  125. three/src/nodes/math/MathNode.d.ts +13 -4
  126. three/src/nodes/math/OperatorNode.d.ts +3 -0
  127. three/src/nodes/tsl/TSLBase.d.ts +5 -0
  128. three/src/nodes/tsl/TSLCore.d.ts +51 -16
  129. three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
  130. three/src/nodes/utils/LoopNode.d.ts +23 -2
  131. three/src/nodes/utils/SplitNode.d.ts +1 -1
  132. three/src/objects/BatchedMesh.d.ts +4 -4
  133. three/src/objects/ClippingGroup.d.ts +41 -0
  134. three/src/renderers/WebGLRenderer.d.ts +10 -8
  135. three/src/renderers/common/Animation.d.ts +41 -4
  136. three/src/renderers/common/Attributes.d.ts +31 -0
  137. three/src/renderers/common/Backend.d.ts +11 -0
  138. three/src/renderers/common/Background.d.ts +22 -0
  139. three/src/renderers/common/BindGroup.d.ts +15 -0
  140. three/src/renderers/common/Binding.d.ts +24 -0
  141. three/src/renderers/common/Bindings.d.ts +54 -0
  142. three/src/renderers/common/Buffer.d.ts +31 -0
  143. three/src/renderers/common/BufferUtils.d.ts +26 -0
  144. three/src/renderers/common/BundleGroup.d.ts +22 -0
  145. three/src/renderers/common/ChainMap.d.ts +31 -1
  146. three/src/renderers/common/ClippingContext.d.ts +61 -14
  147. three/src/renderers/common/Color4.d.ts +36 -0
  148. three/src/renderers/common/ComputePipeline.d.ts +12 -0
  149. three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
  150. three/src/renderers/common/DataMap.d.ts +30 -0
  151. three/src/renderers/common/Geometries.d.ts +52 -0
  152. three/src/renderers/common/Info.d.ts +27 -0
  153. three/src/renderers/common/Pipeline.d.ts +11 -0
  154. three/src/renderers/common/Pipelines.d.ts +104 -0
  155. three/src/renderers/common/ProgrammableStage.d.ts +19 -1
  156. three/src/renderers/common/RenderBundle.d.ts +15 -4
  157. three/src/renderers/common/RenderBundles.d.ts +20 -2
  158. three/src/renderers/common/RenderContext.d.ts +22 -0
  159. three/src/renderers/common/RenderContexts.d.ts +42 -3
  160. three/src/renderers/common/RenderList.d.ts +90 -0
  161. three/src/renderers/common/RenderLists.d.ts +21 -0
  162. three/src/renderers/common/RenderObject.d.ts +160 -5
  163. three/src/renderers/common/RenderObjects.d.ts +56 -0
  164. three/src/renderers/common/RenderPipeline.d.ts +13 -0
  165. three/src/renderers/common/Renderer.d.ts +596 -6
  166. three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
  167. three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
  168. three/src/renderers/common/Textures.d.ts +66 -0
  169. three/src/renderers/common/Uniform.d.ts +106 -0
  170. three/src/renderers/common/UniformBuffer.d.ts +12 -0
  171. three/src/renderers/common/UniformsGroup.d.ts +104 -0
  172. three/src/renderers/common/extras/PMREMGenerator.d.ts +15 -1
  173. three/src/renderers/common/nodes/NodeBuilderState.d.ts +30 -0
  174. three/src/renderers/common/nodes/NodeLibrary.d.ts +73 -4
  175. three/src/renderers/common/nodes/NodeUniform.d.ts +161 -0
  176. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
  177. three/src/renderers/common/nodes/Nodes.d.ts +185 -11
  178. three/src/renderers/webgl/WebGLState.d.ts +1 -1
  179. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
  180. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
  181. three/src/textures/Data3DTexture.d.ts +4 -2
  182. three/src/textures/DataArrayTexture.d.ts +1 -1
  183. three/src/textures/DataTexture.d.ts +7 -2
  184. three/src/textures/Texture.d.ts +3 -0
  185. three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
  186. three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
  187. three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
  188. three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
  189. three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
  190. three/src/Three.Legacy.d.ts +0 -20
  191. three/src/nodes/core/UniformGroup.d.ts +0 -7
  192. three/src/nodes/display/BlendMode.d.ts +0 -10
  193. three/src/nodes/fog/FogExp2Node.d.ts +0 -14
  194. three/src/nodes/fog/FogNode.d.ts +0 -20
  195. three/src/nodes/fog/FogRangeNode.d.ts +0 -19
  196. three/src/nodes/lighting/LightNode.d.ts +0 -18
  197. three/src/textures/types.d.ts +0 -9
@@ -37,7 +37,6 @@ export type MathNodeMethod1 =
37
37
  | typeof MathNode.TRANSPOSE;
38
38
 
39
39
  export type MathNodeMethod2 =
40
- | typeof MathNode.ATAN2
41
40
  | typeof MathNode.MIN
42
41
  | typeof MathNode.MAX
43
42
  | typeof MathNode.MOD
@@ -99,7 +98,6 @@ export default class MathNode extends TempNode {
99
98
 
100
99
  // 2 inputs
101
100
 
102
- static ATAN2: "atan2";
103
101
  static MIN: "min";
104
102
  static MAX: "max";
105
103
  static MOD: "mod";
@@ -157,7 +155,7 @@ export const cos: Unary;
157
155
  export const tan: Unary;
158
156
  export const asin: Unary;
159
157
  export const acos: Unary;
160
- export const atan: Unary;
158
+ export const atan: (a: NodeRepresentation, b?: NodeRepresentation) => ShaderNodeObject<MathNode>;
161
159
  export const abs: Unary;
162
160
  export const sign: Unary;
163
161
  export const length: Unary;
@@ -174,7 +172,6 @@ export const transpose: Unary;
174
172
 
175
173
  type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
176
174
 
177
- export const atan2: Binary;
178
175
  export const min: Binary;
179
176
  export const max: Binary;
180
177
  export const mod: Binary;
@@ -210,6 +207,18 @@ export const rand: (uv: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
210
207
  export const mixElement: Ternary;
211
208
  export const smoothstepElement: Ternary;
212
209
 
210
+ /**
211
+ * @deprecated
212
+ */
213
+ export const atan2: Binary;
214
+
215
+ // GLSL alias function
216
+
217
+ export const faceforward: typeof faceForward;
218
+ export const inversesqrt: typeof inverseSqrt;
219
+
220
+ // Method chaining
221
+
213
222
  declare module "../tsl/TSLCore.js" {
214
223
  interface NodeElements {
215
224
  all: typeof all;
@@ -10,6 +10,7 @@ export type OperatorNodeOp =
10
10
  | ">>"
11
11
  | "<<"
12
12
  | "=="
13
+ | "!="
13
14
  | "&&"
14
15
  | "||"
15
16
  | "^^"
@@ -42,6 +43,7 @@ export const mul: Operator;
42
43
  export const div: Operator;
43
44
  export const modInt: Operator;
44
45
  export const equal: Operator;
46
+ export const notEqual: Operator;
45
47
  export const lessThan: Operator;
46
48
  export const greaterThan: Operator;
47
49
  export const lessThanEqual: Operator;
@@ -65,6 +67,7 @@ declare module "../tsl/TSLCore.js" {
65
67
  div: typeof div;
66
68
  modInt: typeof modInt;
67
69
  equal: typeof equal;
70
+ notEqual: typeof notEqual;
68
71
  lessThan: typeof lessThan;
69
72
  greaterThan: typeof greaterThan;
70
73
  lessThanEqual: typeof lessThanEqual;
@@ -19,3 +19,8 @@ export * from "../math/OperatorNode.js";
19
19
  export * from "../utils/Discard.js";
20
20
  export * from "../utils/RemapNode.js";
21
21
  export * from "./TSLCore.js";
22
+
23
+ /**
24
+ * @deprecated
25
+ */
26
+ export function addNodeElement(name: string): void;
@@ -35,15 +35,29 @@ export interface NodeElements {
35
35
 
36
36
  export function addMethodChaining(name: string, nodeElement: unknown): void;
37
37
 
38
- export type SwizzleCharacter = "x" | "y" | "z" | "w" | "r" | "g" | "b" | "a" | "s" | "t" | "p" | "q";
39
-
40
- export type SwizzleOption = Exclude<
41
- | `${SwizzleCharacter}`
42
- | `${SwizzleCharacter}${SwizzleCharacter}`
43
- | `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`
44
- | `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`,
45
- "abs" | "sqrt"
46
- >;
38
+ type XYZWCharacter = "x" | "y" | "z" | "w";
39
+ type RGBACharacter = "r" | "g" | "b" | "a";
40
+ type STPQCharacter = "s" | "t" | "p" | "q";
41
+
42
+ type XYZWSwizzle =
43
+ | `${XYZWCharacter}`
44
+ | `${XYZWCharacter}${XYZWCharacter}`
45
+ | `${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}`
46
+ | `${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}`;
47
+
48
+ type RGBASwizzle =
49
+ | `${RGBACharacter}`
50
+ | `${RGBACharacter}${RGBACharacter}`
51
+ | `${RGBACharacter}${RGBACharacter}${RGBACharacter}`
52
+ | `${RGBACharacter}${RGBACharacter}${RGBACharacter}${RGBACharacter}`;
53
+
54
+ type STPQSwizzle =
55
+ | `${STPQCharacter}`
56
+ | `${STPQCharacter}${STPQCharacter}`
57
+ | `${STPQCharacter}${STPQCharacter}${STPQCharacter}`
58
+ | `${STPQCharacter}${STPQCharacter}${STPQCharacter}${STPQCharacter}`;
59
+
60
+ export type SwizzleOption = XYZWSwizzle | RGBASwizzle | STPQSwizzle;
47
61
 
48
62
  export type Swizzable<T extends Node = Node> =
49
63
  & T
@@ -172,6 +186,13 @@ type ConstructedNode<T> = T extends new(...args: any[]) => infer R ? (R extends
172
186
 
173
187
  export type NodeOrType = Node | string;
174
188
 
189
+ declare class ShaderCallNodeInternal extends Node {
190
+ }
191
+
192
+ declare class ShaderNodeInternal extends Node {}
193
+
194
+ export const defined: (v: unknown) => unknown;
195
+
175
196
  export const getConstNodeType: (value: NodeOrType) => string | null;
176
197
 
177
198
  export class ShaderNode<T = {}, R extends Node = Node> {
@@ -207,13 +228,26 @@ export function nodeImmutable<T>(
207
228
  ...params: ProxiedTuple<GetConstructors<T>>
208
229
  ): ShaderNodeObject<ConstructedNode<T>>;
209
230
 
210
- export function Fn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
211
- export function Fn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
212
- jsFunc: (args: T) => R,
213
- ): (...args: ProxiedTuple<T>) => R;
214
- export function Fn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
215
- jsFunc: (args: T) => R,
216
- ): (args: ProxiedObject<T>) => R;
231
+ interface Layout {
232
+ name: string;
233
+ type: string;
234
+ inputs: { name: string; type: string }[];
235
+ }
236
+
237
+ interface ShaderNodeFn<Args extends readonly unknown[]> {
238
+ (...args: Args): ShaderNodeObject<ShaderCallNodeInternal>;
239
+ shaderNode: ShaderNodeObject<ShaderNodeInternal>;
240
+ setLayout: (layout: Layout) => this;
241
+ once: () => this;
242
+ }
243
+
244
+ export function Fn(jsFunc: () => void): ShaderNodeFn<[]>;
245
+ export function Fn<T extends readonly unknown[]>(
246
+ jsFunc: (args: T) => void,
247
+ ): ShaderNodeFn<ProxiedTuple<T>>;
248
+ export function Fn<T extends { readonly [key: string]: unknown }>(
249
+ jsFunc: (args: T) => void,
250
+ ): ShaderNodeFn<[ProxiedObject<T>]>;
217
251
 
218
252
  /**
219
253
  * @deprecated tslFn() has been renamed to Fn()
@@ -271,3 +305,4 @@ export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<Arr
271
305
 
272
306
  export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
273
307
  export const convert: (node: NodeRepresentation, types: string) => ShaderNodeObject<Node>;
308
+ export const split: (node: NodeRepresentation, channels?: string) => ShaderNodeObject<Node>;
@@ -1,8 +1,8 @@
1
1
  import { Node, TempNode } from "../Nodes.js";
2
- import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
4
  export default class EquirectUVNode extends TempNode {
5
5
  constructor(dirNode?: ShaderNodeObject<Node>);
6
6
  }
7
7
 
8
- export const equirectUV: ShaderNodeObject<EquirectUVNode>;
8
+ export const equirectUV: (dirNode?: NodeRepresentation) => ShaderNodeObject<EquirectUVNode>;
@@ -1,6 +1,18 @@
1
1
  import Node from "../core/Node.js";
2
2
  import NodeBuilder from "../core/NodeBuilder.js";
3
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
+
5
+ interface LoopNodeObjectParameter {
6
+ // TODO Expand to other types and update loop function types appropriately
7
+ type?: "int" | "uint";
8
+ // TODO The variable name should affect the type of the loop function
9
+ // name?: string;
10
+ start: number | Node;
11
+ end: number | Node;
12
+ condition: string;
13
+ }
14
+
15
+ type LoopNodeParameter = Node | number | LoopNodeObjectParameter;
4
16
 
5
17
  declare class LoopNode extends Node {
6
18
  params: unknown[];
@@ -12,7 +24,16 @@ declare class LoopNode extends Node {
12
24
 
13
25
  export default LoopNode;
14
26
 
15
- export const Loop: (...params: unknown[]) => ShaderNodeObject<Node>;
27
+ interface Loop {
28
+ (i: LoopNodeParameter, func: (inputs: { readonly i: number }) => void): ShaderNodeObject<Node>;
29
+ (
30
+ i: LoopNodeParameter,
31
+ j: LoopNodeParameter,
32
+ func: (inputs: { readonly i: number; readonly j: number }) => void,
33
+ ): ShaderNodeObject<Node>;
34
+ }
35
+
36
+ export const Loop: Loop;
16
37
  export const Continue: () => ShaderNodeObject<Node>;
17
38
  export const Break: () => ShaderNodeObject<Node>;
18
39
 
@@ -1,7 +1,6 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { SwizzleOption } from "../tsl/TSLCore.js";
3
3
 
4
- /** swizzle node */
5
4
  export default class SplitNode extends Node {
6
5
  node: Node;
7
6
  components: string;
@@ -11,5 +10,6 @@ export default class SplitNode extends Node {
11
10
  * @param components swizzle like string, default = "x"
12
11
  */
13
12
  constructor(node: Node, components?: SwizzleOption);
13
+
14
14
  getVectorLength(): number;
15
15
  }
@@ -19,10 +19,10 @@ export interface BatchedMeshGeometryRange {
19
19
  }
20
20
 
21
21
  /**
22
- * A special version of {@link Mesh} with multi draw batch rendering support. Use {@link BatchedMesh} if you have to
23
- * render a large number of objects with the same material but with different world transformations. The usage of
24
- * {@link BatchedMesh} will help you to reduce the number of draw calls and thus improve the overall rendering
25
- * performance in your application.
22
+ * A special version of {@link Mesh} with multi draw batch rendering support. Use BatchedMesh if you have to render a
23
+ * large number of objects with the same material but with different geometries or world transformations. The usage of
24
+ * BatchedMesh will help you to reduce the number of draw calls and thus improve the overall rendering performance in
25
+ * your application.
26
26
  *
27
27
  * If the {@link https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw WEBGL_multi_draw extension} is not
28
28
  * supported then a less performant fallback is used.
@@ -0,0 +1,41 @@
1
+ import { Plane } from "../math/Plane.js";
2
+ import { Group } from "./Group.js";
3
+
4
+ /**
5
+ * A special version of the Group object that defines clipping planes for descendant objects. ClippingGroups can be
6
+ * nested, with clipping planes accumulating by type: intersection or union.
7
+ */
8
+ declare class ClippingGroup extends Group {
9
+ /**
10
+ * Read-only flag to check if a given object is of type ClippingGroup.
11
+ */
12
+ readonly isClippingGroup: true;
13
+
14
+ /**
15
+ * User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects
16
+ * that are children of this ClippingGroup. Points in space whose signed distance to the plane is negative are
17
+ * clipped (not rendered). See the webgpu_clipping example. Default is `[]`.
18
+ */
19
+ clippingPlanes: Plane[];
20
+
21
+ /**
22
+ * Determines if the clipping planes defined by this object are applied. Default is `true`.
23
+ */
24
+ enabled: boolean;
25
+
26
+ /**
27
+ * Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union.
28
+ * Default is `false`.
29
+ */
30
+ clipIntersection: boolean;
31
+
32
+ /**
33
+ * Defines whether to clip shadows according to the clipping planes specified by this ClippingGroup. Default is
34
+ * `false`.
35
+ */
36
+ clipShadows: boolean;
37
+
38
+ constructor();
39
+ }
40
+
41
+ export { ClippingGroup };
@@ -26,13 +26,6 @@ import { WebGLState } from "./webgl/WebGLState.js";
26
26
  import { WebGLRenderTarget } from "./WebGLRenderTarget.js";
27
27
  import { WebXRManager } from "./webxr/WebXRManager.js";
28
28
 
29
- export interface Renderer {
30
- domElement: HTMLCanvasElement;
31
-
32
- render(scene: Object3D, camera: Camera): void;
33
- setSize(width: number, height: number, updateStyle?: boolean): void;
34
- }
35
-
36
29
  export interface WebGLRendererParameters extends WebGLCapabilitiesParameters {
37
30
  /**
38
31
  * A Canvas where the renderer draws its output.
@@ -115,7 +108,7 @@ export interface WebGLDebug {
115
108
  *
116
109
  * see {@link https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLRenderer.js|src/renderers/WebGLRenderer.js}
117
110
  */
118
- export class WebGLRenderer implements Renderer {
111
+ export class WebGLRenderer {
119
112
  /**
120
113
  * parameters is an optional object with properties defining the renderer's behavior.
121
114
  * The constructor also accepts no parameters at all.
@@ -198,6 +191,13 @@ export class WebGLRenderer implements Renderer {
198
191
  */
199
192
  toneMappingExposure: number;
200
193
 
194
+ /**
195
+ * The normalized resolution scale for the transmission render target, measured in percentage of viewport
196
+ * dimensions. Lowering this value can result in significant improvements to {@link MeshPhysicalMaterial}
197
+ * transmission performance. Default is `1`.
198
+ */
199
+ transmissionResolutionScale: number;
200
+
201
201
  info: WebGLInfo;
202
202
 
203
203
  shadowMap: WebGLShadowMap;
@@ -444,6 +444,7 @@ export class WebGLRenderer implements Renderer {
444
444
  * @param dstTexture Specifies the destination texture.
445
445
  * @param srcRegion Specifies the bounds
446
446
  * @param dstPosition Specifies the pixel offset into the dstTexture where the copy will occur.
447
+ * @param srcLevel Specifies the source mipmap level of the texture.
447
448
  * @param dstLevel Specifies the destination mipmap level of the texture.
448
449
  */
449
450
  copyTextureToTexture(
@@ -451,6 +452,7 @@ export class WebGLRenderer implements Renderer {
451
452
  dstTexture: Texture,
452
453
  srcRegion?: Box2 | Box3 | null,
453
454
  dstPosition?: Vector2 | Vector3 | null,
455
+ srcLevel?: number,
454
456
  dstLevel?: number,
455
457
  ): void;
456
458
 
@@ -1,13 +1,50 @@
1
1
  import Info from "./Info.js";
2
2
  import Nodes from "./nodes/Nodes.js";
3
+ interface AnimationContext {
4
+ requestAnimationFrame(callback: FrameRequestCallback, frame?: XRFrame): number;
5
+ cancelAnimationFrame(handle: number): void;
6
+ }
7
+ /**
8
+ * This module manages the internal animation loop of the renderer.
9
+ *
10
+ * @private
11
+ */
3
12
  declare class Animation {
4
13
  nodes: Nodes;
5
14
  info: Info;
6
- animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
7
- requestId: number | null;
15
+ _context: AnimationContext;
16
+ _animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
17
+ _requestId: number | null;
18
+ /**
19
+ * Constructs a new animation loop management component.
20
+ *
21
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
22
+ * @param {Info} info - Renderer component for managing metrics and monitoring data.
23
+ */
8
24
  constructor(nodes: Nodes, info: Info);
9
- _init(): void;
10
- dispose(): void;
25
+ /**
26
+ * Starts the internal animation loop.
27
+ */
28
+ start(): void;
29
+ /**
30
+ * Stops the internal animation loop.
31
+ */
32
+ stop(): void;
33
+ /**
34
+ * Defines the user-level animation loop.
35
+ *
36
+ * @param {Function} callback - The animation loop.
37
+ */
11
38
  setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): void;
39
+ /**
40
+ * Defines the context in which `requestAnimationFrame()` is executed.
41
+ *
42
+ * @param {Window|XRSession} context - The context to set.
43
+ */
44
+ setContext(context: AnimationContext): void;
45
+ /**
46
+ * Frees all internal resources and stops the animation loop.
47
+ */
48
+ dispose(): void;
12
49
  }
13
50
  export default Animation;
@@ -7,6 +7,12 @@ import DataMap from "./DataMap.js";
7
7
  interface Data {
8
8
  version?: number | undefined;
9
9
  }
10
+ /**
11
+ * This renderer module manages geometry attributes.
12
+ *
13
+ * @private
14
+ * @augments DataMap
15
+ */
10
16
  declare class Attributes extends DataMap<{
11
17
  attribute: {
12
18
  key: BufferAttribute | InterleavedBufferAttribute;
@@ -14,9 +20,34 @@ declare class Attributes extends DataMap<{
14
20
  };
15
21
  }> {
16
22
  backend: Backend;
23
+ /**
24
+ * Constructs a new attribute management component.
25
+ *
26
+ * @param {Backend} backend - The renderer's backend.
27
+ */
17
28
  constructor(backend: Backend);
29
+ /**
30
+ * Deletes the data for the given attribute.
31
+ *
32
+ * @param {BufferAttribute} attribute - The attribute.
33
+ * @return {Object} The deleted attribute data.
34
+ */
18
35
  delete(attribute: BufferAttribute | InterleavedBufferAttribute): Data;
36
+ /**
37
+ * Updates the given attribute. This method creates attribute buffers
38
+ * for new attributes and updates data for existing ones.
39
+ *
40
+ * @param {BufferAttribute} attribute - The attribute to update.
41
+ * @param {Number} type - The attribute type.
42
+ */
19
43
  update(attribute: BufferAttribute | InterleavedBufferAttribute, type: AttributeType): void;
44
+ /**
45
+ * Utility method for handling interleaved buffer attributes correctly.
46
+ * To process them, their `InterleavedBuffer` is returned.
47
+ *
48
+ * @param {BufferAttribute} attribute - The attribute.
49
+ * @return {BufferAttribute|InterleavedBuffer}
50
+ */
20
51
  _getBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute): BufferAttribute | InterleavedBuffer;
21
52
  }
22
53
  export default Attributes;
@@ -1,6 +1,17 @@
1
1
  import { CoordinateSystem } from "../../constants.js";
2
2
  import Renderer from "./Renderer.js";
3
3
 
4
+ declare module "../../core/Object3D.js" {
5
+ interface Object3D {
6
+ // See https://github.com/mrdoob/three.js/pull/28683
7
+ count?: number | undefined;
8
+ // See https://github.com/mrdoob/three.js/pull/26335
9
+ occlusionTest?: boolean | undefined;
10
+ // https://github.com/mrdoob/three.js/pull/29386
11
+ static?: boolean | undefined;
12
+ }
13
+ }
14
+
4
15
  export interface BackendParameters {
5
16
  canvas?: HTMLCanvasElement | undefined;
6
17
  }
@@ -9,6 +9,12 @@ interface SceneData {
9
9
  backgroundMesh?: Mesh;
10
10
  backgroundCacheKey: string;
11
11
  }
12
+ /**
13
+ * This renderer module manages the background.
14
+ *
15
+ * @private
16
+ * @augments DataMap
17
+ */
12
18
  declare class Background extends DataMap<{
13
19
  scene: {
14
20
  key: Scene;
@@ -17,7 +23,23 @@ declare class Background extends DataMap<{
17
23
  }> {
18
24
  renderer: Renderer;
19
25
  nodes: Nodes;
26
+ /**
27
+ * Constructs a new background management component.
28
+ *
29
+ * @param {Renderer} renderer - The renderer.
30
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
31
+ */
20
32
  constructor(renderer: Renderer, nodes: Nodes);
33
+ /**
34
+ * Updates the background for the given scene. Depending on how `Scene.background`
35
+ * or `Scene.backgroundNode` are configured, this method might configure a simple clear
36
+ * or add a mesh to the render list for rendering the background as a textured plane
37
+ * or skybox.
38
+ *
39
+ * @param {Scene} scene - The scene.
40
+ * @param {RenderList} renderList - The current render list.
41
+ * @param {RenderContext} renderContext - The current render context.
42
+ */
21
43
  update(scene: Scene, renderList: RenderList, renderContext: RenderContext): void;
22
44
  }
23
45
  export default Background;
@@ -1,11 +1,26 @@
1
1
  import Binding from "./Binding.js";
2
2
  import NodeUniformsGroup from "./nodes/NodeUniformsGroup.js";
3
+ /**
4
+ * A bind group represents a collection of bindings and thus a collection
5
+ * or resources. Bind groups are assigned to pipelines to provide them
6
+ * with the required resources (like uniform buffers or textures).
7
+ *
8
+ * @private
9
+ */
3
10
  declare class BindGroup {
4
11
  name: string;
5
12
  bindings: NodeUniformsGroup[] | Binding[];
6
13
  index: number;
7
14
  bindingsReference: NodeUniformsGroup[] | BindGroup;
8
15
  id: number;
16
+ /**
17
+ * Constructs a new bind group.
18
+ *
19
+ * @param {String} name - The bind group's name.
20
+ * @param {Array<Binding>} bindings - An array of bindings.
21
+ * @param {Number} index - The group index.
22
+ * @param {Array<Binding>} bindingsReference - An array of reference bindings.
23
+ */
9
24
  constructor(
10
25
  name?: string,
11
26
  bindings?: NodeUniformsGroup[],
@@ -1,8 +1,32 @@
1
+ /**
2
+ * A binding represents the connection between a resource (like a texture, sampler
3
+ * or uniform buffer) and the resource definition in a shader stage.
4
+ *
5
+ * This module is an abstract base class for all concrete bindings types.
6
+ *
7
+ * @abstract
8
+ * @private
9
+ */
1
10
  declare class Binding {
2
11
  name: string;
3
12
  visibility: number;
13
+ /**
14
+ * Constructs a new binding.
15
+ *
16
+ * @param {String} [name=''] - The binding's name.
17
+ */
4
18
  constructor(name?: string);
19
+ /**
20
+ * Makes sure binding's resource is visible for the given shader stage.
21
+ *
22
+ * @param {Number} visibility - The shader stage.
23
+ */
5
24
  setVisibility(visibility: number): void;
25
+ /**
26
+ * Clones the binding.
27
+ *
28
+ * @return {Binding} The cloned binding.
29
+ */
6
30
  clone(): Binding & this;
7
31
  }
8
32
  export default Binding;
@@ -11,7 +11,23 @@ import Textures from "./Textures.js";
11
11
  interface BindGroupData {
12
12
  bindGroup?: BindGroup | undefined;
13
13
  }
14
+ /**
15
+ * This renderer module manages the bindings of the renderer.
16
+ *
17
+ * @private
18
+ * @augments DataMap
19
+ */
14
20
  declare class Bindings extends DataMap<{
21
+ /**
22
+ * Constructs a new bindings management component.
23
+ *
24
+ * @param {Backend} backend - The renderer's backend.
25
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
26
+ * @param {Textures} textures - Renderer component for managing textures.
27
+ * @param {Attributes} attributes - Renderer component for managing attributes.
28
+ * @param {Pipelines} pipelines - Renderer component for managing pipelines.
29
+ * @param {Info} info - Renderer component for managing metrics and monitoring data.
30
+ */
15
31
  bindGroup: {
16
32
  key: BindGroup;
17
33
  value: BindGroupData;
@@ -31,12 +47,50 @@ declare class Bindings extends DataMap<{
31
47
  pipelines: Pipelines,
32
48
  info: Info,
33
49
  );
50
+ /**
51
+ * Returns the bind groups for the given render object.
52
+ *
53
+ * @param {RenderObject} renderObject - The render object.
54
+ * @return {Array<BindGroup>} The bind groups.
55
+ */
34
56
  getForRender(renderObject: RenderObject): BindGroup[];
57
+ /**
58
+ * Returns the bind groups for the given compute node.
59
+ *
60
+ * @param {Node} computeNode - The compute node.
61
+ * @return {Array<BindGroup>} The bind groups.
62
+ */
35
63
  getForCompute(computeNode: ComputeNode): BindGroup[];
64
+ /**
65
+ * Updates the bindings for the given compute node.
66
+ *
67
+ * @param {Node} computeNode - The compute node.
68
+ */
36
69
  updateForCompute(computeNode: ComputeNode): void;
70
+ /**
71
+ * Updates the bindings for the given render object.
72
+ *
73
+ * @param {RenderObject} renderObject - The render object.
74
+ */
37
75
  updateForRender(renderObject: RenderObject): void;
76
+ /**
77
+ * Updates the given array of bindings.
78
+ *
79
+ * @param {Array<BindGroup>} bindings - The bind groups.
80
+ */
38
81
  _updateBindings(bindings: BindGroup[]): void;
82
+ /**
83
+ * Initializes the given bind group.
84
+ *
85
+ * @param {BindGroup} bindGroup - The bind group to initialize.
86
+ */
39
87
  _init(bindGroup: BindGroup): void;
88
+ /**
89
+ * Updates the given bind group.
90
+ *
91
+ * @param {BindGroup} bindGroup - The bind group to update.
92
+ * @param {Array<BindGroup>} bindings - The bind groups.
93
+ */
40
94
  _update(bindGroup: BindGroup, bindings: BindGroup[]): void;
41
95
  }
42
96
  export default Bindings;