@drawcall/lod 0.3.0 → 0.4.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 (204) hide show
  1. package/README.md +5 -8
  2. package/dist/bake.d.ts +16 -2
  3. package/dist/bake.js +92 -4
  4. package/dist/bake.js.map +1 -1
  5. package/dist/baked/index.d.ts +2 -2
  6. package/dist/baked/index.js +2 -2
  7. package/dist/baked/interior/faces.js +4 -2
  8. package/dist/baked/interior/faces.js.map +1 -1
  9. package/dist/baked/interior/material.js +1 -1
  10. package/dist/baked/interior/material.js.map +1 -1
  11. package/dist/baked/interior/rooms.d.ts +1 -1
  12. package/dist/baked/interior/rooms.js +1 -1
  13. package/dist/dispose.d.ts +3 -3
  14. package/dist/dispose.js +6 -6
  15. package/dist/dispose.js.map +1 -1
  16. package/dist/foliage.d.ts +32 -0
  17. package/dist/foliage.js +137 -0
  18. package/dist/foliage.js.map +1 -0
  19. package/dist/impostor/bake/index.d.ts +3 -3
  20. package/dist/impostor/bake/index.js +12 -3
  21. package/dist/impostor/bake/index.js.map +1 -1
  22. package/dist/impostor/bake/source.d.ts +2 -1
  23. package/dist/impostor/bake/source.js +2 -2
  24. package/dist/impostor/bake/source.js.map +1 -1
  25. package/dist/impostor/impostor.d.ts +1 -1
  26. package/dist/impostor/impostor.js +1 -1
  27. package/dist/impostor/ktx2/encode.js +5 -2
  28. package/dist/impostor/ktx2/encode.js.map +1 -1
  29. package/dist/impostor/ktx2/uastc.js +3 -2
  30. package/dist/impostor/ktx2/uastc.js.map +1 -1
  31. package/dist/impostor/ktx2/worker.js +0 -2
  32. package/dist/impostor/ktx2/worker.js.map +1 -1
  33. package/dist/impostor/mesh/card.d.ts +1 -1
  34. package/dist/impostor/mesh/index.d.ts +2 -2
  35. package/dist/impostor/mesh/index.js +3 -3
  36. package/dist/impostor/mesh/index.js.map +1 -1
  37. package/dist/index.d.ts +3 -6
  38. package/dist/index.js +3 -6
  39. package/dist/index.js.map +1 -1
  40. package/dist/instanced/camera.d.ts +13 -25
  41. package/dist/instanced/camera.js +17 -42
  42. package/dist/instanced/camera.js.map +1 -1
  43. package/dist/instanced/clusters.d.ts +54 -0
  44. package/dist/instanced/clusters.js +151 -0
  45. package/dist/instanced/clusters.js.map +1 -0
  46. package/dist/instanced/cull.d.ts +3 -3
  47. package/dist/instanced/cull.js +2 -2
  48. package/dist/instanced/cull.js.map +1 -1
  49. package/dist/instanced/instances.d.ts +39 -0
  50. package/dist/instanced/instances.js +104 -0
  51. package/dist/instanced/instances.js.map +1 -0
  52. package/dist/instanced/key.d.ts +1 -1
  53. package/dist/instanced/key.js +1 -1
  54. package/dist/instanced/key.js.map +1 -1
  55. package/dist/instanced/levels.d.ts +9 -9
  56. package/dist/instanced/levels.js +7 -6
  57. package/dist/instanced/levels.js.map +1 -1
  58. package/dist/instanced/lists.d.ts +26 -39
  59. package/dist/instanced/lists.js +42 -61
  60. package/dist/instanced/lists.js.map +1 -1
  61. package/dist/instanced/measure.d.ts +2 -2
  62. package/dist/instanced/measure.js +2 -2
  63. package/dist/instanced/meshes.d.ts +11 -9
  64. package/dist/instanced/meshes.js +26 -16
  65. package/dist/instanced/meshes.js.map +1 -1
  66. package/dist/instanced/mirror.d.ts +16 -12
  67. package/dist/instanced/mirror.js +51 -12
  68. package/dist/instanced/mirror.js.map +1 -1
  69. package/dist/instanced/raycast.d.ts +6 -9
  70. package/dist/instanced/raycast.js +15 -18
  71. package/dist/instanced/raycast.js.map +1 -1
  72. package/dist/instanced/rows.d.ts +15 -73
  73. package/dist/instanced/rows.js +16 -189
  74. package/dist/instanced/rows.js.map +1 -1
  75. package/dist/instanced/shape.d.ts +3 -1
  76. package/dist/instanced/shape.js +6 -3
  77. package/dist/instanced/shape.js.map +1 -1
  78. package/dist/instanced/sort.d.ts +32 -34
  79. package/dist/instanced/sort.js +162 -132
  80. package/dist/instanced/sort.js.map +1 -1
  81. package/dist/instanced/update.d.ts +16 -12
  82. package/dist/instanced/update.js +57 -84
  83. package/dist/instanced/update.js.map +1 -1
  84. package/dist/levels/compile/index.d.ts +4 -2
  85. package/dist/levels/compile/index.js +10 -2
  86. package/dist/levels/compile/index.js.map +1 -1
  87. package/dist/levels/compile/pipelines.d.ts +1 -1
  88. package/dist/levels/compile/pipelines.js +1 -6
  89. package/dist/levels/compile/pipelines.js.map +1 -1
  90. package/dist/levels/draw.d.ts +1 -1
  91. package/dist/levels/draw.js +3 -3
  92. package/dist/levels/fade.d.ts +13 -22
  93. package/dist/levels/fade.js +17 -38
  94. package/dist/levels/fade.js.map +1 -1
  95. package/dist/levels/index.d.ts +7 -7
  96. package/dist/levels/index.js +1 -1
  97. package/dist/levels/item.d.ts +10 -10
  98. package/dist/levels/item.js +15 -23
  99. package/dist/levels/item.js.map +1 -1
  100. package/dist/levels/load.d.ts +1 -1
  101. package/dist/levels/load.js +5 -3
  102. package/dist/levels/load.js.map +1 -1
  103. package/dist/levels/manager.d.ts +30 -31
  104. package/dist/levels/manager.js +75 -62
  105. package/dist/levels/manager.js.map +1 -1
  106. package/dist/levels/material.d.ts +2 -2
  107. package/dist/levels/material.js +2 -2
  108. package/dist/levels/renderer.d.ts +8 -5
  109. package/dist/levels/renderer.js +20 -4
  110. package/dist/levels/renderer.js.map +1 -1
  111. package/dist/levels/requests.d.ts +4 -1
  112. package/dist/levels/requests.js +3 -1
  113. package/dist/levels/requests.js.map +1 -1
  114. package/dist/loader/context.d.ts +9 -11
  115. package/dist/loader/context.js +12 -7
  116. package/dist/loader/context.js.map +1 -1
  117. package/dist/loader/entry.d.ts +4 -0
  118. package/dist/loader/entry.js +43 -0
  119. package/dist/loader/entry.js.map +1 -0
  120. package/dist/loader/index.d.ts +49 -35
  121. package/dist/loader/index.js +123 -135
  122. package/dist/loader/index.js.map +1 -1
  123. package/dist/loader/level.js +5 -5
  124. package/dist/loader/level.js.map +1 -1
  125. package/dist/loader/node.d.ts +26 -0
  126. package/dist/loader/node.js +199 -0
  127. package/dist/loader/node.js.map +1 -0
  128. package/dist/loader/request.d.ts +11 -44
  129. package/dist/loader/request.js +7 -47
  130. package/dist/loader/request.js.map +1 -1
  131. package/dist/loader/url.d.ts +10 -9
  132. package/dist/loader/url.js +21 -17
  133. package/dist/loader/url.js.map +1 -1
  134. package/dist/lod.d.ts +122 -62
  135. package/dist/lod.js +331 -187
  136. package/dist/lod.js.map +1 -1
  137. package/dist/meshopt.d.ts +1 -1
  138. package/dist/meshopt.js +3 -2
  139. package/dist/meshopt.js.map +1 -1
  140. package/dist/node-process.d.ts +5 -0
  141. package/dist/node-process.js +6 -0
  142. package/dist/node-process.js.map +1 -0
  143. package/dist/node.d.ts +2 -0
  144. package/dist/node.js +5 -0
  145. package/dist/node.js.map +1 -0
  146. package/dist/simplify/index.d.ts +2 -2
  147. package/dist/simplify/index.js +7 -7
  148. package/dist/simplify/index.js.map +1 -1
  149. package/dist/source/detail.d.ts +7 -2
  150. package/dist/source/detail.js +24 -22
  151. package/dist/source/detail.js.map +1 -1
  152. package/dist/source/sampler.js +5 -2
  153. package/dist/source/sampler.js.map +1 -1
  154. package/dist/three.d.ts +7 -7
  155. package/dist/three.js +4 -4
  156. package/dist/three.js.map +1 -1
  157. package/dist/wind/bounds.js +1 -1
  158. package/dist/wind/bounds.js.map +1 -1
  159. package/dist/wind/hooks.d.ts +1 -1
  160. package/dist/wind/hooks.js +1 -1
  161. package/dist/wind/index.d.ts +3 -3
  162. package/dist/wind/index.js +11 -9
  163. package/dist/wind/index.js.map +1 -1
  164. package/package.json +10 -6
  165. package/skills/lod/SKILL.md +65 -54
  166. package/dist/gpu.d.ts +0 -39
  167. package/dist/gpu.js +0 -41
  168. package/dist/gpu.js.map +0 -1
  169. package/dist/instanced/chunk.d.ts +0 -97
  170. package/dist/instanced/chunk.js +0 -156
  171. package/dist/instanced/chunk.js.map +0 -1
  172. package/dist/instanced/chunks.d.ts +0 -60
  173. package/dist/instanced/chunks.js +0 -208
  174. package/dist/instanced/chunks.js.map +0 -1
  175. package/dist/instanced/index.d.ts +0 -120
  176. package/dist/instanced/index.js +0 -290
  177. package/dist/instanced/index.js.map +0 -1
  178. package/dist/instanced/pages/buffers.d.ts +0 -37
  179. package/dist/instanced/pages/buffers.js +0 -15
  180. package/dist/instanced/pages/buffers.js.map +0 -1
  181. package/dist/instanced/pages/chunk.d.ts +0 -51
  182. package/dist/instanced/pages/chunk.js +0 -81
  183. package/dist/instanced/pages/chunk.js.map +0 -1
  184. package/dist/instanced/pages/index.d.ts +0 -74
  185. package/dist/instanced/pages/index.js +0 -269
  186. package/dist/instanced/pages/index.js.map +0 -1
  187. package/dist/instanced/pages/passes.d.ts +0 -21
  188. package/dist/instanced/pages/passes.js +0 -52
  189. package/dist/instanced/pages/passes.js.map +0 -1
  190. package/dist/instanced/pages/slots.d.ts +0 -11
  191. package/dist/instanced/pages/slots.js +0 -90
  192. package/dist/instanced/pages/slots.js.map +0 -1
  193. package/dist/instanced/pages/workgroup.d.ts +0 -14
  194. package/dist/instanced/pages/workgroup.js +0 -38
  195. package/dist/instanced/pages/workgroup.js.map +0 -1
  196. package/dist/levels/wait.d.ts +0 -27
  197. package/dist/levels/wait.js +0 -61
  198. package/dist/levels/wait.js.map +0 -1
  199. package/dist/loader/cache.d.ts +0 -12
  200. package/dist/loader/cache.js +0 -68
  201. package/dist/loader/cache.js.map +0 -1
  202. package/dist/loader/dependencies.d.ts +0 -32
  203. package/dist/loader/dependencies.js +0 -113
  204. package/dist/loader/dependencies.js.map +0 -1
