@types/three 0.171.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 (121) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -5
  3. three/examples/jsm/controls/ArcballControls.d.ts +1 -1
  4. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  5. three/examples/jsm/csm/CSMShadowNode.d.ts +2 -3
  6. three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +13 -0
  7. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  8. three/examples/jsm/lines/LineSegments2.d.ts +3 -1
  9. three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
  10. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
  11. three/examples/jsm/objects/InstancedPoints.d.ts +10 -0
  12. three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
  13. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
  14. three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
  15. three/package.json +2 -2
  16. three/src/Three.Core.d.ts +2 -1
  17. three/src/Three.TSL.d.ts +9 -4
  18. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  19. three/src/Three.WebGPU.d.ts +2 -2
  20. three/src/cameras/CubeCamera.d.ts +19 -2
  21. three/src/core/RenderTarget.d.ts +3 -5
  22. three/src/core/RenderTarget3D.d.ts +9 -0
  23. three/src/core/RenderTargetArray.d.ts +9 -0
  24. three/src/materials/Material.d.ts +3 -1
  25. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  26. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  27. three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
  28. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
  29. three/src/materials/nodes/NodeMaterial.d.ts +3 -0
  30. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +56 -0
  31. three/src/nodes/Nodes.d.ts +1 -6
  32. three/src/nodes/TSL.d.ts +2 -3
  33. three/src/nodes/accessors/Arrays.d.ts +3 -2
  34. three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
  35. three/src/nodes/accessors/BufferNode.d.ts +4 -4
  36. three/src/nodes/accessors/MaterialNode.d.ts +3 -3
  37. three/src/nodes/accessors/ModelNode.d.ts +10 -2
  38. three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
  39. three/src/nodes/accessors/StorageBufferNode.d.ts +5 -1
  40. three/src/nodes/accessors/TextureNode.d.ts +5 -0
  41. three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
  42. three/src/nodes/core/Node.d.ts +237 -0
  43. three/src/nodes/core/NodeAttribute.d.ts +13 -0
  44. three/src/nodes/core/NodeBuilder.d.ts +1 -2
  45. three/src/nodes/core/NodeCache.d.ts +21 -0
  46. three/src/nodes/core/NodeParser.d.ts +11 -0
  47. three/src/nodes/core/NodeUniform.d.ts +28 -0
  48. three/src/nodes/core/NodeVar.d.ts +12 -0
  49. three/src/nodes/core/NodeVarying.d.ts +14 -0
  50. three/src/nodes/core/StructTypeNode.d.ts +19 -1
  51. three/src/nodes/core/UniformNode.d.ts +44 -0
  52. three/src/nodes/core/VaryingNode.d.ts +3 -0
  53. three/src/nodes/core/constants.d.ts +35 -0
  54. three/src/nodes/display/PassNode.d.ts +1 -1
  55. three/src/nodes/fog/Fog.d.ts +26 -0
  56. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
  57. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
  58. three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
  59. three/src/nodes/lighting/ShadowNode.d.ts +2 -1
  60. three/src/nodes/math/MathNode.d.ts +13 -4
  61. three/src/nodes/tsl/TSLCore.d.ts +48 -16
  62. three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
  63. three/src/nodes/utils/LoopNode.d.ts +23 -2
  64. three/src/objects/ClippingGroup.d.ts +1 -1
  65. three/src/renderers/WebGLRenderer.d.ts +8 -8
  66. three/src/renderers/common/Animation.d.ts +30 -0
  67. three/src/renderers/common/Attributes.d.ts +31 -0
  68. three/src/renderers/common/Backend.d.ts +11 -0
  69. three/src/renderers/common/Background.d.ts +22 -0
  70. three/src/renderers/common/BindGroup.d.ts +15 -0
  71. three/src/renderers/common/Binding.d.ts +24 -0
  72. three/src/renderers/common/Bindings.d.ts +54 -0
  73. three/src/renderers/common/Buffer.d.ts +31 -0
  74. three/src/renderers/common/BufferUtils.d.ts +26 -0
  75. three/src/renderers/common/BundleGroup.d.ts +22 -0
  76. three/src/renderers/common/ChainMap.d.ts +31 -1
  77. three/src/renderers/common/ClippingContext.d.ts +45 -0
  78. three/src/renderers/common/Color4.d.ts +36 -0
  79. three/src/renderers/common/ComputePipeline.d.ts +12 -0
  80. three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
  81. three/src/renderers/common/DataMap.d.ts +30 -0
  82. three/src/renderers/common/Geometries.d.ts +52 -0
  83. three/src/renderers/common/Info.d.ts +27 -0
  84. three/src/renderers/common/Pipeline.d.ts +11 -0
  85. three/src/renderers/common/Pipelines.d.ts +104 -0
  86. three/src/renderers/common/ProgrammableStage.d.ts +19 -1
  87. three/src/renderers/common/RenderBundle.d.ts +15 -4
  88. three/src/renderers/common/RenderBundles.d.ts +20 -2
  89. three/src/renderers/common/RenderContext.d.ts +22 -0
  90. three/src/renderers/common/RenderContexts.d.ts +42 -3
  91. three/src/renderers/common/RenderList.d.ts +85 -0
  92. three/src/renderers/common/RenderLists.d.ts +21 -0
  93. three/src/renderers/common/RenderObject.d.ts +152 -1
  94. three/src/renderers/common/RenderObjects.d.ts +53 -0
  95. three/src/renderers/common/RenderPipeline.d.ts +13 -0
  96. three/src/renderers/common/Renderer.d.ts +583 -6
  97. three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
  98. three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
  99. three/src/renderers/common/Textures.d.ts +66 -0
  100. three/src/renderers/common/Uniform.d.ts +106 -0
  101. three/src/renderers/common/UniformBuffer.d.ts +12 -0
  102. three/src/renderers/common/UniformsGroup.d.ts +103 -0
  103. three/src/renderers/common/nodes/NodeBuilderState.d.ts +30 -0
  104. three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
  105. three/src/renderers/common/nodes/NodeUniform.d.ts +154 -0
  106. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
  107. three/src/renderers/common/nodes/Nodes.d.ts +185 -11
  108. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
  109. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
  110. three/src/textures/DataTexture.d.ts +2 -2
  111. three/src/textures/Texture.d.ts +3 -0
  112. three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
  113. three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
  114. three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
  115. three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
  116. three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
  117. three/src/Three.Legacy.d.ts +0 -20
  118. three/src/nodes/core/UniformGroup.d.ts +0 -7
  119. three/src/nodes/fog/FogExp2Node.d.ts +0 -14
  120. three/src/nodes/fog/FogNode.d.ts +0 -20
  121. three/src/nodes/fog/FogRangeNode.d.ts +0 -19
