@types/three 0.175.0 → 0.177.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 (84) hide show
  1. three/README.md +2 -2
  2. three/examples/jsm/Addons.d.ts +0 -1
  3. three/examples/jsm/helpers/RapierHelper.d.ts +13 -0
  4. three/examples/jsm/loaders/LDrawLoader.d.ts +8 -3
  5. three/examples/jsm/loaders/LottieLoader.d.ts +4 -0
  6. three/examples/jsm/math/Octree.d.ts +3 -0
  7. three/examples/jsm/misc/MD2CharacterComplex.d.ts +1 -1
  8. three/examples/jsm/physics/RapierPhysics.d.ts +12 -0
  9. three/examples/jsm/postprocessing/AfterimagePass.d.ts +13 -10
  10. three/examples/jsm/postprocessing/BokehPass.d.ts +2 -2
  11. three/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  12. three/examples/jsm/tsl/display/hashBlur.d.ts +7 -1
  13. three/examples/jsm/tsl/shadows/TileShadowNode.d.ts +14 -0
  14. three/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +14 -0
  15. three/package.json +4 -3
  16. three/src/Three.Core.d.ts +1 -1
  17. three/src/Three.TSL.d.ts +13 -5
  18. three/src/Three.WebGPU.Nodes.d.ts +1 -0
  19. three/src/Three.WebGPU.d.ts +1 -0
  20. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  21. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  22. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  23. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  24. three/src/audio/AudioListener.d.ts +1 -1
  25. three/src/cameras/ArrayCamera.d.ts +5 -0
  26. three/src/constants.d.ts +16 -15
  27. three/src/core/BufferGeometry.d.ts +5 -1
  28. three/src/core/RenderTarget.d.ts +11 -19
  29. three/src/extras/DataUtils.d.ts +4 -4
  30. three/src/geometries/CapsuleGeometry.d.ts +11 -3
  31. three/src/lights/LightShadow.d.ts +8 -0
  32. three/src/lights/SpotLightShadow.d.ts +2 -0
  33. three/src/lights/webgpu/ProjectorLight.d.ts +17 -0
  34. three/src/materials/Material.d.ts +3 -8
  35. three/src/materials/ShaderMaterial.d.ts +1 -1
  36. three/src/materials/nodes/NodeMaterial.d.ts +12 -2
  37. three/src/materials/nodes/SpriteNodeMaterial.d.ts +2 -0
  38. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +12 -0
  39. three/src/math/Box3.d.ts +8 -0
  40. three/src/math/ColorManagement.d.ts +12 -2
  41. three/src/math/FrustumArray.d.ts +27 -0
  42. three/src/math/Sphere.d.ts +8 -0
  43. three/src/math/Triangle.d.ts +3 -3
  44. three/src/nodes/Nodes.d.ts +1 -0
  45. three/src/nodes/TSL.d.ts +1 -0
  46. three/src/nodes/accessors/CubeTextureNode.d.ts +12 -1
  47. three/src/nodes/accessors/InstanceNode.d.ts +2 -3
  48. three/src/nodes/accessors/TextureNode.d.ts +11 -6
  49. three/src/nodes/accessors/VertexColorNode.d.ts +1 -1
  50. three/src/nodes/core/AssignNode.d.ts +5 -1
  51. three/src/nodes/core/CacheNode.d.ts +3 -0
  52. three/src/nodes/core/Node.d.ts +11 -7
  53. three/src/nodes/core/NodeUtils.d.ts +4 -0
  54. three/src/nodes/core/NodeVarying.d.ts +11 -1
  55. three/src/nodes/core/StackNode.d.ts +7 -1
  56. three/src/nodes/core/VaryingNode.d.ts +6 -0
  57. three/src/nodes/display/BlendModes.d.ts +4 -0
  58. three/src/nodes/display/ColorSpaceNode.d.ts +2 -12
  59. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +2 -2
  60. three/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  61. three/src/nodes/lighting/ShadowFilterNode.d.ts +28 -0
  62. three/src/nodes/lighting/ShadowNode.d.ts +26 -24
  63. three/src/nodes/lighting/SpotLightNode.d.ts +15 -1
  64. three/src/nodes/math/OperatorNode.d.ts +9 -0
  65. three/src/nodes/tsl/TSLCore.d.ts +45 -32
  66. three/src/nodes/utils/DebugNode.d.ts +2 -1
  67. three/src/nodes/utils/ReflectorNode.d.ts +2 -1
  68. three/src/objects/Mesh.d.ts +8 -0
  69. three/src/objects/Sprite.d.ts +8 -0
  70. three/src/renderers/WebGLRenderer.d.ts +2 -2
  71. three/src/renderers/common/Animation.d.ts +2 -2
  72. three/src/renderers/common/Renderer.d.ts +24 -0
  73. three/src/renderers/common/Textures.d.ts +0 -7
  74. three/src/renderers/common/TimestampQueryPool.d.ts +1 -0
  75. three/src/renderers/common/XRManager.d.ts +55 -1
  76. three/src/renderers/webgpu/WebGPUBackend.d.ts +1 -0
  77. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -0
  78. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +1 -1
  79. three/src/textures/DepthTexture.d.ts +4 -2
  80. three/src/textures/Source.d.ts +20 -16
  81. three/src/textures/Texture.d.ts +76 -2
  82. three/src/textures/VideoFrameTexture.d.ts +1 -1
  83. three/examples/jsm/effects/PeppersGhostEffect.d.ts +0 -10
  84. three/src/core/RenderTargetArray.d.ts +0 -9
