mapspinner 0.1.7 → 0.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapspinner",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "WebGL2 Earth-scale terrain rendering SDK for interactive globe applications",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -168,7 +168,7 @@ export async function initMapspinnerPlanet(gl, opts = {}) {
168
168
  // quadtree levels (L14/L15/L16, ~28m/~14m/~7m cells) -- the close-approach overdraw tail -- so the deepest
169
169
  // LOD is now L13 (~56m cell). Pairs with the LOD_STEP push (each region still resolves levels-finer-per-
170
170
  // distance, just capped three steps shallower). Live override window.__maxLevel.
171
- const maxLevel = opts.maxLevel ?? 13;
171
+ const maxLevel = opts.maxLevel ?? 12;
172
172
  // splitFactor 2.0 over-subdivided ~5-20x: the baseline measured px/poly edge median
173
173
  // 0.73 (orbit) / 1.56 (lowalt), far below the user's 4-50 px target, which also
174
174
  // saturated the atlas (1920/1920) and drove tileGenMs to ~950ms. The live sweep
@@ -497,7 +497,7 @@ export async function initMapspinnerPlanet(gl, opts = {}) {
497
497
  // ONLY to splitDist (NOT distF below): distF = sf*8.0 is the altitude-weighting term, and scaling sf
498
498
  // into BOTH compounds into ~2 levels at altitude (witnessed: base sf*2 gave mx 5->7 at 8000km). Keep
499
499
  // distF on the original sf so the push is a clean ONE step. maxLevel (16) is untouched -- no new LOD.
500
- const LOD_STEP = 4.0; // push ALL LODs out ANOTHER step (user 2026-06-09 #2, after the 1.0->2.0 first step):
500
+ const LOD_STEP = 8.0; // push ALL LODs out TWO steps: compensates for maxLevel 13->12 and steeper far falloff, targets ~600 quads deck
501
501
  qt.computeSplitDist(sf * LOD_STEP, gl.drawingBufferHeight || 480, fovy);
502
502
  // DETAIL-FARTHER (user 2026-06-01h: each LOD pop should happen ~3x farther out -- 6km detail at
503
503
  // 24km, etc.). A quad subdivides when camAlt < l * splitDist * distFactor, so tripling distFactor
@@ -541,11 +541,11 @@ export async function initMapspinnerPlanet(gl, opts = {}) {
541
541
  // subdivide to L16 (~7m cells, the vtxDisplace floor) while flat tiles stay capped at L14 -> the
542
542
  // polygon budget follows the relief, within the existing quadtree spatial index. nadir-only sample
543
543
  // so the foreground the user is descending toward drives it.
544
- let DECK_CAP_LEVEL = 14;
544
+ let DECK_CAP_LEVEL = 12;
545
545
  if (hpf && hpf.sampleDir) {
546
546
  const nA = hpf.sampleDir([camWorldPos[0]/camDist, camWorldPos[1]/camDist, camWorldPos[2]/camDist]);
547
547
  const mtn = Math.max(0, Math.min(1, (nA.elevAmp - 16.8) / (18.6 - 16.8))); // mountain-belt weight 0..1
548
- DECK_CAP_LEVEL = 14 + Math.round(2 * mtn); // flat L14 -> rugged L16, adaptive
548
+ DECK_CAP_LEVEL = 12 + Math.round(2 * mtn); // flat L12 -> rugged L14, adaptive
549
549
  }
550
550
  const _maxLevelOverridden = (typeof window !== 'undefined' && window.__maxLevel != null);
551
551
  if (!_maxLevelOverridden && altKm < DECK_CAP_ALT_KM && mxl > DECK_CAP_LEVEL) mxl = DECK_CAP_LEVEL;
package/src/quadtree.js CHANGED
@@ -94,7 +94,7 @@ export class Quadtree {
94
94
  const near = Math.max(this._camAlt * 6.0, horizon * 0.9, 20000.0);
95
95
  // floor 0.5 (was 0.18): past the horizon the split may HALVE, not crush to ~1/5 (which was
96
96
  // collapsing near-field detail on descent). Foreground (latC<near) stays fall=1 -> full LOD.
97
- const fall = 1.0 / (1.0 + Math.max(0.0, latC - near) / (near * 2.0));
97
+ const fall = 1.0 / (1.0 + Math.max(0.0, latC - near) / near);
98
98
  // ALTITUDE-DETAIL-GRADIENT-SWAP (user: 'above fps height, swap more near detail for far detail so the
99
99
  // higher we get the less of a detail gradient there is to the land center'). The far-coarsening floor
100
100
  // is normally 0.5 (far quads split at half the near rate = a radial detail gradient around the
@@ -104,7 +104,7 @@ export class Quadtree {
104
104
  // stays sharp (floor 0.5) so the deck keeps its near-field detail. fpsAltM live via this.fpsAltM.
105
105
  const fpsAltM = this.fpsAltM || 5000.0;
106
106
  const aboveFps = Math.min(1.0, Math.max(0.0, (this._camAlt - fpsAltM) / (fpsAltM * 8.0))); // 0 at fps height -> 1 by ~45km
107
- const floor = 0.5 + 0.5 * (aboveFps * aboveFps * (3 - 2 * aboveFps)); // 0.5 (fps deck) -> 1.0 (high alt, flat gradient)
107
+ const floor = 0.25 + 0.75 * (aboveFps * aboveFps * (3 - 2 * aboveFps)); // 0.25 (fps deck) -> 1.0 (high alt, flat gradient)
108
108
  const effSplit = this.splitDist * Math.max(floor, fall);
109
109
  if (dist < l * effSplit && level < this.maxLevel) {
110
110
  const hl = l / 2.0;