@takram/three-geospatial 0.5.1 → 0.7.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.
- package/CHANGELOG.md +14 -0
- package/README.md +2 -0
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.js +318 -312
- package/build/index.js.map +1 -1
- package/build/r3f.cjs.map +1 -1
- package/build/r3f.js.map +1 -1
- package/build/shaders.cjs.map +1 -1
- package/build/shaders.js.map +1 -1
- package/build/shared.cjs.map +1 -1
- package/build/shared.js.map +1 -1
- package/build/shared2.cjs.map +1 -1
- package/build/shared2.js.map +1 -1
- package/build/shared3.cjs.map +1 -1
- package/build/shared3.js.map +1 -1
- package/build/webgpu.cjs +1 -1
- package/build/webgpu.cjs.map +1 -1
- package/build/webgpu.js +445 -463
- package/build/webgpu.js.map +1 -1
- package/package.json +2 -2
- package/src/decorators.ts +30 -10
- package/src/r3f/EastNorthUpFrame.tsx +2 -1
- package/src/r3f/EllipsoidMesh.tsx +4 -2
- package/src/webgpu/DownsampleThresholdNode.ts +3 -4
- package/src/webgpu/DualMipmapFilterNode.ts +1 -1
- package/src/webgpu/FnLayout.ts +5 -5
- package/src/webgpu/GaussianBlurNode.ts +3 -3
- package/src/webgpu/HighpVelocityNode.ts +8 -4
- package/src/webgpu/KawaseBlurNode.ts +3 -3
- package/src/webgpu/LensFlareNode.ts +10 -19
- package/src/webgpu/LensGlareNode.ts +8 -11
- package/src/webgpu/MipmapBlurNode.ts +7 -7
- package/src/webgpu/MipmapSurfaceBlurNode.ts +5 -6
- package/src/webgpu/OutputTexture3DNode.ts +1 -5
- package/src/webgpu/OutputTextureNode.ts +1 -4
- package/src/webgpu/RTTextureNode.ts +6 -8
- package/src/webgpu/TemporalAntialiasNode.ts +20 -23
- package/src/webgpu/accessors.ts +8 -10
- package/src/webgpu/generators.ts +7 -9
- package/src/webgpu/math.ts +13 -13
- package/src/webgpu/node.ts +3 -6
- package/src/webgpu/sampling.ts +3 -51
- package/src/webgpu/transformations.ts +30 -35
- package/src/webgpu/utils.ts +9 -9
- package/types/decorators.d.ts +2 -2
- package/types/webgpu/DownsampleThresholdNode.d.ts +4 -4
- package/types/webgpu/DualMipmapFilterNode.d.ts +2 -2
- package/types/webgpu/FnLayout.d.ts +3 -3
- package/types/webgpu/GaussianBlurNode.d.ts +2 -2
- package/types/webgpu/HighpVelocityNode.d.ts +2 -3
- package/types/webgpu/KawaseBlurNode.d.ts +2 -2
- package/types/webgpu/LensFlareNode.d.ts +4 -4
- package/types/webgpu/LensGhostNode.d.ts +1 -1
- package/types/webgpu/LensGlareNode.d.ts +5 -5
- package/types/webgpu/LensHaloNode.d.ts +2 -2
- package/types/webgpu/MipmapBlurNode.d.ts +4 -4
- package/types/webgpu/MipmapSurfaceBlurNode.d.ts +3 -3
- package/types/webgpu/OutputTexture3DNode.d.ts +1 -2
- package/types/webgpu/OutputTextureNode.d.ts +1 -2
- package/types/webgpu/RTTextureNode.d.ts +2 -3
- package/types/webgpu/SeparableFilterNode.d.ts +2 -2
- package/types/webgpu/SingleFilterNode.d.ts +1 -1
- package/types/webgpu/TemporalAntialiasNode.d.ts +6 -6
- package/types/webgpu/accessors.d.ts +8 -8
- package/types/webgpu/generators.d.ts +4 -4
- package/types/webgpu/node.d.ts +4 -5
- package/types/webgpu/sampling.d.ts +0 -1
- package/types/webgpu/transformations.d.ts +8 -8
- package/types/webgpu/utils.d.ts +1 -2
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
cos,
|
|
3
3
|
int,
|
|
4
4
|
logarithmicDepthToViewZ,
|
|
5
|
-
nodeObject,
|
|
6
5
|
orthographicDepthToViewZ,
|
|
7
6
|
perspectiveDepthToViewZ,
|
|
8
7
|
PI,
|
|
@@ -15,7 +14,7 @@ import {
|
|
|
15
14
|
viewZToPerspectiveDepth
|
|
16
15
|
} from 'three/tsl'
|
|
17
16
|
|
|
18
|
-
import type { Node
|
|
17
|
+
import type { Node } from './node'
|
|
19
18
|
|
|
20
19
|
export interface DepthOptions {
|
|
21
20
|
perspective?: boolean
|
|
@@ -24,44 +23,42 @@ export interface DepthOptions {
|
|
|
24
23
|
|
|
25
24
|
export const depthToViewZ = (
|
|
26
25
|
depth: Node<'float'>,
|
|
27
|
-
near:
|
|
28
|
-
far:
|
|
26
|
+
near: Node<'float'>,
|
|
27
|
+
far: Node<'float'>,
|
|
29
28
|
{ perspective = true, logarithmic = false }: DepthOptions = {}
|
|
30
|
-
):
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
: orthographicDepthToViewZ(depth, near, far)
|
|
37
|
-
) as NodeObject<'float'>
|
|
29
|
+
): Node<'float'> => {
|
|
30
|
+
return logarithmic
|
|
31
|
+
? logarithmicDepthToViewZ(depth, near, far)
|
|
32
|
+
: perspective
|
|
33
|
+
? perspectiveDepthToViewZ(depth, near, far)
|
|
34
|
+
: orthographicDepthToViewZ(depth, near, far)
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
export const logarithmicToPerspectiveDepth = (
|
|
41
38
|
depth: Node<'float'>,
|
|
42
|
-
near:
|
|
43
|
-
far:
|
|
44
|
-
):
|
|
39
|
+
near: Node<'float'>,
|
|
40
|
+
far: Node<'float'>
|
|
41
|
+
): Node<'float'> => {
|
|
45
42
|
const viewZ = logarithmicDepthToViewZ(depth, near, far)
|
|
46
|
-
return viewZToPerspectiveDepth(viewZ, near, far)
|
|
43
|
+
return viewZToPerspectiveDepth(viewZ, near, far)
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
export const perspectiveToLogarithmicDepth = (
|
|
50
47
|
depth: Node<'float'>,
|
|
51
|
-
near:
|
|
52
|
-
far:
|
|
53
|
-
):
|
|
54
|
-
const viewZ =
|
|
55
|
-
return viewZToLogarithmicDepth(viewZ, near, far)
|
|
48
|
+
near: Node<'float'>,
|
|
49
|
+
far: Node<'float'>
|
|
50
|
+
): Node<'float'> => {
|
|
51
|
+
const viewZ = perspectiveDepthToViewZ(depth, near, far)
|
|
52
|
+
return viewZToLogarithmicDepth(viewZ, near, far)
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
export const screenToPositionView = (
|
|
59
|
-
uv:
|
|
56
|
+
uv: Node<'vec2'>,
|
|
60
57
|
depth: Node<'float'>,
|
|
61
|
-
viewZ:
|
|
62
|
-
projectionMatrix:
|
|
63
|
-
inverseProjectionMatrix:
|
|
64
|
-
):
|
|
58
|
+
viewZ: Node<'float'>,
|
|
59
|
+
projectionMatrix: Node<'mat4'>,
|
|
60
|
+
inverseProjectionMatrix: Node<'mat4'>
|
|
61
|
+
): Node<'vec3'> => {
|
|
65
62
|
const scale = projectionMatrix.element(int(2)).element(int(3))
|
|
66
63
|
const offset = projectionMatrix.element(int(3)).element(int(3))
|
|
67
64
|
const clip = vec4(vec3(uv.flipY(), depth).mul(2).sub(1), 1)
|
|
@@ -80,25 +77,23 @@ const turboCoeffs = [
|
|
|
80
77
|
/*#__PURE__*/ vec3(0.1357, 0.0914, 0.1067)
|
|
81
78
|
]
|
|
82
79
|
|
|
83
|
-
export const turbo = (x:
|
|
80
|
+
export const turbo = (x: Node<'float'>): Node<'vec3'> => {
|
|
84
81
|
return turboCoeffs
|
|
85
82
|
.slice(1)
|
|
86
|
-
.reduce<
|
|
83
|
+
.reduce<Node>((y, offset) => offset.add(x.mul(y)), turboCoeffs[0])
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
export const depthToColor = (
|
|
90
87
|
depth: Node<'float'>,
|
|
91
|
-
near:
|
|
92
|
-
far:
|
|
88
|
+
near: Node<'float'>,
|
|
89
|
+
far: Node<'float'>,
|
|
93
90
|
options?: DepthOptions
|
|
94
|
-
):
|
|
91
|
+
): Node<'vec3'> => {
|
|
95
92
|
const viewZ = depthToViewZ(depth, near, far, options)
|
|
96
|
-
return turbo(viewZToLogarithmicDepth(viewZ, near, far)
|
|
93
|
+
return turbo(viewZToLogarithmicDepth(viewZ, near, far))
|
|
97
94
|
}
|
|
98
95
|
|
|
99
|
-
export const equirectToDirectionWorld = (
|
|
100
|
-
uv: NodeObject<'vec2'>
|
|
101
|
-
): NodeObject<'vec3'> => {
|
|
96
|
+
export const equirectToDirectionWorld = (uv: Node<'vec2'>): Node<'vec3'> => {
|
|
102
97
|
const lambda = sub(0.5, uv.x).mul(PI2)
|
|
103
98
|
const phi = sub(uv.y, 0.5).mul(PI)
|
|
104
99
|
const cosPhi = cos(phi)
|
package/src/webgpu/utils.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type Backend from 'three/src/renderers/common/Backend.js'
|
|
2
1
|
import { NodeBuilder, type Renderer } from 'three/webgpu'
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export function isWebGPU(
|
|
4
|
+
target: NodeBuilder | Renderer | Renderer['backend']
|
|
5
|
+
): boolean {
|
|
6
|
+
const backend =
|
|
7
|
+
target instanceof NodeBuilder
|
|
8
|
+
? target.renderer.backend
|
|
9
|
+
: 'backend' in target
|
|
10
|
+
? target.backend
|
|
11
|
+
: target
|
|
12
12
|
return backend.isWebGPUBackend === true
|
|
13
13
|
}
|
package/types/decorators.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
interface MaterialLike {
|
|
2
|
-
defines?: Record<string,
|
|
2
|
+
defines?: Record<string, unknown>;
|
|
3
3
|
set needsUpdate(value: boolean);
|
|
4
4
|
}
|
|
5
5
|
interface EffectLike {
|
|
6
|
-
defines: Map<string,
|
|
6
|
+
defines: Map<string, unknown>;
|
|
7
7
|
}
|
|
8
8
|
export declare function define(name: string): <T extends MaterialLike | EffectLike, K extends keyof T>(target: T[K] extends boolean ? T : never, propertyKey: K) => void;
|
|
9
9
|
export interface DefineIntDecoratorOptions {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TextureNode } from 'three/webgpu';
|
|
2
|
-
import { Node
|
|
2
|
+
import { Node } from './node';
|
|
3
3
|
import { SingleFilterNode } from './SingleFilterNode';
|
|
4
4
|
export declare class DownsampleThresholdNode extends SingleFilterNode {
|
|
5
5
|
static get type(): string;
|
|
6
|
-
thresholdLevel: import('three/
|
|
7
|
-
thresholdRange: import('three/
|
|
6
|
+
thresholdLevel: import('three/webgpu').UniformNode<number>;
|
|
7
|
+
thresholdRange: import('three/webgpu').UniformNode<number>;
|
|
8
8
|
constructor(inputNode?: TextureNode | null);
|
|
9
9
|
protected setupOutputNode(): Node;
|
|
10
10
|
}
|
|
11
|
-
export declare const downsampleThreshold: (...args: ConstructorParameters<typeof DownsampleThresholdNode>) =>
|
|
11
|
+
export declare const downsampleThreshold: (...args: ConstructorParameters<typeof DownsampleThresholdNode>) => DownsampleThresholdNode;
|
|
@@ -9,8 +9,8 @@ export declare abstract class DualMipmapFilterNode extends FilterNode {
|
|
|
9
9
|
private readonly upsampleMaterial;
|
|
10
10
|
private readonly mesh;
|
|
11
11
|
private rendererState?;
|
|
12
|
-
protected readonly inputTexelSize: import('three/
|
|
13
|
-
protected readonly downsampleNode:
|
|
12
|
+
protected readonly inputTexelSize: import('three/webgpu').UniformNode<Vector2>;
|
|
13
|
+
protected readonly downsampleNode: TextureNode;
|
|
14
14
|
constructor(inputNode: TextureNode | null | undefined, levels: number);
|
|
15
15
|
setSize(width: number, height: number): this;
|
|
16
16
|
updateBefore({ renderer }: NodeFrame): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProxiedTuple, ShaderCallNodeInternal, ShaderNodeFn, Struct } from 'three/src/nodes/TSL.js';
|
|
2
2
|
import { NodeBuilder, Texture3DNode, TextureNode } from 'three/webgpu';
|
|
3
|
-
import {
|
|
3
|
+
import { Node, NodeType } from './node';
|
|
4
4
|
type FnLayoutType = NodeType | Struct | 'texture' | 'texture3D';
|
|
5
5
|
export interface FnLayoutInput<T extends FnLayoutType = FnLayoutType> {
|
|
6
6
|
name: string;
|
|
@@ -12,10 +12,10 @@ export interface FnLayout<T extends FnLayoutType, Inputs extends readonly FnLayo
|
|
|
12
12
|
type: T;
|
|
13
13
|
inputs?: Inputs;
|
|
14
14
|
}
|
|
15
|
-
type InferNodeObject<T extends FnLayoutType> = T extends NodeType ?
|
|
15
|
+
type InferNodeObject<T extends FnLayoutType> = T extends NodeType ? Node<T> : T extends Struct ? ReturnType<T> : T extends 'texture' ? TextureNode : T extends 'texture3D' ? Texture3DNode : never;
|
|
16
16
|
type InferNodeObjects<Inputs extends readonly FnLayoutInput[]> = {
|
|
17
17
|
[K in keyof Inputs]: Inputs[K] extends FnLayoutInput<infer T> ? InferNodeObject<T> : never;
|
|
18
18
|
};
|
|
19
|
-
export type FnLayoutResult<T extends FnLayoutType, Inputs extends readonly FnLayoutInput[], Nodes extends readonly unknown[] = InferNodeObjects<Inputs>> = (callback: (...args: [] extends Nodes ? [NodeBuilder] : [Nodes, NodeBuilder]) => InferNodeObject<T> |
|
|
19
|
+
export type FnLayoutResult<T extends FnLayoutType, Inputs extends readonly FnLayoutInput[], Nodes extends readonly unknown[] = InferNodeObjects<Inputs>> = (callback: (...args: [] extends Nodes ? [NodeBuilder] : [Nodes, NodeBuilder]) => InferNodeObject<T> | ShaderCallNodeInternal) => ShaderNodeFn<ProxiedTuple<Nodes>>;
|
|
20
20
|
export declare function FnLayout<T extends FnLayoutType, const Inputs extends readonly FnLayoutInput[] = []>({ typeOnly, ...layout }: FnLayout<T, Inputs>): FnLayoutResult<T, Inputs>;
|
|
21
21
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeBuilder, TextureNode } from 'three/webgpu';
|
|
2
|
-
import { Node
|
|
2
|
+
import { Node } from './node';
|
|
3
3
|
import { SeparableFilterNode } from './SeparableFilterNode';
|
|
4
4
|
export declare class GaussianBlurNode extends SeparableFilterNode {
|
|
5
5
|
static get type(): string;
|
|
@@ -7,4 +7,4 @@ export declare class GaussianBlurNode extends SeparableFilterNode {
|
|
|
7
7
|
constructor(inputNode?: TextureNode | null, kernelSize?: number);
|
|
8
8
|
protected setupOutputNode(builder: NodeBuilder): Node;
|
|
9
9
|
}
|
|
10
|
-
export declare const gaussianBlur: (...args: ConstructorParameters<typeof GaussianBlurNode>) =>
|
|
10
|
+
export declare const gaussianBlur: (...args: ConstructorParameters<typeof GaussianBlurNode>) => GaussianBlurNode;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Matrix4 } from 'three';
|
|
2
|
-
import { NodeFrame } from 'three/
|
|
3
|
-
import { TempNode, NodeBuilder } from 'three/webgpu';
|
|
2
|
+
import { TempNode, NodeBuilder, NodeFrame } from 'three/webgpu';
|
|
4
3
|
export declare class HighpVelocityNode extends TempNode {
|
|
5
4
|
static get type(): string;
|
|
6
5
|
projectionMatrix?: Matrix4 | null;
|
|
@@ -15,4 +14,4 @@ export declare class HighpVelocityNode extends TempNode {
|
|
|
15
14
|
updateAfter({ object }: NodeFrame): void;
|
|
16
15
|
setup(builder: NodeBuilder): unknown;
|
|
17
16
|
}
|
|
18
|
-
export declare const highpVelocity:
|
|
17
|
+
export declare const highpVelocity: HighpVelocityNode;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { NodeBuilder, TextureNode } from 'three/webgpu';
|
|
2
2
|
import { DualMipmapFilterNode } from './DualMipmapFilterNode';
|
|
3
|
-
import { Node
|
|
3
|
+
import { Node } from './node';
|
|
4
4
|
export declare class KawaseBlurNode extends DualMipmapFilterNode {
|
|
5
5
|
static get type(): string;
|
|
6
6
|
constructor(inputNode?: TextureNode | null, levels?: number);
|
|
7
7
|
protected setupDownsampleNode(builder: NodeBuilder): Node;
|
|
8
8
|
protected setupUpsampleNode(builder: NodeBuilder): Node;
|
|
9
9
|
}
|
|
10
|
-
export declare const kawaseBlur: (...args: ConstructorParameters<typeof KawaseBlurNode>) =>
|
|
10
|
+
export declare const kawaseBlur: (...args: ConstructorParameters<typeof KawaseBlurNode>) => KawaseBlurNode;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { TempNode,
|
|
1
|
+
import { TempNode, NodeBuilder, TextureNode } from 'three/webgpu';
|
|
2
2
|
import { DownsampleThresholdNode } from './DownsampleThresholdNode';
|
|
3
3
|
import { GaussianBlurNode } from './GaussianBlurNode';
|
|
4
4
|
import { LensGhostNode } from './LensGhostNode';
|
|
5
5
|
import { LensGlareNode } from './LensGlareNode';
|
|
6
6
|
import { LensHaloNode } from './LensHaloNode';
|
|
7
7
|
import { MipmapSurfaceBlurNode } from './MipmapSurfaceBlurNode';
|
|
8
|
-
import {
|
|
8
|
+
import { Node } from './node';
|
|
9
9
|
import { RTTextureNode } from './RTTextureNode';
|
|
10
10
|
export declare class LensFlareNode extends TempNode {
|
|
11
11
|
static get type(): string;
|
|
@@ -16,10 +16,10 @@ export declare class LensFlareNode extends TempNode {
|
|
|
16
16
|
haloNode: LensHaloNode;
|
|
17
17
|
bloomNode: MipmapSurfaceBlurNode;
|
|
18
18
|
glareNode: LensGlareNode;
|
|
19
|
-
bloomIntensity: import('three/
|
|
19
|
+
bloomIntensity: import('three/webgpu').UniformNode<number>;
|
|
20
20
|
featuresNode: RTTextureNode;
|
|
21
21
|
constructor(inputNode?: TextureNode | null);
|
|
22
22
|
setup(builder: NodeBuilder): unknown;
|
|
23
23
|
dispose(): void;
|
|
24
24
|
}
|
|
25
|
-
export declare const lensFlare: (inputNode: Node | null) =>
|
|
25
|
+
export declare const lensFlare: (inputNode: Node | null) => LensFlareNode;
|
|
@@ -2,7 +2,7 @@ import { TempNode, NodeBuilder, TextureNode } from 'three/webgpu';
|
|
|
2
2
|
export declare class LensGhostNode extends TempNode {
|
|
3
3
|
static get type(): string;
|
|
4
4
|
inputNode?: TextureNode | null;
|
|
5
|
-
intensity: import('three/
|
|
5
|
+
intensity: import('three/webgpu').UniformNode<number>;
|
|
6
6
|
constructor(inputNode?: TextureNode | null);
|
|
7
7
|
setup(builder: NodeBuilder): unknown;
|
|
8
8
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Vector2 } from 'three';
|
|
2
2
|
import { NodeBuilder, NodeFrame, TextureNode } from 'three/webgpu';
|
|
3
3
|
import { FilterNode } from './FilterNode';
|
|
4
|
-
import { Node
|
|
4
|
+
import { Node } from './node';
|
|
5
5
|
export declare class LensGlareNode extends FilterNode {
|
|
6
6
|
spikeNode?: TextureNode | null;
|
|
7
7
|
spikePairCount: number;
|
|
8
8
|
wireframe: boolean;
|
|
9
|
-
intensity: import('three/
|
|
10
|
-
sizeScale: import('three/
|
|
11
|
-
luminanceThreshold: import('three/
|
|
9
|
+
intensity: import('three/webgpu').UniformNode<number>;
|
|
10
|
+
sizeScale: import('three/webgpu').UniformNode<Vector2>;
|
|
11
|
+
luminanceThreshold: import('three/webgpu').UniformNode<number>;
|
|
12
12
|
private computeNode?;
|
|
13
13
|
private readonly counterBuffer;
|
|
14
14
|
private instanceBuffer;
|
|
@@ -29,4 +29,4 @@ export declare class LensGlareNode extends FilterNode {
|
|
|
29
29
|
setup(builder: NodeBuilder): unknown;
|
|
30
30
|
dispose(): void;
|
|
31
31
|
}
|
|
32
|
-
export declare const lensGlare: (inputNode: Node | null) =>
|
|
32
|
+
export declare const lensGlare: (inputNode: Node | null) => LensGlareNode;
|
|
@@ -2,8 +2,8 @@ import { TempNode, NodeBuilder, NodeFrame, TextureNode } from 'three/webgpu';
|
|
|
2
2
|
export declare class LensHaloNode extends TempNode {
|
|
3
3
|
static get type(): string;
|
|
4
4
|
inputNode?: TextureNode | null;
|
|
5
|
-
intensity: import('three/
|
|
6
|
-
chromaticAberration: import('three/
|
|
5
|
+
intensity: import('three/webgpu').UniformNode<number>;
|
|
6
|
+
chromaticAberration: import('three/webgpu').UniformNode<number>;
|
|
7
7
|
private readonly aspectRatio;
|
|
8
8
|
constructor(inputNode?: TextureNode | null);
|
|
9
9
|
updateBefore({ renderer }: NodeFrame): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { NodeBuilder, TextureNode, UniformNode, Vector2 } from 'three/webgpu';
|
|
2
2
|
import { DualMipmapFilterNode } from './DualMipmapFilterNode';
|
|
3
|
-
import { Node
|
|
4
|
-
export declare const mipmapBlurDownsample: (inputNode: TextureNode, texelSize:
|
|
5
|
-
export declare const mipmapBlurUpsample: (inputNode: TextureNode, texelSize:
|
|
3
|
+
import { Node } from './node';
|
|
4
|
+
export declare const mipmapBlurDownsample: (inputNode: TextureNode, texelSize: Node<"vec2"> | UniformNode<Vector2>) => Node<"vec4">;
|
|
5
|
+
export declare const mipmapBlurUpsample: (inputNode: TextureNode, texelSize: Node<"vec2"> | UniformNode<Vector2>) => Node<"vec4">;
|
|
6
6
|
export declare class MipmapBlurNode extends DualMipmapFilterNode {
|
|
7
7
|
static get type(): string;
|
|
8
8
|
constructor(inputNode?: TextureNode | null, levels?: number);
|
|
9
9
|
protected setupDownsampleNode(builder: NodeBuilder): Node;
|
|
10
10
|
protected setupUpsampleNode(builder: NodeBuilder): Node;
|
|
11
11
|
}
|
|
12
|
-
export declare const mipmapBlur: (...args: ConstructorParameters<typeof MipmapBlurNode>) =>
|
|
12
|
+
export declare const mipmapBlur: (...args: ConstructorParameters<typeof MipmapBlurNode>) => MipmapBlurNode;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NodeBuilder, TextureNode } from 'three/webgpu';
|
|
2
2
|
import { DualMipmapFilterNode } from './DualMipmapFilterNode';
|
|
3
|
-
import { Node
|
|
3
|
+
import { Node } from './node';
|
|
4
4
|
export declare class MipmapSurfaceBlurNode extends DualMipmapFilterNode {
|
|
5
5
|
static get type(): string;
|
|
6
|
-
blendAmount: import('three/
|
|
6
|
+
blendAmount: import('three/webgpu').UniformNode<number>;
|
|
7
7
|
constructor(inputNode?: TextureNode | null, levels?: number);
|
|
8
8
|
protected setupDownsampleNode(builder: NodeBuilder): Node;
|
|
9
9
|
protected setupUpsampleNode(builder: NodeBuilder): Node;
|
|
10
10
|
}
|
|
11
|
-
export declare const mipmapSurfaceBlur: (...args: ConstructorParameters<typeof MipmapSurfaceBlurNode>) =>
|
|
11
|
+
export declare const mipmapSurfaceBlur: (...args: ConstructorParameters<typeof MipmapSurfaceBlurNode>) => MipmapSurfaceBlurNode;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Texture } from 'three';
|
|
2
2
|
import { Texture3DNode, Node, NodeBuilder } from 'three/webgpu';
|
|
3
|
-
import { NodeObject } from './node';
|
|
4
3
|
export declare class OutputTexture3DNode extends Texture3DNode {
|
|
5
4
|
static get type(): string;
|
|
6
5
|
owner: Node;
|
|
@@ -8,4 +7,4 @@ export declare class OutputTexture3DNode extends Texture3DNode {
|
|
|
8
7
|
setup(builder: NodeBuilder): unknown;
|
|
9
8
|
clone(): this;
|
|
10
9
|
}
|
|
11
|
-
export declare const outputTexture3D: (...args: ConstructorParameters<typeof OutputTexture3DNode>) =>
|
|
10
|
+
export declare const outputTexture3D: (...args: ConstructorParameters<typeof OutputTexture3DNode>) => OutputTexture3DNode;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Texture } from 'three';
|
|
2
2
|
import { TextureNode, Node, NodeBuilder } from 'three/webgpu';
|
|
3
|
-
import { NodeObject } from './node';
|
|
4
3
|
export declare class OutputTextureNode extends TextureNode {
|
|
5
4
|
static get type(): string;
|
|
6
5
|
owner: Node;
|
|
@@ -8,4 +7,4 @@ export declare class OutputTextureNode extends TextureNode {
|
|
|
8
7
|
setup(builder: NodeBuilder): unknown;
|
|
9
8
|
clone(): this;
|
|
10
9
|
}
|
|
11
|
-
export declare const outputTexture: (...args: ConstructorParameters<typeof OutputTextureNode>) =>
|
|
10
|
+
export declare const outputTexture: (...args: ConstructorParameters<typeof OutputTextureNode>) => OutputTextureNode;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TextureNode, Node, NodeBuilder, NodeFrame } from 'three/webgpu';
|
|
2
|
-
import { NodeObject } from './node';
|
|
3
2
|
export declare class RTTextureNode extends TextureNode {
|
|
4
3
|
static get type(): string;
|
|
5
4
|
node: Node;
|
|
@@ -15,9 +14,9 @@ export declare class RTTextureNode extends TextureNode {
|
|
|
15
14
|
dispose(): void;
|
|
16
15
|
clone(): TextureNode;
|
|
17
16
|
}
|
|
18
|
-
export declare const rtTexture: (...args: ConstructorParameters<typeof RTTextureNode>) =>
|
|
17
|
+
export declare const rtTexture: (...args: ConstructorParameters<typeof RTTextureNode>) => RTTextureNode;
|
|
19
18
|
export declare const convertToTexture: (node: Node & {
|
|
20
19
|
isTextureNode?: boolean;
|
|
21
20
|
isSampleNode?: boolean;
|
|
22
21
|
getTextureNode?: () => TextureNode;
|
|
23
|
-
}, name?: string) =>
|
|
22
|
+
}, name?: string) => TextureNode;
|
|
@@ -9,8 +9,8 @@ export declare abstract class SeparableFilterNode extends FilterNode {
|
|
|
9
9
|
private readonly material;
|
|
10
10
|
private readonly mesh;
|
|
11
11
|
private rendererState?;
|
|
12
|
-
protected readonly inputTexelSize: import('three/
|
|
13
|
-
protected readonly direction: import('three/
|
|
12
|
+
protected readonly inputTexelSize: import('three/webgpu').UniformNode<Vector2>;
|
|
13
|
+
protected readonly direction: import('three/webgpu').UniformNode<Vector2>;
|
|
14
14
|
constructor(inputNode?: TextureNode | null);
|
|
15
15
|
setSize(width: number, height: number): this;
|
|
16
16
|
updateBefore({ renderer }: NodeFrame): void;
|
|
@@ -7,7 +7,7 @@ export declare abstract class SingleFilterNode extends FilterNode {
|
|
|
7
7
|
private readonly material;
|
|
8
8
|
private readonly mesh;
|
|
9
9
|
private rendererState?;
|
|
10
|
-
protected readonly inputTexelSize: import('three/
|
|
10
|
+
protected readonly inputTexelSize: import('three/webgpu').UniformNode<Vector2>;
|
|
11
11
|
constructor(inputNode?: TextureNode | null);
|
|
12
12
|
setSize(width: number, height: number): this;
|
|
13
13
|
updateBefore({ renderer }: NodeFrame): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Matrix4, Camera } from 'three';
|
|
2
2
|
import { TempNode, NodeBuilder, NodeFrame, TextureNode } from 'three/webgpu';
|
|
3
|
-
import { Node
|
|
3
|
+
import { Node } from './node';
|
|
4
4
|
interface VelocityNodeImmutable {
|
|
5
5
|
projectionMatrix?: Matrix4 | null;
|
|
6
6
|
}
|
|
@@ -16,10 +16,10 @@ export declare class TemporalAntialiasNode extends TempNode {
|
|
|
16
16
|
depthNode: TextureNode;
|
|
17
17
|
velocityNode: TextureNode;
|
|
18
18
|
camera: SupportedCamera;
|
|
19
|
-
temporalAlpha: import('three/
|
|
20
|
-
varianceGamma: import('three/
|
|
21
|
-
velocityThreshold: import('three/
|
|
22
|
-
depthError: import('three/
|
|
19
|
+
temporalAlpha: import('three/webgpu').UniformNode<number>;
|
|
20
|
+
varianceGamma: import('three/webgpu').UniformNode<number>;
|
|
21
|
+
velocityThreshold: import('three/webgpu').UniformNode<number>;
|
|
22
|
+
depthError: import('three/webgpu').UniformNode<number>;
|
|
23
23
|
debugShowRejection: boolean;
|
|
24
24
|
private readonly textureNode;
|
|
25
25
|
private resolveRT;
|
|
@@ -52,5 +52,5 @@ export declare class TemporalAntialiasNode extends TempNode {
|
|
|
52
52
|
setup(builder: NodeBuilder): unknown;
|
|
53
53
|
dispose(): void;
|
|
54
54
|
}
|
|
55
|
-
export declare const temporalAntialias: (velocityNodeImmutable: VelocityNodeImmutable) => (inputNode: Node, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera) =>
|
|
55
|
+
export declare const temporalAntialias: (velocityNodeImmutable: VelocityNodeImmutable) => (inputNode: Node, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera) => TemporalAntialiasNode;
|
|
56
56
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Vector3, Camera } from 'three';
|
|
2
2
|
import { UniformNode } from 'three/webgpu';
|
|
3
|
-
import {
|
|
4
|
-
export declare const projectionMatrix: (camera: Camera) =>
|
|
5
|
-
export declare const viewMatrix: (camera: Camera) =>
|
|
6
|
-
export declare const inverseProjectionMatrix: (camera: Camera) =>
|
|
7
|
-
export declare const inverseViewMatrix: (camera: Camera) =>
|
|
8
|
-
export declare const cameraPositionWorld: (camera: Camera) =>
|
|
9
|
-
export declare const cameraNear: (camera: Camera) =>
|
|
10
|
-
export declare const cameraFar: (camera: Camera) =>
|
|
3
|
+
import { Node } from './node';
|
|
4
|
+
export declare const projectionMatrix: (camera: Camera) => Node<"mat4">;
|
|
5
|
+
export declare const viewMatrix: (camera: Camera) => Node<"mat4">;
|
|
6
|
+
export declare const inverseProjectionMatrix: (camera: Camera) => Node<"mat4">;
|
|
7
|
+
export declare const inverseViewMatrix: (camera: Camera) => Node<"mat4">;
|
|
8
|
+
export declare const cameraPositionWorld: (camera: Camera) => UniformNode<Vector3>;
|
|
9
|
+
export declare const cameraNear: (camera: Camera) => Node<"float">;
|
|
10
|
+
export declare const cameraFar: (camera: Camera) => Node<"float">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const interleavedGradientNoise: (seed:
|
|
3
|
-
export declare const dithering:
|
|
4
|
-
export declare const equirectGrid: (direction:
|
|
1
|
+
import { Node } from './node';
|
|
2
|
+
export declare const interleavedGradientNoise: (seed: Node<"vec2">) => Node<"float">;
|
|
3
|
+
export declare const dithering: Node<'vec3'>;
|
|
4
|
+
export declare const equirectGrid: (direction: Node<"vec3">, lineWidth: Node<"float">, count?: Node<"vec2">) => Node<"float">;
|
package/types/webgpu/node.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Color, Matrix2, Matrix3, Matrix4, Vector2, Vector3, Vector4 } from 'three';
|
|
2
|
-
import { ShaderNodeObject } from 'three/tsl';
|
|
3
2
|
import { Node as N } from 'three/webgpu';
|
|
4
3
|
declare const nodes: {
|
|
5
4
|
readonly float: import('three/src/nodes/TSL.js').NumberFunction;
|
|
@@ -9,15 +8,15 @@ declare const nodes: {
|
|
|
9
8
|
readonly vec2: import('three/src/nodes/TSL.js').Vector2Function;
|
|
10
9
|
readonly ivec2: import('three/src/nodes/TSL.js').Vector2Function;
|
|
11
10
|
readonly uvec2: import('three/src/nodes/TSL.js').Vector2Function;
|
|
12
|
-
readonly bvec2: (node: N) =>
|
|
11
|
+
readonly bvec2: (node: N) => N;
|
|
13
12
|
readonly vec3: import('three/src/nodes/TSL.js').Vector3Function;
|
|
14
13
|
readonly ivec3: import('three/src/nodes/TSL.js').Vector3Function;
|
|
15
14
|
readonly uvec3: import('three/src/nodes/TSL.js').Vector3Function;
|
|
16
|
-
readonly bvec3: (node: N) =>
|
|
15
|
+
readonly bvec3: (node: N) => N;
|
|
17
16
|
readonly vec4: import('three/src/nodes/TSL.js').Vector4Function;
|
|
18
17
|
readonly ivec4: import('three/src/nodes/TSL.js').Vector4Function;
|
|
19
18
|
readonly uvec4: import('three/src/nodes/TSL.js').Vector4Function;
|
|
20
|
-
readonly bvec4: (node: N) =>
|
|
19
|
+
readonly bvec4: (node: N) => N;
|
|
21
20
|
readonly mat2: import('three/src/nodes/TSL.js').Matrix2Function;
|
|
22
21
|
readonly mat3: import('three/src/nodes/TSL.js').Matrix3Function;
|
|
23
22
|
readonly mat4: import('three/src/nodes/TSL.js').Matrix4Function;
|
|
@@ -28,6 +27,6 @@ export type NodeValueType = number | boolean | Vector2 | Vector3 | Vector4 | Mat
|
|
|
28
27
|
export type NodeTypeOf<T extends NodeValueType> = T extends number ? 'float' : T extends boolean ? 'bool' : T extends Vector2 ? 'vec2' : T extends Vector3 ? 'vec3' : T extends Vector4 ? 'vec4' : T extends Matrix2 ? 'mat2' : T extends Matrix3 ? 'mat3' : T extends Matrix4 ? 'mat4' : T extends Color ? 'color' : never;
|
|
29
28
|
export type NodeValueTypeOf<T extends NodeType> = T extends 'float' | 'int' | 'uint' ? number : T extends 'bool' ? boolean : T extends 'vec2' | 'ivec2' | 'uvec2' | 'bvec2' ? Vector2 : T extends 'vec3' | 'ivec3' | 'uvec3' | 'bvec3' ? Vector3 : T extends 'vec4' | 'ivec4' | 'uvec4' | 'bvec4' ? Vector4 : T extends 'mat2' ? Matrix2 : T extends 'mat3' ? Matrix3 : T extends 'mat4' ? Matrix4 : T extends 'color' ? Color : never;
|
|
30
29
|
export type Node<T extends NodeType = NodeType> = N;
|
|
31
|
-
export
|
|
30
|
+
export declare const Node: typeof N;
|
|
32
31
|
export declare function node<T extends NodeType>(type: T): (typeof nodes)[T];
|
|
33
32
|
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export declare const textureBicubic: import('three/src/nodes/TSL.js').ShaderNodeFn<[textureNode: number | import('three/webgpu').Node, uv: number | import('three/webgpu').Node, sharpness?: number | import('three/webgpu').Node | undefined]>;
|
|
2
1
|
export declare const textureCatmullRom: import('three/src/nodes/TSL.js').ShaderNodeFn<[textureNode: number | import('three/webgpu').Node, uv: number | import('three/webgpu').Node]>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Node
|
|
1
|
+
import { Node } from './node';
|
|
2
2
|
export interface DepthOptions {
|
|
3
3
|
perspective?: boolean;
|
|
4
4
|
logarithmic?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare const depthToViewZ: (depth: Node<"float">, near:
|
|
7
|
-
export declare const logarithmicToPerspectiveDepth: (depth: Node<"float">, near:
|
|
8
|
-
export declare const perspectiveToLogarithmicDepth: (depth: Node<"float">, near:
|
|
9
|
-
export declare const screenToPositionView: (uv:
|
|
10
|
-
export declare const turbo: (x:
|
|
11
|
-
export declare const depthToColor: (depth: Node<"float">, near:
|
|
12
|
-
export declare const equirectToDirectionWorld: (uv:
|
|
6
|
+
export declare const depthToViewZ: (depth: Node<"float">, near: Node<"float">, far: Node<"float">, { perspective, logarithmic }?: DepthOptions) => Node<"float">;
|
|
7
|
+
export declare const logarithmicToPerspectiveDepth: (depth: Node<"float">, near: Node<"float">, far: Node<"float">) => Node<"float">;
|
|
8
|
+
export declare const perspectiveToLogarithmicDepth: (depth: Node<"float">, near: Node<"float">, far: Node<"float">) => Node<"float">;
|
|
9
|
+
export declare const screenToPositionView: (uv: Node<"vec2">, depth: Node<"float">, viewZ: Node<"float">, projectionMatrix: Node<"mat4">, inverseProjectionMatrix: Node<"mat4">) => Node<"vec3">;
|
|
10
|
+
export declare const turbo: (x: Node<"float">) => Node<"vec3">;
|
|
11
|
+
export declare const depthToColor: (depth: Node<"float">, near: Node<"float">, far: Node<"float">, options?: DepthOptions) => Node<"vec3">;
|
|
12
|
+
export declare const equirectToDirectionWorld: (uv: Node<"vec2">) => Node<"vec3">;
|
package/types/webgpu/utils.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { default as Backend } from 'three/src/renderers/common/Backend.js';
|
|
2
1
|
import { NodeBuilder, Renderer } from 'three/webgpu';
|
|
3
|
-
export declare function isWebGPU(target: NodeBuilder | Renderer |
|
|
2
|
+
export declare function isWebGPU(target: NodeBuilder | Renderer | Renderer['backend']): boolean;
|