@@ -287,7 +287,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
287
287
  blendDst: BlendingDstFactor;
288
288
 
289
289
  /**
290
- * The tranparency of the .blendDst. Default is null.
290
+ * The transparency of the .blendDst. Default is null.
291
291
  * @default null
292
292
  */
293
293
  blendDstAlpha: number | null;
@@ -299,7 +299,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
299
299
  blendEquation: BlendingEquation;
300
300
 
301
301
  /**
302
- * The tranparency of the .blendEquation. Default is null.
302
+ * The transparency of the .blendEquation. Default is null.
303
303
  * @default null
304
304
  */
305
305
  blendEquationAlpha: number | null;
@@ -317,7 +317,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
317
317
  blendSrc: BlendingSrcFactor | BlendingDstFactor;
318
318
 
319
319
  /**
320
- * The tranparency of the .blendSrc. Default is null.
320
+ * The transparency of the .blendSrc. Default is null.
321
321
  * @default null
322
322
  */
323
323
  blendSrcAlpha: number | null;
@@ -628,9 +628,4 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
628
628
  * @default false
629
629
  */
630
630
  set needsUpdate(value: boolean);
631
-
632
- /**
633
- * @deprecated onBuild() has been removed.
634
- */
635
- onBuild(object: Object3D, parameters: WebGLProgramParametersWithUniforms, renderer: WebGLRenderer): void;
636
631
  }
