@types/three 0.169.0 → 0.170.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 (147) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +3 -3
  3. three/examples/jsm/animation/MMDAnimationHelper.d.ts +4 -0
  4. three/examples/jsm/animation/MMDPhysics.d.ts +4 -0
  5. three/examples/jsm/controls/ArcballControls.d.ts +1 -1
  6. three/examples/jsm/controls/TransformControls.d.ts +44 -0
  7. three/examples/jsm/csm/CSMFrustum.d.ts +8 -2
  8. three/examples/jsm/csm/CSMHelper.d.ts +2 -1
  9. three/examples/jsm/csm/CSMShadowNode.d.ts +46 -0
  10. three/examples/jsm/curves/NURBSCurve.d.ts +12 -1
  11. three/examples/jsm/exporters/GLTFExporter.d.ts +20 -3
  12. three/examples/jsm/exporters/MMDExporter.d.ts +4 -0
  13. three/examples/jsm/exporters/USDZExporter.d.ts +4 -0
  14. three/examples/jsm/geometries/DecalGeometry.d.ts +9 -3
  15. three/examples/jsm/geometries/TeapotGeometry.d.ts +2 -2
  16. three/examples/jsm/helpers/TextureHelperGPU.d.ts +10 -0
  17. three/examples/jsm/lighting/TiledLighting.d.ts +10 -0
  18. three/examples/jsm/lines/Wireframe.d.ts +5 -2
  19. three/examples/jsm/lines/WireframeGeometry2.d.ts +1 -1
  20. three/examples/jsm/lines/webgpu/Wireframe.d.ts +13 -0
  21. three/examples/jsm/loaders/EXRLoader.d.ts +2 -2
  22. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -2
  23. three/examples/jsm/loaders/KTX2Loader.d.ts +1 -0
  24. three/examples/jsm/loaders/LDrawLoader.d.ts +10 -0
  25. three/examples/jsm/loaders/MMDLoader.d.ts +4 -0
  26. three/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts +9 -0
  27. three/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +9 -0
  28. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +0 -1
  29. three/examples/jsm/math/ColorSpaces.d.ts +11 -0
  30. three/examples/jsm/misc/ProgressiveLightMap.d.ts +8 -10
  31. three/examples/jsm/misc/ProgressiveLightMapGPU.d.ts +27 -0
  32. three/examples/jsm/renderers/SVGRenderer.d.ts +2 -2
  33. three/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.d.ts +1 -5
  34. three/{src/nodes → examples/jsm/tsl}/display/AnaglyphPassNode.d.ts +2 -3
  35. three/{src/nodes → examples/jsm/tsl}/display/AnamorphicNode.d.ts +2 -4
  36. three/examples/jsm/tsl/display/BleachBypass.d.ts +3 -0
  37. three/{src/nodes → examples/jsm/tsl}/display/BloomNode.d.ts +1 -5
  38. three/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.d.ts +2 -6
  39. three/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.d.ts +1 -5
  40. three/{src/nodes → examples/jsm/tsl}/display/DotScreenNode.d.ts +2 -5
  41. three/{src/nodes → examples/jsm/tsl}/display/FXAANode.d.ts +1 -3
  42. three/{src/nodes → examples/jsm/tsl}/display/FilmNode.d.ts +1 -3
  43. three/{src/nodes → examples/jsm/tsl}/display/GTAONode.d.ts +2 -8
  44. three/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.d.ts +13 -5
  45. three/examples/jsm/tsl/display/LensflareNode.d.ts +35 -0
  46. three/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.d.ts +2 -6
  47. three/{src/nodes → examples/jsm/tsl}/display/MotionBlur.d.ts +1 -2
  48. three/examples/jsm/tsl/display/OutlineNode.d.ts +32 -0
  49. three/{src/nodes → examples/jsm/tsl}/display/ParallaxBarrierPassNode.d.ts +2 -3
  50. three/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.d.ts +2 -5
  51. three/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.d.ts +1 -4
  52. three/examples/jsm/tsl/display/SMAANode.d.ts +17 -0
  53. three/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.d.ts +2 -7
  54. three/examples/jsm/tsl/display/SSRNode.d.ts +38 -0
  55. three/examples/jsm/tsl/display/Sepia.d.ts +3 -0
  56. three/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.d.ts +1 -3
  57. three/{src/nodes → examples/jsm/tsl}/display/StereoCompositePassNode.d.ts +2 -5
  58. three/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.d.ts +2 -5
  59. three/examples/jsm/tsl/display/TRAAPassNode.d.ts +15 -0
  60. three/{src/nodes → examples/jsm/tsl}/display/TransitionNode.d.ts +1 -5
  61. three/examples/jsm/tsl/display/hashBlur.d.ts +7 -0
  62. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +22 -0
  63. three/package.json +4 -3
  64. three/src/Three.WebGPU.Nodes.d.ts +5 -1
  65. three/src/Three.WebGPU.d.ts +5 -1
  66. three/src/Three.d.ts +2 -7
  67. three/src/constants.d.ts +1 -9
  68. three/src/core/BufferGeometry.d.ts +13 -2
  69. three/src/core/RenderTarget.d.ts +1 -2
  70. three/src/loaders/FileLoader.d.ts +3 -3
  71. three/src/materials/LineBasicMaterial.d.ts +0 -5
  72. three/src/materials/LineDashedMaterial.d.ts +0 -5
  73. three/src/materials/Material.d.ts +4 -6
  74. three/src/materials/MeshBasicMaterial.d.ts +0 -5
  75. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  76. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  77. three/src/materials/MeshLambertMaterial.d.ts +0 -5
  78. three/src/materials/MeshMatcapMaterial.d.ts +0 -5
  79. three/src/materials/MeshNormalMaterial.d.ts +0 -5
  80. three/src/materials/MeshPhongMaterial.d.ts +0 -5
  81. three/src/materials/MeshPhysicalMaterial.d.ts +0 -5
  82. three/src/materials/MeshStandardMaterial.d.ts +0 -5
  83. three/src/materials/MeshToonMaterial.d.ts +0 -5
  84. three/src/materials/PointsMaterial.d.ts +0 -5
  85. three/src/materials/RawShaderMaterial.d.ts +0 -2
  86. three/src/materials/ShaderMaterial.d.ts +0 -5
  87. three/src/materials/ShadowMaterial.d.ts +0 -5
  88. three/src/materials/SpriteMaterial.d.ts +0 -5
  89. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +2 -2
  90. three/src/materials/nodes/NodeMaterial.d.ts +2 -0
  91. three/src/materials/nodes/NodeMaterials.d.ts +19 -16
  92. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +15 -0
  93. three/src/math/Color.d.ts +39 -22
  94. three/src/math/ColorManagement.d.ts +24 -24
  95. three/src/math/Vector4.d.ts +2 -0
  96. three/src/nodes/Nodes.d.ts +1 -21
  97. three/src/nodes/TSL.d.ts +6 -24
  98. three/src/nodes/accessors/Camera.d.ts +0 -1
  99. three/src/nodes/accessors/SceneNode.d.ts +2 -0
  100. three/src/nodes/accessors/UniformArrayNode.d.ts +2 -2
  101. three/src/nodes/accessors/VelocityNode.d.ts +4 -0
  102. three/src/nodes/code/ScriptableNode.d.ts +1 -1
  103. three/src/nodes/core/StackNode.d.ts +4 -4
  104. three/src/nodes/core/VarNode.d.ts +12 -1
  105. three/src/nodes/display/ColorAdjustment.d.ts +29 -0
  106. three/src/nodes/display/ColorSpaceFunctions.d.ts +2 -2
  107. three/src/nodes/display/ColorSpaceNode.d.ts +14 -8
  108. three/src/nodes/display/RenderOutputNode.d.ts +4 -4
  109. three/src/nodes/display/ViewportDepthNode.d.ts +2 -0
  110. three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +6 -0
  111. three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +10 -0
  112. three/src/nodes/gpgpu/ComputeNode.d.ts +5 -0
  113. three/src/nodes/lighting/LightsNode.d.ts +7 -2
  114. three/src/nodes/lighting/PointLightNode.d.ts +11 -1
  115. three/src/nodes/lighting/ShadowNode.d.ts +12 -0
  116. three/src/nodes/utils/Discard.d.ts +1 -1
  117. three/src/nodes/utils/Oscillators.d.ts +7 -0
  118. three/src/nodes/utils/PostProcessingUtils.d.ts +45 -0
  119. three/src/nodes/utils/ReflectorNode.d.ts +17 -4
  120. three/src/nodes/utils/Timer.d.ts +21 -0
  121. three/src/objects/BatchedMesh.d.ts +47 -2
  122. three/src/renderers/WebGLRenderer.d.ts +22 -11
  123. three/src/renderers/common/Constants.d.ts +2 -1
  124. three/src/renderers/common/Geometries.d.ts +1 -0
  125. three/src/renderers/common/IndirectStorageBufferAttribute.d.ts +10 -0
  126. three/src/renderers/common/Lighting.d.ts +15 -0
  127. three/src/renderers/common/PostProcessingUtils.d.ts +66 -0
  128. three/src/renderers/common/RenderList.d.ts +5 -2
  129. three/src/renderers/common/RenderLists.d.ts +3 -1
  130. three/src/renderers/common/RenderObject.d.ts +1 -0
  131. three/src/renderers/common/Renderer.d.ts +35 -9
  132. three/src/renderers/common/extras/PMREMGenerator.d.ts +5 -1
  133. three/src/renderers/common/nodes/NodeLibrary.d.ts +0 -7
  134. three/src/renderers/webgl/WebGLPrograms.d.ts +3 -10
  135. three/src/renderers/webgl/WebGLState.d.ts +13 -10
  136. three/src/renderers/webgl/WebGLUtils.d.ts +2 -2
  137. three/src/textures/CompressedTexture.d.ts +1 -2
  138. three/src/textures/CubeTexture.d.ts +1 -2
  139. three/src/textures/DataTexture.d.ts +1 -2
  140. three/src/textures/Texture.d.ts +3 -4
  141. three/examples/jsm/cameras/CinematicCamera.d.ts +0 -34
  142. three/src/nodes/display/BleachBypass.d.ts +0 -4
  143. three/src/nodes/display/Sepia.d.ts +0 -4
  144. three/src/nodes/utils/OscNode.d.ts +0 -25
  145. three/src/nodes/utils/TimerNode.d.ts +0 -25
  146. /three/examples/jsm/utils/{TextureUtils.d.ts → WebGLTextureUtils.d.ts} +0 -0
  147. /three/examples/jsm/utils/{TextureUtilsGPU.d.ts → WebGPUTextureUtils.d.ts} +0 -0
