MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / CompressDXT3

Function CompressDXT3

engine/Poseidon/Graphics/Textures/DXTCompressor.cpp:934–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

932}
933
934std::vector<uint8_t> CompressDXT3(const uint8_t* rgba, int width, int height)
935{
936 size_t sz = CompressedSize(width, height, false);
937 std::vector<uint8_t> out(sz);
938 int bw = (width + 3) / 4;
939 int bh = (height + 3) / 4;
940 auto* dst = reinterpret_cast<DXTBlock128*>(out.data());
941
942 for (int by = 0; by < bh; ++by)
943 {
944 for (int bx = 0; bx < bw; ++bx)
945 {
946 DWORD pixels[16];
947 extractBlockARGB(rgba, width, height, bx, by, pixels);
948 CompressDXT1Block(dst->color, pixels, true);
949 CompressDXTABlock(dst->alphaExp, pixels);
950 dst++;
951 }
952 }
953 return out;
954}
955
956std::vector<uint8_t> CompressDXT5(const uint8_t* rgba, int width, int height)
957{

Callers 1

encodeLevelFunction · 0.85

Calls 4

CompressedSizeFunction · 0.85
extractBlockARGBFunction · 0.85
CompressDXT1BlockFunction · 0.85
CompressDXTABlockFunction · 0.85

Tested by

no test coverage detected