mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Pin how a horizon-culled draw set's lift stands in for the aircraft layers'
The aircraft layers lift a contact for the horizon test only when its fix is below 10 m; a horizon-culled set on the Cesium draw port lifts every row drawn below 12 m, and the contract has no per-row lift to say otherwise. The 10 m threshold is now named beside the cull height (iconSet's ICON_CULL_LIFT_BELOW_M, which the aircraft icon layer reads), with what the two rules share and where they part: they agree on every row the aircraft rule lifts and every row drawn at 12 m or more, and the port judges the rest higher (a contact between 10 and 12 m, or one drawn below its fix), so it never hides what the aircraft rule shows. No renderer change: a 10 m threshold in the port would change the ships and fires it already draws.
This commit is contained in:
1 parent
2cc226c1f9
commit
ef61be2b3b
3 files changed
+56
-4
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
ICON_CULL_LIFT,
|
||||
ICON_ROTATES,
|
||||
ICON_SHOWN,
|
||||
ICON_CULL_LIFT_BELOW_M,
|
||||
} from './iconSet.js';
|
||||
import {
|
||||
writeArcSegment,
|
||||
@@ -334,3 +335,40 @@ test('removing a row moves its switch, proxy and depth-test columns too', () =>
|
||||
assert.equal(set.pickProxyHeight(moved), 33);
|
||||
assert.equal(set.depthTestDistance(moved), 0);
|
||||
});
|
||||
|
||||
test('a horizon-culled draw set lifts what the aircraft layers lift, and lifts the rest no lower', () => {
|
||||
const set = createIconSet();
|
||||
const row = set.add('a');
|
||||
set.setFlag(row, ICON_CULL_LIFT, true);
|
||||
const heightOf = (p) => Cesium.Cartographic.fromCartesian(p).height;
|
||||
// The aircraft layers' rule, by fix height h for a row drawn at d.
|
||||
const aircraft = (h, d) =>
|
||||
h < ICON_CULL_LIFT_BELOW_M ? Math.max(d, ICON_CULL_HEIGHT_M) : d;
|
||||
for (const [h, d] of [
|
||||
[-31, -31],
|
||||
[5, 5],
|
||||
[9.99, 9.99],
|
||||
[12, 12],
|
||||
[400, 400],
|
||||
[9, 15],
|
||||
[20, 20],
|
||||
]) {
|
||||
const at = Cesium.Cartesian3.fromDegrees(-97.04, 32.9, d);
|
||||
const judged = heightOf(set.cullPoint(row, at));
|
||||
assert.ok(
|
||||
Math.abs(judged - aircraft(h, d)) < 1e-3,
|
||||
`${h}/${d} m: ${judged}`,
|
||||
);
|
||||
}
|
||||
// Unflagged by the aircraft rule, drawn below 12 m: judged higher, never lower.
|
||||
for (const [h, d] of [
|
||||
[10, 10],
|
||||
[11, 11],
|
||||
[20, 5],
|
||||
]) {
|
||||
const at = Cesium.Cartesian3.fromDegrees(4.1, 51.95, d);
|
||||
const judged = heightOf(set.cullPoint(row, at));
|
||||
assert.ok(Math.abs(judged - ICON_CULL_HEIGHT_M) < 1e-3, `${h}/${d} m`);
|
||||
assert.ok(judged > aircraft(h, d), 'judged higher');
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user