Skip to main content

Module png_import

Module png_import 

Source
Expand description

PNG-sequence / APNG → VoxelClip importer (stage BB). Behind the png feature; see PORTING-BILLBOARD.md. PNG-sequence / APNG → voxel_clip::VoxelClip importer for billboard sprites (stage BB). Feature-gated behind png; see png_import. Import PNG sequences and animated PNG (APNG) into a VoxelClip of flat, camera-facing voxel slabs — the truecolor counterpart of crate::gif_import for Doom/Build-style billboard sprites (stage BB). Feature-gated behind the png feature.

Two entry points:

  • voxel_clip_from_png_frames — N independent PNG files, each a full frame (a “frame_000.png … frame_023.png” export), all the same size.
  • voxel_clip_from_apng — a single animated PNG (frames + per-frame delays + APNG dispose/blend compositing). A plain (non-animated) PNG is a 1-frame clip.

PNG carries real 8-bit alpha, but a VoxelClip is RGB-only, so alpha is resolved as a cutout at PngImportOpts::alpha_cutoff (a pixel becomes a voxel iff alpha >= cutoff). Per-pixel translucency is not preserved; for a uniform fade use a translucent instance material + alpha_mul. See the crate-internal slab module for the axis convention.

Structs§

PngImportOpts
Options for the PNG importers.

Enums§

PngImportError
Failure modes of the PNG importers.

Functions§

voxel_clip_from_apng
Import an animated PNG (APNG) into a clip — frames + per-frame delays, with APNG dispose/blend compositing onto a persistent canvas (so sub-region frames compose correctly). A non-animated PNG yields a 1-frame clip.
voxel_clip_from_png_frames
Import a sequence of independent PNG frames (all the same size) into a clip. durations_ms is either empty (uniform PngImportOpts::default_frame_ms) or one entry per frame.