diff --git a/types/three/examples/jsm/nodes/Nodes.d.ts b/types/three/examples/jsm/nodes/Nodes.d.ts index a686d3b43..5df8ec626 100644 --- a/types/three/examples/jsm/nodes/Nodes.d.ts +++ b/types/three/examples/jsm/nodes/Nodes.d.ts @@ -3,11 +3,11 @@ export * from './core/constants.js'; // core export { default as ArrayUniformNode } from './core/ArrayUniformNode.js'; -export { default as AttributeNode } from './core/AttributeNode.js'; -export { default as BypassNode } from './core/BypassNode.js'; -export { default as CacheNode } from './core/CacheNode.js'; +export { default as AttributeNode, attribute } from './core/AttributeNode.js'; +export { default as BypassNode, bypass } from './core/BypassNode.js'; +export { default as CacheNode, cache } from './core/CacheNode.js'; export { default as ConstNode } from './core/ConstNode.js'; -export { default as ContextNode } from './core/ContextNode.js'; +export { default as ContextNode, context } from './core/ContextNode.js'; export { default as Node } from './core/Node.js'; export { default as NodeAttribute } from './core/NodeAttribute.js'; export { default as NodeBuilder } from './core/NodeBuilder.js'; @@ -19,12 +19,20 @@ export { default as NodeKeywords } from './core/NodeKeywords.js'; export { default as NodeUniform } from './core/NodeUniform.js'; export { default as NodeVar } from './core/NodeVar.js'; export { default as NodeVarying } from './core/NodeVarying.js'; -export { default as PropertyNode } from './core/PropertyNode.js'; +export { + default as PropertyNode, + property, + diffuseColor, + roughness, + metalness, + specularColor, + shininess, +} from './core/PropertyNode.js'; export { default as StackNode } from './core/StackNode.js'; export { default as TempNode } from './core/TempNode.js'; -export { default as UniformNode } from './core/UniformNode.js'; -export { default as VarNode } from './core/VarNode.js'; -export { default as VaryingNode } from './core/VaryingNode.js'; +export { default as UniformNode, uniform } from './core/UniformNode.js'; +export { default as VarNode, label, temp } from './core/VarNode.js'; +export { default as VaryingNode, varying } from './core/VaryingNode.js'; import * as NodeUtils from './core/NodeUtils.js'; export { NodeUtils }; @@ -32,95 +40,261 @@ export { NodeUtils }; // math export { default as MathNode, + EPSILON, + INFINITY, + radians, + degrees, + exp, + exp2, + log, + log2, + sqrt, + inversesqrt, + floor, + ceil, + normalize, + fract, + sin, + cos, + tan, + asin, + acos, + atan, + abs, + sign, + length, + negate, + invert, + dFdx, + dFdy, + round, + reciprocal, + atan2, + min, + max, + mod, + step, + reflect, + distance, + difference, + dot, + cross, + pow, + pow2, + pow3, + pow4, + transformDirection, + mix, + clamp, + refract, + smoothstep, + faceforward, MathNodeMethod1, MathNodeMethod2, MathNodeMethod3, MathNodeMethod, + Unary, + Binary, + Ternary, } from './math/MathNode.js'; -export { default as OperatorNode, OperatorNodeOp } from './math/OperatorNode.js'; -export { default as CondNode } from './math/CondNode.js'; +export { + default as OperatorNode, + add, + sub, + mul, + div, + remainder, + equal, + assign, + lessThan, + greaterThan, + lessThanEqual, + greaterThanEqual, + and, + or, + xor, + bitAnd, + bitOr, + bitXor, + shiftLeft, + shiftRight, + OperatorNodeOp, + Operator, +} from './math/OperatorNode.js'; +export { default as CondNode, cond } from './math/CondNode.js'; // utils export { default as ArrayElementNode } from './utils/ArrayElementNode.js'; export { default as ConvertNode } from './utils/ConvertNode.js'; -export { default as EquirectUVNode } from './utils/EquirectUVNode.js'; +export { default as EquirectUVNode, equirectUV } from './utils/EquirectUVNode.js'; export { default as JoinNode } from './utils/JoinNode.js'; -export { default as MatcapUVNode } from './utils/MatcapUVNode.js'; -export { default as MaxMipLevelNode } from './utils/MaxMipLevelNode.js'; -export { default as OscNode, OscNodeMethod } from './utils/OscNode.js'; -export { default as RemapNode } from './utils/RemapNode.js'; -export { default as RotateUVNode } from './utils/RotateUVNode.js'; -export { default as SpecularMIPLevelNode } from './utils/SpecularMIPLevelNode.js'; +export { default as MatcapUVNode, matcapUV } from './utils/MatcapUVNode.js'; +export { default as MaxMipLevelNode, maxMipLevel } from './utils/MaxMipLevelNode.js'; +export { default as OscNode, oscSine, oscSquare, oscTriangle, oscSawtooth, OscNodeMethod } from './utils/OscNode.js'; +export { default as RemapNode, remap, remapClamp } from './utils/RemapNode.js'; +export { default as RotateUVNode, rotateUV } from './utils/RotateUVNode.js'; +export { default as SpecularMIPLevelNode, specularMIPLevel } from './utils/SpecularMIPLevelNode.js'; export { default as SplitNode } from './utils/SplitNode.js'; -export { default as SpriteSheetUVNode } from './utils/SpriteSheetUVNode.js'; -export { default as TimerNode, TimerNodeScope } from './utils/TimerNode.js'; -export { default as TriplanarTexturesNode } from './utils/TriplanarTexturesNode.js'; +export { default as SpriteSheetUVNode, spritesheetUV } from './utils/SpriteSheetUVNode.js'; +export { + default as TimerNode, + timerLocal, + timerGlobal, + timerDelta, + frameId, + TimerNodeScope, +} from './utils/TimerNode.js'; +export { + default as TriplanarTexturesNode, + triplanarTextures, + triplanarTexture, +} from './utils/TriplanarTexturesNode.js'; // shader node -export * from './shadernode/ShaderNodeElements.js'; +export * from './shadernode/ShaderNode.js'; // accessors -export { default as BitangentNode, BitangentNodeScope } from './accessors/BitangentNode.js'; -export { default as BufferNode } from './accessors/BufferNode.js'; -export { default as CameraNode, CameraNodeScope } from './accessors/CameraNode.js'; -export { default as CubeTextureNode } from './accessors/CubeTextureNode.js'; -export { default as InstanceNode } from './accessors/InstanceNode.js'; -export { default as MaterialNode, MaterialNodeScope } from './accessors/MaterialNode.js'; -export { default as MaterialReferenceNode } from './accessors/MaterialReferenceNode.js'; -export { default as ModelNode } from './accessors/ModelNode.js'; -export { default as ModelViewProjectionNode } from './accessors/ModelViewProjectionNode.js'; -export { default as NormalNode, NormalNodeScope } from './accessors/NormalNode.js'; +export { + default as BitangentNode, + bitangentGeometry, + bitangentLocal, + bitangentView, + bitangentWorld, + transformedBitangentView, + transformedBitangentWorld, + BitangentNodeScope, +} from './accessors/BitangentNode.js'; +export { default as BufferNode, buffer } from './accessors/BufferNode.js'; +export { + default as CameraNode, + cameraProjectionMatrix, + cameraViewMatrix, + cameraNormalMatrix, + cameraWorldMatrix, + cameraPosition, + CameraNodeScope, +} from './accessors/CameraNode.js'; +export { default as CubeTextureNode, cubeTexture } from './accessors/CubeTextureNode.js'; +export { default as InstanceNode, instance } from './accessors/InstanceNode.js'; +export { + default as MaterialNode, + materialAlphaTest, + materialColor, + materialShininess, + materialEmissive, + materialOpacity, + materialSpecularColor, + materialReflectivity, + materialRoughness, + materialMetalness, + materialRotation, + MaterialNodeScope, +} from './accessors/MaterialNode.js'; +export { default as MaterialReferenceNode, materialReference } from './accessors/MaterialReferenceNode.js'; +export { + default as ModelNode, + modelViewMatrix, + modelNormalMatrix, + modelWorldMatrix, + modelPosition, + modelViewPosition, +} from './accessors/ModelNode.js'; +export { default as ModelViewProjectionNode, modelViewProjection } from './accessors/ModelViewProjectionNode.js'; +export { + default as NormalNode, + normalGeometry, + normalLocal, + normalView, + normalWorld, + transformedNormalView, + NormalNodeScope, +} from './accessors/NormalNode.js'; export { default as Object3DNode, Object3DNodeScope as OObject3DNodeScope } from './accessors/Object3DNode.js'; -export { default as PointUVNode } from './accessors/PointUVNode.js'; -export { default as PositionNode, PositionNodeScope } from './accessors/PositionNode.js'; -export { default as ReferenceNode } from './accessors/ReferenceNode.js'; -export { default as ReflectVectorNode } from './accessors/ReflectVectorNode.js'; -export { default as SkinningNode } from './accessors/SkinningNode.js'; -export { default as TangentNode, TangentNodeScope } from './accessors/TangentNode.js'; -export { default as TextureNode } from './accessors/TextureNode.js'; -export { default as UVNode } from './accessors/UVNode.js'; -export { default as UserDataNode } from './accessors/UserDataNode.js'; +export { default as PointUVNode, pointUV } from './accessors/PointUVNode.js'; +export { + default as PositionNode, + positionGeometry, + positionLocal, + positionWorld, + positionWorldDirection, + positionView, + positionViewDirection, + PositionNodeScope, +} from './accessors/PositionNode.js'; +export { default as ReferenceNode, reference } from './accessors/ReferenceNode.js'; +export { default as ReflectVectorNode, reflectVector } from './accessors/ReflectVectorNode.js'; +export { default as SkinningNode, skinning } from './accessors/SkinningNode.js'; +export { default as StorageBufferNode, storage } from './accessors/StorageBufferNode.js'; +export { + default as TangentNode, + tangentGeometry, + tangentLocal, + tangentView, + tangentWorld, + transformedTangentView, + transformedTangentWorld, + TangentNodeScope, +} from './accessors/TangentNode.js'; +export { default as TextureNode, texture, sampler } from './accessors/TextureNode.js'; +export { default as UVNode, uv } from './accessors/UVNode.js'; +export { default as UserDataNode, userData } from './accessors/UserDataNode.js'; // display -export { default as BlendModeNode, BlendMode } from './display/BlendModeNode.js'; -export { default as ColorAdjustmentNode, ColorAdjustmentMethod } from './display/ColorAdjustmentNode.js'; -export { default as ColorSpaceNode, ColorSpaceNodeMethod } from './display/ColorSpaceNode.js'; -export { default as FrontFacingNode } from './display/FrontFacingNode.js'; -export { default as NormalMapNode } from './display/NormalMapNode.js'; -export { default as PosterizeNode } from './display/PosterizeNode.js'; -export { default as ToneMappingNode } from './display/ToneMappingNode.js'; -export { default as ViewportNode } from './display/ViewportNode.js'; +export { default as BlendModeNode, burn, dodge, overlay, screen, BlendMode } from './display/BlendModeNode.js'; +export { + default as ColorAdjustmentNode, + saturation, + vibrance, + hue, + lumaCoeffs, + luminance, + ColorAdjustmentMethod, +} from './display/ColorAdjustmentNode.js'; +export { default as ColorSpaceNode, colorSpace, ColorSpaceNodeMethod } from './display/ColorSpaceNode.js'; +export { default as FrontFacingNode, frontFacing, faceDirection } from './display/FrontFacingNode.js'; +export { default as NormalMapNode, normalMap, TBNViewMatrix } from './display/NormalMapNode.js'; +export { default as PosterizeNode, posterize } from './display/PosterizeNode.js'; +export { default as ToneMappingNode, toneMapping } from './display/ToneMappingNode.js'; +export { + default as ViewportNode, + viewportCoordinate, + viewportResolution, + viewportTopLeft, + viewportBottomLeft, + viewportTopRight, + viewportBottomRight, +} from './display/ViewportNode.js'; // code -export { default as ExpressionNode } from './code/ExpressionNode.js'; -export { default as CodeNode, CodeNodeInclude } from './code/CodeNode.js'; -export { default as FunctionCallNode } from './code/FunctionCallNode.js'; -export { default as FunctionNode, FunctionNodeArguments } from './code/FunctionNode.js'; +export { default as ExpressionNode, expression } from './code/ExpressionNode.js'; +export { default as CodeNode, code, CodeNodeInclude } from './code/CodeNode.js'; +export { default as FunctionCallNode, call } from './code/FunctionCallNode.js'; +export { default as FunctionNode, func, fn, FunctionNodeArguments, Fn } from './code/FunctionNode.js'; // fog -export { default as FogNode } from './fog/FogNode.js'; -export { default as FogRangeNode } from './fog/FogRangeNode.js'; -export { default as FogExp2Node } from './fog/FogExp2Node.js'; +export { default as FogNode, fog } from './fog/FogNode.js'; +export { default as FogRangeNode, rangeFog } from './fog/FogRangeNode.js'; +export { default as FogExp2Node, densityFog } from './fog/FogExp2Node.js'; // geometry -export { default as RangeNode, RangeModeBound } from './geometry/RangeNode.js'; +export { default as RangeNode, range, RangeModeBound } from './geometry/RangeNode.js'; // gpgpu -export { default as ComputeNode } from './gpgpu/ComputeNode.js'; +export { default as ComputeNode, compute } from './gpgpu/ComputeNode.js'; // lighting export { default as PointLightNode } from './lighting/PointLightNode.js'; export { default as SpotLightNode } from './lighting/SpotLightNode.js'; -export { default as LightsNode } from './lighting/LightsNode.js'; +export { default as LightsNode, lights } from './lighting/LightsNode.js'; export { default as LightingNode } from './lighting/LightingNode.js'; -export { default as LightingContextNode, LightingModelNode } from './lighting/LightingContextNode.js'; +export { default as LightingContextNode, lightingContext, LightingModelNode } from './lighting/LightingContextNode.js'; export { default as HemisphereLightNode } from './lighting/HemisphereLightNode.js'; export { default as EnvironmentNode } from './lighting/EnvironmentNode.js'; export { default as AONode } from './lighting/AONode.js'; export { default as AnalyticLightNode } from './lighting/AnalyticLightNode.js'; // procedural -export { default as CheckerNode } from './procedural/CheckerNode.js'; +export { default as CheckerNode, checker } from './procedural/CheckerNode.js'; // loaders export { default as NodeLoader } from './loaders/NodeLoader.js'; diff --git a/types/three/examples/jsm/nodes/accessors/BitangentNode.d.ts b/types/three/examples/jsm/nodes/accessors/BitangentNode.d.ts index c279916f4..77bc7bd6d 100644 --- a/types/three/examples/jsm/nodes/accessors/BitangentNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/BitangentNode.d.ts @@ -1,4 +1,6 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; +import MathNode from '../math/MathNode.js'; export type BitangentNodeScope = | typeof BitangentNode.LOCAL @@ -16,3 +18,10 @@ export default class BitangentNode extends Node { constructor(scope?: BitangentNodeScope); } + +export const bitangentGeometry: Swizzable; +export const bitangentLocal: Swizzable; +export const bitangentView: Swizzable; +export const bitangentWorld: Swizzable; +export const transformedBitangentView: Swizzable; +export const transformedBitangentWorld: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/BufferNode.d.ts b/types/three/examples/jsm/nodes/accessors/BufferNode.d.ts index 992fa881e..b5f281753 100644 --- a/types/three/examples/jsm/nodes/accessors/BufferNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/BufferNode.d.ts @@ -1,5 +1,6 @@ import { NodeTypeOption } from '../core/constants.js'; import UniformNode from '../core/UniformNode.js'; +import { NodeOrType, Swizzable } from '../shadernode/ShaderNode.js'; export default class BufferNode extends UniformNode { isBufferNode: true; @@ -9,3 +10,5 @@ export default class BufferNode extends UniformNode { constructor(value: ArrayLike, bufferType: NodeTypeOption, bufferCount?: number); } + +export const buffer: (value: ArrayLike, nodeOrType: NodeOrType, count: number) => Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/CameraNode.d.ts b/types/three/examples/jsm/nodes/accessors/CameraNode.d.ts index fd64e41e5..eaed6e926 100644 --- a/types/three/examples/jsm/nodes/accessors/CameraNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/CameraNode.d.ts @@ -1,4 +1,5 @@ import Object3DNode, { Object3DNodeScope } from './Object3DNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export type CameraNodeScope = Object3DNodeScope | typeof CameraNode.PROJECTION_MATRIX; @@ -10,3 +11,9 @@ export default class CameraNode extends Object3DNode { constructor(scope?: CameraNodeScope); } + +export const cameraProjectionMatrix: Swizzable; +export const cameraViewMatrix: Swizzable; +export const cameraNormalMatrix: Swizzable; +export const cameraWorldMatrix: Swizzable; +export const cameraPosition: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts b/types/three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts index f3e07a085..1ed291b3e 100644 --- a/types/three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts @@ -1,6 +1,7 @@ -import TextureNode from './TextureNode.js'; -import { Node } from '../Nodes.js'; import { CubeTexture } from '../../../../src/Three.js'; +import TextureNode from './TextureNode.js'; +import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class CubeTextureNode extends TextureNode { isCubeTextureNode: boolean; @@ -11,3 +12,9 @@ export default class CubeTextureNode extends TextureNode { getDefaultUV(): Node; } + +export const cubeTexture: ( + value: CubeTexture, + uvNode?: NodeRepresentation, + levelNode?: NodeRepresentation, +) => Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/InstanceNode.d.ts b/types/three/examples/jsm/nodes/accessors/InstanceNode.d.ts index 5d8267a5b..ac2b10366 100644 --- a/types/three/examples/jsm/nodes/accessors/InstanceNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/InstanceNode.d.ts @@ -1,5 +1,6 @@ import { InstancedMesh } from '../../../../src/Three.js'; import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class InstanceNode extends Node { instanceMesh: InstancedMesh; @@ -7,3 +8,5 @@ export default class InstanceNode extends Node { constructor(instanceMesh: InstancedMesh); } + +export const instance: (instanceMesh: InstancedMesh) => Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/MaterialNode.d.ts b/types/three/examples/jsm/nodes/accessors/MaterialNode.d.ts index 8add8f3cf..32305ce6e 100644 --- a/types/three/examples/jsm/nodes/accessors/MaterialNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/MaterialNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export type MaterialNodeScope = | typeof MaterialNode.ALPHA_TEST @@ -21,3 +22,14 @@ export default class MaterialNode extends Node { scope: MaterialNodeScope; constructor(scope?: MaterialNodeScope); } + +export const materialAlphaTest: Swizzable; +export const materialColor: Swizzable; +export const materialShininess: Swizzable; +export const materialEmissive: Swizzable; +export const materialOpacity: Swizzable; +export const materialSpecularColor: Swizzable; +export const materialReflectivity: Swizzable; +export const materialRoughness: Swizzable; +export const materialMetalness: Swizzable; +export const materialRotation: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts b/types/three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts index f53d61f6d..8a1006e40 100644 --- a/types/three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts @@ -1,6 +1,13 @@ import { Material } from '../../../../src/Three.js'; import ReferenceNode from './ReferenceNode.js'; +import { NodeOrType, Swizzable } from '../shadernode/ShaderNode.js'; export default class MaterialReferenceNode extends ReferenceNode { constructor(property: string, inputType: string, material?: Material | null); } + +export const materialReference: ( + name: string, + nodeOrType: NodeOrType, + material: Material, +) => Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/ModelNode.d.ts b/types/three/examples/jsm/nodes/accessors/ModelNode.d.ts index 92c34154c..c9894adbe 100644 --- a/types/three/examples/jsm/nodes/accessors/ModelNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/ModelNode.d.ts @@ -1,5 +1,5 @@ -import { NodeFrame } from '../Nodes.js'; import Object3DNode, { Object3DNodeScope } from './Object3DNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; /** * Similar to {@link Object3DNode} but the object comes from {@link NodeFrame} @@ -7,3 +7,9 @@ import Object3DNode, { Object3DNodeScope } from './Object3DNode.js'; export default class ModelNode extends Object3DNode { constructor(scope?: Object3DNodeScope); } + +export const modelViewMatrix: Swizzable; +export const modelNormalMatrix: Swizzable; +export const modelWorldMatrix: Swizzable; +export const modelPosition: Swizzable; +export const modelViewPosition: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts b/types/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts index bfe00bee2..9cbaedcae 100644 --- a/types/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts @@ -1,6 +1,9 @@ import Node from '../core/Node.js'; import PositionNode from './PositionNode.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class ModelViewProjectionNode extends Node { constructor(positionNode?: PositionNode); } + +export const modelViewProjection: (position?: NodeRepresentation) => Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/NormalNode.d.ts b/types/three/examples/jsm/nodes/accessors/NormalNode.d.ts index 535018c8d..800ec465f 100644 --- a/types/three/examples/jsm/nodes/accessors/NormalNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/NormalNode.d.ts @@ -1,4 +1,6 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; +import VarNode from '../core/VarNode.js'; export type NormalNodeScope = typeof NormalNode.GEOMETRY | typeof NormalNode.LOCAL | typeof NormalNode.VIEW; @@ -10,3 +12,9 @@ export default class NormalNode extends Node { constructor(scope?: NormalNodeScope); } + +export const normalGeometry: Swizzable; +export const normalLocal: Swizzable; +export const normalView: Swizzable; +export const normalWorld: Swizzable; +export const transformedNormalView: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/PointUVNode.d.ts b/types/three/examples/jsm/nodes/accessors/PointUVNode.d.ts index 1a904acb7..95475f400 100644 --- a/types/three/examples/jsm/nodes/accessors/PointUVNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/PointUVNode.d.ts @@ -1,7 +1,10 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class PointUVNode extends Node { isPointUVNode: true; constructor(); } + +export const pointUV: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/PositionNode.d.ts b/types/three/examples/jsm/nodes/accessors/PositionNode.d.ts index ca8a90b8f..de11e6a17 100644 --- a/types/three/examples/jsm/nodes/accessors/PositionNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/PositionNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode'; export type PositionNodeScope = | typeof PositionNode.GEOMETRY @@ -19,3 +20,10 @@ export default class PositionNode extends Node { constructor(scope?: PositionNodeScope); } + +export const positionGeometry: Swizzable; +export const positionLocal: Swizzable; +export const positionWorld: Swizzable; +export const positionWorldDirection: Swizzable; +export const positionView: Swizzable; +export const positionViewDirection: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/ReferenceNode.d.ts b/types/three/examples/jsm/nodes/accessors/ReferenceNode.d.ts index 26ec4b081..7fc64d80a 100644 --- a/types/three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/ReferenceNode.d.ts @@ -1,5 +1,6 @@ import Node from '../core/Node.js'; -import { NodeTypeOption } from '../Nodes.js'; +import { NodeTypeOption } from '../core/constants.js'; +import { NodeOrType, Swizzable } from '../shadernode/ShaderNode.js'; export default class ReferenceNode extends Node { object: T; @@ -11,3 +12,5 @@ export default class ReferenceNode extends Node { setNodeType(uniformType: NodeTypeOption): void; } + +export const reference: (name: string, nodeOrType: NodeOrType, object: T) => Swizzable>; diff --git a/types/three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts b/types/three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts index 9c7c97231..4d2677721 100644 --- a/types/three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class ReflectVectorNode extends Node { constructor(); @@ -6,3 +7,5 @@ export default class ReflectVectorNode extends Node { getHash(): 'reflectVector'; setup(): Node; } + +export const reflectVector: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/SkinningNode.d.ts b/types/three/examples/jsm/nodes/accessors/SkinningNode.d.ts index fd71913ed..322fdfb25 100644 --- a/types/three/examples/jsm/nodes/accessors/SkinningNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/SkinningNode.d.ts @@ -1,5 +1,6 @@ import { SkinnedMesh } from '../../../../src/Three.js'; import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class SkinningNode extends Node { skinIndexNode: Node; @@ -11,3 +12,5 @@ export default class SkinningNode extends Node { constructor(skinnedMesh: SkinnedMesh); } + +export function skinning(skinnedMesh: SkinnedMesh): Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts b/types/three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts index 0206930d9..dd7fa7908 100644 --- a/types/three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts @@ -1,6 +1,9 @@ -import { NodeTypeOption } from '../Nodes.js'; import BufferNode from './BufferNode.js'; +import { NodeTypeOption } from '../core/constants.js'; +import { NodeOrType, Swizzable } from '../shadernode/ShaderNode.js'; export default class StorageBufferNode extends BufferNode { constructor(value: ArrayLike, bufferType: NodeTypeOption, bufferCount?: number); } + +export const storage: (value: ArrayLike, nodeOrType: NodeOrType, count: number) => Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/TangentNode.d.ts b/types/three/examples/jsm/nodes/accessors/TangentNode.d.ts index 1d8f88949..ec86bdcd2 100644 --- a/types/three/examples/jsm/nodes/accessors/TangentNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/TangentNode.d.ts @@ -1,4 +1,6 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; +import MathNode from '../math/MathNode.js'; export type TangentNodeScope = | typeof TangentNode.LOCAL @@ -16,3 +18,10 @@ export default class TangentNode extends Node { constructor(scope?: TangentNodeScope); } + +export const tangentGeometry: Swizzable; +export const tangentLocal: Swizzable; +export const tangentView: Swizzable; +export const tangentWorld: Swizzable; +export const transformedTangentView: Swizzable; +export const transformedTangentWorld: Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/TextureNode.d.ts b/types/three/examples/jsm/nodes/accessors/TextureNode.d.ts index 9111034a7..f79f14649 100644 --- a/types/three/examples/jsm/nodes/accessors/TextureNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/TextureNode.d.ts @@ -1,6 +1,7 @@ import { Texture } from '../../../../src/Three.js'; import UniformNode from '../core/UniformNode.js'; -import { Node } from '../Nodes.js'; +import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class TextureNode extends UniformNode { isTextureNode: true; @@ -12,3 +13,10 @@ export default class TextureNode extends UniformNode { getDefaultUV(): Node; } + +export const texture: ( + value: Texture, + uvNode?: NodeRepresentation, + levelNode?: NodeRepresentation, +) => Swizzable; +export const sampler: (aTexture: Texture | TextureNode) => Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/UVNode.d.ts b/types/three/examples/jsm/nodes/accessors/UVNode.d.ts index e97ccf3b4..04ba4b8e6 100644 --- a/types/three/examples/jsm/nodes/accessors/UVNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/UVNode.d.ts @@ -1,4 +1,5 @@ import AttributeNode from '../core/AttributeNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class UVNode extends AttributeNode { isUVNode: true; @@ -6,3 +7,5 @@ export default class UVNode extends AttributeNode { constructor(index?: number); } + +export const uv: (index?: number) => Swizzable; diff --git a/types/three/examples/jsm/nodes/accessors/UserDataNode.d.ts b/types/three/examples/jsm/nodes/accessors/UserDataNode.d.ts index 1e8b8ec8d..cc76100ae 100644 --- a/types/three/examples/jsm/nodes/accessors/UserDataNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/UserDataNode.d.ts @@ -1,7 +1,10 @@ import { NodeTypeOption, NodeUserData } from '../core/constants.js'; import ReferenceNode from './ReferenceNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class UserDataNode extends ReferenceNode { userData: NodeUserData | null; constructor(property: string, inputType: NodeTypeOption, userData?: NodeUserData | null); } + +export const userData: (name: string, inputType: NodeTypeOption, userData?: NodeUserData) => Swizzable; diff --git a/types/three/examples/jsm/nodes/code/CodeNode.d.ts b/types/three/examples/jsm/nodes/code/CodeNode.d.ts index 4e8267b14..6320021cc 100644 --- a/types/three/examples/jsm/nodes/code/CodeNode.d.ts +++ b/types/three/examples/jsm/nodes/code/CodeNode.d.ts @@ -1,5 +1,7 @@ import Node from '../core/Node.js'; import NodeBuilder from '../core/NodeBuilder.js'; +import { NodeTypeOption } from '../core/constants'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export interface CodeNodeInclude { build(builder: NodeBuilder): void; @@ -13,3 +15,5 @@ export default class CodeNode extends Node { setIncludes(includes: CodeNodeInclude[]): this; getIncludes(builder: NodeBuilder): CodeNodeInclude[]; } + +export const code: (code: string, nodeType?: NodeTypeOption) => Swizzable; diff --git a/types/three/examples/jsm/nodes/code/ExpressionNode.d.ts b/types/three/examples/jsm/nodes/code/ExpressionNode.d.ts index 205022018..5d9ec0fe7 100644 --- a/types/three/examples/jsm/nodes/code/ExpressionNode.d.ts +++ b/types/three/examples/jsm/nodes/code/ExpressionNode.d.ts @@ -1,7 +1,10 @@ import { NodeTypeOption } from '../core/constants.js'; import TempNode from '../core/TempNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class ExpressionNode extends TempNode { snipped: string; /* sic */ constructor(snipped?: string, nodeType?: NodeTypeOption); } + +export const expression: (snipped?: string, nodeType?: NodeTypeOption) => Swizzable; diff --git a/types/three/examples/jsm/nodes/code/FunctionCallNode.d.ts b/types/three/examples/jsm/nodes/code/FunctionCallNode.d.ts index c37a6efa0..e10a23ccd 100644 --- a/types/three/examples/jsm/nodes/code/FunctionCallNode.d.ts +++ b/types/three/examples/jsm/nodes/code/FunctionCallNode.d.ts @@ -1,6 +1,7 @@ -import FunctionNode from './FunctionNode.js'; +import FunctionNode, { FunctionNodeArguments } from './FunctionNode.js'; import TempNode from '../core/TempNode.js'; import Node from '../core/Node.js'; +import { ProxiedObject, Swizzable } from '../shadernode/ShaderNode.js'; export default class FunctionCallNode

