| Title: | Render 'hexify' Globes on the Graphics Card Without a Browser |
|---|---|
| Description: | Draws the globes of the 'hexify' package offscreen on the graphics card through 'wgpu', the 'Rust' implementation of 'WebGPU', with the same shader and pipelines as the 'hexify' globe widget, and returns the image as pixels or a PNG file. 'hexify' calls it from hex_globe_png(); no browser is needed. |
| Authors: | Gilles Colling [aut, cre, cph] (ORCID: <https://orcid.org/0000-0003-3070-6066>) |
| Maintainer: | Gilles Colling <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-10-23 13:42:04 UTC |
| Source: | https://github.com/gcol33/hexglobe |
The adapter is picked once per session, preferring a discrete graphics
card. The environment variables WGPU_POWER_PREF ("low" or
"high") and WGPU_BACKEND (such as "dx12",
"vulkan" or "metal"), set before the first scene is drawn,
choose another.
gpu_adapter()gpu_adapter()
The adapter's name and graphics backend, one string.
Read a PNG file
read_png(file)read_png(file)
file |
Path of an 8-bit PNG file. |
An image, as from render_scene.
Draws a scene on the graphics card, offscreen, with the shader and the
pipelines of the 'hexify' globe widget. Scenes are built by 'hexify' from
a globe widget; hexify::hex_globe_png() is the usual way in.
render_scene(scene)render_scene(scene)
scene |
A scene, as above. |
A scene is a list of
the WGSL source, one string;
the camera uniform, 112 32-bit floats as a raw vector;
the image size in pixels;
the layers in drawing order, each a list with kind
(0 an opaque mesh, 1 a blended mesh coloured by value, 2 the cells of
an ISEA grid, 3 polylines), count (indices of a mesh, segments
of a polyline), and its buffers as raw vectors: uniform,
pos, item, tri, index, values,
ramp, grid, points, segment; and
textures, the textures bound beside them, each a list of
binding, format ("r32uint" or
"rg32uint"), dimension ("2d" or
"2d-array"), size (width, height and layers) and
data, its texels row by row and layer by layer as a raw
vector.
An image: a list of rgba, the pixels as a raw vector of
red, green, blue and alpha bytes, row by row from the top, alpha not
premultiplied, and width and height.
Write an image as a PNG file
write_png(image, file)write_png(image, file)
image |
An image from |
file |
Path of the PNG file to write. |
file, invisibly.