00001
00002
00003
00004
00005
00006 #ifndef TRACE_ENGINE_H
00007 #define TRACE_ENGINE_H
00008
00009 #include<Image.h>
00010 #include<Scene.h>
00011
00012 #include<string>
00013 #include<time.h>
00014
00017 class TraceEngine
00018 {
00019 public:
00020 TraceEngine(unsigned int w, unsigned int h);
00021 ~TraceEngine();
00022
00023 void frames(unsigned int n) {
00024 noFrames = n;
00025 }
00026 void frameRate(float f) {
00027 rate = f;
00028 }
00029 bool open(const string &fileName);
00030 void start(unsigned int startFrame = 0);
00031
00032 private:
00033 static const int R = 5;
00034
00035 void traceLine(
00036 unsigned int h, Matrix3 &cameraOrientation, Color4 *buffer);
00037 void frame();
00038 void writeFrame();
00039 void setupRay(Vertex3 &r, unsigned int w, unsigned int h);
00040 void createFileName(string &fileName);
00041 void printTime();
00042
00043 const unsigned int width;
00044 const unsigned int height;
00045 unsigned int frameNumber;
00046 unsigned int noFrames;
00047 float rate;
00048 string sceneName;
00049 Scene scene;
00050 Image image;
00051
00052 time_t lastFrameTime;
00053 };
00054 #endif