#!/bin/bash -e

rm -r -f /tmp/fracplanet
mkdir /tmp/fracplanet
cp $1 /tmp/fracplanet/
cd /tmp/fracplanet/

tar xvfz $1

if ! test -d ./fracplanet ; then echo "*** Un-tar failed" ; exit ; fi
cd ./fracplanet

./BUILD

echo "Please save xxx.pov for PovRay, xxx.py for Blender, then quit"

if ! test -s ./fracplanet ; then echo "*** Build failed" ; exit ; fi
./fracplanet

echo "Checking POV-Ray"
povray -Q9 -geometry 768x576 xxx.pov

echo "Checking Blender"
blender -w -p 100 100 800 800 -P xxx.py

