@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,13 +1,25 @@
1
+ import { InstancedBufferAttribute } from "../../core/InstancedBufferAttribute.js";
1
2
  import { InstancedMesh } from "../../objects/InstancedMesh.js";
2
3
  import Node from "../core/Node.js";
3
4
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
5
 
5
6
  export default class InstanceNode extends Node {
6
- instanceMesh: InstancedMesh;
7
+ count: number;
8
+ instanceMatrix: InstancedBufferAttribute;
9
+ instanceColor: InstancedBufferAttribute | null;
10
+
7
11
  instanceMatrixNode: Node | null;
8
12
  instanceColorNode: Node | null;
9
13
 
10
- constructor(instanceMesh: InstancedMesh);
14
+ constructor(
15
+ count: number,
16
+ instanceMatrix: InstancedBufferAttribute,
17
+ instanceColor: InstancedBufferAttribute | null,
18
+ );
11
19
  }
12
20
 
13
- export const instance: (instanceMesh: InstancedMesh) => ShaderNodeObject<InstanceNode>;
21
+ export const instance: (
22
+ count: number,
23
+ instanceMatrix: InstancedBufferAttribute,
24
+ instanceColor: InstancedBufferAttribute | null,
25
+ ) => ShaderNodeObject<InstanceNode>;
@@ -0,0 +1,11 @@
1
+ import { InstancedMesh } from "../../objects/InstancedMesh.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import InstanceNode from "./InstanceNode.js";
4
+
5
+ declare class InstancedMeshNode extends InstanceNode {
6
+ constructor(instanceMesh: InstancedMesh);
7
+ }
8
+
9
+ export default InstancedMeshNode;
10
+
11
+ export const instancedMesh: (instancedMesh: InstancedMesh) => ShaderNodeObject<InstancedMeshNode>;
@@ -0,0 +1,15 @@
1
+ import { Light } from "../../lights/Light.js";
2
+ import Node from "../core/Node.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
+
5
+ export function lightShadowMatrix(light: Light): ShaderNodeObject<Node>;
6
+
7
+ export function lightProjectionUV(light: Light): ShaderNodeObject<Node>;
8
+
9
+ export function lightPosition(light: Light): ShaderNodeObject<Node>;
10
+
11
+ export function lightTargetPosition(light: Light): ShaderNodeObject<Node>;
12
+
13
+ export function lightViewPosition(light: Light): ShaderNodeObject<Node>;
14
+
15
+ export const lightTargetDirection: (light: Light) => ShaderNodeObject<Node>;
@@ -40,7 +40,7 @@ export type MaterialNodeScope =
40
40
  | typeof MaterialNode.POINT_WIDTH
41
41
  | typeof MaterialNode.DISPERSION
42
42
  | typeof MaterialNode.LIGHT_MAP
43
- | typeof MaterialNode.AO_MAP
43
+ | typeof MaterialNode.AO
44
44
  | typeof MaterialNode.REFRACTION_RATIO;
45
45
 
