implement fov

This commit is contained in:
2026-02-25 10:23:19 -08:00
parent 43cc9b6416
commit 48a7b06b71
5 changed files with 31 additions and 9 deletions

View File

@@ -18,6 +18,9 @@ const bot = new CompleteBot(new Uint8Array(await b.arrayBuffer()));
const map = new CompleteMap(new Uint8Array(await m.arrayBuffer()));
const playback = new PlaybackHead(0);
// Initialize playback (fill playback state from bot)
playback.advance_time(bot, 0);
graphics.change_map(map);
// HUD
@@ -111,7 +114,9 @@ requestAnimationFrame(animate);
function resize() {
canvas.width = canvas.clientWidth;
canvas.height = canvas.clientHeight;
graphics.resize(canvas.width, canvas.height);
const fov_y = playback.get_fov_slope_y();
const fov_x = (fov_y * canvas.width) / canvas.height;
graphics.resize(canvas.width, canvas.height, fov_x, fov_y);
}
window.addEventListener("resize", resize);
resize();