@types/three 0.164.1 → 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 (181) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/controls/TransformControls.d.ts +8 -6
  3. three/examples/jsm/exporters/GLTFExporter.d.ts +6 -0
  4. three/examples/jsm/exporters/USDZExporter.d.ts +4 -2
  5. three/examples/jsm/geometries/TeapotGeometry.d.ts +24 -0
  6. three/examples/jsm/helpers/ViewHelper.d.ts +8 -6
  7. three/examples/jsm/lines/LineMaterial.d.ts +2 -4
  8. three/examples/jsm/loaders/DDSLoader.d.ts +8 -2
  9. three/examples/jsm/loaders/FontLoader.d.ts +1 -1
  10. three/examples/jsm/loaders/GLTFLoader.d.ts +12 -7
  11. three/examples/jsm/loaders/KTXLoader.d.ts +8 -2
  12. three/examples/jsm/loaders/LDrawLoader.d.ts +1 -1
  13. three/examples/jsm/loaders/PVRLoader.d.ts +2 -2
  14. three/examples/jsm/modifiers/EdgeSplitModifier.d.ts +17 -10
  15. three/examples/jsm/nodes/Nodes.d.ts +21 -57
  16. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +4 -22
  17. three/examples/jsm/nodes/accessors/BufferAttributeNode.d.ts +50 -0
  18. three/examples/jsm/nodes/accessors/BufferNode.d.ts +3 -4
  19. three/examples/jsm/nodes/accessors/CameraNode.d.ts +11 -20
  20. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +1 -1
  21. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +4 -1
  22. three/examples/jsm/nodes/accessors/ModelNode.d.ts +3 -0
  23. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +1 -2
  24. three/examples/jsm/nodes/accessors/NormalNode.d.ts +9 -17
  25. three/examples/jsm/nodes/accessors/PositionNode.d.ts +6 -26
  26. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +3 -4
  27. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -8
  28. three/examples/jsm/nodes/accessors/RendererReferenceNode.d.ts +2 -3
  29. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +16 -4
  30. three/examples/jsm/nodes/accessors/StorageTextureNode.d.ts +40 -0
  31. three/examples/jsm/nodes/accessors/TangentNode.d.ts +8 -23
  32. three/examples/jsm/nodes/accessors/Texture3DNode.d.ts +16 -0
  33. three/examples/jsm/nodes/accessors/TextureNode.d.ts +1 -1
  34. three/examples/jsm/nodes/accessors/UVNode.d.ts +1 -8
  35. three/examples/jsm/nodes/accessors/UniformsNode.d.ts +0 -2
  36. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +4 -3
  37. three/examples/jsm/nodes/code/CodeNode.d.ts +0 -1
  38. three/examples/jsm/nodes/code/ExpressionNode.d.ts +2 -3
  39. three/examples/jsm/nodes/core/AttributeNode.d.ts +11 -4
  40. three/examples/jsm/nodes/core/CacheNode.d.ts +4 -5
  41. three/examples/jsm/nodes/core/ConstNode.d.ts +1 -2
  42. three/examples/jsm/nodes/core/InputNode.d.ts +1 -2
  43. three/examples/jsm/nodes/core/LightingModel.d.ts +11 -0
  44. three/examples/jsm/nodes/core/Node.d.ts +102 -42
  45. three/examples/jsm/nodes/core/NodeAttribute.d.ts +7 -4
  46. three/examples/jsm/nodes/core/NodeBuilder.d.ts +30 -26
  47. three/examples/jsm/nodes/core/NodeCache.d.ts +48 -6
  48. three/examples/jsm/nodes/core/NodeFunction.d.ts +2 -2
  49. three/examples/jsm/nodes/core/NodeKeywords.d.ts +10 -7
  50. three/examples/jsm/nodes/core/NodeParser.d.ts +4 -4
  51. three/examples/jsm/nodes/core/NodeUniform.d.ts +8 -11
  52. three/examples/jsm/nodes/core/NodeVar.d.ts +5 -4
  53. three/examples/jsm/nodes/core/NodeVarying.d.ts +5 -6
  54. three/examples/jsm/nodes/core/PropertyNode.d.ts +4 -4
  55. three/examples/jsm/nodes/core/StackNode.d.ts +7 -1
  56. three/examples/jsm/nodes/core/StructTypeNode.d.ts +8 -0
  57. three/examples/jsm/nodes/core/TempNode.d.ts +1 -2
  58. three/examples/jsm/nodes/core/UniformGroup.d.ts +7 -0
  59. three/examples/jsm/nodes/core/UniformGroupNode.d.ts +21 -0
  60. three/examples/jsm/nodes/core/UniformNode.d.ts +16 -11
  61. three/examples/jsm/nodes/core/VarNode.d.ts +2 -0
  62. three/examples/jsm/nodes/core/VaryingNode.d.ts +4 -0
  63. three/examples/jsm/nodes/core/constants.d.ts +27 -79
  64. three/examples/jsm/nodes/display/DepthOfFieldNode.d.ts +30 -0
  65. three/examples/jsm/nodes/display/DotScreenNode.d.ts +32 -0
  66. three/examples/jsm/nodes/display/PassNode.d.ts +1 -1
  67. three/examples/jsm/nodes/display/RGBShiftNode.d.ts +24 -0
  68. three/examples/jsm/nodes/display/SobelOperatorNode.d.ts +17 -0
  69. three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +4 -6
  70. three/examples/jsm/nodes/functions/BSDF/LTC.d.ts +9 -0
  71. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +2 -0
  72. three/examples/jsm/nodes/functions/ToonLightingModel.d.ts +4 -0
  73. three/examples/jsm/nodes/lighting/RectAreaLightNode.d.ts +10 -0
  74. three/examples/jsm/nodes/loaders/NodeLoader.d.ts +3 -3
  75. three/examples/jsm/nodes/loaders/NodeObjectLoader.d.ts +2 -3
  76. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +2 -0
  77. three/examples/jsm/nodes/materials/Materials.d.ts +3 -0
  78. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +5 -1
  79. three/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.d.ts +28 -0
  80. three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.d.ts +2 -0
  81. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +7 -4
  82. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +24 -17
  83. three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +6 -7
  84. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +8 -5
  85. three/examples/jsm/nodes/materials/MeshToonNodeMaterial.d.ts +38 -0
  86. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +41 -37
  87. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +1 -0
  88. three/examples/jsm/nodes/materials/ShadowNodeMaterial.d.ts +1 -0
  89. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +3 -3
  90. three/examples/jsm/nodes/materials/VolumeNodeMaterial.d.ts +10 -0
  91. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +1 -0
  92. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +230 -0
  93. three/examples/jsm/nodes/math/MathNode.d.ts +5 -1
  94. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +58 -36
  95. three/examples/jsm/nodes/utils/ConvertNode.d.ts +2 -3
  96. three/examples/jsm/nodes/utils/DiscardNode.d.ts +1 -0
  97. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +2 -2
  98. three/examples/jsm/nodes/utils/SplitNode.d.ts +1 -1
  99. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +4 -5
  100. three/examples/jsm/objects/Sky.d.ts +18 -0
  101. three/examples/jsm/renderers/common/Animation.d.ts +14 -0
  102. three/examples/jsm/renderers/common/Attributes.d.ts +20 -0
  103. three/examples/jsm/renderers/common/Background.d.ts +22 -0
  104. three/examples/jsm/renderers/common/BindGroup.d.ts +9 -0
  105. three/examples/jsm/renderers/common/Binding.d.ts +8 -0
  106. three/examples/jsm/renderers/common/Bindings.d.ts +42 -0
  107. three/examples/jsm/renderers/common/Buffer.d.ts +11 -0
  108. three/examples/jsm/renderers/common/BufferUtils.d.ts +4 -0
  109. three/examples/jsm/renderers/common/ChainMap.d.ts +9 -0
  110. three/examples/jsm/renderers/common/ClippingContext.d.ts +18 -0
  111. three/examples/jsm/renderers/common/Color4.d.ts +6 -5
  112. three/examples/jsm/renderers/common/ComputePipeline.d.ts +8 -0
  113. three/examples/jsm/renderers/common/Constants.d.ts +9 -0
  114. three/examples/jsm/renderers/common/CubeRenderTarget.d.ts +7 -0
  115. three/examples/jsm/renderers/common/DataMap.d.ts +20 -0
  116. three/examples/jsm/renderers/common/Geometries.d.ts +28 -0
  117. three/examples/jsm/renderers/common/Info.d.ts +25 -13
  118. three/examples/jsm/renderers/common/Pipeline.d.ts +6 -0
  119. three/examples/jsm/renderers/common/Pipelines.d.ts +68 -0
  120. three/examples/jsm/renderers/common/PostProcessing.d.ts +2 -0
  121. three/examples/jsm/renderers/common/ProgrammableStage.d.ts +15 -0
  122. three/examples/jsm/renderers/common/RenderBundle.d.ts +8 -0
  123. three/examples/jsm/renderers/common/RenderBundles.d.ts +10 -0
  124. three/examples/jsm/renderers/common/RenderContext.d.ts +38 -0
  125. three/examples/jsm/renderers/common/RenderContexts.d.ts +13 -0
  126. three/examples/jsm/renderers/common/RenderList.d.ts +62 -0
  127. three/examples/jsm/renderers/common/RenderLists.d.ts +10 -0
  128. three/examples/jsm/renderers/common/RenderObject.d.ts +73 -0
  129. three/examples/jsm/renderers/common/RenderObjects.d.ts +59 -0
  130. three/examples/jsm/renderers/common/RenderPipeline.d.ts +8 -0
  131. three/examples/jsm/renderers/common/Renderer.d.ts +186 -208
  132. three/examples/jsm/renderers/common/SampledTexture.d.ts +27 -0
  133. three/examples/jsm/renderers/common/Sampler.d.ts +11 -0
  134. three/examples/jsm/renderers/common/StorageBufferAttribute.d.ts +7 -0
  135. three/examples/jsm/renderers/common/StorageInstancedBufferAttribute.d.ts +7 -0
  136. three/examples/jsm/renderers/common/Textures.d.ts +64 -0
  137. three/examples/jsm/renderers/common/Uniform.d.ts +40 -0
  138. three/examples/jsm/renderers/common/UniformBuffer.d.ts +6 -0
  139. three/examples/jsm/renderers/common/UniformsGroup.d.ts +32 -0
  140. three/examples/jsm/renderers/common/nodes/NodeBuilderState.d.ts +30 -0
  141. three/examples/jsm/renderers/common/nodes/NodeSampledTexture.d.ts +29 -0
  142. three/examples/jsm/renderers/common/nodes/NodeSampler.d.ts +12 -0
  143. three/examples/jsm/renderers/common/nodes/NodeUniform.d.ts +63 -0
  144. three/examples/jsm/renderers/common/nodes/NodeUniformsGroup.d.ts +11 -0
  145. three/examples/jsm/renderers/common/nodes/Nodes.d.ts +95 -0
  146. three/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +123 -0
  147. three/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +6 -0
  148. three/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.d.ts +6 -0
  149. three/examples/jsm/renderers/webgpu/utils/WebGPUConstants.d.ts +328 -0
  150. three/examples/jsm/utils/SceneUtils.d.ts +9 -3
  151. three/package.json +4 -4
  152. three/src/Three.d.ts +1 -0
  153. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -2
  154. three/src/constants.d.ts +6 -0
  155. three/src/core/BufferGeometry.d.ts +19 -17
  156. three/src/core/InterleavedBuffer.d.ts +2 -0
  157. three/src/extras/ShapeUtils.d.ts +5 -8
  158. three/src/extras/TextureUtils.d.ts +42 -0
  159. three/src/lights/LightShadow.d.ts +5 -0
  160. three/src/loaders/LoaderUtils.d.ts +9 -6
  161. three/src/materials/Material.d.ts +21 -12
  162. three/src/math/Color.d.ts +1 -1
  163. three/src/math/Matrix3.d.ts +2 -0
  164. three/src/math/Matrix4.d.ts +2 -0
  165. three/src/math/Vector4.d.ts +6 -0
  166. three/src/objects/BatchedMesh.d.ts +66 -47
  167. three/src/objects/InstancedMesh.d.ts +3 -3
  168. three/src/renderers/WebGLRenderer.d.ts +41 -19
  169. three/src/renderers/shaders/UniformsLib.d.ts +3 -0
  170. three/src/renderers/webgl/WebGLPrograms.d.ts +1 -1
  171. three/src/renderers/webxr/WebXRDepthSensing.d.ts +3 -1
  172. three/src/renderers/webxr/WebXRManager.d.ts +33 -23
  173. three/src/textures/CompressedArrayTexture.d.ts +36 -19
  174. three/src/textures/CompressedTexture.d.ts +16 -8
  175. three/src/textures/DataArrayTexture.d.ts +37 -20
  176. three/src/textures/FramebufferTexture.d.ts +1 -1
  177. three/src/textures/Texture.d.ts +3 -1
  178. three/src/utils.d.ts +2 -0
  179. three/examples/jsm/renderers/webgl/nodes/SlotNode.d.ts +0 -17
  180. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +0 -37
  181. three/examples/jsm/renderers/webgl/nodes/WebGLNodes.d.ts +0 -3
