@types/three 0.171.0 → 0.173.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- three/README.md +1 -1
- three/examples/jsm/Addons.d.ts +0 -5
- three/examples/jsm/controls/ArcballControls.d.ts +1 -1
- three/examples/jsm/controls/OrbitControls.d.ts +5 -0
- three/examples/jsm/csm/CSMShadowNode.d.ts +2 -3
- three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
- three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
- three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
- three/examples/jsm/lines/LineSegments2.d.ts +3 -1
- three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
- three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
- three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
- three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
- three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
- three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
- three/examples/jsm/webxr/XRButton.d.ts +4 -2
- three/package.json +2 -2
- three/src/Three.Core.d.ts +4 -1
- three/src/Three.TSL.d.ts +18 -5
- three/src/Three.WebGPU.Nodes.d.ts +2 -2
- three/src/Three.WebGPU.d.ts +2 -2
- 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/cameras/CubeCamera.d.ts +19 -2
- three/src/constants.d.ts +6 -0
- three/src/core/BufferAttribute.d.ts +5 -0
- three/src/core/RenderTarget.d.ts +3 -5
- three/src/core/RenderTarget3D.d.ts +9 -0
- three/src/core/RenderTargetArray.d.ts +9 -0
- three/src/materials/Material.d.ts +3 -1
- three/src/materials/MeshDepthMaterial.d.ts +0 -5
- three/src/materials/MeshDistanceMaterial.d.ts +0 -5
- three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
- three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
- three/src/materials/nodes/NodeMaterial.d.ts +3 -0
- three/src/materials/nodes/NodeMaterials.d.ts +0 -4
- three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
- three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +57 -0
- three/src/math/Matrix4.d.ts +2 -1
- three/src/nodes/Nodes.d.ts +6 -7
- three/src/nodes/TSL.d.ts +6 -3
- three/src/nodes/accessors/Arrays.d.ts +10 -2
- three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
- three/src/nodes/accessors/BufferNode.d.ts +4 -4
- three/src/nodes/accessors/Camera.d.ts +1 -0
- three/src/nodes/accessors/MaterialNode.d.ts +6 -6
- three/src/nodes/accessors/ModelNode.d.ts +10 -2
- three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
- three/src/nodes/accessors/StorageBufferNode.d.ts +12 -4
- three/src/nodes/accessors/TextureNode.d.ts +5 -0
- three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
- three/src/nodes/core/ArrayNode.d.ts +26 -0
- three/src/nodes/core/Node.d.ts +245 -0
- three/src/nodes/core/NodeAttribute.d.ts +13 -0
- three/src/nodes/core/NodeBuilder.d.ts +1 -2
- three/src/nodes/core/NodeCache.d.ts +23 -1
- three/src/nodes/core/NodeParser.d.ts +11 -0
- three/src/nodes/core/NodeUniform.d.ts +28 -0
- three/src/nodes/core/NodeVar.d.ts +18 -2
- three/src/nodes/core/NodeVarying.d.ts +14 -0
- 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 +41 -4
- three/src/nodes/core/UniformNode.d.ts +44 -0
- three/src/nodes/core/VarNode.d.ts +8 -1
- three/src/nodes/core/VaryingNode.d.ts +12 -0
- three/src/nodes/core/constants.d.ts +35 -0
- three/src/nodes/display/PassNode.d.ts +1 -1
- three/src/nodes/fog/Fog.d.ts +26 -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/gpgpu/ComputeNode.d.ts +6 -1
- three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
- three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
- three/src/nodes/lighting/ShadowNode.d.ts +2 -1
- three/src/nodes/math/MathNode.d.ts +15 -4
- 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 +62 -17
- three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
- three/src/nodes/utils/LoopNode.d.ts +23 -2
- three/src/nodes/utils/MemberNode.d.ts +11 -0
- three/src/objects/BatchedMesh.d.ts +1 -0
- three/src/objects/ClippingGroup.d.ts +1 -1
- three/src/objects/InstancedMesh.d.ts +4 -3
- three/src/renderers/WebGLRenderer.d.ts +10 -10
- three/src/renderers/common/Animation.d.ts +43 -1
- three/src/renderers/common/Attributes.d.ts +31 -0
- three/src/renderers/common/Backend.d.ts +11 -0
- three/src/renderers/common/Background.d.ts +22 -0
- three/src/renderers/common/BindGroup.d.ts +15 -0
- three/src/renderers/common/Binding.d.ts +24 -0
- three/src/renderers/common/Bindings.d.ts +54 -0
- three/src/renderers/common/Buffer.d.ts +31 -0
- three/src/renderers/common/BufferUtils.d.ts +26 -0
- three/src/renderers/common/BundleGroup.d.ts +22 -0
- three/src/renderers/common/ChainMap.d.ts +33 -3
- three/src/renderers/common/ClippingContext.d.ts +45 -0
- three/src/renderers/common/Color4.d.ts +40 -0
- three/src/renderers/common/ComputePipeline.d.ts +12 -0
- three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
- three/src/renderers/common/DataMap.d.ts +30 -0
- three/src/renderers/common/Geometries.d.ts +52 -0
- three/src/renderers/common/Info.d.ts +21 -5
- three/src/renderers/common/Pipeline.d.ts +11 -0
- three/src/renderers/common/Pipelines.d.ts +104 -0
- three/src/renderers/common/PostProcessing.d.ts +1 -1
- three/src/renderers/common/ProgrammableStage.d.ts +19 -1
- three/src/renderers/common/RenderBundle.d.ts +15 -4
- three/src/renderers/common/RenderBundles.d.ts +20 -2
- three/src/renderers/common/RenderContext.d.ts +27 -3
- three/src/renderers/common/RenderContexts.d.ts +37 -6
- three/src/renderers/common/RenderList.d.ts +85 -0
- three/src/renderers/common/RenderLists.d.ts +21 -0
- three/src/renderers/common/RenderObject.d.ts +163 -4
- three/src/renderers/common/RenderObjects.d.ts +53 -0
- three/src/renderers/common/RenderPipeline.d.ts +13 -0
- three/src/renderers/common/Renderer.d.ts +604 -10
- three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
- three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
- three/src/renderers/common/Textures.d.ts +66 -0
- three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
- three/src/renderers/common/Uniform.d.ts +133 -1
- three/src/renderers/common/UniformBuffer.d.ts +12 -0
- three/src/renderers/common/UniformsGroup.d.ts +103 -0
- three/src/renderers/common/XRManager.d.ts +196 -0
- three/src/renderers/common/XRRenderTarget.d.ts +23 -0
- three/src/renderers/common/nodes/NodeBuilderState.d.ts +32 -2
- three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
- three/src/renderers/common/nodes/NodeUniform.d.ts +185 -0
- three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
- three/src/renderers/common/nodes/Nodes.d.ts +192 -17
- three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
- three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
- three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
- three/src/textures/DataTexture.d.ts +2 -2
- three/src/textures/Texture.d.ts +5 -5
- three/src/textures/VideoFrameTexture.d.ts +27 -0
- three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
- three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
- three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
- three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
- three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
- three/src/Three.Legacy.d.ts +0 -20
- three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
- three/src/nodes/core/UniformGroup.d.ts +0 -7
- three/src/nodes/fog/FogExp2Node.d.ts +0 -14
- three/src/nodes/fog/FogNode.d.ts +0 -20
- three/src/nodes/fog/FogRangeNode.d.ts +0 -19
|
@@ -1,18 +1,18 @@
|
|
|
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";
|
|
6
6
|
import { RenderTarget } from "../../core/RenderTarget.js";
|
|
7
7
|
import { Material } from "../../materials/Material.js";
|
|
8
8
|
import { Box2 } from "../../math/Box2.js";
|
|
9
|
-
import {
|
|
10
|
-
import { Plane } from "../../math/Plane.js";
|
|
9
|
+
import { ColorRepresentation } from "../../math/Color.js";
|
|
11
10
|
import { Vector2 } from "../../math/Vector2.js";
|
|
12
11
|
import { Vector4 } from "../../math/Vector4.js";
|
|
13
12
|
import MRTNode from "../../nodes/core/MRTNode.js";
|
|
14
13
|
import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
|
|
15
14
|
import LightsNode from "../../nodes/lighting/LightsNode.js";
|
|
15
|
+
import { Group } from "../../objects/Group.js";
|
|
16
16
|
import { Scene } from "../../scenes/Scene.js";
|
|
17
17
|
import { FramebufferTexture } from "../../textures/FramebufferTexture.js";
|
|
18
18
|
import { Texture } from "../../textures/Texture.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,7 +59,11 @@ 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
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Base class for renderers.
|
|
66
|
+
*/
|
|
62
67
|
declare class Renderer {
|
|
63
68
|
readonly isRenderer: true;
|
|
64
69
|
domElement: HTMLCanvasElement;
|
|
@@ -76,7 +81,6 @@ declare class Renderer {
|
|
|
76
81
|
sortObjects: boolean;
|
|
77
82
|
depth: boolean;
|
|
78
83
|
stencil: boolean;
|
|
79
|
-
clippingPlanes: readonly Plane[];
|
|
80
84
|
info: Info;
|
|
81
85
|
library: NodeLibrary;
|
|
82
86
|
lighting: Lighting;
|
|
@@ -120,6 +124,8 @@ declare class Renderer {
|
|
|
120
124
|
material: Material,
|
|
121
125
|
group: GeometryGroup,
|
|
122
126
|
lightsNode: LightsNode,
|
|
127
|
+
clippingContext: ClippingContext | null,
|
|
128
|
+
passId: string | null,
|
|
123
129
|
) => void)
|
|
124
130
|
| null;
|
|
125
131
|
_currentRenderObjectFunction:
|
|
@@ -131,6 +137,8 @@ declare class Renderer {
|
|
|
131
137
|
material: Material,
|
|
132
138
|
group: GeometryGroup,
|
|
133
139
|
lightsNode: LightsNode,
|
|
140
|
+
clippingContext: ClippingContext | null,
|
|
141
|
+
passId: string | null,
|
|
134
142
|
) => void)
|
|
135
143
|
| null;
|
|
136
144
|
_currentRenderBundle: RenderBundle | null;
|
|
@@ -141,10 +149,12 @@ declare class Renderer {
|
|
|
141
149
|
camera: Camera,
|
|
142
150
|
lightsNode: LightsNode,
|
|
143
151
|
group: GeometryGroup,
|
|
152
|
+
clippingContext: ClippingContext | null,
|
|
144
153
|
passId?: string,
|
|
145
154
|
) => void;
|
|
146
155
|
_isDeviceLost: boolean;
|
|
147
156
|
onDeviceLost: (info: DeviceLostInfo) => void;
|
|
157
|
+
_colorBufferType: TextureDataType;
|
|
148
158
|
_initialized: boolean;
|
|
149
159
|
_initPromise: Promise<void> | null;
|
|
150
160
|
_compilationPromises: Promise<void>[] | null;
|
|
@@ -154,9 +164,7 @@ declare class Renderer {
|
|
|
154
164
|
enabled: boolean;
|
|
155
165
|
type: ShadowMapType | null;
|
|
156
166
|
};
|
|
157
|
-
xr:
|
|
158
|
-
enabled: boolean;
|
|
159
|
-
};
|
|
167
|
+
xr: XRManager;
|
|
160
168
|
debug: {
|
|
161
169
|
checkShaderErrors: boolean;
|
|
162
170
|
onShaderError:
|
|
@@ -173,63 +181,474 @@ declare class Renderer {
|
|
|
173
181
|
}>;
|
|
174
182
|
};
|
|
175
183
|
localClippingEnabled?: boolean | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Constructs a new renderer.
|
|
186
|
+
*
|
|
187
|
+
* @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2).
|
|
188
|
+
* @param {Object} parameters - The configuration parameter.
|
|
189
|
+
* @param {Boolean} [parameters.logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
|
|
190
|
+
* @param {Boolean} [parameters.alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
|
|
191
|
+
* @param {Boolean} [parameters.depth=true] - Whether the default framebuffer should have a depth buffer or not.
|
|
192
|
+
* @param {Boolean} [parameters.stencil=false] - Whether the default framebuffer should have a stencil buffer or not.
|
|
193
|
+
* @param {Boolean} [parameters.antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
|
|
194
|
+
* @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
|
|
195
|
+
* to overwrite the default.
|
|
196
|
+
* @param {Function?} [parameters.getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
|
|
197
|
+
* @param {Number} [parameters.colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
|
|
198
|
+
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
|
|
199
|
+
*/
|
|
176
200
|
constructor(backend: Backend, parameters?: RendererParameters);
|
|
201
|
+
/**
|
|
202
|
+
* Initializes the renderer so it is ready for usage.
|
|
203
|
+
*
|
|
204
|
+
* @async
|
|
205
|
+
* @return {Promise} A Promise that resolves when the renderer has been initialized.
|
|
206
|
+
*/
|
|
177
207
|
init(): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* The coordinate system of the renderer. The value of this property
|
|
210
|
+
* depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or
|
|
211
|
+
* `THREE.WebGPUCoordinateSystem`.
|
|
212
|
+
*
|
|
213
|
+
* @readonly
|
|
214
|
+
* @type {Number}
|
|
215
|
+
*/
|
|
178
216
|
get coordinateSystem(): import("../../constants.js").CoordinateSystem;
|
|
217
|
+
/**
|
|
218
|
+
* Compiles all materials in the given scene. This can be useful to avoid a
|
|
219
|
+
* phenomenon which is called "shader compilation stutter", which occurs when
|
|
220
|
+
* rendering an object with a new shader for the first time.
|
|
221
|
+
*
|
|
222
|
+
* If you want to add a 3D object to an existing scene, use the third optional
|
|
223
|
+
* parameter for applying the target scene. Note that the (target) scene's lighting
|
|
224
|
+
* and environment must be configured before calling this method.
|
|
225
|
+
*
|
|
226
|
+
* @async
|
|
227
|
+
* @param {Object3D} scene - The scene or 3D object to precompile.
|
|
228
|
+
* @param {Camera} camera - The camera that is used to render the scene.
|
|
229
|
+
* @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.
|
|
230
|
+
* @return {Promise<Array>} A Promise that resolves when the compile has been finished.
|
|
231
|
+
*/
|
|
179
232
|
compileAsync(scene: Object3D, camera: Camera, targetScene?: Object3D | null): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Renders the scene in an async fashion.
|
|
235
|
+
*
|
|
236
|
+
* @async
|
|
237
|
+
* @param {Object3D} scene - The scene or 3D object to render.
|
|
238
|
+
* @param {Camera} camera - The camera.
|
|
239
|
+
* @return {Promise} A Promise that resolves when the render has been finished.
|
|
240
|
+
*/
|
|
180
241
|
renderAsync(scene: Scene, camera: Camera): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Can be used to synchronize CPU operations with GPU tasks. So when this method is called,
|
|
244
|
+
* the CPU waits for the GPU to complete its operation (e.g. a compute task).
|
|
245
|
+
*
|
|
246
|
+
* @async
|
|
247
|
+
* @return {Promise} A Promise that resolves when synchronization has been finished.
|
|
248
|
+
*/
|
|
181
249
|
waitForGPU(): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* Sets the given MRT configuration.
|
|
252
|
+
*
|
|
253
|
+
* @param {MRTNode} mrt - The MRT node to set.
|
|
254
|
+
* @return {Renderer} A reference to this renderer.
|
|
255
|
+
*/
|
|
182
256
|
setMRT(mrt: MRTNode | null): this;
|
|
257
|
+
/**
|
|
258
|
+
* Returns the MRT configuration.
|
|
259
|
+
*
|
|
260
|
+
* @return {MRTNode} The MRT configuration.
|
|
261
|
+
*/
|
|
183
262
|
getMRT(): MRTNode | null;
|
|
263
|
+
/**
|
|
264
|
+
* Returns the color buffer type.
|
|
265
|
+
*
|
|
266
|
+
* @return {Number} The color buffer type.
|
|
267
|
+
*/
|
|
268
|
+
getColorBufferType(): TextureDataType;
|
|
269
|
+
/**
|
|
270
|
+
* Default implementation of the device lost callback.
|
|
271
|
+
*
|
|
272
|
+
* @private
|
|
273
|
+
* @param {Object} info - Information about the context lost.
|
|
274
|
+
*/
|
|
184
275
|
_onDeviceLost(info: DeviceLostInfo): void;
|
|
276
|
+
/**
|
|
277
|
+
* Renders the given render bundle.
|
|
278
|
+
*
|
|
279
|
+
* @private
|
|
280
|
+
* @param {Object} bundle - Render bundle data.
|
|
281
|
+
* @param {Scene} sceneRef - The scene the render bundle belongs to.
|
|
282
|
+
* @param {LightsNode} lightsNode - The current lights node.
|
|
283
|
+
*/
|
|
185
284
|
_renderBundle(bundle: Bundle, sceneRef: Scene, lightsNode: LightsNode): void;
|
|
285
|
+
/**
|
|
286
|
+
* Renders the scene or 3D object with the given camera. This method can only be called
|
|
287
|
+
* if the renderer has been initialized.
|
|
288
|
+
*
|
|
289
|
+
* The target of the method is the default framebuffer (meaning the canvas)
|
|
290
|
+
* or alternatively a render target when specified via `setRenderTarget()`.
|
|
291
|
+
*
|
|
292
|
+
* @param {Object3D} scene - The scene or 3D object to render.
|
|
293
|
+
* @param {Camera} camera - The camera to render the scene with.
|
|
294
|
+
* @return {Promise?} A Promise that resolve when the scene has been rendered.
|
|
295
|
+
* Only returned when the renderer has not been initialized.
|
|
296
|
+
*/
|
|
186
297
|
render(scene: Scene, camera: Camera): Promise<void> | undefined;
|
|
298
|
+
/**
|
|
299
|
+
* Returns an internal render target which is used when computing the output tone mapping
|
|
300
|
+
* and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render
|
|
301
|
+
* pass and not inline to achieve more correct results.
|
|
302
|
+
*
|
|
303
|
+
* @private
|
|
304
|
+
* @return {RenderTarget?} The render target. The method returns `null` if no output conversion should be applied.
|
|
305
|
+
*/
|
|
187
306
|
_getFrameBufferTarget(): RenderTarget<Texture> | null;
|
|
307
|
+
/**
|
|
308
|
+
* Renders the scene or 3D object with the given camera.
|
|
309
|
+
*
|
|
310
|
+
* @private
|
|
311
|
+
* @param {Object3D} scene - The scene or 3D object to render.
|
|
312
|
+
* @param {Camera} camera - The camera to render the scene with.
|
|
313
|
+
* @param {Boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not.
|
|
314
|
+
* @return {RenderContext} The current render context.
|
|
315
|
+
*/
|
|
188
316
|
_renderScene(scene: Scene, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
|
|
317
|
+
/**
|
|
318
|
+
* Returns the maximum available anisotropy for texture filtering.
|
|
319
|
+
*
|
|
320
|
+
* @return {Number} The maximum available anisotropy.
|
|
321
|
+
*/
|
|
189
322
|
getMaxAnisotropy(): number;
|
|
323
|
+
/**
|
|
324
|
+
* Returns the active cube face.
|
|
325
|
+
*
|
|
326
|
+
* @return {Number} The active cube face.
|
|
327
|
+
*/
|
|
190
328
|
getActiveCubeFace(): number;
|
|
329
|
+
/**
|
|
330
|
+
* Returns the active mipmap level.
|
|
331
|
+
*
|
|
332
|
+
* @return {Number} The active mipmap level.
|
|
333
|
+
*/
|
|
191
334
|
getActiveMipmapLevel(): number;
|
|
335
|
+
/**
|
|
336
|
+
* Applications are advised to always define the animation loop
|
|
337
|
+
* with this method and not manually with `requestAnimationFrame()`
|
|
338
|
+
* for best compatibility.
|
|
339
|
+
*
|
|
340
|
+
* @async
|
|
341
|
+
* @param {Function} callback - The application's animation loop.
|
|
342
|
+
* @return {Promise} A Promise that resolves when the set has been executed.
|
|
343
|
+
*/
|
|
192
344
|
setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): Promise<void>;
|
|
345
|
+
/**
|
|
346
|
+
* Can be used to transfer buffer data from a storage buffer attribute
|
|
347
|
+
* from the GPU to the CPU in context of compute shaders.
|
|
348
|
+
*
|
|
349
|
+
* @async
|
|
350
|
+
* @param {StorageBufferAttribute} attribute - The storage buffer attribute.
|
|
351
|
+
* @return {Promise<ArrayBuffer>} A promise that resolves with the buffer data when the data are ready.
|
|
352
|
+
*/
|
|
193
353
|
getArrayBufferAsync(attribute: BufferAttribute): Promise<ArrayBuffer>;
|
|
354
|
+
/**
|
|
355
|
+
* Returns the rendering context.
|
|
356
|
+
*
|
|
357
|
+
* @return {GPUCanvasContext|WebGL2RenderingContext} The rendering context.
|
|
358
|
+
*/
|
|
194
359
|
getContext(): void;
|
|
360
|
+
/**
|
|
361
|
+
* Returns the pixel ratio.
|
|
362
|
+
*
|
|
363
|
+
* @return {Number} The pixel ratio.
|
|
364
|
+
*/
|
|
195
365
|
getPixelRatio(): number;
|
|
366
|
+
/**
|
|
367
|
+
* Returns the drawing buffer size in physical pixels. This method honors the pixel ratio.
|
|
368
|
+
*
|
|
369
|
+
* @param {Vector2} target - The method writes the result in this target object.
|
|
370
|
+
* @return {Vector2} The drawing buffer size.
|
|
371
|
+
*/
|
|
196
372
|
getDrawingBufferSize(target: Vector2): Vector2;
|
|
373
|
+
/**
|
|
374
|
+
* Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.
|
|
375
|
+
*
|
|
376
|
+
* @param {Vector2} target - The method writes the result in this target object.
|
|
377
|
+
* @return {Vector2} The drawing buffer size.
|
|
378
|
+
*/
|
|
197
379
|
getSize(target: Vector2): Vector2;
|
|
380
|
+
/**
|
|
381
|
+
* Sets the given pixel ration and resizes the canvas if necessary.
|
|
382
|
+
*
|
|
383
|
+
* @param {Number} [value=1] - The pixel ratio.
|
|
384
|
+
*/
|
|
198
385
|
setPixelRatio(value?: number): void;
|
|
386
|
+
/**
|
|
387
|
+
* This method allows to define the drawing buffer size by specifying
|
|
388
|
+
* width, height and pixel ratio all at once. The size of the drawing
|
|
389
|
+
* buffer is computed with this formula:
|
|
390
|
+
* ````
|
|
391
|
+
* size.x = width * pixelRatio;
|
|
392
|
+
* size.y = height * pixelRatio;
|
|
393
|
+
* ```
|
|
394
|
+
*
|
|
395
|
+
* @param {Number} width - The width in logical pixels.
|
|
396
|
+
* @param {Number} height - The height in logical pixels.
|
|
397
|
+
* @param {Number} pixelRatio - The pixel ratio.
|
|
398
|
+
*/
|
|
199
399
|
setDrawingBufferSize(width: number, height: number, pixelRatio: number): void;
|
|
400
|
+
/**
|
|
401
|
+
* Sets the size of the renderer.
|
|
402
|
+
*
|
|
403
|
+
* @param {Number} width - The width in logical pixels.
|
|
404
|
+
* @param {Number} height - The height in logical pixels.
|
|
405
|
+
* @param {Boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not.
|
|
406
|
+
*/
|
|
200
407
|
setSize(width: number, height: number, updateStyle?: boolean): void;
|
|
408
|
+
/**
|
|
409
|
+
* Defines a manual sort function for the opaque render list.
|
|
410
|
+
* Pass `null` to use the default sort.
|
|
411
|
+
*
|
|
412
|
+
* @param {Function} method - The sort function.
|
|
413
|
+
*/
|
|
201
414
|
setOpaqueSort(method: ((a: RenderItem, b: RenderItem) => number) | null): void;
|
|
415
|
+
/**
|
|
416
|
+
* Defines a manual sort function for the transparent render list.
|
|
417
|
+
* Pass `null` to use the default sort.
|
|
418
|
+
*
|
|
419
|
+
* @param {Function} method - The sort function.
|
|
420
|
+
*/
|
|
202
421
|
setTransparentSort(method: ((a: RenderItem, b: RenderItem) => number) | null): void;
|
|
422
|
+
/**
|
|
423
|
+
* Returns the scissor rectangle.
|
|
424
|
+
*
|
|
425
|
+
* @param {Vector4} target - The method writes the result in this target object.
|
|
426
|
+
* @return {Vector4} The scissor rectangle.
|
|
427
|
+
*/
|
|
203
428
|
getScissor(target: Vector4): Vector4;
|
|
429
|
+
/**
|
|
430
|
+
* Defines the scissor rectangle.
|
|
431
|
+
*
|
|
432
|
+
* @param {Number | Vector4} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit.
|
|
433
|
+
* Instead of passing four arguments, the method also works with a single four-dimensional vector.
|
|
434
|
+
* @param {Number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit.
|
|
435
|
+
* @param {Number} width - The width of the scissor box in logical pixel unit.
|
|
436
|
+
* @param {Number} height - The height of the scissor box in logical pixel unit.
|
|
437
|
+
*/
|
|
204
438
|
setScissor(x: Vector4): void;
|
|
205
439
|
setScissor(x: number, y: number, width: number, height: number): void;
|
|
440
|
+
/**
|
|
441
|
+
* Returns the scissor test value.
|
|
442
|
+
*
|
|
443
|
+
* @return {Boolean} Whether the scissor test should be enabled or not.
|
|
444
|
+
*/
|
|
206
445
|
getScissorTest(): boolean;
|
|
446
|
+
/**
|
|
447
|
+
* Defines the scissor test.
|
|
448
|
+
*
|
|
449
|
+
* @param {Boolean} boolean - Whether the scissor test should be enabled or not.
|
|
450
|
+
*/
|
|
207
451
|
setScissorTest(boolean: boolean): void;
|
|
452
|
+
/**
|
|
453
|
+
* Returns the viewport definition.
|
|
454
|
+
*
|
|
455
|
+
* @param {Vector4} target - The method writes the result in this target object.
|
|
456
|
+
* @return {Vector4} The viewport definition.
|
|
457
|
+
*/
|
|
208
458
|
getViewport(target: Vector4): Vector4;
|
|
459
|
+
/**
|
|
460
|
+
* Defines the viewport.
|
|
461
|
+
*
|
|
462
|
+
* @param {Number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.
|
|
463
|
+
* @param {Number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.
|
|
464
|
+
* @param {Number} width - The width of the viewport in logical pixel unit.
|
|
465
|
+
* @param {Number} height - The height of the viewport in logical pixel unit.
|
|
466
|
+
* @param {Number} minDepth - The minimum depth value of the viewport. WebGPU only.
|
|
467
|
+
* @param {Number} maxDepth - The maximum depth value of the viewport. WebGPU only.
|
|
468
|
+
*/
|
|
209
469
|
setViewport(x: Vector4): void;
|
|
210
470
|
setViewport(x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void;
|
|
471
|
+
/**
|
|
472
|
+
* Returns the clear color.
|
|
473
|
+
*
|
|
474
|
+
* @param {Color} target - The method writes the result in this target object.
|
|
475
|
+
* @return {Color} The clear color.
|
|
476
|
+
*/
|
|
211
477
|
getClearColor(target: Color4): Color4;
|
|
212
|
-
|
|
478
|
+
/**
|
|
479
|
+
* Defines the clear color and optionally the clear alpha.
|
|
480
|
+
*
|
|
481
|
+
* @param {Color} color - The clear color.
|
|
482
|
+
* @param {Number} [alpha=1] - The clear alpha.
|
|
483
|
+
*/
|
|
484
|
+
setClearColor(color: ColorRepresentation, alpha?: number): void;
|
|
485
|
+
/**
|
|
486
|
+
* Returns the clear alpha.
|
|
487
|
+
*
|
|
488
|
+
* @return {Number} The clear alpha.
|
|
489
|
+
*/
|
|
213
490
|
getClearAlpha(): number;
|
|
491
|
+
/**
|
|
492
|
+
* Defines the clear alpha.
|
|
493
|
+
*
|
|
494
|
+
* @param {Number} alpha - The clear alpha.
|
|
495
|
+
*/
|
|
214
496
|
setClearAlpha(alpha: number): void;
|
|
497
|
+
/**
|
|
498
|
+
* Returns the clear depth.
|
|
499
|
+
*
|
|
500
|
+
* @return {Number} The clear depth.
|
|
501
|
+
*/
|
|
215
502
|
getClearDepth(): number;
|
|
503
|
+
/**
|
|
504
|
+
* Defines the clear depth.
|
|
505
|
+
*
|
|
506
|
+
* @param {Number} depth - The clear depth.
|
|
507
|
+
*/
|
|
216
508
|
setClearDepth(depth: number): void;
|
|
509
|
+
/**
|
|
510
|
+
* Returns the clear stencil.
|
|
511
|
+
*
|
|
512
|
+
* @return {Number} The clear stencil.
|
|
513
|
+
*/
|
|
217
514
|
getClearStencil(): number;
|
|
515
|
+
/**
|
|
516
|
+
* Defines the clear stencil.
|
|
517
|
+
*
|
|
518
|
+
* @param {Number} stencil - The clear stencil.
|
|
519
|
+
*/
|
|
218
520
|
setClearStencil(stencil: number): void;
|
|
521
|
+
/**
|
|
522
|
+
* This method performs an occlusion query for the given 3D object.
|
|
523
|
+
* It returns `true` if the given 3D object is fully occluded by other
|
|
524
|
+
* 3D objects in the scene.
|
|
525
|
+
*
|
|
526
|
+
* @param {Object3D} object - The 3D object to test.
|
|
527
|
+
* @return {Boolean} Whether the 3D object is fully occluded or not.
|
|
528
|
+
*/
|
|
219
529
|
isOccluded(object: Object3D): boolean | null;
|
|
530
|
+
/**
|
|
531
|
+
* Performs a manual clear operation. This method ignores `autoClear` properties.
|
|
532
|
+
*
|
|
533
|
+
* @param {Boolean} [color=true] - Whether the color buffer should be cleared or not.
|
|
534
|
+
* @param {Boolean} [depth=true] - Whether the depth buffer should be cleared or not.
|
|
535
|
+
* @param {Boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
|
|
536
|
+
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
537
|
+
* Only returned when the renderer has not been initialized.
|
|
538
|
+
*/
|
|
220
539
|
clear(color?: boolean, depth?: boolean, stencil?: boolean): Promise<void> | undefined;
|
|
540
|
+
/**
|
|
541
|
+
* Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties.
|
|
542
|
+
*
|
|
543
|
+
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
544
|
+
* Only returned when the renderer has not been initialized.
|
|
545
|
+
*/
|
|
221
546
|
clearColor(): Promise<void> | undefined;
|
|
547
|
+
/**
|
|
548
|
+
* Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties.
|
|
549
|
+
*
|
|
550
|
+
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
551
|
+
* Only returned when the renderer has not been initialized.
|
|
552
|
+
*/
|
|
222
553
|
clearDepth(): Promise<void> | undefined;
|
|
554
|
+
/**
|
|
555
|
+
* Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties.
|
|
556
|
+
*
|
|
557
|
+
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
558
|
+
* Only returned when the renderer has not been initialized.
|
|
559
|
+
*/
|
|
223
560
|
clearStencil(): Promise<void> | undefined;
|
|
561
|
+
/**
|
|
562
|
+
* Async version of {@link module:Renderer~Renderer#clear}.
|
|
563
|
+
*
|
|
564
|
+
* @async
|
|
565
|
+
* @param {Boolean} [color=true] - Whether the color buffer should be cleared or not.
|
|
566
|
+
* @param {Boolean} [depth=true] - Whether the depth buffer should be cleared or not.
|
|
567
|
+
* @param {Boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
|
|
568
|
+
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
569
|
+
*/
|
|
224
570
|
clearAsync(color?: boolean, depth?: boolean, stencil?: boolean): Promise<void>;
|
|
571
|
+
/**
|
|
572
|
+
* Async version of {@link module:Renderer~Renderer#clearColor}.
|
|
573
|
+
*
|
|
574
|
+
* @async
|
|
575
|
+
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
576
|
+
*/
|
|
225
577
|
clearColorAsync(): Promise<void>;
|
|
578
|
+
/**
|
|
579
|
+
* Async version of {@link module:Renderer~Renderer#clearDepth}.
|
|
580
|
+
*
|
|
581
|
+
* @async
|
|
582
|
+
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
583
|
+
*/
|
|
226
584
|
clearDepthAsync(): Promise<void>;
|
|
585
|
+
/**
|
|
586
|
+
* Async version of {@link module:Renderer~Renderer#clearStencil}.
|
|
587
|
+
*
|
|
588
|
+
* @async
|
|
589
|
+
* @return {Promise} A Promise that resolves when the clear operation has been executed.
|
|
590
|
+
*/
|
|
227
591
|
clearStencilAsync(): Promise<void>;
|
|
592
|
+
/**
|
|
593
|
+
* The current output tone mapping of the renderer. When a render target is set,
|
|
594
|
+
* the output tone mapping is always `NoToneMapping`.
|
|
595
|
+
*
|
|
596
|
+
* @type {Number}
|
|
597
|
+
*/
|
|
228
598
|
get currentToneMapping(): ToneMapping;
|
|
599
|
+
/**
|
|
600
|
+
* The current output color space of the renderer. When a render target is set,
|
|
601
|
+
* the output color space is always `LinearSRGBColorSpace`.
|
|
602
|
+
*
|
|
603
|
+
* @type {String}
|
|
604
|
+
*/
|
|
229
605
|
get currentColorSpace(): string;
|
|
606
|
+
/**
|
|
607
|
+
* Frees all internal resources of the renderer. Call this method if the renderer
|
|
608
|
+
* is no longer in use by your app.
|
|
609
|
+
*/
|
|
230
610
|
dispose(): void;
|
|
611
|
+
/**
|
|
612
|
+
* Sets the given render target. Calling this method means the renderer does not
|
|
613
|
+
* target the default framebuffer (meaning the canvas) anymore but a custom framebuffer.
|
|
614
|
+
* Use `null` as the first argument to reset the state.
|
|
615
|
+
*
|
|
616
|
+
* @param {RenderTarget?} renderTarget - The render target to set.
|
|
617
|
+
* @param {Number} [activeCubeFace=0] - The active cube face.
|
|
618
|
+
* @param {Number} [activeMipmapLevel=0] - The active mipmap level.
|
|
619
|
+
*/
|
|
231
620
|
setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void;
|
|
621
|
+
/**
|
|
622
|
+
* Returns the current render target.
|
|
623
|
+
*
|
|
624
|
+
* @return {RenderTarget?} The render target. Returns `null` if no render target is set.
|
|
625
|
+
*/
|
|
232
626
|
getRenderTarget(): RenderTarget<Texture> | null;
|
|
627
|
+
/**
|
|
628
|
+
* Callback for {@link module:Renderer~Renderer#setRenderObjectFunction}.
|
|
629
|
+
*
|
|
630
|
+
* @callback renderObjectFunction
|
|
631
|
+
* @param {Object3D} object - The 3D object.
|
|
632
|
+
* @param {Scene} scene - The scene the 3D object belongs to.
|
|
633
|
+
* @param {Camera} camera - The camera the object should be rendered with.
|
|
634
|
+
* @param {BufferGeometry} geometry - The object's geometry.
|
|
635
|
+
* @param {Material} material - The object's material.
|
|
636
|
+
* @param {Object?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
637
|
+
* @param {LightsNode} lightsNode - The current lights node.
|
|
638
|
+
* @param {ClippingContext} clippingContext - The clipping context.
|
|
639
|
+
* @param {String?} [passId=null] - An optional ID for identifying the pass.
|
|
640
|
+
*/
|
|
641
|
+
/**
|
|
642
|
+
* Sets the given render object function. Calling this method overwrites the default implementation
|
|
643
|
+
* which is {@link module:Renderer~Renderer#renderObject}. Defining a custom function can be useful
|
|
644
|
+
* if you want to modify the way objects are rendered. For example you can define things like "every
|
|
645
|
+
* object that has material of a certain type should perform a pre-pass with a special overwrite material".
|
|
646
|
+
* The custom function must always call `renderObject()` in its implementation.
|
|
647
|
+
*
|
|
648
|
+
* Use `null` as the first argument to reset the state.
|
|
649
|
+
*
|
|
650
|
+
* @param {module:Renderer~renderObjectFunction?} renderObjectFunction - The render object function.
|
|
651
|
+
*/
|
|
233
652
|
setRenderObjectFunction(
|
|
234
653
|
renderObjectFunction:
|
|
235
654
|
| ((
|
|
@@ -243,6 +662,11 @@ declare class Renderer {
|
|
|
243
662
|
) => void)
|
|
244
663
|
| null,
|
|
245
664
|
): void;
|
|
665
|
+
/**
|
|
666
|
+
* Returns the current render object function.
|
|
667
|
+
*
|
|
668
|
+
* @return {Function?} The current render object function. Returns `null` if no function is set.
|
|
669
|
+
*/
|
|
246
670
|
getRenderObjectFunction():
|
|
247
671
|
| ((
|
|
248
672
|
object: Object3D,
|
|
@@ -252,16 +676,83 @@ declare class Renderer {
|
|
|
252
676
|
material: Material,
|
|
253
677
|
group: GeometryGroup,
|
|
254
678
|
lightsNode: LightsNode,
|
|
679
|
+
clippingContext: ClippingContext | null,
|
|
680
|
+
passId: string | null,
|
|
255
681
|
) => void)
|
|
256
682
|
| null;
|
|
683
|
+
/**
|
|
684
|
+
* Execute a single or an array of compute nodes. This method can only be called
|
|
685
|
+
* if the renderer has been initialized.
|
|
686
|
+
*
|
|
687
|
+
* @param {Node|Array<Node>} computeNodes - The compute node(s).
|
|
688
|
+
* @return {Promise?} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized.
|
|
689
|
+
*/
|
|
257
690
|
compute(computeNodes: ComputeNode | ComputeNode[]): Promise<void> | undefined;
|
|
691
|
+
/**
|
|
692
|
+
* Execute a single or an array of compute nodes.
|
|
693
|
+
*
|
|
694
|
+
* @async
|
|
695
|
+
* @param {Node|Array<Node>} computeNodes - The compute node(s).
|
|
696
|
+
* @return {Promise} A Promise that resolve when the compute has finished.
|
|
697
|
+
*/
|
|
258
698
|
computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
|
|
699
|
+
/**
|
|
700
|
+
* Checks if the given feature is supported by the selected backend.
|
|
701
|
+
*
|
|
702
|
+
* @async
|
|
703
|
+
* @param {String} name - The feature's name.
|
|
704
|
+
* @return {Promise<Boolean>} A Promise that resolves with a bool that indicates whether the feature is supported or not.
|
|
705
|
+
*/
|
|
259
706
|
hasFeatureAsync(name: string): Promise<void>;
|
|
707
|
+
resolveTimestampsAsync(type?: TimestampQuery): Promise<number | undefined>;
|
|
708
|
+
/**
|
|
709
|
+
* Checks if the given feature is supported by the selected backend. If the
|
|
710
|
+
* renderer has not been initialized, this method always returns `false`.
|
|
711
|
+
*
|
|
712
|
+
* @param {String} name - The feature's name.
|
|
713
|
+
* @return {Boolean} Whether the feature is supported or not.
|
|
714
|
+
*/
|
|
260
715
|
hasFeature(name: string): false | void;
|
|
716
|
+
/**
|
|
717
|
+
* Returns `true` when the renderer has been initialized.
|
|
718
|
+
*
|
|
719
|
+
* @return {Boolean} Whether the renderer has been initialized or not.
|
|
720
|
+
*/
|
|
261
721
|
hasInitialized(): boolean;
|
|
722
|
+
/**
|
|
723
|
+
* Initializes the given textures. Useful for preloading a texture rather than waiting until first render
|
|
724
|
+
* (which can cause noticeable lags due to decode and GPU upload overhead).
|
|
725
|
+
*
|
|
726
|
+
* @async
|
|
727
|
+
* @param {Texture} texture - The texture.
|
|
728
|
+
* @return {Promise} A Promise that resolves when the texture has been initialized.
|
|
729
|
+
*/
|
|
262
730
|
initTextureAsync(texture: Texture): Promise<void>;
|
|
263
|
-
|
|
731
|
+
/**
|
|
732
|
+
* Initializes the given textures. Useful for preloading a texture rather than waiting until first render
|
|
733
|
+
* (which can cause noticeable lags due to decode and GPU upload overhead).
|
|
734
|
+
*
|
|
735
|
+
* This method can only be used if the renderer has been initialized.
|
|
736
|
+
*
|
|
737
|
+
* @param {Texture} texture - The texture.
|
|
738
|
+
*/
|
|
739
|
+
initTexture(texture: Texture): void;
|
|
740
|
+
/**
|
|
741
|
+
* Copies the current bound framebuffer into the given texture.
|
|
742
|
+
*
|
|
743
|
+
* @param {FramebufferTexture} framebufferTexture - The texture.
|
|
744
|
+
* @param {Vector2|Vector4} rectangle - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied.
|
|
745
|
+
*/
|
|
264
746
|
copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: Rectangle | null): void;
|
|
747
|
+
/**
|
|
748
|
+
* Copies data of source texture into a destination texture.
|
|
749
|
+
*
|
|
750
|
+
* @param {Texture} srcTexture - The source texture.
|
|
751
|
+
* @param {Texture} dstTexture - The destination texture.
|
|
752
|
+
* @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
753
|
+
* @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
754
|
+
* @param {Number} level - The mipmap level to copy.
|
|
755
|
+
*/
|
|
265
756
|
copyTextureToTexture(
|
|
266
757
|
srcTexture: Texture,
|
|
267
758
|
dstTexture: Texture,
|
|
@@ -269,15 +760,38 @@ declare class Renderer {
|
|
|
269
760
|
dstPosition?: Vector2 | null,
|
|
270
761
|
level?: number,
|
|
271
762
|
): void;
|
|
763
|
+
/**
|
|
764
|
+
* Reads pixel data from the given render target.
|
|
765
|
+
*
|
|
766
|
+
* @async
|
|
767
|
+
* @param {RenderTarget} renderTarget - The render target to read from.
|
|
768
|
+
* @param {Number} x - The `x` coordinate of the copy region's origin.
|
|
769
|
+
* @param {Number} y - The `y` coordinate of the copy region's origin.
|
|
770
|
+
* @param {Number} width - The width of the copy region.
|
|
771
|
+
* @param {Number} height - The height of the copy region.
|
|
772
|
+
* @param {Number} [textureIndex=0] - The texture index of a MRT render target.
|
|
773
|
+
* @param {Number} [faceIndex=0] - The active cube face index.
|
|
774
|
+
* @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.
|
|
775
|
+
*/
|
|
272
776
|
readRenderTargetPixelsAsync(
|
|
273
777
|
renderTarget: RenderTarget,
|
|
274
778
|
x: number,
|
|
275
779
|
y: number,
|
|
276
780
|
width: number,
|
|
277
781
|
height: number,
|
|
278
|
-
|
|
782
|
+
textureIndex?: number,
|
|
279
783
|
faceIndex?: number,
|
|
280
784
|
): Promise<import("../../core/BufferAttribute.js").TypedArray>;
|
|
785
|
+
/**
|
|
786
|
+
* Analyzes the given 3D object's hierarchy and builds render lists from the
|
|
787
|
+
* processed hierarchy.
|
|
788
|
+
*
|
|
789
|
+
* @param {Object3D} object - The 3D object to process (usually a scene).
|
|
790
|
+
* @param {Camera} camera - The camera the object is rendered with.
|
|
791
|
+
* @param {Number} groupOrder - The group order is derived from the `renderOrder` of groups and is used to group 3D objects within groups.
|
|
792
|
+
* @param {RenderList} renderList - The current render list.
|
|
793
|
+
* @param {ClippingContext} clippingContext - The current clipping context.
|
|
794
|
+
*/
|
|
281
795
|
_projectObject(
|
|
282
796
|
object: Object3D,
|
|
283
797
|
camera: Camera,
|
|
@@ -285,7 +799,25 @@ declare class Renderer {
|
|
|
285
799
|
renderList: RenderList,
|
|
286
800
|
clippingContext: ClippingContext | null,
|
|
287
801
|
): void;
|
|
802
|
+
/**
|
|
803
|
+
* Renders the given render bundles.
|
|
804
|
+
*
|
|
805
|
+
* @private
|
|
806
|
+
* @param {Array<Object>} bundles - Array with render bundle data.
|
|
807
|
+
* @param {Scene} sceneRef - The scene the render bundles belong to.
|
|
808
|
+
* @param {LightsNode} lightsNode - The current lights node.
|
|
809
|
+
*/
|
|
288
810
|
_renderBundles(bundles: Bundle[], sceneRef: Scene, lightsNode: LightsNode): void;
|
|
811
|
+
/**
|
|
812
|
+
* Renders the transparent objects from the given render lists.
|
|
813
|
+
*
|
|
814
|
+
* @private
|
|
815
|
+
* @param {Array<Object>} renderList - The transparent render list.
|
|
816
|
+
* @param {Array<Object>} doublePassList - The list of transparent objects which require a double pass (e.g. because of transmission).
|
|
817
|
+
* @param {Camera} camera - The camera the render list should be rendered with.
|
|
818
|
+
* @param {Scene} scene - The scene the render list belongs to.
|
|
819
|
+
* @param {LightsNode} lightsNode - The current lights node.
|
|
820
|
+
*/
|
|
289
821
|
_renderTransparents(
|
|
290
822
|
renderList: RenderItem[],
|
|
291
823
|
doublePassList: RenderItem[],
|
|
@@ -293,6 +825,16 @@ declare class Renderer {
|
|
|
293
825
|
scene: Scene,
|
|
294
826
|
lightsNode: LightsNode,
|
|
295
827
|
): void;
|
|
828
|
+
/**
|
|
829
|
+
* Renders the objects from the given render list.
|
|
830
|
+
*
|
|
831
|
+
* @private
|
|
832
|
+
* @param {Array<Object>} renderList - The render list.
|
|
833
|
+
* @param {Camera} camera - The camera the render list should be rendered with.
|
|
834
|
+
* @param {Scene} scene - The scene the render list belongs to.
|
|
835
|
+
* @param {LightsNode} lightsNode - The current lights node.
|
|
836
|
+
* @param {String?} [passId=null] - An optional ID for identifying the pass.
|
|
837
|
+
*/
|
|
296
838
|
_renderObjects(
|
|
297
839
|
renderList: RenderItem[],
|
|
298
840
|
camera: Camera,
|
|
@@ -300,6 +842,20 @@ declare class Renderer {
|
|
|
300
842
|
lightsNode: LightsNode,
|
|
301
843
|
passId?: string | null,
|
|
302
844
|
): void;
|
|
845
|
+
/**
|
|
846
|
+
* This method represents the default render object function that manages the render lifecycle
|
|
847
|
+
* of the object.
|
|
848
|
+
*
|
|
849
|
+
* @param {Object3D} object - The 3D object.
|
|
850
|
+
* @param {Scene} scene - The scene the 3D object belongs to.
|
|
851
|
+
* @param {Camera} camera - The camera the object should be rendered with.
|
|
852
|
+
* @param {BufferGeometry} geometry - The object's geometry.
|
|
853
|
+
* @param {Material} material - The object's material.
|
|
854
|
+
* @param {Object?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
855
|
+
* @param {LightsNode} lightsNode - The current lights node.
|
|
856
|
+
* @param {ClippingContext} clippingContext - The clipping context.
|
|
857
|
+
* @param {String?} [passId=null] - An optional ID for identifying the pass.
|
|
858
|
+
*/
|
|
303
859
|
renderObject(
|
|
304
860
|
object: Object3D,
|
|
305
861
|
scene: Scene,
|
|
@@ -311,6 +867,20 @@ declare class Renderer {
|
|
|
311
867
|
clippingContext?: ClippingContext | null,
|
|
312
868
|
passId?: string | null,
|
|
313
869
|
): void;
|
|
870
|
+
/**
|
|
871
|
+
* This method represents the default `_handleObjectFunction` implementation which creates
|
|
872
|
+
* a render object from the given data and performs the draw command with the selected backend.
|
|
873
|
+
*
|
|
874
|
+
* @private
|
|
875
|
+
* @param {Object3D} object - The 3D object.
|
|
876
|
+
* @param {Material} material - The object's material.
|
|
877
|
+
* @param {Scene} scene - The scene the 3D object belongs to.
|
|
878
|
+
* @param {Camera} camera - The camera the object should be rendered with.
|
|
879
|
+
* @param {LightsNode} lightsNode - The current lights node.
|
|
880
|
+
* @param {{start: Number, count: Number}?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
881
|
+
* @param {ClippingContext} clippingContext - The clipping context.
|
|
882
|
+
* @param {String?} [passId=null] - An optional ID for identifying the pass.
|
|
883
|
+
*/
|
|
314
884
|
_renderObjectDirect(
|
|
315
885
|
object: Object3D,
|
|
316
886
|
material: Material,
|
|
@@ -321,15 +891,39 @@ declare class Renderer {
|
|
|
321
891
|
clippingContext: ClippingContext | null,
|
|
322
892
|
passId?: string,
|
|
323
893
|
): void;
|
|
894
|
+
/**
|
|
895
|
+
* A different implementation for `_handleObjectFunction` which only makes sure the object is ready for rendering.
|
|
896
|
+
* Used in `compileAsync()`.
|
|
897
|
+
*
|
|
898
|
+
* @private
|
|
899
|
+
* @param {Object3D} object - The 3D object.
|
|
900
|
+
* @param {Material} material - The object's material.
|
|
901
|
+
* @param {Scene} scene - The scene the 3D object belongs to.
|
|
902
|
+
* @param {Camera} camera - The camera the object should be rendered with.
|
|
903
|
+
* @param {LightsNode} lightsNode - The current lights node.
|
|
904
|
+
* @param {{start: Number, count: Number}?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
905
|
+
* @param {ClippingContext} clippingContext - The clipping context.
|
|
906
|
+
* @param {String?} [passId=null] - An optional ID for identifying the pass.
|
|
907
|
+
*/
|
|
324
908
|
_createObjectPipeline(
|
|
325
909
|
object: Object3D,
|
|
326
910
|
material: Material,
|
|
327
911
|
scene: Scene,
|
|
328
912
|
camera: Camera,
|
|
329
913
|
lightsNode: LightsNode,
|
|
914
|
+
group: Group,
|
|
330
915
|
clippingContext: ClippingContext | null,
|
|
331
916
|
passId?: string,
|
|
332
917
|
): void;
|
|
918
|
+
/**
|
|
919
|
+
* Alias for `compileAsync()`.
|
|
920
|
+
*
|
|
921
|
+
* @method
|
|
922
|
+
* @param {Object3D} scene - The scene or 3D object to precompile.
|
|
923
|
+
* @param {Camera} camera - The camera that is used to render the scene.
|
|
924
|
+
* @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.
|
|
925
|
+
* @return {Promise} A Promise that resolves when the compile has been finished.
|
|
926
|
+
*/
|
|
333
927
|
get compile(): (scene: Object3D, camera: Camera, targetScene?: Object3D | null) => Promise<void>;
|
|
334
928
|
}
|
|
335
929
|
export default Renderer;
|