@types/three 0.159.0 → 0.160.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/loaders/KTX2Loader.d.ts +2 -8
  3. three/examples/jsm/loaders/MaterialXLoader.d.ts +6 -0
  4. three/examples/jsm/misc/Timer.d.ts +80 -0
  5. three/examples/jsm/nodes/Nodes.d.ts +238 -60
  6. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +9 -0
  7. three/examples/jsm/nodes/accessors/BufferNode.d.ts +4 -1
  8. three/examples/jsm/nodes/accessors/CameraNode.d.ts +7 -0
  9. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +9 -2
  10. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +3 -0
  11. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +12 -0
  12. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +7 -0
  13. three/examples/jsm/nodes/accessors/ModelNode.d.ts +7 -1
  14. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
  15. three/examples/jsm/nodes/accessors/NormalNode.d.ts +8 -0
  16. three/examples/jsm/nodes/accessors/PointUVNode.d.ts +3 -0
  17. three/examples/jsm/nodes/accessors/PositionNode.d.ts +8 -0
  18. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +4 -1
  19. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -0
  20. three/examples/jsm/nodes/accessors/SkinningNode.d.ts +3 -0
  21. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +8 -1
  22. three/examples/jsm/nodes/accessors/TangentNode.d.ts +9 -0
  23. three/examples/jsm/nodes/accessors/TextureNode.d.ts +10 -2
  24. three/examples/jsm/nodes/accessors/UVNode.d.ts +3 -0
  25. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +7 -0
  26. three/examples/jsm/nodes/code/CodeNode.d.ts +4 -0
  27. three/examples/jsm/nodes/code/ExpressionNode.d.ts +3 -0
  28. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +7 -1
  29. three/examples/jsm/nodes/code/FunctionNode.d.ts +17 -0
  30. three/examples/jsm/nodes/core/ArrayUniformNode.d.ts +1 -1
  31. three/examples/jsm/nodes/core/AttributeNode.d.ts +3 -0
  32. three/examples/jsm/nodes/core/BypassNode.d.ts +3 -0
  33. three/examples/jsm/nodes/core/CacheNode.d.ts +3 -0
  34. three/examples/jsm/nodes/core/ConstNode.d.ts +3 -3
  35. three/examples/jsm/nodes/core/ContextNode.d.ts +3 -0
  36. three/examples/jsm/nodes/core/InputNode.d.ts +4 -4
  37. three/examples/jsm/nodes/core/NodeBuilder.d.ts +6 -3
  38. three/examples/jsm/nodes/core/NodeUniform.d.ts +12 -8
  39. three/examples/jsm/nodes/core/NodeUtils.d.ts +6 -3
  40. three/examples/jsm/nodes/core/PropertyNode.d.ts +9 -0
  41. three/examples/jsm/nodes/core/UniformNode.d.ts +12 -4
  42. three/examples/jsm/nodes/core/VarNode.d.ts +4 -0
  43. three/examples/jsm/nodes/core/VaryingNode.d.ts +3 -0
  44. three/examples/jsm/nodes/core/constants.d.ts +9 -5
  45. three/examples/jsm/nodes/display/BlendModeNode.d.ts +7 -2
  46. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +18 -1
  47. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +4 -0
  48. three/examples/jsm/nodes/display/FrontFacingNode.d.ts +4 -0
  49. three/examples/jsm/nodes/display/NormalMapNode.d.ts +7 -1
  50. three/examples/jsm/nodes/display/PosterizeNode.d.ts +6 -0
  51. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +8 -1
  52. three/examples/jsm/nodes/display/ViewportNode.d.ts +8 -0
  53. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +3 -0
  54. three/examples/jsm/nodes/fog/FogNode.d.ts +3 -0
  55. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +3 -0
  56. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +1 -1
  57. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +1 -1
  58. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +1 -1
  59. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +1 -1
  60. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +1 -1
  61. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +1 -1
  62. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +1 -1
  63. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +1 -1
  64. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +1 -1
  65. three/examples/jsm/nodes/geometry/RangeNode.d.ts +3 -0
  66. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +7 -0
  67. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +6 -1
  68. three/examples/jsm/nodes/lighting/LightsNode.d.ts +3 -0
  69. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +18 -5
  70. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -3
  71. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +25 -2
  72. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +43 -34
  73. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +5 -3
  74. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +7 -5
  75. three/examples/jsm/nodes/math/CondNode.d.ts +7 -0
  76. three/examples/jsm/nodes/math/MathNode.d.ts +134 -1
  77. three/examples/jsm/nodes/math/OperatorNode.d.ts +51 -0
  78. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +3 -0
  79. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +75 -33
  80. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +4 -2
  81. three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +3 -0
  82. three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +6 -3
  83. three/examples/jsm/nodes/utils/OscNode.d.ts +6 -0
  84. three/examples/jsm/nodes/utils/RemapNode.d.ts +4 -0
  85. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +3 -0
  86. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +5 -1
  87. three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +7 -0
  88. three/examples/jsm/nodes/utils/TimerNode.d.ts +7 -1
  89. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +22 -7
  90. three/examples/jsm/objects/QuadMesh.d.ts +13 -0
  91. three/examples/jsm/postprocessing/{HBAOPass.d.ts → GTAOPass.d.ts} +22 -10
  92. three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.d.ts +3 -0
  93. three/examples/jsm/shaders/{HBAOShader.d.ts → GTAOShader.d.ts} +23 -8
  94. three/examples/jsm/shaders/PoissonDenoiseShader.d.ts +1 -1
  95. three/package.json +2 -2
  96. three/src/Three.d.ts +1 -0
  97. three/src/constants.d.ts +3 -1
  98. three/src/core/UniformsGroup.d.ts +3 -3
  99. three/src/lights/PointLight.d.ts +7 -0
  100. three/src/loaders/MaterialLoader.d.ts +6 -3
  101. three/src/materials/LineBasicMaterial.d.ts +7 -0
  102. three/src/materials/LineDashedMaterial.d.ts +7 -1
  103. three/src/materials/Material.d.ts +14 -14
  104. three/src/materials/MeshBasicMaterial.d.ts +7 -0
  105. three/src/materials/MeshDepthMaterial.d.ts +6 -0
  106. three/src/materials/MeshDistanceMaterial.d.ts +7 -0
  107. three/src/materials/MeshLambertMaterial.d.ts +7 -0
  108. three/src/materials/MeshMatcapMaterial.d.ts +7 -0
  109. three/src/materials/MeshNormalMaterial.d.ts +7 -0
  110. three/src/materials/MeshPhongMaterial.d.ts +7 -0
  111. three/src/materials/MeshPhysicalMaterial.d.ts +6 -1
  112. three/src/materials/MeshStandardMaterial.d.ts +7 -2
  113. three/src/materials/MeshToonMaterial.d.ts +7 -0
  114. three/src/materials/PointsMaterial.d.ts +7 -0
  115. three/src/materials/RawShaderMaterial.d.ts +9 -0
  116. three/src/materials/ShaderMaterial.d.ts +9 -3
  117. three/src/materials/ShadowMaterial.d.ts +7 -0
  118. three/src/materials/SpriteMaterial.d.ts +7 -2
  119. three/src/math/Matrix4.d.ts +30 -30
  120. three/src/math/Sphere.d.ts +5 -0
  121. three/src/math/Triangle.d.ts +8 -8
  122. three/src/objects/SkinnedMesh.d.ts +1 -2
  123. three/src/renderers/shaders/ShaderLib.d.ts +18 -18
  124. three/src/renderers/shaders/UniformsUtils.d.ts +3 -2
  125. three/src/renderers/webgl/WebGLLights.d.ts +39 -37
  126. three/src/renderers/webgl/WebGLPrograms.d.ts +224 -9
  127. three/src/textures/CompressedCubeTexture.d.ts +13 -0
  128. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +0 -310
  129. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -166
