@types/three 0.159.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 (211) 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 +45 -11
  9. three/examples/jsm/loaders/LUT3dlLoader.d.ts +29 -2
  10. three/examples/jsm/loaders/LUTCubeLoader.d.ts +37 -2
  11. three/examples/jsm/loaders/MaterialXLoader.d.ts +6 -0
  12. three/examples/jsm/materials/MeshPostProcessingMaterial.d.ts +13 -0
  13. three/examples/jsm/misc/Timer.d.ts +80 -0
  14. three/examples/jsm/nodes/Nodes.d.ts +304 -61
  15. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +9 -0
  16. three/examples/jsm/nodes/accessors/BufferNode.d.ts +4 -1
  17. three/examples/jsm/nodes/accessors/CameraNode.d.ts +24 -6
  18. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +17 -4
  19. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +3 -0
  20. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +12 -0
  21. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +7 -0
  22. three/examples/jsm/nodes/accessors/ModelNode.d.ts +9 -1
  23. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
  24. three/examples/jsm/nodes/accessors/NormalNode.d.ts +8 -0
  25. three/examples/jsm/nodes/accessors/Object3DNode.d.ts +10 -6
  26. three/examples/jsm/nodes/accessors/PointUVNode.d.ts +3 -0
  27. three/examples/jsm/nodes/accessors/PositionNode.d.ts +8 -0
  28. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +4 -1
  29. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -0
  30. three/examples/jsm/nodes/accessors/SkinningNode.d.ts +3 -0
  31. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +8 -1
  32. three/examples/jsm/nodes/accessors/TangentNode.d.ts +9 -0
  33. three/examples/jsm/nodes/accessors/TextureBicubicNode.d.ts +18 -0
  34. three/examples/jsm/nodes/accessors/TextureNode.d.ts +21 -5
  35. three/examples/jsm/nodes/accessors/UVNode.d.ts +3 -0
  36. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +7 -0
  37. three/examples/jsm/nodes/accessors/VertexColorNode.d.ts +12 -0
  38. three/examples/jsm/nodes/code/CodeNode.d.ts +4 -0
  39. three/examples/jsm/nodes/code/ExpressionNode.d.ts +3 -0
  40. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +13 -1
  41. three/examples/jsm/nodes/code/FunctionNode.d.ts +17 -0
  42. three/examples/jsm/nodes/core/ArrayUniformNode.d.ts +1 -1
  43. three/examples/jsm/nodes/core/AssignNode.d.ts +17 -0
  44. three/examples/jsm/nodes/core/AttributeNode.d.ts +3 -0
  45. three/examples/jsm/nodes/core/BypassNode.d.ts +9 -0
  46. three/examples/jsm/nodes/core/CacheNode.d.ts +11 -0
  47. three/examples/jsm/nodes/core/ConstNode.d.ts +3 -3
  48. three/examples/jsm/nodes/core/ContextNode.d.ts +11 -0
  49. three/examples/jsm/nodes/core/IndexNode.d.ts +18 -0
  50. three/examples/jsm/nodes/core/InputNode.d.ts +4 -4
  51. three/examples/jsm/nodes/core/LightingModel.d.ts +36 -0
  52. three/examples/jsm/nodes/core/Node.d.ts +32 -8
  53. three/examples/jsm/nodes/core/NodeBuilder.d.ts +27 -23
  54. three/examples/jsm/nodes/core/NodeFrame.d.ts +18 -6
  55. three/examples/jsm/nodes/core/NodeUniform.d.ts +12 -8
  56. three/examples/jsm/nodes/core/NodeUtils.d.ts +6 -3
  57. three/examples/jsm/nodes/core/PropertyNode.d.ts +27 -1
  58. three/examples/jsm/nodes/core/UniformNode.d.ts +12 -4
  59. three/examples/jsm/nodes/core/VarNode.d.ts +10 -0
  60. three/examples/jsm/nodes/core/VaryingNode.d.ts +9 -0
  61. three/examples/jsm/nodes/core/constants.d.ts +31 -28
  62. three/examples/jsm/nodes/display/AfterImageNode.d.ts +25 -0
  63. three/examples/jsm/nodes/display/AnamorphicNode.d.ts +32 -0
  64. three/examples/jsm/nodes/display/BlendModeNode.d.ts +21 -6
  65. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +29 -1
  66. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +17 -0
  67. three/examples/jsm/nodes/display/FrontFacingNode.d.ts +4 -0
  68. three/examples/jsm/nodes/display/GaussianBlurNode.d.ts +28 -0
  69. three/examples/jsm/nodes/display/NormalMapNode.d.ts +13 -1
  70. three/examples/jsm/nodes/display/PassNode.d.ts +44 -0
  71. three/examples/jsm/nodes/display/PosterizeNode.d.ts +12 -0
  72. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +8 -1
  73. three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +32 -0
  74. three/examples/jsm/nodes/display/ViewportNode.d.ts +8 -0
  75. three/examples/jsm/nodes/display/ViewportSharedTextureNode.d.ts +18 -0
  76. three/examples/jsm/nodes/display/ViewportTextureNode.d.ts +33 -0
  77. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +9 -0
  78. three/examples/jsm/nodes/fog/FogNode.d.ts +9 -0
  79. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +9 -0
  80. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +9 -2
  81. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +3 -2
  82. three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.d.ts +7 -0
  83. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +3 -2
  84. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +3 -2
  85. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +3 -2
  86. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +1 -1
  87. three/examples/jsm/nodes/functions/PhongLightingModel.d.ts +7 -0
  88. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +17 -8
  89. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +1 -1
  90. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +1 -1
  91. three/examples/jsm/nodes/geometry/RangeNode.d.ts +3 -0
  92. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +13 -0
  93. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +20 -8
  94. three/examples/jsm/nodes/lighting/LightsNode.d.ts +3 -0
  95. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +1 -2
  96. three/examples/jsm/nodes/materials/Materials.d.ts +9 -17
  97. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +2 -4
  98. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +12 -0
  99. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +16 -7
  100. three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +17 -0
  101. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +1 -5
  102. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +55 -16
  103. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +2 -8
  104. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +0 -10
  105. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +43 -34
  106. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +5 -3
  107. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +7 -5
  108. three/examples/jsm/nodes/math/CondNode.d.ts +13 -0
  109. three/examples/jsm/nodes/math/HashNode.d.ts +16 -0
  110. three/examples/jsm/nodes/math/MathNode.d.ts +140 -1
  111. three/examples/jsm/nodes/math/MathUtils.d.ts +16 -0
  112. three/examples/jsm/nodes/math/OperatorNode.d.ts +53 -1
  113. three/examples/jsm/nodes/math/TriNoise3D.d.ts +12 -0
  114. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +9 -0
  115. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +124 -31
  116. three/examples/jsm/nodes/utils/DiscardNode.d.ts +16 -0
  117. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +4 -2
  118. three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +3 -0
  119. three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +6 -3
  120. three/examples/jsm/nodes/utils/OscNode.d.ts +6 -0
  121. three/examples/jsm/nodes/utils/ReflectorNode.d.ts +30 -0
  122. three/examples/jsm/nodes/utils/RemapNode.d.ts +24 -1
  123. three/examples/jsm/nodes/utils/RotateNode.d.ts +21 -0
  124. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +9 -0
  125. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +5 -1
  126. three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +7 -0
  127. three/examples/jsm/nodes/utils/TimerNode.d.ts +7 -1
  128. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +28 -7
  129. three/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
  130. three/examples/jsm/objects/QuadMesh.d.ts +15 -0
  131. three/examples/jsm/postprocessing/{HBAOPass.d.ts → GTAOPass.d.ts} +25 -10
  132. three/examples/jsm/postprocessing/SSAOPass.d.ts +1 -1
  133. three/examples/jsm/renderers/common/Backend.d.ts +6 -2
  134. three/examples/jsm/renderers/common/Color4.d.ts +9 -0
  135. three/examples/jsm/renderers/common/Info.d.ts +7 -1
  136. three/examples/jsm/renderers/common/PostProcessing.d.ts +11 -0
  137. three/examples/jsm/renderers/common/Renderer.d.ts +243 -4
  138. three/examples/jsm/renderers/common/StorageTexture.d.ts +5 -0
  139. three/examples/jsm/renderers/webgl/WebGLBackend.d.ts +4 -2
  140. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +2 -2
  141. three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.d.ts +3 -0
  142. three/examples/jsm/renderers/webgpu/WebGPUBackend.d.ts +15 -6
  143. three/examples/jsm/renderers/webgpu/WebGPURenderer.d.ts +7 -7
  144. three/examples/jsm/shaders/{HBAOShader.d.ts → GTAOShader.d.ts} +23 -8
  145. three/examples/jsm/shaders/PoissonDenoiseShader.d.ts +1 -1
  146. three/examples/jsm/utils/BufferGeometryUtils.d.ts +0 -10
  147. three/examples/jsm/webxr/XRControllerModelFactory.d.ts +6 -5
  148. three/examples/jsm/webxr/XRHandMeshModel.d.ts +10 -2
  149. three/package.json +2 -2
  150. three/src/Three.d.ts +1 -0
  151. three/src/cameras/PerspectiveCamera.d.ts +13 -0
  152. three/src/constants.d.ts +4 -3
  153. three/src/core/InterleavedBufferAttribute.d.ts +12 -2
  154. three/src/core/Object3D.d.ts +13 -13
  155. three/src/core/UniformsGroup.d.ts +3 -3
  156. three/src/extras/core/Curve.d.ts +9 -9
  157. three/src/extras/core/CurvePath.d.ts +8 -7
  158. three/src/geometries/RingGeometry.d.ts +1 -1
  159. three/src/lights/PointLight.d.ts +7 -0
  160. three/src/loaders/MaterialLoader.d.ts +6 -3
  161. three/src/materials/LineBasicMaterial.d.ts +7 -0
  162. three/src/materials/LineDashedMaterial.d.ts +7 -1
  163. three/src/materials/Material.d.ts +17 -15
  164. three/src/materials/MeshBasicMaterial.d.ts +7 -0
  165. three/src/materials/MeshDepthMaterial.d.ts +6 -0
  166. three/src/materials/MeshDistanceMaterial.d.ts +7 -0
  167. three/src/materials/MeshLambertMaterial.d.ts +7 -0
  168. three/src/materials/MeshMatcapMaterial.d.ts +7 -0
  169. three/src/materials/MeshNormalMaterial.d.ts +7 -0
  170. three/src/materials/MeshPhongMaterial.d.ts +7 -0
  171. three/src/materials/MeshPhysicalMaterial.d.ts +6 -1
  172. three/src/materials/MeshStandardMaterial.d.ts +7 -2
  173. three/src/materials/MeshToonMaterial.d.ts +7 -0
  174. three/src/materials/PointsMaterial.d.ts +7 -0
  175. three/src/materials/RawShaderMaterial.d.ts +9 -0
  176. three/src/materials/ShaderMaterial.d.ts +17 -3
  177. three/src/materials/ShadowMaterial.d.ts +7 -0
  178. three/src/materials/SpriteMaterial.d.ts +7 -2
  179. three/src/math/Color.d.ts +1 -1
  180. three/src/math/Matrix4.d.ts +30 -30
  181. three/src/math/Quaternion.d.ts +27 -30
  182. three/src/math/Sphere.d.ts +5 -0
  183. three/src/math/Triangle.d.ts +8 -25
  184. three/src/math/Vector2.d.ts +24 -159
  185. three/src/math/Vector3.d.ts +46 -54
  186. three/src/math/Vector4.d.ts +25 -20
  187. three/src/objects/BatchedMesh.d.ts +2 -2
  188. three/src/objects/Bone.d.ts +2 -2
  189. three/src/objects/InstancedMesh.d.ts +2 -1
  190. three/src/objects/LOD.d.ts +2 -2
  191. three/src/objects/Line.d.ts +3 -2
  192. three/src/objects/LineLoop.d.ts +3 -1
  193. three/src/objects/LineSegments.d.ts +3 -1
  194. three/src/objects/Points.d.ts +3 -2
  195. three/src/objects/SkinnedMesh.d.ts +4 -8
  196. three/src/objects/Sprite.d.ts +2 -2
  197. three/src/renderers/shaders/ShaderLib.d.ts +18 -18
  198. three/src/renderers/shaders/UniformsUtils.d.ts +3 -2
  199. three/src/renderers/webgl/WebGLLights.d.ts +39 -37
  200. three/src/renderers/webgl/WebGLProgram.d.ts +0 -1
  201. three/src/renderers/webgl/WebGLPrograms.d.ts +226 -9
  202. three/src/renderers/webxr/WebXRDepthSensing.d.ts +27 -0
  203. three/src/renderers/webxr/WebXRManager.d.ts +2 -1
  204. three/src/textures/CompressedCubeTexture.d.ts +13 -0
  205. three/src/textures/DataArrayTexture.d.ts +1 -1
  206. three/src/textures/Source.d.ts +11 -1
  207. three/build/three.d.ts +0 -2
  208. three/build/three.min.d.ts +0 -2
  209. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +0 -310
  210. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -166
  211. three/examples/jsm/objects/GroundProjectedSkybox.d.ts +0 -13
