@types/three 0.143.0 → 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.
Files changed (206) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/controls/FirstPersonControls.d.ts +4 -1
  3. three/examples/jsm/csm/CSM.d.ts +1 -1
  4. three/examples/jsm/environments/RoomEnvironment.d.ts +1 -0
  5. three/examples/jsm/interactive/SelectionHelper.d.ts +1 -3
  6. three/examples/jsm/libs/stats.module.d.ts +1 -1
  7. three/examples/jsm/loaders/TIFFLoader.d.ts +16 -0
  8. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +17 -0
  9. three/examples/jsm/math/ColorConverter.d.ts +0 -2
  10. three/examples/jsm/misc/GPUComputationRenderer.d.ts +1 -0
  11. three/examples/jsm/misc/ProgressiveLightMap.d.ts +1 -2
  12. three/examples/jsm/misc/Volume.d.ts +1 -1
  13. three/examples/jsm/modifiers/CurveModifier.d.ts +6 -6
  14. three/examples/jsm/nodes/Nodes.d.ts +216 -0
  15. three/examples/jsm/nodes/accessors/BufferNode.d.ts +11 -0
  16. three/examples/jsm/nodes/accessors/CameraNode.d.ts +12 -0
  17. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +11 -0
  18. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +9 -0
  19. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +23 -0
  20. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +6 -0
  21. three/examples/jsm/nodes/accessors/ModelNode.d.ts +9 -0
  22. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +6 -0
  23. three/examples/jsm/nodes/accessors/NormalNode.d.ts +17 -0
  24. three/examples/jsm/nodes/accessors/Object3DNode.d.ts +22 -0
  25. three/examples/jsm/nodes/accessors/PointUVNode.d.ts +7 -0
  26. three/examples/jsm/nodes/accessors/PositionNode.d.ts +19 -0
  27. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +13 -0
  28. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +8 -0
  29. three/examples/jsm/nodes/accessors/SkinningNode.d.ts +13 -0
  30. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +6 -0
  31. three/examples/jsm/nodes/accessors/TextureNode.d.ts +12 -0
  32. three/examples/jsm/nodes/accessors/UVNode.d.ts +8 -0
  33. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +7 -0
  34. three/examples/jsm/nodes/core/ArrayUniformNode.d.ts +8 -0
  35. three/examples/jsm/nodes/core/AttributeNode.d.ts +9 -0
  36. three/examples/jsm/nodes/core/BypassNode.d.ts +9 -0
  37. three/examples/jsm/nodes/core/CodeNode.d.ts +16 -0
  38. three/examples/jsm/nodes/core/ConstNode.d.ts +10 -0
  39. three/examples/jsm/nodes/core/ContextNode.d.ts +10 -0
  40. three/examples/jsm/nodes/core/ExpressionNode.d.ts +7 -0
  41. three/examples/jsm/nodes/core/FunctionCallNode.d.ts +13 -0
  42. three/examples/jsm/nodes/core/FunctionNode.d.ts +17 -0
  43. three/examples/jsm/nodes/core/InputNode.d.ts +12 -0
  44. three/examples/jsm/nodes/core/InstanceIndexNode.d.ts +6 -0
  45. three/examples/jsm/nodes/core/Node.d.ts +31 -0
  46. three/examples/jsm/nodes/core/NodeAttribute.d.ts +6 -0
  47. three/examples/jsm/nodes/core/NodeBuilder.d.ts +134 -0
  48. three/examples/jsm/nodes/core/NodeCode.d.ts +4 -0
  49. three/examples/jsm/nodes/core/NodeFrame.d.ts +19 -0
  50. three/examples/jsm/nodes/core/NodeFunction.d.ts +13 -0
  51. three/examples/jsm/nodes/core/NodeFunctionInput.d.ts +7 -0
  52. three/examples/jsm/nodes/core/NodeKeywords.d.ts +14 -0
  53. three/examples/jsm/nodes/core/NodeParser.d.ts +5 -0
  54. three/examples/jsm/nodes/core/NodeUniform.d.ts +13 -0
  55. three/examples/jsm/nodes/core/NodeUtils.d.ts +7 -0
  56. three/examples/jsm/nodes/core/NodeVar.d.ts +6 -0
  57. three/examples/jsm/nodes/core/NodeVary.d.ts +6 -0
  58. three/examples/jsm/nodes/core/PropertyNode.d.ts +6 -0
  59. three/examples/jsm/nodes/core/TempNode.d.ts +8 -0
  60. three/examples/jsm/nodes/core/UniformNode.d.ts +10 -0
  61. three/examples/jsm/nodes/core/VarNode.d.ts +16 -0
  62. three/examples/jsm/nodes/core/VaryNode.d.ts +8 -0
  63. three/examples/jsm/nodes/core/constants.d.ts +77 -0
  64. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +20 -0
  65. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +15 -0
  66. three/examples/jsm/nodes/display/FrontFacingNode.d.ts +6 -0
  67. three/examples/jsm/nodes/display/NormalMapNode.d.ts +12 -0
  68. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +14 -0
  69. three/examples/jsm/nodes/fog/FogNode.d.ts +10 -0
  70. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +10 -0
  71. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +6 -0
  72. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +6 -0
  73. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +10 -0
  74. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +9 -0
  75. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +6 -0
  76. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +6 -0
  77. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +11 -0
  78. three/examples/jsm/nodes/functions/light/getDistanceAttenuation.d.ts +5 -0
  79. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +5 -0
  80. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +6 -0
  81. three/examples/jsm/nodes/geometry/RangeNode.d.ts +12 -0
  82. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +11 -0
  83. three/examples/jsm/nodes/lighting/AONode.d.ts +8 -0
  84. three/examples/jsm/nodes/lighting/AnalyticLightNode.d.ts +10 -0
  85. three/examples/jsm/nodes/lighting/EnvironmentNode.d.ts +8 -0
  86. three/examples/jsm/nodes/lighting/HemisphereLightNode.d.ts +13 -0
  87. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +15 -0
  88. three/examples/jsm/nodes/lighting/LightingNode.d.ts +5 -0
  89. three/examples/jsm/nodes/lighting/LightsNode.d.ts +19 -0
  90. three/examples/jsm/nodes/lighting/PunctualLightNode.d.ts +12 -0
  91. three/examples/jsm/nodes/loaders/NodeLoader.d.ts +21 -0
  92. three/examples/jsm/nodes/loaders/NodeMaterialLoader.d.ts +8 -0
  93. three/examples/jsm/nodes/loaders/NodeObjectLoader.d.ts +11 -0
  94. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +16 -0
  95. three/examples/jsm/nodes/materials/Materials.d.ts +17 -0
  96. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +19 -0
  97. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +22 -0
  98. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +27 -0
  99. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +22 -0
  100. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +15 -0
  101. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +23 -0
  102. three/examples/jsm/nodes/materialx/functions/lib/mx_hsv.d.ts +4 -0
  103. three/examples/jsm/nodes/materialx/functions/lib/mx_noise.d.ts +6 -0
  104. three/examples/jsm/nodes/math/CondNode.d.ts +9 -0
  105. three/examples/jsm/nodes/math/MathNode.d.ts +116 -0
  106. three/examples/jsm/nodes/math/OperatorNode.d.ts +31 -0
  107. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +6 -0
  108. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +157 -0
  109. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +285 -0
  110. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +128 -0
  111. three/examples/jsm/nodes/utils/ArrayElementNode.d.ts +9 -0
  112. three/examples/jsm/nodes/utils/ConvertNode.d.ts +8 -0
  113. three/examples/jsm/nodes/utils/JoinNode.d.ts +10 -0
  114. three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +5 -0
  115. three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +7 -0
  116. three/examples/jsm/nodes/utils/OscNode.d.ts +19 -0
  117. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +10 -0
  118. three/examples/jsm/nodes/utils/SplitNode.d.ts +16 -0
  119. three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +9 -0
  120. three/examples/jsm/nodes/utils/TimerNode.d.ts +14 -0
  121. three/examples/jsm/objects/ReflectorForSSRPass.d.ts +4 -4
  122. three/examples/jsm/postprocessing/SSRPass.d.ts +3 -3
  123. three/examples/jsm/renderers/webgl/nodes/SlotNode.d.ts +17 -0
  124. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +56 -0
  125. three/examples/jsm/renderers/webgl/nodes/WebGLNodes.d.ts +3 -0
  126. three/examples/jsm/shaders/AfterimageShader.d.ts +4 -4
  127. three/examples/jsm/shaders/BleachBypassShader.d.ts +3 -3
  128. three/examples/jsm/shaders/BlendShader.d.ts +5 -5
  129. three/examples/jsm/shaders/BokehShader.d.ts +9 -9
  130. three/examples/jsm/shaders/BokehShader2.d.ts +26 -26
  131. three/examples/jsm/shaders/BrightnessContrastShader.d.ts +4 -4
  132. three/examples/jsm/shaders/ColorCorrectionShader.d.ts +5 -5
  133. three/examples/jsm/shaders/ColorifyShader.d.ts +3 -3
  134. three/examples/jsm/shaders/ConvolutionShader.d.ts +4 -4
  135. three/examples/jsm/shaders/CopyShader.d.ts +3 -3
  136. three/examples/jsm/shaders/DOFMipMapShader.d.ts +5 -5
  137. three/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +9 -9
  138. three/examples/jsm/shaders/DigitalGlitch.d.ts +12 -12
  139. three/examples/jsm/shaders/DotScreenShader.d.ts +6 -6
  140. three/examples/jsm/shaders/FXAAShader.d.ts +3 -3
  141. three/examples/jsm/shaders/FilmShader.d.ts +7 -7
  142. three/examples/jsm/shaders/FocusShader.d.ts +6 -6
  143. three/examples/jsm/shaders/FreiChenShader.d.ts +3 -3
  144. three/examples/jsm/shaders/GammaCorrectionShader.d.ts +2 -2
  145. three/examples/jsm/shaders/GodRaysShader.d.ts +12 -12
  146. three/examples/jsm/shaders/HalftoneShader.d.ts +14 -14
  147. three/examples/jsm/shaders/HorizontalBlurShader.d.ts +3 -3
  148. three/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +4 -4
  149. three/examples/jsm/shaders/HueSaturationShader.d.ts +4 -4
  150. three/examples/jsm/shaders/KaleidoShader.d.ts +4 -4
  151. three/examples/jsm/shaders/LuminosityHighPassShader.d.ts +6 -6
  152. three/examples/jsm/shaders/LuminosityShader.d.ts +2 -2
  153. three/examples/jsm/shaders/MirrorShader.d.ts +3 -3
  154. three/examples/jsm/shaders/NormalMapShader.d.ts +5 -5
  155. three/examples/jsm/shaders/PixelShader.d.ts +4 -4
  156. three/examples/jsm/shaders/RGBShiftShader.d.ts +4 -4
  157. three/examples/jsm/shaders/SAOShader.d.ts +15 -15
  158. three/examples/jsm/shaders/SMAAShader.d.ts +10 -10
  159. three/examples/jsm/shaders/SSAOShader.d.ts +19 -19
  160. three/examples/jsm/shaders/SepiaShader.d.ts +3 -3
  161. three/examples/jsm/shaders/SobelOperatorShader.d.ts +3 -3
  162. three/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts +30 -30
  163. three/examples/jsm/shaders/TechnicolorShader.d.ts +2 -2
  164. three/examples/jsm/shaders/ToneMapShader.d.ts +7 -7
  165. three/examples/jsm/shaders/ToonShader.d.ts +26 -26
  166. three/examples/jsm/shaders/TriangleBlurShader.d.ts +3 -3
  167. three/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +3 -3
  168. three/examples/jsm/shaders/VerticalBlurShader.d.ts +3 -3
  169. three/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +4 -4
  170. three/examples/jsm/shaders/VignetteShader.d.ts +4 -4
  171. three/examples/jsm/shaders/VolumeShader.d.ts +7 -7
  172. three/examples/jsm/shaders/WaterRefractionShader.d.ts +6 -6
  173. three/examples/jsm/utils/CameraUtils.d.ts +1 -1
  174. three/index.d.ts +2 -2
  175. three/package.json +3 -3
  176. three/src/Three.d.ts +1 -1
  177. three/src/constants.d.ts +0 -5
  178. three/src/core/BufferAttribute.d.ts +0 -4
  179. three/src/core/BufferGeometry.d.ts +0 -1
  180. three/src/core/Object3D.d.ts +2 -1
  181. three/src/extras/core/ShapePath.d.ts +1 -1
  182. three/src/geometries/BoxGeometry.d.ts +0 -2
  183. three/src/geometries/CapsuleGeometry.d.ts +0 -2
  184. three/src/geometries/CircleGeometry.d.ts +0 -2
  185. three/src/geometries/ConeGeometry.d.ts +0 -2
  186. three/src/geometries/CylinderGeometry.d.ts +0 -2
  187. three/src/geometries/DodecahedronGeometry.d.ts +0 -2
  188. three/src/geometries/ExtrudeGeometry.d.ts +0 -2
  189. three/src/geometries/IcosahedronGeometry.d.ts +0 -2
  190. three/src/geometries/LatheGeometry.d.ts +0 -2
  191. three/src/geometries/OctahedronGeometry.d.ts +0 -2
  192. three/src/geometries/PlaneGeometry.d.ts +0 -2
  193. three/src/geometries/PolyhedronGeometry.d.ts +0 -2
  194. three/src/geometries/RingGeometry.d.ts +0 -2
  195. three/src/geometries/ShapeGeometry.d.ts +0 -2
  196. three/src/geometries/SphereGeometry.d.ts +0 -2
  197. three/src/geometries/TetrahedronGeometry.d.ts +0 -2
  198. three/src/geometries/TorusGeometry.d.ts +0 -2
  199. three/src/geometries/TorusKnotGeometry.d.ts +0 -2
  200. three/src/geometries/TubeGeometry.d.ts +0 -2
  201. three/src/materials/LineBasicMaterial.d.ts +7 -0
  202. three/src/materials/MeshLambertMaterial.d.ts +52 -1
  203. three/src/materials/MeshPhysicalMaterial.d.ts +5 -0
  204. three/src/materials/ShaderMaterial.d.ts +1 -1
  205. three/src/math/Quaternion.d.ts +0 -5
  206. three/src/renderers/shaders/UniformsUtils.d.ts +0 -1
