MCPcopy Create free account
hub / github.com/carbonengine/trinity / CompressNormalMapDXT5

Function CompressNormalMapDXT5

trinity/Tr2DxtCompressor.cpp:705–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

703}
704
705void CompressNormalMapDXT5( const uint8_t* inBuf, uint8_t* outBuf, int width, int height, ptrdiff_t& outputBytes, volatile const bool& cancel )
706{
707 uint8_t block[64];
708 uint8_t minColor[4];
709 uint8_t maxColor[4];
710 uint8_t** outData = &outBuf;
711 for( int j = 0; j < height; j += 4, inBuf += width * 4 * 4 )
712 {
713 if( cancel )
714 {
715 return;
716 }
717 for( int i = 0; i < width; i += 4 )
718 {
719 ExtractBlockDXT5N( inBuf + i * 4, width, block );
720 GetMinMaxColorsWithAlpha( block, minColor, maxColor );
721 EmitByte( maxColor[3], outData );
722 EmitByte( minColor[3], outData );
723 EmitAlphaIndices( block, minColor[3], maxColor[3], outData );
724 EmitWord( ColorTo565( maxColor ), outData );
725 EmitWord( ColorTo565( minColor ), outData );
726 EmitColorIndices( block, minColor, maxColor, outData );
727 }
728 }
729 outputBytes = *outData - outBuf;
730}
731
732void CompressImageDXT1( const uint8_t* inBuf, uint8_t* outBuf, int width, int height, ptrdiff_t& outputBytes, volatile const bool& cancel )
733{

Callers 1

Tr2DxtCompressSurfaceFunction · 0.85

Calls 7

ExtractBlockDXT5NFunction · 0.85
GetMinMaxColorsWithAlphaFunction · 0.85
EmitByteFunction · 0.85
EmitAlphaIndicesFunction · 0.85
EmitWordFunction · 0.85
ColorTo565Function · 0.85
EmitColorIndicesFunction · 0.85

Tested by

no test coverage detected