Renderer.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  Renderer
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       Abstract rendering engine which attempts to evaluate a rendering 
00009    equation over a given 2D domain (the film plane) and pipes its output 
00010    to an equally abstract RenderOutput (generally an image wrapper, but 
00011    allowing for distributed rendering)
00012    <!-------------------------------------------------------------------->**/
00013 
00014 #ifndef RENDERER_H_
00015 #define RENDERER_H_
00016 
00017 #include <utils/PropertyMap.h>
00018 #include <utils/SpectralSampleSet.h>
00019 #include <utils/Timer.h>
00020 
00021 class DirectIllumination;
00022 class Camera;
00023 class Scene;
00024 
00025 class Renderer : public PropertyMap {
00026    public:
00027       ///@name Constructors
00028       //@{-----------------------------------------------------------------
00029       
00030       inline Renderer(Camera *camera = NULL, Scene *scene = NULL)
00031          : PropertyMap(), m_camera(camera), m_scene(scene), m_initted(false), 
00032            m_directIllumination(NULL)
00033       { }
00034       
00035       virtual ~Renderer();
00036       
00037       
00038       //@}-----------------------------------------------------------------
00039       ///@name Initialization routines
00040       //@{-----------------------------------------------------------------
00041       
00042       /**
00043        * @brief
00044        *    Performs any initialization which may be necessary before 
00045        * beginning to render the underlying scene
00046        * 
00047        * @note
00048        *    Default implementation ensures we have a valid scene and camera
00049        * and calls init on both of them respectively
00050        */
00051       virtual void init();
00052       
00053       
00054       //@}-----------------------------------------------------------------
00055       ///@name Main usage interface
00056       //@{-----------------------------------------------------------------
00057       
00058       /**
00059        * Renders the underlying scene
00060        */
00061       virtual void render() = 0;
00062       
00063       
00064       //@}-----------------------------------------------------------------
00065       ///@name Accessors / Mutators
00066       //@{-----------------------------------------------------------------
00067       
00068       inline Camera *getCamera() {
00069          return m_camera;
00070       }
00071       
00072       inline void setCamera(Camera *camera) {
00073          m_camera = camera;
00074       }
00075       
00076       inline Scene *getScene() {
00077          return m_scene;
00078       }
00079       
00080       inline void setScene(Scene *scene) {
00081          m_scene = scene;
00082       }
00083       
00084       virtual bool supportsOpenGL() {
00085          return false;
00086       }
00087       
00088       inline DirectIllumination *getDirectIllumination() {
00089          return m_directIllumination;
00090       }
00091       
00092       inline const Timer &getTimer() const {
00093          return m_timer;
00094       }
00095       
00096       virtual std::string getElapsedTime() const;
00097       
00098       
00099       //@}-----------------------------------------------------------------
00100       
00101    protected:
00102       Camera *m_camera;
00103       Scene  *m_scene;
00104       bool    m_initted;
00105       
00106       DirectIllumination *m_directIllumination;
00107       Timer               m_timer;
00108       //boost::timer        m_timer;
00109 };
00110 
00111 #endif // RENDERER_H_
00112 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6