diff --git a/src/nvtt/tools/compress.cpp b/src/nvtt/tools/compress.cpp index 6f06354..829f4da 100644 --- a/src/nvtt/tools/compress.cpp +++ b/src/nvtt/tools/compress.cpp @@ -134,6 +134,7 @@ int main(int argc, char *argv[]) MyAssertHandler assertHandler; MyMessageHandler messageHandler; + bool alpha = false; bool normal = false; bool color2normal = false; bool wrapRepeat = false; @@ -162,6 +163,10 @@ int main(int argc, char *argv[]) if (strcmp("-color", argv[i]) == 0) { } + else if (strcmp("-alpha", argv[i]) == 0) + { + alpha = true; + } else if (strcmp("-normal", argv[i]) == 0) { normal = true; @@ -295,13 +300,14 @@ int main(int argc, char *argv[]) printf("usage: nvcompress [options] infile [outfile]\n\n"); printf("Input options:\n"); - printf(" -color \tThe input image is a color map (default).\n"); - printf(" -normal \tThe input image is a normal map.\n"); - printf(" -tonormal\tConvert input to normal map.\n"); - printf(" -clamp \tClamp wrapping mode (default).\n"); - printf(" -repeat \tRepeat wrapping mode.\n"); - printf(" -nomips \tDisable mipmap generation.\n"); - printf(" -premula \tPremultiply alpha into color channel.\n"); + printf(" -color \tThe input image is a color map (default).\n"); + printf(" -alpha \tThe input image has an alpha channel used for transparency.\n"); + printf(" -normal \tThe input image is a normal map.\n"); + printf(" -tonormal \tConvert input to normal map.\n"); + printf(" -clamp \tClamp wrapping mode (default).\n"); + printf(" -repeat \tRepeat wrapping mode.\n"); + printf(" -nomips \tDisable mipmap generation.\n"); + printf(" -premula \tPremultiply alpha into color channel.\n"); printf(" -mipfilter \tMipmap filter. One of the following: box, triangle, kaiser.\n\n"); printf("Compression options:\n"); @@ -426,6 +432,15 @@ int main(int argc, char *argv[]) inputOptions.setWrapMode(nvtt::WrapMode_Clamp); } + if (alpha) + { + inputOptions.setAlphaMode(nvtt::AlphaMode_Transparency); + } + else + { + inputOptions.setAlphaMode(nvtt::AlphaMode_None); + } + if (normal) { setNormalMap(inputOptions);