Fortraneries/BloubWorld/runme.sh

75 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
#
# how to run this mess in a batch style
#
INCFILE="bloubs.inc"
TMPPNG="/dev/shm/bloubs7.png"
POVOPT="+Q9 +a -v -d -W920 -H600"
DDIR="frames"
LOGERR="log.error"
NBIMG=3000
make all
err=$?
if [ $err -ne 0 ] ; then
echo 'make error = ' $err
exit 1
fi
printf "\n#declare NbImg = %d;\n" $NBIMG > nbimg.inc
#
# first, we have to make a seminal buch of bloubs
# --> this function need to be paraletrizable
#
./genbloubs in.blbs 6000
for idx in $(seq 0 $NBIMG)
do
echo "======== run passe $idx ========="
./exportbloubs in.blbs | awk -f toinc.awk > $INCFILE
povray -Iscene.pov -K${idx} -O${TMPPNG} ${POVOPT} 2> $LOGERR
if [ 0 -ne $? ] ; then
tail -15 $LOGERR
sleep 30
else
grep "Trace Time" $LOGERR
fi
td=$(date +'%F %R:%S')
txt=$(printf "%5d %s" $idx "${td}")
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
echo "$txt" | tee -a log.txt
convert ${TMPPNG} \
-font fixed \
-pointsize 20 \
-fill Yellow \
-gravity south-east \
-annotate +15+10 "$txt" \
$PNG
echo $PNG '[done]'
./movebloubs in.blbs out.blbs
mv out.blbs in.blbs
echo
done
rm $LOGERR
convert -delay 10 -resize 50% -colors 192 \
$DDIR/????[0]*.png foo.gif
./encode.sh