@types/three 0.184.0 → 0.185.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 (208) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +2 -0
  3. three/examples/jsm/controls/FirstPersonControls.d.ts +9 -0
  4. three/examples/jsm/controls/OrbitControls.d.ts +2 -2
  5. three/examples/jsm/controls/TransformControls.d.ts +32 -1
  6. three/examples/jsm/csm/CSMFrustum.d.ts +73 -13
  7. three/examples/jsm/exporters/DRACOExporter.d.ts +1 -1
  8. three/examples/jsm/exporters/GLTFExporter.d.ts +2 -2
  9. three/examples/jsm/exporters/PLYExporter.d.ts +5 -4
  10. three/examples/jsm/exporters/USDZExporter.d.ts +5 -1
  11. three/examples/jsm/generators/CityGenerator.d.ts +75 -0
  12. three/examples/jsm/generators/ForestGenerator.d.ts +79 -0
  13. three/examples/jsm/generators/TerrainGenerator.d.ts +67 -0
  14. three/examples/jsm/generators/TreeGenerator.d.ts +97 -0
  15. three/examples/jsm/generators/city/SidewalkGenerator.d.ts +40 -0
  16. three/examples/jsm/generators/city/SkyscraperGenerator.d.ts +83 -0
  17. three/examples/jsm/geometries/LoftGeometry.d.ts +83 -0
  18. three/examples/jsm/inspector/tabs/Parameters.d.ts +5 -2
  19. three/examples/jsm/lighting/ClusteredLighting.d.ts +45 -0
  20. three/examples/jsm/lighting/LightProbeGrid.d.ts +131 -13
  21. three/examples/jsm/loaders/DRACOLoader.d.ts +20 -6
  22. three/examples/jsm/loaders/EXRLoader.d.ts +2 -12
  23. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -1
  24. three/examples/jsm/loaders/HDRLoader.d.ts +2 -12
  25. three/examples/jsm/loaders/KTX2Loader.d.ts +1 -1
  26. three/examples/jsm/loaders/LWOLoader.d.ts +6 -0
  27. three/examples/jsm/loaders/RGBELoader.d.ts +1 -7
  28. three/examples/jsm/loaders/SVGLoader.d.ts +9 -6
  29. three/examples/jsm/loaders/TGALoader.d.ts +2 -2
  30. three/examples/jsm/loaders/TIFFLoader.d.ts +2 -11
  31. three/examples/jsm/loaders/USDLoader.d.ts +6 -1
  32. three/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +49 -0
  33. three/examples/jsm/objects/MarchingCubes.d.ts +2 -2
  34. three/examples/jsm/objects/Reflector.d.ts +38 -5
  35. three/examples/jsm/objects/SkyMesh.d.ts +1 -1
  36. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  37. three/examples/jsm/tsl/display/BloomNode.d.ts +23 -6
  38. three/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +84 -0
  39. three/examples/jsm/tsl/display/RecurrentDenoiseNode.d.ts +89 -0
  40. three/examples/jsm/tsl/display/SSAAPassNode.d.ts +0 -2
  41. three/examples/jsm/tsl/display/SSGINode.d.ts +4 -1
  42. three/examples/jsm/tsl/display/SSRNode.d.ts +303 -30
  43. three/examples/jsm/tsl/display/TRAANode.d.ts +1 -1
  44. three/examples/jsm/tsl/display/TemporalReprojectNode.d.ts +64 -0
  45. three/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +54 -0
  46. three/examples/jsm/tsl/math/curlNoise.d.ts +38 -0
  47. three/examples/jsm/tsl/utils/GroundedSkybox.d.ts +17 -0
  48. three/examples/jsm/tsl/utils/RNoise.d.ts +12 -0
  49. three/examples/jsm/tsl/utils/SpecularHelpers.d.ts +20 -0
  50. three/examples/jsm/webxr/WebGLXRFallback.d.ts +14 -0
  51. three/package.json +3 -3
  52. three/src/Three.TSL.d.ts +10 -3
  53. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  54. three/src/Three.WebGPU.d.ts +5 -3
  55. three/src/animation/AnimationClip.d.ts +0 -10
  56. three/src/cameras/Camera.d.ts +1 -1
  57. three/src/core/InterleavedBuffer.d.ts +1 -1
  58. three/src/core/Object3D.d.ts +8 -4
  59. three/src/core/RenderTarget.d.ts +11 -0
  60. three/src/core/Timer.d.ts +1 -1
  61. three/src/core/UniformsGroup.d.ts +1 -1
  62. three/src/extras/Controls.d.ts +6 -5
  63. three/src/extras/core/ShapePath.d.ts +61 -65
  64. three/src/loaders/DataTextureLoader.d.ts +37 -3
  65. three/src/loaders/MaterialLoader.d.ts +8 -0
  66. three/src/materials/LineBasicMaterial.d.ts +5 -0
  67. three/src/materials/Material.d.ts +9 -1
  68. three/src/materials/MeshBasicMaterial.d.ts +30 -0
  69. three/src/materials/MeshDepthMaterial.d.ts +13 -0
  70. three/src/materials/MeshDistanceMaterial.d.ts +13 -0
  71. three/src/materials/MeshLambertMaterial.d.ts +50 -1
  72. three/src/materials/MeshMatcapMaterial.d.ts +31 -1
  73. three/src/materials/MeshNormalMaterial.d.ts +11 -1
  74. three/src/materials/MeshPhongMaterial.d.ts +50 -1
  75. three/src/materials/MeshPhysicalMaterial.d.ts +50 -0
  76. three/src/materials/MeshStandardMaterial.d.ts +53 -1
  77. three/src/materials/MeshToonMaterial.d.ts +43 -1
  78. three/src/materials/PointsMaterial.d.ts +9 -0
  79. three/src/materials/ShaderMaterial.d.ts +2 -0
  80. three/src/materials/SpriteMaterial.d.ts +9 -0
  81. three/src/materials/nodes/Line2NodeMaterial.d.ts +18 -13
  82. three/src/materials/nodes/NodeMaterial.d.ts +33 -13
  83. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +0 -84
  84. three/src/math/Box2.d.ts +3 -3
  85. three/src/math/Box3.d.ts +255 -19
  86. three/src/math/Color.d.ts +10 -10
  87. three/src/math/FrustumArray.d.ts +75 -16
  88. three/src/math/Interpolant.d.ts +111 -8
  89. three/src/math/Matrix2.d.ts +1 -1
  90. three/src/math/Matrix3.d.ts +10 -1
  91. three/src/math/Matrix4.d.ts +329 -105
  92. three/src/math/Vector2.d.ts +1 -2
  93. three/src/math/Vector3.d.ts +3 -4
  94. three/src/math/Vector4.d.ts +1 -2
  95. three/src/math/interpolants/BezierInterpolant.d.ts +19 -3
  96. three/src/math/interpolants/CubicInterpolant.d.ts +18 -3
  97. three/src/math/interpolants/DiscreteInterpolant.d.ts +8 -3
  98. three/src/math/interpolants/LinearInterpolant.d.ts +7 -3
  99. three/src/math/interpolants/QuaternionLinearInterpolant.d.ts +7 -3
  100. three/src/nodes/Nodes.d.ts +4 -13
  101. three/src/nodes/TSL.d.ts +7 -5
  102. three/src/nodes/accessors/Batch.d.ts +19 -0
  103. three/src/nodes/accessors/Instance.d.ts +34 -0
  104. three/src/nodes/accessors/MaterialNode.d.ts +86 -79
  105. three/src/nodes/accessors/Morph.d.ts +11 -0
  106. three/src/nodes/accessors/Skinning.d.ts +23 -0
  107. three/src/nodes/accessors/StorageBufferNode.d.ts +22 -23
  108. three/src/nodes/accessors/StorageTexture3DNode.d.ts +17 -0
  109. three/src/nodes/accessors/StorageTextureNode.d.ts +6 -4
  110. three/src/nodes/accessors/TextureNode.d.ts +15 -10
  111. three/src/nodes/core/ArrayNode.d.ts +16 -8
  112. three/src/nodes/core/ContextNode.d.ts +5 -6
  113. three/src/nodes/core/LightingModel.d.ts +2 -0
  114. three/src/nodes/core/Node.d.ts +50 -51
  115. three/src/nodes/core/NodeBuilder.d.ts +1 -133
  116. three/src/nodes/core/OverrideContextNode.d.ts +92 -0
  117. three/src/nodes/core/PropertyNode.d.ts +13 -2
  118. three/src/nodes/core/StructNode.d.ts +0 -2
  119. three/src/nodes/core/StructTypeNode.d.ts +5 -4
  120. three/src/nodes/core/UniformNode.d.ts +48 -9
  121. three/src/nodes/display/BlendModes.d.ts +72 -11
  122. three/src/nodes/display/FrontFacingNode.d.ts +62 -3
  123. three/src/nodes/display/PassNode.d.ts +0 -2
  124. three/src/nodes/display/PremultiplyAlphaFunctions.d.ts +37 -0
  125. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +53 -45
  126. three/src/nodes/lighting/LightingContextNode.d.ts +9 -2
  127. three/src/nodes/lighting/LightsNode.d.ts +4 -4
  128. three/src/nodes/math/MathNode.d.ts +358 -304
  129. three/src/nodes/math/OperatorNode.d.ts +253 -82
  130. three/src/nodes/tsl/TSLCore.d.ts +16 -9
  131. three/src/nodes/utils/ArrayElementNode.d.ts +5 -4
  132. three/src/nodes/utils/EquirectUV.d.ts +31 -1
  133. three/src/nodes/utils/Packing.d.ts +50 -3
  134. three/src/nodes/utils/RTTNode.d.ts +7 -12
  135. three/src/nodes/utils/Remap.d.ts +216 -29
  136. three/src/nodes/utils/SampleNode.d.ts +18 -8
  137. three/src/objects/BatchedMesh.d.ts +1 -1
  138. three/src/objects/InstancedMesh.d.ts +0 -8
  139. three/src/objects/Skeleton.d.ts +0 -2
  140. three/src/renderers/common/Backend.d.ts +0 -3
  141. three/src/renderers/common/CanvasTarget.d.ts +0 -49
  142. three/src/renderers/common/ClippingContext.d.ts +6 -1
  143. three/src/renderers/common/CubeRenderTarget.d.ts +2 -1
  144. three/src/renderers/common/Info.d.ts +26 -66
  145. three/src/renderers/common/InspectorBase.d.ts +0 -7
  146. three/src/renderers/common/Lighting.d.ts +49 -5
  147. three/src/renderers/common/Renderer.d.ts +34 -458
  148. three/src/renderers/common/RendererUtils.d.ts +1 -2
  149. three/src/renderers/common/TimestampQueryPool.d.ts +1 -1
  150. three/src/renderers/common/XRManager.d.ts +32 -299
  151. three/src/renderers/common/nodes/NodeLibrary.d.ts +0 -117
  152. three/src/renderers/webgl/WebGLPrograms.d.ts +2 -0
  153. three/src/renderers/webgl/WebGLRenderLists.d.ts +5 -1
  154. three/src/renderers/webgl/WebGLState.d.ts +2 -0
  155. three/src/renderers/webgl-fallback/WebGLBackend.d.ts +1 -1
  156. three/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +0 -10
  157. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +0 -1
  158. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +5 -121
  159. three/src/textures/CubeDepthTexture.d.ts +2 -3
  160. three/src/textures/DataTexture.d.ts +2 -1
  161. three/src/textures/DepthTexture.d.ts +5 -5
  162. three/examples/jsm/lighting/TiledLighting.d.ts +0 -9
  163. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +0 -31
  164. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +0 -22
  165. three/src/nodes/accessors/BatchNode.d.ts +0 -12
  166. three/src/nodes/accessors/InstanceNode.d.ts +0 -30
  167. three/src/nodes/accessors/InstancedMeshNode.d.ts +0 -10
  168. three/src/nodes/accessors/MorphNode.d.ts +0 -14
  169. three/src/nodes/accessors/SkinningNode.d.ts +0 -32
  170. three/src/renderers/common/Animation.d.ts +0 -102
  171. three/src/renderers/common/Attributes.d.ts +0 -59
  172. three/src/renderers/common/Background.d.ts +0 -47
  173. three/src/renderers/common/BindGroup.d.ts +0 -39
  174. three/src/renderers/common/Binding.d.ts +0 -50
  175. three/src/renderers/common/Bindings.d.ts +0 -132
  176. three/src/renderers/common/Buffer.d.ts +0 -90
  177. three/src/renderers/common/ChainMap.d.ts +0 -49
  178. three/src/renderers/common/Color4.d.ts +0 -55
  179. three/src/renderers/common/ComputePipeline.d.ts +0 -34
  180. three/src/renderers/common/DataMap.d.ts +0 -42
  181. three/src/renderers/common/Geometries.d.ts +0 -111
  182. three/src/renderers/common/Pipeline.d.ts +0 -29
  183. three/src/renderers/common/Pipelines.d.ts +0 -186
  184. three/src/renderers/common/ProgrammableStage.d.ts +0 -73
  185. three/src/renderers/common/RenderBundle.d.ts +0 -25
  186. three/src/renderers/common/RenderBundles.d.ts +0 -34
  187. three/src/renderers/common/RenderContext.d.ts +0 -235
  188. three/src/renderers/common/RenderContexts.d.ts +0 -47
  189. three/src/renderers/common/RenderList.d.ts +0 -226
  190. three/src/renderers/common/RenderLists.d.ts +0 -46
  191. three/src/renderers/common/RenderObject.d.ts +0 -448
  192. three/src/renderers/common/RenderObjectPipeline.d.ts +0 -33
  193. three/src/renderers/common/RenderObjects.d.ts +0 -151
  194. three/src/renderers/common/SampledTexture.d.ts +0 -28
  195. three/src/renderers/common/Sampler.d.ts +0 -19
  196. three/src/renderers/common/Textures.d.ts +0 -125
  197. three/src/renderers/common/Uniform.d.ts +0 -262
  198. three/src/renderers/common/UniformBuffer.d.ts +0 -20
  199. three/src/renderers/common/UniformsGroup.d.ts +0 -152
  200. three/src/renderers/common/XRRenderTarget.d.ts +0 -67
  201. three/src/renderers/common/nodes/NodeBuilderState.d.ts +0 -121
  202. three/src/renderers/common/nodes/NodeManager.d.ts +0 -309
  203. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +0 -29
  204. three/src/renderers/common/nodes/NodeSampler.d.ts +0 -12
  205. three/src/renderers/common/nodes/NodeUniform.d.ts +0 -250
  206. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +0 -41
  207. three/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +0 -6
  208. three/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts +0 -6
