src=$1; shift
dst=$1; shift
+ext=${src##*.}
+
c=
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
;;
esac
;;
- *)
+ compressonator-atic|nvcompress|s2tc)
+ # These tools don't support DXT2/4 at all.
case "$format" in
dxt2)
fourcchack=DXT2
;;
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" "$fourcchack_dir/src.$ext"
+ convert "$src" -auto-orient -fx "u*u.a" -type TrueColorMatte "$fourcchack_dir/src.$ext"
src="$fourcchack_dir/src.$ext"
fi
esac
dir=`mktemp -d "$HOME/.wine/drive_c/compressonator.XXXXXX"`
dir_dos="C:/${dir##*/}"
- ext=${src##*.}
cp "$src" "$dir/src.$ext"
# compressonator and wine suck, so we sometimes have to retry :(
esac
nvcompress $f "$@" "$src" "$dst"
;;
+ s2tc)
+ case "$format" in
+ dxt1) f="-t DXT1" ;;
+ dxt3) f="-t DXT3" ;;
+ dxt5) f="-t DXT5" ;;
+ 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