Skip to content

Commit

Permalink
feat(map): add option to control view distance for maps
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Jan 6, 2024
1 parent 28af560 commit 99c57d1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/map/MapManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import TextureManager from '../texture/TextureManager.js';
import DoodadManager from './DoodadManager.js';
import { AssetHost } from '../asset.js';

const DEFAULT_VIEW_DISTANCE = 1277.0;

type MapManagerOptions = {
host: AssetHost;
formatManager?: FormatManager;
textureManager?: TextureManager;
viewDistance?: number;
};

class MapManager {
Expand All @@ -35,13 +38,17 @@ class MapManager {
#targetChunkX: number;
#targetChunkY: number;

#viewDistance = 577.0;
#viewDistance = DEFAULT_VIEW_DISTANCE;
#projScreenMatrix = new THREE.Matrix4();
#cameraFrustum = new THREE.Frustum();

#desiredAreas = new Set<number>();

constructor(options: MapManagerOptions) {
if (options.viewDistance) {
this.#viewDistance = options.viewDistance;
}

this.#formatManager = new FormatManager({ host: options.host });
this.#textureManager = options.textureManager ?? new TextureManager({ host: options.host });

Expand Down

0 comments on commit 99c57d1

Please sign in to comment.