@types/three 0.172.0 → 0.174.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.
- three/README.md +1 -1
- three/examples/jsm/animation/CCDIKSolver.d.ts +3 -2
- three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
- three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
- three/examples/jsm/loaders/MTLLoader.d.ts +2 -1
- three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
- three/examples/jsm/misc/Timer.d.ts +13 -2
- three/examples/jsm/objects/Reflector.d.ts +1 -0
- three/examples/jsm/tsl/math/Bayer.d.ts +4 -0
- three/examples/jsm/tsl/utils/Raymarching.d.ts +9 -0
- three/examples/jsm/webxr/XRButton.d.ts +4 -2
- three/package.json +2 -2
- three/src/Three.Core.d.ts +2 -0
- three/src/Three.TSL.d.ts +13 -1
- three/src/Three.d.ts +6 -1
- three/src/animation/AnimationClip.d.ts +1 -1
- three/src/cameras/ArrayCamera.d.ts +7 -6
- three/src/cameras/Camera.d.ts +7 -7
- three/src/constants.d.ts +6 -0
- three/src/core/BufferAttribute.d.ts +5 -0
- three/src/core/Raycaster.d.ts +4 -0
- three/src/extras/PMREMGenerator.d.ts +15 -2
- three/src/geometries/TorusGeometry.d.ts +5 -6
- three/src/materials/nodes/NodeMaterial.d.ts +2 -1
- three/src/materials/nodes/NodeMaterials.d.ts +0 -4
- three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
- three/src/materials/nodes/VolumeNodeMaterial.d.ts +14 -2
- three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +5 -4
- three/src/math/Matrix4.d.ts +2 -1
- three/src/nodes/Nodes.d.ts +6 -3
- three/src/nodes/TSL.d.ts +5 -0
- three/src/nodes/accessors/Arrays.d.ts +9 -2
- three/src/nodes/accessors/BufferAttributeNode.d.ts +25 -22
- three/src/nodes/accessors/Camera.d.ts +1 -0
- three/src/nodes/accessors/Lights.d.ts +1 -1
- three/src/nodes/accessors/MaterialNode.d.ts +3 -3
- three/src/nodes/accessors/MaterialProperties.d.ts +5 -0
- three/src/nodes/accessors/ModelNode.d.ts +1 -0
- three/src/nodes/accessors/Object3DNode.d.ts +7 -5
- three/src/nodes/accessors/StorageBufferNode.d.ts +7 -3
- three/src/nodes/accessors/Texture3DNode.d.ts +2 -2
- three/src/nodes/core/ArrayNode.d.ts +26 -0
- three/src/nodes/core/LightingModel.d.ts +13 -28
- three/src/nodes/core/Node.d.ts +31 -23
- three/src/nodes/core/NodeAttribute.d.ts +3 -3
- three/src/nodes/core/NodeCache.d.ts +4 -3
- three/src/nodes/core/NodeParser.d.ts +1 -1
- three/src/nodes/core/NodeUniform.d.ts +4 -4
- three/src/nodes/core/NodeVar.d.ts +8 -4
- three/src/nodes/core/NodeVarying.d.ts +2 -2
- three/src/nodes/core/StructNode.d.ts +21 -0
- three/src/nodes/core/StructType.d.ts +8 -0
- three/src/nodes/core/StructTypeNode.d.ts +33 -14
- three/src/nodes/core/UniformNode.d.ts +7 -7
- three/src/nodes/core/VarNode.d.ts +8 -1
- three/src/nodes/core/VaryingNode.d.ts +9 -0
- three/src/nodes/core/constants.d.ts +0 -1
- three/src/nodes/display/PassNode.d.ts +10 -1
- three/src/nodes/functions/BSDF/LTC.d.ts +5 -1
- three/src/nodes/functions/VolumetricLightingModel.d.ts +6 -0
- three/src/nodes/geometry/RangeNode.d.ts +6 -11
- three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
- three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
- three/src/nodes/lighting/AnalyticLightNode.d.ts +13 -1
- three/src/nodes/lighting/LightingContextNode.d.ts +18 -4
- three/src/nodes/lighting/LightsNode.d.ts +24 -0
- three/src/nodes/lighting/PointLightNode.d.ts +8 -7
- three/src/nodes/lighting/ShadowBaseNode.d.ts +3 -0
- three/src/nodes/math/MathNode.d.ts +2 -0
- three/src/nodes/math/OperatorNode.d.ts +2 -0
- three/src/nodes/shapes/Shapes.d.ts +4 -0
- three/src/nodes/tsl/TSLBase.d.ts +1 -0
- three/src/nodes/tsl/TSLCore.d.ts +19 -3
- three/src/nodes/utils/MemberNode.d.ts +11 -0
- three/src/nodes/utils/ReflectorNode.d.ts +1 -0
- three/src/objects/BatchedMesh.d.ts +1 -0
- three/src/objects/InstancedMesh.d.ts +4 -3
- three/src/objects/LOD.d.ts +4 -3
- three/src/renderers/WebGLRenderer.d.ts +2 -2
- three/src/renderers/common/Animation.d.ts +16 -4
- three/src/renderers/common/Attributes.d.ts +1 -1
- three/src/renderers/common/BindGroup.d.ts +2 -2
- three/src/renderers/common/Binding.d.ts +2 -2
- three/src/renderers/common/Buffer.d.ts +3 -3
- three/src/renderers/common/BufferUtils.d.ts +8 -9
- three/src/renderers/common/BundleGroup.d.ts +3 -3
- three/src/renderers/common/ChainMap.d.ts +8 -8
- three/src/renderers/common/ClippingContext.d.ts +3 -3
- three/src/renderers/common/Color4.d.ts +12 -8
- three/src/renderers/common/ComputePipeline.d.ts +1 -1
- three/src/renderers/common/DataMap.d.ts +2 -2
- three/src/renderers/common/Geometries.d.ts +4 -4
- three/src/renderers/common/Info.d.ts +2 -13
- three/src/renderers/common/Pipeline.d.ts +1 -1
- three/src/renderers/common/Pipelines.d.ts +10 -10
- three/src/renderers/common/PostProcessing.d.ts +1 -1
- three/src/renderers/common/ProgrammableStage.d.ts +4 -4
- three/src/renderers/common/RenderContext.d.ts +8 -6
- three/src/renderers/common/RenderContexts.d.ts +16 -24
- three/src/renderers/common/RenderList.d.ts +11 -11
- three/src/renderers/common/RenderObject.d.ts +24 -16
- three/src/renderers/common/RenderObjects.d.ts +3 -3
- three/src/renderers/common/RenderPipeline.d.ts +1 -1
- three/src/renderers/common/Renderer.d.ts +139 -96
- three/src/renderers/common/Textures.d.ts +6 -6
- three/src/renderers/common/TimestampQueryPool.d.ts +43 -0
- three/src/renderers/common/Uniform.d.ts +39 -13
- three/src/renderers/common/UniformBuffer.d.ts +1 -1
- three/src/renderers/common/UniformsGroup.d.ts +13 -13
- three/src/renderers/common/XRManager.d.ts +194 -0
- three/src/renderers/common/XRRenderTarget.d.ts +23 -0
- three/src/renderers/common/extras/PMREMGenerator.d.ts +9 -2
- three/src/renderers/common/nodes/NodeBuilderState.d.ts +6 -6
- three/src/renderers/common/nodes/NodeLibrary.d.ts +11 -11
- three/src/renderers/common/nodes/NodeUniform.d.ts +39 -8
- three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +1 -1
- three/src/renderers/common/nodes/Nodes.d.ts +19 -18
- three/src/renderers/webgl/WebGLState.d.ts +7 -6
- three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
- three/src/textures/Texture.d.ts +2 -5
- three/src/textures/VideoFrameTexture.d.ts +27 -0
- three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +0 -13
- three/examples/jsm/objects/InstancedPoints.d.ts +0 -10
- three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Camera } from "../../cameras/Camera.js";
|
|
2
|
-
import { ShadowMapType, ToneMapping } from "../../constants.js";
|
|
2
|
+
import { ShadowMapType, TextureDataType, TimestampQuery, ToneMapping } from "../../constants.js";
|
|
3
3
|
import { BufferAttribute } from "../../core/BufferAttribute.js";
|
|
4
4
|
import { BufferGeometry, GeometryGroup } from "../../core/BufferGeometry.js";
|
|
5
5
|
import { Object3D } from "../../core/Object3D.js";
|
|
@@ -38,6 +38,7 @@ import RenderList, { Bundle, RenderItem } from "./RenderList.js";
|
|
|
38
38
|
import RenderLists from "./RenderLists.js";
|
|
39
39
|
import RenderObjects from "./RenderObjects.js";
|
|
40
40
|
import Textures from "./Textures.js";
|
|
41
|
+
import XRManager from "./XRManager.js";
|
|
41
42
|
interface Rectangle {
|
|
42
43
|
x: number;
|
|
43
44
|
y: number;
|
|
@@ -58,6 +59,7 @@ export interface RendererParameters {
|
|
|
58
59
|
antialias?: boolean | undefined;
|
|
59
60
|
samples?: number | undefined;
|
|
60
61
|
getFallback?: ((error: unknown) => Backend) | null | undefined;
|
|
62
|
+
colorBufferType?: TextureDataType | undefined;
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
63
65
|
* Base class for renderers.
|
|
@@ -112,6 +114,7 @@ declare class Renderer {
|
|
|
112
114
|
_renderTarget: RenderTarget | null;
|
|
113
115
|
_activeCubeFace: number;
|
|
114
116
|
_activeMipmapLevel: number;
|
|
117
|
+
_outputRenderTarget: RenderTarget | null;
|
|
115
118
|
_mrt: MRTNode | null;
|
|
116
119
|
_renderObjectFunction:
|
|
117
120
|
| ((
|
|
@@ -122,6 +125,8 @@ declare class Renderer {
|
|
|
122
125
|
material: Material,
|
|
123
126
|
group: GeometryGroup,
|
|
124
127
|
lightsNode: LightsNode,
|
|
128
|
+
clippingContext: ClippingContext | null,
|
|
129
|
+
passId: string | null,
|
|
125
130
|
) => void)
|
|
126
131
|
| null;
|
|
127
132
|
_currentRenderObjectFunction:
|
|
@@ -133,6 +138,8 @@ declare class Renderer {
|
|
|
133
138
|
material: Material,
|
|
134
139
|
group: GeometryGroup,
|
|
135
140
|
lightsNode: LightsNode,
|
|
141
|
+
clippingContext: ClippingContext | null,
|
|
142
|
+
passId: string | null,
|
|
136
143
|
) => void)
|
|
137
144
|
| null;
|
|
138
145
|
_currentRenderBundle: RenderBundle | null;
|
|
@@ -143,12 +150,14 @@ declare class Renderer {
|
|
|
143
150
|
camera: Camera,
|
|
144
151
|
lightsNode: LightsNode,
|
|
145
152
|
group: GeometryGroup,
|
|
153
|
+
clippingContext: ClippingContext | null,
|
|
146
154
|
passId?: string,
|
|
147
155
|
) => void;
|
|
148
156
|
_isDeviceLost: boolean;
|
|
149
157
|
onDeviceLost: (info: DeviceLostInfo) => void;
|
|
158
|
+
_colorBufferType: TextureDataType;
|
|
150
159
|
_initialized: boolean;
|
|
151
|
-
_initPromise: Promise<
|
|
160
|
+
_initPromise: Promise<this> | null;
|
|
152
161
|
_compilationPromises: Promise<void>[] | null;
|
|
153
162
|
transparent: boolean;
|
|
154
163
|
opaque: boolean;
|
|
@@ -156,9 +165,7 @@ declare class Renderer {
|
|
|
156
165
|
enabled: boolean;
|
|
157
166
|
type: ShadowMapType | null;
|
|
158
167
|
};
|
|
159
|
-
xr:
|
|
160
|
-
enabled: boolean;
|
|
161
|
-
};
|
|
168
|
+
xr: XRManager;
|
|
162
169
|
debug: {
|
|
163
170
|
checkShaderErrors: boolean;
|
|
164
171
|
onShaderError:
|
|
@@ -180,30 +187,32 @@ declare class Renderer {
|
|
|
180
187
|
*
|
|
181
188
|
* @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2).
|
|
182
189
|
* @param {Object} parameters - The configuration parameter.
|
|
183
|
-
* @param {
|
|
184
|
-
* @param {
|
|
185
|
-
* @param {
|
|
186
|
-
* @param {
|
|
187
|
-
* @param {
|
|
188
|
-
* @param {
|
|
190
|
+
* @param {boolean} [parameters.logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
|
|
191
|
+
* @param {boolean} [parameters.alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
|
|
192
|
+
* @param {boolean} [parameters.depth=true] - Whether the default framebuffer should have a depth buffer or not.
|
|
193
|
+
* @param {boolean} [parameters.stencil=false] - Whether the default framebuffer should have a stencil buffer or not.
|
|
194
|
+
* @param {boolean} [parameters.antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
|
|
195
|
+
* @param {number} [parameters.samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0
|
|
189
196
|
* to overwrite the default.
|
|
190
|
-
* @param {Function
|
|
197
|
+
* @param {?Function} [parameters.getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
|
|
198
|
+
* @param {number} [parameters.colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
|
|
199
|
+
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
|
|
191
200
|
*/
|
|
192
201
|
constructor(backend: Backend, parameters?: RendererParameters);
|
|
193
202
|
/**
|
|
194
203
|
* Initializes the renderer so it is ready for usage.
|
|
195
204
|
*
|
|
196
205
|
* @async
|
|
197
|
-
* @return {Promise} A Promise that resolves when the renderer has been initialized.
|
|
206
|
+
* @return {Promise<this>} A Promise that resolves when the renderer has been initialized.
|
|
198
207
|
*/
|
|
199
|
-
init(): Promise<
|
|
208
|
+
init(): Promise<this>;
|
|
200
209
|
/**
|
|
201
210
|
* The coordinate system of the renderer. The value of this property
|
|
202
211
|
* depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or
|
|
203
212
|
* `THREE.WebGPUCoordinateSystem`.
|
|
204
213
|
*
|
|
205
214
|
* @readonly
|
|
206
|
-
* @type {
|
|
215
|
+
* @type {number}
|
|
207
216
|
*/
|
|
208
217
|
get coordinateSystem(): import("../../constants.js").CoordinateSystem;
|
|
209
218
|
/**
|
|
@@ -219,7 +228,7 @@ declare class Renderer {
|
|
|
219
228
|
* @param {Object3D} scene - The scene or 3D object to precompile.
|
|
220
229
|
* @param {Camera} camera - The camera that is used to render the scene.
|
|
221
230
|
* @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added.
|
|
222
|
-
* @return {Promise} A Promise that resolves when the compile has been finished.
|
|
231
|
+
* @return {Promise<Array>} A Promise that resolves when the compile has been finished.
|
|
223
232
|
*/
|
|
224
233
|
compileAsync(scene: Object3D, camera: Camera, targetScene?: Object3D | null): Promise<void>;
|
|
225
234
|
/**
|
|
@@ -252,6 +261,12 @@ declare class Renderer {
|
|
|
252
261
|
* @return {MRTNode} The MRT configuration.
|
|
253
262
|
*/
|
|
254
263
|
getMRT(): MRTNode | null;
|
|
264
|
+
/**
|
|
265
|
+
* Returns the color buffer type.
|
|
266
|
+
*
|
|
267
|
+
* @return {number} The color buffer type.
|
|
268
|
+
*/
|
|
269
|
+
getColorBufferType(): TextureDataType;
|
|
255
270
|
/**
|
|
256
271
|
* Default implementation of the device lost callback.
|
|
257
272
|
*
|
|
@@ -277,7 +292,7 @@ declare class Renderer {
|
|
|
277
292
|
*
|
|
278
293
|
* @param {Object3D} scene - The scene or 3D object to render.
|
|
279
294
|
* @param {Camera} camera - The camera to render the scene with.
|
|
280
|
-
* @return {Promise
|
|
295
|
+
* @return {?Promise} A Promise that resolve when the scene has been rendered.
|
|
281
296
|
* Only returned when the renderer has not been initialized.
|
|
282
297
|
*/
|
|
283
298
|
render(scene: Scene, camera: Camera): Promise<void> | undefined;
|
|
@@ -287,7 +302,7 @@ declare class Renderer {
|
|
|
287
302
|
* pass and not inline to achieve more correct results.
|
|
288
303
|
*
|
|
289
304
|
* @private
|
|
290
|
-
* @return {RenderTarget
|
|
305
|
+
* @return {?RenderTarget} The render target. The method returns `null` if no output conversion should be applied.
|
|
291
306
|
*/
|
|
292
307
|
_getFrameBufferTarget(): RenderTarget<Texture> | null;
|
|
293
308
|
/**
|
|
@@ -296,26 +311,33 @@ declare class Renderer {
|
|
|
296
311
|
* @private
|
|
297
312
|
* @param {Object3D} scene - The scene or 3D object to render.
|
|
298
313
|
* @param {Camera} camera - The camera to render the scene with.
|
|
299
|
-
* @param {
|
|
314
|
+
* @param {boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not.
|
|
300
315
|
* @return {RenderContext} The current render context.
|
|
301
316
|
*/
|
|
302
317
|
_renderScene(scene: Scene, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* The output pass performs tone mapping and color space conversion.
|
|
320
|
+
*
|
|
321
|
+
* @private
|
|
322
|
+
* @param {RenderTarget} renderTarget - The current render target.
|
|
323
|
+
*/
|
|
324
|
+
_renderOutput(renderTarget: RenderTarget): void;
|
|
303
325
|
/**
|
|
304
326
|
* Returns the maximum available anisotropy for texture filtering.
|
|
305
327
|
*
|
|
306
|
-
* @return {
|
|
328
|
+
* @return {number} The maximum available anisotropy.
|
|
307
329
|
*/
|
|
308
330
|
getMaxAnisotropy(): number;
|
|
309
331
|
/**
|
|
310
332
|
* Returns the active cube face.
|
|
311
333
|
*
|
|
312
|
-
* @return {
|
|
334
|
+
* @return {number} The active cube face.
|
|
313
335
|
*/
|
|
314
336
|
getActiveCubeFace(): number;
|
|
315
337
|
/**
|
|
316
338
|
* Returns the active mipmap level.
|
|
317
339
|
*
|
|
318
|
-
* @return {
|
|
340
|
+
* @return {number} The active mipmap level.
|
|
319
341
|
*/
|
|
320
342
|
getActiveMipmapLevel(): number;
|
|
321
343
|
/**
|
|
@@ -325,7 +347,7 @@ declare class Renderer {
|
|
|
325
347
|
*
|
|
326
348
|
* @async
|
|
327
349
|
* @param {Function} callback - The application's animation loop.
|
|
328
|
-
* @return {Promise} A Promise that resolves when the set has been
|
|
350
|
+
* @return {Promise} A Promise that resolves when the set has been executed.
|
|
329
351
|
*/
|
|
330
352
|
setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): Promise<void>;
|
|
331
353
|
/**
|
|
@@ -346,7 +368,7 @@ declare class Renderer {
|
|
|
346
368
|
/**
|
|
347
369
|
* Returns the pixel ratio.
|
|
348
370
|
*
|
|
349
|
-
* @return {
|
|
371
|
+
* @return {number} The pixel ratio.
|
|
350
372
|
*/
|
|
351
373
|
getPixelRatio(): number;
|
|
352
374
|
/**
|
|
@@ -364,9 +386,9 @@ declare class Renderer {
|
|
|
364
386
|
*/
|
|
365
387
|
getSize(target: Vector2): Vector2;
|
|
366
388
|
/**
|
|
367
|
-
* Sets the given pixel
|
|
389
|
+
* Sets the given pixel ratio and resizes the canvas if necessary.
|
|
368
390
|
*
|
|
369
|
-
* @param {
|
|
391
|
+
* @param {number} [value=1] - The pixel ratio.
|
|
370
392
|
*/
|
|
371
393
|
setPixelRatio(value?: number): void;
|
|
372
394
|
/**
|
|
@@ -378,17 +400,17 @@ declare class Renderer {
|
|
|
378
400
|
* size.y = height * pixelRatio;
|
|
379
401
|
* ```
|
|
380
402
|
*
|
|
381
|
-
* @param {
|
|
382
|
-
* @param {
|
|
383
|
-
* @param {
|
|
403
|
+
* @param {number} width - The width in logical pixels.
|
|
404
|
+
* @param {number} height - The height in logical pixels.
|
|
405
|
+
* @param {number} pixelRatio - The pixel ratio.
|
|
384
406
|
*/
|
|
385
407
|
setDrawingBufferSize(width: number, height: number, pixelRatio: number): void;
|
|
386
408
|
/**
|
|
387
409
|
* Sets the size of the renderer.
|
|
388
410
|
*
|
|
389
|
-
* @param {
|
|
390
|
-
* @param {
|
|
391
|
-
* @param {
|
|
411
|
+
* @param {number} width - The width in logical pixels.
|
|
412
|
+
* @param {number} height - The height in logical pixels.
|
|
413
|
+
* @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not.
|
|
392
414
|
*/
|
|
393
415
|
setSize(width: number, height: number, updateStyle?: boolean): void;
|
|
394
416
|
/**
|
|
@@ -415,24 +437,24 @@ declare class Renderer {
|
|
|
415
437
|
/**
|
|
416
438
|
* Defines the scissor rectangle.
|
|
417
439
|
*
|
|
418
|
-
* @param {
|
|
440
|
+
* @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit.
|
|
419
441
|
* Instead of passing four arguments, the method also works with a single four-dimensional vector.
|
|
420
|
-
* @param {
|
|
421
|
-
* @param {
|
|
422
|
-
* @param {
|
|
442
|
+
* @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit.
|
|
443
|
+
* @param {number} width - The width of the scissor box in logical pixel unit.
|
|
444
|
+
* @param {number} height - The height of the scissor box in logical pixel unit.
|
|
423
445
|
*/
|
|
424
446
|
setScissor(x: Vector4): void;
|
|
425
447
|
setScissor(x: number, y: number, width: number, height: number): void;
|
|
426
448
|
/**
|
|
427
449
|
* Returns the scissor test value.
|
|
428
450
|
*
|
|
429
|
-
* @return {
|
|
451
|
+
* @return {boolean} Whether the scissor test should be enabled or not.
|
|
430
452
|
*/
|
|
431
453
|
getScissorTest(): boolean;
|
|
432
454
|
/**
|
|
433
455
|
* Defines the scissor test.
|
|
434
456
|
*
|
|
435
|
-
* @param {
|
|
457
|
+
* @param {boolean} boolean - Whether the scissor test should be enabled or not.
|
|
436
458
|
*/
|
|
437
459
|
setScissorTest(boolean: boolean): void;
|
|
438
460
|
/**
|
|
@@ -445,12 +467,12 @@ declare class Renderer {
|
|
|
445
467
|
/**
|
|
446
468
|
* Defines the viewport.
|
|
447
469
|
*
|
|
448
|
-
* @param {
|
|
449
|
-
* @param {
|
|
450
|
-
* @param {
|
|
451
|
-
* @param {
|
|
452
|
-
* @param {
|
|
453
|
-
* @param {
|
|
470
|
+
* @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.
|
|
471
|
+
* @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.
|
|
472
|
+
* @param {number} width - The width of the viewport in logical pixel unit.
|
|
473
|
+
* @param {number} height - The height of the viewport in logical pixel unit.
|
|
474
|
+
* @param {number} minDepth - The minimum depth value of the viewport. WebGPU only.
|
|
475
|
+
* @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only.
|
|
454
476
|
*/
|
|
455
477
|
setViewport(x: Vector4): void;
|
|
456
478
|
setViewport(x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void;
|
|
@@ -465,43 +487,43 @@ declare class Renderer {
|
|
|
465
487
|
* Defines the clear color and optionally the clear alpha.
|
|
466
488
|
*
|
|
467
489
|
* @param {Color} color - The clear color.
|
|
468
|
-
* @param {
|
|
490
|
+
* @param {number} [alpha=1] - The clear alpha.
|
|
469
491
|
*/
|
|
470
492
|
setClearColor(color: ColorRepresentation, alpha?: number): void;
|
|
471
493
|
/**
|
|
472
494
|
* Returns the clear alpha.
|
|
473
495
|
*
|
|
474
|
-
* @return {
|
|
496
|
+
* @return {number} The clear alpha.
|
|
475
497
|
*/
|
|
476
498
|
getClearAlpha(): number;
|
|
477
499
|
/**
|
|
478
500
|
* Defines the clear alpha.
|
|
479
501
|
*
|
|
480
|
-
* @param {
|
|
502
|
+
* @param {number} alpha - The clear alpha.
|
|
481
503
|
*/
|
|
482
504
|
setClearAlpha(alpha: number): void;
|
|
483
505
|
/**
|
|
484
506
|
* Returns the clear depth.
|
|
485
507
|
*
|
|
486
|
-
* @return {
|
|
508
|
+
* @return {number} The clear depth.
|
|
487
509
|
*/
|
|
488
510
|
getClearDepth(): number;
|
|
489
511
|
/**
|
|
490
512
|
* Defines the clear depth.
|
|
491
513
|
*
|
|
492
|
-
* @param {
|
|
514
|
+
* @param {number} depth - The clear depth.
|
|
493
515
|
*/
|
|
494
516
|
setClearDepth(depth: number): void;
|
|
495
517
|
/**
|
|
496
518
|
* Returns the clear stencil.
|
|
497
519
|
*
|
|
498
|
-
* @return {
|
|
520
|
+
* @return {number} The clear stencil.
|
|
499
521
|
*/
|
|
500
522
|
getClearStencil(): number;
|
|
501
523
|
/**
|
|
502
524
|
* Defines the clear stencil.
|
|
503
525
|
*
|
|
504
|
-
* @param {
|
|
526
|
+
* @param {number} stencil - The clear stencil.
|
|
505
527
|
*/
|
|
506
528
|
setClearStencil(stencil: number): void;
|
|
507
529
|
/**
|
|
@@ -510,15 +532,15 @@ declare class Renderer {
|
|
|
510
532
|
* 3D objects in the scene.
|
|
511
533
|
*
|
|
512
534
|
* @param {Object3D} object - The 3D object to test.
|
|
513
|
-
* @return {
|
|
535
|
+
* @return {boolean} Whether the 3D object is fully occluded or not.
|
|
514
536
|
*/
|
|
515
537
|
isOccluded(object: Object3D): boolean | null;
|
|
516
538
|
/**
|
|
517
539
|
* Performs a manual clear operation. This method ignores `autoClear` properties.
|
|
518
540
|
*
|
|
519
|
-
* @param {
|
|
520
|
-
* @param {
|
|
521
|
-
* @param {
|
|
541
|
+
* @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
|
|
542
|
+
* @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
|
|
543
|
+
* @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
|
|
522
544
|
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
523
545
|
* Only returned when the renderer has not been initialized.
|
|
524
546
|
*/
|
|
@@ -545,31 +567,31 @@ declare class Renderer {
|
|
|
545
567
|
*/
|
|
546
568
|
clearStencil(): Promise<void> | undefined;
|
|
547
569
|
/**
|
|
548
|
-
* Async version of {@link
|
|
570
|
+
* Async version of {@link Renderer#clear}.
|
|
549
571
|
*
|
|
550
572
|
* @async
|
|
551
|
-
* @param {
|
|
552
|
-
* @param {
|
|
553
|
-
* @param {
|
|
573
|
+
* @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
|
|
574
|
+
* @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
|
|
575
|
+
* @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
|
|
554
576
|
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
555
577
|
*/
|
|
556
578
|
clearAsync(color?: boolean, depth?: boolean, stencil?: boolean): Promise<void>;
|
|
557
579
|
/**
|
|
558
|
-
* Async version of {@link
|
|
580
|
+
* Async version of {@link Renderer#clearColor}.
|
|
559
581
|
*
|
|
560
582
|
* @async
|
|
561
583
|
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
562
584
|
*/
|
|
563
585
|
clearColorAsync(): Promise<void>;
|
|
564
586
|
/**
|
|
565
|
-
* Async version of {@link
|
|
587
|
+
* Async version of {@link Renderer#clearDepth}.
|
|
566
588
|
*
|
|
567
589
|
* @async
|
|
568
590
|
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
569
591
|
*/
|
|
570
592
|
clearDepthAsync(): Promise<void>;
|
|
571
593
|
/**
|
|
572
|
-
* Async version of {@link
|
|
594
|
+
* Async version of {@link Renderer#clearStencil}.
|
|
573
595
|
*
|
|
574
596
|
* @async
|
|
575
597
|
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
@@ -579,16 +601,22 @@ declare class Renderer {
|
|
|
579
601
|
* The current output tone mapping of the renderer. When a render target is set,
|
|
580
602
|
* the output tone mapping is always `NoToneMapping`.
|
|
581
603
|
*
|
|
582
|
-
* @type {
|
|
604
|
+
* @type {number}
|
|
583
605
|
*/
|
|
584
606
|
get currentToneMapping(): ToneMapping;
|
|
585
607
|
/**
|
|
586
608
|
* The current output color space of the renderer. When a render target is set,
|
|
587
609
|
* the output color space is always `LinearSRGBColorSpace`.
|
|
588
610
|
*
|
|
589
|
-
* @type {
|
|
611
|
+
* @type {string}
|
|
590
612
|
*/
|
|
591
613
|
get currentColorSpace(): string;
|
|
614
|
+
/**
|
|
615
|
+
* Returns `true` if the rendering settings are set to screen output.
|
|
616
|
+
*
|
|
617
|
+
* @returns {boolean} True if the current render target is the same of output render target or `null`, otherwise false.
|
|
618
|
+
*/
|
|
619
|
+
get isOutputTarget(): boolean;
|
|
592
620
|
/**
|
|
593
621
|
* Frees all internal resources of the renderer. Call this method if the renderer
|
|
594
622
|
* is no longer in use by your app.
|
|
@@ -599,19 +627,31 @@ declare class Renderer {
|
|
|
599
627
|
* target the default framebuffer (meaning the canvas) anymore but a custom framebuffer.
|
|
600
628
|
* Use `null` as the first argument to reset the state.
|
|
601
629
|
*
|
|
602
|
-
* @param {RenderTarget
|
|
603
|
-
* @param {
|
|
604
|
-
* @param {
|
|
630
|
+
* @param {?RenderTarget} renderTarget - The render target to set.
|
|
631
|
+
* @param {number} [activeCubeFace=0] - The active cube face.
|
|
632
|
+
* @param {number} [activeMipmapLevel=0] - The active mipmap level.
|
|
605
633
|
*/
|
|
606
634
|
setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void;
|
|
607
635
|
/**
|
|
608
636
|
* Returns the current render target.
|
|
609
637
|
*
|
|
610
|
-
* @return {RenderTarget
|
|
638
|
+
* @return {?RenderTarget} The render target. Returns `null` if no render target is set.
|
|
611
639
|
*/
|
|
612
640
|
getRenderTarget(): RenderTarget<Texture> | null;
|
|
613
641
|
/**
|
|
614
|
-
*
|
|
642
|
+
* Sets the output render target for the renderer.
|
|
643
|
+
*
|
|
644
|
+
* @param {Object} renderTarget - The render target to set as the output target.
|
|
645
|
+
*/
|
|
646
|
+
setOutputRenderTarget(renderTarget: RenderTarget | null): void;
|
|
647
|
+
/**
|
|
648
|
+
* Returns the current output target.
|
|
649
|
+
*
|
|
650
|
+
* @return {?RenderTarget} The current output render target. Returns `null` if no output target is set.
|
|
651
|
+
*/
|
|
652
|
+
getOutputRenderTarget(): RenderTarget<Texture> | null;
|
|
653
|
+
/**
|
|
654
|
+
* Callback for {@link Renderer#setRenderObjectFunction}.
|
|
615
655
|
*
|
|
616
656
|
* @callback renderObjectFunction
|
|
617
657
|
* @param {Object3D} object - The 3D object.
|
|
@@ -619,21 +659,21 @@ declare class Renderer {
|
|
|
619
659
|
* @param {Camera} camera - The camera the object should be rendered with.
|
|
620
660
|
* @param {BufferGeometry} geometry - The object's geometry.
|
|
621
661
|
* @param {Material} material - The object's material.
|
|
622
|
-
* @param {Object
|
|
662
|
+
* @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
623
663
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
624
664
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
625
|
-
* @param {
|
|
665
|
+
* @param {?string} [passId=null] - An optional ID for identifying the pass.
|
|
626
666
|
*/
|
|
627
667
|
/**
|
|
628
668
|
* Sets the given render object function. Calling this method overwrites the default implementation
|
|
629
|
-
* which is {@link
|
|
669
|
+
* which is {@link Renderer#renderObject}. Defining a custom function can be useful
|
|
630
670
|
* if you want to modify the way objects are rendered. For example you can define things like "every
|
|
631
671
|
* object that has material of a certain type should perform a pre-pass with a special overwrite material".
|
|
632
672
|
* The custom function must always call `renderObject()` in its implementation.
|
|
633
673
|
*
|
|
634
674
|
* Use `null` as the first argument to reset the state.
|
|
635
675
|
*
|
|
636
|
-
* @param {
|
|
676
|
+
* @param {?renderObjectFunction} renderObjectFunction - The render object function.
|
|
637
677
|
*/
|
|
638
678
|
setRenderObjectFunction(
|
|
639
679
|
renderObjectFunction:
|
|
@@ -651,7 +691,7 @@ declare class Renderer {
|
|
|
651
691
|
/**
|
|
652
692
|
* Returns the current render object function.
|
|
653
693
|
*
|
|
654
|
-
* @return {Function
|
|
694
|
+
* @return {?Function} The current render object function. Returns `null` if no function is set.
|
|
655
695
|
*/
|
|
656
696
|
getRenderObjectFunction():
|
|
657
697
|
| ((
|
|
@@ -662,6 +702,8 @@ declare class Renderer {
|
|
|
662
702
|
material: Material,
|
|
663
703
|
group: GeometryGroup,
|
|
664
704
|
lightsNode: LightsNode,
|
|
705
|
+
clippingContext: ClippingContext | null,
|
|
706
|
+
passId: string | null,
|
|
665
707
|
) => void)
|
|
666
708
|
| null;
|
|
667
709
|
/**
|
|
@@ -669,7 +711,7 @@ declare class Renderer {
|
|
|
669
711
|
* if the renderer has been initialized.
|
|
670
712
|
*
|
|
671
713
|
* @param {Node|Array<Node>} computeNodes - The compute node(s).
|
|
672
|
-
* @return {Promise
|
|
714
|
+
* @return {?Promise} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized.
|
|
673
715
|
*/
|
|
674
716
|
compute(computeNodes: ComputeNode | ComputeNode[]): Promise<void> | undefined;
|
|
675
717
|
/**
|
|
@@ -677,29 +719,30 @@ declare class Renderer {
|
|
|
677
719
|
*
|
|
678
720
|
* @async
|
|
679
721
|
* @param {Node|Array<Node>} computeNodes - The compute node(s).
|
|
680
|
-
* @return {Promise
|
|
722
|
+
* @return {Promise} A Promise that resolve when the compute has finished.
|
|
681
723
|
*/
|
|
682
724
|
computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
|
|
683
725
|
/**
|
|
684
726
|
* Checks if the given feature is supported by the selected backend.
|
|
685
727
|
*
|
|
686
728
|
* @async
|
|
687
|
-
* @param {
|
|
688
|
-
* @return {Promise<
|
|
729
|
+
* @param {string} name - The feature's name.
|
|
730
|
+
* @return {Promise<boolean>} A Promise that resolves with a bool that indicates whether the feature is supported or not.
|
|
689
731
|
*/
|
|
690
732
|
hasFeatureAsync(name: string): Promise<void>;
|
|
733
|
+
resolveTimestampsAsync(type?: TimestampQuery): Promise<number | undefined>;
|
|
691
734
|
/**
|
|
692
735
|
* Checks if the given feature is supported by the selected backend. If the
|
|
693
736
|
* renderer has not been initialized, this method always returns `false`.
|
|
694
737
|
*
|
|
695
|
-
* @param {
|
|
696
|
-
* @return {
|
|
738
|
+
* @param {string} name - The feature's name.
|
|
739
|
+
* @return {boolean} Whether the feature is supported or not.
|
|
697
740
|
*/
|
|
698
741
|
hasFeature(name: string): false | void;
|
|
699
742
|
/**
|
|
700
743
|
* Returns `true` when the renderer has been initialized.
|
|
701
744
|
*
|
|
702
|
-
* @return {
|
|
745
|
+
* @return {boolean} Whether the renderer has been initialized or not.
|
|
703
746
|
*/
|
|
704
747
|
hasInitialized(): boolean;
|
|
705
748
|
/**
|
|
@@ -734,7 +777,7 @@ declare class Renderer {
|
|
|
734
777
|
* @param {Texture} dstTexture - The destination texture.
|
|
735
778
|
* @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
736
779
|
* @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
737
|
-
* @param {
|
|
780
|
+
* @param {number} level - The mipmap level to copy.
|
|
738
781
|
*/
|
|
739
782
|
copyTextureToTexture(
|
|
740
783
|
srcTexture: Texture,
|
|
@@ -748,12 +791,12 @@ declare class Renderer {
|
|
|
748
791
|
*
|
|
749
792
|
* @async
|
|
750
793
|
* @param {RenderTarget} renderTarget - The render target to read from.
|
|
751
|
-
* @param {
|
|
752
|
-
* @param {
|
|
753
|
-
* @param {
|
|
754
|
-
* @param {
|
|
755
|
-
* @param {
|
|
756
|
-
* @param {
|
|
794
|
+
* @param {number} x - The `x` coordinate of the copy region's origin.
|
|
795
|
+
* @param {number} y - The `y` coordinate of the copy region's origin.
|
|
796
|
+
* @param {number} width - The width of the copy region.
|
|
797
|
+
* @param {number} height - The height of the copy region.
|
|
798
|
+
* @param {number} [textureIndex=0] - The texture index of a MRT render target.
|
|
799
|
+
* @param {number} [faceIndex=0] - The active cube face index.
|
|
757
800
|
* @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.
|
|
758
801
|
*/
|
|
759
802
|
readRenderTargetPixelsAsync(
|
|
@@ -771,7 +814,7 @@ declare class Renderer {
|
|
|
771
814
|
*
|
|
772
815
|
* @param {Object3D} object - The 3D object to process (usually a scene).
|
|
773
816
|
* @param {Camera} camera - The camera the object is rendered with.
|
|
774
|
-
* @param {
|
|
817
|
+
* @param {number} groupOrder - The group order is derived from the `renderOrder` of groups and is used to group 3D objects within groups.
|
|
775
818
|
* @param {RenderList} renderList - The current render list.
|
|
776
819
|
* @param {ClippingContext} clippingContext - The current clipping context.
|
|
777
820
|
*/
|
|
@@ -816,7 +859,7 @@ declare class Renderer {
|
|
|
816
859
|
* @param {Camera} camera - The camera the render list should be rendered with.
|
|
817
860
|
* @param {Scene} scene - The scene the render list belongs to.
|
|
818
861
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
819
|
-
* @param {
|
|
862
|
+
* @param {?string} [passId=null] - An optional ID for identifying the pass.
|
|
820
863
|
*/
|
|
821
864
|
_renderObjects(
|
|
822
865
|
renderList: RenderItem[],
|
|
@@ -834,10 +877,10 @@ declare class Renderer {
|
|
|
834
877
|
* @param {Camera} camera - The camera the object should be rendered with.
|
|
835
878
|
* @param {BufferGeometry} geometry - The object's geometry.
|
|
836
879
|
* @param {Material} material - The object's material.
|
|
837
|
-
* @param {Object
|
|
880
|
+
* @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
838
881
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
839
882
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
840
|
-
* @param {
|
|
883
|
+
* @param {?string} [passId=null] - An optional ID for identifying the pass.
|
|
841
884
|
*/
|
|
842
885
|
renderObject(
|
|
843
886
|
object: Object3D,
|
|
@@ -860,9 +903,9 @@ declare class Renderer {
|
|
|
860
903
|
* @param {Scene} scene - The scene the 3D object belongs to.
|
|
861
904
|
* @param {Camera} camera - The camera the object should be rendered with.
|
|
862
905
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
863
|
-
* @param {
|
|
906
|
+
* @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
864
907
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
865
|
-
* @param {
|
|
908
|
+
* @param {?string} [passId=null] - An optional ID for identifying the pass.
|
|
866
909
|
*/
|
|
867
910
|
_renderObjectDirect(
|
|
868
911
|
object: Object3D,
|
|
@@ -884,9 +927,9 @@ declare class Renderer {
|
|
|
884
927
|
* @param {Scene} scene - The scene the 3D object belongs to.
|
|
885
928
|
* @param {Camera} camera - The camera the object should be rendered with.
|
|
886
929
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
887
|
-
* @param {
|
|
930
|
+
* @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
888
931
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
889
|
-
* @param {
|
|
932
|
+
* @param {?string} [passId=null] - An optional ID for identifying the pass.
|
|
890
933
|
*/
|
|
891
934
|
_createObjectPipeline(
|
|
892
935
|
object: Object3D,
|