@types/three 0.158.3 → 0.160.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 (230) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +2 -1
  3. three/examples/jsm/cameras/CinematicCamera.d.ts +1 -1
  4. three/examples/jsm/helpers/TextureHelper.d.ts +10 -0
  5. three/examples/jsm/lines/LineMaterial.d.ts +2 -2
  6. three/examples/jsm/loaders/ColladaLoader.d.ts +1 -3
  7. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -1
  8. three/examples/jsm/loaders/KTX2Loader.d.ts +2 -8
  9. three/examples/jsm/loaders/MaterialXLoader.d.ts +6 -0
  10. three/examples/jsm/loaders/SVGLoader.d.ts +1 -5
  11. three/examples/jsm/math/Octree.d.ts +7 -3
  12. three/examples/jsm/misc/ProgressiveLightMap.d.ts +1 -1
  13. three/examples/jsm/misc/Timer.d.ts +80 -0
  14. three/examples/jsm/nodes/Nodes.d.ts +238 -60
  15. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +9 -0
  16. three/examples/jsm/nodes/accessors/BufferNode.d.ts +4 -1
  17. three/examples/jsm/nodes/accessors/CameraNode.d.ts +7 -0
  18. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +9 -2
  19. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +3 -0
  20. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +12 -0
  21. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +7 -0
  22. three/examples/jsm/nodes/accessors/ModelNode.d.ts +7 -1
  23. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
  24. three/examples/jsm/nodes/accessors/NormalNode.d.ts +8 -0
  25. three/examples/jsm/nodes/accessors/PointUVNode.d.ts +3 -0
  26. three/examples/jsm/nodes/accessors/PositionNode.d.ts +8 -0
  27. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +4 -1
  28. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -0
  29. three/examples/jsm/nodes/accessors/SkinningNode.d.ts +3 -0
  30. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +8 -1
  31. three/examples/jsm/nodes/accessors/TangentNode.d.ts +9 -0
  32. three/examples/jsm/nodes/accessors/TextureNode.d.ts +10 -2
  33. three/examples/jsm/nodes/accessors/UVNode.d.ts +3 -0
  34. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +7 -0
  35. three/examples/jsm/nodes/code/CodeNode.d.ts +4 -0
  36. three/examples/jsm/nodes/code/ExpressionNode.d.ts +3 -0
  37. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +7 -1
  38. three/examples/jsm/nodes/code/FunctionNode.d.ts +17 -0
  39. three/examples/jsm/nodes/core/ArrayUniformNode.d.ts +1 -1
  40. three/examples/jsm/nodes/core/AttributeNode.d.ts +3 -0
  41. three/examples/jsm/nodes/core/BypassNode.d.ts +3 -0
  42. three/examples/jsm/nodes/core/CacheNode.d.ts +3 -0
  43. three/examples/jsm/nodes/core/ConstNode.d.ts +3 -3
  44. three/examples/jsm/nodes/core/ContextNode.d.ts +3 -0
  45. three/examples/jsm/nodes/core/InputNode.d.ts +4 -4
  46. three/examples/jsm/nodes/core/NodeBuilder.d.ts +6 -3
  47. three/examples/jsm/nodes/core/NodeUniform.d.ts +12 -8
  48. three/examples/jsm/nodes/core/NodeUtils.d.ts +6 -3
  49. three/examples/jsm/nodes/core/PropertyNode.d.ts +9 -0
  50. three/examples/jsm/nodes/core/UniformNode.d.ts +12 -4
  51. three/examples/jsm/nodes/core/VarNode.d.ts +4 -0
  52. three/examples/jsm/nodes/core/VaryingNode.d.ts +3 -0
  53. three/examples/jsm/nodes/core/constants.d.ts +10 -8
  54. three/examples/jsm/nodes/display/BlendModeNode.d.ts +7 -2
  55. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +18 -1
  56. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +4 -0
  57. three/examples/jsm/nodes/display/FrontFacingNode.d.ts +4 -0
  58. three/examples/jsm/nodes/display/NormalMapNode.d.ts +7 -1
  59. three/examples/jsm/nodes/display/PosterizeNode.d.ts +6 -0
  60. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +8 -1
  61. three/examples/jsm/nodes/display/ViewportNode.d.ts +8 -0
  62. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +3 -0
  63. three/examples/jsm/nodes/fog/FogNode.d.ts +3 -0
  64. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +3 -0
  65. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +1 -1
  66. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +1 -1
  67. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +1 -1
  68. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +1 -1
  69. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +1 -1
  70. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +1 -1
  71. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +1 -1
  72. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +1 -1
  73. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +1 -1
  74. three/examples/jsm/nodes/geometry/RangeNode.d.ts +3 -0
  75. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +7 -0
  76. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +6 -1
  77. three/examples/jsm/nodes/lighting/LightsNode.d.ts +3 -0
  78. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +18 -5
  79. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -3
  80. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +25 -2
  81. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +43 -34
  82. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +5 -3
  83. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +7 -5
  84. three/examples/jsm/nodes/math/CondNode.d.ts +7 -0
  85. three/examples/jsm/nodes/math/MathNode.d.ts +134 -1
  86. three/examples/jsm/nodes/math/OperatorNode.d.ts +51 -0
  87. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +3 -0
  88. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +75 -33
  89. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +4 -2
  90. three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +3 -0
  91. three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +6 -3
  92. three/examples/jsm/nodes/utils/OscNode.d.ts +6 -0
  93. three/examples/jsm/nodes/utils/RemapNode.d.ts +4 -0
  94. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +3 -0
  95. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +5 -1
  96. three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +7 -0
  97. three/examples/jsm/nodes/utils/TimerNode.d.ts +7 -1
  98. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +22 -7
  99. three/examples/jsm/objects/QuadMesh.d.ts +13 -0
  100. three/examples/jsm/postprocessing/GTAOPass.d.ts +118 -0
  101. three/examples/jsm/renderers/common/Info.d.ts +7 -2
  102. three/examples/jsm/renderers/common/Renderer.d.ts +2 -2
  103. three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.d.ts +3 -0
  104. three/examples/jsm/renderers/webgpu/WebGPURenderer.d.ts +1 -0
  105. three/examples/jsm/shaders/GTAOShader.d.ts +59 -0
  106. three/examples/jsm/shaders/PoissonDenoiseShader.d.ts +28 -0
  107. three/examples/jsm/utils/SortUtils.d.ts +7 -0
  108. three/package.json +3 -3
  109. three/src/Three.d.ts +2 -0
  110. three/src/animation/AnimationClip.d.ts +2 -2
  111. three/src/animation/AnimationMixer.d.ts +1 -1
  112. three/src/animation/KeyframeTrack.d.ts +3 -3
  113. three/src/animation/tracks/BooleanKeyframeTrack.d.ts +1 -1
  114. three/src/animation/tracks/ColorKeyframeTrack.d.ts +1 -1
  115. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  116. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  117. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  118. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  119. three/src/audio/Audio.d.ts +1 -1
  120. three/src/audio/AudioListener.d.ts +1 -1
  121. three/src/constants.d.ts +3 -1
  122. three/src/core/BufferAttribute.d.ts +27 -0
  123. three/src/core/BufferGeometry.d.ts +1 -1
  124. three/src/core/InterleavedBuffer.d.ts +27 -0
  125. three/src/core/InterleavedBufferAttribute.d.ts +2 -2
  126. three/src/core/Object3D.d.ts +48 -14
  127. three/src/core/Raycaster.d.ts +1 -0
  128. three/src/core/UniformsGroup.d.ts +3 -3
  129. three/src/extras/core/Curve.d.ts +2 -2
  130. three/src/extras/core/Path.d.ts +1 -1
  131. three/src/extras/core/Shape.d.ts +1 -1
  132. three/src/extras/core/ShapePath.d.ts +1 -1
  133. three/src/extras/curves/CatmullRomCurve3.d.ts +2 -2
  134. three/src/extras/curves/CubicBezierCurve.d.ts +2 -2
  135. three/src/extras/curves/CubicBezierCurve3.d.ts +2 -2
  136. three/src/extras/curves/EllipseCurve.d.ts +1 -1
  137. three/src/extras/curves/LineCurve.d.ts +2 -2
  138. three/src/extras/curves/LineCurve3.d.ts +2 -2
  139. three/src/extras/curves/QuadraticBezierCurve.d.ts +2 -2
  140. three/src/extras/curves/QuadraticBezierCurve3.d.ts +2 -2
  141. three/src/extras/curves/SplineCurve.d.ts +2 -2
  142. three/src/geometries/ExtrudeGeometry.d.ts +5 -5
  143. three/src/geometries/LatheGeometry.d.ts +2 -2
  144. three/src/geometries/PlaneGeometry.d.ts +1 -1
  145. three/src/geometries/PolyhedronGeometry.d.ts +1 -1
  146. three/src/geometries/RingGeometry.d.ts +1 -1
  147. three/src/geometries/ShapeGeometry.d.ts +2 -2
  148. three/src/geometries/SphereGeometry.d.ts +1 -1
  149. three/src/geometries/TorusGeometry.d.ts +1 -1
  150. three/src/geometries/TorusKnotGeometry.d.ts +1 -1
  151. three/src/geometries/TubeGeometry.d.ts +3 -3
  152. three/src/geometries/WireframeGeometry.d.ts +1 -1
  153. three/src/helpers/ArrowHelper.d.ts +4 -4
  154. three/src/helpers/AxesHelper.d.ts +1 -1
  155. three/src/helpers/Box3Helper.d.ts +3 -3
  156. three/src/helpers/CameraHelper.d.ts +2 -2
  157. three/src/helpers/DirectionalLightHelper.d.ts +6 -4
  158. three/src/helpers/GridHelper.d.ts +1 -1
  159. three/src/helpers/HemisphereLightHelper.d.ts +4 -4
  160. three/src/helpers/PlaneHelper.d.ts +2 -2
  161. three/src/helpers/PointLightHelper.d.ts +3 -3
  162. three/src/helpers/SkeletonHelper.d.ts +4 -4
  163. three/src/helpers/SpotLightHelper.d.ts +3 -3
  164. three/src/lights/DirectionalLight.d.ts +1 -1
  165. three/src/lights/DirectionalLightShadow.d.ts +1 -1
  166. three/src/lights/HemisphereLight.d.ts +1 -1
  167. three/src/lights/LightProbe.d.ts +1 -1
  168. three/src/lights/LightShadow.d.ts +5 -5
  169. three/src/lights/PointLight.d.ts +7 -0
  170. three/src/lights/PointLightShadow.d.ts +1 -1
  171. three/src/lights/SpotLight.d.ts +1 -1
  172. three/src/lights/SpotLightShadow.d.ts +1 -1
  173. three/src/loaders/MaterialLoader.d.ts +6 -3
  174. three/src/materials/LineBasicMaterial.d.ts +7 -0
  175. three/src/materials/LineDashedMaterial.d.ts +7 -1
  176. three/src/materials/Material.d.ts +16 -16
  177. three/src/materials/MeshBasicMaterial.d.ts +9 -2
  178. three/src/materials/MeshDepthMaterial.d.ts +7 -1
  179. three/src/materials/MeshDistanceMaterial.d.ts +9 -2
  180. three/src/materials/MeshLambertMaterial.d.ts +9 -2
  181. three/src/materials/MeshMatcapMaterial.d.ts +10 -3
  182. three/src/materials/MeshNormalMaterial.d.ts +9 -2
  183. three/src/materials/MeshPhongMaterial.d.ts +10 -3
  184. three/src/materials/MeshPhysicalMaterial.d.ts +6 -1
  185. three/src/materials/MeshStandardMaterial.d.ts +10 -5
  186. three/src/materials/MeshToonMaterial.d.ts +10 -3
  187. three/src/materials/PointsMaterial.d.ts +9 -2
  188. three/src/materials/RawShaderMaterial.d.ts +9 -0
  189. three/src/materials/ShaderMaterial.d.ts +9 -3
  190. three/src/materials/ShadowMaterial.d.ts +8 -1
  191. three/src/materials/SpriteMaterial.d.ts +9 -4
  192. three/src/math/Box3.d.ts +2 -2
  193. three/src/math/Frustum.d.ts +2 -2
  194. three/src/math/Matrix4.d.ts +30 -30
  195. three/src/math/Sphere.d.ts +5 -0
  196. three/src/math/Triangle.d.ts +8 -8
  197. three/src/math/Vector2.d.ts +1 -1
  198. three/src/math/Vector4.d.ts +1 -1
  199. three/src/objects/BatchedMesh.d.ts +169 -0
  200. three/src/objects/Bone.d.ts +1 -1
  201. three/src/objects/LOD.d.ts +2 -4
  202. three/src/objects/Line.d.ts +2 -4
  203. three/src/objects/LineLoop.d.ts +1 -1
  204. three/src/objects/LineSegments.d.ts +1 -1
  205. three/src/objects/Skeleton.d.ts +2 -8
  206. three/src/objects/SkinnedMesh.d.ts +1 -2
  207. three/src/renderers/WebGL3DRenderTarget.d.ts +7 -5
  208. three/src/renderers/WebGLArrayRenderTarget.d.ts +7 -5
  209. three/src/renderers/WebGLCubeRenderTarget.d.ts +2 -2
  210. three/src/renderers/WebGLRenderTarget.d.ts +1 -1
  211. three/src/renderers/shaders/ShaderChunk.d.ts +1 -0
  212. three/src/renderers/shaders/ShaderLib.d.ts +18 -18
  213. three/src/renderers/shaders/UniformsUtils.d.ts +3 -2
  214. three/src/renderers/webgl/WebGLAttributes.d.ts +1 -0
  215. three/src/renderers/webgl/WebGLBindingStates.d.ts +4 -4
  216. three/src/renderers/webgl/WebGLBufferRenderer.d.ts +4 -3
  217. three/src/renderers/webgl/WebGLClipping.d.ts +2 -2
  218. three/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +5 -4
  219. three/src/renderers/webgl/WebGLLights.d.ts +39 -37
  220. three/src/renderers/webgl/WebGLPrograms.d.ts +225 -10
  221. three/src/renderers/webgl/WebGLRenderLists.d.ts +5 -5
  222. three/src/renderers/webgl/WebGLShadowMap.d.ts +2 -2
  223. three/src/scenes/Fog.d.ts +1 -1
  224. three/src/scenes/FogExp2.d.ts +1 -1
  225. three/src/textures/CompressedCubeTexture.d.ts +13 -0
  226. three/src/textures/Texture.d.ts +1 -1
  227. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +0 -310
  228. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -166
  229. three/examples/jsm/objects/BatchedMesh.d.ts +0 -57
  230. three/examples/jsm/renderers/common/Animation.d.ts +0 -16
