@types/three 0.159.0 → 0.160.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 (129) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/loaders/KTX2Loader.d.ts +2 -8
  3. three/examples/jsm/loaders/MaterialXLoader.d.ts +6 -0
  4. three/examples/jsm/misc/Timer.d.ts +80 -0
  5. three/examples/jsm/nodes/Nodes.d.ts +238 -60
  6. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +9 -0
  7. three/examples/jsm/nodes/accessors/BufferNode.d.ts +4 -1
  8. three/examples/jsm/nodes/accessors/CameraNode.d.ts +7 -0
  9. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +9 -2
  10. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +3 -0
  11. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +12 -0
  12. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +7 -0
  13. three/examples/jsm/nodes/accessors/ModelNode.d.ts +7 -1
  14. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
  15. three/examples/jsm/nodes/accessors/NormalNode.d.ts +8 -0
  16. three/examples/jsm/nodes/accessors/PointUVNode.d.ts +3 -0
  17. three/examples/jsm/nodes/accessors/PositionNode.d.ts +8 -0
  18. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +4 -1
  19. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -0
  20. three/examples/jsm/nodes/accessors/SkinningNode.d.ts +3 -0
  21. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +8 -1
  22. three/examples/jsm/nodes/accessors/TangentNode.d.ts +9 -0
  23. three/examples/jsm/nodes/accessors/TextureNode.d.ts +10 -2
  24. three/examples/jsm/nodes/accessors/UVNode.d.ts +3 -0
  25. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +7 -0
  26. three/examples/jsm/nodes/code/CodeNode.d.ts +4 -0
  27. three/examples/jsm/nodes/code/ExpressionNode.d.ts +3 -0
  28. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +7 -1
  29. three/examples/jsm/nodes/code/FunctionNode.d.ts +17 -0
  30. three/examples/jsm/nodes/core/ArrayUniformNode.d.ts +1 -1
  31. three/examples/jsm/nodes/core/AttributeNode.d.ts +3 -0
  32. three/examples/jsm/nodes/core/BypassNode.d.ts +3 -0
  33. three/examples/jsm/nodes/core/CacheNode.d.ts +3 -0
  34. three/examples/jsm/nodes/core/ConstNode.d.ts +3 -3
  35. three/examples/jsm/nodes/core/ContextNode.d.ts +3 -0
  36. three/examples/jsm/nodes/core/InputNode.d.ts +4 -4
  37. three/examples/jsm/nodes/core/NodeBuilder.d.ts +6 -3
  38. three/examples/jsm/nodes/core/NodeUniform.d.ts +12 -8
  39. three/examples/jsm/nodes/core/NodeUtils.d.ts +6 -3
  40. three/examples/jsm/nodes/core/PropertyNode.d.ts +9 -0
  41. three/examples/jsm/nodes/core/UniformNode.d.ts +12 -4
  42. three/examples/jsm/nodes/core/VarNode.d.ts +4 -0
  43. three/examples/jsm/nodes/core/VaryingNode.d.ts +3 -0
  44. three/examples/jsm/nodes/core/constants.d.ts +9 -5
  45. three/examples/jsm/nodes/display/BlendModeNode.d.ts +7 -2
  46. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +18 -1
  47. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +4 -0
  48. three/examples/jsm/nodes/display/FrontFacingNode.d.ts +4 -0
  49. three/examples/jsm/nodes/display/NormalMapNode.d.ts +7 -1
  50. three/examples/jsm/nodes/display/PosterizeNode.d.ts +6 -0
  51. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +8 -1
  52. three/examples/jsm/nodes/display/ViewportNode.d.ts +8 -0
  53. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +3 -0
  54. three/examples/jsm/nodes/fog/FogNode.d.ts +3 -0
  55. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +3 -0
  56. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +1 -1
  57. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +1 -1
  58. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +1 -1
  59. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +1 -1
  60. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +1 -1
  61. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +1 -1
  62. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +1 -1
  63. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +1 -1
  64. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +1 -1
  65. three/examples/jsm/nodes/geometry/RangeNode.d.ts +3 -0
  66. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +7 -0
  67. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +6 -1
  68. three/examples/jsm/nodes/lighting/LightsNode.d.ts +3 -0
  69. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +18 -5
  70. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -3
  71. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +25 -2
  72. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +43 -34
  73. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +5 -3
  74. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +7 -5
  75. three/examples/jsm/nodes/math/CondNode.d.ts +7 -0
  76. three/examples/jsm/nodes/math/MathNode.d.ts +134 -1
  77. three/examples/jsm/nodes/math/OperatorNode.d.ts +51 -0
  78. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +3 -0
  79. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +75 -33
  80. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +4 -2
  81. three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +3 -0
  82. three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +6 -3
  83. three/examples/jsm/nodes/utils/OscNode.d.ts +6 -0
  84. three/examples/jsm/nodes/utils/RemapNode.d.ts +4 -0
  85. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +3 -0
  86. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +5 -1
  87. three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +7 -0
  88. three/examples/jsm/nodes/utils/TimerNode.d.ts +7 -1
  89. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +22 -7
  90. three/examples/jsm/objects/QuadMesh.d.ts +13 -0
  91. three/examples/jsm/postprocessing/{HBAOPass.d.ts → GTAOPass.d.ts} +22 -10
  92. three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.d.ts +3 -0
  93. three/examples/jsm/shaders/{HBAOShader.d.ts → GTAOShader.d.ts} +23 -8
  94. three/examples/jsm/shaders/PoissonDenoiseShader.d.ts +1 -1
  95. three/package.json +2 -2
  96. three/src/Three.d.ts +1 -0
  97. three/src/constants.d.ts +3 -1
  98. three/src/core/UniformsGroup.d.ts +3 -3
  99. three/src/lights/PointLight.d.ts +7 -0
  100. three/src/loaders/MaterialLoader.d.ts +6 -3
  101. three/src/materials/LineBasicMaterial.d.ts +7 -0
  102. three/src/materials/LineDashedMaterial.d.ts +7 -1
  103. three/src/materials/Material.d.ts +14 -14
  104. three/src/materials/MeshBasicMaterial.d.ts +7 -0
  105. three/src/materials/MeshDepthMaterial.d.ts +6 -0
  106. three/src/materials/MeshDistanceMaterial.d.ts +7 -0
  107. three/src/materials/MeshLambertMaterial.d.ts +7 -0
  108. three/src/materials/MeshMatcapMaterial.d.ts +7 -0
  109. three/src/materials/MeshNormalMaterial.d.ts +7 -0
  110. three/src/materials/MeshPhongMaterial.d.ts +7 -0
  111. three/src/materials/MeshPhysicalMaterial.d.ts +6 -1
  112. three/src/materials/MeshStandardMaterial.d.ts +7 -2
  113. three/src/materials/MeshToonMaterial.d.ts +7 -0
  114. three/src/materials/PointsMaterial.d.ts +7 -0
  115. three/src/materials/RawShaderMaterial.d.ts +9 -0
  116. three/src/materials/ShaderMaterial.d.ts +9 -3
  117. three/src/materials/ShadowMaterial.d.ts +7 -0
  118. three/src/materials/SpriteMaterial.d.ts +7 -2
  119. three/src/math/Matrix4.d.ts +30 -30
  120. three/src/math/Sphere.d.ts +5 -0
  121. three/src/math/Triangle.d.ts +8 -8
  122. three/src/objects/SkinnedMesh.d.ts +1 -2
  123. three/src/renderers/shaders/ShaderLib.d.ts +18 -18
  124. three/src/renderers/shaders/UniformsUtils.d.ts +3 -2
  125. three/src/renderers/webgl/WebGLLights.d.ts +39 -37
  126. three/src/renderers/webgl/WebGLPrograms.d.ts +224 -9
  127. three/src/textures/CompressedCubeTexture.d.ts +13 -0
  128. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +0 -310
  129. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -166
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class FogNode extends Node {
4
5
  isFogNode: true;
@@ -8,3 +9,5 @@ export default class FogNode extends Node {
8
9
  constructor(colorNode: Node, factorNode: Node);
9
10
  mixAssign(outputNode: Node): Node;
10
11
  }
12
+
13
+ export const fog: (colorNode: NodeRepresentation, factorNode: NodeRepresentation) => ShaderNodeObject<FogNode>;
@@ -1,5 +1,6 @@
1
1
  import FogNode from './FogNode.js';
2
2
  import Node from '../core/Node.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class FogRangeNode extends FogNode {
5
6
  isFogRangeNode: true;
@@ -8,3 +9,5 @@ export default class FogRangeNode extends FogNode {
8
9
 
9
10
  constructor(colorNode: Node, nearNode: Node, farNode: Node);
10
11
  }
12
+
13
+ export const rangeFog: (colorNode: Node, nearNode: Node, farNode: Node) => ShaderNodeObject<FogRangeNode>;
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeBaseElements.js';
1
+ import { ShaderNode } from '../../shadernode/ShaderNode.js';
2
2
  import Node from '../../core/Node.js';
3
3
 
4
4
  declare const BRDF_GGX: ShaderNode<{ lightDirection: Node; f0: Node; f90: Node; roughness: Node }>;
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeBaseElements.js';
1
+ import { ShaderNode } from '../../shadernode/ShaderNode.js';
2
2
  import Node from '../../core/Node.js';
3
3
 
4
4
  declare const BRDF_Lambert: ShaderNode<{ diffuseColor: Node }>;
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeElements.js';
1
+ import { ShaderNode } from '../../shadernode/ShaderNode.js';
2
2
  import Node from '../../core/Node.js';
3
3
 
4
4
  // Analytical approximation of the DFG LUT, one half of the
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeBaseElements.js';
1
+ import { ShaderNode } from '../../shadernode/ShaderNode.js';
2
2
  import Node from '../../core/Node.js';
3
3
 
4
4
  // Microfacet Models for Refraction through Rough Surfaces - equation (33)
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeBaseElements.js';
1
+ import { ShaderNode } from '../../shadernode/ShaderNode.js';
2
2
  import Node from '../../core/Node.js';
3
3
 
4
4
  declare const F_Schlick: ShaderNode<{ f0: Node; f90: Node; dotVH: Node }>;
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeBaseElements.js';
1
+ import { ShaderNode } from '../../shadernode/ShaderNode.js';
2
2
  import Node from '../../core/Node.js';
3
3
 
4
4
  declare const V_GGX_SmithCorrelated: ShaderNode<{ alpha: Node; dotNL: Node; dotNV: Node }>;
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../shadernode/ShaderNodeElements.js';
1
+ import { ShaderNode } from '../shadernode/ShaderNode.js';
2
2
  import Node from '../core/Node.js';
3
3
 
4
4
  declare const PhysicalLightingModel: {
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeBaseElements.js';
1
+ import { ShaderNode } from '../../shadernode/ShaderNode.js';
2
2
 
3
3
  declare const getGeometryRoughness: ShaderNode;
4
4
 
@@ -1,4 +1,4 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeElements.js';
1
+ import { ShaderNode } from '../../shadernode/ShaderNode.js';
2
2
  import Node from '../../core/Node.js';
3
3
 
4
4
  declare const getRoughness: ShaderNode<{ roughness: Node }>;
@@ -1,6 +1,7 @@
1
1
  import { Color, Vector2, Vector3, Vector4 } from '../../../../src/Three.js';
2
2
  import Node from '../core/Node.js';
3
3
  import NodeBuilder from '../core/NodeBuilder.js';
4
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
5
 
5
6
  export type RangeModeBound = number | Color | Vector2 | Vector3 | Vector4;
6
7
 
@@ -11,3 +12,5 @@ export default class RangeNode extends Node {
11
12
  constructor(min: RangeModeBound, max: RangeModeBound);
12
13
  getVectorLength(builder: NodeBuilder): number;
13
14
  }
15
+
16
+ export const range: (min: RangeModeBound, max: RangeModeBound) => ShaderNodeObject<RangeNode>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class ComputeNode extends Node {
4
5
  isComputeNode: true;
@@ -9,3 +10,9 @@ export default class ComputeNode extends Node {
9
10
 
10
11
  constructor(computeNode: Node, count: number, workgroupSize?: number[]);
11
12
  }
13
+
14
+ export const compute: (
15
+ node: NodeRepresentation,
16
+ count: number,
17
+ workgroupSize: number[],
18
+ ) => ShaderNodeObject<ComputeNode>;
@@ -1,6 +1,6 @@
1
1
  import ContextNode from '../core/ContextNode.js';
2
2
  import Node from '../core/Node.js';
3
- import { ShaderNode } from '../Nodes.js';
3
+ import { ShaderNode, ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
4
 
5
5
  export interface LightingModelNode {
6
6
  indirectDiffuse?: ShaderNode;
@@ -13,3 +13,8 @@ export default class LightingContextNode extends ContextNode {
13
13
 
14
14
  constructor(node: Node, lightingModelNode?: LightingModelNode | null);
15
15
  }
16
+
17
+ export const lightingContext: (
18
+ node: Node,
19
+ lightingModelNode?: LightingModelNode,
20
+ ) => ShaderNodeObject<LightingContextNode>;
@@ -1,6 +1,7 @@
1
1
  import { Light } from '../../../../src/Three.js';
2
2
  import Node from '../core/Node.js';
3
3
  import LightingNode from './LightingNode.js';
4
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
5
 
5
6
  export default class LightsNode extends Node {
6
7
  lightNodes: LightingNode[];
@@ -17,3 +18,5 @@ export default class LightsNode extends Node {
17
18
  lightNodeClass: { new (light: T): LightingNode },
18
19
  ): void;
19
20
  }
21
+
22
+ export const lights: (lights: Light[]) => ShaderNodeObject<LightsNode>;
@@ -1,12 +1,25 @@
1
1
  import { ShaderMaterialParameters } from '../../../../src/Three.js';
2
- import { Swizzable, CheckerNode, Node } from '../Nodes.js';
3
2
 
4
3
  import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
4
+ import Node from '../core/Node.js';
5
+ import CheckerNode from '../procedural/CheckerNode.js';
6
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
5
7
 
6
8
  export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
7
- iridescenceNode: null | Swizzable<CheckerNode>;
8
- iridescenceIORNode: null | Swizzable;
9
- iridescenceThicknessNode: null | Swizzable;
9
+ readonly isMeshPhysicalNodeMaterial: true;
10
+
11
+ clearcoatNode: Node | null;
12
+ clearcoatRoughnessNode: Node | null;
13
+ clearcoatNormalNode: Node | null;
14
+
15
+ sheenNode: Node | null;
16
+ sheenRoughnessNode: Node | null;
17
+
18
+ iridescenceNode: null | ShaderNodeObject<CheckerNode>;
19
+ iridescenceIORNode: null | ShaderNodeObject<Node>;
20
+ iridescenceThicknessNode: null | ShaderNodeObject<Node>;
21
+
22
+ iorNode?: Node | null;
10
23
 
11
24
  specularIntensityNode: Node | null;
12
25
  specularColorNode: Node | null;
@@ -16,7 +29,7 @@ export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
16
29
  attenuationDistanceNode: Node | null;
17
30
  attenuationColorNode: Node | null;
18
31
 
19
- constructor(parameters: ShaderMaterialParameters);
32
+ constructor(parameters?: ShaderMaterialParameters);
20
33
 
21
34
  copy(source: MeshPhysicalNodeMaterial): this;
22
35
  }
@@ -10,9 +10,6 @@ export default class MeshStandardNodeMaterial extends NodeMaterial {
10
10
  metalnessNode: Node | null;
11
11
  roughnessNode: Node | null;
12
12
 
13
- clearcoatNode: Node | null;
14
- clearcoatRoughnessNode: Node | null;
15
-
16
13
  constructor(paramters?: ShaderMaterialParameters);
17
14
  copy(source: MeshStandardNodeMaterial): this;
18
15
  }
@@ -1,7 +1,22 @@
1
- import { Material, ShaderMaterial } from '../../../../src/Three.js';
1
+ import {
2
+ LineBasicMaterial,
3
+ Material,
4
+ MeshBasicMaterial,
5
+ MeshPhysicalMaterial,
6
+ MeshStandardMaterial,
7
+ PointsMaterial,
8
+ ShaderMaterial,
9
+ SpriteMaterial,
10
+ } from '../../../../src/Three.js';
2
11
  import NodeBuilder from '../core/NodeBuilder.js';
3
12
  import Node from '../core/Node.js';
4
13
  import { LightingModelNode } from '../lighting/LightingContextNode.js';
14
+ import LineBasicNodeMaterial from './LineBasicNodeMaterial.js';
15
+ import MeshBasicNodeMaterial from './MeshBasicNodeMaterial.js';
16
+ import MeshPhysicalNodeMaterial from './MeshPhysicalNodeMaterial.js';
17
+ import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
18
+ import PointsNodeMaterial from './PointsNodeMaterial.js';
19
+ import SpriteNodeMaterial from './SpriteNodeMaterial.js';
5
20
 
6
21
  export default class NodeMaterial extends ShaderMaterial {
7
22
  isNodeMaterial: true;
@@ -34,5 +49,13 @@ export default class NodeMaterial extends ShaderMaterial {
34
49
  lights: { diffuseColorNode: Node; lightingModelNode: LightingModelNode; lightsNode?: Node },
35
50
  ): void;
36
51
  generateOutput(builder: NodeBuilder, lights: { diffuseColorNode: Node; outgoingLightNode: Node }): void;
37
- static fromMaterial(m: Material): NodeMaterial;
52
+
53
+ static fromMaterial(material: LineBasicMaterial): LineBasicNodeMaterial;
54
+ static fromMaterial(material: MeshBasicMaterial): MeshBasicNodeMaterial;
55
+ static fromMaterial(material: MeshPhysicalMaterial): MeshPhysicalNodeMaterial;
56
+ static fromMaterial(material: MeshStandardMaterial): MeshStandardNodeMaterial;
57
+ static fromMaterial(material: PointsMaterial): PointsNodeMaterial;
58
+ static fromMaterial(material: SpriteMaterial): SpriteNodeMaterial;
59
+ static fromMaterial(material: NodeMaterial): NodeMaterial;
60
+ static fromMaterial(material: Material): NodeMaterial;
38
61
  }
@@ -1,94 +1,103 @@
1
1
  import { mx_hsvtorgb, mx_rgbtohsv } from './lib/mx_hsv.js';
2
- import { Swizzable } from '../shadernode/ShaderNodeElements.js';
3
- import { UVNode, MathNode } from '../Nodes.js';
4
- import { NodeRepresentation } from '../shadernode/ShaderNode.js';
2
+ import Node from '../core/Node.js';
3
+ import MathNode from '../math/MathNode.js';
4
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
5
5
 
6
- export function mx_aastep(threshold?: NodeRepresentation, value?: NodeRepresentation): Swizzable<MathNode>;
6
+ export function mx_aastep(threshold?: NodeRepresentation, value?: NodeRepresentation): ShaderNodeObject<MathNode>;
7
7
 
8
8
  export function mx_ramplr(
9
9
  valuel?: NodeRepresentation,
10
10
  valuer?: NodeRepresentation,
11
- texcoord?: Swizzable<UVNode>,
12
- ): Swizzable<MathNode>;
11
+ texcoord?: ShaderNodeObject<Node>,
12
+ ): ShaderNodeObject<MathNode>;
13
13
  export function mx_ramptb(
14
14
  valuet?: NodeRepresentation,
15
15
  valueb?: NodeRepresentation,
16
- texcoord?: Swizzable<UVNode>,
17
- ): Swizzable<MathNode>;
16
+ texcoord?: ShaderNodeObject<Node>,
17
+ ): ShaderNodeObject<MathNode>;
18
18
 
19
19
  export function mx_splitlr(
20
20
  valuel?: NodeRepresentation,
21
21
  valuer?: NodeRepresentation,
22
22
  center?: NodeRepresentation,
23
- texcoord?: Swizzable<UVNode>,
24
- ): Swizzable<MathNode>;
23
+ texcoord?: ShaderNodeObject<Node>,
24
+ ): ShaderNodeObject<MathNode>;
25
25
  export function mx_splittb(
26
26
  valuet?: NodeRepresentation,
27
27
  valueb?: NodeRepresentation,
28
28
  center?: NodeRepresentation,
29
- texcoord?: Swizzable<UVNode>,
30
- ): Swizzable<MathNode>;
29
+ texcoord?: ShaderNodeObject<Node>,
30
+ ): ShaderNodeObject<MathNode>;
31
31
 
