X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=blobdiff_plain;f=misc%2Ftools%2Fcompress-texture;h=418d8e5c40afa401ff93d9e42771008fd7708dd9;hp=9e3b58e5e26719f9d25a33644ba43f58c198cf88;hb=HEAD;hpb=e6785c973c61cb822940111a2846b8163c58222b diff --git a/misc/tools/compress-texture b/misc/tools/compress-texture index 9e3b58e5..9d4fcc13 100755 --- a/misc/tools/compress-texture +++ b/misc/tools/compress-texture @@ -17,8 +17,8 @@ f= fourcchack= case "$tool" in - compressonator-dxtc) - # we still have to preprocess the image to premultiply alpha, as it seems + compressonator-dxtc|crunch) + # We still have to preprocess the image to premultiply alpha, as it seems case "$format" in dxt2) fourcchack=DXT2 @@ -30,7 +30,8 @@ case "$tool" in ;; esac ;; - *) + compressonator-atic|nvcompress|s2tc) + # These tools don't support DXT2/4 at all. case "$format" in dxt2) fourcchack=DXT2 @@ -42,11 +43,14 @@ case "$tool" in ;; esac ;; + *) + echo >&2 "Please figure out the DXT2/DXT4 story for $tool." + ;; esac if [ -n "$fourcchack" ]; then fourcchack_dir=`mktemp -d` - convert "$src" -fx "u*u.a" -type TrueColorMatte "$fourcchack_dir/src.$ext" + convert "$src" -auto-orient -fx "u*u.a" -type TrueColorMatte "$fourcchack_dir/src.$ext" src="$fourcchack_dir/src.$ext" fi @@ -93,6 +97,16 @@ case "$tool" in esac s2tc_compress $f "$@" -i "$src" -o "$dst" ;; + crunch) + case "$format" in + dxt1) f="-DXT1" ;; + dxt2) f="-DXT2" ;; + dxt3) f="-DXT3" ;; + dxt4) f="-DXT4" ;; + dxt5) f="-DXT5" ;; + esac + crunch $f "$@" -noprogress -nostats -quality 255 -mipMode Generate -dxtQuality uber $CRUNCH_TEXTYPEFLAGS -file "$src" -out "$dst" + ;; esac if [ -n "$fourcchack" ]; then