summaryrefslogtreecommitdiff
path: root/drivers/squish/image_compress_squish.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-10-03 08:58:41 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-10-03 08:58:41 -0300
commitaf4a97bef9bfb06e2737ad709dde157688a94daf (patch)
treed3c6471da30a8d6c20d10858e78907edd9c886e8 /drivers/squish/image_compress_squish.cpp
parent1b3a10891ebdc6e76a81c8915ba08065311e17d3 (diff)
missing fils from yesterday comit.
must have made some mistake with git, not sure why they were not sent..
Diffstat (limited to 'drivers/squish/image_compress_squish.cpp')
-rw-r--r--drivers/squish/image_compress_squish.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/squish/image_compress_squish.cpp b/drivers/squish/image_compress_squish.cpp
index 1d71f51db4..2c520bd1e9 100644
--- a/drivers/squish/image_compress_squish.cpp
+++ b/drivers/squish/image_compress_squish.cpp
@@ -18,18 +18,19 @@ void image_compress_squish(Image *p_image) {
if (p_image->get_format()>=Image::FORMAT_BC1)
return; //do not compress, already compressed
-
- Image::AlphaMode alpha = p_image->detect_alpha();
- Image::Format target_format;
int shift=0;
int squish_comp=squish::kColourRangeFit;
- switch(alpha) {
+ Image::Format target_format;
- case Image::ALPHA_NONE: target_format = Image::FORMAT_BC1; shift=1; squish_comp|=squish::kDxt1; break;
- case Image::ALPHA_BIT: target_format = Image::FORMAT_BC2; squish_comp|=squish::kDxt3; break;
- case Image::ALPHA_BLEND: target_format = Image::FORMAT_BC3; squish_comp|=squish::kDxt5; break;
- }
+ if (p_image->get_format()==Image::FORMAT_GRAYSCALE_ALPHA) {
+ //compressed normalmap
+ target_format = Image::FORMAT_BC3; squish_comp|=squish::kDxt5;;
+ } else if (p_image->detect_alpha()!=Image::ALPHA_NONE) {
+ target_format = Image::FORMAT_BC2; squish_comp|=squish::kDxt3;;
+ } else {
+ target_format = Image::FORMAT_BC1; shift=1; squish_comp|=squish::kDxt1;;
+ }
p_image->convert(Image::FORMAT_RGBA); //always expects rgba