@types/three 0.162.0 → 0.164.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 (98) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/animation/CCDIKSolver.d.ts +19 -6
  3. three/examples/jsm/controls/OrbitControls.d.ts +1 -1
  4. three/examples/jsm/exporters/USDZExporter.d.ts +8 -1
  5. three/examples/jsm/geometries/TextGeometry.d.ts +8 -0
  6. three/examples/jsm/interactive/SelectionBox.d.ts +1 -0
  7. three/examples/jsm/loaders/FontLoader.d.ts +18 -4
  8. three/examples/jsm/loaders/LUT3dlLoader.d.ts +1 -2
  9. three/examples/jsm/loaders/LUTCubeLoader.d.ts +1 -2
  10. three/examples/jsm/loaders/RGBMLoader.d.ts +5 -0
  11. three/examples/jsm/loaders/TTFLoader.d.ts +5 -3
  12. three/examples/jsm/math/Octree.d.ts +2 -1
  13. three/examples/jsm/nodes/Nodes.d.ts +33 -5
  14. three/examples/jsm/nodes/accessors/AccessorsUtils.d.ts +2 -0
  15. three/examples/jsm/nodes/accessors/BatchNode.d.ts +14 -0
  16. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +2 -1
  17. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +84 -1
  18. three/examples/jsm/nodes/accessors/RendererReferenceNode.d.ts +16 -0
  19. three/examples/jsm/nodes/accessors/TextureNode.d.ts +11 -1
  20. three/examples/jsm/nodes/code/CodeNode.d.ts +7 -2
  21. three/examples/jsm/nodes/code/FunctionNode.d.ts +10 -4
  22. three/examples/jsm/nodes/core/LightingModel.d.ts +1 -0
  23. three/examples/jsm/nodes/core/Node.d.ts +7 -3
  24. three/examples/jsm/nodes/core/NodeBuilder.d.ts +1 -1
  25. three/examples/jsm/nodes/core/NodeUtils.d.ts +1 -1
  26. three/examples/jsm/nodes/core/OutputStructNode.d.ts +12 -0
  27. three/examples/jsm/nodes/core/PropertyNode.d.ts +10 -0
  28. three/examples/jsm/nodes/display/PassNode.d.ts +2 -0
  29. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +12 -0
  30. three/examples/jsm/nodes/fog/FogNode.d.ts +10 -5
  31. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +9 -5
  32. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +3 -1
  33. three/examples/jsm/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts +10 -0
  34. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +7 -2
  35. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts +16 -0
  36. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +10 -2
  37. three/examples/jsm/nodes/functions/ShadowMaskModel.d.ts +9 -0
  38. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +3 -2
  39. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +3 -2
  40. three/examples/jsm/nodes/lighting/AnalyticLightNode.d.ts +0 -2
  41. three/examples/jsm/nodes/lighting/IrradianceNode.d.ts +8 -0
  42. three/examples/jsm/nodes/lighting/LightUtils.d.ts +7 -2
  43. three/examples/jsm/nodes/materials/Materials.d.ts +2 -0
  44. three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.d.ts +23 -0
  45. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +24 -14
  46. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +9 -2
  47. three/examples/jsm/nodes/materials/ShadowNodeMaterial.d.ts +15 -0
  48. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +36 -32
  49. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +3 -4
  50. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +127 -6
  51. three/examples/jsm/nodes/materialx/lib/mx_transform_color.d.ts +4 -0
  52. three/examples/jsm/nodes/pmrem/PMREMNode.d.ts +20 -0
  53. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +6 -3
  54. three/examples/jsm/objects/QuadMesh.d.ts +5 -8
  55. three/examples/jsm/physics/JoltPhysics.d.ts +10 -0
  56. three/examples/jsm/postprocessing/RenderTransitionPass.d.ts +33 -0
  57. three/examples/jsm/renderers/common/Info.d.ts +3 -7
  58. three/examples/jsm/renderers/common/PostProcessing.d.ts +3 -1
  59. three/examples/jsm/renderers/common/Renderer.d.ts +11 -5
  60. three/examples/jsm/renderers/common/extras/PMREMGenerator.d.ts +8 -0
  61. three/examples/jsm/renderers/webgl/WebGLBackend.d.ts +4 -0
  62. three/examples/jsm/utils/SceneUtils.d.ts +18 -0
  63. three/examples/jsm/webxr/OculusHandModel.d.ts +5 -2
  64. three/examples/jsm/webxr/XRHandModelFactory.d.ts +8 -2
  65. three/index.d.ts +1 -1
  66. three/package.json +4 -4
  67. three/src/Three.d.ts +0 -1
  68. three/src/cameras/Camera.d.ts +3 -0
  69. three/src/constants.d.ts +10 -40
  70. three/src/core/Object3D.d.ts +6 -5
  71. three/src/core/RenderTarget.d.ts +25 -10
  72. three/src/materials/Material.d.ts +46 -23
  73. three/src/materials/MeshPhysicalMaterial.d.ts +65 -51
  74. three/src/materials/ShaderMaterial.d.ts +2 -17
  75. three/src/objects/BatchedMesh.d.ts +11 -1
  76. three/src/objects/InstancedMesh.d.ts +1 -1
  77. three/src/objects/SkinnedMesh.d.ts +0 -2
  78. three/src/renderers/WebGLRenderer.d.ts +2 -2
  79. three/src/renderers/shaders/ShaderChunk.d.ts +0 -1
  80. three/src/renderers/webgl/WebGLAttributes.d.ts +1 -2
  81. three/src/renderers/webgl/WebGLBindingStates.d.ts +1 -8
  82. three/src/renderers/webgl/WebGLBufferRenderer.d.ts +6 -3
  83. three/src/renderers/webgl/WebGLCapabilities.d.ts +13 -6
  84. three/src/renderers/webgl/WebGLExtensions.d.ts +1 -3
  85. three/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +7 -1
  86. three/src/renderers/webgl/WebGLLights.d.ts +1 -2
  87. three/src/renderers/webgl/WebGLPrograms.d.ts +2 -9
  88. three/src/renderers/webgl/WebGLState.d.ts +1 -3
  89. three/src/renderers/webgl/WebGLUtils.d.ts +0 -2
  90. three/src/scenes/Scene.d.ts +6 -0
  91. three/src/textures/Data3DTexture.d.ts +0 -1
  92. three/src/textures/DataArrayTexture.d.ts +0 -1
  93. three/src/textures/DepthTexture.d.ts +0 -3
  94. three/src/textures/Texture.d.ts +13 -7
  95. three/src/textures/types.d.ts +4 -4
  96. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +0 -12
  97. three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.d.ts +0 -3
  98. three/src/renderers/WebGL1Renderer.d.ts +0 -6
