@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
@@ -7,6 +7,12 @@ import DataMap from "./DataMap.js";
7
7
  interface Data {
8
8
  version?: number | undefined;
9
9
  }
10
+ /**
11
+ * This renderer module manages geometry attributes.
12
+ *
13
+ * @private
14
+ * @augments DataMap
15
+ */
10
16
  declare class Attributes extends DataMap<{
11
17
  attribute: {
12
18
  key: BufferAttribute | InterleavedBufferAttribute;
@@ -14,9 +20,34 @@ declare class Attributes extends DataMap<{
14
20
  };
15
21
  }> {
16
22
  backend: Backend;
23
+ /**
24
+ * Constructs a new attribute management component.
25
+ *
26
+ * @param {Backend} backend - The renderer's backend.
27
+ */
17
28
  constructor(backend: Backend);
29
+ /**
30
+ * Deletes the data for the given attribute.
31
+ *
32
+ * @param {BufferAttribute} attribute - The attribute.
33
+ * @return {Object} The deleted attribute data.
34
+ */
18
35
  delete(attribute: BufferAttribute | InterleavedBufferAttribute): Data;
36
+ /**
37
+ * Updates the given attribute. This method creates attribute buffers
38
+ * for new attributes and updates data for existing ones.
39
+ *
40
+ * @param {BufferAttribute} attribute - The attribute to update.
41
+ * @param {Number} type - The attribute type.
42
+ */
19
43
  update(attribute: BufferAttribute | InterleavedBufferAttribute, type: AttributeType): void;
44
+ /**
45
+ * Utility method for handling interleaved buffer attributes correctly.
46
+ * To process them, their `InterleavedBuffer` is returned.
47
+ *
48
+ * @param {BufferAttribute} attribute - The attribute.
49
+ * @return {BufferAttribute|InterleavedBuffer}
50
+ */
20
51
  _getBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute): BufferAttribute | InterleavedBuffer;
21
52
  }
22
53
  export default Attributes;
@@ -1,6 +1,17 @@
1
1
  import { CoordinateSystem } from "../../constants.js";
2
2
  import Renderer from "./Renderer.js";
3
3
 
4
+ declare module "../../core/Object3D.js" {
5
+ interface Object3D {
6
+ // See https://github.com/mrdoob/three.js/pull/28683
7
+ count?: number | undefined;
8
+ // See https://github.com/mrdoob/three.js/pull/26335
9
+ occlusionTest?: boolean | undefined;
10
+ // https://github.com/mrdoob/three.js/pull/29386
11
+ static?: boolean | undefined;
12
+ }
13
+ }
14
+
4
15
  export interface BackendParameters {
5
16
  canvas?: HTMLCanvasElement | undefined;
6
17
  }
@@ -9,6 +9,12 @@ interface SceneData {
9
9
  backgroundMesh?: Mesh;
10
10
  backgroundCacheKey: string;
11
11
  }
