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
|
|
@ -30,7 +30,7 @@ function shipSprite(x,y,face,sc,col,now,mode){const bl=mode==='work'&&Math.floor
|
|||
c.fillStyle=col;c.strokeStyle='#1E2640';c.lineWidth=1.6;c.lineJoin='round';c.beginPath();c.moveTo(-11,0);c.lineTo(11,0);c.lineTo(8,6);c.lineTo(-9,6);c.closePath();c.fill();c.stroke();
|
||||
c.fillStyle='#fff';c.beginPath();c.rect(-7,-7,8,7);c.fill();c.stroke();c.fillStyle='#1E2640';c.fillRect(-5,-5,4,2);
|
||||
c.beginPath();c.arc(9,-2,2.6,0,7);c.fillStyle='#FFD23F';c.fill();c.stroke();
|
||||
if(bl){c.fillStyle='#FFD23F';c.font='900 11px sans-serif';c.textAlign='center';c.fillText('✦',12,-8);}});}
|
||||
if(bl){c.fillStyle='#FFD23F';c.font='900 11px sans-serif';c.textAlign='center';c.fillText('✦',12,-8);}},true);}
|
||||
function drawShips(ks,now){SHIP_HITS.length=0;if(!S||pzOn()||!S.fleet)return;
|
||||
const T=S.day+(UI.speed?clamp(acc/DAY_MS,0,0.999):0),z=cam.z,sc=Math.max(0.85,Math.min(1.5,Math.sqrt(z)))*(lodFar()?0.9:1.05),list=[];
|
||||
for(const s of SHIPS){const p=shipAt(s,T);if(p.m==='port'&&z<1.1)continue;list.push({p,s,col:s.club==='prv'?'#7A5CFF':'#FF4D5E'});}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue