@types/three 0.172.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/geometries/TextGeometry.d.ts +0 -8
- three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
- three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -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 +9 -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/materials/nodes/NodeMaterials.d.ts +0 -4
- three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
- three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +1 -0
- three/src/math/Matrix4.d.ts +2 -1
- three/src/nodes/Nodes.d.ts +5 -1
- three/src/nodes/TSL.d.ts +4 -0
- three/src/nodes/accessors/Arrays.d.ts +9 -2
- three/src/nodes/accessors/BufferAttributeNode.d.ts +1 -1
- three/src/nodes/accessors/Camera.d.ts +1 -0
- three/src/nodes/accessors/MaterialNode.d.ts +3 -3
- three/src/nodes/accessors/StorageBufferNode.d.ts +7 -3
- three/src/nodes/core/ArrayNode.d.ts +26 -0
- three/src/nodes/core/Node.d.ts +9 -1
- three/src/nodes/core/NodeCache.d.ts +2 -1
- three/src/nodes/core/NodeVar.d.ts +6 -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/VarNode.d.ts +8 -1
- three/src/nodes/core/VaryingNode.d.ts +9 -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/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 +16 -3
- three/src/nodes/utils/MemberNode.d.ts +11 -0
- three/src/objects/BatchedMesh.d.ts +1 -0
- three/src/objects/InstancedMesh.d.ts +4 -3
- three/src/renderers/WebGLRenderer.d.ts +2 -2
- three/src/renderers/common/Animation.d.ts +13 -1
- three/src/renderers/common/BufferUtils.d.ts +1 -1
- three/src/renderers/common/BundleGroup.d.ts +1 -1
- three/src/renderers/common/ChainMap.d.ts +5 -5
- three/src/renderers/common/Color4.d.ts +7 -3
- three/src/renderers/common/Info.d.ts +0 -11
- three/src/renderers/common/Pipelines.d.ts +2 -2
- three/src/renderers/common/PostProcessing.d.ts +1 -1
- three/src/renderers/common/RenderContext.d.ts +6 -4
- three/src/renderers/common/RenderContexts.d.ts +14 -22
- three/src/renderers/common/RenderList.d.ts +2 -2
- three/src/renderers/common/RenderObject.d.ts +16 -8
- three/src/renderers/common/Renderer.d.ts +26 -9
- three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
- three/src/renderers/common/Uniform.d.ts +27 -1
- 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 +3 -3
- three/src/renderers/common/nodes/NodeLibrary.d.ts +3 -3
- three/src/renderers/common/nodes/NodeUniform.d.ts +31 -0
- three/src/renderers/common/nodes/Nodes.d.ts +8 -7
- 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.
|
|
@@ -122,6 +124,8 @@ declare class Renderer {
|
|
|
122
124
|
material: Material,
|
|
123
125
|
group: GeometryGroup,
|
|
124
126
|
lightsNode: LightsNode,
|
|
127
|
+
clippingContext: ClippingContext | null,
|
|
128
|
+
passId: string | null,
|
|
125
129
|
) => void)
|
|
126
130
|
| null;
|
|
127
131
|
_currentRenderObjectFunction:
|
|
@@ -133,6 +137,8 @@ declare class Renderer {
|
|
|
133
137
|
material: Material,
|
|
134
138
|
group: GeometryGroup,
|
|
135
139
|
lightsNode: LightsNode,
|
|
140
|
+
clippingContext: ClippingContext | null,
|
|
141
|
+
passId: string | null,
|
|
136
142
|
) => void)
|
|
137
143
|
| null;
|
|
138
144
|
_currentRenderBundle: RenderBundle | null;
|
|
@@ -143,10 +149,12 @@ declare class Renderer {
|
|
|
143
149
|
camera: Camera,
|
|
144
150
|
lightsNode: LightsNode,
|
|
145
151
|
group: GeometryGroup,
|
|
152
|
+
clippingContext: ClippingContext | null,
|
|
146
153
|
passId?: string,
|
|
147
154
|
) => void;
|
|
148
155
|
_isDeviceLost: boolean;
|
|
149
156
|
onDeviceLost: (info: DeviceLostInfo) => void;
|
|
157
|
+
_colorBufferType: TextureDataType;
|
|
150
158
|
_initialized: boolean;
|
|
151
159
|
_initPromise: Promise<void> | null;
|
|
152
160
|
_compilationPromises: Promise<void>[] | null;
|
|
@@ -156,9 +164,7 @@ declare class Renderer {
|
|
|
156
164
|
enabled: boolean;
|
|
157
165
|
type: ShadowMapType | null;
|
|
158
166
|
};
|
|
159
|
-
xr:
|
|
160
|
-
enabled: boolean;
|
|
161
|
-
};
|
|
167
|
+
xr: XRManager;
|
|
162
168
|
debug: {
|
|
163
169
|
checkShaderErrors: boolean;
|
|
164
170
|
onShaderError:
|
|
@@ -188,6 +194,8 @@ declare class Renderer {
|
|
|
188
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
|
|
189
195
|
* to overwrite the default.
|
|
190
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.
|
|
191
199
|
*/
|
|
192
200
|
constructor(backend: Backend, parameters?: RendererParameters);
|
|
193
201
|
/**
|
|
@@ -219,7 +227,7 @@ declare class Renderer {
|
|
|
219
227
|
* @param {Object3D} scene - The scene or 3D object to precompile.
|
|
220
228
|
* @param {Camera} camera - The camera that is used to render the scene.
|
|
221
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.
|
|
222
|
-
* @return {Promise} A Promise that resolves when the compile has been finished.
|
|
230
|
+
* @return {Promise<Array>} A Promise that resolves when the compile has been finished.
|
|
223
231
|
*/
|
|
224
232
|
compileAsync(scene: Object3D, camera: Camera, targetScene?: Object3D | null): Promise<void>;
|
|
225
233
|
/**
|
|
@@ -252,6 +260,12 @@ declare class Renderer {
|
|
|
252
260
|
* @return {MRTNode} The MRT configuration.
|
|
253
261
|
*/
|
|
254
262
|
getMRT(): MRTNode | null;
|
|
263
|
+
/**
|
|
264
|
+
* Returns the color buffer type.
|
|
265
|
+
*
|
|
266
|
+
* @return {Number} The color buffer type.
|
|
267
|
+
*/
|
|
268
|
+
getColorBufferType(): TextureDataType;
|
|
255
269
|
/**
|
|
256
270
|
* Default implementation of the device lost callback.
|
|
257
271
|
*
|
|
@@ -325,7 +339,7 @@ declare class Renderer {
|
|
|
325
339
|
*
|
|
326
340
|
* @async
|
|
327
341
|
* @param {Function} callback - The application's animation loop.
|
|
328
|
-
* @return {Promise} A Promise that resolves when the set has been
|
|
342
|
+
* @return {Promise} A Promise that resolves when the set has been executed.
|
|
329
343
|
*/
|
|
330
344
|
setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): Promise<void>;
|
|
331
345
|
/**
|
|
@@ -662,6 +676,8 @@ declare class Renderer {
|
|
|
662
676
|
material: Material,
|
|
663
677
|
group: GeometryGroup,
|
|
664
678
|
lightsNode: LightsNode,
|
|
679
|
+
clippingContext: ClippingContext | null,
|
|
680
|
+
passId: string | null,
|
|
665
681
|
) => void)
|
|
666
682
|
| null;
|
|
667
683
|
/**
|
|
@@ -677,7 +693,7 @@ declare class Renderer {
|
|
|
677
693
|
*
|
|
678
694
|
* @async
|
|
679
695
|
* @param {Node|Array<Node>} computeNodes - The compute node(s).
|
|
680
|
-
* @return {Promise
|
|
696
|
+
* @return {Promise} A Promise that resolve when the compute has finished.
|
|
681
697
|
*/
|
|
682
698
|
computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
|
|
683
699
|
/**
|
|
@@ -688,6 +704,7 @@ declare class Renderer {
|
|
|
688
704
|
* @return {Promise<Boolean>} A Promise that resolves with a bool that indicates whether the feature is supported or not.
|
|
689
705
|
*/
|
|
690
706
|
hasFeatureAsync(name: string): Promise<void>;
|
|
707
|
+
resolveTimestampsAsync(type?: TimestampQuery): Promise<number | undefined>;
|
|
691
708
|
/**
|
|
692
709
|
* Checks if the given feature is supported by the selected backend. If the
|
|
693
710
|
* renderer has not been initialized, this method always returns `false`.
|
|
@@ -860,7 +877,7 @@ declare class Renderer {
|
|
|
860
877
|
* @param {Scene} scene - The scene the 3D object belongs to.
|
|
861
878
|
* @param {Camera} camera - The camera the object should be rendered with.
|
|
862
879
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
863
|
-
* @param {
|
|
880
|
+
* @param {{start: Number, count: Number}?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
864
881
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
865
882
|
* @param {String?} [passId=null] - An optional ID for identifying the pass.
|
|
866
883
|
*/
|
|
@@ -884,7 +901,7 @@ declare class Renderer {
|
|
|
884
901
|
* @param {Scene} scene - The scene the 3D object belongs to.
|
|
885
902
|
* @param {Camera} camera - The camera the object should be rendered with.
|
|
886
903
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
887
|
-
* @param {
|
|
904
|
+
* @param {{start: Number, count: Number}?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
888
905
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
889
906
|
* @param {String?} [passId=null] - An optional ID for identifying the pass.
|
|
890
907
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import RenderContext from "./RenderContext.js";
|
|
2
|
+
declare abstract class TimestampQueryPool {
|
|
3
|
+
trackTimestamp: boolean;
|
|
4
|
+
maxQueries: number;
|
|
5
|
+
currentQueryIndex: number;
|
|
6
|
+
queryOffsets: Map<number, number>;
|
|
7
|
+
isDisposed: boolean;
|
|
8
|
+
lastValue: number;
|
|
9
|
+
pendingResolve: boolean;
|
|
10
|
+
constructor(maxQueries?: number);
|
|
11
|
+
/**
|
|
12
|
+
* Allocate queries for a specific renderContext.
|
|
13
|
+
*
|
|
14
|
+
* @abstract
|
|
15
|
+
*/
|
|
16
|
+
abstract allocateQueriesForContext(renderContext: RenderContext): number | null;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve all timestamps and return data (or process them).
|
|
19
|
+
*
|
|
20
|
+
* @abstract
|
|
21
|
+
* @returns {Promise<Number>|Number} The resolved timestamp value.
|
|
22
|
+
*/
|
|
23
|
+
abstract resolveQueriesAsync(): Promise<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Dispose of the query pool.
|
|
26
|
+
*
|
|
27
|
+
* @abstract
|
|
28
|
+
*/
|
|
29
|
+
abstract dispose(): void;
|
|
30
|
+
}
|
|
31
|
+
export default TimestampQueryPool;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Color } from "../../math/Color.js";
|
|
2
|
+
import { Matrix2 } from "../../math/Matrix2.js";
|
|
2
3
|
import { Matrix3 } from "../../math/Matrix3.js";
|
|
3
4
|
import { Matrix4 } from "../../math/Matrix4.js";
|
|
4
5
|
import { Vector2 } from "../../math/Vector2.js";
|
|
@@ -116,6 +117,22 @@ declare class ColorUniform extends Uniform<Color> {
|
|
|
116
117
|
*/
|
|
117
118
|
constructor(name: string, value?: Color);
|
|
118
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Represents a Matrix2 uniform.
|
|
122
|
+
*
|
|
123
|
+
* @private
|
|
124
|
+
* @augments Uniform
|
|
125
|
+
*/
|
|
126
|
+
declare class Matrix2Uniform extends Uniform<Matrix2> {
|
|
127
|
+
readonly isMatrix2Uniform: true;
|
|
128
|
+
/**
|
|
129
|
+
* Constructs a new Number uniform.
|
|
130
|
+
*
|
|
131
|
+
* @param {String} name - The uniform's name.
|
|
132
|
+
* @param {Matrix2} value - The uniform's value.
|
|
133
|
+
*/
|
|
134
|
+
constructor(name: string, value?: Matrix2);
|
|
135
|
+
}
|
|
119
136
|
/**
|
|
120
137
|
* Represents a Matrix3 uniform.
|
|
121
138
|
*
|
|
@@ -148,4 +165,13 @@ declare class Matrix4Uniform extends Uniform<Matrix4> {
|
|
|
148
165
|
*/
|
|
149
166
|
constructor(name: string, value?: Matrix4);
|
|
150
167
|
}
|
|
151
|
-
export {
|
|
168
|
+
export {
|
|
169
|
+
ColorUniform,
|
|
170
|
+
Matrix2Uniform,
|
|
171
|
+
Matrix3Uniform,
|
|
172
|
+
Matrix4Uniform,
|
|
173
|
+
NumberUniform,
|
|
174
|
+
Vector2Uniform,
|
|
175
|
+
Vector3Uniform,
|
|
176
|
+
Vector4Uniform,
|
|
177
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { ArrayCamera } from "../../cameras/ArrayCamera.js";
|
|
2
|
+
import { PerspectiveCamera } from "../../cameras/PerspectiveCamera.js";
|
|
3
|
+
import { EventDispatcher } from "../../core/EventDispatcher.js";
|
|
4
|
+
import { RenderTarget } from "../../core/RenderTarget.js";
|
|
5
|
+
import { Vector2 } from "../../math/Vector2.js";
|
|
6
|
+
import { WebXRController } from "../webxr/WebXRController.js";
|
|
7
|
+
import { AnimationContext } from "./Animation.js";
|
|
8
|
+
import Renderer from "./Renderer.js";
|
|
9
|
+
import { XRRenderTarget } from "./XRRenderTarget.js";
|
|
10
|
+
export interface XRManagerEventMap {
|
|
11
|
+
sessionstart: {};
|
|
12
|
+
sessionend: {};
|
|
13
|
+
planesdetected: {
|
|
14
|
+
data: XRFrame;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The XR manager is built on top of the WebXR Device API to
|
|
19
|
+
* manage XR sessions with `WebGPURenderer`.
|
|
20
|
+
*
|
|
21
|
+
* XR is currently only supported with a WebGL 2 backend.
|
|
22
|
+
*
|
|
23
|
+
* @augments EventDispatcher
|
|
24
|
+
*/
|
|
25
|
+
declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
isPresenting: boolean;
|
|
28
|
+
cameraAutoUpdate: boolean;
|
|
29
|
+
_renderer: Renderer;
|
|
30
|
+
_cameraL: PerspectiveCamera;
|
|
31
|
+
_cameraR: PerspectiveCamera;
|
|
32
|
+
_cameras: PerspectiveCamera[];
|
|
33
|
+
_cameraXR: ArrayCamera;
|
|
34
|
+
_currentDepthNear: number | null;
|
|
35
|
+
_currentDepthFar: number | null;
|
|
36
|
+
_controllers: WebXRController[];
|
|
37
|
+
_controllerInputSources: (XRInputSource | null)[];
|
|
38
|
+
_currentRenderTarget: RenderTarget | null;
|
|
39
|
+
_xrRenderTarget: XRRenderTarget | null;
|
|
40
|
+
_currentAnimationContext: AnimationContext | null;
|
|
41
|
+
_currentAnimationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
|
|
42
|
+
_currentPixelRatio: number | null;
|
|
43
|
+
_currentSize: Vector2;
|
|
44
|
+
_onSessionEvent: (event: XRInputSourceEvent) => void;
|
|
45
|
+
_onSessionEnd: () => void;
|
|
46
|
+
_onInputSourcesChange: (event: XRInputSourcesChangeEvent) => void;
|
|
47
|
+
_onAnimationFrame: (time: DOMHighResTimeStamp, frame?: XRFrame) => void;
|
|
48
|
+
_referenceSpace: XRReferenceSpace | null;
|
|
49
|
+
_referenceSpaceType: XRReferenceSpaceType;
|
|
50
|
+
_customReferenceSpace: XRReferenceSpace | null;
|
|
51
|
+
_framebufferScaleFactor: number;
|
|
52
|
+
_foveation: number;
|
|
53
|
+
_session: XRSession | null;
|
|
54
|
+
_glBaseLayer: XRWebGLLayer | null;
|
|
55
|
+
_glBinding: XRWebGLBinding | null;
|
|
56
|
+
_glProjLayer: XRProjectionLayer | null;
|
|
57
|
+
_xrFrame: XRFrame | null;
|
|
58
|
+
_useLayers: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Constructs a new XR manager.
|
|
61
|
+
*
|
|
62
|
+
* @param {Renderer} renderer - The renderer.
|
|
63
|
+
*/
|
|
64
|
+
constructor(renderer: Renderer);
|
|
65
|
+
/**
|
|
66
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
67
|
+
* of a XR controller in target ray space. The requested controller is defined
|
|
68
|
+
* by the given index.
|
|
69
|
+
*
|
|
70
|
+
* @param {Number} index - The index of the XR controller.
|
|
71
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
72
|
+
*/
|
|
73
|
+
getController(index: number): import("../webxr/WebXRController.js").XRTargetRaySpace;
|
|
74
|
+
/**
|
|
75
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
76
|
+
* of a XR controller in grip space. The requested controller is defined
|
|
77
|
+
* by the given index.
|
|
78
|
+
*
|
|
79
|
+
* @param {Number} index - The index of the XR controller.
|
|
80
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
81
|
+
*/
|
|
82
|
+
getControllerGrip(index: number): import("../webxr/WebXRController.js").XRGripSpace;
|
|
83
|
+
/**
|
|
84
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
85
|
+
* of a XR controller in hand space. The requested controller is defined
|
|
86
|
+
* by the given index.
|
|
87
|
+
*
|
|
88
|
+
* @param {Number} index - The index of the XR controller.
|
|
89
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
90
|
+
*/
|
|
91
|
+
getHand(index: number): import("../webxr/WebXRController.js").XRHandSpace;
|
|
92
|
+
/**
|
|
93
|
+
* Returns the foveation value.
|
|
94
|
+
*
|
|
95
|
+
* @return {Number|undefined} The foveation value. Returns `undefined` if no base or projection layer is defined.
|
|
96
|
+
*/
|
|
97
|
+
getFoveation(): number | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Sets the foveation value.
|
|
100
|
+
*
|
|
101
|
+
* @param {Number} foveation - A number in the range `[0,1]` where `0` means no foveation (full resolution)
|
|
102
|
+
* and `1` means maximum foveation (the edges render at lower resolution).
|
|
103
|
+
*/
|
|
104
|
+
setFoveation(foveation: number): void;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the framebuffer scale factor.
|
|
107
|
+
*
|
|
108
|
+
* @return {Number} The framebuffer scale factor.
|
|
109
|
+
*/
|
|
110
|
+
getFramebufferScaleFactor(): number;
|
|
111
|
+
/**
|
|
112
|
+
* Sets the framebuffer scale factor.
|
|
113
|
+
*
|
|
114
|
+
* This method can not be used during a XR session.
|
|
115
|
+
*
|
|
116
|
+
* @param {Number} factor - The framebuffer scale factor.
|
|
117
|
+
*/
|
|
118
|
+
setFramebufferScaleFactor(factor: number): void;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the reference space type.
|
|
121
|
+
*
|
|
122
|
+
* @return {String} The reference space type.
|
|
123
|
+
*/
|
|
124
|
+
getReferenceSpaceType(): XRReferenceSpaceType;
|
|
125
|
+
/**
|
|
126
|
+
* Sets the reference space type.
|
|
127
|
+
*
|
|
128
|
+
* This method can not be used during a XR session.
|
|
129
|
+
*
|
|
130
|
+
* @param {String} type - The reference space type.
|
|
131
|
+
*/
|
|
132
|
+
setReferenceSpaceType(type: XRReferenceSpaceType): void;
|
|
133
|
+
/**
|
|
134
|
+
* Returns the XR reference space.
|
|
135
|
+
*
|
|
136
|
+
* @return {XRReferenceSpace} The XR reference space.
|
|
137
|
+
*/
|
|
138
|
+
getReferenceSpace(): XRReferenceSpace | null;
|
|
139
|
+
/**
|
|
140
|
+
* Sets a custom XR reference space.
|
|
141
|
+
*
|
|
142
|
+
* @param {XRReferenceSpace} space - The XR reference space.
|
|
143
|
+
*/
|
|
144
|
+
setReferenceSpace(space: XRReferenceSpace): void;
|
|
145
|
+
/**
|
|
146
|
+
* Returns the XR camera.
|
|
147
|
+
*
|
|
148
|
+
* @return {ArrayCamera} The XR camera.
|
|
149
|
+
*/
|
|
150
|
+
getCamera(): ArrayCamera;
|
|
151
|
+
/**
|
|
152
|
+
* Returns the environment blend mode from the current XR session.
|
|
153
|
+
*
|
|
154
|
+
* @return {('opaque'|'additive'|'alpha-blend')?} The environment blend mode. Returns `null` when used outside of a XR session.
|
|
155
|
+
*/
|
|
156
|
+
getEnvironmentBlendMode(): XREnvironmentBlendMode | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Returns the current XR frame.
|
|
159
|
+
*
|
|
160
|
+
* @return {XRFrame?} The XR frame. Returns `null` when used outside a XR session.
|
|
161
|
+
*/
|
|
162
|
+
getFrame(): XRFrame | null;
|
|
163
|
+
/**
|
|
164
|
+
* Returns the current XR session.
|
|
165
|
+
*
|
|
166
|
+
* @return {XRSession?} The XR session. Returns `null` when used outside a XR session.
|
|
167
|
+
*/
|
|
168
|
+
getSession(): XRSession | null;
|
|
169
|
+
/**
|
|
170
|
+
* After a XR session has been requested usually with one of the `*Button` modules, it
|
|
171
|
+
* is injected into the renderer with this method. This method triggers the start of
|
|
172
|
+
* the actual XR rendering.
|
|
173
|
+
*
|
|
174
|
+
* @async
|
|
175
|
+
* @param {XRSession} session - The XR session to set.
|
|
176
|
+
* @return {Promise} A Promise that resolves when the session has been set.
|
|
177
|
+
*/
|
|
178
|
+
setSession(session: XRSession): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* This method is called by the renderer per frame and updates the XR camera
|
|
181
|
+
* and it sub cameras based on the given camera. The given camera is the "user"
|
|
182
|
+
* camera created on application level and used for non-XR rendering.
|
|
183
|
+
*
|
|
184
|
+
* @param {PerspectiveCamera} camera - The camera.
|
|
185
|
+
*/
|
|
186
|
+
updateCamera(camera: PerspectiveCamera): void;
|
|
187
|
+
/**
|
|
188
|
+
* Returns a WebXR controller for the given controller index.
|
|
189
|
+
*
|
|
190
|
+
* @private
|
|
191
|
+
* @param {Number} index - The controller index.
|
|
192
|
+
* @return {WebXRController} The XR controller.
|
|
193
|
+
*/
|
|
194
|
+
_getController(index: number): WebXRController;
|
|
195
|
+
}
|
|
196
|
+
export default XRManager;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RenderTarget } from "../../core/RenderTarget.js";
|
|
2
|
+
/**
|
|
3
|
+
* A special type of render target that is used when rendering
|
|
4
|
+
* with the WebXR Device API.
|
|
5
|
+
*
|
|
6
|
+
* @private
|
|
7
|
+
* @augments RenderTarget
|
|
8
|
+
*/
|
|
9
|
+
declare class XRRenderTarget extends RenderTarget {
|
|
10
|
+
readonly isXRRenderTarget: true;
|
|
11
|
+
hasExternalTextures: boolean;
|
|
12
|
+
autoAllocateDepthBuffer: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new XR render target.
|
|
15
|
+
*
|
|
16
|
+
* @param {Number} [width=1] - The width of the render target.
|
|
17
|
+
* @param {Number} [height=1] - The height of the render target.
|
|
18
|
+
* @param {Object} [options={}] - The configuration options.
|
|
19
|
+
*/
|
|
20
|
+
constructor(width?: number, height?: number, options?: {});
|
|
21
|
+
copy(source: XRRenderTarget): this;
|
|
22
|
+
}
|
|
23
|
+
export { XRRenderTarget };
|
|
@@ -21,7 +21,7 @@ declare class NodeBuilderState {
|
|
|
21
21
|
updateNodes: Node[];
|
|
22
22
|
updateBeforeNodes: Node[];
|
|
23
23
|
updateAfterNodes: Node[];
|
|
24
|
-
|
|
24
|
+
observer: NodeMaterialObserver;
|
|
25
25
|
usedTimes: number;
|
|
26
26
|
/**
|
|
27
27
|
* Constructs a new node builder state.
|
|
@@ -34,7 +34,7 @@ declare class NodeBuilderState {
|
|
|
34
34
|
* @param {Array<Node>} updateNodes - An array of nodes that implement their `update()` method.
|
|
35
35
|
* @param {Array<Node>} updateBeforeNodes - An array of nodes that implement their `updateBefore()` method.
|
|
36
36
|
* @param {Array<Node>} updateAfterNodes - An array of nodes that implement their `updateAfter()` method.
|
|
37
|
-
* @param {NodeMaterialObserver}
|
|
37
|
+
* @param {NodeMaterialObserver} observer - A node material observer.
|
|
38
38
|
* @param {Array<Object>} transforms - An array with transform attribute objects. Only relevant when using compute shaders with WebGL 2.
|
|
39
39
|
*/
|
|
40
40
|
constructor(
|
|
@@ -46,7 +46,7 @@ declare class NodeBuilderState {
|
|
|
46
46
|
updateNodes: Node[],
|
|
47
47
|
updateBeforeNodes: Node[],
|
|
48
48
|
updateAfterNodes: Node[],
|
|
49
|
-
|
|
49
|
+
observer: NodeMaterialObserver,
|
|
50
50
|
transforms?: never[],
|
|
51
51
|
);
|
|
52
52
|
/**
|
|
@@ -63,7 +63,7 @@ declare class NodeLibrary {
|
|
|
63
63
|
/**
|
|
64
64
|
* Returns a node material class definition for a material type.
|
|
65
65
|
*
|
|
66
|
-
* @param {
|
|
66
|
+
* @param {String} materialType - The material type.
|
|
67
67
|
* @return {NodeMaterial.constructor?} The node material class definition. Returns `null` if no node material is found.
|
|
68
68
|
*/
|
|
69
69
|
getMaterialNodeClass(materialType: string): (new() => NodeMaterial) | null;
|
|
@@ -71,7 +71,7 @@ declare class NodeLibrary {
|
|
|
71
71
|
* Adds a node material class definition for a given material type.
|
|
72
72
|
*
|
|
73
73
|
* @param {NodeMaterial.constructor} materialNodeClass - The node material class definition.
|
|
74
|
-
* @param {
|
|
74
|
+
* @param {String} materialClassType - The material type.
|
|
75
75
|
*/
|
|
76
76
|
addMaterial(materialNodeClass: {
|
|
77
77
|
new(): NodeMaterial;
|
|
@@ -98,7 +98,7 @@ declare class NodeLibrary {
|
|
|
98
98
|
* Adds a node class definition for the given type to the provided type library.
|
|
99
99
|
*
|
|
100
100
|
* @param {Any} nodeClass - The node class definition.
|
|
101
|
-
* @param {String} type - The object type.
|
|
101
|
+
* @param {Number|String} type - The object type.
|
|
102
102
|
* @param {Map} library - The type library.
|
|
103
103
|
*/
|
|
104
104
|
addType<TNodeClass, TType>(nodeClass: TNodeClass, type: TType, library: Map<TType, TNodeClass>): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Color } from "../../../math/Color.js";
|
|
2
|
+
import { Matrix2 } from "../../../math/Matrix2.js";
|
|
2
3
|
import { Matrix3 } from "../../../math/Matrix3.js";
|
|
3
4
|
import { Matrix4 } from "../../../math/Matrix4.js";
|
|
4
5
|
import { Vector2 } from "../../../math/Vector2.js";
|
|
@@ -7,6 +8,7 @@ import { Vector4 } from "../../../math/Vector4.js";
|
|
|
7
8
|
import NodeUniform from "../../../nodes/core/NodeUniform.js";
|
|
8
9
|
import {
|
|
9
10
|
ColorUniform,
|
|
11
|
+
Matrix2Uniform,
|
|
10
12
|
Matrix3Uniform,
|
|
11
13
|
Matrix4Uniform,
|
|
12
14
|
NumberUniform,
|
|
@@ -154,6 +156,34 @@ declare class ColorNodeUniform extends ColorUniform {
|
|
|
154
156
|
*/
|
|
155
157
|
getType(): string | null;
|
|
156
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* A special form of Matrix2 uniform binding type.
|
|
161
|
+
* It's value is managed by a node object.
|
|
162
|
+
*
|
|
163
|
+
* @private
|
|
164
|
+
* @augments Matrix2Uniform
|
|
165
|
+
*/
|
|
166
|
+
declare class Matrix2NodeUniform extends Matrix2Uniform {
|
|
167
|
+
nodeUniform: NodeUniform<Matrix2>;
|
|
168
|
+
/**
|
|
169
|
+
* Constructs a new node-based Matrix2 uniform.
|
|
170
|
+
*
|
|
171
|
+
* @param {NodeUniform} nodeUniform - The node uniform.
|
|
172
|
+
*/
|
|
173
|
+
constructor(nodeUniform: NodeUniform<Matrix2>);
|
|
174
|
+
/**
|
|
175
|
+
* Overwritten to return the value of the node uniform.
|
|
176
|
+
*
|
|
177
|
+
* @return {Matrix2} The value.
|
|
178
|
+
*/
|
|
179
|
+
getValue(): Matrix2;
|
|
180
|
+
/**
|
|
181
|
+
* Returns the node uniform data type.
|
|
182
|
+
*
|
|
183
|
+
* @return {String} The data type.
|
|
184
|
+
*/
|
|
185
|
+
getType(): string | null;
|
|
186
|
+
}
|
|
157
187
|
/**
|
|
158
188
|
* A special form of Matrix3 uniform binding type.
|
|
159
189
|
* It's value is managed by a node object.
|
|
@@ -212,6 +242,7 @@ declare class Matrix4NodeUniform extends Matrix4Uniform {
|
|
|
212
242
|
}
|
|
213
243
|
export {
|
|
214
244
|
ColorNodeUniform,
|
|
245
|
+
Matrix2NodeUniform,
|
|
215
246
|
Matrix3NodeUniform,
|
|
216
247
|
Matrix4NodeUniform,
|
|
217
248
|
NumberNodeUniform,
|
|
@@ -39,6 +39,10 @@ interface SceneData {
|
|
|
39
39
|
environment?: Texture | undefined;
|
|
40
40
|
environmentNode?: ShaderNodeObject<Node> | undefined;
|
|
41
41
|
}
|
|
42
|
+
interface CacheKeyData {
|
|
43
|
+
callId: number;
|
|
44
|
+
cacheKey: number;
|
|
45
|
+
}
|
|
42
46
|
declare module "../../../scenes/Scene.js" {
|
|
43
47
|
interface Scene {
|
|
44
48
|
environmentNode?: ShaderNodeObject<Node> | null | undefined;
|
|
@@ -81,10 +85,7 @@ declare class Nodes extends DataMap<{
|
|
|
81
85
|
backend: Backend;
|
|
82
86
|
nodeFrame: NodeFrame;
|
|
83
87
|
nodeBuilderCache: Map<string, NodeBuilderState>;
|
|
84
|
-
callHashCache: ChainMap<readonly [Scene, LightsNode],
|
|
85
|
-
callId: number;
|
|
86
|
-
cacheKey: string;
|
|
87
|
-
}>;
|
|
88
|
+
callHashCache: ChainMap<readonly [Scene, LightsNode], CacheKeyData>;
|
|
88
89
|
groupsData: ChainMap<readonly [UniformGroupNode, NodeUniformsGroup], {
|
|
89
90
|
version?: number;
|
|
90
91
|
}>;
|
|
@@ -121,7 +122,7 @@ declare class Nodes extends DataMap<{
|
|
|
121
122
|
*/
|
|
122
123
|
delete(
|
|
123
124
|
object: NodeUniformsGroup | RenderObject | ComputeNode | Scene,
|
|
124
|
-
):
|
|
125
|
+
): RenderObjectData | NodeUniformsGroupData | ComputeNodeData | SceneData;
|
|
125
126
|
/**
|
|
126
127
|
* Returns a node builder state for the given compute node.
|
|
127
128
|
*
|
|
@@ -170,7 +171,7 @@ declare class Nodes extends DataMap<{
|
|
|
170
171
|
* @param {LightsNode} lightsNode - The lights node.
|
|
171
172
|
* @return {Number} The cache key.
|
|
172
173
|
*/
|
|
173
|
-
getCacheKey(scene: Scene, lightsNode: LightsNode):
|
|
174
|
+
getCacheKey(scene: Scene, lightsNode: LightsNode): number;
|
|
174
175
|
/**
|
|
175
176
|
* A boolean that indicates whether tone mapping should be enabled
|
|
176
177
|
* or not.
|
|
@@ -281,7 +282,7 @@ declare class Nodes extends DataMap<{
|
|
|
281
282
|
*/
|
|
282
283
|
needsRefresh(renderObject: RenderObject): boolean;
|
|
283
284
|
/**
|
|
284
|
-
* Frees the
|
|
285
|
+
* Frees the internal resources.
|
|
285
286
|
*/
|
|
286
287
|
dispose(): void;
|
|
287
288
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="@webgpu/types" />
|
|
2
2
|
|
|
3
|
-
import { CoordinateSystem } from "../../constants.js";
|
|
3
|
+
import { CoordinateSystem, HalfFloatType, UnsignedByteType } from "../../constants.js";
|
|
4
4
|
import Backend, { BackendParameters } from "../common/Backend.js";
|
|
5
5
|
|
|
6
6
|
export interface WebGPUBackendParameters extends BackendParameters {
|
|
@@ -10,6 +10,7 @@ export interface WebGPUBackendParameters extends BackendParameters {
|
|
|
10
10
|
device?: GPUDevice | undefined;
|
|
11
11
|
powerPreference?: GPUPowerPreference | undefined;
|
|
12
12
|
context?: GPUCanvasContext | undefined;
|
|
13
|
+
outputType?: typeof UnsignedByteType | typeof HalfFloatType | undefined;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export default class WebGPUBackend extends Backend {
|
three/src/textures/Texture.d.ts
CHANGED
|
@@ -455,11 +455,8 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
|
|
|
455
455
|
updateMatrix(): void;
|
|
456
456
|
|
|
457
457
|
/**
|
|
458
|
-
* Make copy of the texture
|
|
459
|
-
*
|
|
460
|
-
* @remarks
|
|
461
|
-
* Besides, cloning a texture does not automatically mark it for a texture upload
|
|
462
|
-
* You have to set {@link needsUpdate | .needsUpdate} to `true` as soon as it's image property (the data source) is fully loaded or ready.
|
|
458
|
+
* Make copy of the texture. Note this is not a "deep copy", the image is shared. Cloning the texture automatically
|
|
459
|
+
* marks it for texture upload.
|
|
463
460
|
*/
|
|
464
461
|
clone(): this;
|
|
465
462
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MagnificationTextureFilter,
|
|
3
|
+
Mapping,
|
|
4
|
+
MinificationTextureFilter,
|
|
5
|
+
PixelFormat,
|
|
6
|
+
TextureDataType,
|
|
7
|
+
Wrapping,
|
|
8
|
+
} from "../constants.js";
|
|
9
|
+
import { VideoTexture } from "./VideoTexture.js";
|
|
10
|
+
|
|
11
|
+
declare class VideoFrameTexture extends VideoTexture {
|
|
12
|
+
constructor(
|
|
13
|
+
mapping?: Mapping,
|
|
14
|
+
wrapS?: Wrapping,
|
|
15
|
+
wrapT?: Wrapping,
|
|
16
|
+
magFilter?: MagnificationTextureFilter,
|
|
17
|
+
minFilter?: MinificationTextureFilter,
|
|
18
|
+
format?: PixelFormat,
|
|
19
|
+
type?: TextureDataType,
|
|
20
|
+
anisotropy?: number,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// FIXME Replace with VideoFrame when we no longer need to support TypeScript 5.0
|
|
24
|
+
setFrame(frane: unknown): void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { VideoFrameTexture };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { InstancedBufferGeometry } from "three";
|
|
2
|
-
|
|
3
|
-
declare class InstancedPointsGeometry extends InstancedBufferGeometry {
|
|
4
|
-
readonly isInstancedPointsGeometry: true;
|
|
5
|
-
|
|
6
|
-
constructor();
|
|
7
|
-
|
|
8
|
-
setPositions(array: Float32Array | ArrayLike<number>): this;
|
|
9
|
-
|
|
10
|
-
setColors(array: Float32Array | ArrayLike<number>): this;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default InstancedPointsGeometry;
|