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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/offscreen/sg_viewer (Version 11.3.0) and /externals/g4tools/include/tools/offscreen/sg_viewer (Version 9.3)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_offscreen_sg_viewer                 
  5 #define tools_offscreen_sg_viewer                 
  6                                                   
  7 #include "session"                                
  8                                                   
  9 #include "../sg/viewer"                           
 10 #include "../sg/zb_manager"                       
 11 #include "../sg/gl2ps_manager"                    
 12 #include "../sg/write_paper"                      
 13                                                   
 14 namespace tools {namespace sg {class device_in    
 15                                                   
 16 namespace tools {                                 
 17 namespace offscreen {                             
 18                                                   
 19 class sg_viewer : public sg::viewer, public of    
 20   typedef sg::viewer parent;                      
 21 protected:                                        
 22   virtual void render() {write_paper();}          
 23 public:                                           
 24   sg_viewer(session& a_session,                   
 25             int /*a_x*/ = 0,int /*a_y*/ = 0,      
 26             unsigned int a_width = 500,unsigne    
 27             const std::string& /*a_win_title*/    
 28   :parent(a_session.out(),a_width,a_height)       
 29   ,m_session(a_session)                           
 30   ,m_file_format("zb_ps")                         
 31   ,m_file_name("out_zb.ps")                       
 32   ,m_png_writer(0)                                
 33   ,m_jpeg_writer(0)                               
 34   ,m_do_transparency(true)                        
 35   ,m_top_to_bottom(true)                          
 36   {}                                              
 37   virtual ~sg_viewer() {}                         
 38 protected:                                        
 39   sg_viewer(const sg_viewer& a_from)              
 40   :parent(a_from)                                 
 41   ,offscreen::viewer(a_from)                      
 42   ,m_session(a_from.m_session)                    
 43   ,m_zb_mgr(a_from.m_zb_mgr)                      
 44   ,m_gl2ps_mgr(a_from.m_gl2ps_mgr)                
 45   ,m_file_format(a_from.m_file_format)            
 46   ,m_file_name(a_from.m_file_name)                
 47   ,m_png_writer(a_from.m_png_writer)              
 48   ,m_jpeg_writer(a_from.m_jpeg_writer)            
 49   ,m_do_transparency(a_from.m_do_transparency)    
 50   ,m_top_to_bottom(a_from.m_top_to_bottom)        
 51   ,m_opts_1(a_from.m_opts_1)                      
 52   ,m_opts_2(a_from.m_opts_2)                      
 53   {}                                              
 54   sg_viewer& operator=(const sg_viewer& a_from    
 55     parent::operator=(a_from);                    
 56     m_file_format = a_from.m_file_format;         
 57     m_file_name = a_from.m_file_name;             
 58     m_png_writer = a_from.m_png_writer;           
 59     m_jpeg_writer = a_from.m_jpeg_writer;         
 60     m_do_transparency = a_from.m_do_transparen    
 61     m_top_to_bottom = a_from.m_top_to_bottom;     
 62     m_opts_1 = a_from.m_opts_1;                   
 63     m_opts_2 = a_from.m_opts_2;                   
 64     return *this;                                 
 65   }                                               
 66 public:                                           
 67   bool has_window() const {return true;}          
 68                                                   
 69   bool show() {                                   
 70     m_session.to_render(this);                    
 71     return true;                                  
 72   }                                               
 73                                                   
 74   void win_render() {                             
 75     m_session.to_render(this);                    
 76   }                                               
 77                                                   
 78   void set_device_interactor(sg::device_intera    
 79                                                   
 80 public:                                           
 81   void set_file_format(const std::string& a_fi    
 82   void set_file_name(const std::string& a_file    
 83   const std::string& file_format() const {retu    
 84   const std::string& file_name() const {return    
 85   void set_png_writer(sg::png_writer a_png_wri    
 86   void set_jpeg_writer(sg::jpeg_writer a_jpeg_    
 87   void set_do_transparency(bool a_do_transpare    
 88   void set_top_to_bottom(bool a_top_to_bottom)    
 89   void set_opts_1(const std::string& a_opts) {    
 90   void set_opts_2(const std::string& a_opts) {    
 91                                                   
 92   bool write_paper() {                            
 93     if(!m_ww) return false;                       
 94     if(!m_wh) return false;                       
 95     return sg::write_paper(m_out,m_gl2ps_mgr,m    
 96                            m_png_writer,m_jpeg    
 97                            m_clear_color.r(),     
 98                            m_clear_color.g(),     
 99                            m_clear_color.b(),     
100                            m_clear_color.a(),     
101                            m_sg,m_ww,m_wh,        
102                            m_file_name,m_file_    
103                            m_do_transparency,m    
104                            m_opts_1,m_opts_2);    
105   }                                               
106 protected:                                        
107   session& m_session;                             
108   sg::zb_manager m_zb_mgr;                        
109   sg::gl2ps_manager m_gl2ps_mgr;                  
110   std::string m_file_format;                      
111   std::string m_file_name;                        
112   sg::png_writer m_png_writer;                    
113   sg::jpeg_writer m_jpeg_writer;                  
114   bool m_do_transparency;                         
115   bool m_top_to_bottom;                           
116   std::string m_opts_1;                           
117   std::string m_opts_2;                           
118 };                                                
119                                                   
120 }}                                                
121                                                   
122 #endif                                            
123