@@ -1,5 +1,6 @@
1
1
  import Node from '../core/Node.js';
2
2
  import TempNode from '../core/TempNode.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export type MathNodeMethod1 =
5
6
  | typeof MathNode.RADIANS
@@ -27,7 +28,11 @@ export type MathNodeMethod1 =
27
28
  | typeof MathNode.ONE_MINUS
28
29
  | typeof MathNode.DFDX
29
30
  | typeof MathNode.DFDY
30
- | typeof MathNode.ROUND;
31
+ | typeof MathNode.ROUND
32
+ | typeof MathNode.RECIPROCAL
33
+ | typeof MathNode.TRUNC
34
+ | typeof MathNode.FWIDTH
35
+ | typeof MathNode.BITCAST;
31
36
 
32
37
  export type MathNodeMethod2 =
33
38
  | typeof MathNode.ATAN2
@@ -81,6 +86,9 @@ export default class MathNode extends TempNode {
81
86
  static DFDY: 'dFdy';
82
87
  static ROUND: 'round';
83
88
  static RECIPROCAL: 'reciprocal';
89
+ static TRUNC: 'trunc';
90
+ static FWIDTH: 'fwidth';
91
+ static BITCAST: 'bitcast';
84
92
 
85
93
  // 2 inputs
86
94
 
@@ -113,3 +121,128 @@ export default class MathNode extends TempNode {
113
121
  constructor(method: MathNodeMethod2, aNode: Node, bNode: Node);
114
122
  constructor(method: MathNodeMethod3, aNode: Node, bNode: Node, cNode: Node);
115
123
  }
124
+
125
+ export const EPSILON: ShaderNodeObject<Node>;
126
+ export const INFINITY: ShaderNodeObject<Node>;
127
+
128
+ export type Unary = (a: NodeRepresentation) => ShaderNodeObject<MathNode>;
129
+
130
+ export const radians: Unary;
131
+ export const degrees: Unary;
132
+ export const exp: Unary;
133
+ export const exp2: Unary;
134
+ export const log: Unary;
135
+ export const log2: Unary;
136
+ export const sqrt: Unary;
137
+ export const inverseSqrt: Unary;
138
+ export const floor: Unary;
139
+ export const ceil: Unary;
140
+ export const normalize: Unary;
141
+ export const fract: Unary;
142
+ export const sin: Unary;
143
+ export const cos: Unary;
144
+ export const tan: Unary;
145
+ export const asin: Unary;
146
+ export const acos: Unary;
147
+ export const atan: Unary;
148
+ export const abs: Unary;
149
+ export const sign: Unary;
150
+ export const length: Unary;
151
+ export const negate: Unary;
152
+ export const oneMinus: Unary;
153
+ export const dFdx: Unary;
154
+ export const dFdy: Unary;
155
+ export const round: Unary;
156
+ export const reciprocal: Unary;
157
+ export const trunc: Unary;
158
+ export const fwidth: Unary;
159
+ export const bitcast: Unary;
160
+
161
+ export type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
162
+
163
+ export const atan2: Binary;
164
+ export const min: Binary;
165
+ export const max: Binary;
166
+ export const mod: Binary;
167
+ export const step: Binary;
168
+ export const reflect: Binary;
169
+ export const distance: Binary;
170
+ export const difference: Binary;
171
+ export const dot: Binary;
172
+ export const cross: Binary;
173
+ export const pow: Binary;
174
+ export const pow2: Binary;
175
+ export const pow3: Binary;
176
+ export const pow4: Binary;
177
+ export const transformDirection: Binary;
178
+
179
+ export type Ternary = (
180
+ a: NodeRepresentation,
181
+ b: NodeRepresentation,
182
+ c: NodeRepresentation,
183
+ ) => ShaderNodeObject<MathNode>;
184
+
185
+ export const mix: Ternary;
186
+ export const clamp: Ternary;
187
+ export const saturate: Ternary;
188
+ export const refract: Ternary;
189
+ export const smoothstep: Ternary;
190
+ export const faceForward: Ternary;
191
+
192
+ export const mixElement: Ternary;
193
+ export const smoothstepElement: Ternary;
194
+
195
+ declare module '../shadernode/ShaderNode.js' {
196
+ interface NodeElements {
197
+ radians: typeof radians;
198
+ degrees: typeof degrees;
199
+ exp: typeof exp;
200
+ exp2: typeof exp2;
201
+ log: typeof log;
202
+ log2: typeof log2;
203
+ sqrt: typeof sqrt;
204
+ inverseSqrt: typeof inverseSqrt;
205
+ floor: typeof floor;
206
+ ceil: typeof ceil;
207
+ normalize: typeof normalize;
208
+ fract: typeof fract;
209
+ sin: typeof sin;
210
+ cos: typeof cos;
211
+ tan: typeof tan;
212
+ asin: typeof asin;
213
+ acos: typeof acos;
214
+ atan: typeof atan;
215
+ abs: typeof abs;
216
+ sign: typeof sign;
217
+ length: typeof length;
218
+ negate: typeof negate;
219
+ oneMinus: typeof oneMinus;
220
+ dFdx: typeof dFdx;
221
+ dFdy: typeof dFdy;
222
+ round: typeof round;
223
+ reciprocal: typeof reciprocal;
224
+ trunc: typeof trunc;
225
+ fwidth: typeof fwidth;
226
+ atan2: typeof atan2;
227
+ min: typeof min;
228
+ max: typeof max;
229
+ mod: typeof mod;
230
+ step: typeof step;
231
+ reflect: typeof reflect;
232
+ distance: typeof distance;
233
+ dot: typeof dot;
234
+ cross: typeof cross;
235
+ pow: typeof pow;
236
+ pow2: typeof pow2;
237
+ pow3: typeof pow3;
238
+ pow4: typeof pow4;
239
+ transformDirection: typeof transformDirection;
240
+ mix: typeof mixElement;
241
+ clamp: typeof clamp;
242
+ refract: typeof refract;
243
+ smoothstep: typeof smoothstepElement;
244
+ faceForward: typeof faceForward;
245
+ difference: typeof difference;
246
+ saturate: typeof saturate;
247
+ }
248
+ }
@@ -1,5 +1,6 @@
1
1
  import TempNode from '../core/TempNode.js';
2
2
  import Node from '../core/Node.js';
3
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export type OperatorNodeOp =
5
6
  | '='
@@ -29,3 +30,53 @@ export default class OperatorNode extends TempNode {
29
30
 
30
31
  constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]);
