@types/three 0.160.0 → 0.161.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +5 -1
  3. three/examples/jsm/capabilities/WebGPU.d.ts +2 -0
  4. three/examples/jsm/curves/NURBSUtils.d.ts +136 -10
  5. three/examples/jsm/curves/NURBSVolume.d.ts +23 -0
  6. three/examples/jsm/exporters/USDZExporter.d.ts +1 -0
  7. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -0
  8. three/examples/jsm/loaders/KTX2Loader.d.ts +44 -4
  9. three/examples/jsm/loaders/LUT3dlLoader.d.ts +29 -2
  10. three/examples/jsm/loaders/LUTCubeLoader.d.ts +37 -2
  11. three/examples/jsm/materials/MeshPostProcessingMaterial.d.ts +13 -0
  12. three/examples/jsm/nodes/Nodes.d.ts +75 -10
  13. three/examples/jsm/nodes/accessors/CameraNode.d.ts +17 -6
  14. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +8 -2
  15. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +1 -1
  16. three/examples/jsm/nodes/accessors/ModelNode.d.ts +2 -0
  17. three/examples/jsm/nodes/accessors/Object3DNode.d.ts +10 -6
  18. three/examples/jsm/nodes/accessors/TextureBicubicNode.d.ts +18 -0
  19. three/examples/jsm/nodes/accessors/TextureNode.d.ts +11 -3
  20. three/examples/jsm/nodes/accessors/VertexColorNode.d.ts +12 -0
  21. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +6 -0
  22. three/examples/jsm/nodes/core/AssignNode.d.ts +17 -0
  23. three/examples/jsm/nodes/core/BypassNode.d.ts +6 -0
  24. three/examples/jsm/nodes/core/CacheNode.d.ts +8 -0
  25. three/examples/jsm/nodes/core/ContextNode.d.ts +8 -0
  26. three/examples/jsm/nodes/core/IndexNode.d.ts +18 -0
  27. three/examples/jsm/nodes/core/LightingModel.d.ts +36 -0
  28. three/examples/jsm/nodes/core/Node.d.ts +32 -8
  29. three/examples/jsm/nodes/core/NodeBuilder.d.ts +22 -21
  30. three/examples/jsm/nodes/core/NodeFrame.d.ts +18 -6
  31. three/examples/jsm/nodes/core/PropertyNode.d.ts +19 -2
  32. three/examples/jsm/nodes/core/VarNode.d.ts +8 -2
  33. three/examples/jsm/nodes/core/VaryingNode.d.ts +6 -0
  34. three/examples/jsm/nodes/core/constants.d.ts +23 -24
  35. three/examples/jsm/nodes/display/AfterImageNode.d.ts +25 -0
  36. three/examples/jsm/nodes/display/AnamorphicNode.d.ts +32 -0
  37. three/examples/jsm/nodes/display/BlendModeNode.d.ts +14 -4
  38. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +11 -0
  39. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +15 -2
  40. three/examples/jsm/nodes/display/GaussianBlurNode.d.ts +28 -0
  41. three/examples/jsm/nodes/display/NormalMapNode.d.ts +6 -0
  42. three/examples/jsm/nodes/display/PassNode.d.ts +44 -0
  43. three/examples/jsm/nodes/display/PosterizeNode.d.ts +6 -0
  44. three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +32 -0
  45. three/examples/jsm/nodes/display/ViewportSharedTextureNode.d.ts +18 -0
  46. three/examples/jsm/nodes/display/ViewportTextureNode.d.ts +33 -0
  47. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +6 -0
  48. three/examples/jsm/nodes/fog/FogNode.d.ts +6 -0
  49. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +6 -0
  50. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +9 -2
  51. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +3 -2
  52. three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.d.ts +7 -0
  53. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +3 -2
  54. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +3 -2
  55. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +3 -2
  56. three/examples/jsm/nodes/functions/PhongLightingModel.d.ts +7 -0
  57. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +17 -8
  58. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +6 -0
  59. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +20 -13
  60. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +1 -2
  61. three/examples/jsm/nodes/materials/Materials.d.ts +9 -17
  62. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +2 -4
  63. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +12 -0
  64. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +3 -7
  65. three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +17 -0
  66. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +1 -2
  67. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +30 -14
  68. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +2 -8
  69. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +0 -10
  70. three/examples/jsm/nodes/math/CondNode.d.ts +6 -0
  71. three/examples/jsm/nodes/math/HashNode.d.ts +16 -0
  72. three/examples/jsm/nodes/math/MathNode.d.ts +15 -9
  73. three/examples/jsm/nodes/math/MathUtils.d.ts +16 -0
  74. three/examples/jsm/nodes/math/OperatorNode.d.ts +5 -4
  75. three/examples/jsm/nodes/math/TriNoise3D.d.ts +12 -0
  76. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +6 -0
  77. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +55 -4
  78. three/examples/jsm/nodes/utils/DiscardNode.d.ts +16 -0
  79. three/examples/jsm/nodes/utils/ReflectorNode.d.ts +30 -0
  80. three/examples/jsm/nodes/utils/RemapNode.d.ts +23 -4
  81. three/examples/jsm/nodes/utils/RotateNode.d.ts +21 -0
  82. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +6 -0
  83. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +6 -0
  84. three/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
  85. three/examples/jsm/objects/QuadMesh.d.ts +3 -1
  86. three/examples/jsm/postprocessing/GTAOPass.d.ts +3 -0
  87. three/examples/jsm/postprocessing/SSAOPass.d.ts +1 -1
  88. three/examples/jsm/renderers/common/Backend.d.ts +6 -2
  89. three/examples/jsm/renderers/common/Color4.d.ts +9 -0
  90. three/examples/jsm/renderers/common/Info.d.ts +7 -1
  91. three/examples/jsm/renderers/common/PostProcessing.d.ts +11 -0
  92. three/examples/jsm/renderers/common/Renderer.d.ts +243 -4
  93. three/examples/jsm/renderers/common/StorageTexture.d.ts +5 -0
  94. three/examples/jsm/renderers/webgl/WebGLBackend.d.ts +4 -2
  95. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +2 -2
  96. three/examples/jsm/renderers/webgpu/WebGPUBackend.d.ts +15 -6
  97. three/examples/jsm/renderers/webgpu/WebGPURenderer.d.ts +7 -7
  98. three/examples/jsm/utils/BufferGeometryUtils.d.ts +0 -10
  99. three/examples/jsm/webxr/XRControllerModelFactory.d.ts +6 -5
  100. three/examples/jsm/webxr/XRHandMeshModel.d.ts +10 -2
  101. three/package.json +2 -2
  102. three/src/cameras/PerspectiveCamera.d.ts +13 -0
  103. three/src/constants.d.ts +1 -2
  104. three/src/core/InterleavedBufferAttribute.d.ts +12 -2
  105. three/src/core/Object3D.d.ts +13 -13
  106. three/src/extras/core/Curve.d.ts +9 -9
  107. three/src/extras/core/CurvePath.d.ts +8 -7
  108. three/src/geometries/RingGeometry.d.ts +1 -1
  109. three/src/materials/Material.d.ts +3 -1
  110. three/src/materials/ShaderMaterial.d.ts +9 -1
  111. three/src/math/Color.d.ts +1 -1
  112. three/src/math/Quaternion.d.ts +27 -30
  113. three/src/math/Triangle.d.ts +0 -17
  114. three/src/math/Vector2.d.ts +24 -159
  115. three/src/math/Vector3.d.ts +46 -54
  116. three/src/math/Vector4.d.ts +25 -20
  117. three/src/objects/BatchedMesh.d.ts +2 -2
  118. three/src/objects/Bone.d.ts +2 -2
  119. three/src/objects/InstancedMesh.d.ts +2 -1
  120. three/src/objects/LOD.d.ts +2 -2
  121. three/src/objects/Line.d.ts +3 -2
  122. three/src/objects/LineLoop.d.ts +3 -1
  123. three/src/objects/LineSegments.d.ts +3 -1
  124. three/src/objects/Points.d.ts +3 -2
  125. three/src/objects/SkinnedMesh.d.ts +3 -6
  126. three/src/objects/Sprite.d.ts +2 -2
  127. three/src/renderers/webgl/WebGLProgram.d.ts +0 -1
  128. three/src/renderers/webgl/WebGLPrograms.d.ts +3 -1
  129. three/src/renderers/webxr/WebXRDepthSensing.d.ts +27 -0
  130. three/src/renderers/webxr/WebXRManager.d.ts +2 -1
  131. three/src/textures/DataArrayTexture.d.ts +1 -1
  132. three/src/textures/Source.d.ts +11 -1
  133. three/build/three.d.ts +0 -2
  134. three/build/three.min.d.ts +0 -2
  135. three/examples/jsm/objects/GroundProjectedSkybox.d.ts +0 -13