@@ -1,15 +1,76 @@
1
+ import { Color } from "../../math/Color.js";
2
+ import { Vector3 } from "../../math/Vector3.js";
3
+ import { Vector4 } from "../../math/Vector4.js";
1
4
  import Node from "../core/Node.js";
2
5
 
3
- export const blendBurn: (base: Node, blend: Node) => Node<"vec3">;
6
+ type ColorParameter = Node<"float"> | number | Node<"vec3"> | Vector3 | Node<"color"> | Color | Node<"vec4"> | Vector4;
4
7
 
5
- export const blendDodge: (base: Node, blend: Node) => Node<"vec3">;
8
+ /**
9
+ * Represents a "Color Burn" blend mode.
10
+ *
11
+ * It's designed to darken the base layer's colors based on the color of the blend layer.
12
+ * It significantly increases the contrast of the base layer, making the colors more vibrant and saturated.
13
+ * The darker the color in the blend layer, the stronger the darkening and contrast effect on the base layer.
14
+ *
15
+ * @tsl
16
+ * @function
17
+ * @param {Node<vec3>} base - The base color.
18
+ * @param {Node<vec3>} blend - The blend color. A white (#ffffff) blend color does not alter the base color.
19
+ * @return {Node<vec3>} The result.
20
+ */
21
+ export const blendBurn: (base: ColorParameter, blend: ColorParameter) => Node<"vec3">;
22
+ /**
23
+ * Represents a "Color Dodge" blend mode.
24
+ *
25
+ * It's designed to lighten the base layer's colors based on the color of the blend layer.
26
+ * It significantly increases the brightness of the base layer, making the colors lighter and more vibrant.
27
+ * The brighter the color in the blend layer, the stronger the lightening and contrast effect on the base layer.
28
+ *
29
+ * @tsl
30
+ * @function
31
+ * @param {Node<vec3>} base - The base color.
32
+ * @param {Node<vec3>} blend - The blend color. A black (#000000) blend color does not alter the base color.
33
+ * @return {Node<vec3>} The result.
34
+ */
35
+ export const blendDodge: (base: ColorParameter, blend: ColorParameter) => Node<"vec3">;
36
+ /**
37
+ * Represents a "Screen" blend mode.
38
+ *
39
+ * Similar to `blendDodge()`, this mode also lightens the base layer's colors based on the color of the blend layer.
40
+ * The "Screen" blend mode is better for general brightening whereas the "Dodge" results in more subtle and nuanced
41
+ * effects.
42
+ *
43
+ * @tsl
44
+ * @function
45
+ * @param {Node<vec3>} base - The base color.
46
+ * @param {Node<vec3>} blend - The blend color. A black (#000000) blend color does not alter the base color.
47
+ * @return {Node<vec3>} The result.
48
+ */
49
+ export const blendScreen: (base: ColorParameter, blend: ColorParameter) => Node<"vec3">;
50
+ /**
51
+ * Represents a "Overlay" blend mode.
52
+ *
53
+ * It's designed to increase the contrast of the base layer based on the color of the blend layer.
54
+ * It amplifies the existing colors and contrast in the base layer, making lighter areas lighter and darker areas darker.
55
+ * The color of the blend layer significantly influences the resulting contrast and color shift in the base layer.
56
+ *
57
+ * @tsl
58
+ * @function
59
+ * @param {Node<vec3>} base - The base color.
60
+ * @param {Node<vec3>} blend - The blend color
61
+ * @return {Node<vec3>} The result.
62
+ */
63
+ export const blendOverlay: (base: ColorParameter, blend: ColorParameter) => Node<"vec3">;
64
+ /**
65
+ * This function blends two color based on their alpha values by replicating the behavior of `THREE.NormalBlending`.
66
+ * It assumes both input colors have non-premultiplied alpha.
67
+ *
68
+ * @tsl
69
+ * @function
70
+ * @param {Node<vec4>} base - The base color.
71
+ * @param {Node<vec4>} blend - The blend color
72
+ * @return {Node<vec4>} The result.
73
+ */
74
+ export const blendColor: (base: ColorParameter, blend: ColorParameter) => Node<"vec4">;
6
75
 