three/src/nodes/TSL.d.ts CHANGED
@@ -28,15 +28,16 @@ export * from "./utils/FunctionOverloadingNode.js";
28
28
  export * from "./utils/LoopNode.js";
29
29
  export * from "./utils/MatcapUVNode.js";
30
30
  export * from "./utils/MaxMipLevelNode.js";
31
- export * from "./utils/OscNode.js";
31
+ export * from "./utils/Oscillators.js";
32
32
  export * from "./utils/Packing.js";
33
+ export * from "./utils/PostProcessingUtils.js";
33
34
  export * from "./utils/ReflectorNode.js";
34
35
  export * from "./utils/RemapNode.js";
35
36
  export * from "./utils/RotateNode.js";
36
37
  export * from "./utils/RTTNode.js";
37
38
  export * from "./utils/SpriteSheetUVNode.js";
38
39
  export * from "./utils/SpriteUtils.js";
39
- export * from "./utils/TimerNode.js";
40
+ export * from "./utils/Timer.js";
40
41
  export * from "./utils/TriplanarTexturesNode.js";
41
42
  export * from "./utils/UVUtils.js";
42
43
  export * from "./utils/ViewportUtils.js";
@@ -82,39 +83,17 @@ export * from "./accessors/VelocityNode.js";
82
83
  export * from "./accessors/VertexColorNode.js";
