@types/three 0.164.1 → 0.165.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/controls/TransformControls.d.ts +8 -6
- three/examples/jsm/exporters/USDZExporter.d.ts +4 -2
- three/examples/jsm/loaders/FontLoader.d.ts +1 -1
- three/examples/jsm/loaders/GLTFLoader.d.ts +9 -6
- three/examples/jsm/loaders/LDrawLoader.d.ts +1 -1
- three/examples/jsm/modifiers/EdgeSplitModifier.d.ts +17 -10
- three/examples/jsm/nodes/Nodes.d.ts +11 -54
- three/examples/jsm/nodes/accessors/BitangentNode.d.ts +4 -22
- three/examples/jsm/nodes/accessors/BufferAttributeNode.d.ts +49 -0
- three/examples/jsm/nodes/accessors/BufferNode.d.ts +3 -4
- three/examples/jsm/nodes/accessors/CameraNode.d.ts +11 -20
- three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +1 -1
- three/examples/jsm/nodes/accessors/MaterialNode.d.ts +4 -1
- three/examples/jsm/nodes/accessors/ModelNode.d.ts +3 -0
- three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +1 -2
- three/examples/jsm/nodes/accessors/NormalNode.d.ts +9 -17
- three/examples/jsm/nodes/accessors/PositionNode.d.ts +6 -26
- three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +3 -4
- three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -8
- three/examples/jsm/nodes/accessors/RendererReferenceNode.d.ts +2 -3
- three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +9 -4
- three/examples/jsm/nodes/accessors/TangentNode.d.ts +8 -23
- three/examples/jsm/nodes/accessors/Texture3DNode.d.ts +16 -0
- three/examples/jsm/nodes/accessors/TextureNode.d.ts +1 -1
- three/examples/jsm/nodes/accessors/UVNode.d.ts +1 -8
- three/examples/jsm/nodes/accessors/UniformsNode.d.ts +0 -2
- three/examples/jsm/nodes/accessors/UserDataNode.d.ts +4 -3
- three/examples/jsm/nodes/code/CodeNode.d.ts +0 -1
- three/examples/jsm/nodes/code/ExpressionNode.d.ts +2 -3
- three/examples/jsm/nodes/core/AttributeNode.d.ts +11 -4
- three/examples/jsm/nodes/core/ConstNode.d.ts +1 -2
- three/examples/jsm/nodes/core/InputNode.d.ts +1 -2
- three/examples/jsm/nodes/core/Node.d.ts +99 -42
- three/examples/jsm/nodes/core/NodeAttribute.d.ts +7 -4
- three/examples/jsm/nodes/core/NodeBuilder.d.ts +24 -24
- three/examples/jsm/nodes/core/NodeCache.d.ts +38 -4
- three/examples/jsm/nodes/core/NodeKeywords.d.ts +10 -7
- three/examples/jsm/nodes/core/NodeParser.d.ts +4 -4
- three/examples/jsm/nodes/core/NodeUniform.d.ts +8 -11
- three/examples/jsm/nodes/core/NodeVar.d.ts +5 -4
- three/examples/jsm/nodes/core/NodeVarying.d.ts +5 -6
- three/examples/jsm/nodes/core/PropertyNode.d.ts +4 -4
- three/examples/jsm/nodes/core/StackNode.d.ts +7 -1
- three/examples/jsm/nodes/core/StructTypeNode.d.ts +8 -0
- three/examples/jsm/nodes/core/TempNode.d.ts +1 -2
- three/examples/jsm/nodes/core/UniformGroup.d.ts +7 -0
- three/examples/jsm/nodes/core/UniformGroupNode.d.ts +21 -0
- three/examples/jsm/nodes/core/UniformNode.d.ts +14 -11
- three/examples/jsm/nodes/core/VaryingNode.d.ts +4 -0
- three/examples/jsm/nodes/core/constants.d.ts +27 -79
- three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +2 -0
- three/examples/jsm/nodes/functions/ToonLightingModel.d.ts +4 -0
- three/examples/jsm/nodes/loaders/NodeLoader.d.ts +3 -3
- three/examples/jsm/nodes/loaders/NodeObjectLoader.d.ts +2 -3
- three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +2 -0
- three/examples/jsm/nodes/materials/Materials.d.ts +3 -0
- three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +5 -1
- three/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.d.ts +28 -0
- three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.d.ts +2 -0
- three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +5 -1
- three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +8 -0
- three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +5 -1
- three/examples/jsm/nodes/materials/MeshToonNodeMaterial.d.ts +38 -0
- three/examples/jsm/nodes/materials/NodeMaterial.d.ts +9 -4
- three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +1 -0
- three/examples/jsm/nodes/materials/ShadowNodeMaterial.d.ts +1 -0
- three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +1 -0
- three/examples/jsm/nodes/materials/VolumeNodeMaterial.d.ts +10 -0
- three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +58 -36
- three/examples/jsm/nodes/utils/ConvertNode.d.ts +2 -3
- three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +2 -2
- three/examples/jsm/nodes/utils/SplitNode.d.ts +1 -1
- three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +4 -5
- three/examples/jsm/objects/Sky.d.ts +18 -0
- three/examples/jsm/renderers/common/Animation.d.ts +14 -0
- three/examples/jsm/renderers/common/Attributes.d.ts +20 -0
- three/examples/jsm/renderers/common/Background.d.ts +22 -0
- three/examples/jsm/renderers/common/Binding.d.ts +8 -0
- three/examples/jsm/renderers/common/Bindings.d.ts +45 -0
- three/examples/jsm/renderers/common/Buffer.d.ts +11 -0
- three/examples/jsm/renderers/common/BufferUtils.d.ts +4 -0
- three/examples/jsm/renderers/common/ChainMap.d.ts +9 -0
- three/examples/jsm/renderers/common/ClippingContext.d.ts +18 -0
- three/examples/jsm/renderers/common/Color4.d.ts +6 -5
- three/examples/jsm/renderers/common/ComputePipeline.d.ts +8 -0
- three/examples/jsm/renderers/common/Constants.d.ts +9 -0
- three/examples/jsm/renderers/common/CubeRenderTarget.d.ts +7 -0
- three/examples/jsm/renderers/common/DataMap.d.ts +20 -0
- three/examples/jsm/renderers/common/Geometries.d.ts +28 -0
- three/examples/jsm/renderers/common/Info.d.ts +20 -13
- three/examples/jsm/renderers/common/Pipeline.d.ts +6 -0
- three/examples/jsm/renderers/common/Pipelines.d.ts +68 -0
- three/examples/jsm/renderers/common/ProgrammableStage.d.ts +15 -0
- three/examples/jsm/renderers/common/RenderBundle.d.ts +8 -0
- three/examples/jsm/renderers/common/RenderBundles.d.ts +10 -0
- three/examples/jsm/renderers/common/RenderContext.d.ts +38 -0
- three/examples/jsm/renderers/common/RenderContexts.d.ts +13 -0
- three/examples/jsm/renderers/common/RenderList.d.ts +62 -0
- three/examples/jsm/renderers/common/RenderLists.d.ts +10 -0
- three/examples/jsm/renderers/common/RenderObject.d.ts +73 -0
- three/examples/jsm/renderers/common/RenderObjects.d.ts +59 -0
- three/examples/jsm/renderers/common/RenderPipeline.d.ts +8 -0
- three/examples/jsm/renderers/common/Renderer.d.ts +175 -208
- three/examples/jsm/renderers/common/StorageBufferAttribute.d.ts +7 -0
- three/examples/jsm/renderers/common/StorageInstancedBufferAttribute.d.ts +7 -0
- three/examples/jsm/renderers/common/Textures.d.ts +64 -0
- three/examples/jsm/renderers/common/Uniform.d.ts +40 -0
- three/examples/jsm/renderers/common/UniformBuffer.d.ts +6 -0
- three/examples/jsm/renderers/common/UniformsGroup.d.ts +30 -0
- three/examples/jsm/renderers/common/nodes/NodeBuilderState.d.ts +26 -0
- three/examples/jsm/renderers/common/nodes/NodeUniform.d.ts +63 -0
- three/examples/jsm/renderers/common/nodes/NodeUniformsGroup.d.ts +12 -0
- three/examples/jsm/renderers/common/nodes/Nodes.d.ts +94 -0
- three/examples/jsm/utils/SceneUtils.d.ts +9 -3
- three/package.json +2 -2
- three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -2
- three/src/core/BufferGeometry.d.ts +19 -17
- three/src/core/InterleavedBuffer.d.ts +2 -0
- three/src/loaders/LoaderUtils.d.ts +9 -6
- three/src/math/Color.d.ts +1 -1
- three/src/math/Matrix3.d.ts +2 -0
- three/src/math/Matrix4.d.ts +2 -0
- three/src/objects/BatchedMesh.d.ts +15 -0
- three/src/objects/InstancedMesh.d.ts +3 -3
- three/src/renderers/WebGLRenderer.d.ts +41 -19
- three/src/renderers/webgl/WebGLPrograms.d.ts +1 -1
- three/src/renderers/webxr/WebXRDepthSensing.d.ts +1 -1
- three/src/textures/CompressedArrayTexture.d.ts +32 -15
- three/src/textures/DataArrayTexture.d.ts +37 -20
- three/src/textures/FramebufferTexture.d.ts +1 -1
- three/src/utils.d.ts +2 -0
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { AnyObject, NodeTypeOption, SwizzleOption } from "../core/constants.js";
|
|
2
1
|
import ConstNode from "../core/ConstNode.js";
|
|
3
2
|
import Node from "../core/Node.js";
|
|
4
3
|
import NodeBuilder from "../core/NodeBuilder.js";
|
|
4
|
+
import StackNode from "../core/StackNode.js";
|
|
5
5
|
|
|
6
6
|
export interface NodeElements {
|
|
7
|
+
toGlobal: (node: Node) => Node;
|
|
8
|
+
|
|
7
9
|
append: typeof append;
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
string: typeof string;
|
|
39
|
-
arrayBuffer: typeof arrayBuffer;
|
|
11
|
+
toColor: typeof color;
|
|
12
|
+
toFloat: typeof float;
|
|
13
|
+
toInt: typeof int;
|
|
14
|
+
toUint: typeof uint;
|
|
15
|
+
toBool: typeof bool;
|
|
16
|
+
toVec2: typeof vec2;
|
|
17
|
+
toIvec2: typeof ivec2;
|
|
18
|
+
toUvec2: typeof uvec2;
|
|
19
|
+
toBvec2: typeof bvec2;
|
|
20
|
+
toVec3: typeof vec3;
|
|
21
|
+
toIvec3: typeof ivec3;
|
|
22
|
+
toUvec3: typeof uvec3;
|
|
23
|
+
toBvec3: typeof bvec3;
|
|
24
|
+
toVec4: typeof vec4;
|
|
25
|
+
toIvec4: typeof ivec4;
|
|
26
|
+
toUvec4: typeof uvec4;
|
|
27
|
+
toBvec4: typeof bvec4;
|
|
28
|
+
toMat2: typeof mat2;
|
|
29
|
+
toImat2: typeof imat2;
|
|
30
|
+
toUmat2: typeof umat2;
|
|
31
|
+
toBmat2: typeof bmat2;
|
|
32
|
+
toMat3: typeof mat3;
|
|
33
|
+
toImat3: typeof imat3;
|
|
34
|
+
toUmat3: typeof umat3;
|
|
35
|
+
toBmat3: typeof bmat3;
|
|
36
|
+
toMat4: typeof mat4;
|
|
37
|
+
toImat4: typeof imat4;
|
|
38
|
+
toUmat4: typeof umat4;
|
|
39
|
+
toBmat4: typeof bmat4;
|
|
40
40
|
|
|
41
41
|
element: typeof element;
|
|
42
42
|
convert: typeof convert;
|
|
@@ -44,6 +44,16 @@ export interface NodeElements {
|
|
|
44
44
|
|
|
45
45
|
export function addNodeElement(name: string, nodeElement: unknown): void;
|
|
46
46
|
|
|
47
|
+
export type SwizzleCharacter = "x" | "y" | "z" | "w" | "r" | "g" | "b" | "a" | "s" | "t" | "p" | "q";
|
|
48
|
+
|
|
49
|
+
export type SwizzleOption = Exclude<
|
|
50
|
+
| `${SwizzleCharacter}`
|
|
51
|
+
| `${SwizzleCharacter}${SwizzleCharacter}`
|
|
52
|
+
| `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`
|
|
53
|
+
| `${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}${SwizzleCharacter}`,
|
|
54
|
+
"abs" | "sqrt"
|
|
55
|
+
>;
|
|
56
|
+
|
|
47
57
|
export type Swizzable<T extends Node = Node> =
|
|
48
58
|
& T
|
|
49
59
|
& {
|
|
@@ -57,6 +67,12 @@ export type ShaderNodeObject<T extends Node> =
|
|
|
57
67
|
: NodeElements[Key] extends (node: T, ...args: infer Args) => infer R ? (...args: Args) => R
|
|
58
68
|
: never;
|
|
59
69
|
}
|
|
70
|
+
& {
|
|
71
|
+
[Key in keyof NodeElements as `${Key}Assign`]: T extends { [K in Key]: infer M } ? M
|
|
72
|
+
: NodeElements[Key] extends (node: T, ...args: infer Args) => unknown
|
|
73
|
+
? (...args: Args) => ShaderNodeObject<T>
|
|
74
|
+
: never;
|
|
75
|
+
}
|
|
60
76
|
& Swizzable<T>;
|
|
61
77
|
|
|
62
78
|
/** anything that can be passed to {@link nodeObject} and returns a proxy */
|
|
@@ -160,9 +176,9 @@ type NodeArray<T extends NodeObjectOption[]> = { [index in keyof T]: NodeObject<
|
|
|
160
176
|
type NodeObjects<T> = { [key in keyof T]: T[key] extends NodeObjectOption ? NodeObject<T[key]> : T[key] };
|
|
161
177
|
type ConstructedNode<T> = T extends new(...args: any[]) => infer R ? (R extends Node ? R : never) : never;
|
|
162
178
|
|
|
163
|
-
export type NodeOrType = Node |
|
|
179
|
+
export type NodeOrType = Node | string;
|
|
164
180
|
|
|
165
|
-
export const getConstNodeType: (value: NodeOrType) =>
|
|
181
|
+
export const getConstNodeType: (value: NodeOrType) => string | null;
|
|
166
182
|
|
|
167
183
|
export class ShaderNode<T = {}, R extends Node = Node> {
|
|
168
184
|
constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => NodeRepresentation);
|
|
@@ -201,10 +217,16 @@ export function tslFn<R extends Node = ShaderNodeObject<Node>>(jsFunc: () => R):
|
|
|
201
217
|
export function tslFn<T extends any[], R extends Node = ShaderNodeObject<Node>>(
|
|
202
218
|
jsFunc: (args: T) => R,
|
|
203
219
|
): (...args: ProxiedTuple<T>) => R;
|
|
204
|
-
export function tslFn<T extends
|
|
220
|
+
export function tslFn<T extends { [key: string]: unknown }, R extends Node = ShaderNodeObject<Node>>(
|
|
205
221
|
jsFunc: (args: T) => R,
|
|
206
222
|
): (args: ProxiedObject<T>) => R;
|
|
207
223
|
|
|
224
|
+
export const setCurrentStack: (stack: StackNode | null) => void;
|
|
225
|
+
|
|
226
|
+
export const getCurrentStack: () => StackNode | null;
|
|
227
|
+
|
|
228
|
+
export const If: (boolNode: Node, method: () => void) => void;
|
|
229
|
+
|
|
208
230
|
export function append(node: Node): Node;
|
|
209
231
|
|
|
210
232
|
export const color: ConvertType;
|
|
@@ -248,4 +270,4 @@ export const string: (value?: string) => ShaderNodeObject<ConstNode<string>>;
|
|
|
248
270
|
export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<ArrayBuffer>>;
|
|
249
271
|
|
|
250
272
|
export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
|
|
251
|
-
export const convert: (node: NodeRepresentation, types:
|
|
273
|
+
export const convert: (node: NodeRepresentation, types: string) => ShaderNodeObject<Node>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import Node from "../core/Node.js";
|
|
2
|
-
import { NodeTypeOption } from "../Nodes.js";
|
|
3
2
|
|
|
4
3
|
export default class ConvertNode extends Node {
|
|
5
4
|
node: Node;
|
|
6
|
-
convertTo:
|
|
7
|
-
constructor(node: Node, convertTo:
|
|
5
|
+
convertTo: string;
|
|
6
|
+
constructor(node: Node, convertTo: string);
|
|
8
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node, TempNode } from "../Nodes.js";
|
|
2
2
|
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
|
|
3
3
|
|
|
4
4
|
export default class EquirectUVNode extends TempNode {
|
|
5
|
-
constructor(dirNode?: ShaderNodeObject<
|
|
5
|
+
constructor(dirNode?: ShaderNodeObject<Node>);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export const equirectUV: ShaderNodeObject<EquirectUVNode>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PositionNode from "../accessors/PositionNode.js";
|
|
2
1
|
import TextureNode from "../accessors/TextureNode.js";
|
|
3
2
|
import Node from "../core/Node.js";
|
|
4
3
|
import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
|
|
@@ -10,16 +9,16 @@ export default class TriplanarTexturesNode extends Node {
|
|
|
10
9
|
|
|
11
10
|
scaleNode: ShaderNodeObject<Node>;
|
|
12
11
|
|
|
13
|
-
positionNode: ShaderNodeObject<
|
|
14
|
-
normalNode: ShaderNodeObject<
|
|
12
|
+
positionNode: ShaderNodeObject<Node>;
|
|
13
|
+
normalNode: ShaderNodeObject<Node>;
|
|
15
14
|
|
|
16
15
|
constructor(
|
|
17
16
|
textureXNode: Node,
|
|
18
17
|
textureYNode?: TextureNode | null,
|
|
19
18
|
textureZNode?: TextureNode | null,
|
|
20
19
|
scaleNode?: ShaderNodeObject<Node>,
|
|
21
|
-
positionNode?: ShaderNodeObject<
|
|
22
|
-
normalNode?: ShaderNodeObject<
|
|
20
|
+
positionNode?: ShaderNodeObject<Node>,
|
|
21
|
+
normalNode?: ShaderNodeObject<Node>,
|
|
23
22
|
);
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { BoxGeometry, Mesh, ShaderMaterial } from "three";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* {@link Sky} creates a ready to go sky environment for your scenes.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const sky = new Sky();
|
|
8
|
+
* sky.scale.setScalar( 450000 );
|
|
9
|
+
*
|
|
10
|
+
* const phi = MathUtils.degToRad( 90 );
|
|
11
|
+
* const theta = MathUtils.degToRad( 180 );
|
|
12
|
+
* const sunPosition = new Vector3().setFromSphericalCoords( 1, phi, theta );
|
|
13
|
+
*
|
|
14
|
+
* sky.material.uniforms.sunPosition.value = sunPosition;
|
|
15
|
+
*
|
|
16
|
+
* scene.add( sky );
|
|
17
|
+
*/
|
|
3
18
|
export class Sky extends Mesh {
|
|
19
|
+
/**
|
|
20
|
+
* Create a new {@link Sky} instance.
|
|
21
|
+
*/
|
|
4
22
|
constructor();
|
|
5
23
|
|
|
6
24
|
geometry: BoxGeometry;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="webxr" />
|
|
2
|
+
import Info from "./Info.js";
|
|
3
|
+
import Nodes from "./nodes/Nodes.js";
|
|
4
|
+
declare class Animation {
|
|
5
|
+
nodes: Nodes;
|
|
6
|
+
info: Info;
|
|
7
|
+
animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
|
|
8
|
+
requestId: number | null;
|
|
9
|
+
constructor(nodes: Nodes, info: Info);
|
|
10
|
+
_init(): void;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): void;
|
|
13
|
+
}
|
|
14
|
+
export default Animation;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute } from "three";
|
|
2
|
+
import Backend from "./Backend.js";
|
|
3
|
+
import { AttributeType } from "./Constants.js";
|
|
4
|
+
import DataMap from "./DataMap.js";
|
|
5
|
+
interface Data {
|
|
6
|
+
version?: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
declare class Attributes extends DataMap<{
|
|
9
|
+
attribute: {
|
|
10
|
+
key: BufferAttribute | InterleavedBufferAttribute;
|
|
11
|
+
value: Data;
|
|
12
|
+
};
|
|
13
|
+
}> {
|
|
14
|
+
backend: Backend;
|
|
15
|
+
constructor(backend: Backend);
|
|
16
|
+
delete(attribute: BufferAttribute | InterleavedBufferAttribute): Data;
|
|
17
|
+
update(attribute: BufferAttribute | InterleavedBufferAttribute, type: AttributeType): void;
|
|
18
|
+
_getBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute): InterleavedBuffer | BufferAttribute;
|
|
19
|
+
}
|
|
20
|
+
export default Attributes;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Mesh, Scene } from "three";
|
|
2
|
+
import DataMap from "./DataMap.js";
|
|
3
|
+
import Nodes from "./nodes/Nodes.js";
|
|
4
|
+
import RenderContext from "./RenderContext.js";
|
|
5
|
+
import Renderer from "./Renderer.js";
|
|
6
|
+
import RenderList from "./RenderList.js";
|
|
7
|
+
interface SceneData {
|
|
8
|
+
backgroundMesh?: Mesh;
|
|
9
|
+
backgroundCacheKey: string;
|
|
10
|
+
}
|
|
11
|
+
declare class Background extends DataMap<{
|
|
12
|
+
scene: {
|
|
13
|
+
key: Scene;
|
|
14
|
+
value: SceneData;
|
|
15
|
+
};
|
|
16
|
+
}> {
|
|
17
|
+
renderer: Renderer;
|
|
18
|
+
nodes: Nodes;
|
|
19
|
+
constructor(renderer: Renderer, nodes: Nodes);
|
|
20
|
+
update(scene: Scene, renderList: RenderList, renderContext: RenderContext): void;
|
|
21
|
+
}
|
|
22
|
+
export default Background;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
|
|
2
|
+
import Attributes from "./Attributes.js";
|
|
3
|
+
import Backend from "./Backend.js";
|
|
4
|
+
import Binding from "./Binding.js";
|
|
5
|
+
import DataMap from "./DataMap.js";
|
|
6
|
+
import Info from "./Info.js";
|
|
7
|
+
import Nodes from "./nodes/Nodes.js";
|
|
8
|
+
import Pipelines from "./Pipelines.js";
|
|
9
|
+
import RenderObject from "./RenderObject.js";
|
|
10
|
+
import Textures from "./Textures.js";
|
|
11
|
+
interface Data {
|
|
12
|
+
bindings?: Binding[] | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare class Bindings extends DataMap<{
|
|
15
|
+
renderObject: {
|
|
16
|
+
key: RenderObject;
|
|
17
|
+
value: Data;
|
|
18
|
+
};
|
|
19
|
+
computeNode: {
|
|
20
|
+
key: ComputeNode;
|
|
21
|
+
value: Data;
|
|
22
|
+
};
|
|
23
|
+
}> {
|
|
24
|
+
backend: Backend;
|
|
25
|
+
textures: Textures;
|
|
26
|
+
pipelines: Pipelines;
|
|
27
|
+
attributes: Attributes;
|
|
28
|
+
nodes: Nodes;
|
|
29
|
+
info: Info;
|
|
30
|
+
constructor(
|
|
31
|
+
backend: Backend,
|
|
32
|
+
nodes: Nodes,
|
|
33
|
+
textures: Textures,
|
|
34
|
+
attributes: Attributes,
|
|
35
|
+
pipelines: Pipelines,
|
|
36
|
+
info: Info,
|
|
37
|
+
);
|
|
38
|
+
getForRender(renderObject: RenderObject): Binding[];
|
|
39
|
+
getForCompute(computeNode: ComputeNode): Binding[];
|
|
40
|
+
updateForCompute(computeNode: ComputeNode): void;
|
|
41
|
+
updateForRender(renderObject: RenderObject): void;
|
|
42
|
+
_init(bindings: Binding[]): void;
|
|
43
|
+
_update(object: ComputeNode | RenderObject, bindings: Binding[]): void;
|
|
44
|
+
}
|
|
45
|
+
export default Bindings;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Binding from "./Binding.js";
|
|
2
|
+
declare class Buffer extends Binding {
|
|
3
|
+
readonly isBuffer: true;
|
|
4
|
+
bytesPerElement: number;
|
|
5
|
+
_buffer: Float32Array | null;
|
|
6
|
+
constructor(name?: string, buffer?: Float32Array | null);
|
|
7
|
+
get byteLength(): number;
|
|
8
|
+
get buffer(): Float32Array | null;
|
|
9
|
+
update(): boolean;
|
|
10
|
+
}
|
|
11
|
+
export default Buffer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type RecursiveWeakMap<K extends readonly object[], V> = WeakMap<K[number], V | RecursiveWeakMap<K, V>>;
|
|
2
|
+
export default class ChainMap<K extends readonly object[], V> {
|
|
3
|
+
weakMap: RecursiveWeakMap<K, V>;
|
|
4
|
+
constructor();
|
|
5
|
+
get(keys: K): V | undefined;
|
|
6
|
+
set(keys: K, value: V): V;
|
|
7
|
+
delete(keys: K): boolean;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Camera, Material, Matrix3, Matrix4, Plane, Vector4 } from "three";
|
|
2
|
+
import Renderer from "./Renderer.js";
|
|
3
|
+
declare class ClippingContext {
|
|
4
|
+
version: number;
|
|
5
|
+
globalClippingCount: number;
|
|
6
|
+
localClippingCount: number;
|
|
7
|
+
localClippingEnabled: boolean | undefined;
|
|
8
|
+
localClipIntersection: boolean;
|
|
9
|
+
planes: Vector4[];
|
|
10
|
+
parentVersion: number;
|
|
11
|
+
viewNormalMatrix: Matrix3;
|
|
12
|
+
viewMatrix?: Matrix4 | undefined;
|
|
13
|
+
constructor();
|
|
14
|
+
projectPlanes(source: readonly Plane[], offset: number): void;
|
|
15
|
+
updateGlobal(renderer: Renderer, camera: Camera): void;
|
|
16
|
+
update(parent: ClippingContext, material: Material): void;
|
|
17
|
+
}
|
|
18
|
+
export default ClippingContext;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Color, ColorRepresentation } from "
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Color, ColorRepresentation } from "three";
|
|
2
|
+
declare class Color4 extends Color {
|
|
3
|
+
a: number;
|
|
4
|
+
constructor(color?: ColorRepresentation);
|
|
4
5
|
constructor(r: number, g: number, b: number, a?: number);
|
|
5
|
-
|
|
6
6
|
set(...args: [color: ColorRepresentation] | [r: number, g: number, b: number, a?: number]): this;
|
|
7
|
-
|
|
7
|
+
copy(color: Color): this;
|
|
8
8
|
clone(): this;
|
|
9
9
|
}
|
|
10
|
+
export default Color4;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Pipeline from "./Pipeline.js";
|
|
2
|
+
import ProgrammableStage from "./ProgrammableStage.js";
|
|
3
|
+
declare class ComputePipeline extends Pipeline {
|
|
4
|
+
computeProgram: ProgrammableStage;
|
|
5
|
+
readonly isComputePipeline: true;
|
|
6
|
+
constructor(cacheKey: string, computeProgram: ProgrammableStage);
|
|
7
|
+
}
|
|
8
|
+
export default ComputePipeline;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const AttributeType: {
|
|
2
|
+
readonly VERTEX: 1;
|
|
3
|
+
readonly INDEX: 2;
|
|
4
|
+
readonly STORAGE: 4;
|
|
5
|
+
};
|
|
6
|
+
export type AttributeType = (typeof AttributeType)[keyof typeof AttributeType];
|
|
7
|
+
export declare const GPU_CHUNK_BYTES = 16;
|
|
8
|
+
export declare const BlendColorFactor = 211;
|
|
9
|
+
export declare const OneMinusBlendColorFactor = 212;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RenderTargetOptions, Texture, WebGLCubeRenderTarget, WebGLRenderer } from "three";
|
|
2
|
+
declare class CubeRenderTarget extends WebGLCubeRenderTarget {
|
|
3
|
+
readonly isCubeRenderTarget: true;
|
|
4
|
+
constructor(size?: number, options?: RenderTargetOptions);
|
|
5
|
+
fromEquirectangularTexture(renderer: WebGLRenderer, texture: Texture): this;
|
|
6
|
+
}
|
|
7
|
+
export default CubeRenderTarget;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare class DataMap<
|
|
2
|
+
M extends {
|
|
3
|
+
[key: string]: {
|
|
4
|
+
key: object;
|
|
5
|
+
value: unknown;
|
|
6
|
+
};
|
|
7
|
+
},
|
|
8
|
+
> {
|
|
9
|
+
data: WeakMap<M[keyof M]["key"], M[keyof M]["value"]>;
|
|
10
|
+
constructor();
|
|
11
|
+
get<K extends M[keyof M]["key"]>(object: K): Extract<M[keyof M], {
|
|
12
|
+
key: K;
|
|
13
|
+
}>["value"];
|
|
14
|
+
delete<K extends M[keyof M]["key"]>(object: K): Extract<M[keyof M], {
|
|
15
|
+
key: K;
|
|
16
|
+
}>["value"];
|
|
17
|
+
has(object: M[keyof M]["key"]): boolean;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
}
|
|
20
|
+
export default DataMap;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BufferAttribute, BufferGeometry } from "three";
|
|
2
|
+
import Attributes from "./Attributes.js";
|
|
3
|
+
import { AttributeType } from "./Constants.js";
|
|
4
|
+
import DataMap from "./DataMap.js";
|
|
5
|
+
import Info from "./Info.js";
|
|
6
|
+
import RenderObject from "./RenderObject.js";
|
|
7
|
+
interface GeometryData {
|
|
8
|
+
initialized?: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
declare class Geometries extends DataMap<{
|
|
11
|
+
geometry: {
|
|
12
|
+
key: BufferGeometry;
|
|
13
|
+
value: GeometryData;
|
|
14
|
+
};
|
|
15
|
+
}> {
|
|
16
|
+
attributes: Attributes;
|
|
17
|
+
info: Info;
|
|
18
|
+
wireframes: WeakMap<BufferGeometry, BufferAttribute>;
|
|
19
|
+
attributeCall: WeakMap<BufferAttribute, number>;
|
|
20
|
+
constructor(attributes: Attributes, info: Info);
|
|
21
|
+
has(renderObject: RenderObject | BufferGeometry): boolean;
|
|
22
|
+
updateForRender(renderObject: RenderObject): void;
|
|
23
|
+
initGeometry(renderObject: RenderObject): void;
|
|
24
|
+
updateAttributes(renderObject: RenderObject): void;
|
|
25
|
+
updateAttribute(attribute: BufferAttribute, type: AttributeType): void;
|
|
26
|
+
getIndex(renderObject: RenderObject): BufferAttribute | null;
|
|
27
|
+
}
|
|
28
|
+
export default Geometries;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { Object3D } from "three";
|
|
2
|
-
|
|
3
|
-
export default class Info {
|
|
2
|
+
declare class Info {
|
|
4
3
|
autoReset: boolean;
|
|
5
|
-
|
|
6
4
|
frame: number;
|
|
7
5
|
calls: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
render: {
|
|
7
|
+
calls: number;
|
|
8
|
+
drawCalls: number;
|
|
9
|
+
triangles: number;
|
|
10
|
+
points: number;
|
|
11
|
+
lines: number;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
};
|
|
14
|
+
compute: {
|
|
15
|
+
calls: number;
|
|
16
|
+
computeCalls: number;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
};
|
|
19
|
+
memory: {
|
|
20
|
+
geometries: number;
|
|
21
|
+
textures: number;
|
|
22
|
+
};
|
|
23
|
+
constructor();
|
|
15
24
|
update(object: Object3D, count: number, instanceCount: number): void;
|
|
16
|
-
|
|
17
25
|
updateTimestamp(type: "render" | "compute", time: number): void;
|
|
18
|
-
|
|
19
26
|
reset(): void;
|
|
20
|
-
|
|
21
27
|
dispose(): void;
|
|
22
28
|
}
|
|
29
|
+
export default Info;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
|
|
2
|
+
import Backend from "./Backend.js";
|
|
3
|
+
import Binding from "./Binding.js";
|
|
4
|
+
import Bindings from "./Bindings.js";
|
|
5
|
+
import ComputePipeline from "./ComputePipeline.js";
|
|
6
|
+
import DataMap from "./DataMap.js";
|
|
7
|
+
import Nodes from "./nodes/Nodes.js";
|
|
8
|
+
import Pipeline from "./Pipeline.js";
|
|
9
|
+
import ProgrammableStage from "./ProgrammableStage.js";
|
|
10
|
+
import RenderObject from "./RenderObject.js";
|
|
11
|
+
import RenderPipeline from "./RenderPipeline.js";
|
|
12
|
+
interface ComputeNodeData {
|
|
13
|
+
version: number;
|
|
14
|
+
pipeline: ComputePipeline;
|
|
15
|
+
}
|
|
16
|
+
interface RenderObjectData {
|
|
17
|
+
pipeline: RenderPipeline;
|
|
18
|
+
}
|
|
19
|
+
declare class Pipelines extends DataMap<{
|
|
20
|
+
computeNode: {
|
|
21
|
+
key: ComputeNode;
|
|
22
|
+
value: ComputeNodeData;
|
|
23
|
+
};
|
|
24
|
+
renderObject: {
|
|
25
|
+
key: RenderObject;
|
|
26
|
+
value: RenderObjectData;
|
|
27
|
+
};
|
|
28
|
+
}> {
|
|
29
|
+
backend: Backend;
|
|
30
|
+
nodes: Nodes;
|
|
31
|
+
bindings: Bindings | null;
|
|
32
|
+
caches: Map<string, Pipeline>;
|
|
33
|
+
programs: {
|
|
34
|
+
vertex: Map<string, ProgrammableStage>;
|
|
35
|
+
fragment: Map<string, ProgrammableStage>;
|
|
36
|
+
compute: Map<string, ProgrammableStage>;
|
|
37
|
+
};
|
|
38
|
+
constructor(backend: Backend, nodes: Nodes);
|
|
39
|
+
getForCompute(computeNode: ComputeNode, bindings: Binding[]): ComputePipeline;
|
|
40
|
+
getForRender(renderObject: RenderObject, promises?: Promise<void>[] | null): RenderPipeline;
|
|
41
|
+
delete(object: ComputeNode | RenderObject): never;
|
|
42
|
+
dispose(): void;
|
|
43
|
+
updateForRender(renderObject: RenderObject): void;
|
|
44
|
+
_getComputePipeline(
|
|
45
|
+
computeNode: ComputeNode,
|
|
46
|
+
stageCompute: ProgrammableStage,
|
|
47
|
+
cacheKey: string,
|
|
48
|
+
bindings: Binding[],
|
|
49
|
+
): ComputePipeline;
|
|
50
|
+
_getRenderPipeline(
|
|
51
|
+
renderObject: RenderObject,
|
|
52
|
+
stageVertex: ProgrammableStage,
|
|
53
|
+
stageFragment: ProgrammableStage,
|
|
54
|
+
cacheKey: string,
|
|
55
|
+
promises: Promise<void>[] | null,
|
|
56
|
+
): RenderPipeline;
|
|
57
|
+
_getComputeCacheKey(computeNode: ComputeNode, stageCompute: ProgrammableStage): string;
|
|
58
|
+
_getRenderCacheKey(
|
|
59
|
+
renderObject: RenderObject,
|
|
60
|
+
stageVertex: ProgrammableStage,
|
|
61
|
+
stageFragment: ProgrammableStage,
|
|
62
|
+
): string;
|
|
63
|
+
_releasePipeline(pipeline: Pipeline): void;
|
|
64
|
+
_releaseProgram(program: ProgrammableStage): void;
|
|
65
|
+
_needsComputeUpdate(computeNode: ComputeNode): boolean;
|
|
66
|
+
_needsRenderUpdate(renderObject: RenderObject): true | void;
|
|
67
|
+
}
|
|
68
|
+
export default Pipelines;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import NodeAttribute from "../../nodes/core/NodeAttribute.js";
|
|
2
|
+
declare class ProgrammableStage {
|
|
3
|
+
id: number;
|
|
4
|
+
code: string;
|
|
5
|
+
stage: "compute" | "vertex" | "fragment";
|
|
6
|
+
attributes: NodeAttribute[] | null;
|
|
7
|
+
usedTimes: number;
|
|
8
|
+
constructor(
|
|
9
|
+
code: string,
|
|
10
|
+
type: "compute" | "vertex" | "fragment",
|
|
11
|
+
transforms?: null,
|
|
12
|
+
attributes?: NodeAttribute[] | null,
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
export default ProgrammableStage;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Camera, Object3D } from "three";
|
|
2
|
+
import ChainMap from "./ChainMap.js";
|
|
3
|
+
import RenderBundle from "./RenderBundle.js";
|
|
4
|
+
declare class RenderBundles {
|
|
5
|
+
lists: ChainMap<readonly [Object3D, Camera], RenderBundle>;
|
|
6
|
+
constructor();
|
|
7
|
+
get(scene: Object3D, camera: Camera): RenderBundle;
|
|
8
|
+
dispose(): void;
|
|
9
|
+
}
|
|
10
|
+
export default RenderBundles;
|