- *_alpha.jpg)
- # handle in *.jpg case
- ;;
- *.jpg)
- if [ -f "${F%.jpg}_alpha.jpg" ]; then
- cached "$do_dds" reduce_jpeg2_dds "$F" "${F%.*}_alpha.jpg" "dds/${F%.*}.dds" "" "$dds_flags"
- cached "$do_jpeg" reduce_jpeg2_jpeg2 "$F" "${F%.*}_alpha.jpg" "$F" "${F%.*}_alpha.jpg" "$jpeg_qual_rgb" "$jpeg_qual_a"
- else
- cached "$do_dds" reduce_rgb_dds "$F" "" "dds/${F%.*}.dds" "" "$dds_flags"
- cached "$do_jpeg" reduce_jpeg_jpeg "$F" "" "$F" "" "$jpeg_qual_rgb"
+ ./sound/misc/talk*.wav) will_ogg=false ;; # engine "feature"
+ *_bump.*) will_dds=false ;;
+ ./models/player/*) will_dds=false ;;
+ ./models/sprites/*) will_dds=false ;;
+ ./models/*) ;;
+ ./textures/*) ;;
+ ./models/*) ;;
+ ./particles/*) ;;
+ ./progs/*) ;;
+ *)
+ # we can't DDS compress the 2D textures, sorry
+ # but JPEG is still fine
+ will_dds=false
+ ;;
+ esac
+
+ # 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
+
+ # for deluxemaps, lightmaps and normalmaps, enforce high jpeg quality (like on alpha channels)
+ if [ "$jqual_a" -gt "$jqual_rgb" ]; then
+ case "$f" in
+ ./maps/*/lm_[0-9][0-9][0-9][13579]) # deluxemap
+ jqual_rgb=$jqual_a
+ webp_mode=hq
+ ;;
+ ./maps/*/lm_[0-9][0-9][0-9][02468]) # lightmap
+ jqual_rgb=$jqual_a
+ webp_mode=hq
+ ;;
+ *_norm) # normalmap
+ jqual_rgb=$jqual_a
+ webp_mode=hq
+ ;;
+ esac
+ fi
+
+ pm=
+ case "$f" in
+ ./particles/particlefont) # particlefont uses premultiplied alpha
+ pm=_premul
+ ;;
+ esac
+
+ if $do_jpeg_if_not_dds; then
+ if $will_dds; then
+ will_jpeg=false
+ else
+ will_jpeg=true