/** * The air's own top, in Earth radii: 100 km of the Earth's 6,371. The element leaves `ATMOSPHERE_OUTER` of room for it, so it is never cut at the box's edge. * * @example * ```ts * import { AIR_TOP } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(((AIR_TOP - 1) * 6371).toFixed(0), "km thick"); * ``` */ export declare const AIR_TOP: number; /** * How many times its real thickness the air is drawn when a page says nothing: 3. The air is a shell 100 km thick on a globe 12,742 km across, a hair's breadth, and at whole-Earth zoom it comes to a line a pixel or two wide (on a phone, thinner still); * three times is a ring the eye can find, with the same physics and the same colours. `1` is the true thickness. The page's `air-thickness` attribute chooses. * * @example * ```ts * import { AIR_THICKNESS_DEFAULT } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(AIR_THICKNESS_DEFAULT); * ``` */ export declare const AIR_THICKNESS_DEFAULT = 3; /** * The most the air may be thickened: 5, which is as far as the element's box leaves room for (its top is then 1.0785 Earth radii out, inside the 1.08 the box is fitted to). * * @example * ```ts * import { AIR_THICKNESS_MAX } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(AIR_THICKNESS_MAX); * ``` */ export declare const AIR_THICKNESS_MAX = 5; /** * What a page's `air-thickness` attribute means: a number from 1 (the true thickness) to 5, given as it is written; with none, or something that is not a number, `AIR_THICKNESS_DEFAULT`. A number outside the range is brought to its nearest end. * * @param given - The attribute's value, or `null` when the page has none. * @returns How many times its real thickness the air is drawn, between 1 and 5. * * @example * ```ts * import { readAirThickness } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(readAirThickness(null), readAirThickness("1"), readAirThickness("9")); * ``` */ export declare function readAirThickness(given: string | null): number; /** * Where the air's top is, in Earth radii, when it is drawn `thickness` times its real thickness: 1 plus 100 km times that, over the Earth's 6,371. * * @param thickness - 1 for the true thickness (the top is then `AIR_TOP`). * @returns The radius of the shell's outside, in Earth radii. * * @example * ```ts * import { airTop } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(airTop(3).toFixed(4)); * ``` */ export declare const airTop: (thickness: number) => number; /** * How many samples the air takes: along the ray toward the camera and, at each of those, along the ray toward the Sun. * * @example * ```ts * import { AIR_QUALITY, type AirSamples } from "@johnmorrisdotca/chikyu-earth/realistic"; * const light: AirSamples = AIR_QUALITY.light; * console.log(light.view, light.light); * ``` */ export interface AirSamples { view: number; light: number; } /** * The two costs of the air. `full` takes 12 samples along the ray toward the camera and 4 toward the Sun at each; `light` (a small or slow device) takes 6 and 2. * Both put their samples where the air is thick (close to the ground, or at the nearest point of a ray that skims it), not evenly, so even the light one has no bands. * * @example * ```ts * import { AIR_QUALITY } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(AIR_QUALITY.full); * ``` */ export declare const AIR_QUALITY: Record<"full" | "light", AirSamples>; /** * How much the air costs for a page: what its `air` attribute says (`full` or `light`), else `light` on a small or slow device (4 cores or fewer, 4 GB of memory or less, or a touch screen with no mouse) and `full` on the rest. * * @param given - The page's `air` attribute, or `null` when it has none. * @returns `full` or `light`. * * @example * ```ts * import { airFor } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(airFor("light")); * ``` */ export declare function airFor(given: string | null): "full" | "light"; /** * The air's program: where the shell is, in the world's own axes (the Earth sits at the origin and does not turn here, the view turns round it). * * @example * ```ts * import { AIR_VERT } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(AIR_VERT.includes("vWorld")); * ``` */ export declare const AIR_VERT = "\nvarying vec3 vWorld;\nvoid main() {\n vWorld = (modelMatrix * vec4(position, 1.0)).xyz;\n gl_Position = projectionMatrix * viewMatrix * vec4(vWorld, 1.0);\n}"; /** * The air as light scattered once, worked out for each pixel: a ray from the camera through the shell, sampled `view` times, each sample looking `light` times toward the Sun. * Rayleigh scattering (the air's own molecules: thicker the longer the path, and bluer) and Mie scattering (haze and dust: a bright halo round the Sun's direction), with the * scale heights and coefficients of the standard sea-level air (Rayleigh 8 km, Mie 1.2 km; the Mie coefficient is that of very clear air, 0.4 of the usual, so the haze stays blue). What the sums give, and nothing drawn: the blue haze thickening toward the limb on the day side, * the glow toward the Sun, the reddening along the day and night line (the Sun's light has crossed a long, low path) and the thin lit ring seen from the night side looking toward the Sun. * The surface under it is dimmed by what the air takes out of the light (the shader's alpha is what gets through) and what it adds is the colour. * Our own code, from the published single-scattering model (Nishita and others, 1993; O'Neil, GPU Gems 2, chapter 16), no code taken from any project. * The air can be drawn thicker than it is (`thick`, a uniform: 1 is the true 100 km, 3 the default of the elements): the shell and both scale heights grow by it and what each unit of length holds shrinks by it, so the same air gives the same colours over a wider glow. * The Sun is in the world's axes (`sunDir`, toward the Sun); `ortho` is 1 when the camera looks down the z axis from far away (the realistic Earth) and 0 for a camera at a place (the space view). * * @param samples - How many samples to take (`AIR_QUALITY.full` or `AIR_QUALITY.light`). * @returns The fragment program's source, for a `ShaderMaterial`. * * @example * ```ts * import { airFrag, AIR_QUALITY } from "@johnmorrisdotca/chikyu-earth/realistic"; * console.log(airFrag(AIR_QUALITY.light).includes("N_VIEW 6")); * ``` */ export declare const airFrag: (samples: AirSamples) => string;