@@ -1,20 +1,37 @@
1
- import { ConstNode, Node, NodeBuilder, NodeTypeOption, SwizzleOption } from '../Nodes.js';
2
- // lot of private typescript magic here
3
- export {};
1
+ import Node from '../core/Node.js';
2
+ import { NodeTypeOption, SwizzleOption } from '../core/constants.js';
3
+ import ConstNode from '../core/ConstNode.js';
4
+ import NodeBuilder from '../core/NodeBuilder.js';
5
+ import SplitNode from '../utils/SplitNode.js';
6
+
7
+ export interface NodeElements {}
8
+
9
+ export function addNodeElement(name: string, nodeElement: unknown): void;
10
+
4
11
  export type Swizzable<T extends Node = Node> = T & {
5
- [key in SwizzleOption | number]: Swizzable;
12
+ [key in SwizzleOption | number]: ShaderNodeObject<SplitNode>;
6
13
  };
7
14
 
15
+ export type ShaderNodeObject<T extends Node> = T & {
16
+ [Key in keyof NodeElements]: NodeElements[Key] extends (node: T, ...args: infer Args) => infer R
17
+ ? (...args: Args) => R
18
+ : never;
19
+ } & Swizzable<T>;
20
+
8
21
  /** anything that can be passed to {@link nodeObject} and returns a proxy */
