@types/three 0.164.0 → 0.165.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 (133) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/controls/TransformControls.d.ts +8 -6
  3. three/examples/jsm/exporters/USDZExporter.d.ts +4 -2
  4. three/examples/jsm/geometries/TextGeometry.d.ts +1 -1
  5. three/examples/jsm/loaders/FontLoader.d.ts +1 -1
  6. three/examples/jsm/loaders/GLTFLoader.d.ts +9 -6
  7. three/examples/jsm/loaders/LDrawLoader.d.ts +1 -1
  8. three/examples/jsm/modifiers/EdgeSplitModifier.d.ts +17 -10
  9. three/examples/jsm/nodes/Nodes.d.ts +11 -54
  10. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +4 -22
  11. three/examples/jsm/nodes/accessors/BufferAttributeNode.d.ts +49 -0
  12. three/examples/jsm/nodes/accessors/BufferNode.d.ts +3 -4
  13. three/examples/jsm/nodes/accessors/CameraNode.d.ts +11 -20
  14. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +1 -1
  15. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +4 -1
  16. three/examples/jsm/nodes/accessors/ModelNode.d.ts +3 -0
  17. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +1 -2
  18. three/examples/jsm/nodes/accessors/NormalNode.d.ts +9 -17
  19. three/examples/jsm/nodes/accessors/PositionNode.d.ts +6 -26
  20. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +3 -4
  21. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -8
  22. three/examples/jsm/nodes/accessors/RendererReferenceNode.d.ts +2 -3
  23. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +9 -4
  24. three/examples/jsm/nodes/accessors/TangentNode.d.ts +8 -23
  25. three/examples/jsm/nodes/accessors/Texture3DNode.d.ts +16 -0
  26. three/examples/jsm/nodes/accessors/TextureNode.d.ts +1 -1
  27. three/examples/jsm/nodes/accessors/UVNode.d.ts +1 -8
  28. three/examples/jsm/nodes/accessors/UniformsNode.d.ts +0 -2
  29. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +4 -3
  30. three/examples/jsm/nodes/code/CodeNode.d.ts +0 -1
  31. three/examples/jsm/nodes/code/ExpressionNode.d.ts +2 -3
  32. three/examples/jsm/nodes/core/AttributeNode.d.ts +11 -4
  33. three/examples/jsm/nodes/core/ConstNode.d.ts +1 -2
  34. three/examples/jsm/nodes/core/InputNode.d.ts +1 -2
  35. three/examples/jsm/nodes/core/Node.d.ts +99 -42
  36. three/examples/jsm/nodes/core/NodeAttribute.d.ts +7 -4
  37. three/examples/jsm/nodes/core/NodeBuilder.d.ts +24 -24
  38. three/examples/jsm/nodes/core/NodeCache.d.ts +38 -4
  39. three/examples/jsm/nodes/core/NodeKeywords.d.ts +10 -7
  40. three/examples/jsm/nodes/core/NodeParser.d.ts +4 -4
  41. three/examples/jsm/nodes/core/NodeUniform.d.ts +8 -11
  42. three/examples/jsm/nodes/core/NodeVar.d.ts +5 -4
  43. three/examples/jsm/nodes/core/NodeVarying.d.ts +5 -6
  44. three/examples/jsm/nodes/core/PropertyNode.d.ts +4 -4
  45. three/examples/jsm/nodes/core/StackNode.d.ts +7 -1
  46. three/examples/jsm/nodes/core/StructTypeNode.d.ts +8 -0
  47. three/examples/jsm/nodes/core/TempNode.d.ts +1 -2
  48. three/examples/jsm/nodes/core/UniformGroup.d.ts +7 -0
  49. three/examples/jsm/nodes/core/UniformGroupNode.d.ts +21 -0
  50. three/examples/jsm/nodes/core/UniformNode.d.ts +14 -11
  51. three/examples/jsm/nodes/core/VaryingNode.d.ts +4 -0
  52. three/examples/jsm/nodes/core/constants.d.ts +27 -79
  53. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +2 -0
  54. three/examples/jsm/nodes/functions/ToonLightingModel.d.ts +4 -0
  55. three/examples/jsm/nodes/loaders/NodeLoader.d.ts +3 -3
  56. three/examples/jsm/nodes/loaders/NodeObjectLoader.d.ts +2 -3
  57. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +2 -0
  58. three/examples/jsm/nodes/materials/Materials.d.ts +3 -0
  59. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +5 -1
  60. three/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.d.ts +28 -0
  61. three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.d.ts +2 -0
  62. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +5 -1
  63. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +8 -0
  64. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +5 -1
  65. three/examples/jsm/nodes/materials/MeshToonNodeMaterial.d.ts +38 -0
  66. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +9 -4
  67. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +1 -0
  68. three/examples/jsm/nodes/materials/ShadowNodeMaterial.d.ts +1 -0
  69. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +1 -0
  70. three/examples/jsm/nodes/materials/VolumeNodeMaterial.d.ts +10 -0
  71. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +58 -36
  72. three/examples/jsm/nodes/utils/ConvertNode.d.ts +2 -3
  73. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +2 -2
  74. three/examples/jsm/nodes/utils/SplitNode.d.ts +1 -1
  75. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +4 -5
  76. three/examples/jsm/objects/Sky.d.ts +18 -0
  77. three/examples/jsm/renderers/common/Animation.d.ts +14 -0
  78. three/examples/jsm/renderers/common/Attributes.d.ts +20 -0
  79. three/examples/jsm/renderers/common/Background.d.ts +22 -0
  80. three/examples/jsm/renderers/common/Binding.d.ts +8 -0
  81. three/examples/jsm/renderers/common/Bindings.d.ts +45 -0
  82. three/examples/jsm/renderers/common/Buffer.d.ts +11 -0
  83. three/examples/jsm/renderers/common/BufferUtils.d.ts +4 -0
  84. three/examples/jsm/renderers/common/ChainMap.d.ts +9 -0
  85. three/examples/jsm/renderers/common/ClippingContext.d.ts +18 -0
  86. three/examples/jsm/renderers/common/Color4.d.ts +6 -5
  87. three/examples/jsm/renderers/common/ComputePipeline.d.ts +8 -0
  88. three/examples/jsm/renderers/common/Constants.d.ts +9 -0
  89. three/examples/jsm/renderers/common/CubeRenderTarget.d.ts +7 -0
  90. three/examples/jsm/renderers/common/DataMap.d.ts +20 -0
  91. three/examples/jsm/renderers/common/Geometries.d.ts +28 -0
  92. three/examples/jsm/renderers/common/Info.d.ts +20 -13
  93. three/examples/jsm/renderers/common/Pipeline.d.ts +6 -0
  94. three/examples/jsm/renderers/common/Pipelines.d.ts +68 -0
  95. three/examples/jsm/renderers/common/ProgrammableStage.d.ts +15 -0
  96. three/examples/jsm/renderers/common/RenderBundle.d.ts +8 -0
  97. three/examples/jsm/renderers/common/RenderBundles.d.ts +10 -0
  98. three/examples/jsm/renderers/common/RenderContext.d.ts +38 -0
  99. three/examples/jsm/renderers/common/RenderContexts.d.ts +13 -0
  100. three/examples/jsm/renderers/common/RenderList.d.ts +62 -0
  101. three/examples/jsm/renderers/common/RenderLists.d.ts +10 -0
  102. three/examples/jsm/renderers/common/RenderObject.d.ts +73 -0
  103. three/examples/jsm/renderers/common/RenderObjects.d.ts +59 -0
  104. three/examples/jsm/renderers/common/RenderPipeline.d.ts +8 -0
  105. three/examples/jsm/renderers/common/Renderer.d.ts +175 -208
  106. three/examples/jsm/renderers/common/StorageBufferAttribute.d.ts +7 -0
  107. three/examples/jsm/renderers/common/StorageInstancedBufferAttribute.d.ts +7 -0
  108. three/examples/jsm/renderers/common/Textures.d.ts +64 -0
  109. three/examples/jsm/renderers/common/Uniform.d.ts +40 -0
  110. three/examples/jsm/renderers/common/UniformBuffer.d.ts +6 -0
  111. three/examples/jsm/renderers/common/UniformsGroup.d.ts +30 -0
  112. three/examples/jsm/renderers/common/nodes/NodeBuilderState.d.ts +26 -0
  113. three/examples/jsm/renderers/common/nodes/NodeUniform.d.ts +63 -0
  114. three/examples/jsm/renderers/common/nodes/NodeUniformsGroup.d.ts +12 -0
  115. three/examples/jsm/renderers/common/nodes/Nodes.d.ts +94 -0
  116. three/examples/jsm/utils/SceneUtils.d.ts +9 -3
  117. three/package.json +2 -2
  118. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -2
  119. three/src/core/BufferGeometry.d.ts +19 -17
  120. three/src/core/InterleavedBuffer.d.ts +2 -0
  121. three/src/loaders/LoaderUtils.d.ts +9 -6
  122. three/src/math/Color.d.ts +1 -1
  123. three/src/math/Matrix3.d.ts +2 -0
  124. three/src/math/Matrix4.d.ts +2 -0
  125. three/src/objects/BatchedMesh.d.ts +15 -0
  126. three/src/objects/InstancedMesh.d.ts +3 -3
  127. three/src/renderers/WebGLRenderer.d.ts +41 -19
  128. three/src/renderers/webgl/WebGLPrograms.d.ts +1 -1
  129. three/src/renderers/webxr/WebXRDepthSensing.d.ts +1 -1
  130. three/src/textures/CompressedArrayTexture.d.ts +32 -15
  131. three/src/textures/DataArrayTexture.d.ts +37 -20
  132. three/src/textures/FramebufferTexture.d.ts +1 -1
  133. three/src/utils.d.ts +2 -0
