mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-20 06:06:13 +00:00
Changed: code simplification for s3tc_compressor_lib
This commit is contained in:
parent
24aaafd38b
commit
309ad634a3
1 changed files with 2 additions and 4 deletions
|
@ -34,7 +34,6 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vector<uint8
|
||||||
dest.ddpf.dwSize = sizeof(CS3TCCompressor::DDS_PIXELFORMAT);
|
dest.ddpf.dwSize = sizeof(CS3TCCompressor::DDS_PIXELFORMAT);
|
||||||
dest.ddpf.dwFlags = DDPF_FOURCC;
|
dest.ddpf.dwFlags = DDPF_FOURCC;
|
||||||
dest.dwCaps = DDSCAPS_TEXTURE;
|
dest.dwCaps = DDSCAPS_TEXTURE;
|
||||||
dest.dwLinearSize = std::max(4, width) * std::max(4, height);
|
|
||||||
|
|
||||||
// Setting flags
|
// Setting flags
|
||||||
int flags = squish::kColourIterativeClusterFit; // for best quality
|
int flags = squish::kColourIterativeClusterFit; // for best quality
|
||||||
|
@ -44,7 +43,6 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vector<uint8
|
||||||
case DXT1A:
|
case DXT1A:
|
||||||
flags |= squish::kDxt1;
|
flags |= squish::kDxt1;
|
||||||
dest.ddpf.dwFourCC = MAKEFOURCC('D','X', 'T', '1');
|
dest.ddpf.dwFourCC = MAKEFOURCC('D','X', 'T', '1');
|
||||||
dest.dwLinearSize /= 2;
|
|
||||||
break;
|
break;
|
||||||
case DXT3:
|
case DXT3:
|
||||||
flags |= squish::kDxt3;
|
flags |= squish::kDxt3;
|
||||||
|
@ -59,8 +57,8 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vector<uint8
|
||||||
// Encoding
|
// Encoding
|
||||||
//===========
|
//===========
|
||||||
// resize dest.
|
// resize dest.
|
||||||
uint32 encodeSz = squish::GetStorageRequirements(width, height, flags);
|
dest.dwLinearSize = squish::GetStorageRequirements(width, height, flags);
|
||||||
compdata.resize(encodeSz);
|
compdata.resize(dest.dwLinearSize);
|
||||||
// Go!
|
// Go!
|
||||||
float weight[3] = {0.3086f, 0.6094f, 0.0820f};
|
float weight[3] = {0.3086f, 0.6094f, 0.0820f};
|
||||||
squish::CompressImage(pixSrc, width, height, &(*compdata.begin()), flags, weight);
|
squish::CompressImage(pixSrc, width, height, &(*compdata.begin()), flags, weight);
|
||||||
|
|
Loading…
Reference in a new issue