@@ -1,7 +1,10 @@
1
1
  import Node from '../core/Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class PointUVNode extends Node {
4
5
  isPointUVNode: true;
5
6
 
6
7
  constructor();
7
8
  }
9
+
10
+ export const pointUV: ShaderNodeObject<PointUVNode>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export type PositionNodeScope =
4
5
  | typeof PositionNode.GEOMETRY
@@ -19,3 +20,10 @@ export default class PositionNode extends Node {
19
20
 
20
21
  constructor(scope?: PositionNodeScope);
21
22
  }
23
+
24
+ export const positionGeometry: ShaderNodeObject<PositionNode>;
25
+ export const positionLocal: ShaderNodeObject<PositionNode>;
26
+ export const positionWorld: ShaderNodeObject<PositionNode>;
27
+ export const positionWorldDirection: ShaderNodeObject<PositionNode>;
28
+ export const positionView: ShaderNodeObject<PositionNode>;
29
+ export const positionViewDirection: ShaderNodeObject<PositionNode>;
@@ -1,5 +1,6 @@
1
1
  import Node from '../core/Node.js';
2
- import { NodeTypeOption } from '../Nodes.js';
2
+ import { NodeTypeOption } from '../core/constants.js';
3
+ import { NodeOrType, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class ReferenceNode<T> extends Node {
5
6
  object: T;
@@ -11,3 +12,5 @@ export default class ReferenceNode<T> extends Node {
11
12
 
12
13
  setNodeType(uniformType: NodeTypeOption): void;
13
14
  }
15
+
16
+ export const reference: <T>(name: string, nodeOrType: NodeOrType, object: T) => ShaderNodeObject<ReferenceNode<T>>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class ReflectVectorNode extends Node {
4
5
  constructor();
@@ -6,3 +7,5 @@ export default class ReflectVectorNode extends Node {
6
7
  getHash(): 'reflectVector';
7
8
  setup(): Node;
8
9
  }
10
+
11
+ export const reflectVector: ShaderNodeObject<ReflectVectorNode>;
@@ -1,5 +1,6 @@
1
1
  import { SkinnedMesh } from '../../../../src/Three.js';
2
2
  import Node from '../core/Node.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class SkinningNode extends Node {
5
6
  skinIndexNode: Node;
@@ -11,3 +12,5 @@ export default class SkinningNode extends Node {
11
12
 
12
13
  constructor(skinnedMesh: SkinnedMesh);
13
14
  }
15
+
16
+ export function skinning(skinnedMesh: SkinnedMesh): ShaderNodeObject<SkinningNode>;
@@ -1,6 +1,13 @@
1
- import { NodeTypeOption } from '../Nodes.js';
2
1
  import BufferNode from './BufferNode.js';
2
+ import { NodeTypeOption } from '../core/constants.js';
3
+ import { NodeOrType, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class StorageBufferNode extends BufferNode {
5
6
  constructor(value: ArrayLike<number>, bufferType: NodeTypeOption, bufferCount?: number);
6
7
  }
8
+
9
+ export const storage: (
10
+ value: ArrayLike<number>,
11
+ nodeOrType: NodeOrType,
12
+ count: number,
13
+ ) => ShaderNodeObject<StorageBufferNode>;
@@ -1,4 +1,6 @@
1
1
  import Node from '../core/Node.js';
2
+ import MathNode from '../math/MathNode.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
4
 
3
5
  export type TangentNodeScope =
4
6
  | typeof TangentNode.LOCAL
@@ -16,3 +18,10 @@ export default class TangentNode extends Node {
16
18
 
17
19
  constructor(scope?: TangentNodeScope);
18
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>;
27
+ export const transformedTangentWorld: ShaderNodeObject<MathNode>;
@@ -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
+ }
@@ -1,14 +1,30 @@
1
1
  import { Texture } from '../../../../src/Three.js';
2
2
  import UniformNode from '../core/UniformNode.js';
3
- import { Node } from '../Nodes.js';
3
+ import Node from '../core/Node.js';
4
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
5
 
5
- export default class TextureNode extends UniformNode {
6
+ export default class TextureNode extends UniformNode<Texture> {
6
7
  isTextureNode: true;
7
8
 
8
- uvNode: Node | null;
9
- levelNode: Node | null;
9
+ uvNode: ShaderNodeObject<Node> | null;
10
+ levelNode: ShaderNodeObject<Node> | null;
10
11
 
11
- constructor(value: Texture, uvNode?: Node, levelNode?: Node | null);
12
+ constructor(value: Texture, uvNode?: ShaderNodeObject<Node>, levelNode?: ShaderNodeObject<Node> | null);
12
13
 
13
14
  getDefaultUV(): Node;
15
+
16
+ clone(): this;
17
+ }
18
+
19
+ export const texture: (
20
+ value: Texture,
21
+ uvNode?: NodeRepresentation,
22
+ levelNode?: NodeRepresentation,
23
+ ) => ShaderNodeObject<TextureNode>;
24
+ export const sampler: (aTexture: Texture | TextureNode) => ShaderNodeObject<Node>;
25
+
26
+ declare module '../shadernode/ShaderNode.js' {
27
+ interface NodeElements {
28
+ texture: typeof texture;
29
+ }
14
30
  }
@@ -1,4 +1,5 @@
1
1
  import AttributeNode from '../core/AttributeNode.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class UVNode extends AttributeNode {
4
5
  isUVNode: true;
@@ -6,3 +7,5 @@ export default class UVNode extends AttributeNode {
6
7
 
7
8
  constructor(index?: number);
8
9
  }
10
+
11
+ export const uv: (index?: number) => ShaderNodeObject<UVNode>;
@@ -1,7 +1,14 @@
1
1
  import { NodeTypeOption, NodeUserData } from '../core/constants.js';
2
2
  import ReferenceNode from './ReferenceNode.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class UserDataNode extends ReferenceNode<NodeUserData> {
5
6
  userData: NodeUserData | null;
6
7
  constructor(property: string, inputType: NodeTypeOption, userData?: NodeUserData | null);
7
8
  }
9
+
10
+ export const userData: (
11
+ name: string,
12
+ inputType: NodeTypeOption,
13
+ userData?: NodeUserData,
14
+ ) => ShaderNodeObject<UserDataNode>;
@@ -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>;
@@ -1,5 +1,7 @@
1
1
  import Node from '../core/Node.js';
2
2
  import NodeBuilder from '../core/NodeBuilder.js';
3
+ import { NodeTypeOption } from '../core/constants.js';
4
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
5
 
4
6
  export interface CodeNodeInclude {
5
7
  build(builder: NodeBuilder): void;
@@ -13,3 +15,5 @@ export default class CodeNode extends Node {
13
15
  setIncludes(includes: CodeNodeInclude[]): this;
14
16
  getIncludes(builder: NodeBuilder): CodeNodeInclude[];
15
17
  }
18
+
19
+ export const code: (code: string, nodeType?: NodeTypeOption) => ShaderNodeObject<CodeNode>;
@@ -1,7 +1,10 @@
1
1
  import { NodeTypeOption } from '../core/constants.js';
2
2
  import TempNode from '../core/TempNode.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class ExpressionNode extends TempNode {
5
6
  snipped: string; /* sic */
6
7
  constructor(snipped?: string, nodeType?: NodeTypeOption);
7
8
  }
9
+
10
+ export const expression: (snipped?: string, nodeType?: NodeTypeOption) => ShaderNodeObject<ExpressionNode>;
@@ -1,6 +1,7 @@
1
- import FunctionNode from './FunctionNode.js';
1
+ import FunctionNode, { FunctionNodeArguments } from './FunctionNode.js';
2
2
  import TempNode from '../core/TempNode.js';
3
3
  import Node from '../core/Node.js';
4
+ import { ProxiedObject, ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
5
 
5
6
  export default class FunctionCallNode<P extends Node[] | { [name: string]: Node }> extends TempNode {
6
7
  functionNode: FunctionNode<P>;
@@ -11,3 +12,14 @@ export default class FunctionCallNode<P extends Node[] | { [name: string]: Node
11
12
  setParameters(parameters: P): this;
12
13
  getParameters(): P;
13
14
  }
15
+
16
+ export const call: <P extends FunctionNodeArguments>(
17
+ functionNode?: FunctionNode<P>,
18
+ parameters?: ProxiedObject<P>,
19
+ ) => ShaderNodeObject<FunctionCallNode<P>>;
20
+
21
+ declare module '../shadernode/ShaderNode.js' {
22
+ interface NodeElements {
23
+ call: typeof call;
24
+ }
25
+ }
@@ -4,6 +4,7 @@ import NodeBuilder from '../core/NodeBuilder.js';
4
4
  import NodeFunction from '../core/NodeFunction.js';
5
5
  import NodeFunctionInput from '../core/NodeFunctionInput.js';
6
6
  import Node from '../core/Node.js';
7
+ import { ProxiedObject, ProxiedTuple, ShaderNodeObject } from '../shadernode/ShaderNode.js';
7
8
 
8
9
  export type FunctionNodeArguments = Node[] | { [name: string]: Node };
9
10
 
@@ -15,3 +16,19 @@ export default class FunctionNode<P extends Node[] | { [name: string]: Node }> e
15
16
  getNodeFunction(builder: NodeBuilder): NodeFunction;
16
17
  call(parameters: P): FunctionCallNode<P>;
17
18
  }
19
+
20
+ export type Fn<P extends FunctionNodeArguments> = P extends readonly [...unknown[]]
21
+ ? ProxiedTuple<P>
22
+ : readonly [ProxiedObject<P>];
23
+
24
+ export const func: <P extends FunctionNodeArguments>(
25
+ code: string,
26
+ includes?: CodeNodeInclude[],
27
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
28
+ ) => { call: (...params: Fn<P>) => ShaderNodeObject<Node> };
29
+
30
+ export const fn: <P extends FunctionNodeArguments>(
31
+ code: string,
32
+ includes?: CodeNodeInclude[],
33
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
34
+ ) => (...params: Fn<P>) => ShaderNodeObject<Node>;
@@ -1,7 +1,7 @@
1
1
  import UniformNode from './UniformNode.js';
2
2
  import Node from './Node.js';
3
3
 
4
- export default class ArrayUniformNode extends UniformNode {
4
+ export default class ArrayUniformNode extends UniformNode<undefined> {
5
5
  isArrayUniformNode: true;
6
6
  nodes: Node[];
7
7
  constructor(nodes?: Node[]);
@@ -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
+ }
@@ -1,9 +1,12 @@
1
1
  import { NodeTypeOption } from './constants.js';
2
2
  import Node from './Node.js';
3
3
  import NodeBuilder from './NodeBuilder.js';
4
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
5
 
5
6
  export default class AttributeNode extends Node {
6
7
  constructor(attributeName: string, nodeType?: NodeTypeOption | null);
7
8
  setAttributeName(attributeName: string): this;
8
9
  getAttributeName(builder: NodeBuilder): string;
9
10
  }
11
+
12
+ export const attribute: (name: string, nodeType: NodeTypeOption) => ShaderNodeObject<Node>;
@@ -1,4 +1,5 @@
1
1
  import Node from './Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class BypassNode extends Node {
4
5
  isBypassNode: true;
@@ -7,3 +8,11 @@ export default class BypassNode extends Node {
7
8
 
8
9
  constructor(returnNode: Node, callNode: Node);
9
10
  }
11
+
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
+ }
@@ -1,5 +1,6 @@
1
1
  import Node from './Node.js';
2
2
  import NodeCache from './NodeCache.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class CacheNode extends Node {
5
6
  isCacheNode: true;
@@ -8,3 +9,13 @@ export default class CacheNode extends Node {
8
9
 
9
10
  constructor(node: Node, cache?: NodeCache);
10
11
  }
12
+
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
+ }
@@ -1,10 +1,10 @@
1
- import { NodeTypeOption, NodeValueOption } from './constants.js';
1
+ import { NodeTypeOption } from './constants.js';
2
2
  import InputNode from './InputNode.js';
3
3
  import NodeBuilder from './NodeBuilder.js';
4
4
 
5
- export default class ConstNode extends InputNode {
5
+ export default class ConstNode<Value> extends InputNode<Value> {
6
6
  isConstNode: true;
7
- constructor(value: NodeValueOption, nodeType?: NodeTypeOption | null);
7
+ constructor(value: Value, nodeType?: NodeTypeOption | null);
8
8
 
9
9
  generateConst(builder: NodeBuilder): string;
10
10
  }
@@ -1,5 +1,6 @@
1
1
  import Node from './Node.js';
2
2
  import { NodeBuilderContext } from './NodeBuilder.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class ContextNode extends Node {
5
6
  isContextNode: true;
@@ -8,3 +9,13 @@ export default class ContextNode extends Node {
8
9
 
9
10
  constructor(node: Node, context: NodeBuilderContext);
10
11
  }
12
+
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>;
@@ -1,15 +1,15 @@
1
- import { NodeTypeOption, NodeValueOption } from './constants.js';
1
+ import { NodeTypeOption } from './constants.js';
2
2
  import Node from './Node.js';
3
3
  import NodeBuilder from './NodeBuilder.js';
4
4
 
5
5
  export type Precision = 'low' | 'medium' | 'high';
6
6
 
7
- export default abstract class InputNode extends Node {
7
+ export default abstract class InputNode<Value> extends Node {
8
8
  isInputNode: true;
9
- value: NodeValueOption;
9
+ value: Value;
10
10
  precision: Precision | null;
11
11
 
12
- constructor(value: NodeValueOption, nodeType?: NodeTypeOption | null);
12
+ constructor(value: Value, nodeType?: NodeTypeOption | null);
13
13
 
14
14
  getInputType(builder: NodeBuilder): string | null;
15
15
  setPrecision(precision: Precision): this;
@@ -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
  }
@@ -3,15 +3,13 @@ import {
3
3
  Material,
4
4
  Object3D,
5
5
  Renderer,
6
- Scene,
7
6
  Texture,
8
7
  TextureEncoding,
9
8
  WebGLRenderTarget,
10
9
  } from '../../../../src/Three.js';
11
10
  import FogNode from '../fog/FogNode.js';
12
11
  import LightsNode from '../lighting/LightsNode.js';
13
- import { nodeObject } from '../Nodes.js';
14
- import { AnyObject, NodeShaderStageOption, NodeTypeOption } from './constants.js';
12
+ import { AnyObject, NodeShaderStage, NodeTypeOption } from './constants.js';
15
13
  import Node from './Node.js';
16
14
  import NodeAttribute from './NodeAttribute.js';
17
15
  import NodeCache from './NodeCache.js';
@@ -19,6 +17,7 @@ import NodeParser from './NodeParser.js';
19
17
  import NodeUniform from './NodeUniform.js';
20
18
  import NodeVar from './NodeVar.js';
21
19
  import NodeVarying from './NodeVarying.js';
20
+ import StackNode from './StackNode.js';
22
21
 
23
22
  export type BuildStageOption = 'construct' | 'analyze' | 'generate';
24
23
 
@@ -60,9 +59,9 @@ export default abstract class NodeBuilder {
60
59
  */
61
60
  flowsData: any;
62
61
 
63
- shaderStage: NodeShaderStageOption | null;
62
+ shaderStage: NodeShaderStage | null;
64
63
  buildStage: BuildStageOption | null;
65
- stack: Node[];
64
+ stack: StackNode;
66
65
 
67
66
  setHashNode(node: Node, hash: string): void;
68
67
  addNode(node: Node): void;
@@ -70,7 +69,7 @@ export default abstract class NodeBuilder {
70
69
  getMethod(method: string): string;
71
70
  getNodeFromHash(hash: string): Node;
72
71
 
73
- addFlow(shaderStage: NodeShaderStageOption, node: Node): Node;
72
+ addFlow(shaderStage: NodeShaderStage, node: Node): Node;
74
73
 
75
74
  setContext(context: NodeBuilderContext): void;
76
75
  getContext(): NodeBuilderContext;
@@ -92,47 +91,52 @@ export default abstract class NodeBuilder {
92
91
 
93
92
  getAttribute(name: string, type: NodeTypeOption): NodeAttribute;
94
93
 
95
- getPropertyName(node: Node, shaderStage: NodeShaderStageOption): string;
94
+ getPropertyName(node: Node, shaderStage: NodeShaderStage): string;
96
95
  isVector(type: NodeTypeOption): boolean;
97
96
 
98
97
  isMatrix(type: NodeTypeOption): boolean;
99
98
  isReference(type: NodeTypeOption): boolean;
100
- isShaderStage(shaderStage: NodeShaderStageOption): boolean;
99
+ isShaderStage(shaderStage: NodeShaderStage): boolean;
101
100
  getTextureEncodingFromMap(map: Texture | WebGLRenderTarget | unknown): TextureEncoding;
102
101
  getComponentType(type: NodeTypeOption): NodeTypeOption;
103
102
  getVectorType(type: NodeTypeOption): NodeTypeOption;
104
103
  getTypeFromLength(length: number): NodeTypeOption;
105
104
  getTypeLength(type: NodeTypeOption): number;
106
105
  getVectorFromMatrix(type: NodeTypeOption): NodeTypeOption;
107
- getDataFromNode(node: Node, shaderStage?: NodeShaderStageOption): NodeData;
108
- getNodeProperties(node: Node, shaderStage?: NodeShaderStageOption): AnyObject;
109
- getUniformFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStageOption): NodeUniform;
110
- getVarFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStageOption): NodeVar;
106
+ getDataFromNode(node: Node, shaderStage?: NodeShaderStage): NodeData;
107
+ getNodeProperties(node: Node, shaderStage?: NodeShaderStage): AnyObject;
108
+ getUniformFromNode(
109
+ node: Node,
110
+ type: NodeTypeOption,
111
+ shaderStage?: NodeShaderStage,
112
+ name?: string | null,
113
+ ): NodeUniform<string>;
114
+ getVarFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStage): NodeVar;
111
115
  getVaryFromNode(node: Node, type: NodeTypeOption): NodeVarying;
112
- getCodeFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStageOption): string;
116
+ getCodeFromNode(node: Node, type: NodeTypeOption, shaderStage?: NodeShaderStage): string;
113
117
  addFlowCode(code: string): void;
114
- getFlowData(node: Node, shaderStage: NodeShaderStageOption): FlowData;
118
+ getFlowData(node: Node, shaderStage: NodeShaderStage): FlowData;
115
119
  flowNode(node: Node): FlowData;
116
120
  flowChildNode(node: Node, output?: string | null): FlowData;
117
121
  flowNodeFromShaderStage(
118
- shaderStage: NodeShaderStageOption,
122
+ shaderStage: NodeShaderStage,
119
123
  node: Node,
120
124
  output?: string | null,
121
125
  propertyName?: string,
122
126
  ): FlowData;
123
127
  hasGeometryAttribute(name: string): boolean;
124
- abstract getAttributes(shaderStage: NodeShaderStageOption): string;
125
- abstract getVarys(shaderStage: NodeShaderStageOption): string;
126
- getVars(shaderStage: NodeShaderStageOption): string;
127
- abstract getUniforms(stage: NodeShaderStageOption): string;
128
- 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;
129
133
  getHash(): string;
130
- setShaderStage(shaderStage: NodeShaderStageOption): void;
131
- getShaderStage(): NodeShaderStageOption;
134
+ setShaderStage(shaderStage: NodeShaderStage): void;
135
+ getShaderStage(): NodeShaderStage;
132
136
  setBuildStage(buildStage: BuildStageOption): void;
133
137
  getBuildStage(): BuildStageOption;
134
138
  abstract buildCode(): void;
135
- build(): this;
139
+ build(createMaterial?: boolean): this;
136
140
  format(snippet: string, fromType: NodeTypeOption, toType: NodeTypeOption): string;
137
141
  getSignature(): string;
138
142
  }