]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/compress-texture
make the fourcchack actually work for nonsupporting compressors
[xonotic/xonotic.git] / misc / tools / compress-texture
index 36aa0281cbb85a3c153890c6007508649a8bb93f..93d5c49404b45a1a52d5c72ac071062a63618cd6 100755 (executable)
@@ -12,6 +12,7 @@ dst=$1; shift
 
 c=
 f=
+
 fourcchack=
 case "$tool" in
        compressonator-dxtc)
@@ -29,6 +30,13 @@ case "$tool" in
                esac
                ;;
 esac
+
+if [ -n "$fourcchack" ]; then
+       fourcchack_dir=`mktemp -d`
+       convert "$src" -fx "u*u.a" "$fourcchack_dir/src.$ext"
+       src="$fourcchack_dir/src.$ext"
+fi
+
 case "$tool" in
        compressonator-dxtc|compressonator-atic)
                case "$tool" in
@@ -70,4 +78,5 @@ esac
 if [ -n "$fourcchack" ]; then
        # use dd to hack in the right FOURCC
        echo -n "$fourcchack" | dd of="$dst" bs=1 count=4 seek=84
+       rm -rf "$fourcchack_dir"
 fi