@types/three 0.172.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 (72) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
  3. three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
  4. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
  5. three/examples/jsm/webxr/XRButton.d.ts +4 -2
  6. three/package.json +2 -2
  7. three/src/Three.Core.d.ts +2 -0
  8. three/src/Three.TSL.d.ts +9 -1
  9. three/src/animation/AnimationClip.d.ts +1 -1
  10. three/src/cameras/ArrayCamera.d.ts +7 -6
  11. three/src/cameras/Camera.d.ts +7 -7
  12. three/src/constants.d.ts +6 -0
  13. three/src/core/BufferAttribute.d.ts +5 -0
  14. three/src/materials/nodes/NodeMaterials.d.ts +0 -4
  15. three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
  16. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +1 -0
  17. three/src/math/Matrix4.d.ts +2 -1
  18. three/src/nodes/Nodes.d.ts +5 -1
  19. three/src/nodes/TSL.d.ts +4 -0
  20. three/src/nodes/accessors/Arrays.d.ts +9 -2
  21. three/src/nodes/accessors/BufferAttributeNode.d.ts +1 -1
  22. three/src/nodes/accessors/Camera.d.ts +1 -0
  23. three/src/nodes/accessors/MaterialNode.d.ts +3 -3
  24. three/src/nodes/accessors/StorageBufferNode.d.ts +7 -3
  25. three/src/nodes/core/ArrayNode.d.ts +26 -0
  26. three/src/nodes/core/Node.d.ts +9 -1
  27. three/src/nodes/core/NodeCache.d.ts +2 -1
  28. three/src/nodes/core/NodeVar.d.ts +6 -2
  29. three/src/nodes/core/StructNode.d.ts +21 -0
  30. three/src/nodes/core/StructType.d.ts +8 -0
  31. three/src/nodes/core/StructTypeNode.d.ts +33 -14
  32. three/src/nodes/core/VarNode.d.ts +8 -1
  33. three/src/nodes/core/VaryingNode.d.ts +9 -0
  34. three/src/nodes/geometry/RangeNode.d.ts +6 -11
  35. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
  36. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
  37. three/src/nodes/math/MathNode.d.ts +2 -0
  38. three/src/nodes/math/OperatorNode.d.ts +2 -0
  39. three/src/nodes/shapes/Shapes.d.ts +4 -0
  40. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  41. three/src/nodes/tsl/TSLCore.d.ts +16 -3
  42. three/src/nodes/utils/MemberNode.d.ts +11 -0
  43. three/src/objects/BatchedMesh.d.ts +1 -0
  44. three/src/objects/InstancedMesh.d.ts +4 -3
  45. three/src/renderers/WebGLRenderer.d.ts +2 -2
  46. three/src/renderers/common/Animation.d.ts +13 -1
  47. three/src/renderers/common/BufferUtils.d.ts +1 -1
  48. three/src/renderers/common/BundleGroup.d.ts +1 -1
  49. three/src/renderers/common/ChainMap.d.ts +5 -5
  50. three/src/renderers/common/Color4.d.ts +7 -3
  51. three/src/renderers/common/Info.d.ts +0 -11
  52. three/src/renderers/common/Pipelines.d.ts +2 -2
  53. three/src/renderers/common/PostProcessing.d.ts +1 -1
  54. three/src/renderers/common/RenderContext.d.ts +6 -4
  55. three/src/renderers/common/RenderContexts.d.ts +14 -22
  56. three/src/renderers/common/RenderList.d.ts +2 -2
  57. three/src/renderers/common/RenderObject.d.ts +16 -8
  58. three/src/renderers/common/Renderer.d.ts +26 -9
  59. three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
  60. three/src/renderers/common/Uniform.d.ts +27 -1
  61. three/src/renderers/common/XRManager.d.ts +196 -0
  62. three/src/renderers/common/XRRenderTarget.d.ts +23 -0
  63. three/src/renderers/common/nodes/NodeBuilderState.d.ts +3 -3
  64. three/src/renderers/common/nodes/NodeLibrary.d.ts +3 -3
  65. three/src/renderers/common/nodes/NodeUniform.d.ts +31 -0
  66. three/src/renderers/common/nodes/Nodes.d.ts +8 -7
  67. three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
  68. three/src/textures/Texture.d.ts +2 -5
  69. three/src/textures/VideoFrameTexture.d.ts +27 -0
  70. three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +0 -13
  71. three/examples/jsm/objects/InstancedPoints.d.ts +0 -10
  72. three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