83
84
 
84
85
  // display
85
- export * from "./display/AfterImageNode.js";
86
- export * from "./display/AnaglyphPassNode.js";
87
- export * from "./display/AnamorphicNode.js";
88
- export * from "./display/BleachBypass.js";
89
86
  export * from "./display/BlendMode.js";
90
- export * from "./display/BloomNode.js";
91
87
  export * from "./display/BumpMapNode.js";
92
88
  export * from "./display/ColorAdjustment.js";
93
89
  export * from "./display/ColorSpaceNode.js";
94
- export * from "./display/DenoiseNode.js";
95
- export * from "./display/DepthOfFieldNode.js";
96
- export * from "./display/DotScreenNode.js";
97
- export * from "./display/FilmNode.js";
98
90
  export * from "./display/FrontFacingNode.js";
99
- export * from "./display/FXAANode.js";
100
- export * from "./display/GaussianBlurNode.js";
101
- export * from "./display/GTAONode.js";
102
- export * from "./display/Lut3DNode.js";
103
- export * from "./display/MotionBlur.js";
104
91
  export * from "./display/NormalMapNode.js";
105
- export * from "./display/ParallaxBarrierPassNode.js";
106
- export * from "./display/PixelationPassNode.js";
107
92
  export * from "./display/PosterizeNode.js";
108
93
  export * from "./display/RenderOutputNode.js";
109
- export * from "./display/RGBShiftNode.js";
110
94
  export * from "./display/ScreenNode.js";
111
- export * from "./display/Sepia.js";
112
- export * from "./display/SobelOperatorNode.js";
113
- export * from "./display/SSAAPassNode.js";
114
- export * from "./display/StereoPassNode.js";
115
95
  export * from "./display/ToneMappingNode.js";
116
96
  export * from "./display/ToonOutlinePassNode.js";
117
- export * from "./display/TransitionNode.js";
118
97
  export * from "./display/ViewportDepthNode.js";
119
98
  export * from "./display/ViewportDepthTextureNode.js";
120
99
  export * from "./display/ViewportSharedTextureNode.js";
@@ -148,6 +127,8 @@ export * from "./gpgpu/ComputeNode.js";
148
127
  export * from "./lighting/LightingContextNode.js";
149
128
  export * from "./lighting/LightNode.js";
150
129
  export * from "./lighting/LightsNode.js";
130
+ export * from "./lighting/PointLightNode.js";
131
+ export * from "./lighting/ShadowNode.js";
151
132
 
152
133
  // pmrem
153
134
  export * from "./pmrem/PMREMNode.js";
@@ -171,5 +152,6 @@ export { default as V_GGX_SmithCorrelated } from "./functions/BSDF/V_GGX_SmithCo
171
152
  export * from "./lighting/LightUtils.js";
172
153
 
