Skip to content

Function: choosePalette()

ts
function choosePalette(config, paletteOverride?): TerrainLevel[];

Selects or builds the terrain palette for a given planet config.

Routes through strategyFor — each body type provides its own palette generator + densification rule. All non-rocky generators feed their base palette through a shared remapping helper so getTileLevel(elevation, palette) with integer elevation ∈ [0, N-1] resolves to palette[elevation] regardless of the body type.

Parameters

ParameterTypeDescription
configBodyConfigBody configuration (drives the strategy lookup).
paletteOverride?TerrainLevel[]When provided, short-circuits the generators and returns this array verbatim. Caller is responsible for sizing/thresholding it consistently with resolveTerrainLevelCount(radius, coreRadiusRatio).

Returns

TerrainLevel[]

Distribué sous la licence indiquée dans le dépôt.