@thoughts-on-things/vantage-mc 0.1.0 → 0.1.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/dist/{biome-LCQwACRa.d.ts → biome-BR6bKnti.d.ts} +33 -1
- package/dist/{chunk-7V27NYZD.js → chunk-I7TYYQX3.js} +8 -16
- package/dist/{chunk-X7ZJUHP2.js → chunk-O2MEM2GT.js} +79 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/react/index.d.ts +9 -6
- package/dist/react/index.js +3 -3
- package/dist/three/index.d.ts +3 -3
- package/dist/three/index.js +2 -2
- package/dist/{viewer-DkAMDMtW.d.ts → viewer-Bxc0eorS.d.ts} +8 -5
- package/package.json +1 -1
|
@@ -231,6 +231,38 @@ declare function tileKey(x: number, z: number): string;
|
|
|
231
231
|
*/
|
|
232
232
|
declare function parseManifest(data: unknown): WorldManifest;
|
|
233
233
|
|
|
234
|
+
/** Fetch one file of a world render by its manifest-relative path (e.g.
|
|
235
|
+
* `tiles/t.0.0.vtile`). Reject with an `AbortError`-named error if `signal`
|
|
236
|
+
* fires mid-read. */
|
|
237
|
+
type WorldFetch = (path: string, signal?: AbortSignal) => Promise<ArrayBuffer>;
|
|
238
|
+
/** A tiled world render, wherever it lives. Pass one to the viewer's `world`
|
|
239
|
+
* option (or build one with {@link worldFromUrl}, {@link worldFromDirectory},
|
|
240
|
+
* or {@link worldFromFiles}). */
|
|
241
|
+
interface WorldSource {
|
|
242
|
+
/** The `manifest.json` value, still unvalidated — the viewer parses it. */
|
|
243
|
+
manifest: unknown;
|
|
244
|
+
/** Where the world came from, for error messages (a URL, a folder name). */
|
|
245
|
+
label: string;
|
|
246
|
+
/** Fetch a file by manifest-relative path. */
|
|
247
|
+
fetch: WorldFetch;
|
|
248
|
+
}
|
|
249
|
+
/** A world served over HTTP: fetches `manifest.json` at `url` and resolves
|
|
250
|
+
* tile paths relative to it. This is what a plain string `world` option
|
|
251
|
+
* turns into. */
|
|
252
|
+
declare function worldFromUrl(url: string, base?: string): Promise<WorldSource>;
|
|
253
|
+
/** A world in a local directory picked with the File System Access API
|
|
254
|
+
* (`window.showDirectoryPicker()`, Chromium) — reads `manifest.json` from the
|
|
255
|
+
* directory root and resolves tile paths through subdirectory handles on
|
|
256
|
+
* demand, so nothing is read until it streams in. */
|
|
257
|
+
declare function worldFromDirectory(dir: FileSystemDirectoryHandle): Promise<WorldSource>;
|
|
258
|
+
/** A world from a flat file list — `<input webkitdirectory>` or a drag-and-drop
|
|
259
|
+
* walk (the fallback for browsers without `showDirectoryPicker`). Finds the
|
|
260
|
+
* shallowest `manifest.json` and keys every file relative to its folder, so
|
|
261
|
+
* picking a parent folder of the render also works. `pathOf` overrides how a
|
|
262
|
+
* file's relative path is derived (default: `webkitRelativePath`, falling
|
|
263
|
+
* back to `name`). */
|
|
264
|
+
declare function worldFromFiles(files: Iterable<File>, pathOf?: (file: File) => string): Promise<WorldSource>;
|
|
265
|
+
|
|
234
266
|
/** An RGB triple in 0..1. */
|
|
235
267
|
type Rgb = readonly [number, number, number];
|
|
236
268
|
/**
|
|
@@ -272,4 +304,4 @@ declare function summarizeSurfaceBiomes(surface: SurfaceMap, names: string[], pa
|
|
|
272
304
|
*/
|
|
273
305
|
declare function summarizeBiomes(tile: DecodedTile, palette?: Rgb[]): BiomeEntry[];
|
|
274
306
|
|
|
275
|
-
export { type BiomeEntry as B, type DecodedTile as D, type LowresLevel as L, type ManifestTile as M, type QuantizedTile as Q, type Rgb as R, type SurfaceMap as S, TEXTURE_MAGIC as T, type
|
|
307
|
+
export { type BiomeEntry as B, type DecodedTile as D, type LowresLevel as L, type ManifestTile as M, type QuantizedTile as Q, type Rgb as R, type SurfaceMap as S, TEXTURE_MAGIC as T, type WorldFetch as W, type DecodedTextureArray as a, ByteReader as b, type MeshSection as c, type QuantizedSection as d, TILE_MAGIC as e, type TileMagic as f, type WorldManifest as g, type WorldSource as h, biomePalette as i, parseTextureArray as j, parseTile as k, parseTileQuantized as l, summarizeBiomes as m, summarizeSurfaceBiomes as n, worldFromFiles as o, parseManifest as p, worldFromUrl as q, stripNamespace as s, tileKey as t, worldFromDirectory as w };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { biomePalette, LOWRES_EMPTY, tileKey, parseLowresTile, maybeInflate, parseTileQuantized, summarizeSurfaceBiomes, parseTile, summarizeBiomes, parseManifest, parseTextureArray } from './chunk-
|
|
1
|
+
import { biomePalette, LOWRES_EMPTY, tileKey, parseLowresTile, maybeInflate, parseTileQuantized, summarizeSurfaceBiomes, parseTile, summarizeBiomes, worldFromUrl, parseManifest, parseTextureArray } from './chunk-O2MEM2GT.js';
|
|
2
2
|
import * as THREE2 from 'three';
|
|
3
3
|
|
|
4
4
|
var SKY_TOP = [0.3, 0.52, 0.84];
|
|
@@ -813,10 +813,7 @@ var TileManager = class {
|
|
|
813
813
|
this.records.set(key, rec);
|
|
814
814
|
this.inFlight++;
|
|
815
815
|
try {
|
|
816
|
-
const
|
|
817
|
-
const res = await fetch(url, { signal: abort.signal });
|
|
818
|
-
if (!res.ok) throw new Error(`${res.status} ${res.statusText} for ${url}`);
|
|
819
|
-
const tile = parseLowresTile(await maybeInflate(await res.arrayBuffer()));
|
|
816
|
+
const tile = parseLowresTile(await maybeInflate(await this.opts.fetch(ref.path, abort.signal)));
|
|
820
817
|
if (this.disposed || rec.state !== "loading") return;
|
|
821
818
|
const mesh = buildLowresMesh(tile, this.lowresMaterial);
|
|
822
819
|
if (!mesh) {
|
|
@@ -881,10 +878,7 @@ var TileManager = class {
|
|
|
881
878
|
this.records.set(key, rec);
|
|
882
879
|
this.inFlight++;
|
|
883
880
|
try {
|
|
884
|
-
const
|
|
885
|
-
const res = await fetch(url, { signal: abort.signal });
|
|
886
|
-
if (!res.ok) throw new Error(`${res.status} ${res.statusText} for ${url}`);
|
|
887
|
-
const buffer = await maybeInflate(await res.arrayBuffer());
|
|
881
|
+
const buffer = await maybeInflate(await this.opts.fetch(ref.path, abort.signal));
|
|
888
882
|
if (this.disposed || rec.state !== "loading") return;
|
|
889
883
|
let meshes;
|
|
890
884
|
const q = parseTileQuantized(buffer);
|
|
@@ -2017,12 +2011,10 @@ var VantageViewer = class _VantageViewer {
|
|
|
2017
2011
|
/** Stream a tiled world render from its `manifest.json`. Tiles load around
|
|
2018
2012
|
* the camera as it moves and unload behind it; the whole world is reachable
|
|
2019
2013
|
* without ever holding more than the streaming budget in memory. */
|
|
2020
|
-
async loadWorld(
|
|
2021
|
-
const
|
|
2022
|
-
const
|
|
2023
|
-
|
|
2024
|
-
const manifest = parseManifest(await res.json());
|
|
2025
|
-
const texData = parseTextureArray(await maybeInflate(await fetchBuffer(new URL(manifest.textures, abs).toString())));
|
|
2014
|
+
async loadWorld(world, view) {
|
|
2015
|
+
const source = typeof world === "string" ? await worldFromUrl(world) : world;
|
|
2016
|
+
const manifest = parseManifest(source.manifest);
|
|
2017
|
+
const texData = parseTextureArray(await maybeInflate(await source.fetch(manifest.textures)));
|
|
2026
2018
|
this.disposeCurrent();
|
|
2027
2019
|
const palette = biomePalette(manifest.biomes.length);
|
|
2028
2020
|
const shader = createTerrainMaterial(texData, { quantized: true, palette });
|
|
@@ -2036,7 +2028,7 @@ var VantageViewer = class _VantageViewer {
|
|
|
2036
2028
|
this.tile = null;
|
|
2037
2029
|
this.tiles = new TileManager({
|
|
2038
2030
|
manifest,
|
|
2039
|
-
|
|
2031
|
+
fetch: source.fetch,
|
|
2040
2032
|
scene: this.scene,
|
|
2041
2033
|
material: shader,
|
|
2042
2034
|
waterMaterial: waterShader,
|
|
@@ -360,6 +360,84 @@ function parseManifest(data) {
|
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
// src/core/source.ts
|
|
364
|
+
function throwIfAborted(signal) {
|
|
365
|
+
if (signal?.aborted) throw new DOMException("The operation was aborted.", "AbortError");
|
|
366
|
+
}
|
|
367
|
+
function normalizePath(path) {
|
|
368
|
+
return path.startsWith("./") ? path.slice(2) : path;
|
|
369
|
+
}
|
|
370
|
+
async function worldFromUrl(url, base) {
|
|
371
|
+
const abs = new URL(url, base ?? (typeof document !== "undefined" ? document.baseURI : void 0)).toString();
|
|
372
|
+
const res = await fetch(abs);
|
|
373
|
+
if (!res.ok) throw new Error(`${res.status} ${res.statusText} for ${abs}`);
|
|
374
|
+
const manifest = await res.json();
|
|
375
|
+
return {
|
|
376
|
+
manifest,
|
|
377
|
+
label: abs,
|
|
378
|
+
fetch: async (path, signal) => {
|
|
379
|
+
const target = new URL(normalizePath(path), abs).toString();
|
|
380
|
+
const r = await fetch(target, signal ? { signal } : void 0);
|
|
381
|
+
if (!r.ok) throw new Error(`${r.status} ${r.statusText} for ${target}`);
|
|
382
|
+
return r.arrayBuffer();
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
async function worldFromDirectory(dir) {
|
|
387
|
+
const readFile = async (path, signal) => {
|
|
388
|
+
throwIfAborted(signal);
|
|
389
|
+
const segments = normalizePath(path).split("/").filter((s) => s.length > 0 && s !== ".");
|
|
390
|
+
if (segments.length === 0 || segments.includes("..")) throw new Error(`vantage: bad tile path ${path}`);
|
|
391
|
+
let node = dir;
|
|
392
|
+
for (const segment of segments.slice(0, -1)) node = await node.getDirectoryHandle(segment);
|
|
393
|
+
const handle = await node.getFileHandle(segments[segments.length - 1]);
|
|
394
|
+
return handle.getFile();
|
|
395
|
+
};
|
|
396
|
+
let manifestFile;
|
|
397
|
+
try {
|
|
398
|
+
manifestFile = await readFile("manifest.json");
|
|
399
|
+
} catch {
|
|
400
|
+
throw new Error(
|
|
401
|
+
`vantage: no manifest.json in "${dir.name}" \u2014 pick the folder a \`vantage render\` wrote (it holds manifest.json, terrain.vtexarr, and tiles/)`
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
manifest: JSON.parse(await manifestFile.text()),
|
|
406
|
+
label: dir.name,
|
|
407
|
+
fetch: async (path, signal) => {
|
|
408
|
+
const file = await readFile(path, signal);
|
|
409
|
+
throwIfAborted(signal);
|
|
410
|
+
return file.arrayBuffer();
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
async function worldFromFiles(files, pathOf = (f) => f.webkitRelativePath || f.name) {
|
|
415
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
416
|
+
for (const file of files) byPath.set(normalizePath(pathOf(file)).replace(/\\/g, "/"), file);
|
|
417
|
+
let manifestPath = null;
|
|
418
|
+
for (const path of byPath.keys()) {
|
|
419
|
+
if (path !== "manifest.json" && !path.endsWith("/manifest.json")) continue;
|
|
420
|
+
if (manifestPath === null || path.split("/").length < manifestPath.split("/").length) manifestPath = path;
|
|
421
|
+
}
|
|
422
|
+
if (manifestPath === null) {
|
|
423
|
+
throw new Error(
|
|
424
|
+
"vantage: no manifest.json among the selected files \u2014 pick the folder a `vantage render` wrote (it holds manifest.json, terrain.vtexarr, and tiles/)"
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
const prefix = manifestPath.slice(0, manifestPath.length - "manifest.json".length);
|
|
428
|
+
const root = prefix === "" ? "world" : prefix.slice(0, -1);
|
|
429
|
+
return {
|
|
430
|
+
manifest: JSON.parse(await byPath.get(manifestPath).text()),
|
|
431
|
+
label: root,
|
|
432
|
+
fetch: (path, signal) => {
|
|
433
|
+
throwIfAborted(signal);
|
|
434
|
+
const file = byPath.get(prefix + normalizePath(path));
|
|
435
|
+
if (!file) return Promise.reject(new Error(`vantage: ${path} is not in the selected folder`));
|
|
436
|
+
return file.arrayBuffer();
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
|
|
363
441
|
// src/core/lowres.ts
|
|
364
442
|
var LOWRES_MAGIC = "VLR1";
|
|
365
443
|
var LOWRES_EMPTY = -32768;
|
|
@@ -480,4 +558,4 @@ function summarizeBiomes(tile, palette) {
|
|
|
480
558
|
return toEntries(counts, names, pal);
|
|
481
559
|
}
|
|
482
560
|
|
|
483
|
-
export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, biomePalette, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey };
|
|
561
|
+
export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, biomePalette, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey, worldFromDirectory, worldFromFiles, worldFromUrl };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BiomeEntry, b as ByteReader, a as DecodedTextureArray, D as DecodedTile, L as LowresLevel, M as ManifestTile, c as MeshSection, d as QuantizedSection, Q as QuantizedTile, R as Rgb, S as SurfaceMap, T as TEXTURE_MAGIC, e as TILE_MAGIC, f as TileMagic, W as
|
|
1
|
+
export { B as BiomeEntry, b as ByteReader, a as DecodedTextureArray, D as DecodedTile, L as LowresLevel, M as ManifestTile, c as MeshSection, d as QuantizedSection, Q as QuantizedTile, R as Rgb, S as SurfaceMap, T as TEXTURE_MAGIC, e as TILE_MAGIC, f as TileMagic, W as WorldFetch, g as WorldManifest, h as WorldSource, i as biomePalette, p as parseManifest, j as parseTextureArray, k as parseTile, l as parseTileQuantized, s as stripNamespace, m as summarizeBiomes, n as summarizeSurfaceBiomes, t as tileKey, w as worldFromDirectory, o as worldFromFiles, q as worldFromUrl } from '../biome-BR6bKnti.js';
|
|
2
2
|
|
|
3
3
|
declare const LOWRES_MAGIC = "VLR1";
|
|
4
4
|
/** Height sentinel for samples with no terrain (unpopulated chunks). */
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, biomePalette, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey } from '../chunk-
|
|
1
|
+
export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, biomePalette, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey, worldFromDirectory, worldFromFiles, worldFromUrl } from '../chunk-O2MEM2GT.js';
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export { D as
|
|
5
|
-
import {
|
|
6
|
-
export { D as
|
|
3
|
+
import { h as WorldSource, B as BiomeEntry } from '../biome-BR6bKnti.js';
|
|
4
|
+
export { D as DecodedTile } from '../biome-BR6bKnti.js';
|
|
5
|
+
import { g as TileSource, T as TextureSource, S as StreamingSettings, k as ViewMode, L as LightSettings, a as DisplaySettings, d as TileInfo, i as VantageViewer$1 } from '../viewer-Bxc0eorS.js';
|
|
6
|
+
export { D as DEFAULT_ORBIT_ANGLE, V as VANILLA_DISPLAY } from '../viewer-Bxc0eorS.js';
|
|
7
7
|
import 'three';
|
|
8
8
|
|
|
9
9
|
interface VantageViewerProps {
|
|
10
|
-
/** A tiled world to stream: the `manifest.json` URL (from `vantage render`)
|
|
10
|
+
/** A tiled world to stream: the `manifest.json` URL (from `vantage render`),
|
|
11
|
+
* or a `WorldSource` for renders that don't live on a server — e.g.
|
|
12
|
+
* `worldFromDirectory(handle)` for a folder the user picked. Keep the object
|
|
13
|
+
* referentially stable (state/memo): a new identity reloads the world.
|
|
11
14
|
* Takes precedence over `tile`. */
|
|
12
|
-
world?: string;
|
|
15
|
+
world?: string | WorldSource;
|
|
13
16
|
/** A single `.vtile` to render: a URL, a raw buffer, or already-decoded data. */
|
|
14
17
|
tile?: TileSource;
|
|
15
18
|
/** The `.vtexarr` texture array (required for textured tiles). */
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VantageViewer, DEFAULT_ORBIT_ANGLE } from '../chunk-
|
|
2
|
-
export { DEFAULT_ORBIT_ANGLE, VANILLA_DISPLAY } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { VantageViewer, DEFAULT_ORBIT_ANGLE } from '../chunk-I7TYYQX3.js';
|
|
2
|
+
export { DEFAULT_ORBIT_ANGLE, VANILLA_DISPLAY } from '../chunk-I7TYYQX3.js';
|
|
3
|
+
import '../chunk-O2MEM2GT.js';
|
|
4
4
|
import { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo, useContext } from 'react';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
|
package/dist/three/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { R as Rgb, Q as QuantizedTile, D as DecodedTile, a as DecodedTextureArray, S as SurfaceMap } from '../biome-
|
|
3
|
-
export { B as BiomeEntry, b as ByteReader, L as LowresLevel, M as ManifestTile, c as MeshSection, d as QuantizedSection, T as TEXTURE_MAGIC, e as TILE_MAGIC, f as TileMagic, W as
|
|
2
|
+
import { R as Rgb, Q as QuantizedTile, D as DecodedTile, a as DecodedTextureArray, S as SurfaceMap } from '../biome-BR6bKnti.js';
|
|
3
|
+
export { B as BiomeEntry, b as ByteReader, L as LowresLevel, M as ManifestTile, c as MeshSection, d as QuantizedSection, T as TEXTURE_MAGIC, e as TILE_MAGIC, f as TileMagic, W as WorldFetch, g as WorldManifest, h as WorldSource, i as biomePalette, p as parseManifest, j as parseTextureArray, k as parseTile, l as parseTileQuantized, s as stripNamespace, m as summarizeBiomes, n as summarizeSurfaceBiomes, t as tileKey, w as worldFromDirectory, o as worldFromFiles, q as worldFromUrl } from '../biome-BR6bKnti.js';
|
|
4
4
|
import { LowresTile } from '../core/index.js';
|
|
5
5
|
export { LOWRES_EMPTY, LOWRES_MAGIC, isGzip, maybeInflate, parseLowresTile } from '../core/index.js';
|
|
6
|
-
export { D as DEFAULT_ORBIT_ANGLE, a as DisplaySettings, H as HeightSampler, L as LightSettings, b as LoadOptions, M as MapControls, c as MapControlsOptions, S as StreamingSettings, T as TextureSource, d as TileInfo, e as TileManager, f as TileManagerOptions, g as TileSource, h as TileStats, V as VANILLA_DISPLAY, i as VantageViewer, j as VantageViewerOptions, k as ViewMode } from '../viewer-
|
|
6
|
+
export { D as DEFAULT_ORBIT_ANGLE, a as DisplaySettings, H as HeightSampler, L as LightSettings, b as LoadOptions, M as MapControls, c as MapControlsOptions, S as StreamingSettings, T as TextureSource, d as TileInfo, e as TileManager, f as TileManagerOptions, g as TileSource, h as TileStats, V as VANILLA_DISPLAY, i as VantageViewer, j as VantageViewerOptions, k as ViewMode } from '../viewer-Bxc0eorS.js';
|
|
7
7
|
|
|
8
8
|
/** The objects and metadata produced from a tile. */
|
|
9
9
|
interface TerrainObjects {
|
package/dist/three/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DEFAULT_ORBIT_ANGLE, MapControls, SKY_HORIZON, SKY_TOP, TileManager, VANILLA_DISPLAY, VantageViewer, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome } from '../chunk-
|
|
2
|
-
export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, biomePalette, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey } from '../chunk-
|
|
1
|
+
export { DEFAULT_ORBIT_ANGLE, MapControls, SKY_HORIZON, SKY_TOP, TileManager, VANILLA_DISPLAY, VantageViewer, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome } from '../chunk-I7TYYQX3.js';
|
|
2
|
+
export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, biomePalette, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey, worldFromDirectory, worldFromFiles, worldFromUrl } from '../chunk-O2MEM2GT.js';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import {
|
|
2
|
+
import { g as WorldManifest, W as WorldFetch, R as Rgb, B as BiomeEntry, a as DecodedTextureArray, D as DecodedTile, h as WorldSource } from './biome-BR6bKnti.js';
|
|
3
3
|
|
|
4
4
|
interface TileManagerOptions {
|
|
5
5
|
manifest: WorldManifest;
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/** Fetch a file by manifest-relative path — a {@link WorldSource}'s `fetch`
|
|
7
|
+
* (HTTP, a local folder, …). Tile paths are passed through verbatim. */
|
|
8
|
+
fetch: WorldFetch;
|
|
8
9
|
scene: THREE.Scene;
|
|
9
10
|
/** The shared terrain shader (from {@link createTerrainMaterial}). */
|
|
10
11
|
material: THREE.ShaderMaterial;
|
|
@@ -422,8 +423,10 @@ interface VantageViewerOptions {
|
|
|
422
423
|
type TileSource = string | ArrayBuffer | DecodedTile;
|
|
423
424
|
type TextureSource = string | ArrayBuffer | DecodedTextureArray;
|
|
424
425
|
interface LoadOptions {
|
|
425
|
-
/** A tiled world to stream: the `manifest.json` URL
|
|
426
|
-
|
|
426
|
+
/** A tiled world to stream: the `manifest.json` URL, or a {@link WorldSource}
|
|
427
|
+
* for worlds that don't live on an HTTP server (a local folder, a zip — see
|
|
428
|
+
* `worldFromDirectory` / `worldFromFiles`). Takes precedence over `tile`. */
|
|
429
|
+
world?: string | WorldSource;
|
|
427
430
|
/** A single `.vtile` to render (the non-streaming path). */
|
|
428
431
|
tile?: TileSource;
|
|
429
432
|
/** The `.vtexarr` texture array (required for textured tiles). */
|
package/package.json
CHANGED