#! /bin/csh -f
# Last edited on 2004-11-16 17:45:48 by stolfi

set usage = "$0 RA..."

# Re-generates the images for MC930 animated homework hand-ins.
# Arguments are RA numbers of students to process.
# For each student, expects to find the file 
#   ${ra}/main.pov - the student's orignal main POV-ray file.
#   ${ra}/Makefile - homework-specific "rebuild" Makefile (us. link).
# (Re)generates the files
#   ${ra}/main-0.0000{,-i}.png - First frame and icon
#   ${ra}/main-0.5000{,-i}.png - Middle frame and icon
#   ${ra}/main-1.0000{,-i}.png - Last frame and icon
#   ${ra}/main-m.gif - Animated gif with movie
#   ${ra}/main-s.png - Strip with sample frames
#   

if ( $#argv < 1 ) then
  echo "usage: ${usage}"; exit 1
endif

set ras = ( $* )

set path = ( . $path )

set povfile = "main.pov"

foreach ra ( ${ras} )
  # Ckeck if the POV-ray source exists.
  # If so, re-build the image 
  if ( -r ${ra}/${povfile} ) then
    echo "=== (re)building images in ${ra} ===================="
    ( cd ${ra} && make first middle last strip movie; echo " " )
    echo "=== done rebuilding ${ra} =============================="
  else
    echo "${ra}/main.pov does not exist"
  endif
end