Cauldron3D.Formats.Wad3 (Cauldron3D.Formats v0.3.3)

Copy Markdown View Source

WAD3 collections: wall textures with their mips and their own palettes, and pictures with their own palettes.

textures = Cauldron3D.Formats.Wad3.textures(File.read!("halflife.wad"))
textures["c1a0_labflrd"]
#=> [%Cauldron3D.Texture{palette: <<...>>}, ...]

Cauldron3D.Formats.Wad3.pictures(File.read!("gfx.wad"))["crosshairs"]

Names are lower case. In a texture whose name begins {, colour 255 is see-through.

Summary

Functions

A font lump: %{texture:, height:, glyphs:}, texture the 256-pixel-wide sheet of characters with its palette (colour 255 see-through), height a character's height in pixels, and glyphs a tuple of 256 {x, y, width} places on the sheet. nil when it is not one.

Every font in the collection, by name, as font/1 reads it.

The lumps of a WAD3 as {type, name, bytes}.

A picture with its palette: width, height, pixels, then 256 colours; nil when it is not one.

Every picture in the collection, by name.

Every texture in the collection: its four mips, by name.

Functions

font(arg1)

@spec font(binary()) :: map() | nil

A font lump: %{texture:, height:, glyphs:}, texture the 256-pixel-wide sheet of characters with its palette (colour 255 see-through), height a character's height in pixels, and glyphs a tuple of 256 {x, y, width} places on the sheet. nil when it is not one.

fonts(data)

@spec fonts(binary() | nil) :: %{required(String.t()) => map()}

Every font in the collection, by name, as font/1 reads it.

lumps(data)

@spec lumps(binary() | nil) :: [{byte(), String.t(), binary()}]

The lumps of a WAD3 as {type, name, bytes}.

picture(arg1)

@spec picture(binary()) :: Cauldron3D.Texture.t() | nil

A picture with its palette: width, height, pixels, then 256 colours; nil when it is not one.

pictures(data)

@spec pictures(binary() | nil) :: %{required(String.t()) => Cauldron3D.Texture.t()}

Every picture in the collection, by name.

textures(data)

@spec textures(binary() | nil) :: %{required(String.t()) => [Cauldron3D.Texture.t()]}

Every texture in the collection: its four mips, by name.