@@ -61,7 +61,7 @@ export interface ShaderMaterialJSON extends MaterialJSON {
61
61
  defines?: Record<string, unknown>;
62
62
 
63
63
  vertexShader: string;
64
- ragmentShader: string;
64
+ fragmentShader: string;
65
65
 
66
66
  lights: boolean;
67
67
  clipping: boolean;
@@ -22,12 +22,14 @@ export interface NodeMaterialParameters extends MaterialParameters {
22
22
  backdropNode?: Node | null | undefined;
23
23
  backdropAlphaNode?: Node | null | undefined;
24
24
  alphaTestNode?: Node | null | undefined;
25
+ maskNode?: Node | null | undefined;
25
26
 
26
27
  positionNode?: Node | null | undefined;
27
28
  geometryNode?: Node | null | undefined;
28
29
 
29
30
  depthNode?: Node | null | undefined;
30
- shadowNode?: Node | null | undefined;
31
+ receivedShadowPositionNode?: Node | null | undefined;
32
+ castShadowPositionNode?: Node | null | undefined;
31
33
 
32
34
  outputNode?: Node | null | undefined;
33
35
 
@@ -54,12 +56,14 @@ declare class NodeMaterial extends Material {
54
56
  backdropNode: Node | null;
55
57
  backdropAlphaNode: Node | null;
56
58
  alphaTestNode: Node | null;
59
+ maskNode: Node | null;
57
60
 
58
61
  positionNode: Node | null;
59
62
  geometryNode: Node | null;
60
63
 
61
64
  depthNode: Node | null;
62
- shadowPositionNode: Node | null;
65
+ receivedShadowPositionNode: Node | null;
66
+ castShadowPositionNode: Node | null;
63
67
  receivedShadowNode: (() => Node) | null;
64
68
  castShadowNode: Node | null;
65
69
 
@@ -69,6 +73,12 @@ declare class NodeMaterial extends Material {
69
73
  fragmentNode: Node | null;
70
74
  vertexNode: Node | null;
71
75
 
76
+ /**
77
+ * @deprecated ".shadowPositionNode" was renamed to ".receivedShadowPositionNode".'
78
+ */
79
+ get shadowPositionNode(): Node | null;
80
+ set shadowPositionNode(value: Node | null);
81
+
72
82
  constructor();
73
83
 
74
84
  build(builder: NodeBuilder): void;
@@ -5,6 +5,8 @@ import { SpriteMaterialParameters } from "../SpriteMaterial.js";
5
5
  import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";
6
6
 
7
7
  export interface SpriteNodeMaterialParameters extends NodeMaterialParameters, SpriteMaterialParameters {
8
+ rotationNode?: Node | null | undefined;
9
+ scaleNode?: Node | null | undefined;
8
10
  }
9
11
 
10
12
  export default class SpriteNodeMaterial extends NodeMaterial {
@@ -2,6 +2,7 @@ import { BufferAttribute } from "../../../core/BufferAttribute.js";
2
2
  import { Matrix4 } from "../../../math/Matrix4.js";
3
3
  import NodeBuilder from "../../../nodes/core/NodeBuilder.js";
4
4
  import NodeFrame from "../../../nodes/core/NodeFrame.js";
5
+ import Renderer from "../../../renderers/common/Renderer.js";
5
6
  import RenderObject from "../../../renderers/common/RenderObject.js";
6
7
  import { Material } from "../../Material.js";
7
8
  declare const refreshUniforms: readonly [
@@ -11,6 +12,7 @@ declare const refreshUniforms: readonly [
11
12
  "anisotropyMap",
12
13
  "anisotropyRotation",
13
14
  "aoMap",
15
+ "aoMapIntensity",
14
16
  "attenuationColor",
15
17
  "attenuationDistance",
16
18
  "bumpMap",
@@ -23,8 +25,10 @@ declare const refreshUniforms: readonly [
23
25
  "dispersion",
24
26
  "displacementMap",
25
27
  "emissive",
28
+ "emissiveIntensity",
26
29
  "emissiveMap",
27
30
  "envMap",
31
+ "envMapIntensity",
28
32
  "gradientMap",
29
33
  "ior",
30
34
  "iridescence",
@@ -32,6 +36,7 @@ declare const refreshUniforms: readonly [
32
36
  "iridescenceMap",
33
37
  "iridescenceThicknessMap",
34
38
  "lightMap",
39
+ "lightMapIntensity",
35
40
  "map",
36
41
  "matcap",
37
42
  "metalness",
@@ -103,6 +108,13 @@ declare class NodeMaterialObserver {
103
108
  * @return {boolean} Whether the given render object is verified for the first time of this observer.
104
109
  */
105
110
  firstInitialization(renderObject: RenderObject): boolean;
111
+ /**
112
+ * Returns `true` if the current rendering produces motion vectors.
113
+ *
114
+ * @param {Renderer} renderer - The renderer.
115
+ * @return {boolean} Whether the current rendering produces motion vectors or not.
116
+ */
117
+ needsVelocity(renderer: Renderer): boolean;
106
118
  /**
107
119
  * Returns monitoring data for the given render object.
108
120
  *
three/src/math/Box3.d.ts CHANGED
@@ -63,4 +63,12 @@ export class Box3 {
63
63
  * @deprecated Use {@link Box3#intersectsSphere .intersectsSphere()} instead.
64
64
  */
65
65
  isIntersectionSphere(s: any): any;
66
+
67
+ toJSON(): Box3JSON;
68
+ fromJSON(json: Box3JSON): this;
69
+ }
70
+
71
+ export interface Box3JSON {
72
+ min: number[];
73
+ max: number[];
66
74
  }
@@ -29,9 +29,9 @@ export interface ColorManagement {
29
29
 
30
30
  convert: (color: Color, sourceColorSpace: string, targetColorSpace: string) => Color;
31
31
 
32
- fromWorkingColorSpace: (color: Color, targetColorSpace: string) => Color;
32
+ workingToColorSpace: (color: Color, targetColorSpace: string) => Color;
33
33
 
34
- toWorkingColorSpace: (color: Color, sourceColorSpace: string) => Color;
34
+ colorSpaceToWorking: (color: Color, sourceColorSpace: string) => Color;
35
35
 
36
36
  getPrimaries: (colorSpace: string) => [number, number, number, number, number, number];
37
37
 
@@ -40,6 +40,16 @@ export interface ColorManagement {
40
40
  getLuminanceCoefficients: (target: Vector3, colorSpace?: string) => [number, number, number];
41
41
 
42
42
  define: (colorSpaces: Record<string, ColorSpaceDefinition>) => void;
43
+
44
+ /**
45
+ * @deprecated .fromWorkingColorSpace() has been renamed to .workingToColorSpace().
46
+ */
47
+ fromWorkingColorSpace: (color: Color, targetColorSpace: string) => Color;
48
+
49
+ /**
50
+ * @deprecated .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().
51
+ */
52
+ toWorkingColorSpace: (color: Color, sourceColorSpace: string) => Color;
43
53
  }
44
54
 
45
55
  export const ColorManagement: ColorManagement;
@@ -0,0 +1,27 @@
1
+ import { ArrayCamera } from "../cameras/ArrayCamera.js";
2
+ import { CoordinateSystem } from "../constants.js";
3
+ import { Object3D } from "../core/Object3D.js";
4
+ import { Sprite } from "../objects/Sprite.js";
5
+ import { Box3 } from "./Box3.js";
6
+ import { Sphere } from "./Sphere.js";
7
+ import { Vector3 } from "./Vector3.js";
8
+
9
+ declare class FrustumArray {
10
+ coordinateSystem: CoordinateSystem;
11
+
12
+ constructor();
13
+
14
+ intersectsObject(object: Object3D, cameraArray: ArrayCamera): boolean;
15
+
16
+ intersectsSprite(sprite: Sprite, cameraArray: ArrayCamera): boolean;
17
+
18
+ intersectsSprite(sphere: Sphere, cameraArray: ArrayCamera): boolean;
19
+
20
+ intersectsBox(box: Box3, cameraArray: ArrayCamera): boolean;
21
+
22
+ containsPoint(point: Vector3, cameraArray: ArrayCamera): boolean;
23
+
24
+ clone(): FrustumArray;
25
+ }
26
+
27
+ export { FrustumArray };
@@ -44,4 +44,12 @@ export class Sphere {
44
44
  * @deprecated Use {@link Sphere#isEmpty .isEmpty()} instead.
45
45
  */
46
46
  empty(): any;
47
+
48
+ toJSON(): SphereJSON;
49
+ fromJSON(json: SphereJSON): this;
50
+ }
51
+
52
+ export interface SphereJSON {
53
+ radius: number;
54
+ center: number[];
47
55
  }
@@ -83,7 +83,7 @@ export class Triangle {
83
83
  target: Vector4,
84
84
  ): Vector4 | null;
85
85
  static getInterpolatedAttribute(
86
- attr: BufferAttribute,
86
+ attr: BufferAttribute | InterleavedBufferAttribute,
87
87
  i1: number,
88
88
  i2: number,
89
89
  i3: number,
@@ -91,7 +91,7 @@ export class Triangle {
91
91
  target: Vector2,
92
92
  ): Vector2;
93
93
  static getInterpolatedAttribute(
94
- attr: BufferAttribute,
94
+ attr: BufferAttribute | InterleavedBufferAttribute,
95
95
  i1: number,
96
96
  i2: number,
97
97
  i3: number,
@@ -99,7 +99,7 @@ export class Triangle {
99
99
  target: Vector3,
100
100
  ): Vector3;
101
101
  static getInterpolatedAttribute(
102
- attr: BufferAttribute,
102
+ attr: BufferAttribute | InterleavedBufferAttribute,
103
103
  i1: number,
104
104
  i2: number,
105
105
  i3: number,
@@ -139,6 +139,7 @@ export { default as LightingNode } from "./lighting/LightingNode.js";
139
139
  export { default as LightProbeNode } from "./lighting/LightProbeNode.js";
140
140
  export { default as LightsNode } from "./lighting/LightsNode.js";
141
141
  export { default as PointLightNode } from "./lighting/PointLightNode.js";
142
+ export { default as ProjectorLightNode } from "./lighting/ProjectorLightNode.js";
142
143
  export { default as RectAreaLightNode, RectAreaLightTexturesLib } from "./lighting/RectAreaLightNode.js";
143
144
  export { default as ShadowBaseNode } from "./lighting/ShadowBaseNode.js";
144
145
  export { default as ShadowNode } from "./lighting/ShadowNode.js";
three/src/nodes/TSL.d.ts CHANGED
@@ -135,6 +135,7 @@ export * from "./lighting/LightsNode.js";
135
135
  export * from "./lighting/PointLightNode.js";
136
136
  export * from "./lighting/PointShadowNode.js";
137
137
  export * from "./lighting/ShadowBaseNode.js";
138
+ export * from "./lighting/ShadowFilterNode.js";
138
139
  export * from "./lighting/ShadowNode.js";
139
140
 
140
141
  // pmrem
@@ -20,9 +20,20 @@ declare class CubeTextureNode extends TextureNode {
20
20
 
21
21
  export default CubeTextureNode;
22
22
 
23
- export const cubeTexture: (
23
+ export const cubeTextureBase: (
24
24
  value: CubeTexture,
25
25
  uvNode?: NodeRepresentation,
26
26
  levelNode?: NodeRepresentation,
27
27
  biasNode?: NodeRepresentation,
28
28
  ) => ShaderNodeObject<CubeTextureNode>;
29
+
30
+ export const cubeTexture: (
31
+ value?: CubeTexture,
32
+ uvNode?: NodeRepresentation | null,
33
+ levelNode?: NodeRepresentation | null,
34
+ biasNode?: NodeRepresentation | null,
35
+ ) => ShaderNodeObject<CubeTextureNode>;
36
+
37
+ export const uniformCubeTexture: (
38
+ value?: CubeTexture,
39
+ ) => ShaderNodeObject<CubeTextureNode>;
@@ -1,5 +1,4 @@
1
1
  import { InstancedBufferAttribute } from "../../core/InstancedBufferAttribute.js";
2
- import { InstancedMesh } from "../../objects/InstancedMesh.js";
3
2
  import Node from "../core/Node.js";
4
3
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
5
4
 
@@ -14,12 +13,12 @@ export default class InstanceNode extends Node {
14
13
  constructor(
15
14
  count: number,
16
15
  instanceMatrix: InstancedBufferAttribute,
17
- instanceColor: InstancedBufferAttribute | null,
16
+ instanceColor?: InstancedBufferAttribute | null,
18
17
  );
19
18
  }
20
19
 
21
20
  export const instance: (
22
21
  count: number,
23
22
  instanceMatrix: InstancedBufferAttribute,
24
- instanceColor: InstancedBufferAttribute | null,
23
+ instanceColor?: InstancedBufferAttribute | null,
25
24
  ) => ShaderNodeObject<InstanceNode>;
@@ -19,7 +19,7 @@ export default class TextureNode extends UniformNode<Texture> {
19
19
  referenceNode: Node | null;
20
20
 
21
21
  constructor(
22
- value: Texture,
22
+ value?: Texture,
23
23
  uvNode?: ShaderNodeObject<Node> | null,
24
24
  levelNode?: ShaderNodeObject<Node> | null,
25
25
  biasNode?: ShaderNodeObject<Node> | null,
@@ -56,13 +56,18 @@ export default class TextureNode extends UniformNode<Texture> {
56
56
  }
57
57
 
58
58
  export const texture: (
59
- value: Texture,
60
- uvNode?: NodeRepresentation,
61
- levelNode?: NodeRepresentation,
62
- biasNode?: NodeRepresentation,
59
+ value?: Texture,
60
+ uvNode?: NodeRepresentation | null,
61
+ levelNode?: NodeRepresentation | null,
62
+ biasNode?: NodeRepresentation | null,
63
63
  ) => ShaderNodeObject<TextureNode>;
64
+
65
+ export const uniformTexture: (
66
+ value?: Texture,
67
+ ) => ShaderNodeObject<TextureNode>;
68
+
64
69
  export const textureLoad: (
65
- value: Texture,
70
+ value?: Texture,
66
71
  uvNode?: NodeRepresentation,
67
72
  levelNode?: NodeRepresentation,
68
73
  biasNode?: NodeRepresentation,
@@ -6,7 +6,7 @@ export default class VertexColorNode extends AttributeNode {
6
6
 
7
7
  index: number;
8
8
 
9
- constructor(index?: number);
9
+ constructor(index: number);
10
10
  }
11
11
 
12
12
  export const vertexColor: (index?: number) => ShaderNodeObject<VertexColorNode>;
@@ -3,12 +3,16 @@ import Node from "./Node.js";
3
3
  import NodeBuilder from "./NodeBuilder.js";
4
4
  import TempNode from "./TempNode.js";
5
5
 
6
- export default class AssignNode extends TempNode {
6
+ declare class AssignNode extends TempNode {
7
+ readonly isAssignNode: true;
8
+
7
9
  constructor(targetNode: Node, sourceNode: Node);
8
10
 
9
11
  needsSplitAssign(builder: NodeBuilder): boolean;
10
12
  }
11
13
 
14
+ export default AssignNode;
15
+
12
16
  export const assign: (targetNode: NodeRepresentation, sourceNode: NodeRepresentation) => ShaderNodeObject<AssignNode>;
13
17
 
14
18
  declare module "../tsl/TSLCore.js" {
@@ -1,4 +1,5 @@
1
1
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import ContextNode from "./ContextNode.js";
2
3
  import Node from "./Node.js";
3
4
  import NodeCache from "./NodeCache.js";
4
5
 
@@ -13,6 +14,8 @@ export default class CacheNode extends Node {
13
14
 
14
15
  export const cache: (node: Node, cache?: NodeCache) => ShaderNodeObject<CacheNode>;
15
16
 
17
+ export const namespace: (node: Node, namespace: string) => ShaderNodeObject<ContextNode>;
18
+
16
19
  declare module "../tsl/TSLCore.js" {
17
20
  interface NodeElements {
18
21
  cache: typeof cache;
@@ -75,6 +75,7 @@ declare class Node extends EventDispatcher<{
75
75
  _cacheKey: number | null;
76
76
  _cacheKeyVersion: number;
77
77
  global: boolean;
78
+ parents: boolean;
78
79
  readonly isNode: true;
79
80
  readonly id: number;
80
81
  self?: this;
@@ -156,7 +157,7 @@ declare class Node extends EventDispatcher<{
156
157
  /**
157
158
  * By default this method returns the value of the {@link Node#global} flag. This method
158
159
  * can be overwritten in derived classes if an analytical way is required to determine the
159
- * global status.
160
+ * global cache referring to the current shader-stage.
160
161
  *
161
162
  * @param {NodeBuilder} builder - The current node builder.
162
163
  * @return {boolean} Whether this node is global or not.
@@ -280,8 +281,9 @@ declare class Node extends EventDispatcher<{
280
281
  * This stage analyzes the node hierarchy and ensures descendent nodes are built.
281
282
  *
282
283
  * @param {NodeBuilder} builder - The current node builder.
284
+ * @param {?Node} output - The target output node.
283
285
  */
284
- analyze(builder: NodeBuilder): void;
286
+ analyze(builder: NodeBuilder, output?: Node | null): void;
285
287
  /**
286
288
  * Represents the generate stage which is the third step of the build process, see {@link Node#build} method.
287
289
  * This state builds the output node and returns the resulting shader string.
@@ -319,14 +321,16 @@ declare class Node extends EventDispatcher<{
319
321
  */
320
322
  update(frame: NodeFrame): void;
321
323
  /**
322
- * This method performs the build of a node. The behavior of this method as well as its return value depend
323
- * on the current build stage (setup, analyze or generate).
324
+ * This method performs the build of a node. The behavior and return value depend on the current build stage:
325
+ * - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant.
326
+ * - **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`.
327
+ * - **generate**: Generates the shader code for the node. Returns the generated shader string.
324
328
  *
325
329
  * @param {NodeBuilder} builder - The current node builder.
326
- * @param {?string} output - Can be used to define the output type.
327
- * @return {?string} When this method is executed in the setup or analyze stage, `null` is returned. In the generate stage, the generated shader string.
330
+ * @param {string|Node|null} [output=null] - Can be used to define the output type.
331
+ * @return {Node|string|null} The result of the build process, depending on the build stage.
328
332
  */
329
- build(builder: NodeBuilder, output?: string | null): string | null;
333
+ build(builder: NodeBuilder, output?: string | Node | null): Node | string | null;
330
334
  /**
331
335
  * Returns the child nodes as a JSON object.
332
336
  *
@@ -24,6 +24,10 @@ export function getTypeFromLength(length: number): string | undefined;
24
24
 
25
25
  export function getLengthFromType(type: string): number | undefined;
26
26
 
27
+ export function getMemoryLengthFromType(type: string): number | undefined;
28
+
29
+ export function getByteBoundaryFromType(type: string): number | undefined;
30
+
27
31
  export function getValueType(value: unknown): string | null;
28
32
 
29
33
  export function getValueFromType(
@@ -1,3 +1,4 @@
1
+ import { InterpolationSamplingMode, InterpolationSamplingType } from "../../constants.js";
1
2
  import NodeVar from "./NodeVar.js";
2
3
  /**
3
4
  * {@link NodeBuilder} is going to create instances of this class during the build process
@@ -10,12 +11,21 @@ import NodeVar from "./NodeVar.js";
10
11
  declare class NodeVarying extends NodeVar {
11
12
  needsInterpolation: boolean;
12
13
  readonly isNodeVarying: true;
14
+ interpolationType: InterpolationSamplingType | null;
15
+ interpolationSampling: InterpolationSamplingMode | null;
13
16
  /**
14
17
  * Constructs a new node varying.
15
18
  *
16
19
  * @param {string} name - The name of the varying.
17
20
  * @param {string} type - The type of the varying.
21
+ * @param {?string} interpolationType - The interpolation type of the varying.
22
+ * @param {?string} interpolationSampling - The interpolation sampling type of the varying.
18
23
  */
19
- constructor(name: string, type: string | null);
24
+ constructor(
25
+ name: string,
26
+ type: string,
27
+ interpolationType?: InterpolationSamplingType | null,
28
+ interpolationSampling?: InterpolationSamplingMode | null,
29
+ );
20
30
  }
21
31
  export default NodeVarying;
@@ -1,4 +1,4 @@
1
- import { ShaderNodeObject } from "../tsl/TSLCore.js";
1
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
2
  import Node from "./Node.js";
3
3
 
4
4
  declare class StackNode extends Node {
@@ -16,6 +16,12 @@ declare class StackNode extends Node {
16
16
 
17
17
  Else(method: () => void): this;
18
18
 
19
+ Switch(expression: NodeRepresentation): this;
20
+
21
+ Case(...params: NodeRepresentation[]): this;
22
+
23
+ Default(method: () => void): this;
24
+
19
25
  /**
20
26
  * @deprecated Use {@link StackNode#ElseIf Else()} instead.
21
27
  */
@@ -1,3 +1,4 @@
1
+ import { InterpolationSamplingMode, InterpolationSamplingType } from "../../constants.js";
1
2
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
3
  import Node from "./Node.js";
3
4
  import NodeBuilder from "./NodeBuilder.js";
@@ -6,9 +7,14 @@ import NodeVarying from "./NodeVarying.js";
6
7
  export default class VaryingNode extends Node {
7
8
  node: Node;
8
9
  name: string | null;
10
+ readonly isVaryingNode: true;
11
+ interpolationType: InterpolationSamplingType | null;
12
+ interpolationSampling: InterpolationSamplingMode | null;
9
13
 
10
14
  constructor(node: Node, name?: string | null);
11
15
 
16
+ setInterpolation(type: InterpolationSamplingType | null, sampling?: InterpolationSamplingMode | null): this;
17
+
12
18
  setupVarying(builder: NodeBuilder): NodeVarying;
13
19
  }
14
20
 
@@ -11,6 +11,10 @@ export const blendOverlay: (base: NodeRepresentation, blend: NodeRepresentation)
11
11
 
12
12
  export const blendColor: (base: NodeRepresentation, blend: NodeRepresentation) => ShaderNodeObject<Node>;
13
13
 
14
+ export const premult: (color: NodeRepresentation) => ShaderNodeObject<Node>;
15
+
16
+ export const unpremult: (color: NodeRepresentation) => ShaderNodeObject<Node>;
17
+
14
18
  /**
15
19
  * @deprecated
16
20
  */
@@ -27,20 +27,13 @@ export default class ColorSpaceNode extends TempNode {
27
27
  resolveColorSpace(nodeBuilder: NodeBuilder, colorSpace: WorkingOrOutputColorSpace): string;
28
28
  }
29
29
 
30
- export const toOutputColorSpace: (
31
- node: NodeRepresentation,
32
- ) => ShaderNodeObject<ColorSpaceNode>;
33
- export const toWorkingColorSpace: (
34
- node: NodeRepresentation,
35
- ) => ShaderNodeObject<ColorSpaceNode>;
36
-
37
30
  export const workingToColorSpace: (
38
31
  node: NodeRepresentation,
39
- colorSpace: string,
32
+ targetColorSpace: string,
40
33
  ) => ShaderNodeObject<ColorSpaceNode>;
41
34
  export const colorSpaceToWorking: (
42
35
  node: NodeRepresentation,
43
- colorSpace: string,
36
+ sourceColorSpace: string,
44
37
  ) => ShaderNodeObject<ColorSpaceNode>;
45
38
 
46
39
  export const convertColorSpace: (
@@ -51,9 +44,6 @@ export const convertColorSpace: (
51
44
 
52
45
  declare module "../tsl/TSLCore.js" {
53
46
  interface NodeElements {
54
- toOutputColorSpace: typeof toOutputColorSpace;
55
- toWorkingColorSpace: typeof toWorkingColorSpace;
56
-
57
47
  workingToColorSpace: typeof workingToColorSpace;
58
48
  colorSpaceToWorking: typeof colorSpaceToWorking;
59
49
  }
@@ -1,5 +1,4 @@
1
1
  import Node from "../core/Node.js";
2
- import TempNode from "../core/TempNode.js";
3
2
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
4
3
 
5
4
  export type AtomicMethod =
@@ -13,10 +12,11 @@ export type AtomicMethod =
13
12
  | typeof AtomicFunctionNode.ATOMIC_OR
14
13
  | typeof AtomicFunctionNode.ATOMIC_XOR;
15
14
 
16
- declare class AtomicFunctionNode extends TempNode {
15
+ declare class AtomicFunctionNode extends Node {
17
16
  method: AtomicMethod;
18
17
  pointerNode: Node;
19
18
  valueNode: Node;
19
+ parents: boolean;
20
20
 
21
21
  constructor(method: AtomicMethod, pointerNode: Node, valueNode: Node);
22
22
 
@@ -0,0 +1,5 @@
1
+ import SpotLightNode from "./SpotLightNode.js";
2
+
3
+ declare class ProjectorLightNode extends SpotLightNode {}
4
+
5
+ export default ProjectorLightNode;
@@ -0,0 +1,28 @@
1
+ import { Light } from "../../lights/Light.js";
2
+ import NodeMaterial from "../../materials/nodes/NodeMaterial.js";
3
+ import Node from "../core/Node.js";
4
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
5
+
6
+ export const BasicShadowFilter: (
7
+ depthTexture: NodeRepresentation,
8
+ shadowCoord: NodeRepresentation,
9
+ ) => ShaderNodeObject<Node>;
10
+
11
+ export const PCFShadowFilter: (
12
+ depthTexture: NodeRepresentation,
13
+ shadowCoord: NodeRepresentation,
14
+ shadow: NodeRepresentation,
15
+ ) => ShaderNodeObject<Node>;
16
+
17
+ export const PCFSoftShadowFilter: (
18
+ depthTexture: NodeRepresentation,
19
+ shadowCoord: NodeRepresentation,
20
+ shadow: NodeRepresentation,
21
+ ) => ShaderNodeObject<Node>;
22
+
23
+ export const VSMShadowFilter: (
24
+ depthTexture: NodeRepresentation,
25
+ shadowCoord: NodeRepresentation,
26
+ ) => ShaderNodeObject<Node>;
27
+
28
+ export const getShadowMaterial: (light: Light) => NodeMaterial;