32
32
  export function mx_transform_uv(
33
33
  uv_scale?: NodeRepresentation,
34
34
  uv_offset?: NodeRepresentation,
35
- uv_geo?: Swizzable<UVNode>,
36
- ): Swizzable;
35
+ uv_geo?: ShaderNodeObject<Node>,
36
+ ): ShaderNodeObject<Node>;
37
37
 
38
38
  export function mx_noise_float(
39
- texcoord?: Swizzable<UVNode>,
39
+ texcoord?: ShaderNodeObject<Node>,
40
40
  amplitude?: NodeRepresentation,
41
41
  pivot?: NodeRepresentation,
42
- ): Swizzable;
42
+ ): ShaderNodeObject<Node>;
43
43
  export function mx_noise_vec2(
44
- texcoord?: Swizzable<UVNode>,
44
+ texcoord?: ShaderNodeObject<Node>,
45
45
  amplitude?: NodeRepresentation,
46
46
  pivot?: NodeRepresentation,
47
- ): Swizzable;
47
+ ): ShaderNodeObject<Node>;
48
48
  export function mx_noise_vec3(
49
- texcoord?: Swizzable<UVNode>,
49
+ texcoord?: ShaderNodeObject<Node>,
50
50
  amplitude?: NodeRepresentation,
51
51
  pivot?: NodeRepresentation,
52
- ): Swizzable;
52
+ ): ShaderNodeObject<Node>;
53
53
  export function mx_noise_vec4(
54
- texcoord?: Swizzable<UVNode>,
54
+ texcoord?: ShaderNodeObject<Node>,
55
55
  amplitude?: NodeRepresentation,
56
56
  pivot?: NodeRepresentation,
57
- ): Swizzable;
57
+ ): ShaderNodeObject<Node>;
58
58
 
