From 74e3c93055a532979c3468a93c6ae6188fe07bb2 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 15 Jul 2011 13:08:46 +0200 Subject: [PATCH] make encoding of DXT3/5 "more friendly" (don't use the swapped-colors case of DXT1) --- s2tc_compressor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/s2tc_compressor.cpp b/s2tc_compressor.cpp index e3312ef..aebf469 100644 --- a/s2tc_compressor.cpp +++ b/s2tc_compressor.cpp @@ -482,12 +482,15 @@ namespace { if(ca[1] < ca[0]) { + // select mode with 6 = 0, 7 = 255 ca[2] = ca[0]; ca[0] = ca[1]; ca[1] = ca[2]; } } - if(c[1] < c[0]) + if((dxt == DXT1) ? (c[1] < c[0]) : (c[0] < c[1])) + // DXT1: select mode with 3 = transparent + // other: don't select this mode { c[2] = c[0]; c[0] = c[1]; @@ -733,7 +736,9 @@ namespace } } } - if(c[1] < c[0]) + if((dxt == DXT1) ? (c[1] < c[0]) : (c[0] < c[1])) + // DXT1: select mode with 3 = transparent + // other: don't select this mode { c[2] = c[0]; c[0] = c[1]; -- 2.11.0