@types/three 0.171.0 → 0.173.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 (152) 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/TextGeometry.d.ts +0 -8
  7. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  8. three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
  9. three/examples/jsm/lines/LineSegments2.d.ts +3 -1
  10. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
  11. three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
  12. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
  13. three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
  14. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
  15. three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
  16. three/examples/jsm/webxr/XRButton.d.ts +4 -2
  17. three/package.json +2 -2
  18. three/src/Three.Core.d.ts +4 -1
  19. three/src/Three.TSL.d.ts +18 -5
  20. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  21. three/src/Three.WebGPU.d.ts +2 -2
  22. three/src/animation/AnimationClip.d.ts +1 -1
  23. three/src/cameras/ArrayCamera.d.ts +7 -6
  24. three/src/cameras/Camera.d.ts +7 -7
  25. three/src/cameras/CubeCamera.d.ts +19 -2
  26. three/src/constants.d.ts +6 -0
  27. three/src/core/BufferAttribute.d.ts +5 -0
  28. three/src/core/RenderTarget.d.ts +3 -5
  29. three/src/core/RenderTarget3D.d.ts +9 -0
  30. three/src/core/RenderTargetArray.d.ts +9 -0
  31. three/src/materials/Material.d.ts +3 -1
  32. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  33. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  34. three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
  35. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
  36. three/src/materials/nodes/NodeMaterial.d.ts +3 -0
  37. three/src/materials/nodes/NodeMaterials.d.ts +0 -4
  38. three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
  39. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +57 -0
  40. three/src/math/Matrix4.d.ts +2 -1
  41. three/src/nodes/Nodes.d.ts +6 -7
  42. three/src/nodes/TSL.d.ts +6 -3
  43. three/src/nodes/accessors/Arrays.d.ts +10 -2
  44. three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
  45. three/src/nodes/accessors/BufferNode.d.ts +4 -4
  46. three/src/nodes/accessors/Camera.d.ts +1 -0
  47. three/src/nodes/accessors/MaterialNode.d.ts +6 -6
  48. three/src/nodes/accessors/ModelNode.d.ts +10 -2
  49. three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
  50. three/src/nodes/accessors/StorageBufferNode.d.ts +12 -4
  51. three/src/nodes/accessors/TextureNode.d.ts +5 -0
  52. three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
  53. three/src/nodes/core/ArrayNode.d.ts +26 -0
  54. three/src/nodes/core/Node.d.ts +245 -0
  55. three/src/nodes/core/NodeAttribute.d.ts +13 -0
  56. three/src/nodes/core/NodeBuilder.d.ts +1 -2
  57. three/src/nodes/core/NodeCache.d.ts +23 -1
  58. three/src/nodes/core/NodeParser.d.ts +11 -0
  59. three/src/nodes/core/NodeUniform.d.ts +28 -0
  60. three/src/nodes/core/NodeVar.d.ts +18 -2
  61. three/src/nodes/core/NodeVarying.d.ts +14 -0
  62. three/src/nodes/core/StructNode.d.ts +21 -0
  63. three/src/nodes/core/StructType.d.ts +8 -0
  64. three/src/nodes/core/StructTypeNode.d.ts +41 -4
  65. three/src/nodes/core/UniformNode.d.ts +44 -0
  66. three/src/nodes/core/VarNode.d.ts +8 -1
  67. three/src/nodes/core/VaryingNode.d.ts +12 -0
  68. three/src/nodes/core/constants.d.ts +35 -0
  69. three/src/nodes/display/PassNode.d.ts +1 -1
  70. three/src/nodes/fog/Fog.d.ts +26 -0
  71. three/src/nodes/geometry/RangeNode.d.ts +6 -11
  72. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
  73. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
  74. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
  75. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
  76. three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
  77. three/src/nodes/lighting/ShadowNode.d.ts +2 -1
  78. three/src/nodes/math/MathNode.d.ts +15 -4
  79. three/src/nodes/math/OperatorNode.d.ts +2 -0
  80. three/src/nodes/shapes/Shapes.d.ts +4 -0
  81. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  82. three/src/nodes/tsl/TSLCore.d.ts +62 -17
  83. three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
  84. three/src/nodes/utils/LoopNode.d.ts +23 -2
  85. three/src/nodes/utils/MemberNode.d.ts +11 -0
  86. three/src/objects/BatchedMesh.d.ts +1 -0
  87. three/src/objects/ClippingGroup.d.ts +1 -1
  88. three/src/objects/InstancedMesh.d.ts +4 -3
  89. three/src/renderers/WebGLRenderer.d.ts +10 -10
  90. three/src/renderers/common/Animation.d.ts +43 -1
  91. three/src/renderers/common/Attributes.d.ts +31 -0
  92. three/src/renderers/common/Backend.d.ts +11 -0
  93. three/src/renderers/common/Background.d.ts +22 -0
  94. three/src/renderers/common/BindGroup.d.ts +15 -0
  95. three/src/renderers/common/Binding.d.ts +24 -0
  96. three/src/renderers/common/Bindings.d.ts +54 -0
  97. three/src/renderers/common/Buffer.d.ts +31 -0
  98. three/src/renderers/common/BufferUtils.d.ts +26 -0
  99. three/src/renderers/common/BundleGroup.d.ts +22 -0
  100. three/src/renderers/common/ChainMap.d.ts +33 -3
  101. three/src/renderers/common/ClippingContext.d.ts +45 -0
  102. three/src/renderers/common/Color4.d.ts +40 -0
  103. three/src/renderers/common/ComputePipeline.d.ts +12 -0
  104. three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
  105. three/src/renderers/common/DataMap.d.ts +30 -0
  106. three/src/renderers/common/Geometries.d.ts +52 -0
  107. three/src/renderers/common/Info.d.ts +21 -5
  108. three/src/renderers/common/Pipeline.d.ts +11 -0
  109. three/src/renderers/common/Pipelines.d.ts +104 -0
  110. three/src/renderers/common/PostProcessing.d.ts +1 -1
  111. three/src/renderers/common/ProgrammableStage.d.ts +19 -1
  112. three/src/renderers/common/RenderBundle.d.ts +15 -4
  113. three/src/renderers/common/RenderBundles.d.ts +20 -2
  114. three/src/renderers/common/RenderContext.d.ts +27 -3
  115. three/src/renderers/common/RenderContexts.d.ts +37 -6
  116. three/src/renderers/common/RenderList.d.ts +85 -0
  117. three/src/renderers/common/RenderLists.d.ts +21 -0
  118. three/src/renderers/common/RenderObject.d.ts +163 -4
  119. three/src/renderers/common/RenderObjects.d.ts +53 -0
  120. three/src/renderers/common/RenderPipeline.d.ts +13 -0
  121. three/src/renderers/common/Renderer.d.ts +604 -10
  122. three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
  123. three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
  124. three/src/renderers/common/Textures.d.ts +66 -0
  125. three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
  126. three/src/renderers/common/Uniform.d.ts +133 -1
  127. three/src/renderers/common/UniformBuffer.d.ts +12 -0
  128. three/src/renderers/common/UniformsGroup.d.ts +103 -0
  129. three/src/renderers/common/XRManager.d.ts +196 -0
  130. three/src/renderers/common/XRRenderTarget.d.ts +23 -0
  131. three/src/renderers/common/nodes/NodeBuilderState.d.ts +32 -2
  132. three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
  133. three/src/renderers/common/nodes/NodeUniform.d.ts +185 -0
  134. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
  135. three/src/renderers/common/nodes/Nodes.d.ts +192 -17
  136. three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
  137. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
  138. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
  139. three/src/textures/DataTexture.d.ts +2 -2
  140. three/src/textures/Texture.d.ts +5 -5
  141. three/src/textures/VideoFrameTexture.d.ts +27 -0
  142. three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
  143. three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
  144. three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
  145. three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
  146. three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
  147. three/src/Three.Legacy.d.ts +0 -20
  148. three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
  149. three/src/nodes/core/UniformGroup.d.ts +0 -7
  150. three/src/nodes/fog/FogExp2Node.d.ts +0 -14
  151. three/src/nodes/fog/FogNode.d.ts +0 -20
  152. three/src/nodes/fog/FogRangeNode.d.ts +0 -19
