00001 #ifndef RENDERER_H 00002 #define RENDERER_H 00003 00004 #include <string> 00005 #include <pthread.h> 00006 00007 #include "Scene.h" 00008 00009 00010 class Camera; 00011 class SampleGenerator; 00012 class Image; 00013 class CameraAnimator; 00014 00015 00021 class Renderer 00022 { 00023 public: 00028 Renderer(const std::string & filename); 00029 00030 ~Renderer(); 00031 00032 void buildScene(); 00033 00036 void buildScene(const std::string & sceneFile); 00037 00038 void render(); 00039 00042 void renderAnimated(); 00043 00046 void setupAnimation(std::string filename, unsigned int startframe = 0, unsigned int endframe = FRAMES); 00047 00054 int setupSupersampling(int samples); 00055 00060 void physicsLoad(const std::string & file) 00061 { 00062 mScene.physicsLoad(file); 00063 } 00064 00069 void physicsSave(const std::string & file) 00070 { 00071 mScene.physicsDump(file); 00072 } 00073 00074 private: 00075 Camera * mCamera; 00076 bool mSupersampled; 00077 int mSampleCount; 00078 SampleGenerator * mSampler; 00079 Scene mScene; 00080 std::string mFileName; 00081 CameraAnimator* mCameraAnimator; 00082 unsigned int mStartFrame; 00083 unsigned int mEndFrame; 00084 00088 struct ThreadArgs 00089 { 00090 int mStartY; 00091 int mStopY; 00092 bool mSupersampled; 00093 int mSampleCount; 00094 Image * mImage; 00095 Camera* mCamera; 00096 Scene * mScene; 00097 SampleGenerator* mSampler; 00098 }; 00099 00104 static void* renderFromTo(void*); 00105 00108 void buildTestScene(); 00109 }; 00110 00111 #endif 00112