@types/three 0.175.0 → 0.176.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 +2 -2
- three/examples/jsm/helpers/RapierHelper.d.ts +13 -0
- three/examples/jsm/loaders/LottieLoader.d.ts +4 -0
- three/examples/jsm/misc/MD2CharacterComplex.d.ts +1 -1
- three/examples/jsm/physics/RapierPhysics.d.ts +12 -0
- three/examples/jsm/postprocessing/BokehPass.d.ts +2 -2
- three/examples/jsm/tsl/shadows/TileShadowNode.d.ts +14 -0
- three/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +14 -0
- three/package.json +4 -3
- three/src/Three.Core.d.ts +2 -0
- three/src/Three.TSL.d.ts +8 -0
- three/src/audio/AudioListener.d.ts +1 -1
- three/src/cameras/ArrayCamera.d.ts +5 -0
- three/src/constants.d.ts +16 -15
- three/src/core/RenderTarget.d.ts +9 -0
- three/src/geometries/CapsuleGeometry.d.ts +10 -3
- three/src/lights/LightShadow.d.ts +8 -0
- three/src/materials/Material.d.ts +3 -8
- three/src/materials/ShaderMaterial.d.ts +1 -1
- three/src/materials/nodes/NodeMaterial.d.ts +10 -2
- three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +8 -0
- three/src/math/FrustumArray.d.ts +27 -0
- three/src/nodes/TSL.d.ts +1 -0
- three/src/nodes/accessors/InstanceNode.d.ts +2 -3
- three/src/nodes/accessors/VertexColorNode.d.ts +1 -1
- three/src/nodes/core/Node.d.ts +8 -5
- three/src/nodes/core/NodeVarying.d.ts +11 -1
- three/src/nodes/core/StackNode.d.ts +7 -1
- three/src/nodes/core/VaryingNode.d.ts +6 -0
- three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +2 -2
- three/src/nodes/lighting/ShadowFilterNode.d.ts +28 -0
- three/src/nodes/lighting/ShadowNode.d.ts +26 -24
- three/src/nodes/math/OperatorNode.d.ts +9 -0
- three/src/nodes/tsl/TSLCore.d.ts +34 -26
- three/src/nodes/utils/DebugNode.d.ts +2 -1
- three/src/nodes/utils/ReflectorNode.d.ts +1 -1
- three/src/renderers/common/Animation.d.ts +2 -2
- three/src/renderers/common/Renderer.d.ts +19 -0
- three/src/renderers/common/Textures.d.ts +0 -7
- three/src/renderers/common/TimestampQueryPool.d.ts +1 -0
- three/src/renderers/common/XRManager.d.ts +10 -1
- three/src/renderers/webgpu/WebGPUBackend.d.ts +1 -0
- three/src/textures/DepthArrayTexture.d.ts +14 -0
- three/src/textures/Texture.d.ts +8 -1
- three/src/textures/VideoFrameTexture.d.ts +1 -1
three/README.md
CHANGED
|
@@ -8,8 +8,8 @@ This package contains type definitions for three (https://threejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
12
|
-
* Dependencies: [@tweenjs/tween.js](https://npmjs.com/package/@tweenjs/tween.js), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr), [@webgpu/types](https://npmjs.com/package/@webgpu/types), [fflate](https://npmjs.com/package/fflate), [meshoptimizer](https://npmjs.com/package/meshoptimizer)
|
|
11
|
+
* Last updated: Thu, 24 Apr 2025 08:02:30 GMT
|
|
12
|
+
* Dependencies: [@dimforge/rapier3d-compat](https://npmjs.com/package/@dimforge/rapier3d-compat), [@tweenjs/tween.js](https://npmjs.com/package/@tweenjs/tween.js), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr), [@webgpu/types](https://npmjs.com/package/@webgpu/types), [fflate](https://npmjs.com/package/fflate), [meshoptimizer](https://npmjs.com/package/meshoptimizer)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
15
15
|
These definitions were written by [Josh Ellis](https://github.com/joshuaellis), and [Nathan Bierema](https://github.com/Methuselah96).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as RAPIER from "@dimforge/rapier3d-compat";
|
|
2
|
+
import { LineSegments } from "three";
|
|
3
|
+
|
|
4
|
+
declare class RapierHelper extends LineSegments {
|
|
5
|
+
world: RAPIER.World;
|
|
6
|
+
|
|
7
|
+
constructor(world: RAPIER.World);
|
|
8
|
+
|
|
9
|
+
update(): void;
|
|
10
|
+
dispose(): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { RapierHelper };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { CanvasTexture, Loader, LoadingManager } from "three";
|
|
2
2
|
|
|
3
3
|
export class LottieLoader extends Loader<CanvasTexture> {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated The loader has been deprecated and will be removed with r186. Use lottie-web instead and create your
|
|
6
|
+
* animated texture manually.
|
|
7
|
+
*/
|
|
4
8
|
constructor(manager?: LoadingManager);
|
|
5
9
|
|
|
6
10
|
load(
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
+
import * as RAPIER from "@dimforge/rapier3d-compat";
|
|
1
2
|
import { Mesh, Object3D } from "three";
|
|
2
3
|
|
|
3
4
|
type Vector = { x: number; y: number; z: number };
|
|
4
5
|
|
|
5
6
|
export interface RapierPhysicsObject {
|
|
7
|
+
RAPIER: typeof RAPIER;
|
|
8
|
+
world: RAPIER.World;
|
|
6
9
|
addScene: (scene: Object3D) => void;
|
|
7
10
|
addMesh: (mesh: Mesh, mass?: number, restitution?: number) => void;
|
|
8
11
|
setMeshPosition: (mesh: Mesh, position: Vector, index?: number) => void;
|
|
9
12
|
setMeshVelocity: (mesh: Mesh, velocity: Vector, index?: number) => void;
|
|
13
|
+
addHeightfield: (
|
|
14
|
+
mesh: Mesh,
|
|
15
|
+
width: number,
|
|
16
|
+
depth: number,
|
|
17
|
+
heights: Float32Array,
|
|
18
|
+
scale: Vector,
|
|
19
|
+
) => RAPIER.RigidBody;
|
|
10
20
|
}
|
|
11
21
|
|
|
12
22
|
export function RapierPhysics(): Promise<RapierPhysicsObject>;
|
|
23
|
+
|
|
24
|
+
export type RAPIER = typeof RAPIER;
|
|
@@ -2,7 +2,7 @@ import { Camera, Color, MeshDepthMaterial, Scene, ShaderMaterial, WebGLRenderTar
|
|
|
2
2
|
|
|
3
3
|
import { FullScreenQuad, Pass } from "./Pass.js";
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface BokehPassParameters {
|
|
6
6
|
focus?: number;
|
|
7
7
|
aspect?: number;
|
|
8
8
|
aperture?: number;
|
|
@@ -10,7 +10,7 @@ export interface BokehPassParamters {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export class BokehPass extends Pass {
|
|
13
|
-
constructor(scene: Scene, camera: Camera, params:
|
|
13
|
+
constructor(scene: Scene, camera: Camera, params: BokehPassParameters);
|
|
14
14
|
scene: Scene;
|
|
15
15
|
camera: Camera;
|
|
16
16
|
renderTargetColor: WebGLRenderTarget;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Light, ShadowBaseNode } from "three/webgpu";
|
|
2
|
+
|
|
3
|
+
export interface TileShadeNodeConfig {
|
|
4
|
+
tilesX?: number | undefined;
|
|
5
|
+
tilesY?: number | undefined;
|
|
6
|
+
resolution?: { width: number; height: number };
|
|
7
|
+
debug?: boolean | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare class TileShadowNode extends ShadowBaseNode {
|
|
11
|
+
constructor(light: Light, options?: TileShadeNodeConfig);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { TileShadowNode };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Group } from "three/webgpu";
|
|
2
|
+
import { TileShadowNode } from "./TileShadowNode.js";
|
|
3
|
+
|
|
4
|
+
declare class TileShadowNodeHelper extends Group {
|
|
5
|
+
constructor(tileShadowNode: TileShadowNode);
|
|
6
|
+
|
|
7
|
+
init(): void;
|
|
8
|
+
|
|
9
|
+
update(): void;
|
|
10
|
+
|
|
11
|
+
dispose(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { TileShadowNodeHelper };
|
three/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/three",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.176.0",
|
|
4
4
|
"description": "TypeScript definitions for three",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"scripts": {},
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@dimforge/rapier3d-compat": "^0.12.0",
|
|
43
44
|
"@tweenjs/tween.js": "~23.1.3",
|
|
44
45
|
"@types/stats.js": "*",
|
|
45
46
|
"@types/webxr": "*",
|
|
@@ -48,6 +49,6 @@
|
|
|
48
49
|
"meshoptimizer": "~0.18.1"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {},
|
|
51
|
-
"typesPublisherContentHash": "
|
|
52
|
-
"typeScriptVersion": "5.
|
|
52
|
+
"typesPublisherContentHash": "2633ecc9f78b2c3a7ff53ae098668242bacbcea8b1a3e8ca27d1bf0a943233a6",
|
|
53
|
+
"typeScriptVersion": "5.1"
|
|
53
54
|
}
|
three/src/Three.Core.d.ts
CHANGED
|
@@ -103,6 +103,7 @@ export { ColorManagement, ColorSpaceDefinition } from "./math/ColorManagement.js
|
|
|
103
103
|
export * from "./math/Cylindrical.js";
|
|
104
104
|
export * from "./math/Euler.js";
|
|
105
105
|
export * from "./math/Frustum.js";
|
|
106
|
+
export * from "./math/FrustumArray.js";
|
|
106
107
|
export * from "./math/Interpolant.js";
|
|
107
108
|
export * from "./math/interpolants/CubicInterpolant.js";
|
|
108
109
|
export * from "./math/interpolants/DiscreteInterpolant.js";
|
|
@@ -152,6 +153,7 @@ export * from "./textures/CubeTexture.js";
|
|
|
152
153
|
export * from "./textures/Data3DTexture.js";
|
|
153
154
|
export * from "./textures/DataArrayTexture.js";
|
|
154
155
|
export * from "./textures/DataTexture.js";
|
|
156
|
+
export * from "./textures/DepthArrayTexture.js";
|
|
155
157
|
export * from "./textures/DepthTexture.js";
|
|
156
158
|
export * from "./textures/FramebufferTexture.js";
|
|
157
159
|
export * from "./textures/Source.js";
|
three/src/Three.TSL.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export const F_Schlick: typeof TSL.F_Schlick;
|
|
|
13
13
|
export const Fn: typeof TSL.Fn;
|
|
14
14
|
export const INFINITY: typeof TSL.INFINITY;
|
|
15
15
|
export const If: typeof TSL.If;
|
|
16
|
+
export const Switch: typeof TSL.Switch;
|
|
16
17
|
export const Loop: typeof TSL.Loop;
|
|
17
18
|
export const NodeShaderStage: typeof TSL.NodeShaderStage;
|
|
18
19
|
export const NodeType: typeof TSL.NodeType;
|
|
@@ -130,6 +131,8 @@ export const dFdx: typeof TSL.dFdx;
|
|
|
130
131
|
export const dFdy: typeof TSL.dFdy;
|
|
131
132
|
export const dashSize: typeof TSL.dashSize;
|
|
132
133
|
export const debug: typeof TSL.debug;
|
|
134
|
+
export const decrement: typeof TSL.decrement;
|
|
135
|
+
export const decrementBefore: typeof TSL.decrementBefore;
|
|
133
136
|
export const defaultBuildStages: typeof TSL.defaultBuildStages;
|
|
134
137
|
export const defaultShaderStages: typeof TSL.defaultShaderStages;
|
|
135
138
|
export const defined: typeof TSL.defined;
|
|
@@ -183,6 +186,8 @@ export const getScreenPosition: typeof TSL.getScreenPosition;
|
|
|
183
186
|
export const getShIrradianceAt: typeof TSL.getShIrradianceAt;
|
|
184
187
|
export const getTextureIndex: typeof TSL.getTextureIndex;
|
|
185
188
|
export const getViewPosition: typeof TSL.getViewPosition;
|
|
189
|
+
export const getShadowMaterial: typeof TSL.getShadowMaterial;
|
|
190
|
+
export const getShadowRenderObjectFunction: typeof TSL.getShadowRenderObjectFunction;
|
|
186
191
|
export const glsl: typeof TSL.glsl;
|
|
187
192
|
export const glslFn: typeof TSL.glslFn;
|
|
188
193
|
export const grayscale: typeof TSL.grayscale;
|
|
@@ -192,6 +197,8 @@ export const hash: typeof TSL.hash;
|
|
|
192
197
|
export const highpModelNormalViewMatrix: typeof TSL.highpModelNormalViewMatrix;
|
|
193
198
|
export const highPrecisionModelViewMatrix: typeof TSL.highpModelViewMatrix;
|
|
194
199
|
export const hue: typeof TSL.hue;
|
|
200
|
+
export const increment: typeof TSL.increment;
|
|
201
|
+
export const incrementBefore: typeof TSL.incrementBefore;
|
|
195
202
|
export const instance: typeof TSL.instance;
|
|
196
203
|
export const instanceIndex: typeof TSL.instanceIndex;
|
|
197
204
|
export const instancedArray: typeof TSL.instancedArray;
|
|
@@ -217,6 +224,7 @@ export const lengthSq: typeof TSL.lengthSq;
|
|
|
217
224
|
export const lessThan: typeof TSL.lessThan;
|
|
218
225
|
export const lessThanEqual: typeof TSL.lessThanEqual;
|
|
219
226
|
export const lightPosition: typeof TSL.lightPosition;
|
|
227
|
+
export const lightShadowMatrix: typeof TSL.lightShadowMatrix;
|
|
220
228
|
export const lightTargetDirection: typeof TSL.lightTargetDirection;
|
|
221
229
|
export const lightTargetPosition: typeof TSL.lightTargetPosition;
|
|
222
230
|
export const lightViewPosition: typeof TSL.lightViewPosition;
|
|
@@ -4,7 +4,7 @@ import { AudioContext } from "./AudioContext.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* The {@link AudioListener} represents a virtual {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioListener | listener} of the all positional and non-positional audio effects in the scene.
|
|
6
6
|
* A three.js application usually creates a single instance of {@link AudioListener} * @remarks
|
|
7
|
-
* It is a mandatory
|
|
7
|
+
* It is a mandatory constructor parameter for audios entities like {@link Audio | Audio} and {@link PositionalAudio | PositionalAudio}.
|
|
8
8
|
* In most cases, the listener object is a child of the camera
|
|
9
9
|
* So the 3D transformation of the camera represents the 3D transformation of the listener.
|
|
10
10
|
* @example
|
|
@@ -18,6 +18,11 @@ export class ArrayCamera extends PerspectiveCamera {
|
|
|
18
18
|
*/
|
|
19
19
|
readonly isArrayCamera: true;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Whether this camera is used with multiview rendering or not.
|
|
23
|
+
*/
|
|
24
|
+
isMultiViewCamera: boolean;
|
|
25
|
+
|
|
21
26
|
/**
|
|
22
27
|
* An array of cameras.
|
|
23
28
|
* @defaultValue `[]`
|
three/src/constants.d.ts
CHANGED
|
@@ -371,19 +371,6 @@ export const RGBFormat: 1022;
|
|
|
371
371
|
/** {@link RGBAFormat} is the default and reads the red, green, blue and alpha components. */
|
|
372
372
|
export const RGBAFormat: 1023;
|
|
373
373
|
|
|
374
|
-
/**
|
|
375
|
-
* {@link LuminanceFormat} reads each element as a single luminance component.
|
|
376
|
-
* This is then converted to a floating point, clamped to the range `[0,1]`, and then assembled into an RGBA element by
|
|
377
|
-
* placing the luminance value in the red, green and blue channels, and attaching `1.0` to the alpha channel.
|
|
378
|
-
*/
|
|
379
|
-
export const LuminanceFormat: 1024;
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* {@link LuminanceAlphaFormat} reads each element as a luminance/alpha double.
|
|
383
|
-
* The same process occurs as for the {@link LuminanceFormat}, except that the alpha channel may have values other than `1.0`.
|
|
384
|
-
*/
|
|
385
|
-
export const LuminanceAlphaFormat: 1025;
|
|
386
|
-
|
|
387
374
|
/**
|
|
388
375
|
* {@link DepthFormat} reads each element as a single depth value, converts it to floating point, and clamps to the range `[0,1]`.
|
|
389
376
|
* @remarks This is the default for {@link THREE.DepthTexture}.
|
|
@@ -440,8 +427,6 @@ export type PixelFormat =
|
|
|
440
427
|
| typeof AlphaFormat
|
|
441
428
|
| typeof RGBFormat
|
|
442
429
|
| typeof RGBAFormat
|
|
443
|
-
| typeof LuminanceFormat
|
|
444
|
-
| typeof LuminanceAlphaFormat
|
|
445
430
|
| typeof DepthFormat
|
|
446
431
|
| typeof DepthStencilFormat
|
|
447
432
|
| typeof RedFormat
|
|
@@ -797,6 +782,22 @@ export const TimestampQuery: {
|
|
|
797
782
|
};
|
|
798
783
|
export type TimestampQuery = "compute" | "render";
|
|
799
784
|
|
|
785
|
+
export const InterpolationSamplingType: {
|
|
786
|
+
PERSPECTIVE: "perspective";
|
|
787
|
+
LINEAR: "linear";
|
|
788
|
+
FLAT: "flat";
|
|
789
|
+
};
|
|
790
|
+
export type InterpolationSamplingType = "perspective" | "linear" | "flat";
|
|
791
|
+
|
|
792
|
+
export const InterpolationSamplingMode: {
|
|
793
|
+
NORMAL: "normal";
|
|
794
|
+
CENTROID: "centroid";
|
|
795
|
+
SAMPLE: "sample";
|
|
796
|
+
FLAT_FIRST: "flat first";
|
|
797
|
+
FLAT_EITHER: "flat either";
|
|
798
|
+
};
|
|
799
|
+
export type InterpolationSamplingMode = "normal" | "centroid" | "sample" | "flat first" | "flat either";
|
|
800
|
+
|
|
800
801
|
///////////////////////////////////////////////////////////////////////////////
|
|
801
802
|
// Texture - Internal Pixel Formats
|
|
802
803
|
|
three/src/core/RenderTarget.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { Texture } from "../textures/Texture.js";
|
|
|
11
11
|
import { EventDispatcher } from "./EventDispatcher.js";
|
|
12
12
|
|
|
13
13
|
export interface RenderTargetOptions {
|
|
14
|
+
depth?: number | undefined;
|
|
14
15
|
wrapS?: Wrapping | undefined;
|
|
15
16
|
wrapT?: Wrapping | undefined;
|
|
16
17
|
magFilter?: MagnificationTextureFilter | undefined;
|
|
@@ -32,6 +33,7 @@ export interface RenderTargetOptions {
|
|
|
32
33
|
*/
|
|
33
34
|
samples?: number | undefined;
|
|
34
35
|
count?: number | undefined;
|
|
36
|
+
multiview?: boolean | undefined;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export class RenderTarget<TTexture extends Texture | Texture[] = Texture> extends EventDispatcher<{ dispose: {} }> {
|
|
@@ -78,6 +80,13 @@ export class RenderTarget<TTexture extends Texture | Texture[] = Texture> extend
|
|
|
78
80
|
*/
|
|
79
81
|
samples: number;
|
|
80
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Whether to this target is used in multiview rendering.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
multiview: boolean;
|
|
89
|
+
|
|
81
90
|
constructor(width?: number, height?: number, options?: RenderTargetOptions);
|
|
82
91
|
|
|
83
92
|
get texture(): TTexture;
|
|
@@ -19,11 +19,18 @@ export class CapsuleGeometry extends BufferGeometry {
|
|
|
19
19
|
/**
|
|
20
20
|
* Create a new instance of {@link CapsuleGeometry}
|
|
21
21
|
* @param radius Radius of the capsule. Expects a `Float`. Default `1`
|
|
22
|
-
* @param
|
|
22
|
+
* @param height Height of the middle section. Expects a `Float`. Default `1`
|
|
23
23
|
* @param capSegments Number of curve segments used to build the caps. Expects a `Integer`. Default `4`
|
|
24
24
|
* @param radialSegments Number of segmented faces around the circumference of the capsule. Expects a `Integer`. Default `8`
|
|
25
|
+
* @param heightSegments Number of rows of faces along the height of the capsule. Optional; defaults to `1`.
|
|
25
26
|
*/
|
|
26
|
-
constructor(
|
|
27
|
+
constructor(
|
|
28
|
+
radius?: number,
|
|
29
|
+
height?: number,
|
|
30
|
+
capSegments?: number,
|
|
31
|
+
radialSegments?: number,
|
|
32
|
+
heightSegments?: number,
|
|
33
|
+
);
|
|
27
34
|
|
|
28
35
|
/**
|
|
29
36
|
* A Read-only _string_ to check if `this` object type.
|
|
@@ -38,7 +45,7 @@ export class CapsuleGeometry extends BufferGeometry {
|
|
|
38
45
|
*/
|
|
39
46
|
readonly parameters: {
|
|
40
47
|
readonly radius: number;
|
|
41
|
-
readonly
|
|
48
|
+
readonly height: number;
|
|
42
49
|
readonly capSegments: number;
|
|
43
50
|
readonly radialSegments: number;
|
|
44
51
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Camera } from "../cameras/Camera.js";
|
|
2
|
+
import { TextureDataType } from "../constants.js";
|
|
2
3
|
import { Object3DJSONObject } from "../core/Object3D.js";
|
|
3
4
|
import { Frustum } from "../math/Frustum.js";
|
|
4
5
|
import { Matrix4 } from "../math/Matrix4.js";
|
|
@@ -86,6 +87,13 @@ export class LightShadow<TCamera extends Camera = Camera> {
|
|
|
86
87
|
*/
|
|
87
88
|
mapSize: Vector2;
|
|
88
89
|
|
|
90
|
+
/**
|
|
91
|
+
* The type of shadow texture. The default is `UnsignedByteType`.
|
|
92
|
+
*
|
|
93
|
+
* @default UnsignedByteType
|
|
94
|
+
*/
|
|
95
|
+
mapType: TextureDataType;
|
|
96
|
+
|
|
89
97
|
/**
|
|
90
98
|
* The depth map generated using the internal camera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.
|
|
91
99
|
* @defaultValue null
|
|
@@ -287,7 +287,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
|
|
|
287
287
|
blendDst: BlendingDstFactor;
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
|
-
* The
|
|
290
|
+
* The transparency of the .blendDst. Default is null.
|
|
291
291
|
* @default null
|
|
292
292
|
*/
|
|
293
293
|
blendDstAlpha: number | null;
|
|
@@ -299,7 +299,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
|
|
|
299
299
|
blendEquation: BlendingEquation;
|
|
300
300
|
|
|
301
301
|
/**
|
|
302
|
-
* The
|
|
302
|
+
* The transparency of the .blendEquation. Default is null.
|
|
303
303
|
* @default null
|
|
304
304
|
*/
|
|
305
305
|
blendEquationAlpha: number | null;
|
|
@@ -317,7 +317,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
|
|
|
317
317
|
blendSrc: BlendingSrcFactor | BlendingDstFactor;
|
|
318
318
|
|
|
319
319
|
/**
|
|
320
|
-
* The
|
|
320
|
+
* The transparency of the .blendSrc. Default is null.
|
|
321
321
|
* @default null
|
|
322
322
|
*/
|
|
323
323
|
blendSrcAlpha: number | null;
|
|
@@ -628,9 +628,4 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
|
|
|
628
628
|
* @default false
|
|
629
629
|
*/
|
|
630
630
|
set needsUpdate(value: boolean);
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* @deprecated onBuild() has been removed.
|
|
634
|
-
*/
|
|
635
|
-
onBuild(object: Object3D, parameters: WebGLProgramParametersWithUniforms, renderer: WebGLRenderer): void;
|
|
636
631
|
}
|
|
@@ -27,7 +27,8 @@ export interface NodeMaterialParameters extends MaterialParameters {
|
|
|
27
27
|
geometryNode?: Node | null | undefined;
|
|
28
28
|
|
|
29
29
|
depthNode?: Node | null | undefined;
|
|
30
|
-
|
|
30
|
+
receivedShadowPositionNode?: Node | null | undefined;
|
|
31
|
+
castShadowPositionNode?: Node | null | undefined;
|
|
31
32
|
|
|
32
33
|
outputNode?: Node | null | undefined;
|
|
33
34
|
|
|
@@ -59,7 +60,8 @@ declare class NodeMaterial extends Material {
|
|
|
59
60
|
geometryNode: Node | null;
|
|
60
61
|
|
|
61
62
|
depthNode: Node | null;
|
|
62
|
-
|
|
63
|
+
receivedShadowPositionNode: Node | null;
|
|
64
|
+
castShadowPositionNode: Node | null;
|
|
63
65
|
receivedShadowNode: (() => Node) | null;
|
|
64
66
|
castShadowNode: Node | null;
|
|
65
67
|
|
|
@@ -69,6 +71,12 @@ declare class NodeMaterial extends Material {
|
|
|
69
71
|
fragmentNode: Node | null;
|
|
70
72
|
vertexNode: Node | null;
|
|
71
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated ".shadowPositionNode" was renamed to ".receivedShadowPositionNode".'
|
|
76
|
+
*/
|
|
77
|
+
get shadowPositionNode(): Node | null;
|
|
78
|
+
set shadowPositionNode(value: Node | null);
|
|
79
|
+
|
|
72
80
|
constructor();
|
|
73
81
|
|
|
74
82
|
build(builder: NodeBuilder): void;
|
|
@@ -2,6 +2,7 @@ import { BufferAttribute } from "../../../core/BufferAttribute.js";
|
|
|
2
2
|
import { Matrix4 } from "../../../math/Matrix4.js";
|
|
3
3
|
import NodeBuilder from "../../../nodes/core/NodeBuilder.js";
|
|
4
4
|
import NodeFrame from "../../../nodes/core/NodeFrame.js";
|
|
5
|
+
import Renderer from "../../../renderers/common/Renderer.js";
|
|
5
6
|
import RenderObject from "../../../renderers/common/RenderObject.js";
|
|
6
7
|
import { Material } from "../../Material.js";
|
|
7
8
|
declare const refreshUniforms: readonly [
|
|
@@ -103,6 +104,13 @@ declare class NodeMaterialObserver {
|
|
|
103
104
|
* @return {boolean} Whether the given render object is verified for the first time of this observer.
|
|
104
105
|
*/
|
|
105
106
|
firstInitialization(renderObject: RenderObject): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Returns `true` if the current rendering produces motion vectors.
|
|
109
|
+
*
|
|
110
|
+
* @param {Renderer} renderer - The renderer.
|
|
111
|
+
* @return {boolean} Whether the current rendering produces motion vectors or not.
|
|
112
|
+
*/
|
|
113
|
+
needsVelocity(renderer: Renderer): boolean;
|
|
106
114
|
/**
|
|
107
115
|
* Returns monitoring data for the given render object.
|
|
108
116
|
*
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ArrayCamera } from "../cameras/ArrayCamera.js";
|
|
2
|
+
import { CoordinateSystem } from "../constants.js";
|
|
3
|
+
import { Object3D } from "../core/Object3D.js";
|
|
4
|
+
import { Sprite } from "../objects/Sprite.js";
|
|
5
|
+
import { Box3 } from "./Box3.js";
|
|
6
|
+
import { Sphere } from "./Sphere.js";
|
|
7
|
+
import { Vector3 } from "./Vector3.js";
|
|
8
|
+
|
|
9
|
+
declare class FrustumArray {
|
|
10
|
+
coordinateSystem: CoordinateSystem;
|
|
11
|
+
|
|
12
|
+
constructor();
|
|
13
|
+
|
|
14
|
+
intersectsObject(object: Object3D, cameraArray: ArrayCamera): boolean;
|
|
15
|
+
|
|
16
|
+
intersectsSprite(sprite: Sprite, cameraArray: ArrayCamera): boolean;
|
|
17
|
+
|
|
18
|
+
intersectsSprite(sphere: Sphere, cameraArray: ArrayCamera): boolean;
|
|
19
|
+
|
|
20
|
+
intersectsBox(box: Box3, cameraArray: ArrayCamera): boolean;
|
|
21
|
+
|
|
22
|
+
containsPoint(point: Vector3, cameraArray: ArrayCamera): boolean;
|
|
23
|
+
|
|
24
|
+
clone(): FrustumArray;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { FrustumArray };
|
three/src/nodes/TSL.d.ts
CHANGED
|
@@ -135,6 +135,7 @@ export * from "./lighting/LightsNode.js";
|
|
|
135
135
|
export * from "./lighting/PointLightNode.js";
|
|
136
136
|
export * from "./lighting/PointShadowNode.js";
|
|
137
137
|
export * from "./lighting/ShadowBaseNode.js";
|
|
138
|
+
export * from "./lighting/ShadowFilterNode.js";
|
|
138
139
|
export * from "./lighting/ShadowNode.js";
|
|
139
140
|
|
|
140
141
|
// pmrem
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InstancedBufferAttribute } from "../../core/InstancedBufferAttribute.js";
|
|
2
|
-
import { InstancedMesh } from "../../objects/InstancedMesh.js";
|
|
3
2
|
import Node from "../core/Node.js";
|
|
4
3
|
import { ShaderNodeObject } from "../tsl/TSLCore.js";
|
|
5
4
|
|
|
@@ -14,12 +13,12 @@ export default class InstanceNode extends Node {
|
|
|
14
13
|
constructor(
|
|
15
14
|
count: number,
|
|
16
15
|
instanceMatrix: InstancedBufferAttribute,
|
|
17
|
-
instanceColor
|
|
16
|
+
instanceColor?: InstancedBufferAttribute | null,
|
|
18
17
|
);
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
export const instance: (
|
|
22
21
|
count: number,
|
|
23
22
|
instanceMatrix: InstancedBufferAttribute,
|
|
24
|
-
instanceColor
|
|
23
|
+
instanceColor?: InstancedBufferAttribute | null,
|
|
25
24
|
) => ShaderNodeObject<InstanceNode>;
|
three/src/nodes/core/Node.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ declare class Node extends EventDispatcher<{
|
|
|
75
75
|
_cacheKey: number | null;
|
|
76
76
|
_cacheKeyVersion: number;
|
|
77
77
|
global: boolean;
|
|
78
|
+
parents: boolean;
|
|
78
79
|
readonly isNode: true;
|
|
79
80
|
readonly id: number;
|
|
80
81
|
self?: this;
|
|
@@ -319,14 +320,16 @@ declare class Node extends EventDispatcher<{
|
|
|
319
320
|
*/
|
|
320
321
|
update(frame: NodeFrame): void;
|
|
321
322
|
/**
|
|
322
|
-
* This method performs the build of a node. The behavior
|
|
323
|
-
*
|
|
323
|
+
* This method performs the build of a node. The behavior and return value depend on the current build stage:
|
|
324
|
+
* - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant.
|
|
325
|
+
* - **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`.
|
|
326
|
+
* - **generate**: Generates the shader code for the node. Returns the generated shader string.
|
|
324
327
|
*
|
|
325
328
|
* @param {NodeBuilder} builder - The current node builder.
|
|
326
|
-
* @param {?string} output - Can be used to define the output type.
|
|
327
|
-
* @return {
|
|
329
|
+
* @param {?string} [output=null] - Can be used to define the output type.
|
|
330
|
+
* @return {Node|string|null} The result of the build process, depending on the build stage.
|
|
328
331
|
*/
|
|
329
|
-
build(builder: NodeBuilder, output?: string | null): string | null;
|
|
332
|
+
build(builder: NodeBuilder, output?: string | null): Node | string | null;
|
|
330
333
|
/**
|
|
331
334
|
* Returns the child nodes as a JSON object.
|
|
332
335
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InterpolationSamplingMode, InterpolationSamplingType } from "../../constants.js";
|
|
1
2
|
import NodeVar from "./NodeVar.js";
|
|
2
3
|
/**
|
|
3
4
|
* {@link NodeBuilder} is going to create instances of this class during the build process
|
|
@@ -10,12 +11,21 @@ import NodeVar from "./NodeVar.js";
|
|
|
10
11
|
declare class NodeVarying extends NodeVar {
|
|
11
12
|
needsInterpolation: boolean;
|
|
12
13
|
readonly isNodeVarying: true;
|
|
14
|
+
interpolationType: InterpolationSamplingType | null;
|
|
15
|
+
interpolationSampling: InterpolationSamplingMode | null;
|
|
13
16
|
/**
|
|
14
17
|
* Constructs a new node varying.
|
|
15
18
|
*
|
|
16
19
|
* @param {string} name - The name of the varying.
|
|
17
20
|
* @param {string} type - The type of the varying.
|
|
21
|
+
* @param {?string} interpolationType - The interpolation type of the varying.
|
|
22
|
+
* @param {?string} interpolationSampling - The interpolation sampling type of the varying.
|
|
18
23
|
*/
|
|
19
|
-
constructor(
|
|
24
|
+
constructor(
|
|
25
|
+
name: string,
|
|
26
|
+
type: string,
|
|
27
|
+
interpolationType?: InterpolationSamplingType | null,
|
|
28
|
+
interpolationSampling?: InterpolationSamplingMode | null,
|
|
29
|
+
);
|
|
20
30
|
}
|
|
21
31
|
export default NodeVarying;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShaderNodeObject } from "../tsl/TSLCore.js";
|
|
1
|
+
import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
|
|
2
2
|
import Node from "./Node.js";
|
|
3
3
|
|
|
4
4
|
declare class StackNode extends Node {
|
|
@@ -16,6 +16,12 @@ declare class StackNode extends Node {
|
|
|
16
16
|
|
|
17
17
|
Else(method: () => void): this;
|
|
18
18
|
|
|
19
|
+
Switch(expression: NodeRepresentation): this;
|
|
20
|
+
|
|
21
|
+
Case(...params: NodeRepresentation[]): this;
|
|
22
|
+
|
|
23
|
+
Default(method: () => void): this;
|
|
24
|
+
|
|
19
25
|
/**
|
|
20
26
|
* @deprecated Use {@link StackNode#ElseIf Else()} instead.
|
|
21
27
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InterpolationSamplingMode, InterpolationSamplingType } from "../../constants.js";
|
|
1
2
|
import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
|
|
2
3
|
import Node from "./Node.js";
|
|
3
4
|
import NodeBuilder from "./NodeBuilder.js";
|
|
@@ -6,9 +7,14 @@ import NodeVarying from "./NodeVarying.js";
|
|
|
6
7
|
export default class VaryingNode extends Node {
|
|
7
8
|
node: Node;
|
|
8
9
|
name: string | null;
|
|
10
|
+
readonly isVaryingNode: true;
|
|
11
|
+
interpolationType: InterpolationSamplingType | null;
|
|
12
|
+
interpolationSampling: InterpolationSamplingMode | null;
|
|
9
13
|
|
|
10
14
|
constructor(node: Node, name?: string | null);
|
|
11
15
|
|
|
16
|
+
setInterpolation(type: InterpolationSamplingType | null, sampling?: InterpolationSamplingMode | null): this;
|
|
17
|
+
|
|
12
18
|
setupVarying(builder: NodeBuilder): NodeVarying;
|
|
13
19
|
}
|
|
14
20
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Node from "../core/Node.js";
|
|
2
|
-
import TempNode from "../core/TempNode.js";
|
|
3
2
|
import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
|
|
4
3
|
|
|
5
4
|
export type AtomicMethod =
|
|
@@ -13,10 +12,11 @@ export type AtomicMethod =
|
|
|
13
12
|
| typeof AtomicFunctionNode.ATOMIC_OR
|
|
14
13
|
| typeof AtomicFunctionNode.ATOMIC_XOR;
|
|
15
14
|
|
|
16
|
-
declare class AtomicFunctionNode extends
|
|
15
|
+
declare class AtomicFunctionNode extends Node {
|
|
17
16
|
method: AtomicMethod;
|
|
18
17
|
pointerNode: Node;
|
|
19
18
|
valueNode: Node;
|
|
19
|
+
parents: boolean;
|
|
20
20
|
|
|
21
21
|
constructor(method: AtomicMethod, pointerNode: Node, valueNode: Node);
|
|
22
22
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Light } from "../../lights/Light.js";
|
|
2
|
+
import NodeMaterial from "../../materials/nodes/NodeMaterial.js";
|
|
3
|
+
import Node from "../core/Node.js";
|
|
4
|
+
import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
|
|
5
|
+
|
|
6
|
+
export const BasicShadowFilter: (
|
|
7
|
+
depthTexture: NodeRepresentation,
|
|
8
|
+
shadowCoord: NodeRepresentation,
|
|
9
|
+
) => ShaderNodeObject<Node>;
|
|
10
|
+
|
|
11
|
+
export const PCFShadowFilter: (
|
|
12
|
+
depthTexture: NodeRepresentation,
|
|
13
|
+
shadowCoord: NodeRepresentation,
|
|
14
|
+
shadow: NodeRepresentation,
|
|
15
|
+
) => ShaderNodeObject<Node>;
|
|
16
|
+
|
|
17
|
+
export const PCFSoftShadowFilter: (
|
|
18
|
+
depthTexture: NodeRepresentation,
|
|
19
|
+
shadowCoord: NodeRepresentation,
|
|
20
|
+
shadow: NodeRepresentation,
|
|
21
|
+
) => ShaderNodeObject<Node>;
|
|
22
|
+
|
|
23
|
+
export const VSMShadowFilter: (
|
|
24
|
+
depthTexture: NodeRepresentation,
|
|
25
|
+
shadowCoord: NodeRepresentation,
|
|
26
|
+
) => ShaderNodeObject<Node>;
|
|
27
|
+
|
|
28
|
+
export const getShadowMaterial: (light: Light) => NodeMaterial;
|
|
@@ -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
|
|
4
|
-
import {
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
) =>
|
|
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>;
|
|
@@ -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
|
|
three/src/nodes/tsl/TSLCore.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import ConvertNode from "../utils/ConvertNode.js";
|
|
|
9
9
|
export interface NodeElements {
|
|
10
10
|
toGlobal: (node: Node) => Node;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
toStack: typeof Stack;
|
|
13
13
|
|
|
14
14
|
toColor: typeof color;
|
|
15
15
|
toFloat: typeof float;
|
|
@@ -34,6 +34,8 @@ export interface NodeElements {
|
|
|
34
34
|
|
|
35
35
|
element: typeof element;
|
|
36
36
|
convert: typeof convert;
|
|
37
|
+
|
|
38
|
+
append: typeof append;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export function addMethodChaining(name: string, nodeElement: unknown): void;
|
|
@@ -113,7 +115,7 @@ type RemoveHeadAndTail<T extends readonly [...unknown[]]> = T extends [unknown,
|
|
|
113
115
|
*
|
|
114
116
|
* We use an object instead of tuple or union as it makes stuff easier, especially in Typescript 4.0.
|
|
115
117
|
*/
|
|
116
|
-
interface
|
|
118
|
+
interface Constructors<
|
|
117
119
|
A extends undefined | [...unknown[]],
|
|
118
120
|
B extends undefined | [...unknown[]],
|
|
119
121
|
C extends undefined | [...unknown[]],
|
|
@@ -136,20 +138,20 @@ type OverloadedConstructorsOf<T> = T extends {
|
|
|
136
138
|
new(...args: infer A2): unknown;
|
|
137
139
|
new(...args: infer A3): unknown;
|
|
138
140
|
new(...args: infer A4): unknown;
|
|
139
|
-
} ?
|
|
141
|
+
} ? Constructors<A1, A2, A3, A4>
|
|
140
142
|
: T extends {
|
|
141
143
|
new(...args: infer A1): unknown;
|
|
142
144
|
new(...args: infer A2): unknown;
|
|
143
145
|
new(...args: infer A3): unknown;
|
|
144
|
-
} ?
|
|
146
|
+
} ? Constructors<A1, A2, A3, undefined>
|
|
145
147
|
: T extends {
|
|
146
148
|
new(...args: infer A1): unknown;
|
|
147
149
|
new(...args: infer A2): unknown;
|
|
148
|
-
} ?
|
|
149
|
-
: T extends new(...args: infer A) => unknown ?
|
|
150
|
-
:
|
|
150
|
+
} ? Constructors<A1, A2, undefined, undefined>
|
|
151
|
+
: T extends new(...args: infer A) => unknown ? Constructors<A, undefined, undefined, undefined>
|
|
152
|
+
: Constructors<undefined, undefined, undefined, undefined>;
|
|
151
153
|
|
|
152
|
-
type AnyConstructors =
|
|
154
|
+
type AnyConstructors = Constructors<any, any, any, any>;
|
|
153
155
|
|
|
154
156
|
/**
|
|
155
157
|
* Returns all constructors where the first paramter is assignable to given "scope"
|
|
@@ -259,30 +261,14 @@ export function Fn<T extends { readonly [key: string]: unknown }>(
|
|
|
259
261
|
jsFunc: (args: T) => void,
|
|
260
262
|
): ShaderNodeFn<[ProxiedObject<T>]>;
|
|
261
263
|
|
|
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
264
|
export const setCurrentStack: (stack: StackNode | null) => void;
|
|
280
265
|
|
|
281
266
|
export const getCurrentStack: () => StackNode | null;
|
|
282
267
|
|
|
283
268
|
export const If: (boolNode: Node, method: () => void) => StackNode;
|
|
269
|
+
export const Switch: (expression: NodeRepresentation) => StackNode;
|
|
284
270
|
|
|
285
|
-
export function
|
|
271
|
+
export function Stack(node: Node): Node;
|
|
286
272
|
|
|
287
273
|
interface ColorFunction {
|
|
288
274
|
(color?: ColorRepresentation): ShaderNodeObject<ConstNode<Color>>;
|
|
@@ -322,3 +308,25 @@ export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<Arr
|
|
|
322
308
|
export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
|
|
323
309
|
export const convert: (node: NodeRepresentation, types: string) => ShaderNodeObject<Node>;
|
|
324
310
|
export const split: (node: NodeRepresentation, channels?: string) => ShaderNodeObject<Node>;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* @deprecated append() has been renamed to Stack().
|
|
314
|
+
*/
|
|
315
|
+
export const append: (node: Node) => Node;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* @deprecated tslFn() has been renamed to Fn()
|
|
319
|
+
*/
|
|
320
|
+
export function tslFn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R): () => R;
|
|
321
|
+
/**
|
|
322
|
+
* @deprecated tslFn() has been renamed to Fn()
|
|
323
|
+
*/
|
|
324
|
+
export function tslFn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
|
|
325
|
+
jsFunc: (args: T) => R,
|
|
326
|
+
): (...args: ProxiedTuple<T>) => R;
|
|
327
|
+
/**
|
|
328
|
+
* @deprecated tslFn() has been renamed to Fn()
|
|
329
|
+
*/
|
|
330
|
+
export function tslFn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
|
|
331
|
+
jsFunc: (args: T) => R,
|
|
332
|
+
): (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,7 +31,7 @@ declare class ReflectorBaseNode extends Node {
|
|
|
31
31
|
bounces: boolean;
|
|
32
32
|
|
|
33
33
|
virtualCameras: WeakMap<Camera, Camera>;
|
|
34
|
-
renderTargets:
|
|
34
|
+
renderTargets: Map<Camera, RenderTarget>;
|
|
35
35
|
forceUpdate: boolean;
|
|
36
36
|
|
|
37
37
|
constructor(textureNode: TextureNode, parameters?: ReflectorNodeParameters);
|
|
@@ -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
|
*
|
|
@@ -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
|
/**
|
|
@@ -98,12 +98,15 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
|
98
98
|
_glProjLayer: XRProjectionLayer | null;
|
|
99
99
|
_xrFrame: XRFrame | null;
|
|
100
100
|
_useLayers: boolean;
|
|
101
|
+
_useMultiviewIfPossible: boolean;
|
|
102
|
+
_useMultiview: boolean;
|
|
101
103
|
/**
|
|
102
104
|
* Constructs a new XR manager.
|
|
103
105
|
*
|
|
104
106
|
* @param {Renderer} renderer - The renderer.
|
|
107
|
+
* @param {boolean} [multiview=false] - Enables multiview if the device supports it.
|
|
105
108
|
*/
|
|
106
|
-
constructor(renderer: Renderer);
|
|
109
|
+
constructor(renderer: Renderer, multiview?: boolean);
|
|
107
110
|
/**
|
|
108
111
|
* Returns an instance of `THREE.Group` that represents the transformation
|
|
109
112
|
* of a XR controller in target ray space. The requested controller is defined
|
|
@@ -202,6 +205,12 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
|
202
205
|
* @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session.
|
|
203
206
|
*/
|
|
204
207
|
getFrame(): XRFrame | null;
|
|
208
|
+
/**
|
|
209
|
+
* Returns `true` if the engine renders to a multiview target.
|
|
210
|
+
*
|
|
211
|
+
* @return {boolean} Whether the engine renders to a multiview render target or not.
|
|
212
|
+
*/
|
|
213
|
+
useMultiview(): boolean;
|
|
205
214
|
createQuadLayer(
|
|
206
215
|
width: number,
|
|
207
216
|
height: number,
|
|
@@ -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;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DepthTexture } from "./DepthTexture.js";
|
|
2
|
+
|
|
3
|
+
declare class DepthArrayTexture extends DepthTexture {
|
|
4
|
+
readonly isDepthArrayTexture: true;
|
|
5
|
+
layerUpdates: Set<number>;
|
|
6
|
+
|
|
7
|
+
constructor(width?: number, height?: number, depth?: number);
|
|
8
|
+
|
|
9
|
+
addLayerUpdate(layerIndex: number): void;
|
|
10
|
+
|
|
11
|
+
clearLayerUpdates(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { DepthArrayTexture };
|
three/src/textures/Texture.d.ts
CHANGED
|
@@ -377,6 +377,13 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
|
|
|
377
377
|
*/
|
|
378
378
|
isRenderTargetTexture: boolean;
|
|
379
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Indicates if a texture should be handled like a texture array.
|
|
382
|
+
*
|
|
383
|
+
* @default false
|
|
384
|
+
*/
|
|
385
|
+
isTextureArray: boolean;
|
|
386
|
+
|
|
380
387
|
/**
|
|
381
388
|
* An object that can be used to store custom data about the texture.
|
|
382
389
|
* @remarks It should not hold references to functions as these will not be cloned.
|
|
@@ -432,7 +439,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
|
|
|
432
439
|
/**
|
|
433
440
|
* A callback function, called when the texture is updated _(e.g., when needsUpdate has been set to true and then the texture is used)_.
|
|
434
441
|
*/
|
|
435
|
-
onUpdate: () => void;
|
|
442
|
+
onUpdate: ((texture: Texture) => void) | null;
|
|
436
443
|
|
|
437
444
|
/**
|
|
438
445
|
* Transform the **UV** based on the value of this texture's
|