// Decoders for the texture image formats: .tga (Truevision), .vtx (DIV-VTX2), // .bsl (DIV-BSL2). All decode to top-down 32-bit ARGB (0xAARRGGBB). // // BSL is a BIT-SLICED container, not a single image: one w*h grid of 32-bit // texel words whose nibbles hold up to SIX independent 4-bit GRAYSCALE // sub-images (Division dpiBSLTYPE_MONO0..5), or a packed RGB444 (type 7) / // RGBA4444 (type 8) truecolor image. Which slice a texture samples comes from // the material library's TEXTURE record BITSLICE tag (0x18, absent = slice 0) // -- the caller passes it as bslChannel. Reference: the shipping WinTesla // loader VGCDivLoader::LoadBSLFile/getBSLData + Division dsys PIMAGE.H // (dpiBSLTYPE) + PFBIZTAG.H (dpfB_TEXTURE_BITSLICE_TAG). #pragma once #include #include #include struct Image { int w = 0, h = 0; std::vector argb; // w*h, top-down bool ok = false; }; // bslChannel: BSL slice/type index (0..5 mono, 7 RGB444, 8 RGBA4444); -1 or // unspecified = slice 0 (the BMF default when the BITSLICE tag is absent). // Ignored for non-BSL formats. Image decodeImage(const std::string& path, int bslChannel = -1);