Skip to main content

Crate tui_globe

Crate tui_globe 

Source
Expand description

Proof-of-concept terminal renderer for a 3D globe on a ratatui Braille canvas.

The buffers under tui-globe/assets/geo/ are generated by tui-globe/tools/build_geo.py from Natural Earth 50m cultural data (country polygons + state/province lines) and consist of vertex positions on the unit sphere plus 32-bit LINE_STRIP / triangle indices into them. The same format is used by the desktop Mullvad client (which is where the convention originated), so binaries taken from mullvadvpn-app/dist-assets/geo/ would also load - but we ship our own copy so an upstream submodule bump can never break the globe.

The contour buffer is a LINE_STRIP with 0xFFFFFFFF primitive-restart markers separating rings. As a defensive measure for buffers that omit restarts (the desktop app’s shipped buffer is one continuous strip), we also synthesize boundaries at load time by splitting any join whose 3D chord exceeds [MAX_CHORD].

Structs§

Camera
Camera/view state shared by both globe widgets.
Globe
A globe widget driven by an externally-provided Camera.
MapData
Parsed unit-sphere geometry for a globe wireframe with land fill.

Constants§

CONTOUR_COLOR
Stroke color for coastline contours.
LAND_COLOR
Foreground color for land cells.

Functions§

project_point
Project a (latitude, longitude) point on the globe to the cell containing it inside area, given the same camera the renderer will use. Returns None when the point is on the back hemisphere (hidden behind the globe) or projects outside area - callers should treat both as “don’t draw an overlay”.