30 lines
662 B
Bash
Executable File
30 lines
662 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
BASEDIR=$(dirname "$0")
|
|
TARGETDIR="$BASEDIR/../content/textures"
|
|
TMPDIR=$(mktemp -d -t dds.build.XXX)
|
|
CP=${CP:="CompressonatorCLI"}
|
|
PACK=${PACK:="1024-realistic"}
|
|
|
|
function compile {
|
|
tmp="$TMPDIR/$(basename -- $1).png"
|
|
convert -colorspace SRGB -- "$BASEDIR/$1" $tmp
|
|
$CP -fd BC3 -miplevels $3 $tmp "$TARGETDIR/$2" &> /dev/null
|
|
rm $tmp
|
|
echo $2
|
|
}
|
|
compile "Aim.png" "ui/Aim.dds" 1
|
|
|
|
while read from to
|
|
do
|
|
if [ -f "$BASEDIR/$PACK/$from" ]; then
|
|
compile "$PACK/$from" "$PACK/$to" 20
|
|
else
|
|
echo "File not found: $from" >&2
|
|
exit 1
|
|
fi
|
|
|
|
done < "$BASEDIR/$PACK/index.txt"
|
|
|
|
rmdir $TMPDIR
|
|
echo "Done" |