three/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 29 Feb 2024 18:08:09 GMT
11
+ * Last updated: Fri, 26 Apr 2024 16:08:00 GMT
12
12
  * Dependencies: [@tweenjs/tween.js](https://npmjs.com/package/@tweenjs/tween.js), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr), [fflate](https://npmjs.com/package/fflate), [meshoptimizer](https://npmjs.com/package/meshoptimizer)
13
13
 
14
14
  # Credits
@@ -1,7 +1,7 @@
1
- import { Object3D, SkinnedMesh, Vector3 } from "three";
1
+ import { LineBasicMaterial, MeshBasicMaterial, Object3D, SkinnedMesh, SphereGeometry, Vector3 } from "three";
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/naming-convention
4
- export interface IKS {
4
+ export interface IK {
5
5
  effector: number;
6
6
  iteration?: number | undefined;
7
7
  links: Array<{
@@ -17,14 +17,27 @@ export interface IKS {
17
17
  }
18
18
 
19
19
  export class CCDIKSolver {
20
- constructor(mesh: SkinnedMesh, iks: IKS[]);
20
+ mesh: SkinnedMesh;
21
+ iks: IK[];
22
+
23
+ constructor(mesh: SkinnedMesh, iks?: IK[]);
21
24
 
22
25
  update(): this;
23
- updateOne(iks: IKS): this;
24
- createHelper(): CCDIKHelper;
26
+ updateOne(ik: IK): this;
27
+ createHelper(sphereSize?: number): CCDIKHelper;
25
28
  }
26
29
 
27
30
  export class CCDIKHelper extends Object3D {
28
- constructor(mesh: SkinnedMesh, iks?: IKS[], sphereSize?: number);
31
+ root: SkinnedMesh;
32
+ iks: IK[];
33
+
34
+ sphereGeometry: SphereGeometry;
35
+ targetSphereMaterial: MeshBasicMaterial;
36
+ effectorSphereMaterial: MeshBasicMaterial;
37
+ linkSphereMaterial: MeshBasicMaterial;
38
+ lineMaterial: LineBasicMaterial;
39
+
40
+ constructor(mesh: SkinnedMesh, iks?: IK[], sphereSize?: number);
41
+
29
42
  dispose(): void;
30
43
  }
@@ -14,7 +14,7 @@ export interface OrbitControlsEventMap {
14
14
  * event listeners.
15
15
  */
16
16
  export class OrbitControls extends EventDispatcher<OrbitControlsEventMap> {
17
- constructor(object: Camera, domElement?: HTMLElement);
17
+ constructor(object: Camera, domElement: HTMLElement);
18
18
 
19
19
  /**
20
20
  * The camera being controlled.
@@ -8,5 +8,12 @@ export interface USDZExporterOptions {
8
8
  export class USDZExporter {
9
9
  constructor();
10
10
 
11
- parse(scene: Object3D, options?: USDZExporterOptions): Promise<Uint8Array>;
11
+ parse(
12
+ scene: Object3D,
13
+ onDone: (result: Uint8Array) => void,
14
+ onError: (error: unknown) => void,
15
+ options?: USDZExporterOptions,
16
+ ): void;
17
+
18
+ parseAsync(scene: Object3D, options?: USDZExporterOptions): Promise<Uint8Array>;
12
19
  }
@@ -16,9 +16,17 @@ export interface TextGeometryParameters extends ExtrudeGeometryOptions {
16
16
  * Thickness to extrude text.
17
17
  * Expects a `Float`.
18
18
  * @defaultValue `50`
19
+ * @deprecated THREE.TextGeometry: .height is now depreciated. Please use .depth instead
19
20
  */
20
21
  height?: number | undefined;
21
22
 
23
+ /**
24
+ * Thickness to extrude text.
25
+ * Expects a `Float`.
26
+ * @defaultValue `50`
27
+ */
28
+ depth?: number | undefined;
29
+
22
30
  /**
23
31
  * @override
24
32
  * @defaultValue `12`
@@ -8,6 +8,7 @@ export class SelectionBox {
8
8
  endPoint: Vector3;
9
9
  scene: Scene;
10
10
  startPoint: Vector3;
11
+ instances: Record<string, number[]>;
11
12
 
12
13
  select(startPoint?: Vector3, endPoint?: Vector3): Mesh[];
13
14
  updateFrustum(startPoint: Vector3, endPoint: Vector3): void;
@@ -1,5 +1,17 @@
1
1
  import { Loader, LoadingManager, Shape } from "three";
2
2
 
3
+ export interface FontData {
4
+ glyphs: Record<string, { ha: number; x_min: number; x_max: number; o: string }>;
5
+ familyName: string;
6
+ ascender: number;
7
+ descender: number;
8
+ underlinePosition: number;
9
+ underlineThickness: number;
10
+ boundingBox: { yMin: number; xMin: number; yMax: number; xMax: number };
11
+ resolution: number;
12
+ original_font_information: Record<string, string>;
13
+ }
14
+
3
15
  export class FontLoader extends Loader<Font> {
4
16
  constructor(manager?: LoadingManager);
5
17
 
@@ -10,18 +22,20 @@ export class FontLoader extends Loader<Font> {
10
22
  onError?: (err: unknown) => void,
11
23
  ): void;
12
24
 
13
- parse(json: any): Font;
25
+ parse(json: FontData): Font;
14
26
  }
15
27
 
16
28
  export class Font {
17
- constructor(jsondata: any);
29
+ readonly isFont: true;
18
30
 
19
31
  /**
20
32
  * @default 'Font'
21
33
  */
22
34
  type: string;
23
35
 
24
- data: string;
36
+ data: FontData;
37
+
38
+ constructor(data: FontData);
25
39
 
26
- generateShapes(text: string, size: number): Shape[];
40
+ generateShapes(text: string, size?: number): Shape[];
27
41
  }
@@ -1,8 +1,7 @@
1
- import { Data3DTexture, DataTexture, FloatType, Loader, LoadingManager, UnsignedByteType } from "three";
1
+ import { Data3DTexture, FloatType, Loader, LoadingManager, UnsignedByteType } from "three";
2
2
 
3
3
  export interface LUT3dlResult {
4
4
  size: number;
5
- texture: DataTexture;
6
5
  texture3D: Data3DTexture;
7
6
  }
8
7
 
@@ -1,11 +1,10 @@
1
- import { Data3DTexture, DataTexture, FloatType, Loader, LoadingManager, UnsignedByteType, Vector3 } from "three";
1
+ import { Data3DTexture, FloatType, Loader, LoadingManager, UnsignedByteType, Vector3 } from "three";
2
2
 
3
3
  export interface LUTCubeResult {
4
4
  title: string;
5
5
  size: number;
6
6
  domainMin: Vector3;
7
7
  domainMax: Vector3;
8
- texture: DataTexture;
9
8
  texture3D: Data3DTexture;
10
9
  }
11
10
 
@@ -24,6 +24,11 @@ export class RGBMLoader extends DataTextureLoader {
24
24
  onError?: (event: ErrorEvent) => void,
25
25
  ): CubeTexture;
26
26
 
27
+ loadCubemapAsync(
28
+ urls: string[],
29
+ onProgress?: (event: ProgressEvent) => void,
30
+ ): Promise<CubeTexture>;
31
+
27
32
  parse(buffer: ArrayBuffer): RGBM;
28
33
 
29
34
  setDataType(dataType: TextureDataType): this;
@@ -1,8 +1,10 @@
1
1
  import { Loader, LoadingManager } from "three";
2
+ import { FontData } from "./FontLoader.js";
2
3
 
3
- export class TTFLoader extends Loader<object> {
4
- constructor(manager?: LoadingManager);
4
+ export class TTFLoader extends Loader<FontData> {
5
5
  reversed: boolean;
6
6
 
7
- parse(arraybuffer: ArrayBuffer): object;
7
+ constructor(manager?: LoadingManager);
8
+
9
+ parse(arraybuffer: ArrayBuffer): FontData;
8
10
  }
@@ -1,4 +1,4 @@
1
- import { Box3, Object3D, Ray, Sphere, Triangle } from "three";
1
+ import { Box3, Layers, Object3D, Ray, Sphere, Triangle } from "three";
2
2
 
3
3
  import { Capsule } from "./Capsule.js";
4
4
 
@@ -8,6 +8,7 @@ export class Octree {
8
8
 
9
9
  subTrees: Octree[];
10
10
  triangles: Triangle[];
11
+ layers: Layers;
11
12
 
12
13
  constructor(box?: Box3 | null);
13
14
 
@@ -26,7 +26,12 @@ export { default as NodeKeywords } from "./core/NodeKeywords.js";
26
26
  export { default as NodeUniform } from "./core/NodeUniform.js";
27
27
  export { default as NodeVar } from "./core/NodeVar.js";
28
28
  export { default as NodeVarying } from "./core/NodeVarying.js";
29
+ export { default as OutputStructNode, outputStruct } from "./core/OutputStructNode.js";
29
30
  export {
31
+ alphaT,
32
+ anisotropy,
33
+ anisotropyB,
34
+ anisotropyT,
30
35
  clearcoat,
31
36
  clearcoatRoughness,
32
37
  dashSize,
@@ -169,7 +174,6 @@ export { default as ReflectorNode, reflector, ReflectorNodeParameters } from "./
169
174
  export { default as RemapNode, remap, remapClamp } from "./utils/RemapNode.js";
170
175
  export { default as RotateNode, rotate } from "./utils/RotateNode.js";
171
176
  export { default as RotateUVNode, rotateUV } from "./utils/RotateUVNode.js";
172
- export { default as SpecularMIPLevelNode, specularMIPLevel } from "./utils/SpecularMIPLevelNode.js";
173
177
  export { default as SplitNode } from "./utils/SplitNode.js";
174
178
  export { default as SpriteSheetUVNode, spritesheetUV } from "./utils/SpriteSheetUVNode.js";
175
179
  export { default as StorageArrayElementNode } from "./utils/SpriteSheetUVNode.js";
@@ -191,7 +195,8 @@ export {
191
195
  export * from "./shadernode/ShaderNode.js";
192
196
 
193
197
  // accessors
194
- export { parallaxDirection, parallaxUV, TBNViewMatrix } from "./accessors/AccessorsUtils.js";
198
+ export { parallaxDirection, parallaxUV, TBNViewMatrix, transformedBentNormalView } from "./accessors/AccessorsUtils.js";
199
+ export { batch, default as BatchNode } from "./accessors/BatchNode.js";
195
200
  export {
196
201
  bitangentGeometry,
197
202
  bitangentLocal,
@@ -220,16 +225,34 @@ export { default as InstanceNode, instance } from "./accessors/InstanceNode.js";
220
225
  export {
221
226
  default as MaterialNode,
222
227
  materialAlphaTest,
228
+ materialAnisotropy,
229
+ materialAnisotropyVector,
230
+ materialClearcoat,
231
+ materialClearcoatNormal,
232
+ materialClearcoatRoughness,
223
233
  materialColor,
224
234
  materialEmissive,
235
+ materialIridescence,
236
+ materialIridescenceIOR,
237
+ materialIridescenceThickness,
238
+ materialLineDashOffset,
239
+ materialLineDashSize,
240
+ materialLineGapSize,
241
+ materialLineScale,
242
+ materialLineWidth,
225
243
  materialMetalness,
226
244
  MaterialNodeScope,
245
+ materialNormal,
227
246
  materialOpacity,
247
+ materialPointWidth,
228
248
  materialReflectivity,
229
249
  materialRotation,
230
250
  materialRoughness,
251
+ materialSheen,
252
+ materialSheenRoughness,
231
253
  materialShininess,
232
- materialSpecularColor,
254
+ materialSpecular,
255
+ materialSpecularStrength,
233
256
  } from "./accessors/MaterialNode.js";
234
257
  export { default as MaterialReferenceNode, materialReference } from "./accessors/MaterialReferenceNode.js";
235
258
  export {
@@ -275,6 +298,7 @@ export {
275
298
  } from "./accessors/PositionNode.js";
276
299
  export { default as ReferenceNode, reference, referenceBuffer } from "./accessors/ReferenceNode.js";
277
300
  export { default as ReflectVectorNode, reflectVector } from "./accessors/ReflectVectorNode.js";
301
+ export { default as RendererReferenceNode, rendererReference } from "./accessors/RendererReferenceNode.js";
278
302
  export { default as SkinningNode, skinning } from "./accessors/SkinningNode.js";
279
303
  export { default as StorageBufferNode, storage, storageObject } from "./accessors/StorageBufferNode.js";
280
304
  export {
@@ -348,10 +372,10 @@ export { default as ViewportTextureNode, viewportMipTexture, viewportTexture } f
348
372
  export { default as PassNode, depthPass, pass, PassNodeScope } from "./display/PassNode.js";
349
373
 
350
374
  // code
351
- export { code, CodeNodeInclude, default as CodeNode } from "./code/CodeNode.js";
375
+ export { code, CodeNodeInclude, default as CodeNode, glsl, js, wgsl } from "./code/CodeNode.js";
352
376
  export { default as ExpressionNode, expression } from "./code/ExpressionNode.js";
353
377
  export { call, default as FunctionCallNode } from "./code/FunctionCallNode.js";
354
- export { default as FunctionNode, Fn, fn, func, FunctionNodeArguments } from "./code/FunctionNode.js";
378
+ export { default as FunctionNode, Fn, FunctionNodeArguments, glslFn, wgslFn } from "./code/FunctionNode.js";
355
379
 
356
380
  // fog
357
381
  export { default as FogExp2Node, densityFog } from "./fog/FogExp2Node.js";
@@ -369,12 +393,16 @@ export { default as AnalyticLightNode } from "./lighting/AnalyticLightNode.js";
369
393
  export { default as AONode } from "./lighting/AONode.js";
370
394
  export { default as EnvironmentNode } from "./lighting/EnvironmentNode.js";
371
395
  export { default as HemisphereLightNode } from "./lighting/HemisphereLightNode.js";
396
+ export { default as IrradianceNode } from "./lighting/IrradianceNode.js";
372
397
  export { default as LightingContextNode, lightingContext } from "./lighting/LightingContextNode.js";
373
398
  export { default as LightingNode } from "./lighting/LightingNode.js";
374
399
  export { default as LightsNode, lights } from "./lighting/LightsNode.js";
375
400
  export { default as PointLightNode } from "./lighting/PointLightNode.js";
376
401
  export { default as SpotLightNode } from "./lighting/SpotLightNode.js";
377
402
 
403
+ // pmrem
404
+ export { default as PMREMNode, pmremTexture } from "./pmrem/PMREMNode.js";
405
+
378
406
  // procedural
379
407
  export { checker, default as CheckerNode } from "./procedural/CheckerNode.js";
380
408
 
@@ -5,3 +5,5 @@ export const TBNViewMatrix: ShaderNodeObject<Node>;
5
5
 
6
6
  export const parallaxDirection: ShaderNodeObject<Node>;
7
7
  export const parallaxUV: (uv: ShaderNodeObject<Node>, scale: NodeRepresentation) => ShaderNodeObject<Node>;
8
+
9
+ export const transformedBentNormalView: ShaderNodeObject<Node>;
@@ -0,0 +1,14 @@
1
+ import { BatchedMesh } from "three";
2
+ import Node from "../core/Node.js";
3
+ import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
+
5
+ export default class BatchNode extends Node {
6
+ batchMesh: BatchedMesh;
7
+
8
+ instanceColorNode: Node | null;
9
+ batchingIdNode: Node | null;
10
+
11
+ constructor(batchMesh: BatchedMesh);
12
+ }
13
+
14
+ export const batch: (batchMesh: BatchedMesh) => ShaderNodeObject<BatchNode>;
@@ -4,7 +4,8 @@ import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
4
 
5
5
  export default class InstanceNode extends Node {
6
6
  instanceMesh: InstancedMesh;
7
- instanceMatrixNode: Node;
7
+ instanceMatrixNode: Node | null;
8
+ instanceColorNode: Node | null;
8
9
 
9
10
  constructor(instanceMesh: InstancedMesh);
10
11
  }
@@ -1,23 +1,79 @@
1
+ import { Vector2 } from "three";
1
2
  import Node from "../core/Node.js";
3
+ import UniformNode from "../core/UniformNode.js";
2
4
  import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
3
5
 
4
6
  export type MaterialNodeScope =
5
7
  | typeof MaterialNode.ALPHA_TEST
6
8
  | typeof MaterialNode.COLOR
7
9
  | typeof MaterialNode.OPACITY
10
+ | typeof MaterialNode.SHININESS
11
+ | typeof MaterialNode.SPECULAR
12
+ | typeof MaterialNode.SPECULAR_STRENGTH
13
+ | typeof MaterialNode.SPECULAR_INTENSITY
14
+ | typeof MaterialNode.SPECULAR_COLOR
15
+ | typeof MaterialNode.REFLECTIVITY
8
16
  | typeof MaterialNode.ROUGHNESS
9
17
  | typeof MaterialNode.METALNESS
18
+ | typeof MaterialNode.NORMAL
19
+ | typeof MaterialNode.CLEARCOAT
20
+ | typeof MaterialNode.CLEARCOAT_ROUGHNESS
21
+ | typeof MaterialNode.CLEARCOAT_NORMAL
10
22
  | typeof MaterialNode.EMISSIVE
11
- | typeof MaterialNode.ROTATION;
23
+ | typeof MaterialNode.ROTATION
24
+ | typeof MaterialNode.SHEEN
25
+ | typeof MaterialNode.SHEEN_ROUGHNESS
26
+ | typeof MaterialNode.ANISOTROPY
27
+ | typeof MaterialNode.IRIDESCENCE
28
+ | typeof MaterialNode.IRIDESCENCE_IOR
29
+ | typeof MaterialNode.IRIDESCENCE_THICKNESS
30
+ | typeof MaterialNode.IOR
31
+ | typeof MaterialNode.TRANSMISSION
32
+ | typeof MaterialNode.THICKNESS
33
+ | typeof MaterialNode.ATTENUATION_DISTANCE
34
+ | typeof MaterialNode.ATTENUATION_COLOR
35
+ | typeof MaterialNode.LINE_SCALE
36
+ | typeof MaterialNode.LINE_DASH_SIZE
37
+ | typeof MaterialNode.LINE_GAP_SIZE
38
+ | typeof MaterialNode.LINE_WIDTH
39
+ | typeof MaterialNode.LINE_DASH_OFFSET
40
+ | typeof MaterialNode.POINT_WIDTH;
12
41
 
13
42
  export default class MaterialNode extends Node {
14
43
  static ALPHA_TEST: "alphaTest";
15
44
  static COLOR: "color";
16
45
  static OPACITY: "opacity";
46
+ static SHININESS: "shininess";
47
+ static SPECULAR: "specular";
48
+ static SPECULAR_STRENGTH: "specularStrength";
49
+ static SPECULAR_INTENSITY: "specularIntensity";
50
+ static SPECULAR_COLOR: "specularColor";
51
+ static REFLECTIVITY: "reflectivity";
17
52
  static ROUGHNESS: "roughness";
18
53
  static METALNESS: "metalness";
54
+ static NORMAL: "normal";
55
+ static CLEARCOAT: "clearcoat";
56
+ static CLEARCOAT_ROUGHNESS: "clearcoatRoughness";
57
+ static CLEARCOAT_NORMAL: "clearcoatNormal";
19
58
  static EMISSIVE: "emissive";
20
59
  static ROTATION: "rotation";
60
+ static SHEEN: "sheen";
61
+ static SHEEN_ROUGHNESS: "sheenRoughness";
62
+ static ANISOTROPY: "anisotropy";
63
+ static IRIDESCENCE: "iridescence";
64
+ static IRIDESCENCE_IOR: "iridescenceIOR";
65
+ static IRIDESCENCE_THICKNESS: "iridescenceThickness";
66
+ static IOR: "ior";
67
+ static TRANSMISSION: "transmission";
68
+ static THICKNESS: "thickness";
69
+ static ATTENUATION_DISTANCE: "attenuationDistance";
70
+ static ATTENUATION_COLOR: "attenuationColor";
71
+ static LINE_SCALE: "scale";
72
+ static LINE_DASH_SIZE: "dashSize";
73
+ static LINE_GAP_SIZE: "gapSize";
74
+ static LINE_WIDTH: "linewidth";
75
+ static LINE_DASH_OFFSET: "dashOffset";
76
+ static POINT_WIDTH: "pointWidth";
21
77
 
22
78
  scope: MaterialNodeScope;
23
79
  constructor(scope?: MaterialNodeScope);
@@ -28,8 +84,35 @@ export const materialColor: ShaderNodeObject<MaterialNode>;
28
84
  export const materialShininess: ShaderNodeObject<MaterialNode>;
29
85
  export const materialEmissive: ShaderNodeObject<MaterialNode>;
30
86
  export const materialOpacity: ShaderNodeObject<MaterialNode>;
87
+ export const materialSpecular: ShaderNodeObject<MaterialNode>;
88
+
89
+ export const materialSpecularIntensity: ShaderNodeObject<MaterialNode>;
31
90
  export const materialSpecularColor: ShaderNodeObject<MaterialNode>;
91
+
92
+ export const materialSpecularStrength: ShaderNodeObject<MaterialNode>;
32
93
  export const materialReflectivity: ShaderNodeObject<MaterialNode>;
33
94
  export const materialRoughness: ShaderNodeObject<MaterialNode>;
34
95
  export const materialMetalness: ShaderNodeObject<MaterialNode>;
96
+ export const materialNormal: ShaderNodeObject<MaterialNode>;
97
+ export const materialClearcoat: ShaderNodeObject<MaterialNode>;
98
+ export const materialClearcoatRoughness: ShaderNodeObject<MaterialNode>;
99
+ export const materialClearcoatNormal: ShaderNodeObject<MaterialNode>;
35
100
  export const materialRotation: ShaderNodeObject<MaterialNode>;
101
+ export const materialSheen: ShaderNodeObject<MaterialNode>;
102
+ export const materialSheenRoughness: ShaderNodeObject<MaterialNode>;
103
+ export const materialAnisotropy: ShaderNodeObject<MaterialNode>;
104
+ export const materialIridescence: ShaderNodeObject<MaterialNode>;
105
+ export const materialIridescenceIOR: ShaderNodeObject<MaterialNode>;
106
+ export const materialIridescenceThickness: ShaderNodeObject<MaterialNode>;
107
+ export const materialTransmission: ShaderNodeObject<MaterialNode>;
108
+ export const materialThickness: ShaderNodeObject<MaterialNode>;
109
+ export const materialIOR: ShaderNodeObject<MaterialNode>;
110
+ export const materialAttenuationDistance: ShaderNodeObject<MaterialNode>;
111
+ export const materialAttenuationColor: ShaderNodeObject<MaterialNode>;
112
+ export const materialLineScale: ShaderNodeObject<MaterialNode>;
113
+ export const materialLineDashSize: ShaderNodeObject<MaterialNode>;
114
+ export const materialLineGapSize: ShaderNodeObject<MaterialNode>;
115
+ export const materialLineWidth: ShaderNodeObject<MaterialNode>;
116
+ export const materialLineDashOffset: ShaderNodeObject<MaterialNode>;
117
+ export const materialPointWidth: ShaderNodeObject<MaterialNode>;
118
+ export const materialAnisotropyVector: ShaderNodeObject<UniformNode<Vector2>>;
@@ -0,0 +1,16 @@
1
+ import Renderer from "../../renderers/common/Renderer.js";
2
+ import { NodeTypeOption } from "../core/constants.js";
3
+ import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
4
+ import ReferenceNode from "./ReferenceNode.js";
5
+
6
+ export default class RendererReferenceNode extends ReferenceNode<Renderer> {
7
+ renderer: Renderer | null;
8
+
9
+ constructor(property: string, inputType: NodeTypeOption, renderer?: Renderer | null);
10
+ }
11
+
12
+ export const rendererReference: (
13
+ name: string,
14
+ type: NodeTypeOption,
15
+ renderer?: Renderer | null,
16
+ ) => ShaderNodeObject<RendererReferenceNode>;
@@ -4,15 +4,25 @@ import UniformNode from "../core/UniformNode.js";
4
4
  import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
5
5
 
6
6
  export default class TextureNode extends UniformNode<Texture> {
7
- isTextureNode: true;
7
+ readonly isTextureNode: true;
8
8
 
9
9
  uvNode: ShaderNodeObject<Node> | null;
10
10
  levelNode: ShaderNodeObject<Node> | null;
11
+ compareNode: Node | null;
12
+ depthNode: Node | null;
13
+ gradNode: Node | null;
14
+
15
+ sampler: boolean;
16
+ updateMatrix: boolean;
17
+
18
+ referenceNode: Node | null;
11
19
 
12
20
  constructor(value: Texture, uvNode?: ShaderNodeObject<Node>, levelNode?: ShaderNodeObject<Node> | null);
13
21
 
14
22
  getDefaultUV(): Node;
15
23
 
24
+ grad(gradeNodeX: NodeRepresentation, gradeNodeY: NodeRepresentation): ShaderNodeObject<Node>;
25
+
16
26
  clone(): this;
17
27
  }
18
28
 
@@ -10,10 +10,15 @@ export interface CodeNodeInclude {
10
10
  export default class CodeNode extends Node {
11
11
  isCodeNode: true;
12
12
  code: string;
13
- constructor(code?: string, includes?: CodeNodeInclude[]);
13
+ language: string;
14
+
15
+ constructor(code?: string, includes?: CodeNodeInclude[], language?: string);
14
16
 
15
17
  setIncludes(includes: CodeNodeInclude[]): this;
16
18
  getIncludes(builder: NodeBuilder): CodeNodeInclude[];
17
19
  }
18
20
 
19
- export const code: (code: string, nodeType?: NodeTypeOption) => ShaderNodeObject<CodeNode>;
21
+ export const code: (code: string, includes?: CodeNodeInclude[], language?: string) => ShaderNodeObject<CodeNode>;
22
+ export const js: (src: string, includes?: CodeNodeInclude[]) => ShaderNodeObject<CodeNode>;
23
+ export const wgsl: (src: string, includes?: CodeNodeInclude[]) => ShaderNodeObject<CodeNode>;
24
+ export const glsl: (src: string, includes?: CodeNodeInclude[]) => ShaderNodeObject<CodeNode>;
@@ -10,7 +10,7 @@ export type FunctionNodeArguments = Node[] | { [name: string]: Node };
10
10
 
11
11
  export default class FunctionNode<P extends Node[] | { [name: string]: Node }> extends CodeNode {
12
12
  keywords: { [key: string]: Node };
13
- constructor(code?: string, includes?: CodeNodeInclude[]);
13
+ constructor(code?: string, includes?: CodeNodeInclude[], language?: string);
14
14
 
15
15
  getInputs(builder: NodeBuilder): NodeFunctionInput[];
16
16
  getNodeFunction(builder: NodeBuilder): NodeFunction;
@@ -20,13 +20,19 @@ export default class FunctionNode<P extends Node[] | { [name: string]: Node }> e
20
20
  export type Fn<P extends FunctionNodeArguments> = P extends readonly [...unknown[]] ? ProxiedTuple<P>
21
21
  : readonly [ProxiedObject<P>];
22
22
 
23
- export const func: <P extends FunctionNodeArguments>(
23
+ export const nativeFn: <P extends FunctionNodeArguments>(
24
24
  code: string,
25
25
  includes?: CodeNodeInclude[],
26
+ language?: string,
26
27
  // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
27
- ) => { call: (...params: Fn<P>) => ShaderNodeObject<Node> };
28
+ ) => (...params: Fn<P>) => ShaderNodeObject<Node>;
28
29
 
29
- export const fn: <P extends FunctionNodeArguments>(
30
+ export const glslFn: <P extends FunctionNodeArguments>(
31
+ code: string,
32
+ includes?: CodeNodeInclude[],
33
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
34
+ ) => (...params: Fn<P>) => ShaderNodeObject<Node>;
35
+ export const wgslFn: <P extends FunctionNodeArguments>(
30
36
  code: string,
31
37
  includes?: CodeNodeInclude[],
32
38
  // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
@@ -13,6 +13,7 @@ export interface LightingModelDirectInput {
13
13
  lightDirection: Node;
14
14
  lightColor: Node;
15
15
  reflectedLight: LightingModelReflectedLight;
16
+ shadowMask: Node;
16
17
  }
17
18
 
18
19
  export interface LightingModelIndirectInput {
@@ -3,8 +3,6 @@ import NodeBuilder from "./NodeBuilder.js";
3
3
  import NodeFrame from "./NodeFrame.js";
4
4
 
5
5
  export default abstract class Node {
6
- readonly isNode: true;
7
-
8
6
  nodeType: NodeTypeOption | null;
9
7
 
10
8
  updateType: NodeUpdateType;
@@ -12,17 +10,23 @@ export default abstract class Node {
12
10
 
13
11
  uuid: string;
14
12
 
13
+ version: number;
14
+
15
+ readonly isNode: true;
16
+
15
17
  readonly id: number;
16
18
 
17
19
  constructor(nodeType?: NodeTypeOption | null);
18
20
 
21
+ set needsUpdate(value: boolean);
22
+
19
23
  get type(): number;
20
24
 
21
25
  isGlobal(builder: NodeBuilder): boolean;
22
26
 
23
27
  getChildren(): Node[];
24
28
 
25
- getCacheKey(): string;
29
+ getCacheKey(force?: boolean): string;
26
30
 
27
31
  getHash(builder: NodeBuilder): string;
28
32
 
@@ -127,7 +127,7 @@ export default abstract class NodeBuilder {
127
127
  setBuildStage(buildStage: BuildStageOption): void;
128
128
  getBuildStage(): BuildStageOption;
129
129
  abstract buildCode(): void;
130
- build(createMaterial?: boolean): this;
130
+ build(): this;
131
131
  format(snippet: string, fromType: NodeTypeOption, toType: NodeTypeOption): string;
132
132
  getSignature(): string;
133
133
  }
@@ -7,7 +7,7 @@ export interface NodeChild {
7
7
  childNode: Node;
8
8
  }
9
9
 
10
- export function getCacheKey(object: Node): string;
10
+ export function getCacheKey(object: Node, force?: boolean): string;
11
11
  export function getNodeChildren(object: Node): Generator<NodeChild, void>;
12
12
  export function getValueType(value: unknown): string | null;
13
13
  export function getValueFromType(
@@ -0,0 +1,12 @@
1
+ import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
2
+ import Node from "./Node.js";
3
+
4
+ export default class OutputStructNode extends Node {
5
+ members: Node[];
6
+
7
+ readonly isOutputStructNode: true;
8
+
9
+ constructor(...members: Node[]);
10
+ }
11
+
12
+ export const outputStruct: (...members: Node[]) => ShaderNodeObject<OutputStructNode>;