Parallel minetestmapper execution → a lot faster,

fix geometry setting and
abort if minetestmapper isn't found to avoid spamming
This commit is contained in:
HybridDog 2016-01-17 14:14:44 +01:00
parent 3941527d18
commit 22016c4182

View File

@ -4,10 +4,19 @@ MAPDIR=$1
SPAWNPOS=$2 SPAWNPOS=$2
DIMENSIONS=$3 DIMENSIONS=$3
echo "map dir set to "$MAPDIR
if [ -z $MAPPERDIR ]; then if [ -z $MAPPERDIR ]; then
MAPPERDIR=. MAPPERDIR=.
fi fi
MAPPERDIR=$MAPPERDIR/minetestmapper
if [ ! -e $MAPPERDIR ]; then
echo "error, "$MAPPERDIR" doesn't exist."
exit
fi
scriptdir=`readlink -f $0` scriptdir=`readlink -f $0`
scriptdir=`dirname $scriptdir` scriptdir=`dirname $scriptdir`
@ -31,8 +40,17 @@ do
do do
posx=$(($spawnx+$tilesize*($x-$tilenum/2))) posx=$(($spawnx+$tilesize*($x-$tilenum/2)))
posy=$(($spawny+$tilesize*($tilenum/2-$y))) posy=$(($spawny+$tilesize*($tilenum/2-$y)))
$MAPPERDIR/minetestmapper ${MAPPERPARAMS} -i ${MAPDIR} --geometry ${posx},${posy}+${tilesize}+${tilesize} -o ${tiledir}/20/map_${x}_${y}.png $MAPPERDIR ${MAPPERPARAMS} -i ${MAPDIR} --geometry ${posx}:${posy}+${tilesize}+${tilesize} -o ${tiledir}/20/map_${x}_${y}.png &
done done &
done
delay=0
while [ $(ps -C minetestmapper | wc -l) != 1 ]
do
#minetestmappers are unfinished
sleep 1
delay=$(($delay+1))
echo $delay" seconds slept waiting for minetestmapper"
done done
#join the images and make them smaller #join the images and make them smaller