g4tools  5.4.0
sf_mat4f
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_sg_sf_mat4f
5 #define tools_sg_sf_mat4f
6 
7 #include "sf_vec"
8 
9 #include "../lina/mat4f"
10 #include "../lina/vec3f"
11 #include "../lina/rotf"
12 
13 #include "../HEADER"
14 
15 namespace tools {
16 namespace sg {
17 
18 class sf_mat4f : public sf_vec<mat4f,float> {
19  typedef sf_vec<mat4f,float> pr;
21 public:
23  sf_mat4f(const mat4f& a_value):parent(a_value){}
24  virtual ~sf_mat4f(){}
25 public:
26  sf_mat4f(const sf_mat4f& a_from):parent(a_from){}
27  sf_mat4f& operator=(const sf_mat4f& a_from){
28  parent::operator=(a_from);
29  return *this;
30  }
31 public:
32  sf_mat4f& operator=(const mat4f& a_value){
33  parent::operator=(a_value);
34  return *this;
35  }
36 public:
37  void set_identity() {
38  m_value.set_identity();
39  m_touched = true;
40  }
41  void set_translate(float a_x,float a_y,float a_z) {
42  m_value.set_translate(a_x,a_y,a_z);
43  m_touched = true; //FIXME : should check for a change !
44  }
45  void set_translate(const vec3f& a_v) {
46  m_value.set_translate(a_v.x(),a_v.y(),a_v.z());
47  m_touched = true; //FIXME : should check for a change !
48  }
49  void set_scale(float a_x,float a_y,float a_z) {
50  m_value.set_scale(a_x,a_y,a_z);
51  m_touched = true; //FIXME : should check for a change !
52  }
53  void set_scale(float a_s) {
54  m_value.set_scale(a_s);
55  m_touched = true; //FIXME : should check for a change !
56  }
57  void set_rotate(float a_x,float a_y,float a_z,float a_angle) {
58  m_value.set_rotate(a_x,a_y,a_z,a_angle);
59  m_touched = true; //FIXME : should check for a change !
60  }
61  void set_rotate(const vec3f& a_v,float a_angle) {
62  m_value.set_rotate(a_v.x(),a_v.y(),a_v.z(),a_angle);
63  m_touched = true; //FIXME : should check for a change !
64  }
65 
66  void mul_mtx(const mat4f& a_m,float a_tmp[]) {
67  m_value.mul_mtx(a_m,a_tmp);
68  m_touched = true;
69  }
70 
71  void mul_translate(float a_x,float a_y,float a_z) {
72  m_value.mul_translate(a_x,a_y,a_z);
73  m_touched = true;
74  }
75  void mul_translate(const vec3f& a_v) {
76  m_value.mul_translate(a_v.x(),a_v.y(),a_v.z());
77  m_touched = true;
78  }
79  void mul_scale(float a_x,float a_y,float a_z) {
80  m_value.mul_scale(a_x,a_y,a_z);
81  m_touched = true;
82  }
83  void mul_scale(float a_s) {
84  m_value.mul_scale(a_s);
85  m_touched = true;
86  }
87 
88  void mul_rotate(float a_x,float a_y,float a_z,float a_angle) {
89  m_value.mul_rotate(a_x,a_y,a_z,a_angle);
90  m_touched = true;
91  }
92 
93  void mul_rotate(const vec3f& a_axis,float a_angle) {
94  m_value.mul_rotate(a_axis.x(),a_axis.y(),a_axis.z(),a_angle);
95  m_touched = true;
96  }
97 
98  void left_mul_rotate(float a_x,float a_y,float a_z,float a_angle) {
99  m_value.left_mul_rotate(a_x,a_y,a_z,a_angle);
100  m_touched = true;
101  }
102 
103  void left_mul_scale(float a_x,float a_y,float a_z) {
104  m_value.left_mul_scale(a_x,a_y,a_z);
105  m_touched = true;
106  }
107 
108  void left_mul_translate(float a_x,float a_y,float a_z) {
109  m_value.left_mul_translate(a_x,a_y,a_z);
110  m_touched = true;
111  }
112 
113  void left_mul_translate(const vec3f& a_v) {
114  m_value.left_mul_translate(a_v.x(),a_v.y(),a_v.z());
115  m_touched = true;
116  }
117 
118  bool set_rotate(const vec3f& a_from,const vec3f& a_to,float []) {
119  rotf qr;
120  if(!qr.set_value(a_from,a_to)) return false;
121  qr.value(m_value);
122  m_touched = true;
123  return true;
124  }
125 
126  bool mul_rotate(const vec3f& a_from,const vec3f& a_to,float a_tmp[]) {
127  rotf qr;
128  if(!qr.set_value(a_from,a_to)) return false;
129  mat4f rot;
130  qr.value(rot);
131  m_value.mul_mtx(rot,a_tmp);
132  m_touched = true;
133  return true;
134  }
135 };
136 
137 }}
138 
139 #endif
tools::sg::field::m_touched
bool m_touched
Definition: field:63
tools::mat4::set_translate
void set_translate(const T &a_x, const T &a_y, const T &a_z)
Definition: mat4:60
tools::mat4::left_mul_translate
void left_mul_translate(const T &a_x, const T &a_y, const T &a_z)
Definition: mat4:297
tools::sg::sf_mat4f::operator=
sf_mat4f & operator=(const sf_mat4f &a_from)
Definition: sf_mat4f:27
tools::mat4::left_mul_scale
void left_mul_scale(const T &a_x, const T &a_y, const T &a_z)
Definition: mat4:291
tools::rotf
Definition: rotf:16
tools::mat4f::set_rotate
void set_rotate(const float &a_x, const float &a_y, const float &a_z, const float &a_angle)
Definition: mat4f:39
tools::sg::sf_mat4f::set_translate
void set_translate(const vec3f &a_v)
Definition: sf_mat4f:45
tools::sg::sf_mat4f::left_mul_scale
void left_mul_scale(float a_x, float a_y, float a_z)
Definition: sf_mat4f:103
tools::sg::sf_mat4f::set_rotate
void set_rotate(const vec3f &a_v, float a_angle)
Definition: sf_mat4f:61
tools::sg::bsf< mat4f >::m_value
mat4f m_value
Definition: bsf:120
tools::sg::sf_mat4f::sf_mat4f
sf_mat4f(const sf_mat4f &a_from)
Definition: sf_mat4f:26
tools::sg::sf_mat4f::left_mul_rotate
void left_mul_rotate(float a_x, float a_y, float a_z, float a_angle)
Definition: sf_mat4f:98
tools::sg::sf_mat4f::mul_scale
void mul_scale(float a_x, float a_y, float a_z)
Definition: sf_mat4f:79
tools::mat4::mul_translate
void mul_translate(const T &a_x, const T &a_y, const T &a_z)
Definition: mat4:272
tools::sg::sf_mat4f::left_mul_translate
void left_mul_translate(float a_x, float a_y, float a_z)
Definition: sf_mat4f:108
tools::sg::field
Definition: field:25
tools::sg::sf_mat4f::mul_scale
void mul_scale(float a_s)
Definition: sf_mat4f:83
tools::sg::sf_mat4f::set_translate
void set_translate(float a_x, float a_y, float a_z)
Definition: sf_mat4f:41
tools::sg::sf_mat4f::set_rotate
void set_rotate(float a_x, float a_y, float a_z, float a_angle)
Definition: sf_mat4f:57
tools::vec3::y
const T & y() const
Definition: vec3:85
tools::sg::sf_mat4f::operator=
sf_mat4f & operator=(const mat4f &a_value)
Definition: sf_mat4f:32
tools::sg::sf_mat4f::mul_rotate
void mul_rotate(const vec3f &a_axis, float a_angle)
Definition: sf_mat4f:93
tools::sg::sf_mat4f
Definition: sf_mat4f:18
tools::vec3::x
const T & x() const
Definition: vec3:84
tools::sg::sf_vec
Definition: sf_vec:15
tools::sg::field::operator=
field & operator=(const field &)
Definition: field:57
TOOLS_HEADER
#define TOOLS_HEADER(a__class, a__sclass, a__parent)
Definition: HEADER:10
tools::sg::sf_mat4f::mul_mtx
void mul_mtx(const mat4f &a_m, float a_tmp[])
Definition: sf_mat4f:66
sf_vec
tools::vec3f
Definition: vec3f:13
tools::mat4f::left_mul_rotate
void left_mul_rotate(const float &a_x, const float &a_y, const float &a_z, const float &a_angle)
Definition: mat4f:46
tools::sg::sf_mat4f::mul_rotate
void mul_rotate(float a_x, float a_y, float a_z, float a_angle)
Definition: sf_mat4f:88
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::mat4f::mul_rotate
void mul_rotate(const float &a_x, const float &a_y, const float &a_z, const float &a_angle)
Definition: mat4f:43
tools::mat4::mul_scale
void mul_scale(const T &a_sx, const T &a_sy, const T &a_sz)
Definition: mat4:234
tools::rotf::set_value
bool set_value(const vec3f &a_from, const vec3f &a_to)
Definition: rotf:42
tools::sg::sf_mat4f::mul_rotate
bool mul_rotate(const vec3f &a_from, const vec3f &a_to, float a_tmp[])
Definition: sf_mat4f:126
tools::sg::sf_mat4f::sf_mat4f
sf_mat4f(const mat4f &a_value)
Definition: sf_mat4f:23
tools::rotf::value
bool value(vec3f &a_from, float &a_a) const
Definition: rotf:48
tools::mat4f
Definition: mat4f:12
tools::sg::sf_mat4f::mul_translate
void mul_translate(const vec3f &a_v)
Definition: sf_mat4f:75
tools::sg::sf_mat4f::left_mul_translate
void left_mul_translate(const vec3f &a_v)
Definition: sf_mat4f:113
tools::sg::sf_mat4f::set_scale
void set_scale(float a_x, float a_y, float a_z)
Definition: sf_mat4f:49
tools::sg::sf_mat4f::~sf_mat4f
virtual ~sf_mat4f()
Definition: sf_mat4f:24
tools::sg::sf_mat4f::mul_translate
void mul_translate(float a_x, float a_y, float a_z)
Definition: sf_mat4f:71
tools::sg::sf_mat4f::set_scale
void set_scale(float a_s)
Definition: sf_mat4f:53
tools::vec3::z
const T & z() const
Definition: vec3:86
tools::sg::sf_mat4f::set_rotate
bool set_rotate(const vec3f &a_from, const vec3f &a_to, float[])
Definition: sf_mat4f:118
tools::sg::sf_mat4f::sf_mat4f
sf_mat4f()
Definition: sf_mat4f:22
tools::mat4::set_scale
void set_scale(const T &a_s)
Definition: mat4:58
tools::sg::sf_mat4f::set_identity
void set_identity()
Definition: sf_mat4f:37