: ${CACHEDIR:=$HOME/.xonotic-cached-converter}
: ${do_jpeg:=true}
+: ${do_jpeg_if_not_dds:=false}
: ${jpeg_qual_rgb:=95}
: ${jpeg_qual_a:=99}
: ${do_dds:=true}
echo >&2 "Handling $F..."
conv=false
keep=false
+
will_jpeg=$do_jpeg
will_dds=$do_dds
case "$F" in
- textures/*) ;;
- models/*) ;;
- maps/*/*) ;;
+ ./textures/*) ;;
+ ./models/*) ;;
+ ./maps/*/*) ;;
*)
# we can't DDS compress the 2D textures, sorry
# but JPEG is still fine
will_dds=false
;;
esac
+
+ if $do_jpeg_if_not_dds; then
+ if $will_dds; then
+ will_jpeg=false
+ else
+ will_jpeg=true
+ fi
+ fi
+
case "$F" in
*_alpha.jpg)
# handle in *.jpg case
if [ -s "$F.hasalpha" ]; then
cached "$will_dds" reduce_rgba_dds "$F" "" "dds/${F%.*}.dds" "" "$dds_flags"
cached "$will_jpeg" reduce_rgba_jpeg2 "$F" "" "${F%.*}.jpg" "${F%.*}_alpha.jpg" "$jpeg_qual_rgb" "$jpeg_qual_a"
- rm -f "$F" # TGA becomes useless after JPEGging
else
cached "$will_dds" reduce_rgb_dds "$F" "" "dds/${F%.*}.dds" "" "$dds_flags"
cached "$will_jpeg" reduce_rgb_jpeg "$F" "" "${F%.*}.jpg" "" "$jpeg_qual_rgb"
- rm -f "$F" # TGA becomes useless after JPEGging
fi
rm -f "$F.hasalpha"
;;