@@ -0,0 +1,157 @@
1
+ import { ConstNode, Node, NodeBuilder, NodeTypeOption, SwizzleOption } from '../Nodes';
2
+ // lot of private typescript magic here
3
+ export {};
4
+ export type Swizzable<T extends Node = Node> = T &
5
+ {
6
+ [key in SwizzleOption | number]: Swizzable;
7
+ };
8
+
9
+ /** anything that can be passed to {@link nodeObject} and returns a proxy */
10
+ export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | Swizzable<T>;
11
+
12
+ /** anything that can be passed to {@link nodeObject} */
13
+ export type NodeObjectOption = NodeRepresentation | string;
14
+
15
+ // same logic as in ShaderNodeObject: number,boolean,node->swizzable, otherwise do nothing
16
+ export type NodeObject<T> = T extends Node ? Swizzable<T> : T extends number | boolean ? Swizzable<ConstNode> : T;
17
+
18
+ // opposite of NodeObject: node -> node|swizzable|boolean|number, otherwise do nothing
19
+ type Proxied<T> = T extends Node ? NodeRepresentation<T> : T;
20
+ // https://github.com/microsoft/TypeScript/issues/42435#issuecomment-765557874
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]> };
23
+ type RemoveTail<T extends readonly [...unknown[]]> = T extends [unknown, ...infer X] ? X : [];
24
+ type RemoveHeadAndTail<T extends readonly [...unknown[]]> = T extends [unknown, ...infer X, unknown] ? X : [];
25
+
26
+ /**
27
+ * Temporary type to save signatures of 4 constructors. Each element may be tuple or undefined.
28
+ *
29
+ * We use an object instead of tuple or union as it makes stuff easier, especially in Typescript 4.0.
30
+ */
31
+ interface Construtors<
32
+ A extends undefined | [...unknown[]],
33
+ B extends undefined | [...unknown[]],
34
+ C extends undefined | [...unknown[]],
35
+ D extends undefined | [...unknown[]],
36
+ > {
37
+ a: A;
38
+ b: B;
39
+ c: C;
40
+ d: D;
41
+ }
42
+
43
+ /**
44
+ * Returns all constructors
45
+ *
46
+ * <https://github.com/microsoft/TypeScript/issues/37079>
47
+ * <https://stackoverflow.com/a/52761156/1623826>
48
+ */
49
+ type OverloadedConstructorsOf<T> = T extends {
50
+ new (...args: infer A1): unknown;
51
+ new (...args: infer A2): unknown;
52
+ new (...args: infer A3): unknown;
53
+ new (...args: infer A4): unknown;
54
+ }
55
+ ? Construtors<A1, A2, A3, A4>
56
+ : T extends {
57
+ new (...args: infer A1): unknown;
58
+ new (...args: infer A2): unknown;
59
+ new (...args: infer A3): unknown;
60
+ }
61
+ ? Construtors<A1, A2, A3, undefined>
62
+ : T extends {
63
+ new (...args: infer A1): unknown;
64
+ new (...args: infer A2): unknown;
65
+ }
66
+ ? Construtors<A1, A2, undefined, undefined>
67
+ : T extends new (...args: infer A) => unknown
68
+ ? Construtors<A, undefined, undefined, undefined>
69
+ : Construtors<undefined, undefined, undefined, undefined>;
70
+
71
+ type AnyConstructors = Construtors<any, any, any, any>;
72
+
73
+ /**
74
+ * Returns all constructors where the first paramter is assignable to given "scope"
75
+ */
76
+ // tslint:disable-next-line:interface-over-type-literal
77
+ type FilterConstructorsByScope<T extends AnyConstructors, S> = {
78
+ a: S extends T['a'][0] ? T['a'] : undefined;
79
+ b: S extends T['b'][0] ? T['b'] : undefined;
80
+ c: S extends T['c'][0] ? T['c'] : undefined;
81
+ d: S extends T['d'][0] ? T['d'] : undefined;
82
+ };
83
+ /**
84
+ * "flattens" the tuple into an union type
85
+ */
86
+ type ConstructorUnion<T extends AnyConstructors> =
87
+ | Exclude<T['a'], undefined>
88
+ | Exclude<T['b'], undefined>
89
+ | Exclude<T['c'], undefined>
90
+ | Exclude<T['d'], undefined>;
91
+
92
+ /**
93
+ * Extract list of possible scopes - union of the first paramter
94
+ * of all constructors, should it be string
95
+ */
96
+ type ExtractScopes<T extends AnyConstructors> =
97
+ | (T['a'][0] extends string ? T['a'][0] : never)
98
+ | (T['b'][0] extends string ? T['b'][0] : never)
99
+ | (T['c'][0] extends string ? T['c'][0] : never)
100
+ | (T['d'][0] extends string ? T['d'][0] : never);
101
+
102
+ type GetConstructorsByScope<T, S> = ConstructorUnion<FilterConstructorsByScope<OverloadedConstructorsOf<T>, S>>;
103
+ type GetConstructors<T> = ConstructorUnion<OverloadedConstructorsOf<T>>;
104
+ type GetPossibleScopes<T> = ExtractScopes<OverloadedConstructorsOf<T>>;
105
+
106
+ export type ConvertType = (...params: unknown[]) => Swizzable;
107
+
108
+ export const ConvertType: {
109
+ new (type: NodeTypeOption, cacheMap?: Map<unknown, ConstNode>): ConvertType;
110
+ };
111
+
112
+ type NodeArray<T extends NodeObjectOption[]> = { [index in keyof T]: NodeObject<T[index]> };
113
+ type NodeObjects<T> = { [key in keyof T]: T[key] extends NodeObjectOption ? NodeObject<T[key]> : T[key] };
114
+ type ConstructedNode<T> = T extends new (...args: any[]) => infer R ? (R extends Node ? R : never) : never;
115
+
116
+ export type NodeOrType = Node | NodeTypeOption;
117
+
118
+ export function getConstNodeType(value: NodeOrType): NodeTypeOption | null;
119
+ export function nodeObject<T extends NodeObjectOption>(obj: T): NodeObject<T>;
120
+ export function nodeObjects<T>(obj: T): NodeObjects<T>;
121
+
122
+ export function nodeArray<T extends NodeObjectOption[]>(obj: readonly [...T]): NodeArray<T>;
123
+
124
+ export function nodeProxy<T>(
125
+ nodeClass: T,
126
+ ): (...params: ProxiedTuple<GetConstructors<T>>) => Swizzable<ConstructedNode<T>>;
127
+
128
+ export function nodeProxy<T, S extends GetPossibleScopes<T>>(
129
+ nodeClass: T,
130
+ scope: S,
131
+ ): (...params: ProxiedTuple<RemoveTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
132
+
133
+ export function nodeProxy<T, S extends GetPossibleScopes<T>>(
134
+ nodeClass: T,
135
+ scope: S,
136
+ factor: NodeObjectOption,
137
+ ): (...params: ProxiedTuple<RemoveHeadAndTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
138
+
139
+ export function nodeImmutable<T>(
140
+ nodeClass: T,
141
+ ...params: ProxiedTuple<GetConstructors<T>>
142
+ ): Swizzable<ConstructedNode<T>>;
143
+
144
+ export class ShaderNode<T = {}, R extends Node = Node> {
145
+ constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => NodeRepresentation);
146
+ call: (
147
+ inputs: { [key in keyof T]: T[key] extends NodeRepresentation ? Swizzable | Node : T[key] },
148
+ builder?: NodeBuilder,
149
+ ) => Swizzable<R>;
150
+ }
151
+
152
+ export const cacheMaps: {
153
+ bool: Map<boolean, ConstNode>;
154
+ uint: Map<number, ConstNode>;
155
+ int: Map<number, ConstNode>;
156
+ float: Map<number, ConstNode>;
157
+ };
@@ -0,0 +1,285 @@
1
+ import TextureNode from '../accessors/TextureNode';
2
+ import Node from '../core/Node';
3
+
4
+ // shader node utils
5
+ import {
6
+ ShaderNode,
7
+ nodeObject,
8
+ nodeObjects,
9
+ nodeArray,
10
+ nodeProxy,
11
+ nodeImmutable,
12
+ ConvertType,
13
+ Swizzable,
14
+ NodeRepresentation,
15
+ NodeOrType,
16
+ ProxiedObject,
17
+ ProxiedTuple,
18
+ } from './ShaderNode';
19
+ import { Material, Texture } from '../../../../src/Three';
20
+ import { NodeTypeOption, NodeUserData, NodeValueOption } from '../core/constants';
21
+ import { NodeBuilderContext } from '../core/NodeBuilder';
22
+ import {
23
+ BufferNode,
24
+ BypassNode,
25
+ CameraNode,
26
+ CodeNode,
27
+ CodeNodeInclude,
28
+ ComputeNode,
29
+ ContextNode,
30
+ ExpressionNode,
31
+ FrontFacingNode,
32
+ FunctionCallNode,
33
+ FunctionNode,
34
+ FunctionNodeArguments,
35
+ InstanceIndexNode,
36
+ MaterialNode,
37
+ MaterialReferenceNode,
38
+ MathNode,
39
+ ModelNode,
40
+ ModelViewProjectionNode,
41
+ NormalNode,
42
+ PointUVNode,
43
+ PositionNode,
44
+ PropertyNode,
45
+ ReferenceNode,
46
+ UserDataNode,
47
+ UVNode,
48
+ VarNode,
49
+ VaryNode,
50
+ } from '../Nodes';
51
+ import StorageBufferNode from '../accessors/StorageBufferNode';
52
+
53
+ // shader node base
54
+
55
+ export { ShaderNode, nodeObject, nodeObjects, nodeArray, nodeProxy, nodeImmutable, Swizzable };
56
+
57
+ export const color: ConvertType;
58
+
59
+ export const float: ConvertType;
60
+ export const int: ConvertType;
61
+ export const uint: ConvertType;
62
+ export const bool: ConvertType;
63
+
64
+ export const vec2: ConvertType;
65
+ export const ivec2: ConvertType;
66
+ export const uvec2: ConvertType;
67
+ export const bvec2: ConvertType;
68
+
69
+ export const vec3: ConvertType;
70
+ export const ivec3: ConvertType;
71
+ export const uvec3: ConvertType;
72
+ export const bvec3: ConvertType;
73
+
74
+ export const vec4: ConvertType;
75
+ export const ivec4: ConvertType;
76
+ export const uvec4: ConvertType;
77
+ export const bvec4: ConvertType;
78
+
79
+ export const mat3: ConvertType;
80
+ export const imat3: ConvertType;
81
+ export const umat3: ConvertType;
82
+ export const bmat3: ConvertType;
83
+
84
+ export const mat4: ConvertType;
85
+ export const imat4: ConvertType;
86
+ export const umat4: ConvertType;
87
+ export const bmat4: ConvertType;
88
+
89
+ export function uniform(nodeOrType: Node | Swizzable | NodeValueOption): Swizzable;
90
+
91
+ export function attribute(attributeName: string, nodeType: NodeTypeOption): Swizzable;
92
+ export function property(name: string, nodeOrType: Node | NodeTypeOption): Swizzable;
93
+
94
+ export function bypass(returnNode: NodeRepresentation, callNode: NodeRepresentation): Swizzable<BypassNode>;
95
+ export function code(code: string, nodeType?: NodeTypeOption): Swizzable<CodeNode>;
96
+ export function context(node: NodeRepresentation, context: NodeBuilderContext): Swizzable<ContextNode>;
97
+ export function expression(snipped?: string, nodeType?: NodeTypeOption): Swizzable<ExpressionNode>;
98
+
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
120
+
121
+ export const instanceIndex: Swizzable<InstanceIndexNode>;
122
+ export function label(node: NodeRepresentation, name?: string): Swizzable<VarNode>;
123
+ export function temp(node: NodeRepresentation, name?: string): Swizzable<VarNode>;
124
+ export function vary(node: NodeRepresentation, name?: string): Swizzable<VaryNode>;
125
+
126
+ // accesors
127
+
128
+ export function buffer(value: ArrayLike<number>, nodeOrType: NodeOrType, count: number): Swizzable<BufferNode>;
129
+ export function storage(value: ArrayLike<number>, nodeOrType: NodeOrType, count: number): Swizzable<StorageBufferNode>;
130
+
131
+ export const cameraProjectionMatrix: Swizzable<CameraNode>;
132
+ export const cameraViewMatrix: Swizzable<CameraNode>;
133
+ export const cameraNormalMatrix: Swizzable<CameraNode>;
134
+ export const cameraWorldMatrix: Swizzable<CameraNode>;
135
+ export const cameraPosition: Swizzable<CameraNode>;
136
+
137
+ export const materialAlphaTest: Swizzable<MaterialNode>;
138
+ export const materialColor: Swizzable<MaterialNode>;
139
+ export const materialEmissive: Swizzable<MaterialNode>;
140
+ export const materialOpacity: Swizzable<MaterialNode>;
141
+ export const materialRoughness: Swizzable<MaterialNode>;
142
+ export const materialMetalness: Swizzable<MaterialNode>;
143
+ export const materialRotation: Swizzable<MaterialNode>;
144
+
145
+ export const diffuseColor: Swizzable<PropertyNode>;
146
+ export const roughness: Swizzable<PropertyNode>;
147
+ export const metalness: Swizzable<PropertyNode>;
148
+ export const alphaTest: Swizzable<PropertyNode>;
149
+ export const specularColor: Swizzable<PropertyNode>;
150
+
151
+ export function reference<T>(name: string, nodeOrType: NodeOrType, object: T): Swizzable<ReferenceNode<T>>;
152
+ export function materialReference(
153
+ name: string,
154
+ nodeOrType: NodeOrType,
155
+ material: Material,
156
+ ): Swizzable<MaterialReferenceNode>;
157
+ export function userData(name: string, inputType: NodeTypeOption, userData?: NodeUserData): Swizzable<UserDataNode>;
158
+
159
+ export function modelViewProjection(position?: NodeRepresentation): Swizzable<ModelViewProjectionNode>;
160
+
161
+ export const normalGeometry: Swizzable<NormalNode>;
162
+ export const normalLocal: Swizzable<NormalNode>;
163
+ export const normalWorld: Swizzable<NormalNode>;
164
+ export const normalView: Swizzable<NormalNode>;
165
+ export const transformedNormalView: Swizzable<VarNode>;
166
+
167
+ export const modelViewMatrix: Swizzable<ModelNode>;
168
+ export const modelNormalMatrix: Swizzable<ModelNode>;
169
+ export const modelWorldMatrix: Swizzable<ModelNode>;
170
+ export const modelPosition: Swizzable<ModelNode>;
171
+ export const modelViewPosition: Swizzable<ModelNode>;
172
+
173
+ export const positionGeometry: Swizzable<PositionNode>;
174
+ export const positionLocal: Swizzable<PositionNode>;
175
+ export const positionWorld: Swizzable<PositionNode>;
176
+ export const positionView: Swizzable<PositionNode>;
177
+ export const positionViewDirection: Swizzable<PositionNode>;
178
+
179
+ export function texture(
180
+ value: Texture,
181
+ uvNode?: NodeRepresentation,
182
+ levelNode?: NodeRepresentation,
183
+ ): Swizzable<TextureNode>;
184
+ export function sampler(texture: Texture | TextureNode): Swizzable;
185
+ export function uv(index?: number): Swizzable<UVNode>;
186
+ export const pointUV: Swizzable<PointUVNode>;
187
+
188
+ // gpgpu
189
+
190
+ export function compute(node: NodeRepresentation, count: number, workgroupSize: number[]): Swizzable<ComputeNode>;
191
+
192
+ // math
193
+
194
+ export const EPSILON: Swizzable;
195
+ export const INFINITY: Swizzable;
196
+
197
+ export function cond(condNode: NodeRepresentation, ifNode: NodeRepresentation, elseNode: NodeRepresentation): Swizzable;
198
+
199
+ type Operator = (a: NodeRepresentation, b: NodeRepresentation, ...others: NodeRepresentation[]) => Swizzable;
200
+ type Unary = (a: NodeRepresentation) => Swizzable<MathNode>;
201
+ type Binary = (a: NodeRepresentation, b: NodeRepresentation) => Swizzable<MathNode>;
202
+ type Ternary = (a: NodeRepresentation, b: NodeRepresentation, c: NodeRepresentation) => Swizzable<MathNode>;
203
+
204
+ export const add: Operator;
205
+ export const sub: Operator;
206
+ export const mul: Operator;
207
+ export const div: Operator;
208
+ export const remainder: Operator;
209
+ export const equal: Operator;
210
+ export const assign: Operator;
211
+ export const lessThan: Operator;
212
+ export const greaterThan: Operator;
213
+ export const lessThanEqual: Operator;
214
+ export const greaterThanEqual: Operator;
215
+ export const and: Operator;
216
+ export const or: Operator;
217
+ export const xor: Operator;
218
+ export const bitAnd: Operator;
219
+ export const bitOr: Operator;
220
+ export const bitXor: Operator;
221
+ export const shiftLeft: Operator;
222
+ export const shiftRight: Operator;
223
+
224
+ export const radians: Unary;
225
+ export const degrees: Unary;
226
+ export const exp: Unary;
227
+ export const exp2: Unary;
228
+ export const log: Unary;
229
+ export const log2: Unary;
230
+ export const sqrt: Unary;
231
+ export const inversesqrt: Unary;
232
+ export const floor: Unary;
233
+ export const ceil: Unary;
234
+ export const normalize: Unary;
235
+ export const fract: Unary;
236
+ export const sin: Unary;
237
+ export const cos: Unary;
238
+ export const tan: Unary;
239
+ export const asin: Unary;
240
+ export const acos: Unary;
241
+ export const atan: Unary;
242
+ export const abs: Unary;
243
+ export const sign: Unary;
244
+ export const length: Unary;
245
+ export const negate: Unary;
246
+ export const invert: Unary;
247
+ export const dFdx: Unary;
248
+ export const dFdy: Unary;
249
+ export const saturate: Unary;
250
+ export const round: Unary;
251
+
252
+ export const atan2: Binary;
253
+ export const min: Binary;
254
+ export const max: Binary;
255
+ export const mod: Binary;
256
+ export const step: Binary;
257
+ export const reflect: Binary;
258
+ export const distance: Binary;
259
+ export const dot: Binary;
260
+ export const cross: Binary;
261
+ export const pow: Binary;
262
+ export const pow2: Binary;
263
+ export const pow3: Binary;
264
+ export const pow4: Binary;
265
+ export const transformDirection: Binary;
266
+
267
+ export const mix: Ternary;
268
+ export const clamp: Ternary;
269
+ export const refract: Ternary;
270
+ export const smoothstep: Ternary;
271
+ export const faceforward: Ternary;
272
+
273
+ // display
274
+
275
+ export const frontFacing: Swizzable<FrontFacingNode>;
276
+ export const faceDirection: Swizzable;
277
+
278
+ // lighting
279
+
280
+ // utils
281
+ export function element(node: NodeRepresentation, indexNode: NodeRepresentation): Swizzable;
282
+
283
+ // miscellaneous
284
+ export const dotNV: Swizzable<MathNode>;
285
+ export const transformedNormalWorld: Swizzable<MathNode>;
@@ -0,0 +1,128 @@
1
+ import Node from '../core/Node';
2
+ import RangeNode, { RangeModeBound } from '../geometry/RangeNode';
3
+ import { NodeRepresentation, Swizzable } from './ShaderNode';
4
+ import {
5
+ CubeTexture,
6
+ InstancedMesh,
7
+ Light,
8
+ SkinnedMesh,
9
+ Texture,
10
+ TextureEncoding,
11
+ ToneMapping,
12
+ } from '../../../../src/Three';
13
+ import LightingContextNode, { LightingModelNode } from '../lighting/LightingContextNode';
14
+ import {
15
+ CheckerNode,
16
+ ColorAdjustmentNode,
17
+ ColorSpaceNode,
18
+ CubeTextureNode,
19
+ FogNode,
20
+ FogRangeNode,
21
+ InstanceNode,
22
+ LightsNode,
23
+ MatcapUVNode,
24
+ MaxMipLevelNode,
25
+ NormalMapNode,
26
+ OscNode,
27
+ ReflectVectorNode,
28
+ RotateUVNode,
29
+ SkinningNode,
30
+ SpriteSheetUVNode,
31
+ TimerNode,
32
+ ToneMappingNode,
33
+ } from '../Nodes';
34
+
35
+ //
36
+ // Node Material Shader Syntax
37
+ //
38
+
39
+ // shader node base
40
+
41
+ export * from './ShaderNodeBaseElements';
42
+
43
+ // functions
44
+
45
+ export { default as BRDF_GGX } from '../functions/BSDF/BRDF_GGX'; // see https://github.com/tc39/proposal-export-default-from
46
+ export { default as BRDF_Lambert } from '../functions/BSDF/BRDF_Lambert';
47
+ export { default as D_GGX } from '../functions/BSDF/D_GGX';
48
+ export { default as DFGApprox } from '../functions/BSDF/DFGApprox';
49
+ export { default as F_Schlick } from '../functions/BSDF/F_Schlick';
50
+ export { default as V_GGX_SmithCorrelated } from '../functions/BSDF/V_GGX_SmithCorrelated';
51
+
52
+ export { default as getDistanceAttenuation } from '../functions/light/getDistanceAttenuation';
53
+
54
+ export { default as getGeometryRoughness } from '../functions/material/getGeometryRoughness';
55
+ export { default as getRoughness } from '../functions/material/getRoughness';
56
+
57
+ export { default as PhysicalLightingModel } from '../functions/PhysicalLightingModel';
58
+
59
+ // accessors
60
+
61
+ export function cubeTexture(
62
+ value: CubeTexture,
63
+ uvNode?: NodeRepresentation,
64
+ levelNode?: NodeRepresentation,
65
+ ): Swizzable<CubeTextureNode>;
66
+ export function instance(instanceMesh: InstancedMesh): Swizzable<InstanceNode>;
67
+ export const reflectVector: Swizzable<ReflectVectorNode>;
68
+ export function skinning(skinnedMesh: SkinnedMesh): Swizzable<SkinningNode>;
69
+
70
+ // display
71
+
72
+ export function saturation(
73
+ colorNode: NodeRepresentation,
74
+ adjustmentNode?: NodeRepresentation,
75
+ ): Swizzable<ColorAdjustmentNode>;
76
+ export function vibrance(
77
+ colorNode: NodeRepresentation,
78
+ adjustmentNode?: NodeRepresentation,
79
+ ): Swizzable<ColorAdjustmentNode>;
80
+ export function hue(colorNode: NodeRepresentation, adjustmentNode?: NodeRepresentation): Swizzable<ColorAdjustmentNode>;
81
+
82
+ export function colorSpace(node: NodeRepresentation, encoding: TextureEncoding): Swizzable<ColorSpaceNode>;
83
+ export function normalMap(node: Node, scaleNode?: Node): Swizzable<NormalMapNode>;
84
+ export function toneMapping(
85
+ mapping: ToneMapping,
86
+ exposure: NodeRepresentation,
87
+ color: NodeRepresentation,
88
+ ): Swizzable<ToneMappingNode>;
89
+
90
+ // lighting
91
+
92
+ export function lights(lights: Light[]): Swizzable<LightsNode>;
93
+ export function lightingContext(node: Node, lightingModelNode?: LightingModelNode): Swizzable<LightingContextNode>;
94
+
95
+ // utils
96
+
97
+ export const matcapUV: Swizzable<MatcapUVNode>;
98
+ export function maxMipLevel(texture: Texture): Swizzable<MaxMipLevelNode>;
99
+
100
+ export function oscSine(timeNode?: NodeRepresentation): Swizzable<OscNode>;
101
+ export function oscSquare(timeNode?: NodeRepresentation): Swizzable<OscNode>;
102
+ export function oscTriangle(timeNode?: NodeRepresentation): Swizzable<OscNode>;
103
+ export function oscSawtooth(timeNode?: NodeRepresentation): Swizzable<OscNode>;
104
+
105
+ export function rotateUV(uvNode: Node, rotationNode: Node, centerNode?: Node): Swizzable<RotateUVNode>;
106
+
107
+ export function spritesheetUV(
108
+ countNode: NodeRepresentation,
109
+ uvNode?: NodeRepresentation,
110
+ frameNode?: NodeRepresentation,
111
+ ): Swizzable<SpriteSheetUVNode>;
112
+
113
+ export function timerLocal(timeScale: number, value?: number): Swizzable<TimerNode>;
114
+ export function timerGlobal(timeScale: number, value?: number): Swizzable<TimerNode>;
115
+ export function timerDelta(timeScale: number, value?: number): Swizzable<TimerNode>;
116
+
117
+ // geometry
118
+
119
+ export function range(min: RangeModeBound, max: RangeModeBound): Swizzable<RangeNode>;
120
+
121
+ // procedural
122
+
123
+ export function checker(uvNode?: NodeRepresentation): Swizzable<CheckerNode>;
124
+
125
+ // fog
126
+
127
+ export function fog(colorNode: NodeRepresentation, factorNode: NodeRepresentation): Swizzable<FogNode>;
128
+ export function rangeFog(colorNode: Node, nearNode: Node, farNode: Node): Swizzable<FogRangeNode>;
@@ -0,0 +1,9 @@
1
+ import Node from '../core/Node';
2
+ import { TempNode } from '../Nodes';
3
+
4
+ export default class ArrayElementNode extends TempNode {
5
+ node: Node;
6
+ indexNode: Node;
7
+
8
+ constructor(node: Node, indexNode: Node);
9
+ }
@@ -0,0 +1,8 @@
1
+ import Node from '../core/Node';
2
+ import { NodeTypeOption } from '../Nodes';
3
+
4
+ export default class ConvertNode extends Node {
5
+ node: Node;
6
+ convertTo: NodeTypeOption;
7
+ constructor(node: Node, convertTo: NodeTypeOption);
8
+ }
@@ -0,0 +1,10 @@
1
+ import Node from '../core/Node';
2
+ import { TempNode } from '../Nodes';
3
+
4
+ /**
5
+ * This node constructs given type from elements, like vec3(a,b,c)
6
+ */
7
+ export default class JoinNode extends TempNode {
8
+ nodes: Node[];
9
+ constructor(nodes: Node[]);
10
+ }
@@ -0,0 +1,5 @@
1
+ import TempNode from '../core/TempNode';
2
+
3
+ export default class MatcapUVNode extends TempNode {
4
+ constructor();
5
+ }
@@ -0,0 +1,7 @@
1
+ import UniformNode from '../core/UniformNode';
2
+ import { Texture } from '../../../../src/Three';
3
+
4
+ export default class MaxMipLevelNode extends UniformNode {
5
+ texture: Texture;
6
+ constructor(texture: Texture);
7
+ }
@@ -0,0 +1,19 @@
1
+ import Node from '../core/Node';
2
+
3
+ export type OscNodeMethod =
4
+ | typeof OscNode.SINE
5
+ | typeof OscNode.SQUARE
6
+ | typeof OscNode.TRIANGLE
7
+ | typeof OscNode.SAWTOOTH;
8
+
9
+ export default class OscNode extends Node {
10
+ static SINE: 'sine';
11
+ static SQUARE: 'square';
12
+ static TRIANGLE: 'triangle';
13
+ static SAWTOOTH: 'sawtooth';
14
+
15
+ method: OscNodeMethod;
16
+ timeNode: Node;
17
+
18
+ constructor(method: OscNodeMethod, timeNode?: Node);
19
+ }
@@ -0,0 +1,10 @@
1
+ import TempNode from '../core/TempNode';
2
+ import Node from '../core/Node';
3
+
4
+ export default class RotateUVNode extends TempNode {
5
+ uvNode: Node;
6
+ rotationNode: Node;
7
+ centerNode: Node;
8
+
9
+ constructor(uvNode: Node, rotationNode: Node, centerNode?: Node);
10
+ }
@@ -0,0 +1,16 @@
1
+ import { SwizzleOption } from '../core/constants';
2
+ import Node from '../core/Node';
3
+
4
+ /** swizzle node */
5
+ export default class SplitNode extends Node {
6
+ node: Node;
7
+ components: string;
8
+
9
+ /**
10
+ *
11
+ * @param node the input node
12
+ * @param components swizzle like string, default = "x"
13
+ */
14
+ constructor(node: Node, components?: SwizzleOption);
15
+ getVectorLength(): number;
16
+ }
@@ -0,0 +1,9 @@
1
+ import Node from '../core/Node';
2
+
3
+ export default class SpriteSheetUVNode extends Node {
4
+ countNode: Node;
5
+ uvNode: Node;
6
+ frameNode: Node;
7
+
8
+ constructor(countNode: Node, uvNode?: Node, frameNode?: Node);
9
+ }
@@ -0,0 +1,14 @@
1
+ import UniformNode from '../core/UniformNode';
2
+
3
+ export type TimerNodeScope = typeof TimerNode.LOCAL | typeof TimerNode.GLOBAL | typeof TimerNode.DELTA;
4
+
5
+ export default class TimerNode extends UniformNode {
6
+ static LOCAL: 'local';
7
+ static GLOBAL: 'global';
8
+ static DELTA: 'delta';
9
+
10
+ scope: TimerNodeScope;
11
+ scale: number;
12
+
13
+ constructor(scope?: TimerNodeScope, scale?: number, value?: number);
14
+ }