threejs-worldgen
    Preparing search index...

    Seeded, time-driven weather over a world: weather systems that drift with the prevailing wind (advected noise), cloud cover, rain/sleet/snow from the world's temperature at altitude, wind with gusts and slow veering, humidity, fog, and thunderstorm cells with lightning. Climate-aware: deserts rarely rain, rainforests often do, mountains get snow.

    Everything is a pure function of the seed, the world, the position and the time, so you can scrub time backwards and forwards and always get the same weather. Positions are local frame coordinates (x east, z south) of frame (the world itself on a flat world).

    const weather = new Weather({ seed: 'storm', wind: { speed: 9 } }, world)
    const w = weather.at(120, -40, time) // { precipitation, type, windX, windZ, fog, … }
    weather.strikes(-5000, -5000, 5000, 5000, time - 1, time) // lightning in the last second
    Index
    frame: LocalFrame | null

    The frame positions are given in.

    Resolved settings. Change them with Weather.set / Weather.reset.

    version: number = 0

    Bumped on every change; caches compare it.

    world: World | null

    The world whose climate drives the weather, or null (then options.climate is used everywhere).

    • get prevailing(): [number, number]

      Unit vector the prevailing wind blows towards, [x, z].

      Returns [number, number]

    • Every lightning strike inside the box [minX, maxX] × [minZ, maxZ] (frame coordinates) with t0 <= time < t1, sorted by time. Deterministic: the same window always gives the same strikes, and splitting a window into pieces gives the same strikes as asking for it whole.

      Parameters

      • minX: number
      • minZ: number
      • maxX: number
      • maxZ: number
      • t0: number
      • t1: number
      • out: Strike[] = []

      Returns Strike[]