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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/gstos_add (Version 11.3.0) and /externals/g4tools/include/tools/sg/gstos_add (Version 7.0.p1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_gstos_add                        
  5 #define tools_sg_gstos_add                        
  6                                                   
  7 #include "../vmanip"                              
  8 #include "../vdata"                               
  9 #include "../glprims"                             
 10 #include "../lina/mat4f"                          
 11                                                   
 12 namespace tools {                                 
 13 namespace sg {                                    
 14                                                   
 15 class gstos_add {                                 
 16 public:                                           
 17   gstos_add(){}                                   
 18   virtual ~gstos_add(){}                          
 19 public:                                           
 20   gstos_add(const gstos_add&) {}                  
 21   gstos_add& operator=(const gstos_add&){retur    
 22 public:                                           
 23   void clear() {m_xyzs.clear();m_nms.clear();}    
 24                                                   
 25   void add_points(size_t a_floatn,const float*    
 26     append(m_xyzs,a_floatn,a_xyzs);               
 27   }                                               
 28   void add_lines(size_t a_floatn,const float*     
 29     append(m_xyzs,a_floatn,a_xyzs);               
 30   }                                               
 31   void add_line_strip(size_t a_floatn,const fl    
 32     size_t num = a_floatn/3;                      
 33     if(num<2) return;                             
 34     size_t nxyzs = (num-1)*2*3;                   
 35     size_t offset = m_xyzs.size();                
 36     m_xyzs.resize(offset+nxyzs);                  
 37     float* pxyzs = vec_data<float>(m_xyzs)+off    
 38     gl::line_strip_to_lines(num,a_xyzs,pxyzs);    
 39   }                                               
 40   void add_line_loop(size_t a_floatn,const flo    
 41     size_t num = a_floatn/3;                      
 42     if(num<2) return;                             
 43     size_t nxyzs = num*2*3;                       
 44     size_t offset = m_xyzs.size();                
 45     m_xyzs.resize(offset+nxyzs);                  
 46     float* pxyzs = vec_data<float>(m_xyzs)+off    
 47     gl::line_loop_to_lines(num,a_xyzs,pxyzs);     
 48   }                                               
 49   void add_triangles_normal(size_t a_floatn,co    
 50     append(m_xyzs,a_floatn,a_xyzs);               
 51     append(m_nms,a_floatn,a_nms);                 
 52   }                                               
 53   void add_triangle_strip_normal(size_t a_floa    
 54     size_t num = a_floatn/3;                      
 55     if(num<3) return;                             
 56     size_t nxyzs = (num-2)*3*3;                   
 57     size_t offset = m_xyzs.size();                
 58     m_xyzs.resize(offset+nxyzs);                  
 59     float* pxyzs = vec_data<float>(m_xyzs)+off    
 60     offset = m_nms.size();                        
 61     m_nms.resize(offset+nxyzs);                   
 62     float* pnms = vec_data<float>(m_nms)+offse    
 63     gl::triangle_strip_to_triangles_nms(num,a_    
 64   }                                               
 65   void add_triangle_fan_normal(size_t a_floatn    
 66     size_t num = a_floatn/3;                      
 67     if(num<3) return;                             
 68     size_t nxyzs = (num-2)*3*3;                   
 69     size_t offset = m_xyzs.size();                
 70     m_xyzs.resize(offset+nxyzs);                  
 71     float* pxyzs = vec_data<float>(m_xyzs)+off    
 72     offset = m_nms.size();                        
 73     m_nms.resize(offset+nxyzs);                   
 74     float* pnms = vec_data<float>(m_nms)+offse    
 75     gl::triangle_fan_to_triangles_nms(num,a_xy    
 76   }                                               
 77                                                   
 78   void add_triangle_strip_as_triangles(size_t     
 79     add_triangle_strip_normal(a_floatn,a_xyzs,    
 80   }                                               
 81 /*                                                
 82   ////////////////////////////////////////////    
 83   /// for sg::markers and gstos : ////////////    
 84   ////////////////////////////////////////////    
 85   void add_lines(const std::vector<float>& a_x    
 86     append(m_xyzs,a_xyzs.size(),vec_data(a_xyz    
 87   }                                               
 88   void add_triangles_normal(const std::vector<    
 89     if(a_xyzs.size()!=a_nms.size()) return;       
 90     append(m_xyzs,a_xyzs.size(),vec_data(a_xyz    
 91     append(m_nms,a_nms.size(),vec_data(a_nms))    
 92   }                                               
 93   bool project_point(const mat4f& a_model_matr    
 94                      float& a_x,float& a_y,flo    
 95     a_w = 1;                                      
 96     a_model_matrix.mul_4f(a_x,a_y,a_z,a_w);       
 97     a_projection_matrix.mul_4f(a_x,a_y,a_z,a_w    
 98     if(a_w==0.0F) return false;                   
 99     a_x /= a_w;                                   
100     a_y /= a_w;                                   
101     a_z /= a_w;                                   
102     return true;                                  
103   }                                               
104   ////////////////////////////////////////////    
105   ////////////////////////////////////////////    
106   ////////////////////////////////////////////    
107 */                                                
108 public:                                           
109   std::vector<float> m_xyzs;                      
110   std::vector<float> m_nms;                       
111                                                   
112   size_t m_gsto_points_sz;                        
113   size_t m_gsto_lines_sz;                         
114   size_t m_gsto_tris_sz;                          
115   size_t m_gsto_nms_sz;                           
116 };                                                
117                                                   
118 }}                                                
119                                                   
120 #endif