@types/three 0.170.0 → 0.172.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 (197) hide show
  1. three/README.md +1 -1
  2. three/build/three.core.d.ts +1 -0
  3. three/build/three.core.min.d.ts +1 -0
  4. three/build/three.tsl.d.ts +1 -0
  5. three/build/three.tsl.min.d.ts +1 -0
  6. three/examples/jsm/Addons.d.ts +0 -5
  7. three/examples/jsm/controls/ArcballControls.d.ts +6 -1
  8. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  9. three/examples/jsm/controls/TransformControls.d.ts +1 -1
  10. three/examples/jsm/csm/CSMShadowNode.d.ts +2 -4
  11. three/examples/jsm/exporters/GLTFExporter.d.ts +23 -7
  12. three/examples/jsm/geometries/DecalGeometry.d.ts +1 -1
  13. three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +13 -0
  14. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  15. three/examples/jsm/lines/LineSegments2.d.ts +3 -1
  16. three/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +1 -1
  17. three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
  18. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
  19. three/examples/jsm/objects/InstancedPoints.d.ts +10 -0
  20. three/examples/jsm/objects/SkyMesh.d.ts +2 -2
  21. three/examples/jsm/objects/Water2Mesh.d.ts +13 -2
  22. three/examples/jsm/objects/WaterMesh.d.ts +11 -2
  23. three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
  24. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
  25. three/examples/jsm/tsl/display/AfterImageNode.d.ts +2 -1
  26. three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +1 -1
  27. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +2 -2
  28. three/examples/jsm/tsl/display/BleachBypass.d.ts +2 -1
  29. three/examples/jsm/tsl/display/BloomNode.d.ts +2 -1
  30. three/examples/jsm/tsl/display/DenoiseNode.d.ts +3 -4
  31. three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +2 -1
  32. three/examples/jsm/tsl/display/DotScreenNode.d.ts +2 -2
  33. three/examples/jsm/tsl/display/FXAANode.d.ts +2 -1
  34. three/examples/jsm/tsl/display/FilmNode.d.ts +2 -1
  35. three/examples/jsm/tsl/display/GTAONode.d.ts +5 -8
  36. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +2 -2
  37. three/examples/jsm/tsl/display/LensflareNode.d.ts +2 -2
  38. three/examples/jsm/tsl/display/Lut3DNode.d.ts +2 -2
  39. three/examples/jsm/tsl/display/MotionBlur.d.ts +2 -1
  40. three/examples/jsm/tsl/display/OutlineNode.d.ts +2 -2
  41. three/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts +1 -1
  42. three/examples/jsm/tsl/display/PixelationPassNode.d.ts +2 -2
  43. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +2 -1
  44. three/examples/jsm/tsl/display/SMAANode.d.ts +2 -1
  45. three/examples/jsm/tsl/display/SSAAPassNode.d.ts +2 -2
  46. three/examples/jsm/tsl/display/SSRNode.d.ts +2 -2
  47. three/examples/jsm/tsl/display/Sepia.d.ts +2 -1
  48. three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +2 -1
  49. three/examples/jsm/tsl/display/StereoCompositePassNode.d.ts +1 -2
  50. three/examples/jsm/tsl/display/StereoPassNode.d.ts +2 -2
  51. three/examples/jsm/tsl/display/TRAAPassNode.d.ts +2 -2
  52. three/examples/jsm/tsl/display/TransitionNode.d.ts +2 -1
  53. three/examples/jsm/tsl/display/hashBlur.d.ts +2 -1
  54. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +2 -1
  55. three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
  56. three/package.json +4 -4
  57. three/src/Three.Core.d.ts +159 -0
  58. three/src/Three.TSL.d.ts +533 -0
  59. three/src/Three.WebGPU.Nodes.d.ts +14 -195
  60. three/src/Three.WebGPU.d.ts +14 -196
  61. three/src/Three.d.ts +2 -158
  62. three/src/animation/AnimationClip.d.ts +3 -1
  63. three/src/cameras/CubeCamera.d.ts +19 -2
  64. three/src/core/Clock.d.ts +4 -6
  65. three/src/core/InterleavedBuffer.d.ts +12 -0
  66. three/src/core/RenderTarget.d.ts +3 -5
  67. three/src/core/RenderTarget3D.d.ts +9 -0
  68. three/src/core/RenderTargetArray.d.ts +9 -0
  69. three/src/materials/Material.d.ts +9 -5
  70. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  71. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  72. three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
  73. three/src/materials/nodes/LineDashedNodeMaterial.d.ts +3 -0
  74. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
  75. three/src/materials/nodes/NodeMaterial.d.ts +7 -1
  76. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +56 -0
  77. three/src/nodes/Nodes.d.ts +2 -7
  78. three/src/nodes/TSL.d.ts +10 -5
  79. three/src/nodes/accessors/Arrays.d.ts +7 -0
  80. three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
  81. three/src/nodes/accessors/BufferNode.d.ts +4 -4
  82. three/src/nodes/accessors/BuiltinNode.d.ts +14 -0
  83. three/src/nodes/accessors/ClippingNode.d.ts +6 -0
  84. three/src/nodes/accessors/InstanceNode.d.ts +15 -3
  85. three/src/nodes/accessors/InstancedMeshNode.d.ts +11 -0
  86. three/src/nodes/accessors/Lights.d.ts +15 -0
  87. three/src/nodes/accessors/MaterialNode.d.ts +3 -3
  88. three/src/nodes/accessors/ModelNode.d.ts +10 -2
  89. three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
  90. three/src/nodes/accessors/StorageBufferNode.d.ts +25 -12
  91. three/src/nodes/accessors/StorageTextureNode.d.ts +5 -3
  92. three/src/nodes/accessors/TextureNode.d.ts +5 -0
  93. three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
  94. three/src/nodes/core/IndexNode.d.ts +2 -0
  95. three/src/nodes/core/Node.d.ts +237 -0
  96. three/src/nodes/core/NodeAttribute.d.ts +13 -0
  97. three/src/nodes/core/NodeBuilder.d.ts +1 -2
  98. three/src/nodes/core/NodeCache.d.ts +21 -0
  99. three/src/nodes/core/NodeParser.d.ts +11 -0
  100. three/src/nodes/core/NodeUniform.d.ts +28 -0
  101. three/src/nodes/core/NodeUtils.d.ts +7 -0
  102. three/src/nodes/core/NodeVar.d.ts +12 -0
  103. three/src/nodes/core/NodeVarying.d.ts +14 -0
  104. three/src/nodes/core/StackNode.d.ts +6 -1
  105. three/src/nodes/core/StructTypeNode.d.ts +19 -1
  106. three/src/nodes/core/UniformNode.d.ts +44 -0
  107. three/src/nodes/core/VaryingNode.d.ts +3 -0
  108. three/src/nodes/core/constants.d.ts +41 -0
  109. three/src/nodes/display/BlendModes.d.ts +32 -0
  110. three/src/nodes/display/PassNode.d.ts +1 -1
  111. three/src/nodes/display/ScreenNode.d.ts +5 -0
  112. three/src/nodes/display/ViewportDepthNode.d.ts +3 -1
  113. three/src/nodes/fog/Fog.d.ts +26 -0
  114. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +88 -0
  115. three/src/nodes/gpgpu/BarrierNode.d.ts +12 -0
  116. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +13 -0
  117. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
  118. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +19 -0
  119. three/src/nodes/lighting/AnalyticLightNode.d.ts +11 -0
  120. three/src/nodes/lighting/LightsNode.d.ts +2 -2
  121. three/src/nodes/lighting/PointLightNode.d.ts +3 -0
  122. three/src/nodes/lighting/PointShadowNode.d.ts +30 -0
  123. three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
  124. three/src/nodes/lighting/ShadowNode.d.ts +28 -4
  125. three/src/nodes/math/MathNode.d.ts +13 -4
  126. three/src/nodes/math/OperatorNode.d.ts +3 -0
  127. three/src/nodes/tsl/TSLBase.d.ts +5 -0
  128. three/src/nodes/tsl/TSLCore.d.ts +51 -16
  129. three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
  130. three/src/nodes/utils/LoopNode.d.ts +23 -2
  131. three/src/nodes/utils/SplitNode.d.ts +1 -1
  132. three/src/objects/BatchedMesh.d.ts +4 -4
  133. three/src/objects/ClippingGroup.d.ts +41 -0
  134. three/src/renderers/WebGLRenderer.d.ts +10 -8
  135. three/src/renderers/common/Animation.d.ts +41 -4
  136. three/src/renderers/common/Attributes.d.ts +31 -0
  137. three/src/renderers/common/Backend.d.ts +11 -0
  138. three/src/renderers/common/Background.d.ts +22 -0
  139. three/src/renderers/common/BindGroup.d.ts +15 -0
  140. three/src/renderers/common/Binding.d.ts +24 -0
  141. three/src/renderers/common/Bindings.d.ts +54 -0
  142. three/src/renderers/common/Buffer.d.ts +31 -0
  143. three/src/renderers/common/BufferUtils.d.ts +26 -0
  144. three/src/renderers/common/BundleGroup.d.ts +22 -0
  145. three/src/renderers/common/ChainMap.d.ts +31 -1
  146. three/src/renderers/common/ClippingContext.d.ts +61 -14
  147. three/src/renderers/common/Color4.d.ts +36 -0
  148. three/src/renderers/common/ComputePipeline.d.ts +12 -0
  149. three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
  150. three/src/renderers/common/DataMap.d.ts +30 -0
  151. three/src/renderers/common/Geometries.d.ts +52 -0
  152. three/src/renderers/common/Info.d.ts +27 -0
  153. three/src/renderers/common/Pipeline.d.ts +11 -0
  154. three/src/renderers/common/Pipelines.d.ts +104 -0
  155. three/src/renderers/common/ProgrammableStage.d.ts +19 -1
  156. three/src/renderers/common/RenderBundle.d.ts +15 -4
  157. three/src/renderers/common/RenderBundles.d.ts +20 -2
  158. three/src/renderers/common/RenderContext.d.ts +22 -0
  159. three/src/renderers/common/RenderContexts.d.ts +42 -3
  160. three/src/renderers/common/RenderList.d.ts +90 -0
  161. three/src/renderers/common/RenderLists.d.ts +21 -0
  162. three/src/renderers/common/RenderObject.d.ts +160 -5
  163. three/src/renderers/common/RenderObjects.d.ts +56 -0
  164. three/src/renderers/common/RenderPipeline.d.ts +13 -0
  165. three/src/renderers/common/Renderer.d.ts +596 -6
  166. three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
  167. three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
  168. three/src/renderers/common/Textures.d.ts +66 -0
  169. three/src/renderers/common/Uniform.d.ts +106 -0
  170. three/src/renderers/common/UniformBuffer.d.ts +12 -0
  171. three/src/renderers/common/UniformsGroup.d.ts +104 -0
  172. three/src/renderers/common/extras/PMREMGenerator.d.ts +15 -1
  173. three/src/renderers/common/nodes/NodeBuilderState.d.ts +30 -0
  174. three/src/renderers/common/nodes/NodeLibrary.d.ts +73 -4
  175. three/src/renderers/common/nodes/NodeUniform.d.ts +161 -0
  176. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
  177. three/src/renderers/common/nodes/Nodes.d.ts +185 -11
  178. three/src/renderers/webgl/WebGLState.d.ts +1 -1
  179. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
  180. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
  181. three/src/textures/Data3DTexture.d.ts +4 -2
  182. three/src/textures/DataArrayTexture.d.ts +1 -1
  183. three/src/textures/DataTexture.d.ts +7 -2
  184. three/src/textures/Texture.d.ts +3 -0
  185. three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
  186. three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
  187. three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
  188. three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
  189. three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
  190. three/src/Three.Legacy.d.ts +0 -20
  191. three/src/nodes/core/UniformGroup.d.ts +0 -7
  192. three/src/nodes/display/BlendMode.d.ts +0 -10
  193. three/src/nodes/fog/FogExp2Node.d.ts +0 -14
  194. three/src/nodes/fog/FogNode.d.ts +0 -20
  195. three/src/nodes/fog/FogRangeNode.d.ts +0 -19
  196. three/src/nodes/lighting/LightNode.d.ts +0 -18
  197. three/src/textures/types.d.ts +0 -9
