@types/three 0.160.0 → 0.161.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 (135) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +5 -1
  3. three/examples/jsm/capabilities/WebGPU.d.ts +2 -0
  4. three/examples/jsm/curves/NURBSUtils.d.ts +136 -10
  5. three/examples/jsm/curves/NURBSVolume.d.ts +23 -0
  6. three/examples/jsm/exporters/USDZExporter.d.ts +1 -0
  7. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -0
  8. three/examples/jsm/loaders/KTX2Loader.d.ts +44 -4
  9. three/examples/jsm/loaders/LUT3dlLoader.d.ts +29 -2
  10. three/examples/jsm/loaders/LUTCubeLoader.d.ts +37 -2
  11. three/examples/jsm/materials/MeshPostProcessingMaterial.d.ts +13 -0
  12. three/examples/jsm/nodes/Nodes.d.ts +75 -10
  13. three/examples/jsm/nodes/accessors/CameraNode.d.ts +17 -6
  14. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +8 -2
  15. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +1 -1
  16. three/examples/jsm/nodes/accessors/ModelNode.d.ts +2 -0
  17. three/examples/jsm/nodes/accessors/Object3DNode.d.ts +10 -6
  18. three/examples/jsm/nodes/accessors/TextureBicubicNode.d.ts +18 -0
  19. three/examples/jsm/nodes/accessors/TextureNode.d.ts +11 -3
  20. three/examples/jsm/nodes/accessors/VertexColorNode.d.ts +12 -0
  21. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +6 -0
  22. three/examples/jsm/nodes/core/AssignNode.d.ts +17 -0
  23. three/examples/jsm/nodes/core/BypassNode.d.ts +6 -0
  24. three/examples/jsm/nodes/core/CacheNode.d.ts +8 -0
  25. three/examples/jsm/nodes/core/ContextNode.d.ts +8 -0
  26. three/examples/jsm/nodes/core/IndexNode.d.ts +18 -0
  27. three/examples/jsm/nodes/core/LightingModel.d.ts +36 -0
  28. three/examples/jsm/nodes/core/Node.d.ts +32 -8
  29. three/examples/jsm/nodes/core/NodeBuilder.d.ts +22 -21
  30. three/examples/jsm/nodes/core/NodeFrame.d.ts +18 -6
  31. three/examples/jsm/nodes/core/PropertyNode.d.ts +19 -2
  32. three/examples/jsm/nodes/core/VarNode.d.ts +8 -2
  33. three/examples/jsm/nodes/core/VaryingNode.d.ts +6 -0
  34. three/examples/jsm/nodes/core/constants.d.ts +23 -24
  35. three/examples/jsm/nodes/display/AfterImageNode.d.ts +25 -0
  36. three/examples/jsm/nodes/display/AnamorphicNode.d.ts +32 -0
  37. three/examples/jsm/nodes/display/BlendModeNode.d.ts +14 -4
  38. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +11 -0
  39. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +15 -2
  40. three/examples/jsm/nodes/display/GaussianBlurNode.d.ts +28 -0
  41. three/examples/jsm/nodes/display/NormalMapNode.d.ts +6 -0
  42. three/examples/jsm/nodes/display/PassNode.d.ts +44 -0
  43. three/examples/jsm/nodes/display/PosterizeNode.d.ts +6 -0
  44. three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +32 -0
  45. three/examples/jsm/nodes/display/ViewportSharedTextureNode.d.ts +18 -0
  46. three/examples/jsm/nodes/display/ViewportTextureNode.d.ts +33 -0
  47. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +6 -0
  48. three/examples/jsm/nodes/fog/FogNode.d.ts +6 -0
  49. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +6 -0
  50. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +9 -2
  51. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +3 -2
  52. three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.d.ts +7 -0
  53. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +3 -2
  54. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +3 -2
  55. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +3 -2
  56. three/examples/jsm/nodes/functions/PhongLightingModel.d.ts +7 -0
  57. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +17 -8
  58. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +6 -0
  59. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +20 -13
  60. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +1 -2
  61. three/examples/jsm/nodes/materials/Materials.d.ts +9 -17
  62. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +2 -4
  63. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +12 -0
  64. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +3 -7
  65. three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +17 -0
  66. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +1 -2
  67. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +30 -14
  68. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +2 -8
  69. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +0 -10
  70. three/examples/jsm/nodes/math/CondNode.d.ts +6 -0
  71. three/examples/jsm/nodes/math/HashNode.d.ts +16 -0
  72. three/examples/jsm/nodes/math/MathNode.d.ts +15 -9
  73. three/examples/jsm/nodes/math/MathUtils.d.ts +16 -0
  74. three/examples/jsm/nodes/math/OperatorNode.d.ts +5 -4
  75. three/examples/jsm/nodes/math/TriNoise3D.d.ts +12 -0
  76. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +6 -0
  77. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +55 -4
  78. three/examples/jsm/nodes/utils/DiscardNode.d.ts +16 -0
  79. three/examples/jsm/nodes/utils/ReflectorNode.d.ts +30 -0
  80. three/examples/jsm/nodes/utils/RemapNode.d.ts +23 -4
  81. three/examples/jsm/nodes/utils/RotateNode.d.ts +21 -0
  82. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +6 -0
  83. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +6 -0
  84. three/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
  85. three/examples/jsm/objects/QuadMesh.d.ts +3 -1
  86. three/examples/jsm/postprocessing/GTAOPass.d.ts +3 -0
  87. three/examples/jsm/postprocessing/SSAOPass.d.ts +1 -1
  88. three/examples/jsm/renderers/common/Backend.d.ts +6 -2
  89. three/examples/jsm/renderers/common/Color4.d.ts +9 -0
  90. three/examples/jsm/renderers/common/Info.d.ts +7 -1
  91. three/examples/jsm/renderers/common/PostProcessing.d.ts +11 -0
  92. three/examples/jsm/renderers/common/Renderer.d.ts +243 -4
  93. three/examples/jsm/renderers/common/StorageTexture.d.ts +5 -0
  94. three/examples/jsm/renderers/webgl/WebGLBackend.d.ts +4 -2
  95. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +2 -2
  96. three/examples/jsm/renderers/webgpu/WebGPUBackend.d.ts +15 -6
  97. three/examples/jsm/renderers/webgpu/WebGPURenderer.d.ts +7 -7
  98. three/examples/jsm/utils/BufferGeometryUtils.d.ts +0 -10
  99. three/examples/jsm/webxr/XRControllerModelFactory.d.ts +6 -5
  100. three/examples/jsm/webxr/XRHandMeshModel.d.ts +10 -2
  101. three/package.json +2 -2
  102. three/src/cameras/PerspectiveCamera.d.ts +13 -0
  103. three/src/constants.d.ts +1 -2
  104. three/src/core/InterleavedBufferAttribute.d.ts +12 -2
  105. three/src/core/Object3D.d.ts +13 -13
  106. three/src/extras/core/Curve.d.ts +9 -9
  107. three/src/extras/core/CurvePath.d.ts +8 -7
  108. three/src/geometries/RingGeometry.d.ts +1 -1
  109. three/src/materials/Material.d.ts +3 -1
  110. three/src/materials/ShaderMaterial.d.ts +9 -1
  111. three/src/math/Color.d.ts +1 -1
  112. three/src/math/Quaternion.d.ts +27 -30
  113. three/src/math/Triangle.d.ts +0 -17
  114. three/src/math/Vector2.d.ts +24 -159
  115. three/src/math/Vector3.d.ts +46 -54
  116. three/src/math/Vector4.d.ts +25 -20
  117. three/src/objects/BatchedMesh.d.ts +2 -2
  118. three/src/objects/Bone.d.ts +2 -2
  119. three/src/objects/InstancedMesh.d.ts +2 -1
  120. three/src/objects/LOD.d.ts +2 -2
  121. three/src/objects/Line.d.ts +3 -2
  122. three/src/objects/LineLoop.d.ts +3 -1
  123. three/src/objects/LineSegments.d.ts +3 -1
  124. three/src/objects/Points.d.ts +3 -2
  125. three/src/objects/SkinnedMesh.d.ts +3 -6
  126. three/src/objects/Sprite.d.ts +2 -2
  127. three/src/renderers/webgl/WebGLProgram.d.ts +0 -1
  128. three/src/renderers/webgl/WebGLPrograms.d.ts +3 -1
  129. three/src/renderers/webxr/WebXRDepthSensing.d.ts +27 -0
  130. three/src/renderers/webxr/WebXRManager.d.ts +2 -1
  131. three/src/textures/DataArrayTexture.d.ts +1 -1
  132. three/src/textures/Source.d.ts +11 -1
  133. three/build/three.d.ts +0 -2
  134. three/build/three.min.d.ts +0 -2
  135. three/examples/jsm/objects/GroundProjectedSkybox.d.ts +0 -13