@@ -2,6 +2,7 @@ import {
2
2
  LineBasicMaterial,
3
3
  Material,
4
4
  MeshBasicMaterial,
5
+ MeshPhongMaterial,
5
6
  MeshPhysicalMaterial,
6
7
  MeshStandardMaterial,
7
8
  PointsMaterial,
@@ -10,23 +11,24 @@ import {
10
11
  } from '../../../../src/Three.js';
11
12
  import NodeBuilder from '../core/NodeBuilder.js';
12
13
  import Node from '../core/Node.js';
13
- import { LightingModelNode } from '../lighting/LightingContextNode.js';
14
14
  import LineBasicNodeMaterial from './LineBasicNodeMaterial.js';
15
15
  import MeshBasicNodeMaterial from './MeshBasicNodeMaterial.js';
16
16
  import MeshPhysicalNodeMaterial from './MeshPhysicalNodeMaterial.js';
17
17
  import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
18
18
  import PointsNodeMaterial from './PointsNodeMaterial.js';
19
19
  import SpriteNodeMaterial from './SpriteNodeMaterial.js';
20
+ import LightsNode from '../lighting/LightsNode.js';
21
+ import LightingModel from '../core/LightingModel.js';
22
+ import MeshPhongNodeMaterial from './MeshPhongNodeMaterial.js';
20
23
 
21
24
  export default class NodeMaterial extends ShaderMaterial {
22
- isNodeMaterial: true;
25
+ readonly isNodeMaterial: true;
23
26
 
24
- type: string;
27
+ normals: boolean;
25
28
 
26
- lights: true;
27
- normals: true;
29
+ colorSpaced: boolean;
28
30
 
29
- lightsNode: Node | null;
31
+ lightsNode: LightsNode | null;
30
32
  envNode: Node | null;
31
33
 
32
34
  colorNode: Node | null;
@@ -38,20 +40,34 @@ export default class NodeMaterial extends ShaderMaterial {
38
40
 
39
41
  positionNode: Node | null;
40
42
 
43
+ depthNode: Node | null;
44
+ shadowNode: Node | null;
45
+
46
+ outputNode: Node | null;
47
+
48
+ fragmentNode: Node | null;
49
+ vertexNode: Node | null;
50
+
41
51
  constructor();
42
52
 
43
53
  build(builder: NodeBuilder): void;
44
- customProgramCacheKey(): string;
45
- generatePosition(builder: NodeBuilder): void;
46
- generateDiffuseColor(builder: NodeBuilder): void;
47
- generateLight(
48
- builder: NodeBuilder,
49
- lights: { diffuseColorNode: Node; lightingModelNode: LightingModelNode; lightsNode?: Node },
50
- ): void;
51
- generateOutput(builder: NodeBuilder, lights: { diffuseColorNode: Node; outgoingLightNode: Node }): void;
54
+ setup(builder: NodeBuilder): void;
55
+ setupDepth(builder: NodeBuilder): void;
56
+ setupPosition(builder: NodeBuilder): Node;
57
+ setupDiffuseColor(builder: NodeBuilder): void;
58
+ setupVariants(builder: NodeBuilder): void;
59
+ setupNormal(builder: NodeBuilder): void;
60
+ getEnvNode(builder: NodeBuilder): Node | null;
61
+ setupLights(builder: NodeBuilder): LightsNode;
62
+ setupLightingModel(builder: NodeBuilder): LightingModel;
63
+ setupLighting(builder: NodeBuilder): Node;
64
+ setupOutput(builder: NodeBuilder, outputNode: Node): Node;
65
+
66
+ setDefaultValues(material: Material): void;
52
67
 
53
68
  static fromMaterial(material: LineBasicMaterial): LineBasicNodeMaterial;
54
69
  static fromMaterial(material: MeshBasicMaterial): MeshBasicNodeMaterial;
70
+ static fromMaterial(material: MeshPhongMaterial): MeshPhongNodeMaterial;
55
71
  static fromMaterial(material: MeshPhysicalMaterial): MeshPhysicalNodeMaterial;
56
72
  static fromMaterial(material: MeshStandardMaterial): MeshStandardNodeMaterial;
57
73
  static fromMaterial(material: PointsMaterial): PointsNodeMaterial;
@@ -3,13 +3,7 @@ import { ShaderMaterialParameters } from '../../../../src/Three.js';
3
3
  import { Node } from '../Nodes.js';
4
4
 
5
5
  export default class PointsNodeMaterial extends NodeMaterial {
6
- isPointsNodeMateria: true;
7
- colorNode: Node | null;
8
- opacityNode: Node | null;
9
- alphaTestNode: Node | null;
10
- lightNode: Node | null;
11
- sizeNode: Node | null;
12
- positionNode: Node | null;
6
+ readonly isPointsNodeMaterial: true;
7
+
13
8
  constructor(parameters?: ShaderMaterialParameters);
14
- copy(source: PointsNodeMaterial): this;
15
9
  }
@@ -6,18 +6,8 @@ import Node from '../core/Node.js';
6
6
  export default class SpriteNodeMaterial extends NodeMaterial {
7
7
  isSpriteNodeMaterial: true;
8
8
 
9
- colorNode: Node | null;
10
- opacityNode: Node | null;
11
-
12
- alphaTestNode: Node | null;
13
-
14
- lightNode: Node | null;
15
-
16
- positionNode: Node | null;
17
9
  rotationNode: Node | null;
18
10
  scaleNode: Node | null;
19
11
 
20
12
  constructor(parameters?: ShaderMaterialParameters);
21
- generatePosition(builder: NodeBuilder): void;
22
- copy(source: SpriteNodeMaterial): this;
23
13
  }
@@ -14,3 +14,9 @@ export function cond(
14
14
  ifNode: NodeRepresentation,
15
15
  elseNode: NodeRepresentation,
16
16
  ): ShaderNodeObject<Node>;
17
+
18
+ declare module '../shadernode/ShaderNode.js' {
19
+ interface NodeElements {
20
+ cond: typeof cond;
21
+ }
22
+ }
@@ -0,0 +1,16 @@
1
+ import Node from '../core/Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
+
4
+ export default class HashNode extends Node {
5
+ seedNode: Node;
6
+
7
+ constructor(seedNode: Node);
8
+ }
9
+
10
+ export const hash: (seedNode: NodeRepresentation) => ShaderNodeObject<HashNode>;
11
+
12
+ declare module '../shadernode/ShaderNode.js' {
13
+ interface NodeElements {
14
+ hash: typeof hash;
15
+ }
16
+ }
@@ -124,8 +124,10 @@ export default class MathNode extends TempNode {
124
124
 
125
125
  export const EPSILON: ShaderNodeObject<Node>;
126
126
  export const INFINITY: ShaderNodeObject<Node>;
127
+ export const PI: ShaderNodeObject<Node>;
128
+ export const PI2: ShaderNodeObject<Node>;
127
129
 
128
- export type Unary = (a: NodeRepresentation) => ShaderNodeObject<MathNode>;
130
+ type Unary = (a: NodeRepresentation) => ShaderNodeObject<MathNode>;
129
131
 
130
132
  export const radians: Unary;
131
133
  export const degrees: Unary;
@@ -158,7 +160,7 @@ export const trunc: Unary;
158
160
  export const fwidth: Unary;
159
161
  export const bitcast: Unary;
160
162
 
161
- export type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
163
+ type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
162
164
 
163
165
  export const atan2: Binary;
164
166
  export const min: Binary;
@@ -176,15 +178,17 @@ export const pow3: Binary;
176
178
  export const pow4: Binary;
177
179
  export const transformDirection: Binary;
178
180
 
179
- export type Ternary = (
180
- a: NodeRepresentation,
181
- b: NodeRepresentation,
182
- c: NodeRepresentation,
183
- ) => ShaderNodeObject<MathNode>;
181
+ type Ternary = (a: NodeRepresentation, b: NodeRepresentation, c: NodeRepresentation) => ShaderNodeObject<MathNode>;
184
182
 
183
+ export const cbrt: Unary;
184
+ export const lengthSq: Unary;
185
185
  export const mix: Ternary;
186
- export const clamp: Ternary;
187
- export const saturate: Ternary;
186
+ export const clamp: (
187
+ a: NodeRepresentation,
188
+ b?: NodeRepresentation,
189
+ c?: NodeRepresentation,
190
+ ) => ShaderNodeObject<MathNode>;
191
+ export const saturate: Unary;
188
192
  export const refract: Ternary;
189
193
  export const smoothstep: Ternary;
190
194
  export const faceForward: Ternary;
@@ -215,6 +219,7 @@ declare module '../shadernode/ShaderNode.js' {
215
219
  abs: typeof abs;
216
220
  sign: typeof sign;
217
221
  length: typeof length;
222
+ lengthSq: typeof lengthSq;
218
223
  negate: typeof negate;
219
224
  oneMinus: typeof oneMinus;
220
225
  dFdx: typeof dFdx;
@@ -244,5 +249,6 @@ declare module '../shadernode/ShaderNode.js' {
244
249
  faceForward: typeof faceForward;
245
250
  difference: typeof difference;
246
251
  saturate: typeof saturate;
252
+ cbrt: typeof cbrt;
247
253
  }
248
254
  }
@@ -0,0 +1,16 @@
1
+ import { Binary, Ternary } from './MathNode.js';
2
+
3
+ // remapping functions
4
+ export const parabola: Binary;
5
+ export const gain: Binary;
6
+ export const pcurve: Ternary;
7
+ export const sinc: Binary;
8
+
9
+ declare module '../shadernode/ShaderNode.js' {
10
+ interface NodeElements {
11
+ parabola: typeof parabola;
12
+ gain: typeof gain;
13
+ pcurve: typeof pcurve;
14
+ sinc: typeof sinc;
15
+ }
16
+ }
@@ -3,7 +3,6 @@ import Node from '../core/Node.js';
3
3
  import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
4
 
5
5
  export type OperatorNodeOp =
6
- | '='
7
6
  | '%'
8
7
  | '&'
9
8
  | '|'
@@ -31,7 +30,7 @@ export default class OperatorNode extends TempNode {
31
30
  constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]);
32
31
  }
33
32
 
34
- export type Operator = (
33
+ type Operator = (
35
34
  a: NodeRepresentation,
36
35
  b: NodeRepresentation,
37
36
  ...others: NodeRepresentation[]
@@ -43,15 +42,16 @@ export const mul: Operator;
43
42
  export const div: Operator;
44
43
  export const remainder: Operator;
45
44
  export const equal: Operator;
46
- export const assign: Operator;
47
45
  export const lessThan: Operator;
48
46
  export const greaterThan: Operator;
49
47
  export const lessThanEqual: Operator;
50
48
  export const greaterThanEqual: Operator;
51
49
  export const and: Operator;
52
50
  export const or: Operator;
51
+ export const not: (a: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
53
52
  export const xor: Operator;
54
53
  export const bitAnd: Operator;
54
+ export const bitNot: (a: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
55
55
  export const bitOr: Operator;
56
56
  export const bitXor: Operator;
57
57
  export const shiftLeft: Operator;
@@ -65,15 +65,16 @@ declare module '../shadernode/ShaderNode.js' {
65
65
  div: typeof div;
66
66
  remainder: typeof remainder;
67
67
  equal: typeof equal;
68
- assign: typeof assign;
69
68
  lessThan: typeof lessThan;
70
69
  greaterThan: typeof greaterThan;
71
70
  lessThanEqual: typeof lessThanEqual;
72
71
  greaterThanEqual: typeof greaterThanEqual;
73
72
  and: typeof and;
74
73
  or: typeof or;
74
+ not: typeof not;
75
75
  xor: typeof xor;
76
76
  bitAnd: typeof bitAnd;
77
+ bitNot: typeof bitNot;
77
78
  bitOr: typeof bitOr;
78
79
  bitXor: typeof bitXor;
79
80
  shiftLeft: typeof shiftLeft;
@@ -0,0 +1,12 @@
1
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
+ import Node from '../core/Node.js';
3
+
4
+ export const tri: (x: NodeRepresentation) => ShaderNodeObject<Node>;
5
+
6
+ export const tri3: (p: NodeRepresentation) => ShaderNodeObject<Node>;
7
+
8
+ export const triNoise3D: (
9
+ p_immutable: NodeRepresentation,
10
+ spd: NodeRepresentation,
11
+ time: NodeRepresentation,
12
+ ) => ShaderNodeObject<Node>;
@@ -7,3 +7,9 @@ export default class CheckerNode extends TempNode {
7
7
  }
8
8
 
9
9
  export const checker: (uvNode?: NodeRepresentation) => ShaderNodeObject<CheckerNode>;
10
+
11
+ declare module '../shadernode/ShaderNode.js' {
12
+ interface NodeElements {
13
+ checker: typeof checker;
14
+ }
15
+ }
@@ -1,15 +1,51 @@
1
1
  import Node from '../core/Node.js';
2
- import { NodeTypeOption, SwizzleOption } from '../core/constants.js';
2
+ import { AnyObject, NodeTypeOption, SwizzleOption } from '../core/constants.js';
3
3
  import ConstNode from '../core/ConstNode.js';
4
4
  import NodeBuilder from '../core/NodeBuilder.js';
5
- import SplitNode from '../utils/SplitNode.js';
6
5
 
7
- export interface NodeElements {}
6
+ export interface NodeElements {
7
+ append: typeof append;
8
+
9
+ color: typeof color;
10
+ float: typeof float;
11
+ int: typeof int;
12
+ uint: typeof uint;
13
+ bool: typeof bool;
14
+ vec2: typeof vec2;
15
+ ivec2: typeof ivec2;
16
+ uvec2: typeof uvec2;
17
+ bvec2: typeof bvec2;
18
+ vec3: typeof vec3;
19
+ ivec3: typeof ivec3;
20
+ uvec3: typeof uvec3;
21
+ bvec3: typeof bvec3;
22
+ vec4: typeof vec4;
23
+ ivec4: typeof ivec4;
24
+ uvec4: typeof uvec4;
25
+ bvec4: typeof bvec4;
26
+ mat2: typeof mat2;
27
+ imat2: typeof imat2;
28
+ umat2: typeof umat2;
29
+ bmat2: typeof bmat2;
30
+ mat3: typeof mat3;
31
+ imat3: typeof imat3;
32
+ umat3: typeof umat3;
33
+ bmat3: typeof bmat3;
34
+ mat4: typeof mat4;
35
+ imat4: typeof imat4;
36
+ umat4: typeof umat4;
37
+ bmat4: typeof bmat4;
38
+ string: typeof string;
39
+ arrayBuffer: typeof arrayBuffer;
40
+
41
+ element: typeof element;
42
+ convert: typeof convert;
43
+ }
8
44
 
9
45
  export function addNodeElement(name: string, nodeElement: unknown): void;
10
46
 
11
47
  export type Swizzable<T extends Node = Node> = T & {
12
- [key in SwizzleOption | number]: ShaderNodeObject<SplitNode>;
48
+ [key in SwizzleOption | number]: ShaderNodeObject<Node>;
13
49
  };
14
50
 
15
51
  export type ShaderNodeObject<T extends Node> = T & {
@@ -162,6 +198,13 @@ export function nodeImmutable<T>(
162
198
  ...params: ProxiedTuple<GetConstructors<T>>
163
199
  ): ShaderNodeObject<ConstructedNode<T>>;
164
200
 
201
+ export function tslFn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
202
+ export function tslFn<T extends AnyObject, R extends Node = ShaderNodeObject<Node>>(
203
+ jsFunc: (args: T) => R,
204
+ ): (args: T) => R;
205
+
206
+ export function append(node: Node): Node;
207
+
165
208
  export const color: ConvertType;
166
209
 
167
210
  export const float: ConvertType;
@@ -184,6 +227,11 @@ export const ivec4: ConvertType;
184
227
  export const uvec4: ConvertType;
185
228
  export const bvec4: ConvertType;
186
229
 
230
+ export const mat2: ConvertType;
231
+ export const imat2: ConvertType;
232
+ export const umat2: ConvertType;
233
+ export const bmat2: ConvertType;
234
+
187
235
  export const mat3: ConvertType;
188
236
  export const imat3: ConvertType;
189
237
  export const umat3: ConvertType;
@@ -194,5 +242,8 @@ export const imat4: ConvertType;
194
242
  export const umat4: ConvertType;
195
243
  export const bmat4: ConvertType;
196
244
 
245
+ export const string: (value?: string) => ShaderNodeObject<ConstNode<string>>;
246
+ export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<ArrayBuffer>>;
247
+
197
248
  export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
198
249
  export const convert: (node: NodeRepresentation, types: NodeTypeOption) => ShaderNodeObject<Node>;
@@ -0,0 +1,16 @@
1
+ import CondNode from '../math/CondNode.js';
2
+ import Node from '../core/Node.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
+
5
+ export default class DiscardNode extends CondNode {
6
+ constructor(condNode: Node);
7
+ }
8
+
9
+ export const inlineDiscard: (condNode: NodeRepresentation) => ShaderNodeObject<DiscardNode>;
10
+ export const discard: (condNode: NodeRepresentation) => ShaderNodeObject<Node>;
11
+
12
+ declare module '../shadernode/ShaderNode.js' {
13
+ interface NodeElements {
14
+ discard: typeof discard;
15
+ }
16
+ }
@@ -0,0 +1,30 @@
1
+ import { Camera, Object3D, RenderTarget } from '../../../../src/Three.js';
2
+ import TextureNode from '../accessors/TextureNode.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
+
5
+ export interface ReflectorNodeParameters {
6
+ target?: Object3D | undefined;
7
+ resolution?: number | undefined;
8
+ generateMipmaps?: boolean | undefined;
9
+ bounces?: boolean | undefined;
10
+ }
11
+
12
+ export default class ReflectorNode extends TextureNode {
13
+ target: Object3D;
14
+ resolution: number;
15
+ generateMipmaps: boolean;
16
+ bounces: boolean;
17
+
18
+ virtualCameras: WeakMap<Camera, Camera>;
19
+ renderTargets: WeakMap<Camera, RenderTarget>;
20
+
21
+ constructor(parameters?: ReflectorNodeParameters);
22
+
23
+ getTextureNode(): TextureNode;
24
+
25
+ getVirtualCamera(camera: Camera): Camera;
26
+
27
+ getRenderTarget(camera: Camera): RenderTarget;
28
+ }
29
+
30
+ export const reflector: (parameters?: ReflectorNodeParameters) => ShaderNodeObject<ReflectorNode>;
@@ -1,5 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
- import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
3
 
4
4
  export default class RemapNode extends Node {
5
5
  node: Node;
@@ -10,8 +10,27 @@ export default class RemapNode extends Node {
10
10
 
11
11
  doClamp: boolean;
12
12
 
13
- constructor(node: Node, inLowNode: Node, inHighNode: Node, outLowNode: Node, outHighNode: Node);
13
+ constructor(node: Node, inLowNode: Node, inHighNode: Node, outLowNode?: Node, outHighNode?: Node);
14
14
  }
15
15
 
16
- export const remap: (node: Node, inLowNode: Node) => ShaderNodeObject<RemapNode>;
17
- export const remapClamp: (node: Node, inLowNode: Node) => ShaderNodeObject<RemapNode>;
16
+ export const remap: (
17
+ node: Node,
18
+ inLowNode: NodeRepresentation,
19
+ inHighNode: NodeRepresentation,
20
+ outLowNode?: NodeRepresentation,
21
+ outHighNode?: NodeRepresentation,
22
+ ) => ShaderNodeObject<RemapNode>;
23
+ export const remapClamp: (
24
+ node: Node,
25
+ inLowNode: NodeRepresentation,
26
+ inHighNode: NodeRepresentation,
27
+ outLowNode?: NodeRepresentation,
28
+ outHighNode?: NodeRepresentation,
29
+ ) => ShaderNodeObject<RemapNode>;
30
+
31
+ declare module '../shadernode/ShaderNode.js' {
32
+ interface NodeElements {
33
+ remap: typeof remap;
34
+ remapClamp: typeof remapClamp;
35
+ }
36
+ }
@@ -0,0 +1,21 @@
1
+ import TempNode from '../core/TempNode.js';
2
+ import Node from '../core/Node.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
+
5
+ export default class RotateNode extends TempNode {
6
+ positionNode: Node;
7
+ rotationNode: Node;
8
+
9
+ constructor(positionNode: Node, rotationNode: Node);
10
+ }
11
+
12
+ export const rotate: (
13
+ positionNode: NodeRepresentation,
14
+ rotationNode: NodeRepresentation,
15
+ ) => ShaderNodeObject<RotateNode>;
16
+
17
+ declare module '../shadernode/ShaderNode.js' {
18
+ interface NodeElements {
19
+ rotate: typeof rotate;
20
+ }
21
+ }
@@ -11,3 +11,9 @@ export default class RotateUVNode extends TempNode {
11
11
  }
12
12
 
13
13
  export const rotateUV: (uvNode: Node, rotationNode: Node, centerNode?: Node) => ShaderNodeObject<RotateUVNode>;
14
+
15
+ declare module '../shadernode/ShaderNode.js' {
16
+ interface NodeElements {
17
+ rotateUV: typeof rotateUV;
18
+ }
19
+ }
@@ -35,3 +35,9 @@ export const triplanarTexture: (
35
35
  texture: NodeRepresentation,
36
36
  ...params: NodeRepresentation[]
37
37
  ) => ShaderNodeObject<TriplanarTexturesNode>;
38
+
39
+ declare module '../shadernode/ShaderNode.js' {
40
+ interface NodeElements {
41
+ triplanarTexture: typeof triplanarTexture;
42
+ }
43
+ }
@@ -0,0 +1,5 @@
1
+ import { Mesh, MeshBasicMaterial, SphereGeometry, Texture } from '../../../src/Three.js';
2
+
3
+ export class GroundedSkybox extends Mesh<SphereGeometry, MeshBasicMaterial> {
4
+ constructor(map: Texture, height: number, radius: number, resolution?: number);
5
+ }
@@ -6,8 +6,10 @@ export default class QuadMesh {
6
6
 
7
7
  dispose(): void;
8
8
 
9
- render(renderer: Renderer): void;
9
+ renderAsync(renderer: Renderer): Promise<void>;
10
10
 
11
11
  get material(): Material;
12
12
  set material(value: Material);
13
+
14
+ get render(): (renderer: Renderer) => Promise<void>;
13
15
  }
@@ -61,6 +61,8 @@ export class GTAOPass extends Pass {
61
61
  parameters?: { depthTexture?: DepthTexture | undefined; normalTexture?: Texture | undefined } | undefined,
62
62
  );
63
63
 
64
+ get gtaoMap(): Texture;
65
+
64
66
  setGBuffer(depthTexture?: DepthTexture | undefined, normalTexture?: Texture | undefined): void;
65
67
 
66
68
  setSceneClipBox(box: Box3): void;
@@ -108,6 +110,7 @@ export class GTAOPass extends Pass {
108
110
  generateNoise(size?: number): DataTexture;
109
111
 
110
112
  static OUTPUT: {
113
+ Off: -1;
111
114
  Default: 0;
112
115
  Diffuse: 1;
113
116
  Depth: 2;
@@ -27,7 +27,7 @@ export class SSAOPass extends Pass {
27
27
  scene: Scene;
28
28
  camera: Camera;
29
29
  width: number;
30
- height: boolean;
30
+ height: number;
31
31
  clear: boolean;
32
32
  kernelRadius: number;
33
33
  kernel: Vector3[];
@@ -1,13 +1,17 @@
1
1
  import { CoordinateSystem } from '../../../../src/Three.js';
2
2
  import Renderer from './Renderer.js';
3
3
 
4
+ export interface BackendParameters {
5
+ canvas?: HTMLCanvasElement | undefined;
6
+ }
7
+
4
8
  export default abstract class Backend {
5
9
  renderer: Renderer | null;
6
10
  domElement: HTMLCanvasElement | null;
7
11
 
8
- constructor(parameters?: { canvas?: HTMLCanvasElement | undefined });
12
+ constructor(parameters?: BackendParameters);
9
13
 
10
- init(renderer: Renderer): Promise<void>;
14
+ init(renderer: Renderer): void;
11
15
 
12
16
  abstract get coordinateSystem(): CoordinateSystem;
13
17
 
@@ -0,0 +1,9 @@
1
+ import { Color, ColorRepresentation } from '../../../../src/math/Color.ts';
2
+
3
+ export default class Color4 extends Color {
4
+ constructor(r: number, g: number, b: number, a?: number);
5
+
6
+ set(...args: [color: ColorRepresentation] | [r: number, g: number, b: number, a?: number]): this;
7
+
8
+ clone(): this;
9
+ }
@@ -8,12 +8,18 @@ export default class Info {
8
8
 
9
9
  render: { calls: number; drawCalls: number; triangles: number; points: number; lines: number };
10
10
 
11
- compute: { calls: number };
11
+ compute: { calls: number; computeCalls: number };
12
12
 
13
13
  memory: { geometries: number; textures: number };
14
14
 
15
+ timestamp: { compute: number; render: number };
16
+
15
17
  update(object: Object3D, count: number, instanceCount: number): void;
16
18
 
19
+ updateTimestamp(type: keyof typeof this.timestamp, time: number): void;
20
+
21
+ resetCompute(): void;
22
+
17
23
  reset(): void;
18
24
 
19
25
  dispose(): void;
@@ -0,0 +1,11 @@
1
+ import Renderer from './Renderer.js';
2
+ import { Node } from '../../nodes/Nodes.js';
3
+
4
+ export default class PostProcessing {
5
+ renderer: Renderer;
6
+ outputNode: Node;
7
+
8
+ constructor(renderer: Renderer, outputNode?: Node);
9
+
10
+ render(): Promise<void>;
11
+ }