@types/three 0.171.0 → 0.173.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 (152) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -5
  3. three/examples/jsm/controls/ArcballControls.d.ts +1 -1
  4. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  5. three/examples/jsm/csm/CSMShadowNode.d.ts +2 -3
  6. three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
  7. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  8. three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
  9. three/examples/jsm/lines/LineSegments2.d.ts +3 -1
  10. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
  11. three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
  12. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
  13. three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
  14. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
  15. three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
  16. three/examples/jsm/webxr/XRButton.d.ts +4 -2
  17. three/package.json +2 -2
  18. three/src/Three.Core.d.ts +4 -1
  19. three/src/Three.TSL.d.ts +18 -5
  20. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  21. three/src/Three.WebGPU.d.ts +2 -2
  22. three/src/animation/AnimationClip.d.ts +1 -1
  23. three/src/cameras/ArrayCamera.d.ts +7 -6
  24. three/src/cameras/Camera.d.ts +7 -7
  25. three/src/cameras/CubeCamera.d.ts +19 -2
  26. three/src/constants.d.ts +6 -0
  27. three/src/core/BufferAttribute.d.ts +5 -0
  28. three/src/core/RenderTarget.d.ts +3 -5
  29. three/src/core/RenderTarget3D.d.ts +9 -0
  30. three/src/core/RenderTargetArray.d.ts +9 -0
  31. three/src/materials/Material.d.ts +3 -1
  32. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  33. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  34. three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
  35. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
  36. three/src/materials/nodes/NodeMaterial.d.ts +3 -0
  37. three/src/materials/nodes/NodeMaterials.d.ts +0 -4
  38. three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
  39. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +57 -0
  40. three/src/math/Matrix4.d.ts +2 -1
  41. three/src/nodes/Nodes.d.ts +6 -7
  42. three/src/nodes/TSL.d.ts +6 -3
  43. three/src/nodes/accessors/Arrays.d.ts +10 -2
  44. three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
  45. three/src/nodes/accessors/BufferNode.d.ts +4 -4
  46. three/src/nodes/accessors/Camera.d.ts +1 -0
  47. three/src/nodes/accessors/MaterialNode.d.ts +6 -6
  48. three/src/nodes/accessors/ModelNode.d.ts +10 -2
  49. three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
  50. three/src/nodes/accessors/StorageBufferNode.d.ts +12 -4
  51. three/src/nodes/accessors/TextureNode.d.ts +5 -0
  52. three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
  53. three/src/nodes/core/ArrayNode.d.ts +26 -0
  54. three/src/nodes/core/Node.d.ts +245 -0
  55. three/src/nodes/core/NodeAttribute.d.ts +13 -0
  56. three/src/nodes/core/NodeBuilder.d.ts +1 -2
  57. three/src/nodes/core/NodeCache.d.ts +23 -1
  58. three/src/nodes/core/NodeParser.d.ts +11 -0
  59. three/src/nodes/core/NodeUniform.d.ts +28 -0
  60. three/src/nodes/core/NodeVar.d.ts +18 -2
  61. three/src/nodes/core/NodeVarying.d.ts +14 -0
  62. three/src/nodes/core/StructNode.d.ts +21 -0
  63. three/src/nodes/core/StructType.d.ts +8 -0
  64. three/src/nodes/core/StructTypeNode.d.ts +41 -4
  65. three/src/nodes/core/UniformNode.d.ts +44 -0
  66. three/src/nodes/core/VarNode.d.ts +8 -1
  67. three/src/nodes/core/VaryingNode.d.ts +12 -0
  68. three/src/nodes/core/constants.d.ts +35 -0
  69. three/src/nodes/display/PassNode.d.ts +1 -1
  70. three/src/nodes/fog/Fog.d.ts +26 -0
  71. three/src/nodes/geometry/RangeNode.d.ts +6 -11
  72. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
  73. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
  74. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
  75. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
  76. three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
  77. three/src/nodes/lighting/ShadowNode.d.ts +2 -1
  78. three/src/nodes/math/MathNode.d.ts +15 -4
  79. three/src/nodes/math/OperatorNode.d.ts +2 -0
  80. three/src/nodes/shapes/Shapes.d.ts +4 -0
  81. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  82. three/src/nodes/tsl/TSLCore.d.ts +62 -17
  83. three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
  84. three/src/nodes/utils/LoopNode.d.ts +23 -2
  85. three/src/nodes/utils/MemberNode.d.ts +11 -0
  86. three/src/objects/BatchedMesh.d.ts +1 -0
  87. three/src/objects/ClippingGroup.d.ts +1 -1
  88. three/src/objects/InstancedMesh.d.ts +4 -3
  89. three/src/renderers/WebGLRenderer.d.ts +10 -10
  90. three/src/renderers/common/Animation.d.ts +43 -1
  91. three/src/renderers/common/Attributes.d.ts +31 -0
  92. three/src/renderers/common/Backend.d.ts +11 -0
  93. three/src/renderers/common/Background.d.ts +22 -0
  94. three/src/renderers/common/BindGroup.d.ts +15 -0
  95. three/src/renderers/common/Binding.d.ts +24 -0
  96. three/src/renderers/common/Bindings.d.ts +54 -0
  97. three/src/renderers/common/Buffer.d.ts +31 -0
  98. three/src/renderers/common/BufferUtils.d.ts +26 -0
  99. three/src/renderers/common/BundleGroup.d.ts +22 -0
  100. three/src/renderers/common/ChainMap.d.ts +33 -3
  101. three/src/renderers/common/ClippingContext.d.ts +45 -0
  102. three/src/renderers/common/Color4.d.ts +40 -0
  103. three/src/renderers/common/ComputePipeline.d.ts +12 -0
  104. three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
  105. three/src/renderers/common/DataMap.d.ts +30 -0
  106. three/src/renderers/common/Geometries.d.ts +52 -0
  107. three/src/renderers/common/Info.d.ts +21 -5
  108. three/src/renderers/common/Pipeline.d.ts +11 -0
  109. three/src/renderers/common/Pipelines.d.ts +104 -0
  110. three/src/renderers/common/PostProcessing.d.ts +1 -1
  111. three/src/renderers/common/ProgrammableStage.d.ts +19 -1
  112. three/src/renderers/common/RenderBundle.d.ts +15 -4
  113. three/src/renderers/common/RenderBundles.d.ts +20 -2
  114. three/src/renderers/common/RenderContext.d.ts +27 -3
  115. three/src/renderers/common/RenderContexts.d.ts +37 -6
  116. three/src/renderers/common/RenderList.d.ts +85 -0
  117. three/src/renderers/common/RenderLists.d.ts +21 -0
  118. three/src/renderers/common/RenderObject.d.ts +163 -4
  119. three/src/renderers/common/RenderObjects.d.ts +53 -0
  120. three/src/renderers/common/RenderPipeline.d.ts +13 -0
  121. three/src/renderers/common/Renderer.d.ts +604 -10
  122. three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
  123. three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
  124. three/src/renderers/common/Textures.d.ts +66 -0
  125. three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
  126. three/src/renderers/common/Uniform.d.ts +133 -1
  127. three/src/renderers/common/UniformBuffer.d.ts +12 -0
  128. three/src/renderers/common/UniformsGroup.d.ts +103 -0
  129. three/src/renderers/common/XRManager.d.ts +196 -0
  130. three/src/renderers/common/XRRenderTarget.d.ts +23 -0
  131. three/src/renderers/common/nodes/NodeBuilderState.d.ts +32 -2
  132. three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
  133. three/src/renderers/common/nodes/NodeUniform.d.ts +185 -0
  134. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
  135. three/src/renderers/common/nodes/Nodes.d.ts +192 -17
  136. three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
  137. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
  138. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
  139. three/src/textures/DataTexture.d.ts +2 -2
  140. three/src/textures/Texture.d.ts +5 -5
  141. three/src/textures/VideoFrameTexture.d.ts +27 -0
  142. three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
  143. three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
  144. three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
  145. three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
  146. three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
  147. three/src/Three.Legacy.d.ts +0 -20
  148. three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
  149. three/src/nodes/core/UniformGroup.d.ts +0 -7
  150. three/src/nodes/fog/FogExp2Node.d.ts +0 -14
  151. three/src/nodes/fog/FogNode.d.ts +0 -20
  152. three/src/nodes/fog/FogRangeNode.d.ts +0 -19
