X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=misc%2Ftools%2Fcached-converter.sh;h=ec976351921dcd0329a86710e2ea5a8f379a1f80;hb=382234971681efd4f91ac7211cc9bf40f39ba0dc;hp=b4fafee88ca1d7dc23e6f1ea26ec649ddeb86e7e;hpb=c6b9c744e52329d5f21d4afc47ef50cc12460648;p=xonotic%2Fxonotic.git diff --git a/misc/tools/cached-converter.sh b/misc/tools/cached-converter.sh index b4fafee8..ec976351 100755 --- a/misc/tools/cached-converter.sh +++ b/misc/tools/cached-converter.sh @@ -14,7 +14,7 @@ set -e : ${webp_flags_alq:=-lossless -q 100 -q_alpha 100} : ${webp_flags_ahq:=-lossless -q 100 -q_alpha 100} : ${do_dds:=true} -: ${dds_tool:=compressonator-dxtc} +: ${dds_tool:=s2tc} : ${do_ogg:=false} : ${ogg_ogg:=true} : ${ogg_qual:=2} @@ -209,7 +209,7 @@ reduce_jpeg2_dds() { i=$1; shift ia=$1; shift - o=$1; shift; shift + o=$1; shift; shift convert "$i" "$ia" -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.tga" && \ pickdxta "$dds_tool" "$dds_sepalpha" "$tmpdir/x.tga" "$o" $1 } @@ -218,7 +218,7 @@ reduce_jpeg2_dds_premul() { i=$1; shift ia=$1; shift - o=$1; shift; shift + o=$1; shift; shift convert "$i" "$ia" -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.tga" && \ pickdxta "$dds_tool" "$dds_prealpha" "$tmpdir/x.tga" "$o" $1 } @@ -375,13 +375,13 @@ for F in "$@"; do will_dds=$do_dds will_ogg=$do_ogg if ! $ogg_ogg; then - case "$f" in + case "$F" in *.ogg) will_ogg=false ;; esac fi - case "$f" in - ./sounds/misc/talk*.wav) will_ogg=false ;; # engine "feature" - *_bump) will_dds=false ;; + case "$F" in + ./sound/misc/talk*.wav) will_ogg=false ;; # engine "feature" + *_bump.*) will_dds=false ;; ./models/player/*) will_dds=false ;; ./models/sprites/*) will_dds=false ;; ./models/*) ;; @@ -396,17 +396,31 @@ for F in "$@"; do ;; esac - # configure S2TC + # Specific hacks for normalmaps. case "$f" in + ./maps/*/lm_[0-9][0-9][0-9][13579]) # deluxemap + export S2TC_COLORDIST_MODE=NORMALMAP + export S2TC_RANDOM_COLORS=256 + export S2TC_REFINE_COLORS=LOOP + export S2TC_DITHER_MODE=NONE + # Engine ignores alpha channel on these, so we can use the DXT1 black encoding. + export CRUNCH_TEXTYPEFLAGS='-gamma 1.0 -renormalize -rtopmip -uniformMetrics -usetransparentindicesforblack' + ;; *_norm) export S2TC_COLORDIST_MODE=NORMALMAP export S2TC_RANDOM_COLORS=256 export S2TC_REFINE_COLORS=LOOP + export S2TC_DITHER_MODE=NONE + # Alpha channel here means height. + export CRUNCH_TEXTYPEFLAGS='-gamma 1.0 -renormalize -rtopmip -uniformMetrics' ;; *) export S2TC_COLORDIST_MODE=SRGB_MIXED export S2TC_RANDOM_COLORS=64 export S2TC_REFINE_COLORS=LOOP + export S2TC_DITHER_MODE=FLOYDSTEINBERG + # Color channel-like images - consider as sRGB. + export CRUNCH_TEXTYPEFLAGS='-gamma 2.2' ;; esac