9
- export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | Swizzable<T>;
22
+ export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | ShaderNodeObject<T>;
10
23
 
11
24
  /** anything that can be passed to {@link nodeObject} */
12
25
  export type NodeObjectOption = NodeRepresentation | string;
13
26
 
14
- // same logic as in ShaderNodeObject: number,boolean,node->swizzable, otherwise do nothing
15
- export type NodeObject<T> = T extends Node ? Swizzable<T> : T extends number | boolean ? Swizzable<ConstNode> : T;
27
+ // same logic as in ShaderNodeObject: number,boolean,node->ShaderNodeObject, otherwise do nothing
28
+ export type NodeObject<T> = T extends Node
29
+ ? ShaderNodeObject<T>
30
+ : T extends number | boolean
31
+ ? ShaderNodeObject<ConstNode<number | boolean>>
32
+ : T;
16
33
 
17
- // opposite of NodeObject: node -> node|swizzable|boolean|number, otherwise do nothing
34
+ // opposite of NodeObject: node -> node|ShaderNodeObject|boolean|number, otherwise do nothing
18
35
  type Proxied<T> = T extends Node ? NodeRepresentation<T> : T;
19
36
  // https://github.com/microsoft/TypeScript/issues/42435#issuecomment-765557874
20
37
  export type ProxiedTuple<T extends readonly [...unknown[]]> = [...{ [index in keyof T]: Proxied<T[index]> }];
@@ -102,11 +119,7 @@ type GetConstructorsByScope<T, S> = ConstructorUnion<FilterConstructorsByScope<O
102
119
  type GetConstructors<T> = ConstructorUnion<OverloadedConstructorsOf<T>>;
103
120
  type GetPossibleScopes<T> = ExtractScopes<OverloadedConstructorsOf<T>>;
104
121
 
105
- export type ConvertType = (...params: unknown[]) => Swizzable;
106
-
107
- export const ConvertType: {
108
- new (type: NodeTypeOption, cacheMap?: Map<unknown, ConstNode>): ConvertType;
109
- };
122
+ export type ConvertType = (...params: unknown[]) => ShaderNodeObject<Node>;
110
123
 
111
124
  type NodeArray<T extends NodeObjectOption[]> = { [index in keyof T]: NodeObject<T[index]> };
112
125
  type NodeObjects<T> = { [key in keyof T]: T[key] extends NodeObjectOption ? NodeObject<T[key]> : T[key] };
@@ -114,7 +127,16 @@ type ConstructedNode<T> = T extends new (...args: any[]) => infer R ? (R extends
114
127
 
115
128
  export type NodeOrType = Node | NodeTypeOption;
116
129
 
117
- export function getConstNodeType(value: NodeOrType): NodeTypeOption | null;
130
+ export const getConstNodeType: (value: NodeOrType) => NodeTypeOption | null;
131
+
132
+ export class ShaderNode<T = {}, R extends Node = Node> {
133
+ constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => NodeRepresentation);
134
+ call: (
135
+ inputs: { [key in keyof T]: T[key] extends NodeRepresentation ? ShaderNodeObject<Node> | Node : T[key] },
136
+ builder?: NodeBuilder,
137
+ ) => ShaderNodeObject<R>;
138
+ }
139
+
118
140
  export function nodeObject<T extends NodeObjectOption>(obj: T): NodeObject<T>;
119
141
  export function nodeObjects<T>(obj: T): NodeObjects<T>;
120
142
 
@@ -122,35 +144,55 @@ export function nodeArray<T extends NodeObjectOption[]>(obj: readonly [...T]): N
122
144
 
123
145
  export function nodeProxy<T>(
124
146
  nodeClass: T,
125
- ): (...params: ProxiedTuple<GetConstructors<T>>) => Swizzable<ConstructedNode<T>>;
147
+ ): (...params: ProxiedTuple<GetConstructors<T>>) => ShaderNodeObject<ConstructedNode<T>>;
126
148
 
127
149
  export function nodeProxy<T, S extends GetPossibleScopes<T>>(
128
150
  nodeClass: T,
129
151
  scope: S,
130
- ): (...params: ProxiedTuple<RemoveTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
152
+ ): (...params: ProxiedTuple<RemoveTail<GetConstructorsByScope<T, S>>>) => ShaderNodeObject<ConstructedNode<T>>;
131
153
 
