SDK JS
    Preparing search index...

    The single immutable source of truth for the sun at one instant and place. Computed by computeSunState and fanned out by GeoSunSystem to MapLibre's light/sky/hillshade AND the WebGL2 renderers. Every representation a consumer might want is precomputed so nothing downstream re-derives angles (and so nobody trips on the SunCalc south-vs-north azimuth convention). Plain data — structured-clone / worker safe.

    Angles come in both radians and degrees; read the field name suffix carefully. Colours come as both a CSS #rrggbb string and a linear-RGB Vec3 for shader math.

    interface SunState {
        altitudeDeg: number;
        altitudeRad: number;
        ambientFloorLinear: Vec3;
        ambientIntensity: number;
        ambientLinear: Vec3;
        azimuthDeg: number;
        azimuthRad: number;
        color: string;
        colorLinear: Vec3;
        date: Date;
        directionEnu: Vec3;
        gradeLinear: Vec3;
        intensity: number;
        isDay: boolean;
        lat: number;
        lng: number;
        twilight: TwilightPhase;
    }
    Index

    Properties

    altitudeDeg: number

    Altitude above the horizon, degrees.

    altitudeRad: number

    Altitude above the horizon, radians.

    ambientFloorLinear: Vec3

    Minimum lighting multiplier (LINEAR RGB) so lit geometry never crushes to black at night — a dim cool floor (≈0 by day, rising after sunset). Consumer: mesh shader clamp.

    ambientIntensity: number

    Ambient fill scalar, 0..1 (never quite 0 — night keeps a faint fill).

    ambientLinear: Vec3

    Ambient/sky fill color in LINEAR RGB (0..1).

    azimuthDeg: number

    Compass azimuth: degrees from NORTH, clockwise (0=N, 90=E, 180=S, 270=W).

    azimuthRad: number

    SunCalc-raw azimuth: radians, 0 = south, +ve = west (clockwise). Internal trig.

    color: string

    Direct sun color as a CSS #rrggbb string.

    colorLinear: Vec3

    Direct sun color in LINEAR RGB (0..1) for shader math.

    date: Date

    The instant this was computed for (a Date, UTC for the solar math).

    directionEnu: Vec3

    Unit vector pointing TOWARD the sun, in tile-local ENU (x=east, y=north, z=up).

    gradeLinear: Vec3

    Environment day/night color grade (sRGB multiplier, (1,1,1) by day) for BAKED-lit surfaces that can't be relit directionally: textured photogrammetry mesh, point clouds, gaussian splats. Warms at golden hour, dims cool at night. Consumer: textured-mesh / point / splat shaders.

    intensity: number

    Direct-light intensity, 0..1 (0 below the horizon ramping up through twilight).

    isDay: boolean

    altitudeDeg > -0.833 (sun's upper limb at/above the horizon, with refraction).

    lat: number

    Scene reference latitude the position was evaluated at, degrees (−90..90).

    lng: number

    Scene reference longitude the position was evaluated at, degrees (−180..180).

    twilight: TwilightPhase

    Twilight band, for sky tinting and widget readouts.