@types/three 0.175.0 → 0.177.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.
Files changed (84) hide show
  1. three/README.md +2 -2
  2. three/examples/jsm/Addons.d.ts +0 -1
  3. three/examples/jsm/helpers/RapierHelper.d.ts +13 -0
  4. three/examples/jsm/loaders/LDrawLoader.d.ts +8 -3
  5. three/examples/jsm/loaders/LottieLoader.d.ts +4 -0
  6. three/examples/jsm/math/Octree.d.ts +3 -0
  7. three/examples/jsm/misc/MD2CharacterComplex.d.ts +1 -1
  8. three/examples/jsm/physics/RapierPhysics.d.ts +12 -0
  9. three/examples/jsm/postprocessing/AfterimagePass.d.ts +13 -10
  10. three/examples/jsm/postprocessing/BokehPass.d.ts +2 -2
  11. three/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  12. three/examples/jsm/tsl/display/hashBlur.d.ts +7 -1
  13. three/examples/jsm/tsl/shadows/TileShadowNode.d.ts +14 -0
  14. three/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +14 -0
  15. three/package.json +4 -3
  16. three/src/Three.Core.d.ts +1 -1
  17. three/src/Three.TSL.d.ts +13 -5
  18. three/src/Three.WebGPU.Nodes.d.ts +1 -0
  19. three/src/Three.WebGPU.d.ts +1 -0
  20. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  21. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  22. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  23. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  24. three/src/audio/AudioListener.d.ts +1 -1
  25. three/src/cameras/ArrayCamera.d.ts +5 -0
  26. three/src/constants.d.ts +16 -15
  27. three/src/core/BufferGeometry.d.ts +5 -1
  28. three/src/core/RenderTarget.d.ts +11 -19
  29. three/src/extras/DataUtils.d.ts +4 -4
  30. three/src/geometries/CapsuleGeometry.d.ts +11 -3
  31. three/src/lights/LightShadow.d.ts +8 -0
  32. three/src/lights/SpotLightShadow.d.ts +2 -0
  33. three/src/lights/webgpu/ProjectorLight.d.ts +17 -0
  34. three/src/materials/Material.d.ts +3 -8
  35. three/src/materials/ShaderMaterial.d.ts +1 -1
  36. three/src/materials/nodes/NodeMaterial.d.ts +12 -2
  37. three/src/materials/nodes/SpriteNodeMaterial.d.ts +2 -0
  38. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +12 -0
  39. three/src/math/Box3.d.ts +8 -0
  40. three/src/math/ColorManagement.d.ts +12 -2
  41. three/src/math/FrustumArray.d.ts +27 -0
  42. three/src/math/Sphere.d.ts +8 -0
  43. three/src/math/Triangle.d.ts +3 -3
  44. three/src/nodes/Nodes.d.ts +1 -0
  45. three/src/nodes/TSL.d.ts +1 -0
  46. three/src/nodes/accessors/CubeTextureNode.d.ts +12 -1
  47. three/src/nodes/accessors/InstanceNode.d.ts +2 -3
  48. three/src/nodes/accessors/TextureNode.d.ts +11 -6
  49. three/src/nodes/accessors/VertexColorNode.d.ts +1 -1
  50. three/src/nodes/core/AssignNode.d.ts +5 -1
  51. three/src/nodes/core/CacheNode.d.ts +3 -0
  52. three/src/nodes/core/Node.d.ts +11 -7
  53. three/src/nodes/core/NodeUtils.d.ts +4 -0
  54. three/src/nodes/core/NodeVarying.d.ts +11 -1
  55. three/src/nodes/core/StackNode.d.ts +7 -1
  56. three/src/nodes/core/VaryingNode.d.ts +6 -0
  57. three/src/nodes/display/BlendModes.d.ts +4 -0
  58. three/src/nodes/display/ColorSpaceNode.d.ts +2 -12
  59. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +2 -2
  60. three/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  61. three/src/nodes/lighting/ShadowFilterNode.d.ts +28 -0
  62. three/src/nodes/lighting/ShadowNode.d.ts +26 -24
  63. three/src/nodes/lighting/SpotLightNode.d.ts +15 -1
  64. three/src/nodes/math/OperatorNode.d.ts +9 -0
  65. three/src/nodes/tsl/TSLCore.d.ts +45 -32
  66. three/src/nodes/utils/DebugNode.d.ts +2 -1
  67. three/src/nodes/utils/ReflectorNode.d.ts +2 -1
  68. three/src/objects/Mesh.d.ts +8 -0
  69. three/src/objects/Sprite.d.ts +8 -0
  70. three/src/renderers/WebGLRenderer.d.ts +2 -2
  71. three/src/renderers/common/Animation.d.ts +2 -2
  72. three/src/renderers/common/Renderer.d.ts +24 -0
  73. three/src/renderers/common/Textures.d.ts +0 -7
  74. three/src/renderers/common/TimestampQueryPool.d.ts +1 -0
  75. three/src/renderers/common/XRManager.d.ts +55 -1
  76. three/src/renderers/webgpu/WebGPUBackend.d.ts +1 -0
  77. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -0
  78. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +1 -1
  79. three/src/textures/DepthTexture.d.ts +4 -2
  80. three/src/textures/Source.d.ts +20 -16
  81. three/src/textures/Texture.d.ts +76 -2
  82. three/src/textures/VideoFrameTexture.d.ts +1 -1
  83. three/examples/jsm/effects/PeppersGhostEffect.d.ts +0 -10
  84. three/src/core/RenderTargetArray.d.ts +0 -9
