@types/three 0.143.2 → 0.144.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/FirstPersonControls.d.ts +4 -1
- three/examples/jsm/csm/CSM.d.ts +1 -1
- three/examples/jsm/environments/RoomEnvironment.d.ts +1 -0
- three/examples/jsm/interactive/SelectionHelper.d.ts +1 -3
- three/examples/jsm/libs/stats.module.d.ts +1 -1
- three/examples/jsm/loaders/TIFFLoader.d.ts +16 -0
- three/examples/jsm/materials/MeshGouraudMaterial.d.ts +17 -0
- three/examples/jsm/math/ColorConverter.d.ts +0 -2
- three/examples/jsm/misc/GPUComputationRenderer.d.ts +1 -0
- three/examples/jsm/misc/ProgressiveLightMap.d.ts +1 -2
- three/examples/jsm/misc/Volume.d.ts +1 -1
- three/examples/jsm/modifiers/CurveModifier.d.ts +6 -6
- three/examples/jsm/nodes/Nodes.d.ts +2 -1
- three/examples/jsm/nodes/core/CodeNode.d.ts +2 -2
- three/examples/jsm/nodes/core/FunctionCallNode.d.ts +5 -5
- three/examples/jsm/nodes/core/FunctionNode.d.ts +6 -4
- three/examples/jsm/nodes/core/Node.d.ts +1 -0
- three/examples/jsm/nodes/core/NodeUtils.d.ts +1 -0
- three/examples/jsm/nodes/materials/Materials.d.ts +8 -6
- three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +22 -0
- three/examples/jsm/nodes/materialx/functions/lib/mx_hsv.d.ts +4 -0
- three/examples/jsm/nodes/materialx/functions/lib/mx_noise.d.ts +6 -0
- three/examples/jsm/nodes/procedural/CheckerNode.d.ts +2 -2
- three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +10 -8
- three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +25 -7
- three/examples/jsm/objects/ReflectorForSSRPass.d.ts +4 -4
- three/examples/jsm/postprocessing/SSRPass.d.ts +3 -3
- three/examples/jsm/renderers/webgl/nodes/SlotNode.d.ts +15 -3
- three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +5 -5
- three/examples/jsm/renderers/webgl/nodes/WebGLNodes.d.ts +1 -1
- three/examples/jsm/shaders/AfterimageShader.d.ts +4 -4
- three/examples/jsm/shaders/BleachBypassShader.d.ts +3 -3
- three/examples/jsm/shaders/BlendShader.d.ts +5 -5
- three/examples/jsm/shaders/BokehShader.d.ts +9 -9
- three/examples/jsm/shaders/BokehShader2.d.ts +26 -26
- three/examples/jsm/shaders/BrightnessContrastShader.d.ts +4 -4
- three/examples/jsm/shaders/ColorCorrectionShader.d.ts +5 -5
- three/examples/jsm/shaders/ColorifyShader.d.ts +3 -3
- three/examples/jsm/shaders/ConvolutionShader.d.ts +4 -4
- three/examples/jsm/shaders/CopyShader.d.ts +3 -3
- three/examples/jsm/shaders/DOFMipMapShader.d.ts +5 -5
- three/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +9 -9
- three/examples/jsm/shaders/DigitalGlitch.d.ts +12 -12
- three/examples/jsm/shaders/DotScreenShader.d.ts +6 -6
- three/examples/jsm/shaders/FXAAShader.d.ts +3 -3
- three/examples/jsm/shaders/FilmShader.d.ts +7 -7
- three/examples/jsm/shaders/FocusShader.d.ts +6 -6
- three/examples/jsm/shaders/FreiChenShader.d.ts +3 -3
- three/examples/jsm/shaders/GammaCorrectionShader.d.ts +2 -2
- three/examples/jsm/shaders/GodRaysShader.d.ts +12 -12
- three/examples/jsm/shaders/HalftoneShader.d.ts +14 -14
- three/examples/jsm/shaders/HorizontalBlurShader.d.ts +3 -3
- three/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +4 -4
- three/examples/jsm/shaders/HueSaturationShader.d.ts +4 -4
- three/examples/jsm/shaders/KaleidoShader.d.ts +4 -4
- three/examples/jsm/shaders/LuminosityHighPassShader.d.ts +6 -6
- three/examples/jsm/shaders/LuminosityShader.d.ts +2 -2
- three/examples/jsm/shaders/MirrorShader.d.ts +3 -3
- three/examples/jsm/shaders/NormalMapShader.d.ts +5 -5
- three/examples/jsm/shaders/PixelShader.d.ts +4 -4
- three/examples/jsm/shaders/RGBShiftShader.d.ts +4 -4
- three/examples/jsm/shaders/SAOShader.d.ts +15 -15
- three/examples/jsm/shaders/SMAAShader.d.ts +10 -10
- three/examples/jsm/shaders/SSAOShader.d.ts +19 -19
- three/examples/jsm/shaders/SepiaShader.d.ts +3 -3
- three/examples/jsm/shaders/SobelOperatorShader.d.ts +3 -3
- three/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts +30 -30
- three/examples/jsm/shaders/TechnicolorShader.d.ts +2 -2
- three/examples/jsm/shaders/ToneMapShader.d.ts +7 -7
- three/examples/jsm/shaders/ToonShader.d.ts +26 -26
- three/examples/jsm/shaders/TriangleBlurShader.d.ts +3 -3
- three/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +3 -3
- three/examples/jsm/shaders/VerticalBlurShader.d.ts +3 -3
- three/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +4 -4
- three/examples/jsm/shaders/VignetteShader.d.ts +4 -4
- three/examples/jsm/shaders/VolumeShader.d.ts +7 -7
- three/examples/jsm/shaders/WaterRefractionShader.d.ts +6 -6
- three/examples/jsm/utils/CameraUtils.d.ts +1 -1
- three/index.d.ts +1 -1
- three/package.json +3 -3
- three/src/Three.d.ts +1 -1
- three/src/constants.d.ts +0 -5
- three/src/core/BufferAttribute.d.ts +0 -4
- three/src/core/BufferGeometry.d.ts +0 -1
- three/src/core/Object3D.d.ts +2 -1
- three/src/extras/core/ShapePath.d.ts +1 -1
- three/src/geometries/BoxGeometry.d.ts +0 -2
- three/src/geometries/CapsuleGeometry.d.ts +0 -2
- three/src/geometries/CircleGeometry.d.ts +0 -2
- three/src/geometries/ConeGeometry.d.ts +0 -2
- three/src/geometries/CylinderGeometry.d.ts +0 -2
- three/src/geometries/DodecahedronGeometry.d.ts +0 -2
- three/src/geometries/ExtrudeGeometry.d.ts +0 -2
- three/src/geometries/IcosahedronGeometry.d.ts +0 -2
- three/src/geometries/LatheGeometry.d.ts +0 -2
- three/src/geometries/OctahedronGeometry.d.ts +0 -2
- three/src/geometries/PlaneGeometry.d.ts +0 -2
- three/src/geometries/PolyhedronGeometry.d.ts +0 -2
- three/src/geometries/RingGeometry.d.ts +0 -2
- three/src/geometries/ShapeGeometry.d.ts +0 -2
- three/src/geometries/SphereGeometry.d.ts +0 -2
- three/src/geometries/TetrahedronGeometry.d.ts +0 -2
- three/src/geometries/TorusGeometry.d.ts +0 -2
- three/src/geometries/TorusKnotGeometry.d.ts +0 -2
- three/src/geometries/TubeGeometry.d.ts +0 -2
- three/src/materials/LineBasicMaterial.d.ts +7 -0
- three/src/materials/MeshLambertMaterial.d.ts +52 -1
- three/src/materials/MeshPhysicalMaterial.d.ts +5 -0
- three/src/materials/ShaderMaterial.d.ts +1 -1
- three/src/math/Quaternion.d.ts +0 -5
- three/src/renderers/shaders/UniformsUtils.d.ts +0 -1
- three/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.d.ts +0 -13
three/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Fri, 02 Sep 2022 10:02:40 GMT
|
|
12
12
|
* Dependencies: [@types/webxr](https://npmjs.com/package/@types/webxr)
|
|
13
13
|
* Global values: `THREE`
|
|
14
14
|
|
|
@@ -22,7 +22,10 @@ export class FirstPersonControls {
|
|
|
22
22
|
mouseDragOn: boolean;
|
|
23
23
|
|
|
24
24
|
handleResize(): void;
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
lookAt(x: Vector3): this;
|
|
27
|
+
lookAt(x: number, y: number, z: number): this;
|
|
28
|
+
|
|
26
29
|
update(delta: number): this;
|
|
27
30
|
dispose(): void;
|
|
28
31
|
}
|
three/examples/jsm/csm/CSM.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { WebGLRenderer, Vector2 } from '../../../src/Three';
|
|
2
2
|
|
|
3
|
-
import { SelectionBox } from './SelectionBox';
|
|
4
|
-
|
|
5
3
|
export class SelectionHelper {
|
|
6
|
-
constructor(
|
|
4
|
+
constructor(renderer: WebGLRenderer, cssClassName: string);
|
|
7
5
|
element: HTMLElement;
|
|
8
6
|
isDown: boolean;
|
|
9
7
|
pointBottomRight: Vector2;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DataTextureLoader, TextureFilter, LoadingManager } from 'three';
|
|
2
|
+
|
|
3
|
+
export interface TIFFResult {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
data: Uint8Array;
|
|
7
|
+
flipY: true;
|
|
8
|
+
magFilter: TextureFilter;
|
|
9
|
+
minFilter: TextureFilter;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class TIFFLoader extends DataTextureLoader {
|
|
13
|
+
constructor(manager?: LoadingManager);
|
|
14
|
+
|
|
15
|
+
parse(buffer: Iterable<number>): TIFFResult;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MeshGouraudMaterial
|
|
3
|
+
*
|
|
4
|
+
* Lambert illumination model with Gouraud (per-vertex) shading
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { ShaderMaterial, ShaderMaterialParameters } from '../../../src/Three';
|
|
9
|
+
|
|
10
|
+
export class MeshGouraudMaterial extends ShaderMaterial {
|
|
11
|
+
isMeshGouraudMaterial: true;
|
|
12
|
+
type: 'MeshGouraudMaterial';
|
|
13
|
+
|
|
14
|
+
constructor(parameters?: ShaderMaterialParameters);
|
|
15
|
+
|
|
16
|
+
copy(source: MeshGouraudMaterial): this;
|
|
17
|
+
}
|
|
@@ -16,6 +16,4 @@ export interface CMYK {
|
|
|
16
16
|
export namespace ColorConverter {
|
|
17
17
|
function setHSV(color: Color, h: number, s: number, v: number): Color;
|
|
18
18
|
function getHSV(color: Color, target: HSL): HSL;
|
|
19
|
-
function setCMYK(color: Color, c: number, m: number, y: number, k: number): Color;
|
|
20
|
-
function getCMYK(color: Color, target: CMYK): CMYK;
|
|
21
19
|
}
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
MeshBasicMaterial,
|
|
6
6
|
MeshPhongMaterial,
|
|
7
7
|
Object3D,
|
|
8
|
-
PlaneBufferGeometry,
|
|
9
8
|
PlaneGeometry,
|
|
10
9
|
Texture,
|
|
11
10
|
Vector3,
|
|
@@ -43,7 +42,7 @@ export class ProgressiveLightMap {
|
|
|
43
42
|
|
|
44
43
|
uv_boxes: UVBoxes[];
|
|
45
44
|
|
|
46
|
-
blurringPlane: Mesh<
|
|
45
|
+
blurringPlane: Mesh<PlaneGeometry, MeshBasicMaterial>;
|
|
47
46
|
|
|
48
47
|
labelMaterial: MeshBasicMaterial;
|
|
49
48
|
labelPlane: PlaneGeometry;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Matrix3 } from '../../../src/Three';
|
|
2
2
|
|
|
3
|
-
import { VolumeSlice } from './VolumeSlice
|
|
3
|
+
import { VolumeSlice } from './VolumeSlice';
|
|
4
4
|
|
|
5
5
|
export class Volume {
|
|
6
6
|
constructor(xLength?: number, yLength?: number, zLength?: number, type?: string, arrayBuffer?: ArrayLike<number>);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataTexture,
|
|
3
3
|
Curve,
|
|
4
|
-
|
|
4
|
+
IUniform,
|
|
5
5
|
Material,
|
|
6
6
|
InstancedMesh,
|
|
7
7
|
BufferGeometry,
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
} from '../../../src/Three';
|
|
11
11
|
|
|
12
12
|
export interface SplineUniform {
|
|
13
|
-
spineTexture:
|
|
14
|
-
pathOffset:
|
|
15
|
-
pathSegment:
|
|
16
|
-
spineOffset:
|
|
17
|
-
flow:
|
|
13
|
+
spineTexture: IUniform;
|
|
14
|
+
pathOffset: IUniform;
|
|
15
|
+
pathSegment: IUniform;
|
|
16
|
+
spineOffset: IUniform;
|
|
17
|
+
flow: IUniform;
|
|
18
18
|
}
|
|
19
19
|
export function initSplineTexture(size?: number): DataTexture;
|
|
20
20
|
|
|
@@ -7,7 +7,7 @@ import ConstNode from './core/ConstNode';
|
|
|
7
7
|
import ContextNode from './core/ContextNode';
|
|
8
8
|
import ExpressionNode from './core/ExpressionNode';
|
|
9
9
|
import FunctionCallNode from './core/FunctionCallNode';
|
|
10
|
-
import FunctionNode from './core/FunctionNode';
|
|
10
|
+
import FunctionNode, { FunctionNodeArguments } from './core/FunctionNode';
|
|
11
11
|
import InstanceIndexNode from './core/InstanceIndexNode';
|
|
12
12
|
import Node from './core/Node';
|
|
13
13
|
import NodeAttribute from './core/NodeAttribute';
|
|
@@ -118,6 +118,7 @@ export {
|
|
|
118
118
|
ExpressionNode,
|
|
119
119
|
FunctionCallNode,
|
|
120
120
|
FunctionNode,
|
|
121
|
+
FunctionNodeArguments,
|
|
121
122
|
InstanceIndexNode,
|
|
122
123
|
Node,
|
|
123
124
|
NodeAttribute,
|
|
@@ -3,13 +3,13 @@ import Node from './Node';
|
|
|
3
3
|
import NodeBuilder from './NodeBuilder';
|
|
4
4
|
|
|
5
5
|
export interface CodeNodeInclude {
|
|
6
|
-
build(): void;
|
|
6
|
+
build(builder: NodeBuilder): void;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export default class CodeNode extends Node {
|
|
10
10
|
isCodeNode: true;
|
|
11
11
|
code: string;
|
|
12
|
-
constructor(code
|
|
12
|
+
constructor(code?: string, includes?: CodeNodeInclude[]);
|
|
13
13
|
|
|
14
14
|
setIncludes(includes: CodeNodeInclude[]): this;
|
|
15
15
|
getIncludes(builder: NodeBuilder): CodeNodeInclude[];
|
|
@@ -2,12 +2,12 @@ import FunctionNode from './FunctionNode';
|
|
|
2
2
|
import TempNode from './TempNode';
|
|
3
3
|
import Node from './Node';
|
|
4
4
|
|
|
5
|
-
export default class FunctionCallNode extends TempNode {
|
|
6
|
-
functionNode: FunctionNode
|
|
5
|
+
export default class FunctionCallNode<P extends Node[] | { [name: string]: Node }> extends TempNode {
|
|
6
|
+
functionNode: FunctionNode<P>;
|
|
7
7
|
parameters: { [name: string]: Node };
|
|
8
8
|
|
|
9
|
-
constructor(functionNode?: FunctionNode
|
|
9
|
+
constructor(functionNode?: FunctionNode<P>, parameters?: P);
|
|
10
10
|
|
|
11
|
-
setParameters(parameters:
|
|
12
|
-
getParameters():
|
|
11
|
+
setParameters(parameters: P): this;
|
|
12
|
+
getParameters(): P;
|
|
13
13
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import CodeNode from './CodeNode';
|
|
1
|
+
import CodeNode, { CodeNodeInclude } from './CodeNode';
|
|
2
2
|
import FunctionCallNode from './FunctionCallNode';
|
|
3
3
|
import NodeBuilder from './NodeBuilder';
|
|
4
4
|
import NodeFunction from './NodeFunction';
|
|
5
5
|
import NodeFunctionInput from './NodeFunctionInput';
|
|
6
6
|
import Node from './Node';
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export type FunctionNodeArguments = Node[] | { [name: string]: Node };
|
|
9
|
+
|
|
10
|
+
export default class FunctionNode<P extends Node[] | { [name: string]: Node }> extends CodeNode {
|
|
9
11
|
keywords: { [key: string]: Node };
|
|
10
|
-
constructor(code?: string);
|
|
12
|
+
constructor(code?: string, includes?: CodeNodeInclude[]);
|
|
11
13
|
|
|
12
14
|
getInputs(builder: NodeBuilder): NodeFunctionInput[];
|
|
13
15
|
getNodeFunction(builder: NodeBuilder): NodeFunction;
|
|
14
|
-
call(parameters:
|
|
16
|
+
call(parameters: P): FunctionCallNode<P>;
|
|
15
17
|
}
|
|
@@ -4,3 +4,4 @@ import Node from './Node';
|
|
|
4
4
|
export function getNodesKeys(object: Node): string[];
|
|
5
5
|
export function getValueType(value: NodeValueOption): string | null;
|
|
6
6
|
export function getValueFromType(type: string, ...params: number[]): NodeValueOption | null;
|
|
7
|
+
export function getCacheKey(object: Node): string;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import NodeMaterial from '
|
|
2
|
-
import LineBasicNodeMaterial from '
|
|
3
|
-
import MeshBasicNodeMaterial from '
|
|
4
|
-
import MeshStandardNodeMaterial from '
|
|
5
|
-
import PointsNodeMaterial from '
|
|
6
|
-
import SpriteNodeMaterial from '
|
|
1
|
+
import NodeMaterial from './NodeMaterial';
|
|
2
|
+
import LineBasicNodeMaterial from './LineBasicNodeMaterial';
|
|
3
|
+
import MeshBasicNodeMaterial from './MeshBasicNodeMaterial';
|
|
4
|
+
import MeshStandardNodeMaterial from './MeshStandardNodeMaterial';
|
|
5
|
+
import PointsNodeMaterial from './PointsNodeMaterial';
|
|
6
|
+
import SpriteNodeMaterial from './SpriteNodeMaterial';
|
|
7
|
+
import MeshPhysicalNodeMaterial from './MeshPhysicalNodeMaterial';
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
NodeMaterial,
|
|
10
11
|
LineBasicNodeMaterial,
|
|
11
12
|
MeshBasicNodeMaterial,
|
|
13
|
+
MeshPhysicalNodeMaterial,
|
|
12
14
|
MeshStandardNodeMaterial,
|
|
13
15
|
PointsNodeMaterial,
|
|
14
16
|
SpriteNodeMaterial,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ShaderMaterialParameters } from '../../../../src/Three';
|
|
2
|
+
import { Swizzable, CheckerNode, Node } from '../Nodes';
|
|
3
|
+
|
|
4
|
+
import MeshStandardNodeMaterial from './MeshStandardNodeMaterial';
|
|
5
|
+
|
|
6
|
+
export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
7
|
+
iridescenceNode: null | Swizzable<CheckerNode>;
|
|
8
|
+
iridescenceIORNode: null | Swizzable;
|
|
9
|
+
iridescenceThicknessNode: null | Swizzable;
|
|
10
|
+
|
|
11
|
+
specularIntensityNode: Node | null;
|
|
12
|
+
specularColorNode: Node | null;
|
|
13
|
+
|
|
14
|
+
transmissionNode: Node | null;
|
|
15
|
+
thicknessNode: Node | null;
|
|
16
|
+
attenuationDistanceNode: Node | null;
|
|
17
|
+
attenuationColorNode: Node | null;
|
|
18
|
+
|
|
19
|
+
constructor(parameters: ShaderMaterialParameters);
|
|
20
|
+
|
|
21
|
+
copy(source: MeshPhysicalNodeMaterial): this;
|
|
22
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Fn, Node, Swizzable } from '../../../Nodes';
|
|
2
|
+
|
|
3
|
+
export function mx_perlin_noise_float(...params: Fn<[Node]>): Swizzable;
|
|
4
|
+
export function mx_cell_noise_float(...params: Fn<[Node]>): Swizzable;
|
|
5
|
+
export function mx_worley_noise_float(...params: Fn<[Node]>): Swizzable;
|
|
6
|
+
export function mx_fractal_noise_float(...params: Fn<[Node, Node, Node, Node]>): Swizzable;
|
|
@@ -7,17 +7,19 @@ export type Swizzable<T extends Node = Node> = T &
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
/** anything that can be passed to {@link nodeObject} and returns a proxy */
|
|
10
|
-
export type NodeRepresentation = number | boolean | Node | Swizzable
|
|
10
|
+
export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | Swizzable<T>;
|
|
11
11
|
|
|
12
12
|
/** anything that can be passed to {@link nodeObject} */
|
|
13
13
|
export type NodeObjectOption = NodeRepresentation | string;
|
|
14
14
|
|
|
15
|
-
// same logic as in ShaderNodeObject
|
|
15
|
+
// same logic as in ShaderNodeObject: number,boolean,node->swizzable, otherwise do nothing
|
|
16
16
|
export type NodeObject<T> = T extends Node ? Swizzable<T> : T extends number | boolean ? Swizzable<ConstNode> : T;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// opposite of NodeObject: node -> node|swizzable|boolean|number, otherwise do nothing
|
|
19
|
+
type Proxied<T> = T extends Node ? NodeRepresentation<T> : T;
|
|
19
20
|
// https://github.com/microsoft/TypeScript/issues/42435#issuecomment-765557874
|
|
20
|
-
type
|
|
21
|
+
export type ProxiedTuple<T extends readonly [...unknown[]]> = [...{ [index in keyof T]: Proxied<T[index]> }];
|
|
22
|
+
export type ProxiedObject<T> = { [index in keyof T]: Proxied<T[index]> };
|
|
21
23
|
type RemoveTail<T extends readonly [...unknown[]]> = T extends [unknown, ...infer X] ? X : [];
|
|
22
24
|
type RemoveHeadAndTail<T extends readonly [...unknown[]]> = T extends [unknown, ...infer X, unknown] ? X : [];
|
|
23
25
|
|
|
@@ -121,22 +123,22 @@ export function nodeArray<T extends NodeObjectOption[]>(obj: readonly [...T]): N
|
|
|
121
123
|
|
|
122
124
|
export function nodeProxy<T>(
|
|
123
125
|
nodeClass: T,
|
|
124
|
-
): (...params:
|
|
126
|
+
): (...params: ProxiedTuple<GetConstructors<T>>) => Swizzable<ConstructedNode<T>>;
|
|
125
127
|
|
|
126
128
|
export function nodeProxy<T, S extends GetPossibleScopes<T>>(
|
|
127
129
|
nodeClass: T,
|
|
128
130
|
scope: S,
|
|
129
|
-
): (...params:
|
|
131
|
+
): (...params: ProxiedTuple<RemoveTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
|
|
130
132
|
|
|
131
133
|
export function nodeProxy<T, S extends GetPossibleScopes<T>>(
|
|
132
134
|
nodeClass: T,
|
|
133
135
|
scope: S,
|
|
134
136
|
factor: NodeObjectOption,
|
|
135
|
-
): (...params:
|
|
137
|
+
): (...params: ProxiedTuple<RemoveHeadAndTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
|
|
136
138
|
|
|
137
139
|
export function nodeImmutable<T>(
|
|
138
140
|
nodeClass: T,
|
|
139
|
-
...params:
|
|
141
|
+
...params: ProxiedTuple<GetConstructors<T>>
|
|
140
142
|
): Swizzable<ConstructedNode<T>>;
|
|
141
143
|
|
|
142
144
|
export class ShaderNode<T = {}, R extends Node = Node> {
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
Swizzable,
|
|
14
14
|
NodeRepresentation,
|
|
15
15
|
NodeOrType,
|
|
16
|
+
ProxiedObject,
|
|
17
|
+
ProxiedTuple,
|
|
16
18
|
} from './ShaderNode';
|
|
17
19
|
import { Material, Texture } from '../../../../src/Three';
|
|
18
20
|
import { NodeTypeOption, NodeUserData, NodeValueOption } from '../core/constants';
|
|
@@ -22,13 +24,14 @@ import {
|
|
|
22
24
|
BypassNode,
|
|
23
25
|
CameraNode,
|
|
24
26
|
CodeNode,
|
|
27
|
+
CodeNodeInclude,
|
|
25
28
|
ComputeNode,
|
|
26
29
|
ContextNode,
|
|
27
|
-
ConvertNode,
|
|
28
30
|
ExpressionNode,
|
|
29
31
|
FrontFacingNode,
|
|
30
32
|
FunctionCallNode,
|
|
31
33
|
FunctionNode,
|
|
34
|
+
FunctionNodeArguments,
|
|
32
35
|
InstanceIndexNode,
|
|
33
36
|
MaterialNode,
|
|
34
37
|
MaterialReferenceNode,
|
|
@@ -83,8 +86,6 @@ export const imat4: ConvertType;
|
|
|
83
86
|
export const umat4: ConvertType;
|
|
84
87
|
export const bmat4: ConvertType;
|
|
85
88
|
|
|
86
|
-
export function func(code: string): ShaderNode<FunctionNode>;
|
|
87
|
-
|
|
88
89
|
export function uniform(nodeOrType: Node | Swizzable | NodeValueOption): Swizzable;
|
|
89
90
|
|
|
90
91
|
export function attribute(attributeName: string, nodeType: NodeTypeOption): Swizzable;
|
|
@@ -95,10 +96,27 @@ export function code(code: string, nodeType?: NodeTypeOption): Swizzable<CodeNod
|
|
|
95
96
|
export function context(node: NodeRepresentation, context: NodeBuilderContext): Swizzable<ContextNode>;
|
|
96
97
|
export function expression(snipped?: string, nodeType?: NodeTypeOption): Swizzable<ExpressionNode>;
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
// definition: const call = nodeProxy(FunctionCallNode);
|
|
100
|
+
export function call<P extends FunctionNodeArguments>(
|
|
101
|
+
functionNode?: FunctionNode<P>,
|
|
102
|
+
parameters?: ProxiedObject<P>,
|
|
103
|
+
): Swizzable<FunctionCallNode<P>>;
|
|
104
|
+
|
|
105
|
+
export type Fn<P extends FunctionNodeArguments> = P extends readonly [...unknown[]]
|
|
106
|
+
? ProxiedTuple<P>
|
|
107
|
+
: readonly [ProxiedObject<P>];
|
|
108
|
+
|
|
109
|
+
// tslint:disable:no-unnecessary-generics
|
|
110
|
+
export function func<P extends FunctionNodeArguments>(
|
|
111
|
+
code: string,
|
|
112
|
+
includes?: CodeNodeInclude[],
|
|
113
|
+
): { call: (...params: Fn<P>) => Swizzable };
|
|
114
|
+
|
|
115
|
+
export function fn<P extends FunctionNodeArguments>(
|
|
116
|
+
code: string,
|
|
117
|
+
includes?: CodeNodeInclude[],
|
|
118
|
+
): (...params: Fn<P>) => Swizzable;
|
|
119
|
+
// tslint:enable:no-unnecessary-generics
|
|
102
120
|
|
|
103
121
|
export const instanceIndex: Swizzable<InstanceIndexNode>;
|
|
104
122
|
export function label(node: NodeRepresentation, name?: string): Swizzable<VarNode>;
|
|
@@ -21,7 +21,7 @@ export interface ReflectorShader {
|
|
|
21
21
|
fragmentShader: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export interface
|
|
24
|
+
export interface ReflectorForSSRPassOptions {
|
|
25
25
|
clipBias?: number | undefined;
|
|
26
26
|
textureWidth?: number | undefined;
|
|
27
27
|
textureHeight?: number | undefined;
|
|
@@ -30,9 +30,9 @@ export interface ReflectorOptions {
|
|
|
30
30
|
shader?: ReflectorShader | undefined;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export class
|
|
33
|
+
export class ReflectorForSSRPass<TGeometry extends BufferGeometry = BufferGeometry> extends Mesh<TGeometry> {
|
|
34
34
|
type: 'ReflectorForSSRPass';
|
|
35
|
-
options:
|
|
35
|
+
options: ReflectorForSSRPassOptions;
|
|
36
36
|
|
|
37
37
|
static ReflectorShader: ReflectorShader;
|
|
38
38
|
|
|
@@ -49,7 +49,7 @@ export class Reflector<TGeometry extends BufferGeometry = BufferGeometry> extend
|
|
|
49
49
|
|
|
50
50
|
renderTarget: WebGLRenderTarget;
|
|
51
51
|
|
|
52
|
-
constructor(geometry: TGeometry, options:
|
|
52
|
+
constructor(geometry: TGeometry, options: ReflectorForSSRPassOptions);
|
|
53
53
|
|
|
54
54
|
doRender: (renderer: WebGLRenderer, scene: Scene, camera: Camera) => void;
|
|
55
55
|
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ColorRepresentation,
|
|
13
13
|
} from '../../../src/Three';
|
|
14
14
|
import { Pass, FullScreenQuad } from '../postprocessing/Pass';
|
|
15
|
-
import {
|
|
15
|
+
import { ReflectorForSSRPass } from '../objects/ReflectorForSSRPass';
|
|
16
16
|
|
|
17
17
|
export interface SSRPassParams {
|
|
18
18
|
renderer: WebGLRenderer;
|
|
@@ -23,7 +23,7 @@ export interface SSRPassParams {
|
|
|
23
23
|
selects: Mesh[] | null;
|
|
24
24
|
isPerspectiveCamera?: boolean | undefined;
|
|
25
25
|
isBouncing?: boolean | undefined;
|
|
26
|
-
groundReflector:
|
|
26
|
+
groundReflector: ReflectorForSSRPass | null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export class SSRPass extends Pass {
|
|
@@ -33,7 +33,7 @@ export class SSRPass extends Pass {
|
|
|
33
33
|
renderer: WebGLRenderer;
|
|
34
34
|
scene: Scene;
|
|
35
35
|
camera: Camera;
|
|
36
|
-
groundReflector:
|
|
36
|
+
groundReflector: ReflectorForSSRPass | null;
|
|
37
37
|
opacity: number;
|
|
38
38
|
output: number;
|
|
39
39
|
maxDistance: number;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import Node from '../../../nodes/core/Node
|
|
1
|
+
import Node from '../../../nodes/core/Node';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export interface SlotNodeParameters<TNode extends Node = Node> {
|
|
4
|
+
node?: TNode;
|
|
5
|
+
nodeType?: string;
|
|
6
|
+
source?: string | null;
|
|
7
|
+
target?: string | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default class SlotNode<TNode extends Node = Node> extends Node {
|
|
11
|
+
inclusionType: 'replace';
|
|
12
|
+
node: TNode | null;
|
|
13
|
+
source: null;
|
|
14
|
+
target: null;
|
|
15
|
+
|
|
16
|
+
constructor(params: SlotNodeParameters<TNode>);
|
|
5
17
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import NodeBuilder from '../../../nodes/core/NodeBuilder
|
|
1
|
+
import NodeBuilder from '../../../nodes/core/NodeBuilder';
|
|
2
2
|
import { Texture, TextureEncoding, Renderer, Object3D } from '../../../../../src/Three';
|
|
3
|
-
import Node from '../../../nodes/core/Node
|
|
4
|
-
import SlotNode from './SlotNode
|
|
5
|
-
import { NodeShaderStageOption } from '../../../nodes/core/constants
|
|
3
|
+
import Node from '../../../nodes/core/Node';
|
|
4
|
+
import SlotNode from './SlotNode';
|
|
5
|
+
import { NodeShaderStageOption } from '../../../nodes/core/constants';
|
|
6
6
|
|
|
7
7
|
export class WebGLNodeBuilder extends NodeBuilder {
|
|
8
8
|
constructor(
|
|
@@ -39,7 +39,7 @@ export class WebGLNodeBuilder extends NodeBuilder {
|
|
|
39
39
|
|
|
40
40
|
getVarys(shaderStage: string): string;
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
addCodeAfterCode(shaderStage: string, snippet: string, code: string): string;
|
|
43
43
|
addCodeAfterInclude(shaderStage: string, snippet: string, code: string): string;
|
|
44
44
|
|
|
45
45
|
replaceCode(shaderStage: string, source: string, target: string): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IUniform } from '../../../src/Three';
|
|
2
2
|
|
|
3
3
|
export const AfterimageShader: {
|
|
4
4
|
uniforms: {
|
|
5
|
-
damp:
|
|
6
|
-
tOld:
|
|
7
|
-
tNew:
|
|
5
|
+
damp: IUniform;
|
|
6
|
+
tOld: IUniform;
|
|
7
|
+
tNew: IUniform;
|
|
8
8
|
};
|
|
9
9
|
vertexShader: string;
|
|
10
10
|
fragmentShader: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IUniform } from '../../../src/Three';
|
|
2
2
|
|
|
3
3
|
export const BleachBypassShader: {
|
|
4
4
|
uniforms: {
|
|
5
|
-
tDiffuse:
|
|
6
|
-
opacity:
|
|
5
|
+
tDiffuse: IUniform;
|
|
6
|
+
opacity: IUniform;
|
|
7
7
|
};
|
|
8
8
|
vertexShader: string;
|
|
9
9
|
fragmentShader: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IUniform } from '../../../src/Three';
|
|
2
2
|
|
|
3
3
|
export const BlendShader: {
|
|
4
4
|
uniforms: {
|
|
5
|
-
tDiffuse1:
|
|
6
|
-
tDiffuse2:
|
|
7
|
-
mixRatio:
|
|
8
|
-
opacity:
|
|
5
|
+
tDiffuse1: IUniform;
|
|
6
|
+
tDiffuse2: IUniform;
|
|
7
|
+
mixRatio: IUniform;
|
|
8
|
+
opacity: IUniform;
|
|
9
9
|
};
|
|
10
10
|
vertexShader: string;
|
|
11
11
|
fragmentShader: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IUniform } from '../../../src/Three';
|
|
2
2
|
|
|
3
3
|
export const BokehShader: {
|
|
4
4
|
defines: {
|
|
@@ -6,14 +6,14 @@ export const BokehShader: {
|
|
|
6
6
|
PERSPECTIVE_CAMERA: number;
|
|
7
7
|
};
|
|
8
8
|
uniforms: {
|
|
9
|
-
tColor:
|
|
10
|
-
tDepth:
|
|
11
|
-
focus:
|
|
12
|
-
aspect:
|
|
13
|
-
aperture:
|
|
14
|
-
maxblur:
|
|
15
|
-
nearClip:
|
|
16
|
-
farClip:
|
|
9
|
+
tColor: IUniform;
|
|
10
|
+
tDepth: IUniform;
|
|
11
|
+
focus: IUniform;
|
|
12
|
+
aspect: IUniform;
|
|
13
|
+
aperture: IUniform;
|
|
14
|
+
maxblur: IUniform;
|
|
15
|
+
nearClip: IUniform;
|
|
16
|
+
farClip: IUniform;
|
|
17
17
|
};
|
|
18
18
|
vertexShader: string;
|
|
19
19
|
fragmentShader: string;
|