@@ -1,27 +1,46 @@
1
1
  import Node from "./Node.js";
2
+ import NodeBuilder from "./NodeBuilder.js";
3
+ /** @module StructTypeNode **/
4
+ export interface MembersLayout {
5
+ [name: string]: string | {
6
+ type: string;
7
+ atomic?: boolean;
8
+ };
9
+ }
10
+ export interface MemberLayout {
11
+ name: string;
12
+ type: string;
13
+ atomic: boolean;
14
+ }
2
15
  /**
3
- * {@link NodeBuilder} is going to create instances of this class during the build process
4
- * of nodes. They represent the final shader struct data that are going to be generated
5
- * by the builder. A dictionary of struct types is maintained in {@link NodeBuilder#structs}
6
- * for this purpose.
16
+ * Represents a struct type node in the node-based system.
17
+ * This class is used to define and manage the layout and types of struct members.
18
+ * It extends the base Node class and provides methods to get the length of the struct,
19
+ * retrieve member types, and generate the struct type for a builder.
20
+ *
21
+ * @augments Node
7
22
  */
8
23
  declare class StructTypeNode extends Node {
9
24
  static get type(): string;
10
- name: string;
11
- types: string[];
12
- readonly isStructTypeNode: true;
25
+ membersLayout: MemberLayout[];
26
+ name: string | null;
27
+ readonly isStructLayoutNode: true;
13
28
  /**
14
- * Constructs a new struct type node.
29
+ * Creates an instance of StructTypeNode.
15
30
  *
16
- * @param {String} name - The name of the struct.
17
- * @param {Array<String>} types - An array of types.
31
+ * @param {Object} membersLayout - The layout of the members for the struct.
32
+ * @param {string} [name=null] - The optional name of the struct.
18
33
  */
19
- constructor(name: string, types: string[]);
34
+ constructor(membersLayout: MembersLayout, name?: string | null);
20
35
  /**
21
- * Returns the member types.
36
+ * Returns the length of the struct.
37
+ * The length is calculated by summing the lengths of the struct's members.
22
38
  *
23
- * @return {Array<String>} The types.
39
+ * @returns {Number} The length of the struct.
24
40
  */
25
- getMemberTypes(): string[];
41
+ getLength(): number;
42
+ getMemberType(builder: NodeBuilder, name: string): string;
43
+ getNodeType(builder: NodeBuilder): string;
44
+ generate(builder: NodeBuilder): string;
26
45
  }
27
46
  export default StructTypeNode;
@@ -7,12 +7,19 @@ export default class VarNode extends Node {
7
7
 
8
8
  readonly isVarNode: true;
9
9
 
10
- constructor(node: Node, name?: string | null);
10
+ readOnly: boolean;
11
+
12
+ constructor(node: Node, name?: string | null, readOnly?: boolean);
11
13
  }
12
14
 
15
+ export const Var: (node: Node, name?: string | null) => ShaderNodeObject<VarNode>;
16
+
17
+ export const Const: (node: Node, name?: string | null) => ShaderNodeObject<VarNode>;
18
+
13
19
  declare module "../tsl/TSLCore.js" {
14
20
  interface NodeElements {
15
21
  toVar: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
22
+ toConst: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
16
23
  }
17
24
  }
18
25
 
@@ -18,7 +18,16 @@ export const vertexStage: (node: NodeRepresentation) => ShaderNodeObject<Varying
18
18
 
19
19
  declare module "../tsl/TSLCore.js" {
20
20
  interface NodeElements {
21
+ toVarying: typeof varying;
22
+ toVertexStage: typeof vertexStage;
23
+
24
+ /**
25
+ * @deprecated .varying() has been renamed to .toVarying().
26
+ */
21
27
  varying: typeof varying;
28
+ /**
29
+ * @deprecated .vertexStage() has been renamed to .toVertexStage().
30
+ */
22
31
  vertexStage: typeof vertexStage;
23
32
  }
24
33
  }
@@ -1,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>;
@@ -122,6 +122,8 @@ export default class MathNode extends TempNode {
122
122
  bNode: Node | null;
123
123
  cNode: Node | null;
124
124
 
125
+ readonly isMathNode: true;
126
+
125
127
  constructor(method: MathNodeMethod1, aNode: Node);
126
128
  constructor(method: MathNodeMethod2, aNode: Node, bNode: Node);
127
129
  constructor(method: MathNodeMethod3, aNode: Node, bNode: Node, cNode: Node);
@@ -28,6 +28,8 @@ export default class OperatorNode extends TempNode {
28
28
  bNode: Node;
29
29
  op: OperatorNodeOp;
30
30
 
31
+ readonly isOperatorNode: true;
32
+
31
33
  constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]);
