Skip to content
Shapemetry

Types - DocumentEnvironment

API reference for ./model/environment on @huukhanhnguyen/types.

See the Guide for the package's role.

API reference

Signatures are generated from the live package .d.ts - not hand-written.

Environment

type

settings.environment — the surroundings the model is lit by. Every field optional: a document with no environment is lit by its own emitting objects and nothing else.

type Environment
// = {
    /** Where on Earth — the sun's first input. */
    site?: Site;
    /** Which moment — the sun's second input. Without both, there is no sun. */
    moment?: SunMoment;
    /** Direct-sun illuminance (lux) at the model. Absent = a bright clear
     *  midday (the host's documented default). */
    sunLux?: number;
    /** Sun colour temperature (K). */
    sunKelvin?: number;
    /** Colour arriving from above (+Z) — the sky half of the outdoor bounce. */
    skyColor?: string;
    /** Colour bounced from below (−Z) — the ground half. Equal to `skyColor`
     *  gives the flat uniform fill a renderer calls "ambient". */
    groundColor?: string;
    /** Illuminance (lux) of that sky/ground fill. */
    skyLux?: number;
    hdri?: EnvironmentHdri;
}

EnvironmentHdri

type

Image-based lighting. name is a url-method parameter key (an attached HDRI bitmap is an ordinary parameter whose value is its URL) OR a direct https:/data: URI; absent = the host's neutral built-in room, so PBR materials are not pitch black before an HDRI is authored.

type EnvironmentHdri
// = {
    name?: string;
    intensity?: number;
}

Site

type

Where the model stands on Earth. northAngle rotates project north away from +Y, in degrees counter-clockwise looking down. Revit's project location / SketchUp's geo-locate.

type Site
// = {
    latitude: number;
    longitude: number;
    northAngle?: number;
}

SunMoment

type

The moment the sun is computed for — a document FACT (which day and hour this shadow study is about), not a clock reading: nothing here ever consults the wall clock, so the same document always produces the same shadows.

hour is LOCAL SOLAR time (12 = the sun crossing the site's meridian): shadow studies are authored against solar noon, so longitude/time-zone conversion is deliberately out of scope.

type SunMoment
// = {
    month: number;
    day: number;
    hour: number;
}
Last updated: 📖 1 min readEdit on GitHub