@@ -1,30 +1,33 @@
1
+ import { Camera } from "../../cameras/Camera.js";
2
+ import { BufferGeometry } from "../../core/BufferGeometry.js";
3
+ import { Object3D } from "../../core/Object3D.js";
1
4
  import { Light } from "../../lights/Light.js";
2
5
  import { LightShadow } from "../../lights/LightShadow.js";
3
- import Node from "../core/Node.js";
4
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
6
+ import { Material } from "../../materials/Material.js";
7
+ import { Group } from "../../objects/Group.js";
8
+ import ClippingContext from "../../renderers/common/ClippingContext.js";
9
+ import Renderer from "../../renderers/common/Renderer.js";
10
+ import { Scene } from "../../scenes/Scene.js";
11
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
12
+ import LightsNode from "./LightsNode.js";
5
13
  import ShadowBaseNode from "./ShadowBaseNode.js";
6
14
 
7
- export const BasicShadowFilter: (
8
- depthTexture: NodeRepresentation,
9
- shadowCoord: NodeRepresentation,
10
- ) => ShaderNodeObject<Node>;
11
-
12
- export const PCFShadowFilter: (
13
- depthTexture: NodeRepresentation,
14
- shadowCoord: NodeRepresentation,
15
- shadow: NodeRepresentation,
16
- ) => ShaderNodeObject<Node>;
17
-
18
- export const PCFSoftShadowFilter: (
19
- depthTexture: NodeRepresentation,
20
- shadowCoord: NodeRepresentation,
21
- shadow: NodeRepresentation,
22
- ) => ShaderNodeObject<Node>;
23
-
24
- export const VSMShadowFilter: (
25
- depthTexture: NodeRepresentation,
26
- shadowCoord: NodeRepresentation,
27
- ) => ShaderNodeObject<Node>;
15
+ export const getShadowRenderObjectFunction: (
16
+ renderer: Renderer,
17
+ shadow: LightShadow,
18
+ shadowType: number,
19
+ useVelocity: boolean,
20
+ ) => (
21
+ object: Object3D,
22
+ scene: Scene,
23
+ _camera: Camera,
24
+ geometry: BufferGeometry,
25
+ material: Material,
26
+ group: Group,
27
+ lightsNode: LightsNode,
28
+ clippingContext?: ClippingContext | null,
29
+ passId?: string | null,
30
+ ) => void;
28
31
 
