mirror of
https://gitlab.com/xonotic/xonotic
synced 2025-01-19 12:40:57 +00:00
try to support premultiplied alpha for the particlefont
This commit is contained in:
parent
e1922f7a63
commit
0e918e479f
@ -93,6 +93,15 @@ reduce_jpeg2_dds()
|
||||
"$meprefix"compress-texture "$dds_tool" dxt5 "$tmpdir/x.tga" "$o" $1
|
||||
}
|
||||
|
||||
reduce_jpeg2_dds_premul()
|
||||
{
|
||||
i=$1; shift
|
||||
ia=$1; shift
|
||||
o=$1; shift; shift
|
||||
convert "$i" "$ia" -compose CopyOpacity -composite "$tmpdir/x.tga" && \
|
||||
"$meprefix"compress-texture "$dds_tool" dxt4 "$tmpdir/x.tga" "$o" $1
|
||||
}
|
||||
|
||||
reduce_jpeg2_jpeg2()
|
||||
{
|
||||
i=$1; shift
|
||||
@ -153,6 +162,14 @@ reduce_rgba_dds()
|
||||
"$meprefix"compress-texture "$dds_tool" dxt5 "$tmpdir/x.tga" "$o" $1
|
||||
}
|
||||
|
||||
reduce_rgba_dds_premul()
|
||||
{
|
||||
i=$1; shift; shift
|
||||
o=$1; shift; shift
|
||||
convert "$i" "$tmpdir/x.tga" && \
|
||||
"$meprefix"compress-texture "$dds_tool" dxt4 "$tmpdir/x.tga" "$o" $1
|
||||
}
|
||||
|
||||
reduce_rgba_jpeg2()
|
||||
{
|
||||
i=$1; shift; shift
|
||||
@ -244,6 +261,13 @@ for F in "$@"; do
|
||||
esac
|
||||
fi
|
||||
|
||||
pm=
|
||||
case "$f" in
|
||||
./particles/*) # deluxemap
|
||||
pm=_premul
|
||||
;;
|
||||
esac
|
||||
|
||||
if $do_jpeg_if_not_dds; then
|
||||
if $will_dds; then
|
||||
will_jpeg=false
|
||||
@ -264,22 +288,22 @@ for F in "$@"; do
|
||||
;;
|
||||
*.jpg)
|
||||
if [ -f "${f}_alpha.jpg" ]; then
|
||||
cached "$will_dds" reduce_jpeg2_dds "$F" "${f}_alpha.jpg" "dds/${f}.dds" "" "$dds_flags"
|
||||
cached "$will_jpeg" reduce_jpeg2_jpeg2 "$F" "${f}_alpha.jpg" "$F" "${f}_alpha.jpg" "$jqual_rgb" "$jqual_a"
|
||||
cached "$will_dds" reduce_jpeg2_dds$pm "$F" "${f}_alpha.jpg" "dds/${f}.dds" "" "$dds_flags"
|
||||
cached "$will_jpeg" reduce_jpeg2_jpeg2 "$F" "${f}_alpha.jpg" "$F" "${f}_alpha.jpg" "$jqual_rgb" "$jqual_a"
|
||||
else
|
||||
cached "$will_dds" reduce_rgb_dds "$F" "" "dds/${f}.dds" "" "$dds_flags"
|
||||
cached "$will_jpeg" reduce_jpeg_jpeg "$F" "" "$F" "" "$jqual_rgb"
|
||||
cached "$will_dds" reduce_rgb_dds "$F" "" "dds/${f}.dds" "" "$dds_flags"
|
||||
cached "$will_jpeg" reduce_jpeg_jpeg "$F" "" "$F" "" "$jqual_rgb"
|
||||
fi
|
||||
;;
|
||||
*.png|*.tga)
|
||||
cached true has_alpha "$F" "" "$F.hasalpha" ""
|
||||
conv=false
|
||||
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" "$jqual_rgb" "$jqual_a"
|
||||
cached "$will_dds" reduce_rgba_dds$pm "$F" "" "dds/${f}.dds" "" "$dds_flags"
|
||||
cached "$will_jpeg" reduce_rgba_jpeg2 "$F" "" "${f}.jpg" "${f}_alpha.jpg" "$jqual_rgb" "$jqual_a"
|
||||
else
|
||||
cached "$will_dds" reduce_rgb_dds "$F" "" "dds/${f}.dds" "" "$dds_flags"
|
||||
cached "$will_jpeg" reduce_rgb_jpeg "$F" "" "${f}.jpg" "" "$jqual_rgb"
|
||||
cached "$will_dds" reduce_rgb_dds "$F" "" "dds/${f}.dds" "" "$dds_flags"
|
||||
cached "$will_jpeg" reduce_rgb_jpeg "$F" "" "${f}.jpg" "" "$jqual_rgb"
|
||||
fi
|
||||
rm -f "$F.hasalpha"
|
||||
;;
|
||||
|
@ -12,6 +12,23 @@ dst=$1; shift
|
||||
|
||||
c=
|
||||
f=
|
||||
fourcchack=
|
||||
case "$tool" in
|
||||
compressonator-dxtc)
|
||||
;;
|
||||
*)
|
||||
case "$format" in
|
||||
dxt2)
|
||||
fourcchack=DXT2
|
||||
format=dxt3
|
||||
;;
|
||||
dxt4)
|
||||
fourcchack=DXT4
|
||||
format=dxt5
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
case "$tool" in
|
||||
compressonator-dxtc|compressonator-atic)
|
||||
case "$tool" in
|
||||
@ -20,7 +37,9 @@ case "$tool" in
|
||||
esac
|
||||
case "$format" in
|
||||
dxt1) f="+fourCC DXT1" ;;
|
||||
dxt2) f="+fourCC DXT2" ;;
|
||||
dxt3) f="+fourCC DXT3" ;;
|
||||
dxt4) f="+fourCC DXT4" ;;
|
||||
dxt5) f="+fourCC DXT5" ;;
|
||||
esac
|
||||
dir=`mktemp -d "$HOME/.wine/drive_c/compressonator.XXXXXX"`
|
||||
@ -47,3 +66,8 @@ case "$tool" in
|
||||
nvcompress $f "$@" "$src" "$dst"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$fourcchack" ]; then
|
||||
# use dd to hack in the right FOURCC
|
||||
echo -n "$fourcchack" | dd of="$dst" bs=1 count=4 seek=84
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user