@thoughts-on-things/vantage-mc 0.3.0 → 0.5.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.
@@ -1,6 +1,6 @@
1
- import { VantageViewer, DEFAULT_ORBIT_ANGLE } from '../chunk-C7GIMQYZ.js';
2
- export { DEFAULT_ORBIT_ANGLE, VANILLA_DISPLAY } from '../chunk-C7GIMQYZ.js';
3
- import '../chunk-M6KVJXCR.js';
1
+ import { VantageViewer, DEFAULT_ORBIT_ANGLE } from '../chunk-46RBFJ4D.js';
2
+ export { DEFAULT_ORBIT_ANGLE, VANILLA_DISPLAY } from '../chunk-46RBFJ4D.js';
3
+ import '../chunk-EVPUXVSB.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
 
@@ -181,6 +181,63 @@ var CSS = `
181
181
  }
182
182
  .vtg-coords b { color: var(--vtg-dim); font-weight: 600; margin-right: 1px; }
183
183
 
184
+ /* --- cave-view depth gauge ------------------------------------------------- */
185
+ .vtg-depth {
186
+ position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
187
+ display: flex; flex-direction: column; align-items: center; gap: 8px;
188
+ padding: 10px 8px; width: 58px;
189
+ animation: vtg-rise-y 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
190
+ }
191
+ .vtg-depth-val {
192
+ font: 11px var(--vtg-mono); color: var(--vtg-text); font-variant-numeric: tabular-nums;
193
+ display: flex; flex-direction: column; align-items: center; line-height: 1.3;
194
+ }
195
+ .vtg-depth-val b { color: var(--vtg-dim); font-weight: 600; font-size: 9px; letter-spacing: 0.08em; }
196
+ /* The interactive rail: the thumb and landmark labels hang outside the track,
197
+ so the rail stays unclipped while the track clips its own paint. */
198
+ .vtg-depth-rail {
199
+ position: relative; width: 14px; height: min(320px, 38vh);
200
+ cursor: ns-resize; touch-action: none;
201
+ }
202
+ .vtg-depth-rail:focus-visible { outline: 2px solid var(--vtg-accent); outline-offset: 4px; border-radius: 7px; }
203
+ .vtg-depth-track {
204
+ position: absolute; inset: 0; border-radius: 7px; overflow: hidden; pointer-events: none;
205
+ /* A core sample: sky, grass, stone, deepslate, bedrock. */
206
+ background: linear-gradient(180deg, #6f9bce 0%, #6e9150 12%, #6e6f74 48%, #3e424b 76%, #16181d 100%);
207
+ border: 1px solid var(--vtg-line);
208
+ box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
209
+ }
210
+ /* The stratum the slice removed: struck through with hazard stripes. */
211
+ .vtg-depth-cut {
212
+ position: absolute; inset: 0 0 auto 0;
213
+ background: repeating-linear-gradient(-45deg, rgba(10, 13, 19, 0.75) 0 4px, rgba(24, 30, 42, 0.55) 4px 8px);
214
+ }
215
+ .vtg-depth-thumb {
216
+ position: absolute; left: -3px; right: -3px; height: 0; pointer-events: none;
217
+ }
218
+ .vtg-depth-thumb::before {
219
+ content: ''; position: absolute; left: 0; right: 0; top: -1.5px; height: 3px;
220
+ background: var(--vtg-accent); border-radius: 2px;
221
+ box-shadow: 0 0 6px rgba(91, 155, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6);
222
+ }
223
+ .vtg-depth-mark {
224
+ position: absolute; left: 0; right: 0; height: 0; pointer-events: none;
225
+ }
226
+ .vtg-depth-mark i { position: absolute; left: -4px; width: 4px; top: -0.5px; height: 1px; background: rgba(230, 238, 251, 0.55); }
227
+ .vtg-depth-mark span {
228
+ position: absolute; left: 17px; top: -5px; font: 9px var(--vtg-mono); color: var(--vtg-dim);
229
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
230
+ }
231
+ .vtg-depth-close {
232
+ width: 24px; height: 24px; flex: none; display: grid; place-items: center;
233
+ border-radius: 7px; border: 1px solid transparent; background: transparent;
234
+ color: var(--vtg-muted); cursor: pointer; padding: 0;
235
+ transition: background 0.15s, color 0.15s, border-color 0.15s;
236
+ }
237
+ .vtg-depth-close:hover { background: rgba(132, 170, 230, 0.14); color: var(--vtg-text); border-color: var(--vtg-line); }
238
+ .vtg-depth-close svg { width: 13px; height: 13px; display: block; }
239
+ @keyframes vtg-rise-y { from { opacity: 0; transform: translate(-8px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
240
+
184
241
  /* --- centre reticle (navigation reference) -------------------------------- */
185
242
  .vtg-reticle {
186
243
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;
@@ -234,6 +291,7 @@ var VantageViewer2 = forwardRef(function VantageViewer3(props, ref) {
234
291
  view = "orbit",
235
292
  antialias = true,
236
293
  maxPixelRatio = 2,
294
+ renderOnDemand = true,
237
295
  light,
238
296
  display,
239
297
  urlState = true,
@@ -258,7 +316,7 @@ var VantageViewer2 = forwardRef(function VantageViewer3(props, ref) {
258
316
  injectStyles();
259
317
  const el = canvasRef.current;
260
318
  if (!el) return;
261
- const v = new VantageViewer(el, { antialias, maxPixelRatio, view, light, display, streaming, urlState });
319
+ const v = new VantageViewer(el, { antialias, maxPixelRatio, renderOnDemand, view, light, display, streaming, urlState });
262
320
  engineRef.current = v;
263
321
  setEngine(v);
264
322
  let pendingStats = null;
@@ -296,7 +354,7 @@ var VantageViewer2 = forwardRef(function VantageViewer3(props, ref) {
296
354
  engineRef.current = null;
297
355
  setEngine(null);
298
356
  };
299
- }, [antialias, maxPixelRatio]);
357
+ }, [antialias, maxPixelRatio, renderOnDemand]);
300
358
  useEffect(() => {
301
359
  if (!engine) return;
302
360
  let cancelled = false;
@@ -319,7 +377,7 @@ var VantageViewer2 = forwardRef(function VantageViewer3(props, ref) {
319
377
  }, [engine, display?.sharpness, display?.ao, display?.saturation, display?.contrast, display?.fog, display?.renderScale]);
320
378
  useEffect(() => {
321
379
  if (engine && streaming) engine.setStreaming(streaming);
322
- }, [engine, streaming?.viewDistance, streaming?.maxTiles, streaming?.concurrency]);
380
+ }, [engine, streaming?.viewDistance, streaming?.maxTiles, streaming?.concurrency, streaming?.maxBytes]);
323
381
  const ctx = useMemo(
324
382
  () => ({
325
383
  viewer: engine,
@@ -516,38 +574,40 @@ function LightPanel({ title = "lighting", defaultCollapsed = true, className })
516
574
  }
517
575
  );
518
576
  }
577
+ var MiB = 1024 * 1024;
519
578
  var QUALITY_PRESETS = [
520
- { name: "low", viewDistance: 448, maxTiles: 44, renderScale: 0.75 },
521
- { name: "med", viewDistance: 768, maxTiles: 120, renderScale: 1 },
522
- { name: "high", viewDistance: 1152, maxTiles: 264, renderScale: 1 },
523
- { name: "ultra", viewDistance: 1408, maxTiles: 400, renderScale: 1 }
579
+ { name: "low", viewDistance: 448, maxTiles: 44, maxBytes: 320 * MiB, renderScale: 0.75 },
580
+ { name: "med", viewDistance: 768, maxTiles: 120, maxBytes: 512 * MiB, renderScale: 1 },
581
+ { name: "high", viewDistance: 1152, maxTiles: 264, maxBytes: 768 * MiB, renderScale: 1 },
582
+ { name: "ultra", viewDistance: 1408, maxTiles: 400, maxBytes: 1024 * MiB, renderScale: 1 }
524
583
  ];
525
584
  function SettingsPanel({ title = "quality", defaultCollapsed = true, className }) {
526
585
  const { viewer } = useVantage();
527
- const [k, setK] = useState({ viewDistance: 768, maxTiles: 120, renderScale: 1, fog: 1 });
586
+ const [k, setK] = useState({ viewDistance: 768, maxTiles: 120, maxBytes: 512 * MiB, renderScale: 1, fog: 1 });
528
587
  useEffect(() => {
529
588
  if (!viewer) return;
530
589
  const s = viewer.streamingSettings;
531
590
  const d = viewer.displaySettings;
532
- setK({ viewDistance: s.viewDistance, maxTiles: s.maxTiles, renderScale: d.renderScale, fog: d.fog });
591
+ setK({ viewDistance: s.viewDistance, maxTiles: s.maxTiles, maxBytes: s.maxBytes, renderScale: d.renderScale, fog: d.fog });
533
592
  }, [viewer]);
534
593
  if (!viewer) return null;
535
594
  const apply = (next) => {
536
595
  const merged = { ...k, ...next };
537
596
  setK(merged);
538
- if (next.viewDistance !== void 0 || next.maxTiles !== void 0) {
539
- viewer.setStreaming({ viewDistance: merged.viewDistance, maxTiles: merged.maxTiles });
597
+ if (next.viewDistance !== void 0 || next.maxTiles !== void 0 || next.maxBytes !== void 0) {
598
+ viewer.setStreaming({ viewDistance: merged.viewDistance, maxTiles: merged.maxTiles, maxBytes: merged.maxBytes });
540
599
  }
541
600
  if (next.renderScale !== void 0 || next.fog !== void 0) {
542
601
  viewer.setDisplay({ renderScale: merged.renderScale, fog: merged.fog });
543
602
  }
544
603
  };
545
604
  const active = QUALITY_PRESETS.find(
546
- (p) => p.viewDistance === k.viewDistance && p.maxTiles === k.maxTiles && p.renderScale === k.renderScale
605
+ (p) => p.viewDistance === k.viewDistance && p.maxTiles === k.maxTiles && p.maxBytes === k.maxBytes && p.renderScale === k.renderScale
547
606
  );
548
607
  const SLIDERS = [
549
608
  { key: "viewDistance", label: "view distance", min: 256, max: 2048, step: 64, fmt: (v) => `${v}m` },
550
609
  { key: "maxTiles", label: "tile budget", min: 24, max: 512, step: 8, fmt: (v) => `${v}` },
610
+ { key: "maxBytes", label: "memory budget", min: 128 * MiB, max: 1536 * MiB, step: 64 * MiB, fmt: (v) => `${Math.round(v / MiB)} MiB` },
551
611
  { key: "renderScale", label: "render scale", min: 0.5, max: 2, step: 0.05, fmt: (v) => `${v.toFixed(2)}\xD7` },
552
612
  { key: "fog", label: "haze", min: 0, max: 1, step: 0.05, fmt: (v) => v.toFixed(2) }
553
613
  ];
@@ -564,7 +624,7 @@ function SettingsPanel({ title = "quality", defaultCollapsed = true, className }
564
624
  "button",
565
625
  {
566
626
  className: active?.name === p.name ? "vtg-seg-on" : void 0,
567
- onClick: () => apply({ viewDistance: p.viewDistance, maxTiles: p.maxTiles, renderScale: p.renderScale }),
627
+ onClick: () => apply({ viewDistance: p.viewDistance, maxTiles: p.maxTiles, maxBytes: p.maxBytes, renderScale: p.renderScale }),
568
628
  children: p.name
569
629
  },
570
630
  p.name
@@ -604,19 +664,64 @@ var Icon = {
604
664
  fly: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
605
665
  /* @__PURE__ */ jsx("path", { d: "M14.5 1.5 1.2 6.6l5 1.7 1.7 5z" }),
606
666
  /* @__PURE__ */ jsx("path", { d: "M14.5 1.5 7.9 8.1" })
667
+ ] }),
668
+ camera: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
669
+ /* @__PURE__ */ jsx("path", { d: "M2 5h2.2L6 3h4l1.8 2H14v8H2z" }),
670
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "9", r: "2.4" })
671
+ ] }),
672
+ layers: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
673
+ /* @__PURE__ */ jsx("path", { d: "M8 2.2 14 5.4 8 8.6 2 5.4z" }),
674
+ /* @__PURE__ */ jsx("path", { d: "M2.8 8.5 8 11.3l5.2-2.8" }),
675
+ /* @__PURE__ */ jsx("path", { d: "M2.8 11.3 8 14.1l5.2-2.8" })
676
+ ] }),
677
+ expand: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
678
+ /* @__PURE__ */ jsx("path", { d: "M6 2.5H2.5V6" }),
679
+ /* @__PURE__ */ jsx("path", { d: "M10 2.5h3.5V6" }),
680
+ /* @__PURE__ */ jsx("path", { d: "M6 13.5H2.5V10" }),
681
+ /* @__PURE__ */ jsx("path", { d: "M10 13.5h3.5V10" })
682
+ ] }),
683
+ compress: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
684
+ /* @__PURE__ */ jsx("path", { d: "M2.5 6H6V2.5" }),
685
+ /* @__PURE__ */ jsx("path", { d: "M13.5 6H10V2.5" }),
686
+ /* @__PURE__ */ jsx("path", { d: "M2.5 10H6v3.5" }),
687
+ /* @__PURE__ */ jsx("path", { d: "M13.5 10H10v3.5" })
607
688
  ] })
608
689
  };
609
- function MapNav({ compass = true, tilt = true, fly = true, zoom = true, home = true, coords = true, className }) {
610
- const { viewer } = useVantage();
690
+ function MapNav({
691
+ compass = true,
692
+ tilt = true,
693
+ fly = true,
694
+ zoom = true,
695
+ home = true,
696
+ coords = true,
697
+ caves = true,
698
+ screenshot = true,
699
+ fullscreen = true,
700
+ className
701
+ }) {
702
+ const { viewer, info } = useVantage();
703
+ const navRef = useRef(null);
611
704
  const needleRef = useRef(null);
612
705
  const coordRef = useRef(null);
613
706
  const tiltRef = useRef(null);
614
707
  const [flying, setFlying] = useState(false);
708
+ const [isFs, setIsFs] = useState(false);
709
+ const [sliced, setSliced] = useState(false);
615
710
  useEffect(() => {
616
711
  if (!viewer) return;
617
712
  setFlying(viewer.isFlying);
618
713
  return viewer.on("mode", ({ fly: fly2 }) => setFlying(fly2));
619
714
  }, [viewer]);
715
+ useEffect(() => {
716
+ if (!viewer) return;
717
+ setSliced(viewer.slice !== null);
718
+ return viewer.on("slice", ({ y }) => setSliced(y !== null));
719
+ }, [viewer]);
720
+ useEffect(() => {
721
+ const sync = () => setIsFs(document.fullscreenElement != null);
722
+ document.addEventListener("fullscreenchange", sync);
723
+ return () => document.removeEventListener("fullscreenchange", sync);
724
+ }, []);
620
725
  useEffect(() => {
621
726
  if (!viewer) return;
622
727
  let raf = 0;
@@ -653,7 +758,23 @@ function MapNav({ compass = true, tilt = true, fly = true, zoom = true, home = t
653
758
  }, [viewer]);
654
759
  if (!viewer) return null;
655
760
  const toggleTilt = () => viewer.tilt > TILT_THRESHOLD ? viewer.flatten() : viewer.setTilt(DEFAULT_ORBIT_ANGLE);
656
- return /* @__PURE__ */ jsxs("div", { className: className ? `vtg-nav vtg-glass ${className}` : "vtg-nav vtg-glass", role: "group", "aria-label": "map navigation", children: [
761
+ const takeScreenshot = () => {
762
+ const p = viewer.controls.position;
763
+ const a = document.createElement("a");
764
+ a.href = viewer.screenshot();
765
+ a.download = `vantage_${Math.round(p.x)}_${Math.round(p.z)}.png`;
766
+ a.click();
767
+ };
768
+ const showCaves = caves && info !== null && (viewer.hasCaves || sliced);
769
+ const canFullscreen = typeof document !== "undefined" && document.fullscreenEnabled;
770
+ const toggleFullscreen = () => {
771
+ if (document.fullscreenElement != null) document.exitFullscreen().catch(() => {
772
+ });
773
+ else
774
+ (navRef.current?.closest(".vtg-root") ?? document.documentElement).requestFullscreen().catch(() => {
775
+ });
776
+ };
777
+ return /* @__PURE__ */ jsxs("div", { ref: navRef, className: className ? `vtg-nav vtg-glass ${className}` : "vtg-nav vtg-glass", role: "group", "aria-label": "map navigation", children: [
657
778
  compass && /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-compass", title: "Face north", "aria-label": "Face north", onClick: () => viewer.resetNorth(), children: /* @__PURE__ */ jsxs("svg", { viewBox: "-16 -16 32 32", "aria-hidden": "true", children: [
658
779
  /* @__PURE__ */ jsx("circle", { cx: "0", cy: "0", r: "14.5", fill: "none", stroke: "rgba(140,178,238,0.18)", strokeWidth: "1" }),
659
780
  /* @__PURE__ */ jsxs("g", { ref: needleRef, children: [
@@ -675,16 +796,135 @@ function MapNav({ compass = true, tilt = true, fly = true, zoom = true, home = t
675
796
  children: Icon.fly
676
797
  }
677
798
  ),
799
+ showCaves && /* @__PURE__ */ jsx(
800
+ "button",
801
+ {
802
+ type: "button",
803
+ className: sliced ? "vtg-navbtn vtg-on" : "vtg-navbtn",
804
+ title: sliced ? "Close the cave view (C)" : "Cave view \u2014 slice into the world (C)",
805
+ "aria-label": "Toggle cave view",
806
+ "aria-pressed": sliced,
807
+ onClick: () => viewer.toggleSlice(),
808
+ children: Icon.layers
809
+ }
810
+ ),
678
811
  coords && /* @__PURE__ */ jsxs("span", { className: "vtg-coords", title: "World X, Z at view centre", children: [
679
812
  /* @__PURE__ */ jsx("b", { children: "xz" }),
680
813
  /* @__PURE__ */ jsx("span", { ref: coordRef, children: "0, 0" })
681
814
  ] }),
682
- !flying && (zoom || home) && /* @__PURE__ */ jsx("span", { className: "vtg-nav-sep" }),
815
+ (screenshot || fullscreen && canFullscreen || !flying && (zoom || home)) && /* @__PURE__ */ jsx("span", { className: "vtg-nav-sep" }),
683
816
  zoom && !flying && /* @__PURE__ */ jsxs(Fragment, { children: [
684
817
  /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Zoom out", "aria-label": "Zoom out", onClick: () => viewer.zoomBy(-1), children: Icon.minus }),
685
818
  /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Zoom in", "aria-label": "Zoom in", onClick: () => viewer.zoomBy(1), children: Icon.plus })
686
819
  ] }),
687
- home && !flying && /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Reset view", "aria-label": "Reset view", onClick: () => viewer.resetView(), children: Icon.home })
820
+ home && !flying && /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Reset view", "aria-label": "Reset view", onClick: () => viewer.resetView(), children: Icon.home }),
821
+ screenshot && /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Save a screenshot (PNG)", "aria-label": "Save a screenshot", onClick: takeScreenshot, children: Icon.camera }),
822
+ fullscreen && canFullscreen && /* @__PURE__ */ jsx(
823
+ "button",
824
+ {
825
+ type: "button",
826
+ className: isFs ? "vtg-navbtn vtg-on" : "vtg-navbtn",
827
+ title: isFs ? "Exit fullscreen" : "Fullscreen",
828
+ "aria-label": "Toggle fullscreen",
829
+ "aria-pressed": isFs,
830
+ onClick: toggleFullscreen,
831
+ children: isFs ? Icon.compress : Icon.expand
832
+ }
833
+ )
834
+ ] });
835
+ }
836
+ function isTypingTarget2(t) {
837
+ if (!(t instanceof HTMLElement)) return false;
838
+ return t.isContentEditable || t.tagName === "INPUT" || t.tagName === "TEXTAREA";
839
+ }
840
+ function DepthSlider({ toggleKey = "c", step = 4, className }) {
841
+ const { viewer, info } = useVantage();
842
+ const trackRef = useRef(null);
843
+ const [sliceY, setSliceY] = useState(null);
844
+ useEffect(() => {
845
+ if (!viewer) return;
846
+ setSliceY(viewer.slice);
847
+ return viewer.on("slice", ({ y }) => setSliceY(y));
848
+ }, [viewer]);
849
+ useEffect(() => {
850
+ if (!viewer) return;
851
+ const onKey = (e) => {
852
+ if (isTypingTarget2(e.target)) return;
853
+ if (toggleKey && e.key.toLowerCase() === toggleKey.toLowerCase()) {
854
+ if (viewer.hasCaves || viewer.slice !== null) viewer.toggleSlice();
855
+ } else if (viewer.slice !== null && (e.key === "[" || e.key === "]")) {
856
+ viewer.setSlice(viewer.slice + (e.key === "]" ? step : -step));
857
+ }
858
+ };
859
+ window.addEventListener("keydown", onKey);
860
+ return () => window.removeEventListener("keydown", onKey);
861
+ }, [viewer, toggleKey, step]);
862
+ if (!viewer || !info || sliceY === null) return null;
863
+ const { min, max } = viewer.sliceRange;
864
+ const frac = (y) => Math.min(Math.max((max - y) / (max - min), 0), 1);
865
+ const thumbTop = frac(sliceY) * 100;
866
+ const setFromPointer = (e) => {
867
+ const track = trackRef.current;
868
+ if (!track) return;
869
+ const r = track.getBoundingClientRect();
870
+ const t = Math.min(Math.max((e.clientY - r.top) / r.height, 0), 1);
871
+ viewer.setSlice(Math.round(max - t * (max - min)));
872
+ };
873
+ const onPointerDown = (e) => {
874
+ e.preventDefault();
875
+ e.currentTarget.setPointerCapture(e.pointerId);
876
+ setFromPointer(e);
877
+ };
878
+ const marks = [];
879
+ if (63 > min && 63 < max) marks.push({ y: 63, label: "sea" });
880
+ if (0 > min && 0 < max) marks.push({ y: 0, label: "0" });
881
+ return /* @__PURE__ */ jsxs("div", { className: className ? `vtg-depth vtg-glass ${className}` : "vtg-depth vtg-glass", role: "group", "aria-label": "cave view depth", children: [
882
+ /* @__PURE__ */ jsxs("div", { className: "vtg-depth-val", title: "Slice depth (world Y)", children: [
883
+ /* @__PURE__ */ jsx("b", { children: "Y" }),
884
+ Math.round(sliceY)
885
+ ] }),
886
+ /* @__PURE__ */ jsxs(
887
+ "div",
888
+ {
889
+ ref: trackRef,
890
+ className: "vtg-depth-rail",
891
+ role: "slider",
892
+ "aria-label": "Slice depth",
893
+ "aria-valuemin": min,
894
+ "aria-valuemax": max,
895
+ "aria-valuenow": Math.round(sliceY),
896
+ "aria-orientation": "vertical",
897
+ tabIndex: 0,
898
+ onPointerDown,
899
+ onPointerMove: (e) => e.buttons === 1 && setFromPointer(e),
900
+ onKeyDown: (e) => {
901
+ if (e.key === "ArrowUp") viewer.setSlice(sliceY + 1);
902
+ else if (e.key === "ArrowDown") viewer.setSlice(sliceY - 1);
903
+ },
904
+ children: [
905
+ /* @__PURE__ */ jsx("div", { className: "vtg-depth-track", children: /* @__PURE__ */ jsx("div", { className: "vtg-depth-cut", style: { height: `${thumbTop}%` } }) }),
906
+ marks.map((m) => /* @__PURE__ */ jsxs("div", { className: "vtg-depth-mark", style: { top: `${frac(m.y) * 100}%` }, children: [
907
+ /* @__PURE__ */ jsx("i", {}),
908
+ /* @__PURE__ */ jsx("span", { children: m.label })
909
+ ] }, m.label)),
910
+ /* @__PURE__ */ jsx("div", { className: "vtg-depth-thumb", style: { top: `${thumbTop}%` } })
911
+ ]
912
+ }
913
+ ),
914
+ /* @__PURE__ */ jsx(
915
+ "button",
916
+ {
917
+ type: "button",
918
+ className: "vtg-depth-close",
919
+ title: "Close the cave view",
920
+ "aria-label": "Close the cave view",
921
+ onClick: () => viewer.setSlice(null),
922
+ children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", children: [
923
+ /* @__PURE__ */ jsx("path", { d: "M4.5 4.5 11.5 11.5" }),
924
+ /* @__PURE__ */ jsx("path", { d: "M11.5 4.5 4.5 11.5" })
925
+ ] })
926
+ }
927
+ )
688
928
  ] });
689
929
  }
690
930
  function Reticle({ className }) {
@@ -712,4 +952,4 @@ function Reticle({ className }) {
712
952
  ] });
713
953
  }
714
954
 
715
- export { BiomeLayer, CSS, LightPanel, MapNav, Panel, QUALITY_PRESETS, Reticle, SettingsPanel, VantageViewer2 as VantageViewer, injectStyles, useVantage };
955
+ export { BiomeLayer, CSS, DepthSlider, LightPanel, MapNav, Panel, QUALITY_PRESETS, Reticle, SettingsPanel, VantageViewer2 as VantageViewer, injectStyles, useVantage };
@@ -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-CPP37ieY.js';
3
- export { B as BiomeEntry, b as ByteReader, L as Lightmap, c as LowresLevel, M as ManifestTile, d as MeshSection, e as QuantizedSection, T as TEXTURE_MAGIC, f as TILE_MAGIC, g as TextureAnimation, h as TileMagic, U as UV_SCALE, W as WorldFetch, i as WorldManifest, j as WorldSource, k as biomePalette, l as canonicalQuadIndices, p as parseManifest, m as parseTextureArray, n as parseTile, o as parseTileQuantized, s as stripNamespace, q as summarizeBiomes, r as summarizeSurfaceBiomes, t as tileKey, w as worldFromDirectory, u as worldFromFiles, v as worldFromUrl } from '../biome-CPP37ieY.js';
2
+ import { R as Rgb, Q as QuantizedTile, D as DecodedTile, a as DecodedTextureArray, S as SurfaceMap } from '../biome-NBWIY7dT.js';
3
+ export { B as BiomeEntry, b as ByteReader, L as Lightmap, c as LowresLevel, M as ManifestTile, d as MeshSection, e as QuantizedSection, T as TEXTURE_MAGIC, f as TILE_MAGIC, g as TextureAnimation, h as TileMagic, U as UV_SCALE, W as WorldFetch, i as WorldManifest, j as WorldSource, k as biomePalette, l as canonicalQuadIndices, p as parseManifest, m as parseTextureArray, n as parseTile, o as parseTileQuantized, s as stripNamespace, q as summarizeBiomes, r as summarizeSurfaceBiomes, t as tileKey, w as worldFromDirectory, u as worldFromFiles, v as worldFromUrl } from '../biome-NBWIY7dT.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-GsEn9RpF.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-C5vYxrL1.js';
7
7
 
8
8
  /** The objects and metadata produced from a tile. */
9
9
  interface TerrainObjects {
@@ -26,7 +26,7 @@ interface TerrainObjects {
26
26
  /** The meshes built from one tile with caller-provided (shared) materials. */
27
27
  interface TileMeshes {
28
28
  terrain: THREE.Mesh;
29
- /** The atlas-lit tail of the solid geometry (VTL8), drawn with the
29
+ /** The atlas-lit tail of the solid geometry (VTL8+), drawn with the
30
30
  * lightmapped sibling material. */
31
31
  terrainLm?: THREE.Mesh;
32
32
  /** The tail's lightmap texture — dispose it with the tile. */
@@ -42,11 +42,11 @@ interface TileMeshes {
42
42
  */
43
43
  declare function buildTileMeshes(tile: DecodedTile, palette: Rgb[], material: THREE.ShaderMaterial, waterMaterial: THREE.ShaderMaterial): TileMeshes;
44
44
  /**
45
- * Build a VTL6/7/8 tile's meshes in the quantized fast path: shared QUANTIZED
45
+ * Build a VTL6+ tile's meshes in the quantized fast path: shared QUANTIZED
46
46
  * materials (from `createTerrainMaterial(tex, { quantized: true, palette })`),
47
47
  * zero per-vertex CPU work. This is what the streaming TileManager uses.
48
48
  *
49
- * A VTL8 tile's atlas-lit vertex tail becomes its own mesh (`terrainLm`) drawn
49
+ * A VTL8+ tile's atlas-lit vertex tail becomes its own mesh (`terrainLm`) drawn
50
50
  * with `lmMaterial` (from {@link createLightmappedMaterial}) — pass it whenever
51
51
  * the world is format 4+, or the tail would render full-bright.
52
52
  */
@@ -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-C7GIMQYZ.js';
2
- export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, UV_SCALE, biomePalette, canonicalQuadIndices, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey, worldFromDirectory, worldFromFiles, worldFromUrl } from '../chunk-M6KVJXCR.js';
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-46RBFJ4D.js';
2
+ export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, UV_SCALE, biomePalette, canonicalQuadIndices, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey, worldFromDirectory, worldFromFiles, worldFromUrl } from '../chunk-EVPUXVSB.js';