@types/three 0.159.0 → 0.161.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 (211) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +5 -1
  3. three/examples/jsm/capabilities/WebGPU.d.ts +2 -0
  4. three/examples/jsm/curves/NURBSUtils.d.ts +136 -10
  5. three/examples/jsm/curves/NURBSVolume.d.ts +23 -0
  6. three/examples/jsm/exporters/USDZExporter.d.ts +1 -0
  7. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -0
  8. three/examples/jsm/loaders/KTX2Loader.d.ts +45 -11
  9. three/examples/jsm/loaders/LUT3dlLoader.d.ts +29 -2
  10. three/examples/jsm/loaders/LUTCubeLoader.d.ts +37 -2
  11. three/examples/jsm/loaders/MaterialXLoader.d.ts +6 -0
  12. three/examples/jsm/materials/MeshPostProcessingMaterial.d.ts +13 -0
  13. three/examples/jsm/misc/Timer.d.ts +80 -0
  14. three/examples/jsm/nodes/Nodes.d.ts +304 -61
  15. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +9 -0
  16. three/examples/jsm/nodes/accessors/BufferNode.d.ts +4 -1
  17. three/examples/jsm/nodes/accessors/CameraNode.d.ts +24 -6
  18. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +17 -4
  19. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +3 -0
  20. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +12 -0
  21. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +7 -0
  22. three/examples/jsm/nodes/accessors/ModelNode.d.ts +9 -1
  23. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
  24. three/examples/jsm/nodes/accessors/NormalNode.d.ts +8 -0
  25. three/examples/jsm/nodes/accessors/Object3DNode.d.ts +10 -6
  26. three/examples/jsm/nodes/accessors/PointUVNode.d.ts +3 -0
  27. three/examples/jsm/nodes/accessors/PositionNode.d.ts +8 -0
  28. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +4 -1
  29. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -0
  30. three/examples/jsm/nodes/accessors/SkinningNode.d.ts +3 -0
  31. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +8 -1
  32. three/examples/jsm/nodes/accessors/TangentNode.d.ts +9 -0
  33. three/examples/jsm/nodes/accessors/TextureBicubicNode.d.ts +18 -0
  34. three/examples/jsm/nodes/accessors/TextureNode.d.ts +21 -5
  35. three/examples/jsm/nodes/accessors/UVNode.d.ts +3 -0
  36. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +7 -0
  37. three/examples/jsm/nodes/accessors/VertexColorNode.d.ts +12 -0
  38. three/examples/jsm/nodes/code/CodeNode.d.ts +4 -0
  39. three/examples/jsm/nodes/code/ExpressionNode.d.ts +3 -0
  40. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +13 -1
  41. three/examples/jsm/nodes/code/FunctionNode.d.ts +17 -0
  42. three/examples/jsm/nodes/core/ArrayUniformNode.d.ts +1 -1
  43. three/examples/jsm/nodes/core/AssignNode.d.ts +17 -0
  44. three/examples/jsm/nodes/core/AttributeNode.d.ts +3 -0
  45. three/examples/jsm/nodes/core/BypassNode.d.ts +9 -0
  46. three/examples/jsm/nodes/core/CacheNode.d.ts +11 -0
  47. three/examples/jsm/nodes/core/ConstNode.d.ts +3 -3
  48. three/examples/jsm/nodes/core/ContextNode.d.ts +11 -0
  49. three/examples/jsm/nodes/core/IndexNode.d.ts +18 -0
  50. three/examples/jsm/nodes/core/InputNode.d.ts +4 -4
  51. three/examples/jsm/nodes/core/LightingModel.d.ts +36 -0
  52. three/examples/jsm/nodes/core/Node.d.ts +32 -8
  53. three/examples/jsm/nodes/core/NodeBuilder.d.ts +27 -23
  54. three/examples/jsm/nodes/core/NodeFrame.d.ts +18 -6
  55. three/examples/jsm/nodes/core/NodeUniform.d.ts +12 -8
  56. three/examples/jsm/nodes/core/NodeUtils.d.ts +6 -3
  57. three/examples/jsm/nodes/core/PropertyNode.d.ts +27 -1
  58. three/examples/jsm/nodes/core/UniformNode.d.ts +12 -4
  59. three/examples/jsm/nodes/core/VarNode.d.ts +10 -0
  60. three/examples/jsm/nodes/core/VaryingNode.d.ts +9 -0
  61. three/examples/jsm/nodes/core/constants.d.ts +31 -28
  62. three/examples/jsm/nodes/display/AfterImageNode.d.ts +25 -0
  63. three/examples/jsm/nodes/display/AnamorphicNode.d.ts +32 -0
  64. three/examples/jsm/nodes/display/BlendModeNode.d.ts +21 -6
  65. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +29 -1
  66. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +17 -0
  67. three/examples/jsm/nodes/display/FrontFacingNode.d.ts +4 -0
  68. three/examples/jsm/nodes/display/GaussianBlurNode.d.ts +28 -0
  69. three/examples/jsm/nodes/display/NormalMapNode.d.ts +13 -1
  70. three/examples/jsm/nodes/display/PassNode.d.ts +44 -0
  71. three/examples/jsm/nodes/display/PosterizeNode.d.ts +12 -0
  72. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +8 -1
  73. three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +32 -0
  74. three/examples/jsm/nodes/display/ViewportNode.d.ts +8 -0
  75. three/examples/jsm/nodes/display/ViewportSharedTextureNode.d.ts +18 -0
  76. three/examples/jsm/nodes/display/ViewportTextureNode.d.ts +33 -0
  77. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +9 -0
  78. three/examples/jsm/nodes/fog/FogNode.d.ts +9 -0
  79. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +9 -0
  80. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +9 -2
  81. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +3 -2
  82. three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.d.ts +7 -0
  83. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +3 -2
  84. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +3 -2
  85. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +3 -2
  86. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +1 -1
  87. three/examples/jsm/nodes/functions/PhongLightingModel.d.ts +7 -0
  88. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +17 -8
  89. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +1 -1
  90. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +1 -1
  91. three/examples/jsm/nodes/geometry/RangeNode.d.ts +3 -0
  92. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +13 -0
  93. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +20 -8
  94. three/examples/jsm/nodes/lighting/LightsNode.d.ts +3 -0
  95. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +1 -2
  96. three/examples/jsm/nodes/materials/Materials.d.ts +9 -17
  97. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +2 -4
  98. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +12 -0
  99. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +16 -7
  100. three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +17 -0
  101. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +1 -5
  102. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +55 -16
  103. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +2 -8
  104. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +0 -10
  105. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +43 -34
  106. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +5 -3
  107. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +7 -5
  108. three/examples/jsm/nodes/math/CondNode.d.ts +13 -0
  109. three/examples/jsm/nodes/math/HashNode.d.ts +16 -0
  110. three/examples/jsm/nodes/math/MathNode.d.ts +140 -1
  111. three/examples/jsm/nodes/math/MathUtils.d.ts +16 -0
  112. three/examples/jsm/nodes/math/OperatorNode.d.ts +53 -1
  113. three/examples/jsm/nodes/math/TriNoise3D.d.ts +12 -0
  114. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +9 -0
  115. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +124 -31
  116. three/examples/jsm/nodes/utils/DiscardNode.d.ts +16 -0
  117. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +4 -2
  118. three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +3 -0
  119. three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +6 -3
  120. three/examples/jsm/nodes/utils/OscNode.d.ts +6 -0
  121. three/examples/jsm/nodes/utils/ReflectorNode.d.ts +30 -0
  122. three/examples/jsm/nodes/utils/RemapNode.d.ts +24 -1
  123. three/examples/jsm/nodes/utils/RotateNode.d.ts +21 -0
  124. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +9 -0
  125. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +5 -1
  126. three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +7 -0
  127. three/examples/jsm/nodes/utils/TimerNode.d.ts +7 -1
  128. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +28 -7
  129. three/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
  130. three/examples/jsm/objects/QuadMesh.d.ts +15 -0
  131. three/examples/jsm/postprocessing/{HBAOPass.d.ts → GTAOPass.d.ts} +25 -10
  132. three/examples/jsm/postprocessing/SSAOPass.d.ts +1 -1
  133. three/examples/jsm/renderers/common/Backend.d.ts +6 -2
  134. three/examples/jsm/renderers/common/Color4.d.ts +9 -0
  135. three/examples/jsm/renderers/common/Info.d.ts +7 -1
  136. three/examples/jsm/renderers/common/PostProcessing.d.ts +11 -0
  137. three/examples/jsm/renderers/common/Renderer.d.ts +243 -4
  138. three/examples/jsm/renderers/common/StorageTexture.d.ts +5 -0
  139. three/examples/jsm/renderers/webgl/WebGLBackend.d.ts +4 -2
  140. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +2 -2
  141. three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.d.ts +3 -0
  142. three/examples/jsm/renderers/webgpu/WebGPUBackend.d.ts +15 -6
  143. three/examples/jsm/renderers/webgpu/WebGPURenderer.d.ts +7 -7
  144. three/examples/jsm/shaders/{HBAOShader.d.ts → GTAOShader.d.ts} +23 -8
  145. three/examples/jsm/shaders/PoissonDenoiseShader.d.ts +1 -1
  146. three/examples/jsm/utils/BufferGeometryUtils.d.ts +0 -10
  147. three/examples/jsm/webxr/XRControllerModelFactory.d.ts +6 -5
  148. three/examples/jsm/webxr/XRHandMeshModel.d.ts +10 -2
  149. three/package.json +2 -2
  150. three/src/Three.d.ts +1 -0
  151. three/src/cameras/PerspectiveCamera.d.ts +13 -0
  152. three/src/constants.d.ts +4 -3
  153. three/src/core/InterleavedBufferAttribute.d.ts +12 -2
  154. three/src/core/Object3D.d.ts +13 -13
  155. three/src/core/UniformsGroup.d.ts +3 -3
  156. three/src/extras/core/Curve.d.ts +9 -9
  157. three/src/extras/core/CurvePath.d.ts +8 -7
  158. three/src/geometries/RingGeometry.d.ts +1 -1
  159. three/src/lights/PointLight.d.ts +7 -0
  160. three/src/loaders/MaterialLoader.d.ts +6 -3
  161. three/src/materials/LineBasicMaterial.d.ts +7 -0
  162. three/src/materials/LineDashedMaterial.d.ts +7 -1
  163. three/src/materials/Material.d.ts +17 -15
  164. three/src/materials/MeshBasicMaterial.d.ts +7 -0
  165. three/src/materials/MeshDepthMaterial.d.ts +6 -0
  166. three/src/materials/MeshDistanceMaterial.d.ts +7 -0
  167. three/src/materials/MeshLambertMaterial.d.ts +7 -0
  168. three/src/materials/MeshMatcapMaterial.d.ts +7 -0
  169. three/src/materials/MeshNormalMaterial.d.ts +7 -0
  170. three/src/materials/MeshPhongMaterial.d.ts +7 -0
  171. three/src/materials/MeshPhysicalMaterial.d.ts +6 -1
  172. three/src/materials/MeshStandardMaterial.d.ts +7 -2
  173. three/src/materials/MeshToonMaterial.d.ts +7 -0
  174. three/src/materials/PointsMaterial.d.ts +7 -0
  175. three/src/materials/RawShaderMaterial.d.ts +9 -0
  176. three/src/materials/ShaderMaterial.d.ts +17 -3
  177. three/src/materials/ShadowMaterial.d.ts +7 -0
  178. three/src/materials/SpriteMaterial.d.ts +7 -2
  179. three/src/math/Color.d.ts +1 -1
  180. three/src/math/Matrix4.d.ts +30 -30
  181. three/src/math/Quaternion.d.ts +27 -30
  182. three/src/math/Sphere.d.ts +5 -0
  183. three/src/math/Triangle.d.ts +8 -25
  184. three/src/math/Vector2.d.ts +24 -159
  185. three/src/math/Vector3.d.ts +46 -54
  186. three/src/math/Vector4.d.ts +25 -20
  187. three/src/objects/BatchedMesh.d.ts +2 -2
  188. three/src/objects/Bone.d.ts +2 -2
  189. three/src/objects/InstancedMesh.d.ts +2 -1
  190. three/src/objects/LOD.d.ts +2 -2
  191. three/src/objects/Line.d.ts +3 -2
  192. three/src/objects/LineLoop.d.ts +3 -1
  193. three/src/objects/LineSegments.d.ts +3 -1
  194. three/src/objects/Points.d.ts +3 -2
  195. three/src/objects/SkinnedMesh.d.ts +4 -8
  196. three/src/objects/Sprite.d.ts +2 -2
  197. three/src/renderers/shaders/ShaderLib.d.ts +18 -18
  198. three/src/renderers/shaders/UniformsUtils.d.ts +3 -2
  199. three/src/renderers/webgl/WebGLLights.d.ts +39 -37
  200. three/src/renderers/webgl/WebGLProgram.d.ts +0 -1
  201. three/src/renderers/webgl/WebGLPrograms.d.ts +226 -9
  202. three/src/renderers/webxr/WebXRDepthSensing.d.ts +27 -0
  203. three/src/renderers/webxr/WebXRManager.d.ts +2 -1
  204. three/src/textures/CompressedCubeTexture.d.ts +13 -0
  205. three/src/textures/DataArrayTexture.d.ts +1 -1
  206. three/src/textures/Source.d.ts +11 -1
  207. three/build/three.d.ts +0 -2
  208. three/build/three.min.d.ts +0 -2
  209. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +0 -310
  210. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -166
  211. three/examples/jsm/objects/GroundProjectedSkybox.d.ts +0 -13
