@types/three 0.164.0 → 0.165.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 (133) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/controls/TransformControls.d.ts +8 -6
  3. three/examples/jsm/exporters/USDZExporter.d.ts +4 -2
  4. three/examples/jsm/geometries/TextGeometry.d.ts +1 -1
  5. three/examples/jsm/loaders/FontLoader.d.ts +1 -1
  6. three/examples/jsm/loaders/GLTFLoader.d.ts +9 -6
  7. three/examples/jsm/loaders/LDrawLoader.d.ts +1 -1
  8. three/examples/jsm/modifiers/EdgeSplitModifier.d.ts +17 -10
  9. three/examples/jsm/nodes/Nodes.d.ts +11 -54
  10. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +4 -22
  11. three/examples/jsm/nodes/accessors/BufferAttributeNode.d.ts +49 -0
  12. three/examples/jsm/nodes/accessors/BufferNode.d.ts +3 -4
  13. three/examples/jsm/nodes/accessors/CameraNode.d.ts +11 -20
  14. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +1 -1
  15. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +4 -1
  16. three/examples/jsm/nodes/accessors/ModelNode.d.ts +3 -0
  17. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +1 -2
  18. three/examples/jsm/nodes/accessors/NormalNode.d.ts +9 -17
  19. three/examples/jsm/nodes/accessors/PositionNode.d.ts +6 -26
  20. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +3 -4
  21. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -8
  22. three/examples/jsm/nodes/accessors/RendererReferenceNode.d.ts +2 -3
  23. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +9 -4
  24. three/examples/jsm/nodes/accessors/TangentNode.d.ts +8 -23
  25. three/examples/jsm/nodes/accessors/Texture3DNode.d.ts +16 -0
  26. three/examples/jsm/nodes/accessors/TextureNode.d.ts +1 -1
  27. three/examples/jsm/nodes/accessors/UVNode.d.ts +1 -8
  28. three/examples/jsm/nodes/accessors/UniformsNode.d.ts +0 -2
  29. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +4 -3
  30. three/examples/jsm/nodes/code/CodeNode.d.ts +0 -1
  31. three/examples/jsm/nodes/code/ExpressionNode.d.ts +2 -3
  32. three/examples/jsm/nodes/core/AttributeNode.d.ts +11 -4
  33. three/examples/jsm/nodes/core/ConstNode.d.ts +1 -2
  34. three/examples/jsm/nodes/core/InputNode.d.ts +1 -2
  35. three/examples/jsm/nodes/core/Node.d.ts +99 -42
  36. three/examples/jsm/nodes/core/NodeAttribute.d.ts +7 -4
  37. three/examples/jsm/nodes/core/NodeBuilder.d.ts +24 -24
  38. three/examples/jsm/nodes/core/NodeCache.d.ts +38 -4
  39. three/examples/jsm/nodes/core/NodeKeywords.d.ts +10 -7
  40. three/examples/jsm/nodes/core/NodeParser.d.ts +4 -4
  41. three/examples/jsm/nodes/core/NodeUniform.d.ts +8 -11
  42. three/examples/jsm/nodes/core/NodeVar.d.ts +5 -4
  43. three/examples/jsm/nodes/core/NodeVarying.d.ts +5 -6
  44. three/examples/jsm/nodes/core/PropertyNode.d.ts +4 -4
  45. three/examples/jsm/nodes/core/StackNode.d.ts +7 -1
  46. three/examples/jsm/nodes/core/StructTypeNode.d.ts +8 -0
  47. three/examples/jsm/nodes/core/TempNode.d.ts +1 -2
  48. three/examples/jsm/nodes/core/UniformGroup.d.ts +7 -0
  49. three/examples/jsm/nodes/core/UniformGroupNode.d.ts +21 -0
  50. three/examples/jsm/nodes/core/UniformNode.d.ts +14 -11
  51. three/examples/jsm/nodes/core/VaryingNode.d.ts +4 -0
  52. three/examples/jsm/nodes/core/constants.d.ts +27 -79
  53. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +2 -0
  54. three/examples/jsm/nodes/functions/ToonLightingModel.d.ts +4 -0
  55. three/examples/jsm/nodes/loaders/NodeLoader.d.ts +3 -3
  56. three/examples/jsm/nodes/loaders/NodeObjectLoader.d.ts +2 -3
  57. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +2 -0
  58. three/examples/jsm/nodes/materials/Materials.d.ts +3 -0
  59. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +5 -1
  60. three/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.d.ts +28 -0
  61. three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.d.ts +2 -0
  62. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +5 -1
  63. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +8 -0
  64. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +5 -1
  65. three/examples/jsm/nodes/materials/MeshToonNodeMaterial.d.ts +38 -0
  66. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +9 -4
  67. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +1 -0
  68. three/examples/jsm/nodes/materials/ShadowNodeMaterial.d.ts +1 -0
  69. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +1 -0
  70. three/examples/jsm/nodes/materials/VolumeNodeMaterial.d.ts +10 -0
  71. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +58 -36
  72. three/examples/jsm/nodes/utils/ConvertNode.d.ts +2 -3
  73. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +2 -2
  74. three/examples/jsm/nodes/utils/SplitNode.d.ts +1 -1
  75. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +4 -5
  76. three/examples/jsm/objects/Sky.d.ts +18 -0
  77. three/examples/jsm/renderers/common/Animation.d.ts +14 -0
  78. three/examples/jsm/renderers/common/Attributes.d.ts +20 -0
  79. three/examples/jsm/renderers/common/Background.d.ts +22 -0
  80. three/examples/jsm/renderers/common/Binding.d.ts +8 -0
  81. three/examples/jsm/renderers/common/Bindings.d.ts +45 -0
  82. three/examples/jsm/renderers/common/Buffer.d.ts +11 -0
  83. three/examples/jsm/renderers/common/BufferUtils.d.ts +4 -0
  84. three/examples/jsm/renderers/common/ChainMap.d.ts +9 -0
  85. three/examples/jsm/renderers/common/ClippingContext.d.ts +18 -0
  86. three/examples/jsm/renderers/common/Color4.d.ts +6 -5
  87. three/examples/jsm/renderers/common/ComputePipeline.d.ts +8 -0
  88. three/examples/jsm/renderers/common/Constants.d.ts +9 -0
  89. three/examples/jsm/renderers/common/CubeRenderTarget.d.ts +7 -0
  90. three/examples/jsm/renderers/common/DataMap.d.ts +20 -0
  91. three/examples/jsm/renderers/common/Geometries.d.ts +28 -0
  92. three/examples/jsm/renderers/common/Info.d.ts +20 -13
  93. three/examples/jsm/renderers/common/Pipeline.d.ts +6 -0
  94. three/examples/jsm/renderers/common/Pipelines.d.ts +68 -0
  95. three/examples/jsm/renderers/common/ProgrammableStage.d.ts +15 -0
  96. three/examples/jsm/renderers/common/RenderBundle.d.ts +8 -0
  97. three/examples/jsm/renderers/common/RenderBundles.d.ts +10 -0
  98. three/examples/jsm/renderers/common/RenderContext.d.ts +38 -0
  99. three/examples/jsm/renderers/common/RenderContexts.d.ts +13 -0
  100. three/examples/jsm/renderers/common/RenderList.d.ts +62 -0
  101. three/examples/jsm/renderers/common/RenderLists.d.ts +10 -0
  102. three/examples/jsm/renderers/common/RenderObject.d.ts +73 -0
  103. three/examples/jsm/renderers/common/RenderObjects.d.ts +59 -0
  104. three/examples/jsm/renderers/common/RenderPipeline.d.ts +8 -0
  105. three/examples/jsm/renderers/common/Renderer.d.ts +175 -208
  106. three/examples/jsm/renderers/common/StorageBufferAttribute.d.ts +7 -0
  107. three/examples/jsm/renderers/common/StorageInstancedBufferAttribute.d.ts +7 -0
  108. three/examples/jsm/renderers/common/Textures.d.ts +64 -0
  109. three/examples/jsm/renderers/common/Uniform.d.ts +40 -0
  110. three/examples/jsm/renderers/common/UniformBuffer.d.ts +6 -0
  111. three/examples/jsm/renderers/common/UniformsGroup.d.ts +30 -0
  112. three/examples/jsm/renderers/common/nodes/NodeBuilderState.d.ts +26 -0
  113. three/examples/jsm/renderers/common/nodes/NodeUniform.d.ts +63 -0
  114. three/examples/jsm/renderers/common/nodes/NodeUniformsGroup.d.ts +12 -0
  115. three/examples/jsm/renderers/common/nodes/Nodes.d.ts +94 -0
  116. three/examples/jsm/utils/SceneUtils.d.ts +9 -3
  117. three/package.json +2 -2
  118. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -2
  119. three/src/core/BufferGeometry.d.ts +19 -17
  120. three/src/core/InterleavedBuffer.d.ts +2 -0
  121. three/src/loaders/LoaderUtils.d.ts +9 -6
  122. three/src/math/Color.d.ts +1 -1
  123. three/src/math/Matrix3.d.ts +2 -0
  124. three/src/math/Matrix4.d.ts +2 -0
  125. three/src/objects/BatchedMesh.d.ts +15 -0
  126. three/src/objects/InstancedMesh.d.ts +3 -3
  127. three/src/renderers/WebGLRenderer.d.ts +41 -19
  128. three/src/renderers/webgl/WebGLPrograms.d.ts +1 -1
  129. three/src/renderers/webxr/WebXRDepthSensing.d.ts +1 -1
  130. three/src/textures/CompressedArrayTexture.d.ts +32 -15
  131. three/src/textures/DataArrayTexture.d.ts +37 -20
  132. three/src/textures/FramebufferTexture.d.ts +1 -1
  133. three/src/utils.d.ts +2 -0