package/dist/lod.d.ts CHANGED
@@ -1,38 +1,56 @@
1
- import { Object3D, type Camera, type Intersection, type LoadingManager, type Raycaster } from "three/webgpu";
2
- import type { LodGpu } from "./gpu.js";
1
+ import { Box3, Color, InstancedBufferAttribute, Matrix4, Object3D, type Camera, type Intersection, type LoadingManager, type Raycaster } from "three/webgpu";
3
2
  import { type LodLevel, type ThresholdedLevel } from "./levels/index.js";
4
3
  import { type LodEventMap } from "./levels/manager.js";
5
4
  import { WIND } from "./wind/hooks.js";
5
+ import { type LodCluster } from "./instanced/clusters.js";
6
+ import { type CullDistance } from "./instanced/cull.js";
7
+ /** How a Lod is made. */
6
8
  export interface LodOptions {
7
9
  /**
8
- * Gets an item while levels a camera needs load, compile or fade in, ended once they are complete. Without one, a
9
- * Lod nested in another's level reports to that one's, any other to three's `DefaultLoadingManager`. Wait for a
10
- * quiet frame, one in which no item started or ended, rendering (or compiling) the Scene that holds the Lod a frame
11
- * apart meanwhile, to capture what a camera sees complete. A Lod its renderer rendered around for a frame without
12
- * updating it ends its item, and its next update starts it again. Renders of other scenes in a separate task can end
13
- * the item early, and the next update reopens it; a renderer that only compiles leaves a hidden Lod's item held.
10
+ * Gets an item while levels a camera needs load, compile or fade in, ended once they are complete; three's
11
+ * `DefaultLoadingManager` without one. Wait for a quiet frame, one in which no item started or ended, rendering (or
12
+ * compiling) the Scene that holds the Lod a frame apart meanwhile, to capture what a camera sees complete. A Lod its
13
+ * renderer rendered around for a frame without updating it ends its item, and its next update starts it again.
14
+ * Renders of other scenes in a separate task can end the item early, and the next update reopens it; a renderer that
15
+ * only compiles leaves a hidden Lod's item held.
14
16
  */
15
17
  manager?: LoadingManager;
16
18
  }