29
32
  declare class ShadowNode extends ShadowBaseNode {
30
33
  constructor(light: Light, shadow: LightShadow | null);
@@ -33,4 +36,3 @@ declare class ShadowNode extends ShadowBaseNode {
33
36
  export default ShadowNode;
34
37
 
35
38
  export const shadow: (light: Light, shadow?: LightShadow) => ShaderNodeObject<ShadowNode>;
36
- export const shadows: ShaderNodeObject<Node>;
@@ -1,8 +1,10 @@
1
1
  import { SpotLight } from "../../lights/SpotLight.js";
2
2
  import Node from "../core/Node.js";
3
+ import NodeBuilder from "../core/NodeBuilder.js";
4
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
5
  import AnalyticLightNode from "./AnalyticLightNode.js";
4
6
 
5
- export default class PointLightNode extends AnalyticLightNode<SpotLight> {
7
+ declare class SpotLightNode extends AnalyticLightNode<SpotLight> {
6
8
  directionNode: Node;
7
9
 
8
10
  coneCosNode: Node;
@@ -11,5 +13,17 @@ export default class PointLightNode extends AnalyticLightNode<SpotLight> {
11
13
  cutoffDistanceNode: Node;
12
14
  decayExponentNode: Node;
13
15
 
16
+ colorNode: Node;
17
+
14
18
  constructor(light?: SpotLight | null);
19
+
20
+ getLightCoord(builder: NodeBuilder): ShaderNodeObject<Node>;
15
21
  }
22
+
23
+ declare module "three" {
24
+ export interface SpotLight {
25
+ attenuationNode?: ((lightNode: SpotLightNode) => Node) | null | undefined;
26
+ }
27
+ }
28
+
29
+ export default SpotLightNode;
@@ -79,6 +79,11 @@ export const bitXor: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNod
79
79
  export const shiftLeft: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
80
80
  export const shiftRight: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
81
81
 
82
+ export const incrementBefore: (a: NodeRepresentation) => ShaderNodeObject<Node>;
83
+ export const decrementBefore: (a: NodeRepresentation) => ShaderNodeObject<Node>;
84
+ export const increment: (a: NodeRepresentation) => ShaderNodeObject<Node>;
85
+ export const decrement: (a: NodeRepresentation) => ShaderNodeObject<Node>;
86
+
82
87
  declare module "../tsl/TSLCore.js" {
83
88
  interface NodeElements {
84
89
  add: typeof add;
@@ -102,6 +107,10 @@ declare module "../tsl/TSLCore.js" {
102
107
  bitXor: typeof bitXor;
103
108
  shiftLeft: typeof shiftLeft;
104
109
  shiftRight: typeof shiftRight;
110
+ incrementBefore: typeof incrementBefore;
111
+ decrementBefore: typeof decrement;
112
+ increment: typeof increment;
113
+ decrement: typeof decrement;
105
114
  }
106
115
  }
107
116
 
@@ -7,9 +7,7 @@ import StackNode from "../core/StackNode.js";
7
7
  import ConvertNode from "../utils/ConvertNode.js";
8
8
 
9
9
  export interface NodeElements {
10
- toGlobal: (node: Node) => Node;
11
-
12
- append: typeof append;
10
+ toStack: typeof Stack;
13
11
 
14
12
  toColor: typeof color;
15
13
  toFloat: typeof float;
@@ -34,6 +32,8 @@ export interface NodeElements {
34
32
 
35
33
  element: typeof element;
36
34
  convert: typeof convert;
35
+
36
+ append: typeof append;
37
37
  }
38
38
 
39
39
  export function addMethodChaining(name: string, nodeElement: unknown): void;
@@ -113,7 +113,7 @@ type RemoveHeadAndTail<T extends readonly [...unknown[]]> = T extends [unknown,
113
113
  *
114
114
  * We use an object instead of tuple or union as it makes stuff easier, especially in Typescript 4.0.
115
115
  */
116
- interface Construtors<
116
+ interface Constructors<
117
117
  A extends undefined | [...unknown[]],
118
118
  B extends undefined | [...unknown[]],
119
119
  C extends undefined | [...unknown[]],
@@ -136,20 +136,20 @@ type OverloadedConstructorsOf<T> = T extends {
136
136
  new(...args: infer A2): unknown;
137
137
  new(...args: infer A3): unknown;
138
138
  new(...args: infer A4): unknown;
139
- } ? Construtors<A1, A2, A3, A4>
139
+ } ? Constructors<A1, A2, A3, A4>
140
140
  : T extends {
141
141
  new(...args: infer A1): unknown;
142
142
  new(...args: infer A2): unknown;
143
143
  new(...args: infer A3): unknown;
144
- } ? Construtors<A1, A2, A3, undefined>
144
+ } ? Constructors<A1, A2, A3, undefined>
145
145
  : T extends {
146
146
  new(...args: infer A1): unknown;
147
147
  new(...args: infer A2): unknown;
148
- } ? Construtors<A1, A2, undefined, undefined>
149
- : T extends new(...args: infer A) => unknown ? Construtors<A, undefined, undefined, undefined>
150
- : Construtors<undefined, undefined, undefined, undefined>;
148
+ } ? Constructors<A1, A2, undefined, undefined>
149
+ : T extends new(...args: infer A) => unknown ? Constructors<A, undefined, undefined, undefined>
150
+ : Constructors<undefined, undefined, undefined, undefined>;
151
151
 
152
- type AnyConstructors = Construtors<any, any, any, any>;
152
+ type AnyConstructors = Constructors<any, any, any, any>;
153
153
 
154
154
  /**
155
155
  * Returns all constructors where the first paramter is assignable to given "scope"
@@ -246,43 +246,34 @@ interface Layout {
246
246
 
247
247
  interface ShaderNodeFn<Args extends readonly unknown[]> {
248
248
  (...args: Args): ShaderNodeObject<ShaderCallNodeInternal>;
249
+
249
250
  shaderNode: ShaderNodeObject<ShaderNodeInternal>;
251
+ id: number;
252
+
253
+ getNodeType: (builder: NodeBuilder) => string | null;
254
+ getCacheKey: (force?: boolean) => number;
255
+
250
256
  setLayout: (layout: Layout) => this;
251
- once: () => this;
257
+
258
+ once: (namespace?: string | null) => this;
252
259
  }
253
260
 
254
- export function Fn(jsFunc: () => void): ShaderNodeFn<[]>;
261
+ export function Fn(jsFunc: (builder: NodeBuilder) => void): ShaderNodeFn<[]>;
255
262
  export function Fn<T extends readonly unknown[]>(
256
- jsFunc: (args: T) => void,
263
+ jsFunc: (args: T, builder: NodeBuilder) => void,
257
264
  ): ShaderNodeFn<ProxiedTuple<T>>;
258
265
  export function Fn<T extends { readonly [key: string]: unknown }>(
259
- jsFunc: (args: T) => void,
266
+ jsFunc: (args: T, builder: NodeBuilder) => void,
260
267
  ): ShaderNodeFn<[ProxiedObject<T>]>;
261
268
 
262
- /**
263
- * @deprecated tslFn() has been renamed to Fn()
264
- */
265
- export function tslFn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
266
- /**
267
- * @deprecated tslFn() has been renamed to Fn()
268
- */
269
- export function tslFn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
270
- jsFunc: (args: T) => R,
271
- ): (...args: ProxiedTuple<T>) => R;
272
- /**
273
- * @deprecated tslFn() has been renamed to Fn()
274
- */
275
- export function tslFn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
276
- jsFunc: (args: T) => R,
277
- ): (args: ProxiedObject<T>) => R;
278
-
279
269
  export const setCurrentStack: (stack: StackNode | null) => void;
280
270
 
281
271
  export const getCurrentStack: () => StackNode | null;
282
272
 
283
273
  export const If: (boolNode: Node, method: () => void) => StackNode;
274
+ export const Switch: (expression: NodeRepresentation) => StackNode;
284
275
 
285
- export function append(node: Node): Node;
276
+ export function Stack(node: Node): Node;
286
277
 
287
278
  interface ColorFunction {
288
279
  (color?: ColorRepresentation): ShaderNodeObject<ConstNode<Color>>;
@@ -322,3 +313,25 @@ export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<Arr
322
313
  export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
323
314
  export const convert: (node: NodeRepresentation, types: string) => ShaderNodeObject<Node>;
324
315
  export const split: (node: NodeRepresentation, channels?: string) => ShaderNodeObject<Node>;
316
+
317
+ /**
318
+ * @deprecated append() has been renamed to Stack().
319
+ */
320
+ export const append: (node: Node) => Node;
321
+
322
+ /**
323
+ * @deprecated tslFn() has been renamed to Fn()
324
+ */
325
+ export function tslFn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
326
+ /**
327
+ * @deprecated tslFn() has been renamed to Fn()
328
+ */
329
+ export function tslFn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
330
+ jsFunc: (args: T) => R,
331
+ ): (...args: ProxiedTuple<T>) => R;
332
+ /**
333
+ * @deprecated tslFn() has been renamed to Fn()
334
+ */
335
+ export function tslFn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
336
+ jsFunc: (args: T) => R,
337
+ ): (args: ProxiedObject<T>) => R;
@@ -1,4 +1,5 @@
1
1
  import Node from "../core/Node.js";
2
+ import NodeBuilder from "../core/NodeBuilder.js";
2
3
  import TempNode from "../core/TempNode.js";
3
4
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
4
5
 
@@ -10,7 +11,7 @@ export default DebugNode;
10
11
 
11
12
  export const debug: (
12
13
  node: NodeRepresentation,
13
- callback?: ((code: string) => void) | null,
14
+ callback?: ((node: NodeBuilder, code: string) => void) | null,
14
15
  ) => ShaderNodeObject<DebugNode>;
15
16
 
16
17
  declare module "../tsl/TSLCore.js" {
@@ -31,8 +31,9 @@ declare class ReflectorBaseNode extends Node {
31
31
  bounces: boolean;
32
32
 
33
33
  virtualCameras: WeakMap<Camera, Camera>;
34
- renderTargets: WeakMap<Camera, RenderTarget>;
34
+ renderTargets: Map<Camera, RenderTarget>;
35
35
  forceUpdate: boolean;
36
+ hasOutput: boolean;
36
37
 
37
38
  constructor(textureNode: TextureNode, parameters?: ReflectorNodeParameters);
38
39
 
@@ -76,6 +76,14 @@ export class Mesh<
76
76
  */
77
77
  morphTargetDictionary?: { [key: string]: number } | undefined;
78
78
 
79
+ /**
80
+ * The number of instances of this mesh.
81
+ * Can only be used with {@link WebGPURenderer}.
82
+ *
83
+ * @default 1
84
+ */
85
+ count: number;
86
+
79
87
  /**
80
88
  * Updates the morphTargets to have no influence on the object
81
89
  * @remarks Resets the {@link morphTargetInfluences} and {@link morphTargetDictionary} properties.
@@ -62,4 +62,12 @@ export class Sprite<TEventMap extends Object3DEventMap = Object3DEventMap> exten
62
62
  * @defaultValue {@link THREE.Vector2 | `new Vector2(0.5, 0.5)`}.
63
63
  */
64
64
  center: Vector2;
65
+
66
+ /**
67
+ * The number of instances of this sprite.
68
+ * Can only be used with {@link WebGPURenderer}.
69
+ *
70
+ * @default 1
71
+ */
72
+ count: number;
65
73
  }
@@ -202,8 +202,6 @@ export class WebGLRenderer {
202
202
 
203
203
  shadowMap: WebGLShadowMap;
204
204
 
205
- pixelRatio: number;
206
-
207
205
  capabilities: WebGLCapabilities;
208
206
  properties: WebGLProperties;
209
207
  renderLists: WebGLRenderLists;
@@ -408,6 +406,7 @@ export class WebGLRenderer {
408
406
  height: number,
409
407
  buffer: TypedArray,
410
408
  activeCubeFaceIndex?: number,
409
+ textureIndex?: number,
411
410
  ): void;
412
411
 
413
412
  readRenderTargetPixelsAsync(
@@ -418,6 +417,7 @@ export class WebGLRenderer {
418
417
  height: number,
419
418
  buffer: TypedArray,
420
419
  activeCubeFaceIndex?: number,
420
+ textureIndex?: number,
421
421
  ): Promise<TypedArray>;
422
422
 
423
423
  /**
@@ -12,7 +12,7 @@ export interface AnimationContext {
12
12
  declare class Animation {
13
13
  nodes: Nodes;
14
14
  info: Info;
15
- _context: AnimationContext;
15
+ _context: AnimationContext | null;
16
16
  _animationLoop: ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null;
17
17
  _requestId: number | null;
18
18
  /**
@@ -47,7 +47,7 @@ declare class Animation {
47
47
  *
48
48
  * @return {Window|XRSession} The animation context.
49
49
  */
50
- getContext(): AnimationContext;
50
+ getContext(): AnimationContext | null;
51
51
  /**
52
52
  * Defines the context in which `requestAnimationFrame()` is executed.
53
53
  *
@@ -62,6 +62,7 @@ export interface RendererParameters {
62
62
  samples?: number | undefined;
63
63
  getFallback?: ((error: unknown) => Backend) | null | undefined;
64
64
  colorBufferType?: TextureDataType | undefined;
65
+ multiview?: boolean | undefined;
65
66
  }
66
67
  /**
67
68
  * Base class for renderers.
@@ -198,6 +199,7 @@ declare class Renderer {
198
199
  * @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
199
200
  * @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
200
201
  * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
202
+ * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
201
203
  */
202
204
  /**
203
205
  * Constructs a new renderer.
@@ -255,6 +257,23 @@ declare class Renderer {
255
257
  * @return {Promise} A Promise that resolves when synchronization has been finished.
256
258
  */
257
259
  waitForGPU(): Promise<void>;
260
+ /**
261
+ * Enables or disables high precision for model-view and normal-view matrices.
262
+ * When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance.
263
+ *
264
+ * NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`.
265
+ *
266
+ * @param {boolean} value - Whether to enable or disable high precision.
267
+ * @type {boolean}
268
+ */
269
+ set highPrecision(value: boolean);
270
+ /**
271
+ * Returns whether high precision is enabled or not.
272
+ *
273
+ * @return {boolean} Whether high precision is enabled or not.
274
+ * @type {boolean}
275
+ */
276
+ get highPrecision(): boolean;
258
277
  /**
259
278
  * Sets the given MRT configuration.
260
279
  *
@@ -322,6 +341,7 @@ declare class Renderer {
322
341
  * @return {RenderContext} The current render context.
323
342
  */
324
343
  _renderScene(scene: Scene, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
344
+ _setXRLayerSize(width: number, height: number): void;
325
345
  /**
326
346
  * The output pass performs tone mapping and color space conversion.
327
347
  *
@@ -657,6 +677,10 @@ declare class Renderer {
657
677
  * @return {?RenderTarget} The current output render target. Returns `null` if no output target is set.
658
678
  */
659
679
  getOutputRenderTarget(): RenderTarget<Texture> | null;
680
+ /**
681
+ * Resets the renderer to the initial state before WebXR started.
682
+ */
683
+ _resetXRState(): void;
660
684
  /**
661
685
  * Callback for {@link Renderer#setRenderObjectFunction}.
662
686
  *
@@ -116,13 +116,6 @@ declare class Textures extends DataMap<{
116
116
  * @return {boolean} Whether mipmaps are required or not.
117
117
  */
118
118
  needsMipmaps(texture: Texture): boolean;
119
- /**
120
- * Returns `true` if the given texture is an environment map.
121
- *
122
- * @param {Texture} texture - The texture.
123
- * @return {boolean} Whether the given texture is an environment map or not.
124
- */
125
- isEnvironmentTexture(texture: Texture): boolean;
126
119
  /**
127
120
  * Frees internal resource when the given texture isn't
128
121
  * required anymore.
@@ -23,6 +23,7 @@ declare abstract class TimestampQueryPool {
23
23
  *
24
24
  * @abstract
25
25
  * @param {Object} renderContext - The render context to allocate queries for.
26
+ * @returns {?number}
26
27
  */
27
28
  abstract allocateQueriesForContext(renderContext: RenderContext): number | null;
28
29
  /**
@@ -1,6 +1,7 @@
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 { RenderTarget } from "../../core/RenderTarget.js";
4
5
  import { CylinderGeometry } from "../../geometries/CylinderGeometry.js";
5
6
  import { PlaneGeometry } from "../../geometries/PlaneGeometry.js";
6
7
  import { Material } from "../../materials/Material.js";
@@ -11,6 +12,7 @@ import { Vector3 } from "../../math/Vector3.js";
11
12
  import { Mesh } from "../../objects/Mesh.js";
12
13
  import { WebXRController } from "../webxr/WebXRController.js";
13
14
  import { AnimationContext } from "./Animation.js";
15
+ import QuadMesh from "./QuadMesh.js";
14
16
  import Renderer from "./Renderer.js";
15
17
  import { XRRenderTarget } from "./XRRenderTarget.js";
16
18
  export interface XRManagerEventMap {
@@ -77,6 +79,12 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
77
79
  _xrRenderTarget: XRRenderTarget | null;
78
80
  _layers: XRLayerObject[];
79
81
  _supportsLayers: boolean;
82
+ _frameBufferTargets:
83
+ | WeakMap<XRRenderTarget, {
84
+ frameBufferTarget: RenderTarget | null;
85
+ quad: QuadMesh;
86
+ }>
87
+ | null;
80
88
  _createXRLayer: (layer: XRLayerObject) => XRLayer;
81
89
  _gl: WebGL2RenderingContext | null;
82
90
  _currentAnimationContext: AnimationContext | null;
@@ -98,12 +106,15 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
98
106
  _glProjLayer: XRProjectionLayer | null;
99
107
  _xrFrame: XRFrame | null;
100
108
  _useLayers: boolean;
109
+ _useMultiviewIfPossible: boolean;
110
+ _useMultiview: boolean;
101
111
  /**
102
112
  * Constructs a new XR manager.
103
113
  *
104
114
  * @param {Renderer} renderer - The renderer.
115
+ * @param {boolean} [multiview=false] - Enables multiview if the device supports it.
105
116
  */
106
- constructor(renderer: Renderer);
117
+ constructor(renderer: Renderer, multiview?: boolean);
107
118
  /**
108
119
  * Returns an instance of `THREE.Group` that represents the transformation
109
120
  * of a XR controller in target ray space. The requested controller is defined
@@ -202,6 +213,27 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
202
213
  * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session.
203
214
  */
204
215
  getFrame(): XRFrame | null;
216
+ /**
217
+ * Returns `true` if the engine renders to a multiview target.
218
+ *
219
+ * @return {boolean} Whether the engine renders to a multiview render target or not.
220
+ */
221
+ useMultiview(): boolean;
222
+ /**
223
+ * This method can be used in XR applications to create a quadratic layer that presents a separate
224
+ * rendered scene.
225
+ *
226
+ * @param {number} width - The width of the layer plane in world units.
227
+ * @param {number} height - The height of the layer plane in world units.
228
+ * @param {Vector3} translation - The position/translation of the layer plane in world units.
229
+ * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion.
230
+ * @param {number} pixelwidth - The width of the layer's render target in pixels.
231
+ * @param {number} pixelheight - The height of the layer's render target in pixels.
232
+ * @param {Function} rendercall - A callback function that renders the layer. Similar to code in
233
+ * the default animation loop, this method can be used to update/transform 3D object in the layer's scene.
234
+ * @param {Object} [attributes={}] - Allows to configure the layer's render target.
235
+ * @return {Mesh} A mesh representing the quadratic XR layer. This mesh should be added to the XR scene.
236
+ */
205
237
  createQuadLayer(
206
238
  width: number,
207
239
  height: number,
@@ -212,6 +244,22 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
212
244
  rendercall: () => void,
213
245
  attributes?: LayerAttributes,
214
246
  ): Mesh<PlaneGeometry, MeshBasicMaterial, import("../../core/Object3D.js").Object3DEventMap>;
247
+ /**
248
+ * This method can be used in XR applications to create a cylindrical layer that presents a separate
249
+ * rendered scene.
250
+ *
251
+ * @param {number} radius - The radius of the cylinder in world units.
252
+ * @param {number} centralAngle - The central angle of the cylinder in radians.
253
+ * @param {number} aspectratio - The aspect ratio.
254
+ * @param {Vector3} translation - The position/translation of the layer plane in world units.
255
+ * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion.
256
+ * @param {number} pixelwidth - The width of the layer's render target in pixels.
257
+ * @param {number} pixelheight - The height of the layer's render target in pixels.
258
+ * @param {Function} rendercall - A callback function that renders the layer. Similar to code in
259
+ * the default animation loop, this method can be used to update/transform 3D object in the layer's scene.
260
+ * @param {Object} [attributes={}] - Allows to configure the layer's render target.
261
+ * @return {Mesh} A mesh representing the cylindrical XR layer. This mesh should be added to the XR scene.
262
+ */
215
263
  createCylinderLayer(
216
264
  radius: number,
217
265
  centralAngle: number,
@@ -223,6 +271,12 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
223
271
  rendercall: () => void,
224
272
  attributes?: LayerAttributes,
225
273
  ): Mesh<CylinderGeometry, MeshBasicMaterial, import("../../core/Object3D.js").Object3DEventMap>;
274
+ /**
275
+ * Renders the XR layers that have been previously added to the scene.
276
+ *
277
+ * This method is usually called in your animation loop before rendering
278
+ * the actual scene via `renderer.render( scene, camera );`.
279
+ */
226
280
  renderLayers(): void;
227
281
  /**
228
282
  * Returns the current XR session.
@@ -5,6 +5,7 @@ import Backend, { BackendParameters } from "../common/Backend.js";
5
5
 
6
6
  export interface WebGPUBackendParameters extends BackendParameters {
7
7
  alpha?: boolean | undefined;
8
+ compatibilityMode?: boolean | undefined;
8
9
  requiredLimits?: Record<string, GPUSize64> | undefined;
9
10
  trackTimestamp?: boolean | undefined;
10
11
  device?: GPUDevice | undefined;
@@ -48,6 +48,7 @@ export default class WGSLNodeBuilder extends NodeBuilder {
48
48
  texture: Texture,
49
49
  textureProperty: string,
50
50
  uvIndexSnippet: string,
51
+ depthSnippet: string | null,
51
52
  valueSnippet: string,
52
53
  ): string;
53
54
  isUnfilterable(texture: Texture): boolean;
@@ -225,7 +225,7 @@ export enum GPUBlendFactor {
225
225
  SrcAlpha = "src-alpha",
226
226
  OneMinusSrcAlpha = "one-minus-src-alpha",
227
227
  Dst = "dst",
228
- OneMinusDstColor = "one-minus-dst",
228
+ OneMinusDst = "one-minus-dst",
229
229
  DstAlpha = "dst-alpha",
230
230
  OneMinusDstAlpha = "one-minus-dst-alpha",
231
231
  SrcAlphaSaturated = "src-alpha-saturated",
@@ -28,6 +28,7 @@ export class DepthTexture extends Texture {
28
28
  * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.NearestFilter}
29
29
  * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
30
30
  * @param format See {@link DepthTexture.format | .format}. Default {@link THREE.DepthFormat}
31
+ * @param {number} [depth=1] - The depth of the texture.
31
32
  */
32
33
  constructor(
33
34
  width: number,
@@ -40,6 +41,7 @@ export class DepthTexture extends Texture {
40
41
  minFilter?: MinificationTextureFilter,
41
42
  anisotropy?: number,
42
43
  format?: DepthTexturePixelFormat,
44
+ depth?: number,
43
45
  );
44
46
 
45
47
  /**
@@ -53,8 +55,8 @@ export class DepthTexture extends Texture {
53
55
  * Overridden with a record type holding width and height.
54
56
  * @override
55
57
  */
56
- get image(): { width: number; height: number };
57
- set image(value: { width: number; height: number });
58
+ get image(): { width: number; height: number; depth: number };
59
+ set image(value: { width: number; height: number; depth: number });
58
60
 
59
61
  /**
60
62
  * @override