@types/three 0.176.0 → 0.178.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 (214) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -1
  3. three/examples/jsm/capabilities/WebGL.d.ts +0 -11
  4. three/examples/jsm/controls/TransformControls.d.ts +16 -1
  5. three/examples/jsm/helpers/TextureHelper.d.ts +2 -2
  6. three/examples/jsm/helpers/TextureHelperGPU.d.ts +2 -2
  7. three/examples/jsm/loaders/LDrawLoader.d.ts +8 -3
  8. three/examples/jsm/loaders/SVGLoader.d.ts +1 -1
  9. three/examples/jsm/math/Octree.d.ts +3 -0
  10. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  11. three/examples/jsm/postprocessing/AfterimagePass.d.ts +13 -10
  12. three/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  13. three/examples/jsm/transpiler/AST.d.ts +77 -26
  14. three/examples/jsm/transpiler/TSLEncoder.d.ts +9 -3
  15. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +4 -4
  16. three/examples/jsm/tsl/display/BleachBypass.d.ts +2 -2
  17. three/examples/jsm/tsl/display/BloomNode.d.ts +2 -2
  18. three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +20 -0
  19. three/examples/jsm/tsl/display/DenoiseNode.d.ts +4 -4
  20. three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +6 -6
  21. three/examples/jsm/tsl/display/DotScreenNode.d.ts +2 -2
  22. three/examples/jsm/tsl/display/FXAANode.d.ts +3 -3
  23. three/examples/jsm/tsl/display/FilmNode.d.ts +4 -4
  24. three/examples/jsm/tsl/display/GTAONode.d.ts +3 -3
  25. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +5 -5
  26. three/examples/jsm/tsl/display/LensflareNode.d.ts +8 -8
  27. three/examples/jsm/tsl/display/Lut3DNode.d.ts +4 -4
  28. three/examples/jsm/tsl/display/MotionBlur.d.ts +4 -4
  29. three/examples/jsm/tsl/display/OutlineNode.d.ts +3 -3
  30. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +3 -3
  31. three/examples/jsm/tsl/display/SMAANode.d.ts +3 -3
  32. three/examples/jsm/tsl/display/SSRNode.d.ts +5 -5
  33. three/examples/jsm/tsl/display/Sepia.d.ts +2 -2
  34. three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +3 -3
  35. three/examples/jsm/tsl/display/TransitionNode.d.ts +4 -4
  36. three/examples/jsm/tsl/display/hashBlur.d.ts +10 -4
  37. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +5 -5
  38. three/package.json +3 -3
  39. three/src/Three.Core.d.ts +0 -2
  40. three/src/Three.TSL.d.ts +11 -18
  41. three/src/Three.WebGPU.Nodes.d.ts +1 -0
  42. three/src/Three.WebGPU.d.ts +3 -0
  43. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  44. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  45. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  46. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  47. three/src/constants.d.ts +13 -5
  48. three/src/core/BufferGeometry.d.ts +11 -2
  49. three/src/core/GLBufferAttribute.d.ts +18 -1
  50. three/src/core/RenderTarget.d.ts +3 -20
  51. three/src/extras/DataUtils.d.ts +4 -4
  52. three/src/geometries/CapsuleGeometry.d.ts +1 -0
  53. three/src/helpers/AxesHelper.d.ts +3 -1
  54. three/src/lights/SpotLightShadow.d.ts +2 -0
  55. three/src/lights/webgpu/ProjectorLight.d.ts +17 -0
  56. three/src/materials/LineBasicMaterial.d.ts +66 -34
  57. three/src/materials/LineDashedMaterial.d.ts +41 -21
  58. three/src/materials/Material.d.ts +408 -398
  59. three/src/materials/MeshBasicMaterial.d.ts +101 -62
  60. three/src/materials/MeshDepthMaterial.d.ts +71 -32
  61. three/src/materials/MeshDistanceMaterial.d.ts +65 -29
  62. three/src/materials/MeshLambertMaterial.d.ts +179 -103
  63. three/src/materials/MeshMatcapMaterial.d.ts +97 -55
  64. three/src/materials/MeshNormalMaterial.d.ts +76 -41
  65. three/src/materials/MeshPhongMaterial.d.ts +164 -100
  66. three/src/materials/MeshPhysicalMaterial.d.ts +164 -116
  67. three/src/materials/MeshStandardMaterial.d.ts +178 -91
  68. three/src/materials/MeshToonMaterial.d.ts +130 -81
  69. three/src/materials/PointsMaterial.d.ts +77 -30
  70. three/src/materials/RawShaderMaterial.d.ts +12 -7
  71. three/src/materials/ShaderMaterial.d.ts +186 -98
  72. three/src/materials/ShadowMaterial.d.ts +49 -23
  73. three/src/materials/SpriteMaterial.d.ts +62 -33
  74. three/src/materials/nodes/Line2NodeMaterial.d.ts +87 -40
  75. three/src/materials/nodes/LineBasicNodeMaterial.d.ts +35 -16
  76. three/src/materials/nodes/LineDashedNodeMaterial.d.ts +75 -20
  77. three/src/materials/nodes/MeshBasicNodeMaterial.d.ts +49 -30
  78. three/src/materials/nodes/MeshLambertNodeMaterial.d.ts +49 -42
  79. three/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +38 -26
  80. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +36 -22
  81. three/src/materials/nodes/MeshPhongNodeMaterial.d.ts +68 -48
  82. three/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +240 -65
  83. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +99 -3
  84. three/src/materials/nodes/MeshStandardNodeMaterial.d.ts +83 -47
  85. three/src/materials/nodes/MeshToonNodeMaterial.d.ts +42 -36
  86. three/src/materials/nodes/NodeMaterial.d.ts +418 -55
  87. three/src/materials/nodes/NodeMaterials.d.ts +3 -2
  88. three/src/materials/nodes/PointsNodeMaterial.d.ts +31 -7
  89. three/src/materials/nodes/ShadowNodeMaterial.d.ts +38 -11
  90. three/src/materials/nodes/SpriteNodeMaterial.d.ts +68 -18
  91. three/src/materials/nodes/VolumeNodeMaterial.d.ts +50 -14
  92. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +4 -0
  93. three/src/math/Box3.d.ts +8 -0
  94. three/src/math/Color.d.ts +1 -1
  95. three/src/math/ColorManagement.d.ts +12 -2
  96. three/src/math/Sphere.d.ts +8 -0
  97. three/src/math/Triangle.d.ts +3 -3
  98. three/src/nodes/Nodes.d.ts +2 -3
  99. three/src/nodes/TSL.d.ts +4 -3
  100. three/src/nodes/accessors/AccessorsUtils.d.ts +3 -3
  101. three/src/nodes/accessors/Bitangent.d.ts +0 -2
  102. three/src/nodes/accessors/CubeTextureNode.d.ts +16 -5
  103. three/src/nodes/accessors/Normal.d.ts +19 -5
  104. three/src/nodes/accessors/ReferenceBaseNode.d.ts +1 -1
  105. three/src/nodes/accessors/StorageBufferNode.d.ts +3 -2
  106. three/src/nodes/accessors/StorageTextureNode.d.ts +5 -5
  107. three/src/nodes/accessors/Tangent.d.ts +0 -2
  108. three/src/nodes/accessors/TangentUtils.d.ts +22 -0
  109. three/src/nodes/accessors/Texture3DNode.d.ts +5 -4
  110. three/src/nodes/accessors/TextureBicubic.d.ts +4 -2
  111. three/src/nodes/accessors/TextureNode.d.ts +24 -19
  112. three/src/nodes/accessors/TextureSizeNode.d.ts +3 -3
  113. three/src/nodes/accessors/UniformArrayNode.d.ts +2 -7
  114. three/src/nodes/code/FunctionCallNode.d.ts +3 -1
  115. three/src/nodes/code/FunctionNode.d.ts +2 -2
  116. three/src/nodes/code/ScriptableNode.d.ts +2 -2
  117. three/src/nodes/core/AssignNode.d.ts +7 -3
  118. three/src/nodes/core/AttributeNode.d.ts +1 -1
  119. three/src/nodes/core/BypassNode.d.ts +2 -2
  120. three/src/nodes/core/CacheNode.d.ts +1 -0
  121. three/src/nodes/core/ContextNode.d.ts +3 -3
  122. three/src/nodes/core/Node.d.ts +5 -4
  123. three/src/nodes/core/NodeUtils.d.ts +4 -0
  124. three/src/nodes/core/StackNode.d.ts +3 -13
  125. three/src/nodes/core/SubBuildNode.d.ts +15 -0
  126. three/src/nodes/core/VarNode.d.ts +4 -4
  127. three/src/nodes/core/VaryingNode.d.ts +3 -3
  128. three/src/nodes/display/BlendModes.d.ts +14 -10
  129. three/src/nodes/display/BumpMapNode.d.ts +4 -3
  130. three/src/nodes/display/ColorAdjustment.d.ts +17 -17
  131. three/src/nodes/display/ColorSpaceFunctions.d.ts +3 -3
  132. three/src/nodes/display/ColorSpaceNode.d.ts +6 -16
  133. three/src/nodes/display/FrontFacingNode.d.ts +1 -0
  134. three/src/nodes/display/PosterizeNode.d.ts +3 -3
  135. three/src/nodes/display/RenderOutputNode.d.ts +2 -2
  136. three/src/nodes/display/ScreenNode.d.ts +0 -10
  137. three/src/nodes/display/ToneMappingFunctions.d.ts +7 -7
  138. three/src/nodes/display/ToneMappingNode.d.ts +6 -6
  139. three/src/nodes/display/ViewportDepthTextureNode.d.ts +3 -3
  140. three/src/nodes/fog/Fog.d.ts +10 -10
  141. three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +4 -4
  142. three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +2 -2
  143. three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +4 -4
  144. three/src/nodes/geometry/RangeNode.d.ts +9 -2
  145. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +20 -20
  146. three/src/nodes/gpgpu/ComputeNode.d.ts +2 -2
  147. three/src/nodes/lighting/PointShadowNode.d.ts +11 -11
  148. three/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  149. three/src/nodes/lighting/ShadowFilterNode.d.ts +11 -11
  150. three/src/nodes/lighting/SpotLightNode.d.ts +15 -1
  151. three/src/nodes/materialx/MaterialXNodes.d.ts +59 -59
  152. three/src/nodes/materialx/lib/mx_hsv.d.ts +3 -3
  153. three/src/nodes/materialx/lib/mx_noise.d.ts +206 -206
  154. three/src/nodes/materialx/lib/mx_transform_color.d.ts +2 -2
  155. three/src/nodes/math/ConditionalNode.d.ts +4 -19
  156. three/src/nodes/math/Hash.d.ts +2 -2
  157. three/src/nodes/math/MathNode.d.ts +21 -17
  158. three/src/nodes/math/OperatorNode.d.ts +41 -52
  159. three/src/nodes/math/TriNoise3D.d.ts +6 -6
  160. three/src/nodes/pmrem/PMREMNode.d.ts +3 -3
  161. three/src/nodes/pmrem/PMREMUtils.d.ts +20 -20
  162. three/src/nodes/procedural/Checker.d.ts +2 -2
  163. three/src/nodes/shapes/Shapes.d.ts +2 -2
  164. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  165. three/src/nodes/tsl/TSLCore.d.ts +186 -81
  166. three/src/nodes/utils/CubeMapNode.d.ts +2 -2
  167. three/src/nodes/utils/DebugNode.d.ts +2 -2
  168. three/src/nodes/utils/Discard.d.ts +2 -2
  169. three/src/nodes/utils/EquirectUV.d.ts +4 -0
  170. three/src/nodes/utils/LoopNode.d.ts +2 -7
  171. three/src/nodes/utils/MatcapUV.d.ts +4 -0
  172. three/src/nodes/utils/Oscillators.d.ts +5 -5
  173. three/src/nodes/utils/Packing.d.ts +3 -3
  174. three/src/nodes/utils/PostProcessingUtils.d.ts +9 -9
  175. three/src/nodes/utils/RTTNode.d.ts +3 -3
  176. three/src/nodes/utils/ReflectorNode.d.ts +1 -0
  177. three/src/nodes/utils/RemapNode.d.ts +9 -9
  178. three/src/nodes/utils/RotateNode.d.ts +3 -3
  179. three/src/nodes/utils/SampleNode.d.ts +16 -0
  180. three/src/nodes/utils/SpriteSheetUVNode.d.ts +4 -4
  181. three/src/nodes/utils/SpriteUtils.d.ts +2 -2
  182. three/src/nodes/utils/StorageArrayElementNode.d.ts +4 -3
  183. three/src/nodes/utils/TriplanarTextures.d.ts +20 -0
  184. three/src/nodes/utils/UVUtils.d.ts +8 -7
  185. three/src/nodes/utils/ViewportUtils.d.ts +2 -2
  186. three/src/objects/LOD.d.ts +1 -1
  187. three/src/objects/Mesh.d.ts +8 -0
  188. three/src/objects/Sprite.d.ts +8 -0
  189. three/src/renderers/WebGLRenderer.d.ts +3 -3
  190. three/src/renderers/common/Backend.d.ts +3 -3
  191. three/src/renderers/common/RenderObject.d.ts +10 -2
  192. three/src/renderers/common/Renderer.d.ts +10 -5
  193. three/src/renderers/common/Storage3DTexture.d.ts +40 -0
  194. three/src/renderers/common/StorageArrayTexture.d.ts +29 -0
  195. three/src/renderers/common/Textures.d.ts +2 -2
  196. three/src/renderers/common/XRManager.d.ts +45 -0
  197. three/src/renderers/common/XRRenderTarget.d.ts +3 -2
  198. three/src/renderers/common/nodes/NodeLibrary.d.ts +4 -9
  199. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +1 -1
  200. three/src/renderers/common/nodes/Nodes.d.ts +1 -1
  201. three/src/renderers/webgpu/WebGPURenderer.d.ts +3 -0
  202. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +65 -0
  203. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -0
  204. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +10 -1
  205. three/src/textures/DepthTexture.d.ts +4 -2
  206. three/src/textures/Source.d.ts +20 -16
  207. three/src/textures/Texture.d.ts +69 -2
  208. three/examples/jsm/effects/PeppersGhostEffect.d.ts +0 -10
  209. three/src/core/RenderTargetArray.d.ts +0 -9
  210. three/src/nodes/utils/EquirectUVNode.d.ts +0 -8
  211. three/src/nodes/utils/MatcapUVNode.d.ts +0 -8
  212. three/src/nodes/utils/TriplanarTexturesNode.d.ts +0 -36
  213. three/src/renderers/common/nodes/StandardNodeLibrary.d.ts +0 -5
  214. three/src/textures/DepthArrayTexture.d.ts +0 -14