17
19
  /**
18
- * One object's levels, switched by on-screen height with dithered fades. three's renderer calls `update` with each
19
- * camera before it draws, shadow maps' included; each camera measures at the height it draws at, measured in each
20
- * render (outside one, the canvas's). Orthographic cameras switch without fading. Shadows follow what the camera draws
21
- * and omit casters smaller than a shadow texel; levels cast into three's shadow maps, not into a light whose shadow
22
- * map a custom shadow node replaces. Nothing draws until the coarsest level that draws something has loaded, which
23
- * loads first; a deferred level loads when a camera first needs it, once that one has loaded, and meanwhile the
24
- * nearest loaded coarser level draws in its place.
20
+ * Copies of one object at levels of detail, driven like a three InstancedMesh: `instanceMatrix`, `instanceColor`,
21
+ * `count` and `boundingBox`, and `clusters` to cull and choose levels by. Each copy draws the level levelsToDraw gives
22
+ * for its height on screen, switching with dithered fades; each camera's instances are sorted into indirect draws on
23
+ * the GPU. `new Lod(levels)` is one object at the Lod's own transform.
25
24
  *
26
- * Arriving levels' texture uploads are paced to about one uncompressed 2048² RGBA texture's bytes per frame. Levels
27
- * are cloned into the Lod. A nested Lod switches and fades its own levels. Lines, points and sprites draw without
28
- * fading. Raycasts hit the source only. A Lod draws with its LodGpu's renderer only.
25
+ * The attributes are assignable. A CPU attribute's edits draw once its `needsUpdate` is set (within its update ranges,
26
+ * which the Lod takes and clears), as an InstancedMesh's do. A StorageInstancedBufferAttribute, such as one the app's
27
+ * compute pass writes, is read in place, every frame; a storage colour holds four floats per instance. A matrix of
28
+ * scale 0 draws nothing. Instance matrices may scale arbitrarily; the Lod's own transform and its parents should scale
29
+ * uniformly.
29
30
  *
30
- * Build a new Lod after adding or moving meshes within a level: geometry is measured and hooked at construction or
31
- * arrival. Skinned meshes and ShaderMaterials are refused; use static meshes with node materials or supported built-in
32
- * materials.
31
+ * Which levels load and which level meshes draw for a camera follow from the instances' bounds: per cluster, its box
32
+ * and scales; without clusters, `boundingBox` around the first `count` instances, else what the CPU measures of a CPU
33
+ * instanceMatrix. With clusters, only their instances draw. A storage instanceMatrix with neither loads every level
34
+ * (it warns once). Each camera draws only the instances in its frustum, and each shadow map is a camera of its own: it
35
+ * draws the casters in its frustum, each at the level its texels resolve, as an orthographic camera would (an instance
36
+ * smaller than a texel casts nothing). Thresholds, fades and loading follow `LodLevel`; `cullDistance` thins the
37
+ * instances out with distance. Nothing draws until the coarsest level that draws something has loaded, which loads
38
+ * first; a deferred level loads when a camera first needs it, and meanwhile the nearest loaded coarser level draws in
39
+ * its place. Arriving levels' texture uploads are paced to about one uncompressed 2048² RGBA texture's bytes per frame.
40
+ *
41
+ * It draws with WebGPU only (three's WebGPURenderer on its WebGPU backend, with `indirect-first-instance`), with the
42
+ * first renderer that draws it: it learns of it in that renderer's first frame, which draws nothing of it, and another
43
+ * renderer drawing it is its error. Sequential cameras are supported; a nested render with a camera that the outer
44
+ * render also draws with replaces that camera's instance lists, so exclude the Lod from it with camera layers.
45
+ *
46
+ * Level templates are cloned, then their meshes are instanced, as children of the Lod on its layers; it sets each
47
+ * one's `visible` per camera, so hide the Lod itself, never its level meshes. Skinned meshes, InstancedMeshes (except ImpostorMesh),
48
+ * lines, points, sprites and LODs in levels are refused, as are ShaderMaterials; use static meshes with node materials
49
+ * or supported built-in materials. Build a new Lod after adding or moving meshes within a level: geometry is measured
50
+ * at construction or arrival. For external detail, leave level 0 empty and draw the instances that `getLevelAt`
51
+ * reports there.
33
52
  */
