mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Drive the Navara volumetric clouds from the cockpit weather behind an optional render.setCloudCover capability
The cockpit's weather feed moves out of the Cesium cloud pass and serves both: Cesium keeps its own cloud canvas, an engine with its own clouds takes their cover from the same observations, with no second WebGL canvas.
This commit is contained in:
1 parent
d8c63c69d8
commit
f0d38897f4
15 files changed
+1004
-79
No files matched your search
@@ -259,6 +259,16 @@
|
||||
* Cesium mode the app drives the scene's own bloom stage.
|
||||
* @property {() => { enabled: boolean, strength: number }} [bloom] The bloom
|
||||
* last set (a copy).
|
||||
* @property {(options: { coverage?: number | null }) => void} [setCloudCover]
|
||||
* Optional, with cloudCover (capability `cloudCover`): how much of the sky
|
||||
* the engine's own volumetric clouds cover, 0..1, or null for the
|
||||
* engine's own cover (its look). Where the clouds show (height, daylight)
|
||||
* stays the engine's. The cockpit drives it from the weather under the
|
||||
* camera (src/cockpitCloudEffects.js). A coverage outside 0..1 that is not
|
||||
* null throws a TypeError. Null until set. Cesium has none: in Cesium
|
||||
* mode the cockpit draws its own cloud pass.
|
||||
* @property {() => { coverage: number | null }} [cloudCover] The cover last
|
||||
* set (a copy).
|
||||
*
|
||||
* @typedef {{ intensity: number, uniforms: Record<string, number> }} StyleState
|
||||
*
|
||||
@@ -681,6 +691,10 @@ const OPTIONAL_SHAPE = {
|
||||
'render.setBloom': isFunction,
|
||||
'render.bloom': isFunction,
|
||||
},
|
||||
cloudCover: {
|
||||
'render.setCloudCover': isFunction,
|
||||
'render.cloudCover': isFunction,
|
||||
},
|
||||
};
|
||||
|
||||
/** The optional capability flags, e.g. 'visualStyles'. */
|
||||
@@ -843,3 +857,22 @@ export function mergeBloom(current, { enabled, strength } = {}) {
|
||||
strength: strength ?? current.strength,
|
||||
};
|
||||
}
|
||||
|
||||
/** The cloud cover an engine starts with (GlobeRender.cloudCover): its own. */
|
||||
export const CLOUD_COVER_INITIAL = Object.freeze({ coverage: null });
|
||||
|
||||
/**
|
||||
* GlobeRender.setCloudCover's argument merged onto `current`: a new state,
|
||||
* or a TypeError for a coverage that is neither null nor in 0..1.
|
||||
*/
|
||||
export function mergeCloudCover(current, { coverage } = {}) {
|
||||
if (
|
||||
coverage !== undefined &&
|
||||
coverage !== null &&
|
||||
!(isNumber(coverage) && coverage >= 0 && coverage <= 1)
|
||||
)
|
||||
throw new TypeError(
|
||||
`Cloud coverage must be null or a number in 0..1: ${coverage}`,
|
||||
);
|
||||
return { coverage: coverage === undefined ? current.coverage : coverage };
|
||||
}
|
||||
Reference in new issue
Block a user