extends TempNode { functionNode: FunctionNode

; @@ -11,3 +12,8 @@ export default class FunctionCallNode

( + functionNode?: FunctionNode

, + parameters?: ProxiedObject

, +) => Swizzable>; diff --git a/types/three/examples/jsm/nodes/code/FunctionNode.d.ts b/types/three/examples/jsm/nodes/code/FunctionNode.d.ts index 4827f0261..e0b99aa12 100644 --- a/types/three/examples/jsm/nodes/code/FunctionNode.d.ts +++ b/types/three/examples/jsm/nodes/code/FunctionNode.d.ts @@ -4,6 +4,7 @@ import NodeBuilder from '../core/NodeBuilder.js'; import NodeFunction from '../core/NodeFunction.js'; import NodeFunctionInput from '../core/NodeFunctionInput.js'; import Node from '../core/Node.js'; +import { ProxiedObject, ProxiedTuple, Swizzable } from '../shadernode/ShaderNode.js'; export type FunctionNodeArguments = Node[] | { [name: string]: Node }; @@ -15,3 +16,19 @@ export default class FunctionNode

e getNodeFunction(builder: NodeBuilder): NodeFunction; call(parameters: P): FunctionCallNode

; } + +export type Fn

= P extends readonly [...unknown[]] + ? ProxiedTuple