31
32
  }
33
+
34
+ export type Operator = (
35
+ a: NodeRepresentation,
36
+ b: NodeRepresentation,
37
+ ...others: NodeRepresentation[]
38
+ ) => ShaderNodeObject<OperatorNode>;
39
+
40
+ export const add: Operator;
41
+ export const sub: Operator;
42
+ export const mul: Operator;
43
+ export const div: Operator;
44
+ export const remainder: Operator;
45
+ export const equal: Operator;
46
+ export const assign: Operator;
47
+ export const lessThan: Operator;
48
+ export const greaterThan: Operator;
49
+ export const lessThanEqual: Operator;
50
+ export const greaterThanEqual: Operator;
51
+ export const and: Operator;
52
+ export const or: Operator;
53
+ export const xor: Operator;
54
+ export const bitAnd: Operator;
55
+ export const bitOr: Operator;
56
+ export const bitXor: Operator;
57
+ export const shiftLeft: Operator;
58
+ export const shiftRight: Operator;
59
+
60
+ declare module '../shadernode/ShaderNode.js' {
61
+ interface NodeElements {
62
+ add: typeof add;
63
+ sub: typeof sub;
64
+ mul: typeof mul;
65
+ div: typeof div;
66
+ remainder: typeof remainder;
67
+ equal: typeof equal;
68
+ assign: typeof assign;
69
+ lessThan: typeof lessThan;
70
+ greaterThan: typeof greaterThan;
71
+ lessThanEqual: typeof lessThanEqual;
72
+ greaterThanEqual: typeof greaterThanEqual;
73
+ and: typeof and;
74
+ or: typeof or;
75
+ xor: typeof xor;
76
+ bitAnd: typeof bitAnd;
77
+ bitOr: typeof bitOr;
78
+ bitXor: typeof bitXor;
79
+ shiftLeft: typeof shiftLeft;
80
+ shiftRight: typeof shiftRight;
81
+ }
82
+ }
@@ -1,6 +1,9 @@
1
1
  import TempNode from '../core/TempNode.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class CheckerNode extends TempNode {