@@ -1,3 +1,5 @@
1
+ import { Matrix4 } from "three/src/Three.js";
2
+ import { UniformNode } from "../Nodes.js";
1
3
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
2
4
  import Object3DNode from "./Object3DNode.js";
3
5
 
@@ -15,3 +17,4 @@ export const modelWorldMatrix: ShaderNodeObject<ModelNode>;
15
17
  export const modelPosition: ShaderNodeObject<ModelNode>;
16
18
  export const modelScale: ShaderNodeObject<ModelNode>;
17
19
  export const modelViewPosition: ShaderNodeObject<ModelNode>;
20
+ export const modelWorldMatrixInverse: ShaderNodeObject<UniformNode<Matrix4>>;
@@ -1,9 +1,8 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
3
- import PositionNode from "./PositionNode.js";
4
3
 
5
4
  export default class ModelViewProjectionNode extends Node {
6
- constructor(positionNode?: PositionNode);
5
+ constructor(positionNode?: Node);
7
6
  }
8
7
 
9
8
  export const modelViewProjection: (position?: NodeRepresentation) => ShaderNodeObject<ModelViewProjectionNode>;
@@ -1,20 +1,12 @@
1
- import Node from "../core/Node.js";
1
+ import AttributeNode from "../core/AttributeNode.js";
2
+ import PropertyNode from "../core/PropertyNode.js";
2
3
  import VarNode from "../core/VarNode.js";
