@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,19 +1,31 @@
1
- import { Camera, Material, Object3D, Renderer } from '../../../../src/Three.js';
1
+ import { Camera, Material, Object3D, Renderer, Scene } from '../../../../src/Three.js';
2
2
 
3
3
  import Node from './Node.js';
4
4
 
5
5
  export default class NodeFrame {
6
6
  time: number;
7
7
  deltaTime: number;
8
+
8
9
  frameId: number;
9
- startTime: null | number;
10
- renderer: null | Renderer;
11
- material: null | Material;
12
- camera: null | Camera;
13
- object: null | Object3D;
10
+ renderId: number;
11
+
12
+ startTime: number | null;
13
+
14
+ frameMap: WeakMap<Node, number>;
15
+ frameBeforeMap: WeakMap<Node, number>;
16
+ renderMap: WeakMap<Node, number>;
17
+ renderBeforeMap: WeakMap<Node, number>;
18
+
19
+ renderer: Renderer | null;
20
+ material: Material | null;
21
+ camera: Camera | null;
22
+ object: Object3D | null;
23
+ scene: Scene | null;
14
24
 
15
25
  constructor();
16
26
 
27
+ updateBeforeNode(node: Node): void;
28
+
17
29
  updateNode(node: Node): void;
18
30
  update(): void;
19
31
  }
@@ -1,13 +1,17 @@
1
- import { NodeValueOption } from './constants.js';
2
- import InputNode from './InputNode.js';
1
+ import UniformNode from './UniformNode.js';
2
+
3
+ export default class NodeUniform<Value> {
4
+ readonly isNodeUniform: true;
3
5
 
4
- export default class NodeUniform {
5
- isNodeUniform: true;
6
6
  name: string;
7
7
  type: string;
8
- node: InputNode;
9
- needsUpdate: boolean;
10
- value: NodeValueOption;
8
+ node: UniformNode<Value>;
9
+ needsUpdate: boolean | undefined;
10
+
11
+ constructor(name: string, type: string, node: UniformNode<Value>, needsUpdate?: boolean);
12
+
13
+ get(): Value;
14
+ set value(val: Value);
11
15
 
12
- constructor(name: string, type: string, node: InputNode, needsUpdate?: boolean);
16
+ get id(): number;
13
17
  }
@@ -1,4 +1,4 @@
1
- import { NodeValueOption } from './constants.js';
1
+ import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4 } from '../../../../src/Three.js';
2
2
  import Node from './Node.js';
3
3
 
