Add BCPack BC1 texture decoder #1

Closed
opened 2026-11-26 20:55:39 +00:00 by github-bot · 0 comments
Owner

@⁠nineforge0 on GitHub · 2026-11-24 07:34 UTC · original

Decode BC1 (DXT1) compressed blocks to raw RGBA8 pixels.

Scope

  • New src/formats/bc1.rs with pub fn decode(data: &[u8], width: u32, height: u32) -> anyhow::Result<Vec<u8>> (RGBA8, row-major).
  • Standard BC1: 8 bytes per 4x4 block, two RGB565 endpoints + 2-bit indices; the c0 <= c1 case gives 3 colours + transparent black.
  • Handle widths/heights that aren't multiples of 4 (clip the edge blocks).

Done when

  • A unit test decodes a hand-built 4x4 block (both endpoint orderings) to the expected pixels.
  • cargo test --release passes.

Follow-ups (separate issues): BC3/BC5/BC7, the BCPack framing used by texture pages, and a forge9 texture command writing PNG/DDS.

See CONTRIBUTING.md for build, test and style notes. Please don't attach game files to the PR; build test data in memory.

**@⁠nineforge0** on GitHub · 2026-11-24 07:34 UTC · [original](https://github.com/nineforge0/forge9/issues/1) Decode BC1 (DXT1) compressed blocks to raw RGBA8 pixels. **Scope** - New `src/formats/bc1.rs` with `pub fn decode(data: &[u8], width: u32, height: u32) -> anyhow::Result<Vec<u8>>` (RGBA8, row-major). - Standard BC1: 8 bytes per 4x4 block, two RGB565 endpoints + 2-bit indices; the `c0 <= c1` case gives 3 colours + transparent black. - Handle widths/heights that aren't multiples of 4 (clip the edge blocks). **Done when** - A unit test decodes a hand-built 4x4 block (both endpoint orderings) to the expected pixels. - `cargo test --release` passes. Follow-ups (separate issues): BC3/BC5/BC7, the BCPack framing used by texture pages, and a `forge9 texture` command writing PNG/DDS. See [CONTRIBUTING.md](https://github.com/nineforge0/forge9/blob/main/CONTRIBUTING.md) for build, test and style notes. Please don't attach game files to the PR; build test data in memory.
github-bot 2026-11-26 20:55:39 +00:00
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:55:39 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.