mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Give the Cesium renderer the contract's credits port
The shared Cesium ports gain credits, on both the conformance renderer and the application's. list() reports what Cesium owes as plain data: its logo, its static credits and the last drawn frame's imagery, terrain and tile credits, read from the credit display through internals.js, with the credits the app adds listed as given where the display shows them. addStatic shows a credit through Cesium's display, as markup built from the plain data with every value escaped and only web links kept, so attribution stays on screen. change fires when the app adds or removes a credit, and after a drawn frame whose Cesium credits differ from the last one's. src/render/creditMarkup.js reads markup credits as plain data. The credits listener check moves out of renderer.listenerRules into its own check, so a renderer without every port can run it; it and the credits check now run on Cesium.
This commit is contained in:
1 parent
28b5de7196
commit
979e2213b9
13 files changed
+803
-15
No files matched your search
@@ -179,3 +179,26 @@ export function updateCameraChanged(camera) {
|
||||
export function billboardLoadError(billboard) {
|
||||
return billboard.loadError;
|
||||
}
|
||||
|
||||
const NO_CREDITS = Object.freeze([]);
|
||||
|
||||
/**
|
||||
* What a credit display shows, for the credits port to report: its static
|
||||
* credits, the credit elements of the frame under way or last drawn (each
|
||||
* `{credit, count}`, a static one counted `Number.MAX_VALUE`) and the logo
|
||||
* credit it shows first. Cesium's public API only adds and removes static
|
||||
* credits; the per-frame ones (imagery, terrain and tile credits) are seen
|
||||
* nowhere else.
|
||||
* @param {object} display Cesium CreditDisplay.
|
||||
* @returns {{statics: object[], screen: object[], lightbox: object[],
|
||||
* logo: object|undefined}}
|
||||
*/
|
||||
export function creditDisplayContents(display) {
|
||||
const frame = display?._currentFrameCredits;
|
||||
return {
|
||||
statics: display?._staticCredits ?? NO_CREDITS,
|
||||
screen: frame?.screenCredits?.values ?? NO_CREDITS,
|
||||
lightbox: frame?.lightboxCredits?.values ?? NO_CREDITS,
|
||||
logo: display?._currentCesiumCredit,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user