46
46
  export default class MaterialNode extends Node {
@@ -80,7 +80,7 @@ export default class MaterialNode extends Node {
80
80
  static POINT_WIDTH: "pointWidth";
81
81
  static DISPERSION: "dispersion";
82
82
  static LIGHT_MAP: "light";
83
- static AO_MAP: "ao";
83
+ static AO: "ao";
84
84
  static REFRACTION_RATIO: "refractionRatio";
85
85
 
86
86
  scope: MaterialNodeScope;
@@ -125,5 +125,5 @@ export const materialLineDashOffset: ShaderNodeObject<MaterialNode>;
125
125
  export const materialPointWidth: ShaderNodeObject<MaterialNode>;
126
126
  export const materialDispersion: ShaderNodeObject<MaterialNode>;
127
127
  export const materialLightMap: ShaderNodeObject<MaterialNode>;
128
- export const materialAOMap: ShaderNodeObject<MaterialNode>;
128
+ export const materialAO: ShaderNodeObject<MaterialNode>;
129
129
  export const materialAnisotropyVector: ShaderNodeObject<UniformNode<Vector2>>;
@@ -18,7 +18,15 @@ export const modelScale: ShaderNodeObject<ModelNode>;
18
18
  export const modelViewPosition: ShaderNodeObject<ModelNode>;
19
19
  export const modelNormalMatrix: ShaderNodeObject<Node>;
20
20
  export const modelWorldMatrixInverse: ShaderNodeObject<UniformNode<Matrix4>>;
21
+
21
22
  export const modelViewMatrix: ShaderNodeObject<ModelNode>;
22
23
 
23
- export const highPrecisionModelViewMatrix: ShaderNodeObject<Node>;
24
- export const highPrecisionModelNormalViewMatrix: ShaderNodeObject<Node>;
24
+ // GPU Precision
25
+
26
+ export const mediumpModelViewMatrix: ShaderNodeObject<Node>;
27
+
28
+ // CPU Precision
29
+
30
+ export const highpModelViewMatrix: ShaderNodeObject<Node>;
31
+
32
+ export const highpModelNormalViewMatrix: ShaderNodeObject<Node>;
@@ -1,8 +1,4 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export default class ModelViewProjectionNode extends Node {
5
- constructor(positionNode?: Node);
6
- }
7
-
8
- export const modelViewProjection: (position?: NodeRepresentation) => ShaderNodeObject<ModelViewProjectionNode>;
4
+ export const modelViewProjection: ShaderNodeObject<Node>;
@@ -1,38 +1,51 @@
1
1
  import StorageBufferAttribute from "../../renderers/common/StorageBufferAttribute.js";
2
2
  import StorageInstancedBufferAttribute from "../../renderers/common/StorageInstancedBufferAttribute.js";
3
- import { GPUBufferBindingType } from "../../renderers/webgpu/utils/WebGPUConstants.js";
4
- import { NodeOrType, NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import { NodeAccess } from "../core/constants.js";
4
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
5
5
  import StorageArrayElementNode from "../utils/StorageArrayElementNode.js";
6
6
  import BufferNode from "./BufferNode.js";
7
7
 
8
- export default class StorageBufferNode extends BufferNode {
8
+ export default class StorageBufferNode extends BufferNode<StorageBufferAttribute | StorageInstancedBufferAttribute> {
9
9
  readonly isStorageBufferNode: true;
10
- bufferObject: boolean;
11
10
 
12
- access: GPUBufferBindingType;
11
+ access: NodeAccess;
12
+ isAtomic: boolean;
13
+ isPBO: boolean;
14
+
15
+ bufferObject: boolean;
13
16
 
14
17
  constructor(
15
18
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
16
- bufferType: string,
19
+ bufferType?: string | null,
17
20
  bufferCount?: number,
18
21
  );
19
22
 
20
23
  element(indexNode: NodeRepresentation): ShaderNodeObject<StorageArrayElementNode>;
21
24
 
22
- setBufferObject(value: boolean): this;
25
+ setPBO(value: boolean): this;
26
+
27
+ getPBO(): boolean;
23
28
 
24
- setAccess(value: GPUBufferBindingType): this;
29
+ setAccess(value: NodeAccess): this;
25
30
 
26
31
  toReadOnly(): this;
32
+
33
+ setAtmoic(value: boolean): this;
34
+
35
+ toAtomic(): this;
27
36
  }
28
37
 
29
38
  export const storage: (
30
39
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
31
- nodeOrType: NodeOrType,
32
- count: number,
40
+ type?: string | null,
41
+ count?: number,
33
42
  ) => ShaderNodeObject<StorageBufferNode>;
43
+
44
+ /**
45
+ * @deprecated
46
+ */
34
47
  export const storageObject: (
35
48
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
36
- nodeOrType: NodeOrType,
37
- count: number,
49
+ type?: string | null,
50
+ count?: number,
38
51
  ) => ShaderNodeObject<StorageBufferNode>;
@@ -1,5 +1,5 @@
1
- import { GPUStorageTextureAccess } from "../../renderers/webgpu/utils/WebGPUConstants.js";
2
1
  import { Texture } from "../../textures/Texture.js";
2
+ import { NodeAccess } from "../core/constants.js";
3
3
  import Node from "../core/Node.js";
4
4
  import NodeBuilder from "../core/NodeBuilder.js";
5
5
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
@@ -10,7 +10,7 @@ export default class StorageTextureNode extends TextureNode {
10
10
 
11
11
  readonly isStorageTextureNode: true;
12
12
 
13
- access: GPUStorageTextureAccess;
13
+ access: NodeAccess;
14
14
 
15
15
  constructor(
16
16
  value: Texture,
@@ -18,7 +18,9 @@ export default class StorageTextureNode extends TextureNode {
18
18
  storeNode?: Node | null,
19
19
  );
20
20
 
21
- setAccess(value: GPUStorageTextureAccess): this;
21
+ setAccess(value: NodeAccess): this;
22
+
23
+ toReadWrite(): this;
22
24
 
23
25
  toReadOnly(): this;
24
26
 
@@ -31,8 +31,13 @@ export default class TextureNode extends UniformNode<Texture> {
31
31
 
32
32
  getSampler(): boolean;
33
33
 
34
+ /**
35
+ * @deprecated
36
+ */
34
37
  uv(uvNode: NodeRepresentation): ShaderNodeObject<Node>;
35
38
 
39
+ sample(uvNode: NodeRepresentation): ShaderNodeObject<Node>;
40
+
36
41
  blur(amountNode: NodeRepresentation): ShaderNodeObject<Node>;
37
42
 
38
43
  level(levelNode: NodeRepresentation): ShaderNodeObject<Node>;
@@ -7,15 +7,16 @@ declare class UniformArrayElementNode extends ArrayElementNode {
7
7
  constructor(arrayBuffer: Node, indexNode: Node);
8
8
  }
9
9
 
10
- declare class UniformArrayNode extends BufferNode {
10
+ declare class UniformArrayNode extends BufferNode<unknown[]> {
11
11
  array: unknown[];
12
12
  elementType: string | null;
13
+ paddedType: string;
13
14
 
14
15
  readonly isArrayBufferNode: true;
15
16
 
16
17
  constructor(value: unknown[], elementType?: string | null);
17
18
 
18
- getElementLength(): number;
19
+ getPaddedType(): string;
19
20
 
20
21
  element(indexNode: NodeRepresentation): ShaderNodeObject<UniformArrayElementNode>;
21
22
  }
@@ -24,5 +24,7 @@ export default IndexNode;
24
24
 
25
25
  export const vertexIndex: ShaderNodeObject<IndexNode>;
26
26
  export const instanceIndex: ShaderNodeObject<IndexNode>;
27
+ export const subgroupIndex: ShaderNodeObject<IndexNode>;
28
+ export const invocationSubgroupIndex: ShaderNodeObject<IndexNode>;
27
29
  export const invocationLocalIndex: ShaderNodeObject<IndexNode>;
28
30
  export const drawIndex: ShaderNodeObject<IndexNode>;
@@ -57,6 +57,11 @@ interface NodeJSONOutputData {
57
57
  images?: unknown[];
58
58
  nodes?: NodeJSONOutputData[];
59
59
  }
60
+ /**
61
+ * Base class for all nodes.
62
+ *
63
+ * @augments EventDispatcher
64
+ */
60
65
  declare class Node extends EventDispatcher<{
61
66
  dispose: {};
62
67
  }> {
@@ -73,39 +78,271 @@ declare class Node extends EventDispatcher<{
73
78
  readonly isNode: true;
74
79
  readonly id: number;
75
80
  self?: this;
81
+ /**
82
+ * Constructs a new node.
83
+ *
84
+ * @param {String?} nodeType - The node type.
85
+ */
76
86
  constructor(nodeType?: string | null);
87
+ /**
88
+ * Set this property to `true` when the node should be regenerated.
89
+ *
90
+ * @type {Boolean}
91
+ * @default false
92
+ * @param {boolean} value
93
+ */
77
94
  set needsUpdate(value: boolean);
95
+ /**
96
+ * The type of the class. The value is usually the constructor name.
97
+ *
98
+ * @type {String}
99
+ * @readonly
100
+ */
78
101
  get type(): string | undefined;
102
+ /**
103
+ * Convenient method for defining {@link Node#update}.
104
+ *
105
+ * @param {Function} callback - The update method.
106
+ * @param {String} updateType - The update type.
107
+ * @return {Node} A reference to this node.
108
+ */
79
109
  onUpdate(callback: (this: this, frame: NodeFrame) => unknown, updateType: NodeUpdateType): this;
110
+ /**
111
+ * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
112
+ * this method automatically sets the update type to `FRAME`.
113
+ *
114
+ * @param {Function} callback - The update method.
115
+ * @return {Node} A reference to this node.
116
+ */
80
117
  onFrameUpdate(callback: (this: this, frame: NodeFrame) => void): this;
118
+ /**
119
+ * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
120
+ * this method automatically sets the update type to `RENDER`.
121
+ *
122
+ * @param {Function} callback - The update method.
123
+ * @return {Node} A reference to this node.
124
+ */
81
125
  onRenderUpdate(callback: (this: this, frame: NodeFrame) => void): this;
126
+ /**
127
+ * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
128
+ * this method automatically sets the update type to `OBJECT`.
129
+ *
130
+ * @param {Function} callback - The update method.
131
+ * @return {Node} A reference to this node.
132
+ */
82
133
  onObjectUpdate(callback: (this: this, frame: NodeFrame) => void): this;
134
+ /**
135
+ * Convenient method for defining {@link Node#updateReference}.
136
+ *
137
+ * @param {Function} callback - The update method.
138
+ * @return {Node} A reference to this node.
139
+ */
83
140
  onReference(callback: (this: this, frame: NodeBuilder | NodeFrame) => unknown): this;
141
+ /**
142
+ * The `this` reference might point to a Proxy so this method can be used
143
+ * to get the reference to the actual node instance.
144
+ *
145
+ * @return {Node} A reference to the node.
146
+ */
84
147
  getSelf(): this;
148
+ /**
149
+ * Nodes might refer to other objects like materials. This method allows to dynamically update the reference
150
+ * to such objects based on a given state (e.g. the current node frame or builder).
151
+ *
152
+ * @param {Any} state - This method can be invocated in different contexts so `state` can refer to any object type.
153
+ * @return {Any} The updated reference.
154
+ */
85
155
  updateReference(state: NodeBuilder | NodeFrame): unknown;
156
+ /**
157
+ * By default this method returns the value of the {@link Node#global} flag. This method
158
+ * can be overwritten in derived classes if an analytical way is required to determine the
159
+ * global status.
160
+ *
161
+ * @param {NodeBuilder} builder - The current node builder.
162
+ * @return {Boolean} Whether this node is global or not.
163
+ */
86
164
  isGlobal(builder: NodeBuilder): boolean;
165
+ /**
166
+ * Generator function that can be used to iterate over the child nodes.
167
+ *
168
+ * @generator
169
+ * @yields {Node} A child node.
170
+ */
87
171
  getChildren(): Generator<Node, void, unknown>;
172
+ /**
173
+ * Calling this method dispatches the `dispose` event. This event can be used
174
+ * to register event listeners for clean up tasks.
175
+ */
88
176
  dispose(): void;
177
+ /**
178
+ * Callback for {@link Node#traverse}.
179
+ *
180
+ * @callback traverseCallback
181
+ * @param {Node} node - The current node.
182
+ */
183
+ /**
184
+ * Can be used to traverse through the node's hierarchy.
185
+ *
186
+ * @param {traverseCallback} callback - A callback that is executed per node.
187
+ */
89
188
  traverse(callback: (node: Node) => void): void;
189
+ /**
190
+ * Returns the cache key for this node.
191
+ *
192
+ * @param {Boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced.
193
+ * @return {Number} The cache key of the node.
194
+ */
90
195
  getCacheKey(force?: boolean): number;
196
+ /**
197
+ * Generate a custom cache key for this node.
198
+ *
199
+ * @return {Number} The cache key of the node.
200
+ */
201
+ customCacheKey(): number;
202
+ /**
203
+ * Returns the references to this node which is by default `this`.
204
+ *
205
+ * @return {Node} A reference to this node.
206
+ */
91
207
  getScope(): this;
208
+ /**
209
+ * Returns the hash of the node which is used to identify the node. By default it's
210
+ * the {@link Node#uuid} however derived node classes might have to overwrite this method
211
+ * depending on their implementation.
212
+ *
213
+ * @param {NodeBuilder} builder - The current node builder.
214
+ * @return {String} The hash.
215
+ */
92
216
  getHash(builder: NodeBuilder): string;
217
+ /**
218
+ * Returns the update type of {@link Node#update}.
219
+ *
220
+ * @return {NodeUpdateType} The update type.
221
+ */
93
222
  getUpdateType(): NodeUpdateType;
223
+ /**
224
+ * Returns the update type of {@link Node#updateBefore}.
225
+ *
226
+ * @return {NodeUpdateType} The update type.
227
+ */
94
228
  getUpdateBeforeType(): NodeUpdateType;
229
+ /**
230
+ * Returns the update type of {@link Node#updateAfter}.
231
+ *
232
+ * @return {NodeUpdateType} The update type.
233
+ */
95
234
  getUpdateAfterType(): NodeUpdateType;
235
+ /**
236
+ * Certain types are composed of multiple elements. For example a `vec3`
237
+ * is composed of three `float` values. This method returns the type of
238
+ * these elements.
239
+ *
240
+ * @param {NodeBuilder} builder - The current node builder.
241
+ * @return {String} The type of the node.
242
+ */
96
243
  getElementType(builder: NodeBuilder): "bool" | "int" | "float" | "vec2" | "vec3" | "vec4" | "uint" | null;
244
+ /**
245
+ * Returns the node's type.
246
+ *
247
+ * @param {NodeBuilder} builder - The current node builder.
248
+ * @return {String} The type of the node.
249
+ */
97
250
  getNodeType(builder: NodeBuilder): string | null;
251
+ /**
252
+ * This method is used during the build process of a node and ensures
253
+ * equal nodes are not built multiple times but just once. For example if
254
+ * `attribute( 'uv' )` is used multiple times by the user, the build
255
+ * process makes sure to process just the first node.
256
+ *
257
+ * @param {NodeBuilder} builder - The current node builder.
258
+ * @return {Node} The shared node if possible. Otherwise `this` is returned.
259
+ */
98
260
  getShared(builder: NodeBuilder): Node;
261
+ /**
262
+ * Represents the setup stage which is the first step of the build process, see {@link Node#build} method.
263
+ * This method is often overwritten in derived modules to prepare the node which is used as the output/result.
264
+ * The output node must be returned in the `return` statement.
265
+ *
266
+ * @param {NodeBuilder} builder - The current node builder.
267
+ * @return {Node?} The output node.
268
+ */
99
269
  setup(builder: NodeBuilder): unknown;
270
+ /**
271
+ * Represents the analyze stage which is the second step of the build process, see {@link Node#build} method.
272
+ * This stage analyzes the node hierarchy and ensures descendent nodes are built.
273
+ *
274
+ * @param {NodeBuilder} builder - The current node builder.
275
+ */
100
276
  analyze(builder: NodeBuilder): void;
277
+ /**
278
+ * Represents the generate stage which is the third step of the build process, see {@link Node#build} method.
279
+ * This state builds the output node and returns the resulting shader string.
280
+ *
281
+ * @param {NodeBuilder} builder - The current node builder.
282
+ * @param {String?} output - Can be used to define the output type.
283
+ * @return {String?} The generated shader string.
284
+ */
101
285
  generate(builder: NodeBuilder, output?: string | null): string | null | undefined;
286
+ /**
287
+ * The method can be implemented to update the node's internal state before it is used to render an object.
288
+ * The {@link Node#updateBeforeType} property defines how often the update is executed.
289
+ *
290
+ * @abstract
291
+ * @param {NodeFrame} frame - A reference to the current node frame.
292
+ * @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
293
+ */
102
294
  updateBefore(frame: NodeFrame): void;
295
+ /**
296
+ * The method can be implemented to update the node's internal state after it was used to render an object.
297
+ * The {@link Node#updateAfterType} property defines how often the update is executed.
298
+ *
299
+ * @abstract
300
+ * @param {NodeFrame} frame - A reference to the current node frame.
301
+ * @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
302
+ */
103
303
  updateAfter(frame: NodeFrame): void;
304
+ /**
305
+ * The method can be implemented to update the node's internal state when it is used to render an object.
306
+ * The {@link Node#updateType} property defines how often the update is executed.
307
+ *
308
+ * @abstract
309
+ * @param {NodeFrame} frame - A reference to the current node frame.
310
+ * @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
311
+ */
104
312
  update(frame: NodeFrame): void;
313
+ /**
314
+ * This method performs the build of a node. The behavior of this method as well as its return value depend
315
+ * on the current build stage (setup, analyze or generate).
316
+ *
317
+ * @param {NodeBuilder} builder - The current node builder.
318
+ * @param {String?} output - Can be used to define the output type.
319
+ * @return {String?} When this method is executed in the setup or analyze stage, `null` is returned. In the generate stage, the generated shader string.
320
+ */
105
321
  build(builder: NodeBuilder, output?: string | null): string | null;
322
+ /**
323
+ * Returns the child nodes as a JSON object.
324
+ *
325
+ * @return {Object} The serialized child objects as JSON.
326
+ */
106
327
  getSerializeChildren(): Generator<import("./NodeUtils.js").NodeChild, void, unknown>;
328
+ /**
329
+ * Serializes the node to JSON.
330
+ *
331
+ * @param {Object} json - The output JSON object.
332
+ */
107
333
  serialize(json: NodeJSONIntermediateOutputData): void;
334
+ /**
335
+ * Deserializes the node from the given JSON.
336
+ *
337
+ * @param {Object} json - The JSON object.
338
+ */
108
339
  deserialize(json: NodeJSONInputData): void;
340
+ /**
341
+ * Serializes the node into the three.js JSON Object/Scene format.
342
+ *
343
+ * @param {Object?} meta - An optional JSON object that already holds serialized data from other scene objects.
344
+ * @return {Object} The serialized node.
345
+ */
109
346
  toJSON(meta?: NodeJSONMeta | string): NodeJSONOutputData;
110
347
  }
111
348
  export default Node;
@@ -1,9 +1,22 @@
1
1
  import Node from "./Node.js";
2
+ /**
3
+ * {@link NodeBuilder} is going to create instances of this class during the build process
4
+ * of nodes. They represent the final shader attributes that are going to be generated
5
+ * by the builder. Arrays of node attributes is maintained in {@link NodeBuilder#attributes}
6
+ * and {@link NodeBuilder#bufferAttributes} for this purpose.
7
+ */
2
8
  declare class NodeAttribute {
3
9
  readonly isNodeAttribute: true;
4
10
  name: string;
5
11
  type: string | null;
6
12
  node: Node | null;
13
+ /**
14
+ * Constructs a new node attribute.
15
+ *
16
+ * @param {String} name - The name of the attribute.
17
+ * @param {String} type - The type of the attribute.
18
+ * @param {Node?} node - An optional reference to the node.
19
+ */
7
20
  constructor(name: string, type: string | null, node?: Node | null);
8
21
  }
9
22
  export default NodeAttribute;
@@ -3,7 +3,6 @@ import { Object3D } from "../../core/Object3D.js";
3
3
  import { Material } from "../../materials/Material.js";
4
4
  import Renderer from "../../renderers/common/Renderer.js";
5
5
  import { Texture } from "../../textures/Texture.js";
6
- import FogNode from "../fog/FogNode.js";
7
6
  import LightsNode from "../lighting/LightsNode.js";
8
7
  import { NodeShaderStage } from "./constants.js";
9
8
  import Node from "./Node.js";
@@ -41,7 +40,7 @@ export default abstract class NodeBuilder {
41
40
  hashNodes: { [hash: string]: Node };
42
41
 
43
42
  lightsNode: LightsNode;
44
- fogNode: FogNode;
43
+ fogNode: Node;
45
44
 
46
45
  vertexShader: string;
47
46
  fragmentShader: string;
@@ -39,13 +39,34 @@ interface NodeData {
39
39
  interface BufferAttributeData {
40
40
  node: BufferAttributeNode;
41
41
  }
42
+ /**
43
+ * This utility class is used in {@link NodeBuilder} as an internal
44
+ * cache data structure for node data.
45
+ */
42
46
  declare class NodeCache {
43
47
  id: number;
44
48
  nodesData: WeakMap<Node | TypedArray | InterleavedBuffer | BufferAttribute, NodeData | BufferAttributeData>;
45
49
  parent: NodeCache | null;
50
+ /**
51
+ * Constructs a new node cache.
52
+ *
53
+ * @param {NodeCache?} parent - A reference to a parent cache.
54
+ */
46
55
  constructor(parent?: NodeCache | null);
56
+ /**
57
+ * Returns the data for the given node.
58
+ *
59
+ * @param {Node} node - The node.
60
+ * @return {Object?} The data for the node.
61
+ */
47
62
  getData(node: Node): NodeData | undefined;
48
63
  getData(node: TypedArray | InterleavedBuffer | BufferAttribute): BufferAttributeData | undefined;
64
+ /**
65
+ * Sets the data for a given node.
66
+ *
67
+ * @param {Node} node - The node.
68
+ * @param {Object} data - The data that should be cached.
69
+ */
49
70
  setData(node: Node, data: NodeData): void;
50
71
  setData(node: TypedArray | InterleavedBuffer | BufferAttribute, data: BufferAttributeData): void;
51
72
  }
@@ -1,5 +1,16 @@
1
1
  import NodeFunction from "./NodeFunction.js";
2
+ /**
3
+ * Base class for node parsers. A derived parser must be implemented
4
+ * for each supported native shader language.
5
+ */
2
6
  declare abstract class NodeParser {
7
+ /**
8
+ * The method parses the given native code an returns a node function.
9
+ *
10
+ * @abstract
11
+ * @param {String} source - The native shader code.
12
+ * @return {NodeFunction} A node function.
13
+ */
3
14
  abstract parseFunction(source: string): NodeFunction;
4
15
  }
5
16
  export default NodeParser;
@@ -1,14 +1,42 @@
1
1
  import UniformNode from "./UniformNode.js";
2
+ /**
3
+ * {@link NodeBuilder} is going to create instances of this class during the build process
4
+ * of nodes. They represent the final shader uniforms that are going to be generated
5
+ * by the builder. A dictionary of node uniforms is maintained in {@link NodeBuilder#uniforms}
6
+ * for this purpose.
7
+ */
2
8
  declare class NodeUniform<TValue> {
3
9
  readonly isNodeUniform: true;
4
10
  name: string;
5
11
  type: string | null;
6
12
  node: UniformNode<TValue>;
7
13
  needsUpdate: boolean | undefined;
14
+ /**
15
+ * Constructs a new node uniform.
16
+ *
17
+ * @param {String} name - The name of the uniform.
18
+ * @param {String} type - The type of the uniform.
19
+ * @param {UniformNode} node - An reference to the node.
20
+ */
8
21
  constructor(name: string, type: string | null, node: UniformNode<TValue>);
22
+ /**
23
+ * The value of the uniform node.
24
+ *
25
+ * @type {Any}
26
+ */
9
27
  get value(): TValue;
10
28
  set value(val: TValue);
29
+ /**
30
+ * The id of the uniform node.
31
+ *
32
+ * @type {Number}
33
+ */
11
34
  get id(): number;
35
+ /**
36
+ * The uniform node's group.
37
+ *
38
+ * @type {UniformGroupNode}
39
+ */
12
40
  get groupNode(): import("./UniformGroupNode.js").default;
13
41
  }
14
42
  export default NodeUniform;