#define STB_IMAGE_IMPLEMENTATION
#endif
+#define STBI_NO_THREAD_LOCALS
#include "stb/stb_image.h"
#ifdef USE_LIBRGBCX
+ // #define RGBCX_NO_ALGORITHM
#include "librgbcx.h"
-#else
+ #define HAS_DXT_COMPRESSOR
+#endif
+
+#if USE_STB_DXT
#define STB_DXT_IMPLEMENTATION
#include "stb/stb_dxt.h"
+ #define HAS_DXT_COMPRESSOR
+#endif
+
+#ifndef HAS_DXT_COMPRESSOR
+ #warning No DXT compressor specified! S3 Output will be invalid.
#endif
#ifdef NBVTF_SHOW_STDERR
{
rgbcx__encode_bc1( qual, dest, src, 0, 0 );
}
-#else
+#endif
+
+#if USE_STB_DXT
stb_compress_dxt_block( dest, src, alpha, STB_DXT_HIGHQUAL );
#endif
+
+#ifndef HAS_DXT_COMPRESSOR
+
+ for( int i=0; i<alpha? 16: 8; i++ )
+ dest[i] = i%1? 0xff: 0x00;
+#endif
}
void nbvtf_compress_dxt( uint8_t *src, int w, int h, int alpha, int qual,