@kalyptos/narcissus 0.1.3 → 0.2.1
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 +1 -0
- package/dist/cli/main.js +1 -1
- package/dist/controls/controls.d.ts +10 -2
- package/dist/controls/pose.d.ts +8 -1
- package/dist/controls--A-CvrQ5.js +3570 -0
- package/dist/element/index.js +1 -1
- package/dist/engine/engine.d.ts +35 -3
- package/dist/engine/gpu/masks.d.ts +26 -0
- package/dist/engine/gpu/overlay.d.ts +21 -0
- package/dist/engine/gpu/pick.d.ts +28 -0
- package/dist/engine/gpu/pool.d.ts +10 -2
- package/dist/engine/gpu/project.d.ts +5 -0
- package/dist/engine/gpu/raster.d.ts +0 -5
- package/dist/engine/gpu/renderer.d.ts +8 -8
- package/dist/engine/index.d.ts +5 -2
- package/dist/engine/layer.d.ts +26 -0
- package/dist/engine/mask.d.ts +18 -0
- package/dist/engine/math/frustum.d.ts +5 -2
- package/dist/engine/math/prism.d.ts +13 -0
- package/dist/engine/overlay.d.ts +28 -0
- package/dist/engine/stream/feed.d.ts +2 -0
- package/dist/engine/types.d.ts +8 -0
- package/dist/format/encode.d.ts +8 -0
- package/dist/format/idx.d.ts +2 -0
- package/dist/format/index.d.ts +2 -1
- package/dist/format/index.js +1 -1
- package/dist/{format-C3Vn0c2b.js → format-CbtEy9NS.js} +352 -139
- package/dist/index.d.ts +1 -0
- package/dist/index.js +30 -29
- package/dist/synthetic-DO8oIw_x.js +212 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools-DnfuHeoO.js +227 -0
- package/package.json +1 -1
- package/dist/controls-IBLB-RWS.js +0 -2773
- package/dist/synthetic-BeGCzYIv.js +0 -383
- package/dist/tools-NykPVccD.js +0 -242
package/dist/element/index.js
CHANGED
package/dist/engine/engine.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { type World } from '../format/index.ts';
|
|
2
|
+
import { type Layer } from './layer.ts';
|
|
3
|
+
import type { Mask, MaskOptions } from './mask.ts';
|
|
4
|
+
import type { Line, LineStyle, Marker, MarkerStyle } from './overlay.ts';
|
|
2
5
|
import { type Mat4 } from './math/mat4.ts';
|
|
3
6
|
import type { Fetch } from '../ports.ts';
|
|
4
7
|
import type { Plugin } from './plugin.ts';
|
|
5
|
-
import type { Camera, Settings, Stats } from './types.ts';
|
|
8
|
+
import type { Camera, Progress, Settings, Stats } from './types.ts';
|
|
6
9
|
export interface EngineOptions {
|
|
7
10
|
settings: Settings;
|
|
8
11
|
/** display rgb 0..1 behind the splats */
|
|
@@ -16,6 +19,14 @@ export interface EngineOptions {
|
|
|
16
19
|
/** no animation loop: frames come only from step(), for benches */
|
|
17
20
|
manual?: boolean;
|
|
18
21
|
}
|
|
22
|
+
export interface Hit {
|
|
23
|
+
/** where the pixel's ray meets the splat's depth, world coordinates */
|
|
24
|
+
point: [number, number, number];
|
|
25
|
+
/** unit; the splat's thinnest axis, toward the camera */
|
|
26
|
+
normal: [number, number, number];
|
|
27
|
+
/** null for the world */
|
|
28
|
+
layer: Layer | null;
|
|
29
|
+
}
|
|
19
30
|
export interface StepReport {
|
|
20
31
|
/** main-thread ms of the frame */
|
|
21
32
|
cpuMs: number;
|
|
@@ -25,12 +36,31 @@ export interface StepReport {
|
|
|
25
36
|
}
|
|
26
37
|
export interface Engine {
|
|
27
38
|
open(worldUrl: string): Promise<World>;
|
|
39
|
+
/**
|
|
40
|
+
* a layer from a pack, its bytes or its url read through the engine's source; origin is the
|
|
41
|
+
* south-west corner its positions count from, as encodeLayer gives it. it stays through open()
|
|
42
|
+
*/
|
|
43
|
+
addLayer(source: {
|
|
44
|
+
url: string;
|
|
45
|
+
} | {
|
|
46
|
+
bytes: Uint8Array;
|
|
47
|
+
}, origin: readonly [number, number]): Promise<Layer>;
|
|
48
|
+
addMask(mask: MaskOptions): Mask;
|
|
49
|
+
/** a polyline in world coordinates over the splats; one point draws a dot */
|
|
50
|
+
addLine(points: readonly Point[], style?: LineStyle): Line;
|
|
51
|
+
addMarker(point: Point, style?: MarkerStyle): Marker;
|
|
52
|
+
/** canvas css pixel of a world point under the camera set last, null behind it */
|
|
53
|
+
toScreen(point: Point): [number, number] | null;
|
|
28
54
|
setCamera(camera: Camera): void;
|
|
29
55
|
configure(settings: Partial<Settings>): void;
|
|
30
56
|
/** canvas size in css pixels and the device pixel ratio to render at */
|
|
31
57
|
resize(width: number, height: number, ratio: number): void;
|
|
32
|
-
/**
|
|
33
|
-
|
|
58
|
+
/**
|
|
59
|
+
* the surface under canvas css pixel (x, y), or null over nothing: where the splats the last
|
|
60
|
+
* frame drew there, blended front to back, first cover half the pixel, met on that splat's
|
|
61
|
+
* plane; it renders no frame of its own
|
|
62
|
+
*/
|
|
63
|
+
pick(x: number, y: number): Promise<Hit | null>;
|
|
34
64
|
ground(e: number, n: number): number | undefined;
|
|
35
65
|
/** ground(e, n) once every .idx over (e, n) is read */
|
|
36
66
|
groundAt(e: number, n: number): Promise<number | undefined>;
|
|
@@ -45,6 +75,8 @@ export interface Engine {
|
|
|
45
75
|
use(plugin: Plugin): () => void;
|
|
46
76
|
/** device loss, with its reason; the engine is then dead */
|
|
47
77
|
onLost(fn: (reason: string) => void): () => void;
|
|
78
|
+
/** fn(progress) each time the planned or missing splats, or whether pages load, change */
|
|
79
|
+
onProgress(fn: (progress: Progress) => void): () => void;
|
|
48
80
|
/** fn(now) starts each frame the loop draws, so a camera it sets shows in that frame */
|
|
49
81
|
onFrame(fn: (now: number) => void): () => void;
|
|
50
82
|
/** the camera may soon move: after a rest, frames run a moment so the gpu is up to speed by then */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Prism } from '../math/prism.ts';
|
|
2
|
+
export declare class Masks {
|
|
3
|
+
#private;
|
|
4
|
+
/** layout of group 1 in the passes that call masks.wgsl's masked() */
|
|
5
|
+
readonly layout: GPUBindGroupLayout;
|
|
6
|
+
constructor(device: GPUDevice);
|
|
7
|
+
get group(): GPUBindGroup;
|
|
8
|
+
get size(): number;
|
|
9
|
+
/** a new mask's id */
|
|
10
|
+
add(prism: Prism, targets: ReadonlySet<number>): number;
|
|
11
|
+
enable(id: number, enabled: boolean): void;
|
|
12
|
+
delete(id: number): void;
|
|
13
|
+
/** world min e, n, max e, n of a mask's polygon */
|
|
14
|
+
area(id: number): readonly [number, number, number, number] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* whether an enabled mask over layer hides every centre in the world box min to max; when none
|
|
17
|
+
* does, the ids of those that may hide some go into crossing
|
|
18
|
+
*/
|
|
19
|
+
relate(layer: number, min: ArrayLike<number>, max: ArrayLike<number>, crossing: number[]): boolean;
|
|
20
|
+
setOrigin(origin: readonly [number, number, number]): void;
|
|
21
|
+
/** words before the lists: the records and their vertices */
|
|
22
|
+
get listBase(): number;
|
|
23
|
+
/** the records, vertices and lists, as mask ids from listBase on; the last lists when left out */
|
|
24
|
+
write(lists?: number[]): void;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** a capsule from a to b, world coordinates; a marker where a is b */
|
|
2
|
+
export interface Capsule {
|
|
3
|
+
a: readonly [number, number, number];
|
|
4
|
+
b: readonly [number, number, number];
|
|
5
|
+
/** pixels */
|
|
6
|
+
radius: number;
|
|
7
|
+
/** rgba 0 to 1 */
|
|
8
|
+
colour: readonly [number, number, number, number];
|
|
9
|
+
/** hidden where splats lie in front */
|
|
10
|
+
occlude: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class Overlay {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(device: GPUDevice, format: GPUTextureFormat, uniforms: GPUBuffer);
|
|
15
|
+
get count(): number;
|
|
16
|
+
/** the capsules to draw, moved into the floating-origin frame at origin */
|
|
17
|
+
set(capsules: readonly Capsule[], origin: readonly [number, number, number]): void;
|
|
18
|
+
/** draws over target, which holds the finished frame; depth is the splats' log-depth span */
|
|
19
|
+
encode(encoder: GPUCommandEncoder, target: GPUTextureView, depth: GPUTextureView): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Frame, Shade } from '../plugin.ts';
|
|
2
|
+
import { type FrameBuffers } from './buffers.ts';
|
|
3
|
+
import type { Pool } from './pool.ts';
|
|
4
|
+
export interface Found {
|
|
5
|
+
/** view depth, metres */
|
|
6
|
+
depth: number;
|
|
7
|
+
/** 0 for the world */
|
|
8
|
+
layer: number;
|
|
9
|
+
/** the splat's thinnest axis, toward the camera */
|
|
10
|
+
normal: [number, number, number];
|
|
11
|
+
}
|
|
12
|
+
export declare class Pick {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(device: GPUDevice, pool: Pool, buffers: FrameBuffers);
|
|
15
|
+
/** the next pick runs these hooks, as project does */
|
|
16
|
+
hooks(shades: {
|
|
17
|
+
shade: Shade;
|
|
18
|
+
slot: number;
|
|
19
|
+
}[]): void;
|
|
20
|
+
/**
|
|
21
|
+
* submits a pick of target pixel (x, y from the top-left) over the frame's visible clusters;
|
|
22
|
+
* frame must be the last one submitted, whose uniforms and cull the buffers still hold. null
|
|
23
|
+
* where the splats over the pixel never reach half, and where more lay there than the buffer
|
|
24
|
+
* kept, which grows it for the next
|
|
25
|
+
*/
|
|
26
|
+
run(x: number, y: number, frame: Frame): Promise<Found | null>;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type DecodedPage } from '../../format/index.ts';
|
|
2
|
+
import { Masks } from './masks.ts';
|
|
3
|
+
import type { Prism } from '../math/prism.ts';
|
|
2
4
|
import type { Drawn } from '../types.ts';
|
|
3
5
|
export declare class Pool {
|
|
4
6
|
#private;
|
|
@@ -14,6 +16,7 @@ export declare class Pool {
|
|
|
14
16
|
listed: number;
|
|
15
17
|
/** splats */
|
|
16
18
|
capacity: number;
|
|
19
|
+
readonly masks: Masks;
|
|
17
20
|
constructor(device: GPUDevice, capacity: number);
|
|
18
21
|
/** clusters the pool can hold */
|
|
19
22
|
get slots(): number;
|
|
@@ -26,10 +29,11 @@ export declare class Pool {
|
|
|
26
29
|
ids(): Iterable<number>;
|
|
27
30
|
/**
|
|
28
31
|
* queues page id of the unit with south-west corner (e, n), evicting the least recently drawn
|
|
29
|
-
* pages keep rejects; false when it cannot fit even then
|
|
32
|
+
* pages keep rejects; false when it cannot fit even then. a page of a layer other than 0 is pinned
|
|
30
33
|
*/
|
|
31
|
-
add(id: number, page: DecodedPage, unit: readonly [number, number], keep: (id: number) => boolean): boolean;
|
|
34
|
+
add(id: number, page: DecodedPage, unit: readonly [number, number], keep: (id: number) => boolean, layer?: number): boolean;
|
|
32
35
|
remove(id: number): void;
|
|
36
|
+
/** removes every page but the pinned */
|
|
33
37
|
clear(): void;
|
|
34
38
|
/** pages queued and not yet uploaded */
|
|
35
39
|
get queued(): number;
|
|
@@ -39,6 +43,10 @@ export declare class Pool {
|
|
|
39
43
|
draw(drawn: Drawn[]): void;
|
|
40
44
|
/** world position of the floating origin; rewrites every page origin */
|
|
41
45
|
setOrigin(origin: readonly [number, number, number]): void;
|
|
46
|
+
/** a new mask over targets, layer numbers with 0 for the world; it hides from the next draw */
|
|
47
|
+
addMask(prism: Prism, targets: ReadonlySet<number>): number;
|
|
48
|
+
enableMask(id: number, enabled: boolean): void;
|
|
49
|
+
deleteMask(id: number): void;
|
|
42
50
|
/** room for capacity splats, the pages held staying in place; new buffers, so new bind groups */
|
|
43
51
|
grow(capacity: number): void;
|
|
44
52
|
destroy(): void;
|
|
@@ -11,3 +11,8 @@ export declare class Project {
|
|
|
11
11
|
}[]): void;
|
|
12
12
|
encode(encoder: GPUCommandEncoder, visible: number, timestamps?: GPUComputePassTimestampWrites): void;
|
|
13
13
|
}
|
|
14
|
+
/** wgsl of parts, the hooks, and a shade(s) that runs them in order, each from its first slot */
|
|
15
|
+
export declare function shaded(parts: string[], shades: {
|
|
16
|
+
shade: Shade;
|
|
17
|
+
slot: number;
|
|
18
|
+
}[]): string;
|
|
@@ -12,8 +12,3 @@ export declare class Raster {
|
|
|
12
12
|
encode(encoder: GPUCommandEncoder, colour: GPUTextureView, depth: GPUTextureView | null, sky: readonly [number, number, number], timestamps?: GPURenderPassTimestampWrites): void;
|
|
13
13
|
destroy(): void;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* encodes a read of depth texel (x, y from the top-left, clamped); the call it returns, once the
|
|
17
|
-
* encoder is submitted, gives view depth in metres, null where no splat drew
|
|
18
|
-
*/
|
|
19
|
-
export declare function depthAt(device: GPUDevice, encoder: GPUCommandEncoder, depth: GPUTexture, x: number, y: number, near: number, far: number): () => Promise<number | null>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Frame, Post, Shade } from '../plugin.ts';
|
|
2
2
|
import type { Gpu } from './device.ts';
|
|
3
3
|
import type { Pool } from './pool.ts';
|
|
4
|
+
import { type Capsule } from './overlay.ts';
|
|
5
|
+
import { type Found } from './pick.ts';
|
|
4
6
|
export interface GpuStats {
|
|
5
7
|
gpuMs: number;
|
|
6
8
|
passes: Record<string, number>;
|
|
@@ -8,12 +10,6 @@ export interface GpuStats {
|
|
|
8
10
|
drawn: number;
|
|
9
11
|
bytes: number;
|
|
10
12
|
}
|
|
11
|
-
/** view depth in metres of the nearest splat under target pixel (x, y from the top-left), null where none drew */
|
|
12
|
-
export interface DepthPick {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
resolve: (depth: number | null) => void;
|
|
16
|
-
}
|
|
17
13
|
/** Heights over cells x cells from corner (x, y), floating-origin frame */
|
|
18
14
|
export interface HeightsRequest {
|
|
19
15
|
x: number;
|
|
@@ -32,8 +28,12 @@ export declare class Renderer {
|
|
|
32
28
|
post(pass: Post): () => void;
|
|
33
29
|
/** render target size in pixels */
|
|
34
30
|
resize(width: number, height: number): void;
|
|
35
|
-
/**
|
|
36
|
-
|
|
31
|
+
/** the surface under target pixel (x, y from the top-left) as frame, the last rendered, drew it */
|
|
32
|
+
pick(x: number, y: number, frame: Frame): Promise<Found | null>;
|
|
33
|
+
/** host graphics the frames draw last, world coordinates moved to the floating origin */
|
|
34
|
+
overlay(capsules: readonly Capsule[], origin: readonly [number, number, number]): void;
|
|
35
|
+
/** encodes and submits a frame that answers heights; resolves when the gpu has finished it */
|
|
36
|
+
render(frame: Frame, planes: Float32Array, sky: readonly [number, number, number], heights: HeightsRequest[]): Promise<void>;
|
|
37
37
|
stats(): GpuStats;
|
|
38
38
|
destroy(): void;
|
|
39
39
|
}
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { createEngine, NoWebGpu } from './engine.ts';
|
|
2
|
-
export type { Engine, EngineOptions, StepReport } from './engine.ts';
|
|
2
|
+
export type { Engine, EngineOptions, Hit, StepReport } from './engine.ts';
|
|
3
3
|
export type { Cache, Fetch } from '../ports.ts';
|
|
4
4
|
export type { Frame, Host, Plugin, Post, PostPass, Shade } from './plugin.ts';
|
|
5
|
+
export type { Layer } from './layer.ts';
|
|
6
|
+
export type { Mask, MaskOptions } from './mask.ts';
|
|
7
|
+
export type { Colour, Line, LineStyle, Marker, MarkerStyle } from './overlay.ts';
|
|
5
8
|
export type { World } from '../format/index.ts';
|
|
6
|
-
export type { Camera, Settings, Stats } from './types.ts';
|
|
9
|
+
export type { Box, Camera, Progress, Settings, Stats } from './types.ts';
|
|
7
10
|
export { grade } from './plugins/grade.ts';
|
|
8
11
|
export { dof } from './plugins/dof.ts';
|
|
9
12
|
export { fog } from './plugins/fog.ts';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type DecodedPage } from '../format/index.ts';
|
|
2
|
+
import type { Box } from './types.ts';
|
|
3
|
+
export interface Layer {
|
|
4
|
+
/** splats it draws */
|
|
5
|
+
readonly splats: number;
|
|
6
|
+
/** world extent of its splats' 3-sigma boxes */
|
|
7
|
+
readonly box: Box;
|
|
8
|
+
/** a hidden layer costs no frame time; its pages stay on the gpu, so it shows again at once */
|
|
9
|
+
visible: boolean;
|
|
10
|
+
/** 0 to 1, of every splat */
|
|
11
|
+
opacity: number;
|
|
12
|
+
/** frees its pages; the handle then does nothing */
|
|
13
|
+
remove(): void;
|
|
14
|
+
}
|
|
15
|
+
export interface LayerPage {
|
|
16
|
+
page: DecodedPage;
|
|
17
|
+
/** world min e, n, h then max e, n, h of its splats' extents */
|
|
18
|
+
box: Float64Array;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* the pages of a pack whose positions count from origin, the south-west corner; only its finest
|
|
22
|
+
* level, as a layer draws at full detail at every distance
|
|
23
|
+
*/
|
|
24
|
+
export declare function layerPages(pack: Uint8Array, origin: readonly [number, number]): Promise<LayerPage[]>;
|
|
25
|
+
/** the extent of page boxes as layerPages gives them */
|
|
26
|
+
export declare function boxOf(boxes: Float64Array[]): Box;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Layer } from './layer.ts';
|
|
2
|
+
/**
|
|
3
|
+
* a splat of a target is hidden while its centre lies inside the polygon by the even-odd rule and
|
|
4
|
+
* within z; at every level, through fades and while pages stream
|
|
5
|
+
*/
|
|
6
|
+
export interface MaskOptions {
|
|
7
|
+
/** world e, n of its corners, three or more */
|
|
8
|
+
polygon: readonly (readonly [number, number])[];
|
|
9
|
+
/** world heights from and to; the full height when left out */
|
|
10
|
+
z?: readonly [number, number];
|
|
11
|
+
/** what it hides: 'world' for the world's own splats, and layers */
|
|
12
|
+
targets: readonly (Layer | 'world')[];
|
|
13
|
+
}
|
|
14
|
+
export interface Mask {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
/** shows what it hid; the handle then does nothing */
|
|
17
|
+
remove(): void;
|
|
18
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Mat4 } from './mat4.ts';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* the six planes of a webgpu view-projection (clip z 0..1), normalised; inside when n.p + d >= 0.
|
|
4
|
+
* sides moves left, right, bottom, top to those ndc bounds
|
|
5
|
+
*/
|
|
6
|
+
export declare function planes(out: Float32Array | Float64Array, m: Mat4, sides?: readonly number[]): typeof out;
|
|
4
7
|
/** false only when the box lies wholly outside one plane */
|
|
5
8
|
export declare function boxVisible(p: ArrayLike<number>, min: ArrayLike<number>, max: ArrayLike<number>): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** polygon as e0, n0, e1, n1, ..; z the height range, infinite for the full height */
|
|
2
|
+
export interface Prism {
|
|
3
|
+
polygon: Float64Array;
|
|
4
|
+
z: readonly [number, number];
|
|
5
|
+
}
|
|
6
|
+
/** a box's relation to a prism, for every point in the box */
|
|
7
|
+
export declare const OUT = 0;
|
|
8
|
+
export declare const IN = 1;
|
|
9
|
+
export declare const CROSS = 2;
|
|
10
|
+
/** (x, y) inside polygon by the even-odd rule; masks.wgsl tests the same way */
|
|
11
|
+
export declare function inside(polygon: ArrayLike<number>, x: number, y: number): boolean;
|
|
12
|
+
/** OUT, IN or CROSS for the box min x, y, z to max x, y, z */
|
|
13
|
+
export declare function relate(prism: Prism, min: ArrayLike<number>, max: ArrayLike<number>): number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** rgba, each 0 to 1 */
|
|
2
|
+
export type Colour = readonly [number, number, number, number];
|
|
3
|
+
type Point = readonly [number, number, number];
|
|
4
|
+
export interface LineStyle {
|
|
5
|
+
colour?: Colour;
|
|
6
|
+
/** css pixels */
|
|
7
|
+
width?: number;
|
|
8
|
+
/** joins the last point to the first */
|
|
9
|
+
closed?: boolean;
|
|
10
|
+
/** hidden where splats lie in front; true when left out */
|
|
11
|
+
occlude?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface MarkerStyle {
|
|
14
|
+
colour?: Colour;
|
|
15
|
+
/** css pixels across */
|
|
16
|
+
size?: number;
|
|
17
|
+
/** hidden where splats lie in front; true when left out */
|
|
18
|
+
occlude?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface Line {
|
|
21
|
+
set(points: readonly Point[]): void;
|
|
22
|
+
remove(): void;
|
|
23
|
+
}
|
|
24
|
+
export interface Marker {
|
|
25
|
+
set(point: Point): void;
|
|
26
|
+
remove(): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -17,6 +17,8 @@ export declare class Feed {
|
|
|
17
17
|
* arriving pages into the pool while protecting plan.keep and drawn
|
|
18
18
|
*/
|
|
19
19
|
update(plan: Plan, drawn: ReadonlySet<number>, now: number): void;
|
|
20
|
+
/** a page the pool must not evict for another: plan.keep or drawn holds it */
|
|
21
|
+
protects: (id: number) => boolean;
|
|
20
22
|
/** idx fetches and page batches in flight */
|
|
21
23
|
get loading(): number;
|
|
22
24
|
/** pages wanted and not yet started */
|
package/dist/engine/types.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ export interface Drawn {
|
|
|
3
3
|
id: number;
|
|
4
4
|
factors: number;
|
|
5
5
|
}
|
|
6
|
+
/** world metres, min and max per axis, as World.extent */
|
|
7
|
+
export interface Box {
|
|
8
|
+
e: readonly [number, number];
|
|
9
|
+
n: readonly [number, number];
|
|
10
|
+
h: readonly [number, number];
|
|
11
|
+
}
|
|
6
12
|
/** degrees; yaw clockwise from north, pitch negative looks down, fov vertical */
|
|
7
13
|
export interface Camera {
|
|
8
14
|
e: number;
|
|
@@ -53,3 +59,5 @@ export interface Stats {
|
|
|
53
59
|
scale: number;
|
|
54
60
|
loading: boolean;
|
|
55
61
|
}
|
|
62
|
+
/** how far the view has loaded, as stats() also gives it */
|
|
63
|
+
export type Progress = Pick<Stats, 'planned' | 'missing' | 'loading'>;
|
package/dist/format/encode.d.ts
CHANGED
|
@@ -31,6 +31,14 @@ export declare function encodePack(pages: {
|
|
|
31
31
|
row: PageRow;
|
|
32
32
|
blob: Uint8Array;
|
|
33
33
|
}[]): Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
* world-ENU splats as the pack of one page, which a layer draws; origin is the south-west corner in
|
|
36
|
+
* whole metres that the pack's positions count from
|
|
37
|
+
*/
|
|
38
|
+
export declare function encodeLayer(splats: Splats): Promise<{
|
|
39
|
+
pack: Uint8Array;
|
|
40
|
+
origin: [number, number];
|
|
41
|
+
}>;
|
|
34
42
|
/** magic, version and the deflated body */
|
|
35
43
|
export declare function wrap(body: Uint8Array, magic: string): Promise<Uint8Array>;
|
|
36
44
|
export declare function encodeIdx(idx: Idx): Promise<Uint8Array>;
|
package/dist/format/idx.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Idx, PageRow, UnitKey } from './types.ts';
|
|
2
2
|
/** a 52-byte page row at offset, as in .idx and the .pack table */
|
|
3
3
|
export declare function rowAt(view: DataView, offset: number): PageRow;
|
|
4
|
+
/** the rows of a pack's page table, through read(start, end) of a pack of size bytes; throws naming the fault */
|
|
5
|
+
export declare function packRows(read: (start: number, end: number) => Promise<Uint8Array>, size: number): Promise<PageRow[]>;
|
|
4
6
|
/** throws an Error naming the fault when the bytes are not a v1 .idx */
|
|
5
7
|
export declare function parseIdx(bytes: Uint8Array): Promise<Idx>;
|
|
6
8
|
/** u/<L>/<E>/<N>.<hash>.<ext>, relative to world.json */
|
package/dist/format/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from './spec.ts';
|
|
2
2
|
export type { Col, DecodedPage, Idx, PageRow, UnitKey, World, WorldRoot } from './types.ts';
|
|
3
3
|
export { directory, parseWorld } from './world.ts';
|
|
4
|
-
export { namedUnits, parseIdx, parseUnitPath, rowAt, unitPath } from './idx.ts';
|
|
4
|
+
export { namedUnits, packRows, parseIdx, parseUnitPath, rowAt, unitPath } from './idx.ts';
|
|
5
5
|
export { parseCol, sampleCol } from './col.ts';
|
|
6
6
|
export { decodePage, pageHeader, readSplat } from './page.ts';
|
|
7
7
|
export type { SplatValues } from './page.ts';
|
|
8
8
|
export { inflate } from './inflate.ts';
|
|
9
9
|
export { contentHash } from './hash.ts';
|
|
10
|
+
export { encodeLayer, type Splats } from './encode.ts';
|
package/dist/format/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { x as BASE_PLANES, S as C0, C as C1, w as CHILD_BYTES, T as CLUSTER, E as COLOUR_WORDS, D as COL_CHANNELS, O as COL_HEADER, k as COL_MAGIC, A as DESCENDANT_BYTES, j as GEOMETRY_WORDS, M as IDX_HEADER, N as IDX_MAGIC, P as LEAF, F as PACK_MAGIC, I as PACK_TRAILER, L as PAGE_HEADER, R as PAGE_PARAMS, z as PAGE_SIDE, B as PARAMS, V as PLANES, H as PREFIX, U as ROW_BYTES, W as SH_COEFFS, G as VERSION, o as contentHash, s as decodePage, f as directory, r as encodeLayer, b as inflate, m as namedUnits, h as packRows, c as pageHeader, u as parseCol, g as parseIdx, _ as parseUnitPath, p as parseWorld, l as readSplat, v as rowAt, d as sampleCol, y as unitPath } from "../format-CbtEy9NS.js";
|