Every Cesium draw set takes columns

Sets other than icons take setColumns as the rows the columns make over
the items they hold, replacing every item as set does, as the stub does,
so renderer.shape holds on Cesium and joins its checks.
This commit is contained in:
Sameh Khamis committed 2026-11-11 17:08:09 -08:00
1 parent a356d094d5
commit 6ec4d5571d
4 files changed
+69

No files matched your search

+6
View File
@@ -204,6 +204,12 @@ names the nearest frame's time once every globe tile drawn shows that
frame's own imagery (`src/render/cesium/imageryFrames.js`). The checks
`globe.imagery.frames` and `globe.imagery.video` cover both.
Every Cesium draw set takes `setColumns` (`columns`): icon sets on the GPU,
any other as the rows the columns make over the items it holds, each row the
item of that id with the columns' fields over it, replacing every item as
`set` does (`columnRows` in `src/render/cesium/draw.js`, as the stub does).
`renderer.shape` holds on Cesium.
The Cesium port also draws `pattern` line styles (the image repeated
`repeat` times along the line, in the translucent pass; draped too), lines in the
`inertial` frame (turned each frame by the set's motion clock, a depth-fail
+35
View File
@@ -128,6 +128,38 @@ const displayConditionOf = (range) =>
? new Cesium.DistanceDisplayCondition(range[0], range[1])
: undefined;
/**
* `columns` on a set drawn from items: column `i` is row `ids[i]`, the item
* of that id the set holds with the columns' fields over it (`pos`,
* `course`, `show`, `scale`, `alpha`, `color` as 0..1, `meta`). Rows not
* named are gone, as `set` replaces every item.
* @param {import('../contract/draw').Columns} columns
* @param {Map<string, object>} items
*/
export function columnRows(columns, items) {
const {
positions: p,
courses,
shown,
scales,
alphas,
colors,
meta,
} = columns;
return columns.ids.map((id, i) => {
const key = String(id);
const row = { ...(items.get(key) ?? { id: key }) };
if (p) row.pos = { x: p[i * 3], y: p[i * 3 + 1], z: p[i * 3 + 2] };
if (courses) row.course = courses[i];
if (shown) row.show = shown[i] !== 0;
if (scales) row.scale = scales[i];
if (alphas) row.alpha = alphas[i];
if (colors) row.color = [0, 1, 2, 3].map((k) => colors[i * 4 + k] / 255);
if (meta) row.meta = meta[i];
return row;
});
}
/**
* Cesium's point blending for a set's `blend`: additive ones are built
* translucent, a command a set, and added where they draw (`setBlend.js`).
@@ -634,6 +666,9 @@ export function createCesiumDraw({
record.gpu.columns(columns);
patched();
};
// Any other set takes columns as the rows they make, replacing its items.
else if (capabilities.has('columns'))
handle.setColumns = (columns) => handle.set(columnRows(columns, items));
sets.set(spec.id, record);
setsVersion += 1;
return handle;
+27
View File
@@ -8027,3 +8027,30 @@ test('a clustered icon set draws one icon a cluster in place of its members, mad
transforms.worldToWindowCoordinates = project;
}
});
test('a points set takes columns as rows, over the items it holds', () => {
const { scene, draw } = drawOver();
const set = draw.points({ id: 'column-dots' });
set.set([
{ id: 'a', pos: { lon: 0, lat: 0 }, pixelSize: 4, color: '#fff' },
{ id: 'gone', pos: { lon: 1, lat: 0 }, pixelSize: 4, color: '#fff' },
]);
const at = Cesium.Cartesian3.fromDegrees(10, 20);
set.setColumns({
ids: ['a'],
positions: new Float64Array([at.x, at.y, at.z]),
colors: new Uint8Array([255, 0, 0, 255]),
shown: new Uint8Array([1]),
meta: [{ m: 1 }],
});
assert.equal(set.size(), 1, 'rows not named are gone');
const point = scene.added[0].get(0);
assert.ok(Cesium.Cartesian3.equalsEpsilon(point.position, at, 0, 1e-6));
assert.deepEqual(
[point.color.red, point.color.green, point.color.alpha],
[1, 0, 1],
);
assert.equal(point.pixelSize, 4, 'kept from the item');
assert.deepEqual(drawHitOf({ id: point.id })?.meta, { m: 1 });
set.dispose();
});
+1
View File
@@ -112,6 +112,7 @@ export const CESIUM_CHECKS = new Set([
'quality.signals',
'quality.signals.gpuTiming',
'renderer.listeners',
'renderer.shape',
'renderer.readPixels',
'renderer.releaseUnused',
'renderer.whenSettled',