mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
refactor(sky): cut what the sky does not need
- qa-anime-sky keeps only the Milky Way case; the satellites and keyless cases checked an anime shader this branch no longer changes. - Drop qa-sky-sun-moon.mjs: the viewer-options unit test covers it. - VisualEffects sets the sky's visibility directly: the viewer always carries a StarrySky and never outlives the effects. - Drop the unused star intensity knob, the malformed-row tolerance for our own pack, the test-only Transforms parameter and a private-name test. - DATA_SOURCES points to sky/README.md instead of repeating it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d94cc35c81
commit
b00c7c12c8
10 files changed
+131
-515
No files matched your search
+3
-12
@@ -116,11 +116,8 @@ export class VisualEffects {
|
||||
// a post-process cannot tell the sky from far geometry reliably (near
|
||||
// plane clamps, keyless terrain above the ellipsoid horizon): fade the
|
||||
// glow out with the style instead. Bright stars survive as banded points.
|
||||
if (stage === this.stages.anime) {
|
||||
const sky = this.viewer.scene?.skyBox;
|
||||
if (sky && 'milkyWayVisibility' in sky)
|
||||
sky.milkyWayVisibility = 1 - value;
|
||||
}
|
||||
if (stage === this.stages.anime)
|
||||
this.viewer.scene.skyBox.milkyWayVisibility = 1 - value;
|
||||
if (stage.enabled && stage.uniforms.time !== undefined)
|
||||
this.startAnimationLoop();
|
||||
this.requestRender('style-stage');
|
||||
@@ -228,7 +225,7 @@ export class VisualEffects {
|
||||
this.transitions.clear();
|
||||
}
|
||||
|
||||
/** Remove owned stages and restore the borrowed bloom stage and sky after callers release them. */
|
||||
/** Remove owned stages and restore the borrowed bloom stage after callers release it. */
|
||||
destroy() {
|
||||
if (this.destroyed) return;
|
||||
this.stop();
|
||||
@@ -240,11 +237,5 @@ export class VisualEffects {
|
||||
Object.assign(this.bloomStage.uniforms, this.previousBloom.uniforms);
|
||||
this.bloomStage.enabled = this.previousBloom.enabled;
|
||||
}
|
||||
// Anime may have faded the Milky Way out; a surviving viewer gets it back.
|
||||
const sky = this.viewer.scene.skyBox;
|
||||
if (sky && 'milkyWayVisibility' in sky) {
|
||||
sky.milkyWayVisibility = 1;
|
||||
this.requestRender('style-stage');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,9 @@ function fixture() {
|
||||
},
|
||||
};
|
||||
const effects = new VisualEffects({
|
||||
viewer: { scene: { postProcessStages: pipeline } },
|
||||
viewer: {
|
||||
scene: { postProcessStages: pipeline, skyBox: { milkyWayVisibility: 1 } },
|
||||
},
|
||||
requestRender: (reason) => requests.push(reason),
|
||||
holdRender: (reason) => holds.add(reason),
|
||||
releaseRender: (reason) => holds.delete(reason),
|
||||
@@ -174,32 +176,9 @@ test('the anime stage fades the Milky Way out with its own intensity', () => {
|
||||
f.effects.setStageIntensity(f.effects.stages.anime, 0);
|
||||
assert.equal(glow(), MILKY_WAY_INTENSITY);
|
||||
sky.destroy();
|
||||
// A sky box without the knob (Cesium's own) is left alone.
|
||||
const plain = {};
|
||||
f.effects.viewer.scene.skyBox = plain;
|
||||
f.effects.setStageIntensity(f.effects.stages.anime, 1);
|
||||
assert.deepEqual(plain, {});
|
||||
f.effects.destroy();
|
||||
});
|
||||
|
||||
test('destroying the effects gives a surviving viewer its Milky Way back', () => {
|
||||
const f = fixture();
|
||||
const sky = { milkyWayVisibility: 1 };
|
||||
f.effects.viewer.scene.skyBox = sky;
|
||||
f.effects.initStyles();
|
||||
f.effects.startTransition('anime', 0, 1);
|
||||
f.tick(250);
|
||||
f.effects.stop();
|
||||
const frozen = sky.milkyWayVisibility;
|
||||
assert.ok(
|
||||
frozen > 0 && frozen < 1,
|
||||
'stop keeps the stages, and the fade, as they are',
|
||||
);
|
||||
f.effects.destroy();
|
||||
assert.equal(sky.milkyWayVisibility, 1);
|
||||
assert.equal(f.requests.at(-1), 'style-stage');
|
||||
});
|
||||
|
||||
test('bloom retains its dead zone, normalized intensity and independent toggle', () => {
|
||||
const f = fixture();
|
||||
f.effects.initPostProcess();
|
||||
|
||||
Reference in new issue
Block a user