@@ -0,0 +1,20 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const triplanarTextures: (
5
+ textureXNode: Node,
6
+ textureYNode?: Node | null,
7
+ textureZNode?: Node | null,
8
+ scaleNode?: Node,
9
+ positionNode?: Node,
10
+ normalNode?: Node,
11
+ ) => ShaderNodeObject<Node>;
12
+
13
+ export const triplanarTexture: (
14
+ textureXNode: Node,
15
+ textureYNode?: Node | null,
16
+ textureZNode?: Node | null,
17
+ scaleNode?: Node,
18
+ positionNode?: Node,
19
+ normalNode?: Node,
20
+ ) => ShaderNodeObject<Node>;
@@ -1,14 +1,15 @@
1
+ import Node from "../core/Node.js";
1
2
  import OperatorNode from "../math/OperatorNode.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
4
 
4
5
  export const rotateUV: (
5
- uv: NodeRepresentation,
6
- rotation: NodeRepresentation,
7
- center?: NodeRepresentation,
6
+ uv: Node,
7
+ rotation: Node,
8
+ center?: Node,
8
9
  ) => ShaderNodeObject<OperatorNode>;
9
10
 
10
11
  export const spherizeUV: (
11
- uv: NodeRepresentation,
12
- strength: NodeRepresentation,
13
- center?: NodeRepresentation,
12
+ uv: Node,
13
+ strength: Node | number,
14
+ center?: Node,
14
15
  ) => ShaderNodeObject<OperatorNode>;