32
34
  }
33
35
 
@@ -0,0 +1,4 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const shapeCircle: (coord?: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -1,6 +1,7 @@
1
1
  export * from "../accessors/BufferAttributeNode.js";
2
2
  export * from "../code/ExpressionNode.js";
3
3
  export * from "../code/FunctionCallNode.js";
4
+ export * from "../core/ArrayNode.js";
4
5
  export * from "../core/AssignNode.js";
5
6
  export * from "../core/BypassNode.js";
6
7
  export * from "../core/CacheNode.js";
@@ -1,7 +1,10 @@
1
+ import { Color, ColorRepresentation } from "../../math/Color.js";
2
+ import { Vector3 } from "../../math/Vector3.js";
1
3
  import ConstNode from "../core/ConstNode.js";
2
4
  import Node from "../core/Node.js";
3
5
  import NodeBuilder from "../core/NodeBuilder.js";
4
6
  import StackNode from "../core/StackNode.js";
7
+ import ConvertNode from "../utils/ConvertNode.js";
5
8
 
6
9
  export interface NodeElements {
7
10
  toGlobal: (node: Node) => Node;
@@ -84,7 +87,7 @@ export type ShaderNodeObject<T extends Node> =
84
87
  & Swizzable<T>;
85
88
 
86
89
  /** anything that can be passed to {@link nodeObject} and returns a proxy */
87
- export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | ShaderNodeObject<T>;
90
+ export type NodeRepresentation<T extends Node = Node> = number | boolean | Vector3 | Node | ShaderNodeObject<T>;
88
91
 
89
92
  /** anything that can be passed to {@link nodeObject} */
90
93
  export type NodeObjectOption = NodeRepresentation | string;
@@ -231,7 +234,11 @@ export function nodeImmutable<T>(
231
234
  interface Layout {
232
235
  name: string;
233
236
  type: string;
234
- inputs: { name: string; type: string }[];
237
+ inputs: {
238
+ name: string;
239
+ type: string;
240
+ qualifier?: "in" | "out" | "inout";
241
+ }[];
235
242
  }
236
243
 
237
244
  interface ShaderNodeFn<Args extends readonly unknown[]> {
@@ -274,7 +281,13 @@ export const If: (boolNode: Node, method: () => void) => StackNode;
274
281
 
275
282
  export function append(node: Node): Node;
276
283
 
277
- 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;
278
291
 
279
292
  export const float: ConvertType;
280
293
  export const int: ConvertType;
@@ -0,0 +1,11 @@
1
+ import Node from "../core/Node.js";
2
+
3
+ declare class MemberNode extends Node {
4
+ node: Node;
5
+ property: string;
6
+ readonly isMemberNode: true;
7
+
8
+ constructor(node: Node, property: string);
9
+ }
10
+
11
+ export default MemberNode;
@@ -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
  */
@@ -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
  */
@@ -278,12 +278,12 @@ export class WebGLRenderer {
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,6 +1,6 @@
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
  }
@@ -30,12 +30,24 @@ declare class Animation {
30
30
  * Stops the internal animation loop.
31
31
  */
32
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;
33
39
  /**
34
40
  * Defines the user-level animation loop.
35
41
  *
36
42
  * @param {Function} callback - The animation loop.
37
43
  */
38
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;
39
51
  /**
40
52
  * Defines the context in which `requestAnimationFrame()` is executed.
41
53
  *
@@ -1,7 +1,7 @@
1
1
  /** @module BufferUtils **/
2
2
  /**
3
3
  * This function is usually called with the length in bytes of an array buffer.
4
- * It returns an padded value whic ensure chunk size alignment according to STD140 layout.
4
+ * It returns an padded value which ensure chunk size alignment according to STD140 layout.
5
5
  *
6
6
  * @function
7
7
  * @param {Number} floatLength - The buffer length.
@@ -1,6 +1,6 @@
1
1
  import { Group } from "../../objects/Group.js";
2
2
  /**
3
- * A specialized group which eanbles applications access to the
3
+ * A specialized group which enables applications access to the
4
4
  * Render Bundle API of WebGPU. The group with all its descendant nodes
5
5
  * are considered as one render bundle and processed as such by
6
6
  * the renderer.
@@ -3,14 +3,14 @@ type RecursiveWeakMap<K extends readonly object[], V> = WeakMap<K[number], V | R
3
3
  * Data structure for the renderer. It allows defining values
4
4
  * with chained, hierarchical keys. Keys are meant to be
5
5
  * objects since the module internally works with Weak Maps
6
- * for perforamnce reasons.
6
+ * for performance reasons.
7
7
  *
8
8
  * @private
9
9
  */
10
- export default class ChainMap<K extends readonly object[], V> {
10
+ declare class ChainMap<K extends readonly object[], V> {
11
11
  weakMap: RecursiveWeakMap<K, V>;
12
12
  /**
13
- * Constructs a new chained map.
13
+ * Constructs a new Chain Map.
14
14
  */
15
15
  constructor();
16
16
  /**
@@ -25,7 +25,7 @@ export default class ChainMap<K extends readonly object[], V> {
25
25
  *
26
26
  * @param {Array<Object>} keys - List of keys.
27
27
  * @param {Any} value - The value to set.
28
- * @return {ChainMap} A reference to this chain map.
28
+ * @return {ChainMap} A reference to this Chain Map.
29
29
  */
30
30
  set(keys: K, value: V): this;
31
31
  /**
@@ -36,4 +36,4 @@ export default class ChainMap<K extends readonly object[], V> {
36
36
  */
37
37
  delete(keys: K): boolean;
38
38
  }
39
- export {};
39
+ export default ChainMap;
@@ -11,16 +11,20 @@ declare class Color4 extends Color {
11
11
  a: number;
12
12
  /**
13
13
  * Constructs a new four-component color.
14
+ * You can also pass a single THREE.Color, hex or
15
+ * string argument to this constructor.
14
16
  *
15
- * @param {Number|String} r - The red value.
16
- * @param {Number} g - The green value.
17
- * @param {Number} b - The blue value.
17
+ * @param {Number|String} [r=1] - The red value.
18
+ * @param {Number} [g=1] - The green value.
19
+ * @param {Number} [b=1] - The blue value.
18
20
  * @param {Number} [a=1] - The alpha value.
19
21
  */
20
22
  constructor(color?: ColorRepresentation);
21
23
  constructor(r: number, g: number, b: number, a?: number);
22
24
  /**
23
25
  * Overwrites the default to honor alpha.
26
+ * You can also pass a single THREE.Color, hex or
27
+ * string argument to this method.
24
28
  *
25
29
  * @param {Number|String} r - The red value.
26
30
  * @param {Number} g - The green value.
@@ -16,15 +16,11 @@ declare class Info {
16
16
  points: number;
17
17
  lines: number;
18
18
  timestamp: number;
19
- previousFrameCalls: number;
20
- timestampCalls: number;
21
19
  };
22
20
  compute: {
23
21
  calls: number;
24
22
  frameCalls: number;
25
23
  timestamp: number;
26
- previousFrameCalls: number;
27
- timestampCalls: number;
28
24
  };
29
25
  memory: {
30
26
  geometries: number;
@@ -42,13 +38,6 @@ declare class Info {
42
38
  * @param {Number} instanceCount - The instance count.
43
39
  */
44
40
  update(object: Object3D, count: number, instanceCount: number): void;
45
- /**
46
- * Used by async render methods to updated timestamp metrics.
47
- *
48
- * @param {('render'|'compute')} type - The type of render call.
49
- * @param {Number} time - The duration of the compute/render call in milliseconds.
50
- */
51
- updateTimestamp(type: "render" | "compute", time: number): void;
52
41
  /**
53
42
  * Resets frame related metrics.
54
43
  */
@@ -105,7 +105,7 @@ declare class Pipelines extends DataMap<{
105
105
  * @param {ProgrammableStage} stageVertex - The programmable stage representing the vertex shader.
106
106
  * @param {ProgrammableStage} stageFragment - The programmable stage representing the fragment shader.
107
107
  * @param {String} cacheKey - The cache key.
108
- * @param {Array} promises - An array of compilation promises which is only relevant in context of `Renderer.compileAsync()`.
108
+ * @param {Array<Promise>?} promises - An array of compilation promises which is only relevant in context of `Renderer.compileAsync()`.
109
109
  * @return {ComputePipeline} The compute pipeline.
110
110
  */
111
111
  _getRenderPipeline(
@@ -149,7 +149,7 @@ declare class Pipelines extends DataMap<{
149
149
  * Releases the shader program.
150
150
  *
151
151
  * @private
152
- * @param {Object} program - The shdaer program to release.
152
+ * @param {Object} program - The shader program to release.
153
153
  */
154
154
  _releaseProgram(program: ProgrammableStage): void;
155
155
  /**
@@ -13,7 +13,7 @@ declare class PostProcessing {
13
13
 
14
14
  render(): void;
15
15
 
16
- update(): void;
16
+ dispose(): void;
17
17
 
18
18
  renderAsync(): Promise<void>;
19
19
  }
@@ -31,19 +31,19 @@ declare class RenderContext {
31
31
  viewportValue: Vector4;
32
32
  scissor: boolean;
33
33
  scissorValue: Vector4;
34
+ renderTarget: RenderTarget | null;
34
35
  textures: Texture[] | null;
35
36
  depthTexture: DepthTexture | null;
36
37
  activeCubeFace: number;
37
38
  sampleCount: number;
38
39
  width: number;
39
40
  height: number;
41
+ occlusionQueryCount: number;
42
+ clippingContext: ClippingContext | null;
40
43
  readonly isRenderContext: true;
41
- clippingContext?: ClippingContext | undefined;
42
44
  depthClearValue?: number | undefined;
43
45
  stencilClearValue?: number | undefined;
44
- renderTarget?: RenderTarget | undefined;
45
46
  activeMipmapLevel?: number | undefined;
46
- occlusionQueryCount?: number | undefined;
47
47
  /**
48
48
  * Constructs a new render context.
49
49
  */
@@ -56,7 +56,9 @@ declare class RenderContext {
56
56
  getCacheKey(): number;
57
57
  }
58
58
  /**
59
- * Computes a cache key for the given render context.
59
+ * Computes a cache key for the given render context. This key
60
+ * should identify the render target state so it is possible to
61
+ * configure the correct attachments in the respective backend.
60
62
  *
61
63
  * @param {RenderContext} renderContext - The render context.
62
64
  * @return {Number} The cache key.
@@ -1,6 +1,6 @@
1
1
  import { Camera } from "../../cameras/Camera.js";
2
- import { Object3D } from "../../core/Object3D.js";
3
2
  import { RenderTarget } from "../../core/RenderTarget.js";
3
+ import { Scene } from "../../scenes/Scene.js";
4
4
  import ChainMap from "./ChainMap.js";
5
5
  import RenderContext from "./RenderContext.js";
6
6
  /**
@@ -10,15 +10,7 @@ import RenderContext from "./RenderContext.js";
10
10
  */
11
11
  declare class RenderContexts {
12
12
  chainMaps: {
13
- [attachmentState: string]:
14
- | ChainMap<
15
- | readonly [Object3D, Camera]
16
- | readonly [Object3D, Camera, {
17
- id: "default";
18
- }],
19
- RenderContext
20
- >
21
- | undefined;
13
+ [attachmentState: string]: ChainMap<readonly [Scene, Camera], RenderContext> | undefined;
22
14
  };
23
15
  /**
24
16
  * Constructs a new render context management component.
@@ -27,27 +19,27 @@ declare class RenderContexts {
27
19
  /**
28
20
  * Returns a render context for the given scene, camera and render target.
29
21
  *
30
- * @param {Scene?} [scene=null] - The scene. The parameter can become `null` e.g. when the renderer clears a render target.
31
- * @param {Camera?} [camera=null] - The camera that is used to render the scene. The parameter can become `null` e.g. when the renderer clears a render target.
22
+ * @param {Scene} scene - The scene.
23
+ * @param {Camera} camera - The camera that is used to render the scene.
32
24
  * @param {RenderTarget?} [renderTarget=null] - The active render target.
33
25
  * @return {RenderContext} The render context.
34
26
  */
35
- get(scene?: Object3D | null, camera?: Camera | null, renderTarget?: RenderTarget | null): RenderContext;
27
+ get(scene: Scene, camera: Camera, renderTarget?: RenderTarget | null): RenderContext;
28
+ /**
29
+ * Returns a render context intended for clear operations.
30
+ *
31
+ * @param {RenderTarget?} [renderTarget=null] - The active render target.
32
+ * @return {RenderContext} The render context.
33
+ */
34
+ getForClear(renderTarget?: RenderTarget | null): RenderContext;
36
35
  /**
37
36
  * Returns a chain map for the given attachment state.
38
37
  *
38
+ * @private
39
39
  * @param {String} attachmentState - The attachment state.
40
40
  * @return {ChainMap} The chain map.
41
41
  */
42
- getChainMap(
43
- attachmentState: string,
44
- ): ChainMap<
45
- | readonly [Object3D<import("../../core/Object3D.js").Object3DEventMap>, Camera]
46
- | readonly [Object3D<import("../../core/Object3D.js").Object3DEventMap>, Camera, {
47
- id: "default";
48
- }],
49
- RenderContext
50
- >;
42
+ _getChainMap(attachmentState: string): ChainMap<readonly [Scene, Camera], RenderContext>;
51
43
  /**
52
44
  * Frees internal resources.
53
45
  */
@@ -144,8 +144,8 @@ declare class RenderList {
144
144
  /**
145
145
  * Sorts the internal render lists.
146
146
  *
147
- * @param {Function} customOpaqueSort - A custom sort function for opaque objects.
148
- * @param {Function} customTransparentSort - A custom sort function for transparent objects.
147
+ * @param {function(Any, Any): Number} customOpaqueSort - A custom sort function for opaque objects.
148
+ * @param {function(Any, Any): Number} customTransparentSort - A custom sort function for transparent objects.
149
149
  */
150
150
  sort(
151
151
  customOpaqueSort: ((a: RenderItem, b: RenderItem) => number) | null,
@@ -35,7 +35,7 @@ import RenderPipeline from "./RenderPipeline.js";
35
35
  *
36
36
  * @private
37
37
  */
38
- export default class RenderObject {
38
+ declare class RenderObject {
39
39
  _nodes: Nodes;
40
40
  _geometries: Geometries;
41
41
  id: number;
@@ -121,7 +121,7 @@ export default class RenderObject {
121
121
  /**
122
122
  * Returns the node builder state of this render object.
123
123
  *
124
- * @return {NodeBuilderState} The node buider state.
124
+ * @return {NodeBuilderState} The node builder state.
125
125
  */
126
126
  getNodeBuilderState(): NodeBuilderState;
127
127
  /**
@@ -136,6 +136,13 @@ export default class RenderObject {
136
136
  * @return {Array<BindGroup>} The bindings.
137
137
  */
138
138
  getBindings(): BindGroup[];
139
+ /**
140
+ * Returns a binding group by group name of this render object.
141
+ *
142
+ * @param {String} name - The name of the binding group.
143
+ * @return {BindGroup?} The bindings.
144
+ */
145
+ getBindingGroup(name: string): BindGroup | undefined;
139
146
  /**
140
147
  * Returns the index of the render object's geometry.
141
148
  *
@@ -203,7 +210,7 @@ export default class RenderObject {
203
210
  *
204
211
  * The material cache key is part of the render object cache key.
205
212
  *
206
- * @return {String} The material cache key.
213
+ * @return {Number} The material cache key.
207
214
  */
208
215
  getMaterialCacheKey(): number;
209
216
  /**
@@ -224,7 +231,7 @@ export default class RenderObject {
224
231
  * `RenderObjects.get()`. The render object's NodeMaterialObserver is then used to detect
225
232
  * a need for a refresh due to material, geometry or object related value changes.
226
233
  *
227
- * TODO: Investigate if it's possible to merge boths steps so there is only a single place
234
+ * TODO: Investigate if it's possible to merge both steps so there is only a single place
228
235
  * that performs the 'needsUpdate' check.
229
236
  *
230
237
  * @type {Boolean}
@@ -234,17 +241,18 @@ export default class RenderObject {
234
241
  /**
235
242
  * Returns the dynamic cache key which represents a key that is computed per draw command.
236
243
  *
237
- * @return {String} The cache key.
244
+ * @return {Number} The cache key.
238
245
  */
239
- getDynamicCacheKey(): string;
246
+ getDynamicCacheKey(): number;
240
247
  /**
241
248
  * Returns the render object's cache key.
242
249
  *
243
- * @return {String} The cache key.
250
+ * @return {Number} The cache key.
244
251
  */
245
- getCacheKey(): string;
252
+ getCacheKey(): number;
246
253
  /**
247
254
  * Frees internal resources.
248
255
  */
249
256
  dispose(): void;
250
257
  }
258
+ export default RenderObject;