Skip to content

Commit

Permalink
feat(web): add reasonable starting views for continent maps
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Dec 31, 2023
1 parent 5e9b401 commit 9df69cf
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions packages/spelunker-web/src/components/core/MapViewer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,22 @@ const camera = new THREE.PerspectiveCamera(
1277.0,
);

const MapViewer = ({ map: { filename } }) => {
const GENERIC_VIEW = new THREE.Vector3(100.0, 100.0, 0.0);
const DEFAULT_VIEWS = {
// Eastern Kingdoms - The Hinterlands, Aerie Peak
0: new THREE.Vector3(323.513, -2227.2, 137.617),

// Kalimdor - Mulgore, Thunder Bluff
1: new THREE.Vector3(-981.917, -74.6465, 20.1265),

// Outland - Hellfire Peninsula, Honor Hold
530: new THREE.Vector3(-803.012, 2702.59, 106.758),

// Northrend - Grizzly Hills, Amberpine GY
571: new THREE.Vector3(3534.13, -2882.06, 204.625),
};

const MapViewer = ({ map: { id, filename } }) => {
const containerRef = useRef();
const canvasRef = useRef();
const mapManagerRef = useRef();
Expand Down Expand Up @@ -61,8 +76,8 @@ const MapViewer = ({ map: { filename } }) => {
controls.keyPanSpeed = 20.0;
controls.zoomSpeed = 5.0;

const position = new THREE.Vector3(100.0, 100.0, 0.0);
controls.setView(position);
const view = DEFAULT_VIEWS[id] || GENERIC_VIEW;
controls.setView(view);

const mapManager = new MapManager(filename, formatManager, textureManager);
mapManagerRef.current = mapManager;
Expand Down

0 comments on commit 9df69cf

Please sign in to comment.