@@ -1,4 +1,4 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const viewportSafeUV: (uv?: NodeRepresentation | null) => ShaderNodeObject<Node>;
4
+ export const viewportSafeUV: (uv?: Node | null) => ShaderNodeObject<Node>;
@@ -87,7 +87,7 @@ export class LOD<TEventMap extends Object3DEventMap = Object3DEventMap> extends
87
87
  * Otherwise `false`.
88
88
  * @param distance Distance of the level to delete.
89
89
  */
90
- removeLabel(distance: number): boolean;
90
+ removeLevel(distance: number): boolean;
91
91
 
92
92
  /**
93
93
  * Get the currently active {@link LOD} level
@@ -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
  /**
@@ -463,7 +463,7 @@ export class WebGLRenderer {
463
463
  * position. The `depthTexture` and `texture` property of 3D render targets are supported as well.
464
464
  *
465
465
  * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are
466
- * intitialized e.g. via {@link .initRenderTarget}().
466
+ * initialized e.g. via {@link .initRenderTarget}().
467
467
  *
468
468
  * @param srcTexture Specifies the source texture.
469
469
  * @param dstTexture Specifies the destination texture.
@@ -13,12 +13,12 @@ declare module "../../core/Object3D.js" {
13
13
  }
14
14
 
15
15
  export interface BackendParameters {
16
- canvas?: HTMLCanvasElement | undefined;
16
+ canvas?: HTMLCanvasElement | OffscreenCanvas | undefined;
17
17
  }
18
18
 
19
19
  export default abstract class Backend {
20
20
  renderer: Renderer | null;
21
- domElement: HTMLCanvasElement | null;
21
+ domElement: HTMLCanvasElement | OffscreenCanvas | null;
22
22
 
23
23
  constructor(parameters?: BackendParameters);
24
24
 
@@ -26,5 +26,5 @@ export default abstract class Backend {
26
26
 
27
27
  abstract get coordinateSystem(): CoordinateSystem;
28
28
 
29
- getDomElement(): HTMLCanvasElement;
29
+ getDomElement(): HTMLCanvasElement | OffscreenCanvas;
30
30
  }
@@ -53,7 +53,14 @@ declare class RenderObject {
53
53
  count: number;
54
54
  } | null;
55
55
  attributes: Array<BufferAttribute | InterleavedBufferAttribute> | null;
56
+ attributesId: {
57
+ [attributeName: string]: number;
58
+ } | null;
56
59
  pipeline: RenderPipeline | null;
60
+ group: {
61
+ start: number;
62
+ count: number;
63
+ } | null;
57
64
  vertexBuffers: Array<BufferAttribute | InterleavedBuffer> | null;
58
65
  drawParams: {
59
66
  vertexCount: number;
@@ -64,14 +71,15 @@ declare class RenderObject {
64
71
  bundle: BundleGroup | null;
65
72
  clippingContext: ClippingContext | null;
66
73
  clippingContextCacheKey: string;
67
- initialNodesCacheKey: string;
68
- initialCacheKey: string;
74
+ initialNodesCacheKey: number;
75
+ initialCacheKey: number;
69
76
  _nodeBuilderState: NodeBuilderState | null;
70
77
  _bindings: BindGroup[] | null;
71
78
  _monitor: NodeMaterialObserver | null;
72
79
  onDispose: (() => void) | null;
73
80
  readonly isRenderObject: true;
74
81
  onMaterialDispose: () => void;
82
+ onGeometryDispose: () => void;
75
83
  /**
76
84
  * Constructs a new render object.
77
85
  *
@@ -239,7 +239,7 @@ declare class Renderer {
239
239
  * @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.
240
240
  * @return {Promise<Array|undefined>} A Promise that resolves when the compile has been finished.
241
241
  */