59
- export function mx_worley_noise_float(texcoord?: Swizzable<UVNode>, jitter?: NodeRepresentation): Swizzable;
60
- export function mx_worley_noise_vec2(texcoord?: Swizzable<UVNode>, jitter?: NodeRepresentation): Swizzable;
61
- export function mx_worley_noise_vec3(texcoord?: Swizzable<UVNode>, jitter?: NodeRepresentation): Swizzable;
59
+ export function mx_worley_noise_float(
60
+ texcoord?: ShaderNodeObject<Node>,
61
+ jitter?: NodeRepresentation,
62
+ ): ShaderNodeObject<Node>;
63
+ export function mx_worley_noise_vec2(
64
+ texcoord?: ShaderNodeObject<Node>,
65
+ jitter?: NodeRepresentation,
66
+ ): ShaderNodeObject<Node>;
67
+ export function mx_worley_noise_vec3(
68
+ texcoord?: ShaderNodeObject<Node>,
69
+ jitter?: NodeRepresentation,
70
+ ): ShaderNodeObject<Node>;
62
71
 
63
- export function mx_cell_noise_float(texcoord?: Swizzable<UVNode>): Swizzable;
72
+ export function mx_cell_noise_float(texcoord?: ShaderNodeObject<Node>): ShaderNodeObject<Node>;
64
73
 