173
154
  export { default as getGeometryRoughness } from "./functions/material/getGeometryRoughness.js";
155
+ export { default as getParallaxCorrectNormal } from "./functions/material/getParallaxCorrectNormal.js";
174
156
  export { default as getRoughness } from "./functions/material/getRoughness.js";
175
157
  export { default as getShIrradianceAt } from "./functions/material/getShIrradianceAt.js";
@@ -6,7 +6,6 @@ import { ShaderNodeObject } from "../tsl/TSLCore.js";
6
6
 
7
7
  export const cameraNear: ShaderNodeObject<UniformNode<number>>;
8
8
  export const cameraFar: ShaderNodeObject<UniformNode<number>>;
9
- export const cameraLogDepth: ShaderNodeObject<UniformNode<number>>;
10
9
  export const cameraProjectionMatrix: ShaderNodeObject<UniformNode<Matrix4>>;
11
10
  export const cameraProjectionMatrixInverse: ShaderNodeObject<UniformNode<Matrix4>>;
12
11
  export const cameraViewMatrix: ShaderNodeObject<UniformNode<Matrix4>>;
@@ -12,9 +12,11 @@ declare class SceneNode extends Node {
12
12
 
13
13
  static BACKGROUND_BLURRINESS: "backgroundBlurriness";
14
14
  static BACKGROUND_INTENSITY: "backgroundIntensity";
15
+ static BACKGROUND_ROTATION: "backgroundRotation";
15
16
  }
16
17
 
17
18
  export default SceneNode;
18
19
 
19
20
  export const backgroundBlurriness: ShaderNodeObject<SceneNode>;
20
21
  export const backgroundIntensity: ShaderNodeObject<SceneNode>;
22
+ export const backgroundRotation: ShaderNodeObject<SceneNode>;
@@ -1,5 +1,5 @@
1
1
  import Node from "../core/Node.js";
2
- import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
  import ArrayElementNode from "../utils/ArrayElementNode.js";
4
4
  import BufferNode from "./BufferNode.js";
5
5
 
@@ -17,7 +17,7 @@ declare class UniformArrayNode extends BufferNode {
17
17
 
18
18
  getElementLength(): number;
19
19
 
20
- element(indexNode: number): ShaderNodeObject<UniformArrayElementNode>;
20
+ element(indexNode: NodeRepresentation): ShaderNodeObject<UniformArrayElementNode>;
21
21
  }
22
22
 
23
23
  export default UniformArrayNode;
@@ -4,11 +4,15 @@ import UniformNode from "../core/UniformNode.js";
4
4
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
5
5
 
6
6
  declare class VelocityNode extends TempNode {
7
+ projectionMatrix: Matrix4 | null;
8
+
7
9
  previousModelWorldMatrix: UniformNode<Matrix4>;
8
10
  previousProjectionMatrix: UniformNode<Matrix4>;
9
11
  previousCameraViewMatrix: UniformNode<Matrix4>;
10
12
 
11
13
  constructor();
14
+
15
+ setProjectionMatrix(projectionMatrix: Matrix4 | null): void;
12
16
  }
13
17
 
14
18
  export default VelocityNode;
@@ -5,7 +5,7 @@ declare class Resources extends Map<string, unknown> {
5
5
  get<TArgs extends unknown[]>(key: string, callback?: ((...args: TArgs) => void) | null, ...params: TArgs): unknown;
6
6
  }
7
7
 
8
- export const global: Resources;
8
+ export const ScriptableNodeResources: Resources;
9
9
 
