Changed: Added DDSD_LINEARSIZE in tga2dds to avoid warning in CBitmap
This commit is contained in:
parent
b2417a68ab
commit
1ff44fdb50
1 changed files with 6 additions and 19 deletions
|
@ -28,33 +28,34 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vector<uint8
|
||||||
//===========================================
|
//===========================================
|
||||||
memset(&dest, 0, sizeof(dest));
|
memset(&dest, 0, sizeof(dest));
|
||||||
dest.dwSize = sizeof(dest);
|
dest.dwSize = sizeof(dest);
|
||||||
dest.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
|
dest.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_LINEARSIZE;
|
||||||
dest.dwHeight = height;
|
dest.dwHeight = height;
|
||||||
dest.dwWidth = width;
|
dest.dwWidth = width;
|
||||||
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
|
||||||
switch(algo)
|
switch(algo)
|
||||||
{
|
{
|
||||||
case DXT1:
|
case DXT1:
|
||||||
flags |= squish::kDxt1;
|
|
||||||
break;
|
|
||||||
case DXT1A:
|
case DXT1A:
|
||||||
flags |= squish::kDxt1;
|
flags |= squish::kDxt1;
|
||||||
|
dest.ddpf.dwFourCC = MAKEFOURCC('D','X', 'T', '1');
|
||||||
|
dest.dwLinearSize /= 2;
|
||||||
break;
|
break;
|
||||||
case DXT3:
|
case DXT3:
|
||||||
flags |= squish::kDxt3;
|
flags |= squish::kDxt3;
|
||||||
|
dest.ddpf.dwFourCC = MAKEFOURCC('D','X', 'T', '3');
|
||||||
break;
|
break;
|
||||||
case DXT5:
|
case DXT5:
|
||||||
flags |= squish::kDxt5;
|
flags |= squish::kDxt5;
|
||||||
|
dest.ddpf.dwFourCC = MAKEFOURCC('D','X', 'T', '5');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Encoding
|
// Encoding
|
||||||
//===========
|
//===========
|
||||||
// resize dest.
|
// resize dest.
|
||||||
|
@ -64,20 +65,6 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vector<uint8
|
||||||
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);
|
||||||
|
|
||||||
switch(algo)
|
|
||||||
{
|
|
||||||
case DXT1:
|
|
||||||
case DXT1A:
|
|
||||||
dest.ddpf.dwFourCC = MAKEFOURCC('D','X', 'T', '1');
|
|
||||||
break;
|
|
||||||
case DXT3:
|
|
||||||
dest.ddpf.dwFourCC = MAKEFOURCC('D','X', 'T', '3');
|
|
||||||
break;
|
|
||||||
case DXT5:
|
|
||||||
dest.ddpf.dwFourCC = MAKEFOURCC('D','X', 'T', '5');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* S3TC is a very good compressor, but make BIG mistakes in some case with DXTC5 and DXTC3
|
/* S3TC is a very good compressor, but make BIG mistakes in some case with DXTC5 and DXTC3
|
||||||
*/
|
*/
|
||||||
if( algo==DXT5 || algo==DXT3 )
|
if( algo==DXT5 || algo==DXT3 )
|
||||||
|
|
Loading…
Reference in a new issue