@types/three 0.159.0 → 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 (129) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/loaders/KTX2Loader.d.ts +2 -8
  3. three/examples/jsm/loaders/MaterialXLoader.d.ts +6 -0
  4. three/examples/jsm/misc/Timer.d.ts +80 -0
  5. three/examples/jsm/nodes/Nodes.d.ts +238 -60
  6. three/examples/jsm/nodes/accessors/BitangentNode.d.ts +9 -0
  7. three/examples/jsm/nodes/accessors/BufferNode.d.ts +4 -1
  8. three/examples/jsm/nodes/accessors/CameraNode.d.ts +7 -0
  9. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +9 -2
  10. three/examples/jsm/nodes/accessors/InstanceNode.d.ts +3 -0
  11. three/examples/jsm/nodes/accessors/MaterialNode.d.ts +12 -0
  12. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +7 -0
  13. three/examples/jsm/nodes/accessors/ModelNode.d.ts +7 -1
  14. three/examples/jsm/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
  15. three/examples/jsm/nodes/accessors/NormalNode.d.ts +8 -0
  16. three/examples/jsm/nodes/accessors/PointUVNode.d.ts +3 -0
  17. three/examples/jsm/nodes/accessors/PositionNode.d.ts +8 -0
  18. three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +4 -1
  19. three/examples/jsm/nodes/accessors/ReflectVectorNode.d.ts +3 -0
  20. three/examples/jsm/nodes/accessors/SkinningNode.d.ts +3 -0
  21. three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +8 -1
  22. three/examples/jsm/nodes/accessors/TangentNode.d.ts +9 -0
  23. three/examples/jsm/nodes/accessors/TextureNode.d.ts +10 -2
  24. three/examples/jsm/nodes/accessors/UVNode.d.ts +3 -0
  25. three/examples/jsm/nodes/accessors/UserDataNode.d.ts +7 -0
  26. three/examples/jsm/nodes/code/CodeNode.d.ts +4 -0
  27. three/examples/jsm/nodes/code/ExpressionNode.d.ts +3 -0
  28. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +7 -1
  29. three/examples/jsm/nodes/code/FunctionNode.d.ts +17 -0
  30. three/examples/jsm/nodes/core/ArrayUniformNode.d.ts +1 -1
  31. three/examples/jsm/nodes/core/AttributeNode.d.ts +3 -0
  32. three/examples/jsm/nodes/core/BypassNode.d.ts +3 -0
  33. three/examples/jsm/nodes/core/CacheNode.d.ts +3 -0
  34. three/examples/jsm/nodes/core/ConstNode.d.ts +3 -3
  35. three/examples/jsm/nodes/core/ContextNode.d.ts +3 -0
  36. three/examples/jsm/nodes/core/InputNode.d.ts +4 -4
  37. three/examples/jsm/nodes/core/NodeBuilder.d.ts +6 -3
  38. three/examples/jsm/nodes/core/NodeUniform.d.ts +12 -8
  39. three/examples/jsm/nodes/core/NodeUtils.d.ts +6 -3
  40. three/examples/jsm/nodes/core/PropertyNode.d.ts +9 -0
  41. three/examples/jsm/nodes/core/UniformNode.d.ts +12 -4
  42. three/examples/jsm/nodes/core/VarNode.d.ts +4 -0
  43. three/examples/jsm/nodes/core/VaryingNode.d.ts +3 -0
  44. three/examples/jsm/nodes/core/constants.d.ts +9 -5
  45. three/examples/jsm/nodes/display/BlendModeNode.d.ts +7 -2
  46. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +18 -1
  47. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +4 -0
  48. three/examples/jsm/nodes/display/FrontFacingNode.d.ts +4 -0
  49. three/examples/jsm/nodes/display/NormalMapNode.d.ts +7 -1
  50. three/examples/jsm/nodes/display/PosterizeNode.d.ts +6 -0
  51. three/examples/jsm/nodes/display/ToneMappingNode.d.ts +8 -1
  52. three/examples/jsm/nodes/display/ViewportNode.d.ts +8 -0
  53. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +3 -0
  54. three/examples/jsm/nodes/fog/FogNode.d.ts +3 -0
  55. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +3 -0
  56. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +1 -1
  57. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +1 -1
  58. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +1 -1
  59. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +1 -1
  60. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +1 -1
  61. three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +1 -1
  62. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +1 -1
  63. three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts +1 -1
  64. three/examples/jsm/nodes/functions/material/getRoughness.d.ts +1 -1
  65. three/examples/jsm/nodes/geometry/RangeNode.d.ts +3 -0
  66. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +7 -0
  67. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +6 -1
  68. three/examples/jsm/nodes/lighting/LightsNode.d.ts +3 -0
  69. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +18 -5
  70. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -3
  71. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +25 -2
  72. three/examples/jsm/nodes/materialx/MaterialXNodes.d.ts +43 -34
  73. three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +5 -3
  74. three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +7 -5
  75. three/examples/jsm/nodes/math/CondNode.d.ts +7 -0
  76. three/examples/jsm/nodes/math/MathNode.d.ts +134 -1
  77. three/examples/jsm/nodes/math/OperatorNode.d.ts +51 -0
  78. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +3 -0
  79. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +75 -33
  80. three/examples/jsm/nodes/utils/EquirectUVNode.d.ts +4 -2
  81. three/examples/jsm/nodes/utils/MatcapUVNode.d.ts +3 -0
  82. three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +6 -3
  83. three/examples/jsm/nodes/utils/OscNode.d.ts +6 -0
  84. three/examples/jsm/nodes/utils/RemapNode.d.ts +4 -0
  85. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +3 -0
  86. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +5 -1
  87. three/examples/jsm/nodes/utils/SpriteSheetUVNode.d.ts +7 -0
  88. three/examples/jsm/nodes/utils/TimerNode.d.ts +7 -1
  89. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +22 -7
  90. three/examples/jsm/objects/QuadMesh.d.ts +13 -0
  91. three/examples/jsm/postprocessing/{HBAOPass.d.ts → GTAOPass.d.ts} +22 -10
  92. three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.d.ts +3 -0
  93. three/examples/jsm/shaders/{HBAOShader.d.ts → GTAOShader.d.ts} +23 -8
  94. three/examples/jsm/shaders/PoissonDenoiseShader.d.ts +1 -1
  95. three/package.json +2 -2
  96. three/src/Three.d.ts +1 -0
  97. three/src/constants.d.ts +3 -1
  98. three/src/core/UniformsGroup.d.ts +3 -3
  99. three/src/lights/PointLight.d.ts +7 -0
  100. three/src/loaders/MaterialLoader.d.ts +6 -3
  101. three/src/materials/LineBasicMaterial.d.ts +7 -0
  102. three/src/materials/LineDashedMaterial.d.ts +7 -1
  103. three/src/materials/Material.d.ts +14 -14
  104. three/src/materials/MeshBasicMaterial.d.ts +7 -0
  105. three/src/materials/MeshDepthMaterial.d.ts +6 -0
  106. three/src/materials/MeshDistanceMaterial.d.ts +7 -0
  107. three/src/materials/MeshLambertMaterial.d.ts +7 -0
  108. three/src/materials/MeshMatcapMaterial.d.ts +7 -0
  109. three/src/materials/MeshNormalMaterial.d.ts +7 -0
  110. three/src/materials/MeshPhongMaterial.d.ts +7 -0
  111. three/src/materials/MeshPhysicalMaterial.d.ts +6 -1
  112. three/src/materials/MeshStandardMaterial.d.ts +7 -2
  113. three/src/materials/MeshToonMaterial.d.ts +7 -0
  114. three/src/materials/PointsMaterial.d.ts +7 -0
  115. three/src/materials/RawShaderMaterial.d.ts +9 -0
  116. three/src/materials/ShaderMaterial.d.ts +9 -3
  117. three/src/materials/ShadowMaterial.d.ts +7 -0
  118. three/src/materials/SpriteMaterial.d.ts +7 -2
  119. three/src/math/Matrix4.d.ts +30 -30
  120. three/src/math/Sphere.d.ts +5 -0
  121. three/src/math/Triangle.d.ts +8 -8
  122. three/src/objects/SkinnedMesh.d.ts +1 -2
  123. three/src/renderers/shaders/ShaderLib.d.ts +18 -18
  124. three/src/renderers/shaders/UniformsUtils.d.ts +3 -2
  125. three/src/renderers/webgl/WebGLLights.d.ts +39 -37
  126. three/src/renderers/webgl/WebGLPrograms.d.ts +224 -9
  127. three/src/textures/CompressedCubeTexture.d.ts +13 -0
  128. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +0 -310
  129. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -166
