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

Function CompressDXT1

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

Source from the content-addressed store, hash-verified

911}
912
913std::vector<uint8_t> CompressDXT1(const uint8_t* rgba, int width, int height)
914{
915 size_t sz = CompressedSize(width, height, true);
916 std::vector<uint8_t> out(sz);
917 int bw = (width + 3) / 4;
918 int bh = (height + 3) / 4;
919 auto* dst = reinterpret_cast<DXTBlock64*>(out.data());
920
921 for (int by = 0; by < bh; ++by)
922 {
923 for (int bx = 0; bx < bw; ++bx)
924 {
925 DWORD pixels[16];
926 extractBlockARGB(rgba, width, height, bx, by, pixels);
927 CompressDXT1Block(*dst, pixels);
928 dst++;
929 }
930 }
931 return out;
932}
933
934std::vector<uint8_t> CompressDXT3(const uint8_t* rgba, int width, int height)
935{

Callers 3

encodeLevelFunction · 0.85
ConvertPixelsFunction · 0.85

Calls 3

CompressedSizeFunction · 0.85
extractBlockARGBFunction · 0.85
CompressDXT1BlockFunction · 0.85

Tested by

no test coverage detected