@@ -1,18 +1,29 @@
1
1
  import Object3DNode, { Object3DNodeScope } from './Object3DNode.js';
2
2
  import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
3
 
4
- export type CameraNodeScope = Object3DNodeScope | typeof CameraNode.PROJECTION_MATRIX;
4
+ export type CameraNodeScope =
5
+ | Object3DNodeScope
6
+ | typeof CameraNode.PROJECTION_MATRIX
7
+ | typeof CameraNode.PROJECTION_MATRIX_INVERSE
8
+ | typeof CameraNode.NEAR
9
+ | typeof CameraNode.FAR
10
+ | typeof CameraNode.LOG_DEPTH;
5
11
 
6
12
  export default class CameraNode extends Object3DNode {
7
- static PROJECTION_MATRIX: 'projectionMatrix';
8
-
9
- // @ts-expect-error
10
- scope: CameraNodeScope;
13
+ constructor(scope?: string);
11
14
 
12
- constructor(scope?: CameraNodeScope);
15
+ static PROJECTION_MATRIX: 'projectionMatrix';
16
+ static PROJECTION_MATRIX_INVERSE: 'projectionMatrixInverse';
17
+ static NEAR: 'near';
18
+ static FAR: 'far';
19
+ static LOG_DEPTH: 'logDepth';
13
20
  }