@@ -0,0 +1,63 @@
1
+ import { Color, Matrix3, Matrix4, Vector2, Vector3, Vector4 } from "three";
2
+ import NodeUniform from "../../../nodes/core/NodeUniform.js";
3
+ import {
4
+ ColorUniform,
5
+ FloatUniform,
6
+ Matrix3Uniform,
7
+ Matrix4Uniform,
8
+ Vector2Uniform,
9
+ Vector3Uniform,
10
+ Vector4Uniform,
11
+ } from "../Uniform.js";
12
+ declare class FloatNodeUniform extends FloatUniform {
13
+ nodeUniform: NodeUniform<number>;
14
+ constructor(nodeUniform: NodeUniform<number>);
15
+ getValue(): number;
16
+ }
17
+ declare class Vector2NodeUniform extends Vector2Uniform {
18
+ nodeUniform: NodeUniform<Vector2>;
19
+ constructor(nodeUniform: NodeUniform<Vector2>);
20
+ getValue(): Vector2;
21
+ }
22
+ declare class Vector3NodeUniform extends Vector3Uniform {
23
+ nodeUniform: NodeUniform<Vector3>;
24
+ constructor(nodeUniform: NodeUniform<Vector3>);
25
+ getValue(): Vector3;
26
+ }
27
+ declare class Vector4NodeUniform extends Vector4Uniform {
28
+ nodeUniform: NodeUniform<Vector4>;
29
+ constructor(nodeUniform: NodeUniform<Vector4>);
30
+ getValue(): Vector4;
31
+ }
32
+ declare class ColorNodeUniform extends ColorUniform {
33
+ nodeUniform: NodeUniform<Color>;
34
+ constructor(nodeUniform: NodeUniform<Color>);
35
+ getValue(): Color;
36
+ }
37
+ declare class Matrix3NodeUniform extends Matrix3Uniform {
38
+ nodeUniform: NodeUniform<Matrix3>;
39
+ constructor(nodeUniform: NodeUniform<Matrix3>);
40
+ getValue(): Matrix3;
41
+ }
42
+ declare class Matrix4NodeUniform extends Matrix4Uniform {
43
+ nodeUniform: NodeUniform<Matrix4>;
44
+ constructor(nodeUniform: NodeUniform<Matrix4>);
45
+ getValue(): Matrix4;
46
+ }
47
+ export {
48
+ ColorNodeUniform,
49
+ FloatNodeUniform,
50
+ Matrix3NodeUniform,
51
+ Matrix4NodeUniform,
52
+ Vector2NodeUniform,
53
+ Vector3NodeUniform,
54
+ Vector4NodeUniform,
55
+ };
56
+ export type NodeUniformGPU =
57
+ | FloatNodeUniform
58
+ | Vector2NodeUniform
59
+ | Vector3NodeUniform
60
+ | Vector4NodeUniform
61
+ | ColorNodeUniform
62
+ | Matrix3NodeUniform
63
+ | Matrix4NodeUniform;
@@ -0,0 +1,12 @@
1
+ import UniformGroupNode from "../../../nodes/core/UniformGroupNode.js";
2
+ import UniformNode from "../../../nodes/core/UniformNode.js";
3
+ import UniformsGroup from "../UniformsGroup.js";
4
+ declare class NodeUniformsGroup extends UniformsGroup {
5
+ id: number;
6
+ groupNode: UniformGroupNode;
7
+ readonly isNodeUniformsGroup: true;
8
+ constructor(name: string, groupNode: UniformGroupNode);
9
+ get shared(): boolean;
10
+ getNodes(): UniformNode<unknown>[];
11
+ }
12
+ export default NodeUniformsGroup;
@@ -0,0 +1,94 @@
1
+ import { Camera, Color, CubeTexture, FogBase, Material, Object3D, Scene, Texture } from "three";
2
+ import Node from "../../../nodes/core/Node.js";
3
+ import NodeBuilder from "../../../nodes/core/NodeBuilder.js";
4
+ import UniformGroupNode from "../../../nodes/core/UniformGroupNode.js";
5
+ import ComputeNode from "../../../nodes/gpgpu/ComputeNode.js";
6
+ import LightsNode from "../../../nodes/lighting/LightsNode.js";
7
+ import { NodeFrame, ShaderNodeObject } from "../../../nodes/Nodes.js";
8
+ import Backend from "../Backend.js";
9
+ import ChainMap from "../ChainMap.js";
10
+ import DataMap from "../DataMap.js";
11
+ import Renderer from "../Renderer.js";
12
+ import RenderObject from "../RenderObject.js";
13
+ import NodeBuilderState from "./NodeBuilderState.js";
14
+ import NodeUniformsGroup from "./NodeUniformsGroup.js";
15
+ interface NodeUniformsGroupData {
16
+ renderId?: number | undefined;
17
+ frameId?: number | undefined;
18
+ }
19
+ interface RenderObjectData {
20
+ nodeBuilderState?: NodeBuilderState | undefined;
21
+ }
22
+ interface ComputeNodeData {
23
+ nodeBuilderState?: NodeBuilderState | undefined;
24
+ }
25
+ interface SceneData {
26
+ background?: Color | Texture | CubeTexture | undefined;
27
+ backgroundNode?: Node | undefined;
28
+ fog?: FogBase | undefined;
29
+ fogNode?: Node | undefined;
30
+ environment?: Texture | undefined;
31
+ environmentNode?: Node | undefined;
32
+ }
33
+ declare class Nodes extends DataMap<{
34
+ nodeUniformsGroup: {
35
+ key: NodeUniformsGroup;
36
+ value: NodeUniformsGroupData;
37
+ };
38
+ renderObject: {
39
+ key: RenderObject;
40
+ value: RenderObjectData;
41
+ };
42
+ computeNode: {
43
+ key: ComputeNode;
44
+ value: ComputeNodeData;
45
+ };
46
+ scene: {
47
+ key: Scene;
48
+ value: SceneData;
49
+ };
50
+ }> {
51
+ renderer: Renderer;
52
+ backend: Backend;
53
+ nodeFrame: NodeFrame;
54
+ nodeBuilderCache: Map<string, NodeBuilderState>;
55
+ callHashCache: ChainMap<readonly [Scene, LightsNode], {
56
+ callId: number;
57
+ cacheKey: string;
58
+ }>;
59
+ groupsData: ChainMap<readonly [UniformGroupNode, NodeUniformsGroup], {
60
+ version?: number;
61
+ }>;
62
+ constructor(renderer: Renderer, backend: Backend);
63
+ updateGroup(nodeUniformsGroup: NodeUniformsGroup): boolean;
64
+ getForRenderCacheKey(renderObject: RenderObject): string;
65
+ getForRender(renderObject: RenderObject): NodeBuilderState;
66
+ delete(
67
+ object: NodeUniformsGroup | RenderObject | ComputeNode | Scene,
68
+ ): SceneData | RenderObjectData | NodeUniformsGroupData | ComputeNodeData;
69
+ getForCompute(computeNode: ComputeNode): NodeBuilderState;
70
+ _createNodeBuilderState(nodeBuilder: NodeBuilder): NodeBuilderState;
71
+ getEnvironmentNode(scene: Scene): Node | null;
72
+ getBackgroundNode(scene: Scene): Node | null;
73
+ getFogNode(scene: Scene): Node | null;
74
+ getCacheKey(scene: Scene, lightsNode: LightsNode): string;
75
+ updateScene(scene: Scene): void;
76
+ get isToneMappingState(): boolean;
77
+ updateBackground(scene: Scene): void;
78
+ updateFog(scene: Scene): void;
79
+ updateEnvironment(scene: Scene): void;
80
+ getNodeFrame(
81
+ renderer?: Renderer,
82
+ scene?: Scene | null,
83
+ object?: Object3D | null,
84
+ camera?: Camera | null,
85
+ material?: Material | null,
86
+ ): NodeFrame;
87
+ getNodeFrameForRender(renderObject: RenderObject): NodeFrame;
88
+ getOutputNode(outputTexture: Texture): ShaderNodeObject<Node>;
89
+ updateBefore(renderObject: RenderObject): void;
90
+ updateForCompute(computeNode: ComputeNode): void;
91
+ updateForRender(renderObject: RenderObject): void;
92
+ dispose(): void;
93
+ }
94
+ export default Nodes;
@@ -33,19 +33,25 @@ export function reduceVertices<TValue>(
33
33
  ): TValue;