7
- export const blendScreen: (base: Node, blend: Node) => Node<"vec3">;
8
-
9
- export const blendOverlay: (base: Node, blend: Node) => Node<"vec3">;
10
-
11
- export const blendColor: (base: Node, blend: Node) => Node<"vec4">;
12
-
13
- export const premultiplyAlpha: (color: Node) => Node<"vec4">;
14
-
15
- export const unpremultiplyAlpha: (color: Node) => Node<"vec4">;
76
+ export {};
@@ -1,12 +1,71 @@
1
+ import { Vector3 } from "../../math/Vector3.js";
1
2
  import Node from "../core/Node.js";
2
3
 
4
+ /**
5
+ * This node can be used to evaluate whether a primitive is front or back facing.
6
+ *
7
+ * @augments Node
8
+ */
3
9
  declare class FrontFacingNode extends Node<"bool"> {
4
- isFrontFacingNode: true;
10
+ /**
11
+ * Constructs a new front facing node.
12
+ */
5
13
  constructor();
14
+ /**
15
+ * This flag can be used for type testing.
16
+ *
17
+ * @type {boolean}
18
+ * @readonly
19
+ * @default true
20
+ */
21
+ readonly isFrontFacingNode: boolean;
6
22
  }
7
23
 
8
24
  export default FrontFacingNode;