242
- compileAsync(scene: Object3D, camera: Camera, targetScene?: Object3D | null): Promise<void>;
242
+ compileAsync(scene: Object3D, camera: Camera, targetScene?: Scene | null): Promise<void>;
243
243
  /**
244
244
  * Renders the scene in an async fashion.
245
245
  *
@@ -248,7 +248,7 @@ declare class Renderer {
248
248
  * @param {Camera} camera - The camera.
249
249
  * @return {Promise} A Promise that resolves when the render has been finished.
250
250
  */
251
- renderAsync(scene: Scene, camera: Camera): Promise<void>;
251
+ renderAsync(scene: Object3D, camera: Camera): Promise<void>;
252
252
  /**
253
253
  * Can be used to synchronize CPU operations with GPU tasks. So when this method is called,
254
254
  * the CPU waits for the GPU to complete its operation (e.g. a compute task).
@@ -321,7 +321,7 @@ declare class Renderer {
321
321
  * @return {?Promise} A Promise that resolve when the scene has been rendered.
322
322
  * Only returned when the renderer has not been initialized.
323
323
  */
324
- render(scene: Scene, camera: Camera): Promise<void> | undefined;
324
+ render(scene: Object3D, camera: Camera): Promise<void> | undefined;
325
325
  /**
326
326
  * Returns an internal render target which is used when computing the output tone mapping
327
327
  * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render
@@ -340,7 +340,8 @@ declare class Renderer {
340
340
  * @param {boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not.
341
341
  * @return {RenderContext} The current render context.
342
342
  */
