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


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_sg_sf_rotf                            4 #ifndef tools_sg_sf_rotf
  5 #define tools_sg_sf_rotf                            5 #define tools_sg_sf_rotf
  6                                                     6 
  7 #include "sf"                                       7 #include "sf"
  8                                                     8 
  9 #include "../lina/rotf"                             9 #include "../lina/rotf"
 10                                                    10 
 11 #include "../HEADER"                               11 #include "../HEADER"
 12                                                    12 
 13 namespace tools {                                  13 namespace tools {
 14 namespace sg {                                     14 namespace sg {
 15                                                    15 
 16 class sf_rotf : public bsf<rotf> {                 16 class sf_rotf : public bsf<rotf> {
 17   TOOLS_HEADER(sf_rotf,tools::sg::sf_rotf,bsf<     17   TOOLS_HEADER(sf_rotf,tools::sg::sf_rotf,bsf<rotf>)
 18 public:                                            18 public:
 19   virtual bool write(io::iwbuf& a_buffer) {        19   virtual bool write(io::iwbuf& a_buffer) {
 20     const vec4<float>& vec = m_value.quat();       20     const vec4<float>& vec = m_value.quat();
 21     const float* d = get_data(vec);                21     const float* d = get_data(vec);
 22     return a_buffer.write_vec(vec.size(),d);       22     return a_buffer.write_vec(vec.size(),d);
 23   }                                                23   }
 24   virtual bool read(io::irbuf& a_buffer) {         24   virtual bool read(io::irbuf& a_buffer) {
 25     vec4<float>& vec = m_value.quat();             25     vec4<float>& vec = m_value.quat();
 26     uint32 n;                                      26     uint32 n;
 27     float* v;                                      27     float* v;
 28     if(!a_buffer.read_vec(n,v)) return false;      28     if(!a_buffer.read_vec(n,v)) return false;
 29     if(n!=vec.size()) {                            29     if(n!=vec.size()) {
 30       delete [] v;                                 30       delete [] v;
 31 #ifdef TOOLS_MEM                                   31 #ifdef TOOLS_MEM
 32       mem::decrement(s_new().c_str());             32       mem::decrement(s_new().c_str());
 33 #endif                                             33 #endif
 34       return false;                                34       return false;
 35     }                                              35     }
 36     for(uint32 index=0;index<n;index++) vec[in     36     for(uint32 index=0;index<n;index++) vec[index] = v[index];
 37     delete [] v;                                   37     delete [] v;
 38 #ifdef TOOLS_MEM                                   38 #ifdef TOOLS_MEM
 39     mem::decrement(s_new().c_str());               39     mem::decrement(s_new().c_str());
 40 #endif                                             40 #endif
 41     return true;                                   41     return true;
 42   }                                                42   }
 43   virtual bool dump(std::ostream&) {               43   virtual bool dump(std::ostream&) {
 44     //a_out << parent::m_value << std::endl;       44     //a_out << parent::m_value << std::endl;
 45     return true;                                   45     return true;
 46   }                                                46   }
 47   virtual bool s_value(std::string& a_s) const     47   virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
 48   virtual bool s2value(const std::string&) {re     48   virtual bool s2value(const std::string&) {return false;}
 49 public:                                            49 public:
 50   sf_rotf():parent(){}                             50   sf_rotf():parent(){}
 51   sf_rotf(const rotf& a_value):parent(a_value)     51   sf_rotf(const rotf& a_value):parent(a_value){}
 52   virtual ~sf_rotf(){}                             52   virtual ~sf_rotf(){}
 53 public:                                            53 public:
 54   sf_rotf(const sf_rotf& a_from):parent(a_from     54   sf_rotf(const sf_rotf& a_from):parent(a_from){}
 55   sf_rotf& operator=(const sf_rotf& a_from){       55   sf_rotf& operator=(const sf_rotf& a_from){
 56     parent::operator=(a_from);                     56     parent::operator=(a_from);
 57     return *this;                                  57     return *this;
 58   }                                                58   }
 59 public:                                            59 public:
 60   sf_rotf& operator=(const rotf& a_value){         60   sf_rotf& operator=(const rotf& a_value){
 61     parent::operator=(a_value);                    61     parent::operator=(a_value);
 62     return *this;                                  62     return *this;
 63   }                                                63   }
 64 public: //iv2ps                                    64 public: //iv2ps
 65   void setValue(const vec3f& a_axis,float a_an     65   void setValue(const vec3f& a_axis,float a_angle) {
 66     value(rotf(a_axis,a_angle));                   66     value(rotf(a_axis,a_angle));
 67   }                                                67   }
 68   void setValue(const rotf& a_value) {             68   void setValue(const rotf& a_value) {
 69     value(a_value);                                69     value(a_value);
 70   }                                                70   }
 71 };                                                 71 };
 72                                                    72 
 73 }}                                                 73 }}
 74                                                    74 
 75 #endif                                             75 #endif