10
10
  declare class ScriptableNode extends Node {
11
11
  codeNode: Node | null;
@@ -11,17 +11,17 @@ export default class StackNode extends Node {
11
11
 
12
12
  If(boolNode: Node, method: () => void): this;
13
13
 
14
- ElseIf(node: Node, method: () => void): this;
14
+ ElseIf(boolNode: Node, method: () => void): this;
15
15
 
16
- Else(node: Node, method: () => void): this;
16
+ Else(method: () => void): this;
17
17
 
18
18
  /**
19
19
  * @deprecated Use {@link StackNode#ElseIf Else()} instead.
20
20
  */
21
- elseif(node: Node, method: () => void): this;
21
+ elseif(boolNode: Node, method: () => void): this;
22
22
 
23
23
  /**
24
24
  * @deprecated Use {@link StackNode#Else Else()} instead.
25
25
  */
26
- else(node: Node, method: () => void): this;
26
+ else(method: () => void): this;
27
27
  }
@@ -10,11 +10,22 @@ export default class VarNode extends Node {
10
10
  constructor(node: Node, name?: string | null);
11
11
  }
12
12
 
13
+ declare module "../tsl/TSLCore.js" {
14
+ interface NodeElements {
15
+ toVar: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
16
+ }
17
+ }
18
+
19
+ /**
20
+ * @deprecated Use ".toVar()" instead.
21
+ */
13
22
  export const temp: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
14
23
 
15
24
  declare module "../tsl/TSLCore.js" {
16
25
  interface NodeElements {
26
+ /**
27
+ * @deprecated Use ".toVar()" instead.
28
+ */
17
29
  temp: typeof temp;
18
- toVar: typeof temp;
19
30
  }
20
31
  }
@@ -25,3 +25,32 @@ export const luminance: (
25
25
  ) => ShaderNodeObject<MathNode>;
26
26
 
27
27
  export const threshold: (color: NodeRepresentation, thershold: NodeRepresentation) => ShaderNodeObject<MathNode>;
28
+
29
+ /**
30
+ * Color Decision List (CDL) v1.2
31
+ *
32
+ * Compact representation of color grading information, defined by slope, offset, power, and saturation. The CDL should
33
+ * be typically be given input in a log space (such as LogC, ACEScc, or AgX Log), and will return output in the same
34
+ * space. Output may require clamping >=0.
35
+ *
36
+ * References:
37
+ * - ASC CDL v1.2
38
+ * - https://blender.stackexchange.com/a/55239/43930
39
+ * - https://docs.acescentral.com/specifications/acescc/
40
+ *
41
+ * @param color Input (-Infinity < input < +Infinity)
42
+ * @param slope Slope (0 ≤ slope < +Infinity)
43
+ * @param offset Offset (-Infinity < offset < +Infinity; typically -1 < offset < 1)
44
+ * @param power Power (0 < power < +Infinity)
45
+ * @param saturation Saturation (0 ≤ saturation < +Infinity; typically 0 ≤ saturation < 4)
46
+ * @param luminanceCoefficients Luminance coefficients for saturation term, typically Rec. 709
47
+ * @return Output, -Infinity < output < +Infinity
48
+ */
49
+ export const cdl: (
50
+ color: NodeRepresentation,
51
+ slope?: NodeRepresentation,
52
+ offset?: NodeRepresentation,
53
+ power?: NodeRepresentation,
54
+ saturation?: NodeRepresentation,
55
+ luminanceCoefficients?: NodeRepresentation,
56
+ ) => ShaderNodeObject<Node>;
@@ -1,6 +1,6 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const sRGBToLinearSRGB: (color: NodeRepresentation) => ShaderNodeObject<Node>;
4
+ export const sRGBTransferEOTF: (color: NodeRepresentation) => ShaderNodeObject<Node>;
5
5
 
6
- export const linearSRGBTosRGB: (color: NodeRepresentation) => ShaderNodeObject<Node>;
6
+ export const sRGBTransferOETF: (color: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -1,4 +1,4 @@
1
- import { ColorSpace, LinearSRGBColorSpace, SRGBColorSpace } from "../../constants.js";
1
+ import { LinearSRGBColorSpace, SRGBColorSpace } from "../../constants.js";
2
2
  import Node from "../core/Node.js";
3
3
  import NodeBuilder from "../core/NodeBuilder.js";
4
4
  import TempNode from "../core/TempNode.js";
@@ -15,16 +15,16 @@ export function getColorSpaceMethod(
15
15
 
16
16
  export default class ColorSpaceNode extends TempNode {
17
17
  colorNode: Node;
18
- source: WorkingOrOutputColorSpace | ColorSpace;
19
- target: WorkingOrOutputColorSpace | ColorSpace;
18
+ source: string;
19
+ target: string;
20
20
 
21
21
  constructor(
22
22
  colorNode: Node,
23
- source: WorkingOrOutputColorSpace | ColorSpace,
24
- target: WorkingOrOutputColorSpace | ColorSpace,
23
+ source: string,
24
+ target: string,
25
25
  );
26
26
 
27
- getColorSpace(nodeBuilder: NodeBuilder, colorSpace: WorkingOrOutputColorSpace): ColorSpace;
27
+ resolveColorSpace(nodeBuilder: NodeBuilder, colorSpace: WorkingOrOutputColorSpace): string;
28
28
  }
29
29
 
30
30
  export const toOutputColorSpace: (
@@ -36,11 +36,17 @@ export const toWorkingColorSpace: (
36
36
 
37
37
  export const workingToColorSpace: (
38
38
  node: NodeRepresentation,
39
- colorSpace: ColorSpace,
39
+ colorSpace: string,
40
40
  ) => ShaderNodeObject<ColorSpaceNode>;
41
41
  export const colorSpaceToWorking: (
42
42
  node: NodeRepresentation,
43
- colorSpace: ColorSpace,
43
+ colorSpace: string,
44
+ ) => ShaderNodeObject<ColorSpaceNode>;
45
+
46
+ export const convertColorSpace: (
47
+ node: NodeRepresentation,
48
+ sourceColorSpace: string,
49
+ targetColorSpace: string,
44
50
  ) => ShaderNodeObject<ColorSpaceNode>;
45
51
 
46
52
  declare module "../tsl/TSLCore.js" {
@@ -1,4 +1,4 @@
1
- import { ColorSpace, ToneMapping } from "../../constants.js";
1
+ import { ToneMapping } from "../../constants.js";
2
2
  import Node from "../core/Node.js";
3
3
  import TempNode from "../core/TempNode.js";
4
4
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
@@ -6,11 +6,11 @@ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
6
6
  declare class RenderOutputNode extends TempNode {
7
7
  colorNode: Node;
8
8
  toneMapping: ToneMapping | null;
9
- outputColorSpace: ColorSpace | null;
9
+ outputColorSpace: string | null;
10
10
 
11
11
  readonly isRenderOutput: true;
12
12
 
13
- constructor(colorNode: Node, toneMapping?: ToneMapping | null, outputColorSpace?: ColorSpace | null);
13
+ constructor(colorNode: Node, toneMapping?: ToneMapping | null, outputColorSpace?: string | null);
14
14
  }
15
15
 
16
16
  export default RenderOutputNode;
@@ -18,7 +18,7 @@ export default RenderOutputNode;
18
18
  export const renderOutput: (
19
19
  color: NodeRepresentation,
20
20
  toneMapping?: ToneMapping | null,
21
- outputColorSpace?: ColorSpace | null,
21
+ outputColorSpace?: string | null,
22
22
  ) => ShaderNodeObject<RenderOutputNode>;
23
23
 
24
24
  declare module "../tsl/TSLCore.js" {
@@ -29,6 +29,8 @@ export const viewZToPerspectiveDepth: (viewZ: Node, near: Node, far: Node) => No
29
29
 
30
30
  export const perspectiveDepthToViewZ: (depth: Node, near: Node, far: Node) => Node;
31
31
 
32
+ export const perspectiveDepthToLogarithmicDepth: (perspectiveW: Node, near: Node, far: Node) => Node;
33
+
32
34
  export const depth: ShaderNodeObject<ViewportDepthNode>;
33
35
  export const linearDepth: (valueNode?: Node | null) => ShaderNodeObject<ViewportDepthNode>;
34
36
  export const viewportLinearDepth: ShaderNodeObject<ViewportDepthNode>;
@@ -0,0 +1,6 @@
1
+ import Node from "../../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../../tsl/TSLCore.js";
3
+
4
+ declare const getAlphaHashThreshold: (position: NodeRepresentation) => ShaderNodeObject<Node>;
5
+
6
+ export default getAlphaHashThreshold;
@@ -0,0 +1,10 @@
1
+ import Node from "../../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../../tsl/TSLCore.js";
3
+
4
+ declare const getParallaxCorrectNormal: (
5
+ normal: NodeRepresentation,
6
+ cubeSize: NodeRepresentation,
7
+ cubePos: NodeRepresentation,
8
+ ) => ShaderNodeObject<Node>;
9
+
10
+ export default getParallaxCorrectNormal;
@@ -1,3 +1,4 @@
1
+ import Renderer from "../../renderers/common/Renderer.js";
1
2
  import Node from "../core/Node.js";
2
3
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
4
 
@@ -8,7 +9,11 @@ export default class ComputeNode extends Node {
8
9
  workgroupSize: number[];
9
10
  dispatchCount: number;
10
11
 
12
+ onInitFunction: ((args: { renderer: Renderer }) => void) | null;
13
+
11
14
  constructor(computeNode: Node, count: number, workgroupSize?: number[]);
15
+
16
+ onInit(callback: ((args: { renderer: Renderer }) => void) | null): void;
12
17
  }
13
18
 
14
19
  export const compute: (
@@ -2,17 +2,22 @@ import { Light } from "../../lights/Light.js";
2
2
  import Node from "../core/Node.js";
3
3
  import { NodeBuilder } from "../Nodes.js";
4
4
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
5
+ import LightNode from "./LightNode.js";
5
6
 
6
7
  declare class LightsNode extends Node {
7
- constructor(lights?: Light[]);
8
+ constructor();
8
9
 
9
10
  setupLightsNode(builder: NodeBuilder): void;
10
11
 
12
+ setupLights(builder: NodeBuilder, lightNodes: LightNode[]): void;
13
+
11
14
  setLights(lights: Light[]): this;
12
15
 
13
16
  getLights(): Light[];
17
+
18
+ get hasLights(): boolean;
14
19
  }
15
20
 
16
21
  export default LightsNode;
17
22
 
18
- export const lights: (lights: Light[]) => ShaderNodeObject<LightsNode>;
23
+ export const lights: (lights?: Light[]) => ShaderNodeObject<LightsNode>;
@@ -1,10 +1,20 @@
1
1
  import { PointLight } from "../../lights/PointLight.js";
2
2
  import Node from "../core/Node.js";
3
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
4
  import AnalyticLightNode from "./AnalyticLightNode.js";
4
5
 
5
- export default class PointLightNode extends AnalyticLightNode<PointLight> {
6
+ export const directPointLight: (
7
+ color: NodeRepresentation,
8
+ lightViewPosition: NodeRepresentation,
9
+ cutoffDistance: NodeRepresentation,
10
+ decayExponent: NodeRepresentation,
11
+ ) => ShaderNodeObject<Node>;
12
+
13
+ declare class PointLightNode extends AnalyticLightNode<PointLight> {
6
14
  cutoffDistanceNode: Node;
7
15
  decayExponentNode: Node;
8
16
 
9
17
  constructor(light?: PointLight | null);
10
18
  }
19
+
20
+ export default PointLightNode;
@@ -0,0 +1,12 @@
1
+ import { Light } from "../../lights/Light.js";
2
+ import { LightShadow } from "../../lights/LightShadow.js";
3
+ import Node from "../core/Node.js";
4
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
5
+
6
+ declare class ShadowNode extends Node {
7
+ constructor(light: Light, shadow: LightShadow);
8
+ }
9
+
10
+ export default ShadowNode;
11
+
12
+ export const shadow: (light: Light, shadow: LightShadow) => ShaderNodeObject<ShadowNode>;
@@ -1,7 +1,7 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const Discard: (conditional: NodeRepresentation) => ShaderNodeObject<Node>;
4
+ export const Discard: (conditional?: NodeRepresentation) => ShaderNodeObject<Node>;
5
5
  export const Return: () => ShaderNodeObject<Node>;
6
6
 
7
7
  declare module "../tsl/TSLCore.js" {
@@ -0,0 +1,7 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const oscSine: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
5
+ export const oscSquare: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
6
+ export const oscTriangle: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
7
+ export const oscSawtooth: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -0,0 +1,45 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ /**
5
+ * Computes a position in view space based on a fragment's screen position expressed as uv coordinates, the fragments
6
+ * depth value and the camera's inverse projection matrix.
7
+ *
8
+ * @param {vec2} screenPosition - The fragment's screen position expressed as uv coordinates.
9
+ * @param {float} depth - The fragment's depth value.
10
+ * @param {mat4} projectionMatrixInverse - The camera's inverse projection matrix.
11
+ * @return {vec3} The fragments position in view space.
12
+ */
13
+ export const getViewPosition: (
14
+ screenPosition: NodeRepresentation,
15
+ depth: NodeRepresentation,
16
+ projectionMatrixInverse: NodeRepresentation,
17
+ ) => ShaderNodeObject<Node>;
18
+
19
+ /**
20
+ * Computes a screen position expressed as uv coordinates based on a fragment's position in view space and the camera's
21
+ * projection matrix
22
+ *
23
+ * @param {vec3} viewPosition - The fragments position in view space.
24
+ * @param {mat4} projectionMatrix - The camera's projection matrix.
25
+ * @return {vec2} The fragment's screen position expressed as uv coordinates.
26
+ */
27
+ export const getScreenPosition: (
28
+ viewPosition: NodeRepresentation,
29
+ projectionMatrix: NodeRepresentation,
30
+ ) => ShaderNodeObject<Node>;
31
+
32
+ /**
33
+ * Computes a normal vector based on depth data. Can be used as a fallback when no normal render target is available or
34
+ * if flat surface normals are required.
35
+ *
36
+ * @param {vec2} uv - The texture coordinate.
37
+ * @param {DepthTexture} depthTexture - The depth texture.
38
+ * @param {mat4} projectionMatrixInverse - The camera's inverse projection matrix.
39
+ * @return {vec3} The computed normal vector.
40
+ */
41
+ export const getNormalFromDepth: (
42
+ uv: NodeRepresentation,
43
+ depthTexture: NodeRepresentation,
44
+ projectionMatrixInverse: NodeRepresentation,
45
+ ) => ShaderNodeObject<Node>;
@@ -2,6 +2,7 @@ import { Camera } from "../../cameras/Camera.js";
2
2
  import { Object3D } from "../../core/Object3D.js";
3
3
  import { RenderTarget } from "../../core/RenderTarget.js";
4
4
  import TextureNode from "../accessors/TextureNode.js";
5
+ import Node from "../core/Node.js";
5
6
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
6
7
 
7
8
  export interface ReflectorNodeParameters {
@@ -11,7 +12,19 @@ export interface ReflectorNodeParameters {
11
12
  bounces?: boolean | undefined;
12
13
  }
13
14
 
14
- export default class ReflectorNode extends TextureNode {
15
+ declare class ReflectorNode extends TextureNode {
16
+ constructor(parameters?: ReflectorNodeParameters);
17
+
18
+ get reflector(): ReflectorBaseNode;
19
+
20
+ get target(): Object3D;
21
+
22
+ getDepthNode(): ShaderNodeObject<ReflectorNode>;
23
+ }
24
+
25
+ declare class ReflectorBaseNode extends Node {
26
+ textureNode: TextureNode;
27
+
15
28
  target: Object3D;
16
29
  resolution: number;
17
30
  generateMipmaps: boolean;
@@ -20,9 +33,7 @@ export default class ReflectorNode extends TextureNode {
20
33
  virtualCameras: WeakMap<Camera, Camera>;
21
34
  renderTargets: WeakMap<Camera, RenderTarget>;
22
35
 
23
- constructor(parameters?: ReflectorNodeParameters);
24
-
25
- getTextureNode(): TextureNode;
36
+ constructor(textureNode: TextureNode, parameters?: ReflectorNodeParameters);
26
37
 
27
38
  getVirtualCamera(camera: Camera): Camera;
28
39
 
@@ -30,3 +41,5 @@ export default class ReflectorNode extends TextureNode {
30
41
  }
31
42
 
32
43
  export const reflector: (parameters?: ReflectorNodeParameters) => ShaderNodeObject<ReflectorNode>;
44
+
45
+ export default ReflectorNode;
@@ -0,0 +1,21 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const time: ShaderNodeObject<Node>;
5
+ export const deltaTime: ShaderNodeObject<Node>;
6
+ export const frameId: ShaderNodeObject<Node>;
7
+
8
+ /**
9
+ * @deprecated Use "time" instead.
10
+ */
11
+ export const timerLocal: (timeScale?: number) => ShaderNodeObject<Node>;
12
+
13
+ /**
14
+ * @deprecated Use "time" instead.
15
+ */
16
+ export const timerGlobal: (timeScale?: number) => ShaderNodeObject<Node>;
17
+
18
+ /**
19
+ * @deprecated Use "deltaTime" instead.
20
+ */
21
+ export const timerDelta: (timeScale?: number) => ShaderNodeObject<Node>;
@@ -7,6 +7,17 @@ import { Matrix4 } from "../math/Matrix4.js";
7
7
  import { Sphere } from "../math/Sphere.js";
8
8
  import { Mesh } from "./Mesh.js";
9
9
 
10
+ export interface BatchedMeshGeometryRange {
11
+ vertexStart: number;
12
+ vertexCount: number;
13
+ reservedVertexCount: number;
14
+ indexStart: number;
15
+ indexCount: number;
16
+ reservedIndexCount: number;
17
+ start: number;
18
+ count: number;
19
+ }
20
+
10
21
  /**
11
22
  * A special version of {@link Mesh} with multi draw batch rendering support. Use {@link BatchedMesh} if you have to
12
23
  * render a large number of objects with the same material but with different world transformations. The usage of
@@ -80,6 +91,12 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
80
91
  */
81
92
  get maxInstanceCount(): number;
82
93
 
94
+ get instanceCount(): number;
95
+
96
+ get unusedVertexCount(): number;
97
+
98
+ get unusedIndexCount(): number;
99
+
83
100
  /**
84
101
  * Read-only flag to check if a given object is of type {@link BatchedMesh}.
85
102
  */
@@ -151,8 +168,8 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
151
168
  */
152
169
  getGeometryRangeAt(
153
170
  geometryId: number,
154
- target?: { start: number; count: number },
155
- ): { start: number; count: number } | null;
171
+ target?: BatchedMeshGeometryRange,
172
+ ): BatchedMeshGeometryRange | null;
156
173
 
157
174
  /**
158
175
  * Get the geometryIndex of the defined instance.
@@ -208,6 +225,12 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
208
225
  */
209
226
  addInstance(geometryId: number): number;
210
227
 
228
+ /**
229
+ * @param geometryId The id of a geometry to remove from the [name] that was previously added via "addGeometry". Any
230
+ * instances referencing this geometry will also be removed as a side effect.
231
+ */
232
+ deleteGeometry(geometryId: number): this;
233
+
211
234
  /**
212
235
  * Removes an existing instance from the BatchedMesh using the given instanceId.
213
236
  * @param instanceId The id of an instance to remove from the BatchedMesh that was previously added via
@@ -223,6 +246,28 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
223
246
  */
224
247
  setGeometryAt(geometryId: number, geometry: BufferGeometry): number;
225
248
 
249
+ /**
250
+ * Repacks the sub geometries in [name] to remove any unused space remaining from previously deleted geometry,
251
+ * freeing up space to add new geometry.
252
+ */
253
+ optimize(): this;
254
+
255
+ /**
256
+ * Resizes the available space in BatchedMesh's vertex and index buffer attributes to the provided sizes. If the
257
+ * provided arguments shrink the geometry buffers but there is not enough unused space at the end of the geometry
258
+ * attributes then an error is thrown.
259
+ * @param maxVertexCount the max number of vertices to be used by all unique geometries to resize to.
260
+ * @param maxIndexCount the max number of indices to be used by all unique geometries to resize to.
261
+ */
262
+ setGeometrySize(maxVertexCount: number, maxIndexCount: number): void;
263
+
264
+ /**
265
+ * Resizes the necessary buffers to support the provided number of instances. If the provided arguments shrink the
266
+ * number of instances but there are not enough unused ids at the end of the list then an error is thrown.
267
+ * @param maxInstanceCount the max number of individual instances that can be added and rendered by the BatchedMesh.
268
+ */
269
+ setInstanceCount(maxInstanceCount: number): void;
270
+
226
271
  getBoundingBoxAt(geometryId: number, target: Box3): Box3 | null;
227
272
  getBoundingSphereAt(geometryId: number, target: Sphere): Sphere | null;
228
273
  }