import type * as THREE from "three"; import type { ThreeParts } from "../realistic/textures.ts"; import type { MeteorShower } from "../data/meteor-showers.ts"; type Three = ThreeParts; type Vec3 = [number, number, number]; /** * The most streaks alive at once: the size of the one mesh they are drawn as. * * @example * ```ts * import { METEOR_SLOTS } from "@johnmorrisdotca/chikyu-earth/meteors"; * * console.log(METEOR_SLOTS); // 48 * ``` */ export declare const METEOR_SLOTS = 48; /** * The most streaks drawn in a second, however strong the shower. * * @example * ```ts * import { METEORS_PER_SECOND_MAX } from "@johnmorrisdotca/chikyu-earth/meteors"; * * console.log(METEORS_PER_SECOND_MAX); // 9 * ``` */ export declare const METEORS_PER_SECOND_MAX = 9; /** The meteors' part of the Earth's model: what the element sets, and what the layer wrote at its last step. */ export interface MeteorState { on: boolean; /** Whether new streaks may start now (the clock runs, the page is in view, and a reader who asked for less motion has pressed Play). */ running: () => boolean; /** Told when the strongest active shower changes, with `null` when none is active. */ onShower?: (shower: MeteorShower | null, zhr: number) => void; /** How strongly the streaks are drawn, 0 to 1 (`meteors-strength`): it scales how many start and how bright they are, and nothing that is real. 0 draws none. */ strength: number; random: () => number; drawn: { alive: number; spawned: number; perSecond: number; shower: string | null; zhr: number; }; } export declare const newMeteorState: () => MeteorState; /** What the layer needs at each step. The vectors are in the Earth's own axes (see `placeVector`). */ export interface MeteorStep { /** The page's clock, in milliseconds (`performance.now()`). */ now: number; /** The moment shown, in milliseconds since the epoch. */ time: number; /** The place at the middle of the view. */ facing: Vec3; /** The place the Sun is overhead. */ sun: Vec3; /** The Earth's radius on the screen, in CSS pixels. */ radius: number; width: number; height: number; } export interface MeteorLayer { /** Put the streaks right for now; returns the milliseconds until the next draw is wanted, or `Infinity` when nothing is moving and nothing is due. */ step(input: MeteorStep): number; dispose(): void; } /** * How many streaks a second are drawn for a mean hourly rate over the dark part of the view: 2.5 a second where the whole view is dark on a * night with no shower, more with a shower but squeezed (the 0.6th power) and never over nine, none where nothing in view is dark. * A streak stands for a great many meteors: the count follows the real rate, it does not equal it. * `strength` (0 to 1, the page's `meteors-strength`) then scales the count: half the streaks at 0.5, none at 0. * * @param meanHourlyRate - The mean over the view of each place's hourly rate times how dark it is there (`hourlyRateAt`, `darkness`). * @param strength - How strongly the streaks are drawn, from 0 to 1 (1 when left out); a number outside the range is brought to its nearest end. * @returns Streaks a second. * * @example * ```ts * import { streaksPerSecond } from "@johnmorrisdotca/chikyu-earth/meteors"; * * console.log(streaksPerSecond(8), streaksPerSecond(0), streaksPerSecond(100000), streaksPerSecond(8, 0.5)); // 2.5 0 9 1.25 * ``` */ export declare function streaksPerSecond(meanHourlyRate: number, strength?: number): number; /** * Where one streak runs: from `start` to `end`, in Earth radii from the centre, in the Earth's own axes. * It ends `METEOR_HEIGHT_KM.bottom + 5` km up and comes down the line from the radiant; its true length is the drop in height * divided by the sine of the radiant's height, at most 260 km, and `stretch` (1 or more) lengthens it for the eye. * * @param place - The unit vector of the place it ends over. * @param radiant - The unit vector towards the radiant (it must stand above that place's horizon). * @param stretch - How many times longer than true to draw it; 1 is true. * @returns The two ends, and the true length in kilometres. * * @example * ```ts * import { placeVector, streakPath } from "@johnmorrisdotca/chikyu-earth/meteors"; * * const place = placeVector({ lon: 0, lat: 0 }); * // Straight down from overhead: it falls 25 km, from 110 km up to 85 km. * const path = streakPath(place, place, 1); * console.log(path.km.toFixed(0), ((Math.hypot(...path.start) - 1) * 6371).toFixed(0)); // "25" "110" * ``` */ export declare function streakPath(place: readonly [number, number, number], radiant: readonly [number, number, number], stretch?: number): { start: Vec3; end: Vec3; km: number; }; /** Make the layer inside `parent`, an object that turns with the Earth and has the Earth's own axes and a radius of 1 (a group, or the Earth's own mesh). Nothing is drawn until `step` starts a streak. */ export declare function createMeteorLayer(three: Three, parent: THREE.Object3D, state: MeteorState): MeteorLayer; export {};