@types/three 0.168.0 → 0.169.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 (86) hide show
  1. three/README.md +1 -1
  2. three/build/three.webgpu.nodes.d.ts +1 -0
  3. three/build/three.webgpu.nodes.min.d.ts +1 -0
  4. three/examples/jsm/Addons.d.ts +0 -7
  5. three/examples/jsm/controls/DragControls.d.ts +0 -15
  6. three/examples/jsm/controls/TransformControls.d.ts +152 -25
  7. three/examples/jsm/exporters/EXRExporter.d.ts +7 -2
  8. three/examples/jsm/exporters/KTX2Exporter.d.ts +3 -1
  9. three/examples/jsm/helpers/LightProbeHelper.d.ts +5 -3
  10. three/examples/jsm/helpers/LightProbeHelperGPU.d.ts +12 -0
  11. three/examples/jsm/lights/LightProbeGenerator.d.ts +5 -1
  12. three/examples/jsm/lines/Line2.d.ts +15 -1
  13. three/examples/jsm/lines/LineGeometry.d.ts +18 -1
  14. three/examples/jsm/lines/LineMaterial.d.ts +65 -12
  15. three/examples/jsm/lines/LineSegments2.d.ts +25 -2
  16. three/examples/jsm/lines/LineSegmentsGeometry.d.ts +46 -9
  17. three/examples/jsm/loaders/DRACOLoader.d.ts +6 -0
  18. three/examples/jsm/modifiers/CurveModifier.d.ts +7 -3
  19. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +31 -0
  20. three/examples/jsm/objects/Lensflare.d.ts +13 -9
  21. three/examples/jsm/objects/LensflareMesh.d.ts +21 -0
  22. three/examples/jsm/utils/GeometryCompressionUtils.d.ts +20 -4
  23. three/examples/jsm/utils/ShadowMapViewer.d.ts +8 -6
  24. three/examples/jsm/utils/ShadowMapViewerGPU.d.ts +26 -0
  25. three/examples/jsm/utils/SkeletonUtils.d.ts +25 -5
  26. three/examples/jsm/utils/TextureUtilsGPU.d.ts +3 -0
  27. three/package.json +2 -2
  28. three/src/Three.WebGPU.Nodes.d.ts +201 -0
  29. three/src/Three.WebGPU.d.ts +2 -1
  30. three/src/audio/Audio.d.ts +4 -1
  31. three/src/core/BufferAttribute.d.ts +0 -15
  32. three/src/core/InterleavedBuffer.d.ts +0 -12
  33. three/src/core/Object3D.d.ts +1 -1
  34. three/src/core/Raycaster.d.ts +2 -1
  35. three/src/extras/Controls.d.ts +3 -3
  36. three/src/loaders/MaterialLoader.d.ts +2 -0
  37. three/src/loaders/nodes/NodeLoader.d.ts +5 -0
  38. three/src/loaders/nodes/NodeMaterialLoader.d.ts +3 -0
  39. three/src/loaders/nodes/NodeObjectLoader.d.ts +12 -0
  40. three/src/materials/nodes/NodeMaterial.d.ts +2 -4
  41. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +81 -0
  42. three/src/math/Quaternion.d.ts +4 -3
  43. three/src/math/Triangle.d.ts +24 -0
  44. three/src/nodes/Nodes.d.ts +2 -2
  45. three/src/nodes/TSL.d.ts +92 -186
  46. three/src/nodes/accessors/BufferAttributeNode.d.ts +1 -0
  47. three/src/nodes/accessors/MaterialNode.d.ts +0 -1
  48. three/src/nodes/accessors/ModelNode.d.ts +7 -3
  49. three/src/nodes/accessors/Normal.d.ts +6 -0
  50. three/src/nodes/accessors/Object3DNode.d.ts +1 -5
  51. three/src/nodes/accessors/VelocityNode.d.ts +2 -1
  52. three/src/nodes/core/Node.d.ts +3 -12
  53. three/src/nodes/core/NodeUtils.d.ts +5 -1
  54. three/src/nodes/core/StructTypeNode.d.ts +1 -0
  55. three/src/nodes/core/UniformNode.d.ts +1 -0
  56. three/src/nodes/display/ColorSpaceFunctions.d.ts +2 -2
  57. three/src/nodes/display/ColorSpaceNode.d.ts +26 -7
  58. three/src/nodes/display/ScreenNode.d.ts +48 -0
  59. three/src/nodes/display/ToneMappingFunctions.d.ts +6 -6
  60. three/src/nodes/display/ToonOutlinePassNode.d.ts +24 -0
  61. three/src/nodes/functions/material/getShIrradianceAt.d.ts +6 -0
  62. three/src/objects/BatchedMesh.d.ts +33 -0
  63. three/src/objects/Group.d.ts +0 -6
  64. three/src/objects/LOD.d.ts +7 -0
  65. three/src/renderers/WebGLRenderer.d.ts +2 -12
  66. three/src/renderers/common/BundleGroup.d.ts +10 -0
  67. three/src/renderers/common/ClippingContext.d.ts +1 -1
  68. three/src/renderers/common/RenderBundles.d.ts +3 -3
  69. three/src/renderers/common/RenderContext.d.ts +2 -2
  70. three/src/renderers/common/RenderList.d.ts +2 -1
  71. three/src/renderers/common/RenderObject.d.ts +19 -1
  72. three/src/renderers/common/Renderer.d.ts +8 -1
  73. three/src/renderers/common/nodes/NodeBuilderState.d.ts +3 -2
  74. three/src/renderers/common/nodes/Nodes.d.ts +8 -0
  75. three/src/renderers/webgl/WebGLCapabilities.d.ts +13 -0
  76. three/src/renderers/webgl/WebGLPrograms.d.ts +1 -0
  77. three/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts +12 -0
  78. three/src/renderers/webgpu/WebGPURenderer.d.ts +7 -3
  79. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +5 -0
  80. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +5 -0
  81. three/examples/jsm/geometries/SDFGeometryGenerator.d.ts +0 -16
  82. three/examples/jsm/loaders/TiltLoader.d.ts +0 -7
  83. three/examples/jsm/utils/GPUStatsPanel.d.ts +0 -12
  84. three/examples/jsm/utils/PackedPhongMaterial.d.ts +0 -10
  85. three/src/nodes/display/ViewportNode.d.ts +0 -38
  86. three/src/renderers/common/StandardRenderer.d.ts +0 -12
