X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=misc%2Ftools%2Fcompress-texture;h=9e3b58e5e26719f9d25a33644ba43f58c198cf88;hb=4995b9b8da0ecb49ef107b287309bbae18671d68;hp=efacb863c21a4c11568bc90b96b8fbe172c33470;hpb=91db13f951e136707b596bcfe3132d077e78bef3;p=xonotic%2Fxonotic.git diff --git a/misc/tools/compress-texture b/misc/tools/compress-texture index efacb863..9e3b58e5 100755 --- a/misc/tools/compress-texture +++ b/misc/tools/compress-texture @@ -10,6 +10,8 @@ format=$1; shift src=$1; shift dst=$1; shift +ext=${src##*.} + c= f= @@ -44,7 +46,7 @@ esac if [ -n "$fourcchack" ]; then fourcchack_dir=`mktemp -d` - convert "$src" -fx "u*u.a" "$fourcchack_dir/src.$ext" + convert "$src" -fx "u*u.a" -type TrueColorMatte "$fourcchack_dir/src.$ext" src="$fourcchack_dir/src.$ext" fi @@ -63,7 +65,6 @@ case "$tool" in 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 :( @@ -84,10 +85,18 @@ case "$tool" in 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" + ;; 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 + echo -n "$fourcchack" | dd of="$dst" bs=1 count=4 seek=84 conv=notrunc rm -rf "$fourcchack_dir" fi