implement fov
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user