2022-02-06 23:45:08 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# how to run this mess in a batch style
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2022-02-18 19:30:10 +01:00
|
|
|
INCFILE="WS/bloubs.inc"
|
2022-02-06 23:45:08 +01:00
|
|
|
TMPPNG="/dev/shm/bloubs7.png"
|
2024-01-30 13:32:43 +01:00
|
|
|
POVOPT="+Q9 +a -v -d -W1024 -H768 -WT2"
|
2022-03-18 12:21:40 +01:00
|
|
|
DDIR="frames/a"
|
2022-02-07 01:50:49 +01:00
|
|
|
LOGERR="log.error"
|
2024-01-30 13:32:43 +01:00
|
|
|
TXTCOLOR="#db4090"
|
2022-02-06 23:45:08 +01:00
|
|
|
|
2024-01-29 05:25:08 +01:00
|
|
|
BLOUBDATAS="WS/bloubs.data"
|
|
|
|
BARYDATAS="WS/log.barycentres"
|
|
|
|
|
2022-02-16 15:59:42 +01:00
|
|
|
# --- put the work file in ramdisk
|
2022-02-09 19:51:42 +01:00
|
|
|
BLBS_IN="/dev/shm/in.blbs"
|
|
|
|
BLBS_OUT="/dev/shm/out.blbs"
|
|
|
|
|
2024-01-28 00:06:57 +01:00
|
|
|
NBIMG=2000
|
2022-02-08 18:56:51 +01:00
|
|
|
|
2022-02-06 23:45:08 +01:00
|
|
|
make all
|
|
|
|
err=$?
|
|
|
|
if [ $err -ne 0 ] ; then
|
2022-02-09 19:51:42 +01:00
|
|
|
echo 'make error code is = ' $err
|
2022-02-06 23:45:08 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2022-02-07 02:09:54 +01:00
|
|
|
|
2022-02-18 19:30:10 +01:00
|
|
|
printf "\n#declare NbImg = %d;\n" $NBIMG > WS/nbimg.inc
|
2022-02-08 18:56:51 +01:00
|
|
|
|
2022-02-06 23:45:08 +01:00
|
|
|
#
|
|
|
|
# first, we have to make a seminal buch of bloubs
|
2022-02-16 15:59:42 +01:00
|
|
|
# --> this function need to be parametrizable
|
2022-02-06 23:45:08 +01:00
|
|
|
#
|
2024-01-30 13:32:43 +01:00
|
|
|
./genbloubs ${BLBS_IN} 666
|
2022-02-06 23:45:08 +01:00
|
|
|
|
2022-03-18 12:21:40 +01:00
|
|
|
for idx in $(seq 0 $((NBIMG-1)) )
|
2022-02-06 23:45:08 +01:00
|
|
|
do
|
|
|
|
|
2024-01-30 13:32:43 +01:00
|
|
|
echo "================= run passe $idx ===================="
|
2022-02-06 23:45:08 +01:00
|
|
|
|
2024-01-28 00:06:57 +01:00
|
|
|
# make the bloubs's data readable by POVray
|
|
|
|
#
|
2024-01-29 05:25:08 +01:00
|
|
|
./exportbloubs ${BLBS_IN} > $BLOUBDATAS
|
|
|
|
awk -f toinc.awk < $BLOUBDATAS > $INCFILE
|
|
|
|
awk '{ print $1, $2, $3 }' < $BLOUBDATAS > $BARYDATAS
|
2022-02-06 23:45:08 +01:00
|
|
|
|
2024-01-28 00:06:57 +01:00
|
|
|
echo "### raytracing pass $idx"
|
|
|
|
|
2022-02-07 01:50:49 +01:00
|
|
|
povray -Iscene.pov -K${idx} -O${TMPPNG} ${POVOPT} 2> $LOGERR
|
2022-02-08 02:53:49 +01:00
|
|
|
if [ 0 -ne $? ] ; then
|
|
|
|
tail -15 $LOGERR
|
2024-01-25 21:44:49 +01:00
|
|
|
sleep 90
|
2022-02-08 02:53:49 +01:00
|
|
|
fi
|
|
|
|
|
2024-01-30 13:32:43 +01:00
|
|
|
td=$(date -u +'%F %R' | tr '01' 'ol')
|
2024-01-28 00:06:57 +01:00
|
|
|
hi=$(printf "#%04d" $idx | tr '01' 'ol')
|
2024-01-30 13:32:43 +01:00
|
|
|
count=$(tail -1 "WS/log.nb_bloubs" | tr '01' 'ol')
|
2022-02-18 19:30:10 +01:00
|
|
|
|
2022-02-06 23:45:08 +01:00
|
|
|
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
|
|
|
|
|
|
|
|
convert ${TMPPNG} \
|
2022-02-11 10:23:13 +01:00
|
|
|
-font Courier-Bold \
|
2024-01-30 13:32:43 +01:00
|
|
|
-pointsize 32 \
|
2022-03-18 23:41:42 +01:00
|
|
|
-fill "$TXTCOLOR" \
|
2022-02-06 23:45:08 +01:00
|
|
|
-gravity south-east \
|
2022-03-18 12:21:40 +01:00
|
|
|
-annotate +25+5 "$td" \
|
2022-02-09 19:51:42 +01:00
|
|
|
-gravity south-west \
|
2022-03-18 12:21:40 +01:00
|
|
|
-annotate +25+5 "$hi" \
|
2022-02-18 19:30:10 +01:00
|
|
|
-gravity north-east \
|
2022-03-25 22:42:15 +01:00
|
|
|
-annotate +45+5 "$count" \
|
2022-03-18 12:21:40 +01:00
|
|
|
-gravity north-west \
|
2022-03-25 22:42:15 +01:00
|
|
|
-annotate +45+5 "BloubWorld" \
|
2022-02-06 23:45:08 +01:00
|
|
|
$PNG
|
|
|
|
|
2022-02-07 01:50:49 +01:00
|
|
|
echo $PNG '[done]'
|
2022-02-06 23:45:08 +01:00
|
|
|
|
2022-02-09 19:51:42 +01:00
|
|
|
./movebloubs ${BLBS_IN} ${BLBS_OUT}
|
2022-03-25 22:42:15 +01:00
|
|
|
./mergebloubs ${BLBS_OUT} ${BLBS_IN}
|
|
|
|
# mv ${BLBS_OUT} ${BLBS_IN}
|
|
|
|
|
2024-01-28 00:06:57 +01:00
|
|
|
echo "### run done"
|
2024-01-30 13:32:43 +01:00
|
|
|
sleep 5
|
2022-02-06 23:45:08 +01:00
|
|
|
|
|
|
|
done
|
|
|
|
|
2022-02-07 01:50:49 +01:00
|
|
|
rm $LOGERR
|
2022-02-06 23:45:08 +01:00
|
|
|
|
2022-02-16 15:59:42 +01:00
|
|
|
nice ./encode.sh
|
2022-02-06 23:45:08 +01:00
|
|
|
|
|
|
|
|