Skip to main content

Module gif_import

Module gif_import 

Source
Expand description

Animated-GIF → VoxelClip importer for Doom-style billboard sprites (stage BB). Behind the gif feature; see PORTING-BILLBOARD.md. Animated-GIF → voxel_clip::VoxelClip importer for Doom-style billboard sprites (stage BB). Feature-gated behind gif; see gif_import + PORTING-BILLBOARD.md. Import an animated GIF into a VoxelClip of flat, camera-facing voxel slabs — the authoring bridge for Doom/Build-style billboard sprites (stage BB; see PORTING-BILLBOARD.md). Feature-gated behind the gif feature.

Each GIF frame becomes one VoxelFrame slab of dims [W, thickness, H]: every non-transparent pixel becomes a voxel, every transparent pixel is air (a 1-bit cutout — GIF carries only a single transparent palette index). The slab is 1 voxel thick by default (thickness), so a camera-facing instance reads as flat pixel art while still being a real voxel volume that casts + receives shadows.

§Axis convention

Image column → local +x (right), image row → local +z (up; the top image row maps to the highest z), and local +y → depth (the thickness axis, the slab’s normal). A Cylindrical billboard then orients forward = +y toward the camera, up = +z = world up. Pixel colours are packed voxlap-style 0x80RRGGBB (neutral brightness byte); a pure-black pixel is nudged to 0x010101 because rgb == 0 is the engine’s air/empty sentinel.

§What this does NOT do

Material assignment (e.g. an additive glow for fire) is not part of the importer: a VoxelClip carries geometry + colour only. A whole-clip glow is a per-instance concern — define an additive Material and set it on the clip instance (set_sprite_instance_material) — so the importer stays a pure geometry bridge.

Structs§

GifImportOpts
Options for voxel_clip_from_gif.

Enums§

GifImportError
Failure modes of voxel_clip_from_gif.
Pivot
Where the clip’s pivot sits in the slab (the point that maps to the instance’s world position). z = 0 is the bottom of the image.

Functions§

voxel_clip_from_gif
Decode an animated GIF into a VoxelClip of flat voxel slabs.