@@ -1,42 +1,281 @@
1
- import { Camera, ColorSpace, CoordinateSystem, Scene, ToneMapping } from '../../../../src/Three.js';
1
+ import {
2
+ Camera,
3
+ ColorSpace,
4
+ CoordinateSystem,
5
+ Scene,
6
+ ToneMapping,
7
+ Vector2,
8
+ Vector4,
9
+ Color,
10
+ Object3D,
11
+ RenderTarget,
12
+ FramebufferTexture,
13
+ BufferGeometry,
14
+ Material,
15
+ Group,
16
+ } from '../../../../src/Three.js';
2
17
  import Backend from './Backend.js';
3
18
  import Info from './Info.js';
19
+ import Color4 from './../common/Color4.js';
20
+ import ComputeNode from '../../nodes/gpgpu/ComputeNode.js';
21
+ import LightsNode from '../../nodes/lighting/LightsNode.js';
4
22
 
23
+ export interface RendererParameters {
24
+ logarithmicDepthBuffer?: boolean | undefined;
25
+ alpha?: boolean | undefined;
26
+ }
27
+
28
+ /**
29
+ * Generic Renderer interface containing either a WebGL or WebGPU backend.
30
+ */
5
31
  export default class Renderer {
6
- isRenderer: true;
32
+ /**
33
+ * @default true
34
+ */
35
+ readonly isRenderer: true;
7
36
 
8
37
  domElement: HTMLCanvasElement;
9
38
 
39
+ /**
40
+ * The renderer backend; could be WebGLBackend or WebGPUBackend
41
+ */
10
42
  backend: Backend;
11
43
 
44
+ /**
45
+ * @default true
46
+ */
12
47
  autoClear: boolean;
48
+
49
+ /**
50
+ * @default true
51
+ */
13
52
  autoClearColor: boolean;
53
+
54
+ /**
55
+ * @default true
56
+ */
14
57
  autoClearDepth: boolean;
58
+
59
+ /**
60
+ * @default true
61
+ */
15
62
  autoClearStencil: boolean;
16
63
 
64
+ /**
65
+ * @default SRGBColorSpace
66
+ */
17
67
  outputColorSpace: ColorSpace;
18
68
 
69
+ /**
70
+ * @default NoToneMapping
71
+ */
19
72
  toneMapping: ToneMapping;
73
+
74
+ /**
75
+ * @default 1.0
76
+ */
20
77
  toneMappingExposure: number;
21
78
 
79
+ /**
80
+ * @default true
81
+ */
22
82
  sortObjects: boolean;
23
83
 
84
+ /**
85
+ * @default true
86
+ */
24
87
  depth: boolean;
88
+
89
+ /**
90
+ * @default true
91
+ */
25
92
  stencil: boolean;
26
93
 
27
94
  info: Info;
28
95
 
29
- constructor(backend: Backend, parameters?: { logarithmicDepthBuffer?: boolean | undefined });
96
+ constructor(backend: Backend, parameters?: RendererParameters);
30
97
 
31
98
  init(): Promise<void>;
32
99
 
33
100
  get coordinateSystem(): CoordinateSystem;
34
101
 
35
- render(scene: Scene, camera: Camera): Promise<void>;
102
+ compileAsync(scene: Scene, camera: Camera, targetScene?: Scene | null): Promise<void>;
103
+
104
+ renderAsync(scene: Scene, camera: Camera): Promise<void>;
105
+
106
+ getMaxAnisotropy(): number;
107
+
108
+ getActiveCubeFace(): number;
109
+
110
+ getActiveMipmapLevel(): number;
36
111
 
37
112
  setAnimationLoop(callback: ((time: DOMHighResTimeStamp) => void) | null): Promise<void>;
38
113
 
114
+ /**
115
+ * Sets the pixel ratio of the Renderer.
116
+ */
39
117
  setPixelRatio(value?: number): void;
40
118
 
119
+ /**
120
+ * Sets the width and height of the output canvas and optionally updates the CSS style on the DOM element.
121
+ */
41
122
  setSize(width: number, height: number, updateStyle?: boolean): void;
123
+
124
+ /**
125
+ * Gets the Rendering Context of the renderer.
126
+ */
127
+ getContext(): RenderingContext;
128
+
129
+ /**
130
+ * Gets the current pixel ratio of the renderer.
131
+ */
132
+ getPixelRatio(): number;
133
+
134
+ getDrawingBufferSize(target: Vector2): Vector2;
135
+
136
+ getSize(target: Vector2): Vector2;
137
+
138
+ setDrawingBufferSize(width: number, height: number, pixelRatio: number): void;
139
+
140
+ /**
141
+ * Sets the custom opaque sort function for the RenderLists. Pass null to use the default painterSortStable function.
142
+ */
143
+ setOpaqueSort(method: (a: unknown, b: unknown) => number): void;
144
+
145
+ /**
146
+ * Sets the custom transparent sort function for the RenderLists. Pass null to use the default reversePainterSortStable function.
147
+ */
148
+ setTransparentSort(method: (a: unknown, b: unknown) => number): void;
149
+
150
+ /**
151
+ * Copies the scissor area into target.
152
+ */
153
+ getScissor(target: Vector4): Vector4;
154
+
155
+ /**
156
+ * Sets the scissor area from (x, y) to (x + width, y + height).
157
+ */
158
+ setScissor(x: number, y: number, width: number, height: number): void;
159
+
160
+ /**
161
+ * Returns true if scissor test is enabled; returns false otherwise.
162
+ */
163
+ getScissorTest(): boolean;
164
+
165
+ /**
166
+ * Enable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions.
167
+ */
168
+ setScissorTest(boolean: boolean): void;
169
+
170
+ /**
171
+ * Copies the viewport into target.
172
+ */
173
+ getViewport(target: Vector4): Vector4;
174
+
175
+ /**
176
+ * Sets the viewport to render from (x, y) to (x + width, y + height).
177
+ * (x, y) is the lower-left corner of the region.
178
+ */
179
+ setViewport(x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void;
180
+
181
+ /**
182
+ * Returns a Color4 instance with the current clear color.
183
+ */
184
+ getClearColor(target: Color4): Color4;
185
+
186
+ /**
187
+ * Sets the clear color, using color for the color and alpha for the opacity.
188
+ */
189
+ setClearColor(color: Color, alpha?: number): void;
190
+
191
+ /**
192
+ * Returns a float with the current clear alpha. Ranges from 0 to 1.
193
+ */
194
+ getClearAlpha(): number;
195
+
196
+ setClearAlpha(alpha: number): void;
197
+
198
+ getClearDepth(): number;
199
+
200
+ setClearDepth(depth: number): void;
201
+
202
+ getClearStencil(): number;
203
+
204
+ setClearStencil(stencil: number): void;
205
+
206
+ isOccluded(object: Object3D): boolean;
207
+
208
+ /**
209
+ * Tells the renderer to clear its color, depth or stencil drawing buffer(s).
210
+ * Arguments default to true
211
+ */
212
+ clearAsync(color?: boolean, depth?: boolean, stencil?: boolean): Promise<void>;
213
+
214
+ /**
215
+ * Clear the color buffer. Equivalent to calling .clear( true, false, false ).
216
+ */
217
+ clearColorAsync(): Promise<void>;
218
+
219
+ /**
220
+ * Clear the depth buffer. Equivalent to calling .clear( false, true, false ).
221
+ */
222
+ clearDepthAsync(): Promise<void>;
223
+
224
+ /**
225
+ * Clear the stencil buffer. Equivalent to calling .clear( false, false, true ).
226
+ */
227
+ clearStencilAsync(): Promise<void>;
228
+
229
+ get currentColorSpace(): ColorSpace;
230
+
231
+ dispose(): void;
232
+
233
+ setRenderTarget(renderTarget: RenderTarget, activeCubeFace?: number, activeMipmapLevel?: number): void;
234
+
235
+ getRenderTarget(): RenderTarget;
236
+
237
+ setRenderObjectFunction(renderObjectFunction: () => {}): void;
238
+
239
+ getRenderObjectFunction(): () => {};
240
+
241
+ /**
242
+ * Runs a compute pipeline
243
+ */
244
+ computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
245
+
246
+ hasFeature(name: string): boolean;
247
+
248
+ copyFramebufferToTexture(framebufferTexture: FramebufferTexture): void;
249
+
250
+ readRenderTargetPixelsAsync(
251
+ renderTarget: RenderTarget,
252
+ x: number,
253
+ y: number,
254
+ width: number,
255
+ height: number,
256
+ ): Promise<Float32Array | Uint16Array | Uint8Array | Int8Array | Int16Array | Uint32Array | Int32Array>;
257
+
258
+ renderObject(
259
+ object: Object3D,
260
+ scene: Scene,
261
+ camera: Camera,
262
+ geometry: BufferGeometry,
263
+ material: Material,
264
+ group: Group,
265
+ lightsNode: LightsNode,
266
+ ): void;
267
+
268
+ get compute(): (computeNodes: ComputeNode | ComputeNode[]) => Promise<void>;
269
+
270
+ get compile(): (scene: Scene, camera: Camera, targetScene?: Scene | null) => Promise<void>;
271
+
272
+ get render(): (scene: Scene, camera: Camera) => Promise<void>;
273
+
274
+ get clear(): (color?: boolean, depth?: boolean, stencil?: boolean) => Promise<void>;
275
+
276
+ get clearColor(): () => Promise<void>;
277
+
278
+ get clearDepth(): () => Promise<void>;
279
+
280
+ get clearStencil(): () => Promise<void>;
42
281
  }
@@ -0,0 +1,5 @@
1
+ import { Texture } from '../../../../src/Three.js';
2
+
3
+ export default class StorageTexture extends Texture {
4
+ constructor(width?: number, height?: number);
5
+ }
@@ -1,8 +1,10 @@
1
1
  import { CoordinateSystem } from '../../../../src/Three.js';
2
- import Backend from '../common/Backend.js';
2
+ import Backend, { BackendParameters } from '../common/Backend.js';
3
3
 
4
4
  export default class WebGLBackend extends Backend {
5
- constructor(parameters?: { canvas?: HTMLCanvasElement | undefined });
5
+ constructor(parameters?: BackendParameters);
6
6
 
7
7
  get coordinateSystem(): CoordinateSystem;
8
+
9
+ getMaxAnisotropy(): number;
8
10
  }
@@ -2,7 +2,7 @@ import NodeBuilder from '../../../nodes/core/NodeBuilder.js';
2
2
  import { Renderer, Object3D } from '../../../../../src/Three.js';
3
3
  import Node from '../../../nodes/core/Node.js';
4
4
  import SlotNode from './SlotNode.js';
5
- import { NodeShaderStageOption } from '../../../nodes/core/constants.js';
5
+ import { NodeShaderStage } from '../../../nodes/core/constants.js';
6
6
 
7
7
  export class WebGLNodeBuilder extends NodeBuilder {
8
8
  constructor(
@@ -11,7 +11,7 @@ export class WebGLNodeBuilder extends NodeBuilder {
11
11
  shader: { uniforms: any; vertexShader: any; fragmentShader: any },
12
12
  );
13
13
 
14
- addSlot(shaderStage: NodeShaderStageOption, slotNode: SlotNode): Node;
14
+ addSlot(shaderStage: NodeShaderStage, slotNode: SlotNode): Node;
15
15
 
16
16
  getUniforms(shaderStage: string): string;
17
17
 
@@ -0,0 +1,3 @@
1
+ import { NodeFrame } from '../../../nodes/Nodes.js';
2
+
3
+ export const nodeFrame: NodeFrame;
@@ -1,12 +1,21 @@
1
1
  import { CoordinateSystem } from '../../../../src/Three.js';
2
- import Backend from '../common/Backend.js';
2
+ import Backend, { BackendParameters } from '../common/Backend.js';
3
+
4
+ export interface WebGPUBackendParameters extends BackendParameters {
5
+ alpha?: boolean | undefined;
6
+ antialias?: boolean | undefined;
7
+ sampleCount?: number | undefined;
8
+ trackTimestamp?: boolean | undefined;
9
+ }
3
10
 
4
11
  export default class WebGPUBackend extends Backend {
5
- constructor(parameters?: {
6
- canvas?: HTMLCanvasElement | undefined;
7
- antialias?: boolean | undefined;
8
- sampleCount?: number | undefined;
9
- });
12
+ readonly isWebGPUBackend: true;
13
+
14
+ constructor(parameters?: WebGPUBackendParameters);
10
15
 
11
16
  get coordinateSystem(): CoordinateSystem;
17
+
18
+ // utils public
19
+
20
+ getMaxAnisotropy(): number;
12
21
  }
@@ -1,10 +1,10 @@
1
- import Renderer from '../common/Renderer.js';
1
+ import Renderer, { RendererParameters } from '../common/Renderer.js';
2
+ import { WebGPUBackendParameters } from './WebGPUBackend.js';
3
+
4
+ export interface WebGPURendererParameters extends RendererParameters, WebGPUBackendParameters {
5
+ forceWebGL?: boolean | undefined;
6
+ }
2
7
 
3
8
  export default class WebGPURenderer extends Renderer {
4
- constructor(parameters?: {
5
- canvas?: HTMLCanvasElement | undefined;
6
- antialias?: boolean | undefined;
7
- sampleCount?: number | undefined;
8
- logarithmicDepthBuffer?: boolean | undefined;
9
- });
9
+ constructor(parameters?: WebGPURendererParameters);
10
10
  }
@@ -1,14 +1,15 @@
1
- import { IUniform, Matrix4, Vector2 } from '../../../src/Three.js';
1
+ import { DataTexture, IUniform, Matrix4, Vector2, Vector3 } from '../../../src/Three.js';
2
2
 
3
- export const HBAOShader: {
3
+ export const GTAOShader: {
4
4
  name: string;
5
5
  defines: {
6
6
  PERSPECTIVE_CAMERA: number;
7
7
  SAMPLES: number;
8
- SAMPLE_VECTORS: string;
9
8
  NORMAL_VECTOR_TYPE: number;
10
- DEPTH_VALUE_SOURCE: number;
11
- SAMPLING_FROM_NOISE: number;
9
+ DEPTH_SWIZZLING: string;
10
+ SCREEN_SPACE_RADIUS: number;
11
+ SCREEN_SPACE_RADIUS_SCALE: number;
12
+ SCENE_CLIP_BOX: number;
12
13
  };
13
14
  uniforms: {
14
15
  tNormal: IUniform;
@@ -21,13 +22,17 @@ export const HBAOShader: {
21
22
  cameraProjectionMatrixInverse: IUniform<Matrix4>;
22
23
  radius: IUniform<number>;
23
24
  distanceExponent: IUniform<number>;
24
- bias: IUniform<number>;
25
+ thickness: IUniform<number>;
26
+ distanceFallOff: IUniform<number>;
27
+ scale: IUniform<number>;
28
+ sceneBoxMin: IUniform<Vector3>;
29
+ sceneBoxMax: IUniform<Vector3>;
25
30
  };
26
31
  vertexShader: string;
27
32
  fragmentShader: string;
28
33
  };
29
34
 
30
- export const HBAODepthShader: {
35
+ export const GTAODepthShader: {
31
36
  name: string;
32
37
  defines: {
33
38
  PERSPECTIVE_CAMERA: number;
@@ -41,4 +46,14 @@ export const HBAODepthShader: {
41
46
  fragmentShader: string;
42
47
  };
43
48
 
44
- export function generateHaboSampleKernelInitializer(samples: number): string;
49
+ export const GTAOBlendShader: {
50
+ name: string;
51
+ uniforms: {
52
+ tDiffuse: IUniform;
53
+ intensity: IUniform<number>;
54
+ };
55
+ vertexShader: string;
56
+ fragmentShader: string;
57
+ };
58
+
59
+ export function generateMagicSquareNoise(samples?: number): DataTexture;
@@ -25,4 +25,4 @@ export const PoissonDenoiseShader: {
25
25
  fragmentShader: string;
26
26
  };
27
27
 
28
- export function generatePdSamplePointInitializer(samples: number, rings: number): string;
28
+ export function generatePdSamplePointInitializer(samples: number, rings: number, radiusExponent: number): string;
@@ -35,13 +35,3 @@ export function deinterleaveGeometry(geometry: BufferGeometry): void;
35
35
  * @param creaseAngle The crease angle in radians.
36
36
  */
37
37
  export function toCreasedNormals(geometry: BufferGeometry, creaseAngle?: number): BufferGeometry;
38
-
39
- /**
40
- * @deprecated Use mergeGeometries instead.
41
- */
42
- export function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
43
-
44
- /**
45
- * @deprecated Use mergeAttributes instead.
46
- */
47
- export function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
@@ -1,6 +1,5 @@
1
- import { Group, Object3D, Texture } from '../../../src/Three.js';
2
-
3
- import { GLTFLoader } from '../loaders/GLTFLoader.js';
1
+ import { Group, Loader, Object3D, Texture } from '../../../src/Three.js';
2
+ import { GLTF } from '../loaders/GLTFLoader.js';
4
3
 
5
4
  export class XRControllerModel extends Object3D {
6
5
  constructor();
@@ -13,9 +12,11 @@ export class XRControllerModel extends Object3D {
13
12
  }
14
13
 
15
14
  export class XRControllerModelFactory {
16
- constructor(gltfLoader?: GLTFLoader);
17
- gltfLoader: GLTFLoader | null;
15
+ gltfLoader: Loader<GLTF> | null;
18
16
  path: string;
17
+ onLoad: ((scene: Group) => void) | null;
18
+
19
+ constructor(gltfLoader?: Loader<GLTF> | null, onLoad?: ((scene: Group) => void) | null);
19
20
 
20
21
  createControllerModel(controller: Group): XRControllerModel;
21
22
  }
@@ -1,11 +1,19 @@
1
- import { Object3D } from '../../../src/Three.js';
1
+ import { Loader, Object3D } from '../../../src/Three.js';
2
+ import { GLTF } from '../loaders/GLTFLoader.js';
2
3
 
3
4
  export class XRHandMeshModel {
4
5
  controller: Object3D;
5
6
  handModel: Object3D;
6
7
  bones: Object3D[];
7
8
 
8
- constructor(handModel: Object3D, controller: Object3D, path: string, handedness: string);
9
+ constructor(
10
+ handModel: Object3D,
11
+ controller: Object3D,
12
+ path: string,
13
+ handedness: string,
14
+ loader?: Loader<GLTF> | null,
15
+ onLoad?: ((object: Object3D) => void) | null,
16
+ );
9
17
 
10
18
  updateMesh(): void;
11
19
  }
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.159.0",
3
+ "version": "0.161.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -44,6 +44,6 @@
44
44
  "fflate": "~0.6.10",
45
45
  "meshoptimizer": "~0.18.1"
46
46
  },
47
- "typesPublisherContentHash": "00146f19c0acfa1923520aa89574fd3c011b0b97251b16d57b2bc5999534c2c9",
47
+ "typesPublisherContentHash": "3aa24058634b97c18523562ed8a4194a3a400d891c67daa36884efcbc24b62ef",
48
48
  "typeScriptVersion": "4.6"
49
49
  }
three/src/Three.d.ts CHANGED
@@ -223,6 +223,7 @@ export * from './scenes/Scene.js';
223
223
  */
224
224
  export * from './textures/VideoTexture.js';
225
225
  export * from './textures/CompressedArrayTexture.js';
226
+ export * from './textures/CompressedCubeTexture.js';
226
227
  export * from './textures/DataTexture.js';
227
228
  export * from './textures/CompressedTexture.js';
228
229
  export * from './textures/CubeTexture.js';
@@ -1,4 +1,5 @@
1
1
  import { Camera } from './Camera.js';
2
+ import { Vector2 } from '../math/Vector2.js';
2
3
 
3
4
  /**
4
5
  * Camera that uses {@link https://en.wikipedia.org/wiki/Perspective_(graphical) | perspective projection}.
@@ -148,6 +149,18 @@ export class PerspectiveCamera extends Camera {
148
149
  */
149
150
  getFilmHeight(): number;
150
151
 
152
+ /**
153
+ * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
154
+ * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
155
+ */
156
+ getViewBounds(distance: number, minTarget: Vector2, maxTarget: Vector2): void;
157
+
158
+ /**
159
+ * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
160
+ * Copies the result into the target Vector2, where x is width and y is height.
161
+ */
162
+ getViewSize(distance: number, minTarget: Vector2, maxTarget: Vector2): void;
163
+
151
164
  /**
152
165
  * Sets an offset in a larger frustum.
153
166
  * @remarks
three/src/constants.d.ts CHANGED
@@ -37,12 +37,11 @@ export type ShadowMapType = typeof BasicShadowMap | typeof PCFShadowMap | typeof
37
37
  export const FrontSide: 0;
38
38
  export const BackSide: 1;
39
39
  export const DoubleSide: 2;
40
- export const TwoPassDoubleSide: 2;
41
40
  /**
42
41
  * Defines which side of faces will be rendered - front, back or both.
43
42
  * Default is {@link FrontSide}.
44
43
  */
45
- export type Side = typeof FrontSide | typeof BackSide | typeof DoubleSide | typeof TwoPassDoubleSide;
44
+ export type Side = typeof FrontSide | typeof BackSide | typeof DoubleSide;
46
45
 
47
46
  // blending modes
48
47
  export const NoBlending: 0;
@@ -140,13 +139,15 @@ export const ReinhardToneMapping: 2;
140
139
  export const CineonToneMapping: 3;
141
140
  export const ACESFilmicToneMapping: 4;
142
141
  export const CustomToneMapping: 5;
142
+ export const AgXToneMapping: 6;
143
143
  export type ToneMapping =
144
144
  | typeof NoToneMapping
145
145
  | typeof LinearToneMapping
146
146
  | typeof ReinhardToneMapping
147
147
  | typeof CineonToneMapping
148
148
  | typeof ACESFilmicToneMapping
149
- | typeof CustomToneMapping;
149
+ | typeof CustomToneMapping
150
+ | typeof AgXToneMapping;
150
151
 
151
152
  // Bind modes
152
153
  export const AttachedBindMode: 'attached';
@@ -84,13 +84,23 @@ export class InterleavedBufferAttribute {
84
84
  * Applies normal matrix {@link Matrix3 | m} to every Vector3 element of this InterleavedBufferAttribute.
85
85
  * @param m
86
86
  */
87
- applyNormalMatrix(matrix: Matrix): this;
87
+ applyNormalMatrix(m: Matrix): this;
88
88
 
89
89
  /**
90
90
  * Applies matrix {@link Matrix4 | m} to every Vector3 element of this InterleavedBufferAttribute, interpreting the elements as a direction vectors.
91
91
  * @param m
92
92
  */
93
- transformDirection(matrix: Matrix): this;
93
+ transformDirection(m: Matrix): this;
94
+
95
+ /**
96
+ * Returns the given component of the vector at the given index.
97
+ */
98
+ getComponent(index: number, component: number): number;
99
+
100
+ /**
101
+ * Sets the given component of the vector at the given index.
102
+ */
103
+ setComponent(index: number, component: number, value: number): this;
94
104
 
95
105
  /**
96
106
  * Returns the x component of the item at the given index.