00001
00002 #ifndef __output_context_hpp__
00003 #define __output_context_hpp__
00004
00005 #include <crbn/output/output.hpp>
00006 #include <crbn/basic/paramlist.hpp>
00007 #include <crbn/basic/vec2.hpp>
00008
00009 class OutputContext
00010 {
00011 public:
00012
00013
00014 OutputContext();
00015
00016
00017 ~OutputContext();
00018
00019 void realize();
00020
00021 uint32 get_line_width() { return _image_line_width; }
00022 uint32 get_line_count() { return _image_line_count; }
00023 uint32 get_pixel_count() { return _image_pixel_count; }
00024 float get_aspect_ratio() { return _image_ar; }
00025
00026 void set_background_color( vec3& color ) { _background_color = color; }
00027 void get_background_color( vec3& color ) { color = _background_color; }
00028
00029 bool create_default();
00030 bool create( const char* output_type, paramlist& pl );
00031
00032 void outformat( const char* prefix, int digits );
00033 void resolution( uint32 width, uint32 height, float par );
00034 void crop_window( float xmin, float xmax, float ymin, float ymax );
00035
00036 void samples2screen( uint32 count, uint32 sample_number, vec2* uvs );
00037
00038 bool is_reachable();
00039 void open( uint32 frame_current );
00040 void close();
00041 void write( int size, vec3* colors );
00042
00043 private:
00044 void unload();
00045
00046 void* _output_module;
00047 Output* _output;
00048 vec3 _background_color;
00049
00050 char* _prefix;
00051 char _dnumber;
00052
00053 vec2 _dp;
00054
00055 uint32 _image_width, _image_height;
00056 float _image_par;
00057 float _image_ar;
00058
00059 float _image_crop_xmin, _image_crop_xmax;
00060 float _image_crop_ymin, _image_crop_ymax;
00061
00062 uint32 _image_line_width, _image_line_count;
00063 uint32 _image_pixel_count;
00064
00065 uint32 _image_vert_begin_skip, _image_vert_end_skip;
00066 uint32 _image_horiz_begin_skip, _image_horiz_end_skip;
00067 };
00068
00069 #endif // __output_context_hpp__