WebGL map: keep the cities' pictures while the zoom moves, paint them sharp once it rests
The scale of a city's picture is in steps of 1/24, so a pinch repainted every city every ~4 % of zoom: hundreds of pictures a frame, and the atlas full and reset over and over. On the card, while the zoom moves, pictures that grow with it (cities, ships, badges) keep the step of the scale held when it began, stretched by up to 1.25x either way by the card's filtering, and take a new one beyond that; 250 ms after the zoom stops they are painted at their own step again, and a still map is drawn once more for it. The 2D map paints every step as before.
This commit is contained in:
parent
2ff634a0ed
commit
eeeccc60d4
7 changed files with 115 additions and 12 deletions
|
|
@ -31,7 +31,7 @@ function mapHidden(){for(const id of ['dashCard','bankCard']){const c=$(id);if(c
|
|||
a second anyway, and every frame while the land picture is still catching up with a zoom (the WebGL map has none). */
|
||||
const FRAME=[];
|
||||
function mapStill(t,now){const sl=UI.sel,dr=UI.drag;
|
||||
const v=[t,cam.x,cam.y,cam.z,CW,CH,DPR,S,R,S&&S.day,S&&S.links.length,S&&S.offers.length,S&&S.inc.length,sl&&sl.type,sl&&sl.id,UI.hover,UI.snap&&UI.snap.id,dr&&dr.mode,dr&&dr.cx,dr&&dr.cy,FLOATS.length,UI.mk?UI.mk.tx:0,UI.mk?UI.mk.mood:0];
|
||||
const v=[t,cam.x,cam.y,cam.z,CW,CH,DPR,S,R,S&&S.day,S&&S.links.length,S&&S.offers.length,S&&S.inc.length,sl&&sl.type,sl&&sl.id,UI.hover,UI.snap&&UI.snap.id,dr&&dr.mode,dr&&dr.cx,dr&&dr.cy,FLOATS.length,UI.mk?UI.mk.tx:0,UI.mk?UI.mk.mood:0,zoomMoving()];
|
||||
let same=v.length===FRAME.length;for(let i=0;i<v.length;i++)if(FRAME[i]!==v[i]){same=false;FRAME[i]=v[i];}
|
||||
return same&&now-(UI.drawnAt||0)<1000&&(glOn()||!!(WL.cv&&WL.key===(cam.z*DPR).toFixed(4)&&wlCovers(cam.z)));}
|
||||
function tickErr(e){console.error('[tubes] tick failed',e);if(UI.tickErr)return;UI.tickErr=true;track('tick_error',true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue