@types/three 0.157.1 → 0.157.2
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/animation/CCDIKSolver.d.ts +30 -0
- three/examples/jsm/animation/MMDAnimationHelper.d.ts +105 -0
- three/examples/jsm/animation/MMDPhysics.d.ts +124 -0
- three/examples/jsm/cameras/CinematicCamera.d.ts +41 -0
- three/examples/jsm/capabilities/WebGL.d.ts +9 -0
- three/examples/jsm/controls/FirstPersonControls.d.ts +31 -0
- three/examples/jsm/controls/OrbitControls.d.ts +286 -0
- three/examples/jsm/controls/TrackballControls.d.ts +58 -0
- three/examples/jsm/effects/OutlineEffect.d.ts +36 -0
- three/examples/jsm/environments/RoomEnvironment.d.ts +6 -0
- three/examples/jsm/exporters/PLYExporter.d.ts +30 -0
- three/examples/jsm/exporters/STLExporter.d.ts +21 -0
- three/examples/jsm/geometries/TextGeometry.d.ts +115 -0
- three/examples/jsm/helpers/RectAreaLightHelper.d.ts +10 -0
- three/examples/jsm/helpers/ViewHelper.d.ts +15 -0
- three/examples/jsm/libs/fflate.module.d.ts +1 -0
- three/examples/jsm/libs/lil-gui.module.min.d.ts +609 -0
- three/examples/jsm/libs/tween.module.d.ts +219 -0
- three/examples/jsm/lights/RectAreaLightUniformsLib.d.ts +3 -0
- three/examples/jsm/lines/Line2.d.ts +11 -0
- three/examples/jsm/lines/LineGeometry.d.ts +10 -0
- three/examples/jsm/lines/LineMaterial.d.ts +31 -0
- three/examples/jsm/lines/LineSegments2.d.ts +14 -0
- three/examples/jsm/lines/LineSegmentsGeometry.d.ts +23 -0
- three/examples/jsm/loaders/DDSLoader.d.ts +16 -0
- three/examples/jsm/loaders/DRACOLoader.d.ts +19 -0
- three/examples/jsm/loaders/FontLoader.d.ts +27 -0
- three/examples/jsm/loaders/GLTFLoader.d.ts +147 -0
- three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +18 -0
- three/examples/jsm/loaders/KTX2Loader.d.ts +16 -0
- three/examples/jsm/loaders/LDrawLoader.d.ts +19 -0
- three/examples/jsm/loaders/MMDLoader.d.ts +56 -0
- three/examples/jsm/loaders/MTLLoader.d.ts +104 -0
- three/examples/jsm/loaders/OBJLoader.d.ts +10 -0
- three/examples/jsm/loaders/PCDLoader.d.ts +8 -0
- three/examples/jsm/loaders/RGBELoader.d.ts +19 -0
- three/examples/jsm/loaders/RGBMLoader.d.ts +32 -0
- three/examples/jsm/loaders/SVGLoader.d.ts +68 -0
- three/examples/jsm/loaders/TGALoader.d.ts +7 -0
- three/examples/jsm/loaders/TTFLoader.d.ts +8 -0
- three/examples/jsm/loaders/USDZLoader.d.ts +11 -0
- three/examples/jsm/materials/MeshGouraudMaterial.d.ts +17 -0
- three/examples/jsm/modifiers/TessellateModifier.d.ts +9 -0
- three/examples/jsm/nodes/Nodes.d.ts +149 -0
- three/examples/jsm/nodes/accessors/BitangentNode.d.ts +18 -0
- three/examples/jsm/nodes/accessors/BufferNode.d.ts +11 -0
- three/examples/jsm/nodes/accessors/CameraNode.d.ts +12 -0
- three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +13 -0
- three/examples/jsm/nodes/accessors/InstanceNode.d.ts +9 -0
- three/examples/jsm/nodes/accessors/MaterialNode.d.ts +23 -0
- three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +6 -0
- three/examples/jsm/nodes/accessors/ModelNode.d.ts +9 -0
- three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +6 -0
- three/examples/jsm/nodes/accessors/NormalNode.d.ts +12 -0
- three/examples/jsm/nodes/accessors/Object3DNode.d.ts +22 -0
- three/examples/jsm/nodes/accessors/PointUVNode.d.ts +7 -0
- three/examples/jsm/nodes/accessors/PositionNode.d.ts +21 -0
- three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +13 -0
- three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +8 -0
- three/examples/jsm/nodes/accessors/SkinningNode.d.ts +13 -0
- three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +6 -0
- three/examples/jsm/nodes/accessors/TangentNode.d.ts +18 -0
- three/examples/jsm/nodes/accessors/TextureNode.d.ts +14 -0
- three/examples/jsm/nodes/accessors/UVNode.d.ts +8 -0
- three/examples/jsm/nodes/accessors/UserDataNode.d.ts +7 -0
- three/examples/jsm/nodes/code/CodeNode.d.ts +15 -0
- three/examples/jsm/nodes/code/ExpressionNode.d.ts +7 -0
- three/examples/jsm/nodes/code/FunctionCallNode.d.ts +13 -0
- three/examples/jsm/nodes/code/FunctionNode.d.ts +17 -0
- three/examples/jsm/nodes/core/ArrayUniformNode.d.ts +8 -0
- three/examples/jsm/nodes/core/AttributeNode.d.ts +9 -0
- three/examples/jsm/nodes/core/BypassNode.d.ts +9 -0
- three/examples/jsm/nodes/core/CacheNode.d.ts +10 -0
- three/examples/jsm/nodes/core/ConstNode.d.ts +10 -0
- three/examples/jsm/nodes/core/ContextNode.d.ts +10 -0
- three/examples/jsm/nodes/core/InputNode.d.ts +16 -0
- three/examples/jsm/nodes/core/Node.d.ts +31 -0
- three/examples/jsm/nodes/core/NodeAttribute.d.ts +6 -0
- three/examples/jsm/nodes/core/NodeBuilder.d.ts +138 -0
- three/examples/jsm/nodes/core/NodeCache.d.ts +9 -0
- three/examples/jsm/nodes/core/NodeCode.d.ts +4 -0
- three/examples/jsm/nodes/core/NodeFrame.d.ts +19 -0
- three/examples/jsm/nodes/core/NodeFunction.d.ts +13 -0
- three/examples/jsm/nodes/core/NodeFunctionInput.d.ts +7 -0
- three/examples/jsm/nodes/core/NodeKeywords.d.ts +14 -0
- three/examples/jsm/nodes/core/NodeParser.d.ts +5 -0
- three/examples/jsm/nodes/core/NodeUniform.d.ts +13 -0
- three/examples/jsm/nodes/core/NodeUtils.d.ts +13 -0
- three/examples/jsm/nodes/core/NodeVar.d.ts +6 -0
- three/examples/jsm/nodes/core/NodeVarying.d.ts +8 -0
- three/examples/jsm/nodes/core/PropertyNode.d.ts +6 -0
- three/examples/jsm/nodes/core/StackNode.d.ts +11 -0
- three/examples/jsm/nodes/core/TempNode.d.ts +11 -0
- three/examples/jsm/nodes/core/UniformNode.d.ts +10 -0
- three/examples/jsm/nodes/core/VarNode.d.ts +16 -0
- three/examples/jsm/nodes/core/VaryingNode.d.ts +8 -0
- three/examples/jsm/nodes/core/constants.d.ts +78 -0
- three/examples/jsm/nodes/display/BlendModeNode.d.ts +32 -0
- three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +20 -0
- three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +18 -0
- three/examples/jsm/nodes/display/FrontFacingNode.d.ts +6 -0
- three/examples/jsm/nodes/display/NormalMapNode.d.ts +12 -0
- three/examples/jsm/nodes/display/PosterizeNode.d.ts +8 -0
- three/examples/jsm/nodes/display/ToneMappingNode.d.ts +14 -0
- three/examples/jsm/nodes/display/ViewportNode.d.ts +23 -0
- three/examples/jsm/nodes/fog/FogExp2Node.d.ts +9 -0
- three/examples/jsm/nodes/fog/FogNode.d.ts +10 -0
- three/examples/jsm/nodes/fog/FogRangeNode.d.ts +10 -0
- three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +6 -0
- three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +6 -0
- three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +10 -0
- three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +9 -0
- three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +6 -0
- three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +6 -0
- three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +11 -0
- three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +5 -0
- three/examples/jsm/nodes/functions/material/getRoughness.d.ts +6 -0
- three/examples/jsm/nodes/geometry/RangeNode.d.ts +13 -0
- three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +11 -0
- three/examples/jsm/nodes/lighting/AONode.d.ts +8 -0
- three/examples/jsm/nodes/lighting/AnalyticLightNode.d.ts +10 -0
- three/examples/jsm/nodes/lighting/EnvironmentNode.d.ts +8 -0
- three/examples/jsm/nodes/lighting/HemisphereLightNode.d.ts +13 -0
- three/examples/jsm/nodes/lighting/LightUtils.d.ts +4 -0
- three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +15 -0
- three/examples/jsm/nodes/lighting/LightingNode.d.ts +5 -0
- three/examples/jsm/nodes/lighting/LightsNode.d.ts +19 -0
- three/examples/jsm/nodes/lighting/PointLightNode.d.ts +10 -0
- three/examples/jsm/nodes/lighting/SpotLightNode.d.ts +15 -0
- three/examples/jsm/nodes/loaders/NodeLoader.d.ts +14 -0
- three/examples/jsm/nodes/loaders/NodeMaterialLoader.d.ts +8 -0
- three/examples/jsm/nodes/loaders/NodeObjectLoader.d.ts +9 -0
- three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +9 -0
- three/examples/jsm/nodes/materials/Materials.d.ts +17 -0
- three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +10 -0
- three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +22 -0
- three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +18 -0
- three/examples/jsm/nodes/materials/NodeMaterial.d.ts +38 -0
- three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +15 -0
- three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +23 -0
- three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +94 -0
- three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +4 -0
- three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +6 -0
- three/examples/jsm/nodes/math/CondNode.d.ts +9 -0
- three/examples/jsm/nodes/math/MathNode.d.ts +115 -0
- three/examples/jsm/nodes/math/OperatorNode.d.ts +31 -0
- three/examples/jsm/nodes/procedural/CheckerNode.d.ts +6 -0
- three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +156 -0
- three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +310 -0
- three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +166 -0
- three/examples/jsm/nodes/utils/ArrayElementNode.d.ts +9 -0
- three/examples/jsm/nodes/utils/ConvertNode.d.ts +8 -0
- three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +6 -0
- three/examples/jsm/nodes/utils/JoinNode.d.ts +10 -0
- three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +5 -0
- three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +11 -0
- three/examples/jsm/nodes/utils/OscNode.d.ts +19 -0
- three/examples/jsm/nodes/utils/RemapNode.d.ts +13 -0
- three/examples/jsm/nodes/utils/RotateUVNode.d.ts +10 -0
- three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +8 -0
- three/examples/jsm/nodes/utils/SplitNode.d.ts +16 -0
- three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +9 -0
- three/examples/jsm/nodes/utils/TimerNode.d.ts +19 -0
- three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +22 -0
- three/examples/jsm/objects/GroundProjectedSkybox.d.ts +13 -0
- three/examples/jsm/objects/MarchingCubes.d.ts +76 -0
- three/examples/jsm/objects/Reflector.d.ts +29 -0
- three/examples/jsm/postprocessing/EffectComposer.d.ts +31 -0
- three/examples/jsm/postprocessing/Pass.d.ts +31 -0
- three/examples/jsm/postprocessing/SavePass.d.ts +12 -0
- three/examples/jsm/postprocessing/ShaderPass.d.ts +11 -0
- three/examples/jsm/renderers/CSS3DRenderer.d.ts +26 -0
- three/examples/jsm/renderers/webgl/nodes/SlotNode.d.ts +17 -0
- three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +37 -0
- three/examples/jsm/renderers/webgl/nodes/WebGLNodes.d.ts +3 -0
- three/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts +10 -0
- three/examples/jsm/shaders/BokehShader2.d.ts +42 -0
- three/examples/jsm/shaders/ToonShader.d.ts +54 -0
- three/examples/jsm/shaders/VelocityShader.d.ts +13 -0
- three/examples/jsm/textures/FlakesTexture.d.ts +3 -0
- three/examples/jsm/utils/CameraUtils.d.ts +9 -0
- three/examples/jsm/utils/GeometryUtils.d.ts +25 -0
- three/examples/jsm/utils/LDrawUtils.d.ts +5 -0
- three/examples/jsm/utils/ShadowMapViewer.d.ts +24 -0
- three/examples/jsm/webxr/VRButton.d.ts +5 -0
- three/examples/jsm/webxr/XRButton.d.ts +6 -0
- three/examples/jsm/webxr/XRControllerModelFactory.d.ts +21 -0
- three/examples/jsm/webxr/XRHandMeshModel.d.ts +11 -0
- three/examples/jsm/webxr/XRHandModelFactory.d.ts +25 -0
- three/examples/jsm/webxr/XRHandPrimitiveModel.d.ts +24 -0
- three/package.json +2 -2
- three/src/extras/Earcut.d.ts +15 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import { ShaderMaterialParameters } from '../../../../src/Three.js';
|
|
3
|
+
import { Node } from '../Nodes.js';
|
|
4
|
+
|
|
5
|
+
export default class PointsNodeMaterial extends NodeMaterial {
|
|
6
|
+
isPointsNodeMateria: true;
|
|
7
|
+
colorNode: Node | null;
|
|
8
|
+
opacityNode: Node | null;
|
|
9
|
+
alphaTestNode: Node | null;
|
|
10
|
+
lightNode: Node | null;
|
|
11
|
+
sizeNode: Node | null;
|
|
12
|
+
positionNode: Node | null;
|
|
13
|
+
constructor(parameters?: ShaderMaterialParameters);
|
|
14
|
+
copy(source: PointsNodeMaterial): this;
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import { ShaderMaterialParameters } from '../../../../src/Three.js';
|
|
3
|
+
import { NodeBuilder } from '../Nodes.js';
|
|
4
|
+
import Node from '../core/Node.js';
|
|
5
|
+
|
|
6
|
+
export default class SpriteNodeMaterial extends NodeMaterial {
|
|
7
|
+
isSpriteNodeMaterial: true;
|
|
8
|
+
|
|
9
|
+
colorNode: Node | null;
|
|
10
|
+
opacityNode: Node | null;
|
|
11
|
+
|
|
12
|
+
alphaTestNode: Node | null;
|
|
13
|
+
|
|
14
|
+
lightNode: Node | null;
|
|
15
|
+
|
|
16
|
+
positionNode: Node | null;
|
|
17
|
+
rotationNode: Node | null;
|
|
18
|
+
scaleNode: Node | null;
|
|
19
|
+
|
|
20
|
+
constructor(parameters?: ShaderMaterialParameters);
|
|
21
|
+
generatePosition(builder: NodeBuilder): void;
|
|
22
|
+
copy(source: SpriteNodeMaterial): this;
|
|
23
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { mx_hsvtorgb, mx_rgbtohsv } from './lib/mx_hsv.js';
|
|
2
|
+
import { Swizzable } from '../shadernode/ShaderNodeElements.js';
|
|
3
|
+
import { UVNode, MathNode } from '../Nodes.js';
|
|
4
|
+
import { NodeRepresentation } from '../shadernode/ShaderNode.js';
|
|
5
|
+
|
|
6
|
+
export function mx_aastep(threshold?: NodeRepresentation, value?: NodeRepresentation): Swizzable<MathNode>;
|
|
7
|
+
|
|
8
|
+
export function mx_ramplr(
|
|
9
|
+
valuel?: NodeRepresentation,
|
|
10
|
+
valuer?: NodeRepresentation,
|
|
11
|
+
texcoord?: Swizzable<UVNode>,
|
|
12
|
+
): Swizzable<MathNode>;
|
|
13
|
+
export function mx_ramptb(
|
|
14
|
+
valuet?: NodeRepresentation,
|
|
15
|
+
valueb?: NodeRepresentation,
|
|
16
|
+
texcoord?: Swizzable<UVNode>,
|
|
17
|
+
): Swizzable<MathNode>;
|
|
18
|
+
|
|
19
|
+
export function mx_splitlr(
|
|
20
|
+
valuel?: NodeRepresentation,
|
|
21
|
+
valuer?: NodeRepresentation,
|
|
22
|
+
center?: NodeRepresentation,
|
|
23
|
+
texcoord?: Swizzable<UVNode>,
|
|
24
|
+
): Swizzable<MathNode>;
|
|
25
|
+
export function mx_splittb(
|
|
26
|
+
valuet?: NodeRepresentation,
|
|
27
|
+
valueb?: NodeRepresentation,
|
|
28
|
+
center?: NodeRepresentation,
|
|
29
|
+
texcoord?: Swizzable<UVNode>,
|
|
30
|
+
): Swizzable<MathNode>;
|
|
31
|
+
|
|
32
|
+
export function mx_transform_uv(
|
|
33
|
+
uv_scale?: NodeRepresentation,
|
|
34
|
+
uv_offset?: NodeRepresentation,
|
|
35
|
+
uv_geo?: Swizzable<UVNode>,
|
|
36
|
+
): Swizzable;
|
|
37
|
+
|
|
38
|
+
export function mx_noise_float(
|
|
39
|
+
texcoord?: Swizzable<UVNode>,
|
|
40
|
+
amplitude?: NodeRepresentation,
|
|
41
|
+
pivot?: NodeRepresentation,
|
|
42
|
+
): Swizzable;
|
|
43
|
+
export function mx_noise_vec2(
|
|
44
|
+
texcoord?: Swizzable<UVNode>,
|
|
45
|
+
amplitude?: NodeRepresentation,
|
|
46
|
+
pivot?: NodeRepresentation,
|
|
47
|
+
): Swizzable;
|
|
48
|
+
export function mx_noise_vec3(
|
|
49
|
+
texcoord?: Swizzable<UVNode>,
|
|
50
|
+
amplitude?: NodeRepresentation,
|
|
51
|
+
pivot?: NodeRepresentation,
|
|
52
|
+
): Swizzable;
|
|
53
|
+
export function mx_noise_vec4(
|
|
54
|
+
texcoord?: Swizzable<UVNode>,
|
|
55
|
+
amplitude?: NodeRepresentation,
|
|
56
|
+
pivot?: NodeRepresentation,
|
|
57
|
+
): Swizzable;
|
|
58
|
+
|
|
59
|
+
export function mx_worley_noise_float(texcoord?: Swizzable<UVNode>, jitter?: NodeRepresentation): Swizzable;
|
|
60
|
+
export function mx_worley_noise_vec2(texcoord?: Swizzable<UVNode>, jitter?: NodeRepresentation): Swizzable;
|
|
61
|
+
export function mx_worley_noise_vec3(texcoord?: Swizzable<UVNode>, jitter?: NodeRepresentation): Swizzable;
|
|
62
|
+
|
|
63
|
+
export function mx_cell_noise_float(texcoord?: Swizzable<UVNode>): Swizzable;
|
|
64
|
+
|
|
65
|
+
export function mx_fractal_noise_float(
|
|
66
|
+
position?: Swizzable<UVNode>,
|
|
67
|
+
octaves?: NodeRepresentation,
|
|
68
|
+
lacunarity?: NodeRepresentation,
|
|
69
|
+
diminish?: NodeRepresentation,
|
|
70
|
+
amplitude?: NodeRepresentation,
|
|
71
|
+
): Swizzable;
|
|
72
|
+
export function mx_fractal_noise_vec2(
|
|
73
|
+
position?: Swizzable<UVNode>,
|
|
74
|
+
octaves?: NodeRepresentation,
|
|
75
|
+
lacunarity?: NodeRepresentation,
|
|
76
|
+
diminish?: NodeRepresentation,
|
|
77
|
+
amplitude?: NodeRepresentation,
|
|
78
|
+
): Swizzable;
|
|
79
|
+
export function mx_fractal_noise_vec3(
|
|
80
|
+
position?: Swizzable<UVNode>,
|
|
81
|
+
octaves?: NodeRepresentation,
|
|
82
|
+
lacunarity?: NodeRepresentation,
|
|
83
|
+
diminish?: NodeRepresentation,
|
|
84
|
+
amplitude?: NodeRepresentation,
|
|
85
|
+
): Swizzable;
|
|
86
|
+
export function mx_fractal_noise_vec4(
|
|
87
|
+
position?: Swizzable<UVNode>,
|
|
88
|
+
octaves?: NodeRepresentation,
|
|
89
|
+
lacunarity?: NodeRepresentation,
|
|
90
|
+
diminish?: NodeRepresentation,
|
|
91
|
+
amplitude?: NodeRepresentation,
|
|
92
|
+
): Swizzable;
|
|
93
|
+
|
|
94
|
+
export { mx_hsvtorgb, mx_rgbtohsv };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Fn, Node, Swizzable } from '../../Nodes.js';
|
|
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;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
|
+
import TempNode from '../core/TempNode.js';
|
|
3
|
+
|
|
4
|
+
export type MathNodeMethod1 =
|
|
5
|
+
| typeof MathNode.RADIANS
|
|
6
|
+
| typeof MathNode.DEGREES
|
|
7
|
+
| typeof MathNode.EXP
|
|
8
|
+
| typeof MathNode.EXP2
|
|
9
|
+
| typeof MathNode.LOG
|
|
10
|
+
| typeof MathNode.LOG2
|
|
11
|
+
| typeof MathNode.SQRT
|
|
12
|
+
| typeof MathNode.INVERSE_SQRT
|
|
13
|
+
| typeof MathNode.FLOOR
|
|
14
|
+
| typeof MathNode.CEIL
|
|
15
|
+
| typeof MathNode.NORMALIZE
|
|
16
|
+
| typeof MathNode.FRACT
|
|
17
|
+
| typeof MathNode.SIN
|
|
18
|
+
| typeof MathNode.COS
|
|
19
|
+
| typeof MathNode.TAN
|
|
20
|
+
| typeof MathNode.ASIN
|
|
21
|
+
| typeof MathNode.ACOS
|
|
22
|
+
| typeof MathNode.ATAN
|
|
23
|
+
| typeof MathNode.ABS
|
|
24
|
+
| typeof MathNode.SIGN
|
|
25
|
+
| typeof MathNode.LENGTH
|
|
26
|
+
| typeof MathNode.NEGATE
|
|
27
|
+
| typeof MathNode.ONE_MINUS
|
|
28
|
+
| typeof MathNode.DFDX
|
|
29
|
+
| typeof MathNode.DFDY
|
|
30
|
+
| typeof MathNode.ROUND;
|
|
31
|
+
|
|
32
|
+
export type MathNodeMethod2 =
|
|
33
|
+
| typeof MathNode.ATAN2
|
|
34
|
+
| typeof MathNode.MIN
|
|
35
|
+
| typeof MathNode.MAX
|
|
36
|
+
| typeof MathNode.MOD
|
|
37
|
+
| typeof MathNode.STEP
|
|
38
|
+
| typeof MathNode.REFLECT
|
|
39
|
+
| typeof MathNode.DISTANCE
|
|
40
|
+
| typeof MathNode.DOT
|
|
41
|
+
| typeof MathNode.CROSS
|
|
42
|
+
| typeof MathNode.POW
|
|
43
|
+
| typeof MathNode.TRANSFORM_DIRECTION;
|
|
44
|
+
|
|
45
|
+
export type MathNodeMethod3 =
|
|
46
|
+
| typeof MathNode.MIX
|
|
47
|
+
| typeof MathNode.CLAMP
|
|
48
|
+
| typeof MathNode.REFRACT
|
|
49
|
+
| typeof MathNode.SMOOTHSTEP
|
|
50
|
+
| typeof MathNode.FACEFORWARD;
|
|
51
|
+
|
|
52
|
+
export type MathNodeMethod = MathNodeMethod1 | MathNodeMethod2 | MathNodeMethod3;
|
|
53
|
+
|
|
54
|
+
export default class MathNode extends TempNode {
|
|
55
|
+
// 1 input
|
|
56
|
+
|
|
57
|
+
static RADIANS: 'radians';
|
|
58
|
+
static DEGREES: 'degrees';
|
|
59
|
+
static EXP: 'exp';
|
|
60
|
+
static EXP2: 'exp2';
|
|
61
|
+
static LOG: 'log';
|
|
62
|
+
static LOG2: 'log2';
|
|
63
|
+
static SQRT: 'sqrt';
|
|
64
|
+
static INVERSE_SQRT: 'inversesqrt';
|
|
65
|
+
static FLOOR: 'floor';
|
|
66
|
+
static CEIL: 'ceil';
|
|
67
|
+
static NORMALIZE: 'normalize';
|
|
68
|
+
static FRACT: 'fract';
|
|
69
|
+
static SIN: 'sin';
|
|
70
|
+
static COS: 'cos';
|
|
71
|
+
static TAN: 'tan';
|
|
72
|
+
static ASIN: 'asin';
|
|
73
|
+
static ACOS: 'acos';
|
|
74
|
+
static ATAN: 'atan';
|
|
75
|
+
static ABS: 'abs';
|
|
76
|
+
static SIGN: 'sign';
|
|
77
|
+
static LENGTH: 'length';
|
|
78
|
+
static NEGATE: 'negate';
|
|
79
|
+
static ONE_MINUS: 'oneMinus';
|
|
80
|
+
static DFDX: 'dFdx';
|
|
81
|
+
static DFDY: 'dFdy';
|
|
82
|
+
static ROUND: 'round';
|
|
83
|
+
static RECIPROCAL: 'reciprocal';
|
|
84
|
+
|
|
85
|
+
// 2 inputs
|
|
86
|
+
|
|
87
|
+
static ATAN2: 'atan2';
|
|
88
|
+
static MIN: 'min';
|
|
89
|
+
static MAX: 'max';
|
|
90
|
+
static MOD: 'mod';
|
|
91
|
+
static STEP: 'step';
|
|
92
|
+
static REFLECT: 'reflect';
|
|
93
|
+
static DISTANCE: 'distance';
|
|
94
|
+
static DOT: 'dot';
|
|
95
|
+
static CROSS: 'cross';
|
|
96
|
+
static POW: 'pow';
|
|
97
|
+
static TRANSFORM_DIRECTION: 'transformDirection';
|
|
98
|
+
|
|
99
|
+
// 3 inputs
|
|
100
|
+
|
|
101
|
+
static MIX: 'mix';
|
|
102
|
+
static CLAMP: 'clamp';
|
|
103
|
+
static REFRACT: 'refract';
|
|
104
|
+
static SMOOTHSTEP: 'smoothstep';
|
|
105
|
+
static FACEFORWARD: 'faceforward';
|
|
106
|
+
|
|
107
|
+
method: MathNodeMethod;
|
|
108
|
+
aNode: Node;
|
|
109
|
+
bNode: Node | null;
|
|
110
|
+
cNode: Node | null;
|
|
111
|
+
|
|
112
|
+
constructor(method: MathNodeMethod1, aNode: Node);
|
|
113
|
+
constructor(method: MathNodeMethod2, aNode: Node, bNode: Node);
|
|
114
|
+
constructor(method: MathNodeMethod3, aNode: Node, bNode: Node, cNode: Node);
|
|
115
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import TempNode from '../core/TempNode.js';
|
|
2
|
+
import Node from '../core/Node.js';
|
|
3
|
+
|
|
4
|
+
export type OperatorNodeOp =
|
|
5
|
+
| '='
|
|
6
|
+
| '%'
|
|
7
|
+
| '&'
|
|
8
|
+
| '|'
|
|
9
|
+
| '^'
|
|
10
|
+
| '>>'
|
|
11
|
+
| '<<'
|
|
12
|
+
| '=='
|
|
13
|
+
| '&&'
|
|
14
|
+
| '||'
|
|
15
|
+
| '^^'
|
|
16
|
+
| '<'
|
|
17
|
+
| '>'
|
|
18
|
+
| '<='
|
|
19
|
+
| '>='
|
|
20
|
+
| '+'
|
|
21
|
+
| '-'
|
|
22
|
+
| '*'
|
|
23
|
+
| '/';
|
|
24
|
+
|
|
25
|
+
export default class OperatorNode extends TempNode {
|
|
26
|
+
aNode: Node;
|
|
27
|
+
bNode: Node;
|
|
28
|
+
op: OperatorNodeOp;
|
|
29
|
+
|
|
30
|
+
constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]);
|
|
31
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { ConstNode, Node, NodeBuilder, NodeTypeOption, SwizzleOption } from '../Nodes.js';
|
|
2
|
+
// lot of private typescript magic here
|
|
3
|
+
export {};
|
|
4
|
+
export type Swizzable<T extends Node = Node> = T & {
|
|
5
|
+
[key in SwizzleOption | number]: Swizzable;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** anything that can be passed to {@link nodeObject} and returns a proxy */
|
|
9
|
+
export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | Swizzable<T>;
|
|
10
|
+
|
|
11
|
+
/** anything that can be passed to {@link nodeObject} */
|
|
12
|
+
export type NodeObjectOption = NodeRepresentation | string;
|
|
13
|
+
|
|
14
|
+
// same logic as in ShaderNodeObject: number,boolean,node->swizzable, otherwise do nothing
|
|
15
|
+
export type NodeObject<T> = T extends Node ? Swizzable<T> : T extends number | boolean ? Swizzable<ConstNode> : T;
|
|
16
|
+
|
|
17
|
+
// opposite of NodeObject: node -> node|swizzable|boolean|number, otherwise do nothing
|
|
18
|
+
type Proxied<T> = T extends Node ? NodeRepresentation<T> : T;
|
|
19
|
+
// https://github.com/microsoft/TypeScript/issues/42435#issuecomment-765557874
|
|
20
|
+
export type ProxiedTuple<T extends readonly [...unknown[]]> = [...{ [index in keyof T]: Proxied<T[index]> }];
|
|
21
|
+
export type ProxiedObject<T> = { [index in keyof T]: Proxied<T[index]> };
|
|
22
|
+
type RemoveTail<T extends readonly [...unknown[]]> = T extends [unknown, ...infer X] ? X : [];
|
|
23
|
+
type RemoveHeadAndTail<T extends readonly [...unknown[]]> = T extends [unknown, ...infer X, unknown] ? X : [];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Temporary type to save signatures of 4 constructors. Each element may be tuple or undefined.
|
|
27
|
+
*
|
|
28
|
+
* We use an object instead of tuple or union as it makes stuff easier, especially in Typescript 4.0.
|
|
29
|
+
*/
|
|
30
|
+
interface Construtors<
|
|
31
|
+
A extends undefined | [...unknown[]],
|
|
32
|
+
B extends undefined | [...unknown[]],
|
|
33
|
+
C extends undefined | [...unknown[]],
|
|
34
|
+
D extends undefined | [...unknown[]],
|
|
35
|
+
> {
|
|
36
|
+
a: A;
|
|
37
|
+
b: B;
|
|
38
|
+
c: C;
|
|
39
|
+
d: D;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns all constructors
|
|
44
|
+
*
|
|
45
|
+
* <https://github.com/microsoft/TypeScript/issues/37079>
|
|
46
|
+
* <https://stackoverflow.com/a/52761156/1623826>
|
|
47
|
+
*/
|
|
48
|
+
type OverloadedConstructorsOf<T> = T extends {
|
|
49
|
+
new (...args: infer A1): unknown;
|
|
50
|
+
new (...args: infer A2): unknown;
|
|
51
|
+
new (...args: infer A3): unknown;
|
|
52
|
+
new (...args: infer A4): unknown;
|
|
53
|
+
}
|
|
54
|
+
? Construtors<A1, A2, A3, A4>
|
|
55
|
+
: T extends {
|
|
56
|
+
new (...args: infer A1): unknown;
|
|
57
|
+
new (...args: infer A2): unknown;
|
|
58
|
+
new (...args: infer A3): unknown;
|
|
59
|
+
}
|
|
60
|
+
? Construtors<A1, A2, A3, undefined>
|
|
61
|
+
: T extends {
|
|
62
|
+
new (...args: infer A1): unknown;
|
|
63
|
+
new (...args: infer A2): unknown;
|
|
64
|
+
}
|
|
65
|
+
? Construtors<A1, A2, undefined, undefined>
|
|
66
|
+
: T extends new (...args: infer A) => unknown
|
|
67
|
+
? Construtors<A, undefined, undefined, undefined>
|
|
68
|
+
: Construtors<undefined, undefined, undefined, undefined>;
|
|
69
|
+
|
|
70
|
+
type AnyConstructors = Construtors<any, any, any, any>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns all constructors where the first paramter is assignable to given "scope"
|
|
74
|
+
*/
|
|
75
|
+
// tslint:disable-next-line:interface-over-type-literal
|
|
76
|
+
type FilterConstructorsByScope<T extends AnyConstructors, S> = {
|
|
77
|
+
a: S extends T['a'][0] ? T['a'] : undefined;
|
|
78
|
+
b: S extends T['b'][0] ? T['b'] : undefined;
|
|
79
|
+
c: S extends T['c'][0] ? T['c'] : undefined;
|
|
80
|
+
d: S extends T['d'][0] ? T['d'] : undefined;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* "flattens" the tuple into an union type
|
|
84
|
+
*/
|
|
85
|
+
type ConstructorUnion<T extends AnyConstructors> =
|
|
86
|
+
| Exclude<T['a'], undefined>
|
|
87
|
+
| Exclude<T['b'], undefined>
|
|
88
|
+
| Exclude<T['c'], undefined>
|
|
89
|
+
| Exclude<T['d'], undefined>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Extract list of possible scopes - union of the first paramter
|
|
93
|
+
* of all constructors, should it be string
|
|
94
|
+
*/
|
|
95
|
+
type ExtractScopes<T extends AnyConstructors> =
|
|
96
|
+
| (T['a'][0] extends string ? T['a'][0] : never)
|
|
97
|
+
| (T['b'][0] extends string ? T['b'][0] : never)
|
|
98
|
+
| (T['c'][0] extends string ? T['c'][0] : never)
|
|
99
|
+
| (T['d'][0] extends string ? T['d'][0] : never);
|
|
100
|
+
|
|
101
|
+
type GetConstructorsByScope<T, S> = ConstructorUnion<FilterConstructorsByScope<OverloadedConstructorsOf<T>, S>>;
|
|
102
|
+
type GetConstructors<T> = ConstructorUnion<OverloadedConstructorsOf<T>>;
|
|
103
|
+
type GetPossibleScopes<T> = ExtractScopes<OverloadedConstructorsOf<T>>;
|
|
104
|
+
|
|
105
|
+
export type ConvertType = (...params: unknown[]) => Swizzable;
|
|
106
|
+
|
|
107
|
+
export const ConvertType: {
|
|
108
|
+
new (type: NodeTypeOption, cacheMap?: Map<unknown, ConstNode>): ConvertType;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
type NodeArray<T extends NodeObjectOption[]> = { [index in keyof T]: NodeObject<T[index]> };
|
|
112
|
+
type NodeObjects<T> = { [key in keyof T]: T[key] extends NodeObjectOption ? NodeObject<T[key]> : T[key] };
|
|
113
|
+
type ConstructedNode<T> = T extends new (...args: any[]) => infer R ? (R extends Node ? R : never) : never;
|
|
114
|
+
|
|
115
|
+
export type NodeOrType = Node | NodeTypeOption;
|
|
116
|
+
|
|
117
|
+
export function getConstNodeType(value: NodeOrType): NodeTypeOption | null;
|
|
118
|
+
export function nodeObject<T extends NodeObjectOption>(obj: T): NodeObject<T>;
|
|
119
|
+
export function nodeObjects<T>(obj: T): NodeObjects<T>;
|
|
120
|
+
|
|
121
|
+
export function nodeArray<T extends NodeObjectOption[]>(obj: readonly [...T]): NodeArray<T>;
|
|
122
|
+
|
|
123
|
+
export function nodeProxy<T>(
|
|
124
|
+
nodeClass: T,
|
|
125
|
+
): (...params: ProxiedTuple<GetConstructors<T>>) => Swizzable<ConstructedNode<T>>;
|
|
126
|
+
|
|
127
|
+
export function nodeProxy<T, S extends GetPossibleScopes<T>>(
|
|
128
|
+
nodeClass: T,
|
|
129
|
+
scope: S,
|
|
130
|
+
): (...params: ProxiedTuple<RemoveTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
|
|
131
|
+
|
|
132
|
+
export function nodeProxy<T, S extends GetPossibleScopes<T>>(
|
|
133
|
+
nodeClass: T,
|
|
134
|
+
scope: S,
|
|
135
|
+
factor: NodeObjectOption,
|
|
136
|
+
): (...params: ProxiedTuple<RemoveHeadAndTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
|
|
137
|
+
|
|
138
|
+
export function nodeImmutable<T>(
|
|
139
|
+
nodeClass: T,
|
|
140
|
+
...params: ProxiedTuple<GetConstructors<T>>
|
|
141
|
+
): Swizzable<ConstructedNode<T>>;
|
|
142
|
+
|
|
143
|
+
export class ShaderNode<T = {}, R extends Node = Node> {
|
|
144
|
+
constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => NodeRepresentation);
|
|
145
|
+
call: (
|
|
146
|
+
inputs: { [key in keyof T]: T[key] extends NodeRepresentation ? Swizzable | Node : T[key] },
|
|
147
|
+
builder?: NodeBuilder,
|
|
148
|
+
) => Swizzable<R>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const cacheMaps: {
|
|
152
|
+
bool: Map<boolean, ConstNode>;
|
|
153
|
+
uint: Map<number, ConstNode>;
|
|
154
|
+
int: Map<number, ConstNode>;
|
|
155
|
+
float: Map<number, ConstNode>;
|
|
156
|
+
};
|