@@ -1,7 +1,24 @@
1
1
  import { CoordinateSystem } from "../constants.js";
2
2
  import { Object3D } from "../core/Object3D.js";
3
+ import { RenderTarget } from "../core/RenderTarget.js";
3
4
  import { WebGLCubeRenderTarget } from "../renderers/WebGLCubeRenderTarget.js";
4
- import { WebGLRenderer } from "../renderers/WebGLRenderer.js";
5
+ import { Camera } from "./Camera.js";
6
+
7
+ export interface CubeCameraRenderer {
8
+ coordinateSystem: CoordinateSystem;
9
+ getRenderTarget(): RenderTarget | null;
10
+ getActiveCubeFace(): number;
11
+ getActiveMipmapLevel(): number;
12
+ xr: {
13
+ enabled: boolean;
14
+ };
15
+ setRenderTarget(
16
+ renderTarget: WebGLCubeRenderTarget | null,
17
+ activeCubeFace?: number,
18
+ activeMipmapLevel?: number,
19
+ ): void;
20
+ render(scene: Object3D, camera: Camera): void;
21
+ }
5
22
 
6
23
  /**
7
24
  * Creates **6** {@link THREE.PerspectiveCamera | cameras} that render to a {@link THREE.WebGLCubeRenderTarget | WebGLCubeRenderTarget}.
@@ -64,5 +81,5 @@ export class CubeCamera extends Object3D {
64
81
  * @param renderer The current WebGL renderer
65
82
  * @param scene The current scene
66
83
  */
