#!/bin/bash

SIZE=960
FRAME=0
RESULT=0
QUALITY=HIGH

if [ "$1" != "" ] && [ $1 > 0 ]
then
	SIZE=$1
fi

if [ "$2" != "" ]
then
	QUALITY=$2
fi

until [ $RESULT != 0 ]
do
	echo -ne "Frame $FRAME...\t\t"
	./plot-3d.r $FRAME $SIZE $QUALITY
	RESULT=$?
	FRAME=$(($FRAME + 1))
done

echo "DONE (return code = $RESULT)!"