@@ -5,6 +5,7 @@ import NodeBuilder from "./NodeBuilder.js";
5
5
  import NodeFrame from "./NodeFrame.js";
6
6
  import UniformGroupNode from "./UniformGroupNode.js";
7
7
  declare class UniformNode<TValue> extends InputNode<TValue> {
8
+ static get type(): string;
8
9
  readonly isUniformNode: true;
9
10
  name: string;
10
11
  groupNode: UniformGroupNode;
@@ -1,6 +1,6 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const sRGBToLinear: (color: NodeRepresentation) => ShaderNodeObject<Node>;
4
+ export const sRGBToLinearSRGB: (color: NodeRepresentation) => ShaderNodeObject<Node>;
5
5
 
6
- export const LinearTosRGB: (color: NodeRepresentation) => ShaderNodeObject<Node>;
6
+ export const linearSRGBTosRGB: (color: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -1,35 +1,54 @@
1
1
  import { ColorSpace, LinearSRGBColorSpace, SRGBColorSpace } from "../../constants.js";
2
2
  import Node from "../core/Node.js";
3
+ import NodeBuilder from "../core/NodeBuilder.js";
3
4
  import TempNode from "../core/TempNode.js";
4
5
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
5
6
 
7
+ export type WorkingOrOutputColorSpace = "WorkingColorSpace" | "OutputColorSpace";
8
+
6
9
  export type ColorSpaceMethod = "LinearTosRGB" | "sRGBToLinear" | "LinearToLinear" | "sRGBTosRGB";
7
10
 
8
- export const getColorSpaceMethod: (
11
+ export function getColorSpaceMethod(
9
12
  source: typeof LinearSRGBColorSpace | typeof SRGBColorSpace,
10
13
  target: typeof LinearSRGBColorSpace | typeof SRGBColorSpace,
11
- ) => ColorSpaceMethod;
14
+ ): ColorSpaceMethod;
12
15
 
13
16
  export default class ColorSpaceNode extends TempNode {
14
17
  colorNode: Node;
15
- target: ColorSpace | null;
16
- source: ColorSpace | null;
18
+ source: WorkingOrOutputColorSpace | ColorSpace;
19
+ target: WorkingOrOutputColorSpace | ColorSpace;
20
+
21
+ constructor(
22
+ colorNode: Node,
23
+ source: WorkingOrOutputColorSpace | ColorSpace,
24
+ target: WorkingOrOutputColorSpace | ColorSpace,
25
+ );
17
26
 
18
- constructor(colorNode: Node, target?: ColorSpace | null, source?: ColorSpace | null);
27
+ getColorSpace(nodeBuilder: NodeBuilder, colorSpace: WorkingOrOutputColorSpace): ColorSpace;
19
28
  }
20
29
 
21
30
  export const toOutputColorSpace: (
22
31
  node: NodeRepresentation,
23
- colorSpace?: ColorSpace | null,
24
32
  ) => ShaderNodeObject<ColorSpaceNode>;
25
33
  export const toWorkingColorSpace: (
26
34
  node: NodeRepresentation,
27
- colorSpace?: ColorSpace | null,
35
+ ) => ShaderNodeObject<ColorSpaceNode>;
36
+
37
+ export const workingToColorSpace: (
38
+ node: NodeRepresentation,
39
+ colorSpace: ColorSpace,
40
+ ) => ShaderNodeObject<ColorSpaceNode>;
41
+ export const colorSpaceToWorking: (
42
+ node: NodeRepresentation,
43
+ colorSpace: ColorSpace,
28
44
  ) => ShaderNodeObject<ColorSpaceNode>;
29
45
 
30
46
  declare module "../tsl/TSLCore.js" {
31
47
  interface NodeElements {
32
48
  toOutputColorSpace: typeof toOutputColorSpace;
33
49
  toWorkingColorSpace: typeof toWorkingColorSpace;
50
+
51
+ workingToColorSpace: typeof workingToColorSpace;
52
+ colorSpaceToWorking: typeof colorSpaceToWorking;
34
53
  }
35
54
  }
@@ -0,0 +1,48 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export type ScreenNodeScope =
5
+ | typeof ScreenNode.COORDINATE
6
+ | typeof ScreenNode.VIEWPORT
7
+ | typeof ScreenNode.SIZE
8
+ | typeof ScreenNode.UV;
9
+
10
+ declare class ScreenNode extends Node {
11
+ scope: ScreenNodeScope;
12
+
13
+ readonly isViewportNode: true;
14
+
15
+ constructor(scope: ScreenNodeScope);
16
+
17
+ static COORDINATE: "coordinate";
18
+ static VIEWPORT: "viewport";
19
+ static SIZE: "size";
20
+ static UV: "uv";
21
+ }
22
+
23
+ export default ScreenNode;
24
+
25
+ // Screen
26
+
27
+ export const screenUV: ShaderNodeObject<ScreenNode>;
28
+ export const screenSize: ShaderNodeObject<ScreenNode>;
29
+ export const screenCoordinate: ShaderNodeObject<ScreenNode>;
30
+
31
+ // Viewport
32
+
33
+ export const viewport: ShaderNodeObject<ScreenNode>;
34
+ export const viewportSize: ShaderNodeObject<Node>;
35
+ export const viewportCoordinate: ShaderNodeObject<Node>;
36
+ export const viewportUV: ShaderNodeObject<Node>;
37
+
38
+ // Deprecated
39
+
40
+ /**
41
+ * @deprecated "viewportTopLeft" is deprecated. Use "viewportUV" instead.
42
+ */
43
+ export const viewportTopLeft: ShaderNodeObject<ScreenNode>;
44
+
45
+ /**
46
+ * @deprecated "viewportBottomLeft" is deprecated. Use "viewportUV.flipY()" instead.
47
+ */
48
+ export const viewportBottomLeft: ShaderNodeObject<ScreenNode>;
@@ -1,14 +1,14 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const LinearToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
4
+ export const linearToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
5
5
 
6
- export const ReinhardToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
6
+ export const reinhardToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
7
7
 
8
- export const CineonToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
8
+ export const cineonToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
9
9
 
10
- export const ACESFilmicToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
10
+ export const acesFilmicToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
11
11
 
12
- export const AgXToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
12
+ export const agxToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
13
13
 
14
- export const NeutralToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
14
+ export const neutralToneMapping: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -0,0 +1,24 @@
1
+ import { Camera } from "../../cameras/Camera.js";
2
+ import { Color } from "../../math/Color.js";
3
+ import { Scene } from "../../scenes/Scene.js";
4
+ import Node from "../core/Node.js";
5
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
6
+ import PassNode from "./PassNode.js";
7
+
8
+ declare class ToonOutlinePassNode extends PassNode {
9
+ colorNode: Node;
10
+ thicknessNode: Node;
11
+ alphaNode: Node;
12
+
13
+ constructor(scene: Scene, camera: Camera, colorNode: Node, thicknessNode: Node, alphaNode: Node);
14
+ }
15
+
16
+ export default ToonOutlinePassNode;
17
+
18
+ export const toonOutlinePass: (
19
+ scene: Scene,
20
+ camera: Camera,
21
+ color?: Color,
22
+ thickness?: number,
23
+ alpha?: number,
24
+ ) => ShaderNodeObject<ToonOutlinePassNode>;
@@ -0,0 +1,6 @@
1
+ import Node from "../../core/Node.js";
2
+ import { ShaderNodeObject } from "../../tsl/TSLCore.js";
3
+
4
+ declare const getShIrradianceAt: (normal: Node, shCoefficients: Node) => ShaderNodeObject<Node>;
5
+
6
+ export default getShIrradianceAt;
@@ -141,6 +141,25 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
141
141
  */
142
142
  getVisibleAt(instanceId: number): boolean;
143
143
 
144
+ /**
145
+ * Get the range representing the subset of triangles related to the attached geometry, indicating the starting
146
+ * offset and count, or `null` if invalid.
147
+ *
148
+ * Return an object of the form: { start: Integer, count: Integer }
149
+ * @param geometryId The id of the geometry to get the range of.
150
+ * @param target Optional target object to copy the range in to.
151
+ */
152
+ getGeometryRangeAt(
153
+ geometryId: number,
154
+ target?: { start: number; count: number },
155
+ ): { start: number; count: number } | null;
156
+
157
+ /**
158
+ * Get the geometryIndex of the defined instance.
159
+ * @param instanceId The id of an instance to get the geometryIndex of.
160
+ */
161
+ getGeometryIdAt(instanceId: number): number;
162
+
144
163
  /**
145
164
  * Sets the given color to the defined geometry instance.
146
165
  * @param instanceId The id of the instance to set the color of.
@@ -162,6 +181,13 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
162
181
  */
163
182
  setVisibleAt(instanceId: number, visible: boolean): this;
164
183
 
184
+ /**
185
+ * Sets the geometryIndex of the instance at the given index.
186
+ * @param instanceId The id of the instance to set the geometryIndex of.
187
+ * @param geometryId The geometryIndex to be use by the instance.
188
+ */
189
+ setGeometryIdAt(instanceId: number, geometryId: number): this;
190
+
165
191
  /**
166
192
  * Adds the given geometry to the {@link BatchedMesh} and returns the associated index referring to it.
167
193
  * @param geometry The geometry to add into the {@link BatchedMesh}.
@@ -182,6 +208,13 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
182
208
  */
183
209
  addInstance(geometryId: number): number;
184
210
 
211
+ /**
212
+ * Removes an existing instance from the BatchedMesh using the given instanceId.
213
+ * @param instanceId The id of an instance to remove from the BatchedMesh that was previously added via
214
+ * "addInstance".
215
+ */
216
+ deleteInstance(instanceId: number): this;
217
+
185
218
  /**
186
219
  * Replaces the geometry at `geometryId` with the provided geometry. Throws an error if there is not enough space
187
220
  * reserved for geometry. Calling this will change all instances that are rendering that geometry.
@@ -34,10 +34,4 @@ export class Group<TEventMap extends Object3DEventMap = Object3DEventMap> extend
34
34
  * @defaultValue `true`
35
35
  */
36
36
  readonly isGroup: true;
37
-
38
- /**
39
- * @override
40
- * @defaultValue `Group`
41
- */
42
- override readonly type: string | "Group";
43
37
  }
@@ -81,6 +81,13 @@ export class LOD<TEventMap extends Object3DEventMap = Object3DEventMap> extends
81
81
  */
82
82
  addLevel(object: Object3D, distance?: number, hysteresis?: number): this;
83
83
 
84
+ /**
85
+ * Removes an existing level, based on the distance from the camera. Returns `true` when the level has been removed.
86
+ * Otherwise `false`.
87
+ * @param distance Distance of the level to delete.
88
+ */
89
+ removeLabel(distance: number): boolean;
90
+
84
91
  /**
85
92
  * Get the currently active {@link LOD} level
86
93
  * @remarks
@@ -15,7 +15,7 @@ import { Scene } from "../scenes/Scene.js";
15
15
  import { Data3DTexture } from "../textures/Data3DTexture.js";
16
16
  import { DataArrayTexture } from "../textures/DataArrayTexture.js";
17
17
  import { OffscreenCanvas, Texture } from "../textures/Texture.js";
18
- import { WebGLCapabilities } from "./webgl/WebGLCapabilities.js";
18
+ import { WebGLCapabilities, WebGLCapabilitiesParameters } from "./webgl/WebGLCapabilities.js";
19
19
  import { WebGLExtensions } from "./webgl/WebGLExtensions.js";
20
20
  import { WebGLInfo } from "./webgl/WebGLInfo.js";
21
21
  import { WebGLProgram } from "./webgl/WebGLProgram.js";
@@ -33,7 +33,7 @@ export interface Renderer {
33
33
  setSize(width: number, height: number, updateStyle?: boolean): void;
34
34
  }
35
35
 
36
- export interface WebGLRendererParameters {
36
+ export interface WebGLRendererParameters extends WebGLCapabilitiesParameters {
37
37
  /**
38
38
  * A Canvas where the renderer draws its output.
39
39
  */
@@ -46,11 +46,6 @@ export interface WebGLRendererParameters {
46
46
  */
47
47
  context?: WebGLRenderingContext | undefined;
48
48
 
49
- /**
50
- * shader precision. Can be "highp", "mediump" or "lowp".
51
- */
52
- precision?: string | undefined;
53
-
54
49
  /**
55
50
  * default is false.
56
51
  */
@@ -86,11 +81,6 @@ export interface WebGLRendererParameters {
86
81
  */
87
82
  depth?: boolean | undefined;
88
83
 
89
- /**
90
- * default is false.
91
- */
92
- logarithmicDepthBuffer?: boolean | undefined;
93
-
94
84
  /**
95
85
  * default is false.
96
86
  */
@@ -0,0 +1,10 @@
1
+ import { Group } from "../../objects/Group.js";
2
+ declare class BundleGroup extends Group {
3
+ readonly isBundleGroup: true;
4
+ readonly type: string;
5
+ static: boolean;
6
+ version: number;
7
+ constructor();
8
+ set needsUpdate(value: boolean);
9
+ }
10
+ export default BundleGroup;
@@ -14,7 +14,7 @@ declare class ClippingContext {
14
14
  planes: Vector4[];
15
15
  parentVersion: number;
16
16
  viewNormalMatrix: Matrix3;
17
- cacheKey: string;
17
+ cacheKey: number;
18
18
  viewMatrix?: Matrix4 | undefined;
19
19
  constructor();
20
20
  projectPlanes(source: readonly Plane[], offset: number): void;
@@ -1,11 +1,11 @@
1
1
  import { Camera } from "../../cameras/Camera.js";
2
- import { Object3D } from "../../core/Object3D.js";
2
+ import BundleGroup from "./BundleGroup.js";
3
3
  import ChainMap from "./ChainMap.js";
4
4
  import RenderBundle from "./RenderBundle.js";
5
5
  declare class RenderBundles {
6
- lists: ChainMap<readonly [Object3D, Camera], RenderBundle>;
6
+ lists: ChainMap<readonly [BundleGroup, Camera], RenderBundle>;
7
7
  constructor();
8
- get(scene: Object3D, camera: Camera): RenderBundle;
8
+ get(scene: BundleGroup, camera: Camera): RenderBundle;
9
9
  dispose(): void;
10
10
  }
11
11
  export default RenderBundles;
@@ -37,7 +37,7 @@ declare class RenderContext {
37
37
  activeMipmapLevel?: number | undefined;
38
38
  occlusionQueryCount?: number | undefined;
39
39
  constructor();
40
- getCacheKey(): string;
40
+ getCacheKey(): number;
41
41
  }
42
- export declare function getCacheKey(renderContext: RenderContext): string;
42
+ export declare function getCacheKey(renderContext: RenderContext): number;
43
43
  export default RenderContext;
@@ -4,8 +4,9 @@ import { Object3D } from "../../core/Object3D.js";
4
4
  import { Light } from "../../lights/Light.js";
5
5
  import { Material } from "../../materials/Material.js";
6
6
  import { LightsNode } from "../../nodes/Nodes.js";
7
+ import BundleGroup from "./BundleGroup.js";
7
8
  export interface Bundle {
8
- object: Object3D;
9
+ bundleGroup: BundleGroup;
9
10
  camera: Camera;
10
11
  renderList: RenderList;
11
12
  }
@@ -5,9 +5,11 @@ import { InterleavedBuffer } from "../../core/InterleavedBuffer.js";
5
5
  import { InterleavedBufferAttribute } from "../../core/InterleavedBufferAttribute.js";
6
6
  import { Object3D } from "../../core/Object3D.js";
7
7
  import { Material } from "../../materials/Material.js";
8
+ import NodeMaterialObserver from "../../materials/nodes/manager/NodeMaterialObserver.js";
8
9
  import { LightsNode } from "../../nodes/Nodes.js";
9
10
  import { Scene } from "../../scenes/Scene.js";
10
11
  import BindGroup from "./BindGroup.js";
12
+ import BundleGroup from "./BundleGroup.js";
11
13
  import ClippingContext from "./ClippingContext.js";
12
14
  import Geometries from "./Geometries.js";
13
15
  import NodeBuilderState from "./nodes/NodeBuilderState.js";
@@ -35,12 +37,20 @@ export default class RenderObject {
35
37
  attributes: Array<BufferAttribute | InterleavedBufferAttribute> | null;
36
38
  pipeline: RenderPipeline | null;
37
39
  vertexBuffers: Array<BufferAttribute | InterleavedBuffer> | null;
40
+ drawParams: {
41
+ vertexCount: number;
42
+ firstVertex: number;
43
+ instanceCount: number;
44
+ firstInstance: number;
45
+ } | null;
46
+ bundle: BundleGroup | null;
38
47
  clippingContext: ClippingContext;
39
48
  clippingContextVersion: number;
40
49
  initialNodesCacheKey: string;
41
50
  initialCacheKey: string;
42
51
  _nodeBuilderState: NodeBuilderState | null;
43
52
  _bindings: BindGroup[] | null;
53
+ _monitor: NodeMaterialObserver | null;
44
54
  onDispose: (() => void) | null;
45
55
  readonly isRenderObject: true;
46
56
  onMaterialDispose: () => void;
@@ -58,6 +68,7 @@ export default class RenderObject {
58
68
  updateClipping(parent: ClippingContext): void;
59
69
  get clippingNeedsUpdate(): boolean;
60
70
  getNodeBuilderState(): NodeBuilderState;
71
+ getMonitor(): NodeMaterialObserver;
61
72
  getBindings(): BindGroup[];
62
73
  getIndex(): BufferAttribute | null;
63
74
  getChainArray(): readonly [
@@ -68,7 +79,14 @@ export default class RenderObject {
68
79
  ];
69
80
  getAttributes(): (InterleavedBufferAttribute | BufferAttribute)[];
70
81
  getVertexBuffers(): (InterleavedBuffer | BufferAttribute)[] | null;
71
- getMaterialCacheKey(): string;
82
+ getDrawParameters(): {
83
+ vertexCount: number;
84
+ firstVertex: number;
85
+ instanceCount: number;
86
+ firstInstance: number;
87
+ } | null;
88
+ getGeometryCacheKey(): string;
89
+ getMaterialCacheKey(): number;
72
90
  get needsUpdate(): boolean;
73
91
  getDynamicCacheKey(): string;
74
92
  getCacheKey(): string;
@@ -36,6 +36,12 @@ import RenderList, { Bundle, RenderItem } from "./RenderList.js";
36
36
  import RenderLists from "./RenderLists.js";
37
37
  import RenderObjects from "./RenderObjects.js";
38
38
  import Textures from "./Textures.js";
39
+ interface Rectangle {
40
+ x: number;
41
+ y: number;
42
+ z: number;
43
+ w: number;
44
+ }
39
45
  export interface RendererParameters {
40
46
  logarithmicDepthBuffer?: boolean | undefined;
41
47
  alpha?: boolean | undefined;
@@ -238,7 +244,7 @@ declare class Renderer {
238
244
  computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
239
245
  hasFeatureAsync(name: string): Promise<void>;
240
246
  hasFeature(name: string): false | void;
241
- copyFramebufferToTexture(framebufferTexture: FramebufferTexture): void;
247
+ copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: Rectangle | null): void;
242
248
  copyTextureToTexture(
243
249
  srcTexture: Texture,
244
250
  dstTexture: Texture,
@@ -253,6 +259,7 @@ declare class Renderer {
253
259
  width: number,
254
260
  height: number,
255
261
  index?: number,
262
+ faceIndex?: number,
256
263
  ): Promise<import("../../core/BufferAttribute.js").TypedArray>;
257
264
  _projectObject(object: Object3D, camera: Camera, groupOrder: number, renderList: RenderList): void;
258
265
  _renderBundles(bundles: Bundle[], sceneRef: Scene, lightsNode: LightsNode): void;
@@ -1,3 +1,4 @@
1
+ import NodeMaterialObserver from "../../../materials/nodes/manager/NodeMaterialObserver.js";
1
2
  import Node from "../../../nodes/core/Node.js";
2
3
  import NodeAttribute from "../../../nodes/core/NodeAttribute.js";
3
4
  import BindGroup from "../BindGroup.js";
@@ -11,7 +12,7 @@ declare class NodeBuilderState {
11
12
  updateNodes: Node[];
12
13
  updateBeforeNodes: Node[];
13
14
  updateAfterNodes: Node[];
14
- instanceBindGroups: boolean;
15
+ monitor: NodeMaterialObserver;
15
16
  usedTimes: number;
16
17
  constructor(
17
18
  vertexShader: string | null,
@@ -22,7 +23,7 @@ declare class NodeBuilderState {
22
23
  updateNodes: Node[],
23
24
  updateBeforeNodes: Node[],
24
25
  updateAfterNodes: Node[],
25
- instanceBindGroups?: boolean,
26
+ monitor: NodeMaterialObserver,
26
27
  transforms?: never[],
27
28
  );
28
29
  createBindings(): BindGroup[];
@@ -39,6 +39,13 @@ interface SceneData {
39
39
  environment?: Texture | undefined;
40
40
  environmentNode?: Node | undefined;
41
41
  }
42
+ declare module "../../../scenes/Scene.js" {
43
+ interface Scene {
44
+ environmentNode?: Node | null | undefined;
45
+ backgroundNode?: Node | null | undefined;
46
+ fogNode?: Node | null | undefined;
47
+ }
48
+ }
42
49
  declare class Nodes extends DataMap<{
43
50
  nodeUniformsGroup: {
44
51
  key: NodeUniformsGroup;
@@ -101,6 +108,7 @@ declare class Nodes extends DataMap<{
101
108
  updateAfter(renderObject: RenderObject): void;
102
109
  updateForCompute(computeNode: ComputeNode): void;
103
110
  updateForRender(renderObject: RenderObject): void;
111
+ needsRefresh(renderObject: RenderObject): boolean;
104
112
  dispose(): void;
105
113
  }
106
114
  export default Nodes;
@@ -1,8 +1,20 @@
1
1
  import { PixelFormat, TextureDataType } from "../../constants.js";
2
2
 
3
3
  export interface WebGLCapabilitiesParameters {
4
+ /**
5
+ * shader precision. Can be "highp", "mediump" or "lowp".
6
+ */
4
7
  precision?: string | undefined;
8
+
9
+ /**
10
+ * default is false.
11
+ */
5
12
  logarithmicDepthBuffer?: boolean | undefined;
13
+
14
+ /**
15
+ * default is false.
16
+ */
17
+ reverseDepthBuffer?: boolean | undefined;
6
18
  }
7
19
 
8
20
  export class WebGLCapabilities {
@@ -18,6 +30,7 @@ export class WebGLCapabilities {
18
30
 
19
31
  precision: string;
20
32
  logarithmicDepthBuffer: boolean;
33
+ reverseDepthBuffer: boolean;
21
34
 
22
35
  maxTextures: number;
23
36
  maxVertexTextures: number;
@@ -155,6 +155,7 @@ export interface WebGLProgramParameters {
155
155
 
156
156
  sizeAttenuation: boolean;
157
157
  logarithmicDepthBuffer: boolean;
158
+ reverseDepthBuffer: boolean;
158
159
 
159
160
  skinning: boolean;
160
161
 
@@ -0,0 +1,12 @@
1
+ import Renderer, { RendererParameters } from "../common/Renderer.js";
2
+ import { WebGPUBackendParameters } from "./WebGPUBackend.js";
3
+
4
+ export interface WebGPURendererParameters extends RendererParameters, WebGPUBackendParameters {
5
+ forceWebGL?: boolean | undefined;
6
+ }
7
+
8
+ export default class WebGPURenderer extends Renderer {
9
+ readonly isWebGPURenderer: true;
10
+
11
+ constructor(parameters?: WebGPURendererParameters);
12
+ }
@@ -1,10 +1,14 @@
1
- import StandardRenderer, { StandardRendererParameters } from "../common/StandardRenderer.js";
1
+ import Renderer, { RendererParameters } from "../common/Renderer.js";
2
2
  import { WebGPUBackendParameters } from "./WebGPUBackend.js";
3
3
 
4
- export interface WebGPURendererParameters extends StandardRendererParameters, WebGPUBackendParameters {
4
+ export interface WebGPURendererParameters extends RendererParameters, WebGPUBackendParameters {
5
5
  forceWebGL?: boolean | undefined;
6
6
  }
7
7
 
8
- export default class WebGPURenderer extends StandardRenderer {
8
+ declare class WebGPURenderer extends Renderer {
9
+ readonly isWebGPURenderer: true;
10
+
9
11
  constructor(parameters?: WebGPURendererParameters);
10
12
  }
13
+
14
+ export default WebGPURenderer;
@@ -0,0 +1,5 @@
1
+ import NodeLibrary from "../../common/nodes/NodeLibrary.js";
2
+ declare class BasicNodeLibrary extends NodeLibrary {
3
+ constructor();
4
+ }
5
+ export default BasicNodeLibrary;
@@ -0,0 +1,5 @@
1
+ import NodeLibrary from "../../common/nodes/NodeLibrary.js";
2
+ declare class StandardNodeLibrary extends NodeLibrary {
3
+ constructor();
4
+ }
5
+ export default StandardNodeLibrary;
@@ -1,16 +0,0 @@
1
- import { BufferGeometry, WebGLRenderer, WebGLRenderTarget } from "three";
2
-
3
- export class SDFGeometryGenerator {
4
- constructor(renderer: WebGLRenderer);
5
-
6
- generate(res?: number, distFunc?: string, bounds?: number): BufferGeometry;
7
-
8
- computeSDF(
9
- width: number,
10
- height: number,
11
- tilesX: number,
12
- tilesY: number,
13
- bounds: number,
14
- shader: string,
15
- ): WebGLRenderTarget;
16
- }
@@ -1,7 +0,0 @@
1
- import { Group, Loader, LoadingManager } from "three";
2
-
3
- export class TiltLoader extends Loader<Group> {
4
- constructor(manager?: LoadingManager);
5
-
6
- parse(data: ArrayBuffer): Group;
7
- }
@@ -1,12 +0,0 @@
1
- import Stats from "../libs/stats.module.js";
2
-
3
- export class GPUStatsPanel extends Stats.Panel {
4
- context: WebGLRenderingContext | WebGL2RenderingContext;
5
- extension: unknown;
6
- maxTime: number;
7
- activeQueries: number;
8
- startQuery: () => void;
9
- endQuery: () => void;
10
-
11
- constructor(context: WebGLRenderingContext | WebGL2RenderingContext, name?: string);
12
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * `PackedPhongMaterial` inherited from THREE.MeshPhongMaterial
3
- *
4
- * @param {Object} parameters
5
- */
6
- import { MeshPhongMaterial, MeshPhongMaterialParameters } from "three";
7
-
8
- export class PackedPhongMaterial extends MeshPhongMaterial {
9
- constructor(parameters: MeshPhongMaterialParameters);
10
- }