4
+ import MathNode from "../math/MathNode.js";
3
5
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
6
 
5
- export type NormalNodeScope = typeof NormalNode.GEOMETRY | typeof NormalNode.LOCAL | typeof NormalNode.VIEW;
6
-
7
- export default class NormalNode extends Node {
8
- static GEOMETRY: "geometry";
9
- static LOCAL: "local";
10
- static VIEW: "view";
11
- scope: NormalNodeScope;
12
-
13
- constructor(scope?: NormalNodeScope);
14
- }
15
-
16
- export const normalGeometry: ShaderNodeObject<NormalNode>;
17
- export const normalLocal: ShaderNodeObject<NormalNode>;
18
- export const normalView: ShaderNodeObject<NormalNode>;
19
- export const normalWorld: ShaderNodeObject<NormalNode>;
20
- export const transformedNormalView: ShaderNodeObject<VarNode>;
7
+ export const normalGeometry: ShaderNodeObject<AttributeNode>;
8
+ export const normalLocal: ShaderNodeObject<VarNode>;
9
+ export const normalView: ShaderNodeObject<MathNode>;
10
+ export const normalWorld: ShaderNodeObject<MathNode>;
11
+ export const transformedNormalView: ShaderNodeObject<PropertyNode>;
12
+ export const transformedClearcoatNormalView: ShaderNodeObject<PropertyNode>;
@@ -1,29 +1,9 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
3
3
 
