mirror of
https://gitlab.com/xonotic/xonotic
synced 2025-01-23 06:23:16 +00:00
41 lines
1010 B
Bash
Executable File
41 lines
1010 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# usage: compress-texture tool compression in.png out.dds
|
|
# example: compress-texture compressonator dxt1 foo.jpg foo.dds
|
|
|
|
tool=$1; shift
|
|
format=$1; shift
|
|
src=$1; shift
|
|
dst=$1; shift
|
|
|
|
c=
|
|
f=
|
|
case "$tool" in
|
|
compressonator-dxtc|compressonator-atic)
|
|
case "$tool" in
|
|
*-dxtc) c="-codec DXTC.dll" ;;
|
|
*-atic) c="-codec ATICompressor.dll" ;;
|
|
esac
|
|
case "$format" in
|
|
dxt1) f="+fourCC DXT1" ;;
|
|
dxt3) f="+fourCC DXT3" ;;
|
|
dxt5) f="+fourCC DXT5" ;;
|
|
esac
|
|
dir=`mktemp -d "$HOME/.wine/drive_c/compressonator.XXXXXX"`
|
|
dir_dos="C:/${dir##*/}"
|
|
ext=${src##*.}
|
|
cp "$src" "$dir/src.$ext"
|
|
DISPLAY= wine "$HOME/.wine/drive_c/Program Files/AMD/The Compressonator 1.50/TheCompressonator.exe" -convert -mipmaps "$dir_dos/src.$ext" "$dir_dos/dst.dds" $c $f "$@" -mipper BoxFilter.dll
|
|
mv "$dir/dst.dds" "$dst"
|
|
rm -rf "$dir"
|
|
;;
|
|
nvcompress)
|
|
case "$format" in
|
|
dxt1) f="-bc1" ;;
|
|
dxt3) f="-alpha -bc3" ;;
|
|
dxt5) f="-alpha -bc5" ;;
|
|
esac
|
|
nvcompress $f "$@" "$src" "$dst"
|
|
;;
|
|
esac
|