docs: add render diagrams and complete config examples
This commit is contained in:
1 parent
b9a77fbaa4
commit
d5fb1f12c4
3 files changed
+246
-139
No files matched your search
Vendored
+10
-95
@@ -2783,7 +2783,6 @@ var RAYLEIGH = [0.192, 0.451, 1.0];
|
||||
var ATMO_AIR_GAIN = (typeof ATMO.airGain === 'number') ? Math.max(0.05, ATMO.airGain) : 0.55;
|
||||
var ATMO_HAZE_RESIDUAL = (typeof ATMO.hazeResidual === 'number')
|
||||
? Math.max(0.02, Math.min(0.95, ATMO.hazeResidual)) : 0.30;
|
||||
var ATMO_DISTANCE_FOG = ATMO.distanceFog !== false;
|
||||
var ATMO_MODEL = ATMO.model || {};
|
||||
var HAZE_CFG = ATMO.haze || {};
|
||||
var ATMO_MODEL_ON = (typeof HAZE_CFG.enabled === 'boolean')
|
||||
@@ -5416,9 +5415,6 @@ var planeV = null, planeVbo = null, planeProg = null, planeU = null, planeA = nu
|
||||
// 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;
|
||||
|
||||
var CT2_SEG = 18;
|
||||
var ct2Buf = null, ct2Vbo = null, ct2Verts = 0;
|
||||
var ct2Prog = null, ct2A = null, ct2U = null;
|
||||
@@ -5518,95 +5514,6 @@ var CT2_FRAG_SRC = [
|
||||
'}'
|
||||
].join('\n');
|
||||
|
||||
function _ctVert(x, y, z, u, v, s, p) {
|
||||
var i = ctVerts * 7;
|
||||
ctBuf[i] = x; ctBuf[i + 1] = y; ctBuf[i + 2] = z;
|
||||
ctBuf[i + 3] = u; ctBuf[i + 4] = v; ctBuf[i + 5] = s; ctBuf[i + 6] = p;
|
||||
ctVerts++;
|
||||
}
|
||||
|
||||
var CT_VERT_SRC = [
|
||||
'attribute vec3 aPos;',
|
||||
'attribute float aU;', // 0 tail .. 1 head
|
||||
'attribute float aV;', // -1 .. +1 across the ribbon
|
||||
'attribute float aS;', // per-trail strength (gate x day x fade)',
|
||||
'attribute float aP;', // per-trail noise phase
|
||||
'uniform mat4 uProj;',
|
||||
'uniform mat4 uView;',
|
||||
'uniform vec3 uCamPos;',
|
||||
'uniform float uEarthRadius;',
|
||||
'uniform float uCurvatureOn;',
|
||||
'varying float vU;',
|
||||
'varying float vV;',
|
||||
'varying float vS;',
|
||||
'varying float vP;',
|
||||
'varying vec3 vWorld;',
|
||||
'void main() {',
|
||||
'vU = aU; vV = aV; vS = aS; vP = aP;',
|
||||
'vec3 pos = aPos;',
|
||||
'if (uCurvatureOn > 0.5) {',
|
||||
'vec2 d = pos.xz - uCamPos.xz;',
|
||||
'pos.y -= dot(d, d) / (2.0 * max(1.0, uEarthRadius));',
|
||||
'}',
|
||||
'vWorld = pos;',
|
||||
'gl_Position = uProj * uView * vec4(pos, 1.0);',
|
||||
'}'
|
||||
].join('\n');
|
||||
|
||||
var CT_FRAG_SRC = [
|
||||
'precision mediump float;',
|
||||
'uniform vec3 uSunColor;',
|
||||
'uniform float uSunInt;',
|
||||
'uniform vec3 uMoonColor;',
|
||||
'uniform float uMoonInt;',
|
||||
'uniform float uSkyAmb;',
|
||||
'uniform float uStarAmb;',
|
||||
'uniform float uNightBoost;', // extra gain on the moon/star terms
|
||||
'uniform vec3 uSunDir;',
|
||||
'uniform vec3 uCamPos;',
|
||||
'varying float vU;',
|
||||
'varying float vV;',
|
||||
'varying float vS;',
|
||||
'varying float vP;',
|
||||
'varying vec3 vWorld;',
|
||||
'void main() {',
|
||||
// Procedural mip: a contrail far away is a handful of pixels wide, so
|
||||
// its along-stripe density and its edge wobble are higher frequency
|
||||
// than the pixel grid can carry - that is the shimmer. Both fade to
|
||||
// their mean with distance, which leaves a steady faint stripe.
|
||||
'float cDist = length(vWorld - uCamPos);',
|
||||
'float cSoft = smoothstep(9.0, 22.0, cDist);',
|
||||
// density patches drifting along the stripe
|
||||
'float along = vU * 26.0 + vP * 31.0;',
|
||||
'float dens = 0.62 + 0.38 * sin(along) * sin(along * 2.7 + 1.3);',
|
||||
'dens = mix(dens, 0.62, cSoft);',
|
||||
'if (dens < 0.0) dens = 0.0;',
|
||||
// eroded, uneven edges: the stripe narrows and widens along u
|
||||
'float wob = 0.55 + 0.45 * (0.5 + 0.5 * sin(along * 3.1 + 7.0));',
|
||||
'wob = mix(wob, 0.78, cSoft);',
|
||||
'float side = abs(vV);',
|
||||
'float edge = 1.0 - smoothstep(wob * 0.22, wob, side);',
|
||||
// older tail also thins out across its width
|
||||
'edge *= 0.45 + 0.55 * pow(vU, 0.6);',
|
||||
'if (edge <= 0.0) discard;',
|
||||
'float a = vS * pow(vU, 1.15) * 1.15 * dens * edge;',
|
||||
'if (a <= 0.004) discard;',
|
||||
// A contrail is a cloud: sunlit head-on, moonlit at night, and on a
|
||||
// dark starlit night the diffuse starlight keeps it faintly visible
|
||||
// instead of a hard white stripe on black.
|
||||
'vec3 vd = normalize(vWorld - uCamPos);',
|
||||
'float cosT = dot(vd, -uSunDir);',
|
||||
'float phase = 0.35 + 0.65 * pow(max(0.0, cosT), 2.0);',
|
||||
// Same multipliers as the cloud deck, so the contrail/cloud
|
||||
// brightness ratio at night is the same as in daylight.
|
||||
'vec3 light = uSunColor * uSunInt * phase * 1.25',
|
||||
' + (uMoonColor * uMoonInt * 3.0',
|
||||
' + max(vec3(uSkyAmb), uStarAmb * vec3(0.75, 0.85, 1.0)) * 1.7)',
|
||||
' * uNightBoost;',
|
||||
'gl_FragColor = vec4(vec3(0.95, 0.96, 1.0) * light, a);',
|
||||
'}'
|
||||
].join('\n');
|
||||
|
||||
function decodePlaneVerts() {
|
||||
if (planeV || !window.__planeVerts) return;
|
||||
try {
|
||||
@@ -5672,6 +5579,12 @@ function planetHeliocentric(p, d) {
|
||||
var z = r * Math.sin(u) * Math.sin(i);
|
||||
return [x, y, z];
|
||||
}
|
||||
var PLANET_CFG = (window.CONFIG && window.CONFIG.planets) || {};
|
||||
var PLANETS_ON = PLANET_CFG.enabled !== false;
|
||||
var PLANET_BRIGHT = (typeof PLANET_CFG.brightness === 'number') ? Math.max(0, PLANET_CFG.brightness) : 1.0;
|
||||
var PLANET_SIZE_SCALE = (typeof PLANET_CFG.sizeScale === 'number') ? Math.max(0.2, Math.min(2.0, PLANET_CFG.sizeScale)) : 1.0;
|
||||
var PLANET_SHOW_PLUTO = PLANET_CFG.showPluto !== false;
|
||||
|
||||
function updatePlanetPoints(gl, date) {
|
||||
if (!gl || !date) return;
|
||||
var d = (date.getTime() - Date.UTC(2000, 0, 1, 12, 0, 0)) / 86400000;
|
||||
@@ -5683,6 +5596,8 @@ function updatePlanetPoints(gl, date) {
|
||||
var ceps = Math.cos(eps), seps = Math.sin(eps);
|
||||
for (var pi = 0; pi < PLANET_ELEMENTS.length; pi++) {
|
||||
var p = PLANET_ELEMENTS[pi];
|
||||
if (!PLANETS_ON) continue;
|
||||
if (!PLANET_SHOW_PLUTO && p.name === 'Pluto') continue;
|
||||
var helio = planetHeliocentric(p, d);
|
||||
var gx = helio[0] - earth[0];
|
||||
var gy = helio[1] - earth[1];
|
||||
@@ -5708,9 +5623,9 @@ function updatePlanetPoints(gl, date) {
|
||||
mag = mag + 5 * Math.log10(Math.max(1e-6, rGeo * rSun));
|
||||
mag = Math.max(-5.0, Math.min(16.0, mag));
|
||||
var bright = p.bright * Math.max(0.12, Math.min(1.25, Math.pow(2.512, -mag * 0.35)));
|
||||
data[di++] = dx; data[di++] = dy; data[di++] = dz; data[di++] = p.sizeCode;
|
||||
data[di++] = dx; data[di++] = dy; data[di++] = dz; data[di++] = p.sizeCode * PLANET_SIZE_SCALE;
|
||||
data[di++] = p.color[0]; data[di++] = p.color[1]; data[di++] = p.color[2];
|
||||
data[di++] = bright;
|
||||
data[di++] = bright * PLANET_BRIGHT;
|
||||
count++;
|
||||
}
|
||||
if (!planetVbo) planetVbo = gl.createBuffer();
|
||||
|
||||
Reference in new issue
Block a user