@types/three 0.165.0 → 0.166.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 (79) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/exporters/GLTFExporter.d.ts +6 -0
  3. three/examples/jsm/geometries/TeapotGeometry.d.ts +24 -0
  4. three/examples/jsm/helpers/ViewHelper.d.ts +8 -6
  5. three/examples/jsm/lines/LineMaterial.d.ts +2 -4
  6. three/examples/jsm/loaders/DDSLoader.d.ts +8 -2
  7. three/examples/jsm/loaders/GLTFLoader.d.ts +3 -1
  8. three/examples/jsm/loaders/KTXLoader.d.ts +8 -2
  9. three/examples/jsm/loaders/PVRLoader.d.ts +2 -2
  10. three/examples/jsm/nodes/Nodes.d.ts +10 -3
  11. three/examples/jsm/nodes/accessors/BufferAttributeNode.d.ts +1 -0
  12. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +7 -0
  13. three/examples/jsm/nodes/accessors/StorageTextureNode.d.ts +40 -0
  14. three/examples/jsm/nodes/core/CacheNode.d.ts +4 -5
  15. three/examples/jsm/nodes/core/LightingModel.d.ts +11 -0
  16. three/examples/jsm/nodes/core/Node.d.ts +3 -0
  17. three/examples/jsm/nodes/core/NodeBuilder.d.ts +7 -3
  18. three/examples/jsm/nodes/core/NodeCache.d.ts +12 -4
  19. three/examples/jsm/nodes/core/NodeFunction.d.ts +2 -2
  20. three/examples/jsm/nodes/core/NodeUniform.d.ts +1 -1
  21. three/examples/jsm/nodes/core/UniformNode.d.ts +2 -0
  22. three/examples/jsm/nodes/core/VarNode.d.ts +2 -0
  23. three/examples/jsm/nodes/display/DepthOfFieldNode.d.ts +30 -0
  24. three/examples/jsm/nodes/display/DotScreenNode.d.ts +32 -0
  25. three/examples/jsm/nodes/display/PassNode.d.ts +1 -1
  26. three/examples/jsm/nodes/display/RGBShiftNode.d.ts +24 -0
  27. three/examples/jsm/nodes/display/SobelOperatorNode.d.ts +17 -0
  28. three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +4 -6
  29. three/examples/jsm/nodes/functions/BSDF/LTC.d.ts +9 -0
  30. three/examples/jsm/nodes/lighting/RectAreaLightNode.d.ts +10 -0
  31. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +2 -3
  32. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +17 -18
  33. three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +6 -7
  34. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +3 -4
  35. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +32 -33
  36. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +2 -3
  37. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +1 -0
  38. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +230 -0
  39. three/examples/jsm/nodes/math/MathNode.d.ts +5 -1
  40. three/examples/jsm/nodes/utils/DiscardNode.d.ts +1 -0
  41. three/examples/jsm/renderers/common/BindGroup.d.ts +9 -0
  42. three/examples/jsm/renderers/common/Bindings.d.ts +11 -14
  43. three/examples/jsm/renderers/common/Geometries.d.ts +3 -3
  44. three/examples/jsm/renderers/common/Info.d.ts +6 -1
  45. three/examples/jsm/renderers/common/PostProcessing.d.ts +2 -0
  46. three/examples/jsm/renderers/common/RenderObject.d.ts +3 -3
  47. three/examples/jsm/renderers/common/Renderer.d.ts +11 -0
  48. three/examples/jsm/renderers/common/SampledTexture.d.ts +27 -0
  49. three/examples/jsm/renderers/common/Sampler.d.ts +11 -0
  50. three/examples/jsm/renderers/common/Uniform.d.ts +3 -3
  51. three/examples/jsm/renderers/common/UniformsGroup.d.ts +4 -2
  52. three/examples/jsm/renderers/common/nodes/NodeBuilderState.d.ts +8 -4
  53. three/examples/jsm/renderers/common/nodes/NodeSampledTexture.d.ts +29 -0
  54. three/examples/jsm/renderers/common/nodes/NodeSampler.d.ts +12 -0
  55. three/examples/jsm/renderers/common/nodes/NodeUniform.d.ts +4 -4
  56. three/examples/jsm/renderers/common/nodes/NodeUniformsGroup.d.ts +0 -1
  57. three/examples/jsm/renderers/common/nodes/Nodes.d.ts +1 -0
  58. three/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +123 -0
  59. three/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +6 -0
  60. three/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.d.ts +6 -0
  61. three/examples/jsm/renderers/webgpu/utils/WebGPUConstants.d.ts +328 -0
  62. three/package.json +4 -4
  63. three/src/Three.d.ts +1 -0
  64. three/src/constants.d.ts +6 -0
  65. three/src/extras/ShapeUtils.d.ts +5 -8
  66. three/src/extras/TextureUtils.d.ts +42 -0
  67. three/src/lights/LightShadow.d.ts +5 -0
  68. three/src/materials/Material.d.ts +21 -12
  69. three/src/math/Vector4.d.ts +6 -0
  70. three/src/objects/BatchedMesh.d.ts +58 -54
  71. three/src/renderers/shaders/UniformsLib.d.ts +3 -0
  72. three/src/renderers/webxr/WebXRDepthSensing.d.ts +2 -0
  73. three/src/renderers/webxr/WebXRManager.d.ts +33 -23
  74. three/src/textures/CompressedArrayTexture.d.ts +4 -4
  75. three/src/textures/CompressedTexture.d.ts +16 -8
  76. three/src/textures/Texture.d.ts +3 -1
  77. three/examples/jsm/renderers/webgl/nodes/SlotNode.d.ts +0 -17
  78. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +0 -37
  79. three/examples/jsm/renderers/webgl/nodes/WebGLNodes.d.ts +0 -3
