Update to CMake, tweaks & dds
[convexer.git] / nbvtf / dds_cmd.c
diff --git a/nbvtf/dds_cmd.c b/nbvtf/dds_cmd.c
new file mode 100644 (file)
index 0000000..2b39189
--- /dev/null
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <math.h>
+
+#define STB_IMAGE_IMPLEMENTATION
+#define NBVTF_SHOW_STDERR
+#include "nbvtf.h"
+
+int main( int argc, char *argv[] )
+{
+       if( argc < 3 )
+       {
+               printf( "Usage: todds input_file.png output.dds\n" );
+               return 0;
+       }
+
+       printf( "todds: converting to dds... " );
+       
+       int x,y,n;
+       uint8_t *data = stbi_load( argv[1], &x, &y, &n, 4 );
+       
+       if( data )
+       {
+      nbvtf_init();
+      nbvtf_write_dds_dxt1( data, x, y, 16, argv[2] );
+      free( data );
+
+      printf( "Success\n" );
+   }
+   else 
+      printf( "Failed\n" );
+
+       return 0;
+}