Expand description
DDS texture-container support. DDS (DirectDraw Surface) reader and writer.
This module provides container-level support for KotOR-era DDS files.
Parsing and serialization are backed by ddsfile, but the public API is kept
focused on D3D9-era headers and formats that KotOR actually uses.
§KotOR Notes
- Reader support includes:
- standard
DDScontainers (D3D9-era headers; canonical compressed formats are DXT1/DXT5). - a
CResDDSprefix-header container variant used by vanilla resource paths.
- standard
- Canonical KotOR compressed paths currently target DXT1 and DXT5.
- Writer support currently emits standard
DDScontainers only.
§Two variants, told apart by the first four bytes
A standard DDS opens with the DDS magic and a 124-byte D3D9-era header.
The CResDDS variant vanilla resource paths use has no magic at all: twenty
bytes of proprietary prefix metadata sit where the header would be, and the
surface payload follows directly. The prefix replaces the DDS header rather
than preceding it.
Both are read and only the standard form is written. Emitting the prefixed
variant would reproduce a container the engine reads and nothing else does.
The prefix field map and the engine’s own read are in
docs/src/formats/textures/dds.md.
Structs§
- CRes
DdsHeader - Parsed
CResDDSprefix metadata header. - Dds
- In-memory DDS container.
Enums§
- DdsBinary
Error - Errors produced while parsing or serializing DDS data.
- DdsSource
Flavor - DDS source container flavor.
Functions§
- read_
dds - Reads DDS data from a reader.
- read_
dds_ from_ bytes - Reads DDS data from bytes.
- write_
dds - Writes DDS data to a writer.
- write_
dds_ to_ vec - Serializes DDS data to a byte vector.
Type Aliases§
- DdsCaps2
- DDS caps2 bitflag re-export.
- DdsD3d
Format - DDS D3D-format enum re-export.
- DdsNew
D3dParams - Constructor parameter set for D3D-style DDS creation.