@@ -1,13 +1,41 @@
1
+ /** @module NodeConstants **/
2
+ /**
3
+ * Possible shader stages.
4
+ *
5
+ * @property {string} VERTEX The vertex shader stage.
6
+ * @property {string} FRAGMENT The fragment shader stage.
7
+ */
1
8
  export declare const NodeShaderStage: {
2
9
  readonly VERTEX: "vertex";
3
10
  readonly FRAGMENT: "fragment";
4
11
  };
12
+ /**
13
+ * Update types of a node.
14
+ *
15
+ * @property {string} NONE The update method is not executed.
16
+ * @property {string} FRAME The update method is executed per frame.
17
+ * @property {string} RENDER The update method is executed per render. A frame might be produced by multiple render calls so this value allows more detailed updates than FRAME.
18
+ * @property {string} OBJECT The update method is executed per {@link Object3D} that uses the node for rendering.
19
+ */
5
20
  export declare const NodeUpdateType: {
6
21
  readonly NONE: "none";
7
22
  readonly FRAME: "frame";
8
23
  readonly RENDER: "render";
9
24
  readonly OBJECT: "object";
10
25
  };
26
+ /**
27
+ * Data types of a node.
28
+ *
29
+ * @property {string} BOOLEAN Boolean type.
30
+ * @property {string} INTEGER Integer type.
31
+ * @property {string} FLOAT Float type.
32
+ * @property {string} VECTOR2 Two-dimensional vector type.
33
+ * @property {string} VECTOR3 Three-dimensional vector type.
34
+ * @property {string} VECTOR4 Four-dimensional vector type.
35
+ * @property {string} MATRIX2 2x2 matrix type.
36
+ * @property {string} MATRIX3 3x3 matrix type.
37
+ * @property {string} MATRIX4 4x4 matrix type.
38
+ */
11
39
  export declare const NodeType: {
12
40
  readonly BOOLEAN: "bool";
13
41
  readonly INTEGER: "int";
@@ -19,6 +47,13 @@ export declare const NodeType: {
19
47
  readonly MATRIX3: "mat3";
20
48
  readonly MATRIX4: "mat4";
21
49
  };
50
+ /**
51
+ * Access types of a node. These are relevant for compute and storage usage.
52
+ *
53
+ * @property {string} READ_ONLY Read-only access
54
+ * @property {string} WRITE_ONLY Write-only access.
55
+ * @property {string} READ_WRITE Read and write access.
56
+ */
22
57
  export declare const NodeAccess: {
23
58
  readonly READ_ONLY: "readOnly";
24
59
  readonly WRITE_ONLY: "writeOnly";
@@ -68,4 +68,4 @@ export default PassNode;
68
68
 
69
69
  export const pass: (scene: Scene, camera: Camera, options?: RenderTargetOptions) => ShaderNodeObject<PassNode>;
70
70
  export const passTexture: (pass: PassNode, texture: Texture) => ShaderNodeObject<PassTextureNode>;
71
- export const depthPass: (scene: Scene, camera: Camera) => ShaderNodeObject<PassNode>;
71
+ export const depthPass: (scene: Scene, camera: Camera, options?: RenderTargetOptions) => ShaderNodeObject<PassNode>;
@@ -0,0 +1,26 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const rangeFogFactor: (near: NodeRepresentation, far: NodeRepresentation) => ShaderNodeObject<Node>;
5
+
6
+ export const densityFogFactor: (density: NodeRepresentation) => ShaderNodeObject<Node>;
7
+
8
+ export const fog: (color: NodeRepresentation, factor: NodeRepresentation) => ShaderNodeObject<Node>;
9
+
10
+ /**
11
+ * @deprecated
12
+ */
13
+ export function rangeFog(
14
+ color: NodeRepresentation,
15
+ near: NodeRepresentation,
16
+ far: NodeRepresentation,
17
+ ): ShaderNodeObject<Node>;
18
+
19
+ /**
20
+ * @deprecated
21
+ */
22
+ export function densityFog(
23
+ color: NodeRepresentation,
24
+ near: NodeRepresentation,
25
+ far: NodeRepresentation,
26
+ ): ShaderNodeObject<Node>;
@@ -1,19 +1,14 @@
1
- import { Color } from "../../math/Color.js";
2
- import { Vector2 } from "../../math/Vector2.js";
3
- import { Vector3 } from "../../math/Vector3.js";
4
- import { Vector4 } from "../../math/Vector4.js";
5
1
  import Node from "../core/Node.js";
6
2
  import NodeBuilder from "../core/NodeBuilder.js";
7
- import { ShaderNodeObject } from "../tsl/TSLCore.js";
8
-
9
- export type RangeModeBound = number | Color | Vector2 | Vector3 | Vector4;
3
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
10
4
 
11
5
  export default class RangeNode extends Node {
12
- min: RangeModeBound;
13
- max: RangeModeBound;
6
+ minNode: Node;
7
+ maxNode: Node;
8
+
9
+ constructor(minNode: Node, maxNode: Node);
14
10
 
15
- constructor(min: RangeModeBound, max: RangeModeBound);
16
11
  getVectorLength(builder: NodeBuilder): number;
17
12
  }
18
13
 
19
- export const range: (min: RangeModeBound, max: RangeModeBound) => ShaderNodeObject<RangeNode>;
14
+ export const range: (minNode: NodeRepresentation, maxNode: NodeRepresentation) => ShaderNodeObject<RangeNode>;
@@ -39,6 +39,11 @@ export const atomicFunc: (
39
39
  storeNode?: NodeRepresentation | null,
40
40
  ) => ShaderNodeObject<AtomicFunctionNode>;
41
41
 
42
+ export const atomicLoad: (
43
+ pointerNode: NodeRepresentation,
44
+ storeNode?: NodeRepresentation | null,
45
+ ) => ShaderNodeObject<AtomicFunctionNode>;
46
+
42
47
  export const atomicStore: (
43
48
  pointerNode: NodeRepresentation,
44
49
  valueNode: NodeRepresentation,
@@ -9,5 +9,6 @@ export default ComputeBuiltinNode;
9
9
 
10
10
  export const numWorkgroups: ShaderNodeObject<ComputeBuiltinNode>;
11
11
  export const workgroupId: ShaderNodeObject<ComputeBuiltinNode>;
12
+ export const globalId: ShaderNodeObject<ComputeBuiltinNode>;
12
13
  export const localId: ShaderNodeObject<ComputeBuiltinNode>;
13
14
  export const subgroupSize: ShaderNodeObject<ComputeBuiltinNode>;
@@ -8,18 +8,23 @@ export default class ComputeNode extends Node {
8
8
  count: number;
9
9
  workgroupSize: number[];
10
10
  dispatchCount: number;
11
+ name: string;
11
12
 
12
13
  onInitFunction: ((args: { renderer: Renderer }) => void) | null;
13
14
 
14
15
  constructor(computeNode: Node, count: number, workgroupSize?: number[]);
15
16
 
17
+ label(name: string): void;
18
+
19
+ updateDispatchCount(): void;
20
+
16
21
  onInit(callback: ((args: { renderer: Renderer }) => void) | null): void;
17
22
  }
18
23
 
19
24
  export const compute: (
20
25
  node: NodeRepresentation,
21
26
  count: number,
22
- workgroupSize: number[],
27
+ workgroupSize?: number[],
23
28
  ) => ShaderNodeObject<ComputeNode>;
24
29
 
25
30
  declare module "../tsl/TSLCore.js" {
@@ -7,6 +7,8 @@ declare class WorkgroupInfoNode extends Node {
7
7
 
8
8
  readonly isWorkgroupInfoNode: true;
9
9
 
10
+ elementType: string;
11
+
10
12
  scope: string;
11
13
 
12
14
  constructor(scope: string, bufferType: string, bufferCount?: number);
@@ -0,0 +1,15 @@
1
+ import { Light } from "../../lights/Light.js";
2
+ import Node from "../core/Node.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
+
5
+ declare class ShadowBaseNode extends Node {
6
+ light: Light;
7
+
8
+ readonly isShadowBasedNode: true;
9
+
10
+ constructor(light: Light);
11
+ }
12
+
13
+ export const shadowPositionWorld: ShaderNodeObject<Node>;
14
+
15
+ export default ShadowBaseNode;
@@ -2,6 +2,7 @@ import { Light } from "../../lights/Light.js";
2
2
  import { LightShadow } from "../../lights/LightShadow.js";
3
3
  import Node from "../core/Node.js";
4
4
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
5
+ import ShadowBaseNode from "./ShadowBaseNode.js";
5
6
 
6
7
  export const BasicShadowFilter: (
7
8
  depthTexture: NodeRepresentation,
@@ -25,7 +26,7 @@ export const VSMShadowFilter: (
25
26
  shadowCoord: NodeRepresentation,
26
27
  ) => ShaderNodeObject<Node>;
27
28
 
28
- declare class ShadowNode extends Node {
29
+ declare class ShadowNode extends ShadowBaseNode {
29
30
  constructor(light: Light, shadow: LightShadow | null);
30
31
  }
31
32
 
@@ -37,7 +37,6 @@ export type MathNodeMethod1 =
37
37
  | typeof MathNode.TRANSPOSE;
38
38
 
39
39
  export type MathNodeMethod2 =
40
- | typeof MathNode.ATAN2
41
40
  | typeof MathNode.MIN
42
41
  | typeof MathNode.MAX
43
42
  | typeof MathNode.MOD
@@ -99,7 +98,6 @@ export default class MathNode extends TempNode {
99
98
 
100
99
  // 2 inputs
101
100
 
102
- static ATAN2: "atan2";
103
101
  static MIN: "min";
104
102
  static MAX: "max";
105
103
  static MOD: "mod";
@@ -124,6 +122,8 @@ export default class MathNode extends TempNode {
124
122
  bNode: Node | null;
125
123
  cNode: Node | null;
126
124
 
125
+ readonly isMathNode: true;
126
+
127
127
  constructor(method: MathNodeMethod1, aNode: Node);
128
128
  constructor(method: MathNodeMethod2, aNode: Node, bNode: Node);
129
129
  constructor(method: MathNodeMethod3, aNode: Node, bNode: Node, cNode: Node);
@@ -157,7 +157,7 @@ export const cos: Unary;
157
157
  export const tan: Unary;
158
158
  export const asin: Unary;
159
159
  export const acos: Unary;
160
- export const atan: Unary;
160
+ export const atan: (a: NodeRepresentation, b?: NodeRepresentation) => ShaderNodeObject<MathNode>;
161
161
  export const abs: Unary;
162
162
  export const sign: Unary;
163
163
  export const length: Unary;
@@ -174,7 +174,6 @@ export const transpose: Unary;
174
174
 
175
175
  type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
176
176
 
177
- export const atan2: Binary;
178
177
  export const min: Binary;
179
178
  export const max: Binary;
180
179
  export const mod: Binary;
@@ -210,6 +209,18 @@ export const rand: (uv: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
210
209
  export const mixElement: Ternary;
211
210
  export const smoothstepElement: Ternary;
212
211
 
212
+ /**
213
+ * @deprecated
214
+ */
215
+ export const atan2: Binary;
216
+
217
+ // GLSL alias function
218
+
219
+ export const faceforward: typeof faceForward;
220
+ export const inversesqrt: typeof inverseSqrt;
221
+
222
+ // Method chaining
223
+
213
224
  declare module "../tsl/TSLCore.js" {
214
225
  interface NodeElements {
215
226
  all: typeof all;
@@ -28,6 +28,8 @@ export default class OperatorNode extends TempNode {
28
28
  bNode: Node;
29
29
  op: OperatorNodeOp;
30
30
 
31
+ readonly isOperatorNode: true;
32
+
31
33
  constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]);
32
34
  }
33
35
 
@@ -0,0 +1,4 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const shapeCircle: (coord?: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -1,6 +1,7 @@
1
1
  export * from "../accessors/BufferAttributeNode.js";
2
2
  export * from "../code/ExpressionNode.js";
3
3
  export * from "../code/FunctionCallNode.js";
4
+ export * from "../core/ArrayNode.js";
4
5
  export * from "../core/AssignNode.js";
5
6
  export * from "../core/BypassNode.js";
6
7
  export * from "../core/CacheNode.js";
@@ -1,7 +1,10 @@
1
+ import { Color, ColorRepresentation } from "../../math/Color.js";
2
+ import { Vector3 } from "../../math/Vector3.js";
1
3
  import ConstNode from "../core/ConstNode.js";
2
4
  import Node from "../core/Node.js";
3
5
  import NodeBuilder from "../core/NodeBuilder.js";
4
6
  import StackNode from "../core/StackNode.js";
7
+ import ConvertNode from "../utils/ConvertNode.js";
5
8
 
6
9
  export interface NodeElements {
7
10
  toGlobal: (node: Node) => Node;
@@ -35,15 +38,29 @@ export interface NodeElements {
35
38
 
36
39
  export function addMethodChaining(name: string, nodeElement: unknown): void;
37
40
 
38
- export type SwizzleCharacter = "x" | "y" | "z" | "w" | "r" | "g" | "b" | "a" | "s" | "t" | "p" | "q";
41
+ type XYZWCharacter = "x" | "y" | "z" | "w";
42
+ type RGBACharacter = "r" | "g" | "b" | "a";
43
+ type STPQCharacter = "s" | "t" | "p" | "q";
39
44
 
40
- export type SwizzleOption = Exclude<
41
- | `${SwizzleCharacter}`
42
- | `${SwizzleCharacter}${SwizzleCharacter}`
43
- | `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`
44
- | `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`,
45
- "abs" | "sqrt"
46
- >;
45
+ type XYZWSwizzle =
46
+ | `${XYZWCharacter}`
47
+ | `${XYZWCharacter}${XYZWCharacter}`
48
+ | `${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}`
49
+ | `${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}${XYZWCharacter}`;
50
+
51
+ type RGBASwizzle =
52
+ | `${RGBACharacter}`
53
+ | `${RGBACharacter}${RGBACharacter}`
54
+ | `${RGBACharacter}${RGBACharacter}${RGBACharacter}`
55
+ | `${RGBACharacter}${RGBACharacter}${RGBACharacter}${RGBACharacter}`;
56
+
57
+ type STPQSwizzle =
58
+ | `${STPQCharacter}`
59
+ | `${STPQCharacter}${STPQCharacter}`
60
+ | `${STPQCharacter}${STPQCharacter}${STPQCharacter}`
61
+ | `${STPQCharacter}${STPQCharacter}${STPQCharacter}${STPQCharacter}`;
62
+
63
+ export type SwizzleOption = XYZWSwizzle | RGBASwizzle | STPQSwizzle;
47
64
 
48
65
  export type Swizzable<T extends Node = Node> =
49
66
  & T
@@ -70,7 +87,7 @@ export type ShaderNodeObject<T extends Node> =
70
87
  & Swizzable<T>;
71
88
 
72
89
  /** anything that can be passed to {@link nodeObject} and returns a proxy */
73
- export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | ShaderNodeObject<T>;
90
+ export type NodeRepresentation<T extends Node = Node> = number | boolean | Vector3 | Node | ShaderNodeObject<T>;
74
91
 
75
92
  /** anything that can be passed to {@link nodeObject} */
76
93
  export type NodeObjectOption = NodeRepresentation | string;
@@ -172,6 +189,11 @@ type ConstructedNode<T> = T extends new(...args: any[]) => infer R ? (R extends
172
189
 
173
190
  export type NodeOrType = Node | string;
174
191
 
192
+ declare class ShaderCallNodeInternal extends Node {
193
+ }
194
+
195
+ declare class ShaderNodeInternal extends Node {}
196
+
175
197
  export const defined: (v: unknown) => unknown;
176
198
 
177
199
  export const getConstNodeType: (value: NodeOrType) => string | null;
@@ -209,13 +231,30 @@ export function nodeImmutable<T>(
209
231
  ...params: ProxiedTuple<GetConstructors<T>>
210
232
  ): ShaderNodeObject<ConstructedNode<T>>;
211
233
 
212
- export function Fn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
213
- export function Fn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
214
- jsFunc: (args: T) => R,
215
- ): (...args: ProxiedTuple<T>) => R;
216
- export function Fn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
217
- jsFunc: (args: T) => R,
218
- ): (args: ProxiedObject<T>) => R;
234
+ interface Layout {
235
+ name: string;
236
+ type: string;
237
+ inputs: {
238
+ name: string;
239
+ type: string;
240
+ qualifier?: "in" | "out" | "inout";
241
+ }[];
242
+ }
243
+
244
+ interface ShaderNodeFn<Args extends readonly unknown[]> {
245
+ (...args: Args): ShaderNodeObject<ShaderCallNodeInternal>;
246
+ shaderNode: ShaderNodeObject<ShaderNodeInternal>;
247
+ setLayout: (layout: Layout) => this;
248
+ once: () => this;
249
+ }
250
+
251
+ export function Fn(jsFunc: () => void): ShaderNodeFn<[]>;
252
+ export function Fn<T extends readonly unknown[]>(
253
+ jsFunc: (args: T) => void,
254
+ ): ShaderNodeFn<ProxiedTuple<T>>;
255
+ export function Fn<T extends { readonly [key: string]: unknown }>(
256
+ jsFunc: (args: T) => void,
257
+ ): ShaderNodeFn<[ProxiedObject<T>]>;
219
258
 
220
259
  /**
221
260
  * @deprecated tslFn() has been renamed to Fn()
@@ -242,7 +281,13 @@ export const If: (boolNode: Node, method: () => void) => StackNode;
242
281
 
243
282
  export function append(node: Node): Node;
244
283
 
245
- export const color: ConvertType;
284
+ interface ColorFunction {
285
+ (color?: ColorRepresentation): ShaderNodeObject<ConstNode<Color>>;
286
+ (r: number, g: number, b: number): ShaderNodeObject<ConstNode<Color>>;
287
+ (node: Node): ShaderNodeObject<ConvertNode>;
288
+ }
289
+
290
+ export const color: ColorFunction;
246
291
 
247
292
  export const float: ConvertType;
248
293
  export const int: ConvertType;
@@ -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
 
@@ -0,0 +1,11 @@
1
+ import Node from "../core/Node.js";
2
+
3
+ declare class MemberNode extends Node {
4
+ node: Node;
5
+ property: string;
6
+ readonly isMemberNode: true;
7
+
8
+ constructor(node: Node, property: string);
9
+ }
10
+
11
+ export default MemberNode;
@@ -186,6 +186,7 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
186
186
 
187
187
  /**
188
188
  * Sets the given local transformation matrix to the defined instance.
189
+ * Negatively scaled matrices are not supported.
189
190
  * @param instanceId The id of an instance to set the matrix of.
190
191
  * @param matrix A 4x4 matrix representing the local transformation of a single instance.
191
192
  */
@@ -2,7 +2,7 @@ import { Plane } from "../math/Plane.js";
2
2
  import { Group } from "./Group.js";
3
3
 
4
4
  /**
5
- * A special version of the Group object that defines clipping planes for decendant objects. ClippingGroups can be
5
+ * A special version of the Group object that defines clipping planes for descendant objects. ClippingGroups can be
6
6
  * nested, with clipping planes accumulating by type: intersection or union.
7
7
  */
8
8
  declare class ClippingGroup extends Group {
@@ -145,9 +145,10 @@ export class InstancedMesh<
145
145
  getMorphAt(index: number, mesh: Mesh): void;
146
146
 
147
147
  /**
148
- * Sets the given local transformation matrix to the defined instance.
149
- * @remarks
150
- * Make sure you set {@link InstancedBufferAttribute.needsUpdate | .instanceMatrix.needsUpdate()} flag to `true` after updating all the matrices.
148
+ * Sets the given local transformation matrix to the defined instance. Make sure you set
149
+ * {@link InstancedBufferAttribute.needsUpdate | .instanceMatrix.needsUpdate()} flag to `true` after updating all
150
+ * the matrices.
151
+ * Negatively scaled matrices are not supported.
151
152
  * @param index The index of an instance. Values have to be in the range `[0, count]`. Expects a `Integer`
152
153
  * @param matrix A 4x4 matrix representing the local transformation of a single instance.
153
154
  */
@@ -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;
@@ -278,12 +278,12 @@ export class WebGLRenderer implements Renderer {
278
278
  /**
279
279
  * Sets the custom opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
280
280
  */
281
- setOpaqueSort(method: (a: any, b: any) => number): void;
281
+ setOpaqueSort(method: ((a: any, b: any) => number) | null): void;
282
282
 
283
283
  /**
284
284
  * Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function.
285
285
  */
286
- setTransparentSort(method: (a: any, b: any) => number): void;
286
+ setTransparentSort(method: ((a: any, b: any) => number) | null): void;
287
287
 
288
288
  /**
289
289
  * Returns a THREE.Color instance with the current clear color.
@@ -1,20 +1,62 @@
1
1
  import Info from "./Info.js";
2
2
  import Nodes from "./nodes/Nodes.js";
3
- interface AnimationContext {
3
+ export interface AnimationContext {
4
4
  requestAnimationFrame(callback: FrameRequestCallback, frame?: XRFrame): number;
5
5
  cancelAnimationFrame(handle: number): void;
6
6
  }
7
+ /**
8
+ * This module manages the internal animation loop of the renderer.
9
+ *
10
+ * @private
11
+ */
7
12
  declare class Animation {
8
13
  nodes: Nodes;
9
14
  info: Info;
10
15
  _context: AnimationContext;
11
16
  _animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
12
17
  _requestId: number | null;
18
+ /**
19
+ * Constructs a new animation loop management component.
20
+ *
21
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
22
+ * @param {Info} info - Renderer component for managing metrics and monitoring data.
23
+ */
13
24
  constructor(nodes: Nodes, info: Info);
25
+ /**
26
+ * Starts the internal animation loop.
27
+ */
14
28
  start(): void;
29
+ /**
30
+ * Stops the internal animation loop.
31
+ */
15
32
  stop(): void;
33
+ /**
34
+ * Returns the user-level animation loop.
35
+ *
36
+ * @return {Function} The animation loop.
37
+ */
38
+ getAnimationLoop(): ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
39
+ /**
40
+ * Defines the user-level animation loop.
41
+ *
42
+ * @param {Function} callback - The animation loop.
43
+ */
16
44
  setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): void;
45
+ /**
46
+ * Returns the animation context.
47
+ *
48
+ * @return {Window|XRSession} The animation context.
49
+ */
50
+ getContext(): AnimationContext;
51
+ /**
52
+ * Defines the context in which `requestAnimationFrame()` is executed.
53
+ *
54
+ * @param {Window|XRSession} context - The context to set.
55
+ */
17
56
  setContext(context: AnimationContext): void;
57
+ /**
58
+ * Frees all internal resources and stops the animation loop.
59
+ */
18
60
  dispose(): void;
19
61
  }
20
62
  export default Animation;