4
- export type PositionNodeScope =
5
- | typeof PositionNode.GEOMETRY
6
- | typeof PositionNode.LOCAL
7
- | typeof PositionNode.WORLD
8
- | typeof PositionNode.WORLD_DIRECTION
9
- | typeof PositionNode.VIEW
10
- | typeof PositionNode.VIEW_DIRECTION;
11
-
12
- export default class PositionNode extends Node {
13
- static GEOMETRY: "geometry";
14
- static LOCAL: "local";
15
- static WORLD: "world";
16
- static WORLD_DIRECTION: "worldDirection";
17
- static VIEW: "view";
18
- static VIEW_DIRECTION: "viewDirection";
19
- scope: PositionNodeScope;
20
-
21
- constructor(scope?: PositionNodeScope);
22
- }
23
-
24
- export const positionGeometry: ShaderNodeObject<PositionNode>;
25
- export const positionLocal: ShaderNodeObject<PositionNode>;
26
- export const positionWorld: ShaderNodeObject<PositionNode>;
27
- export const positionWorldDirection: ShaderNodeObject<PositionNode>;
28
- export const positionView: ShaderNodeObject<PositionNode>;
29
- export const positionViewDirection: ShaderNodeObject<PositionNode>;
4
+ export const positionGeometry: ShaderNodeObject<Node>;
5
+ export const positionLocal: ShaderNodeObject<Node>;
6
+ export const positionWorld: ShaderNodeObject<Node>;
7
+ export const positionWorldDirection: ShaderNodeObject<Node>;
8
+ export const positionView: ShaderNodeObject<Node>;
9
+ export const positionViewDirection: ShaderNodeObject<Node>;
@@ -1,11 +1,10 @@
1
- import { NodeTypeOption } from "../core/constants.js";
2
1
  import Node from "../core/Node.js";
