@types/three 0.174.0 → 0.175.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 +1 -1
- three/examples/jsm/controls/PointerLockControls.d.ts +4 -1
- three/examples/jsm/geometries/ParametricFunctions.d.ts +8 -0
- three/examples/jsm/interactive/HTMLMesh.d.ts +9 -2
- three/examples/jsm/loaders/LUTImageLoader.d.ts +2 -2
- three/examples/jsm/postprocessing/HalftonePass.d.ts +1 -1
- three/examples/jsm/postprocessing/LUTPass.d.ts +1 -1
- three/examples/jsm/postprocessing/SMAAPass.d.ts +1 -1
- three/examples/jsm/transpiler/AST.d.ts +218 -1
- three/examples/jsm/transpiler/TSLEncoder.d.ts +35 -1
- three/examples/jsm/webxr/VRButton.d.ts +4 -2
- three/package.json +2 -2
- three/src/Three.TSL.d.ts +3 -1
- three/src/animation/AnimationAction.d.ts +219 -19
- three/src/animation/AnimationClip.d.ts +140 -28
- three/src/animation/AnimationMixer.d.ts +100 -8
- three/src/animation/AnimationObjectGroup.d.ts +55 -14
- three/src/animation/AnimationUtils.d.ts +154 -43
- three/src/animation/KeyframeTrack.d.ts +134 -25
- three/src/animation/PropertyBinding.d.ts +89 -31
- three/src/animation/PropertyMixer.d.ts +62 -5
- three/src/animation/tracks/BooleanKeyframeTrack.d.ts +12 -4
- three/src/animation/tracks/ColorKeyframeTrack.d.ts +10 -4
- three/src/animation/tracks/NumberKeyframeTrack.d.ts +10 -4
- three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +10 -4
- three/src/animation/tracks/StringKeyframeTrack.d.ts +12 -4
- three/src/animation/tracks/VectorKeyframeTrack.d.ts +10 -4
- three/src/constants.d.ts +2 -2
- three/src/core/BufferAttribute.d.ts +11 -0
- three/src/core/BufferGeometry.d.ts +1 -3
- three/src/extras/Controls.d.ts +1 -1
- three/src/extras/Earcut.d.ts +5 -3
- three/src/extras/ImageUtils.d.ts +1 -0
- three/src/lights/PointLight.d.ts +1 -1
- three/src/loaders/FileLoader.d.ts +2 -2
- three/src/loaders/LoaderUtils.d.ts +0 -5
- three/src/materials/Material.d.ts +3 -0
- three/src/nodes/Nodes.d.ts +1 -0
- three/src/nodes/accessors/BufferAttributeNode.d.ts +11 -4
- three/src/nodes/accessors/Object3DNode.d.ts +6 -6
- three/src/nodes/accessors/SkinningNode.d.ts +4 -3
- three/src/nodes/accessors/StorageTextureNode.d.ts +2 -2
- three/src/nodes/accessors/TextureNode.d.ts +3 -1
- three/src/nodes/code/ExpressionNode.d.ts +3 -2
- three/src/nodes/code/ScriptableNode.d.ts +1 -1
- three/src/nodes/code/ScriptableValueNode.d.ts +1 -1
- three/src/nodes/core/StructTypeNode.d.ts +1 -1
- three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +1 -12
- three/src/nodes/math/ConditionalNode.d.ts +4 -4
- three/src/nodes/math/MathNode.d.ts +20 -12
- three/src/nodes/math/OperatorNode.d.ts +57 -26
- three/src/nodes/tsl/TSLBase.d.ts +1 -0
- three/src/nodes/utils/DebugNode.d.ts +20 -0
- three/src/nodes/utils/SpriteSheetUVNode.d.ts +2 -2
- three/src/renderers/common/Animation.d.ts +2 -2
- three/src/renderers/common/Attributes.d.ts +1 -1
- three/src/renderers/common/Color4.d.ts +1 -1
- three/src/renderers/common/CubeRenderTarget.d.ts +6 -0
- three/src/renderers/common/RenderList.d.ts +2 -2
- three/src/renderers/common/RenderObject.d.ts +1 -1
- three/src/renderers/common/RenderObjects.d.ts +2 -2
- three/src/renderers/common/Renderer.d.ts +36 -27
- three/src/renderers/common/XRManager.d.ts +69 -3
- three/src/renderers/common/nodes/NodeBuilderState.d.ts +3 -3
- three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +1 -1
- three/src/textures/CanvasTexture.d.ts +1 -1
- three/examples/jsm/geometries/ParametricGeometries.d.ts +0 -32
|
@@ -33,33 +33,51 @@ export default class OperatorNode extends TempNode {
|
|
|
33
33
|
constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
export const add: (
|
|
37
37
|
a: NodeRepresentation,
|
|
38
38
|
b: NodeRepresentation,
|
|
39
|
-
...
|
|
39
|
+
...params: NodeRepresentation[]
|
|
40
40
|
) => ShaderNodeObject<OperatorNode>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
export const
|
|
57
|
-
export const
|
|
58
|
-
export const
|
|
59
|
-
export const
|
|
60
|
-
export const
|
|
61
|
-
export const
|
|
62
|
-
export const
|
|
41
|
+
export const sub: (
|
|
42
|
+
a: NodeRepresentation,
|
|
43
|
+
b: NodeRepresentation,
|
|
44
|
+
...params: NodeRepresentation[]
|
|
45
|
+
) => ShaderNodeObject<OperatorNode>;
|
|
46
|
+
export const mul: (
|
|
47
|
+
a: NodeRepresentation,
|
|
48
|
+
b: NodeRepresentation,
|
|
49
|
+
...params: NodeRepresentation[]
|
|
50
|
+
) => ShaderNodeObject<OperatorNode>;
|
|
51
|
+
export const div: (
|
|
52
|
+
a: NodeRepresentation,
|
|
53
|
+
b: NodeRepresentation,
|
|
54
|
+
...params: NodeRepresentation[]
|
|
55
|
+
) => ShaderNodeObject<OperatorNode>;
|
|
56
|
+
export const mod: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
57
|
+
export const equal: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
58
|
+
export const notEqual: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
59
|
+
export const lessThan: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
60
|
+
export const greaterThan: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
61
|
+
export const lessThanEqual: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
62
|
+
export const greaterThanEqual: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
63
|
+
export const and: (
|
|
64
|
+
a: NodeRepresentation,
|
|
65
|
+
b: NodeRepresentation,
|
|
66
|
+
...params: NodeRepresentation[]
|
|
67
|
+
) => ShaderNodeObject<OperatorNode>;
|
|
68
|
+
export const or: (
|
|
69
|
+
a: NodeRepresentation,
|
|
70
|
+
b: NodeRepresentation,
|
|
71
|
+
...params: NodeRepresentation[]
|
|
72
|
+
) => ShaderNodeObject<OperatorNode>;
|
|
73
|
+
export const not: (value: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
74
|
+
export const xor: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
75
|
+
export const bitAnd: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
76
|
+
export const bitNot: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
77
|
+
export const bitOr: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
78
|
+
export const bitXor: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
79
|
+
export const shiftLeft: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
80
|
+
export const shiftRight: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
63
81
|
|
|
64
82
|
declare module "../tsl/TSLCore.js" {
|
|
65
83
|
interface NodeElements {
|
|
@@ -67,7 +85,7 @@ declare module "../tsl/TSLCore.js" {
|
|
|
67
85
|
sub: typeof sub;
|
|
68
86
|
mul: typeof mul;
|
|
69
87
|
div: typeof div;
|
|
70
|
-
|
|
88
|
+
mod: typeof mod;
|
|
71
89
|
equal: typeof equal;
|
|
72
90
|
notEqual: typeof notEqual;
|
|
73
91
|
lessThan: typeof lessThan;
|
|
@@ -90,7 +108,16 @@ declare module "../tsl/TSLCore.js" {
|
|
|
90
108
|
/**
|
|
91
109
|
* @deprecated .remainder() has been renamed to .modInt().
|
|
92
110
|
*/
|
|
93
|
-
export const remainder:
|
|
111
|
+
export const remainder: (
|
|
112
|
+
aNode: NodeRepresentation,
|
|
113
|
+
bNode: NodeRepresentation,
|
|
114
|
+
...params: NodeRepresentation[]
|
|
115
|
+
) => ShaderNodeObject<OperatorNode>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated "modInt()" is deprecated. Use "mod( int( ... ) )" instead.
|
|
119
|
+
*/
|
|
120
|
+
export const modInt: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
|
|
94
121
|
|
|
95
122
|
declare module "../tsl/TSLCore.js" {
|
|
96
123
|
interface NodeElements {
|
|
@@ -98,5 +125,9 @@ declare module "../tsl/TSLCore.js" {
|
|
|
98
125
|
* @deprecated .remainder() has been renamed to .modInt().
|
|
99
126
|
*/
|
|
100
127
|
remainder: typeof remainder;
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated "modInt()" is deprecated. Use "mod( int( ... ) )" instead.
|
|
130
|
+
*/
|
|
131
|
+
modInt: typeof modInt;
|
|
101
132
|
}
|
|
102
133
|
}
|
three/src/nodes/tsl/TSLBase.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "../gpgpu/ComputeNode.js";
|
|
|
17
17
|
export * from "../math/ConditionalNode.js";
|
|
18
18
|
export * from "../math/MathNode.js";
|
|
19
19
|
export * from "../math/OperatorNode.js";
|
|
20
|
+
export * from "../utils/DebugNode.js";
|
|
20
21
|
export * from "../utils/Discard.js";
|
|
21
22
|
export * from "../utils/RemapNode.js";
|
|
22
23
|
export * from "./TSLCore.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Node from "../core/Node.js";
|
|
2
|
+
import TempNode from "../core/TempNode.js";
|
|
3
|
+
import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
|
|
4
|
+
|
|
5
|
+
declare class DebugNode extends TempNode {
|
|
6
|
+
constructor(node: Node, callback?: ((code: string) => void) | null);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default DebugNode;
|
|
10
|
+
|
|
11
|
+
export const debug: (
|
|
12
|
+
node: NodeRepresentation,
|
|
13
|
+
callback?: ((code: string) => void) | null,
|
|
14
|
+
) => ShaderNodeObject<DebugNode>;
|
|
15
|
+
|
|
16
|
+
declare module "../tsl/TSLCore.js" {
|
|
17
|
+
interface NodeElements {
|
|
18
|
+
debug: typeof debug;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -11,6 +11,6 @@ export default class SpriteSheetUVNode extends Node {
|
|
|
11
11
|
|
|
12
12
|
export const spritesheetUV: (
|
|
13
13
|
countNode: NodeRepresentation,
|
|
14
|
-
uvNode
|
|
15
|
-
frameNode
|
|
14
|
+
uvNode: NodeRepresentation | null,
|
|
15
|
+
frameNode: NodeRepresentation | null,
|
|
16
16
|
) => ShaderNodeObject<SpriteSheetUVNode>;
|
|
@@ -33,13 +33,13 @@ declare class Animation {
|
|
|
33
33
|
/**
|
|
34
34
|
* Returns the user-level animation loop.
|
|
35
35
|
*
|
|
36
|
-
* @return {Function} The animation loop.
|
|
36
|
+
* @return {?Function} The animation loop.
|
|
37
37
|
*/
|
|
38
38
|
getAnimationLoop(): ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null;
|
|
39
39
|
/**
|
|
40
40
|
* Defines the user-level animation loop.
|
|
41
41
|
*
|
|
42
|
-
* @param {Function} callback - The animation loop.
|
|
42
|
+
* @param {?Function} callback - The animation loop.
|
|
43
43
|
*/
|
|
44
44
|
setAnimationLoop(callback: ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null): void;
|
|
45
45
|
/**
|
|
@@ -30,7 +30,7 @@ declare class Attributes extends DataMap<{
|
|
|
30
30
|
* Deletes the data for the given attribute.
|
|
31
31
|
*
|
|
32
32
|
* @param {BufferAttribute} attribute - The attribute.
|
|
33
|
-
* @return {Object} The deleted attribute data.
|
|
33
|
+
* @return {Object|null} The deleted attribute data.
|
|
34
34
|
*/
|
|
35
35
|
delete(attribute: BufferAttribute | InterleavedBufferAttribute): Data;
|
|
36
36
|
/**
|
|
@@ -26,7 +26,7 @@ declare class Color4 extends Color {
|
|
|
26
26
|
* You can also pass a single THREE.Color, hex or
|
|
27
27
|
* string argument to this method.
|
|
28
28
|
*
|
|
29
|
-
* @param {number|string} r - The red value.
|
|
29
|
+
* @param {number|string|Color} r - The red value.
|
|
30
30
|
* @param {number} g - The green value.
|
|
31
31
|
* @param {number} b - The blue value.
|
|
32
32
|
* @param {number} [a=1] - The alpha value.
|
|
@@ -10,6 +10,12 @@ import { WebGLRenderer } from "../WebGLRenderer.js";
|
|
|
10
10
|
*/
|
|
11
11
|
declare class CubeRenderTarget extends WebGLCubeRenderTarget {
|
|
12
12
|
readonly isCubeRenderTarget: true;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new cube render target.
|
|
15
|
+
*
|
|
16
|
+
* @param {number} [size=1] - The size of the render target.
|
|
17
|
+
* @param {RenderTarget~Options} [options] - The configuration object.
|
|
18
|
+
*/
|
|
13
19
|
constructor(size?: number, options?: RenderTargetOptions);
|
|
14
20
|
/**
|
|
15
21
|
* Converts the given equirectangular texture to a cube map.
|
|
@@ -144,8 +144,8 @@ declare class RenderList {
|
|
|
144
144
|
/**
|
|
145
145
|
* Sorts the internal render lists.
|
|
146
146
|
*
|
|
147
|
-
* @param {function(any, any): number} customOpaqueSort - A custom sort function for opaque objects.
|
|
148
|
-
* @param {function(any, any): number} customTransparentSort - A custom sort function for transparent objects.
|
|
147
|
+
* @param {?function(any, any): number} customOpaqueSort - A custom sort function for opaque objects.
|
|
148
|
+
* @param {?function(any, any): number} customTransparentSort - A custom sort function for transparent objects.
|
|
149
149
|
*/
|
|
150
150
|
sort(
|
|
151
151
|
customOpaqueSort: ((a: RenderItem, b: RenderItem) => number) | null,
|
|
@@ -189,7 +189,7 @@ declare class RenderObject {
|
|
|
189
189
|
/**
|
|
190
190
|
* Returns the draw parameters for the render object.
|
|
191
191
|
*
|
|
192
|
-
* @return {{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} The draw parameters.
|
|
192
|
+
* @return {?{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} The draw parameters.
|
|
193
193
|
*/
|
|
194
194
|
getDrawParameters(): {
|
|
195
195
|
vertexCount: number;
|
|
@@ -56,7 +56,7 @@ declare class RenderObjects {
|
|
|
56
56
|
* @param {LightsNode} lightsNode - The lights node.
|
|
57
57
|
* @param {RenderContext} renderContext - The render context.
|
|
58
58
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
59
|
-
* @param {
|
|
59
|
+
* @param {string} [passId] - An optional ID for identifying the pass.
|
|
60
60
|
* @return {RenderObject} The render object.
|
|
61
61
|
*/
|
|
62
62
|
get(
|
|
@@ -98,7 +98,7 @@ declare class RenderObjects {
|
|
|
98
98
|
* @param {LightsNode} lightsNode - The lights node.
|
|
99
99
|
* @param {RenderContext} renderContext - The render context.
|
|
100
100
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
101
|
-
* @param {
|
|
101
|
+
* @param {string} [passId] - An optional ID for identifying the pass.
|
|
102
102
|
* @return {RenderObject} The render object.
|
|
103
103
|
*/
|
|
104
104
|
createRenderObject(
|
|
@@ -6,8 +6,10 @@ 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 { Box3 } from "../../math/Box3.js";
|
|
9
10
|
import { ColorRepresentation } from "../../math/Color.js";
|
|
10
11
|
import { Vector2 } from "../../math/Vector2.js";
|
|
12
|
+
import { Vector3 } from "../../math/Vector3.js";
|
|
11
13
|
import { Vector4 } from "../../math/Vector4.js";
|
|
12
14
|
import MRTNode from "../../nodes/core/MRTNode.js";
|
|
13
15
|
import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
|
|
@@ -183,21 +185,26 @@ declare class Renderer {
|
|
|
183
185
|
};
|
|
184
186
|
localClippingEnabled?: boolean | undefined;
|
|
185
187
|
/**
|
|
186
|
-
*
|
|
188
|
+
* Renderer options.
|
|
187
189
|
*
|
|
188
|
-
* @
|
|
189
|
-
* @
|
|
190
|
-
* @
|
|
191
|
-
* @
|
|
192
|
-
* @
|
|
193
|
-
* @
|
|
194
|
-
* @
|
|
195
|
-
* @param {number} [parameters.samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0
|
|
190
|
+
* @typedef {Object} Renderer~Options
|
|
191
|
+
* @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
|
|
192
|
+
* @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
|
|
193
|
+
* @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not.
|
|
194
|
+
* @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not.
|
|
195
|
+
* @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
|
|
196
|
+
* @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0
|
|
196
197
|
* to overwrite the default.
|
|
197
|
-
* @
|
|
198
|
-
* @
|
|
198
|
+
* @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
|
|
199
|
+
* @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
|
|
199
200
|
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
|
|
200
201
|
*/
|
|
202
|
+
/**
|
|
203
|
+
* Constructs a new renderer.
|
|
204
|
+
*
|
|
205
|
+
* @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2).
|
|
206
|
+
* @param {Renderer~Options} [parameters] - The configuration parameter.
|
|
207
|
+
*/
|
|
201
208
|
constructor(backend: Backend, parameters?: RendererParameters);
|
|
202
209
|
/**
|
|
203
210
|
* Initializes the renderer so it is ready for usage.
|
|
@@ -227,8 +234,8 @@ declare class Renderer {
|
|
|
227
234
|
* @async
|
|
228
235
|
* @param {Object3D} scene - The scene or 3D object to precompile.
|
|
229
236
|
* @param {Camera} camera - The camera that is used to render the scene.
|
|
230
|
-
* @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added.
|
|
231
|
-
* @return {Promise<Array>} A Promise that resolves when the compile has been finished.
|
|
237
|
+
* @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.
|
|
238
|
+
* @return {Promise<Array|undefined>} A Promise that resolves when the compile has been finished.
|
|
232
239
|
*/
|
|
233
240
|
compileAsync(scene: Object3D, camera: Camera, targetScene?: Object3D | null): Promise<void>;
|
|
234
241
|
/**
|
|
@@ -280,7 +287,7 @@ declare class Renderer {
|
|
|
280
287
|
* @private
|
|
281
288
|
* @param {Object} bundle - Render bundle data.
|
|
282
289
|
* @param {Scene} sceneRef - The scene the render bundle belongs to.
|
|
283
|
-
* @param {LightsNode} lightsNode - The
|
|
290
|
+
* @param {LightsNode} lightsNode - The lights node.
|
|
284
291
|
*/
|
|
285
292
|
_renderBundle(bundle: Bundle, sceneRef: Scene, lightsNode: LightsNode): void;
|
|
286
293
|
/**
|
|
@@ -346,7 +353,7 @@ declare class Renderer {
|
|
|
346
353
|
* for best compatibility.
|
|
347
354
|
*
|
|
348
355
|
* @async
|
|
349
|
-
* @param {Function} callback - The application's animation loop.
|
|
356
|
+
* @param {?Function} callback - The application's animation loop.
|
|
350
357
|
* @return {Promise} A Promise that resolves when the set has been executed.
|
|
351
358
|
*/
|
|
352
359
|
setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): Promise<void>;
|
|
@@ -382,7 +389,7 @@ declare class Renderer {
|
|
|
382
389
|
* Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.
|
|
383
390
|
*
|
|
384
391
|
* @param {Vector2} target - The method writes the result in this target object.
|
|
385
|
-
* @return {Vector2} The
|
|
392
|
+
* @return {Vector2} The renderer's size in logical pixels.
|
|
386
393
|
*/
|
|
387
394
|
getSize(target: Vector2): Vector2;
|
|
388
395
|
/**
|
|
@@ -395,7 +402,7 @@ declare class Renderer {
|
|
|
395
402
|
* This method allows to define the drawing buffer size by specifying
|
|
396
403
|
* width, height and pixel ratio all at once. The size of the drawing
|
|
397
404
|
* buffer is computed with this formula:
|
|
398
|
-
*
|
|
405
|
+
* ```js
|
|
399
406
|
* size.x = width * pixelRatio;
|
|
400
407
|
* size.y = height * pixelRatio;
|
|
401
408
|
* ```
|
|
@@ -711,7 +718,7 @@ declare class Renderer {
|
|
|
711
718
|
* if the renderer has been initialized.
|
|
712
719
|
*
|
|
713
720
|
* @param {Node|Array<Node>} computeNodes - The compute node(s).
|
|
714
|
-
* @return {
|
|
721
|
+
* @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized.
|
|
715
722
|
*/
|
|
716
723
|
compute(computeNodes: ComputeNode | ComputeNode[]): Promise<void> | undefined;
|
|
717
724
|
/**
|
|
@@ -755,7 +762,7 @@ declare class Renderer {
|
|
|
755
762
|
*/
|
|
756
763
|
initTextureAsync(texture: Texture): Promise<void>;
|
|
757
764
|
/**
|
|
758
|
-
* Initializes the given
|
|
765
|
+
* Initializes the given texture. Useful for preloading a texture rather than waiting until first render
|
|
759
766
|
* (which can cause noticeable lags due to decode and GPU upload overhead).
|
|
760
767
|
*
|
|
761
768
|
* This method can only be used if the renderer has been initialized.
|
|
@@ -767,24 +774,26 @@ declare class Renderer {
|
|
|
767
774
|
* Copies the current bound framebuffer into the given texture.
|
|
768
775
|
*
|
|
769
776
|
* @param {FramebufferTexture} framebufferTexture - The texture.
|
|
770
|
-
* @param {Vector2|Vector4} rectangle - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied.
|
|
777
|
+
* @param {?Vector2|Vector4} [rectangle=null] - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied.
|
|
771
778
|
*/
|
|
772
779
|
copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: Rectangle | null): void;
|
|
773
780
|
/**
|
|
774
|
-
* Copies data of source texture into a destination texture.
|
|
781
|
+
* Copies data of the given source texture into a destination texture.
|
|
775
782
|
*
|
|
776
783
|
* @param {Texture} srcTexture - The source texture.
|
|
777
784
|
* @param {Texture} dstTexture - The destination texture.
|
|
778
785
|
* @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
779
786
|
* @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
780
|
-
* @param {number}
|
|
787
|
+
* @param {number} [srcLevel=0] - The source mip level to copy from.
|
|
788
|
+
* @param {number} [dstLevel=0] - The destination mip level to copy to.
|
|
781
789
|
*/
|
|
782
790
|
copyTextureToTexture(
|
|
783
791
|
srcTexture: Texture,
|
|
784
792
|
dstTexture: Texture,
|
|
785
|
-
srcRegion?: Box2 | null,
|
|
786
|
-
dstPosition?: Vector2 | null,
|
|
787
|
-
|
|
793
|
+
srcRegion?: Box2 | Box3 | null,
|
|
794
|
+
dstPosition?: Vector2 | Vector3 | null,
|
|
795
|
+
srcLevel?: number,
|
|
796
|
+
dstLevel?: number,
|
|
788
797
|
): void;
|
|
789
798
|
/**
|
|
790
799
|
* Reads pixel data from the given render target.
|
|
@@ -879,7 +888,7 @@ declare class Renderer {
|
|
|
879
888
|
* @param {Material} material - The object's material.
|
|
880
889
|
* @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
881
890
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
882
|
-
* @param {ClippingContext} clippingContext - The clipping context.
|
|
891
|
+
* @param {?ClippingContext} clippingContext - The clipping context.
|
|
883
892
|
* @param {?string} [passId=null] - An optional ID for identifying the pass.
|
|
884
893
|
*/
|
|
885
894
|
renderObject(
|
|
@@ -948,7 +957,7 @@ declare class Renderer {
|
|
|
948
957
|
* @param {Object3D} scene - The scene or 3D object to precompile.
|
|
949
958
|
* @param {Camera} camera - The camera that is used to render the scene.
|
|
950
959
|
* @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.
|
|
951
|
-
* @return {Promise} A Promise that resolves when the compile has been finished.
|
|
960
|
+
* @return {function(Object3D, Camera, ?Scene): Promise|undefined} A Promise that resolves when the compile has been finished.
|
|
952
961
|
*/
|
|
953
962
|
get compile(): (scene: Object3D, camera: Camera, targetScene?: Object3D | null) => Promise<void>;
|
|
954
963
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { ArrayCamera } from "../../cameras/ArrayCamera.js";
|
|
2
2
|
import { PerspectiveCamera } from "../../cameras/PerspectiveCamera.js";
|
|
3
3
|
import { EventDispatcher } from "../../core/EventDispatcher.js";
|
|
4
|
+
import { CylinderGeometry } from "../../geometries/CylinderGeometry.js";
|
|
5
|
+
import { PlaneGeometry } from "../../geometries/PlaneGeometry.js";
|
|
6
|
+
import { Material } from "../../materials/Material.js";
|
|
7
|
+
import { MeshBasicMaterial } from "../../materials/MeshBasicMaterial.js";
|
|
8
|
+
import { Quaternion } from "../../math/Quaternion.js";
|
|
4
9
|
import { Vector2 } from "../../math/Vector2.js";
|
|
10
|
+
import { Vector3 } from "../../math/Vector3.js";
|
|
11
|
+
import { Mesh } from "../../objects/Mesh.js";
|
|
5
12
|
import { WebXRController } from "../webxr/WebXRController.js";
|
|
6
13
|
import { AnimationContext } from "./Animation.js";
|
|
7
14
|
import Renderer from "./Renderer.js";
|
|
@@ -13,6 +20,39 @@ export interface XRManagerEventMap {
|
|
|
13
20
|
data: XRFrame;
|
|
14
21
|
};
|
|
15
22
|
}
|
|
23
|
+
export interface XRQuadLayerObject {
|
|
24
|
+
type: "quad";
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
translation: Vector3;
|
|
28
|
+
quaternion: Quaternion;
|
|
29
|
+
pixelwidth: number;
|
|
30
|
+
pixelheight: number;
|
|
31
|
+
plane: Mesh;
|
|
32
|
+
material: Material;
|
|
33
|
+
rendercall: () => void;
|
|
34
|
+
renderTarget: XRRenderTarget;
|
|
35
|
+
xrlayer?: XRLayer;
|
|
36
|
+
}
|
|
37
|
+
export interface XRCylinderLayerObject {
|
|
38
|
+
type: "cylinder";
|
|
39
|
+
radius: number;
|
|
40
|
+
centralAngle: number;
|
|
41
|
+
aspectratio: number;
|
|
42
|
+
translation: Vector3;
|
|
43
|
+
quaternion: Quaternion;
|
|
44
|
+
pixelwidth: number;
|
|
45
|
+
pixelheight: number;
|
|
46
|
+
plane: Mesh;
|
|
47
|
+
material: Material;
|
|
48
|
+
rendercall: () => void;
|
|
49
|
+
renderTarget: XRRenderTarget;
|
|
50
|
+
xrlayer?: XRLayer;
|
|
51
|
+
}
|
|
52
|
+
export type XRLayerObject = XRQuadLayerObject | XRCylinderLayerObject;
|
|
53
|
+
export interface LayerAttributes {
|
|
54
|
+
stencil?: boolean | undefined;
|
|
55
|
+
}
|
|
16
56
|
/**
|
|
17
57
|
* The XR manager is built on top of the WebXR Device API to
|
|
18
58
|
* manage XR sessions with `WebGPURenderer`.
|
|
@@ -35,6 +75,10 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
|
35
75
|
_controllers: WebXRController[];
|
|
36
76
|
_controllerInputSources: (XRInputSource | null)[];
|
|
37
77
|
_xrRenderTarget: XRRenderTarget | null;
|
|
78
|
+
_layers: XRLayerObject[];
|
|
79
|
+
_supportsLayers: boolean;
|
|
80
|
+
_createXRLayer: (layer: XRLayerObject) => XRLayer;
|
|
81
|
+
_gl: WebGL2RenderingContext | null;
|
|
38
82
|
_currentAnimationContext: AnimationContext | null;
|
|
39
83
|
_currentAnimationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
|
|
40
84
|
_currentPixelRatio: number | null;
|
|
@@ -117,7 +161,7 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
|
117
161
|
/**
|
|
118
162
|
* Returns the reference space type.
|
|
119
163
|
*
|
|
120
|
-
* @return {
|
|
164
|
+
* @return {XRReferenceSpaceType} The reference space type.
|
|
121
165
|
*/
|
|
122
166
|
getReferenceSpaceType(): XRReferenceSpaceType;
|
|
123
167
|
/**
|
|
@@ -125,7 +169,7 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
|
125
169
|
*
|
|
126
170
|
* This method can not be used during a XR session.
|
|
127
171
|
*
|
|
128
|
-
* @param {
|
|
172
|
+
* @param {XRReferenceSpaceType} type - The reference space type.
|
|
129
173
|
*/
|
|
130
174
|
setReferenceSpaceType(type: XRReferenceSpaceType): void;
|
|
131
175
|
/**
|
|
@@ -149,7 +193,7 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
|
149
193
|
/**
|
|
150
194
|
* Returns the environment blend mode from the current XR session.
|
|
151
195
|
*
|
|
152
|
-
* @return {
|
|
196
|
+
* @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session.
|
|
153
197
|
*/
|
|
154
198
|
getEnvironmentBlendMode(): XREnvironmentBlendMode | undefined;
|
|
155
199
|
/**
|
|
@@ -158,6 +202,28 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
|
158
202
|
* @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session.
|
|
159
203
|
*/
|
|
160
204
|
getFrame(): XRFrame | null;
|
|
205
|
+
createQuadLayer(
|
|
206
|
+
width: number,
|
|
207
|
+
height: number,
|
|
208
|
+
translation: Vector3,
|
|
209
|
+
quaternion: Quaternion,
|
|
210
|
+
pixelwidth: number,
|
|
211
|
+
pixelheight: number,
|
|
212
|
+
rendercall: () => void,
|
|
213
|
+
attributes?: LayerAttributes,
|
|
214
|
+
): Mesh<PlaneGeometry, MeshBasicMaterial, import("../../core/Object3D.js").Object3DEventMap>;
|
|
215
|
+
createCylinderLayer(
|
|
216
|
+
radius: number,
|
|
217
|
+
centralAngle: number,
|
|
218
|
+
aspectratio: number,
|
|
219
|
+
translation: Vector3,
|
|
220
|
+
quaternion: Quaternion,
|
|
221
|
+
pixelwidth: number,
|
|
222
|
+
pixelheight: number,
|
|
223
|
+
rendercall: () => void,
|
|
224
|
+
attributes?: LayerAttributes,
|
|
225
|
+
): Mesh<CylinderGeometry, MeshBasicMaterial, import("../../core/Object3D.js").Object3DEventMap>;
|
|
226
|
+
renderLayers(): void;
|
|
161
227
|
/**
|
|
162
228
|
* Returns the current XR session.
|
|
163
229
|
*
|
|
@@ -26,9 +26,9 @@ declare class NodeBuilderState {
|
|
|
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.
|
|
@@ -31,7 +31,7 @@ export class CanvasTexture extends Texture {
|
|
|
31
31
|
* @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
|
|
32
32
|
*/
|
|
33
33
|
constructor(
|
|
34
|
-
canvas
|
|
34
|
+
canvas?: TexImageSource | OffscreenCanvas,
|
|
35
35
|
mapping?: Mapping,
|
|
36
36
|
wrapS?: Wrapping,
|
|
37
37
|
wrapT?: Wrapping,
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Curve, Vector3 } from "three";
|
|
2
|
-
|
|
3
|
-
import { ParametricGeometry } from "./ParametricGeometry.js";
|
|
4
|
-
|
|
5
|
-
export namespace ParametricGeometries {
|
|
6
|
-
function klein(v: number, u: number, target: Vector3): Vector3;
|
|
7
|
-
function plane(width: number, height: number): (u: number, v: number, target: Vector3) => Vector3;
|
|
8
|
-
function mobius(u: number, t: number, target: Vector3): Vector3;
|
|
9
|
-
function mobius3d(u: number, t: number, target: Vector3): Vector3;
|
|
10
|
-
|
|
11
|
-
class TubeGeometry extends ParametricGeometry {
|
|
12
|
-
constructor(
|
|
13
|
-
path: Curve<Vector3>,
|
|
14
|
-
segments?: number,
|
|
15
|
-
radius?: number,
|
|
16
|
-
segmentsRadius?: number,
|
|
17
|
-
closed?: boolean,
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
class TorusKnotGeometry extends TubeGeometry {
|
|
22
|
-
constructor(radius?: number, tube?: number, segmentsT?: number, segmentsR?: number, p?: number, q?: number);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
class SphereGeometry extends ParametricGeometry {
|
|
26
|
-
constructor(size: number, u: number, v: number);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
class PlaneGeometry extends ParametricGeometry {
|
|
30
|
-
constructor(width: number, depth: number, segmentsWidth: number, segmentsDepth: number);
|
|
31
|
-
}
|
|
32
|
-
}
|