#ifndef MOVIEH #define MOVIEH #include #include #include "picture.h" using namespace std; class putable; class movie { const int delay; //in hundreths of a second void write(ostream& ost, bool direction) const; void write_to_file(const char *outfilename, const char *comment, bool direction) const; public: const int nframes; vector v; static const int fs = 20; //frames per second static const int nf = fs * 3 / 2; //number of frames template movie(const ANIMATE1 *view, const ANIMATE2 *dir, const ANIMATE3 *dist, int initial_nframes = nf, int initial_delay = 100 / fs) : nframes(initial_nframes), delay(initial_delay), v(nframes) { for (vector::iterator it = v.begin(); it != v.end(); ++it) { it->frameno = it - v.begin(); it->nframes = nframes; it->viewpoint = (*view)(it->frameno, it->nframes); it->direction = (*dir )(it->frameno, it->nframes); it->d = (*dist)(it->frameno, it->nframes); } } movie(const picture& begin, const picture& end, int nframes = fs * 3 / 2, int delay = 100 / fs); friend movie& operator<<(movie& m, const putable& p); friend ostream& operator<<(ostream& ost, const movie& m); void write(const char *outfilename, const char *begin = "", const char *end = "") const; }; #endif