34
53
  export declare class Lod extends Object3D<LodEventMap> {
35
- private readonly gpu;
36
54
  /** Multiplies every measured height: below 1, cheaper levels take over sooner. */
37
55
  static quality: number;
38
56
  /** Tint every level by its index, to see which level draws where. */
@@ -40,69 +58,111 @@ export declare class Lod extends Object3D<LodEventMap> {
40
58
  /** Share of a level's range its fade spans: from `maxPixels × (1 - fade)` up to its `maxPixels`, the finer level draws too. */
41
59
  static readonly fade = 0.1;
42
60
  readonly isLOD = true;
61
+ readonly isLod = true;
43
62
  /** Let the renderer call `update` with its camera every frame. */
44
63
  autoUpdate: boolean;
45
64
  /** Draw only this level, without fades, once the coarsest level that draws something has loaded. */
46
65
  forceLevel: number | null;
47
- /** The levels, each `object` this Lod's own copy once there is one. Set `maxPixels` to move a switch. */
66
+ /** The levels, each `object` the template its level meshes are made from, once there is one (never in the scene). */
48
67
  readonly levels: ThresholdedLevel[];
68
+ /** Thins the instances out with distance from a camera, in every camera; null draws them at any distance. */
69
+ cullDistance: CullDistance | null;
70
+ /** 16 floats per instance: a CPU InstancedBufferAttribute (identities to start with) or a storage one. */
71
+ instanceMatrix: InstancedBufferAttribute;
72
+ /** RGB per instance, white without: three floats on the CPU, four in a storage attribute. */
73
+ instanceColor: InstancedBufferAttribute | null;
74
+ /** How many of `instanceMatrix`'s instances draw. */
75
+ count: number;
76
+ /** Bounds every instance at every level, in the Lod's space (see `computeBoundingBox`); measured when null. */
77
+ boundingBox: Box3 | null;
78
+ /** Disjoint ranges of instances, each inside its box, which cull and choose levels apart; clipped to `count`. */
79
+ clusters: LodCluster[] | undefined;
49
80
  /** The levels as they were given, which a copy is made from. */
50
81
  private inputs;
51
- /** Per level, where its meshes' fade comes from. */
52
- private readonly fades;
53
- /** Per level, whether its object is a Lod, which fades its own levels. */
54
- private readonly nested;
55
- /**
56
- * Per loaded level, what in it may cast (see `shadowCasters`): found when it is built or joins, read every shadow
57
- * map.
58
- */
59
- private readonly casters;
60
- /** The levels as levelsToDraw reads them. */
61
- private encoded;
62
- /** Bounding sphere of the source (see `measureLevels`) in the Lod's own space. */
63
- private sphere;
64
- private casterRadius;
65
- private loads;
82
+ /** What it is made of for its levels, which a copy makes anew. */
83
+ private built;
66
84
  private disposed;
85
+ private readonly instances;
86
+ /** What the level meshes draw. */
87
+ private readonly drawn;
88
+ /** Around every instance, survivors grown: what every level mesh is culled and boxed by. */
89
+ private readonly bounds;
90
+ private readonly view;
91
+ /** The cluster ranges last checked to be disjoint. */
92
+ private readonly checked;
93
+ /** What `cullIn` writes cullDistance into, in this Lod's space. */
94
+ private readonly cull;
67
95
  /**
68
- * `levels[0]` is the source. Empty only as the target of `copy`. A source that draws nothing (an empty Object3D, for
69
- * detail another system draws) is measured by the first level that draws something. `gpu` is what it shares with
70
- * every Lod drawing with its renderer.
96
+ * Drawn until a renderer has drawn the Lod, to learn which: three tells a mesh its renderer, but not a LOD. It bounds
97
+ * the instances for Box3.setFromObject, as the level meshes do once there are some.
71
98
  */
72
- constructor(levels: readonly LodLevel[], gpu: LodGpu, options?: LodOptions);
73
- private build;
74
- /** Fade the meshes under `node` by `fade`; an inner Lod fades its own. */
75
- private hook;
76
- /** A copy of `loaded`, level `index`'s object, parented hidden for world matrices and wind until it joins. */
77
- private prepare;
99
+ private readonly sentinel;
100
+ private warned;
101
+ /** `levels[0]` is the source; empty only as the target of `copy`. `count` instances, at the Lod's origin to start with. */
102
+ constructor(levels: readonly LodLevel[], count?: number, options?: LodOptions);
78
103
  get pending(): boolean;
79
104
  get error(): Error | undefined;
80
105
  /** Where the item of levels a camera misses goes (see `LodOptions.manager`). */
81
106
  get manager(): LoadingManager;
82
107
  set manager(manager: LoadingManager | undefined);
83
- /** Switch and fade the levels for `camera`, and load those it needs. What fails is reported (see `error`): three is rendering. */
108
+ setMatrixAt(index: number, matrix: Matrix4): this;
109
+ getMatrixAt(index: number, matrix: Matrix4): Matrix4;
110
+ /** Write instance `index`'s colour, making a white `instanceColor` for every instance first if there is none. */
111
+ setColorAt(index: number, color: Color): this;
112
+ /** Instance `index`'s colour: white without `instanceColor`. */
113
+ getColorAt(index: number, color: Color): Color;
114
+ /**
115
+ * Set `boundingBox` around the first `count` instances at every level and its sway, from a CPU instanceMatrix as it
116
+ * is now; the CPU cannot read a storage one.
117
+ */
118
+ computeBoundingBox(): void;
119
+ /** What this Lod is made of for `inputs`: its levels, their meshes and their loading. */
120
+ private init;
121
+ /**
122
+ * The sentinel, drawn until a renderer has drawn the Lod (see `see`): no instances, on the Lod's layers, casting, and
123
+ * never hit by a raycast. Its box is the instances' bounds, and its vertices that box's corners (see `placeSentinel`),
124
+ * which precise Box3.setFromObject reads.
125
+ */
126
+ private makeSentinel;
127
+ /** `renderer`, which three hands a mesh's draw, draws the Lod (see `LodLevelLoadManager.see`): it, once checked. */
128
+ private see;
129
+ [WIND](padding: number, slope: number, baseY: number): void;
130
+ /** Take in the instances as they are now, so that its level meshes bound them (see Box3.setFromObject), then update the world matrices. */
131
+ updateMatrixWorld(force?: boolean): void;
132
+ /** Sort the instances into level lists for `camera`, a camera's or a shadow map's, and load the levels they need. What fails is reported (see `error`). */
84
133
  update(camera: Camera): void;
85
- /** Show the levels for `camera`, a shadow map's when `shadow`. */
86
- private show;
87
- /** The source's height on `camera`'s screen, and the levels as levelsToDraw reads them there. */
88
- private measure;
134
+ /** Take in the attributes, clusters and cullDistance as they are now, and bound the instances. */
135
+ private refresh;
136
+ /** Put the sentinel's vertices at the corners of the instances' bounds; at the origin while nothing bounds them. */
137
+ private placeSentinel;
138
+ /** Sort for `camera`, a shadow map's when `shadow`, drawn by `renderer`. */
139
+ private sort;
140
+ /** `camera` in this Lod's space, drawn by `renderer` (see `localCamera`). */
141
+ private localCamera;
142
+ /**
143
+ * The level that draws most of instance `index`'s pixels for `camera` from where it is now, with the levels loaded
144
+ * now and no arrival under way (see `drawnLevel`); null at scale 0, thinned out by `cullDistance`, or while no level
145
+ * it could draw is loaded. From the CPU instanceMatrix as it is, edits not yet drawn included; the CPU cannot read a
146
+ * storage one. It measures with the renderer drawing the Lod, so it throws before one has drawn it.
147
+ */
148
+ getLevelAt(index: number, camera: Camera): number | null;
89
149
  /**
90
- * The index of the level that draws most of the Lod's pixels for `camera` from where it is, with the levels loaded
91
- * now and no arrival under way (see `drawnLevel`); null while no level it could draw is loaded.
150
+ * Hits the first `count` instances on the source level, with `instanceId` set as on an InstancedMesh's hits; `object`
151
+ * is this Lod. Instances of a storage instanceMatrix, which the CPU cannot read, are not hit. Its level meshes, on its
152
+ * layers, are never hit themselves.
92
153
  */
93
- getLevel(camera: Camera): number | null;
94
- [WIND](padding: number): void;
95
- raycast(raycaster: Raycaster, intersects: Intersection[]): boolean;
154
+ raycast(raycaster: Raycaster, intersects: Intersection[]): void;
96
155
  /**
97
- * Copies `source`'s levels into this empty Lod (it throws otherwise). The copies share geometry, materials and
98
- * textures with `source`, as three's clone does; the settings, LoadingManager, wind and each level's `maxPixels`
99
- * come along.
156
+ * Copies `source`'s levels, instances and settings into this Lod without levels (it throws otherwise); the copy
157
+ * shares geometry and textures with `source`, and holds copies of its attributes and clusters. Storage attributes
158
+ * cannot be copied: their instances live on the GPU.
100
159
  */
101
160
  copy(source: Lod): this;
102
161
  clone(): this;
103
162
  /**
104
- * Release what the Lod made of its levels, once nothing it prepares or compiles still uses them. Objects you give or
105
- * load are yours to dispose; LodLoader's are freed when the last Lod holding them is disposed (see `LodLevel.hold`).
163
+ * Release its buffers and what it made of its levels, once nothing it prepares or compiles still uses them. Objects
164
+ * you give or load, its attributes among them, are yours to dispose; CachedLodLoader's are freed when the last Lod
165
+ * holding them is disposed (see `LodLevel.hold`).
106
166
  */
107
167
  dispose(): void;
108
168
  }