@@ -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>;
@@ -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;
@@ -1,61 +1,118 @@
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
-
11
72
  uuid: string;
12
-
13
73
  version: number;
14
-
74
+ _cacheKey: string | null;
75
+ _cacheKeyVersion: number;
76
+ global: boolean;
15
77
  readonly isNode: true;
16
-
17
78
  readonly id: number;
18
-
19
- constructor(nodeType?: NodeTypeOption | null);
20
-
79
+ self?: this;
80
+ constructor(nodeType?: string | null);
21
81
  set needsUpdate(value: boolean);
22
-
23
- get type(): number;
24
-
82
+ get type(): string | undefined;
83
+ onUpdate(callback: (this: this, frame: NodeFrame) => unknown, updateType: NodeUpdateType): this;
84
+ onFrameUpdate(callback: (this: this, frame: NodeFrame) => void): this;
85
+ onRenderUpdate(callback: (this: this, frame: NodeFrame) => void): this;
86
+ onObjectUpdate(callback: (this: this, frame: NodeFrame) => void): this;
87
+ onReference(callback: (this: this, frame: NodeBuilder | NodeFrame) => unknown): this;
88
+ getSelf(): this;
89
+ updateReference(state: NodeBuilder | NodeFrame): unknown;
25
90
  isGlobal(builder: NodeBuilder): boolean;