343
- _renderScene(scene: Scene, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
343
+ _renderScene(scene: Object3D, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
344
+ _setXRLayerSize(width: number, height: number): void;
344
345
  /**
345
346
  * The output pass performs tone mapping and color space conversion.
346
347
  *
@@ -676,6 +677,10 @@ declare class Renderer {
676
677
  * @return {?RenderTarget} The current output render target. Returns `null` if no output target is set.
677
678
  */
678
679
  getOutputRenderTarget(): RenderTarget<Texture> | null;
680
+ /**
681
+ * Resets the renderer to the initial state before WebXR started.
682
+ */
683
+ _resetXRState(): void;
679
684
  /**
680
685
  * Callback for {@link Renderer#setRenderObjectFunction}.
681
686
  *
@@ -978,6 +983,6 @@ declare class Renderer {
978
983
  * @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.
979
984
  * @return {function(Object3D, Camera, ?Scene): Promise|undefined} A Promise that resolves when the compile has been finished.
980
985
  */
981
- get compile(): (scene: Object3D, camera: Camera, targetScene?: Object3D | null) => Promise<void>;
986
+ get compile(): (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Promise<void>;
982
987
  }
983
988
  export default Renderer;
@@ -0,0 +1,40 @@
1
+ import { Wrapping } from "../../constants.js";
2
+ import { Texture } from "../../textures/Texture.js";
3
+
4
+ /**
5
+ * This special type of texture is intended for compute shaders.
6
+ * It can be used to compute the data of a texture with a compute shader.
7
+ *
8
+ * Note: This type of texture can only be used with `WebGPURenderer`
9
+ * and a WebGPU backend.
10
+ */
11
+ declare class Storage3DTexture extends Texture {
12
+ /**
13
+ * This defines how the texture is wrapped in the depth direction and corresponds to
14
+ * *W* in UVW mapping.
15
+ */
16
+ wrapR: Wrapping;
17
+
18
+ /**
19
+ * This flag can be used for type testing.
20
+ *
21
+ * @default true
22
+ */
23
+ readonly isStorageTexture: true;
24
+
25
+ /**
26
+ * Indicates whether this texture is a 3D texture.
27
+ */
28
+ is3DTexture: boolean;
29
+
30
+ /**
31
+ * Constructs a new storage texture.
32
+ *
33
+ * @param {number} [width=1] - The storage texture's width.
34
+ * @param {number} [height=1] - The storage texture's height.
35
+ * @param {number} [depth=1] - The storage texture's depth.
36
+ */
37
+ constructor(width?: number, height?: number, depth?: number);
38
+ }
39
+
40
+ export default Storage3DTexture;
@@ -0,0 +1,29 @@
1
+ import { Wrapping } from "../../constants.js";
2
+ import { Texture } from "../../textures/Texture.js";
3
+
4
+ /**
5
+ * This special type of texture is intended for compute shaders.
6
+ * It can be used to compute the data of a texture with a compute shader.
7
+ *
8
+ * Note: This type of texture can only be used with `WebGPURenderer`
9
+ * and a WebGPU backend.
10
+ */
11
+ declare class Storage3DTexture extends Texture {
12
+ /**
13
+ * This flag can be used for type testing.
14
+ *
15
+ * @default true
16
+ */
17
+ readonly isStorageTexture: true;
18
+
19
+ /**
20
+ * Constructs a new storage texture.
21
+ *
22
+ * @param {number} [width=1] - The storage texture's width.
23
+ * @param {number} [height=1] - The storage texture's height.
24
+ * @param {number} [depth=1] - The storage texture's depth.
25
+ */
26
+ constructor(width?: number, height?: number, depth?: number);
27
+ }
28
+
29
+ export default Storage3DTexture;
@@ -6,7 +6,7 @@ import Backend from "./Backend.js";
6
6
  import DataMap from "./DataMap.js";
7
7
  import Info from "./Info.js";
8
8
  import Renderer from "./Renderer.js";
9
- type SizeVector3Unitialized = Vector3 & {
9
+ type SizeVector3Uninitialized = Vector3 & {
10
10
  width?: number;
11
11
  height?: number;
12
12
  depth?: number;
@@ -99,7 +99,7 @@ declare class Textures extends DataMap<{
99
99
  * @param {Vector3} target - The target vector.
100
100
  * @return {Vector3} The target vector.
101
101
  */
102
- getSize(texture: Texture, target?: SizeVector3Unitialized): SizeVector3;
102
+ getSize(texture: Texture, target?: SizeVector3Uninitialized): SizeVector3;
103
103
  /**
104
104
  * Computes the number of mipmap levels for the given texture.
105
105
  *
@@ -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;
@@ -211,6 +219,21 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
211
219
  * @return {boolean} Whether the engine renders to a multiview render target or not.
212
220
  */
213
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
+ */
214
237
  createQuadLayer(
215
238
  width: number,
216
239
  height: number,
@@ -221,6 +244,22 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
221
244
  rendercall: () => void,
222
245
  attributes?: LayerAttributes,
223
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
+ */
224
263
  createCylinderLayer(
225
264
  radius: number,
226
265
  centralAngle: number,
@@ -232,6 +271,12 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
232
271
  rendercall: () => void,
233
272
  attributes?: LayerAttributes,
234
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
+ */
235
280
  renderLayers(): void;
236
281
  /**
237
282
  * Returns the current XR session.
@@ -8,8 +8,9 @@ import { RenderTarget, RenderTargetOptions } from "../../core/RenderTarget.js";
8
8
  */
9
9
  declare class XRRenderTarget extends RenderTarget {
10
10
  readonly isXRRenderTarget: true;
11
- hasExternalTextures: boolean;
12
- autoAllocateDepthBuffer: boolean;
11
+ _hasExternalTextures: boolean;
12
+ _autoAllocateDepthBuffer: boolean;
13
+ _isOpaqueFramebuffer: boolean;
13
14
  /**
14
15
  * Constructs a new XR render target.
15
16
  *
@@ -4,7 +4,7 @@ import { Material } from "../../../materials/Material.js";
4
4
  import NodeMaterial from "../../../materials/nodes/NodeMaterial.js";
5
5
  import Node from "../../../nodes/core/Node.js";
6
6
  import AnalyticLightNode from "../../../nodes/lighting/AnalyticLightNode.js";
7
- import { NodeRepresentation, ShaderNodeObject } from "../../../nodes/tsl/TSLCore.js";
7
+ import { ShaderNodeObject } from "../../../nodes/tsl/TSLCore.js";
8
8
  /**
9
9
  * The purpose of a node library is to assign node implementations
10
10
  * to existing library features. In `WebGPURenderer` lights, materials
@@ -22,10 +22,7 @@ declare class NodeLibrary {
22
22
  materialNodes: Map<string, {
23
23
  new(): NodeMaterial;
24
24
  }>;
25
- toneMappingNodes: Map<
26
- ToneMapping,
27
- (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>
28
- >;
25
+ toneMappingNodes: Map<ToneMapping, (color: Node, exposure: Node) => ShaderNodeObject<Node>>;
29
26
  /**
30
27
  * Constructs a new node library.
31
28
  */
@@ -48,7 +45,7 @@ declare class NodeLibrary {
48
45
  * @param {number} toneMapping - The tone mapping.
49
46
  */
50
47
  addToneMapping(
51
- toneMappingNode: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>,
48
+ toneMappingNode: (color: Node, exposure: Node) => ShaderNodeObject<Node>,
52
49
  toneMapping: ToneMapping,
53
50
  ): void;
54
51
  /**
@@ -57,9 +54,7 @@ declare class NodeLibrary {
57
54
  * @param {number} toneMapping - The tone mapping.
58
55
  * @return {?Function} The tone mapping node function. Returns `null` if no node function is found.
59
56
  */
60
- getToneMappingFunction(
61
- toneMapping: ToneMapping,
62
- ): ((color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>) | null;
57
+ getToneMappingFunction(toneMapping: ToneMapping): ((color: Node, exposure: Node) => ShaderNodeObject<Node>) | null;
63
58
  /**
64
59
  * Returns a node material class definition for a material type.
65
60
  *
@@ -23,7 +23,7 @@ declare class NodeSampledCubeTexture extends NodeSampledTexture {
23
23
  }
24
24
 
25
25
  declare class NodeSampledTexture3D extends NodeSampledTexture {
26
- readonly isSampledTexture3D = true;
26
+ readonly isSampledTexture3D: true;
27
27
  }
28
28
 
29
29
  export { NodeSampledCubeTexture, NodeSampledTexture, NodeSampledTexture3D };
@@ -106,7 +106,7 @@ declare class Nodes extends DataMap<{
106
106
  * @param {RenderObject} renderObject - The render object.
107
107
  * @return {number} The cache key.
108
108
  */
109
- getForRenderCacheKey(renderObject: RenderObject): string;
109
+ getForRenderCacheKey(renderObject: RenderObject): number;
110
110
  /**
111
111
  * Returns a node builder state for the given render object.
112
112
  *
@@ -1,4 +1,5 @@
1
1
  import Renderer, { RendererParameters } from "../common/Renderer.js";
2
+ import StandardNodeLibrary from "./nodes/StandardNodeLibrary.js";
2
3
  import { WebGPUBackendParameters } from "./WebGPUBackend.js";
3
4
 
4
5
  export interface WebGPURendererParameters extends RendererParameters, WebGPUBackendParameters {
@@ -6,6 +7,8 @@ export interface WebGPURendererParameters extends RendererParameters, WebGPUBack
6
7
  }
7
8
 
8
9
  declare class WebGPURenderer extends Renderer {
10
+ library: StandardNodeLibrary;
11
+
9
12
  readonly isWebGPURenderer: true;
10
13
 
11
14
  constructor(parameters?: WebGPURendererParameters);
@@ -1,3 +1,16 @@
1
+ import { LineBasicNodeMaterialNodeProperties } from "../../../materials/nodes/LineBasicNodeMaterial.js";
2
+ import { LineDashedNodeMaterialNodeProperties } from "../../../materials/nodes/LineDashedNodeMaterial.js";
3
+ import { MeshBasicNodeMaterialNodeProperties } from "../../../materials/nodes/MeshBasicNodeMaterial.js";
4
+ import { MeshLambertNodeMaterialNodeProperties } from "../../../materials/nodes/MeshLambertNodeMaterial.js";
5
+ import { MeshMatcapNodeMaterialNodeProperties } from "../../../materials/nodes/MeshMatcapNodeMaterial.js";
6
+ import { MeshNormalNodeMaterialNodeProperties } from "../../../materials/nodes/MeshNormalNodeMaterial.js";
7
+ import { MeshPhongNodeMaterialNodeProperties } from "../../../materials/nodes/MeshPhongNodeMaterial.js";
8
+ import { MeshPhysicalNodeMaterialNodeProperties } from "../../../materials/nodes/MeshPhysicalNodeMaterial.js";
9
+ import { MeshStandardNodeMaterialNodeProperties } from "../../../materials/nodes/MeshStandardNodeMaterial.js";
10
+ import { MeshToonNodeMaterialNodeProperties } from "../../../materials/nodes/MeshToonNodeMaterial.js";
11
+ import { PointsNodeMaterialNodeProperties } from "../../../materials/nodes/PointsNodeMaterial.js";
12
+ import { ShadowNodeMaterialNodeProperties } from "../../../materials/nodes/ShadowNodeMaterial.js";
13
+ import { SpriteNodeMaterialNodeProperties } from "../../../materials/nodes/SpriteNodeMaterial.js";
1
14
  import NodeLibrary from "../../common/nodes/NodeLibrary.js";
2
15
  /**
3
16
  * This version of a node library represents the standard version
@@ -13,4 +26,56 @@ declare class StandardNodeLibrary extends NodeLibrary {
13
26
  */
14
27
  constructor();
15
28
  }
29
+ declare module "../../../materials/MeshPhongMaterial.js" {
30
+ interface MeshPhongMaterialProperties extends MeshPhongNodeMaterialNodeProperties {
31
+ }
32
+ }
33
+ declare module "../../../materials/MeshStandardMaterial.js" {
34
+ interface MeshStandardMaterialProperties extends MeshStandardNodeMaterialNodeProperties {
35
+ }
36
+ }
37
+ declare module "../../../materials/MeshPhysicalMaterial.js" {
38
+ interface MeshPhysicalMaterialProperties extends MeshPhysicalNodeMaterialNodeProperties {
39
+ }
40
+ }
41
+ declare module "../../../materials/MeshToonMaterial.js" {
42
+ interface MeshToonMaterialProperties extends MeshToonNodeMaterialNodeProperties {
43
+ }
44
+ }
45
+ declare module "../../../materials/MeshBasicMaterial.js" {
46
+ interface MeshBasicMaterialProperties extends MeshBasicNodeMaterialNodeProperties {
47
+ }
48
+ }
49
+ declare module "../../../materials/MeshLambertMaterial.js" {
50
+ interface MeshLambertMaterialProperties extends MeshLambertNodeMaterialNodeProperties {
51
+ }
52
+ }
53
+ declare module "../../../materials/MeshNormalMaterial.js" {
54
+ interface MeshNormalMaterialProperties extends MeshNormalNodeMaterialNodeProperties {
55
+ }
56
+ }
57
+ declare module "../../../materials/MeshMatcapMaterial.js" {
58
+ interface MeshMatcapMaterialProperties extends MeshMatcapNodeMaterialNodeProperties {
59
+ }
60
+ }
61
+ declare module "../../../materials/LineBasicMaterial.js" {
62
+ interface LineBasicMaterialProperties extends LineBasicNodeMaterialNodeProperties {
63
+ }
64
+ }
65
+ declare module "../../../materials/LineDashedMaterial.js" {
66
+ interface LineDashedMaterialProperties extends LineDashedNodeMaterialNodeProperties {
67
+ }
68
+ }
69
+ declare module "../../../materials/PointsMaterial.js" {
70
+ interface PointsMaterialProperties extends PointsNodeMaterialNodeProperties {
71
+ }
72
+ }
73
+ declare module "../../../materials/SpriteMaterial.js" {
74
+ interface SpriteMaterialProperties extends SpriteNodeMaterialNodeProperties {
75
+ }
76
+ }
77
+ declare module "../../../materials/ShadowMaterial.js" {
78
+ interface ShadowMaterialProperties extends ShadowNodeMaterialNodeProperties {
79
+ }
80
+ }
16
81
  export default StandardNodeLibrary;
@@ -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",
@@ -314,15 +314,24 @@ export enum GPUInputStepMode {
314
314
  }
315
315
 
316
316
  export enum GPUFeatureName {
317
+ CoreFeaturesAndLimits = "core-features-and-limits",
317
318
  DepthClipControl = "depth-clip-control",
318
319
  Depth32FloatStencil8 = "depth32float-stencil8",
319
320
  TextureCompressionBC = "texture-compression-bc",
321
+ TextureCompressionBCSliced3D = "texture-compression-bc-sliced-3d",
320
322
  TextureCompressionETC2 = "texture-compression-etc2",
321
323
  TextureCompressionASTC = "texture-compression-astc",
324
+ TextureCompressionASTCSliced3D = "texture-compression-astc-sliced-3d",
322
325
  TimestampQuery = "timestamp-query",
323
326
  IndirectFirstInstance = "indirect-first-instance",
324
327
  ShaderF16 = "shader-f16",
325
328
  RG11B10UFloat = "rg11b10ufloat-renderable",
326
329
  BGRA8UNormStorage = "bgra8unorm-storage",
327
330
  Float32Filterable = "float32-filterable",
331
+ Float32Blendable = "float32-blendable",
332
+ ClipDistances = "clip-distances",
333
+ DualSourceBlending = "dual-source-blending",
334
+ Subgroups = "subgroups",
335
+ TextureFormatsTier1 = "texture-formats-tier1",
336
+ TextureFormatsTier2 = "texture-formats-tier2",
328
337
  }
@@ -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