mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Give the Cesium draw port atlases and the clamp state
The shared Cesium ports gain draw.atlas, draw.clampState and
draw.on('clampState'), on both the conformance renderer and the
application's. An icon names an image by atlas slot; it draws once its atlas
holds the slot, and registering an atlas again rebuilds the icon sets that
read from it. A generated image with a key is one texture however many icons
draw it.
clampState is draped unless a shown 3D tileset is in the scene: the port
draws clamped items where it is given them and drapes nothing onto tiles yet,
so over tiles it says overlay. A change is told after the drawn frame that
shows it, never on subscribing.
A new draw.atlas check registers an atlas after its icons and picks them;
it and draw.clampState now run on Cesium.
This commit is contained in:
1 parent
09a84ea8a5
commit
338b75b8d8
5 files changed
+194
-5
No files matched your search
@@ -1125,6 +1125,52 @@ export function portChecks() {
|
||||
off();
|
||||
},
|
||||
),
|
||||
check(
|
||||
'draw.atlas',
|
||||
'icons draw slots of an atlas registered after them, and are picked',
|
||||
async (h, r) => {
|
||||
await overAustin(h, r);
|
||||
const set = r.draw.icons({ id: 'conf:atlas' });
|
||||
const at = (lon) => h.toEcef({ lon, lat: AUSTIN.lat, height: 0 });
|
||||
// A generated slot too, where there is a page to make it in.
|
||||
const canvas = globalThis.document?.createElement('canvas');
|
||||
const slots = { svg: ['dot', DOT, AUSTIN.lon - 0.002] };
|
||||
if (canvas) {
|
||||
canvas.width = canvas.height = 16;
|
||||
const g = canvas.getContext('2d');
|
||||
g.fillStyle = '#fff';
|
||||
g.fillRect(0, 0, 16, 16);
|
||||
slots.canvas = [
|
||||
'square',
|
||||
{ canvas, key: 'conf:square' },
|
||||
AUSTIN.lon + 0.002,
|
||||
];
|
||||
}
|
||||
set.set(
|
||||
Object.entries(slots).map(([id, [slot, , lon]]) => ({
|
||||
id,
|
||||
pos: at(lon),
|
||||
image: { atlas: 'conf:atlas', slot },
|
||||
size: [24, 24],
|
||||
})),
|
||||
);
|
||||
await drawn(h, r);
|
||||
r.draw.atlas(
|
||||
'conf:atlas',
|
||||
Object.fromEntries(
|
||||
Object.values(slots).map(([slot, image]) => [slot, image]),
|
||||
),
|
||||
);
|
||||
await drawn(h, r);
|
||||
await settled(r);
|
||||
for (const [id, [, , lon]] of Object.entries(slots)) {
|
||||
const s = r.query.project(at(lon));
|
||||
ok(s, `${id} projects`);
|
||||
equal(r.query.pick(s.x, s.y)?.id, id, `${id} slot drawn and picked`);
|
||||
}
|
||||
set.dispose();
|
||||
},
|
||||
),
|
||||
check(
|
||||
'draw.columns',
|
||||
'column updates are rows: sized, picked, removed',
|
||||
|
||||
Reference in new issue
Block a user