4
5
  uvNode: Node;
5
6
  constructor(uvNode?: Node);
6
7
  }
8
+
9
+ export const checker: (uvNode?: NodeRepresentation) => ShaderNodeObject<CheckerNode>;
@@ -1,20 +1,37 @@
1
- import { ConstNode, Node, NodeBuilder, NodeTypeOption, SwizzleOption } from '../Nodes.js';
2
- // lot of private typescript magic here
3
- export {};
1
+ import Node from '../core/Node.js';
2
+ import { NodeTypeOption, SwizzleOption } from '../core/constants.js';
3
+ import ConstNode from '../core/ConstNode.js';
4
+ import NodeBuilder from '../core/NodeBuilder.js';
5
+ import SplitNode from '../utils/SplitNode.js';
6
+
7
+ export interface NodeElements {}
8
+
9
+ export function addNodeElement(name: string, nodeElement: unknown): void;
10
+
4
11
  export type Swizzable<T extends Node = Node> = T & {
5
- [key in SwizzleOption | number]: Swizzable;
12
+ [key in SwizzleOption | number]: ShaderNodeObject<SplitNode>;
6
13
  };
7
14
 
15
+ export type ShaderNodeObject<T extends Node> = T & {
16
+ [Key in keyof NodeElements]: NodeElements[Key] extends (node: T, ...args: infer Args) => infer R
17
+ ? (...args: Args) => R
18
+ : never;
19
+ } & Swizzable<T>;
20
+
8
21
  /** 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>;
22
+ export type NodeRepresentation<T extends Node = Node> = number | boolean | Node | ShaderNodeObject<T>;
10
23
 
11
24
  /** anything that can be passed to {@link nodeObject} */
12
25
  export type NodeObjectOption = NodeRepresentation | string;
13
26
 
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;
27
+ // same logic as in ShaderNodeObject: number,boolean,node->ShaderNodeObject, otherwise do nothing
28
+ export type NodeObject<T> = T extends Node
29
+ ? ShaderNodeObject<T>
30
+ : T extends number | boolean
31
+ ? ShaderNodeObject<ConstNode<number | boolean>>
32
+ : T;
16
33
 
17
- // opposite of NodeObject: node -> node|swizzable|boolean|number, otherwise do nothing
34
+ // opposite of NodeObject: node -> node|ShaderNodeObject|boolean|number, otherwise do nothing
18
35
  type Proxied<T> = T extends Node ? NodeRepresentation<T> : T;
19
36
  // https://github.com/microsoft/TypeScript/issues/42435#issuecomment-765557874
20
37
  export type ProxiedTuple<T extends readonly [...unknown[]]> = [...{ [index in keyof T]: Proxied<T[index]> }];
@@ -102,11 +119,7 @@ type GetConstructorsByScope<T, S> = ConstructorUnion<FilterConstructorsByScope<O
102
119
  type GetConstructors<T> = ConstructorUnion<OverloadedConstructorsOf<T>>;
103
120
  type GetPossibleScopes<T> = ExtractScopes<OverloadedConstructorsOf<T>>;
104
121
 
105
- export type ConvertType = (...params: unknown[]) => Swizzable;
106
-
107
- export const ConvertType: {
108
- new (type: NodeTypeOption, cacheMap?: Map<unknown, ConstNode>): ConvertType;
109
- };
122
+ export type ConvertType = (...params: unknown[]) => ShaderNodeObject<Node>;
110
123
 
111
124
  type NodeArray<T extends NodeObjectOption[]> = { [index in keyof T]: NodeObject<T[index]> };
112
125
  type NodeObjects<T> = { [key in keyof T]: T[key] extends NodeObjectOption ? NodeObject<T[key]> : T[key] };
@@ -114,7 +127,16 @@ type ConstructedNode<T> = T extends new (...args: any[]) => infer R ? (R extends
114
127
 
115
128
  export type NodeOrType = Node | NodeTypeOption;
116
129
 
117
- export function getConstNodeType(value: NodeOrType): NodeTypeOption | null;
130
+ export const getConstNodeType: (value: NodeOrType) => NodeTypeOption | null;
131
+
132
+ export class ShaderNode<T = {}, R extends Node = Node> {
133
+ constructor(jsFunc: (inputs: NodeObjects<T>, builder: NodeBuilder) => NodeRepresentation);
134
+ call: (
135
+ inputs: { [key in keyof T]: T[key] extends NodeRepresentation ? ShaderNodeObject<Node> | Node : T[key] },
136
+ builder?: NodeBuilder,
137
+ ) => ShaderNodeObject<R>;
138
+ }
139
+
118
140
  export function nodeObject<T extends NodeObjectOption>(obj: T): NodeObject<T>;
119
141
  export function nodeObjects<T>(obj: T): NodeObjects<T>;
120
142
 
@@ -122,35 +144,55 @@ export function nodeArray<T extends NodeObjectOption[]>(obj: readonly [...T]): N
122
144
 
123
145
  export function nodeProxy<T>(
124
146
  nodeClass: T,
125
- ): (...params: ProxiedTuple<GetConstructors<T>>) => Swizzable<ConstructedNode<T>>;
147
+ ): (...params: ProxiedTuple<GetConstructors<T>>) => ShaderNodeObject<ConstructedNode<T>>;
126
148
 
127
149
  export function nodeProxy<T, S extends GetPossibleScopes<T>>(
128
150
  nodeClass: T,
129
151
  scope: S,
130
- ): (...params: ProxiedTuple<RemoveTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
152
+ ): (...params: ProxiedTuple<RemoveTail<GetConstructorsByScope<T, S>>>) => ShaderNodeObject<ConstructedNode<T>>;
131
153
 
132
154
  export function nodeProxy<T, S extends GetPossibleScopes<T>>(
133
155
  nodeClass: T,
134
156
  scope: S,
135
157
  factor: NodeObjectOption,
136
- ): (...params: ProxiedTuple<RemoveHeadAndTail<GetConstructorsByScope<T, S>>>) => Swizzable<ConstructedNode<T>>;
158
+ ): (...params: ProxiedTuple<RemoveHeadAndTail<GetConstructorsByScope<T, S>>>) => ShaderNodeObject<ConstructedNode<T>>;
137
159
 
