contrails: keep visible at night as dimmed moonlit streaks (42% of night ramp); city debug counter + pending-terrain log

This commit is contained in:
Richard Zink committed 2026-10-10 11:50:07 +02:00
1 parent a23cf85223
commit 26bd5bbc59
1 file changed
+11 -5
+11 -5
View File
@@ -2163,7 +2163,8 @@ function fetchSettlements() {
if (!fresh && cityGeo) return; // fully cached cycle - nothing changed
cityGeo = list.slice();
buildCityVBO(elevGl || (clouds3dState && clouds3dState.gl));
console.log('[clouds3d] settlements: ' + list.length + ' places -> ' + cityCount + ' lights');
console.log('[clouds3d] settlements: ' + list.length + ' places -> ' + cityCount + ' lights' +
(cityCount ? '' : ' (terrain pending)'));
});
}
@@ -2508,6 +2509,8 @@ function buildCityVBO(gl) {
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verts), gl.STATIC_DRAW);
cityVbo = vbo; cityCount = verts.length / 5;
// debug counter (also used by headless smoke tests)
window.__cityDbg = { places: cityGeo ? cityGeo.length : 0, lights: cityCount };
sanitizeCityAttribSlots(gl);
if (!cityProg) {
cityProg = makeProgram(gl, CITY_VERT_SRC, CITY_FRAG_SRC);
@@ -2850,8 +2853,9 @@ var planeV = null, planeVbo = null, planeProg = null, planeU = null, planeA = nu
// ground distance in 8 curve segments and swept into a ribbon
// (contrailWidthM wide). The fragment shader dissolves it into a cloud
// stripe: density patches along the length, wavy eroded edges (per-trail
// noise phase), alpha ramping up toward the head. Fades out with dayf
// (dark exhaust is invisible anyway).
// noise phase), alpha ramping up toward the head. By day the stripes are
// sun-lit white; by night they stay visible as dimmed moonlit streaks
// (reusing the car-lights night ramp), around 40 % strength.
var ctBuf = null, ctVbo = null, ctVerts = 0;
var ctProg = null, ctA = null, ctU = null;
@@ -3752,8 +3756,10 @@ window.clouds3dRender = function(target) {
// Only CONFIG.flights.contrailChance of the aircraft leave a
// persistent stripe (the ice-humidity window is not everywhere),
// and the stripe follows the curved leg: walked backwards from
// the aircraft in fixed steps.
if (dayf > 0.02) {
// the aircraft in fixed steps. Visible by day (sun-lit) AND by
// night as dimmed moonlit streaks.
var tvis = Math.max(dayf, carNight * 0.42);
if (tvis > 0.02) {
if (!ctBuf) ctBuf = new Float32Array(CT_MAX * CT_SEG * 6 * 7);
ctVerts = 0;
var _cs = { x: 0, z: 0, tx: 1, tz: 0 };