@@ -1,47 +1,49 @@
1
1
  import { WebGLExtensions } from './WebGLExtensions.js';
2
2
  import { WebGLCapabilities } from './WebGLCapabilities.js';
3
3
 
4
- export class WebGLLights {
5
- constructor(extensions: WebGLExtensions, capabilities: WebGLCapabilities);
4
+ export interface WebGLLightsState {
5
+ version: number;
6
+
7
+ hash: {
8
+ directionalLength: number;
9
+ pointLength: number;
10
+ spotLength: number;
11
+ rectAreaLength: number;
12
+ hemiLength: number;
13
+
14
+ numDirectionalShadows: number;
15
+ numPointShadows: number;
16
+ numSpotShadows: number;
17
+ numSpotMaps: number;
6
18
 
7
- state: {
8
- version: number;
9
-
10
- hash: {
11
- directionalLength: number;
12
- pointLength: number;
13
- spotLength: number;
14
- rectAreaLength: number;
15
- hemiLength: number;
16
-
17
- numDirectionalShadows: number;
18
- numPointShadows: number;
19
- numSpotShadows: number;
20
- numSpotMaps: number;
21
-
22
- numLightProbes: number;
23
- };
24
-
25
- ambient: number[];
26
- probe: any[];
27
- directional: any[];
28
- directionalShadow: any[];
29
- directionalShadowMap: any[];
30
- directionalShadowMatrix: any[];
31
- spot: any[];
32
- spotShadow: any[];
33
- spotShadowMap: any[];
34
- spotShadowMatrix: any[];
35
- rectArea: any[];
36
- point: any[];
37
- pointShadow: any[];
38
- pointShadowMap: any[];
39
- pointShadowMatrix: any[];
40
- hemi: any[];
41
- numSpotLightShadowsWithMaps: number;
42
19
  numLightProbes: number;
43
20
  };
44
21
 
22
+ ambient: number[];
23
+ probe: any[];
24
+ directional: any[];
25
+ directionalShadow: any[];
26
+ directionalShadowMap: any[];
27
+ directionalShadowMatrix: any[];
28
+ spot: any[];
29
+ spotShadow: any[];
30
+ spotShadowMap: any[];
31
+ spotShadowMatrix: any[];
32
+ rectArea: any[];
33
+ point: any[];
34
+ pointShadow: any[];
35
+ pointShadowMap: any[];
36
+ pointShadowMatrix: any[];
37
+ hemi: any[];
38
+ numSpotLightShadowsWithMaps: number;
39
+ numLightProbes: number;
40
+ }
41
+
42
+ export class WebGLLights {
43
+ constructor(extensions: WebGLExtensions, capabilities: WebGLCapabilities);
44
+
45
+ state: WebGLLightsState;
46
+
45
47
  get(light: any): any;
46
48
  setup(lights: any): void;
47
49
  setupView(lights: any, camera: any): void;
@@ -1,12 +1,220 @@
1
+ import { Material } from '../../materials/Material.js';
2
+ import { Object3D } from '../../core/Object3D.js';
3
+ import { Light } from '../../lights/Light.js';
4
+ import { Scene } from '../../scenes/Scene.js';
5
+ import { IUniform } from '../shaders/UniformsLib.js';
1
6
  import { WebGLRenderer } from '../WebGLRenderer.js';
2
- import { WebGLProgram } from './WebGLProgram.js';
7
+ import { WebGLBindingStates } from './WebGLBindingStates.js';
3
8
  import { WebGLCapabilities } from './WebGLCapabilities.js';
9
+ import { WebGLClipping } from './WebGLClipping.js';
4
10
  import { WebGLCubeMaps } from './WebGLCubeMaps.js';
5
11
  import { WebGLExtensions } from './WebGLExtensions.js';
6
- import { WebGLClipping } from './WebGLClipping.js';
7
- import { WebGLBindingStates } from './WebGLBindingStates.js';
8
- import { Material } from '../../materials/Material.js';
9
- import { Scene } from '../../scenes/Scene.js';
12
+ import { WebGLLightsState } from './WebGLLights.js';
13
+ import { WebGLProgram } from './WebGLProgram.js';
14
+ import {
15
+ ColorSpace,
16
+ Combine,
17
+ DepthPackingStrategies,
18
+ GLSLVersion,
19
+ Mapping,
20
+ ShadowMapType,
21
+ ToneMapping,
22
+ } from '../../constants.js';
23
+
24
+ export interface WebGLProgramParameters {
25
+ isWebGL2: boolean;
26
+
27
+ shaderID: string;
28
+ shaderType: string;
29
+ shaderName: string;
30
+
31
+ vertexShader: string;
32
+ fragmentShader: string;
33
+ defines: { [define: string]: string | number | boolean } | undefined;
34
+
35
+ customVertexShaderID: string | undefined;
36
+ customFragmentShaderID: string | undefined;
37
+
38
+ isRawShaderMaterial: boolean;
39
+ glslVersion: GLSLVersion | null | undefined;
40
+
41
+ precision: 'lowp' | 'mediump' | 'highp';
42
+
43
+ batching: boolean;
44
+ instancing: boolean;
45
+ instancingColor: boolean;
46
+
47
+ supportsVertexTextures: boolean;
48
+ outputColorSpace: ColorSpace;
49
+
50
+ map: boolean;
51
+ matcap: boolean;
52
+ envMap: boolean;
53
+ envMapMode: Mapping | false;
54
+ envMapCubeUVHeight: number | null;
55
+ aoMap: boolean;
56
+ lightMap: boolean;
57
+ bumpMap: boolean;
58
+ normalMap: boolean;
59
+ displacementMap: boolean;
60
+ emissiveMap: boolean;
61
+
62
+ normalMapObjectSpace: boolean;
63
+ normalMapTangentSpace: boolean;
64
+
65
+ metalnessMap: boolean;
66
+ roughnessMap: boolean;
67
+
68
+ anisotropy: boolean;
69
+ anisotropyMap: boolean;
70
+
71
+ clearcoat: boolean;
72
+ clearcoatMap: boolean;
73
+ clearcoatNormalMap: boolean;
74
+ clearcoatRoughnessMap: boolean;
75
+
76
+ iridescence: boolean;
77
+ iridescenceMap: boolean;
78
+ iridescenceThicknessMap: boolean;
79
+
80
+ sheen: boolean;
81
+ sheenColorMap: boolean;
82
+ sheenRoughnessMap: boolean;
83
+
84
+ specularMap: boolean;
85
+ specularColorMap: boolean;
86
+ specularIntensityMap: boolean;
87
+
88
+ transmission: boolean;
89
+ transmissionMap: boolean;
90
+ thicknessMap: boolean;
91
+
92
+ gradientMap: boolean;
93
+
94
+ opaque: boolean;
95
+
96
+ alphaMap: boolean;
97
+ alphaTest: boolean;
98
+ alphaHash: boolean;
99
+
100
+ combine: Combine | undefined;
101
+
102
+ //
103
+
104
+ mapUv: string | false;
105
+ aoMapUv: string | false;
106
+ lightMapUv: string | false;
107
+ bumpMapUv: string | false;
108
+ normalMapUv: string | false;
109
+ displacementMapUv: string | false;
110
+ emissiveMapUv: string | false;
111
+
112
+ metalnessMapUv: string | false;
113
+ roughnessMapUv: string | false;
114
+
115
+ anisotropyMapUv: string | false;
116
+
117
+ clearcoatMapUv: string | false;
118
+ clearcoatNormalMapUv: string | false;
119
+ clearcoatRoughnessMapUv: string | false;
120
+
121
+ iridescenceMapUv: string | false;
122
+ iridescenceThicknessMapUv: string | false;
123
+
124
+ sheenColorMapUv: string | false;
125
+ sheenRoughnessMapUv: string | false;
126
+
127
+ specularMapUv: string | false;
128
+ specularColorMapUv: string | false;
129
+ specularIntensityMapUv: string | false;
130
+
131
+ transmissionMapUv: string | false;
132
+ thicknessMapUv: string | false;
133
+
134
+ alphaMapUv: string | false;
135
+
136
+ //
137
+
138
+ vertexTangents: boolean;
139
+ vertexColors: boolean;
140
+ vertexAlphas: boolean;
141
+ vertexUv1s: boolean;
142
+ vertexUv2s: boolean;
143
+ vertexUv3s: boolean;
144
+
145
+ pointsUvs: boolean;
146
+
147
+ fog: boolean;
148
+ useFog: boolean;
149
+ fogExp2: boolean | null; // null is possible because of a bug: ( fog && fog.isFogExp2 )
150
+
151
+ flatShading: boolean;
152
+
153
+ sizeAttenuation: boolean;
154
+ logarithmicDepthBuffer: boolean;
155
+
156
+ skinning: boolean;
157
+
158
+ morphTargets: boolean;
159
+ morphNormals: boolean;
160
+ morphColors: boolean;
161
+ morphTargetsCount: number;
162
+ morphTextureStride: number;
163
+
164
+ numDirLights: number;
165
+ numPointLights: number;
166
+ numSpotLights: number;
167
+ numSpotLightMaps: number;
168
+ numRectAreaLights: number;
169
+ numHemiLights: number;
170
+
171
+ numDirLightShadows: number;
172
+ numPointLightShadows: number;
173
+ numSpotLightShadows: number;
174
+ numSpotLightShadowsWithMaps: number;
175
+
176
+ numLightProbes: number;
177
+
178
+ numClippingPlanes: number;
179
+ numClipIntersection: number;
180
+
181
+ dithering: boolean;
182
+
183
+ shadowMapEnabled: boolean;
184
+ shadowMapType: ShadowMapType;
185
+
186
+ toneMapping: ToneMapping;
187
+ useLegacyLights: boolean;
188
+
189
+ decodeVideoTexture: boolean;
190
+
191
+ premultipliedAlpha: boolean;
192
+
193
+ doubleSided: boolean;
194
+ flipSided: boolean;
195
+
196
+ useDepthPacking: boolean;
197
+ depthPacking: DepthPackingStrategies | 0;
198
+
199
+ index0AttributeName: string | undefined;
200
+
201
+ extensionDerivatives: boolean;
202
+ extensionFragDepth: boolean;
203
+ extensionDrawBuffers: boolean;
204
+ extensionShaderTextureLOD: boolean;
205
+ extensionClipCullDistance: boolean;
206
+
207
+ rendererExtensionFragDepth: boolean;
208
+ rendererExtensionDrawBuffers: boolean;
209
+ rendererExtensionShaderTextureLod: boolean;
210
+ rendererExtensionParallelShaderCompile: boolean;
211
+
212
+ customProgramCacheKey: string;
213
+ }
214
+
215
+ export interface WebGLProgramParametersWithUniforms extends WebGLProgramParameters {
216
+ uniforms: { [uniform: string]: IUniform };
217
+ }
10
218
 
11
219
  export class WebGLPrograms {
12
220
  constructor(
@@ -20,9 +228,16 @@ export class WebGLPrograms {
20
228
 
21
229
  programs: WebGLProgram[];
22
230
 
23
- getParameters(material: Material, lights: any, shadows: object[], scene: Scene, object: any): any;
24
- getProgramCacheKey(parameters: any): string;
25
- getUniforms(material: Material): object;
26
- acquireProgram(parameters: any, cacheKey: string): WebGLProgram;
231
+ getParameters(
232
+ material: Material,
233
+ lights: WebGLLightsState,
234
+ shadows: Light[],
235
+ scene: Scene,
236
+ object: Object3D,
237
+ ): WebGLProgramParameters;
238
+
239
+ getProgramCacheKey(parameters: WebGLProgramParameters): string;
240
+ getUniforms(material: Material): { [uniform: string]: IUniform };
241
+ acquireProgram(parameters: WebGLProgramParametersWithUniforms, cacheKey: string): WebGLProgram;
27
242
  releaseProgram(program: WebGLProgram): void;
28
243
  }
@@ -0,0 +1,13 @@
1
+ import { CompressedTexture } from './CompressedTexture.js';
2
+ import { CompressedPixelFormat, TextureDataType } from '../constants.js';
3
+
4
+ export class CompressedCubeTexture extends CompressedTexture {
5
+ readonly isCompressedCubeTexture: true;
6
+ readonly isCubeTexture: true;
7
+
8
+ constructor(
9
+ images: Array<{ width: number; height: number }>,
10
+ format?: CompressedPixelFormat,
11
+ type?: TextureDataType,
12
+ );
13
+ }
@@ -1,310 +0,0 @@
1
- import TextureNode from '../accessors/TextureNode.js';
2
- import Node from '../core/Node.js';
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.js';
19
- import { Material, Texture } from '../../../../src/Three.js';
20
- import { NodeTypeOption, NodeUserData, NodeValueOption } from '../core/constants.js';
21
- import { NodeBuilderContext } from '../core/NodeBuilder.js';
22
- import {
23
- BitangentNode,
24
- BufferNode,
25
- BypassNode,
26
- CacheNode,
27
- CameraNode,
28
- CodeNode,
29
- CodeNodeInclude,
30
- ComputeNode,
31
- ContextNode,
32
- ExpressionNode,
33
- FrontFacingNode,
34
- FunctionCallNode,
35
- FunctionNode,
36
- FunctionNodeArguments,
37
- MaterialNode,
38
- MaterialReferenceNode,
39
- MathNode,
40
- MaxMipLevelNode,
41
- ModelNode,
42
- ModelViewProjectionNode,
43
- NormalNode,
44
- PointUVNode,
45
- PositionNode,
46
- PropertyNode,
47
- ReferenceNode,
48
- TangentNode,
49
- UserDataNode,
50
- UVNode,
51
- VarNode,
52
- VaryingNode,
53
- } from '../Nodes.js';
54
- import StorageBufferNode from '../accessors/StorageBufferNode.js';
55
- import NodeCache from '../core/NodeCache.js';
56
-
57
- // shader node base
58
-
59
- export { ShaderNode, nodeObject, nodeObjects, nodeArray, nodeProxy, nodeImmutable, Swizzable };
60
-
61
- export const color: ConvertType;
62
-
63
- export const float: ConvertType;
64
- export const int: ConvertType;
65
- export const uint: ConvertType;
66
- export const bool: ConvertType;
67
-
68
- export const vec2: ConvertType;
69
- export const ivec2: ConvertType;
70
- export const uvec2: ConvertType;
71
- export const bvec2: ConvertType;
72
-
73
- export const vec3: ConvertType;
74
- export const ivec3: ConvertType;
75
- export const uvec3: ConvertType;
76
- export const bvec3: ConvertType;
77
-
78
- export const vec4: ConvertType;
79
- export const ivec4: ConvertType;
80
- export const uvec4: ConvertType;
81
- export const bvec4: ConvertType;
82
-
83
- export const mat3: ConvertType;
84
- export const imat3: ConvertType;
85
- export const umat3: ConvertType;
86
- export const bmat3: ConvertType;
87
-
88
- export const mat4: ConvertType;
89
- export const imat4: ConvertType;
90
- export const umat4: ConvertType;
91
- export const bmat4: ConvertType;
92
-
93
- export function uniform(nodeOrType: Node | Swizzable | NodeValueOption): Swizzable;
94
-
95
- export function attribute(attributeName: string, nodeType: NodeTypeOption): Swizzable;
96
- export function property(name: string, nodeOrType: Node | NodeTypeOption): Swizzable;
97
-
98
- export function convert(node: NodeRepresentation, types: NodeTypeOption): Swizzable;
99
- export function maxMipLevel(texture: Texture): Swizzable<MaxMipLevelNode>;
100
-
101
- export function bypass(returnNode: NodeRepresentation, callNode: NodeRepresentation): Swizzable<BypassNode>;
102
- export function cache(node: Node, cache?: NodeCache): Swizzable<CacheNode>;
103
- export function code(code: string, nodeType?: NodeTypeOption): Swizzable<CodeNode>;
104
- export function context(node: NodeRepresentation, context: NodeBuilderContext): Swizzable<ContextNode>;
105
- export function expression(snipped?: string, nodeType?: NodeTypeOption): Swizzable<ExpressionNode>;
106
-
107
- // definition: const call = nodeProxy(FunctionCallNode);
108
- export function call<P extends FunctionNodeArguments>(
109
- functionNode?: FunctionNode<P>,
110
- parameters?: ProxiedObject<P>,
111
- ): Swizzable<FunctionCallNode<P>>;
112
-
113
- export type Fn<P extends FunctionNodeArguments> = P extends readonly [...unknown[]]
114
- ? ProxiedTuple<P>
115
- : readonly [ProxiedObject<P>];
116
-
117
- export function func<P extends FunctionNodeArguments>(
118
- code: string,
119
- includes?: CodeNodeInclude[],
120
- // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
121
- ): { call: (...params: Fn<P>) => Swizzable };
122
-
123
- export function fn<P extends FunctionNodeArguments>(
124
- code: string,
125
- includes?: CodeNodeInclude[],
126
- // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
127
- ): (...params: Fn<P>) => Swizzable;
128
-
129
- export function label(node: NodeRepresentation, name?: string): Swizzable<VarNode>;
130
- export function temp(node: NodeRepresentation, name?: string): Swizzable<VarNode>;
131
- export function vary(node: NodeRepresentation, name?: string): Swizzable<VaryingNode>;
132
-
133
- // accesors
134
-
135
- export function buffer(value: ArrayLike<number>, nodeOrType: NodeOrType, count: number): Swizzable<BufferNode>;
136
- export function storage(value: ArrayLike<number>, nodeOrType: NodeOrType, count: number): Swizzable<StorageBufferNode>;
137
-
138
- export const cameraProjectionMatrix: Swizzable<CameraNode>;
139
- export const cameraViewMatrix: Swizzable<CameraNode>;
140
- export const cameraNormalMatrix: Swizzable<CameraNode>;
141
- export const cameraWorldMatrix: Swizzable<CameraNode>;
142
- export const cameraPosition: Swizzable<CameraNode>;
143
-
144
- export const materialAlphaTest: Swizzable<MaterialNode>;
145
- export const materialColor: Swizzable<MaterialNode>;
146
- export const materialEmissive: Swizzable<MaterialNode>;
147
- export const materialOpacity: Swizzable<MaterialNode>;
148
- export const materialRoughness: Swizzable<MaterialNode>;
149
- export const materialMetalness: Swizzable<MaterialNode>;
150
- export const materialRotation: Swizzable<MaterialNode>;
151
-
152
- export const diffuseColor: Swizzable<PropertyNode>;
153
- export const roughness: Swizzable<PropertyNode>;
154
- export const metalness: Swizzable<PropertyNode>;
155
- export const alphaTest: Swizzable<PropertyNode>;
156
- export const specularColor: Swizzable<PropertyNode>;
157
-
158
- export function reference<T>(name: string, nodeOrType: NodeOrType, object: T): Swizzable<ReferenceNode<T>>;
159
- export function materialReference(
160
- name: string,
161
- nodeOrType: NodeOrType,
162
- material: Material,
163
- ): Swizzable<MaterialReferenceNode>;
164
- export function userData(name: string, inputType: NodeTypeOption, userData?: NodeUserData): Swizzable<UserDataNode>;
165
-
166
- export function modelViewProjection(position?: NodeRepresentation): Swizzable<ModelViewProjectionNode>;
167
-
168
- export const normalGeometry: Swizzable<NormalNode>;
169
- export const normalLocal: Swizzable<NormalNode>;
170
- export const normalWorld: Swizzable<NormalNode>;
171
- export const normalView: Swizzable<NormalNode>;
172
- export const transformedNormalView: Swizzable<VarNode>;
173
-
174
- export const tangentGeometry: Swizzable<TangentNode>;
175
- export const tangentLocal: Swizzable<TangentNode>;
176
- export const tangentView: Swizzable<TangentNode>;
177
- export const tangentWorld: Swizzable<TangentNode>;
178
- export const transformedTangentView: Swizzable<MathNode>;
179
- export const transformedTangentWorld: Swizzable<MathNode>;
180
-
181
- export const bitangentGeometry: Swizzable<BitangentNode>;
182
- export const bitangentLocal: Swizzable<BitangentNode>;
183
- export const bitangentView: Swizzable<BitangentNode>;
184
- export const bitangentWorld: Swizzable<BitangentNode>;
185
- export const transformedBitangentView: Swizzable<MathNode>;
186
- export const transformedBitangentWorld: Swizzable<MathNode>;
187
-
188
- export const modelViewMatrix: Swizzable<ModelNode>;
189
- export const modelNormalMatrix: Swizzable<ModelNode>;
190
- export const modelWorldMatrix: Swizzable<ModelNode>;
191
- export const modelPosition: Swizzable<ModelNode>;
192
- export const modelViewPosition: Swizzable<ModelNode>;
193
-
194
- export const positionGeometry: Swizzable<PositionNode>;
195
- export const positionLocal: Swizzable<PositionNode>;
196
- export const positionWorld: Swizzable<PositionNode>;
197
- export const positionWorldDirection: Swizzable<PositionNode>;
198
- export const positionView: Swizzable<PositionNode>;
199
- export const positionViewDirection: Swizzable<PositionNode>;
200
-
201
- export function texture(
202
- value: Texture,
203
- uvNode?: NodeRepresentation,
204
- levelNode?: NodeRepresentation,
205
- ): Swizzable<TextureNode>;
206
- export function sampler(texture: Texture | TextureNode): Swizzable;
207
- export function uv(index?: number): Swizzable<UVNode>;
208
- export const pointUV: Swizzable<PointUVNode>;
209
-
210
- // gpgpu
211
-
212
- export function compute(node: NodeRepresentation, count: number, workgroupSize: number[]): Swizzable<ComputeNode>;
213
-
214
- // math
215
-
216
- export const EPSILON: Swizzable;
217
- export const INFINITY: Swizzable;
218
-
219
- export function cond(condNode: NodeRepresentation, ifNode: NodeRepresentation, elseNode: NodeRepresentation): Swizzable;
220
-
221
- type Operator = (a: NodeRepresentation, b: NodeRepresentation, ...others: NodeRepresentation[]) => Swizzable;
222
- type Unary = (a: NodeRepresentation) => Swizzable<MathNode>;
223
- type Binary = (a: NodeRepresentation, b: NodeRepresentation) => Swizzable<MathNode>;
224
- type Ternary = (a: NodeRepresentation, b: NodeRepresentation, c: NodeRepresentation) => Swizzable<MathNode>;
225
-
226
- export const add: Operator;
227
- export const sub: Operator;
228
- export const mul: Operator;
229
- export const div: Operator;
230
- export const remainder: Operator;
231
- export const equal: Operator;
232
- export const assign: Operator;
233
- export const lessThan: Operator;
234
- export const greaterThan: Operator;
235
- export const lessThanEqual: Operator;
236
- export const greaterThanEqual: Operator;
237
- export const and: Operator;
238
- export const or: Operator;
239
- export const xor: Operator;
240
- export const bitAnd: Operator;
241
- export const bitOr: Operator;
242
- export const bitXor: Operator;
243
- export const shiftLeft: Operator;
244
- export const shiftRight: Operator;
245
-
246
- export const radians: Unary;
247
- export const degrees: Unary;
248
- export const exp: Unary;
249
- export const exp2: Unary;
250
- export const log: Unary;
251
- export const log2: Unary;
252
- export const sqrt: Unary;
253
- export const inversesqrt: Unary;
254
- export const floor: Unary;
255
- export const ceil: Unary;
256
- export const normalize: Unary;
257
- export const fract: Unary;
258
- export const sin: Unary;
259
- export const cos: Unary;
260
- export const tan: Unary;
261
- export const asin: Unary;
262
- export const acos: Unary;
263
- export const atan: Unary;
264
- export const abs: Unary;
265
- export const sign: Unary;
266
- export const length: Unary;
267
- export const negate: Unary;
268
- export const invert: Unary;
269
- export const dFdx: Unary;
270
- export const dFdy: Unary;
271
- export const round: Unary;
272
- export const reciprocal: Unary;
273
-
274
- export const atan2: Binary;
275
- export const min: Binary;
276
- export const max: Binary;
277
- export const mod: Binary;
278
- export const step: Binary;
279
- export const reflect: Binary;
280
- export const distance: Binary;
281
- export const dot: Binary;
282
- export const cross: Binary;
283
- export const pow: Binary;
284
- export const pow2: Binary;
285
- export const pow3: Binary;
286
- export const pow4: Binary;
287
- export const transformDirection: Binary;
288
-
289
- export const mix: Ternary;
290
- export const clamp: Ternary;
291
- export const refract: Ternary;
292
- export const smoothstep: Ternary;
293
- export const faceforward: Ternary;
294
-
295
- // display
296
-
297
- export const frontFacing: Swizzable<FrontFacingNode>;
298
- export const faceDirection: Swizzable;
299
-
300
- // lighting
301
-
302
- // utils
303
- export function element(node: NodeRepresentation, indexNode: NodeRepresentation): Swizzable;
304
-
305
- // miscellaneous
306
- export const lumaCoeffs: Swizzable<MathNode>;
307
- export const luminance: Binary;
308
- export const difference: Binary;
309
- export const dotNV: Swizzable<MathNode>;
310
- export const TBNViewMatrix: Swizzable<MathNode>;