138
160
  export function nodeImmutable<T>(
139
161
  nodeClass: T,
140
162
  ...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
- };
163
+ ): ShaderNodeObject<ConstructedNode<T>>;
164
+
165
+ export const color: ConvertType;
166
+
167
+ export const float: ConvertType;
168
+ export const int: ConvertType;
169
+ export const uint: ConvertType;
170
+ export const bool: ConvertType;
171
+
172
+ export const vec2: ConvertType;
173
+ export const ivec2: ConvertType;
174
+ export const uvec2: ConvertType;
175
+ export const bvec2: ConvertType;
176
+
177
+ export const vec3: ConvertType;
178
+ export const ivec3: ConvertType;
179
+ export const uvec3: ConvertType;
180
+ export const bvec3: ConvertType;
181
+
182
+ export const vec4: ConvertType;
183
+ export const ivec4: ConvertType;
184
+ export const uvec4: ConvertType;
185
+ export const bvec4: ConvertType;
186
+
187
+ export const mat3: ConvertType;
188
+ export const imat3: ConvertType;
189
+ export const umat3: ConvertType;
190
+ export const bmat3: ConvertType;
191
+
192
+ export const mat4: ConvertType;
193
+ export const imat4: ConvertType;
194
+ export const umat4: ConvertType;
195
+ export const bmat4: ConvertType;
196
+
197
+ export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
198
+ export const convert: (node: NodeRepresentation, types: NodeTypeOption) => ShaderNodeObject<Node>;
@@ -1,6 +1,8 @@
1
1
  import { PositionNode, TempNode } from '../Nodes.js';
2
- import { Swizzable } from '../shadernode/ShaderNodeElements.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
3
 
4
4
  export default class EquirectUVNode extends TempNode {
5
- constructor(dirNode?: Swizzable<PositionNode>);
5
+ constructor(dirNode?: ShaderNodeObject<PositionNode>);
6
6
  }
7
+
8
+ export const equirectUV: ShaderNodeObject<EquirectUVNode>;
@@ -1,5 +1,8 @@
1
1
  import TempNode from '../core/TempNode.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class MatcapUVNode extends TempNode {
4
5
  constructor();
5
6
  }
7
+
8
+ export const matcapUV: ShaderNodeObject<MatcapUVNode>;
@@ -1,11 +1,14 @@
1
- import UniformNode from '../core/UniformNode.js';
2
1
  import { Texture } from '../../../../src/Three.js';
3
- import { TextureNode } from '../Nodes.js';
2
+ import UniformNode from '../core/UniformNode.js';
3
+ import TextureNode from '../accessors/TextureNode.js';
4
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
4
5
 