65
74
  export function mx_fractal_noise_float(
66
- position?: Swizzable<UVNode>,
75
+ position?: ShaderNodeObject<Node>,
67
76
  octaves?: NodeRepresentation,
68
77
  lacunarity?: NodeRepresentation,
69
78
  diminish?: NodeRepresentation,
70
79
  amplitude?: NodeRepresentation,
71
- ): Swizzable;
80
+ ): ShaderNodeObject<Node>;
72
81
  export function mx_fractal_noise_vec2(
73
- position?: Swizzable<UVNode>,
82
+ position?: ShaderNodeObject<Node>,
74
83
  octaves?: NodeRepresentation,
75
84
  lacunarity?: NodeRepresentation,
76
85
  diminish?: NodeRepresentation,
77
86
  amplitude?: NodeRepresentation,
78
- ): Swizzable;
87
+ ): ShaderNodeObject<Node>;
79
88
  export function mx_fractal_noise_vec3(
80
- position?: Swizzable<UVNode>,
89
+ position?: ShaderNodeObject<Node>,
81
90
  octaves?: NodeRepresentation,
82
91
  lacunarity?: NodeRepresentation,
83
92
  diminish?: NodeRepresentation,
84
93
  amplitude?: NodeRepresentation,
85
- ): Swizzable;
94
+ ): ShaderNodeObject<Node>;
86
95
  export function mx_fractal_noise_vec4(
87
- position?: Swizzable<UVNode>,
96
+ position?: ShaderNodeObject<Node>,
88
97
  octaves?: NodeRepresentation,
89
98
  lacunarity?: NodeRepresentation,
90
99
  diminish?: NodeRepresentation,
91
100
  amplitude?: NodeRepresentation,
92
- ): Swizzable;
101
+ ): ShaderNodeObject<Node>;
93
102
 
