@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
@@ -1,120 +0,0 @@
1
- import { Object3D, type Camera, type Intersection, type LoadingManager, type Raycaster } from "three/webgpu";
2
- import { type LodLevel, type ThresholdedLevel } from "../levels/index.js";
3
- import { type LodEventMap } from "../levels/manager.js";
4
- import type { LodGpu } from "../gpu.js";
5
- import { type LodOptions } from "../lod.js";
6
- import { WIND } from "../wind/hooks.js";
7
- import type { InstancedLodChunk, InstancedLodChunkParameters } from "./chunk.js";
8
- import { type CullDistance } from "./cull.js";
9
- /** How an InstancedLod is made. */
10
- export interface InstancedLodOptions extends LodOptions {
11
- /**
12
- * The most instances it draws for a camera, over all its chunks, CPU and GPU chunks alike: 16384 by default. Its
13
- * lists take 8 bytes per level that draws something per instance (about 400 KB with the defaults and three levels),
14
- * and every camera that draws any InstancedLod of its LodGpu, each shadow map's included, holds the lists of every
15
- * InstancedLod of that LodGpu. A camera that draws only a few InstancedLods, such as a minimap's or a reflection's,
16
- * is bounded by giving those a LodGpu of their own. Chunks that together outgrow it are reported (see `error`),
17
- * naming it as the limit to raise. Its LodGpu's pool holds the instances themselves (see `LodGpuOptions`).
18
- */
19
- maxInstanceCount?: number;
20
- }
21
- /**
22
- * Independently drawn copies of one object, sorted into indirect draws per camera on the GPU. Instances arrive and
23
- * leave in chunks (see `addChunk`), from the CPU or written by the app's GPU passes; `cullDistance` thins them out with
24
- * distance. Thresholds, fades, loading and global settings follow Lod: each instance draws what levelsToDraw gives for
25
- * its height. Each camera draws only the instances in its frustum, and each shadow map is a camera of its own: it draws
26
- * the casters in its frustum, each at the level its texels resolve, as an orthographic camera would (an instance
27
- * smaller than a texel casts nothing). Instance matrices may scale arbitrarily; the InstancedLod's own transform and its
28
- * parents should scale uniformly. Scale 0 draws nothing.
29
- *
30
- * Level templates are cloned, then their meshes are instanced; it sets each level mesh's `visible` per camera, so hide
31
- * the InstancedLod itself, never its level meshes. Skinned meshes, InstancedMeshes (except ImpostorMesh)
32
- * and nested Lods are unsupported. For external detail, leave level 0 empty and draw the instances that
33
- * `chunk.getLevelAt` reports there.
34
- *
35
- * Every level mesh's `geometry.boundingBox` and `boundingSphere` bound all its instances, not one, so
36
- * `new Box3().setFromObject(lod)` bounds them once a level has loaded; with `precise` it walks a level's vertices once,
37
- * at no instance, as it cannot see them. Measure one instance by a level's `object`, scaled by its matrix.
38
- *
39
- * Instances live in its LodGpu's pool, and every InstancedLod of a LodGpu sorts for a camera in one compute call.
40
- * Requires WebGPU `indirect-first-instance`. Sequential cameras are supported; a nested render with a camera that the
41
- * outer render also draws with replaces that camera's instance lists, so exclude this InstancedLod from it with camera
42
- * layers.
43
- */
44
- export declare class InstancedLod extends Object3D<LodEventMap> {
45
- private readonly gpu;
46
- readonly isLOD = true;
47
- readonly isInstancedLod = true;
48
- /** Let the renderer call `update` with its camera every frame. */
49
- autoUpdate: boolean;
50
- /** Draw only this level, without fades, once the coarsest level that draws something has loaded. */
51
- forceLevel: number | null;
52
- /** The levels, each `object` the template its level meshes are made from, once there is one (never in the scene). */
53
- readonly levels: ThresholdedLevel[];
54
- /** Thins the instances out with distance from a camera, in every camera; null draws them at any distance. */
55
- cullDistance: CullDistance | null;
56
- /** The levels as they were given, which a copy is made from. */
57
- private inputs;
58
- /** What it is made of for its levels and sizes, which a copy makes anew. */
59
- private built;
60
- private disposed;
61
- /** Around every instance, survivors grown: what every level mesh is culled and boxed by. */
62
- private readonly bounds;
63
- /** What `cullIn` writes cullDistance into, in this InstancedLod's space. */
64
- private readonly cull;
65
- /**
66
- * `levels[0]` is the source. Empty only as the target of `copy`. It holds no instances until chunks are added. `gpu`
67
- * is what it shares with every Lod drawing with its renderer.
68
- */
69
- constructor(levels: readonly LodLevel[], gpu: LodGpu, options?: InstancedLodOptions);
70
- get pending(): boolean;
71
- get error(): Error | undefined;
72
- /** Where the item of levels a camera misses goes (see `LodOptions.manager`). */
73
- get manager(): LoadingManager;
74
- set manager(manager: LoadingManager | undefined);
75
- /** Its chunks, in the order they were added. */
76
- get chunks(): Iterable<InstancedLodChunk>;
77
- /** What this InstancedLod is made of for `inputs` and `maxInstanceCount`: its levels, their meshes and their loading. */
78
- private init;
79
- /**
80
- * Add `parameters`' instances as one chunk, from the CPU or the GPU (see `InstancedLodChunkParameters`). The next
81
- * render that updates this InstancedLod copies them into its pages. Its item (see `LodOptions.manager`) stays held
82
- * until the GPU shows every chunk copied; a chunk the pool lacks pages for draws the instances it got until it is
83
- * removed, and is this InstancedLod's error (see `error`).
84
- */
85
- addChunk(parameters: InstancedLodChunkParameters): InstancedLodChunk;
86
- /** Remove `chunk`'s instances; its pages return to the pool in the next render. */
87
- removeChunk(chunk: InstancedLodChunk): void;
88
- /** Bound every chunk's instances, survivors grown. */
89
- private measureBounds;
90
- [WIND](padding: number, slope: number, baseY: number): void;
91
- /** 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`). */
92
- update(camera: Camera): void;
93
- /** Sort for `camera`, a shadow map's when `shadow`. */
94
- private sort;
95
- /** `camera` in this InstancedLod's space (see `localCamera`). */
96
- private localCamera;
97
- /** Draw survivors' scaled matrices, or the pool's again. */
98
- private scaleSurvivors;
99
- /** The level instance `index` of `chunk` draws most of its pixels with for `camera` (see `InstancedLodChunk.getLevelAt`). */
100
- private levelAt;
101
- /**
102
- * Hits every instance of its CPU chunks on the source level, with `instanceId` and `chunk` set (see
103
- * `InstancedLodIntersection`); `object` is this InstancedLod. A GPU chunk's instances the CPU cannot see, and meshes
104
- * of the source on layers the raycaster does not test, are not hit.
105
- */
106
- raycast(raycaster: Raycaster, intersects: Intersection[]): boolean;
107
- /**
108
- * Copies `source`'s levels, CPU chunks and settings into this empty InstancedLod, one without levels or chunks (it
109
- * throws otherwise); the copy shares geometry and textures with `source`, and its chunks hold copies of the source's
110
- * attributes. A GPU chunk cannot be copied: its instances live on the GPU.
111
- */
112
- copy(source: InstancedLod): this;
113
- clone(): this;
114
- /**
115
- * Release its buffers and what it made of its levels, once nothing it prepares or compiles still uses them. Objects
116
- * you give or load, chunk attributes among them, are yours to dispose; LodLoader's are freed when the last Lod
117
- * holding them is disposed (see `LodLevel.hold`).
118
- */
119
- dispose(): void;
120
- }
@@ -1,290 +0,0 @@
1
- import { Box3, Object3D, Sphere } from "three/webgpu";
2
- import { at } from "../at.js";
3
- import { disposeCopies } from "../dispose.js";
4
- import { EncodedLevels, emptyLevels, levelsFrom } from "../levels/index.js";
5
- import { fadeSourceOf } from "../levels/fade.js";
6
- import { levelsToLoad } from "../levels/load.js";
7
- import { LodLevelLoadManager } from "../levels/manager.js";
8
- import { Lod } from "../lod.js";
9
- import { inShadowMap } from "../levels/renderer.js";
10
- import { sameClass } from "../three.js";
11
- import { WIND } from "../wind/hooks.js";
12
- import { copyWind } from "../wind/index.js";
13
- import { ChunkSet } from "./chunks.js";
14
- import { cullIn, emptyCull } from "./cull.js";
15
- import { MeshesByLevel } from "./levels.js";
16
- import { InstanceLists, frustumIn, listedOf } from "./lists.js";
17
- import { localCamera, shownBy, walk } from "./camera.js";
18
- import { drawMatrices } from "./meshes.js";
19
- import { raycastInstances } from "./raycast.js";
20
- import { InstanceShape } from "./shape.js";
21
- import { MAX_SURVIVOR_SCALE, instanceLevel } from "./measure.js";
22
- const DEFAULT_INSTANCES = 16384;
23
- /**
24
- * Independently drawn copies of one object, sorted into indirect draws per camera on the GPU. Instances arrive and
25
- * leave in chunks (see `addChunk`), from the CPU or written by the app's GPU passes; `cullDistance` thins them out with
26
- * distance. Thresholds, fades, loading and global settings follow Lod: each instance draws what levelsToDraw gives for
27
- * its height. Each camera draws only the instances in its frustum, and each shadow map is a camera of its own: it draws
28
- * the casters in its frustum, each at the level its texels resolve, as an orthographic camera would (an instance
29
- * smaller than a texel casts nothing). Instance matrices may scale arbitrarily; the InstancedLod's own transform and its
30
- * parents should scale uniformly. Scale 0 draws nothing.
31
- *
32
- * Level templates are cloned, then their meshes are instanced; it sets each level mesh's `visible` per camera, so hide
33
- * the InstancedLod itself, never its level meshes. Skinned meshes, InstancedMeshes (except ImpostorMesh)
34
- * and nested Lods are unsupported. For external detail, leave level 0 empty and draw the instances that
35
- * `chunk.getLevelAt` reports there.
36
- *
37
- * Every level mesh's `geometry.boundingBox` and `boundingSphere` bound all its instances, not one, so
38
- * `new Box3().setFromObject(lod)` bounds them once a level has loaded; with `precise` it walks a level's vertices once,
39
- * at no instance, as it cannot see them. Measure one instance by a level's `object`, scaled by its matrix.
40
- *
41
- * Instances live in its LodGpu's pool, and every InstancedLod of a LodGpu sorts for a camera in one compute call.
42
- * Requires WebGPU `indirect-first-instance`. Sequential cameras are supported; a nested render with a camera that the
43
- * outer render also draws with replaces that camera's instance lists, so exclude this InstancedLod from it with camera
44
- * layers.
45
- */
46
- export class InstancedLod extends Object3D {
47
- gpu;
48
- isLOD = true;
49
- isInstancedLod = true;
50
- /** Let the renderer call `update` with its camera every frame. */
51
- autoUpdate = true;
52
- /** Draw only this level, without fades, once the coarsest level that draws something has loaded. */
53
- forceLevel = null;
54
- /** The levels, each `object` the template its level meshes are made from, once there is one (never in the scene). */
55
- levels = [];
56
- /** Thins the instances out with distance from a camera, in every camera; null draws them at any distance. */
57
- cullDistance = null;
58
- /** The levels as they were given, which a copy is made from. */
59
- inputs = [];
60
- /** What it is made of for its levels and sizes, which a copy makes anew. */
61
- built;
62
- disposed = false;
63
- /** Around every instance, survivors grown: what every level mesh is culled and boxed by. */
64
- bounds = { sphere: new Sphere(), box: new Box3() };
65
- /** What `cullIn` writes cullDistance into, in this InstancedLod's space. */
66
- cull = emptyCull();
67
- /**
68
- * `levels[0]` is the source. Empty only as the target of `copy`. It holds no instances until chunks are added. `gpu`
69
- * is what it shares with every Lod drawing with its renderer.
70
- */
71
- constructor(levels, gpu, options = {}) {
72
- super();
73
- this.gpu = gpu;
74
- // Each level's draws start at its list (see update.ts).
75
- if (!gpu.renderer.hasFeature("indirect-first-instance"))
76
- throw new Error("InstancedLod: needs the GPU feature indirect-first-instance, which this device lacks");
77
- const maxInstanceCount = options.maxInstanceCount ?? DEFAULT_INSTANCES;
78
- if (!Number.isInteger(maxInstanceCount) || maxInstanceCount < 1)
79
- throw new RangeError(`InstancedLod: maxInstanceCount must be a positive integer, got ${maxInstanceCount}`);
80
- this.built = this.init(levels, maxInstanceCount);
81
- this.built.loads.item.given = options.manager;
82
- }
83
- get pending() {
84
- return this.built.loads.pending;
85
- }
86
- get error() {
87
- return this.built.loads.error;
88
- }
89
- /** Where the item of levels a camera misses goes (see `LodOptions.manager`). */
90
- get manager() {
91
- return this.built.loads.item.manager;
92
- }
93
- set manager(manager) {
94
- this.built.loads.item.given = manager;
95
- }
96
- /** Its chunks, in the order they were added. */
97
- get chunks() {
98
- return this.built.chunks.keys();
99
- }
100
- /** What this InstancedLod is made of for `inputs` and `maxInstanceCount`: its levels, their meshes and their loading. */
101
- init(inputs, maxInstanceCount) {
102
- const shape = new InstanceShape(inputs);
103
- const { pool, renderer } = this.gpu;
104
- const lists = new InstanceLists(this.gpu.sorter, listedOf(inputs), maxInstanceCount);
105
- const chunks = new ChunkSet(pool, lists.row, this.bounds, () => shape.originReach, (chunk, index, camera) => this.levelAt(chunk, index, camera));
106
- const drawn = { matrices: pool.matrices, colors: pool.colors };
107
- const drawing = { shape, lists, drawn };
108
- this.inputs = inputs;
109
- if (inputs.length > 0)
110
- this.levels.push(...levelsFrom(inputs, 2 * shape.ownRadius, "InstancedLod"));
111
- const encoded = new EncodedLevels(this.levels, emptyLevels(inputs), "InstancedLod");
112
- const drawFor = (renderer, camera) => this.built.loads.guard(() => {
113
- if (renderer !== this.gpu.renderer)
114
- throw new Error("InstancedLod: another renderer than its LodGpu's drew it");
115
- lists.drawFor(camera);
116
- });
117
- const meshes = new MeshesByLevel(this, this.levels, drawing, this.bounds, drawFor);
118
- const loads = new LodLevelLoadManager(this, this.gpu, `InstancedLod ${this.uuid}`, inputs, encoded.get(null, true), (level, loaded) => meshes.prepare(level, loaded), (level) => meshes.of(level), async () => {
119
- const instances = await pool.status(renderer, chunks.slots());
120
- if (instances !== null && instances > maxInstanceCount)
121
- throw new Error(`InstancedLod: its chunks hold ${instances} instances, more than its lists hold: raise its maxInstanceCount (${maxInstanceCount})`);
122
- return instances !== null;
123
- });
124
- return { maxInstanceCount, chunks, ...drawing, meshes, loads, encoded };
125
- }
126
- /**
127
- * Add `parameters`' instances as one chunk, from the CPU or the GPU (see `InstancedLodChunkParameters`). The next
128
- * render that updates this InstancedLod copies them into its pages. Its item (see `LodOptions.manager`) stays held
129
- * until the GPU shows every chunk copied; a chunk the pool lacks pages for draws the instances it got until it is
130
- * removed, and is this InstancedLod's error (see `error`).
131
- */
132
- addChunk(parameters) {
133
- if (this.disposed)
134
- throw new Error("InstancedLod: it was disposed");
135
- if (this.levels.length === 0)
136
- throw new Error("InstancedLod: give it levels before chunks");
137
- const chunk = this.built.chunks.add(parameters);
138
- this.measureBounds();
139
- this.built.loads.chunksChanged();
140
- return chunk;
141
- }
142
- /** Remove `chunk`'s instances; its pages return to the pool in the next render. */
143
- removeChunk(chunk) {
144
- this.built.chunks.remove(chunk);
145
- this.measureBounds();
146
- this.built.loads.chunksChanged();
147
- }
148
- /** Bound every chunk's instances, survivors grown. */
149
- measureBounds() {
150
- this.built.chunks.bound(this.cullDistance?.scaleSurvivors ? MAX_SURVIVOR_SCALE : 1);
151
- }
152
- [WIND](padding, slope, baseY) {
153
- if (this.built.loads.started)
154
- throw new Error("InstancedLod: apply wind before the first render");
155
- this.built.shape.wind(padding, slope, baseY);
156
- for (const mesh of this.built.meshes.all()) {
157
- const source = fadeSourceOf(mesh);
158
- if (source?.kind === "instances")
159
- source.radius = this.built.shape.fadeRadius;
160
- }
161
- this.measureBounds();
162
- }
163
- /** 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`). */
164
- update(camera) {
165
- if (this.disposed || this.levels.length === 0)
166
- return;
167
- // A shadow map draws nothing of an InstancedLod whose levels cast nothing; one not loaded yet may.
168
- const shadow = inShadowMap(this);
169
- if (shadow && !this.levels.some(({ object }, i) => !object || this.built.meshes.of(i).some((mesh) => mesh.castShadow)))
170
- return;
171
- this.built.loads.guard(() => this.sort(camera, shadow));
172
- }
173
- /** Sort for `camera`, a shadow map's when `shadow`. */
174
- sort(camera, shadow) {
175
- const { loads, shape, lists, chunks, drawn, encoded, meshes } = this.built;
176
- const { levels, eye, scale, ortho } = this.localCamera(camera, shadow);
177
- if (chunks.refresh())
178
- this.measureBounds();
179
- // The pages change before any sorts with them.
180
- const { pool } = this.gpu;
181
- pool.prepare(this.gpu.renderer);
182
- const survivors = this.cullDistance?.scaleSurvivors ?? false;
183
- if (survivors !== (drawn.matrices !== pool.matrices))
184
- this.scaleSurvivors(survivors);
185
- const cull = cullIn(this.cullDistance, this.matrixWorld, this.cull);
186
- const local = { levels, eye, scale, ortho, cull };
187
- const found = lists.of(camera);
188
- // Outside the camera's frustum, nothing draws: a shadow map, which loads nothing by heights, walks no chunk then.
189
- const seen = frustumIn(found, camera, this.matrixWorld).intersectsSphere(this.bounds.sphere);
190
- if (!shadow || seen)
191
- walk(found, local, this.built);
192
- // A shadow map draws from the levels its scene's cameras loaded.
193
- loads.request(camera, shadow ? levelsToLoad([], encoded.heights(levels)) : found.wanted, shadow);
194
- meshes.tint(Lod.debug);
195
- lists.prune(camera, (other) => loads.requests.rendering(other));
196
- const { loaded, before, progress } = loads;
197
- // Three projects this InstancedLod's children for the camera after this update.
198
- const shown = seen ? shownBy(found, levels, encoded, { loaded, before, progress }) : 0;
199
- lists.sort(camera, {
200
- ...local,
201
- loaded,
202
- before,
203
- progress,
204
- bounds: this.bounds.sphere,
205
- box: this.bounds.box,
206
- source: shape.source,
207
- reach: shape.reach,
208
- onlyLevel: cull === null ? found.onlyLevel : 0,
209
- chunks: chunks.version,
210
- });
211
- // Nothing draws from the camera's indirect draws before a sort writes them, which a level mesh's draw runs first.
212
- meshes.show(found.written ? shown : 0);
213
- }
214
- /** `camera` in this InstancedLod's space (see `localCamera`). */
215
- localCamera(camera, shadow) {
216
- const { loads, encoded } = this.built;
217
- return localCamera(camera, loads.heightOf(camera, shadow), this.matrixWorld, encoded, this.forceLevel);
218
- }
219
- /** Draw survivors' scaled matrices, or the pool's again. */
220
- scaleSurvivors(survivors) {
221
- const { pool, sorter } = this.gpu;
222
- this.built.drawn.matrices = survivors ? sorter.scaledMatrices : pool.matrices;
223
- drawMatrices(this.built.meshes.all(), this.built.drawn);
224
- this.measureBounds();
225
- }
226
- /** The level instance `index` of `chunk` draws most of its pixels with for `camera` (see `InstancedLodChunk.getLevelAt`). */
227
- levelAt(chunk, index, camera) {
228
- const cull = cullIn(this.cullDistance, this.matrixWorld, this.cull);
229
- const local = this.localCamera(camera, inShadowMap(this));
230
- return instanceLevel(chunk.instanceMatrix.array, (chunk.start + index) * 16, cull, local, this.built.shape.source, this.built.loads.loaded);
231
- }
232
- /**
233
- * Hits every instance of its CPU chunks on the source level, with `instanceId` and `chunk` set (see
234
- * `InstancedLodIntersection`); `object` is this InstancedLod. A GPU chunk's instances the CPU cannot see, and meshes
235
- * of the source on layers the raycaster does not test, are not hit.
236
- */
237
- raycast(raycaster, intersects) {
238
- raycastInstances(this, { parts: this.built.meshes.source, rest: this.built.shape.rest }, this.built.chunks.cpu(), raycaster, intersects);
239
- return false;
240
- }
241
- /**
242
- * Copies `source`'s levels, CPU chunks and settings into this empty InstancedLod, one without levels or chunks (it
243
- * throws otherwise); the copy shares geometry and textures with `source`, and its chunks hold copies of the source's
244
- * attributes. A GPU chunk cannot be copied: its instances live on the GPU.
245
- */
246
- copy(source) {
247
- if (this.levels.length > 0 || this.built.chunks.size > 0)
248
- throw new Error("InstancedLod.copy: copy into an InstancedLod without levels or chunks");
249
- const chunks = source.built.chunks.copies();
250
- const inputs = source.inputs.map((input, i) => ({ ...input, maxPixels: at(source.levels, i).maxPixels }));
251
- super.copy(source, false);
252
- this.built.chunks.dispose();
253
- this.built.lists.dispose();
254
- this.built = this.init(inputs, source.built.maxInstanceCount);
255
- this.built.loads.item.given = source.built.loads.item.given;
256
- this.forceLevel = source.forceLevel;
257
- this.autoUpdate = source.autoUpdate;
258
- this.cullDistance = source.cullDistance && { ...source.cullDistance };
259
- copyWind(source, this);
260
- for (const chunk of chunks)
261
- this.addChunk(chunk);
262
- return this;
263
- }
264
- clone() {
265
- const clone = new InstancedLod([], this.gpu).copy(this);
266
- if (!sameClass(this, clone))
267
- throw new Error("InstancedLod.clone: a subclass must override clone");
268
- return clone;
269
- }
270
- /**
271
- * Release its buffers and what it made of its levels, once nothing it prepares or compiles still uses them. Objects
272
- * you give or load, chunk attributes among them, are yours to dispose; LodLoader's are freed when the last Lod
273
- * holding them is disposed (see `LodLevel.hold`).
274
- */
275
- dispose() {
276
- if (this.disposed)
277
- return;
278
- this.disposed = true;
279
- super.dispose();
280
- this.built.chunks.dispose();
281
- this.built.loads.dispose(() => {
282
- this.built.meshes.dispose();
283
- this.built.lists.dispose();
284
- for (const { object } of this.levels)
285
- if (object)
286
- disposeCopies(object);
287
- });
288
- }
289
- }
290
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/instanced/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAuE,MAAM,cAAc,CAAC;AAC3H,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAwC,MAAM,oBAAoB,CAAC;AAClH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAqB,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,aAAa,EAAgB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAA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,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;YAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC3B,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,IAAI,CAAC,MAAM;gBAAE,IAAI,MAAM;oBAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,37 +0,0 @@
1
- import type { StorageBufferAttribute, StorageInstancedBufferAttribute } from "three/webgpu";
2
- /** Bits of an occupied page's entry that hold its page; those above hold its InstancedLod's row. */
3
- export declare const PAGE_BITS = 16;
4
- /** A page pool's sizes and buffers, which its passes read. */
5
- export interface PoolBuffers {
6
- readonly pages: number;
7
- readonly slots: number;
8
- /** The free page count, then the free page ids. */
9
- readonly stack: StorageBufferAttribute;
10
- /** Per window of a chunk's range, from its slot's first window (see `sources`): the page it holds. */
11
- readonly table: StorageBufferAttribute;
12
- /** Per window of a chunk's range: the window's instances, then where they start among the chunk's. */
13
- readonly windows: StorageBufferAttribute;
14
- /**
15
- * Per slot, written by the CPU: its chunk's first window, its windows, its generation, and its InstancedLod's row
16
- * plus one (0 while it holds no chunk).
17
- */
18
- readonly sources: StorageBufferAttribute;
19
- /**
20
- * Per slot, written by the GPU, two vec4s: the generation it got to, its pages, its instances and the pages it needs;
21
- * then the first window its pages are listed from.
22
- */
23
- readonly states: StorageBufferAttribute;
24
- /** How many pages chunks hold, then per page held its id and its InstancedLod's row (see `PAGE_BITS`). */
25
- readonly occupied: StorageBufferAttribute;
26
- /** Every pool index's instance matrix and colour (RGB and a pad), as the level meshes draw them. */
27
- readonly matrices: StorageInstancedBufferAttribute;
28
- readonly colors: StorageInstancedBufferAttribute;
29
- }
30
- /** `pool`'s buffers as one pass uses them: a node each, since a pass may not bind a buffer it writes twice. */
31
- export declare function nodes(pool: PoolBuffers): {
32
- stack: import("three/webgpu").StorageBufferNode<"uint">;
33
- table: import("three/webgpu").StorageBufferNode<"uint">;
34
- windows: import("three/webgpu").StorageBufferNode<"uint">;
35
- sources: import("three/webgpu").StorageBufferNode<"uvec4">;
36
- states: import("three/webgpu").StorageBufferNode<"uvec4">;
37
- };
@@ -1,15 +0,0 @@
1
- import { storage } from "three/tsl";
2
- // The buffers of a page pool, which its passes read and write (see passes.ts).
3
- /** Bits of an occupied page's entry that hold its page; those above hold its InstancedLod's row. */
4
- export const PAGE_BITS = 16;
5
- /** `pool`'s buffers as one pass uses them: a node each, since a pass may not bind a buffer it writes twice. */
6
- export function nodes(pool) {
7
- return {
8
- stack: storage(pool.stack, "uint", 0).toAtomic(),
9
- table: storage(pool.table, "uint", 0),
10
- windows: storage(pool.windows, "uint", 0),
11
- sources: storage(pool.sources, "uvec4", 0).toReadOnly(),
12
- states: storage(pool.states, "uvec4", 0),
13
- };
14
- }
15
- //# sourceMappingURL=buffers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buffers.js","sourceRoot":"","sources":["../../../src/instanced/pages/buffers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,+EAA+E;AAE/E,oGAAoG;AACpG,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC;AA6B5B,+GAA+G;AAC/G,MAAM,UAAU,KAAK,CAAC,IAAiB;IACrC,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;QAChD,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QACrC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACzC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE;QACvD,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;KACzC,CAAC;AACJ,CAAC"}
@@ -1,51 +0,0 @@
1
- import { type ComputeNode, type StorageBufferAttribute, type StorageInstancedBufferAttribute } from "three/webgpu";
2
- import { type PoolBuffers } from "./buffers.js";
3
- /**
4
- * The attributes chunks are read from: matrices, colours or none (white) with the floats between instances' colours,
5
- * and an instance count's buffer or none.
6
- */
7
- export interface Attributes {
8
- readonly matrices: Storage;
9
- readonly colors: {
10
- readonly attribute: Storage;
11
- readonly stride: 3 | 4;
12
- } | null;
13
- readonly counts: Storage | null;
14
- }
15
- /** A storage attribute, of either kind. */
16
- type Storage = StorageBufferAttribute | StorageInstancedBufferAttribute;
17
- /** A chunk the count and write passes read: its slot, its first window, its range of its attributes, and where its instance count lies. */
18
- export interface ChunkRange {
19
- readonly slot: number;
20
- readonly base: number;
21
- readonly start: number;
22
- readonly count: number;
23
- readonly countIndex: number;
24
- }
25
- /** The chunk the count and write passes read next, set before each runs. */
26
- export declare function chunkUniforms(): {
27
- slot: import("three/webgpu").UniformNode<"uint", number>;
28
- base: import("three/webgpu").UniformNode<"uint", number>;
29
- start: import("three/webgpu").UniformNode<"uint", number>;
30
- count: import("three/webgpu").UniformNode<"uint", number>;
31
- countIndex: import("three/webgpu").UniformNode<"uint", number>;
32
- };
33
- export type ChunkUniforms = ReturnType<typeof chunkUniforms>;
34
- /** Nodes reading a chunk's attributes, for their layout; pointed at each chunk's own before its passes run. */
35
- export declare function chunkReads({ matrices, colors, counts }: Attributes): {
36
- matrices: import("three/webgpu").StorageBufferNode<"mat4">;
37
- colors: {
38
- floats: import("three/webgpu").StorageBufferNode<"float">;
39
- stride: 4 | 3;
40
- } | null;
41
- counts: import("three/webgpu").StorageBufferNode<"uint"> | null;
42
- };
43
- export type ChunkReads = ReturnType<typeof chunkReads>;
44
- /** Counts each window's instances of `chunk`, read by `reads`: one workgroup per window. */
45
- export declare function countPass(pool: PoolBuffers, chunk: ChunkUniforms, reads: ChunkReads): ComputeNode;
46
- /**
47
- * Writes each window's instances of `chunk`, read by `reads`, into its pages, in order, and clears the room past its
48
- * last instance on its last page, which then draw nothing: one workgroup per window.
49
- */
50
- export declare function writePass(pool: PoolBuffers, chunk: ChunkUniforms, reads: ChunkReads): ComputeNode;
51
- export {};
@@ -1,81 +0,0 @@
1
- import { Matrix4 } from "three/webgpu";
2
- import { If, localId, mat4, storage, uniform, vec3, vec4, workgroupId } from "three/tsl";
3
- import { maxScale } from "../../tsl.js";
4
- import { nodes } from "./buffers.js";
5
- import { PAGE, least, rank, workgroups } from "./workgroup.js";
6
- // The passes that read one chunk's attributes, one workgroup per window of its range: counting its instances, and
7
- // writing them into the pages they got (see index.ts for the order they run in).
8
- /** The matrix of a pool index without an instance: scale 0 draws nothing. */
9
- const nothing = new Matrix4().multiplyScalar(0);
10
- /** The chunk the count and write passes read next, set before each runs. */
11
- export function chunkUniforms() {
12
- return {
13
- slot: uniform(0, "uint"),
14
- base: uniform(0, "uint"),
15
- start: uniform(0, "uint"),
16
- count: uniform(0, "uint"),
17
- countIndex: uniform(0, "uint"),
18
- };
19
- }
20
- /** Nodes reading a chunk's attributes, for their layout; pointed at each chunk's own before its passes run. */
21
- export function chunkReads({ matrices, colors, counts }) {
22
- return {
23
- matrices: storage(matrices, "mat4", 0).toReadOnly(),
24
- colors: colors && { floats: storage(colors.attribute, "float", 0).toReadOnly(), stride: colors.stride },
25
- counts: counts && storage(counts, "uint", 0).toReadOnly(),
26
- };
27
- }
28
- /**
29
- * This lane's instance of `chunk`, read by `reads`: the lane's index in the chunk's range, its matrix (scale 0 past the
30
- * chunk's instance count) and colour, and whether it is an instance, at a scale above 0.
31
- */
32
- function read(chunk, { matrices, colors, counts }) {
33
- const index = workgroupId.x.mul(PAGE).add(localId.x).toVar();
34
- const total = counts ? least(counts.element(chunk.countIndex), chunk.count) : chunk.count;
35
- const m = mat4(nothing).toVar();
36
- If(index.lessThan(total), () => void m.assign(matrices.element(chunk.start.add(index))));
37
- const first = chunk.start.add(index).mul(colors?.stride ?? 3);
38
- const color = colors ? vec3(colors.floats.element(first), colors.floats.element(first.add(1)), colors.floats.element(first.add(2))) : vec3(1);
39
- return { index, matrix: m, color, live: maxScale(m).greaterThan(0) };
40
- }
41
- /** Counts each window's instances of `chunk`, read by `reads`: one workgroup per window. */
42
- export function countPass(pool, chunk, reads) {
43
- const { windows } = nodes(pool);
44
- return workgroups(() => {
45
- const { live } = read(chunk, reads);
46
- const { total } = rank(live);
47
- If(localId.x.equal(0), () => void windows.element(chunk.base.add(workgroupId.x)).assign(total));
48
- });
49
- }
50
- /**
51
- * Writes each window's instances of `chunk`, read by `reads`, into its pages, in order, and clears the room past its
52
- * last instance on its last page, which then draw nothing: one workgroup per window.
53
- */
54
- export function writePass(pool, chunk, reads) {
55
- const { windows, table, states } = nodes(pool);
56
- const matrices = storage(pool.matrices, "mat4", 0);
57
- const colors = storage(pool.colors, "vec4", 0);
58
- return workgroups(() => {
59
- /** The pool index of the chunk's instance `packed`, its index among the chunk's instances. */
60
- const poolIndexOf = (packed) => table
61
- .element(chunk.base.add(packed.div(PAGE)))
62
- .mul(PAGE)
63
- .add(packed.mod(PAGE))
64
- .toVar();
65
- const state = states.element(chunk.slot.mul(2)).toVar();
66
- const { matrix, color, live } = read(chunk, reads);
67
- const { before } = rank(live);
68
- const packed = windows.element(chunk.base.add(workgroupId.x)).add(before).toVar();
69
- // Instances past the pages the chunk got are left out.
70
- If(live.and(packed.lessThan(state.y.mul(PAGE))), () => {
71
- const into = poolIndexOf(packed);
72
- matrices.element(into).assign(matrix);
73
- colors.element(into).assign(vec4(color, 1));
74
- });
75
- If(workgroupId.x.equal(0), () => {
76
- const tail = state.z.add(localId.x).toVar();
77
- If(tail.lessThan(state.y.mul(PAGE)), () => void matrices.element(poolIndexOf(tail)).assign(mat4(nothing)));
78
- });
79
- });
80
- }
81
- //# sourceMappingURL=chunk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../../src/instanced/pages/chunk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,OAAO,EAAgF,MAAM,cAAc,CAAC;AACvI,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,KAAK,EAAoB,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE/D,kHAAkH;AAClH,iFAAiF;AAEjF,6EAA6E;AAC7E,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAwBhD,4EAA4E;AAC5E,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC;QACzB,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC;KAC/B,CAAC;AACJ,CAAC;AAID,+GAA+G;AAC/G,MAAM,UAAU,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAc;IACjE,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,UAAU,EAA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