hex-world
    Preparing search index...

    Interface HexWorldOptions

    interface HexWorldOptions {
        container: HTMLElement;
        map?: HexMap;
        width?: number;
        height?: number;
        featureLayerCount?: number;
        orientation?: HexOrientation;
        hexSize?: number;
        terrainDescriptors?: TerrainDescriptor[];
        terrainAssets?: TerrainAssetRegistry;
        terrainMaterialOptions?: TerrainMaterialOptions;
        liquidDescriptors?: LiquidTypeDescriptor[];
        liquidMaterials?: Map<string, LiquidMaterialSet>;
        scatterDefinitions?: ScatterDefinition[];
        scatterSeed?: number;
        fogData?: FogData;
        flowWidenedRivers?: boolean;
        chunkSize?: number;
        loadRadius?: number;
        geometryOptions?: ChunkGeometryOptions;
        waterGeometryOptions?: WaterGeometryOptions;
        chunkWorker?: boolean | (() => ChunkWorkerLike);
        camera?: HexWorldCameraOptions;
        background?: ColorRepresentation | null;
        lights?: boolean;
        shadows?: boolean | SunShadowOptions;
        dayNight?: boolean | DayNightOptions;
        sky?: boolean | SkyDomeOptions;
        godRays?: boolean | GodRaysOptions;
        skirt?: boolean | MapSkirtMeshOptions;
        seasons?: boolean | HexWorldSeasonOptions;
        wind?: boolean | WindOptions;
        autoStart?: boolean;
        clickTolerance?: number;
    }
    Index

    Properties

    container: HTMLElement

    Element the renderer canvas is appended to; sized to fit it.

    map?: HexMap

    Existing map to render. Omit to create a blank one from width/height.

    width?: number

    Blank-map dimensions when map is omitted. Default 100×100.

    height?: number
    featureLayerCount?: number

    Feature layers for the blank map. Default 0.

    orientation?: HexOrientation

    POINTY_TOP (default) or FLAT_TOP.

    hexSize?: number

    Hex radius in world units. Default 1.

    terrainDescriptors?: TerrainDescriptor[]

    Custom terrain set. Default DEFAULT_TERRAIN_DESCRIPTORS.

    terrainAssets?: TerrainAssetRegistry

    Asset registry for image-textured terrain.

    terrainMaterialOptions?: TerrainMaterialOptions

    Extra options for the terrain shader material (light dir/colors, texScale).

    liquidDescriptors?: LiquidTypeDescriptor[]

    Liquid types to render. Default DEFAULT_LIQUID_DESCRIPTORS.

    liquidMaterials?: Map<string, LiquidMaterialSet>

    Per-liquid material sets. Default: resolved from each liquid descriptor.

    scatterDefinitions?: ScatterDefinition[]
    scatterSeed?: number

    Seed for deterministic scatter placement. Default 1234.

    fogData?: FogData
    flowWidenedRivers?: boolean

    Widen river channels with accumulated flow. Default true.

    chunkSize?: number

    Cells per chunk side. Default 32.

    loadRadius?: number

    Chunk streaming radius. Default 5.

    geometryOptions?: ChunkGeometryOptions
    waterGeometryOptions?: WaterGeometryOptions
    chunkWorker?: boolean | (() => ChunkWorkerLike)

    Build streamed-in chunk geometry on a Web Worker instead of the main thread, eliminating streaming hitches on big maps. true uses the library's bundled worker (createDefaultChunkWorker); pass a factory to supply your own. Default false (synchronous builds).

    background?: ColorRepresentation | null

    Scene background color, or null to leave the scene transparent. Default 0x1a1a2e.

    lights?: boolean

    Add the default ambient + directional lights. Default true.

    shadows?: boolean | SunShadowOptions

    Sun shadows: true for the tuned defaults, or a SunShadowOptions object. Enables the renderer's shadow maps and replaces the default directional light with a SunShadowRig whose ortho frustum re-fits the camera view each frame (chunk streaming keeps working — the frustum follows the camera, not the loaded set). With lights: false the shadow maps are still enabled so a hand-wired rig works, but no rig is created. Default false.

    dayNight?: boolean | DayNightOptions

    Animated day/night cycle: true for defaults (120 s days), or a DayNightOptions object. Drives the sun/shadow rig direction, warm dawn/dusk light tinting, a cool moonlight mode, the scene background, and liquid darkening (lava's emissive glow survives the night). Also creatable later via HexWorld.setTimeOfDay. Default off.

    sky?: boolean | SkyDomeOptions

    Gradient sky dome + matching distance haze: true for the tuned defaults, or a SkyDomeOptions object. The dome takes its colors from the day/night cycle and greys over under rain/snow, while terrain, roads, and every liquid layer dissolve into its horizon color, so the map edge fades into atmosphere instead of ending against the background. groundTint defaults to the average color of the terrain palette (re-derived on terrain swaps). Scatter materials get the same haze via attachAtmosphere; hand your own unit/prop materials to it as well. Also creatable later via HexWorld.setSky. Default off.

    godRays?: boolean | GodRaysOptions

    Crepuscular rays fanning out from the sun past ridgelines and trees: true for the tuned defaults, or a GodRaysOptions object. Drawn as one extra low-resolution pass after the frame, so the renderer's antialiasing is untouched, and skipped entirely whenever the sun is down, behind the camera, or buried under cloud. Best paired with sky (the dome supplies the disc the shafts start at and the overcast that puts them out). Also creatable later via HexWorld.setGodRays. Default off.

    skirt?: boolean | MapSkirtMeshOptions

    Close the map's open edges with a wall of cut earth: true for the tuned defaults, or a MapSkirtMeshOptions object. The terrain is a surface rather than a solid, so any camera low enough to see the horizon also sees under it — the skirt gives the map a bottom and four sides, banded with soil strata like a block cut out of the ground.

    Its top follows the terrain's own contour (including where that contour is a sea bed), and it takes the world's geometryOptions automatically so the seam stays tight. Also creatable later via HexWorld.setSkirt. Default off.

    seasons?: boolean | HexWorldSeasonOptions

    Seasons, snow accumulation, and freezing water: true for the tuned defaults, or a HexWorldSeasonOptions object. Builds a ClimateData for the map (or takes one you already generated), advances a SeasonCycle alongside the day clock, and drives snow on the terrain and scatter plus ice on every liquid whose descriptor sets a freezePoint. Precipitation follows too — snow falls where snow lies, rain everywhere else. Also creatable later via HexWorld.setSeasons. Default off.

    wind?: boolean | WindOptions

    The shared world wind: true for the tuned defaults, or a WindOptions object. One vector, gusting on its own clock, that drifts the cloud deck, slants the rain, marches the ripples across open water, and bends every plant whose material carries attachWindSway — which is the call that decides which scatter answers it, since a boulder should not. Also switchable later via HexWorld.setWind. Default off.

    autoStart?: boolean

    Start the render loop immediately. Default true.

    clickTolerance?: number

    How far the pointer may travel between press and release and still count as a cellClick, in CSS pixels. This is what keeps a right-drag pan from firing a click when the button comes up. Default 5.