132
154
  export function nodeProxy<T, S extends GetPossibleScopes<T>>(
133
155
  nodeClass: T,
134
156
  scope: S,
135
157
  factor: NodeObjectOption,
136
- ): (...params: ProxiedTuple<RemoveHeadAndTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
158
+ ): (...params: ProxiedTuple<RemoveHeadAndTail<GetConstructorsByScope<T, S>>>) => ShaderNodeObject<ConstructedNode<T>>;
137
159
 
138
160
  export function nodeImmutable<T>(
139
161
  nodeClass: T,
140
162
  ...params: ProxiedTuple<GetConstructors<T>>
141
- ): Swizzable<ConstructedNode<T>>;
142
-
143
- export class ShaderNode<T = {}, R extends Node = Node> {
144
- constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => NodeRepresentation);
145
- call: (
146
- inputs: { [key in keyof T]: T[key] extends NodeRepresentation ? Swizzable | Node : T[key] },
147
- builder?: NodeBuilder,
148
- ) => Swizzable<R>;
149
- }
150
-
151
- export const cacheMaps: {
152
- bool: Map<boolean, ConstNode>;
153
- uint: Map<number, ConstNode>;
154
- int: Map<number, ConstNode>;
155
- float: Map<number, ConstNode>;
156
- };
163
+ ): ShaderNodeObject<ConstructedNode<T>>;
164
+
165
+ export const color: ConvertType;
166
+
167
+ export const float: ConvertType;
168
+ export const int: ConvertType;
169
+ export const uint: ConvertType;
170
+ export const bool: ConvertType;
171
+
172
+ export const vec2: ConvertType;
173
+ export const ivec2: ConvertType;
174
+ export const uvec2: ConvertType;
175
+ export const bvec2: ConvertType;
176
+
177
+ export const vec3: ConvertType;
178
+ export const ivec3: ConvertType;
179
+ export const uvec3: ConvertType;
180
+ export const bvec3: ConvertType;
181
+
182
+ export const vec4: ConvertType;
183
+ export const ivec4: ConvertType;
184
+ export const uvec4: ConvertType;
185
+ export const bvec4: ConvertType;
186
+
187
+ export const mat3: ConvertType;
188
+ export const imat3: ConvertType;
189
+ export const umat3: ConvertType;
190
+ export const bmat3: ConvertType;
191
+
192
+ export const mat4: ConvertType;
193
+ export const imat4: ConvertType;
194
+ export const umat4: ConvertType;
195
+ export const bmat4: ConvertType;
196
+
197
+ export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
198
+ export const convert: (node: NodeRepresentation, types: NodeTypeOption) => ShaderNodeObject<Node>;
@@ -1,6 +1,8 @@
1
1
  import { PositionNode, TempNode } from '../Nodes.js';
2
- import { Swizzable } from '../shadernode/ShaderNodeElements.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
3
 
4
4
  export default class EquirectUVNode extends TempNode {
5
- constructor(dirNode?: Swizzable<PositionNode>);
5
+ constructor(dirNode?: ShaderNodeObject<PositionNode>);
6
6
  }
7
+
8
+ export const equirectUV: ShaderNodeObject<EquirectUVNode>;
@@ -1,5 +1,8 @@
1
1
  import TempNode from '../core/TempNode.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class MatcapUVNode extends TempNode {
4
5
  constructor();
5
6
  }
7
+
8
+ export const matcapUV: ShaderNodeObject<MatcapUVNode>;
@@ -1,11 +1,14 @@
1
- import UniformNode from '../core/UniformNode.js';
2
1
  import { Texture } from '../../../../src/Three.js';
3
- import { TextureNode } from '../Nodes.js';
2
+ import UniformNode from '../core/UniformNode.js';
3
+ import TextureNode from '../accessors/TextureNode.js';
4
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
5
 
