Interface: BodyTypeStrategy
Data + builders for a single BodyType.
Fields are deliberately flat data when possible — flatSurface, atmoLayerMode, metallicSheen are read-only constants the consumer lifts straight off the strategy, no function call. The two builders (buildPalette, buildShaderParams) wrap the per-type logic that's too large for a flat record.
Properties
displayName
readonly displayName: string;Human-readable name — used for logs / panels, not for dispatch.
shaderType
readonly shaderType: LibBodyType;Shader family used by the procedural material — selects which fragment shader runs (rocky.frag, gas.frag, metallic.frag, star.frag). Decoupled from the public BodyType so the shader catalogue can keep its current names while the public taxonomy moves to 'planetary' | 'star' + SurfaceLook.
flatSurface
readonly flatSurface: boolean;true when the smooth-sphere display should be flat (no vertex displacement) — currently only stars, whose granulation is a shader effect rather than terrain relief.
displayMeshIsAtmosphere
readonly displayMeshIsAtmosphere: boolean;true when the smooth display sphere plays the role of the atmosphere itself (gas-giant case) instead of being an inert sol backdrop. Drives four downstream behaviours:
- the smooth sphere stretches to
config.radius(atmospheric silhouette) - it stays visible as a backdrop dome in the playable surface view
- its
Sideflips toBackSidein surface view (inner curvature read) - default vertex paint is skipped (caller paints atmo-flavoured colours)
solVariationRanges?
readonly optional solVariationRanges?: SolVariationRanges;Per-type sol-side variation ranges. Omitted by every strategy that matches the lib's defaults — only metallic bodies override.
defaultAtmosphereOpacity
readonly defaultAtmosphereOpacity: number;Default atmosphere opacity for the 'shader' view, in [0, 1]. The config can override via BodyConfig.atmosphereOpacity. Gas giants land at 1 (opaque envelope, smooth sphere can be skipped); rocky bodies use a translucent halo (~0.45); metallic and stars default to 0 (no atmo halo on shader view).
canHaveRings
readonly canHaveRings: boolean;Whether this body type can ever carry a decorative ring system.
metallicSheen
readonly metallicSheen: number;Metallic sheen coefficient passed to the legacy hex shader. 1.0 for metallic bodies, 0.0 otherwise. Lifted into the strategy so the shader override receives a single numeric input.
Methods
tileRefRadius()
tileRefRadius(config): number;Returns the tile-reference radius used to derive the hexasphere subdivision count. Stars use STAR_TILE_REF keyed by spectral class (so tile counts stay stable across O/B/A/F/G/K/M); planets use their own visual radius.
Parameters
| Parameter | Type |
|---|---|
config | BodyConfig |
Returns
number
buildPalette()
buildPalette(
config,
count,
coreRadiusRatio): TerrainLevel[];Builds the terrain palette at the given band count. Each strategy is responsible for densification + re-mapping to the integer band model used downstream — the function returns the final palette (length === count, threshold i+1 per band, Infinity on the last band, height = i × layout.unit or 0 when flatSurface).
Parameters
| Parameter | Type |
|---|---|
config | BodyConfig |
count | number |
coreRadiusRatio | number |
Returns
buildShaderParams()
buildShaderParams(
config,
seed,
variation?): ParamMap;Builds the shader uniform map for this body's procedural material. Combines the type's default param block with caller-supplied physics + variation. Receives the deterministic seed so each strategy can stamp it on its own field naming.
Parameters
| Parameter | Type |
|---|---|
config | BodyConfig |
seed | number |
variation? | BodyVariation |