NaiveRenderOutput.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  NaiveRenderOutput
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       Records point samples from a renderer and naively reconstructs the 
00009    underlying image by storing samples into the bin/pixel which they fall 
00010    into, overwriting previous samples, and not using any reconstruction 
00011    filter
00012    <!-------------------------------------------------------------------->**/
00013 
00014 #ifndef NAIVE_RENDER_OUTPUT_H_
00015 #define NAIVE_RENDER_OUTPUT_H_
00016 
00017 #include <renderers/RenderOutput.h>
00018 #include <filters/filters.h>
00019 #include <common/image/Image.h>
00020 
00021 class NaiveRenderOutput : public RenderOutput {
00022    
00023    public:
00024       ///@name Constructors
00025       //@{-----------------------------------------------------------------
00026       
00027       inline NaiveRenderOutput(Image *output = NULL)
00028          : RenderOutput(), 
00029            m_output(output), m_progressiveValues(NULL)
00030       {
00031          if (output) {
00032             const unsigned width  = output->getWidth();
00033             const unsigned height = output->getHeight();
00034             
00035             const unsigned size = width * height;
00036             m_progressiveValues = new ProgressiveFilterValue<SpectralSampleSet>[size];
00037             
00038             m_viewport.setSize(width, height);
00039          }
00040       }
00041       
00042       virtual ~NaiveRenderOutput() {
00043          safeDeleteArray(m_progressiveValues);
00044       }
00045       
00046       
00047       //@}-----------------------------------------------------------------
00048       ///@name Accessors / Mutators
00049       //@{-----------------------------------------------------------------
00050       
00051       inline Image *getImage() {
00052          return m_output;
00053       }
00054       
00055       inline void setImage(Image *image) {
00056          ASSERT(image);
00057          
00058          if (image == m_output)
00059             return;
00060          
00061          //safeDelete(m_output); // TODO: who 'owns' m_output?
00062          
00063          // TODO: possibly synchronization issue -- ensure it doesn't happen
00064          m_output = image;
00065          m_viewport.setSize(m_output->getWidth(), m_output->getHeight());
00066          
00067          safeDeleteArray(m_progressiveValues);
00068          const unsigned size = m_output->getWidth() * m_output->getHeight();
00069          m_progressiveValues = new ProgressiveFilterValue<SpectralSampleSet>[size];
00070       }
00071       
00072       
00073       //@}-----------------------------------------------------------------
00074        
00075    protected:
00076       virtual void _addSample(const PointSample &sample);
00077       
00078    protected:
00079       Image *m_output;
00080       ProgressiveFilterValue<SpectralSampleSet> *m_progressiveValues;
00081 };
00082 
00083 #endif // NAIVE_RENDER_OUTPUT_H_
00084 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6