4
4
  export interface NodeChild {
@@ -9,5 +9,8 @@ export interface NodeChild {
9
9
 
10
10
  export function getCacheKey(object: Node): string;
11
11
  export function getNodeChildren(object: Node): Generator<NodeChild, void>;
12
- export function getValueType(value: NodeValueOption): string | null;
13
- export function getValueFromType(type: string, ...params: number[]): NodeValueOption | null;
12
+ export function getValueType(value: unknown): string | null;
13
+ export function getValueFromType(
14
+ type: string,
15
+ ...params: number[]
16
+ ): Color | Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4 | boolean | number | string | ArrayBufferLike | null;
@@ -1,6 +1,32 @@
1
1
  import { NodeTypeOption } from './constants.js';
2
2
  import Node from './Node.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class PropertyNode extends Node {
5
- constructor(name?: string, nodeType?: NodeTypeOption);
6
+ name: string | null;
7
+ varying: boolean;
8
+
9
+ readonly isPropertyNode: true;
10
+
11
+ constructor(nodeType?: NodeTypeOption | null, name?: string | null, varying?: boolean);
6
12
  }
13
+
14
+ export const property: (type?: NodeTypeOption | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
15
+ export const varyingProperty: (type?: NodeTypeOption | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
16
+
17
+ export const diffuseColor: ShaderNodeObject<PropertyNode>;
18
+ export const roughness: ShaderNodeObject<PropertyNode>;
19
+ export const metalness: ShaderNodeObject<PropertyNode>;
20
+ export const clearcoat: ShaderNodeObject<PropertyNode>;
21
+ export const clearcoatRoughness: ShaderNodeObject<PropertyNode>;
22
+ export const sheen: ShaderNodeObject<PropertyNode>;
23
+ export const sheenRoughness: ShaderNodeObject<PropertyNode>;
24
+ export const iridescence: ShaderNodeObject<PropertyNode>;
25
+ export const iridescenceIOR: ShaderNodeObject<PropertyNode>;
26
+ export const iridescenceThickness: ShaderNodeObject<PropertyNode>;
27
+ export const specularColor: ShaderNodeObject<PropertyNode>;
28
+ export const shininess: ShaderNodeObject<PropertyNode>;
29
+ export const output: ShaderNodeObject<PropertyNode>;
30
+ export const dashSize: ShaderNodeObject<PropertyNode>;
31
+ export const gapSize: ShaderNodeObject<PropertyNode>;
32
+ export const pointWidth: ShaderNodeObject<PropertyNode>;
@@ -1,10 +1,18 @@
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
+ import Node from './Node.js';
5
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
6
 
5
- export default class UniformNode extends InputNode {
6
- isUniformNode: true;
7
+ export default class UniformNode<Value> extends InputNode<Value> {
8
+ readonly isUniformNode: true;
9
+
10
+ constructor(value: Value, nodeType?: NodeTypeOption | null);
7
11
 
8
- constructor(value: NodeValueOption, nodeType?: NodeTypeOption | null);
9
12
  getUniformHash(builder: NodeBuilder): string;
10
13
  }
14
+
15
+ export const uniform: <Value>(
16
+ arg1: InputNode<Value> | Value,
17
+ arg2?: Node | string,
18
+ ) => ShaderNodeObject<UniformNode<Value>>;
@@ -1,5 +1,6 @@
1
1
  import { OperatorNodeOp } from '../math/OperatorNode.js';
2
2
  import Node from './Node.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class VarNode extends Node {
5
6
  node: Node;
@@ -14,3 +15,12 @@ export default class VarNode extends Node {
14
15
  mul(...params: Node[]): this;
15
16
  div(...params: Node[]): this;
16
17
  }
18
+
19
+ export const temp: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
20
+
21
+ declare module '../shadernode/ShaderNode.js' {
22
+ interface NodeElements {
23
+ temp: typeof temp;
24
+ toVar: typeof temp;
25
+ }
26
+ }
@@ -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 VaryingNode extends Node {
4
5
  node: Node;
@@ -6,3 +7,11 @@ export default class VaryingNode extends Node {
6
7
 
7
8
  constructor(node: Node, name?: string | null);
8
9
  }
10
+
11
+ export const varying: (node: NodeRepresentation, name?: string) => ShaderNodeObject<VaryingNode>;
12
+
13
+ declare module '../shadernode/ShaderNode.js' {
14
+ interface NodeElements {
15
+ varying: typeof varying;
16
+ }
17
+ }
@@ -1,21 +1,27 @@
1
- import { Color, Matrix3, Matrix4, Vector2, Vector3, Vector4 } from '../../../../src/Three.js';
1
+ export enum NodeShaderStage {
2
+ VERTEX = 'vertex',
3
+ FRAGMENT = 'fragment',
4
+ }
2
5
 
3
- // disable automatic export, we have some private declarations
4
- export const NodeShaderStage: {
5
- VERTEX: 'vertex';
6
- FRAGMENT: 'fragment';
7
- };
6
+ export enum NodeUpdateType {
7
+ NONE = 'none',
8
+ FRAME = 'frame',
9
+ RENDER = 'render',
10
+ OBJECT = 'object',
11
+ }
8
12
 
9
- export const NodeUpdateType: {
10
- NONE: 'none';
11
- FRAME: 'frame';
12
- RENDER: 'render';
13
- OBJECT: 'object';
14
- };
13
+ export enum NodeType {
14
+ BOOLEAN = 'bool',
15
+ INTEGER = 'int',
16
+ FLOAT = 'float',
17
+ VECTOR2 = 'vec2',
18
+ VECTOR3 = 'vec3',
19
+ VECTOR4 = 'vec4',
20
+ MATRIX2 = 'mat2',
21
+ MATRIX3 = 'mat3',
22
+ MATRIX4 = 'mat4',
23
+ }
15
24
 
16
- export type NodeValueOption = Color | Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4 | boolean | number;
17
- export type NodeUpdateTypeOption = 'none' | 'frame' | 'object';
18
- export type NodeShaderStageOption = 'vertex' | 'fragment' | 'compute';
19
25
  export type NodeTypeOption =
20
26
  | 'bool'
21
27
  | 'int'
@@ -23,6 +29,7 @@ export type NodeTypeOption =
23
29
  | 'vec2'
24
30
  | 'vec3'
25
31
  | 'vec4'
32
+ | 'mat2'
26
33
  | 'mat3'
27
34
  | 'mat4'
28
35
  | 'code' /* CodeNode */
@@ -50,8 +57,15 @@ export type NodeTypeOption =
50
57
  | 'umat4'
51
58
  | 'bmat4';
52
59
 
53
- // can be defined with string template type in Typescript 4.1
54
- export type SwizzleOption = string;
60
+ export type SwizzleCharacter = 'x' | 'y' | 'z' | 'w' | 'r' | 'g' | 'b' | 'a' | 's' | 't' | 'p' | 'q';
61
+
62
+ export type SwizzleOption = Exclude<
63
+ | `${SwizzleCharacter}`
64
+ | `${SwizzleCharacter}${SwizzleCharacter}`
65
+ | `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`
66
+ | `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`,
67
+ 'abs' | 'sqrt'
68
+ >;
55
69
 
56
70
  /** Should be the same type as Object3D.userData */
57
71
  export type NodeUserData = Record<string, any>;
@@ -63,14 +77,3 @@ export interface AnyObject {
63
77
 
64
78
  /** a generic JSON type, used by nodes only */
65
79
  export type AnyJson = any;
66
-
67
- export const NodeType: {
68
- BOOLEAN: 'bool';
69
- INTEGER: 'int';
70
- FLOAT: 'float';
71
- VECTOR2: 'vec2';
72
- VECTOR3: 'vec3';
73
- VECTOR4: 'vec4';
74
- MATRIX3: 'mat3';
75
- MATRIX4: 'mat4';
76
- };
@@ -0,0 +1,25 @@
1
+ import Node from '../core/Node.js';
2
+ import TempNode from '../core/TempNode.js';
3
+ import TextureNode from '../accessors/TextureNode.js';
4
+ import UniformNode from '../core/UniformNode.js';
5
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
6
+
7
+ export default class AfterImageNode extends TempNode {
8
+ textureNode: TextureNode;
9
+ textureNodeOld: Node;
10
+ damp: UniformNode<number>;
11
+
12
+ constructor(textureNode: Node, damp?: number);
13
+
14
+ getTextureNode(): TextureNode;
15
+
16
+ setSize(width: number, height: number): void;
17
+ }
18
+
19
+ export const afterImage: (node: Node, damp?: number) => ShaderNodeObject<AfterImageNode>;
20
+
21
+ declare module '../shadernode/ShaderNode.js' {
22
+ interface NodeElements {
23
+ afterImage: typeof afterImage;
24
+ }
25
+ }
@@ -0,0 +1,32 @@
1
+ import { Vector2 } from '../../../../src/Three.js';
2
+ import Node from '../core/Node.js';
3
+ import TempNode from '../core/TempNode.js';
4
+ import TextureNode from '../accessors/TextureNode.js';
5
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
6
+
7
+ export default class AnamorphicNode extends TempNode {
8
+ textureNode: TextureNode;
9
+ thresholdNode: Node;
10
+ scaleNode: Node;
11
+ samples: number;
12
+ resolution: Vector2;
13
+
14
+ constructor(textureNode: TextureNode, thresholdNode: Node, scaleNode: Node, samples: number);
15
+
16
+ getTextureNode(): TextureNode;
17
+
18
+ setSize(width: number, height: number): void;
19
+ }
20
+
21
+ export const anamorphic: (
22
+ node: TextureNode,
23
+ threshold?: NodeRepresentation,
24
+ scale?: NodeRepresentation,
25
+ samples?: NodeRepresentation,
26
+ ) => ShaderNodeObject<AnamorphicNode>;
27
+
28
+ declare module '../shadernode/ShaderNode.js' {
29
+ interface NodeElements {
30
+ anamorphic: typeof anamorphic;
31
+ }
32
+ }
@@ -1,14 +1,15 @@
1
1
  import TempNode from '../core/TempNode.js';
2
- import { ShaderNode } from '../shadernode/ShaderNodeBaseElements.js';
3
- import { Node } from '../Nodes.js';
2
+ import Node from '../core/Node.js';
3
+ import { NodeRepresentation, ShaderNode, ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
+ import { JoinNode } from '../Nodes.js';
4
5
 
5
- export const BurnNode: ShaderNode<{ base: Node; blendNode: Node }>;
6
+ export const BurnNode: (args: { base: Node; blend: Node }) => ShaderNodeObject<JoinNode>;
6
7
 
7
- export const DodgeNode: ShaderNode<{ base: Node; blendNode: Node }>;
8
+ export const DodgeNode: (args: { base: Node; blend: Node }) => ShaderNodeObject<JoinNode>;
8
9
 
9
- export const ScreenNode: ShaderNode<{ base: Node; blendNode: Node }>;
10
+ export const ScreenNode: (args: { base: Node; blend: Node }) => ShaderNodeObject<JoinNode>;
10
11
 
11
- export const OverlayNode: ShaderNode<{ base: Node; blendNode: Node }>;
12
+ export const OverlayNode: (args: { base: Node; blend: Node }) => ShaderNodeObject<JoinNode>;
12
13
 
13
14
  export type BlendMode =
14
15
  | typeof BlendModeNode.BURN
@@ -30,3 +31,17 @@ export default class BlendModeNode extends TempNode {
30
31
 
31
32
  setup(): Node;
32
33
  }
34
+
35
+ export const burn: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => ShaderNodeObject<BlendModeNode>;
36
+ export const dodge: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => ShaderNodeObject<BlendModeNode>;
37
+ export const overlay: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => ShaderNodeObject<BlendModeNode>;
38
+ export const screen: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => ShaderNodeObject<BlendModeNode>;
39
+
40
+ declare module '../shadernode/ShaderNode.js' {
41
+ interface NodeElements {
42
+ burn: typeof burn;
43
+ dodge: typeof dodge;
44
+ overlay: typeof overlay;
45
+ screen: typeof screen;
46
+ }
47
+ }
@@ -1,5 +1,6 @@
1
1
  import TempNode from '../core/TempNode.js';
2
- import { Node } from '../Nodes.js';
2
+ import MathNode from '../math/MathNode.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export type ColorAdjustmentMethod =
5
6
  | typeof ColorAdjustmentNode.SATURATION
@@ -18,3 +19,30 @@ export default class ColorAdjustmentNode extends TempNode {
18
19
 
19
20
  constructor(method: ColorAdjustmentMethod, colorNode: Node, adjustmentNode?: Node);
20
21
  }
22
+
23
+ export const saturation: (
24
+ colorNode: NodeRepresentation,
25
+ adjustmentNode?: NodeRepresentation,
26
+ ) => ShaderNodeObject<ColorAdjustmentNode>;
27
+ export const vibrance: (
28
+ colorNode: NodeRepresentation,
29
+ adjustmentNode?: NodeRepresentation,
30
+ ) => ShaderNodeObject<ColorAdjustmentNode>;
31
+ export const hue: (
32
+ colorNode: NodeRepresentation,
33
+ adjustmentNode?: NodeRepresentation,
34
+ ) => ShaderNodeObject<ColorAdjustmentNode>;
35
+
36
+ export const lumaCoeffs: ShaderNodeObject<MathNode>;
37
+ export const luminance: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
38
+
39
+ export const threshold: (color: NodeRepresentation, thershold: NodeRepresentation) => ShaderNodeObject<MathNode>;
40
+
41
+ declare module '../shadernode/ShaderNode.js' {
42
+ interface NodeElements {
43
+ saturation: typeof saturation;
44
+ vibrance: typeof vibrance;
45
+ hue: typeof hue;
46
+ threshold: typeof threshold;
47
+ }
48
+ }
@@ -1,5 +1,7 @@
1
+ import { ColorSpace } from '../../../../src/Three.js';
1
2
  import TempNode from '../core/TempNode.js';
2
3
  import Node from '../core/Node.js';
4
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
5
 
4
6
  export type ColorSpaceNodeMethod =
5
7
  | typeof ColorSpaceNode.LINEAR_TO_LINEAR
@@ -16,3 +18,18 @@ export default class ColorSpaceNode extends TempNode {
16
18
 
17
19
  constructor(method: ColorSpaceNodeMethod | null, node: Node);
18
20
  }
21
+
22
+ export const linearToColorSpace: (node: NodeRepresentation, colorSpace: ColorSpace) => ShaderNodeObject<ColorSpaceNode>;
23
+ export const colorSpaceToLinear: (node: NodeRepresentation, colorSpace: ColorSpace) => ShaderNodeObject<ColorSpaceNode>;
24
+
25
+ export const linearTosRGB: (node: NodeRepresentation) => ShaderNodeObject<ColorSpaceNode>;
26
+ export const sRGBToLinear: (node: NodeRepresentation) => ShaderNodeObject<ColorSpaceNode>;
27
+
28
+ declare module '../shadernode/ShaderNode.js' {
29
+ interface NodeElements {
30
+ linearTosRGB: typeof linearTosRGB;
31
+ sRGBToLinear: typeof sRGBToLinear;
32
+ linearToColorSpace: typeof linearToColorSpace;
33
+ colorSpaceToLinear: typeof colorSpaceToLinear;
34
+ }
35
+ }
@@ -1,6 +1,10 @@
1
1
  import Node from '../core/Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class FrontFacingNode extends Node {
4
5
  isFrontFacingNode: true;
5
6
  constructor();
6
7
  }
8
+
9
+ export const frontFacing: ShaderNodeObject<FrontFacingNode>;
10
+ export const faceDirection: ShaderNodeObject<Node>;
@@ -0,0 +1,28 @@
1
+ import { Vector2 } from '../../../../src/Three.js';
2
+ import TempNode from '../core/TempNode.js';
3
+ import TextureNode from '../accessors/TextureNode.js';
4
+ import Node from '../core/Node.js';
5
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
6
+
7
+ export default class GaussianBlurNode extends TempNode {
8
+ textureNode: TextureNode;
9
+ sigma: number;
10
+
11
+ directionNode: Node;
12
+
13
+ resolution: Vector2;
14
+
15
+ constructor(textureNode: TextureNode, sigma?: number);
16
+
17
+ setSize(width: number, height: number): void;
18
+
19
+ getTextureNode(): TextureNode;
20
+ }
21
+
22
+ export const gaussianBlur: (node: NodeRepresentation, sigma?: number) => ShaderNodeObject<GaussianBlurNode>;
23
+
24
+ declare module '../shadernode/ShaderNode.js' {
25
+ interface NodeElements {
26
+ gaussianBlur: typeof gaussianBlur;
27
+ }
28
+ }
@@ -1,6 +1,8 @@
1
- import TempNode from '../core/TempNode.js';
2
1
  import { NormalMapTypes } from '../../../../src/Three.js';
2
+ import TempNode from '../core/TempNode.js';
3
3
  import Node from '../core/Node.js';
4
+ import MathNode from '../math/MathNode.js';
5
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
6
 
5
7
  export default class NormalMapNode extends TempNode {
6
8
  node: Node;
@@ -10,3 +12,13 @@ export default class NormalMapNode extends TempNode {
10
12
 
11
13
  constructor(node: Node, scaleNode?: Node | null);
12
14
  }
15
+
16
+ export const normalMap: (node: Node, scaleNode?: Node) => ShaderNodeObject<NormalMapNode>;
17
+
18
+ export const TBNViewMatrix: ShaderNodeObject<MathNode>;
19
+
20
+ declare module '../shadernode/ShaderNode.js' {
21
+ interface NodeElements {
22
+ normalMap: typeof normalMap;
23
+ }
24
+ }
@@ -0,0 +1,44 @@
1
+ import { Camera, RenderTarget, Scene, Texture } from '../../../../src/Three.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
+ import TempNode from '../core/TempNode.js';
4
+ import TextureNode from '../accessors/TextureNode.js';
5
+ import Node from '../core/Node.js';
6
+
7
+ declare class PassTextureNode extends TextureNode {
8
+ passNode: PassNode;
9
+
10
+ constructor(passNode: PassNode, texture: Texture);
11
+ }
12
+
13
+ export default class PassNode extends TempNode {
14
+ scope: PassNodeScope;
15
+ scene: Scene;
16
+ camera: Camera;
17
+
18
+ renderTarget: RenderTarget;
19
+
20
+ readonly isPassNode: true;
21
+
22
+ constructor(scope: PassNodeScope, scene: Scene, camera: Camera);
23
+
24
+ getTextureNode(): ShaderNodeObject<PassTextureNode>;
25
+
26
+ getTextureDepthNode(): ShaderNodeObject<PassTextureNode>;
27
+
28
+ getDepthNode(): ShaderNodeObject<Node>;
29
+
30
+ setSize(width: number, height: number): void;
31
+
32
+ setPixelRatio(pixelRatio: number): void;
33
+
34
+ dispose(): void;
35
+
36
+ static COLOR: 'color';
37
+ static DEPTH: 'depth';
38
+ }
39
+
40
+ export type PassNodeScope = typeof PassNode.COLOR | typeof PassNode.DEPTH;
41
+
42
+ export const pass: (scene: Scene, camera: Camera) => ShaderNodeObject<PassNode>;
43
+ export const texturePass: (pass: PassNode, texture: Texture) => ShaderNodeObject<PassTextureNode>;
44
+ export const depthPass: (scene: Scene, camera: Camera) => ShaderNodeObject<PassNode>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class PosterizeNode extends Node {
4
5
  sourceNode: Node;
@@ -6,3 +7,14 @@ export default class PosterizeNode extends Node {
6
7
 
7
8
  constructor(sourceNode: Node, stepsNode: Node);
8
9
  }
10
+
11
+ export const posterize: (
12
+ sourceNode: NodeRepresentation,
13
+ stepsNode: NodeRepresentation,
14
+ ) => ShaderNodeObject<PosterizeNode>;
15
+
16
+ declare module '../shadernode/ShaderNode.js' {
17
+ interface NodeElements {
18
+ posterize: typeof posterize;
19
+ }
20
+ }
@@ -1,6 +1,7 @@
1
+ import { ToneMapping } from '../../../../src/Three.js';
1
2
  import TempNode from '../core/TempNode.js';
2
3
  import Node from '../core/Node.js';
3
- import { ToneMapping } from '../../../../src/Three.js';
4
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
5
 
5
6
  // exposure only
6
7
  export const LinearToneMappingNode: Node;
@@ -12,3 +13,9 @@ export default class ToneMappingNode extends TempNode {
12
13
 
13
14
  constructor(toneMapping: ToneMapping, exposureNode?: Node, colorNode?: Node | null);
14
15
  }
16
+
17
+ export const toneMapping: (
18
+ mapping: ToneMapping,
19
+ exposure: NodeRepresentation,
20
+ color?: NodeRepresentation,
21
+ ) => ShaderNodeObject<ToneMappingNode>;
@@ -0,0 +1,32 @@
1
+ import Node from '../core/Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
+
4
+ export default class ViewportDepthNode extends Node {
5
+ scope: ViewportDepthNodeScope;
6
+ valueNode: Node;
7
+
8
+ readonly isViewportDepthNode: true;
9
+
10
+ constructor(scope: ViewportDepthNodeScope, valueNode?: Node | null);
11
+
12
+ static DEPTH: 'depth';
13
+ static DEPTH_TEXTURE: 'depthTexture';
14
+ static DEPTH_PIXEL: 'depthPixel';
15
+ }
16
+
17
+ export type ViewportDepthNodeScope =
18
+ | typeof ViewportDepthNode.DEPTH
19
+ | typeof ViewportDepthNode.DEPTH_TEXTURE
20
+ | typeof ViewportDepthNode.DEPTH_PIXEL;
21
+
22
+ export const viewZToOrthographicDepth: (viewZ: Node, near: Node, far: Node) => Node;
23
+
24
+ export const orthographicDepthToViewZ: (depth: Node, near: Node, far: Node) => Node;
25
+
26
+ export const viewZToPerspectiveDepth: (viewZ: Node, near: Node, far: Node) => Node;
27
+
28
+ export const perspectiveDepthToViewZ: (depth: Node, near: Node, far: Node) => Node;
29
+
30
+ export const depth: ShaderNodeObject<ViewportDepthNode>;
31
+ export const depthTexture: (valueNode?: Node | null) => ShaderNodeObject<ViewportDepthNode>;
32
+ export const depthPixel: ShaderNodeObject<ViewportDepthNode>;
@@ -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 ViewportNodeScope =
4
5
  | typeof ViewportNode.COORDINATE
@@ -21,3 +22,10 @@ export default class ViewportNode extends Node {
21
22
 
22
23
  constructor(scope: ViewportNodeScope);
23
24
  }
25
+
26
+ export const viewportCoordinate: ShaderNodeObject<ViewportNode>;
27
+ export const viewportResolution: ShaderNodeObject<ViewportNode>;
28
+ export const viewportTopLeft: ShaderNodeObject<ViewportNode>;
29
+ export const viewportBottomLeft: ShaderNodeObject<ViewportNode>;
30
+ export const viewportTopRight: ShaderNodeObject<ViewportNode>;
31
+ export const viewportBottomRight: ShaderNodeObject<ViewportNode>;
@@ -0,0 +1,18 @@
1
+ import Node from '../core/Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
+ import ViewportTextureNode from './ViewportTextureNode.js';
4
+
5
+ export default class ViewportSharedTextureNode extends ViewportTextureNode {
6
+ constructor(uvNode?: Node, levelNode?: Node | null);
7
+ }
8
+
9
+ export const viewportSharedTexture: (
10
+ uvNode?: Node,
11
+ levelNode?: Node | null,
12
+ ) => ShaderNodeObject<ViewportSharedTextureNode>;
13
+
14
+ declare module '../shadernode/ShaderNode.js' {
15
+ interface NodeElements {
16
+ viewportSharedTexture: typeof viewportSharedTexture;
17
+ }
18
+ }