3
2
  import { NodeOrType, NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
3
 
5
4
  export default class ReferenceNode<T> extends Node {
6
5
  property: string;
7
6
 
8
- uniformType: NodeTypeOption;
7
+ uniformType: string;
9
8
 
10
9
  object: T;
11
10
  count: number | null;
@@ -14,9 +13,9 @@ export default class ReferenceNode<T> extends Node {
14
13
  reference: T | null;
15
14
  node: Node | null;
16
15
 
17
- constructor(property: string, uniformType: NodeTypeOption, object?: T | null, count?: number | null);
16
+ constructor(property: string, uniformType: string, object?: T | null, count?: number | null);
18
17
 
19
- setNodeType(uniformType: NodeTypeOption): void;
18
+ setNodeType(uniformType: string): void;
20
19
  }
21
20
 
22
21
  export const reference: <T>(name: string, nodeOrType: NodeOrType, object: T) => ShaderNodeObject<ReferenceNode<T>>;
@@ -1,11 +1,6 @@
1
1
  import Node from "../core/Node.js";
2
+ import VarNode from "../core/VarNode.js";
2
3
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
3
4
 
4
- export default class ReflectVectorNode extends Node {
5
- constructor();
6
-
7
- getHash(): "reflectVector";
8
- setup(): Node;
9
- }
10
-
11
- export const reflectVector: ShaderNodeObject<ReflectVectorNode>;
5
+ export const reflectView: ShaderNodeObject<Node>;
6
+ export const reflectVector: ShaderNodeObject<VarNode>;
@@ -1,16 +1,15 @@
1
1
  import Renderer from "../../renderers/common/Renderer.js";
2
- import { NodeTypeOption } from "../core/constants.js";
3
2
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
3
  import ReferenceNode from "./ReferenceNode.js";
5
4
 
6
5
  export default class RendererReferenceNode extends ReferenceNode<Renderer> {
7
6
  renderer: Renderer | null;
8
7
 
9
- constructor(property: string, inputType: NodeTypeOption, renderer?: Renderer | null);
8
+ constructor(property: string, inputType: string, renderer?: Renderer | null);
10
9
  }
11
10
 
12
11
  export const rendererReference: (
13
12
  name: string,
14
- type: NodeTypeOption,
13
+ type: string,
15
14
  renderer?: Renderer | null,
16
15
  ) => ShaderNodeObject<RendererReferenceNode>;
@@ -1,4 +1,6 @@
1
- import { NodeTypeOption } from "../core/constants.js";
1
+ import StorageBufferAttribute from "../../renderers/common/StorageBufferAttribute.js";
2
+ import StorageInstancedBufferAttribute from "../../renderers/common/StorageInstancedBufferAttribute.js";
3
+ import { GPUBufferBindingType } from "../../renderers/webgpu/utils/WebGPUConstants.js";
2
4
  import { NodeOrType, NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
3
5
  import StorageArrayElementNode from "../utils/StoargeArrayElementNode.js";
4
6
  import BufferNode from "./BufferNode.js";
@@ -7,20 +9,30 @@ export default class StorageBufferNode extends BufferNode {
7
9
  readonly isStorageBufferNode: true;
8
10
  bufferObject: boolean;
9
11
 
10
- constructor(value: ArrayLike<number>, bufferType: NodeTypeOption, bufferCount?: number);
12
+ access: GPUBufferBindingType;
13
+
14
+ constructor(
15
+ value: StorageBufferAttribute | StorageInstancedBufferAttribute,
16
+ bufferType: string,
17
+ bufferCount?: number,
18
+ );
11
19
 
12
20
  element(indexNode: NodeRepresentation): ShaderNodeObject<StorageArrayElementNode>;
13
21
 
14
22
  setBufferObject(value: boolean): this;
23
+
24
+ setAccess(value: GPUBufferBindingType): this;
25
+
26
+ toReadOnly(): this;
15
27
  }
16
28
 
17
29
  export const storage: (
18
- value: ArrayLike<number>,
30
+ value: StorageBufferAttribute | StorageInstancedBufferAttribute,
19
31
  nodeOrType: NodeOrType,
20
32
  count: number,
21
33
  ) => ShaderNodeObject<StorageBufferNode>;
22
34
  export const storageObject: (
23
- value: ArrayLike<number>,
35
+ value: StorageBufferAttribute | StorageInstancedBufferAttribute,
24
36
  nodeOrType: NodeOrType,
25
37
  count: number,
26
38
  ) => ShaderNodeObject<StorageBufferNode>;
@@ -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>;
@@ -1,27 +1,12 @@
1
- import Node from "../core/Node.js";
1
+ import AttributeNode from "../core/AttributeNode.js";
2
+ import VarNode from "../core/VarNode.js";
3
+ import VaryingNode from "../core/VaryingNode.js";
2
4
  import MathNode from "../math/MathNode.js";
3
5
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
6
 
5
- export type TangentNodeScope =
6
- | typeof TangentNode.LOCAL
7
- | typeof TangentNode.VIEW
8
- | typeof TangentNode.WORLD
9
- | typeof TangentNode.GEOMETRY;
10
-
11
- export default class TangentNode extends Node {
12
- static GEOMETRY: "geometry";
13
- static LOCAL: "local";
14
- static VIEW: "view";
15
- static WORLD: "world";
16
-
17
- scope: TangentNodeScope;
18
-
19
- constructor(scope?: TangentNodeScope);
20
- }
21
-
22
- export const tangentGeometry: ShaderNodeObject<TangentNode>;
23
- export const tangentLocal: ShaderNodeObject<TangentNode>;
24
- export const tangentView: ShaderNodeObject<TangentNode>;
25
- export const tangentWorld: ShaderNodeObject<TangentNode>;
26
- export const transformedTangentView: ShaderNodeObject<MathNode>;
7
+ export const tangentGeometry: ShaderNodeObject<AttributeNode>;
8
+ export const tangentLocal: ShaderNodeObject<VaryingNode>;
9
+ export const tangentView: ShaderNodeObject<MathNode>;
10
+ export const tangentWorld: ShaderNodeObject<MathNode>;
11
+ export const transformedTangentView: ShaderNodeObject<VarNode>;
27
12
  export const transformedTangentWorld: ShaderNodeObject<MathNode>;
@@ -0,0 +1,16 @@
1
+ import { CubeTexture, Texture } from "three";
2
+ import Node from "../core/Node.js";
3
+ import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
+ import TextureNode from "./TextureNode.js";
5
+
6
+ export default class Texture3DNode extends TextureNode {
7
+ readonly isTexture3DNode: true;
8
+
9
+ constructor(value: Texture, uvNode?: ShaderNodeObject<Node> | null, levelNode?: ShaderNodeObject<Node> | null);
10
+ }
11
+
12
+ export const texture3D: (
13
+ value: CubeTexture,
14
+ uvNode?: NodeRepresentation,
15
+ levelNode?: NodeRepresentation,
16
+ ) => ShaderNodeObject<Texture3DNode>;
@@ -17,7 +17,7 @@ export default class TextureNode extends UniformNode<Texture> {
17
17
 
18
18
  referenceNode: Node | null;
19
19
 
20
- constructor(value: Texture, uvNode?: ShaderNodeObject<Node>, levelNode?: ShaderNodeObject<Node> | null);
20
+ constructor(value: Texture, uvNode?: ShaderNodeObject<Node> | null, levelNode?: ShaderNodeObject<Node> | null);
21
21
 
22
22
  getDefaultUV(): Node;
23
23
 
@@ -1,11 +1,4 @@
1
1
  import AttributeNode from "../core/AttributeNode.js";
2
2
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
3
3
 
4
- export default class UVNode extends AttributeNode {
5
- isUVNode: true;
6
- index: number;
7
-
8
- constructor(index?: number);
9
- }
10
-
11
- export const uv: (index?: number) => ShaderNodeObject<UVNode>;
4
+ export const uv: (index?: number) => ShaderNodeObject<AttributeNode>;
@@ -15,8 +15,6 @@ export default class UniformsNode extends BufferNode {
15
15
 
16
16
  constructor(value: unknown[], elementType?: string | null);
17
17
 
18
- getElementType(): string | null;
19
-
20
18
  getElementLength(): number;
21
19
 
22
20
  element(indexNode: number): ShaderNodeObject<UniformsElementNode>;
@@ -1,14 +1,15 @@
1
- import { NodeTypeOption, NodeUserData } from "../core/constants.js";
2
1
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
3
2
  import ReferenceNode from "./ReferenceNode.js";
4
3
 
4
+ export type NodeUserData = Record<string, any>;
5
+
5
6
  export default class UserDataNode extends ReferenceNode<NodeUserData> {
6
7
  userData: NodeUserData | null;
7
- constructor(property: string, inputType: NodeTypeOption, userData?: NodeUserData | null);
8
+ constructor(property: string, inputType: string, userData?: NodeUserData | null);
8
9
  }
9
10
 
10
11
  export const userData: (
11
12
  name: string,
12
- inputType: NodeTypeOption,
13
+ inputType: string,
13
14
  userData?: NodeUserData,
14
15
  ) => ShaderNodeObject<UserDataNode>;
@@ -1,4 +1,3 @@
1
- import { NodeTypeOption } from "../core/constants.js";
2
1
  import Node from "../core/Node.js";
3
2
  import NodeBuilder from "../core/NodeBuilder.js";
4
3
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
@@ -1,10 +1,9 @@
1
- import { NodeTypeOption } from "../core/constants.js";
2
1
  import TempNode from "../core/TempNode.js";
3
2
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
3
 
5
4
  export default class ExpressionNode extends TempNode {
6
5
  snipped: string; /* sic */
7
- constructor(snipped?: string, nodeType?: NodeTypeOption);
6
+ constructor(snipped?: string, nodeType?: string);
8
7
  }
9
8
 
10
- export const expression: (snipped?: string, nodeType?: NodeTypeOption) => ShaderNodeObject<ExpressionNode>;
9
+ export const expression: (snipped?: string, nodeType?: string) => ShaderNodeObject<ExpressionNode>;
@@ -1,12 +1,19 @@
1
- import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
2
- import { NodeTypeOption } from "./constants.js";
1
+ import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
3
2
  import Node from "./Node.js";
4
3
  import NodeBuilder from "./NodeBuilder.js";
5
4
 
6
5
  export default class AttributeNode extends Node {
7
- constructor(attributeName: string, nodeType?: NodeTypeOption | null);
6
+ defaultNode: Node | null;
7
+
8
+ constructor(attributeName: string, nodeType?: string | null, defaultNode?: Node | null);
9
+
8
10
  setAttributeName(attributeName: string): this;
11
+
9
12
  getAttributeName(builder: NodeBuilder): string;
10
13
  }
11
14
 
12
- export const attribute: (name: string, nodeType: NodeTypeOption) => ShaderNodeObject<Node>;
15
+ export const attribute: (
16
+ name: string,
17
+ nodeType?: string | null,
18
+ defaultNode?: NodeRepresentation,
19
+ ) => ShaderNodeObject<AttributeNode>;
@@ -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
  }
@@ -1,10 +1,9 @@
1
- import { NodeTypeOption } from "./constants.js";
2
1
  import InputNode from "./InputNode.js";
3
2
  import NodeBuilder from "./NodeBuilder.js";
4
3
 
5
4
  export default class ConstNode<Value> extends InputNode<Value> {
6
5
  isConstNode: true;
7
- constructor(value: Value, nodeType?: NodeTypeOption | null);
6
+ constructor(value: Value, nodeType?: string | null);
8
7
 
9
8
  generateConst(builder: NodeBuilder): string;
10
9
  }
@@ -1,4 +1,3 @@
1
- import { NodeTypeOption } from "./constants.js";
2
1
  import Node from "./Node.js";
3
2
  import NodeBuilder from "./NodeBuilder.js";
4
3
 
@@ -9,7 +8,7 @@ export default abstract class InputNode<Value> extends Node {
9
8
  value: Value;
10
9
  precision: Precision | null;
11
10
 
12
- constructor(value: Value, nodeType?: NodeTypeOption | null);
11
+ constructor(value: Value, nodeType?: string | null);
13
12
 
14
13
  getInputType(builder: NodeBuilder): string | null;
15
14
  setPrecision(precision: Precision): this;
@@ -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;
@@ -1,61 +1,121 @@
1
- import { AnyJson, NodeTypeOption, NodeUpdateType } from "./constants.js";
1
+ import { EventDispatcher } from "three";
2
+ import { NodeUpdateType } from "./constants.js";
2
3
  import NodeBuilder from "./NodeBuilder.js";
3
4
  import NodeFrame from "./NodeFrame.js";
4
-
5
- export default abstract class Node {
6
- nodeType: NodeTypeOption | null;
7
-
5
+ interface NodeJSONMeta {
6
+ textures: {
7
+ [key: string]: unknown;
8
+ };
9
+ images: {
10
+ [key: string]: unknown;
11
+ };
12
+ nodes: {
13
+ [key: string]: NodeJSONIntermediateOutputData;
14
+ };
15
+ }
16
+ interface NodeJSONMetadata {
17
+ version: number;
18
+ type: "Node";
19
+ generator: "Node.toJSON";
20
+ }
21
+ interface NodeJSONInputNodes {
22
+ [property: string]:
23
+ | string[]
24
+ | {
25
+ [index: string]: string | undefined;
26
+ }
27
+ | string
28
+ | undefined;
29
+ }
30
+ interface NodeJSONInputData {
31
+ inputNodes?: NodeJSONInputNodes | undefined;
32
+ meta: {
33
+ textures: {
34
+ [key: string]: unknown;
35
+ };
36
+ nodes: {
37
+ [key: string]: Node;
38
+ };
39
+ };
40
+ }
41
+ interface NodeJSONInputData {
42
+ uuid: string;
43
+ type: string | undefined;
44
+ metadata?: NodeJSONMetadata;
45
+ inputNodes?: NodeJSONInputNodes | undefined;
46
+ }
47
+ interface NodeJSONIntermediateOutputData {
48
+ uuid: string;
49
+ type: string | undefined;
50
+ meta?: NodeJSONMeta | undefined;
51
+ metadata?: NodeJSONMetadata;
52
+ inputNodes?: NodeJSONInputNodes | undefined;
53
+ textures?: unknown[];
54
+ images?: unknown[];
55
+ nodes?: NodeJSONIntermediateOutputData[];
56
+ }
57
+ interface NodeJSONOutputData {
58
+ uuid: string;
59
+ type: string | undefined;
60
+ metadata?: NodeJSONMetadata;
61
+ inputNodes?: NodeJSONInputNodes | undefined;
62
+ textures?: unknown[];
63
+ images?: unknown[];
64
+ nodes?: NodeJSONOutputData[];
65
+ }
66
+ declare class Node extends EventDispatcher<{
67
+ dispose: {};
68
+ }> {
69
+ nodeType: string | null;
8
70
  updateType: NodeUpdateType;
9
71
  updateBeforeType: NodeUpdateType;
10
-
72
+ updateAfterType: NodeUpdateType;
11
73
  uuid: string;
12
-
13
74
  version: number;
14
-
75
+ _cacheKey: string | null;
76
+ _cacheKeyVersion: number;
77
+ global: boolean;
15
78
  readonly isNode: true;
16
-
17
79
  readonly id: number;
18
-
19
- constructor(nodeType?: NodeTypeOption | null);
20
-
80
+ self?: this;
81
+ constructor(nodeType?: string | null);
21
82
  set needsUpdate(value: boolean);
22
-
23
- get type(): number;
24
-
83
+ get type(): string | undefined;
84
+ onUpdate(callback: (this: this, frame: NodeFrame) => unknown, updateType: NodeUpdateType): this;
85
+ onFrameUpdate(callback: (this: this, frame: NodeFrame) => void): this;
86
+ onRenderUpdate(callback: (this: this, frame: NodeFrame) => void): this;
87
+ onObjectUpdate(callback: (this: this, frame: NodeFrame) => void): this;
88
+ onReference(callback: (this: this, frame: NodeBuilder | NodeFrame) => unknown): this;
89
+ getSelf(): this;
90
+ updateReference(state: NodeBuilder | NodeFrame): unknown;
25
91
  isGlobal(builder: NodeBuilder): boolean;
26
-
27
- getChildren(): Node[];
28
-
92
+ getChildren(): Generator<Node, void, unknown>;
93
+ dispose(): void;
94
+ traverse(callback: (node: Node) => void): void;
29
95
  getCacheKey(force?: boolean): string;
30
-
31
96
  getHash(builder: NodeBuilder): string;
32
-
33
97
  getUpdateType(): NodeUpdateType;
34
-
35
98
  getUpdateBeforeType(): NodeUpdateType;
36
-
37
- getNodeType(builder: NodeBuilder, output?: string | null): NodeTypeOption | null;
38
-
39
- getReference(builder: NodeBuilder): Node;
40
-
41
- setup(builder: NodeBuilder): Node | null;
42
-
99
+ getUpdateAfterType(): NodeUpdateType;
100
+ getElementType(builder: NodeBuilder): "bool" | "int" | "float" | "vec2" | "vec3" | "vec4" | "uint" | null;
101
+ getNodeType(builder: NodeBuilder): string | null;
102
+ getShared(builder: NodeBuilder): Node;
103
+ setup(builder: NodeBuilder): unknown;
104
+ construct(builder: NodeBuilder): unknown;
43
105
  increaseUsage(builder: NodeBuilder): number;
44
-
45
106
  analyze(builder: NodeBuilder): void;
46
-
47
- generate(builder: NodeBuilder, output?: string | null): string;
48
-
107
+ generate(builder: NodeBuilder, output?: string | null): string | null | undefined;
49
108
  updateBefore(frame: NodeFrame): void;
50
-
51
- /** This method must be overriden when {@link updateType} !== 'none' */
109
+ updateAfter(frame: NodeFrame): void;
52
110
  update(frame: NodeFrame): void;
53
-
54
- build(builder: NodeBuilder, output?: string | null): string;
55
-
56
- serialize(json: AnyJson): void;
57
-
58
- deserialize(json: AnyJson): void;
59
-
60
- toJSON(meta?: string | { textures: {}; images: {}; nodes: {} }): AnyJson;
111
+ build(builder: NodeBuilder, output?: string | null): string | null;
112
+ getSerializeChildren(): Generator<import("./NodeUtils.js").NodeChild, void, unknown>;
113
+ serialize(json: NodeJSONIntermediateOutputData): void;
114
+ deserialize(json: NodeJSONInputData): void;
115
+ toJSON(meta?: NodeJSONMeta | string): NodeJSONOutputData;
61
116
  }
117
+ export default Node;
118
+ export declare function addNodeClass(type: string, nodeClass: {
119
+ new(...args: any[]): Node;
120
+ }): void;
121
+ export declare function createNodeFromType(type: string): Node | undefined;
@@ -1,6 +1,9 @@
1
- export default class NodeAttribute {
2
- isNodeAttribute: true;
1
+ import Node from "./Node.js";
2
+ declare class NodeAttribute {
3
+ readonly isNodeAttribute: true;
3
4
  name: string;
4
- type: string;
5
- constructor(name: string, type: string);
5
+ type: string | null;
6
+ node: Node | null;
7
+ constructor(name: string, type: string | null, node?: Node | null);
6
8
  }
9
+ export default NodeAttribute;