hex-world
    Preparing search index...

    Class SkyDome

    Gradient sky dome that closes the world: a zenith→horizon→ground ramp with a sun/moon glow and a night star field, plus the matching distance haze on the ground materials so the map edge dissolves into the same color the sky shows at the horizon.

    It is a sink, not a clock — feed it a DayNightState (directly, or by naming it as a DayNightCycle target) for time of day, and an overcast factor from a WeatherSystem for rain and snow, which flattens the gradient toward grey and puts out the sun and stars.

    The mesh rides the camera and never writes or tests depth, so its radius only has to stay inside the far plane — SkyDome.update rescales it to match whatever camera it is handed.

    const sky = new SkyDome({ materials: () => world.hazeMaterials() }).addTo(scene);
    // per frame:
    cycle.applyTo({ sunRig, terrainMaterial, sky });
    sky.setOvercast(weather.overcast);
    sky.update(camera, dt);
    Index

    Constructors

    Properties

    mesh: Mesh
    material: ShaderMaterial

    Accessors

    • get enabled(): boolean

      Whether the sky and its matching distance haze are drawn.

      Returns boolean

    • get overcast(): number

      Current overcast factor, 0 (clear) – 1 (solid grey).

      Returns number

    • get horizonColor(): Color

      The color the world dissolves into: the horizon band after biome tinting and overcast. Reused between calls — copy anything you keep.

      Returns Color

    Methods

    • Add the dome to a scene (or any Object3D). Returns this for chaining.

      Parameters

      • parent: Object3D

      Returns this

    • Show or hide the whole sky system — dome mesh and surface haze together.

      Parameters

      • enabled: boolean

      Returns void

    • Set the gradient directly — the standalone path for scenes without a day/night cycle. Unset fields keep their current value.

      Parameters

      • colors: { zenith?: ColorRepresentation; horizon?: ColorRepresentation }

      Returns void

    • Re-point the biome haze tint the horizon band leans toward (null clears it) — call after swapping the terrain palette, since a new palette means a new average. See averageTerrainColor.

      Parameters

      • tint: ColorRepresentation | null

      Returns void

    • Point the sun/moon glow. dirTowardLight points from the scene toward the luminary; the glow fades out as it sinks below the horizon.

      Parameters

      • dirTowardLight: Vector3
      • Optionalcolor: Color
      • night: boolean = false

      Returns void

    • Adopt one moment of a DayNightCycle: gradient colors, the active luminary's direction and color, and the star fade. Named as the cycle's sky target this is called for you every frame.

      Parameters

      Returns void

    • How overcast the sky reads, 0–1 — a WeatherSystem's overcast. Flattens the gradient toward grey, dims the horizon haze to match, and puts out the sun disc and the stars, so rain and snow stop happening under a clear blue sky.

      Parameters

      • overcast: number

      Returns void

    • Re-push the haze onto the current material list — call after swapping terrain or liquid materials (HexWorld does this for you).

      Returns void

    • Ride the camera and advance the twinkle. dt may be omitted for a static star field. Call once per frame, before rendering.

      Parameters

      • camera: Camera
      • dt: number = 0

      Returns void

    • Detach the dome, free its geometry/material, and switch the surface haze back off.

      Returns void