12
+ /**
13
+ * This renderer module manages the background.
14
+ *
15
+ * @private
16
+ * @augments DataMap
17
+ */
12
18
  declare class Background extends DataMap<{
13
19
  scene: {
14
20
  key: Scene;
@@ -17,7 +23,23 @@ declare class Background extends DataMap<{
17
23
  }> {
18
24
  renderer: Renderer;
19
25
  nodes: Nodes;
26
+ /**
27
+ * Constructs a new background management component.
28
+ *
29
+ * @param {Renderer} renderer - The renderer.
30
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
31
+ */
20
32
  constructor(renderer: Renderer, nodes: Nodes);
33
+ /**
34
+ * Updates the background for the given scene. Depending on how `Scene.background`
35
+ * or `Scene.backgroundNode` are configured, this method might configure a simple clear
36
+ * or add a mesh to the render list for rendering the background as a textured plane
37
+ * or skybox.
38
+ *
39
+ * @param {Scene} scene - The scene.
40
+ * @param {RenderList} renderList - The current render list.
41
+ * @param {RenderContext} renderContext - The current render context.
42
+ */
21
43
  update(scene: Scene, renderList: RenderList, renderContext: RenderContext): void;
22
44
  }
23
45
  export default Background;
@@ -1,11 +1,26 @@
1
1
  import Binding from "./Binding.js";
2
2
  import NodeUniformsGroup from "./nodes/NodeUniformsGroup.js";
3
+ /**
4
+ * A bind group represents a collection of bindings and thus a collection
5
+ * or resources. Bind groups are assigned to pipelines to provide them
6
+ * with the required resources (like uniform buffers or textures).
7
+ *
8
+ * @private
9
+ */
3
10
  declare class BindGroup {
4
11
  name: string;
5
12
  bindings: NodeUniformsGroup[] | Binding[];
6
13
  index: number;
7
14
  bindingsReference: NodeUniformsGroup[] | BindGroup;
8
15
  id: number;
16
+ /**
17
+ * Constructs a new bind group.
18
+ *
19
+ * @param {String} name - The bind group's name.
20
+ * @param {Array<Binding>} bindings - An array of bindings.
21
+ * @param {Number} index - The group index.
22
+ * @param {Array<Binding>} bindingsReference - An array of reference bindings.
23
+ */
9
24
  constructor(
10
25
  name?: string,
11
26
  bindings?: NodeUniformsGroup[],
@@ -1,8 +1,32 @@
1
+ /**
2
+ * A binding represents the connection between a resource (like a texture, sampler
3
+ * or uniform buffer) and the resource definition in a shader stage.
4
+ *
5
+ * This module is an abstract base class for all concrete bindings types.
6
+ *
7
+ * @abstract
8
+ * @private
9
+ */
1
10
  declare class Binding {
2
11
  name: string;
3
12
  visibility: number;
13
+ /**
14
+ * Constructs a new binding.
15
+ *
16
+ * @param {String} [name=''] - The binding's name.
17
+ */
4
18
  constructor(name?: string);
19
+ /**
20
+ * Makes sure binding's resource is visible for the given shader stage.
21
+ *
22
+ * @param {Number} visibility - The shader stage.
23
+ */
5
24
  setVisibility(visibility: number): void;
25
+ /**
26
+ * Clones the binding.
27
+ *
28
+ * @return {Binding} The cloned binding.
29
+ */
6
30
  clone(): Binding & this;
7
31
  }
8
32
  export default Binding;
@@ -11,7 +11,23 @@ import Textures from "./Textures.js";
11
11
  interface BindGroupData {
12
12
  bindGroup?: BindGroup | undefined;
13
13
  }
14
+ /**
15
+ * This renderer module manages the bindings of the renderer.
16
+ *
17
+ * @private
18
+ * @augments DataMap
19
+ */
14
20
  declare class Bindings extends DataMap<{
21
+ /**
22
+ * Constructs a new bindings management component.
23
+ *
24
+ * @param {Backend} backend - The renderer's backend.
25
+ * @param {Nodes} nodes - Renderer component for managing nodes related logic.
26
+ * @param {Textures} textures - Renderer component for managing textures.
27
+ * @param {Attributes} attributes - Renderer component for managing attributes.
28
+ * @param {Pipelines} pipelines - Renderer component for managing pipelines.
29
+ * @param {Info} info - Renderer component for managing metrics and monitoring data.
30
+ */
15
31
  bindGroup: {
16
32
  key: BindGroup;
17
33
  value: BindGroupData;
@@ -31,12 +47,50 @@ declare class Bindings extends DataMap<{
31
47
  pipelines: Pipelines,
32
48
  info: Info,
33
49
  );
50
+ /**
51
+ * Returns the bind groups for the given render object.
52
+ *
53
+ * @param {RenderObject} renderObject - The render object.
54
+ * @return {Array<BindGroup>} The bind groups.
55
+ */
34
56
  getForRender(renderObject: RenderObject): BindGroup[];
57
+ /**
58
+ * Returns the bind groups for the given compute node.
59
+ *
60
+ * @param {Node} computeNode - The compute node.
61
+ * @return {Array<BindGroup>} The bind groups.
62
+ */
35
63
  getForCompute(computeNode: ComputeNode): BindGroup[];
64
+ /**
65
+ * Updates the bindings for the given compute node.
66
+ *
67
+ * @param {Node} computeNode - The compute node.
68
+ */
36
69
  updateForCompute(computeNode: ComputeNode): void;
70
+ /**
71
+ * Updates the bindings for the given render object.
72
+ *
73
+ * @param {RenderObject} renderObject - The render object.
74
+ */
37
75
  updateForRender(renderObject: RenderObject): void;
76
+ /**
77
+ * Updates the given array of bindings.
78
+ *
79
+ * @param {Array<BindGroup>} bindings - The bind groups.
80
+ */
38
81
  _updateBindings(bindings: BindGroup[]): void;
82
+ /**
83
+ * Initializes the given bind group.
84
+ *
85
+ * @param {BindGroup} bindGroup - The bind group to initialize.
86
+ */
39
87
  _init(bindGroup: BindGroup): void;
88
+ /**
89
+ * Updates the given bind group.
90
+ *
91
+ * @param {BindGroup} bindGroup - The bind group to update.
92
+ * @param {Array<BindGroup>} bindings - The bind groups.
93
+ */
40
94
  _update(bindGroup: BindGroup, bindings: BindGroup[]): void;
41
95
  }
42
96
  export default Bindings;
@@ -1,11 +1,42 @@
1
1
  import Binding from "./Binding.js";
2
+ /**
3
+ * Represents a buffer binding type.
4
+ *
5
+ * @private
6
+ * @abstract
7
+ * @augments Binding
8
+ */
2
9
  declare class Buffer extends Binding {
3
10
  readonly isBuffer: true;
4
11
  bytesPerElement: number;
5
12
  _buffer: Float32Array | null;
13
+ /**
14
+ * Constructs a new buffer.
15
+ *
16
+ * @param {String} name - The buffer's name.
17
+ * @param {TypedArray} [buffer=null] - The buffer.
18
+ */
6
19
  constructor(name?: string, buffer?: Float32Array | null);
20
+ /**
21
+ * The buffer's byte length.
22
+ *
23
+ * @type {Number}
24
+ * @readonly
25
+ */
7
26
  get byteLength(): number;
27
+ /**
28
+ * A reference to the internal buffer.
29
+ *
30
+ * @type {Float32Array}
31
+ * @readonly
32
+ */
8
33
  get buffer(): Float32Array | null;
34
+ /**
35
+ * Updates the binding.
36
+ *
37
+ * @return {Boolean} Whether the buffer has been updated and must be
38
+ * uploaded to the GPU.
39
+ */
9
40
  update(): boolean;
10
41
  }
11
42
  export default Buffer;
@@ -1,4 +1,30 @@
1
+ /** @module BufferUtils **/
2
+ /**
3
+ * This function is usually called with the length in bytes of an array buffer.
4
+ * It returns an padded value which ensure chunk size alignment according to STD140 layout.
5
+ *
6
+ * @function
7
+ * @param {Number} floatLength - The buffer length.
8
+ * @return {Number} The padded length.
9
+ */
1
10
  declare function getFloatLength(floatLength: number): number;
11
+ /**
12
+ * Given the count of vectors and their vector length, this function computes
13
+ * a total length in bytes with buffer alignment according to STD140 layout.
14
+ *
15
+ * @function
16
+ * @param {Number} count - The number of vectors.
17
+ * @param {Number} [vectorLength=4] - The vector length.
18
+ * @return {Number} The padded length.
19
+ */
2
20
  declare function getVectorLength(count: number, vectorLength?: number): number;
21
+ /**
22
+ * This function is called with a vector length and ensure the computed length
23
+ * matches a predefined stride (in this case `4`).
24
+ *
25
+ * @function
26
+ * @param {Number} vectorLength - The vector length.
27
+ * @return {Number} The padded length.
28
+ */
3
29
  declare function getStrideLength(vectorLength: number): number;
4
30
  export { getFloatLength, getStrideLength, getVectorLength };
@@ -1,10 +1,32 @@
1
1
  import { Group } from "../../objects/Group.js";
2
+ /**
3
+ * A specialized group which enables applications access to the
4
+ * Render Bundle API of WebGPU. The group with all its descendant nodes
5
+ * are considered as one render bundle and processed as such by
6
+ * the renderer.
7
+ *
8
+ * This module is only fully supported by `WebGPURenderer` with a WebGPU backend.
9
+ * With a WebGL backend, the group can technically be rendered but without
10
+ * any performance improvements.
11
+ *
12
+ * @augments Group
13
+ */
2
14
  declare class BundleGroup extends Group {
3
15
  readonly isBundleGroup: true;
4
16
  readonly type: string;
5
17
  static: boolean;
6
18
  version: number;
19
+ /**
20
+ * Constructs a new bundle group.
21
+ */
7
22
  constructor();
23
+ /**
24
+ * Set this property to `true` when the bundle group has changed.
25
+ *
26
+ * @type {Boolean}
27
+ * @default false
28
+ * @param {Boolean} value
29
+ */
8
30
  set needsUpdate(value: boolean);
9
31
  }
10
32
  export default BundleGroup;
@@ -1,9 +1,39 @@
1
1
  type RecursiveWeakMap<K extends readonly object[], V> = WeakMap<K[number], V | RecursiveWeakMap<K, V>>;
2
- export default class ChainMap<K extends readonly object[], V> {
2
+ /**
3
+ * Data structure for the renderer. It allows defining values
4
+ * with chained, hierarchical keys. Keys are meant to be
5
+ * objects since the module internally works with Weak Maps
6
+ * for performance reasons.
7
+ *
8
+ * @private
9
+ */
10
+ declare class ChainMap<K extends readonly object[], V> {
3
11
  weakMap: RecursiveWeakMap<K, V>;
12
+ /**
13
+ * Constructs a new Chain Map.
14
+ */
4
15
  constructor();
16
+ /**
17
+ * Returns the value for the given array of keys.
18
+ *
19
+ * @param {Array<Object>} keys - List of keys.
20
+ * @return {Any} The value. Returns `undefined` if no value was found.
21
+ */
5
22
  get(keys: K): V | undefined;
6
- set(keys: K, value: V): V;
23
+ /**
24
+ * Sets the value for the given keys.
25
+ *
26
+ * @param {Array<Object>} keys - List of keys.
27
+ * @param {Any} value - The value to set.
28
+ * @return {ChainMap} A reference to this Chain Map.
29
+ */
30
+ set(keys: K, value: V): this;
31
+ /**
32
+ * Deletes a value for the given keys.
33
+ *
34
+ * @param {Array<Object>} keys - The keys.
35
+ * @return {Boolean} Returns `true` if the value has been removed successfully and `false` if the value has not be found.
36
+ */
7
37
  delete(keys: K): boolean;
8
38
  }
9
- export {};
39
+ export default ChainMap;
@@ -5,6 +5,14 @@ import { Plane } from "../../math/Plane.js";
5
5
  import { Vector4 } from "../../math/Vector4.js";
6
6
  import { ClippingGroup } from "../../objects/ClippingGroup.js";
7
7
  import { Scene } from "../../scenes/Scene.js";
8
+ /**
9
+ * Represents the state that is used to perform clipping via clipping planes.
10
+ * There is a default clipping context for each render context. When the
11
+ * scene holds instances of `ClippingGroup`, there will be a context for each
12
+ * group.
13
+ *
14
+ * @private
15
+ */
8
16
  declare class ClippingContext {
9
17
  version: number;
10
18
  clipIntersection: boolean | null;
@@ -16,11 +24,48 @@ declare class ClippingContext {
16
24
  shadowPass: boolean;
17
25
  viewMatrix?: Matrix4;
18
26
  parentVersion: number | null;
27
+ /**
28
+ * Constructs a new clipping context.
29
+ *
30
+ * @param {ClippingContext?} [parentContext=null] - A reference to the parent clipping context.
31
+ */
19
32
  constructor(parentContext?: ClippingContext | null);
33
+ /**
34
+ * Projects the given source clipping planes and writes the result into the
35
+ * destination array.
36
+ *
37
+ * @param {Array<Plane>} source - The source clipping planes.
38
+ * @param {Array<Vector4>} destination - The destination.
39
+ * @param {Number} offset - The offset.
40
+ */
20
41
  projectPlanes(source: readonly Plane[], destination: readonly Vector4[], offset: number): void;
42
+ /**
43
+ * Updates the root clipping context of a scene.
44
+ *
45
+ * @param {Scene} scene - The scene.
46
+ * @param {Camera} camera - The camera that is used to render the scene.
47
+ */
21
48
  updateGlobal(scene: Scene, camera: Camera): void;
49
+ /**
50
+ * Updates the clipping context.
51
+ *
52
+ * @param {ClippingContext} parentContext - The parent context.
53
+ * @param {ClippingGroup} clippingGroup - The clipping group this context belongs to.
54
+ */
22
55
  update(parentContext: ClippingContext, clippingGroup: ClippingGroup): void;
56
+ /**
57
+ * Returns a clipping context for the given clipping group.
58
+ *
59
+ * @param {ClippingGroup} clippingGroup - The clipping group.
60
+ * @return {ClippingContext} The clipping context.
61
+ */
23
62
  getGroupContext(clippingGroup: ClippingGroup): ClippingContext;
63
+ /**
64
+ * The count of union clipping planes.
65
+ *
66
+ * @type {Number}
67
+ * @readonly
68
+ */
24
69
  get unionClippingCount(): number;
25
70
  }
26
71
  export default ClippingContext;
@@ -1,10 +1,50 @@
1
1
  import { Color, ColorRepresentation } from "../../math/Color.js";
2
+ /**
3
+ * A four-component version of {@link Color} which is internally
4
+ * used by the renderer to represents clear color with alpha as
5
+ * one object.
6
+ *
7
+ * @private
8
+ * @augments Color
9
+ */
2
10
  declare class Color4 extends Color {
3
11
  a: number;
12
+ /**
13
+ * Constructs a new four-component color.
14
+ * You can also pass a single THREE.Color, hex or
15
+ * string argument to this constructor.
16
+ *
17
+ * @param {Number|String} [r=1] - The red value.
18
+ * @param {Number} [g=1] - The green value.
19
+ * @param {Number} [b=1] - The blue value.
20
+ * @param {Number} [a=1] - The alpha value.
21
+ */
4
22
  constructor(color?: ColorRepresentation);
5
23
  constructor(r: number, g: number, b: number, a?: number);
24
+ /**
25
+ * Overwrites the default to honor alpha.
26
+ * You can also pass a single THREE.Color, hex or
27
+ * string argument to this method.
28
+ *
29
+ * @param {Number|String} r - The red value.
30
+ * @param {Number} g - The green value.
31
+ * @param {Number} b - The blue value.
32
+ * @param {Number} [a=1] - The alpha value.
33
+ * @return {Color4} A reference to this object.
34
+ */
6
35
  set(...args: [color: ColorRepresentation] | [r: number, g: number, b: number, a?: number]): this;
36
+ /**
37
+ * Overwrites the default to honor alpha.
38
+ *
39
+ * @param {Color4} color - The color to copy.
40
+ * @return {Color4} A reference to this object.
41
+ */
7
42
  copy(color: Color): this;
43
+ /**
44
+ * Overwrites the default to honor alpha.
45
+ *
46
+ * @return {Color4} The cloned color.
47
+ */
8
48
  clone(): this;
9
49
  }
10
50
  export default Color4;
@@ -1,8 +1,20 @@
1
1
  import Pipeline from "./Pipeline.js";
2
2
  import ProgrammableStage from "./ProgrammableStage.js";
3
+ /**
4
+ * Class for representing compute pipelines.
5
+ *
6
+ * @private
7
+ * @augments Pipeline
8
+ */
3
9
  declare class ComputePipeline extends Pipeline {
4
10
  computeProgram: ProgrammableStage;
5
11
  readonly isComputePipeline: true;
12
+ /**
13
+ * Constructs a new render pipeline.
14
+ *
15
+ * @param {String} cacheKey - The pipeline's cache key.
16
+ * @param {ProgrammableStage} computeProgram - The pipeline's compute shader.
17
+ */
6
18
  constructor(cacheKey: string, computeProgram: ProgrammableStage);
7
19
  }
8
20
  export default ComputePipeline;
@@ -2,9 +2,22 @@ import { RenderTargetOptions } from "../../core/RenderTarget.js";
2
2
  import { WebGLCubeRenderTarget } from "../../renderers/WebGLCubeRenderTarget.js";
3
3
  import { Texture } from "../../textures/Texture.js";
4
4
  import { WebGLRenderer } from "../WebGLRenderer.js";
5
+ /**
6
+ * This class represents a cube render target. It is a special version
7
+ * of `WebGLCubeRenderTarget` which is compatible with `WebGPURenderer`.
8
+ *
9
+ * @augments WebGLCubeRenderTarget
10
+ */
5
11
  declare class CubeRenderTarget extends WebGLCubeRenderTarget {
6
12
  readonly isCubeRenderTarget: true;
7
13
  constructor(size?: number, options?: RenderTargetOptions);
14
+ /**
15
+ * Converts the given equirectangular texture to a cube map.
16
+ *
17
+ * @param {Renderer} renderer - The renderer.
18
+ * @param {Texture} texture - The equirectangular texture.
19
+ * @return {CubeRenderTarget} A reference to this cube render target.
20
+ */
8
21
  fromEquirectangularTexture(renderer: WebGLRenderer, texture: Texture): this;
9
22
  }
10
23
  export default CubeRenderTarget;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Data structure for the renderer. It is intended to manage
3
+ * data of objects in dictionaries.
4
+ *
5
+ * @private
6
+ */
1
7
  declare class DataMap<
2
8
  M extends {
3
9
  [key: string]: {
@@ -7,14 +13,38 @@ declare class DataMap<
7
13
  },
8
14
  > {
9
15
  data: WeakMap<M[keyof M]["key"], M[keyof M]["value"]>;
16
+ /**
17
+ * Constructs a new data map.
18
+ */
10
19
  constructor();
20
+ /**
21
+ * Returns the dictionary for the given object.
22
+ *
23
+ * @param {Object} object - The object.
24
+ * @return {Object} The dictionary.
25
+ */
11
26
  get<K extends M[keyof M]["key"]>(object: K): Extract<M[keyof M], {
12
27
  key: K;
13
28
  }>["value"];
29
+ /**
30
+ * Deletes the dictionary for the given object.
31
+ *
32
+ * @param {Object} object - The object.
33
+ * @return {Object?} The deleted dictionary.
34
+ */
14
35
  delete<K extends M[keyof M]["key"]>(object: K): Extract<M[keyof M], {
15
36
  key: K;
16
37
  }>["value"];
38
+ /**
39
+ * Returns `true` if the given object has a dictionary defined.
40
+ *
41
+ * @param {Object} object - The object to test.
42
+ * @return {Boolean} Whether a dictionary is defined or not.
43
+ */
17
44
  has(object: M[keyof M]["key"]): boolean;
45
+ /**
46
+ * Frees internal resources.
47
+ */
18
48
  dispose(): void;
19
49
  }
20
50
  export default DataMap;
@@ -10,6 +10,12 @@ import RenderObject from "./RenderObject.js";
10
10
  interface GeometryData {
11
11
  initialized?: boolean | undefined;
12
12
  }
13
+ /**
14
+ * This renderer module manages geometries.
15
+ *
16
+ * @private
17
+ * @augments DataMap
18
+ */
13
19
  declare class Geometries extends DataMap<{
14
20
  geometry: {
15
21
  key: BufferGeometry;
@@ -20,13 +26,59 @@ declare class Geometries extends DataMap<{
20
26
  info: Info;
21
27
  wireframes: WeakMap<BufferGeometry, BufferAttribute>;
22
28
  attributeCall: WeakMap<BufferAttribute | InterleavedBufferAttribute | InterleavedBuffer, number>;
29
+ /**
30
+ * Constructs a new geometry management component.
31
+ *
32
+ * @param {Attributes} attributes - Renderer component for managing attributes.
33
+ * @param {Info} info - Renderer component for managing metrics and monitoring data.
34
+ */
23
35
  constructor(attributes: Attributes, info: Info);
36
+ /**
37
+ * Returns `true` if the given render object has an initialized geometry.
38
+ *
39
+ * @param {RenderObject} renderObject - The render object.
40
+ * @return {Boolean} Whether if the given render object has an initialized geometry or not.
41
+ */
24
42
  has(renderObject: RenderObject | BufferGeometry): boolean;
43
+ /**
44
+ * Prepares the geometry of the given render object for rendering.
45
+ *
46
+ * @param {RenderObject} renderObject - The render object.
47
+ */
25
48
  updateForRender(renderObject: RenderObject): void;
49
+ /**
50
+ * Initializes the geometry of the given render object.
51
+ *
52
+ * @param {RenderObject} renderObject - The render object.
53
+ */
26
54
  initGeometry(renderObject: RenderObject): void;
55
+ /**
56
+ * Updates the geometry attributes of the given render object.
57
+ *
58
+ * @param {RenderObject} renderObject - The render object.
59
+ */
27
60
  updateAttributes(renderObject: RenderObject): void;
61
+ /**
62
+ * Updates the given attribute.
63
+ *
64
+ * @param {BufferAttribute} attribute - The attribute to update.
65
+ * @param {Number} type - The attribute type.
66
+ */
28
67
  updateAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, type: AttributeType): void;
68
+ /**
69
+ * Returns the indirect buffer attribute of the given render object.
70
+ *
71
+ * @param {RenderObject} renderObject - The render object.
72
+ * @return {BufferAttribute?} The indirect attribute. `null` if no indirect drawing is used.
73
+ */
29
74
  getIndirect(renderObject: RenderObject): import("./IndirectStorageBufferAttribute.js").default | null;
75
+ /**
76
+ * Returns the index of the given render object's geometry. This is implemented
77
+ * in a method to return a wireframe index if necessary.
78
+ *
79
+ * @param {RenderObject} renderObject - The render object.
80
+ * @return {BufferAttribute?} The index. Returns `null` for non-indexed geometries.
81
+ */
30
82
  getIndex(renderObject: RenderObject): BufferAttribute | null;
31
83
  }
32
84
  export default Geometries;