+ : readonly [ProxiedObject

]; + +export const func:

( + code: string, + includes?: CodeNodeInclude[], + // eslint-disable-next-line @definitelytyped/no-unnecessary-generics +) => { call: (...params: Fn

) => Swizzable }; + +export const fn:

( + code: string, + includes?: CodeNodeInclude[], + // eslint-disable-next-line @definitelytyped/no-unnecessary-generics +) => (...params: Fn

) => Swizzable; diff --git a/types/three/examples/jsm/nodes/core/AttributeNode.d.ts b/types/three/examples/jsm/nodes/core/AttributeNode.d.ts index f3418012b..5c5c435d3 100644 --- a/types/three/examples/jsm/nodes/core/AttributeNode.d.ts +++ b/types/three/examples/jsm/nodes/core/AttributeNode.d.ts @@ -1,9 +1,12 @@ import { NodeTypeOption } from './constants.js'; import Node from './Node.js'; import NodeBuilder from './NodeBuilder.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class AttributeNode extends Node { constructor(attributeName: string, nodeType?: NodeTypeOption | null); setAttributeName(attributeName: string): this; getAttributeName(builder: NodeBuilder): string; } + +export const attribute: (name: string, nodeType: NodeTypeOption) => Swizzable; diff --git a/types/three/examples/jsm/nodes/core/BypassNode.d.ts b/types/three/examples/jsm/nodes/core/BypassNode.d.ts index 45905daea..df13af549 100644 --- a/types/three/examples/jsm/nodes/core/BypassNode.d.ts +++ b/types/three/examples/jsm/nodes/core/BypassNode.d.ts @@ -1,4 +1,5 @@ import Node from './Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class BypassNode extends Node { isBypassNode: true; @@ -7,3 +8,5 @@ export default class BypassNode extends Node { constructor(returnNode: Node, callNode: Node); } + +export const bypass: (returnNode: NodeRepresentation, callNode: NodeRepresentation) => Swizzable; diff --git a/types/three/examples/jsm/nodes/core/CacheNode.d.ts b/types/three/examples/jsm/nodes/core/CacheNode.d.ts index b9268c53e..e25865281 100644 --- a/types/three/examples/jsm/nodes/core/CacheNode.d.ts +++ b/types/three/examples/jsm/nodes/core/CacheNode.d.ts @@ -1,5 +1,6 @@ import Node from './Node.js'; import NodeCache from './NodeCache.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class CacheNode extends Node { isCacheNode: true; @@ -8,3 +9,5 @@ export default class CacheNode extends Node { constructor(node: Node, cache?: NodeCache); } + +export const cache: (node: Node, cache?: NodeCache) => Swizzable; diff --git a/types/three/examples/jsm/nodes/core/ContextNode.d.ts b/types/three/examples/jsm/nodes/core/ContextNode.d.ts index c3978c999..b2a16616b 100644 --- a/types/three/examples/jsm/nodes/core/ContextNode.d.ts +++ b/types/three/examples/jsm/nodes/core/ContextNode.d.ts @@ -1,5 +1,6 @@ import Node from './Node.js'; import { NodeBuilderContext } from './NodeBuilder.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class ContextNode extends Node { isContextNode: true; @@ -8,3 +9,5 @@ export default class ContextNode extends Node { constructor(node: Node, context: NodeBuilderContext); } + +export const context: (node: NodeRepresentation, context: NodeBuilderContext) => Swizzable; diff --git a/types/three/examples/jsm/nodes/core/PropertyNode.d.ts b/types/three/examples/jsm/nodes/core/PropertyNode.d.ts index 90c2014df..f4fe5c429 100644 --- a/types/three/examples/jsm/nodes/core/PropertyNode.d.ts +++ b/types/three/examples/jsm/nodes/core/PropertyNode.d.ts @@ -1,6 +1,15 @@ import { NodeTypeOption } from './constants.js'; import Node from './Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class PropertyNode extends Node { constructor(name?: string, nodeType?: NodeTypeOption); } + +export const property: (name: string, nodeOrType: Node | NodeTypeOption) => Swizzable; + +export const diffuseColor: Swizzable; +export const roughness: Swizzable; +export const metalness: Swizzable; +export const specularColor: Swizzable; +export const shininess: Swizzable; diff --git a/types/three/examples/jsm/nodes/core/UniformNode.d.ts b/types/three/examples/jsm/nodes/core/UniformNode.d.ts index 2a94eed15..f85d86cca 100644 --- a/types/three/examples/jsm/nodes/core/UniformNode.d.ts +++ b/types/three/examples/jsm/nodes/core/UniformNode.d.ts @@ -1,6 +1,8 @@ import { NodeTypeOption, NodeValueOption } from './constants.js'; import InputNode from './InputNode.js'; import NodeBuilder from './NodeBuilder.js'; +import Node from './Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class UniformNode extends InputNode { isUniformNode: true; @@ -8,3 +10,8 @@ export default class UniformNode extends InputNode { constructor(value: NodeValueOption, nodeType?: NodeTypeOption | null); getUniformHash(builder: NodeBuilder): string; } + +export const uniform: ( + arg1: Node | Swizzable | NodeValueOption, + arg2?: Node | Swizzable | NodeValueOption, +) => Swizzable; diff --git a/types/three/examples/jsm/nodes/core/VarNode.d.ts b/types/three/examples/jsm/nodes/core/VarNode.d.ts index b93aab295..5982c254c 100644 --- a/types/three/examples/jsm/nodes/core/VarNode.d.ts +++ b/types/three/examples/jsm/nodes/core/VarNode.d.ts @@ -1,5 +1,6 @@ import { OperatorNodeOp } from '../math/OperatorNode.js'; import Node from './Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class VarNode extends Node { node: Node; @@ -14,3 +15,6 @@ export default class VarNode extends Node { mul(...params: Node[]): this; div(...params: Node[]): this; } + +export const label: (node: NodeRepresentation, name?: string) => Swizzable; +export const temp: (node: NodeRepresentation, name?: string) => Swizzable; diff --git a/types/three/examples/jsm/nodes/core/VaryingNode.d.ts b/types/three/examples/jsm/nodes/core/VaryingNode.d.ts index ec6e34161..30ef1e235 100644 --- a/types/three/examples/jsm/nodes/core/VaryingNode.d.ts +++ b/types/three/examples/jsm/nodes/core/VaryingNode.d.ts @@ -1,4 +1,5 @@ import Node from './Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class VaryingNode extends Node { node: Node; @@ -6,3 +7,5 @@ export default class VaryingNode extends Node { constructor(node: Node, name?: string | null); } + +export const varying: (node: NodeRepresentation, name?: string) => Swizzable; diff --git a/types/three/examples/jsm/nodes/display/BlendModeNode.d.ts b/types/three/examples/jsm/nodes/display/BlendModeNode.d.ts index 2964fe67d..a9ccf5ff6 100644 --- a/types/three/examples/jsm/nodes/display/BlendModeNode.d.ts +++ b/types/three/examples/jsm/nodes/display/BlendModeNode.d.ts @@ -1,6 +1,6 @@ import TempNode from '../core/TempNode.js'; -import { ShaderNode } from '../shadernode/ShaderNodeBaseElements.js'; -import { Node } from '../Nodes.js'; +import Node from '../core/Node.js'; +import { NodeRepresentation, ShaderNode, Swizzable } from '../shadernode/ShaderNode.js'; export const BurnNode: ShaderNode<{ base: Node; blendNode: Node }>; @@ -30,3 +30,8 @@ export default class BlendModeNode extends TempNode { setup(): Node; } + +export const burn: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => Swizzable; +export const dodge: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => Swizzable; +export const overlay: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => Swizzable; +export const screen: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => Swizzable; diff --git a/types/three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts b/types/three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts index 8b0d02939..ffc8f5553 100644 --- a/types/three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +++ b/types/three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts @@ -1,5 +1,6 @@ import TempNode from '../core/TempNode.js'; -import { Node } from '../Nodes.js'; +import MathNode from '../math/MathNode.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export type ColorAdjustmentMethod = | typeof ColorAdjustmentNode.SATURATION @@ -18,3 +19,19 @@ export default class ColorAdjustmentNode extends TempNode { constructor(method: ColorAdjustmentMethod, colorNode: Node, adjustmentNode?: Node); } + +export const saturation: ( + colorNode: NodeRepresentation, + adjustmentNode?: NodeRepresentation, +) => Swizzable; +export const vibrance: ( + colorNode: NodeRepresentation, + adjustmentNode?: NodeRepresentation, +) => Swizzable; +export const hue: ( + colorNode: NodeRepresentation, + adjustmentNode?: NodeRepresentation, +) => Swizzable; + +export const lumaCoeffs: Swizzable; +export const luminance: (a: NodeRepresentation, b: NodeRepresentation) => Swizzable; diff --git a/types/three/examples/jsm/nodes/display/ColorSpaceNode.d.ts b/types/three/examples/jsm/nodes/display/ColorSpaceNode.d.ts index 507e1ff74..5f882018a 100644 --- a/types/three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +++ b/types/three/examples/jsm/nodes/display/ColorSpaceNode.d.ts @@ -1,5 +1,7 @@ +import { TextureEncoding } from '../../../../src/Three.js'; import TempNode from '../core/TempNode.js'; import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export type ColorSpaceNodeMethod = | typeof ColorSpaceNode.LINEAR_TO_LINEAR @@ -16,3 +18,5 @@ export default class ColorSpaceNode extends TempNode { constructor(method: ColorSpaceNodeMethod | null, node: Node); } + +export const colorSpace: (node: NodeRepresentation, encoding: TextureEncoding) => Swizzable; diff --git a/types/three/examples/jsm/nodes/display/FrontFacingNode.d.ts b/types/three/examples/jsm/nodes/display/FrontFacingNode.d.ts index 63903c83f..0be2b38ba 100644 --- a/types/three/examples/jsm/nodes/display/FrontFacingNode.d.ts +++ b/types/three/examples/jsm/nodes/display/FrontFacingNode.d.ts @@ -1,6 +1,10 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class FrontFacingNode extends Node { isFrontFacingNode: true; constructor(); } + +export const frontFacing: Swizzable; +export const faceDirection: Swizzable; diff --git a/types/three/examples/jsm/nodes/display/NormalMapNode.d.ts b/types/three/examples/jsm/nodes/display/NormalMapNode.d.ts index 2ab0244f8..753ab8321 100644 --- a/types/three/examples/jsm/nodes/display/NormalMapNode.d.ts +++ b/types/three/examples/jsm/nodes/display/NormalMapNode.d.ts @@ -1,6 +1,8 @@ -import TempNode from '../core/TempNode.js'; import { NormalMapTypes } from '../../../../src/Three.js'; +import TempNode from '../core/TempNode.js'; import Node from '../core/Node.js'; +import MathNode from '../math/MathNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class NormalMapNode extends TempNode { node: Node; @@ -10,3 +12,7 @@ export default class NormalMapNode extends TempNode { constructor(node: Node, scaleNode?: Node | null); } + +export const normalMap: (node: Node, scaleNode?: Node) => Swizzable; + +export const TBNViewMatrix: Swizzable; diff --git a/types/three/examples/jsm/nodes/display/PosterizeNode.d.ts b/types/three/examples/jsm/nodes/display/PosterizeNode.d.ts index ecbc1ac3c..a09e25ce9 100644 --- a/types/three/examples/jsm/nodes/display/PosterizeNode.d.ts +++ b/types/three/examples/jsm/nodes/display/PosterizeNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class PosterizeNode extends Node { sourceNode: Node; @@ -6,3 +7,5 @@ export default class PosterizeNode extends Node { constructor(sourceNode: Node, stepsNode: Node); } + +export const posterize: (sourceNode: NodeRepresentation, stepsNode: NodeRepresentation) => Swizzable; diff --git a/types/three/examples/jsm/nodes/display/ToneMappingNode.d.ts b/types/three/examples/jsm/nodes/display/ToneMappingNode.d.ts index f59f0253c..d40c3d8c1 100644 --- a/types/three/examples/jsm/nodes/display/ToneMappingNode.d.ts +++ b/types/three/examples/jsm/nodes/display/ToneMappingNode.d.ts @@ -1,6 +1,7 @@ +import { ToneMapping } from '../../../../src/Three.js'; import TempNode from '../core/TempNode.js'; import Node from '../core/Node.js'; -import { ToneMapping } from '../../../../src/Three.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; // exposure only export const LinearToneMappingNode: Node; @@ -12,3 +13,9 @@ export default class ToneMappingNode extends TempNode { constructor(toneMapping: ToneMapping, exposureNode?: Node, colorNode?: Node | null); } + +export const toneMapping: ( + mapping: ToneMapping, + exposure: NodeRepresentation, + color: NodeRepresentation, +) => Swizzable; diff --git a/types/three/examples/jsm/nodes/display/ViewportNode.d.ts b/types/three/examples/jsm/nodes/display/ViewportNode.d.ts index 26fac99d7..04fae496c 100644 --- a/types/three/examples/jsm/nodes/display/ViewportNode.d.ts +++ b/types/three/examples/jsm/nodes/display/ViewportNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export type ViewportNodeScope = | typeof ViewportNode.COORDINATE @@ -21,3 +22,10 @@ export default class ViewportNode extends Node { constructor(scope: ViewportNodeScope); } + +export const viewportCoordinate: Swizzable; +export const viewportResolution: Swizzable; +export const viewportTopLeft: Swizzable; +export const viewportBottomLeft: Swizzable; +export const viewportTopRight: Swizzable; +export const viewportBottomRight: Swizzable; diff --git a/types/three/examples/jsm/nodes/fog/FogExp2Node.d.ts b/types/three/examples/jsm/nodes/fog/FogExp2Node.d.ts index 21b8130bf..30511596d 100644 --- a/types/three/examples/jsm/nodes/fog/FogExp2Node.d.ts +++ b/types/three/examples/jsm/nodes/fog/FogExp2Node.d.ts @@ -1,5 +1,6 @@ import Node from '../core/Node.js'; import FogNode from './FogNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class FogExp2Node extends FogNode { isFogExp2Node: true; @@ -7,3 +8,5 @@ export default class FogExp2Node extends FogNode { constructor(colorNode: Node, densityNode: Node); } + +export const densityFog: (colorNode: Node, densityNode: Node) => Swizzable; diff --git a/types/three/examples/jsm/nodes/fog/FogNode.d.ts b/types/three/examples/jsm/nodes/fog/FogNode.d.ts index d0cf3a8f7..da796628a 100644 --- a/types/three/examples/jsm/nodes/fog/FogNode.d.ts +++ b/types/three/examples/jsm/nodes/fog/FogNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class FogNode extends Node { isFogNode: true; @@ -8,3 +9,5 @@ export default class FogNode extends Node { constructor(colorNode: Node, factorNode: Node); mixAssign(outputNode: Node): Node; } + +export const fog: (colorNode: NodeRepresentation, factorNode: NodeRepresentation) => Swizzable; diff --git a/types/three/examples/jsm/nodes/fog/FogRangeNode.d.ts b/types/three/examples/jsm/nodes/fog/FogRangeNode.d.ts index 99d59f92d..c65ce7ca0 100644 --- a/types/three/examples/jsm/nodes/fog/FogRangeNode.d.ts +++ b/types/three/examples/jsm/nodes/fog/FogRangeNode.d.ts @@ -1,5 +1,6 @@ import FogNode from './FogNode.js'; import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class FogRangeNode extends FogNode { isFogRangeNode: true; @@ -8,3 +9,5 @@ export default class FogRangeNode extends FogNode { constructor(colorNode: Node, nearNode: Node, farNode: Node); } + +export const rangeFog: (colorNode: Node, nearNode: Node, farNode: Node) => Swizzable; diff --git a/types/three/examples/jsm/nodes/geometry/RangeNode.d.ts b/types/three/examples/jsm/nodes/geometry/RangeNode.d.ts index 2f5a6a18f..f60ab8f1e 100644 --- a/types/three/examples/jsm/nodes/geometry/RangeNode.d.ts +++ b/types/three/examples/jsm/nodes/geometry/RangeNode.d.ts @@ -1,6 +1,7 @@ import { Color, Vector2, Vector3, Vector4 } from '../../../../src/Three.js'; import Node from '../core/Node.js'; import NodeBuilder from '../core/NodeBuilder.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export type RangeModeBound = number | Color | Vector2 | Vector3 | Vector4; @@ -11,3 +12,5 @@ export default class RangeNode extends Node { constructor(min: RangeModeBound, max: RangeModeBound); getVectorLength(builder: NodeBuilder): number; } + +export const range: (min: RangeModeBound, max: RangeModeBound) => Swizzable; diff --git a/types/three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts b/types/three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts index 720dfa3cd..07a40b652 100644 --- a/types/three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +++ b/types/three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class ComputeNode extends Node { isComputeNode: true; @@ -9,3 +10,5 @@ export default class ComputeNode extends Node { constructor(computeNode: Node, count: number, workgroupSize?: number[]); } + +export const compute: (node: NodeRepresentation, count: number, workgroupSize: number[]) => Swizzable; diff --git a/types/three/examples/jsm/nodes/lighting/LightingContextNode.d.ts b/types/three/examples/jsm/nodes/lighting/LightingContextNode.d.ts index c4cbc2c8e..6f00e6a07 100644 --- a/types/three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +++ b/types/three/examples/jsm/nodes/lighting/LightingContextNode.d.ts @@ -1,6 +1,6 @@ import ContextNode from '../core/ContextNode.js'; import Node from '../core/Node.js'; -import { ShaderNode } from '../Nodes.js'; +import { ShaderNode, Swizzable } from '../shadernode/ShaderNode.js'; export interface LightingModelNode { indirectDiffuse?: ShaderNode; @@ -13,3 +13,5 @@ export default class LightingContextNode extends ContextNode { constructor(node: Node, lightingModelNode?: LightingModelNode | null); } + +export const lightingContext: (node: Node, lightingModelNode?: LightingModelNode) => Swizzable; diff --git a/types/three/examples/jsm/nodes/lighting/LightsNode.d.ts b/types/three/examples/jsm/nodes/lighting/LightsNode.d.ts index 2453833e6..da81c9d7b 100644 --- a/types/three/examples/jsm/nodes/lighting/LightsNode.d.ts +++ b/types/three/examples/jsm/nodes/lighting/LightsNode.d.ts @@ -1,6 +1,7 @@ import { Light } from '../../../../src/Three.js'; import Node from '../core/Node.js'; import LightingNode from './LightingNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class LightsNode extends Node { lightNodes: LightingNode[]; @@ -17,3 +18,5 @@ export default class LightsNode extends Node { lightNodeClass: { new (light: T): LightingNode }, ): void; } + +export const lights: (lights: Light[]) => Swizzable; diff --git a/types/three/examples/jsm/nodes/math/CondNode.d.ts b/types/three/examples/jsm/nodes/math/CondNode.d.ts index 43756cee5..920901b9c 100644 --- a/types/three/examples/jsm/nodes/math/CondNode.d.ts +++ b/types/three/examples/jsm/nodes/math/CondNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class CondNode extends Node { condNode: Node; @@ -7,3 +8,5 @@ export default class CondNode extends Node { constructor(condNode: Node, ifNode: Node, elseNode: Node); } + +export function cond(condNode: NodeRepresentation, ifNode: NodeRepresentation, elseNode: NodeRepresentation): Swizzable; diff --git a/types/three/examples/jsm/nodes/math/MathNode.d.ts b/types/three/examples/jsm/nodes/math/MathNode.d.ts index 3b8ac9072..4d8215d92 100644 --- a/types/three/examples/jsm/nodes/math/MathNode.d.ts +++ b/types/three/examples/jsm/nodes/math/MathNode.d.ts @@ -1,5 +1,6 @@ import Node from '../core/Node.js'; import TempNode from '../core/TempNode.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export type MathNodeMethod1 = | typeof MathNode.RADIANS @@ -113,3 +114,62 @@ export default class MathNode extends TempNode { constructor(method: MathNodeMethod2, aNode: Node, bNode: Node); constructor(method: MathNodeMethod3, aNode: Node, bNode: Node, cNode: Node); } + +export const EPSILON: Swizzable; +export const INFINITY: Swizzable; + +export type Unary = (a: NodeRepresentation) => Swizzable; + +export const radians: Unary; +export const degrees: Unary; +export const exp: Unary; +export const exp2: Unary; +export const log: Unary; +export const log2: Unary; +export const sqrt: Unary; +export const inversesqrt: Unary; +export const floor: Unary; +export const ceil: Unary; +export const normalize: Unary; +export const fract: Unary; +export const sin: Unary; +export const cos: Unary; +export const tan: Unary; +export const asin: Unary; +export const acos: Unary; +export const atan: Unary; +export const abs: Unary; +export const sign: Unary; +export const length: Unary; +export const negate: Unary; +export const invert: Unary; +export const dFdx: Unary; +export const dFdy: Unary; +export const round: Unary; +export const reciprocal: Unary; + +export type Binary = (a: NodeRepresentation, b: NodeRepresentation) => Swizzable; + +export const atan2: Binary; +export const min: Binary; +export const max: Binary; +export const mod: Binary; +export const step: Binary; +export const reflect: Binary; +export const distance: Binary; +export const difference: Binary; +export const dot: Binary; +export const cross: Binary; +export const pow: Binary; +export const pow2: Binary; +export const pow3: Binary; +export const pow4: Binary; +export const transformDirection: Binary; + +export type Ternary = (a: NodeRepresentation, b: NodeRepresentation, c: NodeRepresentation) => Swizzable; + +export const mix: Ternary; +export const clamp: Ternary; +export const refract: Ternary; +export const smoothstep: Ternary; +export const faceforward: Ternary; diff --git a/types/three/examples/jsm/nodes/math/OperatorNode.d.ts b/types/three/examples/jsm/nodes/math/OperatorNode.d.ts index f24926dc6..49d4b7fa9 100644 --- a/types/three/examples/jsm/nodes/math/OperatorNode.d.ts +++ b/types/three/examples/jsm/nodes/math/OperatorNode.d.ts @@ -1,5 +1,6 @@ import TempNode from '../core/TempNode.js'; import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export type OperatorNodeOp = | '=' @@ -29,3 +30,25 @@ export default class OperatorNode extends TempNode { constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]); } + +export type Operator = (a: NodeRepresentation, b: NodeRepresentation, ...others: NodeRepresentation[]) => Swizzable; + +export const add: Operator; +export const sub: Operator; +export const mul: Operator; +export const div: Operator; +export const remainder: Operator; +export const equal: Operator; +export const assign: Operator; +export const lessThan: Operator; +export const greaterThan: Operator; +export const lessThanEqual: Operator; +export const greaterThanEqual: Operator; +export const and: Operator; +export const or: Operator; +export const xor: Operator; +export const bitAnd: Operator; +export const bitOr: Operator; +export const bitXor: Operator; +export const shiftLeft: Operator; +export const shiftRight: Operator; diff --git a/types/three/examples/jsm/nodes/procedural/CheckerNode.d.ts b/types/three/examples/jsm/nodes/procedural/CheckerNode.d.ts index 803dc2c32..79c90887d 100644 --- a/types/three/examples/jsm/nodes/procedural/CheckerNode.d.ts +++ b/types/three/examples/jsm/nodes/procedural/CheckerNode.d.ts @@ -1,6 +1,9 @@ import TempNode from '../core/TempNode.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class CheckerNode extends TempNode { uvNode: Node; constructor(uvNode?: Node); } + +export const checker: (uvNode?: NodeRepresentation) => Swizzable; diff --git a/types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts b/types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts index cf946012b..a6276e4b6 100644 --- a/types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +++ b/types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts @@ -1,6 +1,5 @@ import { ConstNode, Node, NodeBuilder, NodeTypeOption, SwizzleOption } from '../Nodes.js'; -// lot of private typescript magic here -export {}; + export type Swizzable = T & { [key in SwizzleOption | number]: Swizzable; }; @@ -115,6 +114,15 @@ type ConstructedNode = T extends new (...args: any[]) => infer R ? (R extends export type NodeOrType = Node | NodeTypeOption; export function getConstNodeType(value: NodeOrType): NodeTypeOption | null; + +export class ShaderNode { + constructor(jsFunc: (inputs: NodeObjects, builder: NodeBuilder) => NodeRepresentation); + call: ( + inputs: { [key in keyof T]: T[key] extends NodeRepresentation ? Swizzable | Node : T[key] }, + builder?: NodeBuilder, + ) => Swizzable; +} + export function nodeObject(obj: T): NodeObject; export function nodeObjects(obj: T): NodeObjects; @@ -140,17 +148,37 @@ export function nodeImmutable( ...params: ProxiedTuple> ): Swizzable>; -export class ShaderNode { - constructor(jsFunc: (inputs: NodeObjects, builder: NodeBuilder) => NodeRepresentation); - call: ( - inputs: { [key in keyof T]: T[key] extends NodeRepresentation ? Swizzable | Node : T[key] }, - builder?: NodeBuilder, - ) => Swizzable; -} +export const color: ConvertType; -export const cacheMaps: { - bool: Map; - uint: Map; - int: Map; - float: Map; -}; +export const float: ConvertType; +export const int: ConvertType; +export const uint: ConvertType; +export const bool: ConvertType; + +export const vec2: ConvertType; +export const ivec2: ConvertType; +export const uvec2: ConvertType; +export const bvec2: ConvertType; + +export const vec3: ConvertType; +export const ivec3: ConvertType; +export const uvec3: ConvertType; +export const bvec3: ConvertType; + +export const vec4: ConvertType; +export const ivec4: ConvertType; +export const uvec4: ConvertType; +export const bvec4: ConvertType; + +export const mat3: ConvertType; +export const imat3: ConvertType; +export const umat3: ConvertType; +export const bmat3: ConvertType; + +export const mat4: ConvertType; +export const imat4: ConvertType; +export const umat4: ConvertType; +export const bmat4: ConvertType; + +export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => Swizzable; +export const convert: (node: NodeRepresentation, types: NodeTypeOption) => Swizzable; diff --git a/types/three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts b/types/three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts deleted file mode 100644 index a36d92f75..000000000 --- a/types/three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +++ /dev/null @@ -1,310 +0,0 @@ -import TextureNode from '../accessors/TextureNode.js'; -import Node from '../core/Node.js'; - -// shader node utils -import { - ShaderNode, - nodeObject, - nodeObjects, - nodeArray, - nodeProxy, - nodeImmutable, - ConvertType, - Swizzable, - NodeRepresentation, - NodeOrType, - ProxiedObject, - ProxiedTuple, -} from './ShaderNode.js'; -import { Material, Texture } from '../../../../src/Three.js'; -import { NodeTypeOption, NodeUserData, NodeValueOption } from '../core/constants.js'; -import { NodeBuilderContext } from '../core/NodeBuilder.js'; -import { - BitangentNode, - BufferNode, - BypassNode, - CacheNode, - CameraNode, - CodeNode, - CodeNodeInclude, - ComputeNode, - ContextNode, - ExpressionNode, - FrontFacingNode, - FunctionCallNode, - FunctionNode, - FunctionNodeArguments, - MaterialNode, - MaterialReferenceNode, - MathNode, - MaxMipLevelNode, - ModelNode, - ModelViewProjectionNode, - NormalNode, - PointUVNode, - PositionNode, - PropertyNode, - ReferenceNode, - TangentNode, - UserDataNode, - UVNode, - VarNode, - VaryingNode, -} from '../Nodes.js'; -import StorageBufferNode from '../accessors/StorageBufferNode.js'; -import NodeCache from '../core/NodeCache.js'; - -// shader node base - -export { ShaderNode, nodeObject, nodeObjects, nodeArray, nodeProxy, nodeImmutable, Swizzable }; - -export const color: ConvertType; - -export const float: ConvertType; -export const int: ConvertType; -export const uint: ConvertType; -export const bool: ConvertType; - -export const vec2: ConvertType; -export const ivec2: ConvertType; -export const uvec2: ConvertType; -export const bvec2: ConvertType; - -export const vec3: ConvertType; -export const ivec3: ConvertType; -export const uvec3: ConvertType; -export const bvec3: ConvertType; - -export const vec4: ConvertType; -export const ivec4: ConvertType; -export const uvec4: ConvertType; -export const bvec4: ConvertType; - -export const mat3: ConvertType; -export const imat3: ConvertType; -export const umat3: ConvertType; -export const bmat3: ConvertType; - -export const mat4: ConvertType; -export const imat4: ConvertType; -export const umat4: ConvertType; -export const bmat4: ConvertType; - -export function uniform(nodeOrType: Node | Swizzable | NodeValueOption): Swizzable; - -export function attribute(attributeName: string, nodeType: NodeTypeOption): Swizzable; -export function property(name: string, nodeOrType: Node | NodeTypeOption): Swizzable; - -export function convert(node: NodeRepresentation, types: NodeTypeOption): Swizzable; -export function maxMipLevel(texture: Texture): Swizzable; - -export function bypass(returnNode: NodeRepresentation, callNode: NodeRepresentation): Swizzable; -export function cache(node: Node, cache?: NodeCache): Swizzable; -export function code(code: string, nodeType?: NodeTypeOption): Swizzable; -export function context(node: NodeRepresentation, context: NodeBuilderContext): Swizzable; -export function expression(snipped?: string, nodeType?: NodeTypeOption): Swizzable; - -// definition: const call = nodeProxy(FunctionCallNode); -export function call

( - functionNode?: FunctionNode

, - parameters?: ProxiedObject

, -): Swizzable>; - -export type Fn

= P extends readonly [...unknown[]] - ? ProxiedTuple

- : readonly [ProxiedObject

]; - -export function func

( - code: string, - includes?: CodeNodeInclude[], - // eslint-disable-next-line @definitelytyped/no-unnecessary-generics -): { call: (...params: Fn

) => Swizzable }; - -export function fn

( - code: string, - includes?: CodeNodeInclude[], - // eslint-disable-next-line @definitelytyped/no-unnecessary-generics -): (...params: Fn

) => Swizzable; - -export function label(node: NodeRepresentation, name?: string): Swizzable; -export function temp(node: NodeRepresentation, name?: string): Swizzable; -export function vary(node: NodeRepresentation, name?: string): Swizzable; - -// accesors - -export function buffer(value: ArrayLike, nodeOrType: NodeOrType, count: number): Swizzable; -export function storage(value: ArrayLike, nodeOrType: NodeOrType, count: number): Swizzable; - -export const cameraProjectionMatrix: Swizzable; -export const cameraViewMatrix: Swizzable; -export const cameraNormalMatrix: Swizzable; -export const cameraWorldMatrix: Swizzable; -export const cameraPosition: Swizzable; - -export const materialAlphaTest: Swizzable; -export const materialColor: Swizzable; -export const materialEmissive: Swizzable; -export const materialOpacity: Swizzable; -export const materialRoughness: Swizzable; -export const materialMetalness: Swizzable; -export const materialRotation: Swizzable; - -export const diffuseColor: Swizzable; -export const roughness: Swizzable; -export const metalness: Swizzable; -export const alphaTest: Swizzable; -export const specularColor: Swizzable; - -export function reference(name: string, nodeOrType: NodeOrType, object: T): Swizzable>; -export function materialReference( - name: string, - nodeOrType: NodeOrType, - material: Material, -): Swizzable; -export function userData(name: string, inputType: NodeTypeOption, userData?: NodeUserData): Swizzable; - -export function modelViewProjection(position?: NodeRepresentation): Swizzable; - -export const normalGeometry: Swizzable; -export const normalLocal: Swizzable; -export const normalWorld: Swizzable; -export const normalView: Swizzable; -export const transformedNormalView: Swizzable; - -export const tangentGeometry: Swizzable; -export const tangentLocal: Swizzable; -export const tangentView: Swizzable; -export const tangentWorld: Swizzable; -export const transformedTangentView: Swizzable; -export const transformedTangentWorld: Swizzable; - -export const bitangentGeometry: Swizzable; -export const bitangentLocal: Swizzable; -export const bitangentView: Swizzable; -export const bitangentWorld: Swizzable; -export const transformedBitangentView: Swizzable; -export const transformedBitangentWorld: Swizzable; - -export const modelViewMatrix: Swizzable; -export const modelNormalMatrix: Swizzable; -export const modelWorldMatrix: Swizzable; -export const modelPosition: Swizzable; -export const modelViewPosition: Swizzable; - -export const positionGeometry: Swizzable; -export const positionLocal: Swizzable; -export const positionWorld: Swizzable; -export const positionWorldDirection: Swizzable; -export const positionView: Swizzable; -export const positionViewDirection: Swizzable; - -export function texture( - value: Texture, - uvNode?: NodeRepresentation, - levelNode?: NodeRepresentation, -): Swizzable; -export function sampler(texture: Texture | TextureNode): Swizzable; -export function uv(index?: number): Swizzable; -export const pointUV: Swizzable; - -// gpgpu - -export function compute(node: NodeRepresentation, count: number, workgroupSize: number[]): Swizzable; - -// math - -export const EPSILON: Swizzable; -export const INFINITY: Swizzable; - -export function cond(condNode: NodeRepresentation, ifNode: NodeRepresentation, elseNode: NodeRepresentation): Swizzable; - -type Operator = (a: NodeRepresentation, b: NodeRepresentation, ...others: NodeRepresentation[]) => Swizzable; -type Unary = (a: NodeRepresentation) => Swizzable; -type Binary = (a: NodeRepresentation, b: NodeRepresentation) => Swizzable; -type Ternary = (a: NodeRepresentation, b: NodeRepresentation, c: NodeRepresentation) => Swizzable; - -export const add: Operator; -export const sub: Operator; -export const mul: Operator; -export const div: Operator; -export const remainder: Operator; -export const equal: Operator; -export const assign: Operator; -export const lessThan: Operator; -export const greaterThan: Operator; -export const lessThanEqual: Operator; -export const greaterThanEqual: Operator; -export const and: Operator; -export const or: Operator; -export const xor: Operator; -export const bitAnd: Operator; -export const bitOr: Operator; -export const bitXor: Operator; -export const shiftLeft: Operator; -export const shiftRight: Operator; - -export const radians: Unary; -export const degrees: Unary; -export const exp: Unary; -export const exp2: Unary; -export const log: Unary; -export const log2: Unary; -export const sqrt: Unary; -export const inversesqrt: Unary; -export const floor: Unary; -export const ceil: Unary; -export const normalize: Unary; -export const fract: Unary; -export const sin: Unary; -export const cos: Unary; -export const tan: Unary; -export const asin: Unary; -export const acos: Unary; -export const atan: Unary; -export const abs: Unary; -export const sign: Unary; -export const length: Unary; -export const negate: Unary; -export const invert: Unary; -export const dFdx: Unary; -export const dFdy: Unary; -export const round: Unary; -export const reciprocal: Unary; - -export const atan2: Binary; -export const min: Binary; -export const max: Binary; -export const mod: Binary; -export const step: Binary; -export const reflect: Binary; -export const distance: Binary; -export const dot: Binary; -export const cross: Binary; -export const pow: Binary; -export const pow2: Binary; -export const pow3: Binary; -export const pow4: Binary; -export const transformDirection: Binary; - -export const mix: Ternary; -export const clamp: Ternary; -export const refract: Ternary; -export const smoothstep: Ternary; -export const faceforward: Ternary; - -// display - -export const frontFacing: Swizzable; -export const faceDirection: Swizzable; - -// lighting - -// utils -export function element(node: NodeRepresentation, indexNode: NodeRepresentation): Swizzable; - -// miscellaneous -export const lumaCoeffs: Swizzable; -export const luminance: Binary; -export const difference: Binary; -export const dotNV: Swizzable; -export const TBNViewMatrix: Swizzable; diff --git a/types/three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts b/types/three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts deleted file mode 100644 index be35f76e8..000000000 --- a/types/three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -import Node from '../core/Node.js'; -import RangeNode, { RangeModeBound } from '../geometry/RangeNode.js'; -import { NodeRepresentation, Swizzable } from './ShaderNode.js'; -import { - CubeTexture, - InstancedMesh, - Light, - SkinnedMesh, - Texture, - TextureEncoding, - ToneMapping, -} from '../../../../src/Three.js'; -import LightingContextNode, { LightingModelNode } from '../lighting/LightingContextNode.js'; -import { - BlendModeNode, - CheckerNode, - ColorAdjustmentNode, - ColorSpaceNode, - CubeTextureNode, - EquirectUVNode, - FogNode, - FogRangeNode, - FogExp2Node, - InstanceNode, - LightsNode, - MatcapUVNode, - NormalMapNode, - OscNode, - PosterizeNode, - RemapNode, - ReflectVectorNode, - RotateUVNode, - SkinningNode, - SpriteSheetUVNode, - TimerNode, - ToneMappingNode, - TriplanarTexturesNode, - SpecularMIPLevelNode, - ViewportNode, -} from '../Nodes.js'; - -// -// Node Material Shader Syntax -// - -// shader node base - -export * from './ShaderNodeBaseElements.js'; - -// functions - -export { default as BRDF_GGX } from '../functions/BSDF/BRDF_GGX.js'; // see https://github.com/tc39/proposal-export-default-from -export { default as BRDF_Lambert } from '../functions/BSDF/BRDF_Lambert.js'; -export { default as D_GGX } from '../functions/BSDF/D_GGX.js'; -export { default as DFGApprox } from '../functions/BSDF/DFGApprox.js'; -export { default as F_Schlick } from '../functions/BSDF/F_Schlick.js'; -export { default as V_GGX_SmithCorrelated } from '../functions/BSDF/V_GGX_SmithCorrelated.js'; - -export { default as getGeometryRoughness } from '../functions/material/getGeometryRoughness.js'; -export { default as getRoughness } from '../functions/material/getRoughness.js'; - -export { default as PhysicalLightingModel } from '../functions/PhysicalLightingModel.js'; - -// accessors - -export function cubeTexture( - value: CubeTexture, - uvNode?: NodeRepresentation, - levelNode?: NodeRepresentation, -): Swizzable; -export function instance(instanceMesh: InstancedMesh): Swizzable; -export const reflectVector: Swizzable; -export function skinning(skinnedMesh: SkinnedMesh): Swizzable; - -// display - -export function burn(baseNode: NodeRepresentation, blendNode?: NodeRepresentation): Swizzable; -export function dodge(baseNode: NodeRepresentation, blendNode?: NodeRepresentation): Swizzable; -export function overlay(baseNode: NodeRepresentation, blendNode?: NodeRepresentation): Swizzable; -export function screen(baseNode: NodeRepresentation, blendNode?: NodeRepresentation): Swizzable; - -export function saturation( - colorNode: NodeRepresentation, - adjustmentNode?: NodeRepresentation, -): Swizzable; -export function vibrance( - colorNode: NodeRepresentation, - adjustmentNode?: NodeRepresentation, -): Swizzable; -export function hue(colorNode: NodeRepresentation, adjustmentNode?: NodeRepresentation): Swizzable; - -export function colorSpace(node: NodeRepresentation, encoding: TextureEncoding): Swizzable; -export function normalMap(node: Node, scaleNode?: Node): Swizzable; -export function toneMapping( - mapping: ToneMapping, - exposure: NodeRepresentation, - color: NodeRepresentation, -): Swizzable; - -export function posterize(sourceNode: NodeRepresentation, stepsNode: NodeRepresentation): Swizzable; - -export const viewportCoordinate: Swizzable; -export const viewportResolution: Swizzable; -export const viewportTopLeft: Swizzable; -export const viewportBottomLeft: Swizzable; -export const viewportTopRight: Swizzable; -export const viewportBottomRight: Swizzable; - -// lighting - -export function lights(lights: Light[]): Swizzable; -export function lightingContext(node: Node, lightingModelNode?: LightingModelNode): Swizzable; - -// utils - -export const matcapUV: Swizzable; -export const equirectUV: Swizzable; - -export function specularMIPLevel(): Swizzable; - -export function oscSine(timeNode?: NodeRepresentation): Swizzable; -export function oscSquare(timeNode?: NodeRepresentation): Swizzable; -export function oscTriangle(timeNode?: NodeRepresentation): Swizzable; -export function oscSawtooth(timeNode?: NodeRepresentation): Swizzable; - -export function remap(node: Node, inLowNode: Node): Swizzable; -export function remapClamp(node: Node, inLowNode: Node): Swizzable; - -export function rotateUV(uvNode: Node, rotationNode: Node, centerNode?: Node): Swizzable; - -export function spritesheetUV( - countNode: NodeRepresentation, - uvNode?: NodeRepresentation, - frameNode?: NodeRepresentation, -): Swizzable; - -export function timerLocal(timeScale: number, value?: number): Swizzable; -export function timerGlobal(timeScale: number, value?: number): Swizzable; -export function timerDelta(timeScale: number, value?: number): Swizzable; -export const frameId: Swizzable; -export function triplanarTextures( - textureXNode: NodeRepresentation, - textureYNode?: NodeRepresentation, - textureZNode?: NodeRepresentation, - scaleNode?: NodeRepresentation, - positionNode?: NodeRepresentation, - normalNode?: NodeRepresentation, -): Swizzable; -export function triplanarTexture( - texture: NodeRepresentation, - ...params: NodeRepresentation[] -): Swizzable; - -// geometry - -export function range(min: RangeModeBound, max: RangeModeBound): Swizzable; - -// procedural - -export function checker(uvNode?: NodeRepresentation): Swizzable; - -// fog - -export function fog(colorNode: NodeRepresentation, factorNode: NodeRepresentation): Swizzable; -export function rangeFog(colorNode: Node, nearNode: Node, farNode: Node): Swizzable; -export function exp2Fog(colorNode: Node, densityNode: Node): Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/EquirectUVNode.d.ts b/types/three/examples/jsm/nodes/utils/EquirectUVNode.d.ts index 54f46c020..f40fa9756 100644 --- a/types/three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/EquirectUVNode.d.ts @@ -1,6 +1,8 @@ import { PositionNode, TempNode } from '../Nodes.js'; -import { Swizzable } from '../shadernode/ShaderNodeElements.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class EquirectUVNode extends TempNode { constructor(dirNode?: Swizzable); } + +export const equirectUV: Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/MatcapUVNode.d.ts b/types/three/examples/jsm/nodes/utils/MatcapUVNode.d.ts index 536d597db..256ce0fdd 100644 --- a/types/three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/MatcapUVNode.d.ts @@ -1,5 +1,8 @@ import TempNode from '../core/TempNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class MatcapUVNode extends TempNode { constructor(); } + +export const matcapUV: Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts b/types/three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts index b17f695de..adcc3edfb 100644 --- a/types/three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts @@ -1,6 +1,7 @@ -import UniformNode from '../core/UniformNode.js'; import { Texture } from '../../../../src/Three.js'; -import { TextureNode } from '../Nodes.js'; +import UniformNode from '../core/UniformNode.js'; +import TextureNode from '../accessors/TextureNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class MaxMipLevelNode extends UniformNode { textureNode: TextureNode; @@ -9,3 +10,5 @@ export default class MaxMipLevelNode extends UniformNode { get texture(): Texture; } + +export const maxMipLevel: (texture: Texture) => Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/OscNode.d.ts b/types/three/examples/jsm/nodes/utils/OscNode.d.ts index 36fa31bf3..03e8d592a 100644 --- a/types/three/examples/jsm/nodes/utils/OscNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/OscNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export type OscNodeMethod = | typeof OscNode.SINE @@ -17,3 +18,8 @@ export default class OscNode extends Node { constructor(method: OscNodeMethod, timeNode?: Node); } + +export const oscSine: (timeNode?: NodeRepresentation) => Swizzable; +export const oscSquare: (timeNode?: NodeRepresentation) => Swizzable; +export const oscTriangle: (timeNode?: NodeRepresentation) => Swizzable; +export const oscSawtooth: (timeNode?: NodeRepresentation) => Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/RemapNode.d.ts b/types/three/examples/jsm/nodes/utils/RemapNode.d.ts index c29e69438..f1e95481a 100644 --- a/types/three/examples/jsm/nodes/utils/RemapNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/RemapNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class RemapNode extends Node { node: Node; @@ -11,3 +12,6 @@ export default class RemapNode extends Node { constructor(node: Node, inLowNode: Node, inHighNode: Node, outLowNode: Node, outHighNode: Node); } + +export const remap: (node: Node, inLowNode: Node) => Swizzable; +export const remapClamp: (node: Node, inLowNode: Node) => Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/RotateUVNode.d.ts b/types/three/examples/jsm/nodes/utils/RotateUVNode.d.ts index a64edd9b7..129413269 100644 --- a/types/three/examples/jsm/nodes/utils/RotateUVNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/RotateUVNode.d.ts @@ -1,5 +1,6 @@ import TempNode from '../core/TempNode.js'; import Node from '../core/Node.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class RotateUVNode extends TempNode { uvNode: Node; @@ -8,3 +9,5 @@ export default class RotateUVNode extends TempNode { constructor(uvNode: Node, rotationNode: Node, centerNode?: Node); } + +export const rotateUV: (uvNode: Node, rotationNode: Node, centerNode?: Node) => Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts b/types/three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts index c9a0a0bda..6b16d4b14 100644 --- a/types/three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts @@ -1,4 +1,6 @@ -import { Node, TextureNode } from '../Nodes.js'; +import Node from '../core/Node.js'; +import TextureNode from '../accessors/TextureNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export default class SpecularMIPLevelNode extends Node { textureNode: TextureNode; @@ -6,3 +8,5 @@ export default class SpecularMIPLevelNode extends Node { constructor(textureNode: TextureNode, roughnessNode?: Node | null); } + +export const specularMIPLevel: () => Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts b/types/three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts index 11a692c92..0a552fb51 100644 --- a/types/three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts @@ -1,4 +1,5 @@ import Node from '../core/Node.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class SpriteSheetUVNode extends Node { countNode: Node; @@ -7,3 +8,9 @@ export default class SpriteSheetUVNode extends Node { constructor(countNode: Node, uvNode?: Node, frameNode?: Node); } + +export const spritesheetUV: ( + countNode: NodeRepresentation, + uvNode?: NodeRepresentation, + frameNode?: NodeRepresentation, +) => Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/TimerNode.d.ts b/types/three/examples/jsm/nodes/utils/TimerNode.d.ts index 6647bf396..a0d67310a 100644 --- a/types/three/examples/jsm/nodes/utils/TimerNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/TimerNode.d.ts @@ -1,4 +1,5 @@ import UniformNode from '../core/UniformNode.js'; +import { Swizzable } from '../shadernode/ShaderNode.js'; export type TimerNodeScope = | typeof TimerNode.LOCAL @@ -17,3 +18,8 @@ export default class TimerNode extends UniformNode { constructor(scope?: TimerNodeScope, scale?: number, value?: number); } + +export const timerLocal: (timeScale: number, value?: number) => Swizzable; +export const timerGlobal: (timeScale: number, value?: number) => Swizzable; +export const timerDelta: (timeScale: number, value?: number) => Swizzable; +export const frameId: Swizzable; diff --git a/types/three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts b/types/three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts index f7eab9ef6..0d609262c 100644 --- a/types/three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +++ b/types/three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts @@ -1,5 +1,7 @@ import Node from '../core/Node.js'; -import { PositionNode, Swizzable, TextureNode } from '../Nodes.js'; +import PositionNode from '../accessors/PositionNode.js'; +import TextureNode from '../accessors/TextureNode.js'; +import { NodeRepresentation, Swizzable } from '../shadernode/ShaderNode.js'; export default class TriplanarTexturesNode extends Node { textureXNode: TextureNode; @@ -20,3 +22,16 @@ export default class TriplanarTexturesNode extends Node { normalNode?: Swizzable, ); } + +export const triplanarTextures: ( + textureXNode: NodeRepresentation, + textureYNode?: NodeRepresentation, + textureZNode?: NodeRepresentation, + scaleNode?: NodeRepresentation, + positionNode?: NodeRepresentation, + normalNode?: NodeRepresentation, +) => Swizzable; +export const triplanarTexture: ( + texture: NodeRepresentation, + ...params: NodeRepresentation[] +) => Swizzable;