@thoughts-on-things/vantage-mc 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 +21 -0
- package/README.md +200 -0
- package/dist/biome-LCQwACRa.d.ts +275 -0
- package/dist/chunk-7V27NYZD.js +2605 -0
- package/dist/chunk-X7ZJUHP2.js +483 -0
- package/dist/core/index.d.ts +39 -0
- package/dist/core/index.js +1 -0
- package/dist/react/index.d.ts +157 -0
- package/dist/react/index.js +715 -0
- package/dist/three/index.d.ts +110 -0
- package/dist/three/index.js +2 -0
- package/dist/viewer-DkAMDMtW.d.ts +628 -0
- package/package.json +91 -0
|
@@ -0,0 +1,110 @@
|
|
|
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-LCQwACRa.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 WorldManifest, g as biomePalette, p as parseManifest, h as parseTextureArray, i as parseTile, j as parseTileQuantized, s as stripNamespace, k as summarizeBiomes, l as summarizeSurfaceBiomes, t as tileKey } from '../biome-LCQwACRa.js';
|
|
4
|
+
import { LowresTile } from '../core/index.js';
|
|
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-DkAMDMtW.js';
|
|
7
|
+
|
|
8
|
+
/** The objects and metadata produced from a tile. */
|
|
9
|
+
interface TerrainObjects {
|
|
10
|
+
/** Opaque terrain mesh. */
|
|
11
|
+
terrain: THREE.Mesh;
|
|
12
|
+
/** Transparent water mesh, drawn after the terrain (VTL4+ tiles with fluids). */
|
|
13
|
+
water?: THREE.Mesh;
|
|
14
|
+
/** The terrain material. For textured tiles this is the Vantage shader that
|
|
15
|
+
* exposes the biome/fog/light uniforms; for flat tiles, a basic lit material. */
|
|
16
|
+
material: THREE.Material;
|
|
17
|
+
/** The Vantage shader material, present only for textured tiles. */
|
|
18
|
+
shader?: THREE.ShaderMaterial;
|
|
19
|
+
/** Axis-aligned bounds of the terrain geometry. */
|
|
20
|
+
bounds: THREE.Box3;
|
|
21
|
+
/** The biome colour palette used for per-vertex tints (indexed by biome id). */
|
|
22
|
+
palette: Rgb[];
|
|
23
|
+
/** True for flat (VTL1) tiles, which need scene lights to be shaded. */
|
|
24
|
+
requiresSceneLights: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** The meshes built from one tile with caller-provided (shared) materials. */
|
|
27
|
+
interface TileMeshes {
|
|
28
|
+
terrain: THREE.Mesh;
|
|
29
|
+
water?: THREE.Mesh;
|
|
30
|
+
bounds: THREE.Box3;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Build a tile's meshes against EXISTING materials — the streaming path, where
|
|
34
|
+
* every tile shares one terrain shader + one water shader (one program, two
|
|
35
|
+
* draw calls per tile, uniforms in lock-step). For a one-shot single tile with
|
|
36
|
+
* its own materials, use {@link buildTerrain}.
|
|
37
|
+
*/
|
|
38
|
+
declare function buildTileMeshes(tile: DecodedTile, palette: Rgb[], material: THREE.ShaderMaterial, waterMaterial: THREE.ShaderMaterial): TileMeshes;
|
|
39
|
+
/**
|
|
40
|
+
* Build a VTL6 tile's meshes in the quantized fast path: shared QUANTIZED
|
|
41
|
+
* materials (from `createTerrainMaterial(tex, { quantized: true, palette })`),
|
|
42
|
+
* zero per-vertex CPU work. This is what the streaming TileManager uses.
|
|
43
|
+
*/
|
|
44
|
+
declare function buildQuantizedTileMeshes(tile: QuantizedTile, material: THREE.ShaderMaterial, waterMaterial: THREE.ShaderMaterial): TileMeshes;
|
|
45
|
+
/**
|
|
46
|
+
* Build renderable three.js objects from a decoded tile.
|
|
47
|
+
*
|
|
48
|
+
* @param tile A tile decoded with {@link parseTile}.
|
|
49
|
+
* @param texData The texture array decoded with {@link parseTextureArray};
|
|
50
|
+
* required for textured tiles (VTL2+), ignored for flat tiles.
|
|
51
|
+
*/
|
|
52
|
+
declare function buildTerrain(tile: DecodedTile, texData?: DecodedTextureArray): TerrainObjects;
|
|
53
|
+
/**
|
|
54
|
+
* Build a lowres LOD tile's heightfield mesh: one vertex per sample (heights
|
|
55
|
+
* from the generator, colors with lighting/tint baked in), two triangles per
|
|
56
|
+
* cell whose four corners all have terrain. Adjacent tiles share edge samples
|
|
57
|
+
* (the +1 apron in the format), so the field is seamless across tiles.
|
|
58
|
+
*
|
|
59
|
+
* The surface is dipped slightly below the real terrain height — deeper for
|
|
60
|
+
* coarser levels — so wherever hires tiles (or finer lowres rings) are
|
|
61
|
+
* resident they win the depth test cleanly instead of z-fighting.
|
|
62
|
+
*
|
|
63
|
+
* Returns `null` for an all-empty tile.
|
|
64
|
+
*/
|
|
65
|
+
declare function buildLowresMesh(tile: LowresTile, material: THREE.ShaderMaterial): THREE.Mesh | null;
|
|
66
|
+
|
|
67
|
+
/** Atmosphere palette — a calm Minecraft-ish daytime. Horizon doubles as fog. */
|
|
68
|
+
declare const SKY_TOP: readonly [number, number, number];
|
|
69
|
+
declare const SKY_HORIZON: readonly [number, number, number];
|
|
70
|
+
/** Options for {@link createTerrainMaterial}. */
|
|
71
|
+
interface TerrainMaterialOptions {
|
|
72
|
+
/** Render VTL6 tiles in their on-disk quantized encoding: the vertex shader
|
|
73
|
+
* dequantizes u16 positions and int8 normals, and biome colours come from a
|
|
74
|
+
* palette texture. Pair with `buildQuantizedTileMeshes` (the streaming path). */
|
|
75
|
+
quantized?: boolean;
|
|
76
|
+
/** Biome palette (indexed by biome id) baked into the palette texture.
|
|
77
|
+
* Required in spirit when `quantized`; defaults to a generic palette. */
|
|
78
|
+
palette?: readonly Rgb[];
|
|
79
|
+
}
|
|
80
|
+
/** Build the textured terrain material from a decoded texture array. */
|
|
81
|
+
declare function createTerrainMaterial(texData: DecodedTextureArray, opts?: TerrainMaterialOptions): THREE.ShaderMaterial;
|
|
82
|
+
/**
|
|
83
|
+
* A transparent water material that shares the terrain material's uniforms (so
|
|
84
|
+
* the biome toggle, fog, and light track together) but blends with no depth
|
|
85
|
+
* write — the opaque seabed shows through, while terrain in front still occludes
|
|
86
|
+
* it via the depth test.
|
|
87
|
+
*/
|
|
88
|
+
declare function createWaterMaterial(terrain: THREE.ShaderMaterial): THREE.ShaderMaterial;
|
|
89
|
+
/**
|
|
90
|
+
* The lowres LOD material: a vertex-colored heightfield (lighting and biome
|
|
91
|
+
* tint are baked into the colors by the generator) that shares the terrain
|
|
92
|
+
* shader's fog/grade/exposure uniform OBJECTS, so haze, colour grade, and the
|
|
93
|
+
* radial fog centre track the hires terrain exactly.
|
|
94
|
+
*/
|
|
95
|
+
declare function createLowresMaterial(terrain: THREE.ShaderMaterial): THREE.ShaderMaterial;
|
|
96
|
+
/**
|
|
97
|
+
* A camera-locked gradient sky dome (depth-test off, drawn first) so the
|
|
98
|
+
* background reads as sky from any zoom, with the horizon matching the fog.
|
|
99
|
+
* Keep it centred on the camera each frame (`sky.position.copy(camera.position)`).
|
|
100
|
+
*/
|
|
101
|
+
declare function createSky(): THREE.Mesh;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Return the biome id at the first surface column the ray drops below the
|
|
105
|
+
* terrain top, or `-1` if it misses. `bounds` bounds the march so empty sky is
|
|
106
|
+
* skipped.
|
|
107
|
+
*/
|
|
108
|
+
declare function pickBiome(ray: THREE.Ray, surf: SurfaceMap, bounds: THREE.Box3): number;
|
|
109
|
+
|
|
110
|
+
export { DecodedTextureArray, DecodedTile, LowresTile, QuantizedTile, Rgb, SKY_HORIZON, SKY_TOP, SurfaceMap, type TerrainMaterialOptions, type TerrainObjects, type TileMeshes, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome };
|
|
@@ -0,0 +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-7V27NYZD.js';
|
|
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-X7ZJUHP2.js';
|