@types/three 0.165.0 → 0.166.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 +1 -1
- three/examples/jsm/exporters/GLTFExporter.d.ts +6 -0
- three/examples/jsm/geometries/TeapotGeometry.d.ts +24 -0
- three/examples/jsm/helpers/ViewHelper.d.ts +8 -6
- three/examples/jsm/lines/LineMaterial.d.ts +2 -4
- three/examples/jsm/loaders/DDSLoader.d.ts +8 -2
- three/examples/jsm/loaders/GLTFLoader.d.ts +3 -1
- three/examples/jsm/loaders/KTXLoader.d.ts +8 -2
- three/examples/jsm/loaders/PVRLoader.d.ts +2 -2
- three/examples/jsm/nodes/Nodes.d.ts +10 -3
- three/examples/jsm/nodes/accessors/BufferAttributeNode.d.ts +1 -0
- three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +7 -0
- three/examples/jsm/nodes/accessors/StorageTextureNode.d.ts +40 -0
- three/examples/jsm/nodes/core/CacheNode.d.ts +4 -5
- three/examples/jsm/nodes/core/LightingModel.d.ts +11 -0
- three/examples/jsm/nodes/core/Node.d.ts +3 -0
- three/examples/jsm/nodes/core/NodeBuilder.d.ts +7 -3
- three/examples/jsm/nodes/core/NodeCache.d.ts +12 -4
- three/examples/jsm/nodes/core/NodeFunction.d.ts +2 -2
- three/examples/jsm/nodes/core/NodeUniform.d.ts +1 -1
- three/examples/jsm/nodes/core/UniformNode.d.ts +2 -0
- three/examples/jsm/nodes/core/VarNode.d.ts +2 -0
- three/examples/jsm/nodes/display/DepthOfFieldNode.d.ts +30 -0
- three/examples/jsm/nodes/display/DotScreenNode.d.ts +32 -0
- three/examples/jsm/nodes/display/PassNode.d.ts +1 -1
- three/examples/jsm/nodes/display/RGBShiftNode.d.ts +24 -0
- three/examples/jsm/nodes/display/SobelOperatorNode.d.ts +17 -0
- three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +4 -6
- three/examples/jsm/nodes/functions/BSDF/LTC.d.ts +9 -0
- three/examples/jsm/nodes/lighting/RectAreaLightNode.d.ts +10 -0
- three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +2 -3
- three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +17 -18
- three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +6 -7
- three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +3 -4
- three/examples/jsm/nodes/materials/NodeMaterial.d.ts +32 -33
- three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +2 -3
- three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +1 -0
- three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +230 -0
- three/examples/jsm/nodes/math/MathNode.d.ts +5 -1
- three/examples/jsm/nodes/utils/DiscardNode.d.ts +1 -0
- three/examples/jsm/renderers/common/BindGroup.d.ts +9 -0
- three/examples/jsm/renderers/common/Bindings.d.ts +11 -14
- three/examples/jsm/renderers/common/Geometries.d.ts +3 -3
- three/examples/jsm/renderers/common/Info.d.ts +6 -1
- three/examples/jsm/renderers/common/PostProcessing.d.ts +2 -0
- three/examples/jsm/renderers/common/RenderObject.d.ts +3 -3
- three/examples/jsm/renderers/common/Renderer.d.ts +11 -0
- three/examples/jsm/renderers/common/SampledTexture.d.ts +27 -0
- three/examples/jsm/renderers/common/Sampler.d.ts +11 -0
- three/examples/jsm/renderers/common/Uniform.d.ts +3 -3
- three/examples/jsm/renderers/common/UniformsGroup.d.ts +4 -2
- three/examples/jsm/renderers/common/nodes/NodeBuilderState.d.ts +8 -4
- three/examples/jsm/renderers/common/nodes/NodeSampledTexture.d.ts +29 -0
- three/examples/jsm/renderers/common/nodes/NodeSampler.d.ts +12 -0
- three/examples/jsm/renderers/common/nodes/NodeUniform.d.ts +4 -4
- three/examples/jsm/renderers/common/nodes/NodeUniformsGroup.d.ts +0 -1
- three/examples/jsm/renderers/common/nodes/Nodes.d.ts +1 -0
- three/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +123 -0
- three/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +6 -0
- three/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.d.ts +6 -0
- three/examples/jsm/renderers/webgpu/utils/WebGPUConstants.d.ts +328 -0
- three/package.json +4 -4
- three/src/Three.d.ts +1 -0
- three/src/constants.d.ts +6 -0
- three/src/extras/ShapeUtils.d.ts +5 -8
- three/src/extras/TextureUtils.d.ts +42 -0
- three/src/lights/LightShadow.d.ts +5 -0
- three/src/materials/Material.d.ts +21 -12
- three/src/math/Vector4.d.ts +6 -0
- three/src/objects/BatchedMesh.d.ts +58 -54
- three/src/renderers/shaders/UniformsLib.d.ts +3 -0
- three/src/renderers/webxr/WebXRDepthSensing.d.ts +2 -0
- three/src/renderers/webxr/WebXRManager.d.ts +33 -23
- three/src/textures/CompressedArrayTexture.d.ts +4 -4
- three/src/textures/CompressedTexture.d.ts +16 -8
- three/src/textures/Texture.d.ts +3 -1
- three/examples/jsm/renderers/webgl/nodes/SlotNode.d.ts +0 -17
- three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +0 -37
- three/examples/jsm/renderers/webgl/nodes/WebGLNodes.d.ts +0 -3
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
|
|
2
2
|
import Attributes from "./Attributes.js";
|
|
3
3
|
import Backend from "./Backend.js";
|
|
4
|
-
import
|
|
4
|
+
import BindGroup from "./BindGroup.js";
|
|
5
5
|
import DataMap from "./DataMap.js";
|
|
6
6
|
import Info from "./Info.js";
|
|
7
7
|
import Nodes from "./nodes/Nodes.js";
|
|
8
8
|
import Pipelines from "./Pipelines.js";
|
|
9
9
|
import RenderObject from "./RenderObject.js";
|
|
10
10
|
import Textures from "./Textures.js";
|
|
11
|
-
interface
|
|
12
|
-
|
|
11
|
+
interface BindGroupData {
|
|
12
|
+
bindGroup?: BindGroup | undefined;
|
|
13
13
|
}
|
|
14
14
|
declare class Bindings extends DataMap<{
|
|
15
|
-
|
|
16
|
-
key:
|
|
17
|
-
value:
|
|
18
|
-
};
|
|
19
|
-
computeNode: {
|
|
20
|
-
key: ComputeNode;
|
|
21
|
-
value: Data;
|
|
15
|
+
bindGroup: {
|
|
16
|
+
key: BindGroup;
|
|
17
|
+
value: BindGroupData;
|
|
22
18
|
};
|
|
23
19
|
}> {
|
|
24
20
|
backend: Backend;
|
|
@@ -35,11 +31,12 @@ declare class Bindings extends DataMap<{
|
|
|
35
31
|
pipelines: Pipelines,
|
|
36
32
|
info: Info,
|
|
37
33
|
);
|
|
38
|
-
getForRender(renderObject: RenderObject):
|
|
39
|
-
getForCompute(computeNode: ComputeNode):
|
|
34
|
+
getForRender(renderObject: RenderObject): BindGroup[];
|
|
35
|
+
getForCompute(computeNode: ComputeNode): BindGroup[];
|
|
40
36
|
updateForCompute(computeNode: ComputeNode): void;
|
|
41
37
|
updateForRender(renderObject: RenderObject): void;
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
_updateBindings(object: ComputeNode | RenderObject, bindings: BindGroup[]): void;
|
|
39
|
+
_init(bindGroup: BindGroup): void;
|
|
40
|
+
_update(object: ComputeNode | RenderObject, bindGroup: BindGroup, bindings: BindGroup[]): void;
|
|
44
41
|
}
|
|
45
42
|
export default Bindings;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BufferAttribute, BufferGeometry } from "three";
|
|
1
|
+
import { BufferAttribute, BufferGeometry, InterleavedBuffer, InterleavedBufferAttribute } from "three";
|
|
2
2
|
import Attributes from "./Attributes.js";
|
|
3
3
|
import { AttributeType } from "./Constants.js";
|
|
4
4
|
import DataMap from "./DataMap.js";
|
|
@@ -16,13 +16,13 @@ declare class Geometries extends DataMap<{
|
|
|
16
16
|
attributes: Attributes;
|
|
17
17
|
info: Info;
|
|
18
18
|
wireframes: WeakMap<BufferGeometry, BufferAttribute>;
|
|
19
|
-
attributeCall: WeakMap<BufferAttribute, number>;
|
|
19
|
+
attributeCall: WeakMap<BufferAttribute | InterleavedBufferAttribute | InterleavedBuffer, number>;
|
|
20
20
|
constructor(attributes: Attributes, info: Info);
|
|
21
21
|
has(renderObject: RenderObject | BufferGeometry): boolean;
|
|
22
22
|
updateForRender(renderObject: RenderObject): void;
|
|
23
23
|
initGeometry(renderObject: RenderObject): void;
|
|
24
24
|
updateAttributes(renderObject: RenderObject): void;
|
|
25
|
-
updateAttribute(attribute: BufferAttribute, type: AttributeType): void;
|
|
25
|
+
updateAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, type: AttributeType): void;
|
|
26
26
|
getIndex(renderObject: RenderObject): BufferAttribute | null;
|
|
27
27
|
}
|
|
28
28
|
export default Geometries;
|
|
@@ -5,16 +5,21 @@ declare class Info {
|
|
|
5
5
|
calls: number;
|
|
6
6
|
render: {
|
|
7
7
|
calls: number;
|
|
8
|
+
frameCalls: number;
|
|
8
9
|
drawCalls: number;
|
|
9
10
|
triangles: number;
|
|
10
11
|
points: number;
|
|
11
12
|
lines: number;
|
|
12
13
|
timestamp: number;
|
|
14
|
+
previousFrameCalls: number;
|
|
15
|
+
timestampCalls: number;
|
|
13
16
|
};
|
|
14
17
|
compute: {
|
|
15
18
|
calls: number;
|
|
16
|
-
|
|
19
|
+
frameCalls: number;
|
|
17
20
|
timestamp: number;
|
|
21
|
+
previousFrameCalls: number;
|
|
22
|
+
timestampCalls: number;
|
|
18
23
|
};
|
|
19
24
|
memory: {
|
|
20
25
|
geometries: number;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
Scene,
|
|
10
10
|
} from "three";
|
|
11
11
|
import LightsNode from "../../nodes/lighting/LightsNode.js";
|
|
12
|
-
import
|
|
12
|
+
import BindGroup from "./BindGroup.js";
|
|
13
13
|
import ClippingContext from "./ClippingContext.js";
|
|
14
14
|
import Geometries from "./Geometries.js";
|
|
15
15
|
import NodeBuilderState from "./nodes/NodeBuilderState.js";
|
|
@@ -42,7 +42,7 @@ export default class RenderObject {
|
|
|
42
42
|
initialNodesCacheKey: string;
|
|
43
43
|
initialCacheKey: string;
|
|
44
44
|
_nodeBuilderState: NodeBuilderState | null;
|
|
45
|
-
_bindings:
|
|
45
|
+
_bindings: BindGroup[] | null;
|
|
46
46
|
onDispose: (() => void) | null;
|
|
47
47
|
readonly isRenderObject: true;
|
|
48
48
|
onMaterialDispose: () => void;
|
|
@@ -60,7 +60,7 @@ export default class RenderObject {
|
|
|
60
60
|
updateClipping(parent: ClippingContext): void;
|
|
61
61
|
get clippingNeedsUpdate(): boolean;
|
|
62
62
|
getNodeBuilderState(): NodeBuilderState;
|
|
63
|
-
getBindings():
|
|
63
|
+
getBindings(): BindGroup[];
|
|
64
64
|
getIndex(): BufferAttribute | null;
|
|
65
65
|
getChainArray(): readonly [Object3D<import("three").Object3DEventMap>, Material, RenderContext, LightsNode];
|
|
66
66
|
getAttributes(): (InterleavedBufferAttribute | BufferAttribute)[];
|
|
@@ -133,6 +133,17 @@ declare class Renderer {
|
|
|
133
133
|
xr: {
|
|
134
134
|
enabled: boolean;
|
|
135
135
|
};
|
|
136
|
+
debug: {
|
|
137
|
+
checkShaderErrors: boolean;
|
|
138
|
+
onShaderError:
|
|
139
|
+
| ((
|
|
140
|
+
gl: WebGL2RenderingContext,
|
|
141
|
+
programGPU: WebGLProgram,
|
|
142
|
+
glVertexShader: WebGLShader,
|
|
143
|
+
glFragmentShader: WebGLShader,
|
|
144
|
+
) => void)
|
|
145
|
+
| null;
|
|
146
|
+
};
|
|
136
147
|
localClippingEnabled?: boolean | undefined;
|
|
137
148
|
constructor(backend: Backend, parameters?: RendererParameters);
|
|
138
149
|
init(): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Texture } from "three";
|
|
2
|
+
import Binding from "./Binding.js";
|
|
3
|
+
|
|
4
|
+
declare class SampledTexture extends Binding {
|
|
5
|
+
id: number;
|
|
6
|
+
texture: Texture | null;
|
|
7
|
+
version: number;
|
|
8
|
+
store: boolean;
|
|
9
|
+
readonly isSampledTexture: true;
|
|
10
|
+
constructor(name: string, texture: Texture | null);
|
|
11
|
+
get needsBindingsUpdate(): boolean;
|
|
12
|
+
update(): boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class SampledArrayTexture extends SampledTexture {
|
|
16
|
+
readonly isSampledArrayTexture: true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare class Sampled3DTexture extends SampledTexture {
|
|
20
|
+
readonly isSampled3DTexture: true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare class SampledCubeTexture extends SampledTexture {
|
|
24
|
+
readonly isSampledCubeTexture: true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { Sampled3DTexture, SampledArrayTexture, SampledCubeTexture, SampledTexture };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import TextureNode from "../../nodes/accessors/TextureNode.js";
|
|
2
|
+
import Binding from "./Binding.js";
|
|
3
|
+
|
|
4
|
+
declare class Sampler extends Binding {
|
|
5
|
+
texture: TextureNode | null;
|
|
6
|
+
version: number;
|
|
7
|
+
readonly isSampler: true;
|
|
8
|
+
constructor(name: string, texture: TextureNode | null);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default Sampler;
|
|
@@ -9,8 +9,8 @@ declare class Uniform<TValue> {
|
|
|
9
9
|
setValue(value: TValue): void;
|
|
10
10
|
getValue(): TValue;
|
|
11
11
|
}
|
|
12
|
-
declare class
|
|
13
|
-
readonly
|
|
12
|
+
declare class NumberUniform extends Uniform<number> {
|
|
13
|
+
readonly isNumberUniform: true;
|
|
14
14
|
constructor(name: string, value?: number);
|
|
15
15
|
}
|
|
16
16
|
declare class Vector2Uniform extends Uniform<Vector2> {
|
|
@@ -37,4 +37,4 @@ declare class Matrix4Uniform extends Uniform<Matrix4> {
|
|
|
37
37
|
readonly isMatrix4Uniform: true;
|
|
38
38
|
constructor(name: string, value?: Matrix4);
|
|
39
39
|
}
|
|
40
|
-
export { ColorUniform,
|
|
40
|
+
export { ColorUniform, Matrix3Uniform, Matrix4Uniform, NumberUniform, Vector2Uniform, Vector3Uniform, Vector4Uniform };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ColorNodeUniform,
|
|
3
|
-
FloatNodeUniform,
|
|
4
3
|
Matrix3NodeUniform,
|
|
5
4
|
Matrix4NodeUniform,
|
|
6
5
|
NodeUniformGPU,
|
|
6
|
+
NumberNodeUniform,
|
|
7
7
|
Vector2NodeUniform,
|
|
8
8
|
Vector3NodeUniform,
|
|
9
9
|
Vector4NodeUniform,
|
|
@@ -11,15 +11,17 @@ import {
|
|
|
11
11
|
import UniformBuffer from "./UniformBuffer.js";
|
|
12
12
|
declare class UniformsGroup extends UniformBuffer {
|
|
13
13
|
readonly isUniformsGroup: true;
|
|
14
|
+
_values: number[] | null;
|
|
14
15
|
uniforms: NodeUniformGPU[];
|
|
15
16
|
constructor(name?: string);
|
|
16
17
|
addUniform(uniform: NodeUniformGPU): this;
|
|
17
18
|
removeUniform(uniform: NodeUniformGPU): this;
|
|
19
|
+
get values(): number[];
|
|
18
20
|
get buffer(): Float32Array;
|
|
19
21
|
get byteLength(): number;
|
|
20
22
|
update(): boolean;
|
|
21
23
|
updateByType(uniform: NodeUniformGPU): boolean | undefined;
|
|
22
|
-
updateNumber(uniform:
|
|
24
|
+
updateNumber(uniform: NumberNodeUniform): boolean;
|
|
23
25
|
updateVector2(uniform: Vector2NodeUniform): boolean;
|
|
24
26
|
updateVector3(uniform: Vector3NodeUniform): boolean;
|
|
25
27
|
updateVector4(uniform: Vector4NodeUniform): boolean;
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import Node from "../../../nodes/core/Node.js";
|
|
2
2
|
import NodeAttribute from "../../../nodes/core/NodeAttribute.js";
|
|
3
|
-
import
|
|
3
|
+
import BindGroup from "../BindGroup.js";
|
|
4
4
|
declare class NodeBuilderState {
|
|
5
5
|
vertexShader: string | null;
|
|
6
6
|
fragmentShader: string | null;
|
|
7
7
|
computeShader: string | null;
|
|
8
8
|
transforms: never[];
|
|
9
9
|
nodeAttributes: NodeAttribute[];
|
|
10
|
-
bindings:
|
|
10
|
+
bindings: BindGroup[];
|
|
11
11
|
updateNodes: Node[];
|
|
12
12
|
updateBeforeNodes: Node[];
|
|
13
|
+
updateAfterNodes: Node[];
|
|
14
|
+
instanceBindGroups: boolean;
|
|
13
15
|
usedTimes: number;
|
|
14
16
|
constructor(
|
|
15
17
|
vertexShader: string | null,
|
|
16
18
|
fragmentShader: string | null,
|
|
17
19
|
computeShader: string | null,
|
|
18
20
|
nodeAttributes: NodeAttribute[],
|
|
19
|
-
bindings:
|
|
21
|
+
bindings: BindGroup[],
|
|
20
22
|
updateNodes: Node[],
|
|
21
23
|
updateBeforeNodes: Node[],
|
|
24
|
+
updateAfterNodes: Node[],
|
|
25
|
+
instanceBindGroups?: boolean,
|
|
22
26
|
transforms?: never[],
|
|
23
27
|
);
|
|
24
|
-
createBindings():
|
|
28
|
+
createBindings(): BindGroup[];
|
|
25
29
|
}
|
|
26
30
|
export default NodeBuilderState;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import TextureNode from "../../../nodes/accessors/TextureNode.js";
|
|
2
|
+
import UniformGroupNode from "../../../nodes/core/UniformGroupNode.js";
|
|
3
|
+
import { SampledTexture } from "../SampledTexture.js";
|
|
4
|
+
|
|
5
|
+
type GPUStorageTextureAccess = "read-only" | "read-write" | "write-only";
|
|
6
|
+
|
|
7
|
+
declare class NodeSampledTexture extends SampledTexture {
|
|
8
|
+
textureNode: TextureNode | undefined;
|
|
9
|
+
groupNode: UniformGroupNode;
|
|
10
|
+
access: "read-write" | "read-only" | "write-only";
|
|
11
|
+
constructor(
|
|
12
|
+
name: string,
|
|
13
|
+
textureNode: TextureNode | undefined,
|
|
14
|
+
groupNode: UniformGroupNode,
|
|
15
|
+
access: GPUStorageTextureAccess | null,
|
|
16
|
+
);
|
|
17
|
+
get needsBindingsUpdate(): boolean;
|
|
18
|
+
update(): boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class NodeSampledCubeTexture extends NodeSampledTexture {
|
|
22
|
+
readonly isSampledCubeTexture: true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class NodeSampledTexture3D extends NodeSampledTexture {
|
|
26
|
+
readonly isSampledTexture3D = true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { NodeSampledCubeTexture, NodeSampledTexture, NodeSampledTexture3D };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import TextureNode from "../../../nodes/accessors/TextureNode.js";
|
|
2
|
+
import UniformGroupNode from "../../../nodes/core/UniformGroupNode.js";
|
|
3
|
+
import Sampler from "../Sampler.js";
|
|
4
|
+
|
|
5
|
+
declare class NodeSampler extends Sampler {
|
|
6
|
+
textureNode: TextureNode | undefined;
|
|
7
|
+
groupNode: UniformGroupNode;
|
|
8
|
+
constructor(name: string, textureNode: TextureNode | undefined, groupNode: UniformGroupNode);
|
|
9
|
+
update(): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default NodeSampler;
|
|
@@ -2,14 +2,14 @@ import { Color, Matrix3, Matrix4, Vector2, Vector3, Vector4 } from "three";
|
|
|
2
2
|
import NodeUniform from "../../../nodes/core/NodeUniform.js";
|
|
3
3
|
import {
|
|
4
4
|
ColorUniform,
|
|
5
|
-
FloatUniform,
|
|
6
5
|
Matrix3Uniform,
|
|
7
6
|
Matrix4Uniform,
|
|
7
|
+
NumberUniform,
|
|
8
8
|
Vector2Uniform,
|
|
9
9
|
Vector3Uniform,
|
|
10
10
|
Vector4Uniform,
|
|
11
11
|
} from "../Uniform.js";
|
|
12
|
-
declare class
|
|
12
|
+
declare class NumberNodeUniform extends NumberUniform {
|
|
13
13
|
nodeUniform: NodeUniform<number>;
|
|
14
14
|
constructor(nodeUniform: NodeUniform<number>);
|
|
15
15
|
getValue(): number;
|
|
@@ -46,15 +46,15 @@ declare class Matrix4NodeUniform extends Matrix4Uniform {
|
|
|
46
46
|
}
|
|
47
47
|
export {
|
|
48
48
|
ColorNodeUniform,
|
|
49
|
-
FloatNodeUniform,
|
|
50
49
|
Matrix3NodeUniform,
|
|
51
50
|
Matrix4NodeUniform,
|
|
51
|
+
NumberNodeUniform,
|
|
52
52
|
Vector2NodeUniform,
|
|
53
53
|
Vector3NodeUniform,
|
|
54
54
|
Vector4NodeUniform,
|
|
55
55
|
};
|
|
56
56
|
export type NodeUniformGPU =
|
|
57
|
-
|
|
|
57
|
+
| NumberNodeUniform
|
|
58
58
|
| Vector2NodeUniform
|
|
59
59
|
| Vector3NodeUniform
|
|
60
60
|
| Vector4NodeUniform
|
|
@@ -6,7 +6,6 @@ declare class NodeUniformsGroup extends UniformsGroup {
|
|
|
6
6
|
groupNode: UniformGroupNode;
|
|
7
7
|
readonly isNodeUniformsGroup: true;
|
|
8
8
|
constructor(name: string, groupNode: UniformGroupNode);
|
|
9
|
-
get shared(): boolean;
|
|
10
9
|
getNodes(): UniformNode<unknown>[];
|
|
11
10
|
}
|
|
12
11
|
export default NodeUniformsGroup;
|
|
@@ -87,6 +87,7 @@ declare class Nodes extends DataMap<{
|
|
|
87
87
|
getNodeFrameForRender(renderObject: RenderObject): NodeFrame;
|
|
88
88
|
getOutputNode(outputTexture: Texture): ShaderNodeObject<Node>;
|
|
89
89
|
updateBefore(renderObject: RenderObject): void;
|
|
90
|
+
updateAfter(renderObject: RenderObject): void;
|
|
90
91
|
updateForCompute(computeNode: ComputeNode): void;
|
|
91
92
|
updateForRender(renderObject: RenderObject): void;
|
|
92
93
|
dispose(): void;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Texture } from "three";
|
|
2
|
+
import { NodeShaderStage } from "../../../nodes/core/constants.js";
|
|
3
|
+
import NodeBuilder from "../../../nodes/core/NodeBuilder.js";
|
|
4
|
+
import NodeUniform from "../../../nodes/core/NodeUniform.js";
|
|
5
|
+
import NodeVar from "../../../nodes/core/NodeVar.js";
|
|
6
|
+
import StructTypeNode from "../../../nodes/core/StructTypeNode.js";
|
|
7
|
+
import { ShaderNode } from "../../../nodes/shadernode/ShaderNode.js";
|
|
8
|
+
import NodeUniformsGroup from "../../common/nodes/NodeUniformsGroup.js";
|
|
9
|
+
|
|
10
|
+
type BuiltinStage = NodeShaderStage | "attribute" | "output";
|
|
11
|
+
interface BuiltinType {
|
|
12
|
+
name: string;
|
|
13
|
+
property: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class WGSLNodeBuilder extends NodeBuilder {
|
|
18
|
+
builtins: { [key in BuiltinStage]: Map<string, BuiltinType> };
|
|
19
|
+
uniformGroups: { [key in NodeShaderStage]: NodeUniformsGroup };
|
|
20
|
+
|
|
21
|
+
needsColorSpaceToLinear(texture: Texture);
|
|
22
|
+
_generateTextureSample(
|
|
23
|
+
texture: Texture,
|
|
24
|
+
textureProperty: string,
|
|
25
|
+
uvSnippet: string,
|
|
26
|
+
depthSnippet: string | null,
|
|
27
|
+
shaderStage: NodeShaderStage,
|
|
28
|
+
): string;
|
|
29
|
+
_generateVideoSample(textureProperty: string, uvSnippet: string, shaderStage: NodeShaderStage): string;
|
|
30
|
+
_generateTextureSampleLevel(
|
|
31
|
+
texture: Texture,
|
|
32
|
+
textureProperty: string,
|
|
33
|
+
uvSnippet: string,
|
|
34
|
+
levelSnippet: string,
|
|
35
|
+
depthSnippet: string | null,
|
|
36
|
+
shaderStage: NodeShaderStage,
|
|
37
|
+
): string;
|
|
38
|
+
generateTextureLod(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string): string;
|
|
39
|
+
generateTextureLoad(
|
|
40
|
+
texture: Texture,
|
|
41
|
+
textureProperty: string,
|
|
42
|
+
uvIndexSnippet: string,
|
|
43
|
+
depthSnippet: string | null,
|
|
44
|
+
shaderStage: NodeShaderStage,
|
|
45
|
+
): string;
|
|
46
|
+
generateTextureStore(
|
|
47
|
+
texture: Texture,
|
|
48
|
+
textureProperty: string,
|
|
49
|
+
uvIndexSnippet: string,
|
|
50
|
+
valueSnippet: string,
|
|
51
|
+
): string;
|
|
52
|
+
isUnfilterable(texture: Texture): boolean;
|
|
53
|
+
generateTexture(
|
|
54
|
+
texture: Texture,
|
|
55
|
+
textureProperty: string,
|
|
56
|
+
uvSnippet: string,
|
|
57
|
+
depthSnippet: string | null,
|
|
58
|
+
shaderStage: NodeShaderStage,
|
|
59
|
+
): string;
|
|
60
|
+
generateTextureGrad(
|
|
61
|
+
texture: Texture,
|
|
62
|
+
textureProperty: string,
|
|
63
|
+
uvSnippet: string,
|
|
64
|
+
gradSnippet: string[],
|
|
65
|
+
depthSnippet: string | null,
|
|
66
|
+
shaderStage: NodeShaderStage,
|
|
67
|
+
): string;
|
|
68
|
+
generateTextureCompare(
|
|
69
|
+
texture: Texture,
|
|
70
|
+
textureProperty: string,
|
|
71
|
+
uvSnippet: string,
|
|
72
|
+
compareSnippet: String,
|
|
73
|
+
shaderStage: NodeShaderStage,
|
|
74
|
+
): string;
|
|
75
|
+
generateTextureLevel(
|
|
76
|
+
texture: Texture,
|
|
77
|
+
textureProperty: string,
|
|
78
|
+
uvSnippet: string,
|
|
79
|
+
levelSnippet: string,
|
|
80
|
+
depthSnippet: string | null,
|
|
81
|
+
shaderStage: NodeShaderStage,
|
|
82
|
+
): string;
|
|
83
|
+
|
|
84
|
+
getPropertyName<TValue>(node: NodeVar | NodeUniform<TValue>, shaderStage: NodeShaderStage): string;
|
|
85
|
+
|
|
86
|
+
getOutputStructName(): string;
|
|
87
|
+
|
|
88
|
+
_getUniformGroupCount(shaderStage: NodeShaderStage): number;
|
|
89
|
+
|
|
90
|
+
getFunctionOperator(op: string): string | null;
|
|
91
|
+
// getStorageAccess(node: StorageTextureNode | StorageBufferNode): string;
|
|
92
|
+
|
|
93
|
+
getBuiltin(name: string, property: string, type: string, shaderStage: BuiltinStage): string;
|
|
94
|
+
getVertexIndex(): string;
|
|
95
|
+
getInstanceIndex(): string;
|
|
96
|
+
|
|
97
|
+
buildFunctionCode(shaderNode: ShaderNode): string;
|
|
98
|
+
|
|
99
|
+
getFragDepth(): string;
|
|
100
|
+
getFragCoord(): string;
|
|
101
|
+
getFrontFacing(): string;
|
|
102
|
+
|
|
103
|
+
getBuiltins(shaderStage: BuiltinStage): string;
|
|
104
|
+
getAttributes(shaderStage: NodeShaderStage): string;
|
|
105
|
+
|
|
106
|
+
getStructMembers(struct: StructTypeNode): string;
|
|
107
|
+
getStructs(shaderStage: NodeShaderStage): string;
|
|
108
|
+
|
|
109
|
+
getVar(type: string, name: string): string;
|
|
110
|
+
getVars(shaderStage: NodeShaderStage): string;
|
|
111
|
+
getVaryings(shaderStage: NodeShaderStage): string;
|
|
112
|
+
getUniforms(shaderStage: NodeShaderStage): string;
|
|
113
|
+
buildCode(): void;
|
|
114
|
+
getMethod(method: string, output?: string | null): string;
|
|
115
|
+
|
|
116
|
+
_getWGSLMethod(method: string);
|
|
117
|
+
// _include(name: string): CodeNode
|
|
118
|
+
_getWGSLVertexCode(shaderData: { [key: string]: string }): string;
|
|
119
|
+
_getWGSLFragmentCode(shaderData: { [key: string]: string }): string;
|
|
120
|
+
_getWGSLComputeCode(shaderData: { [key: string]: string }, workgroupSize: string): string;
|
|
121
|
+
_getWGSLStruct(name: string, vars: string): string;
|
|
122
|
+
_getWGSLStructBinding(name: string, vars: string, access: string, binding: number, group: number): string;
|
|
123
|
+
}
|