#!/bin/bash


source ./config.sh
source ./fonctions.sh

DDIR="frames/hilevel"
DSTOPT="/dev/shm/hilevel-altitude.png"
MIXED="/dev/shm/mixed.fimg"

message 0 "Hilevel ? Really ?"

# ---------------------------------------------------------

DEBUT=$(date +'%s')

for i in $( seq 0 $((NBIMG - 1)) )
do

	dst=$(printf "%s/%05d.png" $DDIR $i)
	tag=$(printf "%03o %5d" 			\
			$i $(($(date +'%s')-$DEBUT )) )
	echo $dst $tag

	j=$(( i * 2 ))
	fimg=$(printf "%s/%04d.fimg" $SILO $i )
	fimgops -v -k 0.250 relief.fimg ${fimg} mix ${MIXED}
	fimg2pnm -v -g ${MIXED} WS/mixed.pgm

	povray -ihilevel +K$i ${POVOPT} -o${DSTOPT} 2> /dev/null

	convert   $DSTOPT					\
			-font		Courier-Bold		\
			-fill		${COLTXT_A}		\
			-pointsize	32			\
			-annotate +88+35 "${tag}"		\
			$dst

	sleep 5

done
echo "Encoding now..." ; echo
exec ./encode.sh   "$DDIR"   "hilevel-hf.mp4"
