00001 00002 #ifndef __sampler_hpp__ 00003 #define __sampler_hpp__ 00004 00005 #include <crbn/basic/basic.h> 00006 #include <crbn/basic/vec2.hpp> 00007 #include <crbn/basic/vec3.hpp> 00008 #include <crbn/basic/vec4.hpp> 00009 00024 class Sampler 00025 { 00026 public: 00027 Sampler( uint32 nbs = 1 ) : _sample1d( nbs ) { _ok = false; } 00028 virtual ~Sampler() {} 00029 00033 inline uint32 sample_number_1d() { return _sample1d; } 00037 inline uint32 sample_number_2d() { return _sample2d; } 00041 inline uint32 sample_number_3d() { return _sample3d; } 00042 00043 inline uint32 memory() { return _memory_used; } 00044 inline bool is_ok() { return _ok; } 00045 00053 virtual uint32 generate_1d( uint32 size, float* array ) = 0; 00061 virtual uint32 generate_2d( uint32 size, vec2* array ) = 0; 00069 virtual uint32 generate_3d( uint32 size, vec3* array ) = 0; 00070 00071 protected: 00072 uint32 _memory_used; 00073 bool _ok; 00074 uint32 _sample1d; 00075 uint32 _sample2d; 00076 uint32 _sample3d; 00077 }; 00078 00079 #endif // __sampler_hpp__