26
-
27
- getChildren(): Node[];
28
-
91
+ getChildren(): Generator<Node, void, unknown>;
92
+ dispose(): void;
93
+ traverse(callback: (node: Node) => void): void;
29
94
  getCacheKey(force?: boolean): string;
30
-
31
95
  getHash(builder: NodeBuilder): string;
32
-
33
96
  getUpdateType(): NodeUpdateType;
34
-
35
97
  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
-
98
+ getElementType(builder: NodeBuilder): "bool" | "int" | "float" | "vec2" | "vec3" | "vec4" | "uint" | null;
99
+ getNodeType(builder: NodeBuilder): string | null;
100
+ getShared(builder: NodeBuilder): Node;
101
+ setup(builder: NodeBuilder): unknown;
102
+ construct(builder: NodeBuilder): unknown;
43
103
  increaseUsage(builder: NodeBuilder): number;
44
-
45
104
  analyze(builder: NodeBuilder): void;
46
-
47
- generate(builder: NodeBuilder, output?: string | null): string;
48
-
105
+ generate(builder: NodeBuilder, output?: string | null): string | null | undefined;
49
106
  updateBefore(frame: NodeFrame): void;
50
-
51
- /** This method must be overriden when {@link updateType} !== 'none' */
52
107
  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;
108
+ build(builder: NodeBuilder, output?: string | null): string | null;
109
+ getSerializeChildren(): Generator<import("./NodeUtils.js").NodeChild, void, unknown>;
110
+ serialize(json: NodeJSONIntermediateOutputData): void;
111
+ deserialize(json: NodeJSONInputData): void;
112
+ toJSON(meta?: NodeJSONMeta | string): NodeJSONOutputData;
61
113
  }