94
103
  export { mx_hsvtorgb, mx_rgbtohsv };
@@ -1,4 +1,6 @@
1
- import { Fn, Node, Swizzable } from '../../Nodes.js';
1
+ import Node from '../../core/Node.js';
2
+ import { Fn } from '../../code/FunctionNode.js';
3
+ import { ShaderNodeObject } from '../../shadernode/ShaderNode.js';
2
4
 
3
- export function mx_hsvtorgb(...params: Fn<[Node]>): Swizzable;
4
- export function mx_rgbtohsv(...params: Fn<[Node]>): Swizzable;
5
+ export function mx_hsvtorgb(...params: Fn<[Node]>): ShaderNodeObject<Node>;
6
+ export function mx_rgbtohsv(...params: Fn<[Node]>): ShaderNodeObject<Node>;
@@ -1,6 +1,8 @@
1
- import { Fn, Node, Swizzable } from '../../Nodes.js';
1
+ import Node from '../../core/Node.js';
2
+ import { Fn } from '../../code/FunctionNode.js';
3
+ import { ShaderNodeObject } from '../../shadernode/ShaderNode.js';
2
4
 
3
- export function mx_perlin_noise_float(...params: Fn<[Node]>): Swizzable;
4
- export function mx_cell_noise_float(...params: Fn<[Node]>): Swizzable;
5
- export function mx_worley_noise_float(...params: Fn<[Node]>): Swizzable;
6
- export function mx_fractal_noise_float(...params: Fn<[Node, Node, Node, Node]>): Swizzable;
5
+ export function mx_perlin_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>;
6
+ export function mx_cell_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>;
7
+ export function mx_worley_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>;
8
+ export function mx_fractal_noise_float(...params: Fn<[Node, Node, Node, Node]>): ShaderNodeObject<Node>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class CondNode extends Node {
4
5
  condNode: Node;
@@ -7,3 +8,9 @@ export default class CondNode extends Node {
7
8
 
8
9
  constructor(condNode: Node, ifNode: Node, elseNode: Node);
9
10
  }
11
+
12
+ export function cond(
13
+ condNode: NodeRepresentation,
14
+ ifNode: NodeRepresentation,
15
+ elseNode: NodeRepresentation,
16
+ ): ShaderNodeObject<Node>;
@@ -1,5 +1,6 @@
1
1
  import Node from '../core/Node.js';
2
2
  import TempNode from '../core/TempNode.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export type MathNodeMethod1 =
5
6
  | typeof MathNode.RADIANS
@@ -27,7 +28,11 @@ export type MathNodeMethod1 =
27
28
  | typeof MathNode.ONE_MINUS
28
29
  | typeof MathNode.DFDX
29
30
  | typeof MathNode.DFDY
30
- | typeof MathNode.ROUND;
31
+ | typeof MathNode.ROUND
32
+ | typeof MathNode.RECIPROCAL
33
+ | typeof MathNode.TRUNC
34
+ | typeof MathNode.FWIDTH
35
+ | typeof MathNode.BITCAST;
31
36
 
32
37
  export type MathNodeMethod2 =
33
38
  | typeof MathNode.ATAN2
@@ -81,6 +86,9 @@ export default class MathNode extends TempNode {
81
86
  static DFDY: 'dFdy';
82
87
  static ROUND: 'round';
83
88
  static RECIPROCAL: 'reciprocal';
89
+ static TRUNC: 'trunc';
90
+ static FWIDTH: 'fwidth';
91
+ static BITCAST: 'bitcast';
84
92
 
85
93
  // 2 inputs
86
94
 
@@ -113,3 +121,128 @@ export default class MathNode extends TempNode {
113
121
  constructor(method: MathNodeMethod2, aNode: Node, bNode: Node);
114
122
  constructor(method: MathNodeMethod3, aNode: Node, bNode: Node, cNode: Node);
115
123
  }
124
+
125
+ export const EPSILON: ShaderNodeObject<Node>;
126
+ export const INFINITY: ShaderNodeObject<Node>;
127
+
128
+ export type Unary = (a: NodeRepresentation) => ShaderNodeObject<MathNode>;
129
+
130
+ export const radians: Unary;
131
+ export const degrees: Unary;
132
+ export const exp: Unary;
133
+ export const exp2: Unary;
134
+ export const log: Unary;
135
+ export const log2: Unary;
136
+ export const sqrt: Unary;
137
+ export const inverseSqrt: Unary;
138
+ export const floor: Unary;
139
+ export const ceil: Unary;
140
+ export const normalize: Unary;
141
+ export const fract: Unary;
142
+ export const sin: Unary;
143
+ export const cos: Unary;
144
+ export const tan: Unary;
145
+ export const asin: Unary;
146
+ export const acos: Unary;
147
+ export const atan: Unary;
148
+ export const abs: Unary;
149
+ export const sign: Unary;
150
+ export const length: Unary;
151
+ export const negate: Unary;
152
+ export const oneMinus: Unary;
153
+ export const dFdx: Unary;
154
+ export const dFdy: Unary;
155
+ export const round: Unary;
156
+ export const reciprocal: Unary;
157
+ export const trunc: Unary;
158
+ export const fwidth: Unary;
159
+ export const bitcast: Unary;
160
+
161
+ export type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
162
+
163
+ export const atan2: Binary;
164
+ export const min: Binary;
165
+ export const max: Binary;
166
+ export const mod: Binary;
167
+ export const step: Binary;
168
+ export const reflect: Binary;
169
+ export const distance: Binary;
170
+ export const difference: Binary;
171
+ export const dot: Binary;
172
+ export const cross: Binary;
173
+ export const pow: Binary;
174
+ export const pow2: Binary;
175
+ export const pow3: Binary;
176
+ export const pow4: Binary;
177
+ export const transformDirection: Binary;
178
+
179
+ export type Ternary = (
180
+ a: NodeRepresentation,
181
+ b: NodeRepresentation,
182
+ c: NodeRepresentation,
183
+ ) => ShaderNodeObject<MathNode>;
184
+
185
+ export const mix: Ternary;
186
+ export const clamp: Ternary;
187
+ export const saturate: Ternary;
188
+ export const refract: Ternary;
189
+ export const smoothstep: Ternary;
190
+ export const faceForward: Ternary;
191
+
192
+ export const mixElement: Ternary;
193
+ export const smoothstepElement: Ternary;
194
+
195
+ declare module '../shadernode/ShaderNode.js' {
196
+ interface NodeElements {
197
+ radians: typeof radians;
198
+ degrees: typeof degrees;
199
+ exp: typeof exp;
200
+ exp2: typeof exp2;
201
+ log: typeof log;
202
+ log2: typeof log2;
203
+ sqrt: typeof sqrt;
204
+ inverseSqrt: typeof inverseSqrt;
205
+ floor: typeof floor;
206
+ ceil: typeof ceil;
207
+ normalize: typeof normalize;
208
+ fract: typeof fract;
209
+ sin: typeof sin;
210
+ cos: typeof cos;
211
+ tan: typeof tan;
212
+ asin: typeof asin;
213
+ acos: typeof acos;
214
+ atan: typeof atan;
215
+ abs: typeof abs;
216
+ sign: typeof sign;
217
+ length: typeof length;
218
+ negate: typeof negate;
219
+ oneMinus: typeof oneMinus;
220
+ dFdx: typeof dFdx;
221
+ dFdy: typeof dFdy;
222
+ round: typeof round;
223
+ reciprocal: typeof reciprocal;
224
+ trunc: typeof trunc;
225
+ fwidth: typeof fwidth;
226
+ atan2: typeof atan2;
227
+ min: typeof min;
228
+ max: typeof max;
229
+ mod: typeof mod;
230
+ step: typeof step;
231
+ reflect: typeof reflect;
232
+ distance: typeof distance;
233
+ dot: typeof dot;
234
+ cross: typeof cross;
235
+ pow: typeof pow;
236
+ pow2: typeof pow2;
237
+ pow3: typeof pow3;
238
+ pow4: typeof pow4;
239
+ transformDirection: typeof transformDirection;
240
+ mix: typeof mixElement;
241
+ clamp: typeof clamp;
242
+ refract: typeof refract;
243
+ smoothstep: typeof smoothstepElement;
244
+ faceForward: typeof faceForward;
245
+ difference: typeof difference;
246
+ saturate: typeof saturate;
247
+ }
248
+ }
@@ -1,5 +1,6 @@
1
1
  import TempNode from '../core/TempNode.js';
2
2
  import Node from '../core/Node.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export type OperatorNodeOp =
5
6
  | '='
@@ -29,3 +30,53 @@ export default class OperatorNode extends TempNode {
29
30
 
30
31
  constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]);
31
32
  }