@@ -6,6 +6,7 @@ import { RenderTarget } from "../../core/RenderTarget.js";
6
6
  import { Material } from "../../materials/Material.js";
7
7
  import { Color } from "../../math/Color.js";
8
8
  import MRTNode from "../../nodes/core/MRTNode.js";
9
+ import Node from "../../nodes/core/Node.js";
9
10
  import LightsNode from "../../nodes/lighting/LightsNode.js";
10
11
  import { Scene } from "../../scenes/Scene.js";
11
12
  import { CubeTexture } from "../../textures/CubeTexture.js";
@@ -43,24 +44,35 @@ export interface RendererState {
43
44
 
44
45
  export function saveRendererState(renderer: Renderer, state?: RendererState): RendererState;
45
46
 
46
- export function resetRendererState(renderer: Renderer, state?: RendererState): RendererState;
47
+ export function resetRendererState(renderer: Renderer, state: RendererState): RendererState;
47
48
 
48
49
  export function restoreRendererState(renderer: Renderer, state: RendererState): void;
49
50
 
50
- // renderer and scene state
51
+ // scene state
51
52
 
52
- export interface RendererAndSceneState extends RendererState {
53
+ export interface SceneState {
53
54
  background: Color | Texture | CubeTexture | null;
54
55
  backgroundNode: Node | null | undefined;
55
56
  overrideMaterial: Material | null;
56
57
  }
57
58
 
59
+ export function saveSceneState(scene: Scene, state?: SceneState): SceneState;
60
+
61
+ export function resetSceneState(scene: Scene, state: SceneState): SceneState;
62
+
63
+ export function restoreSceneState(scene: Scene, state: SceneState): SceneState;
64
+
65
+ // renderer and scene state
66
+
67
+ export interface RendererAndSceneState extends RendererState, SceneState {
68
+ }
69
+
58
70
  export function saveRendererAndSceneState(
59
71
  renderer: RendererState,
60
72
  scene: Scene,
61
73
  state?: RendererAndSceneState,
62
74
  ): RendererAndSceneState;
63
75
 
64
- export function resetRendererAndSceneState(renderer: Renderer, state?: RendererAndSceneState): RendererAndSceneState;
76
+ export function resetRendererAndSceneState(renderer: Renderer, state: RendererAndSceneState): RendererAndSceneState;
65
77
 
66
78
  export function restoreRendererAndSceneState(renderer: Renderer, state: RendererAndSceneState): void;
@@ -3,5 +3,5 @@ import { BufferAttribute, TypedArray } from "../../core/BufferAttribute.js";
3
3
  export default class StorageBufferAttribute extends BufferAttribute {
4
4
  readonly isStorageBufferAttribute: true;
5
5
 
6
- constructor(array: TypedArray, itemSize: number);
6
+ constructor(array: TypedArray | number, itemSize: number);
7
7
  }
@@ -43,6 +43,12 @@ interface TextureOptions {
43
43
  needsMipmaps?: boolean;
44
44
  levels?: number;
45
45
  }
46
+ /**
47
+ * This module manages the textures of the renderer.
48
+ *
49
+ * @private
50
+ * @augments DataMap
51
+ */
46
52
  declare class Textures extends DataMap<{
47
53
  renderTarget: {
48
54
  key: RenderTarget;
@@ -56,13 +62,73 @@ declare class Textures extends DataMap<{
56
62
  renderer: Renderer;
57
63
  backend: Backend;
58
64
  info: Info;
65
+ /**
66
+ * Constructs a new texture management component.
67
+ *
68
+ * @param {Renderer} renderer - The renderer.
69
+ * @param {Backend} backend - The renderer's backend.
70
+ * @param {Info} info - Renderer component for managing metrics and monitoring data.
71
+ */
59
72
  constructor(renderer: Renderer, backend: Backend, info: Info);
73
+ /**
74
+ * Updates the given render target. Based on the given render target configuration,
75
+ * it updates the texture states representing the attachments of the framebuffer.
76
+ *
77
+ * @param {RenderTarget} renderTarget - The render target to update.
78
+ * @param {Number} [activeMipmapLevel=0] - The active mipmap level.
79
+ */
60
80
  updateRenderTarget(renderTarget: RenderTarget, activeMipmapLevel?: number): void;
81
+ /**
82
+ * Updates the given texture. Depending on the texture state, this method
83
+ * triggers the upload of texture data to the GPU memory. If the texture data are
84
+ * not yet ready for the upload, it uses default texture data for as a placeholder.
85
+ *
86
+ * @param {Texture} texture - The texture to update.
87
+ * @param {Object} [options={}] - The options.
88
+ */
61
89
  updateTexture(texture: Texture, options?: TextureOptions): void;
90
+ /**
91
+ * Computes the size of the given texture and writes the result
92
+ * into the target vector. This vector is also returned by the
93
+ * method.
94
+ *
95
+ * If no texture data are available for the compute yet, the method
96
+ * returns default size values.
97
+ *
98
+ * @param {Texture} texture - The texture to compute the size for.
99
+ * @param {Vector3} target - The target vector.
100
+ * @return {Vector3} The target vector.
101
+ */
62
102
  getSize(texture: Texture, target?: SizeVector3Unitialized): SizeVector3;
103
+ /**
104
+ * Computes the number of mipmap levels for the given texture.
105
+ *
106
+ * @param {Texture} texture - The texture.
107
+ * @param {Number} width - The texture's width.
108
+ * @param {Number} height - The texture's height.
109
+ * @return {Number} The number of mipmap levels.
110
+ */
63
111
  getMipLevels(texture: Texture, width: number, height: number): number;
112
+ /**
113
+ * Returns `true` if the given texture requires mipmaps.
114
+ *
115
+ * @param {Texture} texture - The texture.
116
+ * @return {Boolean} Whether mipmaps are required or not.
117
+ */
64
118
  needsMipmaps(texture: Texture): boolean;
119
+ /**
120
+ * Returns `true` if the given texture is an environment map.
121
+ *
122
+ * @param {Texture} texture - The texture.
123
+ * @return {Boolean} Whether the given texture is an environment map or not.
124
+ */
65
125
  isEnvironmentTexture(texture: Texture): boolean;
126
+ /**
127
+ * Frees internal resource when the given texture isn't
128
+ * required anymore.
129
+ *
130
+ * @param {Texture} texture - The texture to destroy.
131
+ */
66
132
  _destroyTexture(texture: Texture): void;
67
133
  }
68
134
  export default Textures;
@@ -4,42 +4,148 @@ import { Matrix4 } from "../../math/Matrix4.js";
4
4
  import { Vector2 } from "../../math/Vector2.js";
5
5
  import { Vector3 } from "../../math/Vector3.js";
6
6
  import { Vector4 } from "../../math/Vector4.js";
7
+ /**
8
+ * Abstract base class for uniforms.
9
+ *
10
+ * @abstract
11
+ * @private
12
+ */
7
13
  declare class Uniform<TValue> {
8
14
  name: string;
9
15
  value: TValue;
10
16
  boundary: number;
11
17
  itemSize: number;
12
18
  offset: number;
19
+ /**
20
+ * Constructs a new uniform.
21
+ *
22
+ * @param {String} name - The uniform's name.
23
+ * @param {Any} value - The uniform's value.
24
+ */
13
25
  constructor(name: string, value: TValue);
26
+ /**
27
+ * Sets the uniform's value.
28
+ *
29
+ * @param {Any} value - The value to set.
30
+ */
14
31
  setValue(value: TValue): void;
32
+ /**
33
+ * Returns the uniform's value.
34
+ *
35
+ * @return {Any} The value.
36
+ */
15
37
  getValue(): TValue;
16
38
  }
39
+ /**
40
+ * Represents a Number uniform.
41
+ *
42
+ * @private
43
+ * @augments Uniform
44
+ */
17
45
  declare class NumberUniform extends Uniform<number> {
18
46
  readonly isNumberUniform: true;
47
+ /**
48
+ * Constructs a new Number uniform.
49
+ *
50
+ * @param {String} name - The uniform's name.
51
+ * @param {Number} value - The uniform's value.
52
+ */
19
53
  constructor(name: string, value?: number);
20
54
  }
55
+ /**
56
+ * Represents a Vector2 uniform.
57
+ *
58
+ * @private
59
+ * @augments Uniform
60
+ */
21
61
  declare class Vector2Uniform extends Uniform<Vector2> {
22
62
  readonly isVector2Uniform: true;
63
+ /**
64
+ * Constructs a new Number uniform.
65
+ *
66
+ * @param {String} name - The uniform's name.
67
+ * @param {Vector2} value - The uniform's value.
68
+ */
23
69
  constructor(name: string, value?: Vector2);
24
70
  }
71
+ /**
72
+ * Represents a Vector3 uniform.
73
+ *
74
+ * @private
75
+ * @augments Uniform
76
+ */
25
77
  declare class Vector3Uniform extends Uniform<Vector3> {
26
78
  readonly isVector3Uniform: true;
79
+ /**
80
+ * Constructs a new Number uniform.
81
+ *
82
+ * @param {String} name - The uniform's name.
83
+ * @param {Vector3} value - The uniform's value.
84
+ */
27
85
  constructor(name: string, value?: Vector3);
28
86
  }
87
+ /**
88
+ * Represents a Vector4 uniform.
89
+ *
90
+ * @private
91
+ * @augments Uniform
92
+ */
29
93
  declare class Vector4Uniform extends Uniform<Vector4> {
30
94
  readonly isVector4Uniform: true;
95
+ /**
96
+ * Constructs a new Number uniform.
97
+ *
98
+ * @param {String} name - The uniform's name.
99
+ * @param {Vector4} value - The uniform's value.
100
+ */
31
101
  constructor(name: string, value?: Vector4);
32
102
  }
103
+ /**
104
+ * Represents a Color uniform.
105
+ *
106
+ * @private
107
+ * @augments Uniform
108
+ */
33
109
  declare class ColorUniform extends Uniform<Color> {
34
110
  readonly isColorUniform: true;
111
+ /**
112
+ * Constructs a new Number uniform.
113
+ *
114
+ * @param {String} name - The uniform's name.
115
+ * @param {Color} value - The uniform's value.
116
+ */
35
117
  constructor(name: string, value?: Color);
36
118
  }
119
+ /**
120
+ * Represents a Matrix3 uniform.
121
+ *
122
+ * @private
123
+ * @augments Uniform
124
+ */
37
125
  declare class Matrix3Uniform extends Uniform<Matrix3> {
38
126
  readonly isMatrix3Uniform: true;
127
+ /**
128
+ * Constructs a new Number uniform.
129
+ *
130
+ * @param {String} name - The uniform's name.
131
+ * @param {Matrix3} value - The uniform's value.
132
+ */
39
133
  constructor(name: string, value?: Matrix3);
40
134
  }
135
+ /**
136
+ * Represents a Matrix4 uniform.
137
+ *
138
+ * @private
139
+ * @augments Uniform
140
+ */
41
141
  declare class Matrix4Uniform extends Uniform<Matrix4> {
42
142
  readonly isMatrix4Uniform: true;
143
+ /**
144
+ * Constructs a new Number uniform.
145
+ *
146
+ * @param {String} name - The uniform's name.
147
+ * @param {Matrix4} value - The uniform's value.
148
+ */
43
149
  constructor(name: string, value?: Matrix4);
44
150
  }
45
151
  export { ColorUniform, Matrix3Uniform, Matrix4Uniform, NumberUniform, Vector2Uniform, Vector3Uniform, Vector4Uniform };
@@ -1,6 +1,18 @@
1
1
  import Buffer from "./Buffer.js";
2
+ /**
3
+ * Represents a uniform buffer binding type.
4
+ *
5
+ * @private
6
+ * @augments Buffer
7
+ */
2
8
  declare class UniformBuffer extends Buffer {
3
9
  readonly isUniformBuffer: true;
10
+ /**
11
+ * Constructs a new uniform buffer.
12
+ *
13
+ * @param {String} name - The buffer's name.
14
+ * @param {TypedArray} [buffer=null] - The buffer.
15
+ */
4
16
  constructor(name?: string, buffer?: null);
5
17
  }
6
18
  export default UniformBuffer;
@@ -9,25 +9,128 @@ import {
9
9
  Vector4NodeUniform,
10
10
  } from "./nodes/NodeUniform.js";
11
11
  import UniformBuffer from "./UniformBuffer.js";
12
+ /**
13
+ * This class represents a uniform buffer binding but with
14
+ * an API that allows to maintain individual uniform objects.
15
+ *
16
+ * @private
17
+ * @augments UniformBuffer
18
+ */
12
19
  declare class UniformsGroup extends UniformBuffer {
13
20
  readonly isUniformsGroup: true;
14
21
  _values: number[] | null;
15
22
  uniforms: NodeUniformGPU[];
23
+ /**
24
+ * Constructs a new uniforms group.
25
+ *
26
+ * @param {String} name - The group's name.
27
+ */
16
28
  constructor(name?: string);
29
+ /**
30
+ * Adds a uniform to this group.
31
+ *
32
+ * @param {Uniform} uniform - The uniform to add.
33
+ * @return {UniformsGroup} A reference to this group.
34
+ */
17
35
  addUniform(uniform: NodeUniformGPU): this;
36
+ /**
37
+ * Removes a uniform from this group.
38
+ *
39
+ * @param {Uniform} uniform - The uniform to remove.
40
+ * @return {UniformsGroup} A reference to this group.
41
+ */
18
42
  removeUniform(uniform: NodeUniformGPU): this;
43
+ /**
44
+ * An array with the raw uniform values.
45
+ *
46
+ * @type {Array<Number>}
47
+ */
19
48
  get values(): number[];
49
+ /**
50
+ * A Float32 array buffer with the uniform values.
51
+ *
52
+ * @type {Float32Array}
53
+ */
20
54
  get buffer(): Float32Array;
55
+ /**
56
+ * The byte length of the buffer with correct buffer alignment.
57
+ *
58
+ * @type {Number}
59
+ */
21
60
  get byteLength(): number;
61
+ /**
62
+ * Updates this group by updating each uniform object of
63
+ * the internal uniform list. The uniform objects check if their
64
+ * values has actually changed so this method only returns
65
+ * `true` if there is a real value change.
66
+ *
67
+ * @return {Boolean} Whether the uniforms have been updated and
68
+ * must be uploaded to the GPU.
69
+ */
22
70
  update(): boolean;
71
+ /**
72
+ * Updates a given uniform by calling an update method matching
73
+ * the uniforms type.
74
+ *
75
+ * @param {Uniform} uniform - The uniform to update.
76
+ * @return {Boolean} Whether the uniform has been updated or not.
77
+ */
23
78
  updateByType(uniform: NodeUniformGPU): boolean | undefined;
79
+ /**
80
+ * Updates a given Number uniform.
81
+ *
82
+ * @param {NumberUniform} uniform - The Number uniform.
83
+ * @return {Boolean} Whether the uniform has been updated or not.
84
+ */
24
85
  updateNumber(uniform: NumberNodeUniform): boolean;
86
+ /**
87
+ * Updates a given Vector2 uniform.
88
+ *
89
+ * @param {Vector2Uniform} uniform - The Vector2 uniform.
90
+ * @return {Boolean} Whether the uniform has been updated or not.
91
+ */
25
92
  updateVector2(uniform: Vector2NodeUniform): boolean;
93
+ /**
94
+ * Updates a given Vector3 uniform.
95
+ *
96
+ * @param {Vector3Uniform} uniform - The Vector3 uniform.
97
+ * @return {Boolean} Whether the uniform has been updated or not.
98
+ */
26
99
  updateVector3(uniform: Vector3NodeUniform): boolean;
100
+ /**
101
+ * Updates a given Vector4 uniform.
102
+ *
103
+ * @param {Vector4Uniform} uniform - The Vector4 uniform.
104
+ * @return {Boolean} Whether the uniform has been updated or not.
105
+ */
27
106
  updateVector4(uniform: Vector4NodeUniform): boolean;
107
+ /**
108
+ * Updates a given Color uniform.
109
+ *
110
+ * @param {ColorUniform} uniform - The Color uniform.
111
+ * @return {Boolean} Whether the uniform has been updated or not.
112
+ */
28
113
  updateColor(uniform: ColorNodeUniform): boolean;
114
+ /**
115
+ * Updates a given Matrix3 uniform.
116
+ *
117
+ * @param {Matrix3Uniform} uniform - The Matrix3 uniform.
118
+ * @return {Boolean} Whether the uniform has been updated or not.
119
+ */
29
120
  updateMatrix3(uniform: Matrix3NodeUniform): boolean;
121
+ /**
122
+ * Updates a given Matrix4 uniform.
123
+ *
124
+ * @param {Matrix4Uniform} uniform - The Matrix4 uniform.
125
+ * @return {Boolean} Whether the uniform has been updated or not.
126
+ */
30
127
  updateMatrix4(uniform: Matrix4NodeUniform): boolean;
128
+ /**
129
+ * Returns a typed array that matches the given data type.
130
+ *
131
+ * @param {String} type - The data type.
132
+ * @return {TypedArray} The typed array.
133
+ */
31
134
  _getBufferForType(type: string | null): Int32Array | Uint32Array | Float32Array;
32
135
  }
33
136
  export default UniformsGroup;
@@ -2,6 +2,15 @@ import NodeMaterialObserver from "../../../materials/nodes/manager/NodeMaterialO
2
2
  import Node from "../../../nodes/core/Node.js";
3
3
  import NodeAttribute from "../../../nodes/core/NodeAttribute.js";
4
4
  import BindGroup from "../BindGroup.js";
5
+ /**
6
+ * This module represents the state of a node builder after it was
7
+ * used to build the nodes for a render object. The state holds the
8
+ * results of the build for further processing in the renderer.
9
+ *
10
+ * Render objects with identical cache keys share the same node builder state.
11
+ *
12
+ * @private
13
+ */
5
14
  declare class NodeBuilderState {
6
15
  vertexShader: string | null;
7
16
  fragmentShader: string | null;
@@ -14,6 +23,20 @@ declare class NodeBuilderState {
14
23
  updateAfterNodes: Node[];
15
24
  monitor: NodeMaterialObserver;
16
25
  usedTimes: number;
26
+ /**
27
+ * Constructs a new node builder state.
28
+ *
29
+ * @param {String?} vertexShader - The native vertex shader code.
30
+ * @param {String?} fragmentShader - The native fragment shader code.
31
+ * @param {String?} computeShader - The native compute shader code.
32
+ * @param {Array<NodeAttribute>} nodeAttributes - An array of node attributes.
33
+ * @param {Array<BindGroup>} bindings - An array of bind groups.
34
+ * @param {Array<Node>} updateNodes - An array of nodes that implement their `update()` method.
35
+ * @param {Array<Node>} updateBeforeNodes - An array of nodes that implement their `updateBefore()` method.
36
+ * @param {Array<Node>} updateAfterNodes - An array of nodes that implement their `updateAfter()` method.
37
+ * @param {NodeMaterialObserver} monitor - A node material observer.
38
+ * @param {Array<Object>} transforms - An array with transform attribute objects. Only relevant when using compute shaders with WebGL 2.
39
+ */
17
40
  constructor(
18
41
  vertexShader: string | null,
19
42
  fragmentShader: string | null,
@@ -26,6 +49,13 @@ declare class NodeBuilderState {
26
49
  monitor: NodeMaterialObserver,
27
50
  transforms?: never[],
28
51
  );
52
+ /**
53
+ * This method is used to create a array of bind groups based
54
+ * on the existing bind groups of this state. Shared groups are
55
+ * not cloned.
56
+ *
57
+ * @return {Array<BindGroup>} A array of bind groups.
58
+ */
29
59
  createBindings(): BindGroup[];
30
60
  }
31
61
  export default NodeBuilderState;
@@ -5,6 +5,14 @@ import NodeMaterial from "../../../materials/nodes/NodeMaterial.js";
5
5
  import Node from "../../../nodes/core/Node.js";
6
6
  import AnalyticLightNode from "../../../nodes/lighting/AnalyticLightNode.js";
7
7
  import { NodeRepresentation, ShaderNodeObject } from "../../../nodes/tsl/TSLCore.js";
8
+ /**
9
+ * The purpose of a node library is to assign node implementations
10
+ * to existing library features. In `WebGPURenderer` lights, materials
11
+ * which are not based on `NodeMaterial` as well as tone mapping techniques
12
+ * are implemented with node-based modules.
13
+ *
14
+ * @private
15
+ */
8
16
  declare class NodeLibrary {
9
17
  lightNodes: WeakMap<{
10
18
  new(): Light;
@@ -18,26 +26,89 @@ declare class NodeLibrary {
18
26
  ToneMapping,
19
27
  (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>
20
28
  >;
29
+ /**
30
+ * Constructs a new node library.
31
+ */
21
32
  constructor();
33
+ /**
34
+ * Returns a matching node material instance for the given material object.
35
+ *
36
+ * This method also assigns/copies the properties of the given material object
37
+ * to the node material. This is done to make sure the current material
38
+ * configuration carries over to the node version.
39
+ *
40
+ * @param {Material} material - A material.
41
+ * @return {NodeMaterial} The corresponding node material.
42
+ */
22
43
  fromMaterial(material: Material): Material | NodeMaterial | null;
44
+ /**
45
+ * Adds a tone mapping node function for a tone mapping technique (constant).
46
+ *
47
+ * @param {Function} toneMappingNode - The tone mapping node function.
48
+ * @param {Number} toneMapping - The tone mapping.
49
+ */
23
50
  addToneMapping(
24
51
  toneMappingNode: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>,
25
52
  toneMapping: ToneMapping,
26
53
  ): void;
54
+ /**
55
+ * Returns a tone mapping node function for a tone mapping technique (constant).
56
+ *
57
+ * @param {Number} toneMapping - The tone mapping.
58
+ * @return {Function?} The tone mapping node function. Returns `null` if no node function is found.
59
+ */
27
60
  getToneMappingFunction(
28
61
  toneMapping: ToneMapping,
29
62
  ): ((color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>) | null;
63
+ /**
64
+ * Returns a node material class definition for a material type.
65
+ *
66
+ * @param {Sring} materialType - The material type.
67
+ * @return {NodeMaterial.constructor?} The node material class definition. Returns `null` if no node material is found.
68
+ */
30
69
  getMaterialNodeClass(materialType: string): (new() => NodeMaterial) | null;
70
+ /**
71
+ * Adds a node material class definition for a given material type.
72
+ *
73
+ * @param {NodeMaterial.constructor} materialNodeClass - The node material class definition.
74
+ * @param {Sring} materialClassType - The material type.
75
+ */
31
76
  addMaterial(materialNodeClass: {
32
77
  new(): NodeMaterial;
33
78
  }, materialClassType: string): void;
79
+ /**
80
+ * Returns a light node class definition for a light class definition.
81
+ *
82
+ * @param {Light.constructor} light - The light class definition.
83
+ * @return {AnalyticLightNode.constructor?} The light node class definition. Returns `null` if no light node is found.
84
+ */
34
85
  getLightNodeClass(light: Light): (new(light: Light) => AnalyticLightNode<Light>) | null;
86
+ /**
87
+ * Adds a light node class definition for a given light class definition.
88
+ *
89
+ * @param {AnalyticLightNode.constructor} lightNodeClass - The light node class definition.
90
+ * @param {Light.constructor} lightClass - The light class definition.
91
+ */
35
92
  addLight<TLight extends Light>(lightNodeClass: {
36
93
  new(light: TLight): AnalyticLightNode<TLight>;
37
94
  }, lightClass: {
38
95
  new(): TLight;
39
96
  }): void;
97
+ /**
98
+ * Adds a node class definition for the given type to the provided type library.
99
+ *
100
+ * @param {Any} nodeClass - The node class definition.
101
+ * @param {String} type - The object type.
102
+ * @param {Map} library - The type library.
103
+ */
40
104
  addType<TNodeClass, TType>(nodeClass: TNodeClass, type: TType, library: Map<TType, TNodeClass>): void;
105
+ /**
106
+ * Adds a node class definition for the given class definition to the provided type library.
107
+ *
108
+ * @param {Any} nodeClass - The node class definition.
109
+ * @param {Any} baseClass - The class definition.
110
+ * @param {WeakMap} library - The type library.
111
+ */
41
112
  addClass<TNodeClass, TBaseClass extends object>(
42
113
  nodeClass: TNodeClass,
43
114
  baseClass: TBaseClass,