three/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 31 May 2024 15:07:05 GMT
11
+ * Last updated: Fri, 28 Jun 2024 21:35:38 GMT
12
12
  * Dependencies: [@tweenjs/tween.js](https://npmjs.com/package/@tweenjs/tween.js), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr), [fflate](https://npmjs.com/package/fflate), [meshoptimizer](https://npmjs.com/package/meshoptimizer)
13
13
 
14
14
  # Credits
@@ -82,6 +82,12 @@ export class GLTFExporter {
82
82
  options?: GLTFExporterOptions,
83
83
  ): void;
84
84
 
85
+ /**
86
+ * Generates a .gltf (JSON) or .glb (binary) output from the input (Scenes or Objects).
87
+ *
88
+ * This is just like the {@link parse}() method, but instead of accepting callbacks it returns a promise that
89
+ * resolves with the result, and otherwise accepts the same options.
90
+ */
85
91
  parseAsync(
86
92
  input: Object3D | Object3D[],
87
93
  options?: GLTFExporterOptions,
@@ -1,6 +1,30 @@
1
1
  import { BufferGeometry } from "three";
2
2
 
3
+ /**
4
+ * {@link TeapotGeometry} tesselates the famous Utah teapot database by Martin Newell.
5
+ *
6
+ * {@link TeapotGeometry} is an add-on, and must be imported explicitly. See
7
+ * [Installation / Addons]{@link https://threejs.org/docs/#manual/en/introduction/Installation}.
8
+ *
9
+ * @example
10
+ * import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
11
+ *
12
+ * const geometry = new TeapotGeometry( 50, 18 );
13
+ * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
14
+ * const teapot = new THREE.Mesh( geometry, material );
15
+ * scene.add( teapot );
16
+ */
3
17
  export class TeapotGeometry extends BufferGeometry {
18
+ /**
19
+ * @param size Relative scale of the teapot. Optional; Defaults to `50`.
20
+ * @param segments Number of line segments to subdivide each patch edge. Optional; Defaults to `10`.
21
+ * @param bottom Whether the bottom of the teapot is generated or not. Optional; Defaults to `true`.
22
+ * @param lid Whether the lid is generated or not. Optional; Defaults to `true`.
23
+ * @param body Whether the body is generated or not. Optional; Defaults to `true`.
24
+ * @param fitLid Whether the lid is slightly stretched to prevent gaps between the body and lid or not. Optional;
25
+ * Defaults to `true`.
26
+ * @param blinn Whether the teapot is scaled vertically for better aesthetics or not. Optional; Defaults to `true`.
27
+ */
4
28
  constructor(
5
29
  size?: number,
6
30
  segments?: number,
@@ -1,15 +1,17 @@
1
1
  import { Camera, Object3D, Vector3, WebGLRenderer } from "three";
2
2
 
3
3
  export class ViewHelper extends Object3D {
4
+ readonly isViewHelper: true;
5
+
4
6
  animating: boolean;
5
7
  center: Vector3;
6
8
 
7
- readonly isViewHelper: true;
9
+ render: (renderer: WebGLRenderer) => void;
10
+ handleClick: (event: MouseEvent) => boolean;
11
+ setLabels: (labelX?: string, labelY?: string, labelZ?: string) => void;
12
+ setLabelStyle: (font?: string, color?: string, radius?: number) => void;
13
+ update: (delta: number) => void;
14
+ dispose: () => void;
8
15
 
9
16
  constructor(camera: Camera, domElement: HTMLElement);
10
-
11
- render(renderer: WebGLRenderer): void;
12
- handleClick(event: MouseEvent): boolean;
13
- update(delta: number): void;
14
- dispose(): void;
15
17
  }
@@ -1,6 +1,6 @@
1
- import { Color, ColorRepresentation, MaterialParameters, ShaderMaterial, Vector2 } from "three";
1
+ import { Color, ColorRepresentation, ShaderMaterial, ShaderMaterialParameters, Vector2 } from "three";
2
2
 
3
- export interface LineMaterialParameters extends MaterialParameters {
3
+ export interface LineMaterialParameters extends ShaderMaterialParameters {
4
4
  alphaToCoverage?: boolean | undefined;
5
5
  color?: ColorRepresentation | undefined;
6
6
  dashed?: boolean | undefined;
@@ -8,9 +8,7 @@ export interface LineMaterialParameters extends MaterialParameters {
8
8
  dashSize?: number | undefined;
9
9
  dashOffset?: number | undefined;
10
10
  gapSize?: number | undefined;
11
- linewidth?: number | undefined;
12
11
  resolution?: Vector2 | undefined;
13
- wireframe?: boolean | undefined;
14
12
  worldUnits?: boolean | undefined;
15
13
  }
16
14
 
@@ -1,7 +1,13 @@
1
- import { CompressedPixelFormat, CompressedTextureLoader, LoadingManager, PixelFormat } from "three";
1
+ import {
2
+ CompressedPixelFormat,
3
+ CompressedTextureLoader,
4
+ CompressedTextureMipmap,
5
+ LoadingManager,
6
+ PixelFormat,
7
+ } from "three";
2
8
 
3
9
  export interface DDS {
4
- mipmaps: object[];
10
+ mipmaps: CompressedTextureMipmap[];
5
11
  width: number;
6
12
  height: number;
7
13
  format: PixelFormat | CompressedPixelFormat;
@@ -3,6 +3,7 @@ import {
3
3
  BufferAttribute,
4
4
  BufferGeometry,
5
5
  Camera,
6
+ ColorSpace,
6
7
  FileLoader,
7
8
  Group,
8
9
  ImageBitmapLoader,
@@ -112,7 +113,8 @@ export class GLTFParser {
112
113
  texCoord?: number | undefined;
113
114
  extensions?: any;
114
115
  },
115
- ) => Promise<void>;
116
+ colorSpace?: ColorSpace | undefined,
117
+ ) => Promise<Texture | null>;
116
118
  assignFinalMaterial: (object: Mesh) => void;
117
119
  getMaterialType: () => typeof MeshStandardMaterial;
118
120
  loadMaterial: (materialIndex: number) => Promise<Material>;
@@ -1,7 +1,13 @@
1
- import { CompressedPixelFormat, CompressedTextureLoader, LoadingManager, PixelFormat } from "three";
1
+ import {
2
+ CompressedPixelFormat,
3
+ CompressedTextureLoader,
4
+ CompressedTextureMipmap,
5
+ LoadingManager,
6
+ PixelFormat,
7
+ } from "three";
2
8
 
3
9
  export interface KTX {
4
- mipmaps: object[];
10
+ mipmaps: CompressedTextureMipmap[];
5
11
  width: number;
6
12
  height: number;
7
13
  format: PixelFormat | CompressedPixelFormat;
@@ -1,7 +1,7 @@
1
- import { CompressedPixelFormat, CompressedTextureLoader, LoadingManager } from "three";
1
+ import { CompressedPixelFormat, CompressedTextureLoader, CompressedTextureMipmap, LoadingManager } from "three";
2
2
 
3
3
  export interface PVR {
4
- mipmaps: object[];
4
+ mipmaps: CompressedTextureMipmap[];
5
5
  width: number;
6
6
  height: number;
7
7
  format: CompressedPixelFormat;
@@ -127,6 +127,7 @@ export {
127
127
  step,
128
128
  tan,
129
129
  transformDirection,
130
+ transpose,
130
131
  trunc,
131
132
  } from "./math/MathNode.js";
132
133
 
@@ -164,7 +165,7 @@ export { triNoise3D } from "./math/TriNoise3D.js";
164
165
  // utils
165
166
  export { default as ArrayElementNode } from "./utils/ArrayElementNode.js";
166
167
  export { default as ConvertNode } from "./utils/ConvertNode.js";
167
- export { default as DiscardNode, discard } from "./utils/DiscardNode.js";
168
+ export { default as DiscardNode, discard, Return } from "./utils/DiscardNode.js";
168
169
  export { default as EquirectUVNode, equirectUV } from "./utils/EquirectUVNode.js";
169
170
  export { default as JoinNode } from "./utils/JoinNode.js";
170
171
  export { default as MatcapUVNode, matcapUV } from "./utils/MatcapUVNode.js";
@@ -266,6 +267,7 @@ export * from "./accessors/ReflectVectorNode.js";
266
267
  export { default as RendererReferenceNode, rendererReference } from "./accessors/RendererReferenceNode.js";
267
268
  export { default as SkinningNode, skinning } from "./accessors/SkinningNode.js";
268
269
  export { default as StorageBufferNode, storage, storageObject } from "./accessors/StorageBufferNode.js";
270
+ export { default as StorageTextureNode, storageTexture, textureStore } from "./accessors/StorageTextureNode.js";
269
271
  export * from "./accessors/TangentNode.js";
270
272
  export { default as Texture3DNode, texture3D } from "./accessors/Texture3DNode.js";
271
273
  export { default as TextureBicubicNode, textureBicubic } from "./accessors/TextureBicubicNode.js";
@@ -297,19 +299,23 @@ export {
297
299
  linearTosRGB,
298
300
  sRGBToLinear,
299
301
  } from "./display/ColorSpaceNode.js";
302
+ export { default as DepthOfFieldNode, dof } from "./display/DepthOfFieldNode.js";
303
+ export { default as DotScreenNode, dotScreen } from "./display/DotScreenNode.js";
300
304
  export { default as FrontFacingNode, faceDirection, frontFacing } from "./display/FrontFacingNode.js";
301
305
  export { default as GaussianBlurNode, gaussianBlur } from "./display/GaussianBlurNode.js";
302
306
  export { default as NormalMapNode, normalMap } from "./display/NormalMapNode.js";
303
307
  export { default as PosterizeNode, posterize } from "./display/PosterizeNode.js";
308
+ export { default as RGBShiftNode, rgbShift } from "./display/RGBShiftNode.js";
309
+ export { default as SobelOperatorNode, sobel } from "./display/SobelOperatorNode.js";
304
310
  export { default as ToneMappingNode, toneMapping } from "./display/ToneMappingNode.js";
305
311
  export {
306
312
  default as ViewportDepthNode,
307
313
  depth,
308
- depthPixel,
309
- depthTexture,
314
+ linearDepth,
310
315
  orthographicDepthToViewZ,
311
316
  perspectiveDepthToViewZ,
312
317
  ViewportDepthNodeScope,
318
+ viewportLinearDepth,
313
319
  viewZToOrthographicDepth,
314
320
  viewZToPerspectiveDepth,
315
321
  } from "./display/ViewportDepthNode.js";
@@ -355,6 +361,7 @@ export { default as LightingContextNode, lightingContext } from "./lighting/Ligh
355
361
  export { default as LightingNode } from "./lighting/LightingNode.js";
356
362
  export { default as LightsNode, lights } from "./lighting/LightsNode.js";
357
363
  export { default as PointLightNode } from "./lighting/PointLightNode.js";
364
+ export { default as RectAreaLightNode } from "./lighting/RectAreaLightNode.js";
358
365
  export { default as SpotLightNode } from "./lighting/SpotLightNode.js";
359
366
 
360
367
  // pmrem
@@ -15,6 +15,7 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
15
15
  bufferStride?: number,
16
16
  bufferOffset?: number,
17
17
  );
18
+ getHash(builder: NodeBuilder): string;
18
19
  getNodeType(builder: NodeBuilder): string | null;
19
20
  setup(builder: NodeBuilder): void;
20
21
  generate(builder: NodeBuilder): string | null | undefined;
@@ -1,5 +1,6 @@
1
1
  import StorageBufferAttribute from "../../renderers/common/StorageBufferAttribute.js";
2
2
  import StorageInstancedBufferAttribute from "../../renderers/common/StorageInstancedBufferAttribute.js";
3
+ import { GPUBufferBindingType } from "../../renderers/webgpu/utils/WebGPUConstants.js";
3
4
  import { NodeOrType, NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
5
  import StorageArrayElementNode from "../utils/StoargeArrayElementNode.js";
5
6
  import BufferNode from "./BufferNode.js";
@@ -8,6 +9,8 @@ export default class StorageBufferNode extends BufferNode {
8
9
  readonly isStorageBufferNode: true;
9
10
  bufferObject: boolean;
10
11
 
12
+ access: GPUBufferBindingType;
13
+
11
14
  constructor(
12
15
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
13
16
  bufferType: string,
@@ -17,6 +20,10 @@ export default class StorageBufferNode extends BufferNode {
17
20
  element(indexNode: NodeRepresentation): ShaderNodeObject<StorageArrayElementNode>;
18
21
 
19
22
  setBufferObject(value: boolean): this;
23
+
24
+ setAccess(value: GPUBufferBindingType): this;
25
+
26
+ toReadOnly(): this;
20
27
  }
21
28
 
22
29
  export const storage: (
@@ -0,0 +1,40 @@
1
+ import { Texture } from "three";
2
+ import { GPUStorageTextureAccess } from "../../renderers/webgpu/utils/WebGPUConstants.js";
3
+ import Node from "../core/Node.js";
4
+ import NodeBuilder from "../core/NodeBuilder.js";
5
+ import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
6
+ import TextureNode from "./TextureNode.js";
7
+
8
+ export default class StorageTextureNode extends TextureNode {
9
+ storeNode: Node | null;
10
+
11
+ readonly isStorageTextureNode: true;
12
+
13
+ access: GPUStorageTextureAccess;
14
+
15
+ constructor(
16
+ value: Texture,
17
+ uvNode?: ShaderNodeObject<Node> | null,
18
+ storeNode?: Node | null,
19
+ );
20
+
21
+ setAccess(value: GPUStorageTextureAccess): this;
22
+
23
+ toReadOnly(): this;
24
+
25
+ toWriteOnly(): this;
26
+
27
+ generateStore(builder: NodeBuilder): void;
28
+ }
29
+
30
+ export const storageTexture: (
31
+ value: Texture,
32
+ uvNode?: NodeRepresentation,
33
+ storeNode?: NodeRepresentation,
34
+ ) => ShaderNodeObject<StorageTextureNode>;
35
+
36
+ export const textureStore: (
37
+ value: Texture,
38
+ uvNode?: NodeRepresentation,
39
+ storeNode?: NodeRepresentation,
40
+ ) => ShaderNodeObject<StorageTextureNode>;
@@ -3,19 +3,18 @@ import Node from "./Node.js";
3
3
  import NodeCache from "./NodeCache.js";
4
4
 
5
5
  export default class CacheNode extends Node {
6
- isCacheNode: true;
7
6
  node: Node;
8
- cache: NodeCache;
7
+ parent: boolean;
9
8
 
10
- constructor(node: Node, cache?: NodeCache);
9
+ readonly isCacheNode: true;
10
+
11
+ constructor(node: Node, parent?: boolean);
11
12
  }
12
13
 
13
14
  export const cache: (node: Node, cache?: NodeCache) => ShaderNodeObject<CacheNode>;
14
- export const globalCache: (node: Node) => ShaderNodeObject<CacheNode>;
15
15
 
16
16
  declare module "../shadernode/ShaderNode.js" {
17
17
  interface NodeElements {
18
18
  cache: typeof cache;
19
- globalCache: typeof globalCache;
20
19
  }
21
20
  }
@@ -16,6 +16,16 @@ export interface LightingModelDirectInput {
16
16
  shadowMask: Node;
17
17
  }
18
18
 
19
+ export interface LightingModelDirectRectAreaInput {
20
+ lightColor: Node;
21
+ lightPosition: Node;
22
+ halfWidth: Node;
23
+ halfHeight: Node;
24
+ reflectedLight: LightingModelReflectedLight;
25
+ ltc_1: Node;
26
+ ltc_2: Node;
27
+ }
28
+
19
29
  export interface LightingModelIndirectInput {
20
30
  radiance: Node;
21
31
  irradiance: Node;
@@ -31,6 +41,7 @@ export default class LightingModel {
31
41
  start(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
32
42
  finish(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
33
43
  direct(input: LightingModelDirectInput, stack: StackNode, builder: NodeBuilder): void;
44
+ directRectArea(input: LightingModelDirectRectAreaInput, stack: StackNode, builder: NodeBuilder): void;
34
45
  indirectDiffuse(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
35
46
  indirectSpecular(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
36
47
  ambientOcclusion(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
@@ -69,6 +69,7 @@ declare class Node extends EventDispatcher<{
69
69
  nodeType: string | null;
70
70
  updateType: NodeUpdateType;
71
71
  updateBeforeType: NodeUpdateType;
72
+ updateAfterType: NodeUpdateType;
72
73
  uuid: string;
73
74
  version: number;
74
75
  _cacheKey: string | null;
@@ -95,6 +96,7 @@ declare class Node extends EventDispatcher<{
95
96
  getHash(builder: NodeBuilder): string;
96
97
  getUpdateType(): NodeUpdateType;
97
98
  getUpdateBeforeType(): NodeUpdateType;
99
+ getUpdateAfterType(): NodeUpdateType;
98
100
  getElementType(builder: NodeBuilder): "bool" | "int" | "float" | "vec2" | "vec3" | "vec4" | "uint" | null;
99
101
  getNodeType(builder: NodeBuilder): string | null;
100
102
  getShared(builder: NodeBuilder): Node;
@@ -104,6 +106,7 @@ declare class Node extends EventDispatcher<{
104
106
  analyze(builder: NodeBuilder): void;
105
107
  generate(builder: NodeBuilder, output?: string | null): string | null | undefined;
106
108
  updateBefore(frame: NodeFrame): void;
109
+ updateAfter(frame: NodeFrame): void;
107
110
  update(frame: NodeFrame): void;
108
111
  build(builder: NodeBuilder, output?: string | null): string | null;
109
112
  getSerializeChildren(): Generator<import("./NodeUtils.js").NodeChild, void, unknown>;
@@ -1,4 +1,4 @@
1
- import { BufferGeometry, Material, Object3D, Renderer } from "three";
1
+ import { BufferGeometry, Material, Object3D, Renderer, Texture } from "three";
2
2
  import FogNode from "../fog/FogNode.js";
3
3
  import LightsNode from "../lighting/LightsNode.js";
4
4
  import { NodeShaderStage } from "./constants.js";
@@ -58,6 +58,7 @@ export default abstract class NodeBuilder {
58
58
  setHashNode(node: Node, hash: string): void;
59
59
  addNode(node: Node): void;
60
60
  get currentNode(): Node;
61
+ isFilteredTexture(texture: Texture): boolean;
61
62
  getMethod(method: string): string;
62
63
  getNodeFromHash(hash: string): Node;
63
64
 
@@ -65,6 +66,9 @@ export default abstract class NodeBuilder {
65
66
 
66
67
  setContext(context: NodeBuilderContext): void;
67
68
  getContext(): NodeBuilderContext;
69
+ setCache(cache: NodeCache): void;
70
+ getCache(): NodeCache;
71
+ getCacheFromNode(node: Node, parent?: boolean): NodeCache;
68
72
  isAvailable(name: string): boolean;
69
73
 
70
74
  abstract getInstanceIndex(): string;
@@ -83,7 +87,7 @@ export default abstract class NodeBuilder {
83
87
 
84
88
  getAttribute(name: string, type: string): NodeAttribute;
85
89
 
86
- getPropertyName(node: Node, shaderStage: NodeShaderStage): string;
90
+ getPropertyName<TValue>(node: NodeVar | NodeUniform<TValue>, shaderStage: NodeShaderStage): string;
87
91
  isVector(type: string): boolean;
88
92
 
89
93
  isMatrix(type: string): boolean;
@@ -117,7 +121,7 @@ export default abstract class NodeBuilder {
117
121
  ): FlowData;
118
122
  hasGeometryAttribute(name: string): boolean;
119
123
  abstract getAttributes(shaderStage: NodeShaderStage): string;
120
- abstract getVarys(shaderStage: NodeShaderStage): string;
124
+ abstract getVaryings(shaderStage: NodeShaderStage): string;
121
125
  getVars(shaderStage: NodeShaderStage): string;
122
126
  abstract getUniforms(stage: NodeShaderStage): string;
123
127
  getCodes(shaderStage: NodeShaderStage): string;
@@ -1,3 +1,5 @@
1
+ import { BufferAttribute, InterleavedBuffer, TypedArray } from "three";
2
+ import BufferAttributeNode from "../accessors/BufferAttributeNode.js";
1
3
  import Node from "./Node.js";
2
4
  import NodeAttribute from "./NodeAttribute.js";
3
5
  import NodeCode from "./NodeCode.js";
@@ -33,11 +35,17 @@ interface NodeData {
33
35
  compute?: ShaderStageNodeData | undefined;
34
36
  any?: ShaderStageNodeData | undefined;
35
37
  }
38
+ interface BufferAttributeData {
39
+ node: BufferAttributeNode;
40
+ }
36
41
  declare class NodeCache {
37
42
  id: number;
38
- nodesData: WeakMap<Node, NodeData>;
39
- constructor();
40
- getNodeData(node: Node): NodeData | undefined;
41
- setNodeData(node: Node, data: NodeData): void;
43
+ nodesData: WeakMap<Node | TypedArray | InterleavedBuffer | BufferAttribute, NodeData | BufferAttributeData>;
44
+ parent: NodeCache | null;
45
+ constructor(parent?: NodeCache | null);
46
+ getData(node: Node): NodeData | undefined;
47
+ getData(node: TypedArray | InterleavedBuffer | BufferAttribute): BufferAttributeData | undefined;
48
+ setData(node: Node, data: NodeData): void;
49
+ setData(node: TypedArray | InterleavedBuffer | BufferAttribute, data: BufferAttributeData): void;
42
50
  }
43
51
  export default NodeCache;
@@ -5,9 +5,9 @@ export default abstract class NodeFunction {
5
5
  type: string;
6
6
  inputs: NodeFunctionInput[];
7
7
  name: string;
8
- presicion: string;
8
+ precision: string;
9
9
 
10
- constructor(type: string, inputs: NodeFunctionInput[], name?: string, presicion?: string);
10
+ constructor(type: string, inputs: NodeFunctionInput[], name?: string, precision?: string);
11
11
 
12
12
  abstract getCode(name?: string): string;
13
13
  }
@@ -5,7 +5,7 @@ declare class NodeUniform<TValue> {
5
5
  type: string | null;
6
6
  node: UniformNode<TValue>;
7
7
  needsUpdate: boolean | undefined;
8
- constructor(name: string, type: string | null, node: UniformNode<TValue>, needsUpdate?: undefined);
8
+ constructor(name: string, type: string | null, node: UniformNode<TValue>);
9
9
  get value(): TValue;
10
10
  set value(val: TValue);
11
11
  get id(): number;
@@ -6,8 +6,10 @@ import NodeFrame from "./NodeFrame.js";
6
6
  import UniformGroupNode from "./UniformGroupNode.js";
7
7
  declare class UniformNode<TValue> extends InputNode<TValue> {
8
8
  readonly isUniformNode: true;
9
+ name: string;
9
10
  groupNode: UniformGroupNode;
10
11
  constructor(value: TValue, nodeType?: string | null);
12
+ label(name: string): this;
11
13
  setGroup(group: UniformGroupNode): this;
12
14
  getGroup(): UniformGroupNode;
13
15
  getUniformHash(builder: NodeBuilder): string;
@@ -6,6 +6,8 @@ export default class VarNode extends Node {
6
6
  node: Node;
7
7
  name: string | null;
8
8
 
9
+ readonly isVarNode: true;
10
+
9
11
  constructor(node: Node, name?: string | null);
10
12
 
11
13
  op(op: OperatorNodeOp, ...params: Node[]): this;
@@ -0,0 +1,30 @@
1
+ import TextureNode from "../accessors/TextureNode.js";
2
+ import Node from "../core/Node.js";
3
+ import TempNode from "../core/TempNode.js";
4
+ import UniformNode from "../core/UniformNode.js";
5
+ import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
6
+
7
+ export default class DepthOfFieldNode extends TempNode {
8
+ textureNode: TextureNode;
9
+ viewZNode: Node;
10
+
11
+ focus: UniformNode<number>;
12
+ aperture: UniformNode<number>;
13
+ maxblur: UniformNode<number>;
14
+
15
+ constructor(textureNode: TextureNode, viewZNode: Node, focus?: number, aperture?: number, maxblur?: number);
16
+ }
17
+
18
+ export const dof: (
19
+ node: NodeRepresentation,
20
+ viewZNode: NodeRepresentation,
21
+ focus?: number,
22
+ aperture?: number,
23
+ maxblur?: number,
24
+ ) => ShaderNodeObject<DepthOfFieldNode>;
25
+
26
+ declare module "../shadernode/ShaderNode.js" {
27
+ interface NodeElements {
28
+ dof: typeof dof;
29
+ }
30
+ }
@@ -0,0 +1,32 @@
1
+ import { Vector2 } from "three";
2
+ import TextureNode from "../accessors/TextureNode.js";
3
+ import Node from "../core/Node.js";
4
+ import TempNode from "../core/TempNode.js";
5
+ import UniformNode from "../core/UniformNode.js";
6
+ import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
7
+
8
+ export default class DotScreenNode extends TempNode {
9
+ colorNode: Node;
10
+ center: UniformNode<Vector2>;
11
+ angle: UniformNode<number>;
12
+ scale: UniformNode<number>;
13
+
14
+ constructor(colorNode: Node, center?: Vector2, angle?: number, scale?: number);
15
+
16
+ getTextureNode(): ShaderNodeObject<TextureNode>;
17
+
18
+ setSize(width: number, height: number): void;
19
+ }
20
+
21
+ export const dotScreen: (
22
+ node: NodeRepresentation,
23
+ center?: Vector2,
24
+ angle?: number,
25
+ scale?: number,
26
+ ) => ShaderNodeObject<DotScreenNode>;
27
+
28
+ declare module "../shadernode/ShaderNode.js" {
29
+ interface NodeElements {
30
+ dotScreen: typeof dotScreen;
31
+ }
32
+ }
@@ -27,7 +27,7 @@ export default class PassNode extends TempNode {
27
27
 
28
28
  getViewZNode(): ShaderNodeObject<Node>;
29
29
 
30
- getDepthNode(): ShaderNodeObject<Node>;
30
+ getLinearDepthNode(): ShaderNodeObject<Node>;
31
31
 
32
32
  setSize(width: number, height: number): void;
33
33
 
@@ -0,0 +1,24 @@
1
+ import TextureNode from "../accessors/TextureNode.js";
2
+ import TempNode from "../core/TempNode.js";
3
+ import UniformNode from "../core/UniformNode.js";
4
+ import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
5
+
6
+ export default class RGBShiftNode extends TempNode {
7
+ textureNode: TextureNode;
8
+ amount: UniformNode<number>;
9
+ angle: UniformNode<number>;
10
+
11
+ constructor(textureNode: TextureNode, amount?: number, angle?: number);
12
+
13
+ getTextureNode(): TextureNode;
14
+
15
+ setSize(width: number, height: number): void;
16
+ }
17
+
18
+ export const rgbShift: (node: NodeRepresentation, amount?: number, angle?: number) => ShaderNodeObject<RGBShiftNode>;
19
+
20
+ declare module "../shadernode/ShaderNode.js" {
21
+ interface NodeElements {
22
+ rgbShift: typeof rgbShift;
23
+ }
24
+ }
@@ -0,0 +1,17 @@
1
+ import TextureNode from "../accessors/TextureNode.js";
2
+ import TempNode from "../core/TempNode.js";
3
+ import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
+
5
+ export default class SobelOperatorNode extends TempNode {
6
+ textureNode: TextureNode;
7
+
8
+ constructor(textureNode: TextureNode);
9
+ }
10
+
11
+ export const sobel: (node: NodeRepresentation) => ShaderNodeObject<SobelOperatorNode>;
12
+
13
+ declare module "../shadernode/ShaderNode.js" {
14
+ interface NodeElements {
15
+ sobel: typeof sobel;
16
+ }
17
+ }
@@ -10,14 +10,12 @@ export default class ViewportDepthNode extends Node {
10
10
  constructor(scope: ViewportDepthNodeScope, valueNode?: Node | null);
11
11
 
12
12
  static DEPTH: "depth";
13
- static DEPTH_TEXTURE: "depthTexture";
14
- static DEPTH_PIXEL: "depthPixel";
13
+ static LINEAR_DEPTH: "linearDepth";
15
14
  }
16
15
 
17
16
  export type ViewportDepthNodeScope =
18
17
  | typeof ViewportDepthNode.DEPTH
19
- | typeof ViewportDepthNode.DEPTH_TEXTURE
20
- | typeof ViewportDepthNode.DEPTH_PIXEL;
18
+ | typeof ViewportDepthNode.LINEAR_DEPTH;
21
19
 
22
20
  export const viewZToOrthographicDepth: (viewZ: Node, near: Node, far: Node) => Node;
23
21
 
@@ -28,5 +26,5 @@ export const viewZToPerspectiveDepth: (viewZ: Node, near: Node, far: Node) => No
28
26
  export const perspectiveDepthToViewZ: (depth: Node, near: Node, far: Node) => Node;
29
27
 
30
28
  export const depth: ShaderNodeObject<ViewportDepthNode>;
31
- export const depthTexture: (valueNode?: Node | null) => ShaderNodeObject<ViewportDepthNode>;
32
- export const depthPixel: ShaderNodeObject<ViewportDepthNode>;
29
+ export const linearDepth: (valueNode?: Node | null) => ShaderNodeObject<ViewportDepthNode>;
30
+ export const viewportLinearDepth: ShaderNodeObject<ViewportDepthNode>;
@@ -0,0 +1,9 @@
1
+ import Node from "../../core/Node.js";
2
+
3
+ declare const LTC_Uv: (args: { N: Node; V: Node; roughness: Node }) => Node;
4
+
5
+ declare const LTC_Evaluate: (
6
+ args: { N: Node; V: Node; P: Node; mInv: Node; p0: Node; p1: Node; p2: Node; p3: Node },
7
+ ) => Node;
8
+
9
+ export { LTC_Evaluate, LTC_Uv };
@@ -0,0 +1,10 @@
1
+ import { RectAreaLight } from "three";
2
+ import Node from "../core/Node.js";
3
+ import AnalyticLightNode from "./AnalyticLightNode.js";
4
+
5
+ export default class RectAreaLightNode extends AnalyticLightNode<RectAreaLight> {
6
+ halfHeight: Node;
7
+ halfWidth: Node;
8
+
9
+ constructor(light?: RectAreaLight | null);
10
+ }