34
34
 
35
35
  /**
36
- * @param object Object to traverse.
36
+ * A generator based version of {@link Object3D.traverse}.
37
+ *
38
+ * @param object The 3D object to traverse.
37
39
  * @yields Objects that passed the filter condition.
38
40
  */
39
41
  export function traverseGenerator(object: Object3D): Generator<Object3D, void, unknown>;
40
42
 
41
43
  /**
42
- * @param object Object to traverse.
44
+ * A generator based version of {@link Object3D.traverseVisible}.
45
+ *
46
+ * @param object The 3D object to traverse.
43
47
  * @yields Objects that passed the filter condition.
44
48
  */
45
49
  export function traverseVisibleGenerator(object: Object3D): Generator<Object3D, void, unknown>;
46
50
 
47
51
  /**
48
- * @param object Object to traverse.
52
+ * A generator based version of {@link Object3D.traverseAncestors}.
53
+ *
54
+ * @param object The 3D object to traverse.
49
55
  * @yields Objects that passed the filter condition.
50
56
  */
51
57
  export function traverseAncestorsGenerator(object: Object3D): Generator<Object3D, void, unknown>;
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.164.0",
3
+ "version": "0.165.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -45,6 +45,6 @@
45
45
  "fflate": "~0.8.2",
46
46
  "meshoptimizer": "~0.18.1"
