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] [ 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/sg/zb_viewer (Version 11.3.0) and /externals/g4tools/include/tools/sg/zb_viewer (Version 6.0)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_zb_viewer                        
  5 #define tools_sg_zb_viewer                        
  6                                                   
  7 #include "zb_action"                              
  8 #include "viewer"                                 
  9                                                   
 10 namespace tools {                                 
 11 namespace sg {                                    
 12                                                   
 13 class zb_viewer : public viewer {                 
 14   TOOLS_HEADER(zb_viewer,tools::sg::zb_viewer,    
 15 public:                                           
 16   zb_viewer(std::ostream& a_out,unsigned int a    
 17   :parent(a_out,a_width,a_height)                 
 18   ,m_mgr_gra()                                    
 19   ,m_out_buffer_what(get_rgbs)                    
 20   {}                                              
 21   virtual ~zb_viewer(){                           
 22     //WARNING : nodes may refer m_mgr_gra (to     
 23     //          we have to delete them first.     
 24     m_sg.clear();                                 
 25   }                                               
 26 public:                                           
 27   zb_viewer(const zb_viewer& a_from)              
 28   :parent(a_from)                                 
 29   ,m_mgr_gra(a_from.m_mgr_gra)                    
 30   ,m_out_buffer_what(get_rgbs)                    
 31   {}                                              
 32   zb_viewer& operator=(const zb_viewer& a_from    
 33     parent::operator=(a_from);                    
 34     m_mgr_gra = a_from.m_mgr_gra;                 
 35     m_out_buffer_what = get_rgbs;                 
 36     m_out_buffer.clear();                         
 37     return *this;                                 
 38   }                                               
 39 public:                                           
 40   enum get_what {                                 
 41     get_rgbs = 0,                                 
 42     get_rgbas,                                    
 43     get_bgras                                     
 44   };                                              
 45   bool render(get_what a_what,bool a_top_to_bo    
 46     m_out_buffer.clear();                         
 47     if(!m_ww) return false;                       
 48     if(!m_wh) return false;                       
 49                                                   
 50     zb_action action(m_mgr_gra,m_out,m_ww,m_wh    
 51     action.clear_color_buffer(m_clear_color.r(    
 52     action.clear_depth_buffer();                  
 53     action.set_do_transparency(false);            
 54     action.set_have_to_do_transparency(false);    
 55     m_sg.render(action);                          
 56     if(!action.end()) { //check that matrices     
 57       m_out << "tools::sg::zb_viewer: bad zb_a    
 58       return false;                               
 59     } else {                                      
 60       if(action.have_to_do_transparency()) {      
 61         action.set_do_transparency(true);         
 62         m_sg.render(action);                      
 63         if(!action.end()) { //check that matri    
 64           m_out << "tools::sg::zb_viewer: bad     
 65           return false;                           
 66         }                                         
 67       }                                           
 68     }                                             
 69                                                   
 70     m_out_buffer_what = a_what;                   
 71     bool status = false;                          
 72     switch(a_what) {                              
 73     case get_rgbs:                                
 74       status = action.get_rgbs(a_top_to_bottom    
 75       break;                                      
 76     case get_rgbas:                               
 77       status = action.get_rgbas(a_top_to_botto    
 78       break;                                      
 79     case get_bgras:                               
 80       status = action.get_bgras(a_top_to_botto    
 81       break;                                      
 82     }\                                            
 83     if(!status) {                                 
 84       m_out << "tools::sg::zb_viewer::render()    
 85       m_out_buffer.clear();                       
 86       return false;                               
 87     }                                             
 88     /*m_out << "size " << m_out_buffer.size()     
 89     return true;                                  
 90   }                                               
 91                                                   
 92   const std::vector<unsigned char>& out_buffer    
 93   void out_buffer_clear() {m_out_buffer.clear(    
 94                                                   
 95 protected:                                        
 96   zb_manager m_mgr_gra;                           
 97   get_what m_out_buffer_what;                     
 98   std::vector<unsigned char> m_out_buffer;        
 99 };                                                
100                                                   
101 }}                                                
102                                                   
103 #endif