@margoengine/tiles 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +307 -3
- package/dist/bounds-CgKJT3Pg.js +161 -0
- package/dist/bounds.d.ts +66 -0
- package/dist/data-uri-DbGLVHq5.js +132 -0
- package/dist/data-uri.d.ts +2 -0
- package/dist/errors-D5_2oB8I.js +7 -0
- package/dist/fade.d.ts +34 -0
- package/dist/fade.js +129 -0
- package/dist/feature-texture.d.ts +19 -0
- package/dist/features.d.ts +78 -0
- package/dist/features.js +401 -0
- package/dist/formats-NNuOXg-1.js +390 -0
- package/dist/formats.d.ts +124 -0
- package/dist/glb-BU81jlYZ.js +25 -0
- package/dist/height.d.ts +20 -0
- package/dist/height.js +31 -0
- package/dist/i3dm.d.ts +16 -0
- package/dist/i3dm.js +85 -0
- package/dist/imagery.d.ts +108 -0
- package/dist/imagery.js +325 -0
- package/dist/implicit.d.ts +42 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +849 -0
- package/dist/ion.d.ts +106 -0
- package/dist/ion.js +152 -0
- package/dist/json-BQoirgm5.js +4 -0
- package/dist/matrix-DcI5oFrD.js +89 -0
- package/dist/matrix.d.ts +32 -0
- package/dist/memory.d.ts +44 -0
- package/dist/metadata.d.ts +147 -0
- package/dist/metadata.js +285 -0
- package/dist/properties.d.ts +94 -0
- package/dist/properties.js +320 -0
- package/dist/queue.d.ts +37 -0
- package/dist/raw-accessor.d.ts +4 -0
- package/dist/renderer.d.ts +193 -0
- package/dist/s2.d.ts +37 -0
- package/dist/s2.js +181 -0
- package/dist/scene-scope-DufD_3B6.js +42 -0
- package/dist/screen-door-CMv5Jko4.js +11 -0
- package/dist/shared/screen-door.d.ts +9 -0
- package/dist/splats.d.ts +80 -0
- package/dist/splats.js +187 -0
- package/dist/style.d.ts +61 -0
- package/dist/style.js +609 -0
- package/dist/terrain.d.ts +96 -0
- package/dist/terrain.js +434 -0
- package/dist/tileset.d.ts +316 -0
- package/dist/uv-transform.d.ts +11 -0
- package/dist/wgs84-C5btsGGY.js +18 -0
- package/dist/wgs84.d.ts +24 -0
- package/package.json +124 -6
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" preserve="true" />
|
|
2
|
+
import { type BoundingVolumeExtension, type BoundingVolumeJSON, type TileBounds } from './bounds.js';
|
|
3
|
+
import { type TileContent } from './formats.js';
|
|
4
|
+
import { type ImplicitTilingJSON, type Subtree } from './implicit.js';
|
|
5
|
+
import { type TileMatrix } from './matrix.js';
|
|
6
|
+
/** How a tile's children add detail: ADD draws them on top of it, REPLACE draws them instead of it. */
|
|
7
|
+
export type Refine = 'ADD' | 'REPLACE';
|
|
8
|
+
/** Content state of a tile. */
|
|
9
|
+
export type TileState = 'unloaded' | 'loading' | 'ready' | 'failed';
|
|
10
|
+
/** What a content factory returns: something drawable with a size in bytes, shown or hidden each update. */
|
|
11
|
+
export interface TileRenderable {
|
|
12
|
+
/** Bytes this content holds (GPU and CPU); counted against `memoryBudget`. */
|
|
13
|
+
readonly bytes: number;
|
|
14
|
+
/** Set by the tileset each update: true while the tile is selected for drawing. */
|
|
15
|
+
visible: boolean;
|
|
16
|
+
/** Frees the content; called on eviction and on `tileset.dispose()`. */
|
|
17
|
+
dispose(): void;
|
|
18
|
+
/** The engine model drawing this content when it is one (glTF, b3dm): what height and pick queries cast against. */
|
|
19
|
+
readonly model?: object;
|
|
20
|
+
}
|
|
21
|
+
/** Turns parsed content into a renderable. Throw (or reject) to fail the tile; honour `signal`. */
|
|
22
|
+
export type ContentFactory = (content: TileContent, tile: TilesetTile, signal: AbortSignal) => TileRenderable | Promise<TileRenderable>;
|
|
23
|
+
/** A metadata entity of 3D Tiles 1.1 (`tileset.metadata`, `tile.metadata`, `content.metadata`, groups). */
|
|
24
|
+
export interface MetadataEntity {
|
|
25
|
+
class: string;
|
|
26
|
+
properties?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
/** A tile JSON object (the parts this package reads). */
|
|
29
|
+
export interface TileJSON {
|
|
30
|
+
boundingVolume: BoundingVolumeJSON;
|
|
31
|
+
viewerRequestVolume?: BoundingVolumeJSON;
|
|
32
|
+
geometricError: number;
|
|
33
|
+
refine?: Refine;
|
|
34
|
+
transform?: readonly number[];
|
|
35
|
+
content?: ContentJSON;
|
|
36
|
+
contents?: ContentJSON[];
|
|
37
|
+
children?: TileJSON[];
|
|
38
|
+
implicitTiling?: ImplicitTilingJSON;
|
|
39
|
+
metadata?: MetadataEntity;
|
|
40
|
+
}
|
|
41
|
+
/** A tile content JSON object. */
|
|
42
|
+
export interface ContentJSON {
|
|
43
|
+
uri?: string;
|
|
44
|
+
/** 3D Tiles 1.0 pre-release name of `uri`. */
|
|
45
|
+
url?: string;
|
|
46
|
+
boundingVolume?: BoundingVolumeJSON;
|
|
47
|
+
metadata?: MetadataEntity;
|
|
48
|
+
group?: number;
|
|
49
|
+
}
|
|
50
|
+
/** A tileset JSON object (the parts this package reads). */
|
|
51
|
+
export interface TilesetJSON {
|
|
52
|
+
asset: {
|
|
53
|
+
version: string;
|
|
54
|
+
tilesetVersion?: string;
|
|
55
|
+
};
|
|
56
|
+
geometricError: number;
|
|
57
|
+
root: TileJSON;
|
|
58
|
+
properties?: Record<string, unknown>;
|
|
59
|
+
schema?: MetadataSchema;
|
|
60
|
+
schemaUri?: string;
|
|
61
|
+
metadata?: MetadataEntity;
|
|
62
|
+
groups?: MetadataEntity[];
|
|
63
|
+
extensionsUsed?: string[];
|
|
64
|
+
extensionsRequired?: string[];
|
|
65
|
+
}
|
|
66
|
+
/** A metadata schema (classes with typed properties and defaults); only `default` values are interpreted. */
|
|
67
|
+
export interface MetadataSchema {
|
|
68
|
+
id?: string;
|
|
69
|
+
classes?: Record<string, {
|
|
70
|
+
properties?: Record<string, {
|
|
71
|
+
type?: string;
|
|
72
|
+
default?: unknown;
|
|
73
|
+
required?: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
}>;
|
|
76
|
+
enums?: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
interface ImplicitContext {
|
|
79
|
+
readonly scheme: 'QUADTREE' | 'OCTREE';
|
|
80
|
+
readonly subtreeLevels: number;
|
|
81
|
+
readonly availableLevels: number;
|
|
82
|
+
readonly subtreeTemplate: string;
|
|
83
|
+
readonly contentTemplates: readonly string[];
|
|
84
|
+
readonly base: string;
|
|
85
|
+
readonly rootBounds: TileBounds;
|
|
86
|
+
readonly rootError: number;
|
|
87
|
+
readonly refine: Refine;
|
|
88
|
+
readonly transform: TileMatrix;
|
|
89
|
+
readonly subtrees: Map<string, Subtree>;
|
|
90
|
+
}
|
|
91
|
+
/** One tile of the tree. Explicit tiles come from JSON; implicit ones are created as their subtrees arrive. */
|
|
92
|
+
export declare class TilesetTile {
|
|
93
|
+
/** Unique within the tileset: the content URL, or the JSON path / implicit coordinates. */
|
|
94
|
+
readonly id: string;
|
|
95
|
+
readonly parent: TilesetTile | null;
|
|
96
|
+
/** Children known so far (implicit and external children appear once their subtree or tileset has loaded). */
|
|
97
|
+
children: TilesetTile[];
|
|
98
|
+
/** Depth from the tileset root (external tileset roots continue the count). */
|
|
99
|
+
readonly depth: number;
|
|
100
|
+
readonly geometricError: number;
|
|
101
|
+
readonly refine: Refine;
|
|
102
|
+
/** Computed transform: every ancestor's `transform` times this one's, float64, tileset coordinates. */
|
|
103
|
+
readonly transform: TileMatrix;
|
|
104
|
+
readonly bounds: TileBounds;
|
|
105
|
+
readonly contentBounds?: TileBounds;
|
|
106
|
+
readonly viewerRequestVolume?: TileBounds;
|
|
107
|
+
/** Absolute content URLs (3D Tiles 1.1 allows several); empty for an empty tile. */
|
|
108
|
+
readonly contentUrls: readonly string[];
|
|
109
|
+
/** `tile.metadata`, and per content `content.metadata` and `content.group`. */
|
|
110
|
+
readonly metadata?: MetadataEntity;
|
|
111
|
+
readonly contentMetadata: readonly (MetadataEntity | undefined)[];
|
|
112
|
+
readonly contentGroups: readonly (number | undefined)[];
|
|
113
|
+
/** Implicit coordinates (level, x, y, z) for implicit tiles. */
|
|
114
|
+
readonly implicit?: {
|
|
115
|
+
readonly level: number;
|
|
116
|
+
readonly x: number;
|
|
117
|
+
readonly y: number;
|
|
118
|
+
readonly z: number;
|
|
119
|
+
};
|
|
120
|
+
state: TileState;
|
|
121
|
+
/** True once its content turned out to be an external tileset (its child is that tileset's root). */
|
|
122
|
+
external: boolean;
|
|
123
|
+
/** Parsed contents while ready. */
|
|
124
|
+
contents: TileContent[];
|
|
125
|
+
renderable?: TileRenderable;
|
|
126
|
+
/** Why the last load failed. */
|
|
127
|
+
error?: Error;
|
|
128
|
+
/** Selection values of the last update: distance from the camera and screen-space error in pixels. */
|
|
129
|
+
distance: number;
|
|
130
|
+
screenSpaceError: number;
|
|
131
|
+
/** Last update that drew or needed this tile. */
|
|
132
|
+
lastUsed: number;
|
|
133
|
+
/** @internal */
|
|
134
|
+
context?: ImplicitContext;
|
|
135
|
+
/** @internal */
|
|
136
|
+
expanded: boolean;
|
|
137
|
+
constructor(init: {
|
|
138
|
+
id: string;
|
|
139
|
+
parent: TilesetTile | null;
|
|
140
|
+
geometricError: number;
|
|
141
|
+
refine: Refine;
|
|
142
|
+
transform: TileMatrix;
|
|
143
|
+
bounds: TileBounds;
|
|
144
|
+
contentBounds?: TileBounds;
|
|
145
|
+
viewerRequestVolume?: TileBounds;
|
|
146
|
+
contentUrls: readonly string[];
|
|
147
|
+
metadata?: MetadataEntity;
|
|
148
|
+
contentMetadata?: readonly (MetadataEntity | undefined)[];
|
|
149
|
+
contentGroups?: readonly (number | undefined)[];
|
|
150
|
+
implicit?: {
|
|
151
|
+
level: number;
|
|
152
|
+
x: number;
|
|
153
|
+
y: number;
|
|
154
|
+
z: number;
|
|
155
|
+
};
|
|
156
|
+
context?: ImplicitContext;
|
|
157
|
+
});
|
|
158
|
+
/** True when the tile has content to load (an empty tile only groups its children). */
|
|
159
|
+
get hasContent(): boolean;
|
|
160
|
+
}
|
|
161
|
+
/** The camera, in tileset coordinates, for one update. */
|
|
162
|
+
export interface TilesView {
|
|
163
|
+
/** Camera position, tileset (usually ECEF) coordinates. */
|
|
164
|
+
readonly position: ArrayLike<number>;
|
|
165
|
+
/** 6 frustum planes [a, b, c, d] (a x + b y + c z + d >= 0 inside), tileset coordinates. Omit to keep every tile. */
|
|
166
|
+
readonly planes?: ArrayLike<number>;
|
|
167
|
+
/** Drawing-buffer height in pixels. */
|
|
168
|
+
readonly screenHeight: number;
|
|
169
|
+
/** Vertical field of view in degrees (perspective). Default 60. */
|
|
170
|
+
readonly fov?: number;
|
|
171
|
+
/** World height the view shows, for orthographic cameras (screen-space error then ignores distance). */
|
|
172
|
+
readonly orthographicHeight?: number;
|
|
173
|
+
}
|
|
174
|
+
/** Options of `Tileset.load` and `Tileset.from`. */
|
|
175
|
+
export interface TilesetOptions {
|
|
176
|
+
/** Fetch to use (a custom one serves tests, auth headers or an offline cache). Default `globalThis.fetch`. */
|
|
177
|
+
fetch?: (input: string, init?: {
|
|
178
|
+
signal?: AbortSignal;
|
|
179
|
+
}) => Promise<Response>;
|
|
180
|
+
/** Aborts the tileset load, every request, and makes the tileset stop requesting. */
|
|
181
|
+
signal?: AbortSignal;
|
|
182
|
+
/** Refine while a tile's screen-space error is above this many pixels. Default 16. */
|
|
183
|
+
maximumScreenSpaceError?: number;
|
|
184
|
+
/** Requests in flight at once. Default 6. */
|
|
185
|
+
maxConcurrentRequests?: number;
|
|
186
|
+
/** Bytes of ready content to keep; least recently used tiles outside the view are evicted past it. Default 512 MiB. */
|
|
187
|
+
memoryBudget?: number;
|
|
188
|
+
/**
|
|
189
|
+
* Skip levels of detail: do not load REPLACE ancestors whose error is more than `skipScreenSpaceErrorFactor` times the
|
|
190
|
+
* target, so the view fills in at its final detail sooner (holes show until it does). Default false.
|
|
191
|
+
*/
|
|
192
|
+
skipLevelOfDetail?: boolean;
|
|
193
|
+
/** See `skipLevelOfDetail`. Default 16. */
|
|
194
|
+
skipScreenSpaceErrorFactor?: number;
|
|
195
|
+
/** Makes renderables from parsed content. Default: keep the parsed content only (bytes = content size). */
|
|
196
|
+
content?: ContentFactory;
|
|
197
|
+
/** Bounding volume extensions to read, such as `s2` from `@margoengine/tiles/s2`. Default none. */
|
|
198
|
+
boundingVolumes?: readonly BoundingVolumeExtension[];
|
|
199
|
+
}
|
|
200
|
+
/** Counts reported by `progress` and `idle` events and `tileset.progress`. */
|
|
201
|
+
export interface TilesProgress {
|
|
202
|
+
/** Requests waiting. */
|
|
203
|
+
readonly queued: number;
|
|
204
|
+
/** Requests in flight. */
|
|
205
|
+
readonly loading: number;
|
|
206
|
+
/** Tiles with content ready. */
|
|
207
|
+
readonly ready: number;
|
|
208
|
+
/** Tiles whose last load failed. */
|
|
209
|
+
readonly failed: number;
|
|
210
|
+
/** Tiles selected for drawing in the last update. */
|
|
211
|
+
readonly selected: number;
|
|
212
|
+
/** Bytes of ready content, and the budget. */
|
|
213
|
+
readonly bytes: number;
|
|
214
|
+
readonly memoryBudget: number;
|
|
215
|
+
}
|
|
216
|
+
/** Events of a `Tileset`. */
|
|
217
|
+
export interface TilesetEvents {
|
|
218
|
+
/** Visibility is selected, before eviction; optional transitions may retain visible outgoing content. */
|
|
219
|
+
selection: {
|
|
220
|
+
selected: readonly TilesetTile[];
|
|
221
|
+
};
|
|
222
|
+
tileload: {
|
|
223
|
+
tile: TilesetTile;
|
|
224
|
+
};
|
|
225
|
+
tileunload: {
|
|
226
|
+
tile: TilesetTile;
|
|
227
|
+
};
|
|
228
|
+
error: {
|
|
229
|
+
tile?: TilesetTile;
|
|
230
|
+
error: Error;
|
|
231
|
+
};
|
|
232
|
+
progress: TilesProgress;
|
|
233
|
+
/** After an update that left nothing queued or loading (the view is complete). */
|
|
234
|
+
idle: TilesProgress;
|
|
235
|
+
}
|
|
236
|
+
/** Result of `tileset.update`. */
|
|
237
|
+
export interface TilesFrame {
|
|
238
|
+
/** Tiles drawn this update, in traversal order. */
|
|
239
|
+
readonly selected: readonly TilesetTile[];
|
|
240
|
+
/** Tiles wanted but not ready (queued or loading). */
|
|
241
|
+
readonly pending: number;
|
|
242
|
+
}
|
|
243
|
+
/** A streaming 3D Tiles tileset. Call `update(view)` every frame; it selects, requests, shows and evicts tiles. */
|
|
244
|
+
export declare class Tileset {
|
|
245
|
+
readonly url: string;
|
|
246
|
+
readonly json: TilesetJSON;
|
|
247
|
+
readonly root: TilesetTile;
|
|
248
|
+
/** Tileset metadata schema, when the tileset has one (inline or from `schemaUri`). */
|
|
249
|
+
readonly schema?: MetadataSchema;
|
|
250
|
+
/** `tileset.metadata`. */
|
|
251
|
+
readonly metadata?: MetadataEntity;
|
|
252
|
+
/** `tileset.groups`. */
|
|
253
|
+
readonly groups: readonly MetadataEntity[];
|
|
254
|
+
maximumScreenSpaceError: number;
|
|
255
|
+
memoryBudget: number;
|
|
256
|
+
skipLevelOfDetail: boolean;
|
|
257
|
+
skipScreenSpaceErrorFactor: number;
|
|
258
|
+
/** Bytes of ready content now. */
|
|
259
|
+
bytes: number;
|
|
260
|
+
/** True after an update where the visible tiles alone passed `memoryBudget` (refinement then waits). */
|
|
261
|
+
overBudget: boolean;
|
|
262
|
+
disposed: boolean;
|
|
263
|
+
private readonly fetcher;
|
|
264
|
+
private readonly queue;
|
|
265
|
+
private readonly controller;
|
|
266
|
+
private readonly factory?;
|
|
267
|
+
private readonly volumes;
|
|
268
|
+
private readonly listeners;
|
|
269
|
+
private readonly ready;
|
|
270
|
+
private readonly failed;
|
|
271
|
+
private readonly failedSubtrees;
|
|
272
|
+
private frame;
|
|
273
|
+
private shown;
|
|
274
|
+
private pending;
|
|
275
|
+
private wasIdle;
|
|
276
|
+
/** Fetches tileset JSON (and its `schemaUri`) and returns the tileset. Aborts with `options.signal`. */
|
|
277
|
+
static load(url: string | URL, options?: TilesetOptions): Promise<Tileset>;
|
|
278
|
+
/** A tileset from JSON already in memory; relative URIs resolve against `url`. */
|
|
279
|
+
static from(json: unknown, url: string | URL, options?: TilesetOptions): Tileset;
|
|
280
|
+
private constructor();
|
|
281
|
+
/** Subscribes to an event; returns the unsubscribe function. */
|
|
282
|
+
on<K extends keyof TilesetEvents>(type: K, listener: (event: TilesetEvents[K]) => void): () => void;
|
|
283
|
+
private emit;
|
|
284
|
+
/** Current counts (the payload of `progress`). */
|
|
285
|
+
get progress(): TilesProgress;
|
|
286
|
+
/** Every tile known so far, depth first. */
|
|
287
|
+
tiles(): IterableIterator<TilesetTile>;
|
|
288
|
+
/** A metadata entity's properties with the schema's `default` values filled in for properties it leaves out. */
|
|
289
|
+
properties(entity: MetadataEntity | undefined): Record<string, unknown>;
|
|
290
|
+
/** Screen-space error in pixels of an error in metres at a distance, for a view. */
|
|
291
|
+
static screenSpaceError(geometricError: number, distance: number, view: TilesView): number;
|
|
292
|
+
/**
|
|
293
|
+
* Selects the tiles to draw for a view, shows them, hides the rest, queues missing content by priority, evicts past
|
|
294
|
+
* the memory budget and emits `progress` (and `idle` once nothing is pending).
|
|
295
|
+
*/
|
|
296
|
+
update(view: TilesView): TilesFrame;
|
|
297
|
+
/** Forgets failed loads so the next update requests them again (after a network error is fixed). */
|
|
298
|
+
retry(): void;
|
|
299
|
+
/** Aborts every request and frees every renderable. */
|
|
300
|
+
dispose(): void;
|
|
301
|
+
[Symbol.dispose](): void;
|
|
302
|
+
private visit;
|
|
303
|
+
private mightBeTileset;
|
|
304
|
+
private draw;
|
|
305
|
+
private want;
|
|
306
|
+
/** Fetches bytes with this tileset's fetch (auth headers, caches); a non-OK answer throws code `failed`. */
|
|
307
|
+
fetchBytes(url: string, signal?: AbortSignal): Promise<Uint8Array>;
|
|
308
|
+
private loadTile;
|
|
309
|
+
private fail;
|
|
310
|
+
private attachExternal;
|
|
311
|
+
private unload;
|
|
312
|
+
private evict;
|
|
313
|
+
private buildTile;
|
|
314
|
+
private expand;
|
|
315
|
+
}
|
|
316
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KHR_texture_transform as the two rows of one 2x3 affine map, uv' = T * R * S * uv. Rotation uses the sign
|
|
3
|
+
* that `@margoengine/gltf/texture-coordinates` renders with (u' = c*u + s*v, v' = -s*u + c*v; checked there against
|
|
4
|
+
* the Khronos TextureTransformTest and TextureTransformMultiTest references), so a property or feature-ID texture
|
|
5
|
+
* read on the CPU, highlighted on the GPU and drawn by the model all sample the same texel.
|
|
6
|
+
*/
|
|
7
|
+
export type UVRows = readonly [number, number, number, number, number, number];
|
|
8
|
+
export declare function uvRows(scale: readonly number[], offset: readonly number[], rotation: number): UVRows;
|
|
9
|
+
export declare function applyUV(m: UVRows, u: number, v: number): [number, number];
|
|
10
|
+
/** The same map as a WGSL expression over the vec2f expression `p`. */
|
|
11
|
+
export declare function uvRowsWGSL(m: UVRows, p: string): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as e from "@margoengine/math/geo";
|
|
2
|
+
//#region src/wgs84.ts
|
|
3
|
+
var t = 6378137, n = 1 / 298.257223563, r = t * .9966471893352525;
|
|
4
|
+
function i(t, n, r = 0) {
|
|
5
|
+
return e.cartographicToEcef(t, n, r);
|
|
6
|
+
}
|
|
7
|
+
function a(t, n, r) {
|
|
8
|
+
return e.ecefToCartographic(t, n, r);
|
|
9
|
+
}
|
|
10
|
+
function o(t, n, r) {
|
|
11
|
+
return e.geodeticNormal(t, n, r);
|
|
12
|
+
}
|
|
13
|
+
function s(e, t, n) {
|
|
14
|
+
let { longitude: r, latitude: i } = a(e, t, n), o = Math.sin(r), s = Math.cos(r), c = Math.sin(i), l = Math.cos(i);
|
|
15
|
+
return Float64Array.of(-o, s, 0, 0, -c * s, -c * o, l, 0, l * s, l * o, c, 0, e, t, n, 1);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { s as a, i, r as n, a as o, n as r, o as s, t };
|
package/dist/wgs84.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TileMatrix } from './matrix.js';
|
|
2
|
+
/** WGS84 semi-major axis, metres. */
|
|
3
|
+
export declare const WGS84_A = 6378137;
|
|
4
|
+
/** WGS84 flattening. */
|
|
5
|
+
export declare const WGS84_F: number;
|
|
6
|
+
/** WGS84 semi-minor axis, metres. */
|
|
7
|
+
export declare const WGS84_B: number;
|
|
8
|
+
/** Geodetic coordinates: longitude and latitude in radians, height above the ellipsoid in metres. */
|
|
9
|
+
export interface Cartographic {
|
|
10
|
+
longitude: number;
|
|
11
|
+
latitude: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
/** Geodetic (radians, metres) to ECEF metres. */
|
|
15
|
+
export declare function cartographicToEcef(longitude: number, latitude: number, height?: number): [number, number, number];
|
|
16
|
+
/** ECEF metres to geodetic (Bowring 1976 plus refinement): sub-millimetre from the earth's centre to geostationary heights. */
|
|
17
|
+
export declare function ecefToCartographic(x: number, y: number, z: number): Cartographic;
|
|
18
|
+
/** The ellipsoid's outward unit normal (geodetic up) at an ECEF point. */
|
|
19
|
+
export declare function geodeticNormal(x: number, y: number, z: number): [number, number, number];
|
|
20
|
+
/**
|
|
21
|
+
* The local east-north-up frame at an ECEF point as a matrix from ENU metres to ECEF: columns east, north, up and the
|
|
22
|
+
* point. At the poles, where east is undefined, east is taken as +y (longitude 0's east).
|
|
23
|
+
*/
|
|
24
|
+
export declare function eastNorthUpToEcef(x: number, y: number, z: number): TileMatrix;
|
package/package.json
CHANGED
|
@@ -1,6 +1,124 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@margoengine/tiles",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@margoengine/tiles",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Streaming OGC 3D Tiles 1.1: implicit and explicit tilesets, screen-space-error selection, a fetch queue, a memory budget and glTF tiles drawn through gltf/pbr.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"margoengine",
|
|
7
|
+
"webgpu",
|
|
8
|
+
"3d",
|
|
9
|
+
"3d-tiles",
|
|
10
|
+
"ogc",
|
|
11
|
+
"gis",
|
|
12
|
+
"digital-twin",
|
|
13
|
+
"streaming"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://margoengine.com",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/scottcampbelldata/margoengine/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/scottcampbelldata/margoengine.git",
|
|
22
|
+
"directory": "packages/tiles"
|
|
23
|
+
},
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"author": "Scott Campbell",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"exports": {
|
|
29
|
+
"./properties": {
|
|
30
|
+
"types": "./dist/properties.d.ts",
|
|
31
|
+
"import": "./dist/properties.js"
|
|
32
|
+
},
|
|
33
|
+
"./imagery": {
|
|
34
|
+
"types": "./dist/imagery.d.ts",
|
|
35
|
+
"import": "./dist/imagery.js"
|
|
36
|
+
},
|
|
37
|
+
"./style": {
|
|
38
|
+
"types": "./dist/style.d.ts",
|
|
39
|
+
"import": "./dist/style.js"
|
|
40
|
+
},
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"import": "./dist/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./i3dm": {
|
|
46
|
+
"types": "./dist/i3dm.d.ts",
|
|
47
|
+
"import": "./dist/i3dm.js"
|
|
48
|
+
},
|
|
49
|
+
"./metadata": {
|
|
50
|
+
"types": "./dist/metadata.d.ts",
|
|
51
|
+
"import": "./dist/metadata.js"
|
|
52
|
+
},
|
|
53
|
+
"./splats": {
|
|
54
|
+
"types": "./dist/splats.d.ts",
|
|
55
|
+
"import": "./dist/splats.js"
|
|
56
|
+
},
|
|
57
|
+
"./s2": {
|
|
58
|
+
"types": "./dist/s2.d.ts",
|
|
59
|
+
"import": "./dist/s2.js"
|
|
60
|
+
},
|
|
61
|
+
"./terrain": {
|
|
62
|
+
"types": "./dist/terrain.d.ts",
|
|
63
|
+
"import": "./dist/terrain.js"
|
|
64
|
+
},
|
|
65
|
+
"./ion": {
|
|
66
|
+
"types": "./dist/ion.d.ts",
|
|
67
|
+
"import": "./dist/ion.js"
|
|
68
|
+
},
|
|
69
|
+
"./features": {
|
|
70
|
+
"types": "./dist/features.d.ts",
|
|
71
|
+
"import": "./dist/features.js"
|
|
72
|
+
},
|
|
73
|
+
"./fade": {
|
|
74
|
+
"types": "./dist/fade.d.ts",
|
|
75
|
+
"import": "./dist/fade.js"
|
|
76
|
+
},
|
|
77
|
+
"./height": {
|
|
78
|
+
"types": "./dist/height.d.ts",
|
|
79
|
+
"import": "./dist/height.js"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"files": [
|
|
83
|
+
"dist",
|
|
84
|
+
"LICENSE",
|
|
85
|
+
"NOTICE"
|
|
86
|
+
],
|
|
87
|
+
"publishConfig": {
|
|
88
|
+
"access": "public"
|
|
89
|
+
},
|
|
90
|
+
"dependencies": {
|
|
91
|
+
"@margoengine/math": "^0.1.0"
|
|
92
|
+
},
|
|
93
|
+
"peerDependencies": {
|
|
94
|
+
"@margoengine/core": "^0.1.0",
|
|
95
|
+
"@margoengine/gltf": "^0.1.0",
|
|
96
|
+
"@margoengine/points": "^0.1.0",
|
|
97
|
+
"@margoengine/decoders": "^0.1.0",
|
|
98
|
+
"@margoengine/splats": "^0.1.0",
|
|
99
|
+
"@margoengine/bvh": "^0.1.0"
|
|
100
|
+
},
|
|
101
|
+
"peerDependenciesMeta": {
|
|
102
|
+
"@margoengine/gltf": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"@margoengine/points": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"@margoengine/decoders": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"@margoengine/splats": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"@margoengine/bvh": {
|
|
115
|
+
"optional": true
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"scripts": {
|
|
119
|
+
"build": "node ../../scripts/build-optional.js tiles",
|
|
120
|
+
"test": "npm run build && node --test tests/*.test.js",
|
|
121
|
+
"test:browser": "npm run build && node tests/tiles-browser.mjs",
|
|
122
|
+
"prepack": "npm run build"
|
|
123
|
+
}
|
|
124
|
+
}
|