@@ -17,7 +17,25 @@ import Nodes from "./nodes/Nodes.js";
17
17
  import RenderContext from "./RenderContext.js";
18
18
  import Renderer from "./Renderer.js";
19
19
  import RenderPipeline from "./RenderPipeline.js";
20
- export default class RenderObject {
20
+ /**
21
+ * A render object is the renderer's representation of single entity that gets drawn
22
+ * with a draw command. There is no unique mapping of render objects to 3D objects in the
23
+ * scene since render objects also depend from the used material, the current render context
24
+ * and the current scene's lighting.
25
+ *
26
+ * In general, the basic process of the renderer is:
27
+ *
28
+ * - Analyze the 3D objects in the scene and generate render lists containing render items.
29
+ * - Process the render lists by calling one or more render commands for each render item.
30
+ * - For each render command, request a render object and perform the draw.
31
+ *
32
+ * The module provides an interface to get data required for the draw command like the actual
33
+ * draw parameters or vertex buffers. It also holds a series of caching related methods since
34
+ * creating render objects should only be done when necessary.
35
+ *
36
+ * @private
37
+ */
38
+ declare class RenderObject {
21
39
  _nodes: Nodes;
22
40
  _geometries: Geometries;
23
41
  id: number;
@@ -54,6 +72,20 @@ export default class RenderObject {
54
72
  onDispose: (() => void) | null;
55
73
  readonly isRenderObject: true;
56
74
  onMaterialDispose: () => void;
75
+ /**
76
+ * Constructs a new render object.
77
+ *
78
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
79
+ * @param {Geometries} geometries - Renderer component for managing geometries.
80
+ * @param {Renderer} renderer - The renderer.
81
+ * @param {Object3D} object - The 3D object.
82
+ * @param {Material} material - The 3D object's material.
83
+ * @param {Scene} scene - The scene the 3D object belongs to.
84
+ * @param {Camera} camera - The camera the object should be rendered with.
85
+ * @param {LightsNode} lightsNode - The lights node.
86
+ * @param {RenderContext} renderContext - The render context.
87
+ * @param {ClippingContext} clippingContext - The clipping context.
88
+ */
57
89
  constructor(
58
90
  nodes: Nodes,
59
91
  geometries: Geometries,
@@ -66,34 +98,161 @@ export default class RenderObject {
66
98
  renderContext: RenderContext,
67
99
  clippingContext: ClippingContext | null,
68
100
  );
69
- updateClipping(parent: ClippingContext): void;
101
+ /**
102
+ * Updates the clipping context.
103
+ *
104
+ * @param {ClippingContext} context - The clipping context to set.
105
+ */
106
+ updateClipping(context: ClippingContext): void;
107
+ /**
108
+ * Whether the clipping requires an update or not.
109
+ *
110
+ * @type {Boolean}
111
+ * @readonly
112
+ */
70
113
  get clippingNeedsUpdate(): boolean;
114
+ /**
115
+ * The number of clipping planes defined in context of hardware clipping.
116
+ *
117
+ * @type {Number}
118
+ * @readonly
119
+ */
71
120
  get hardwareClippingPlanes(): number;
121
+ /**
122
+ * Returns the node builder state of this render object.
123
+ *
124
+ * @return {NodeBuilderState} The node builder state.
125
+ */
72
126
  getNodeBuilderState(): NodeBuilderState;
127
+ /**
128
+ * Returns the node material observer of this render object.
129
+ *
130
+ * @return {NodeMaterialObserver} The node material observer.
131
+ */
73
132
  getMonitor(): NodeMaterialObserver;
133
+ /**
134
+ * Returns an array of bind groups of this render object.
135
+ *
136
+ * @return {Array<BindGroup>} The bindings.
137
+ */
74
138
  getBindings(): BindGroup[];
139
+ /**
140
+ * Returns a binding group by group name of this render object.
141
+ *
142
+ * @param {String} name - The name of the binding group.
143
+ * @return {BindGroup?} The bindings.
144
+ */
145
+ getBindingGroup(name: string): BindGroup | undefined;
146
+ /**
147
+ * Returns the index of the render object's geometry.
148
+ *
149
+ * @return {BufferAttribute?} The index. Returns `null` for non-indexed geometries.
150
+ */
75
151
  getIndex(): BufferAttribute | null;
152
+ /**
153
+ * Returns the indirect buffer attribute.
154
+ *
155
+ * @return {BufferAttribute?} The indirect attribute. `null` if no indirect drawing is used.
156
+ */
76
157
  getIndirect(): import("./IndirectStorageBufferAttribute.js").default | null;
158
+ /**
159
+ * Returns an array that acts as a key for identifying the render object in a chain map.
160
+ *
161
+ * @return {Array<Object>} An array with object references.
162
+ */
77
163
  getChainArray(): readonly [
78
164
  Object3D<import("../../core/Object3D.js").Object3DEventMap>,
79
165
  Material,
80
166
  RenderContext,
81
167
  LightsNode,
82
168
  ];
169
+ /**
170
+ * This method is used when the geometry of a 3D object has been exchanged and the
171
+ * respective render object now requires an update.
172
+ *
173
+ * @param {BufferGeometry} geometry - The geometry to set.
174
+ */
83
175
  setGeometry(geometry: BufferGeometry): void;
176
+ /**
177
+ * Returns the buffer attributes of the render object. The returned array holds
178
+ * attribute definitions on geometry and node level.
179
+ *
180
+ * @return {Array<BufferAttribute>} An array with buffer attributes.
181
+ */
84
182
  getAttributes(): (BufferAttribute | InterleavedBufferAttribute)[];
183
+ /**
184
+ * Returns the vertex buffers of the render object.
185
+ *
186
+ * @return {Array<BufferAttribute|InterleavedBuffer>} An array with buffer attribute or interleaved buffers.
187
+ */
85
188
  getVertexBuffers(): (BufferAttribute | InterleavedBuffer)[] | null;
189
+ /**
190
+ * Returns the draw parameters for the render object.
191
+ *
192
+ * @return {{vertexCount: Number, firstVertex: Number, instanceCount: Number, firstInstance: Number}} The draw parameters.
193
+ */
86
194
  getDrawParameters(): {
87
195
  vertexCount: number;
88
196
  firstVertex: number;
89
197
  instanceCount: number;
90
198
  firstInstance: number;
91
199
  } | null;
200
+ /**
201
+ * Returns the render object's geometry cache key.
202
+ *
203
+ * The geometry cache key is part of the material cache key.
204
+ *
205
+ * @return {String} The geometry cache key.
206
+ */
92
207
  getGeometryCacheKey(): string;
208
+ /**
209
+ * Returns the render object's material cache key.
210
+ *
211
+ * The material cache key is part of the render object cache key.
212
+ *
213
+ * @return {Number} The material cache key.
214
+ */
93
215
  getMaterialCacheKey(): number;
216
+ /**
217
+ * Whether the geometry requires an update or not.
218
+ *
219
+ * @type {Boolean}
220
+ * @readonly
221
+ */
94
222
  get needsGeometryUpdate(): boolean;
223
+ /**
224
+ * Whether the render object requires an update or not.
225
+ *
226
+ * Note: There are two distinct places where render objects are checked for an update.
227
+ *
228
+ * 1. In `RenderObjects.get()` which is executed when the render object is request. This
229
+ * method checks the `needsUpdate` flag and recreates the render object if necessary.
230
+ * 2. In `Renderer._renderObjectDirect()` right after getting the render object via
231
+ * `RenderObjects.get()`. The render object's NodeMaterialObserver is then used to detect
232
+ * a need for a refresh due to material, geometry or object related value changes.
233
+ *
234
+ * TODO: Investigate if it's possible to merge both steps so there is only a single place
235
+ * that performs the 'needsUpdate' check.
236
+ *
237
+ * @type {Boolean}
238
+ * @readonly
239
+ */
95
240
  get needsUpdate(): boolean;
96
- getDynamicCacheKey(): string;
97
- getCacheKey(): string;
241
+ /**
242
+ * Returns the dynamic cache key which represents a key that is computed per draw command.
243
+ *
244
+ * @return {Number} The cache key.
245
+ */
246
+ getDynamicCacheKey(): number;
247
+ /**
248
+ * Returns the render object's cache key.
249
+ *
250
+ * @return {Number} The cache key.
251
+ */
252
+ getCacheKey(): number;
253
+ /**
254
+ * Frees internal resources.
255
+ */
98
256
  dispose(): void;
99
257
  }
258
+ export default RenderObject;
@@ -13,6 +13,11 @@ import Pipelines from "./Pipelines.js";
13
13
  import RenderContext from "./RenderContext.js";
14
14
  import Renderer from "./Renderer.js";
15
15
  import RenderObject from "./RenderObject.js";
16
+ /**
17
+ * This module manages the render objects of the renderer.
18
+ *
19
+ * @private
20
+ */
16
21
  declare class RenderObjects {
17
22
  renderer: Renderer;
18
23
  nodes: Nodes;
@@ -23,6 +28,16 @@ declare class RenderObjects {
23
28
  chainMaps: {
24
29
  [passId: string]: ChainMap<readonly [Object3D, Material, RenderContext, LightsNode], RenderObject>;
25
30
  };
31
+ /**
32
+ * Constructs a new render object management component.
33
+ *
34
+ * @param {Renderer} renderer - The renderer.
35
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
36
+ * @param {Geometries} geometries - Renderer component for managing geometries.
37
+ * @param {Pipelines} pipelines - Renderer component for managing pipelines.
38
+ * @param {Bindings} bindings - Renderer component for managing bindings.
39
+ * @param {Info} info - Renderer component for managing metrics and monitoring data.
40
+ */
26
41
  constructor(
27
42
  renderer: Renderer,
28
43
  nodes: Nodes,
@@ -31,6 +46,19 @@ declare class RenderObjects {
31
46
  bindings: Bindings,
32
47
  info: Info,
33
48
  );
49
+ /**
50
+ * Returns a render object for the given object and state data.
51
+ *
52
+ * @param {Object3D} object - The 3D object.
53
+ * @param {Material} material - The 3D object's material.
54
+ * @param {Scene} scene - The scene the 3D object belongs to.
55
+ * @param {Camera} camera - The camera the 3D object should be rendered with.
56
+ * @param {LightsNode} lightsNode - The lights node.
57
+ * @param {RenderContext} renderContext - The render context.
58
+ * @param {ClippingContext} clippingContext - The clipping context.
59
+ * @param {String?} passId - An optional ID for identifying the pass.
60
+ * @return {RenderObject} The render object.
61
+ */
34
62
  get(
35
63
  object: Object3D,
36
64
  material: Material,
@@ -41,13 +69,38 @@ declare class RenderObjects {
41
69
  clippingContext: ClippingContext | null,
42
70
  passId?: string | undefined,
43
71
  ): RenderObject;
72
+ /**
73
+ * Returns a chain map for the given pass ID.
74
+ *
75
+ * @param {String} [passId='default'] - The pass ID.
76
+ * @return {ChainMap} The chain map.
77
+ */
44
78
  getChainMap(
45
79
  passId?: string,
46
80
  ): ChainMap<
47
81
  readonly [Object3D<import("../../core/Object3D.js").Object3DEventMap>, Material, RenderContext, LightsNode],
48
82
  RenderObject
49
83
  >;
84
+ /**
85
+ * Frees internal resources.
86
+ */
50
87
  dispose(): void;
88
+ /**
89
+ * Factory method for creating render objects with the given list of parameters.
90
+ *
91
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
92
+ * @param {Geometries} geometries - Renderer component for managing geometries.
93
+ * @param {Renderer} renderer - The renderer.
94
+ * @param {Object3D} object - The 3D object.
95
+ * @param {Material} material - The object's material.
96
+ * @param {Scene} scene - The scene the 3D object belongs to.
97
+ * @param {Camera} camera - The camera the object should be rendered with.
98
+ * @param {LightsNode} lightsNode - The lights node.
99
+ * @param {RenderContext} renderContext - The render context.
100
+ * @param {ClippingContext} clippingContext - The clipping context.
101
+ * @param {String?} passId - An optional ID for identifying the pass.
102
+ * @return {RenderObject} The render object.
103
+ */
51
104
  createRenderObject(
52
105
  nodes: Nodes,
53
106
  geometries: Geometries,
@@ -1,8 +1,21 @@
1
1
  import Pipeline from "./Pipeline.js";
2
2
  import ProgrammableStage from "./ProgrammableStage.js";
3
+ /**
4
+ * Class for representing render pipelines.
5
+ *
6
+ * @private
7
+ * @augments Pipeline
8
+ */
3
9
  declare class RenderPipeline extends Pipeline {
4
10
  vertexProgram: ProgrammableStage;
5
11
  fragmentProgram: ProgrammableStage;
12
+ /**
13
+ * Constructs a new render pipeline.
14
+ *
15
+ * @param {String} cacheKey - The pipeline's cache key.
16
+ * @param {ProgrammableStage} vertexProgram - The pipeline's vertex shader.
17
+ * @param {ProgrammableStage} fragmentProgram - The pipeline's fragment shader.
18
+ */
6
19
  constructor(cacheKey: string, vertexProgram: ProgrammableStage, fragmentProgram: ProgrammableStage);
7
20
  }
8
21
  export default RenderPipeline;