feat(globe): Sharpen on Navara, on at 80 % by default

The contract gains render.setSharpen({ enabled, amount }) and
render.sharpen(). Navara draws it as a custom EffectDesc: Cesium's unsharp
mask (3x3 box blur, gamma 2.2 round trip so one amount matches Cesium)
right after tone mapping and before SMAA/FXAA, skipping sky and cloud
pixels by scene depth. The Cesium engine keeps the state only; Cesium mode
still sharpens with its own post stage, unchanged. The fake engine records
it and the contract suite checks it.

Without a viewer the Sharpen slider and toggle drive the engine with the
same slider-to-amount mapping. On Navara the defaults, presets and share
links read Cesium's 49 % as 80 %.
This commit is contained in:
German Khokhlov committed 2026-10-16 13:30:56 +04:00
1 parent ac081a008d
commit bb8c0b83c4
17 files changed
+521 -16

No files matched your search

+22
View File
@@ -5,9 +5,11 @@ import {
GLOBE_ENGINE_MEMBERS,
INPUT_TYPES,
MODIFIERS,
SHARPEN_INITIAL,
assertGlobeEngine,
createEngineEvent,
isEngineEvent,
mergeSharpen,
} from './contract.js';
import { createFakeEngine } from './testing/fakeEngine.js';
import {
@@ -292,3 +294,23 @@ test('raiseValue raises exactly one argument with the event semantics', () => {
assert.deepEqual(seen, [['first', [42]]]);
assert.equal(event.numberOfListeners, 1);
});
test('the contract carries the sharpening and checks its values', () => {
for (const member of ['render.setSharpen', 'render.sharpen'])
assert.ok(GLOBE_ENGINE_MEMBERS.includes(member), member);
assert.deepEqual(SHARPEN_INITIAL, { enabled: false, amount: 1 });
const on = mergeSharpen(SHARPEN_INITIAL, { enabled: true });
assert.deepEqual(on, { enabled: true, amount: 1 });
assert.deepEqual(mergeSharpen(on, { amount: 0 }), {
enabled: true,
amount: 0,
});
assert.deepEqual(mergeSharpen(on), on);
for (const bad of [
{ enabled: 1 },
{ amount: -1 },
{ amount: Infinity },
{ amount: null },
])
assert.throws(() => mergeSharpen(on, bad), TypeError);
});