14
21
 
15
22
  export const cameraProjectionMatrix: ShaderNodeObject<CameraNode>;
23
+ export const cameraProjectionMatrixInverse: ShaderNodeObject<CameraNode>;
24
+ export const cameraNear: ShaderNodeObject<CameraNode>;
25
+ export const cameraFar: ShaderNodeObject<CameraNode>;
26
+ export const cameraLogDepth: ShaderNodeObject<CameraNode>;
16
27
  export const cameraViewMatrix: ShaderNodeObject<CameraNode>;
17
28
  export const cameraNormalMatrix: ShaderNodeObject<CameraNode>;
18
29
  export const cameraWorldMatrix: ShaderNodeObject<CameraNode>;
@@ -5,8 +5,8 @@ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.j
5
5
 
6
6
  export default class CubeTextureNode extends TextureNode {
7
7
  isCubeTextureNode: boolean;
8
- uvNode: Node | null;
9
- levelNode: Node | null;
8
+ uvNode: ShaderNodeObject<Node> | null;
9
+ levelNode: ShaderNodeObject<Node> | null;
10
10
 
11
11
  constructor(value: CubeTexture, uvNode?: Node | null, levelNode?: Node | null);
12
12
 
@@ -18,3 +18,9 @@ export const cubeTexture: (
18
18
  uvNode?: NodeRepresentation,
19
19
  levelNode?: NodeRepresentation,
20
20
  ) => ShaderNodeObject<CubeTextureNode>;
21
+
22
+ declare module '../shadernode/ShaderNode.js' {
23
+ interface NodeElements {
24
+ cubeTexture: typeof cubeTexture;
25
+ }
26
+ }
@@ -9,5 +9,5 @@ export default class MaterialReferenceNode extends ReferenceNode<Material | null
9
9
  export const materialReference: (
10
10
  name: string,
11
11
  nodeOrType: NodeOrType,
12
- material: Material,
12
+ material?: Material | null,
13
13
  ) => ShaderNodeObject<MaterialReferenceNode>;
@@ -8,8 +8,10 @@ export default class ModelNode extends Object3DNode {
8
8
  constructor(scope?: Object3DNodeScope);
9
9
  }
10
10
 
11
+ export const modelDirection: ShaderNodeObject<ModelNode>;
11
12
  export const modelViewMatrix: ShaderNodeObject<ModelNode>;
12
13
  export const modelNormalMatrix: ShaderNodeObject<ModelNode>;
13
14
  export const modelWorldMatrix: ShaderNodeObject<ModelNode>;
14
15
  export const modelPosition: ShaderNodeObject<ModelNode>;
16
+ export const modelScale: ShaderNodeObject<ModelNode>;
15
17
  export const modelViewPosition: ShaderNodeObject<ModelNode>;
@@ -6,17 +6,21 @@ export type Object3DNodeScope =
6
6
  | typeof Object3DNode.NORMAL_MATRIX
7
7
  | typeof Object3DNode.WORLD_MATRIX
8
8
  | typeof Object3DNode.POSITION
9
- | typeof Object3DNode.VIEW_POSITION;
9
+ | typeof Object3DNode.SCALE
10
+ | typeof Object3DNode.VIEW_POSITION
11
+ | typeof Object3DNode.DIRECTION;
10
12
 
11
13
  export default class Object3DNode extends Node {
14
+ scope: string;
15
+ object3d: Object3D | null;
16
+
17
+ constructor(scope?: string, object3d?: Object3D | null);
18
+
12
19
  static VIEW_MATRIX: 'viewMatrix';
13
20
  static NORMAL_MATRIX: 'normalMatrix';
14
21
  static WORLD_MATRIX: 'worldMatrix';
15
22
  static POSITION: 'position';
23
+ static SCALE: 'scale';
16
24
  static VIEW_POSITION: 'viewPosition';
17
-
18
- scope: Object3DNodeScope;
19
- object3d: Object3D | null;
20
-
21
- constructor(scope?: Object3DNodeScope, object3d?: Object3D | null);
25
+ static DIRECTION: 'direction';
22
26
  }
@@ -0,0 +1,18 @@
1
+ import Node from '../core/Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
+ import TempNode from '../core/TempNode.js';
4
+
5
+ export default class TextureBicubicNode extends TempNode {
6
+ textureNode: Node;
7
+ blurNode: Node;
8
+
9
+ constructor(textureNode: Node, blurNode?: Node);
10
+ }
11
+
12
+ export const textureBicubic: (textureNode: Node, blurNode?: NodeRepresentation) => ShaderNodeObject<TextureBicubicNode>;
13
+
14
+ declare module '../shadernode/ShaderNode.js' {
15
+ interface NodeElements {
16
+ bicubic: typeof textureBicubic;
17
+ }
18
+ }
@@ -6,12 +6,14 @@ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.j
6
6
  export default class TextureNode extends UniformNode<Texture> {
7
7
  isTextureNode: true;
8
8
 
9
- uvNode: Node | null;
10
- levelNode: Node | null;
9
+ uvNode: ShaderNodeObject<Node> | null;
10
+ levelNode: ShaderNodeObject<Node> | null;
11
11
 
12
- constructor(value: Texture, uvNode?: Node, levelNode?: Node | null);
12
+ constructor(value: Texture, uvNode?: ShaderNodeObject<Node>, levelNode?: ShaderNodeObject<Node> | null);
13
13
 
14
14
  getDefaultUV(): Node;
15
+
16
+ clone(): this;
15
17
  }
16
18
 
17
19
  export const texture: (
@@ -20,3 +22,9 @@ export const texture: (
20
22
  levelNode?: NodeRepresentation,
21
23
  ) => ShaderNodeObject<TextureNode>;
22
24
  export const sampler: (aTexture: Texture | TextureNode) => ShaderNodeObject<Node>;
25
+
26
+ declare module '../shadernode/ShaderNode.js' {
27
+ interface NodeElements {
28
+ texture: typeof texture;
29
+ }
30
+ }
@@ -0,0 +1,12 @@
1
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
+ import AttributeNode from '../core/AttributeNode.js';
3
+
4
+ export default class VertexColorNode extends AttributeNode {
5
+ readonly isVertexColorNode: true;
6
+
7
+ index: number;
8
+
9
+ constructor(index?: number);
10
+ }
11
+
12
+ export const vertexColor: (index?: number) => ShaderNodeObject<VertexColorNode>;
@@ -17,3 +17,9 @@ export const call: <P extends FunctionNodeArguments>(
17
17
  functionNode?: FunctionNode<P>,
18
18
  parameters?: ProxiedObject<P>,
19
19
  ) => ShaderNodeObject<FunctionCallNode<P>>;
20
+
21
+ declare module '../shadernode/ShaderNode.js' {
22
+ interface NodeElements {
23
+ call: typeof call;
24
+ }
25
+ }
@@ -0,0 +1,17 @@
1
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
+ import Node from './Node.js';
3
+ import TempNode from './TempNode.js';
4
+
5
+ export default class AssignNode extends TempNode {
6
+ constructor(targetNode: Node, sourceNode: Node);
7
+
8
+ hasDependencies(): false;
9
+ }
10
+
11
+ export const assign: (targetNode: NodeRepresentation, sourceNode: NodeRepresentation) => ShaderNodeObject<AssignNode>;
12
+
13
+ declare module '../shadernode/ShaderNode.js' {
14
+ interface NodeElements {
15
+ assign: typeof assign;
16
+ }
17
+ }
@@ -10,3 +10,9 @@ export default class BypassNode extends Node {
10
10
  }
11
11
 
12
12
  export const bypass: (returnNode: NodeRepresentation, callNode: NodeRepresentation) => ShaderNodeObject<BypassNode>;
13
+
14
+ declare module '../shadernode/ShaderNode.js' {
15
+ interface NodeElements {
16
+ bypass: typeof bypass;
17
+ }
18
+ }
@@ -11,3 +11,11 @@ export default class CacheNode extends Node {
11
11
  }
12
12
 
13
13
  export const cache: (node: Node, cache?: NodeCache) => ShaderNodeObject<CacheNode>;
14
+ export const globalCache: (node: Node) => ShaderNodeObject<CacheNode>;
15
+
16
+ declare module '../shadernode/ShaderNode.js' {
17
+ interface NodeElements {
18
+ cache: typeof cache;
19
+ globalCache: typeof globalCache;
20
+ }
21
+ }
@@ -11,3 +11,11 @@ export default class ContextNode extends Node {
11
11
  }
12
12
 
13
13
  export const context: (node: NodeRepresentation, context: NodeBuilderContext) => ShaderNodeObject<ContextNode>;
14
+ export const label: (node: NodeRepresentation, label: string) => ShaderNodeObject<ContextNode>;
15
+
16
+ declare module '../shadernode/ShaderNode.js' {
17
+ interface NodeElements {
18
+ context: typeof context;
19
+ label: typeof label;
20
+ }
21
+ }
@@ -0,0 +1,18 @@
1
+ import Node from './Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
+
4
+ export type IndexNodeScope = typeof IndexNode.VERTEX | typeof IndexNode.INSTANCE;
5
+
6
+ export default class IndexNode extends Node {
7
+ scope: IndexNodeScope;
8
+
9
+ readonly isInstanceNode: true;
10
+
11
+ constructor(scope: IndexNodeScope);
12
+
13
+ static VERTEX: 'vertex';
14
+ static INSTANCE: 'instance';
15
+ }
16
+
17
+ export const vertexIndex: ShaderNodeObject<IndexNode>;
18
+ export const instanceIndex: ShaderNodeObject<IndexNode>;
@@ -0,0 +1,36 @@
1
+ import Node from './Node.js';
2
+ import NodeBuilder from './NodeBuilder.js';
3
+ import StackNode from './StackNode.js';
4
+
5
+ export interface LightingModelReflectedLight {
6
+ directDiffuse: Node;
7
+ directSpecular: Node;
8
+ indirectDiffuse: Node;
9
+ indirectSpecular: Node;
10
+ }
11
+
12
+ export interface LightingModelDirectInput {
13
+ lightDirection: Node;
14
+ lightColor: Node;
15
+ reflectedLight: LightingModelReflectedLight;
16
+ }
17
+
18
+ export interface LightingModelIndirectInput {
19
+ radiance: Node;
20
+ irradiance: Node;
21
+ iblIrradiance: Node;
22
+ ambientOcclusion: Node;
23
+ reflectedLight: LightingModelReflectedLight;
24
+ backdrop: Node;
25
+ backdropAlpha: Node;
26
+ outgoingLight: Node;
27
+ }
28
+
29
+ export default class LightingModel {
30
+ start(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
31
+ finish(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
32
+ direct(input: LightingModelDirectInput, stack: StackNode, builder: NodeBuilder): void;
33
+ indirectDiffuse(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
34
+ indirectSpecular(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
35
+ ambientOcclusion(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
36
+ }
@@ -1,31 +1,55 @@
1
- import { AnyJson, NodeTypeOption, NodeUpdateTypeOption } from './constants.js';
1
+ import { AnyJson, NodeTypeOption, NodeUpdateType } from './constants.js';
2
2
  import NodeBuilder from './NodeBuilder.js';
3
3
  import NodeFrame from './NodeFrame.js';
4
4
 
5
5
  export default abstract class Node {
6
- uuid: string;
7
- type: string;
8
- isNode: true;
6
+ readonly isNode: true;
7
+
9
8
  nodeType: NodeTypeOption | null;
10
- updateType: NodeUpdateTypeOption;
11
- id: number;
9
+
10
+ updateType: NodeUpdateType;
11
+ updateBeforeType: NodeUpdateType;
12
+
13
+ uuid: string;
14
+
15
+ readonly id: number;
12
16
 
13
17
  constructor(nodeType?: NodeTypeOption | null);
14
18
 
19
+ get type(): number;
20
+
15
21
  isGlobal(builder: NodeBuilder): boolean;
22
+
16
23
  getChildren(): Node[];
24
+
25
+ getCacheKey(): string;
26
+
17
27
  getHash(builder: NodeBuilder): string;
18
- getUpdateType(builder: NodeBuilder): NodeUpdateTypeOption;
28
+
29
+ getUpdateType(): NodeUpdateType;
30
+
31
+ getUpdateBeforeType(): NodeUpdateType;
32
+
19
33
  getNodeType(builder: NodeBuilder, output?: string | null): NodeTypeOption | null;
34
+
20
35
  getReference(builder: NodeBuilder): Node;
36
+
21
37
  setup(builder: NodeBuilder): Node | null;
38
+
22
39
  analyze(builder: NodeBuilder): void;
40
+
23
41
  generate(builder: NodeBuilder, output?: string | null): string;
42
+
43
+ updateBefore(frame: NodeFrame): void;
44
+
24
45
  /** This method must be overriden when {@link updateType} !== 'none' */
25
46
  update(frame: NodeFrame): void;
47
+
26
48
  build(builder: NodeBuilder, output?: string | null): string;
49
+
27
50
  serialize(json: AnyJson): void;
51
+
28
52
  deserialize(json: AnyJson): void;
53
+
29
54
  toJSON(meta?: string | { textures: {}; images: {}; nodes: {} }): AnyJson;
30
- getCacheKey(): string;
31
55
  }
@@ -9,7 +9,7 @@ import {
9
9
  } from '../../../../src/Three.js';
10
10
  import FogNode from '../fog/FogNode.js';
11
11
  import LightsNode from '../lighting/LightsNode.js';
12
- import { AnyObject, NodeShaderStageOption, NodeTypeOption } from './constants.js';
12
+ import { AnyObject, NodeShaderStage, NodeTypeOption } from './constants.js';
13
13
  import Node from './Node.js';
14
14
  import NodeAttribute from './NodeAttribute.js';
15
15
  import NodeCache from './NodeCache.js';
@@ -17,6 +17,7 @@ import NodeParser from './NodeParser.js';
17
17
  import NodeUniform from './NodeUniform.js';
18
18
  import NodeVar from './NodeVar.js';
19
19
  import NodeVarying from './NodeVarying.js';
20
+ import StackNode from './StackNode.js';
20
21
 
21
22
  export type BuildStageOption = 'construct' | 'analyze' | 'generate';
22
23
 
@@ -58,9 +59,9 @@ export default abstract class NodeBuilder {
58
59
  */
59
60
  flowsData: any;
60
61
 
61
- shaderStage: NodeShaderStageOption | null;
62
+ shaderStage: NodeShaderStage | null;
62
63
  buildStage: BuildStageOption | null;
63
- stack: Node[];
64
+ stack: StackNode;
64
65
 
65
66
  setHashNode(node: Node, hash: string): void;
66
67
  addNode(node: Node): void;
@@ -68,7 +69,7 @@ export default abstract class NodeBuilder {
68
69
  getMethod(method: string): string;
69
70
  getNodeFromHash(hash: string): Node;
70
71
 
71
- addFlow(shaderStage: NodeShaderStageOption, node: Node): Node;
72
+ addFlow(shaderStage: NodeShaderStage, node: Node): Node;
72
73
 
73
74
  setContext(context: NodeBuilderContext): void;
74
75
  getContext(): NodeBuilderContext;
@@ -90,52 +91,52 @@ export default abstract class NodeBuilder {
90
91
 
91
92
  getAttribute(name: string, type: NodeTypeOption): NodeAttribute;
92
93
 
93
- getPropertyName(node: Node, shaderStage: NodeShaderStageOption): string;
94
+ getPropertyName(node: Node, shaderStage: NodeShaderStage): string;
94
95
  isVector(type: NodeTypeOption): boolean;
95
96
 
96
97
  isMatrix(type: NodeTypeOption): boolean;
97
98
  isReference(type: NodeTypeOption): boolean;
98
- isShaderStage(shaderStage: NodeShaderStageOption): boolean;
99
+ isShaderStage(shaderStage: NodeShaderStage): boolean;
99
100
  getTextureEncodingFromMap(map: Texture | WebGLRenderTarget | unknown): TextureEncoding;
100
101
  getComponentType(type: NodeTypeOption): NodeTypeOption;
101
102
  getVectorType(type: NodeTypeOption): NodeTypeOption;
102
103
  getTypeFromLength(length: number): NodeTypeOption;
103
104
  getTypeLength(type: NodeTypeOption): number;
104
105
  getVectorFromMatrix(type: NodeTypeOption): NodeTypeOption;
105
- getDataFromNode(node: Node, shaderStage?: NodeShaderStageOption): NodeData;
106
- getNodeProperties(node: Node, shaderStage?: NodeShaderStageOption): AnyObject;
106
+ getDataFromNode(node: Node, shaderStage?: NodeShaderStage): NodeData;
107
+ getNodeProperties(node: Node, shaderStage?: NodeShaderStage): AnyObject;
107
108
  getUniformFromNode(
108
109
  node: Node,
109
110
  type: NodeTypeOption,
110
- shaderStage?: NodeShaderStageOption,
111
+ shaderStage?: NodeShaderStage,
111
112
  name?: string | null,
112
113
  ): NodeUniform<string>;
113
- getVarFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStageOption): NodeVar;
114
+ getVarFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStage): NodeVar;
114
115
  getVaryFromNode(node: Node, type: NodeTypeOption): NodeVarying;
115
- getCodeFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStageOption): string;
116
+ getCodeFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStage): string;
116
117
  addFlowCode(code: string): void;
117
- getFlowData(node: Node, shaderStage: NodeShaderStageOption): FlowData;
118
+ getFlowData(node: Node, shaderStage: NodeShaderStage): FlowData;
118
119
  flowNode(node: Node): FlowData;
119
120
  flowChildNode(node: Node, output?: string | null): FlowData;
120
121
  flowNodeFromShaderStage(
121
- shaderStage: NodeShaderStageOption,
122
+ shaderStage: NodeShaderStage,
122
123
  node: Node,
123
124
  output?: string | null,
124
125
  propertyName?: string,
125
126
  ): FlowData;
126
127
  hasGeometryAttribute(name: string): boolean;
127
- abstract getAttributes(shaderStage: NodeShaderStageOption): string;
128
- abstract getVarys(shaderStage: NodeShaderStageOption): string;
129
- getVars(shaderStage: NodeShaderStageOption): string;
130
- abstract getUniforms(stage: NodeShaderStageOption): string;
131
- getCodes(shaderStage: NodeShaderStageOption): string;
128
+ abstract getAttributes(shaderStage: NodeShaderStage): string;
129
+ abstract getVarys(shaderStage: NodeShaderStage): string;
130
+ getVars(shaderStage: NodeShaderStage): string;
131
+ abstract getUniforms(stage: NodeShaderStage): string;
132
+ getCodes(shaderStage: NodeShaderStage): string;
132
133
  getHash(): string;
133
- setShaderStage(shaderStage: NodeShaderStageOption): void;
134
- getShaderStage(): NodeShaderStageOption;
134
+ setShaderStage(shaderStage: NodeShaderStage): void;
135
+ getShaderStage(): NodeShaderStage;
135
136
  setBuildStage(buildStage: BuildStageOption): void;
136
137
  getBuildStage(): BuildStageOption;
137
138
  abstract buildCode(): void;
138
- build(): this;
139
+ build(createMaterial?: boolean): this;
139
140
  format(snippet: string, fromType: NodeTypeOption, toType: NodeTypeOption): string;
140
141
  getSignature(): string;
141
142
  }
@@ -1,19 +1,31 @@
1
- import { Camera, Material, Object3D, Renderer } from '../../../../src/Three.js';
1
+ import { Camera, Material, Object3D, Renderer, Scene } from '../../../../src/Three.js';
2
2
 
3
3
  import Node from './Node.js';
4
4
 
5
5
  export default class NodeFrame {
6
6
  time: number;
7
7
  deltaTime: number;
8
+
8
9
  frameId: number;
9
- startTime: null | number;
10
- renderer: null | Renderer;
11
- material: null | Material;
12
- camera: null | Camera;
13
- object: null | Object3D;
10
+ renderId: number;
11
+
12
+ startTime: number | null;
13
+
14
+ frameMap: WeakMap<Node, number>;
15
+ frameBeforeMap: WeakMap<Node, number>;
16
+ renderMap: WeakMap<Node, number>;
17
+ renderBeforeMap: WeakMap<Node, number>;
18
+
19
+ renderer: Renderer | null;
20
+ material: Material | null;
21
+ camera: Camera | null;
22
+ object: Object3D | null;
23
+ scene: Scene | null;
14
24
 
15
25
  constructor();
16
26
 
27
+ updateBeforeNode(node: Node): void;
28
+
17
29
  updateNode(node: Node): void;
18
30
  update(): void;
19
31
  }
@@ -3,13 +3,30 @@ import Node from './Node.js';
3
3
  import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
4
 
5
5
  export default class PropertyNode extends Node {
6
- constructor(name?: string, nodeType?: NodeTypeOption);
6
+ name: string | null;
7
+ varying: boolean;
8
+
9
+ readonly isPropertyNode: true;
10
+
11
+ constructor(nodeType?: NodeTypeOption | null, name?: string | null, varying?: boolean);
7
12
  }
8
13
 
9
- export const property: (name: string, nodeOrType: Node | NodeTypeOption) => ShaderNodeObject<Node>;
14
+ export const property: (type?: NodeTypeOption | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
15
+ export const varyingProperty: (type?: NodeTypeOption | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
10
16
 
11
17
  export const diffuseColor: ShaderNodeObject<PropertyNode>;
12
18
  export const roughness: ShaderNodeObject<PropertyNode>;
13
19
  export const metalness: ShaderNodeObject<PropertyNode>;
20
+ export const clearcoat: ShaderNodeObject<PropertyNode>;
21
+ export const clearcoatRoughness: ShaderNodeObject<PropertyNode>;
22
+ export const sheen: ShaderNodeObject<PropertyNode>;
23
+ export const sheenRoughness: ShaderNodeObject<PropertyNode>;
24
+ export const iridescence: ShaderNodeObject<PropertyNode>;
25
+ export const iridescenceIOR: ShaderNodeObject<PropertyNode>;
26
+ export const iridescenceThickness: ShaderNodeObject<PropertyNode>;
14
27
  export const specularColor: ShaderNodeObject<PropertyNode>;
15
28
  export const shininess: ShaderNodeObject<PropertyNode>;
29
+ export const output: ShaderNodeObject<PropertyNode>;
30
+ export const dashSize: ShaderNodeObject<PropertyNode>;
31
+ export const gapSize: ShaderNodeObject<PropertyNode>;
32
+ export const pointWidth: ShaderNodeObject<PropertyNode>;
@@ -16,5 +16,11 @@ export default class VarNode extends Node {
16
16
  div(...params: Node[]): this;
17
17
  }
18
18
 
19
- export const label: (node: NodeRepresentation, name?: string) => ShaderNodeObject<VarNode>;
20
- export const temp: (node: NodeRepresentation, name?: string) => ShaderNodeObject<VarNode>;
19
+ export const temp: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
20
+
21
+ declare module '../shadernode/ShaderNode.js' {
22
+ interface NodeElements {
23
+ temp: typeof temp;
24
+ toVar: typeof temp;
25
+ }
26
+ }
@@ -9,3 +9,9 @@ export default class VaryingNode extends Node {
9
9
  }
10
10
 
11
11
  export const varying: (node: NodeRepresentation, name?: string) => ShaderNodeObject<VaryingNode>;
12
+
13
+ declare module '../shadernode/ShaderNode.js' {
14
+ interface NodeElements {
15
+ varying: typeof varying;
16
+ }
17
+ }
@@ -1,18 +1,27 @@
1
- // disable automatic export, we have some private declarations
2
- export const NodeShaderStage: {
3
- VERTEX: 'vertex';
4
- FRAGMENT: 'fragment';
5
- };
1
+ export enum NodeShaderStage {
2
+ VERTEX = 'vertex',
3
+ FRAGMENT = 'fragment',
4
+ }
6
5
 
7
- export const NodeUpdateType: {
8
- NONE: 'none';
9
- FRAME: 'frame';
10
- RENDER: 'render';
11
- OBJECT: 'object';
12
- };
6
+ export enum NodeUpdateType {
7
+ NONE = 'none',
8
+ FRAME = 'frame',
9
+ RENDER = 'render',
10
+ OBJECT = 'object',
11
+ }
12
+
13
+ export enum NodeType {
14
+ BOOLEAN = 'bool',
15
+ INTEGER = 'int',
16
+ FLOAT = 'float',
17
+ VECTOR2 = 'vec2',
18
+ VECTOR3 = 'vec3',
19
+ VECTOR4 = 'vec4',
20
+ MATRIX2 = 'mat2',
21
+ MATRIX3 = 'mat3',
22
+ MATRIX4 = 'mat4',
23
+ }
13
24
 
14
- export type NodeUpdateTypeOption = 'none' | 'frame' | 'object';
15
- export type NodeShaderStageOption = 'vertex' | 'fragment' | 'compute';
16
25
  export type NodeTypeOption =
17
26
  | 'bool'
18
27
  | 'int'
@@ -20,6 +29,7 @@ export type NodeTypeOption =
20
29
  | 'vec2'
21
30
  | 'vec3'
22
31
  | 'vec4'
32
+ | 'mat2'
23
33
  | 'mat3'
24
34
  | 'mat4'
25
35
  | 'code' /* CodeNode */
@@ -67,14 +77,3 @@ export interface AnyObject {
67
77
 
68
78
  /** a generic JSON type, used by nodes only */
69
79
  export type AnyJson = any;
70
-
71
- export const NodeType: {
72
- BOOLEAN: 'bool';
73
- INTEGER: 'int';
74
- FLOAT: 'float';
75
- VECTOR2: 'vec2';
76
- VECTOR3: 'vec3';
77
- VECTOR4: 'vec4';
78
- MATRIX3: 'mat3';
79
- MATRIX4: 'mat4';
80
- };
@@ -0,0 +1,25 @@
1
+ import Node from '../core/Node.js';
2
+ import TempNode from '../core/TempNode.js';
3
+ import TextureNode from '../accessors/TextureNode.js';
4
+ import UniformNode from '../core/UniformNode.js';
5
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
6
+
7
+ export default class AfterImageNode extends TempNode {
8
+ textureNode: TextureNode;
9
+ textureNodeOld: Node;
10
+ damp: UniformNode<number>;
11
+
12
+ constructor(textureNode: Node, damp?: number);
13
+
14
+ getTextureNode(): TextureNode;
15
+
16
+ setSize(width: number, height: number): void;
17
+ }
18
+
19
+ export const afterImage: (node: Node, damp?: number) => ShaderNodeObject<AfterImageNode>;
20
+
21
+ declare module '../shadernode/ShaderNode.js' {
22
+ interface NodeElements {
23
+ afterImage: typeof afterImage;
24
+ }
25
+ }