5
- export default class MaxMipLevelNode extends UniformNode {
6
+ export default class MaxMipLevelNode extends UniformNode<0> {
6
7
  textureNode: TextureNode;
7
8
 
8
9
  constructor(textureNode: TextureNode);
9
10
 
10
11
  get texture(): Texture;
11
12
  }
13
+
14
+ export const maxMipLevel: (texture: Texture) => ShaderNodeObject<MaxMipLevelNode>;
@@ -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 type OscNodeMethod =
4
5
  | typeof OscNode.SINE
@@ -17,3 +18,8 @@ export default class OscNode extends Node {
17
18
 
18
19
  constructor(method: OscNodeMethod, timeNode?: Node);
19
20
  }
21
+
22
+ export const oscSine: (timeNode?: NodeRepresentation) => ShaderNodeObject<OscNode>;
23
+ export const oscSquare: (timeNode?: NodeRepresentation) => ShaderNodeObject<OscNode>;
24
+ export const oscTriangle: (timeNode?: NodeRepresentation) => ShaderNodeObject<OscNode>;
25
+ export const oscSawtooth: (timeNode?: NodeRepresentation) => ShaderNodeObject<OscNode>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class RemapNode extends Node {
4
5
  node: Node;
@@ -11,3 +12,6 @@ export default class RemapNode extends Node {
11
12
 
12
13
  constructor(node: Node, inLowNode: Node, inHighNode: Node, outLowNode: Node, outHighNode: Node);
13
14
  }
15
+
16
+ export const remap: (node: Node, inLowNode: Node) => ShaderNodeObject<RemapNode>;
17
+ export const remapClamp: (node: Node, inLowNode: Node) => ShaderNodeObject<RemapNode>;
@@ -1,5 +1,6 @@
1
1
  import TempNode from '../core/TempNode.js';
2
2
  import Node from '../core/Node.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class RotateUVNode extends TempNode {
5
6
  uvNode: Node;
@@ -8,3 +9,5 @@ export default class RotateUVNode extends TempNode {
8
9
 
9
10
  constructor(uvNode: Node, rotationNode: Node, centerNode?: Node);
10
11
  }
12
+
13
+ export const rotateUV: (uvNode: Node, rotationNode: Node, centerNode?: Node) => ShaderNodeObject<RotateUVNode>;
@@ -1,4 +1,6 @@
1
- import { Node, TextureNode } from '../Nodes.js';
1
+ import Node from '../core/Node.js';
2
+ import TextureNode from '../accessors/TextureNode.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
4
 
3
5
  export default class SpecularMIPLevelNode extends Node {
4
6
  textureNode: TextureNode;
@@ -6,3 +8,5 @@ export default class SpecularMIPLevelNode extends Node {
6
8
 
7
9
  constructor(textureNode: TextureNode, roughnessNode?: Node | null);
8
10
  }
11
+
12
+ export const specularMIPLevel: () => ShaderNodeObject<SpecularMIPLevelNode>;
@@ -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 SpriteSheetUVNode extends Node {
4
5
  countNode: Node;
@@ -7,3 +8,9 @@ export default class SpriteSheetUVNode extends Node {
7
8
 
8
9
  constructor(countNode: Node, uvNode?: Node, frameNode?: Node);
9
10
  }
11
+
12
+ export const spritesheetUV: (
13
+ countNode: NodeRepresentation,
14
+ uvNode?: NodeRepresentation,
15
+ frameNode?: NodeRepresentation,
16
+ ) => ShaderNodeObject<SpriteSheetUVNode>;
@@ -1,4 +1,5 @@
1
1
  import UniformNode from '../core/UniformNode.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export type TimerNodeScope =
4
5
  | typeof TimerNode.LOCAL
@@ -6,7 +7,7 @@ export type TimerNodeScope =
6
7
  | typeof TimerNode.DELTA
7
8
  | typeof TimerNode.FRAME;
8
9
 
9
- export default class TimerNode extends UniformNode {
10
+ export default class TimerNode extends UniformNode<number> {
10
11
  static LOCAL: 'local';
11
12
  static GLOBAL: 'global';
12
13
  static DELTA: 'delta';
@@ -17,3 +18,8 @@ export default class TimerNode extends UniformNode {
17
18
 
18
19
  constructor(scope?: TimerNodeScope, scale?: number, value?: number);
19
20
  }
21
+
22
+ export const timerLocal: (timeScale?: number, value?: number) => ShaderNodeObject<TimerNode>;
23
+ export const timerGlobal: (timeScale?: number, value?: number) => ShaderNodeObject<TimerNode>;
24
+ export const timerDelta: (timeScale?: number, value?: number) => ShaderNodeObject<TimerNode>;
25
+ export const frameId: ShaderNodeObject<TimerNode>;
@@ -1,22 +1,37 @@
1
1
  import Node from '../core/Node.js';
2
- import { PositionNode, Swizzable, TextureNode } from '../Nodes.js';
2
+ import PositionNode from '../accessors/PositionNode.js';
3
+ import TextureNode from '../accessors/TextureNode.js';
4
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
5
 
4
6
  export default class TriplanarTexturesNode extends Node {
5
7
  textureXNode: TextureNode;
6
8
  textureYNode: TextureNode | null;
7
9
  textureZNode: TextureNode | null;
8
10
 
9
- scaleNode: Swizzable;
11
+ scaleNode: ShaderNodeObject<Node>;
10
12
 
11
- positionNode: Swizzable<PositionNode>;
12
- normalNode: Swizzable<PositionNode>;
13
+ positionNode: ShaderNodeObject<PositionNode>;
14
+ normalNode: ShaderNodeObject<PositionNode>;
13
15
 
14
16
  constructor(
15
17
  textureXNode: Node,
16
18
  textureYNode?: TextureNode | null,
17
19
  textureZNode?: TextureNode | null,
18
- scaleNode?: Swizzable,
19
- positionNode?: Swizzable<PositionNode>,
20
- normalNode?: Swizzable<PositionNode>,
20
+ scaleNode?: ShaderNodeObject<Node>,
21
+ positionNode?: ShaderNodeObject<PositionNode>,
22
+ normalNode?: ShaderNodeObject<PositionNode>,
21
23
  );
22
24
  }
25
+
26
+ export const triplanarTextures: (
27
+ textureXNode: NodeRepresentation,
28
+ textureYNode?: NodeRepresentation,
29
+ textureZNode?: NodeRepresentation,
30
+ scaleNode?: NodeRepresentation,
31
+ positionNode?: NodeRepresentation,
32
+ normalNode?: NodeRepresentation,
33
+ ) => ShaderNodeObject<TriplanarTexturesNode>;
34
+ export const triplanarTexture: (
35
+ texture: NodeRepresentation,
36
+ ...params: NodeRepresentation[]
37
+ ) => ShaderNodeObject<TriplanarTexturesNode>;
@@ -0,0 +1,13 @@
1
+ import { Material } from '../../../src/Three.js';
2
+ import Renderer from '../renderers/common/Renderer.js';
3
+
4
+ export default class QuadMesh {
5
+ constructor(material?: Material | null);
6
+
7
+ dispose(): void;
8
+
9
+ render(renderer: Renderer): void;
10
+
11
+ get material(): Material;
12
+ set material(value: Material);
13
+ }
@@ -1,4 +1,5 @@
1
1
  import {
2
+ Box3,
2
3
  Camera,
3
4
  Color,
4
5
  ColorRepresentation,
@@ -14,23 +15,26 @@ import {
14
15
 
15
16
  import { FullScreenQuad, Pass } from './Pass.js';
16
17
 
17
- export class HBAOPass extends Pass {
18
+ export class GTAOPass extends Pass {
18
19
  width: number;
19
20
  height: number;
20
21
  clear: boolean;
21
22
  camera: Camera;
22
23
  scene: Scene;
23
24
  output: number;
25
+ blendIntensity: number;
24
26
 
25
- rings: number;
26
- samples: number;
27
+ pdRings: number;
28
+ pdRadiusExponent: number;
29
+ pdSamples: number;
27
30
 
28
- noiseTexture: DataTexture;
31
+ gtaoNoiseTexture: DataTexture;
32
+ pdNoiseTexture: DataTexture;
29
33
 
30
- hbaoRenderTarget: WebGLRenderTarget;
34
+ gtaoRenderTarget: WebGLRenderTarget;
31
35
  pdRenderTarget: WebGLRenderTarget;
32
36
 
33
- hbaoMaterial: ShaderMaterial;
37
+ gtaoMaterial: ShaderMaterial;
34
38
 
35
39
  normalMaterial: MeshNormalMaterial;
36
40
 
@@ -40,6 +44,8 @@ export class HBAOPass extends Pass {
40
44
 
41
45
  copyMaterial: ShaderMaterial;
42
46
 
47
+ blendMaterial: ShaderMaterial;
48
+
43
49
  fsQuad: FullScreenQuad;
44
50
 
45
51
  originalClearColor: Color;
@@ -55,13 +61,18 @@ export class HBAOPass extends Pass {
55
61
  parameters?: { depthTexture?: DepthTexture | undefined; normalTexture?: Texture | undefined } | undefined,
56
62
  );
57
63
 
58
- setTextures(depthTexture?: DepthTexture | undefined, normalTexture?: Texture | undefined): void;
64
+ setGBuffer(depthTexture?: DepthTexture | undefined, normalTexture?: Texture | undefined): void;
65
+
66
+ setSceneClipBox(box: Box3): void;
59
67
 
60
- updateHbaoMaterial(parameters: {
68
+ updateGtaoMaterial(parameters: {
61
69
  radius?: number | undefined;
62
70
  distanceExponent?: number | undefined;
63
- bias?: number | undefined;
71
+ thickness?: number | undefined;
72
+ distanceFallOff?: number | undefined;
73
+ scale?: number | undefined;
64
74
  samples?: number | undefined;
75
+ screenSpaceRadius?: boolean | undefined;
65
76
  }): void;
66
77
 
67
78
  updatePdMaterial(parameters: {
@@ -69,6 +80,7 @@ export class HBAOPass extends Pass {
69
80
  depthPhi?: number | undefined;
70
81
  normalPhi?: number | undefined;
71
82
  radius?: number | undefined;
83
+ radiusExponent?: number | undefined;
72
84
  rings?: number | undefined;
73
85
  samples?: number | undefined;
74
86
  }): void;
@@ -100,7 +112,7 @@ export class HBAOPass extends Pass {
100
112
  Diffuse: 1;
101
113
  Depth: 2;
102
114
  Normal: 3;
103
- HBAO: 4;
115
+ AO: 4;
104
116
  Denoise: 5;
105
117
  };
106
118
  }
@@ -0,0 +1,3 @@
1
+ import { NodeFrame } from '../../../nodes/Nodes.js';
2
+
3
+ export const nodeFrame: NodeFrame;
@@ -1,14 +1,15 @@
1
- import { IUniform, Matrix4, Vector2 } from '../../../src/Three.js';
1
+ import { DataTexture, IUniform, Matrix4, Vector2, Vector3 } from '../../../src/Three.js';
2
2
 
3
- export const HBAOShader: {
3
+ export const GTAOShader: {
4
4
  name: string;
5
5
  defines: {
6
6
  PERSPECTIVE_CAMERA: number;
7
7
  SAMPLES: number;
8
- SAMPLE_VECTORS: string;
9
8
  NORMAL_VECTOR_TYPE: number;
10
- DEPTH_VALUE_SOURCE: number;
11
- SAMPLING_FROM_NOISE: number;
9
+ DEPTH_SWIZZLING: string;
10
+ SCREEN_SPACE_RADIUS: number;
11
+ SCREEN_SPACE_RADIUS_SCALE: number;
12
+ SCENE_CLIP_BOX: number;
12
13
  };
13
14
  uniforms: {
14
15
  tNormal: IUniform;
@@ -21,13 +22,17 @@ export const HBAOShader: {
21
22
  cameraProjectionMatrixInverse: IUniform<Matrix4>;
22
23
  radius: IUniform<number>;
23
24
  distanceExponent: IUniform<number>;
24
- bias: IUniform<number>;
25
+ thickness: IUniform<number>;
26
+ distanceFallOff: IUniform<number>;
27
+ scale: IUniform<number>;
28
+ sceneBoxMin: IUniform<Vector3>;
29
+ sceneBoxMax: IUniform<Vector3>;
25
30
  };
26
31
  vertexShader: string;
27
32
  fragmentShader: string;
28
33
  };
29
34
 
30
- export const HBAODepthShader: {
35
+ export const GTAODepthShader: {
31
36
  name: string;
32
37
  defines: {
33
38
  PERSPECTIVE_CAMERA: number;
@@ -41,4 +46,14 @@ export const HBAODepthShader: {
41
46
  fragmentShader: string;
42
47
  };
43
48
 
44
- export function generateHaboSampleKernelInitializer(samples: number): string;
49
+ export const GTAOBlendShader: {
50
+ name: string;
51
+ uniforms: {
52
+ tDiffuse: IUniform;
53
+ intensity: IUniform<number>;
54
+ };
55
+ vertexShader: string;
56
+ fragmentShader: string;
57
+ };
58
+
59
+ export function generateMagicSquareNoise(samples?: number): DataTexture;
@@ -25,4 +25,4 @@ export const PoissonDenoiseShader: {
25
25
  fragmentShader: string;
26
26
  };
27
27
 
28
- export function generatePdSamplePointInitializer(samples: number, rings: number): string;
28
+ export function generatePdSamplePointInitializer(samples: number, rings: number, radiusExponent: number): string;
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.159.0",
3
+ "version": "0.160.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -44,6 +44,6 @@
44
44
  "fflate": "~0.6.10",
45
45
  "meshoptimizer": "~0.18.1"
46
46
  },
47
- "typesPublisherContentHash": "00146f19c0acfa1923520aa89574fd3c011b0b97251b16d57b2bc5999534c2c9",
47
+ "typesPublisherContentHash": "7de688c4d074af1d79f7696d827bdd1236ff9e159d0b343b35e0b152202c544e",
48
48
  "typeScriptVersion": "4.6"
49
49
  }
three/src/Three.d.ts CHANGED
@@ -223,6 +223,7 @@ export * from './scenes/Scene.js';
223
223
  */
224
224
  export * from './textures/VideoTexture.js';
225
225
  export * from './textures/CompressedArrayTexture.js';
226
+ export * from './textures/CompressedCubeTexture.js';
226
227
  export * from './textures/DataTexture.js';
227
228
  export * from './textures/CompressedTexture.js';
228
229
  export * from './textures/CubeTexture.js';
three/src/constants.d.ts CHANGED
@@ -140,13 +140,15 @@ export const ReinhardToneMapping: 2;
140
140
  export const CineonToneMapping: 3;
141
141
  export const ACESFilmicToneMapping: 4;
142
142
  export const CustomToneMapping: 5;
143
+ export const AgXToneMapping: 6;
143
144
  export type ToneMapping =
144
145
  | typeof NoToneMapping
145
146
  | typeof LinearToneMapping
146
147
  | typeof ReinhardToneMapping
147
148
  | typeof CineonToneMapping
148
149
  | typeof ACESFilmicToneMapping
149
- | typeof CustomToneMapping;
150
+ | typeof CustomToneMapping
151
+ | typeof AgXToneMapping;
150
152
 
151
153
  // Bind modes
152
154
  export const AttachedBindMode: 'attached';
@@ -15,11 +15,11 @@ export class UniformsGroup extends EventDispatcher<{ dispose: {} }> {
15
15
 
16
16
  usage: Usage;
17
17
 
18
- uniforms: Uniform[];
18
+ uniforms: Array<Uniform | Uniform[]>;
19
19
 
20
- add(uniform: Uniform): this;
20
+ add(uniform: Uniform | Uniform[]): this;
21
21
 
22
- remove(uniform: Uniform): this;
22
+ remove(uniform: Uniform | Uniform[]): this;
23
23
 
24
24
  setName(name: string): this;
25
25
 
@@ -29,6 +29,13 @@ export class PointLight extends Light<PointLightShadow> {
29
29
  */
30
30
  constructor(color?: ColorRepresentation, intensity?: number, distance?: number, decay?: number);
31
31
 
32
+ /**
33
+ * Read-only flag to check if a given object is of type {@link PointLight}.
34
+ * @remarks This is a _constant_ value
35
+ * @defaultValue `true`
36
+ */
37
+ readonly isPointLight: true;
38
+
32
39
  /**
33
40
  * @default 'PointLight'
34
41
  */
@@ -4,13 +4,16 @@ import { Texture } from '../textures/Texture.js';
4
4
  import { Material } from '../materials/Material.js';
5
5
 
6
6
  export class MaterialLoader extends Loader<Material> {
7
- constructor(manager?: LoadingManager);
8
-
9
7
  /**
10
8
  * @default {}
11
9
  */
12
10
  textures: { [key: string]: Texture };
13
11
 
14
- setTextures(textures: { [key: string]: Texture }): this;
12
+ constructor(manager?: LoadingManager);
13
+
15
14
  parse(json: unknown): Material;
15
+
16
+ setTextures(textures: { [key: string]: Texture }): this;
17
+
18
+ static createMaterialFromType(type: string): Material;
16
19
  }
@@ -13,6 +13,13 @@ export interface LineBasicMaterialParameters extends MaterialParameters {
13
13
  export class LineBasicMaterial extends Material {
14
14
  constructor(parameters?: LineBasicMaterialParameters);
15
15
 
16
+ /**
17
+ * Read-only flag to check if a given object is of type {@link LineBasicMaterial}.
18
+ * @remarks This is a _constant_ value
19
+ * @defaultValue `true`
20
+ */
21
+ readonly isLineBasicMaterial: true;
22
+
16
23
  /**
17
24
  * @default 'LineBasicMaterial'
18
25
  */
@@ -9,6 +9,13 @@ export interface LineDashedMaterialParameters extends LineBasicMaterialParameter
9
9
  export class LineDashedMaterial extends LineBasicMaterial {
10
10
  constructor(parameters?: LineDashedMaterialParameters);
11
11
 
12
+ /**
13
+ * Read-only flag to check if a given object is of type {@link LineDashedMaterial}.
14
+ * @remarks This is a _constant_ value
15
+ * @defaultValue `true`
16
+ */
17
+ readonly isLineDashedMaterial: true;
18
+
12
19
  /**
13
20
  * @default 'LineDashedMaterial'
14
21
  */
@@ -28,7 +35,6 @@ export class LineDashedMaterial extends LineBasicMaterial {
28
35
  * @default 1
29
36
  */
30
37
  gapSize: number;
31
- readonly isLineDashedMaterial: true;
32
38
 
33
39
  setValues(parameters: LineDashedMaterialParameters): void;
34
40
  }