SampleGenerator.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  SampleGenerator
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @date   Fall 2008
00005    
00006    @brief
00007       Point sample generation over the 2D unit interval [0,1]^2
00008    
00009    @see Viewport
00010    @see SampleGeneratorThread
00011    <!-------------------------------------------------------------------->**/
00012 
00013 #ifndef SAMPLE_GENERATOR_H_
00014 #define SAMPLE_GENERATOR_H_
00015 
00016 #include <renderers/PointSample.h>
00017 #include <utils/PropertyMap.h>
00018 #include <core/Viewport.h>
00019 
00020 class SampleGenerator : public PropertyMap {
00021    
00022    public:
00023       ///@name Constructors
00024       //@{-----------------------------------------------------------------
00025       
00026       inline SampleGenerator()
00027       { }
00028       
00029       virtual ~SampleGenerator()
00030       { }
00031       
00032       
00033       //@}-----------------------------------------------------------------
00034       ///@name Static factory
00035       //@{-----------------------------------------------------------------
00036       
00037       static SampleGenerator *create(const std::string &type);
00038       
00039       
00040       //@}-----------------------------------------------------------------
00041       ///@name Initialization
00042       //@{-----------------------------------------------------------------
00043       
00044       /**
00045        * @brief
00046        *    Performs any initialization which may be necessary before 
00047        * beginning to generate samples
00048        * 
00049        * @note
00050        *    Default implementation is empty
00051        */
00052       virtual void init();
00053       
00054       
00055       //@}-----------------------------------------------------------------
00056       ///@name Main usage interface
00057       //@{-----------------------------------------------------------------
00058       
00059       /**
00060        * @brief
00061        *    Generates samples over the unit square [0,1]^2 with regards to 
00062        * the given viewport and stores them in outSamples
00063        * 
00064        * @note
00065        *    Samples will be appended to outSamples if outSamples is not 
00066        * initially empty
00067        */
00068       virtual void generate(PointSampleList &outSamples, const Viewport &v) = 0;
00069       
00070       
00071       //@}-----------------------------------------------------------------
00072       
00073    protected:
00074       /**
00075        * @brief
00076        *    Main interface for subclasses to add a given PointSample to be 
00077        * 'generated'. Default implementation is simple: samples.push_back(s);
00078        * Subclasses should not access samples list directly but should 
00079        * instead use this method which allows for SampleGeneratorThread to 
00080        * override _addSample to instead notify a PointSampleRenderer's 
00081        * shared pool of pending work
00082        */
00083       virtual void _addSample(const PointSample &s, PointSampleList &samples);
00084 };
00085 
00086 #endif // SAMPLE_GENERATOR_H_
00087 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6