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


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_matrix                           
  5 #define tools_sg_matrix                           
  6                                                   
  7 #include "node"                                   
  8 #include "sf_mat4f"                               
  9 #include "../lina/mat4f"                          
 10 #include "render_action"                          
 11 #include "pick_action"                            
 12 #include "bbox_action"                            
 13 #include "event_action"                           
 14 #include "visible_action"                         
 15                                                   
 16 namespace tools {                                 
 17 namespace sg {                                    
 18                                                   
 19 class matrix : public node {                      
 20   TOOLS_NODE(matrix,tools::sg::matrix,node)       
 21 public:                                           
 22   sf_mat4f mtx;                                   
 23 public:                                           
 24   virtual const desc_fields& node_desc_fields(    
 25     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::mat    
 26     static const desc_fields s_v(parent::node_    
 27       TOOLS_ARG_FIELD_DESC(mtx)                   
 28     );                                            
 29     return s_v;                                   
 30   }                                               
 31 private:                                          
 32   void add_fields(){                              
 33     add_field(&mtx);                              
 34   }                                               
 35 public:                                           
 36   virtual void render(render_action& a_action)    
 37     a_action.model_matrix().mul_mtx(mtx.value(    
 38     a_action.state().m_model = a_action.model_    
 39     a_action.load_model_matrix(a_action.model_    
 40   }                                               
 41   virtual void pick(pick_action& a_action) {      
 42     a_action.model_matrix().mul_mtx(mtx.value(    
 43     a_action.state().m_model = a_action.model_    
 44   }                                               
 45   virtual void bbox(bbox_action& a_action) {      
 46     a_action.model_matrix().mul_mtx(mtx.value(    
 47     a_action.state().m_model = a_action.model_    
 48   }                                               
 49   virtual void event(event_action& a_action) {    
 50     a_action.model_matrix().mul_mtx(mtx.value(    
 51     a_action.state().m_model = a_action.model_    
 52   }                                               
 53   virtual void get_matrix(get_matrix_action& a    
 54     a_action.model_matrix().mul_mtx(mtx.value(    
 55     a_action.state().m_model = a_action.model_    
 56   }                                               
 57   virtual void is_visible(visible_action& a_ac    
 58     a_action.model_matrix().mul_mtx(mtx.value(    
 59     a_action.state().m_model = a_action.model_    
 60   }                                               
 61 public:                                           
 62   matrix():parent(),mtx(mat4f()) {                
 63 #ifdef TOOLS_MEM                                  
 64     mem::increment(s_class().c_str());            
 65 #endif                                            
 66     add_fields();                                 
 67     mtx.set_identity();                           
 68   }                                               
 69   virtual ~matrix(){                              
 70 #ifdef TOOLS_MEM                                  
 71     mem::decrement(s_class().c_str());            
 72 #endif                                            
 73   }                                               
 74 public:                                           
 75   matrix(const matrix& a_from):parent(a_from),    
 76 #ifdef TOOLS_MEM                                  
 77     mem::increment(s_class().c_str());            
 78 #endif                                            
 79     add_fields();                                 
 80   }                                               
 81   matrix& operator=(const matrix& a_from){        
 82     parent::operator=(a_from);                    
 83     mtx = a_from.mtx;                             
 84     return *this;                                 
 85   }                                               
 86 public:                                           
 87   // shortcuts :                                  
 88   void set_identity() {mtx.set_identity();}       
 89                                                   
 90   void set_translate(float a_x,float a_y,float    
 91   void set_translate(const vec3f& a_v) {mtx.se    
 92                                                   
 93   void set_scale(float a_x,float a_y,float a_z    
 94   void set_scale(float a_s) {mtx.set_scale(a_s    
 95                                                   
 96   void set_rotate(float a_x,float a_y,float a_    
 97   void set_rotate(const vec3f& a_v,float a_ang    
 98   bool set_rotate(const vec3f& a_from,const ve    
 99                                                   
100   void mul_mtx(const mat4f& a_m) {mtx.mul_mtx(    
101                                                   
102   void mul_translate(float a_x,float a_y,float    
103   void mul_translate(const vec3f& a_v) {mtx.mu    
104   void mul_scale(float a_x,float a_y,float a_z    
105   void mul_scale(float a_s) {mtx.mul_scale(a_s    
106                                                   
107   void mul_rotate(float a_x,float a_y,float a_    
108                                                   
109   void mul_rotate(const vec3f& a_v,float a_ang    
110   void mul_rotate(const vec4f& a_v) {mtx.mul_r    
111                                                   
112   void left_mul_rotate(float a_x,float a_y,flo    
113                                                   
114   void left_mul_scale(float a_x,float a_y,floa    
115                                                   
116   void left_mul_translate(float a_x,float a_y,    
117                                                   
118   void left_mul_translate(const vec3f& a_v) {m    
119                                                   
120   bool mul_rotate(const vec3f& a_from,const ve    
121 protected:                                        
122   float m_tmp[16]; //OPTIMIZATION                 
123 };                                                
124                                                   
125 }}                                                
126                                                   
127 #endif