114
+ export default Node;
115
+ export declare function addNodeClass(type: string, nodeClass: {
116
+ new(...args: any[]): Node;
117
+ }): void;
118
+ 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;
@@ -1,7 +1,7 @@
1
1
  import { BufferGeometry, Material, Object3D, Renderer } from "three";
2
2
  import FogNode from "../fog/FogNode.js";
3
3
  import LightsNode from "../lighting/LightsNode.js";
4
- import { AnyObject, NodeShaderStage, NodeTypeOption } from "./constants.js";
4
+ import { NodeShaderStage } from "./constants.js";
5
5
  import Node from "./Node.js";
6
6
  import NodeAttribute from "./NodeAttribute.js";
7
7
  import NodeCache from "./NodeCache.js";
@@ -18,12 +18,12 @@ export interface FlowData {
18
18
  }
19
19
 
20
20
  export interface NodeData {
21
- vertex: AnyObject;
22
- fragment: AnyObject;
23
- compute: AnyObject;
21
+ vertex: { [key: string]: unknown };
22
+ fragment: { [key: string]: unknown };
23
+ compute: { [key: string]: unknown };
24
24
  }
25
25
 
26
- export type NodeBuilderContext = AnyObject;
26
+ export type NodeBuilderContext = { [key: string]: unknown };
27
27
 
28
28
  export default abstract class NodeBuilder {
29
29
  object: Object3D;
@@ -76,35 +76,35 @@ export default abstract class NodeBuilder {
76
76
  isFlipY(): boolean;
77
77
 
78
78
  // @TODO: rename to .generateConst()
79
- getConst(type: NodeTypeOption, value?: unknown): Node;
80
- getType(type: NodeTypeOption): NodeTypeOption;
79
+ getConst(type: string, value?: unknown): Node;
80
+ getType(type: string): string;
81
81
 
82
82
  generateMethod(method: string): string;
83
83
 
84
- getAttribute(name: string, type: NodeTypeOption): NodeAttribute;
84
+ getAttribute(name: string, type: string): NodeAttribute;
85
85
 
86
86
  getPropertyName(node: Node, shaderStage: NodeShaderStage): string;
87
- isVector(type: NodeTypeOption): boolean;
88
-
89
- isMatrix(type: NodeTypeOption): boolean;
90
- isReference(type: NodeTypeOption): boolean;
91
- isShaderStage(shaderStage: NodeShaderStage): boolean;
92
- getComponentType(type: NodeTypeOption): NodeTypeOption;
93
- getVectorType(type: NodeTypeOption): NodeTypeOption;
94
- getTypeFromLength(length: number): NodeTypeOption;
95
- getTypeLength(type: NodeTypeOption): number;
96
- getVectorFromMatrix(type: NodeTypeOption): NodeTypeOption;
87
+ isVector(type: string): boolean;
88
+
89
+ isMatrix(type: string): boolean;
90
+ isReference(type: string): boolean;
91
+ getElementType(type: string): string | null;
92
+ getComponentType(type: string): string | null;
93
+ getVectorType(type: string): string;
94
+ getTypeFromLength(length: number): string;
95
+ getTypeLength(type: string): number;
96
+ getVectorFromMatrix(type: string): string;
97
97
  getDataFromNode(node: Node, shaderStage?: NodeShaderStage): NodeData;
98
- getNodeProperties(node: Node, shaderStage?: NodeShaderStage): AnyObject;
98
+ getNodeProperties(node: Node, shaderStage?: NodeShaderStage): { [key: string]: unknown };
99
99
  getUniformFromNode(
100
100
  node: Node,
101
- type: NodeTypeOption,
101
+ type: string,
102
102
  shaderStage?: NodeShaderStage,
103
103
  name?: string | null,
104
104
  ): NodeUniform<string>;
105
- getVarFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStage): NodeVar;
106
- getVaryFromNode(node: Node, type: NodeTypeOption): NodeVarying;
107
- getCodeFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStage): string;
105
+ getVarFromNode(node: Node, type: string, shaderStage?: NodeShaderStage): NodeVar;
106
+ getVaryFromNode(node: Node, type: string): NodeVarying;
107
+ getCodeFromNode(node: Node, type: string, shaderStage?: NodeShaderStage): string;
108
108
  addFlowCode(code: string): void;
