@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.
- package/README.md +5 -8
- package/dist/bake.d.ts +16 -2
- package/dist/bake.js +92 -4
- package/dist/bake.js.map +1 -1
- package/dist/baked/index.d.ts +2 -2
- package/dist/baked/index.js +2 -2
- package/dist/baked/interior/faces.js +4 -2
- package/dist/baked/interior/faces.js.map +1 -1
- package/dist/baked/interior/material.js +1 -1
- package/dist/baked/interior/material.js.map +1 -1
- package/dist/baked/interior/rooms.d.ts +1 -1
- package/dist/baked/interior/rooms.js +1 -1
- package/dist/dispose.d.ts +3 -3
- package/dist/dispose.js +6 -6
- package/dist/dispose.js.map +1 -1
- package/dist/foliage.d.ts +32 -0
- package/dist/foliage.js +137 -0
- package/dist/foliage.js.map +1 -0
- package/dist/impostor/bake/index.d.ts +3 -3
- package/dist/impostor/bake/index.js +12 -3
- package/dist/impostor/bake/index.js.map +1 -1
- package/dist/impostor/bake/source.d.ts +2 -1
- package/dist/impostor/bake/source.js +2 -2
- package/dist/impostor/bake/source.js.map +1 -1
- package/dist/impostor/impostor.d.ts +1 -1
- package/dist/impostor/impostor.js +1 -1
- package/dist/impostor/ktx2/encode.js +5 -2
- package/dist/impostor/ktx2/encode.js.map +1 -1
- package/dist/impostor/ktx2/uastc.js +3 -2
- package/dist/impostor/ktx2/uastc.js.map +1 -1
- package/dist/impostor/ktx2/worker.js +0 -2
- package/dist/impostor/ktx2/worker.js.map +1 -1
- package/dist/impostor/mesh/card.d.ts +1 -1
- package/dist/impostor/mesh/index.d.ts +2 -2
- package/dist/impostor/mesh/index.js +3 -3
- package/dist/impostor/mesh/index.js.map +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/instanced/camera.d.ts +13 -25
- package/dist/instanced/camera.js +17 -42
- package/dist/instanced/camera.js.map +1 -1
- package/dist/instanced/clusters.d.ts +54 -0
- package/dist/instanced/clusters.js +151 -0
- package/dist/instanced/clusters.js.map +1 -0
- package/dist/instanced/cull.d.ts +3 -3
- package/dist/instanced/cull.js +2 -2
- package/dist/instanced/cull.js.map +1 -1
- package/dist/instanced/instances.d.ts +39 -0
- package/dist/instanced/instances.js +104 -0
- package/dist/instanced/instances.js.map +1 -0
- package/dist/instanced/key.d.ts +1 -1
- package/dist/instanced/key.js +1 -1
- package/dist/instanced/key.js.map +1 -1
- package/dist/instanced/levels.d.ts +9 -9
- package/dist/instanced/levels.js +7 -6
- package/dist/instanced/levels.js.map +1 -1
- package/dist/instanced/lists.d.ts +26 -39
- package/dist/instanced/lists.js +42 -61
- package/dist/instanced/lists.js.map +1 -1
- package/dist/instanced/measure.d.ts +2 -2
- package/dist/instanced/measure.js +2 -2
- package/dist/instanced/meshes.d.ts +11 -9
- package/dist/instanced/meshes.js +26 -16
- package/dist/instanced/meshes.js.map +1 -1
- package/dist/instanced/mirror.d.ts +16 -12
- package/dist/instanced/mirror.js +51 -12
- package/dist/instanced/mirror.js.map +1 -1
- package/dist/instanced/raycast.d.ts +6 -9
- package/dist/instanced/raycast.js +15 -18
- package/dist/instanced/raycast.js.map +1 -1
- package/dist/instanced/rows.d.ts +15 -73
- package/dist/instanced/rows.js +16 -189
- package/dist/instanced/rows.js.map +1 -1
- package/dist/instanced/shape.d.ts +3 -1
- package/dist/instanced/shape.js +6 -3
- package/dist/instanced/shape.js.map +1 -1
- package/dist/instanced/sort.d.ts +32 -34
- package/dist/instanced/sort.js +162 -132
- package/dist/instanced/sort.js.map +1 -1
- package/dist/instanced/update.d.ts +16 -12
- package/dist/instanced/update.js +57 -84
- package/dist/instanced/update.js.map +1 -1
- package/dist/levels/compile/index.d.ts +4 -2
- package/dist/levels/compile/index.js +10 -2
- package/dist/levels/compile/index.js.map +1 -1
- package/dist/levels/compile/pipelines.d.ts +1 -1
- package/dist/levels/compile/pipelines.js +1 -6
- package/dist/levels/compile/pipelines.js.map +1 -1
- package/dist/levels/draw.d.ts +1 -1
- package/dist/levels/draw.js +3 -3
- package/dist/levels/fade.d.ts +13 -22
- package/dist/levels/fade.js +17 -38
- package/dist/levels/fade.js.map +1 -1
- package/dist/levels/index.d.ts +7 -7
- package/dist/levels/index.js +1 -1
- package/dist/levels/item.d.ts +10 -10
- package/dist/levels/item.js +15 -23
- package/dist/levels/item.js.map +1 -1
- package/dist/levels/load.d.ts +1 -1
- package/dist/levels/load.js +5 -3
- package/dist/levels/load.js.map +1 -1
- package/dist/levels/manager.d.ts +30 -31
- package/dist/levels/manager.js +75 -62
- package/dist/levels/manager.js.map +1 -1
- package/dist/levels/material.d.ts +2 -2
- package/dist/levels/material.js +2 -2
- package/dist/levels/renderer.d.ts +8 -5
- package/dist/levels/renderer.js +20 -4
- package/dist/levels/renderer.js.map +1 -1
- package/dist/levels/requests.d.ts +4 -1
- package/dist/levels/requests.js +3 -1
- package/dist/levels/requests.js.map +1 -1
- package/dist/loader/context.d.ts +9 -11
- package/dist/loader/context.js +12 -7
- package/dist/loader/context.js.map +1 -1
- package/dist/loader/entry.d.ts +4 -0
- package/dist/loader/entry.js +43 -0
- package/dist/loader/entry.js.map +1 -0
- package/dist/loader/index.d.ts +49 -35
- package/dist/loader/index.js +123 -135
- package/dist/loader/index.js.map +1 -1
- package/dist/loader/level.js +5 -5
- package/dist/loader/level.js.map +1 -1
- package/dist/loader/node.d.ts +26 -0
- package/dist/loader/node.js +199 -0
- package/dist/loader/node.js.map +1 -0
- package/dist/loader/request.d.ts +11 -44
- package/dist/loader/request.js +7 -47
- package/dist/loader/request.js.map +1 -1
- package/dist/loader/url.d.ts +10 -9
- package/dist/loader/url.js +21 -17
- package/dist/loader/url.js.map +1 -1
- package/dist/lod.d.ts +122 -62
- package/dist/lod.js +331 -187
- package/dist/lod.js.map +1 -1
- package/dist/meshopt.d.ts +1 -1
- package/dist/meshopt.js +3 -2
- package/dist/meshopt.js.map +1 -1
- package/dist/node-process.d.ts +5 -0
- package/dist/node-process.js +6 -0
- package/dist/node-process.js.map +1 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +5 -0
- package/dist/node.js.map +1 -0
- package/dist/simplify/index.d.ts +2 -2
- package/dist/simplify/index.js +7 -7
- package/dist/simplify/index.js.map +1 -1
- package/dist/source/detail.d.ts +7 -2
- package/dist/source/detail.js +24 -22
- package/dist/source/detail.js.map +1 -1
- package/dist/source/sampler.js +5 -2
- package/dist/source/sampler.js.map +1 -1
- package/dist/three.d.ts +7 -7
- package/dist/three.js +4 -4
- package/dist/three.js.map +1 -1
- package/dist/wind/bounds.js +1 -1
- package/dist/wind/bounds.js.map +1 -1
- package/dist/wind/hooks.d.ts +1 -1
- package/dist/wind/hooks.js +1 -1
- package/dist/wind/index.d.ts +3 -3
- package/dist/wind/index.js +11 -9
- package/dist/wind/index.js.map +1 -1
- package/package.json +10 -6
- package/skills/lod/SKILL.md +65 -54
- package/dist/gpu.d.ts +0 -39
- package/dist/gpu.js +0 -41
- package/dist/gpu.js.map +0 -1
- package/dist/instanced/chunk.d.ts +0 -97
- package/dist/instanced/chunk.js +0 -156
- package/dist/instanced/chunk.js.map +0 -1
- package/dist/instanced/chunks.d.ts +0 -60
- package/dist/instanced/chunks.js +0 -208
- package/dist/instanced/chunks.js.map +0 -1
- package/dist/instanced/index.d.ts +0 -120
- package/dist/instanced/index.js +0 -290
- package/dist/instanced/index.js.map +0 -1
- package/dist/instanced/pages/buffers.d.ts +0 -37
- package/dist/instanced/pages/buffers.js +0 -15
- package/dist/instanced/pages/buffers.js.map +0 -1
- package/dist/instanced/pages/chunk.d.ts +0 -51
- package/dist/instanced/pages/chunk.js +0 -81
- package/dist/instanced/pages/chunk.js.map +0 -1
- package/dist/instanced/pages/index.d.ts +0 -74
- package/dist/instanced/pages/index.js +0 -269
- package/dist/instanced/pages/index.js.map +0 -1
- package/dist/instanced/pages/passes.d.ts +0 -21
- package/dist/instanced/pages/passes.js +0 -52
- package/dist/instanced/pages/passes.js.map +0 -1
- package/dist/instanced/pages/slots.d.ts +0 -11
- package/dist/instanced/pages/slots.js +0 -90
- package/dist/instanced/pages/slots.js.map +0 -1
- package/dist/instanced/pages/workgroup.d.ts +0 -14
- package/dist/instanced/pages/workgroup.js +0 -38
- package/dist/instanced/pages/workgroup.js.map +0 -1
- package/dist/levels/wait.d.ts +0 -27
- package/dist/levels/wait.js +0 -61
- package/dist/levels/wait.js.map +0 -1
- package/dist/loader/cache.d.ts +0 -12
- package/dist/loader/cache.js +0 -68
- package/dist/loader/cache.js.map +0 -1
- package/dist/loader/dependencies.d.ts +0 -32
- package/dist/loader/dependencies.js +0 -113
- 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
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
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
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
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
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
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`
|
|
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
|
-
/**
|
|
52
|
-
private
|
|
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
|
-
*
|
|
69
|
-
*
|
|
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
|
-
|
|
73
|
-
private
|
|
74
|
-
/**
|
|
75
|
-
|
|
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
|
-
|
|
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
|
-
/**
|
|
86
|
-
private
|
|
87
|
-
/**
|
|
88
|
-
private
|
|
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
|
-
*
|
|
91
|
-
*
|
|
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
|
-
|
|
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
|
|
98
|
-
* textures with `source`,
|
|
99
|
-
*
|
|
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
|
|
105
|
-
* load are yours to dispose;
|
|
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
|
}
|