diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-08-23 08:58:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-23 08:58:44 +0200 |
commit | a2acbb0bfb547f893f9d84cfde4957fdc4791dae (patch) | |
tree | e2d4cea1f614529eb33df1303137374027baaf1c /modules | |
parent | d3714d1787566e95be89823a48fafddc2667af6e (diff) | |
parent | 4cd866685ea7f7dff569d71ae53392abb7a67df1 (diff) |
Merge pull request #21167 from elasota/squish-quality-config
Support higher-quality S3TC compression modes
Diffstat (limited to 'modules')
-rw-r--r-- | modules/squish/image_compress_squish.cpp | 8 | ||||
-rw-r--r-- | modules/squish/image_compress_squish.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 6aaabb9d9b..25fc897146 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -75,7 +75,7 @@ void image_decompress_squish(Image *p_image) { p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } -void image_compress_squish(Image *p_image, Image::CompressSource p_source) { +void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source) { if (p_image->get_format() >= Image::FORMAT_DXT1) return; //do not compress, already compressed @@ -86,6 +86,12 @@ void image_compress_squish(Image *p_image, Image::CompressSource p_source) { if (p_image->get_format() <= Image::FORMAT_RGBA8) { int squish_comp = squish::kColourRangeFit; + + if (p_lossy_quality > 0.85) + squish_comp = squish::kColourIterativeClusterFit; + else if (p_lossy_quality > 0.75) + squish_comp = squish::kColourClusterFit; + Image::Format target_format = Image::FORMAT_RGBA8; Image::DetectChannels dc = p_image->get_detected_channels(); diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h index c022063fe5..6da947beea 100644 --- a/modules/squish/image_compress_squish.h +++ b/modules/squish/image_compress_squish.h @@ -33,7 +33,7 @@ #include "image.h" -void image_compress_squish(Image *p_image, Image::CompressSource p_source); +void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source); void image_decompress_squish(Image *p_image); #endif // IMAGE_COMPRESS_SQUISH_H |