mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
ac081a008d
commit
bb8c0b83c4
17 files changed
+521
-16
No files matched your search
@@ -160,6 +160,16 @@
|
||||
* Owns whatever the engine needs to render every frame or only on request
|
||||
* (Cesium: requestRenderMode and maximumRenderTimeChange = Infinity).
|
||||
* @property {() => boolean} isContinuous
|
||||
* @property {(options: { enabled?: boolean, amount?: number }) => void} setSharpen
|
||||
* An unsharp mask on the final image, after tone mapping and before
|
||||
* anti-aliasing: each pixel moves away from its 3×3 box blur by `amount`
|
||||
* (the maths of the app's Cesium sharpen stage, whose `amount` uniform the
|
||||
* Sharpen slider sets in 0.1..2.1). Omitted fields keep their value; a
|
||||
* non-boolean `enabled` or a negative or non-finite `amount` throws a
|
||||
* TypeError. Off with amount 1 until set. The Cesium engine only keeps the
|
||||
* state: in Cesium mode the app's own post stage sharpens.
|
||||
* @property {() => { enabled: boolean, amount: number }} sharpen
|
||||
* The sharpening last set (a copy).
|
||||
*
|
||||
* @typedef {object} PickResult
|
||||
* @property {any} id The picked entity or object id; undefined for map tiles.
|
||||
@@ -382,6 +392,8 @@ const SHAPE = {
|
||||
request: isFunction,
|
||||
setContinuous: isFunction,
|
||||
isContinuous: isFunction,
|
||||
setSharpen: isFunction,
|
||||
sharpen: isFunction,
|
||||
},
|
||||
surface: {
|
||||
sampleHeight: isFunction,
|
||||
@@ -448,3 +460,23 @@ export function assertGlobeEngine(engine) {
|
||||
);
|
||||
return engine;
|
||||
}
|
||||
|
||||
/** The sharpening an engine starts with (GlobeRender.sharpen). */
|
||||
export const SHARPEN_INITIAL = Object.freeze({ enabled: false, amount: 1 });
|
||||
|
||||
/**
|
||||
* GlobeRender.setSharpen's argument merged onto `current`: a new state, or a
|
||||
* TypeError for a non-boolean `enabled` or a negative or non-finite `amount`.
|
||||
*/
|
||||
export function mergeSharpen(current, { enabled, amount } = {}) {
|
||||
if (enabled !== undefined && !isBoolean(enabled))
|
||||
throw new TypeError(`Sharpen enabled must be a boolean: ${enabled}`);
|
||||
if (amount !== undefined && !(isNumber(amount) && amount >= 0))
|
||||
throw new TypeError(
|
||||
`Sharpen amount must be a finite number >= 0: ${amount}`,
|
||||
);
|
||||
return {
|
||||
enabled: enabled ?? current.enabled,
|
||||
amount: amount ?? current.amount,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user