67
- update(renderer: WebGLRenderer, scene: Object3D): void;
84
+ update(renderer: CubeCameraRenderer, scene: Object3D): void;
68
85
  }
three/src/core/Clock.d.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Object for keeping track of time
3
- * @remarks
4
- * This uses {@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now | performance.now} if it is available,
5
- * otherwise it reverts to the less accurate {@link https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/now | Date.now}.
6
- * @see {@link https://threejs.org/docs/index.html#api/en/core/Clock | Official Documentation}
7
- * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js | Source}
2
+ * Object for keeping track of time. This uses
3
+ * [performance.now]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now}.
4
+ * @see [Official Documentation]{@link https://threejs.org/docs/index.html#api/en/core/Clock}
5
+ * @see [Source]{@link https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js}
8
6
  */
9
7
  export class Clock {
10
8
  /**
@@ -85,6 +85,18 @@ export class InterleavedBuffer {
85
85
  */
86
86
  uuid: string;
87
87
 
88
+ /**
89
+ * A callback function that is executed after the Renderer has transferred the geometry data to the GPU.
90
+ */
91
+ onUploadCallback: () => void;
92
+
93
+ /**
94
+ * Sets the value of the {@link onUploadCallback} property.
95
+ * @see {@link onUploadCallback}
96
+ * @param callback function that is executed after the Renderer has transferred the geometry data to the GPU.
97
+ */
98
+ onUpload(callback: () => void): this;
99
+
88
100
  /**
89
101
  * Calls {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set | TypedArray.set}( {@link value}, {@link offset} )
90
102
  * on the {@link BufferAttribute.array | array}.
@@ -72,11 +72,6 @@ export class RenderTarget<TTexture extends Texture | Texture[] = Texture> extend
72
72
  */
73
73
  resolveStencilBuffer: boolean;
74
74
 
75
- /**
76
- * @default null
77
- */
78
- depthTexture: DepthTexture | null;
79
-
80
75
  /**
81
76
  * Defines the count of MSAA samples. Can only be used with WebGL 2. Default is **0**.
82
77
  * @default 0
@@ -88,6 +83,9 @@ export class RenderTarget<TTexture extends Texture | Texture[] = Texture> extend
88
83
  get texture(): TTexture;
89
84
  set texture(value: TTexture);
90
85
 
86
+ set depthTexture(current: DepthTexture | null);
87
+ get depthTexture(): DepthTexture | null;
88
+
91
89
  setSize(width: number, height: number, depth?: number): void;
92
90
  clone(): this;
93
91
  copy(source: RenderTarget): this;
@@ -0,0 +1,9 @@
1
+ import { RenderTarget, RenderTargetOptions } from "./RenderTarget.js";
2
+
3
+ declare class RenderTarget3D extends RenderTarget {
4
+ readonly isRenderTarget3D: true;
5
+
6
+ constructor(width?: number, height?: number, depth?: number, options?: RenderTargetOptions);
7
+ }
8
+
9
+ export { RenderTarget3D };
@@ -0,0 +1,9 @@
1
+ import { RenderTarget, RenderTargetOptions } from "./RenderTarget.js";
2
+
3
+ declare class RenderTargetArray extends RenderTarget {
4
+ readonly isRenderTargetArray: true;
5
+
6
+ constructor(width?: number, height?: number, depth?: number, options?: RenderTargetOptions);
7
+ }
8
+
9
+ export { RenderTargetArray };
@@ -234,10 +234,6 @@ export interface MaterialJSON {
234
234
  * Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.
235
235
  */
236
236
  export class Material extends EventDispatcher<{ dispose: {} }> {
237
- static get type(): string;
238
-
239
- get type(): string;
240
-
241
237
  constructor();
242
238
 
243
239
  /**
@@ -247,6 +243,12 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
247
243
  */
248
244
  readonly isMaterial: true;
249
245
 
246
+ /**
247
+ * Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a
248
+ * scene.
249
+ */
250
+ type: string;
251
+
250
252
  /**
251
253
  * Enables alpha hashed transparency, an alternative to {@link .transparent} or {@link .alphaTest}. The material
252
254
  * will not be rendered if opacity is lower than a random threshold. Randomization introduces some grain or noise,
@@ -571,7 +573,9 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
571
573
  /**
572
574
  * An optional callback that is executed immediately before the shader program is compiled.
573
575
  * This function is called with the shader source code as a parameter.
574
- * Useful for the modification of built-in materials.
576
+ * Useful for the modification of built-in materials, but the recommended approach moving forward is to use
577
+ * `WebGPURenderer` with the new Node Material system and
578
+ * [TSL]{@link https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language}.
575
579
  * Unlike properties, the callback is not supported by {@link .clone()}, {@link .copy()} and {@link .toJSON()}.
576
580
  * This callback is only supported in `WebGLRenderer` (not `WebGPURenderer`).
577
581
  * @param parameters WebGL program parameters
@@ -62,10 +62,5 @@ export class MeshDepthMaterial extends Material {
62
62
  */
63
63
  wireframeLinewidth: number;
64
64
 
65
- /**
66
- * @default false
67
- */
68
- fog: boolean;
69
-
70
65
  setValues(parameters: MeshDepthMaterialParameters): void;
71
66
  }
@@ -48,10 +48,5 @@ export class MeshDistanceMaterial extends Material {
48
48
  */
49
49
  displacementBias: number;
50
50
 
51
- /**
52
- * @default false
53
- */
54
- fog: boolean;
55
-
56
51
  setValues(parameters: MeshDistanceMaterialParameters): void;
57
52
  }
@@ -5,6 +5,7 @@ import { LineDashedMaterialParameters } from "../LineDashedMaterial.js";
5
5
  import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";
6
6
 
7
7
  export interface Line2NodeMaterialParameters extends NodeMaterialParameters, LineDashedMaterialParameters {
8
+ worldUnits?: boolean | undefined;
8
9
  dashed?: boolean | undefined;
9
10
  }
10
11
 
@@ -3,6 +3,7 @@ import { LineDashedMaterialParameters } from "../LineDashedMaterial.js";
3
3
  import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";
4
4
 
5
5
  export interface LineDashedNodeMaterialParameters extends NodeMaterialParameters, LineDashedMaterialParameters {
6
+ dashOffset?: number | undefined;
6
7
  offsetNode?: Node | null | undefined;
7
8
  dashScaleNode?: Node | null | undefined;
8
9
  dashSizeNode?: Node | null | undefined;
@@ -12,6 +13,8 @@ export interface LineDashedNodeMaterialParameters extends NodeMaterialParameters
12
13
  declare class LineDashedNodeMaterial extends NodeMaterial {
13
14
  readonly isLineDashedNodeMaterial: true;
14
15
 
16
+ dashOffset: number;
17
+
15
18
  offsetNode: Node | null;
16
19
  dashScaleNode: Node | null;
17
20
  dashSizeNode: Node | null;
@@ -1,14 +1,14 @@
1
- import ConstNode from "../../nodes/core/ConstNode.js";
1
+ import InputNode from "../../nodes/core/InputNode.js";
2
2
  import Node from "../../nodes/core/Node.js";
3
3
  import MeshPhysicalNodeMaterial, { MeshPhysicalNodeMaterialParameters } from "./MeshPhysicalNodeMaterial.js";
4
4
 
5
5
  export default class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
6
6
  thicknessColorNode: Node | null;
7
- thicknessDistortionNode: ConstNode<number>;
8
- thicknessAmbientNode: ConstNode<number>;
9
- thicknessAttenuationNode: ConstNode<number>;
10
- thicknessPowerNode: ConstNode<number>;
11
- thicknessScaleNode: ConstNode<number>;
7
+ thicknessDistortionNode: InputNode<number>;
8
+ thicknessAmbientNode: InputNode<number>;
9
+ thicknessAttenuationNode: InputNode<number>;
10
+ thicknessPowerNode: InputNode<number>;
11
+ thicknessScaleNode: InputNode<number>;
12
12
 
13
13
  constructor(parameters?: MeshPhysicalNodeMaterialParameters);
14
14
 
@@ -42,6 +42,7 @@ declare class NodeMaterial extends Material {
42
42
 
43
43
  fog: boolean;
44
44
  lights: boolean;
45
+ hardwareClipping: boolean;
45
46
 
46
47
  lightsNode: LightsNode | null;
47
48
  envNode: Node | null;
@@ -58,8 +59,9 @@ declare class NodeMaterial extends Material {
58
59
  geometryNode: Node | null;
59
60
 
60
61
  depthNode: Node | null;
61
- shadowNode: Node | null;
62
62
  shadowPositionNode: Node | null;
63
+ receivedShadowNode: Node | null;
64
+ castShadowNode: Node | null;
63
65
 
64
66
  outputNode: Node | null;
65
67
  mrtNode: MRTNode | null;
@@ -72,7 +74,11 @@ declare class NodeMaterial extends Material {
72
74
  build(builder: NodeBuilder): void;
73
75
  setup(builder: NodeBuilder): void;
74
76
  setupClipping(builder: NodeBuilder): ClippingNode | null;
77
+ setupHardwareClipping(builder: NodeBuilder): void;
75
78
  setupDepth(builder: NodeBuilder): void;
79
+ setupPositionView(): Node;
80
+ setupModelViewProjection(): Node;
81
+ setupVertex(builder: NodeBuilder): Node;
76
82
  setupPosition(builder: NodeBuilder): Node;
77
83
  setupDiffuseColor(builder: NodeBuilder): void;
78
84
  setupVariants(builder: NodeBuilder): void;
@@ -78,19 +78,75 @@ interface RenderObjectData {
78
78
  worldMatrix: Matrix4;
79
79
  version?: number;
80
80
  }
81
+ /**
82
+ * This class is used by {@link WebGPURenderer} as management component.
83
+ * It's primary purpose is to determine whether render objects require a
84
+ * refresh right before they are going to be rendered or not.
85
+ */
81
86
  declare class NodeMaterialObserver {
82
87
  renderObjects: WeakMap<RenderObject, RenderObjectData>;
83
88
  hasNode: boolean;
84
89
  hasAnimation: boolean;
85
90
  refreshUniforms: readonly RefreshUniform[];
86
91
  renderId: number;
92
+ /**
93
+ * Constructs a new node material observer.
94
+ *
95
+ * @param {NodeBuilder} builder - The node builder.
96
+ */
87
97
  constructor(builder: NodeBuilder);
98
+ /**
99
+ * Returns `true` if the given render object is verified for the first time of this observer.
100
+ *
101
+ * @param {RenderObject} renderObject - The render object.
102
+ * @return {Boolean} Whether the given render object is verified for the first time of this observer.
103
+ */
88
104
  firstInitialization(renderObject: RenderObject): boolean;
105
+ /**
106
+ * Returns monitoring data for the given render object.
107
+ *
108
+ * @param {RenderObject} renderObject - The render object.
109
+ * @return {Object} The monitoring data.
110
+ */
89
111
  getRenderObjectData(renderObject: RenderObject): RenderObjectData;
112
+ /**
113
+ * Returns an attribute data structure holding the attributes versions for
114
+ * monitoring.
115
+ *
116
+ * @param {Object} attributes - The geometry attributes.
117
+ * @return {Object} An object for monitoring the versions of attributes.
118
+ */
90
119
  getAttributesData(attributes: Record<string, BufferAttribute>): AttributesData;
120
+ /**
121
+ * Returns `true` if the node builder's material uses
122
+ * node properties.
123
+ *
124
+ * @param {NodeBuilder} builder - The current node builder.
125
+ * @return {Boolean} Whether the node builder's material uses node properties or not.
126
+ */
91
127
  containsNode(builder: NodeBuilder): boolean;
128
+ /**
129
+ * Returns a material data structure holding the material property values for
130
+ * monitoring.
131
+ *
132
+ * @param {Material} material - The material.
133
+ * @return {Object} An object for monitoring material properties.
134
+ */
92
135
  getMaterialData(material: Material): MaterialData;
136
+ /**
137
+ * Returns `true` if the given render object has not changed its state.
138
+ *
139
+ * @param {RenderObject} renderObject - The render object.
140
+ * @return {Boolean} Whether the given render object has changed its state or not.
141
+ */
93
142
  equals(renderObject: RenderObject): boolean;
143
+ /**
144
+ * Checks if the given render object requires a refresh.
145
+ *
146
+ * @param {RenderObject} renderObject - The render object.
147
+ * @param {NodeFrame} nodeFrame - The current node frame.
148
+ * @return {Boolean} Whether the given render object requires a refresh or not.
149
+ */
94
150
  needsRefresh(renderObject: RenderObject, nodeFrame: NodeFrame): boolean;
95
151
  }
96
152
  export default NodeMaterialObserver;
@@ -70,11 +70,11 @@ export { default as BatchNode } from "./accessors/BatchNode.js";
70
70
  export { default as BufferAttributeNode } from "./accessors/BufferAttributeNode.js";
71
71
  export { default as BufferNode } from "./accessors/BufferNode.js";
72
72
  export { default as CubeTextureNode } from "./accessors/CubeTextureNode.js";
73
+ export { default as InstancedMeshNode } from "./accessors/InstancedMeshNode.js";
73
74
  export { default as InstanceNode } from "./accessors/InstanceNode.js";
74
75
  export { default as MaterialNode, MaterialNodeScope } from "./accessors/MaterialNode.js";
75
76
  export { default as MaterialReferenceNode } from "./accessors/MaterialReferenceNode.js";
76
77
  export { default as ModelNode } from "./accessors/ModelNode.js";
77
- export { default as ModelViewProjectionNode } from "./accessors/ModelViewProjectionNode.js";
78
78
  export { default as MorphNode } from "./accessors/MorphNode.js";
79
79
  export { default as Object3DNode } from "./accessors/Object3DNode.js";
80
80
  export { default as PointUVNode } from "./accessors/PointUVNode.js";
@@ -114,11 +114,6 @@ export { default as FunctionNode } from "./code/FunctionNode.js";
114
114
  export { default as ScriptableNode } from "./code/ScriptableNode.js";
115
115
  export { default as ScriptableValueNode } from "./code/ScriptableValueNode.js";
116
116
 
117
- // fog
118
- export { default as FogExp2Node } from "./fog/FogExp2Node.js";
119
- export { default as FogNode } from "./fog/FogNode.js";
120
- export { default as FogRangeNode } from "./fog/FogRangeNode.js";
121
-
122
117
  // geometry
123
118
  export { default as RangeNode, RangeModeBound } from "./geometry/RangeNode.js";
124
119
 
@@ -137,11 +132,11 @@ export { default as IESSpotLightNode } from "./lighting/IESSpotLightNode.js";
137
132
  export { default as IrradianceNode } from "./lighting/IrradianceNode.js";
138
133
  export { default as LightingContextNode } from "./lighting/LightingContextNode.js";
139
134
  export { default as LightingNode } from "./lighting/LightingNode.js";
140
- export { default as LightNode, LightNodeScope } from "./lighting/LightNode.js";
141
135
  export { default as LightProbeNode } from "./lighting/LightProbeNode.js";
142
136
  export { default as LightsNode } from "./lighting/LightsNode.js";
143
137
  export { default as PointLightNode } from "./lighting/PointLightNode.js";
144
138
  export { default as RectAreaLightNode, RectAreaLightTexturesLib } from "./lighting/RectAreaLightNode.js";
139
+ export { default as ShadowBaseNode } from "./lighting/ShadowBaseNode.js";
145
140
  export { default as ShadowNode } from "./lighting/ShadowNode.js";
146
141
  export { default as SpotLightNode } from "./lighting/SpotLightNode.js";
147
142
 
three/src/nodes/TSL.d.ts CHANGED
@@ -47,12 +47,14 @@ export * from "./tsl/TSLBase.js";
47
47
 
48
48
  // accessors
49
49
  export * from "./accessors/AccessorsUtils.js";
50
+ export * from "./accessors/Arrays.js";
50
51
  export * from "./accessors/BatchNode.js";
51
52
  export * from "./accessors/Bitangent.js";
52
53
  export * from "./accessors/BufferAttributeNode.js";
53
54
  export * from "./accessors/BufferNode.js";
54
55
  export * from "./accessors/Camera.js";
55
56
  export * from "./accessors/CubeTextureNode.js";
57
+ export * from "./accessors/InstancedMeshNode.js";
56
58
  export * from "./accessors/InstanceNode.js";
57
59
  export * from "./accessors/MaterialNode.js";
58
60
  export * from "./accessors/MaterialProperties.js";
@@ -83,7 +85,7 @@ export * from "./accessors/VelocityNode.js";
83
85
  export * from "./accessors/VertexColorNode.js";
84
86
 
85
87
  // display
86
- export * from "./display/BlendMode.js";
88
+ export * from "./display/BlendModes.js";
87
89
  export * from "./display/BumpMapNode.js";
88
90
  export * from "./display/ColorAdjustment.js";
89
91
  export * from "./display/ColorSpaceNode.js";
@@ -113,21 +115,24 @@ export * from "./code/ScriptableNode.js";
113
115
  export * from "./code/ScriptableValueNode.js";
114
116
 
115
117
  // fog
116
- export * from "./fog/FogExp2Node.js";
117
- export * from "./fog/FogNode.js";
118
- export * from "./fog/FogRangeNode.js";
118
+ export * from "./fog/Fog.js";
119
119
 
120
120
  // geometry
121
121
  export * from "./geometry/RangeNode.js";
122
122
 
123
123
  // gpgpu
124
+ export * from "./gpgpu/AtomicFunctionNode.js";
125
+ export * from "./gpgpu/BarrierNode.js";
126
+ export * from "./gpgpu/ComputeBuiltinNode.js";
124
127
  export * from "./gpgpu/ComputeNode.js";
128
+ export * from "./gpgpu/WorkgroupInfoNode.js";
125
129
 
126
130
  // lighting
131
+ export * from "./accessors/Lights.js";
127
132
  export * from "./lighting/LightingContextNode.js";
128
- export * from "./lighting/LightNode.js";
129
133
  export * from "./lighting/LightsNode.js";
130
134
  export * from "./lighting/PointLightNode.js";
135
+ export * from "./lighting/ShadowBaseNode.js";
131
136
  export * from "./lighting/ShadowNode.js";
132
137
 
133
138
  // pmrem
@@ -0,0 +1,7 @@
1
+ import { TypedArray } from "../../core/BufferAttribute.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import StorageBufferNode from "./StorageBufferNode.js";
4
+
5
+ export const attributeArray: (count: TypedArray | number, type?: string) => ShaderNodeObject<StorageBufferNode>;
6
+
7
+ export const instancedArray: (count: TypedArray | number, type?: string) => ShaderNodeObject<StorageBufferNode>;
@@ -4,6 +4,29 @@ import { InterleavedBuffer } from "../../core/InterleavedBuffer.js";
4
4
  import { InterleavedBufferAttribute } from "../../core/InterleavedBufferAttribute.js";
5
5
  import InputNode from "../core/InputNode.js";
6
6
  import NodeBuilder from "../core/NodeBuilder.js";
7
+ /** @module BufferAttributeNode **/
8
+ /**
9
+ * In earlier `three.js` versions it was only possible to define attribute data
10
+ * on geometry level. With `BufferAttributeNode`, it is also possible to do this
11
+ * on the node level.
12
+ * ```js
13
+ * const geometry = new THREE.PlaneGeometry();
14
+ * const positionAttribute = geometry.getAttribute( 'position' );
15
+ *
16
+ * const colors = [];
17
+ * for ( let i = 0; i < position.count; i ++ ) {
18
+ * colors.push( 1, 0, 0 );
19
+ * }
20
+ *
21
+ * material.colorNode = bufferAttribute( new THREE.Float32BufferAttribute( colors, 3 ) );
22
+ * ```
23
+ * This new approach is especially interesting when geometry data are generated via
24
+ * compute shaders. The below line converts a storage buffer into an attribute node.
25
+ * ```js
26
+ * material.positionNode = positionBuffer.toAttribute();
27
+ * ```
28
+ * @augments InputNode
29
+ */
7
30
  declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuffer | BufferAttribute> {
8
31
  static get type(): string;
9
32
  readonly isBufferNode: true;
@@ -13,39 +36,133 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
13
36
  usage: Usage;
14
37
  instanced: boolean;
15
38
  attribute: BufferAttribute | InterleavedBufferAttribute | null;
39
+ /**
40
+ * Constructs a new buffer attribute node.
41
+ *
42
+ * @param {BufferAttribute|InterleavedBuffer|TypedArray} value - The attribute data.
43
+ * @param {String?} [bufferType=null] - The buffer type (e.g. `'vec3'`).
44
+ * @param {Number} [bufferStride=0] - The buffer stride.
45
+ * @param {Number} [bufferOffset=0] - The buffer offset.
46
+ */
16
47
  constructor(
17
48
  value: TypedArray | InterleavedBuffer | BufferAttribute,
18
49
  bufferType?: string | null,
19
50
  bufferStride?: number,
20
51
  bufferOffset?: number,
21
52
  );
53
+ /**
54
+ * This method is overwritten since the attribute data might be shared
55
+ * and thus the hash should be shared as well.
56
+ *
57
+ * @param {NodeBuilder} builder - The current node builder.
58
+ * @return {String} The hash.
59
+ */
22
60
  getHash(builder: NodeBuilder): string;
61
+ /**
62
+ * This method is overwritten since the node type is inferred from
63
+ * the buffer attribute.
64
+ *
65
+ * @param {NodeBuilder} builder - The current node builder.
66
+ * @return {String} The node type.
67
+ */
23
68
  getNodeType(builder: NodeBuilder): string | null;
69
+ /**
70
+ * Depending on which value was passed to the node, `setup()` behaves
71
+ * differently. If no instance of `BufferAttribute` was passed, the method
72
+ * creates an internal attribute and configures it respectively.
73
+ *
74
+ * @param {NodeBuilder} builder - The current node builder.
75
+ */
24
76
  setup(builder: NodeBuilder): void;
77
+ /**
78
+ * Generates the code snippet of the buffer attribute node.
79
+ *
80
+ * @param {NodeBuilder} builder - The current node builder.
81
+ * @return {String} The generated code snippet.
82
+ */
25
83
  generate(builder: NodeBuilder): string | null | undefined;
84
+ /**
85
+ * Overwrites the default implementation to return a fixed value `'bufferAttribute'`.
86
+ *
87
+ * @param {NodeBuilder} builder - The current node builder.
88
+ * @return {String} The input type.
89
+ */
26
90
  getInputType(): string;
91
+ /**
92
+ * Sets the `usage` property to the given value.
93
+ *
94
+ * @param {Number} value - The usage to set.
95
+ * @return {BufferAttributeNode} A reference to this node.
96
+ */
27
97
  setUsage(value: Usage): this;
98
+ /**
99
+ * Sets the `instanced` property to the given value.
100
+ *
101
+ * @param {Number} value - The value to set.
102
+ * @return {BufferAttributeNode} A reference to this node.
103
+ */
28
104
  setInstanced(value: boolean): this;
29
105
  }
30
106
  export default BufferAttributeNode;
107
+ /**
108
+ * TSL function for creating a buffer attribute node.
109
+ *
110
+ * @function
111
+ * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
112
+ * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
113
+ * @param {Number} [stride=0] - The buffer stride.
114
+ * @param {Number} [offset=0] - The buffer offset.
115
+ * @returns {BufferAttributeNode}
116
+ */
31
117
  export declare const bufferAttribute: (
32
118
  array: TypedArray | InterleavedBuffer | BufferAttribute,
33
119
  type?: string | null,
34
120
  stride?: number,
35
121
  offset?: number,
36
122
  ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
123
+ /**
124
+ * TSL function for creating a buffer attribute node but with dynamic draw usage.
125
+ * Use this function if attribute data are updated per frame.
126
+ *
127
+ * @function
128
+ * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
129
+ * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
130
+ * @param {Number} [stride=0] - The buffer stride.
131
+ * @param {Number} [offset=0] - The buffer offset.
132
+ * @returns {BufferAttributeNode}
133
+ */
37
134
  export declare const dynamicBufferAttribute: (
38
135
  array: TypedArray | InterleavedBuffer | BufferAttribute,
39
136
  type?: string | null,
40
137
  stride?: number,
41
138
  offset?: number,
42
139
  ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
140
+ /**
141
+ * TSL function for creating a buffer attribute node but with enabled instancing
142
+ *
143
+ * @function
144
+ * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
145
+ * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
146
+ * @param {Number} [stride=0] - The buffer stride.
147
+ * @param {Number} [offset=0] - The buffer offset.
148
+ * @returns {BufferAttributeNode}
149
+ */
43
150
  export declare const instancedBufferAttribute: (
44
151
  array: TypedArray | InterleavedBuffer | BufferAttribute,
45
152
  type?: string | null,
46
153
  stride?: number,
47
154
  offset?: number,
48
155
  ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
156
+ /**
157
+ * TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing
158
+ *
159
+ * @function
160
+ * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
161
+ * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
162
+ * @param {Number} [stride=0] - The buffer stride.
163
+ * @param {Number} [offset=0] - The buffer offset.
164
+ * @returns {BufferAttributeNode}
165
+ */
49
166
  export declare const instancedDynamicBufferAttribute: (
50
167
  array: TypedArray | InterleavedBuffer | BufferAttribute,
51
168
  type?: string | null,
@@ -1,17 +1,17 @@
1
1
  import UniformNode from "../core/UniformNode.js";
2
2
  import { NodeOrType, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export default class BufferNode extends UniformNode<unknown> {
4
+ export default class BufferNode<TValue> extends UniformNode<TValue> {
5
5
  isBufferNode: true;
6
6
 
7
7
  bufferType: string;
8
8
  bufferCount: number;
9
9
 
10
- constructor(value: unknown, bufferType: string, bufferCount?: number);
10
+ constructor(value: TValue, bufferType: string, bufferCount?: number);
11
11
  }
12
12
 
13
- export const buffer: (
13
+ export const buffer: <TValue>(
14
14
  value: unknown,
15
15
  nodeOrType: NodeOrType,
16
16
  count: number,
17
- ) => ShaderNodeObject<BufferNode>;
17
+ ) => ShaderNodeObject<BufferNode<TValue>>;
@@ -0,0 +1,14 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ declare class BuiltinNode extends Node {
5
+ name: string;
6
+
7
+ readonly isBuiltinNode: true;
8
+
9
+ constructor(name: string);
10
+ }
11
+
12
+ export default BuiltinNode;
13
+
14
+ export const builtin: (name: string) => ShaderNodeObject<BuiltinNode>;
@@ -1,4 +1,6 @@
1
+ import { Plane } from "../../math/Plane.js";
1
2
  import Node from "../core/Node.js";
3
+ import NodeBuilder from "../core/NodeBuilder.js";
2
4
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
5
 
4
6
  export type ClippingNodeScope = typeof ClippingNode.ALPHA_TO_COVERAGE | typeof ClippingNode.DEFAULT;
@@ -6,11 +8,15 @@ export type ClippingNodeScope = typeof ClippingNode.ALPHA_TO_COVERAGE | typeof C
6
8
  export default class ClippingNode extends Node {
7
9
  scope: ClippingNodeScope;
8
10
 
11
+ hardwareClipping?: boolean;
12
+
9
13
  constructor(scope?: ClippingNodeScope);
10
14
 
11
15
  static ALPHA_TO_COVERAGE: "alphaToCoverage";
12
16
  static DEFAULT: "default";
17
+ static HARDWARE: "hardware";
13
18
  }
14
19
 
15
20
  export const clipping: () => ShaderNodeObject<ClippingNode>;
16
21
  export const clippingAlpha: () => ShaderNodeObject<ClippingNode>;
22
+ export const hardwareClipping: () => ShaderNodeObject<ClippingNode>;