9
25
 
26
+ /**
27
+ * TSL object that represents whether a primitive is front or back facing
28
+ *
29
+ * @tsl
30
+ * @type {FrontFacingNode<bool>}
31
+ */
10
32
  export const frontFacing: FrontFacingNode;
11
- export const faceDirection: Node;
12
- export const directionToFaceDirection: (direction: Node) => Node;
33
+ /**
34
+ * TSL object that represents the front facing status as a number instead of a bool.
35
+ * `1` means front facing, `-1` means back facing.
36
+ *
37
+ * @tsl
38
+ * @type {Node<float>}
39
+ */
40
+ export const faceDirection: Node<"float">;
41
+ /**
42
+ * Negates a vector if the rendering occurs on the back side of a face,
43
+ * based on the material's side configuration.
44
+ *
45
+ * - If the material's side is `BackSide`, the vector is inverted (negated).
46
+ * - If the material's side is `DoubleSide`, the vector is multiplied by `faceDirection`
47
+ * (negated only for back-facing fragments).
48
+ * - If the material's side is `FrontSide` (default), the vector remains unchanged.
49
+ *
50
+ * @tsl
51
+ * @function
52
+ * @param {Node<vec3>} vector - The vector to process.
53
+ * @returns {Node<vec3>} The processed vector.
54
+ */
55
+ export const negateOnBackSide: (vector: Node<"vec3"> | Vector3) => Node<"vec3">;
56
+ /**
57
+ * Negates a vector if the rendering occurs on the back side of a face,
58
+ * based on the material's side configuration.
59
+ *
60
+ * - If the material's side is `BackSide`, the vector is inverted (negated).
61
+ * - If the material's side is `DoubleSide`, the vector is multiplied by `faceDirection`
62
+ * (negated only for back-facing fragments).
63
+ * - If the material's side is `FrontSide` (default), the vector remains unchanged.
64
+ *
65
+ * @tsl
66
+ * @function
67
+ * @deprecated since r185. Use {@link negateOnBackSide} instead.
68
+ * @param {Node<vec3>} vector - The vector to convert.
69
+ * @returns {Node<vec3>} The converted vector.
70
+ */
71
+ export const directionToFaceDirection: (vector: Node<"vec3"> | Vector3) => Node<"vec3">;
@@ -94,8 +94,6 @@ declare class PassNode extends TempNode<"vec4"> {
94
94
  setViewport(x: number, y: number, width: number, height: number): void;
95
95
  setViewport(x: Vector4): void;
96
96
 
97
- setPixelRatio(pixelRatio: number): void;
98
-
99
97
  dispose(): void;
100
98
 
101
99
  static COLOR: "color";
@@ -0,0 +1,37 @@
1
+ import { Color } from "../../math/Color.js";
2
+ import { Vector3 } from "../../math/Vector3.js";
3
+ import { Vector4 } from "../../math/Vector4.js";
4
+ import Node from "../core/Node.js";
5
+
6
+ type ColorParameter = Node<"float"> | number | Node<"vec3"> | Vector3 | Node<"color"> | Color | Node<"vec4"> | Vector4;
7
+
8
+ /**
9
+ * Premultiplies the RGB channels of a color by its alpha channel.
10
+ *
11
+ * This function is useful for converting a non-premultiplied alpha color
12
+ * into a premultiplied alpha format, where the RGB values are scaled
13
+ * by the alpha value. Premultiplied alpha is often used in graphics
14
+ * rendering for certain operations, such as compositing and image processing.
15
+ *
16
+ * @tsl
17
+ * @function
18
+ * @param {Node<vec4>} color - The input color with non-premultiplied alpha.
19
+ * @return {Node<vec4>} The color with premultiplied alpha.
20
+ */
21
+ export const premultiplyAlpha: (color: ColorParameter) => Node<"vec4">;
22
+ /**
23
+ * Unpremultiplies the RGB channels of a color by its alpha channel.
24
+ *
25
+ * This function is useful for converting a premultiplied alpha color
26
+ * back into a non-premultiplied alpha format, where the RGB values are
27
+ * divided by the alpha value. Unpremultiplied alpha is often used in graphics
28
+ * rendering for certain operations, such as compositing and image processing.
29
+ *
30
+ * @tsl
31
+ * @function
32
+ * @param {Node<vec4>} color - The input color with premultiplied alpha.
33
+ * @return {Node<vec4>} The color with non-premultiplied alpha.
34
+ */
35
+ export const unpremultiplyAlpha: (color: ColorParameter) => Node<"vec4">;
36
+
37
+ export {};
@@ -11,73 +11,81 @@ export type AtomicMethod =
11
11
  | typeof AtomicFunctionNode.ATOMIC_OR
12
12
  | typeof AtomicFunctionNode.ATOMIC_XOR;
13
13
 
14
- declare class AtomicFunctionNode extends Node {
14
+ interface AtomicFunctionNodeInterface {
15
15
  method: AtomicMethod;
16
16
  pointerNode: Node;
17
- valueNode: Node;
17
+ valueNode: Node | null;
18
18
  parents: boolean;
19
-
20
- constructor(method: AtomicMethod, pointerNode: Node, valueNode: Node);
21
-
22
- static ATOMIC_LOAD: "atomicLoad";
23
- static ATOMIC_STORE: "atomicStore";
24
- static ATOMIC_ADD: "atomicAdd";
25
- static ATOMIC_SUB: "atomicSub";
26
- static ATOMIC_MAX: "atomicMax";
27
- static ATOMIC_MIN: "atomicMin";
28
- static ATOMIC_AND: "atomicAnd";
29
- static ATOMIC_OR: "atomicOr";
30
- static ATOMIC_XOR: "atomicXor";
31
19
  }
32
20
 
21
+ declare const AtomicFunctionNode: {
22
+ new<TNodeType>(
23
+ method: AtomicMethod,
24
+ pointerNode: Node,
25
+ valueNode: Node | null,
26
+ ): AtomicFunctionNode<TNodeType>;
27
+
28
+ ATOMIC_LOAD: "atomicLoad";
29
+ ATOMIC_STORE: "atomicStore";
30
+ ATOMIC_ADD: "atomicAdd";
31
+ ATOMIC_SUB: "atomicSub";
32
+ ATOMIC_MAX: "atomicMax";
33
+ ATOMIC_MIN: "atomicMin";
34
+ ATOMIC_AND: "atomicAnd";
35
+ ATOMIC_OR: "atomicOr";
36
+ ATOMIC_XOR: "atomicXor";
37
+ };
38
+
39
+ export type AtomicFunctionNode<TNodeType> = Node<TNodeType> & AtomicFunctionNodeInterface;
40
+
33
41
  export default AtomicFunctionNode;
34
42
 
35
- export const atomicFunc: (
43
+ export const atomicFunc: <TNodeType>(
36
44
  method: AtomicMethod,
37
- pointerNode: Node,
38
- valueNode: Node,
39
- ) => AtomicFunctionNode;
45
+ pointerNode: Node<TNodeType>,
46
+ valueNode: Node | null,
47
+ ) => AtomicFunctionNode<TNodeType>;
40
48
 
41
- export const atomicLoad: (
42
- pointerNode: Node,
43
- ) => AtomicFunctionNode;
49
+ export const atomicLoad: <TNodeType>(
50
+ pointerNode: Node<TNodeType>,
51
+ ) => AtomicFunctionNode<TNodeType>;
44
52
 
45
- export const atomicStore: (
46
- pointerNode: Node,
53
+ export const atomicStore: <TNodeType>(
54
+ pointerNode: Node<TNodeType>,
47
55
  valueNode: Node | number,
48
- ) => AtomicFunctionNode;
56
+ ) => AtomicFunctionNode<TNodeType>;
49
57
 
50
- export const atomicAdd: (
51
- pointerNode: Node,
58
+ export const atomicAdd: <TNodeType>(
59
+ pointerNode: Node<TNodeType>,
52
60
  valueNode: Node | number,
53
- ) => AtomicFunctionNode;
61
+ ) => AtomicFunctionNode<TNodeType>;
54
62
 
55
- export const atomicSub: (
56
- pointerNode: Node,
63
+ export const atomicSub: <TNodeType>(
64
+ pointerNode: Node<TNodeType>,
57
65
  valueNode: Node | number,
58
- ) => AtomicFunctionNode;
66
+ ) => AtomicFunctionNode<TNodeType>;
59
67
 
60
- export const atomicMax: (
61
- pointerNode: Node,
68
+ export const atomicMax: <TNodeType>(
69
+ pointerNode: Node<TNodeType>,
62
70
  valueNode: Node,
63
- ) => AtomicFunctionNode;
71
+ ) => AtomicFunctionNode<TNodeType>;
64
72
 
65
- export const atomicMin: (
66
- pointerNode: Node,
73
+ export const atomicMin: <TNodeType>(
74
+ pointerNode: Node<TNodeType>,
67
75
  valueNode: Node,
68
- ) => AtomicFunctionNode;
76
+ ) => AtomicFunctionNode<TNodeType>;
69
77
 
70
- export const atomicAnd: (
71
- pointerNode: Node,
78
+ export const atomicAnd: <TNodeType>(
79
+ pointerNode: Node<TNodeType>,
72
80
  valueNode: Node,
73
- ) => AtomicFunctionNode;
81
+ ) => AtomicFunctionNode<TNodeType>;
74
82
 
75
- export const atomicOr: (
76
- pointerNode: Node,
83
+ export const atomicOr: <TNodeType>(
84
+ pointerNode: Node<TNodeType>,
77
85
  valueNode: Node,
78
- ) => AtomicFunctionNode;
86
+ ) => AtomicFunctionNode<TNodeType>;
79
87
 
80
- export const atomicXor: (
81
- pointerNode: Node,
88
+ export const atomicXor: <TNodeType>(
89
+ pointerNode: Node<TNodeType>,
82
90
  valueNode: Node,
83
- ) => AtomicFunctionNode;
91
+ ) => AtomicFunctionNode<TNodeType>;
@@ -1,6 +1,7 @@
1
1
  import ContextNode from "../core/ContextNode.js";
2
2
  import LightingModel, { LightingModelReflectedLight } from "../core/LightingModel.js";
3
3
  import Node from "../core/Node.js";
4
+ import LightingNode from "./LightingNode.js";
4
5
  import LightsNode from "./LightsNode.js";
5
6
 
6
7
  export interface LightingContext {
@@ -9,18 +10,21 @@ export interface LightingContext {
9
10
  iblIrradiance: Node;
10
11
  ambientOcclusion: Node;
11
12
  reflectedLight: LightingModelReflectedLight;
13
+ materialLightings: LightingNode[];
12
14
  backdrop: Node;
13
15
  backdropAlpha: Node;
14
16
  }
15
17
 
16
18
  export default class LightingContextNode extends ContextNode<unknown> {
17
- lightingModelNode: LightingModel | null;
19
+ lightingModel: LightingModel | null;
20
+ materialLightings: LightingNode[];
18
21
  backdropNode: Node | null;
19
22
  backdropAlphaNode: Node | null;
20
23
 
21
24
  constructor(
22
25
  lightsNode: LightsNode,
23
26
  lightingModel?: LightingModel | null,
27
+ materialLightings?: LightingNode[],
24
28
  backdropNode?: Node | null,
25
29
  backdropAlphaNode?: Node | null,
26
30
  );
@@ -30,5 +34,8 @@ export default class LightingContextNode extends ContextNode<unknown> {
30
34
 
31
35
  export const lightingContext: (
32
36
  node: LightsNode,
33
- lightingModelNode?: LightingModel,
37
+ lightingModel?: LightingModel | null,
38
+ materialLightings?: LightingNode[],
39
+ backdropNode?: Node | null,
40
+ backdropAlphaNode?: Node | null,
34
41
  ) => LightingContextNode;
@@ -18,13 +18,13 @@ export interface DirectRectAreaLightData {
18
18
  }
19
19
 
20
20
  declare class LightsNode extends Node {
21
- totalDiffuseNode: Node;
22
- totalSpecularNode: Node;
23
- outgoingLightNode: Node;
21
+ totalDiffuseNode: Node<"vec3">;
22
+ totalSpecularNode: Node<"vec3">;
23
+ outgoingLightNode: Node<"vec3">;
24
24
 
25
25
  constructor();
26
26
 
27
- setupLightsNode(builder: NodeBuilder): void;
27
+ setupLightsNode(builder: NodeBuilder): LightingNode[];
28
28
 
29
29
  setupDirectLight(builder: NodeBuilder, lightNode: Node, lightData: DirectLightData): void;
30
30