@takram/three-geospatial 0.7.1 → 0.9.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 +41 -0
- package/README.md +1 -1
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.js +580 -598
- package/build/index.js.map +1 -1
- package/build/r3f.cjs +1 -1
- package/build/r3f.js +1 -1
- package/build/shared2.cjs +1 -1
- package/build/shared2.cjs.map +1 -1
- package/build/shared2.js +27 -212
- package/build/shared2.js.map +1 -1
- package/build/shared3.cjs +1 -1
- package/build/shared3.cjs.map +1 -1
- package/build/shared3.js +213 -8
- package/build/shared3.js.map +1 -1
- package/build/webgpu.cjs +6 -1
- package/build/webgpu.cjs.map +1 -1
- package/build/webgpu.js +1111 -768
- package/build/webgpu.js.map +1 -1
- package/package.json +1 -1
- package/src/EllipsoidGeometry.ts +1 -1
- package/src/PointOfView.ts +12 -5
- package/src/STBNLoader.ts +41 -19
- package/src/unrollLoops.ts +1 -1
- package/src/webgpu/CascadedShadowMapsNode.ts +48 -0
- package/src/webgpu/DualMipmapFilterNode.ts +8 -4
- package/src/webgpu/FilterNode.ts +5 -3
- package/src/webgpu/FnLayout.ts +17 -16
- package/src/webgpu/HighpVelocityNode.ts +9 -4
- package/src/webgpu/LensFlareNode.ts +12 -16
- package/src/webgpu/LensGlareNode.ts +28 -32
- package/src/webgpu/LensHaloNode.ts +2 -1
- package/src/webgpu/OutputTexture3DNode.ts +10 -0
- package/src/webgpu/OutputTextureNode.ts +10 -0
- package/src/webgpu/STBNTextureNode.ts +58 -0
- package/src/webgpu/ScreenSpaceShadowNode.ts +685 -0
- package/src/webgpu/SeparableFilterNode.ts +8 -5
- package/src/webgpu/SingleFilterNode.ts +5 -2
- package/src/webgpu/StorageTexture3DNode.ts +30 -0
- package/src/webgpu/TemporalAntialiasNode.ts +178 -137
- package/src/webgpu/accessors.ts +75 -36
- package/src/webgpu/debug.ts +38 -47
- package/src/webgpu/events.ts +18 -0
- package/src/webgpu/index.ts +5 -1
- package/src/webgpu/math.ts +116 -15
- package/src/webgpu/sampling.ts +39 -5
- package/src/webgpu/transformations.ts +71 -44
- package/types/PointOfView.d.ts +1 -1
- package/types/STBNLoader.d.ts +3 -4
- package/types/webgpu/CascadedShadowMapsNode.d.ts +13 -0
- package/types/webgpu/DualMipmapFilterNode.d.ts +1 -2
- package/types/webgpu/FnLayout.d.ts +4 -4
- package/types/webgpu/HighpVelocityNode.d.ts +1 -0
- package/types/webgpu/LensFlareNode.d.ts +2 -3
- package/types/webgpu/LensGlareNode.d.ts +1 -1
- package/types/webgpu/STBNTextureNode.d.ts +9 -0
- package/types/webgpu/ScreenSpaceShadowNode.d.ts +33 -0
- package/types/webgpu/SeparableFilterNode.d.ts +2 -3
- package/types/webgpu/SingleFilterNode.d.ts +1 -2
- package/types/webgpu/StorageTexture3DNode.d.ts +9 -0
- package/types/webgpu/TemporalAntialiasNode.d.ts +9 -10
- package/types/webgpu/accessors.d.ts +9 -8
- package/types/webgpu/debug.d.ts +4 -3
- package/types/webgpu/events.d.ts +3 -0
- package/types/webgpu/index.d.ts +5 -1
- package/types/webgpu/math.d.ts +3 -0
- package/types/webgpu/sampling.d.ts +2 -1
- package/types/webgpu/transformations.d.ts +7 -10
- package/src/webgpu/RTTextureNode.ts +0 -130
- package/types/webgpu/RTTextureNode.d.ts +0 -22
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DirectionalLight, PerspectiveCamera, Vector2 } from 'three';
|
|
2
|
+
import { CSMShadowNode } from 'three/examples/jsm/csm/CSMShadowNode.js';
|
|
3
|
+
import { NodeFrame } from 'three/webgpu';
|
|
4
|
+
declare module 'three/examples/jsm/csm/CSMShadowNode.js' {
|
|
5
|
+
interface CSMShadowNode {
|
|
6
|
+
_cascades: Vector2[];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare class CascadedShadowMapsNode extends CSMShadowNode {
|
|
10
|
+
camera: PerspectiveCamera;
|
|
11
|
+
light: DirectionalLight;
|
|
12
|
+
updateBefore(frame: NodeFrame): void;
|
|
13
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Vector2 } from 'three';
|
|
2
1
|
import { NodeBuilder, NodeFrame, TextureNode } from 'three/webgpu';
|
|
3
2
|
import { FilterNode } from './FilterNode';
|
|
4
3
|
import { Node } from './node';
|
|
@@ -9,7 +8,7 @@ export declare abstract class DualMipmapFilterNode extends FilterNode {
|
|
|
9
8
|
private readonly upsampleMaterial;
|
|
10
9
|
private readonly mesh;
|
|
11
10
|
private rendererState?;
|
|
12
|
-
protected readonly inputTexelSize: import('three/webgpu').UniformNode<Vector2>;
|
|
11
|
+
protected readonly inputTexelSize: import('three/webgpu').UniformNode<import('three').Vector2>;
|
|
13
12
|
protected readonly downsampleNode: TextureNode;
|
|
14
13
|
constructor(inputNode: TextureNode | null | undefined, levels: number);
|
|
15
14
|
setSize(width: number, height: number): this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ProxiedTuple, ShaderCallNodeInternal, ShaderNodeFn
|
|
2
|
-
import { NodeBuilder
|
|
1
|
+
import { ProxiedTuple, ShaderCallNodeInternal, ShaderNodeFn } from 'three/src/nodes/TSL.js';
|
|
2
|
+
import { NodeBuilder } from 'three/webgpu';
|
|
3
3
|
import { Node, NodeType } from './node';
|
|
4
|
-
type FnLayoutType = NodeType |
|
|
4
|
+
type FnLayoutType = NodeType | (new (...args: any[]) => any) | ((...args: any[]) => any);
|
|
5
5
|
export interface FnLayoutInput<T extends FnLayoutType = FnLayoutType> {
|
|
6
6
|
name: string;
|
|
7
7
|
type: T;
|
|
@@ -12,7 +12,7 @@ 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 ? Node<T> : T extends
|
|
15
|
+
type InferNodeObject<T extends FnLayoutType> = T extends NodeType ? Node<T> : T extends new (...args: any[]) => any ? InstanceType<T> : T extends (...args: any[]) => any ? ReturnType<T> : 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
|
};
|
|
@@ -9,6 +9,7 @@ export declare class HighpVelocityNode extends TempNode {
|
|
|
9
9
|
private readonly previousModelViewMatrix;
|
|
10
10
|
private readonly objectModelViewMatrices;
|
|
11
11
|
constructor();
|
|
12
|
+
setProjectionMatrix(value: Matrix4 | null): this;
|
|
12
13
|
update({ camera }: NodeFrame): void;
|
|
13
14
|
updateBefore({ object, camera }: NodeFrame): void;
|
|
14
15
|
updateAfter({ object }: NodeFrame): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TempNode, NodeBuilder, TextureNode } from 'three/webgpu';
|
|
1
|
+
import { TempNode, NodeBuilder, RTTNode, TextureNode } from 'three/webgpu';
|
|
2
2
|
import { DownsampleThresholdNode } from './DownsampleThresholdNode';
|
|
3
3
|
import { GaussianBlurNode } from './GaussianBlurNode';
|
|
4
4
|
import { LensGhostNode } from './LensGhostNode';
|
|
@@ -6,7 +6,6 @@ import { LensGlareNode } from './LensGlareNode';
|
|
|
6
6
|
import { LensHaloNode } from './LensHaloNode';
|
|
7
7
|
import { MipmapSurfaceBlurNode } from './MipmapSurfaceBlurNode';
|
|
8
8
|
import { Node } from './node';
|
|
9
|
-
import { RTTextureNode } from './RTTextureNode';
|
|
10
9
|
export declare class LensFlareNode extends TempNode {
|
|
11
10
|
static get type(): string;
|
|
12
11
|
inputNode?: TextureNode | null;
|
|
@@ -17,7 +16,7 @@ export declare class LensFlareNode extends TempNode {
|
|
|
17
16
|
bloomNode: MipmapSurfaceBlurNode;
|
|
18
17
|
glareNode: LensGlareNode;
|
|
19
18
|
bloomIntensity: import('three/webgpu').UniformNode<number>;
|
|
20
|
-
featuresNode:
|
|
19
|
+
featuresNode: RTTNode;
|
|
21
20
|
constructor(inputNode?: TextureNode | null);
|
|
22
21
|
setup(builder: NodeBuilder): unknown;
|
|
23
22
|
dispose(): void;
|
|
@@ -10,7 +10,7 @@ export declare class LensGlareNode extends FilterNode {
|
|
|
10
10
|
sizeScale: import('three/webgpu').UniformNode<Vector2>;
|
|
11
11
|
luminanceThreshold: import('three/webgpu').UniformNode<number>;
|
|
12
12
|
private computeNode?;
|
|
13
|
-
private readonly
|
|
13
|
+
private readonly indirectBuffer;
|
|
14
14
|
private instanceBuffer;
|
|
15
15
|
private readonly renderTarget;
|
|
16
16
|
private readonly material;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Texture3DNode, NodeBuilder } from 'three/webgpu';
|
|
2
|
+
export declare class STBNTextureNode extends Texture3DNode {
|
|
3
|
+
url: string;
|
|
4
|
+
constructor();
|
|
5
|
+
customCacheKey(): number;
|
|
6
|
+
setup(builder: NodeBuilder): unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare const stbnTexture: STBNTextureNode;
|
|
9
|
+
export declare const stbn: import('three/src/nodes/TSL.js').ShaderCallNodeInternal;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Camera, DirectionalLight } from 'three';
|
|
2
|
+
import { StorageTexture, TempNode, NodeBuilder, NodeFrame, TextureNode } from 'three/webgpu';
|
|
3
|
+
export declare class ScreenSpaceShadowNode extends TempNode {
|
|
4
|
+
get type(): string;
|
|
5
|
+
depthNode: TextureNode;
|
|
6
|
+
camera: Camera;
|
|
7
|
+
mainLight: DirectionalLight;
|
|
8
|
+
sampleCount: number;
|
|
9
|
+
hardShadowSamples: number;
|
|
10
|
+
fadeOutSamples: number;
|
|
11
|
+
readonly outputTexture: StorageTexture;
|
|
12
|
+
private readonly textureNode;
|
|
13
|
+
thickness: import('three/webgpu').UniformNode<number>;
|
|
14
|
+
shadowContrast: import('three/webgpu').UniformNode<number>;
|
|
15
|
+
shadowIntensity: import('three/webgpu').UniformNode<number>;
|
|
16
|
+
bilinearThreshold: import('three/webgpu').UniformNode<number>;
|
|
17
|
+
private readonly lightCoordinate;
|
|
18
|
+
private readonly dispatchOffset;
|
|
19
|
+
private readonly dispatchIndex;
|
|
20
|
+
private readonly dispatches;
|
|
21
|
+
private dispatchCount;
|
|
22
|
+
private readonly computeNode;
|
|
23
|
+
constructor(depthNode: TextureNode, camera: Camera, mainLight: DirectionalLight);
|
|
24
|
+
customCacheKey(): number;
|
|
25
|
+
getTextureNode(): TextureNode;
|
|
26
|
+
setSize(width: number, height: number): this;
|
|
27
|
+
updateBefore(frame: NodeFrame): void;
|
|
28
|
+
private updateDispatchList;
|
|
29
|
+
private createComputeNode;
|
|
30
|
+
setup(builder: NodeBuilder): unknown;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
}
|
|
33
|
+
export declare const screenSpaceShadow: (...args: ConstructorParameters<typeof ScreenSpaceShadowNode>) => ScreenSpaceShadowNode;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Vector2 } from 'three';
|
|
2
1
|
import { NodeBuilder, NodeFrame, TextureNode } from 'three/webgpu';
|
|
3
2
|
import { FilterNode } from './FilterNode';
|
|
4
3
|
import { Node } from './node';
|
|
@@ -9,8 +8,8 @@ export declare abstract class SeparableFilterNode extends FilterNode {
|
|
|
9
8
|
private readonly material;
|
|
10
9
|
private readonly mesh;
|
|
11
10
|
private rendererState?;
|
|
12
|
-
protected readonly inputTexelSize: import('three/webgpu').UniformNode<Vector2>;
|
|
13
|
-
protected readonly direction: import('three/webgpu').UniformNode<Vector2>;
|
|
11
|
+
protected readonly inputTexelSize: import('three/webgpu').UniformNode<import('three').Vector2>;
|
|
12
|
+
protected readonly direction: import('three/webgpu').UniformNode<import('three').Vector2>;
|
|
14
13
|
constructor(inputNode?: TextureNode | null);
|
|
15
14
|
setSize(width: number, height: number): this;
|
|
16
15
|
updateBefore({ renderer }: NodeFrame): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Vector2 } from 'three';
|
|
2
1
|
import { NodeBuilder, NodeFrame, TextureNode } from 'three/webgpu';
|
|
3
2
|
import { FilterNode } from './FilterNode';
|
|
4
3
|
import { Node } from './node';
|
|
@@ -7,7 +6,7 @@ export declare abstract class SingleFilterNode extends FilterNode {
|
|
|
7
6
|
private readonly material;
|
|
8
7
|
private readonly mesh;
|
|
9
8
|
private rendererState?;
|
|
10
|
-
protected readonly inputTexelSize: import('three/webgpu').UniformNode<Vector2>;
|
|
9
|
+
protected readonly inputTexelSize: import('three/webgpu').UniformNode<import('three').Vector2>;
|
|
11
10
|
constructor(inputNode?: TextureNode | null);
|
|
12
11
|
setSize(width: number, height: number): this;
|
|
13
12
|
updateBefore({ renderer }: NodeFrame): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StorageTextureNode, Node, NodeBuilder } from 'three/webgpu';
|
|
2
|
+
export declare class StorageTexture3DNode extends StorageTextureNode {
|
|
3
|
+
static get type(): string;
|
|
4
|
+
getDefaultUV(): Node;
|
|
5
|
+
setUpdateMatrix(_value: boolean): void;
|
|
6
|
+
generateUV(builder: NodeBuilder, uvNode: Node): string;
|
|
7
|
+
generateOffset(builder: NodeBuilder, offsetNode: Node): string;
|
|
8
|
+
}
|
|
9
|
+
export declare const storageTexture3D: (...args: ConstructorParameters<typeof StorageTexture3DNode>) => StorageTexture3DNode;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Camera } from 'three';
|
|
2
2
|
import { TempNode, NodeBuilder, NodeFrame, TextureNode } from 'three/webgpu';
|
|
3
3
|
import { Node } from './node';
|
|
4
|
-
interface VelocityNodeImmutable {
|
|
5
|
-
projectionMatrix?: Matrix4 | null;
|
|
6
|
-
}
|
|
7
4
|
interface SupportedCamera extends Camera {
|
|
8
5
|
updateProjectionMatrix(): void;
|
|
9
6
|
setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void;
|
|
@@ -11,7 +8,6 @@ interface SupportedCamera extends Camera {
|
|
|
11
8
|
}
|
|
12
9
|
export declare class TemporalAntialiasNode extends TempNode {
|
|
13
10
|
static get type(): string;
|
|
14
|
-
private readonly velocityNodeImmutable;
|
|
15
11
|
inputNode: TextureNode;
|
|
16
12
|
depthNode: TextureNode;
|
|
17
13
|
velocityNode: TextureNode;
|
|
@@ -26,21 +22,19 @@ export declare class TemporalAntialiasNode extends TempNode {
|
|
|
26
22
|
private historyRT;
|
|
27
23
|
private previousDepthTexture?;
|
|
28
24
|
private readonly resolveMaterial;
|
|
29
|
-
private readonly copyMaterial;
|
|
30
25
|
private readonly mesh;
|
|
31
26
|
private rendererState?;
|
|
32
|
-
private
|
|
27
|
+
private needsSyncRenderPipeline;
|
|
33
28
|
private needsClearHistory;
|
|
34
29
|
private readonly resolveNode;
|
|
35
30
|
private readonly historyNode;
|
|
36
31
|
private readonly previousDepthNode;
|
|
37
32
|
private readonly originalProjectionMatrix;
|
|
38
33
|
private jitterIndex;
|
|
39
|
-
constructor(
|
|
34
|
+
constructor(inputNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera);
|
|
40
35
|
customCacheKey(): number;
|
|
41
36
|
private createRenderTarget;
|
|
42
37
|
getTextureNode(): TextureNode;
|
|
43
|
-
private setProjectionMatrix;
|
|
44
38
|
setSize(width: number, height: number): this;
|
|
45
39
|
private clearHistory;
|
|
46
40
|
private setViewOffset;
|
|
@@ -52,5 +46,10 @@ export declare class TemporalAntialiasNode extends TempNode {
|
|
|
52
46
|
setup(builder: NodeBuilder): unknown;
|
|
53
47
|
dispose(): void;
|
|
54
48
|
}
|
|
55
|
-
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Function signature has been changed. Use
|
|
51
|
+
* temporalAntialias(inputNode, depthNode, velocityNode, camera)
|
|
52
|
+
*/
|
|
53
|
+
export declare function temporalAntialias(velocityNodeImmutable: unknown): (inputNode: Node, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera) => TemporalAntialiasNode;
|
|
54
|
+
export declare function temporalAntialias(inputNode: Node, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera): TemporalAntialiasNode;
|
|
56
55
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Camera, Vector3 } from 'three';
|
|
2
2
|
import { UniformNode } from 'three/webgpu';
|
|
3
3
|
import { Node } from './node';
|
|
4
|
-
export declare const projectionMatrix: (camera
|
|
5
|
-
export declare const viewMatrix: (camera
|
|
6
|
-
export declare const inverseProjectionMatrix: (camera
|
|
7
|
-
export declare const inverseViewMatrix: (camera
|
|
8
|
-
export declare const cameraPositionWorld: (camera
|
|
9
|
-
export declare const cameraNear: (camera
|
|
10
|
-
export declare const cameraFar: (camera
|
|
4
|
+
export declare const projectionMatrix: (camera?: Camera | null) => Node<"mat4">;
|
|
5
|
+
export declare const viewMatrix: (camera?: Camera | null) => Node<"mat4">;
|
|
6
|
+
export declare const inverseProjectionMatrix: (camera?: Camera | null) => Node<"mat4">;
|
|
7
|
+
export declare const inverseViewMatrix: (camera?: Camera | null) => Node<"mat4">;
|
|
8
|
+
export declare const cameraPositionWorld: (camera?: Camera | null) => UniformNode<Vector3>;
|
|
9
|
+
export declare const cameraNear: (camera?: Camera | null) => Node<"float">;
|
|
10
|
+
export declare const cameraFar: (camera?: Camera | null) => Node<"float">;
|
|
11
|
+
export declare const viewZ: import('three/webgpu').VarNode;
|
package/types/webgpu/debug.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NodeMaterial, Node, Renderer } from 'three/webgpu';
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function debugVertexNode(renderer: Renderer, material: NodeMaterial):
|
|
4
|
-
export declare function
|
|
2
|
+
export declare function debugMaterial(renderer: Renderer, material: NodeMaterial): Promise<string | null>;
|
|
3
|
+
export declare function debugVertexNode(renderer: Renderer, material: NodeMaterial): Promise<string | null>;
|
|
4
|
+
export declare function debugFragmentNode(renderer: Renderer, material: NodeMaterial): Promise<string | null>;
|
|
5
|
+
export declare function debugNode(renderer: Renderer, node: Node): Promise<string | null>;
|
|
5
6
|
export declare function hookFunction<T, K extends keyof {
|
|
6
7
|
[K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: unknown;
|
|
7
8
|
}, Args extends unknown[] = T[K] extends (...args: any[]) => any ? Parameters<T[K]> : never, Result = T[K] extends (...args: any[]) => any ? ReturnType<T[K]> : never>(target: T, name: K, callback: (...args: Args) => void): T;
|
package/types/webgpu/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './accessors';
|
|
2
|
+
export * from './CascadedShadowMapsNode';
|
|
2
3
|
export * from './debug';
|
|
3
4
|
export * from './DownsampleThresholdNode';
|
|
5
|
+
export * from './events';
|
|
4
6
|
export * from './FnLayout';
|
|
5
7
|
export * from './FnVar';
|
|
6
8
|
export * from './GaussianBlurNode';
|
|
@@ -14,8 +16,10 @@ export * from './MipmapSurfaceBlurNode';
|
|
|
14
16
|
export * from './node';
|
|
15
17
|
export * from './OutputTexture3DNode';
|
|
16
18
|
export * from './OutputTextureNode';
|
|
17
|
-
export * from './RTTextureNode';
|
|
18
19
|
export * from './sampling';
|
|
20
|
+
export * from './ScreenSpaceShadowNode';
|
|
21
|
+
export * from './STBNTextureNode';
|
|
22
|
+
export * from './StorageTexture3DNode';
|
|
19
23
|
export * from './TemporalAntialiasNode';
|
|
20
24
|
export * from './transformations';
|
|
21
25
|
export * from './utils';
|
package/types/webgpu/math.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export declare const bvecNot: (...params: import('three/webgpu').Node[]) => import('three/webgpu').FunctionOverloadingNode;
|
|
2
|
+
export declare const bvecAnd: (...params: import('three/webgpu').Node[]) => import('three/webgpu').FunctionOverloadingNode;
|
|
3
|
+
export declare const bvecOr: (...params: import('three/webgpu').Node[]) => import('three/webgpu').FunctionOverloadingNode;
|
|
1
4
|
export declare const raySphereIntersection: import('three/src/nodes/TSL.js').ShaderNodeFn<[rayOrigin: number | import('three/webgpu').Node, rayDirection: number | import('three/webgpu').Node, center: number | import('three/webgpu').Node, radius: number | import('three/webgpu').Node]>;
|
|
2
5
|
export declare const raySpheresIntersectionsStruct: import('three/src/nodes/TSL.js').Struct;
|
|
3
6
|
export declare const raySpheresIntersections: import('three/src/nodes/TSL.js').ShaderNodeFn<[rayOrigin: number | import('three/webgpu').Node, rayDirection: number | import('three/webgpu').Node, center: number | import('three/webgpu').Node, radii: number | import('three/webgpu').Node]>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const textureGather: import('three/src/nodes/TSL.js').ShaderNodeFn<[textureNode: number | import('three/webgpu').Node, uvNode: number | import('three/webgpu').Node, component?: unknown]>;
|
|
2
|
+
export declare const textureCatmullRom: import('three/src/nodes/TSL.js').ShaderNodeFn<[textureNode: number | import('three/webgpu').Node, uvNode?: number | import('three/webgpu').Node | undefined]>;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import { Camera } from 'three';
|
|
1
2
|
import { Node } from './node';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
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">;
|
|
3
|
+
export declare const depthToViewZ: import('three/src/nodes/TSL.js').ShaderNodeFn<[depth: number | import('three/webgpu').Node, camera?: Camera | null | undefined, near?: number | import('three/webgpu').Node | null | undefined, far?: number | import('three/webgpu').Node | null | undefined]>;
|
|
4
|
+
export declare const logarithmicToPerspectiveDepth: (depth: Node<"float">, near?: Node<"float"> | null, far?: Node<"float"> | null) => Node<"float">;
|
|
5
|
+
export declare const perspectiveToLogarithmicDepth: (depth: Node<"float">, near?: Node<"float"> | null, far?: Node<"float"> | null) => Node<"float">;
|
|
9
6
|
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: (
|
|
11
|
-
export declare const depthToColor: (depth: Node
|
|
12
|
-
export declare const equirectToDirectionWorld: (
|
|
7
|
+
export declare const turbo: import('three/src/nodes/TSL.js').ShaderNodeFn<[number | import('three/webgpu').Node]>;
|
|
8
|
+
export declare const depthToColor: import('three/src/nodes/TSL.js').ShaderNodeFn<[depth: number | import('three/webgpu').Node, camera?: Camera | undefined, near?: number | import('three/webgpu').Node | undefined, far?: number | import('three/webgpu').Node | undefined]>;
|
|
9
|
+
export declare const equirectToDirectionWorld: import('three/src/nodes/TSL.js').ShaderNodeFn<[number | import('three/webgpu').Node]>;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { uv } from 'three/tsl'
|
|
2
|
-
import {
|
|
3
|
-
HalfFloatType,
|
|
4
|
-
LinearFilter,
|
|
5
|
-
NodeMaterial,
|
|
6
|
-
NodeUpdateType,
|
|
7
|
-
QuadMesh,
|
|
8
|
-
RendererUtils,
|
|
9
|
-
RenderTarget,
|
|
10
|
-
RGBAFormat,
|
|
11
|
-
TextureNode,
|
|
12
|
-
Vector2,
|
|
13
|
-
type Node,
|
|
14
|
-
type NodeBuilder,
|
|
15
|
-
type NodeFrame
|
|
16
|
-
} from 'three/webgpu'
|
|
17
|
-
|
|
18
|
-
const { resetRendererState, restoreRendererState } = RendererUtils
|
|
19
|
-
|
|
20
|
-
function createRenderTarget(): RenderTarget {
|
|
21
|
-
const renderTarget = new RenderTarget(1, 1, {
|
|
22
|
-
depthBuffer: false,
|
|
23
|
-
type: HalfFloatType,
|
|
24
|
-
format: RGBAFormat
|
|
25
|
-
})
|
|
26
|
-
const texture = renderTarget.texture
|
|
27
|
-
texture.minFilter = LinearFilter
|
|
28
|
-
texture.magFilter = LinearFilter
|
|
29
|
-
texture.generateMipmaps = false
|
|
30
|
-
return renderTarget
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const sizeScratch = /*#__PURE__*/ new Vector2()
|
|
34
|
-
|
|
35
|
-
// Similar to RTTNode, which is a bit finicky to handle.
|
|
36
|
-
export class RTTextureNode extends TextureNode {
|
|
37
|
-
static override get type(): string {
|
|
38
|
-
return 'RTTextureNode'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
node: Node
|
|
42
|
-
resolutionScale = 1
|
|
43
|
-
|
|
44
|
-
private readonly renderTarget: RenderTarget
|
|
45
|
-
private readonly material = new NodeMaterial()
|
|
46
|
-
private readonly mesh = new QuadMesh(this.material)
|
|
47
|
-
private rendererState?: RendererUtils.RendererState
|
|
48
|
-
|
|
49
|
-
constructor(node: Node, uvNode?: Node) {
|
|
50
|
-
const renderTarget = createRenderTarget()
|
|
51
|
-
super(renderTarget.texture, uvNode ?? uv())
|
|
52
|
-
this.node = node
|
|
53
|
-
this.renderTarget = renderTarget
|
|
54
|
-
this.updateBeforeType = NodeUpdateType.FRAME
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
setSize(width: number, height: number): this {
|
|
58
|
-
const { resolutionScale } = this
|
|
59
|
-
const w = Math.max(Math.round(width * resolutionScale), 1)
|
|
60
|
-
const h = Math.max(Math.round(height * resolutionScale), 1)
|
|
61
|
-
this.renderTarget.setSize(w, h)
|
|
62
|
-
return this
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
override updateBefore({ renderer }: NodeFrame): void {
|
|
66
|
-
if (renderer == null) {
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const size = renderer.getDrawingBufferSize(sizeScratch)
|
|
71
|
-
this.setSize(size.x, size.y)
|
|
72
|
-
|
|
73
|
-
this.rendererState = resetRendererState(renderer, this.rendererState)
|
|
74
|
-
|
|
75
|
-
renderer.setRenderTarget(this.renderTarget)
|
|
76
|
-
this.mesh.render(renderer)
|
|
77
|
-
|
|
78
|
-
restoreRendererState(renderer, this.rendererState)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
override setup(builder: NodeBuilder): unknown {
|
|
82
|
-
const { material } = this
|
|
83
|
-
// I don't fully understand why, but updates on "node" doesn't propagate
|
|
84
|
-
// unless giving the builder context.
|
|
85
|
-
material.fragmentNode = this.node.context(builder.getContext())
|
|
86
|
-
material.needsUpdate = true
|
|
87
|
-
return super.setup(builder)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
override dispose(): void {
|
|
91
|
-
this.renderTarget.dispose()
|
|
92
|
-
this.material.dispose()
|
|
93
|
-
this.mesh.geometry.dispose()
|
|
94
|
-
super.dispose()
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// @ts-expect-error Ignore
|
|
98
|
-
override clone(): TextureNode {
|
|
99
|
-
const result = new TextureNode(this.value, this.uvNode, this.levelNode)
|
|
100
|
-
result.sampler = this.sampler
|
|
101
|
-
result.referenceNode = this
|
|
102
|
-
return result
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export const rtTexture = (
|
|
107
|
-
...args: ConstructorParameters<typeof RTTextureNode>
|
|
108
|
-
): RTTextureNode => new RTTextureNode(...args)
|
|
109
|
-
|
|
110
|
-
export const convertToTexture = (
|
|
111
|
-
node: Node & {
|
|
112
|
-
isTextureNode?: boolean
|
|
113
|
-
isSampleNode?: boolean
|
|
114
|
-
getTextureNode?: () => TextureNode
|
|
115
|
-
},
|
|
116
|
-
name?: string
|
|
117
|
-
): TextureNode => {
|
|
118
|
-
let textureNode: TextureNode
|
|
119
|
-
if (node.isTextureNode === true || node.isSampleNode === true) {
|
|
120
|
-
textureNode = node as TextureNode
|
|
121
|
-
} else if (node.getTextureNode != null) {
|
|
122
|
-
textureNode = node.getTextureNode()
|
|
123
|
-
} else {
|
|
124
|
-
textureNode = new RTTextureNode(node)
|
|
125
|
-
if (name != null) {
|
|
126
|
-
textureNode.value.name = name
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return textureNode
|
|
130
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { TextureNode, Node, NodeBuilder, NodeFrame } from 'three/webgpu';
|
|
2
|
-
export declare class RTTextureNode extends TextureNode {
|
|
3
|
-
static get type(): string;
|
|
4
|
-
node: Node;
|
|
5
|
-
resolutionScale: number;
|
|
6
|
-
private readonly renderTarget;
|
|
7
|
-
private readonly material;
|
|
8
|
-
private readonly mesh;
|
|
9
|
-
private rendererState?;
|
|
10
|
-
constructor(node: Node, uvNode?: Node);
|
|
11
|
-
setSize(width: number, height: number): this;
|
|
12
|
-
updateBefore({ renderer }: NodeFrame): void;
|
|
13
|
-
setup(builder: NodeBuilder): unknown;
|
|
14
|
-
dispose(): void;
|
|
15
|
-
clone(): TextureNode;
|
|
16
|
-
}
|
|
17
|
-
export declare const rtTexture: (...args: ConstructorParameters<typeof RTTextureNode>) => RTTextureNode;
|
|
18
|
-
export declare const convertToTexture: (node: Node & {
|
|
19
|
-
isTextureNode?: boolean;
|
|
20
|
-
isSampleNode?: boolean;
|
|
21
|
-
getTextureNode?: () => TextureNode;
|
|
22
|
-
}, name?: string) => TextureNode;
|