47
47
  },
48
- "typesPublisherContentHash": "58c6d9927d6ac01a5c65fdd023a998d808d352da3e1d79f7bb0b3b290f2d5443",
48
+ "typesPublisherContentHash": "49d047af400101035815c93fc592aa882a686de2432be990ac9df6ee209b2854",
49
49
  "typeScriptVersion": "4.7"
50
50
  }
@@ -1,8 +1,7 @@
1
- import { InterpolationModes } from "../../constants.js";
2
1
  import { KeyframeTrack } from "../KeyframeTrack.js";
3
2
 
4
3
  export class StringKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: ArrayLike<number>, values: ArrayLike<any>, interpolation?: InterpolationModes);
4
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<any>);
6
5
 
7
6
  /**
8
7
  * @default 'string'
@@ -15,6 +15,24 @@ export type NormalOrGLBufferAttributes = Record<
15
15
  BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute
16
16
  >;
17
17
 
18
+ export interface GeometryGroup {
19
+ /**
20
+ * Specifies the first element in this draw call – the first vertex for non-indexed geometry, otherwise the first triangle index.
21
+ * @remarks Expects a `Integer`
22
+ */
23
+ start: number;
24
+ /**
25
+ * Specifies how many vertices (or indices) are included.
26
+ * @remarks Expects a `Integer`
27
+ */
28
+ count: number;
29
+ /**
30
+ * Specifies the material array index to use.
31
+ * @remarks Expects a `Integer`
32
+ */
33
+ materialIndex?: number | undefined;
34
+ }
35
+
18
36
  /**
19
37
  * A representation of mesh, line, or point geometry
20
38
  * Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU.
@@ -144,23 +162,7 @@ export class BufferGeometry<
144
162
  * @remarks Use {@link addGroup | .addGroup} to add groups, rather than modifying this array directly.
145
163
  * @defaultValue `[]`
146
164
  */
