@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
three/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 16 Apr 2026 19:29:33 GMT
11
+ * Last updated: Thu, 25 Jun 2026 18:41:21 GMT
12
12
  * Dependencies: [@dimforge/rapier3d-compat](https://npmjs.com/package/@dimforge/rapier3d-compat), [@tweenjs/tween.js](https://npmjs.com/package/@tweenjs/tween.js), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr), [fflate](https://npmjs.com/package/fflate), [meshoptimizer](https://npmjs.com/package/meshoptimizer)
13
13
 
14
14
  # Credits
@@ -46,6 +46,7 @@ export * from "./exporters/USDZExporter.js";
46
46
  export * from "./geometries/BoxLineGeometry.js";
47
47
  export * from "./geometries/ConvexGeometry.js";
48
48
  export * from "./geometries/DecalGeometry.js";
49
+ export * from "./geometries/LoftGeometry.js";
49
50
  export * from "./geometries/ParametricFunctions.js";
50
51
  export * from "./geometries/ParametricGeometry.js";
51
52
  export * from "./geometries/RoundedBoxGeometry.js";
@@ -284,6 +285,7 @@ export * from "./webxr/OculusHandModel.js";
284
285
  export * from "./webxr/OculusHandPointerModel.js";
285
286
  export * from "./webxr/Text2D.js";
286
287
  export * from "./webxr/VRButton.js";
288
+ export * from "./webxr/WebGLXRFallback.js";
287
289
  export * from "./webxr/XRButton.js";
288
290
  export * from "./webxr/XRControllerModelFactory.js";
289
291
  export * from "./webxr/XREstimatedLight.js";
@@ -14,6 +14,15 @@ declare class FirstPersonControls extends Controls<{}> {
14
14
  */
15
15
  lookSpeed: number;
16
16
 
17
+ /**
18
+ * How quickly the movement and look velocity catches up to the input. Lower
19
+ * values feel heavier (more inertia), `1` disables damping.
20
+ *
21
+ * @type {number}
22
+ * @default 0.1
23
+ */
24
+ dampingFactor: number;
25
+
17
26
  /**
18
27
  * Whether or not it's possible to vertically look around. Default is `true`.
19
28
  */
@@ -20,7 +20,7 @@ export interface OrbitControlsEventMap {
20
20
  /**
21
21
  * Orbit controls allow the camera to orbit around a target.
22
22
  */
23
- declare class OrbitControls extends Controls<OrbitControlsEventMap> {
23
+ declare class OrbitControls<TCamera extends Camera = Camera> extends Controls<OrbitControlsEventMap, TCamera> {
24
24
  /**
25
25
  * The focus point of the controls, the {@link .object} orbits around this. It can be updated manually at any point
26
26
  * to change the focus of the controls.
@@ -206,7 +206,7 @@ declare class OrbitControls extends Controls<OrbitControlsEventMap> {
206
206
  * is the scene itself.
207
207
  * @param domElement The HTML element used for event listeners. (optional)
208
208
  */
209
- constructor(object: Camera, domElement?: HTMLElement | SVGElement | null);
209
+ constructor(object: TCamera, domElement?: HTMLElement | SVGElement | null);
210
210
 
211
211
  set cursorStyle(type: "auto" | "grab");
212
212
  get cursorStyle(): "auto" | "grab";
@@ -1,4 +1,4 @@
1
- import { Camera, ColorRepresentation, Controls, Mesh, Object3D, Quaternion, Raycaster, Vector3 } from "three";
1
+ import { Camera, ColorRepresentation, Controls, Mesh, Object3D, Quaternion, Raycaster, Vector3, Vector4 } from "three";
2
2
 
3
3
  export type TransformControlsMode = "translate" | "rotate" | "scale";
4
4
 
@@ -41,6 +41,8 @@ export interface TransformControlsEventMap {
41
41
  "showXY-changed": { value: unknown };
42
42
  "showYZ-changed": { value: unknown };
43
43
  "showXZ-changed": { value: unknown };
44
+ "showXYZE-changed": { value: unknown };
45
+ "showE-changed": { value: unknown };
44
46
  "minX-changed": { value: unknown };
45
47
  "maxX-changed": { value: unknown };
46
48
  "minY-changed": { value: unknown };
@@ -111,6 +113,17 @@ declare class TransformControls extends Controls<TransformControlsEventMap> {
111
113
  */
112
114
  size: number;
113
115
 
116
+ /**
117
+ * The viewport rectangle, in logical (CSS) pixels with the origin at the lower-left
118
+ * of the canvas. Set this when the renderer uses a sub-canvas viewport so pointer
119
+ * coordinates map to the correct region. If `null`, the full canvas is used.
120
+ *
121
+ * @name TransformControls#viewport
122
+ * @type {?Vector4}
123
+ * @default null
124
+ */
125
+ viewport: Vector4 | null;
126
+
114
127
  /**
115
128
  * Whether or not dragging is currently performed. Read-only property.
116
129
  */
@@ -152,6 +165,24 @@ declare class TransformControls extends Controls<TransformControlsEventMap> {
152
165
  */
153
166
  showXZ: boolean;
154
167
 
168
+ /**
169
+ * Whether the xyze rotation helper should be visible or not.
170
+ *
171
+ * @name TransformControls#showXYZE
172
+ * @type {boolean}
173
+ * @default true
174
+ */
175
+ showXYZE: boolean;
176
+
177
+ /**
178
+ * Whether the e rotation helper should be visible or not.
179
+ *
180
+ * @name TransformControls#showE
181
+ * @type {boolean}
182
+ * @default true
183
+ */
184
+ showE: boolean;
185
+
155
186
  /**
156
187
  * The minimum allowed X position during translation. Default is `-Infinity`.
157
188
  */
@@ -1,25 +1,85 @@
1
1
  import { Matrix4, Vector3 } from "three";
2
2
 
3
- export interface CSMFrustumVerticies {
3
+ export interface CSMFrustumVertices {
4
4
  near: Vector3[];
5
5
  far: Vector3[];
6
6
  }
7
7
 
8
8
  export interface CSMFrustumParameters {
9
- webGL?: boolean;
10
- projectionMatrix?: Matrix4;
11
- maxFar?: number;
9
+ /**
10
+ * - Whether this CSM frustum is used with WebGL or WebGPU.
11
+ */
12
+ webGL?: boolean | undefined;
13
+ /**
14
+ * - Whether reversed depth buffer is enabled.
15
+ */
16
+ reversedDepth?: boolean | undefined;
17
+ /**
18
+ * - A projection matrix usually of the scene's camera.
19
+ */
20
+ projectionMatrix?: Matrix4 | undefined;
21
+ /**
22
+ * - The maximum far value.
23
+ */
24
+ maxFar?: number | undefined;
12
25
  }
13
26
 
14
- declare class CSMFrustum {
15
- zNear: number;
16
- vertices: CSMFrustumVerticies;
17
-
27
+ /**
28
+ * Represents the frustum of a CSM instance.
29
+ *
30
+ * @three_import import { CSMFrustum } from 'three/addons/csm/CSMFrustum.js';
31
+ */
32
+ export class CSMFrustum {
33
+ /**
34
+ * Constructs a new CSM frustum.
35
+ *
36
+ * @param {CSMFrustum~Data} [data] - The CSM data.
37
+ */
18
38
  constructor(data?: CSMFrustumParameters);
19
-
20
- setFromProjectionMatrix(projectionMatrix: Matrix4, maxFar: number): CSMFrustumVerticies;
21
- split(breaks: number[], target: CSMFrustum[]): void;
39
+ /**
40
+ * The zNear value. This value depends on whether the CSM
41
+ * is used with WebGL or WebGPU. Both API use different
42
+ * conventions for their projection matrices.
43
+ *
44
+ * @type {number}
45
+ */
46
+ zNear: number;
47
+ /**
48
+ * The zFar value.
49
+ *
50
+ * @type {number}
51
+ */
52
+ zFar: number;
53
+ /**
54
+ * An object representing the vertices of the near and
55
+ * far plane in view space.
56
+ *
57
+ * @type {Object}
58
+ */
59
+ vertices: CSMFrustumVertices;
60
+ /**
61
+ * Setups this CSM frustum from the given projection matrix and max far value.
62
+ *
63
+ * @param {Matrix4} projectionMatrix - The projection matrix, usually of the scene's camera.
64
+ * @param {number} maxFar - The maximum far value.
65
+ * @returns {Object} An object representing the vertices of the near and far plane in view space.
66
+ */
67
+ setFromProjectionMatrix(projectionMatrix: Matrix4, maxFar: number): CSMFrustumVertices;
68
+ /**
69
+ * Splits the CSM frustum by the given array. The new CSM frustum are pushed into the given
70
+ * target array.
71
+ *
72
+ * @param {Array<number>} breaks - An array of numbers in the range `[0,1]` the defines how the
73
+ * CSM frustum should be split up.
74
+ * @param {Array<CSMFrustum>} target - The target array that holds the new CSM frustums.
75
+ */
76
+ split(breaks: Array<number>, target: Array<CSMFrustum>): void;
77
+ /**
78
+ * Transforms the given target CSM frustum into the different coordinate system defined by the
79
+ * given camera matrix.
80
+ *
81
+ * @param {Matrix4} cameraMatrix - The matrix that defines the new coordinate system.
82
+ * @param {CSMFrustum} target - The CSM to convert.
83
+ */
22
84
  toSpace(cameraMatrix: Matrix4, target: CSMFrustum): void;
23
85
  }
24
-
25
- export { CSMFrustum };
@@ -13,5 +13,5 @@ export interface DRACOExporterOptions {
13
13
  export class DRACOExporter {
14
14
  constructor();
15
15
 
16
- parse(object: Mesh | Points, options?: DRACOExporterOptions): Int8Array<ArrayBuffer>;
16
+ parseAsync(object: Mesh | Points, options?: DRACOExporterOptions): Promise<Int8Array<ArrayBuffer>>;
17
17
  }
@@ -34,7 +34,7 @@ export interface GLTFExporterOptions {
34
34
  /**
35
35
  * List of animations to be included in the export.
36
36
  */
37
- animations?: AnimationClip[];
37
+ animations?: AnimationClip[] | AnimationClip[][];
38
38
 
39
39
  /**
40
40
  * Generate indices for non-index geometry and export with them. Default is false.
@@ -88,7 +88,7 @@ declare class GLTFExporter {
88
88
  parse(
89
89
  input: Object3D | Object3D[],
90
90
  onDone: (gltf: ArrayBuffer | { [key: string]: unknown }) => void,
91
- onError: (error: ErrorEvent) => void,
91
+ onError: ((error: ErrorEvent) => void) | null,
92
92
  options?: GLTFExporterOptions,
93
93
  ): void;
94
94
 
@@ -1,8 +1,9 @@
1
1
  import { Object3D } from "three";
2
2
 
3
3
  export interface PLYExporterOptionsBase {
4
- excludeAttributes?: string[];
5
- littleEndian?: boolean;
4
+ excludeAttributes?: string[] | undefined;
5
+ littleEndian?: boolean | undefined;
6
+ customPropertyMapping?: Record<string, string[]>;
6
7
  }
7
8
 
8
9
  export interface PLYExporterOptionsBinary extends PLYExporterOptionsBase {
@@ -10,11 +11,11 @@ export interface PLYExporterOptionsBinary extends PLYExporterOptionsBase {
10
11
  }
11
12
 
12
13
  export interface PLYExporterOptionsString extends PLYExporterOptionsBase {
13
- binary?: false;
14
+ binary?: false | undefined;
14
15
  }
15
16
 
16
17
  export interface PLYExporterOptions extends PLYExporterOptionsBase {
17
- binary?: boolean;
18
+ binary?: boolean | undefined;
18
19
  }
19
20
 
20
21
  export class PLYExporter {
@@ -1,4 +1,4 @@
1
- import { Object3D } from "three";
1
+ import { AnimationClip, Object3D } from "three";
2
2
  import * as WebGLTextureUtils from "../utils/WebGLTextureUtils.js";
3
3
  import * as WebGPUTextureUtils from "../utils/WebGPUTextureUtils.js";
4
4
 
@@ -8,6 +8,8 @@ export interface USDZExporterOptions {
8
8
  onlyVisible?: boolean | undefined;
9
9
  quickLookCompatible?: boolean | undefined;
10
10
  maxTextureSize?: number | undefined;
11
+ animations?: AnimationClip[] | undefined;
12
+ animationFrameRate?: number | undefined;
11
13
  }
12
14
 
13
15
  export class USDZExporter {
@@ -15,6 +17,8 @@ export class USDZExporter {
15
17
 
16
18
  constructor();
17
19
 
20
+ setTextureUtils(textureUtils: typeof WebGLTextureUtils | typeof WebGPUTextureUtils | null): void;
21
+
18
22
  parse(
19
23
  scene: Object3D,
20
24
  onDone: (result: Uint8Array<ArrayBuffer>) => void,
@@ -0,0 +1,75 @@
1
+ import { Group, Material, MeshStandardNodeMaterial } from "three/webgpu";
2
+ import { SidewalkGenerator } from "./city/SidewalkGenerator.js";
3
+ import { SkyscraperGenerator } from "./city/SkyscraperGenerator.js";
4
+
5
+ export interface CityGeneratorParameters {
6
+ seed: number;
7
+ street: number;
8
+ lot: number;
9
+ lotsX: number;
10
+ lotsZ: number;
11
+ blocksX: number;
12
+ blocksZ: number;
13
+ curbHeight: number;
14
+ curbRadius: number;
15
+ }
16
+
17
+ export interface CityGeneratorLayout {
18
+ street: number;
19
+ lot: number;
20
+ lotsX: number;
21
+ lotsZ: number;
22
+ blocksX: number;
23
+ blocksZ: number;
24
+ blockW: number;
25
+ blockD: number;
26
+ cityW: number;
27
+ cityD: number;
28
+ }
29
+
30
+ export interface CityGeneratorMaterials {
31
+ building?: Material | undefined;
32
+ }
33
+
34
+ /**
35
+ * Lays out a grid of city blocks and fills each lot with a {@link SkyscraperGenerator}
36
+ * tower of its own seed, height and footprint, optionally on raised sidewalk
37
+ * slabs (curbs). Returns a `THREE.Group` ready to add to a scene.
38
+ *
39
+ * Pass a building material to dress the towers; the sidewalks dress themselves
40
+ * via {@link SidewalkGenerator}. The layout is exposed as
41
+ * {@link CityGenerator#layout} so the surrounding scene (road markings, etc.)
42
+ * can align to the same grid.
43
+ *
44
+ * ```js
45
+ * const city = new CityGenerator( { seed: 1 } );
46
+ * scene.add( city.build( materials ) );
47
+ * ```
48
+ */
49
+ export class CityGenerator {
50
+ constructor(parameters?: Partial<CityGeneratorParameters>);
51
+
52
+ parameters: CityGeneratorParameters;
53
+ layout: CityGeneratorLayout;
54
+
55
+ generators: SkyscraperGenerator[];
56
+ sidewalk: SidewalkGenerator;
57
+ group: Group | null;
58
+
59
+ build(materials?: CityGeneratorMaterials): Group;
60
+ dispose(): void;
61
+
62
+ static defaults: CityGeneratorParameters;
63
+ }
64
+
65
+ /**
66
+ * The shared material every tower in a {@link CityGenerator} is dressed with: one flat
67
+ * masonry colour per lot, picked from a palette by hashing the lot's grid cell.
68
+ */
69
+ export function createBuildingMaterial(layout: CityGeneratorLayout, seed?: number): MeshStandardNodeMaterial;
70
+
71
+ /**
72
+ * The road surface: wet asphalt with lane lines and crosswalks aligned to a
73
+ * {@link CityGenerator} layout. Apply it to a ground plane sized to the city.
74
+ */
75
+ export function createRoadMaterial(layout: CityGeneratorLayout): MeshStandardNodeMaterial;
@@ -0,0 +1,79 @@
1
+ import { Group, InstancedMesh, MeshStandardNodeMaterial, Node, UniformNode, Vector3 } from "three/webgpu";
2
+ import { TerrainGenerator } from "./TerrainGenerator.js";
3
+
4
+ export interface ForestGeneratorParameters {
5
+ seed: number;
6
+ count: number;
7
+ detail: number;
8
+ radius: number;
9
+ height: number;
10
+ distortion: number;
11
+ sink: number;
12
+ altitudeMin: number;
13
+ altitudeMax: number;
14
+ minSlope: number;
15
+ densityFrequency: number;
16
+ minScale: number;
17
+ maxScale: number;
18
+ from: number;
19
+ to: number;
20
+ castShadow: boolean;
21
+ }
22
+
23
+ /**
24
+ * Carpets a {@link TerrainGenerator} ( or anything exposing `sampleHeight`,
25
+ * `sampleSlope`, `minY`, `maxY` and `parameters.size` ) with a forest of hundreds
26
+ * of thousands of trees in a single draw call.
27
+ *
28
+ * Each tree is the cheapest thing that still reads as a tree: a ~20-face icosphere
29
+ * squashed into a tapered teardrop and lumped with a little noise, carrying a baked
30
+ * dark-base / bright-top gradient. Tens of triangles each, so a single
31
+ * {@link THREE.InstancedMesh} of half a million of them costs one draw call. Trees
32
+ * are placed by rejection sampling against ecological rules — a min/max altitude
33
+ * band ( above the mist floor, below the snowline ), a slope limit ( none on
34
+ * cliffs ) and a low-frequency density mask that opens clearings — then jittered in
35
+ * yaw, lean and ( squared-biased ) scale so the stand never reads as copies.
36
+ *
37
+ * ```js
38
+ * const forest = new ForestGenerator( { count: 500000 } );
39
+ * scene.add( forest.build( terrain ) );
40
+ * ```
41
+ */
42
+ export class ForestGenerator {
43
+ constructor(parameters?: Partial<ForestGeneratorParameters>);
44
+
45
+ parameters: ForestGeneratorParameters;
46
+
47
+ from: UniformNode<"float", number>;
48
+ to: UniformNode<"float", number>;
49
+
50
+ material: MeshStandardNodeMaterial;
51
+ mesh: InstancedMesh | null;
52
+ group: Group | null;
53
+
54
+ build(terrain: TerrainGenerator): Group;
55
+ setCameraPosition(position: Vector3): void;
56
+ dispose(): void;
57
+
58
+ static defaults: ForestGeneratorParameters;
59
+ }
60
+
61
+ /**
62
+ * The single material shared by every tree in a {@link ForestGenerator}. A plain
63
+ * MeshStandardNodeMaterial lit by the scene — only the surface is authored: deep
64
+ * shadowed green in the recesses rising to a bright, yellow-green sunlit crown,
65
+ * mottled into needle clumps by 3D noise, with a matching bump so the clumps catch
66
+ * the light. Half a million instanced blobs makes this mesh vertex-bound, so the
67
+ * regional colour drift is baked to a per-instance attribute ( no shader noise for it ),
68
+ * and the costly clump noise + bump are **gated by distance** — full detail on the near
69
+ * trees ( where it reads ), skipped on the far canopy ( where it is sub-pixel ).
70
+ *
71
+ * @param {Node} from - distance within which every tree is drawn.
72
+ * @param {Node} to - distance past which no tree is drawn.
73
+ * @return {MeshStandardNodeMaterial}
74
+ */
75
+ export function createForestMaterial(
76
+ from: Node<"float">,
77
+ to: Node<"float">,
78
+ camPos: Node<"vec3">,
79
+ ): MeshStandardNodeMaterial;
@@ -0,0 +1,67 @@
1
+ import { BufferGeometry, Group, MeshStandardNodeMaterial, UniformNode } from "three/webgpu";
2
+
3
+ export interface TerrainGeneratorParameters {
4
+ seed: number;
5
+ size: number;
6
+ segments: number;
7
+ heightScale: number;
8
+ frequency: number;
9
+ octaves: number;
10
+ lacunarity: number;
11
+ gain: number;
12
+ erosion: number;
13
+ warp: number;
14
+ valleyBias: number;
15
+ seaLevel: number;
16
+ talus: number;
17
+ talusPasses: number;
18
+ }
19
+
20
+ /**
21
+ * Bakes a procedural mountain range into a single {@link THREE.BufferGeometry} and
22
+ * returns a `THREE.Group` ready to add to a scene.
23
+ *
24
+ * The heightfield is a derivative-damped fractal sum ( Quilez's fake erosion ): each
25
+ * octave is suppressed where the running slope is already steep, concentrating detail
26
+ * into weathered ridgelines, and a low-frequency domain warp makes those ridges
27
+ * meander. A few passes of thermal ( talus ) erosion then relax any slope past the
28
+ * angle of repose, settling the fractal's needle-spikes into real crests.
29
+ *
30
+ * The grid is triangulated with alternating quad diagonals ( a diamond pattern ), so a
31
+ * coarse mesh holds its silhouette without a one-way grain. The surface shades itself
32
+ * from altitude and slope in TSL — grass, forest, rock, scree and snow, with detail
33
+ * normals and aerial perspective — so no material or textures are needed.
34
+ *
35
+ * The baked height grid is exposed through {@link TerrainGenerator#sampleHeight} so a
36
+ * scattered forest ( or anything else ) can sit exactly on the surface.
37
+ *
38
+ * ```js
39
+ * const terrain = new TerrainGenerator( { seed: 1 } );
40
+ * scene.add( terrain.build() );
41
+ * ```
42
+ */
43
+ export class TerrainGenerator {
44
+ constructor(parameters?: Partial<TerrainGeneratorParameters>);
45
+
46
+ parameters: TerrainGeneratorParameters;
47
+
48
+ minHeight: UniformNode<"float", number>;
49
+ maxHeight: UniformNode<"float", number>;
50
+
51
+ material: MeshStandardNodeMaterial;
52
+ geometry: BufferGeometry | null;
53
+ group: Group | null;
54
+
55
+ heights?: Float32Array;
56
+ gridSize?: number;
57
+ minY?: number;
58
+ maxY?: number;
59
+
60
+ build(): Group;
61
+
62
+ sampleHeight(x: number, z: number): number;
63
+ sampleSlope(x: number, z: number): number;
64
+ dispose(): void;
65
+
66
+ static defaults: TerrainGeneratorParameters;
67
+ }
@@ -0,0 +1,97 @@
1
+ import { Color, Material, Mesh, MeshStandardNodeMaterial, Node } from "three/webgpu";
2
+
3
+ export interface TreeGeneratorParameters {
4
+ seed: number;
5
+ levels: number;
6
+ children: number[];
7
+ branchAngle: number[];
8
+ angleVariance: number;
9
+ lengthRatio: number;
10
+ trunkLength: number;
11
+ trunkRadius: number;
12
+ taper: number;
13
+ taperCurve: number;
14
+ rootFlare: number;
15
+ flareFrac: number;
16
+ radiusExponent: number;
17
+ minRadius: number;
18
+ minLength: number;
19
+ droop: number;
20
+ upPull: number;
21
+ gnarl: number[];
22
+ radialSegments: number;
23
+ sectionLength: number;
24
+ childStart: number;
25
+ trunkClear: number;
26
+ }
27
+
28
+ /**
29
+ * Grows a procedural tree skeleton — trunk, branches and twigs, each swept as a tapered
30
+ * tube — and bakes it into one non-indexed {@link BufferGeometry} (position and normal
31
+ * only), ready to instance into a forest. It produces *branches only*; add foliage as a
32
+ * separate layer.
33
+ *
34
+ * The branching is deterministic for a given `seed`: a recursive sweep lays down gently
35
+ * curved tubes with a parallel-transport frame (so they never twist), forking by the
36
+ * pipe model (each child much thinner than its parent), spreading children along the
37
+ * upper part of each branch with a golden-angle roll, and pulling them back up toward
38
+ * the light. A flared root, non-linear taper and gravity droop fill in the character.
39
+ *
40
+ * Parameters are set with a fluent builder: a `set<Param>()` exists for every default
41
+ * ( `setSeed`, `setLevels`, `setChildren`, … ), each returning `this` for chaining.
42
+ *
43
+ * Each `build()` returns a fresh, independent mesh that the caller owns, so one
44
+ * generator can be re-parametrized and built repeatedly to grow a varied stand:
45
+ *
46
+ * ```js
47
+ * const generator = new TreeGenerator( material );
48
+ * const oak = generator.setSeed( 1 ).setLevels( 4 ).build();
49
+ * const pine = generator.setSeed( 2 ).setLevels( 5 ).build();
50
+ * ```
51
+ */
52
+ export class TreeGenerator {
53
+ constructor(material?: Material | null);
54
+
55
+ material: Material | null;
56
+ parameters: Partial<TreeGeneratorParameters>;
57
+
58
+ build(): Mesh;
59
+
60
+ static defaults: TreeGeneratorParameters;
61
+
62
+ setSeed: (seed: number) => this;
63
+ setLevels: (levels: number) => this;
64
+ setChildren: (children: number[]) => this;
65
+ setBranchAngle: (branchAngle: number[]) => this;
66
+ setAngleVariance: (angleVariance: number) => this;
67
+ setLengthRatio: (lengthRatio: number) => this;
68
+ setTrunkLength: (trunkLength: number) => this;
69
+ setTrunkRadius: (trunkRadius: number) => this;
70
+ setTaper: (taper: number) => this;
71
+ setTaperCurve: (taperCurve: number) => this;
72
+ setRootFlare: (rootFlare: number) => this;
73
+ setFlareFrac: (flareFrac: number) => this;
74
+ setRadiusExponent: (radiusExponent: number) => this;
75
+ setMinRadius: (minRadius: number) => this;
76
+ setMinLength: (minLength: number) => this;
77
+ setDroop: (droop: number) => this;
78
+ setUpPull: (upPull: number) => this;
79
+ setGnarl: (gnarl: number[]) => this;
80
+ setRadialSegments: (radialSegments: number) => this;
81
+ setSectionLength: (sectionLength: number) => this;
82
+ setChildStart: (childStart: number) => this;
83
+ setTrunkClear: (trunkClear: number) => this;
84
+ }
85
+
86
+ export interface TreeMaterialParameters {
87
+ barkColor?: Color | number | Node<"color"> | undefined;
88
+ }
89
+
90
+ /**
91
+ * A simple bark material for a {@link TreeGenerator} mesh: a low-saturation brown with a
92
+ * faint, vertically-stretched grain, so trunks read near-black against bright fog.
93
+ *
94
+ * @param {Object} [parameters] - `barkColor` ( a hex, THREE.Color or TSL node ).
95
+ * @return {MeshStandardNodeMaterial}
96
+ */
97
+ export function createTreeMaterial(parameters?: TreeMaterialParameters): MeshStandardNodeMaterial;
@@ -0,0 +1,40 @@
1
+ import { Group, Matrix4, MeshStandardNodeMaterial } from "three/webgpu";
2
+
3
+ export interface SidewalkGeneratorParameters {
4
+ width: number;
5
+ depth: number;
6
+ height: number;
7
+ radius: number;
8
+ curbWidth: number;
9
+ curbLip: number;
10
+ }
11
+
12
+ /**
13
+ * Generates the raised sidewalk for a city's blocks: per block, a rounded-corner concrete
14
+ * slab rimmed by a distinct granite kerbstone that stands proud of the walking surface and
15
+ * drops to the road. Instanced across a list of placements and dressed with its own
16
+ * procedural material ( poured concrete flags, scored expansion joints, granite curb ).
17
+ * Returns a `THREE.Group` of two instanced meshes — the walking slab and the curb.
18
+ *
19
+ * Unlike the building generator, this one owns its materials: the slab and curb
20
+ * geometry and the TSL that shades them live together here.
21
+ *
22
+ * ```js
23
+ * const sidewalk = new SidewalkGenerator( { width: 90, depth: 60, height: 0.5 } );
24
+ * scene.add( sidewalk.build( placements ) ); // placements: Matrix4[]
25
+ * ```
26
+ */
27
+ export class SidewalkGenerator {
28
+ constructor(parameters?: Partial<SidewalkGeneratorParameters>);
29
+
30
+ parameters: SidewalkGeneratorParameters;
31
+
32
+ material: MeshStandardNodeMaterial | null;
33
+ curbMaterial: MeshStandardNodeMaterial | null;
34
+ mesh: Group | null;
35
+
36
+ build(placements: Matrix4[]): Group;
37
+ dispose(): void;
38
+
39
+ static defaults: SidewalkGeneratorParameters;
40
+ }