5
- export default class MaxMipLevelNode extends UniformNode {
6
+ export default class MaxMipLevelNode extends UniformNode<0> {
6
7
  textureNode: TextureNode;
7
8
 
8
9
  constructor(textureNode: TextureNode);
9
10
 
10
11
  get texture(): Texture;
11
12
  }
13
+
14
+ export const maxMipLevel: (texture: Texture) => ShaderNodeObject<MaxMipLevelNode>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export type OscNodeMethod =
4
5
  | typeof OscNode.SINE
@@ -17,3 +18,8 @@ export default class OscNode extends Node {
17
18
 
18
19
  constructor(method: OscNodeMethod, timeNode?: Node);
19
20
  }
21
+
22
+ export const oscSine: (timeNode?: NodeRepresentation) => ShaderNodeObject<OscNode>;
23
+ export const oscSquare: (timeNode?: NodeRepresentation) => ShaderNodeObject<OscNode>;
24
+ export const oscTriangle: (timeNode?: NodeRepresentation) => ShaderNodeObject<OscNode>;
25
+ export const oscSawtooth: (timeNode?: NodeRepresentation) => ShaderNodeObject<OscNode>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class RemapNode extends Node {
4
5
  node: Node;
@@ -11,3 +12,6 @@ export default class RemapNode extends Node {
11
12
 
12
13
  constructor(node: Node, inLowNode: Node, inHighNode: Node, outLowNode: Node, outHighNode: Node);
13
14
  }
15
+
16
+ export const remap: (node: Node, inLowNode: Node) => ShaderNodeObject<RemapNode>;
17
+ export const remapClamp: (node: Node, inLowNode: Node) => ShaderNodeObject<RemapNode>;
@@ -1,5 +1,6 @@
1
1
  import TempNode from '../core/TempNode.js';
2
2
  import Node from '../core/Node.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
4
 
4
5
  export default class RotateUVNode extends TempNode {
5
6
  uvNode: Node;
@@ -8,3 +9,5 @@ export default class RotateUVNode extends TempNode {
8
9
 
9
10
  constructor(uvNode: Node, rotationNode: Node, centerNode?: Node);
10
11
  }
12
+
13
+ export const rotateUV: (uvNode: Node, rotationNode: Node, centerNode?: Node) => ShaderNodeObject<RotateUVNode>;
@@ -1,4 +1,6 @@
1
- import { Node, TextureNode } from '../Nodes.js';
1
+ import Node from '../core/Node.js';
2
+ import TextureNode from '../accessors/TextureNode.js';
3
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
4
 
3
5
  export default class SpecularMIPLevelNode extends Node {
4
6
  textureNode: TextureNode;
@@ -6,3 +8,5 @@ export default class SpecularMIPLevelNode extends Node {
6
8
 
7
9
  constructor(textureNode: TextureNode, roughnessNode?: Node | null);
8
10
  }
11
+
12
+ export const specularMIPLevel: () => ShaderNodeObject<SpecularMIPLevelNode>;
@@ -1,4 +1,5 @@
1
1
  import Node from '../core/Node.js';
2
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export default class SpriteSheetUVNode extends Node {
4
5
  countNode: Node;
@@ -7,3 +8,9 @@ export default class SpriteSheetUVNode extends Node {
7
8
 
8
9
  constructor(countNode: Node, uvNode?: Node, frameNode?: Node);
9
10
  }
11
+
12
+ export const spritesheetUV: (
13
+ countNode: NodeRepresentation,
14
+ uvNode?: NodeRepresentation,
15
+ frameNode?: NodeRepresentation,
16
+ ) => ShaderNodeObject<SpriteSheetUVNode>;
@@ -1,4 +1,5 @@
1
1
  import UniformNode from '../core/UniformNode.js';
2
+ import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
2
3
 
3
4
  export type TimerNodeScope =
4
5
  | typeof TimerNode.LOCAL
@@ -6,7 +7,7 @@ export type TimerNodeScope =
6
7
  | typeof TimerNode.DELTA
7
8
  | typeof TimerNode.FRAME;
8
9
 
9
- export default class TimerNode extends UniformNode {
10
+ export default class TimerNode extends UniformNode<number> {
10
11
  static LOCAL: 'local';
11
12
  static GLOBAL: 'global';
12
13
  static DELTA: 'delta';
@@ -17,3 +18,8 @@ export default class TimerNode extends UniformNode {
17
18
 
18
19
  constructor(scope?: TimerNodeScope, scale?: number, value?: number);
19
20
  }
21
+
22
+ export const timerLocal: (timeScale?: number, value?: number) => ShaderNodeObject<TimerNode>;
23
+ export const timerGlobal: (timeScale?: number, value?: number) => ShaderNodeObject<TimerNode>;
24
+ export const timerDelta: (timeScale?: number, value?: number) => ShaderNodeObject<TimerNode>;
25
+ export const frameId: ShaderNodeObject<TimerNode>;
@@ -1,22 +1,37 @@
1
1
  import Node from '../core/Node.js';
2
- import { PositionNode, Swizzable, TextureNode } from '../Nodes.js';
2
+ import PositionNode from '../accessors/PositionNode.js';
3
+ import TextureNode from '../accessors/TextureNode.js';
4
+ import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
3
5
 
4
6
  export default class TriplanarTexturesNode extends Node {
5
7
  textureXNode: TextureNode;
6
8
  textureYNode: TextureNode | null;
7
9
  textureZNode: TextureNode | null;
8
10
 
9
- scaleNode: Swizzable;
11
+ scaleNode: ShaderNodeObject<Node>;
10
12
 
11
- positionNode: Swizzable<PositionNode>;
12
- normalNode: Swizzable<PositionNode>;
13
+ positionNode: ShaderNodeObject<PositionNode>;
14
+ normalNode: ShaderNodeObject<PositionNode>;
13
15
 
14
16
  constructor(
15
17
  textureXNode: Node,
16
18
  textureYNode?: TextureNode | null,
17
19
  textureZNode?: TextureNode | null,
18
- scaleNode?: Swizzable,
19
- positionNode?: Swizzable<PositionNode>,
20
- normalNode?: Swizzable<PositionNode>,
20
+ scaleNode?: ShaderNodeObject<Node>,
21
+ positionNode?: ShaderNodeObject<PositionNode>,
22
+ normalNode?: ShaderNodeObject<PositionNode>,
21
23
  );
22
24
  }
25
+
26
+ export const triplanarTextures: (
27
+ textureXNode: NodeRepresentation,
28
+ textureYNode?: NodeRepresentation,
29
+ textureZNode?: NodeRepresentation,
30
+ scaleNode?: NodeRepresentation,
31
+ positionNode?: NodeRepresentation,
32
+ normalNode?: NodeRepresentation,
33
+ ) => ShaderNodeObject<TriplanarTexturesNode>;
34
+ export const triplanarTexture: (
35
+ texture: NodeRepresentation,
36
+ ...params: NodeRepresentation[]
37
+ ) => ShaderNodeObject<TriplanarTexturesNode>;
@@ -0,0 +1,13 @@
1
+ import { Material } from '../../../src/Three.js';
2
+ import Renderer from '../renderers/common/Renderer.js';
3
+
4
+ export default class QuadMesh {
5
+ constructor(material?: Material | null);
6
+
7
+ dispose(): void;
8
+
9
+ render(renderer: Renderer): void;
10
+
11
+ get material(): Material;
12
+ set material(value: Material);
13
+ }