Make SetSpec.drawOrder exact and draw it in Cesium and the stub

Among sets that skip the depth test, a higher drawOrder draws over a lower
one whatever order they were made in, and picks name them topmost first.

Cesium draws the earlier of two opaque near-plane icons on top and picks
it, so the draw port stacks the sets' hosts with a higher order earlier,
ties in the order the sets were made. Hosts trade places only among the
slots draw-set hosts already hold, so no other primitive moves; nothing
moves while every set is at 0. Translucent items blend
order-independently in Cesium and are not ordered by it.

The stub sorts its hits the same way. A conformance check draws two icon
sets at one spot and swaps their orders.
This commit is contained in:
Sameh Khamis committed 2026-11-08 13:01:36 -08:00
1 parent 45302e9fbf
commit 8fe8b8e14d
6 files changed
+219 -3

No files matched your search

+58
View File
@@ -721,6 +721,64 @@ export function portChecks() {
stack.dispose();
},
),
check(
'draw.drawOrder',
'of sets drawn over depth, the higher draw order is on top and picked',
async (h, r) => {
await overAustin(h, r);
const pos = h.toEcef({ ...AUSTIN, height: 0 });
const icon = (id) => ({
id,
pos,
image: DOT,
size: [24, 24],
disableDepthTest: Infinity,
});
const first = r.draw.icons({ id: 'conf:order-first' });
// Made after it, but drawn over it.
const second = r.draw.icons({ id: 'conf:order-second', drawOrder: 2 });
first.set([icon('a')]);
second.set([icon('b')]);
await drawn(h, r);
await settled(r);
const s = r.query.project(pos);
ok(s, 'the icons project');
const sets = () =>
r.query
.drillPick(s.x, s.y)
.filter((x) => x.set.startsWith('conf:order-'))
.map((x) => x.set);
equal(r.query.pick(s.x, s.y)?.set, 'conf:order-second', 'the higher');
deepEqual(
sets(),
['conf:order-second', 'conf:order-first'],
'topmost first',
);
first.setOptions({ drawOrder: 3 });
await drawn(h, r);
equal(
r.query.pick(s.x, s.y)?.set,
'conf:order-first',
'raised, the pick flips',
);
deepEqual(
sets(),
['conf:order-first', 'conf:order-second'],
'and the drill',
);
// Of one order, they keep the order they were made in.
first.setOptions({ drawOrder: 0 });
second.setOptions({ drawOrder: 0 });
await drawn(h, r);
equal(
r.query.pick(s.x, s.y)?.set,
'conf:order-first',
'equal ones as they were made',
);
first.dispose();
second.dispose();
},
),
check(
'query.pickBeforeStyles',
'picks answer against the scene as drawn before styles',