147
- groups: Array<{
148
- /**
149
- * Specifies the first element in this draw call – the first vertex for non-indexed geometry, otherwise the first triangle index.
150
- * @remarks Expects a `Integer`
151
- */
152
- start: number;
153
- /**
154
- * Specifies how many vertices (or indices) are included.
155
- * @remarks Expects a `Integer`
156
- */
157
- count: number;
158
- /**
159
- * Specifies the material array index to use.
160
- * @remarks Expects a `Integer`
161
- */
162
- materialIndex?: number | undefined;
163
- }>;
165
+ groups: GeometryGroup[];
164
166
 
165
167
  /**
166
168
  * Bounding box for the {@link THREE.BufferGeometry | BufferGeometry}, which can be calculated with {@link computeBoundingBox | .computeBoundingBox()}.
@@ -10,6 +10,8 @@ import { InterleavedBufferAttribute } from "./InterleavedBufferAttribute.js";
10
10
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBuffer.js | Source}
11
11
  */
12
12
  export class InterleavedBuffer {
13
+ readonly isInterleavedBuffer: true;
14
+
13
15
  /**
14
16
  * Create a new instance of {@link InterleavedBuffer}
15
17
  * @param array A {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | TypedArray} with a shared buffer. Stores the geometry data.
@@ -1,7 +1,10 @@
1
- export interface LoaderUtils {
2
- decodeText(array: BufferSource): string;
3
- extractUrlBase(url: string): string;
4
- resolveURL(url: string, path: string): string;
5
- }
1
+ export class LoaderUtils {
2
+ /**
3
+ * @deprecated decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.
4
+ */
5
+ static decodeText(array: BufferSource): string;
6
+
7
+ static extractUrlBase(url: string): string;
6
8
 
7
- export const LoaderUtils: LoaderUtils;
9
+ static resolveURL(url: string, path: string): string;
10
+ }
three/src/math/Color.d.ts CHANGED
@@ -255,7 +255,7 @@ export class Color {
255
255
  * Copies given color.
256
256
  * @param color Color to copy.
257
257
  */
258
- copy(color: this): this;
258
+ copy(color: Color): this;
259
259
 
260
260
  /**
261
261
  * Copies given color making conversion from sRGB to linear space.
@@ -52,6 +52,8 @@ export interface Matrix {
52
52
  * ( class Matrix3 implements Matrix<Matrix3> )
53
53
  */
54
54
  export class Matrix3 implements Matrix {
55
+ readonly isMatrix3: true;
56
+
55
57
  /**
56
58
  * Creates an identity matrix.
57
59
  */
@@ -42,6 +42,8 @@ export type Matrix4Tuple = [
42
42
  * m.multiply( m3 );
43
43
  */
44
44
  export class Matrix4 implements Matrix {
45
+ readonly isMatrix4: true;
46
+
45
47
  /**
46
48
  * Creates an identity matrix.
47
49
  */
@@ -2,6 +2,7 @@ import { Camera } from "../cameras/Camera.js";
2
2
  import { BufferGeometry } from "../core/BufferGeometry.js";
3
3
  import { Material } from "../materials/Material.js";
4
4
  import { Box3 } from "../math/Box3.js";
5
+ import { Color } from "../math/Color.js";
5
6
  import { Matrix4 } from "../math/Matrix4.js";
6
7
  import { Sphere } from "../math/Sphere.js";
7
8
  import { Mesh } from "./Mesh.js";
@@ -108,6 +109,13 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
108
109
  func: ((this: this, list: Array<{ start: number; count: number; z: number }>, camera: Camera) => void) | null,
109
110
  ): this;
110
111
 
112
+ /**
113
+ * Get the color of the defined geometry.
114
+ * @param index The index of a geometry. Values have to be in the range [0, count].
115
+ * @param color This color object will be set to the color of the defined geometry.
116
+ */
117
+ getColorAt(index: number, color: Color): void;
118
+
111
119
  /**
112
120
  * Get the local transformation matrix of the defined instance.
113
121
  * @param index The index of an instance. Values have to be in the range [0, count].
@@ -121,6 +129,13 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
121
129
  */
122
130
  getVisibleAt(index: number): boolean;
123
131
 
132
+ /**
133
+ * Sets the given color to the defined geometry.
134
+ * @param index The index of a geometry. Values have to be in the range [0, count].
135
+ * @param color The color of a single geometry.
136
+ */
137
+ setColorAt(index: number, color: Color): void;
138
+
124
139
  /**
125
140
  * Sets the given local transformation matrix to the defined instance. Make sure you set {@link .instanceMatrix}
126
141
  * {@link BufferAttribute.needsUpdate} to true after updating all the matrices.
@@ -16,7 +16,7 @@ export interface InstancedMeshEventMap extends Object3DEventMap {
16
16
  /**
17
17
  * A special version of {@link THREE.Mesh | Mesh} with instanced rendering support
18
18
  * @remarks
19
- * Use {@link InstancedMesh} if you have to render a large number of objects with the same geometry and material but with different world transformations
19
+ * Use {@link InstancedMesh} if you have to render a large number of objects with the same geometry and material(s) but with different world transformations
20
20
  * @remarks
21
21
  * The usage of {@link InstancedMesh} will help you to reduce the number of draw calls and thus improve the overall rendering performance in your application.
22
22
  * @see Example: {@link https://threejs.org/examples/#webgl_instancing_dynamic | WebGL / instancing / dynamic}
@@ -33,8 +33,8 @@ export class InstancedMesh<
33
33
  > extends Mesh<TGeometry, TMaterial, TEventMap> {
34
34
  /**
35
35
  * Create a new instance of {@link InstancedMesh}
36
- * @param geometry An instance of {@link THREE.BufferGeometry | BufferGeometry}.
37
- * @param material A single or an array of {@link THREE.Material | Material}. Default {@link THREE.MeshBasicMaterial | `new THREE.MeshBasicMaterial()`}.
36
+ * @param geometry An instance of {@link BufferGeometry}.
37
+ * @param material A single or an array of {@link Material}. Default is a new {@link MeshBasicMaterial}.
38
38
  * @param count The **maximum** number of instances of this Mesh. Expects a `Integer`
39
39
  */
40
40
  constructor(geometry: TGeometry | undefined, material: TMaterial | undefined, count: number);
@@ -1,8 +1,10 @@
1
1
  import { Camera } from "../cameras/Camera.js";
2
2
  import { ColorSpace, CullFace, ShadowMapType, ToneMapping, WebGLCoordinateSystem } from "../constants.js";
3
+ import { TypedArray } from "../core/BufferAttribute.js";
3
4
  import { BufferGeometry } from "../core/BufferGeometry.js";
4
5
  import { Object3D } from "../core/Object3D.js";
5
6
  import { Material } from "../materials/Material.js";
7
+ import { Box2 } from "../math/Box2.js";
6
8
  import { Box3 } from "../math/Box3.js";
7
9
  import { Color, ColorRepresentation } from "../math/Color.js";
8
10
  import { Plane } from "../math/Plane.js";
@@ -125,7 +127,7 @@ export interface WebGLDebug {
125
127
  */
126
128
  export class WebGLRenderer implements Renderer {
127
129
  /**
128
- * parameters is an optional object with properties defining the renderer's behaviour.
130
+ * parameters is an optional object with properties defining the renderer's behavior.
129
131
  * The constructor also accepts no parameters at all.
130
132
  * In all cases, it will assume sane defaults when parameters are missing.
131
133
  */
@@ -196,13 +198,6 @@ export class WebGLRenderer implements Renderer {
196
198
 
197
199
  get coordinateSystem(): typeof WebGLCoordinateSystem;
198
200
 
199
- /**
200
- * @deprecated Migrate your lighting according to the following guide:
201
- * https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.
202
- * @default true
203
- */
204
- useLegacyLights: boolean;
205
-
206
201
  /**
207
202
  * @default THREE.NoToneMapping
208
203
  */
@@ -421,46 +416,73 @@ export class WebGLRenderer implements Renderer {
421
416
  y: number,
422
417
  width: number,
423
418
  height: number,
424
- buffer: any,
419
+ buffer: TypedArray,
425
420
  activeCubeFaceIndex?: number,
426
421
  ): void;
427
422
 
423
+ readRenderTargetPixelsAsync(
424
+ renderTarget: WebGLRenderTarget | WebGLRenderTarget<Texture[]>,
425
+ x: number,
426
+ y: number,
427
+ width: number,
428
+ height: number,
429
+ buffer: TypedArray,
430
+ activeCubeFaceIndex?: number,
431
+ ): Promise<TypedArray>;
432
+
428
433
  /**
429
434
  * Copies a region of the currently bound framebuffer into the selected mipmap level of the selected texture.
430
435
  * This region is defined by the size of the destination texture's mip level, offset by the input position.
431
436
  *
432
- * @param position Specifies the pixel offset from which to copy out of the framebuffer.
433
437
  * @param texture Specifies the destination texture.
438
+ * @param position Specifies the pixel offset from which to copy out of the framebuffer.
434
439
  * @param level Specifies the destination mipmap level of the texture.
435
440
  */
436
- copyFramebufferToTexture(position: Vector2, texture: Texture, level?: number): void;
441
+ copyFramebufferToTexture(texture: Texture, position?: Vector2 | null, level?: number): void;
437
442
 
438
443
  /**
439
- * Copies srcTexture to the specified level of dstTexture, offset by the input position.
444
+ * Copies the pixels of a texture in the bounds `srcRegion` in the destination texture starting from the given
445
+ * position.
440
446
  *
441
- * @param position Specifies the pixel offset into the dstTexture where the copy will occur.
442
447
  * @param srcTexture Specifies the source texture.
443
448
  * @param dstTexture Specifies the destination texture.
449
+ * @param srcRegion Specifies the bounds
450
+ * @param dstPosition Specifies the pixel offset into the dstTexture where the copy will occur.
444
451
  * @param level Specifies the destination mipmap level of the texture.
445
452
  */
446
- copyTextureToTexture(position: Vector2, srcTexture: Texture, dstTexture: Texture, level?: number): void;
453
+ copyTextureToTexture(
454
+ srcTexture: Texture,
455
+ dstTexture: Texture,
456
+ srcRegion?: Box2 | null,
457
+ dstPosition?: Vector2 | null,
458
+ level?: number,
459
+ ): void;
447
460
 
448
461
  /**
449
- * Copies the pixels of a texture in the bounds sourceBox in the desination texture starting from the given position.
450
- * @param sourceBox Specifies the bounds
451
- * @param position Specifies the pixel offset into the dstTexture where the copy will occur.
462
+ * Copies the pixels of a texture in the bounds `srcRegion` in the destination texture starting from the given
463
+ * position.
464
+ *
452
465
  * @param srcTexture Specifies the source texture.
453
466
  * @param dstTexture Specifies the destination texture.
467
+ * @param srcRegion Specifies the bounds
468
+ * @param dstPosition Specifies the pixel offset into the dstTexture where the copy will occur.
454
469
  * @param level Specifies the destination mipmap level of the texture.
455
470
  */
456
471
  copyTextureToTexture3D(
457
- sourceBox: Box3,
458
- position: Vector3,
459
472
  srcTexture: Texture,
460
473
  dstTexture: Data3DTexture | DataArrayTexture,
474
+ srcRegion?: Box3 | null,
475
+ dstPosition?: Vector3 | null,
461
476
  level?: number,
462
477
  ): void;
463
478
 
479
+ /**
480
+ * Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data can be copied
481
+ * into it using {@link WebGLRenderer.copyTextureToTexture} before it has been rendered to.
482
+ * @param target
483
+ */
484
+ initRenderTarget(target: WebGLRenderTarget): void;
485
+
464
486
  /**
465
487
  * Initializes the given texture. Can be used to preload a texture rather than waiting until first render (which can cause noticeable lags due to decode and GPU upload overhead).
466
488
  *
@@ -39,6 +39,7 @@ export interface WebGLProgramParameters {
39
39
  precision: "lowp" | "mediump" | "highp";
40
40
 
41
41
  batching: boolean;
42
+ batchingColor: boolean;
42
43
  instancing: boolean;
43
44
  instancingColor: boolean;
44
45
  instancingMorph: boolean;
@@ -186,7 +187,6 @@ export interface WebGLProgramParameters {
186
187
  shadowMapType: ShadowMapType;
187
188
 
188
189
  toneMapping: ToneMapping;
189
- useLegacyLights: boolean;
190
190
 
191
191
  decodeVideoTexture: boolean;
192
192
 
@@ -21,7 +21,7 @@ export class WebXRDepthSensing {
21
21
 
22
22
  init(renderer: WebGLRenderer, depthData: XRWebGLDepthInformation, renderState: XRRenderState): void;
23
23
 
24
- render(renderer: WebGLRenderer, cameraXR: WebXRArrayCamera): void;
24
+ getMesh(cameraXR: WebXRArrayCamera): Mesh | null;
25
25
 
26
26
  reset(): void;
27
27
  }
@@ -9,6 +9,32 @@ import { CompressedTexture } from "./CompressedTexture.js";
9
9
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CompressedArrayTexture.js | Source}
10
10
  */
11
11
  export class CompressedArrayTexture extends CompressedTexture {
12
+ /**
13
+ * Read-only flag to check if a given object is of type {@link CompressedArrayTexture}.
14
+ * @remarks This is a _constant_ value
15
+ * @defaultValue `true`
16
+ */
17
+ readonly isCompressedArrayTexture: true;
18
+
19
+ /**
20
+ * Overridden with a object containing width and height.
21
+ * @override
22
+ */
23
+ get image(): { width: number; height: number; depth: number };
24
+ set image(value: { width: number; height: number; depth: number });
25
+
26
+ /**
27
+ * This defines how the texture is wrapped in the depth direction.
28
+ * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
29
+ * @defaultValue {@link THREE.ClampToEdgeWrapping}
30
+ */
31
+ wrapR: Wrapping;
32
+
33
+ /**
34
+ * A set of all layers which need to be updated in the texture. See {@link CompressedArrayTexture.addLayerUpdate}.
35
+ */
36
+ layerUpdates: Set<number>;
37
+
12
38
  /**
13
39
  * Create a new instance of {@link CompressedArrayTexture}
14
40
  * @param mipmaps The mipmaps array should contain objects with data, width and height.
@@ -29,23 +55,14 @@ export class CompressedArrayTexture extends CompressedTexture {
29
55
  );
30
56
 
31
57
  /**
32
- * Read-only flag to check if a given object is of type {@link CompressedArrayTexture}.
33
- * @remarks This is a _constant_ value
34
- * @defaultValue `true`
58
+ * Describes that a specific layer of the texture needs to be updated. Normally when {@link Texture.needsUpdate} is
59
+ * set to true, the entire compressed texture array is sent to the GPU. Marking specific layers will only transmit
60
+ * subsets of all mipmaps associated with a specific depth in the array which is often much more performant.
35
61
  */
36
- readonly isCompressedArrayTexture: true;
62
+ addLayerUpdate(layerIndex: number): void;
37
63
 
38
64
  /**
39
- * Overridden with a object containing width and height.
40
- * @override
65
+ * Resets the layer updates registry. See {@link CompressedArrayTexture.addLayerUpdate}.
41
66
  */
42
- get image(): { width: number; height: number; depth: number };
43
- set image(value: { width: number; height: number; depth: number });
44
-
45
- /**
46
- * This defines how the texture is wrapped in the depth direction.
47
- * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
48
- * @defaultValue {@link THREE.ClampToEdgeWrapping}
49
- */
50
- wrapR: Wrapping;
67
+ clearLayoutUpdates(): void;
51
68
  }