mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Tidy the vessels layer on the draw port: shared pose key, lazy pose, frame reasons, sprite order
The camera pose key moves to render/camera/poseSignature.js, Cesium-free, and iconOrientation's cameraPoseSignature builds the same key through it. The vessels frame hook reads the pose only when a pass runs or a moved camera could still need its trailing pass, and the unused focus scratch point goes. The draw port takes the frame port's requestRender, so a GPU icon set's own frames (its images packed into the atlas) are asked for under the reason icons:<set id> in the frame diagnostics, where the vessels layer's own ais-vessels-icons reason used to be. Other draw requests are unchanged. A host with no registerSpriteSet still draws the ships and warns once. The vessels draw test now checks the sprite order finds the set's host, and that a torn-down layer draws a new set registered in the old one's place. The new motion, icon book and pose key tests join the format check.
This commit is contained in:
1 parent
7a9c7b4d96
commit
1c8cf240c4
14 files changed
+334
-76
No files matched your search
@@ -833,3 +833,36 @@ test('the atlas holds more than 64 images, every one addressed on WebGL 2', asyn
|
||||
);
|
||||
assert.equal(slots.size, 70, 'each its own slot');
|
||||
});
|
||||
|
||||
test('a GPU icon set asks the frame port for its atlas frames, under its own reason', async () => {
|
||||
const { iconAtlas } = await import('../../data/iconAtlas.js');
|
||||
const onChange = iconAtlas.onChange;
|
||||
const heard = [];
|
||||
iconAtlas.onChange = (listener) => (heard.push(listener), () => {});
|
||||
try {
|
||||
const reasons = [];
|
||||
const { scene, draw } = drawOver({
|
||||
requestRender: (reason) => reasons.push(reason),
|
||||
});
|
||||
const set = draw.icons({ id: 'gpu:reason' });
|
||||
set.set([icon('a', { motion: { kind: 'hold' } })]);
|
||||
assert.equal(heard.length, 1, 'its host listens for packed images');
|
||||
const before = scene.renders;
|
||||
heard[0]();
|
||||
assert.deepEqual(reasons, ['icons:gpu:reason']);
|
||||
assert.equal(scene.renders, before, 'through the frame port only');
|
||||
set.dispose();
|
||||
|
||||
// With no frame port, the scene's own request, as before.
|
||||
const bare = drawOver();
|
||||
const bareSet = bare.draw.icons({ id: 'gpu:bare' });
|
||||
bareSet.set([icon('a', { motion: { kind: 'hold' } })]);
|
||||
assert.equal(heard.length, 2);
|
||||
const was = bare.scene.renders;
|
||||
heard[1]();
|
||||
assert.equal(bare.scene.renders, was + 1);
|
||||
bareSet.dispose();
|
||||
} finally {
|
||||
iconAtlas.onChange = onChange;
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user