#!/usr/bin/perl
#hfcliffs.pl by taudas@nthstone.mi.org 11/1994
#base perl script by unknown (erik anderson?) from pov-list maillist.

&setup;
$steps = 99;
$pi = 3.141592654;
for($t=1;$t<$steps;++$t) {
    $y = $t*-0.0015;
    $z = $t*0.03;
    &savecamera;
    &tracestep($t);
}

sub setup {
    open(SETUP,">hfcliffs.def") || die("cannot open setup for write.\n");
    print SETUP <<"END_OF_SETUP";
+d +v1 +ft +a0.3 -w200 -h200 -linclude
END_OF_SETUP
    close(SETUP);
}

sub savecamera {
    open(CAMERA,">hfcliffs.inc") || die("No open camera for write?\n");
    print CAMERA <<"END_OF_CAMERA";
declare YLoc = $y
declare ZLoc = $z
END_OF_CAMERA
    close(CAMERA);
}

sub tracestep {
    print "Tracing step $_[0]\n";
    system("povray -ihfcliffs.pov -ohfcliffs$_[0].tga    +c +k0 hfcliffs.def");
    system("povray -ihfcliffs.pov -ohfcliffs$_[0].r.tga  +c +k1 hfcliffs.def");
    system("mkstereo hfcliffs$_[0] 160");
    system("rm hfcliffs$_[0]*a");	
}
