@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
|
@@ -75,7 +75,7 @@ declare class Textures extends DataMap<{
|
|
|
75
75
|
* it updates the texture states representing the attachments of the framebuffer.
|
|
76
76
|
*
|
|
77
77
|
* @param {RenderTarget} renderTarget - The render target to update.
|
|
78
|
-
* @param {
|
|
78
|
+
* @param {number} [activeMipmapLevel=0] - The active mipmap level.
|
|
79
79
|
*/
|
|
80
80
|
updateRenderTarget(renderTarget: RenderTarget, activeMipmapLevel?: number): void;
|
|
81
81
|
/**
|
|
@@ -104,23 +104,23 @@ declare class Textures extends DataMap<{
|
|
|
104
104
|
* Computes the number of mipmap levels for the given texture.
|
|
105
105
|
*
|
|
106
106
|
* @param {Texture} texture - The texture.
|
|
107
|
-
* @param {
|
|
108
|
-
* @param {
|
|
109
|
-
* @return {
|
|
107
|
+
* @param {number} width - The texture's width.
|
|
108
|
+
* @param {number} height - The texture's height.
|
|
109
|
+
* @return {number} The number of mipmap levels.
|
|
110
110
|
*/
|
|
111
111
|
getMipLevels(texture: Texture, width: number, height: number): number;
|
|
112
112
|
/**
|
|
113
113
|
* Returns `true` if the given texture requires mipmaps.
|
|
114
114
|
*
|
|
115
115
|
* @param {Texture} texture - The texture.
|
|
116
|
-
* @return {
|
|
116
|
+
* @return {boolean} Whether mipmaps are required or not.
|
|
117
117
|
*/
|
|
118
118
|
needsMipmaps(texture: Texture): boolean;
|
|
119
119
|
/**
|
|
120
120
|
* Returns `true` if the given texture is an environment map.
|
|
121
121
|
*
|
|
122
122
|
* @param {Texture} texture - The texture.
|
|
123
|
-
* @return {
|
|
123
|
+
* @return {boolean} Whether the given texture is an environment map or not.
|
|
124
124
|
*/
|
|
125
125
|
isEnvironmentTexture(texture: Texture): boolean;
|
|
126
126
|
/**
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import RenderContext from "./RenderContext.js";
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class of a timestamp query pool.
|
|
4
|
+
*
|
|
5
|
+
* @abstract
|
|
6
|
+
*/
|
|
7
|
+
declare abstract class TimestampQueryPool {
|
|
8
|
+
trackTimestamp: boolean;
|
|
9
|
+
maxQueries: number;
|
|
10
|
+
currentQueryIndex: number;
|
|
11
|
+
queryOffsets: Map<number, number>;
|
|
12
|
+
isDisposed: boolean;
|
|
13
|
+
lastValue: number;
|
|
14
|
+
pendingResolve: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new timestamp query pool.
|
|
17
|
+
*
|
|
18
|
+
* @param {number} [maxQueries=256] - Maximum number of queries this pool can hold.
|
|
19
|
+
*/
|
|
20
|
+
constructor(maxQueries?: number);
|
|
21
|
+
/**
|
|
22
|
+
* Allocate queries for a specific renderContext.
|
|
23
|
+
*
|
|
24
|
+
* @abstract
|
|
25
|
+
* @param {Object} renderContext - The render context to allocate queries for.
|
|
26
|
+
*/
|
|
27
|
+
abstract allocateQueriesForContext(renderContext: RenderContext): number | null;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve all timestamps and return data (or process them).
|
|
30
|
+
*
|
|
31
|
+
* @abstract
|
|
32
|
+
* @async
|
|
33
|
+
* @returns {Promise<number>|number} The resolved timestamp value.
|
|
34
|
+
*/
|
|
35
|
+
abstract resolveQueriesAsync(): Promise<number>;
|
|
36
|
+
/**
|
|
37
|
+
* Dispose of the query pool.
|
|
38
|
+
*
|
|
39
|
+
* @abstract
|
|
40
|
+
*/
|
|
41
|
+
abstract dispose(): void;
|
|
42
|
+
}
|
|
43
|
+
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";
|
|
@@ -19,20 +20,20 @@ declare class Uniform<TValue> {
|
|
|
19
20
|
/**
|
|
20
21
|
* Constructs a new uniform.
|
|
21
22
|
*
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {string} name - The uniform's name.
|
|
24
|
+
* @param {any} value - The uniform's value.
|
|
24
25
|
*/
|
|
25
26
|
constructor(name: string, value: TValue);
|
|
26
27
|
/**
|
|
27
28
|
* Sets the uniform's value.
|
|
28
29
|
*
|
|
29
|
-
* @param {
|
|
30
|
+
* @param {any} value - The value to set.
|
|
30
31
|
*/
|
|
31
32
|
setValue(value: TValue): void;
|
|
32
33
|
/**
|
|
33
34
|
* Returns the uniform's value.
|
|
34
35
|
*
|
|
35
|
-
* @return {
|
|
36
|
+
* @return {any} The value.
|
|
36
37
|
*/
|
|
37
38
|
getValue(): TValue;
|
|
38
39
|
}
|
|
@@ -47,8 +48,8 @@ declare class NumberUniform extends Uniform<number> {
|
|
|
47
48
|
/**
|
|
48
49
|
* Constructs a new Number uniform.
|
|
49
50
|
*
|
|
50
|
-
* @param {
|
|
51
|
-
* @param {
|
|
51
|
+
* @param {string} name - The uniform's name.
|
|
52
|
+
* @param {number} value - The uniform's value.
|
|
52
53
|
*/
|
|
53
54
|
constructor(name: string, value?: number);
|
|
54
55
|
}
|
|
@@ -63,7 +64,7 @@ declare class Vector2Uniform extends Uniform<Vector2> {
|
|
|
63
64
|
/**
|
|
64
65
|
* Constructs a new Number uniform.
|
|
65
66
|
*
|
|
66
|
-
* @param {
|
|
67
|
+
* @param {string} name - The uniform's name.
|
|
67
68
|
* @param {Vector2} value - The uniform's value.
|
|
68
69
|
*/
|
|
69
70
|
constructor(name: string, value?: Vector2);
|
|
@@ -79,7 +80,7 @@ declare class Vector3Uniform extends Uniform<Vector3> {
|
|
|
79
80
|
/**
|
|
80
81
|
* Constructs a new Number uniform.
|
|
81
82
|
*
|
|
82
|
-
* @param {
|
|
83
|
+
* @param {string} name - The uniform's name.
|
|
83
84
|
* @param {Vector3} value - The uniform's value.
|
|
84
85
|
*/
|
|
85
86
|
constructor(name: string, value?: Vector3);
|
|
@@ -95,7 +96,7 @@ declare class Vector4Uniform extends Uniform<Vector4> {
|
|
|
95
96
|
/**
|
|
96
97
|
* Constructs a new Number uniform.
|
|
97
98
|
*
|
|
98
|
-
* @param {
|
|
99
|
+
* @param {string} name - The uniform's name.
|
|
99
100
|
* @param {Vector4} value - The uniform's value.
|
|
100
101
|
*/
|
|
101
102
|
constructor(name: string, value?: Vector4);
|
|
@@ -111,11 +112,27 @@ declare class ColorUniform extends Uniform<Color> {
|
|
|
111
112
|
/**
|
|
112
113
|
* Constructs a new Number uniform.
|
|
113
114
|
*
|
|
114
|
-
* @param {
|
|
115
|
+
* @param {string} name - The uniform's name.
|
|
115
116
|
* @param {Color} value - The uniform's value.
|
|
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
|
*
|
|
@@ -127,7 +144,7 @@ declare class Matrix3Uniform extends Uniform<Matrix3> {
|
|
|
127
144
|
/**
|
|
128
145
|
* Constructs a new Number uniform.
|
|
129
146
|
*
|
|
130
|
-
* @param {
|
|
147
|
+
* @param {string} name - The uniform's name.
|
|
131
148
|
* @param {Matrix3} value - The uniform's value.
|
|
132
149
|
*/
|
|
133
150
|
constructor(name: string, value?: Matrix3);
|
|
@@ -143,9 +160,18 @@ declare class Matrix4Uniform extends Uniform<Matrix4> {
|
|
|
143
160
|
/**
|
|
144
161
|
* Constructs a new Number uniform.
|
|
145
162
|
*
|
|
146
|
-
* @param {
|
|
163
|
+
* @param {string} name - The uniform's name.
|
|
147
164
|
* @param {Matrix4} value - The uniform's value.
|
|
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
|
+
};
|
|
@@ -10,7 +10,7 @@ declare class UniformBuffer extends Buffer {
|
|
|
10
10
|
/**
|
|
11
11
|
* Constructs a new uniform buffer.
|
|
12
12
|
*
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {string} name - The buffer's name.
|
|
14
14
|
* @param {TypedArray} [buffer=null] - The buffer.
|
|
15
15
|
*/
|
|
16
16
|
constructor(name?: string, buffer?: null);
|
|
@@ -23,7 +23,7 @@ declare class UniformsGroup extends UniformBuffer {
|
|
|
23
23
|
/**
|
|
24
24
|
* Constructs a new uniforms group.
|
|
25
25
|
*
|
|
26
|
-
* @param {
|
|
26
|
+
* @param {string} name - The group's name.
|
|
27
27
|
*/
|
|
28
28
|
constructor(name?: string);
|
|
29
29
|
/**
|
|
@@ -43,7 +43,7 @@ declare class UniformsGroup extends UniformBuffer {
|
|
|
43
43
|
/**
|
|
44
44
|
* An array with the raw uniform values.
|
|
45
45
|
*
|
|
46
|
-
* @type {Array<
|
|
46
|
+
* @type {Array<number>}
|
|
47
47
|
*/
|
|
48
48
|
get values(): number[];
|
|
49
49
|
/**
|
|
@@ -55,7 +55,7 @@ declare class UniformsGroup extends UniformBuffer {
|
|
|
55
55
|
/**
|
|
56
56
|
* The byte length of the buffer with correct buffer alignment.
|
|
57
57
|
*
|
|
58
|
-
* @type {
|
|
58
|
+
* @type {number}
|
|
59
59
|
*/
|
|
60
60
|
get byteLength(): number;
|
|
61
61
|
/**
|
|
@@ -64,7 +64,7 @@ declare class UniformsGroup extends UniformBuffer {
|
|
|
64
64
|
* values has actually changed so this method only returns
|
|
65
65
|
* `true` if there is a real value change.
|
|
66
66
|
*
|
|
67
|
-
* @return {
|
|
67
|
+
* @return {boolean} Whether the uniforms have been updated and
|
|
68
68
|
* must be uploaded to the GPU.
|
|
69
69
|
*/
|
|
70
70
|
update(): boolean;
|
|
@@ -73,62 +73,62 @@ declare class UniformsGroup extends UniformBuffer {
|
|
|
73
73
|
* the uniforms type.
|
|
74
74
|
*
|
|
75
75
|
* @param {Uniform} uniform - The uniform to update.
|
|
76
|
-
* @return {
|
|
76
|
+
* @return {boolean} Whether the uniform has been updated or not.
|
|
77
77
|
*/
|
|
78
78
|
updateByType(uniform: NodeUniformGPU): boolean | undefined;
|
|
79
79
|
/**
|
|
80
80
|
* Updates a given Number uniform.
|
|
81
81
|
*
|
|
82
82
|
* @param {NumberUniform} uniform - The Number uniform.
|
|
83
|
-
* @return {
|
|
83
|
+
* @return {boolean} Whether the uniform has been updated or not.
|
|
84
84
|
*/
|
|
85
85
|
updateNumber(uniform: NumberNodeUniform): boolean;
|
|
86
86
|
/**
|
|
87
87
|
* Updates a given Vector2 uniform.
|
|
88
88
|
*
|
|
89
89
|
* @param {Vector2Uniform} uniform - The Vector2 uniform.
|
|
90
|
-
* @return {
|
|
90
|
+
* @return {boolean} Whether the uniform has been updated or not.
|
|
91
91
|
*/
|
|
92
92
|
updateVector2(uniform: Vector2NodeUniform): boolean;
|
|
93
93
|
/**
|
|
94
94
|
* Updates a given Vector3 uniform.
|
|
95
95
|
*
|
|
96
96
|
* @param {Vector3Uniform} uniform - The Vector3 uniform.
|
|
97
|
-
* @return {
|
|
97
|
+
* @return {boolean} Whether the uniform has been updated or not.
|
|
98
98
|
*/
|
|
99
99
|
updateVector3(uniform: Vector3NodeUniform): boolean;
|
|
100
100
|
/**
|
|
101
101
|
* Updates a given Vector4 uniform.
|
|
102
102
|
*
|
|
103
103
|
* @param {Vector4Uniform} uniform - The Vector4 uniform.
|
|
104
|
-
* @return {
|
|
104
|
+
* @return {boolean} Whether the uniform has been updated or not.
|
|
105
105
|
*/
|
|
106
106
|
updateVector4(uniform: Vector4NodeUniform): boolean;
|
|
107
107
|
/**
|
|
108
108
|
* Updates a given Color uniform.
|
|
109
109
|
*
|
|
110
110
|
* @param {ColorUniform} uniform - The Color uniform.
|
|
111
|
-
* @return {
|
|
111
|
+
* @return {boolean} Whether the uniform has been updated or not.
|
|
112
112
|
*/
|
|
113
113
|
updateColor(uniform: ColorNodeUniform): boolean;
|
|
114
114
|
/**
|
|
115
115
|
* Updates a given Matrix3 uniform.
|
|
116
116
|
*
|
|
117
117
|
* @param {Matrix3Uniform} uniform - The Matrix3 uniform.
|
|
118
|
-
* @return {
|
|
118
|
+
* @return {boolean} Whether the uniform has been updated or not.
|
|
119
119
|
*/
|
|
120
120
|
updateMatrix3(uniform: Matrix3NodeUniform): boolean;
|
|
121
121
|
/**
|
|
122
122
|
* Updates a given Matrix4 uniform.
|
|
123
123
|
*
|
|
124
124
|
* @param {Matrix4Uniform} uniform - The Matrix4 uniform.
|
|
125
|
-
* @return {
|
|
125
|
+
* @return {boolean} Whether the uniform has been updated or not.
|
|
126
126
|
*/
|
|
127
127
|
updateMatrix4(uniform: Matrix4NodeUniform): boolean;
|
|
128
128
|
/**
|
|
129
129
|
* Returns a typed array that matches the given data type.
|
|
130
130
|
*
|
|
131
|
-
* @param {
|
|
131
|
+
* @param {string} type - The data type.
|
|
132
132
|
* @return {TypedArray} The typed array.
|
|
133
133
|
*/
|
|
134
134
|
_getBufferForType(type: string | null): Int32Array | Uint32Array | Float32Array;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { ArrayCamera } from "../../cameras/ArrayCamera.js";
|
|
2
|
+
import { PerspectiveCamera } from "../../cameras/PerspectiveCamera.js";
|
|
3
|
+
import { EventDispatcher } from "../../core/EventDispatcher.js";
|
|
4
|
+
import { Vector2 } from "../../math/Vector2.js";
|
|
5
|
+
import { WebXRController } from "../webxr/WebXRController.js";
|
|
6
|
+
import { AnimationContext } from "./Animation.js";
|
|
7
|
+
import Renderer from "./Renderer.js";
|
|
8
|
+
import { XRRenderTarget } from "./XRRenderTarget.js";
|
|
9
|
+
export interface XRManagerEventMap {
|
|
10
|
+
sessionstart: {};
|
|
11
|
+
sessionend: {};
|
|
12
|
+
planesdetected: {
|
|
13
|
+
data: XRFrame;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The XR manager is built on top of the WebXR Device API to
|
|
18
|
+
* manage XR sessions with `WebGPURenderer`.
|
|
19
|
+
*
|
|
20
|
+
* XR is currently only supported with a WebGL 2 backend.
|
|
21
|
+
*
|
|
22
|
+
* @augments EventDispatcher
|
|
23
|
+
*/
|
|
24
|
+
declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
isPresenting: boolean;
|
|
27
|
+
cameraAutoUpdate: boolean;
|
|
28
|
+
_renderer: Renderer;
|
|
29
|
+
_cameraL: PerspectiveCamera;
|
|
30
|
+
_cameraR: PerspectiveCamera;
|
|
31
|
+
_cameras: PerspectiveCamera[];
|
|
32
|
+
_cameraXR: ArrayCamera;
|
|
33
|
+
_currentDepthNear: number | null;
|
|
34
|
+
_currentDepthFar: number | null;
|
|
35
|
+
_controllers: WebXRController[];
|
|
36
|
+
_controllerInputSources: (XRInputSource | null)[];
|
|
37
|
+
_xrRenderTarget: XRRenderTarget | null;
|
|
38
|
+
_currentAnimationContext: AnimationContext | null;
|
|
39
|
+
_currentAnimationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
|
|
40
|
+
_currentPixelRatio: number | null;
|
|
41
|
+
_currentSize: Vector2;
|
|
42
|
+
_onSessionEvent: (event: XRInputSourceEvent) => void;
|
|
43
|
+
_onSessionEnd: () => void;
|
|
44
|
+
_onInputSourcesChange: (event: XRInputSourcesChangeEvent) => void;
|
|
45
|
+
_onAnimationFrame: (time: DOMHighResTimeStamp, frame?: XRFrame) => void;
|
|
46
|
+
_referenceSpace: XRReferenceSpace | null;
|
|
47
|
+
_referenceSpaceType: XRReferenceSpaceType;
|
|
48
|
+
_customReferenceSpace: XRReferenceSpace | null;
|
|
49
|
+
_framebufferScaleFactor: number;
|
|
50
|
+
_foveation: number;
|
|
51
|
+
_session: XRSession | null;
|
|
52
|
+
_glBaseLayer: XRWebGLLayer | null;
|
|
53
|
+
_glBinding: XRWebGLBinding | null;
|
|
54
|
+
_glProjLayer: XRProjectionLayer | null;
|
|
55
|
+
_xrFrame: XRFrame | null;
|
|
56
|
+
_useLayers: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Constructs a new XR manager.
|
|
59
|
+
*
|
|
60
|
+
* @param {Renderer} renderer - The renderer.
|
|
61
|
+
*/
|
|
62
|
+
constructor(renderer: Renderer);
|
|
63
|
+
/**
|
|
64
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
65
|
+
* of a XR controller in target ray space. The requested controller is defined
|
|
66
|
+
* by the given index.
|
|
67
|
+
*
|
|
68
|
+
* @param {number} index - The index of the XR controller.
|
|
69
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
70
|
+
*/
|
|
71
|
+
getController(index: number): import("../webxr/WebXRController.js").XRTargetRaySpace;
|
|
72
|
+
/**
|
|
73
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
74
|
+
* of a XR controller in grip space. The requested controller is defined
|
|
75
|
+
* by the given index.
|
|
76
|
+
*
|
|
77
|
+
* @param {number} index - The index of the XR controller.
|
|
78
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
79
|
+
*/
|
|
80
|
+
getControllerGrip(index: number): import("../webxr/WebXRController.js").XRGripSpace;
|
|
81
|
+
/**
|
|
82
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
83
|
+
* of a XR controller in hand space. The requested controller is defined
|
|
84
|
+
* by the given index.
|
|
85
|
+
*
|
|
86
|
+
* @param {number} index - The index of the XR controller.
|
|
87
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
88
|
+
*/
|
|
89
|
+
getHand(index: number): import("../webxr/WebXRController.js").XRHandSpace;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the foveation value.
|
|
92
|
+
*
|
|
93
|
+
* @return {number|undefined} The foveation value. Returns `undefined` if no base or projection layer is defined.
|
|
94
|
+
*/
|
|
95
|
+
getFoveation(): number | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Sets the foveation value.
|
|
98
|
+
*
|
|
99
|
+
* @param {number} foveation - A number in the range `[0,1]` where `0` means no foveation (full resolution)
|
|
100
|
+
* and `1` means maximum foveation (the edges render at lower resolution).
|
|
101
|
+
*/
|
|
102
|
+
setFoveation(foveation: number): void;
|
|
103
|
+
/**
|
|
104
|
+
* Returns the framebuffer scale factor.
|
|
105
|
+
*
|
|
106
|
+
* @return {number} The framebuffer scale factor.
|
|
107
|
+
*/
|
|
108
|
+
getFramebufferScaleFactor(): number;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the framebuffer scale factor.
|
|
111
|
+
*
|
|
112
|
+
* This method can not be used during a XR session.
|
|
113
|
+
*
|
|
114
|
+
* @param {number} factor - The framebuffer scale factor.
|
|
115
|
+
*/
|
|
116
|
+
setFramebufferScaleFactor(factor: number): void;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the reference space type.
|
|
119
|
+
*
|
|
120
|
+
* @return {string} The reference space type.
|
|
121
|
+
*/
|
|
122
|
+
getReferenceSpaceType(): XRReferenceSpaceType;
|
|
123
|
+
/**
|
|
124
|
+
* Sets the reference space type.
|
|
125
|
+
*
|
|
126
|
+
* This method can not be used during a XR session.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} type - The reference space type.
|
|
129
|
+
*/
|
|
130
|
+
setReferenceSpaceType(type: XRReferenceSpaceType): void;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the XR reference space.
|
|
133
|
+
*
|
|
134
|
+
* @return {XRReferenceSpace} The XR reference space.
|
|
135
|
+
*/
|
|
136
|
+
getReferenceSpace(): XRReferenceSpace | null;
|
|
137
|
+
/**
|
|
138
|
+
* Sets a custom XR reference space.
|
|
139
|
+
*
|
|
140
|
+
* @param {XRReferenceSpace} space - The XR reference space.
|
|
141
|
+
*/
|
|
142
|
+
setReferenceSpace(space: XRReferenceSpace): void;
|
|
143
|
+
/**
|
|
144
|
+
* Returns the XR camera.
|
|
145
|
+
*
|
|
146
|
+
* @return {ArrayCamera} The XR camera.
|
|
147
|
+
*/
|
|
148
|
+
getCamera(): ArrayCamera;
|
|
149
|
+
/**
|
|
150
|
+
* Returns the environment blend mode from the current XR session.
|
|
151
|
+
*
|
|
152
|
+
* @return {?('opaque'|'additive'|'alpha-blend')} The environment blend mode. Returns `null` when used outside of a XR session.
|
|
153
|
+
*/
|
|
154
|
+
getEnvironmentBlendMode(): XREnvironmentBlendMode | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* Returns the current XR frame.
|
|
157
|
+
*
|
|
158
|
+
* @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session.
|
|
159
|
+
*/
|
|
160
|
+
getFrame(): XRFrame | null;
|
|
161
|
+
/**
|
|
162
|
+
* Returns the current XR session.
|
|
163
|
+
*
|
|
164
|
+
* @return {?XRSession} The XR session. Returns `null` when used outside a XR session.
|
|
165
|
+
*/
|
|
166
|
+
getSession(): XRSession | null;
|
|
167
|
+
/**
|
|
168
|
+
* After a XR session has been requested usually with one of the `*Button` modules, it
|
|
169
|
+
* is injected into the renderer with this method. This method triggers the start of
|
|
170
|
+
* the actual XR rendering.
|
|
171
|
+
*
|
|
172
|
+
* @async
|
|
173
|
+
* @param {XRSession} session - The XR session to set.
|
|
174
|
+
* @return {Promise} A Promise that resolves when the session has been set.
|
|
175
|
+
*/
|
|
176
|
+
setSession(session: XRSession): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* This method is called by the renderer per frame and updates the XR camera
|
|
179
|
+
* and it sub cameras based on the given camera. The given camera is the "user"
|
|
180
|
+
* camera created on application level and used for non-XR rendering.
|
|
181
|
+
*
|
|
182
|
+
* @param {PerspectiveCamera} camera - The camera.
|
|
183
|
+
*/
|
|
184
|
+
updateCamera(camera: PerspectiveCamera): void;
|
|
185
|
+
/**
|
|
186
|
+
* Returns a WebXR controller for the given controller index.
|
|
187
|
+
*
|
|
188
|
+
* @private
|
|
189
|
+
* @param {number} index - The controller index.
|
|
190
|
+
* @return {WebXRController} The XR controller.
|
|
191
|
+
*/
|
|
192
|
+
_getController(index: number): WebXRController;
|
|
193
|
+
}
|
|
194
|
+
export default XRManager;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RenderTarget, RenderTargetOptions } 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?: RenderTargetOptions);
|
|
21
|
+
copy(source: XRRenderTarget): this;
|
|
22
|
+
}
|
|
23
|
+
export { XRRenderTarget };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { RenderTarget } from "../../../core/RenderTarget.js";
|
|
2
|
+
import { Vector3 } from "../../../math/Vector3.js";
|
|
2
3
|
import { Scene } from "../../../scenes/Scene.js";
|
|
3
4
|
import Renderer from "../Renderer.js";
|
|
4
5
|
|
|
6
|
+
export interface PMREMGeneratorOptions {
|
|
7
|
+
size?: number | undefined;
|
|
8
|
+
position?: Vector3 | undefined;
|
|
9
|
+
renderTarget?: RenderTarget | null | undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
declare class PMREMGenerator {
|
|
6
13
|
constructor(renderer: Renderer);
|
|
7
14
|
|
|
@@ -10,7 +17,7 @@ declare class PMREMGenerator {
|
|
|
10
17
|
sigma?: number,
|
|
11
18
|
near?: number,
|
|
12
19
|
far?: number,
|
|
13
|
-
|
|
20
|
+
options?: PMREMGeneratorOptions,
|
|
14
21
|
): RenderTarget;
|
|
15
22
|
|
|
16
23
|
fromSceneAsync(
|
|
@@ -18,7 +25,7 @@ declare class PMREMGenerator {
|
|
|
18
25
|
sigma?: number,
|
|
19
26
|
near?: number,
|
|
20
27
|
far?: number,
|
|
21
|
-
|
|
28
|
+
options?: PMREMGeneratorOptions,
|
|
22
29
|
): Promise<RenderTarget>;
|
|
23
30
|
|
|
24
31
|
dispose(): void;
|
|
@@ -21,20 +21,20 @@ 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.
|
|
28
28
|
*
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
29
|
+
* @param {?string} vertexShader - The native vertex shader code.
|
|
30
|
+
* @param {?string} fragmentShader - The native fragment shader code.
|
|
31
|
+
* @param {?string} computeShader - The native compute shader code.
|
|
32
32
|
* @param {Array<NodeAttribute>} nodeAttributes - An array of node attributes.
|
|
33
33
|
* @param {Array<BindGroup>} bindings - An array of bind groups.
|
|
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
|
/**
|
|
@@ -45,7 +45,7 @@ declare class NodeLibrary {
|
|
|
45
45
|
* Adds a tone mapping node function for a tone mapping technique (constant).
|
|
46
46
|
*
|
|
47
47
|
* @param {Function} toneMappingNode - The tone mapping node function.
|
|
48
|
-
* @param {
|
|
48
|
+
* @param {number} toneMapping - The tone mapping.
|
|
49
49
|
*/
|
|
50
50
|
addToneMapping(
|
|
51
51
|
toneMappingNode: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>,
|
|
@@ -54,8 +54,8 @@ declare class NodeLibrary {
|
|
|
54
54
|
/**
|
|
55
55
|
* Returns a tone mapping node function for a tone mapping technique (constant).
|
|
56
56
|
*
|
|
57
|
-
* @param {
|
|
58
|
-
* @return {Function
|
|
57
|
+
* @param {number} toneMapping - The tone mapping.
|
|
58
|
+
* @return {?Function} The tone mapping node function. Returns `null` if no node function is found.
|
|
59
59
|
*/
|
|
60
60
|
getToneMappingFunction(
|
|
61
61
|
toneMapping: ToneMapping,
|
|
@@ -63,15 +63,15 @@ declare class NodeLibrary {
|
|
|
63
63
|
/**
|
|
64
64
|
* Returns a node material class definition for a material type.
|
|
65
65
|
*
|
|
66
|
-
* @param {
|
|
67
|
-
* @return {NodeMaterial.constructor
|
|
66
|
+
* @param {string} materialType - The material type.
|
|
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;
|
|
70
70
|
/**
|
|
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;
|
|
@@ -80,7 +80,7 @@ declare class NodeLibrary {
|
|
|
80
80
|
* Returns a light node class definition for a light class definition.
|
|
81
81
|
*
|
|
82
82
|
* @param {Light.constructor} light - The light class definition.
|
|
83
|
-
* @return {AnalyticLightNode.constructor
|
|
83
|
+
* @return {?AnalyticLightNode.constructor} The light node class definition. Returns `null` if no light node is found.
|
|
84
84
|
*/
|
|
85
85
|
getLightNodeClass(light: Light): (new(light: Light) => AnalyticLightNode<Light>) | null;
|
|
86
86
|
/**
|
|
@@ -97,16 +97,16 @@ declare class NodeLibrary {
|
|
|
97
97
|
/**
|
|
98
98
|
* Adds a node class definition for the given type to the provided type library.
|
|
99
99
|
*
|
|
100
|
-
* @param {
|
|
101
|
-
* @param {
|
|
100
|
+
* @param {any} nodeClass - The node class definition.
|
|
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;
|
|
105
105
|
/**
|
|
106
106
|
* Adds a node class definition for the given class definition to the provided type library.
|
|
107
107
|
*
|
|
108
|
-
* @param {
|
|
109
|
-
* @param {
|
|
108
|
+
* @param {any} nodeClass - The node class definition.
|
|
109
|
+
* @param {any} baseClass - The class definition.
|
|
110
110
|
* @param {WeakMap} library - The type library.
|
|
111
111
|
*/
|
|
112
112
|
addClass<TNodeClass, TBaseClass extends object>(
|