109
109
  getFlowData(node: Node, shaderStage: NodeShaderStage): FlowData;
110
110
  flowNode(node: Node): FlowData;
@@ -128,6 +128,6 @@ export default abstract class NodeBuilder {
128
128
  getBuildStage(): BuildStageOption;
129
129
  abstract buildCode(): void;
130
130
  build(): this;
131
- format(snippet: string, fromType: NodeTypeOption, toType: NodeTypeOption): string;
131
+ format(snippet: string, fromType: string, toType: string): string;
132
132
  getSignature(): string;
133
133
  }
@@ -1,9 +1,43 @@
1
1
  import Node from "./Node.js";
2
- import { NodeData } from "./NodeBuilder.js";
3
-
4
- export default class NodeCache {
2
+ import NodeAttribute from "./NodeAttribute.js";
3
+ import NodeCode from "./NodeCode.js";
4
+ import NodeUniform from "./NodeUniform.js";
5
+ import NodeVar from "./NodeVar.js";
6
+ import NodeVarying from "./NodeVarying.js";
7
+ export interface ShaderStageNodeData {
8
+ properties?:
9
+ | (
10
+ & {
11
+ outputNode: Node | null;
12
+ initialized?: boolean | undefined;
13
+ }
14
+ & {
15
+ [K in `node${string}`]?: Node | undefined;
16
+ }
17
+ )
18
+ | undefined;
19
+ bufferAttribute?: NodeAttribute | undefined;
20
+ structType?: Node | undefined;
21
+ uniform?: NodeUniform<unknown> | undefined;
22
+ variable?: NodeVar | undefined;
23
+ varying?: NodeVarying | undefined;
24
+ code?: NodeCode | undefined;
25
+ usageCount?: number | undefined;
26
+ snippet?: string | undefined;
27
+ propertyName?: string | undefined;
28
+ propertySizeName?: string | undefined;
29
+ }
30
+ interface NodeData {
31
+ vertex?: ShaderStageNodeData | undefined;
32
+ fragment?: ShaderStageNodeData | undefined;
33
+ compute?: ShaderStageNodeData | undefined;
34
+ any?: ShaderStageNodeData | undefined;
35
+ }
36
+ declare class NodeCache {
5
37
  id: number;
6
38
  nodesData: WeakMap<Node, NodeData>;
7
-
8
39
  constructor();
40
+ getNodeData(node: Node): NodeData | undefined;
41
+ setNodeData(node: Node, data: NodeData): void;
9
42
  }
43
+ export default NodeCache;
@@ -1,14 +1,17 @@
1
1
  import Node from "./Node.js";
2
2
  import NodeBuilder from "./NodeBuilder.js";
3
-
4
- export default class NodeKeywords {
3
+ declare class NodeKeywords {
5
4
  keywords: string[];
6
- nodes: Node[];
7
- keywordsCallback: { [name: string]: (name: string) => Node };
8
-
5
+ nodes: {
6
+ [name: string]: Node;
7
+ };
8
+ keywordsCallback: {
9
+ [name: string]: (name: string) => Node;
10
+ };
11
+ constructor();
9
12
  getNode(name: string): Node;
10
- addKeyword(name: string, callback: (name: string) => Node): void;
11
-
13
+ addKeyword(name: string, callback: (name: string) => Node): this;
12
14
  parse(code: string): Node[];
13
15
  include(builder: NodeBuilder, code: string): void;
14
16
  }
17
+ export default NodeKeywords;
@@ -1,5 +1,5 @@
1
- import Node from "./Node.js";
2
-
3
- export default abstract class NodeParser {
4
- abstract parseFunction(source: string): Node;
1
+ import NodeFunction from "./NodeFunction.js";
2
+ declare abstract class NodeParser {
3
+ abstract parseFunction(source: string): NodeFunction;
5
4
  }
5
+ export default NodeParser;
@@ -1,17 +1,14 @@
1
1
  import UniformNode from "./UniformNode.js";
2
-
3
- export default class NodeUniform<Value> {
2
+ declare class NodeUniform<TValue> {
4
3
  readonly isNodeUniform: true;
5
-
6
4
  name: string;
7
- type: string;
8
- node: UniformNode<Value>;
5
+ type: string | null;
6
+ node: UniformNode<TValue>;
9
7
  needsUpdate: boolean | undefined;
10
-
11
- constructor(name: string, type: string, node: UniformNode<Value>, needsUpdate?: boolean);
12
-
13
- get(): Value;
14
- set value(val: Value);
15
-
8
+ constructor(name: string, type: string | null, node: UniformNode<TValue>, needsUpdate?: undefined);
9
+ get value(): TValue;
10
+ set value(val: TValue);
16
11
  get id(): number;
12
+ get groupNode(): import("./UniformGroupNode.js").default;
17
13
  }
14
+ export default NodeUniform;
@@ -1,6 +1,7 @@
1
- export default class NodeVar {
2
- isNodeVar: true;
1
+ declare class NodeVar {
2
+ readonly isNodeVar: true;
3
3
  name: string;
4
- type: string;
5
- constructor(name: string, type: string);
4
+ type: string | null;
5
+ constructor(name: string, type: string | null);
6
6
  }
7
+ export default NodeVar;
@@ -1,8 +1,7 @@
1
1
  import NodeVar from "./NodeVar.js";
2
-
3
- export default class NodeVarying extends NodeVar {
4
- needsInterpolation: false;
5
- isNodeVarying: true;
6
-
7
- constructor(name: string, type: string);
2
+ declare class NodeVarying extends NodeVar {
3
+ needsInterpolation: boolean;
4
+ readonly isNodeVarying: true;
5
+ constructor(name: string, type: string | null);
8
6
  }
7
+ export default NodeVarying;
@@ -1,5 +1,4 @@
1
1
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
2
- import { NodeTypeOption } from "./constants.js";
3
2
  import Node from "./Node.js";
4
3
 
5
4
  export default class PropertyNode extends Node {
@@ -8,11 +7,11 @@ export default class PropertyNode extends Node {
8
7
 
9
8
  readonly isPropertyNode: true;
10
9
 
11
- constructor(nodeType?: NodeTypeOption | null, name?: string | null, varying?: boolean);
10
+ constructor(nodeType?: string | null, name?: string | null, varying?: boolean);
12
11
  }
13
12
 
14
- export const property: (type?: NodeTypeOption | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
15
- export const varyingProperty: (type?: NodeTypeOption | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
13
+ export const property: (type?: string | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
14
+ export const varyingProperty: (type?: string | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
16
15
 
17
16
  export const diffuseColor: ShaderNodeObject<PropertyNode>;
18
17
  export const roughness: ShaderNodeObject<PropertyNode>;
@@ -40,3 +39,4 @@ export const transmission: ShaderNodeObject<PropertyNode>;
40
39
  export const thickness: ShaderNodeObject<PropertyNode>;
41
40
  export const attenuationDistance: ShaderNodeObject<PropertyNode>;
42
41
  export const attenuationColor: ShaderNodeObject<PropertyNode>;
42
+ export const dispersion: ShaderNodeObject<PropertyNode>;
@@ -7,5 +7,11 @@ export default class StackNode extends Node {
7
7
 
8
8
  constructor();
9
9
 
10
- assign(targetNode: Node, sourceValue: Node): this;
10
+ add(node: Node): this;
11
+
12
+ if(boolNode: Node, method: () => void): this;
13
+
14
+ elseIf(node: Node, method: () => void): this;
15
+
16
+ else(node: Node, method: () => void): this;
11
17
  }
@@ -0,0 +1,8 @@
1
+ import Node from "./Node.js";
2
+ declare class StructTypeNode extends Node {
3
+ types: string[];
4
+ readonly isStructTypeNode: true;
5
+ constructor(types: string[]);
6
+ getMemberTypes(): string[];
7
+ }
8
+ export default StructTypeNode;
@@ -1,11 +1,10 @@
1
- import { NodeTypeOption } from "./constants.js";
2
1
  import Node from "./Node.js";
3
2
  import NodeBuilder from "./NodeBuilder.js";
4
3
 
5
4
  export default class TempNode extends Node {
6
5
  isTempNode: true;
7
6
 
8
- constructor(type: NodeTypeOption | null);
7
+ constructor(type: string | null);
9
8
 
10
9
  hasDependencies(builder: NodeBuilder): boolean;
11
10
  }
@@ -0,0 +1,7 @@
1
+ export default class UniformGroup {
2
+ name: string;
3
+
4
+ readonly isUniformGroup: true;
5
+
6
+ constructor(name: string);
7
+ }