@@ -36,7 +36,7 @@ import {
3636 pinInGridCell,3737 selectGridCell,3838 } from "./grid.js";39-import { equirectMapping, mapSurface } from "./semconv.js";39+import { equirectMapping, worldSurface } from "./semconv.js";4040 import { state } from "./state.js";4141 import { markerIconKey, measureLabel } from "./styles.js";4242 import { categoryColor, iconOutsetColor, initials } from "./theme.js";@@ -76,7 +76,7 @@ let globe = null;
7676 let texturedFor = "";7777 7878 79-const detail = { group: null, tiles: new Map(), key: "", variant: "" };79+const detail = { group: null, tiles: new Map(), key: "", lens: "" };8080 8181 8282 @@ -103,7 +103,7 @@ const materials = new Map();
103103 104104 105105 export function syncGlobe() {106- const offered = mapSurface(state.map) === "sphere" && equirectMapping(state.map) !== null;106+ const offered = worldSurface(state.world) === "sphere" && equirectMapping(state.world) !== null;107107 elements.globeToggle.hidden = !offered;108108 leaveGlobe();109109 if (!offered && globe) {@@ -148,7 +148,7 @@ function altitudeForZoom(zoom) {
148148 149149 function zoomForAltitude(altitude) {150150 const safe = Number.isFinite(altitude) ? Math.max(altitude, nearestAltitude / 2) : wholeDiscAltitude;151- const ceiling = (state.variant?.maxZoom ?? wholeChartZoom) + overzoomLevels;151+ const ceiling = (state.lens?.maxZoom ?? wholeChartZoom) + overzoomLevels;152152 return clamp(wholeChartZoom + Math.log2(wholeDiscAltitude / safe), 0, ceiling);153153 }154154 @@ -171,7 +171,7 @@ function leaveGlobe() {
171171 172172 173173 174- const mapping = equirectMapping(state.map);174+ const mapping = equirectMapping(state.world);175175 const view = state.engine?.getView();176176 if (globe && state.globeActive && mapping && view) {177177 const pov = globe.pointOfView();@@ -213,7 +213,7 @@ export function aimGlobe(lat, lng, ease) {
213213 }214214 215215 async function enterGlobe() {216- const mapping = equirectMapping(state.map);216+ const mapping = equirectMapping(state.world);217217 if (!mapping) return;218218 state.globeActive = true;219219 elements.viewport.hidden = true;@@ -258,7 +258,7 @@ async function enterGlobe() {
258258 259259 globe.onGlobeClick(({ lat, lng }) => {260260 if (!state.gridEnabled) return;261- const held = equirectMapping(state.map);261+ const held = equirectMapping(state.world);262262 if (!held) return;263263 const [worldX, worldY] = held.toWorld(lat, lng);264264 const target = activeSystem().descendTarget(state.gridCell, [worldX, -worldY]);@@ -293,11 +293,11 @@ async function enterGlobe() {
293293 globe.pointOfView({ lat: 10, lng: 0, altitude: wholeDiscAltitude });294294 }295295 296- const variant = state.variant || state.map.variants[0];297- const key = `${state.game.stamp}:${state.map.slug}:${variant.tiles}`;296+ const lens = state.lens || state.world.lenses[0];297+ const key = `${state.volume.stamp}:${state.world.slug}:${lens.tiles}`;298298 if (texturedFor !== key) {299299 texturedFor = key;300- const texture = await composeTexture(variant);300+ const texture = await composeTexture(lens);301301 if (texture && texturedFor === key) {302302 globe.globeImageUrl(texture);303303 }@@ -329,7 +329,7 @@ function rebuildGlobeGrid() {
329329 child.material?.map?.dispose();330330 child.material?.dispose();331331 }332- const mapping = state.globeActive ? equirectMapping(state.map) : null;332+ const mapping = state.globeActive ? equirectMapping(state.world) : null;333333 if (!mapping || !state.gridEnabled) {334334 grid.cell = null;335335 return;@@ -730,21 +730,21 @@ function frameGridCell(mapping) {
730730 731731 function updateDetailTiles() {732732 if (!globe || !detail.group) return;733- const variant = state.globeActive ? state.variant || state.map.variants[0] : null;734- if (!variant) {733+ const lens = state.globeActive ? state.lens || state.world.lenses[0] : null;734+ if (!lens) {735735 clearDetailTiles();736736 return;737737 }738- if (detail.variant !== variant.tiles) {738+ if (detail.lens !== lens.tiles) {739739 clearDetailTiles();740- detail.variant = variant.tiles;740+ detail.lens = lens.tiles;741741 }742742 const pov = globe.pointOfView();743743 const zoom = Math.min(744744 Math.round(zoomForAltitude(pov.altitude)) + 1,745- variant.maxZoom,745+ lens.maxZoom,746746 );747- if (zoom <= textureZoom || !variant.formats[zoom]) {747+ if (zoom <= textureZoom || !lens.formats[zoom]) {748748 clearDetailTiles();749749 detail.key = "";750750 return;@@ -770,7 +770,7 @@ function updateDetailTiles() {
770770 wanted.add(`${zoom}/${column}/${row}`);771771 }772772 }773- const key = `${variant.tiles}:${[...wanted].sort().join(",")}`;773+ const key = `${lens.tiles}:${[...wanted].sort().join(",")}`;774774 if (key === detail.key) return;775775 detail.key = key;776776 @@ -783,7 +783,7 @@ function updateDetailTiles() {
783783 for (const name of wanted) {784784 if (detail.tiles.has(name)) continue;785785 const [z, column, row] = name.split("/").map(Number);786- const mesh = tileMesh(variant, z, column, row);786+ const mesh = tileMesh(lens, z, column, row);787787 detail.tiles.set(name, mesh);788788 detail.group.add(mesh);789789 }@@ -792,7 +792,7 @@ function updateDetailTiles() {
792792 793793 794794 795-function tileMesh(variant, zoom, column, row) {795+function tileMesh(lens, zoom, column, row) {796796 const span = 360 / 2 ** zoom;797797 const west = -180 + column * span;798798 const north = 90 - row * span;@@ -824,7 +824,7 @@ function tileMesh(variant, zoom, column, row) {
824824 const mesh = new Mesh(geometry, material);825825 826826 mesh.visible = false;827- const url = `${state.game.base}/tiles/${variant.tiles}/${zoom}/${column}/${row}.${variant.formats[zoom]}`;827+ const url = `${state.volume.base}/tiles/${lens.tiles}/${zoom}/${column}/${row}.${lens.formats[zoom]}`;828828 new TextureLoader().load(url, (texture) => {829829 texture.colorSpace = SRGBColorSpace;830830 material.map = texture;@@ -967,7 +967,7 @@ function material(category, selected) {
967967 }968968 969969 970-970+971971 export function refreshGlobe() {972972 if (state.globeActive) void enterGlobe();973973 }@@ -1011,9 +1011,9 @@ function spherePins(mapping) {
10111011 10121012 10131013 1014-async function composeTexture(variant) {1015- const zoom = Math.min(textureZoom, variant.maxZoom);1016- const format = variant.formats[zoom];1014+async function composeTexture(lens) {1015+ const zoom = Math.min(textureZoom, lens.maxZoom);1016+ const format = lens.formats[zoom];10171017 if (!format) return null;10181018 const columns = 2 ** zoom;10191019 const rows = columns / 2;@@ -1024,7 +1024,7 @@ async function composeTexture(variant) {
10241024 const jobs = [];10251025 for (let y = 0; y < rows; y++) {10261026 for (let x = 0; x < columns; x++) {1027- const url = `${state.game.base}/tiles/${variant.tiles}/${zoom}/${x}/${y}.${format}`;1027+ const url = `${state.volume.base}/tiles/${lens.tiles}/${zoom}/${x}/${y}.${format}`;10281028 jobs.push(loadTile(url).then((image) => {10291029 if (image) context.drawImage(image, x * 256, y * 256, 256, 256);10301030 }));