3 # Render crosshairs from gfx/crosshair*.svg to DATADIR/gfx/crosshair*.tga,
4 # if they are newer than their target tga file.
7 # To compensate for filter rendering errors and to reduce rbg noise,
8 # the svg files are rendered at a large size and then scaled down.
11 # rsvg-convert (librsvg)
12 # convert (imagemagick)
15 # ./render-svg.sh DATADIR
18 # ./render-crosshairs.sh ~/.xonotic/data
23 echo "Usage: $0 DATADIR"
33 for svg in gfx/*.svg; do
36 tga="$data/${svg%.*}.tga"
38 if [ "$ext" = "svg" ] && [ -f "$svg" ] && [ "$svg" -nt "$tga" ]; then
41 w=$(identify -format "%w" "$svg")
42 h=$(identify -format "%h" "$svg")
43 scale=$(echo "s=sqrt($maxPixels/$w/$h);if(s>$maxScale)s=$maxScale;s" | bc)
46 rsvg-convert -z "$scale" "$svg" | convert - -scale "$w" "$tga"