X-Git-Url: https://harrygodden.com/git/?p=convexer.git;a=blobdiff_plain;f=nbvtf%2Fnbvtf.h;fp=nbvtf%2Fnbvtf.h;h=aa82cbf6a302823416a011f99a956e89e0f43383;hp=6be4714ed99a26c0d340898bce37986c9abc4851;hb=12102f7b89f21fe5148e9a4506f505fcaef98da2;hpb=7a7000b2a485ca28219d3c7449db9d9291398902 diff --git a/nbvtf/nbvtf.h b/nbvtf/nbvtf.h index 6be4714..aa82cbf 100644 --- a/nbvtf/nbvtf.h +++ b/nbvtf/nbvtf.h @@ -59,13 +59,23 @@ extern "C" { #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 @@ -541,9 +551,17 @@ void nbvtf_dxt_block( uint8_t *dest, uint8_t *src, int alpha, int qual ) { 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