projects
/
convexer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
switch to shell scripts
[convexer.git]
/
nbvtf
/
nbvtf.h
diff --git
a/nbvtf/nbvtf.h
b/nbvtf/nbvtf.h
index 6be4714ed99a26c0d340898bce37986c9abc4851..aa82cbf6a302823416a011f99a956e89e0f43383 100644
(file)
--- a/
nbvtf/nbvtf.h
+++ b/
nbvtf/nbvtf.h
@@
-59,13
+59,23
@@
extern "C" {
#define STB_IMAGE_IMPLEMENTATION
#endif
#define STB_IMAGE_IMPLEMENTATION
#endif
+#define STBI_NO_THREAD_LOCALS
#include "stb/stb_image.h"
#ifdef USE_LIBRGBCX
#include "stb/stb_image.h"
#ifdef USE_LIBRGBCX
+ // #define RGBCX_NO_ALGORITHM
#include "librgbcx.h"
#include "librgbcx.h"
-#else
+ #define HAS_DXT_COMPRESSOR
+#endif
+
+#if USE_STB_DXT
#define STB_DXT_IMPLEMENTATION
#include "stb/stb_dxt.h"
#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
#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 );
}
{
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
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,
}
void nbvtf_compress_dxt( uint8_t *src, int w, int h, int alpha, int qual,