OSDN Git Service

make encoding of DXT3/5 "more friendly" (don't use the swapped-colors case of DXT1)
authorRudolf Polzer <divverent@xonotic.org>
Fri, 15 Jul 2011 11:08:46 +0000 (13:08 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 15 Jul 2011 11:08:46 +0000 (13:08 +0200)
s2tc_compressor.cpp

index e3312ef..aebf469 100644 (file)
@@ -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];