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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/render_gstos (Version 11.3.0) and /externals/g4tools/include/tools/sg/render_gstos (Version 9.1.p3)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_render_gstos                     
  5 #define tools_sg_render_gstos                     
  6                                                   
  7 #include "gstos"                                  
  8 #include "render_action"                          
  9                                                   
 10 #include "gstos_add"                              
 11                                                   
 12 namespace tools {                                 
 13 namespace sg {                                    
 14                                                   
 15 class render_gstos : public gstos {               
 16   typedef gstos parent;                           
 17 public:                                           
 18   virtual void visit(gstos_add& a_visitor,draw    
 19 protected: //gstos                                
 20   virtual unsigned int create_gsto(std::ostrea    
 21     std::vector<float> gsto_data;                 
 22                                                   
 23     gstos_add _add;                               
 24     visit(_add,draw_points);                      
 25     append(gsto_data,_add.m_xyzs);                
 26     m_gstos_points_sz = _add.m_xyzs.size();       
 27                                                   
 28     _add.clear();                                 
 29     visit(_add,draw_lines);                       
 30     append(gsto_data,_add.m_xyzs);                
 31     m_gstos_lines_sz = _add.m_xyzs.size();        
 32                                                   
 33     _add.clear();                                 
 34     visit(_add,draw_filled);                      
 35     append(gsto_data,_add.m_xyzs);                
 36     m_gstos_tris_sz = _add.m_xyzs.size();         
 37     append(gsto_data,_add.m_nms);                 
 38     m_gstos_nms_sz = _add.m_nms.size();           
 39                                                   
 40     if(gsto_data.empty()) return 0;               
 41                                                   
 42     return a_mgr.create_gsto_from_data(gsto_da    
 43   }                                               
 44 public: //node                                    
 45   bool gstos_render(render_action& a_action) {    
 46     const state& state = a_action.state();        
 47                                                   
 48     bool draw_edges = false;                      
 49     if(state.m_draw_type==draw_filled) draw_ed    
 50                                                   
 51     if(state.m_use_gsto) {                        
 52       unsigned int _id = get_gsto_id(a_action.    
 53       if(_id) {                                   
 54         bufpos pxyzs = 0;                         
 55         bufpos plines = pxyzs+m_gstos_points_s    
 56         bufpos ptris = plines+m_gstos_lines_sz    
 57         bufpos pnms  = ptris+m_gstos_tris_sz*s    
 58                                                   
 59         a_action.begin_gsto(_id);                 
 60         if(draw_edges) {                          
 61           //a_action.set_lighting(false); //NO    
 62           a_action.color4f(0,0,0,1); //if ligh    
 63           a_action.line_width(1);                 
 64                                                   
 65           a_action.draw_gsto_v(gl::lines(),m_g    
 66                                                   
 67           //pushes back the filled polygons to    
 68           a_action.set_polygon_offset(true);      
 69                                                   
 70           a_action.color4f(state.m_color);        
 71           a_action.line_width(state.m_line_wid    
 72           //a_action.set_lighting(state.m_GL_L    
 73         }                                         
 74         if(state.m_draw_type==draw_points) {      
 75           a_action.draw_gsto_v(gl::points(),m_    
 76         } else if(state.m_draw_type==draw_line    
 77           a_action.draw_gsto_v(gl::lines(),m_g    
 78   } else {                                        
 79           a_action.draw_gsto_vn(gl::triangles(    
 80         }                                         
 81         if(draw_edges) a_action.set_polygon_of    
 82         a_action.end_gsto();                      
 83         return true;                              
 84                                                   
 85       } else { //!_id                             
 86         // use immediate rendering.               
 87       }                                           
 88                                                   
 89     } else {                                      
 90       clean_gstos(&a_action.render_manager());    
 91     }                                             
 92     return false;                                 
 93   }                                               
 94   bool gstos_render_no_style(render_action& a_    
 95     const state& state = a_action.state();        
 96     if(state.m_use_gsto) {                        
 97       unsigned int _id = get_gsto_id(a_action.    
 98       if(_id) {                                   
 99         bufpos pxyzs = 0;                         
100         bufpos plines = pxyzs+m_gstos_points_s    
101         bufpos ptris = plines+m_gstos_lines_sz    
102         bufpos pnms  = ptris+m_gstos_tris_sz*s    
103                                                   
104         a_action.begin_gsto(_id);                 
105         a_action.draw_gsto_v(gl::points(),m_gs    
106         a_action.draw_gsto_v(gl::lines(),m_gst    
107         a_action.draw_gsto_vn(gl::triangles(),    
108         a_action.end_gsto();                      
109         return true;                              
110                                                   
111       } else { //!_id                             
112         // use immediate rendering.               
113       }                                           
114                                                   
115     } else {                                      
116       clean_gstos(&a_action.render_manager());    
117     }                                             
118     return false;                                 
119   }                                               
120 public:                                           
121   render_gstos():parent(),m_gstos_points_sz(0)    
122   virtual ~render_gstos() {}                      
123 public:                                           
124   render_gstos(const render_gstos& a_from):par    
125   render_gstos& operator=(const render_gstos&     
126     parent::operator=(a_from);                    
127     m_gstos_points_sz = 0;                        
128     m_gstos_lines_sz = 0;                         
129     m_gstos_tris_sz = 0;                          
130     m_gstos_nms_sz = 0;                           
131     return *this;                                 
132   }                                               
133 protected:                                        
134   size_t m_gstos_points_sz;                       
135   size_t m_gstos_lines_sz;                        
136   size_t m_gstos_tris_sz;                         
137   size_t m_gstos_nms_sz;                          
138 };                                                
139                                                   
140 }}                                                
141                                                   
142 #endif