33
+
34
+ export type Operator = (
35
+ a: NodeRepresentation,
36
+ b: NodeRepresentation,
37
+ ...others: NodeRepresentation[]
38
+ ) => ShaderNodeObject<OperatorNode>;
39
+
40
+ export const add: Operator;
41
+ export const sub: Operator;
42
+ export const mul: Operator;
43
+ export const div: Operator;
44
+ export const remainder: Operator;
45
+ export const equal: Operator;
46
+ export const assign: Operator;
47
+ export const lessThan: Operator;
48
+ export const greaterThan: Operator;
49
+ export const lessThanEqual: Operator;
50
+ export const greaterThanEqual: Operator;
51
+ export const and: Operator;
52
+ export const or: Operator;
53
+ export const xor: Operator;
54
+ export const bitAnd: Operator;
55
+ export const bitOr: Operator;
56
+ export const bitXor: Operator;
57
+ export const shiftLeft: Operator;
58
+ export const shiftRight: Operator;
59
+
60
+ declare module '../shadernode/ShaderNode.js' {
61
+ interface NodeElements {
62
+ add: typeof add;
63
+ sub: typeof sub;
64
+ mul: typeof mul;
65
+ div: typeof div;
66
+ remainder: typeof remainder;
67
+ equal: typeof equal;
68
+ assign: typeof assign;
69
+ lessThan: typeof lessThan;
70
+ greaterThan: typeof greaterThan;
71
+ lessThanEqual: typeof lessThanEqual;
72
+ greaterThanEqual: typeof greaterThanEqual;
73
+ and: typeof and;
74
+ or: typeof or;
75
+ xor: typeof xor;
76
+ bitAnd: typeof bitAnd;
77
+ bitOr: typeof bitOr;
78
+ bitXor: typeof bitXor;
79
+ shiftLeft: typeof shiftLeft;
80
+ shiftRight: typeof shiftRight;
81
+ }
82
+ }
@@ -1,6 +1,9 @@
1
1
  import TempNode from '../core/TempNode.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class CheckerNode extends TempNode {
4
5
  uvNode: Node;
5
6
  constructor(uvNode?: Node);
6
7
  }
8
+
9
+ export const checker: (uvNode?: NodeRepresentation) => ShaderNodeObject<CheckerNode>;