|
|
|
@ -97,11 +97,11 @@ Containers::Optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt, UnsignedIn |
|
|
|
return {}; |
|
|
|
return {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* RLE encoding. Reference: http://www.paulbourke.net/dataformats/tga/ */ |
|
|
|
|
|
|
|
const bool rle = (header.imageType & 8); |
|
|
|
|
|
|
|
|
|
|
|
/* Color */ |
|
|
|
/* Color */ |
|
|
|
bool rle = false; |
|
|
|
if((header.imageType & ~8) == 2) { |
|
|
|
if(header.imageType == 2 || header.imageType == 10) { |
|
|
|
|
|
|
|
/* Reference: http://www.paulbourke.net/dataformats/tga/ */ |
|
|
|
|
|
|
|
rle = header.imageType == 10; |
|
|
|
|
|
|
|
switch(header.bpp) { |
|
|
|
switch(header.bpp) { |
|
|
|
case 24: |
|
|
|
case 24: |
|
|
|
format = PixelFormat::RGB8Unorm; |
|
|
|
format = PixelFormat::RGB8Unorm; |
|
|
|
@ -115,11 +115,7 @@ Containers::Optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt, UnsignedIn |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Grayscale */ |
|
|
|
/* Grayscale */ |
|
|
|
} else if(header.imageType == 3 || header.imageType == 11) { |
|
|
|
} else if((header.imageType & ~8) == 3) { |
|
|
|
/* I only discovered this by accident when using ImageMagick's
|
|
|
|
|
|
|
|
mogrify -compression RunLengthEncoded file.tga |
|
|
|
|
|
|
|
as far as I could find, it's not documented in any TGA specs */ |
|
|
|
|
|
|
|
rle = header.imageType == 11; |
|
|
|
|
|
|
|
format = PixelFormat::R8Unorm; |
|
|
|
format = PixelFormat::R8Unorm; |
|
|
|
if(header.bpp != 8) { |
|
|
|
if(header.bpp != 8) { |
|
|
|
Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; |
|
|
|
Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; |
|
|
|
|