g4tools  5.4.0
base_camera
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_base_camera
5 #define tools_sg_base_camera
6 
7 #include "node"
8 
9 #include "sf_vec3f"
10 #include "sf_vec4f"
11 #include "sf_rotf"
12 
13 #include "render_action"
14 #include "pick_action"
15 #include "event_action"
16 #include "visible_action"
17 #include "enums"
18 
19 #include "../mathf" //astro
20 
21 namespace tools {
22 namespace sg {
23 
24 class base_camera : public node {
26 public:
30  //Camera orientation specified as a rotation value from the default
31  //orientation where the camera is pointing along the negative z-axis,
32  //with "up" along the positive y-axis.
34 
35  //for viewers :
40 public:
41  virtual const desc_fields& node_desc_fields() const {
43  static const desc_fields s_v(parent::node_desc_fields(),8, //WARNING : take care of count.
52  );
53  return s_v;
54  }
55 private:
56  void add_fields(){
57  add_field(&znear);
58  add_field(&zfar);
61 
62  add_field(&dx);
63  add_field(&da);
64  add_field(&ds);
65  add_field(&focal);
66  }
67 public:
68  virtual float near_height() const = 0;
69  virtual void zoom(float) = 0;
70  virtual camera_type type() const = 0;
71  virtual void get_lrbt(unsigned int,unsigned int,
72  float&,float&,float&,float&) = 0;
73 public:
74  virtual void render(render_action& a_action) {
75  _mult_matrix(a_action);
76  set_state(a_action);
77  //{mat4f& _mtx = a_action.projection_matrix();
78  // a_action.out() << "debug : tools::sg::base_camera::render : proj :" << std::endl;
79  // a_action.out() << _mtx << std::endl;}
80  a_action.load_proj_matrix(a_action.projection_matrix());
81  a_action.load_model_matrix(a_action.model_matrix());
82  }
83  virtual void pick(pick_action& a_action) {
84  _mult_matrix(a_action);
85  set_state(a_action);
86  }
87  virtual void event(event_action& a_action){
88  _mult_matrix(a_action);
89  set_state(a_action);
90  }
91  virtual void get_matrix(get_matrix_action& a_action){
92  _mult_matrix(a_action);
93  set_state(a_action);
94  }
95  virtual void is_visible(visible_action& a_action){
96  _mult_matrix(a_action);
97  set_state(a_action);
98  }
99 protected:
101  :parent()
102  ,znear(1)
103  ,zfar(10)
104  ,position(vec3f(0,0,1))
105  ,orientation(rotf(vec3f(0,0,1),0)) //quat = vec4f(0,0,0,1)
106  ,dx(0.01f)
107  ,da(0.017f) //one degree.
108  ,ds(0.99f)
109  ,focal(1)
110  {
111 #ifdef TOOLS_MEM
112  mem::increment(s_class().c_str());
113 #endif
114  add_fields();
115  }
116 public:
117  virtual ~base_camera(){
118 #ifdef TOOLS_MEM
119  mem::decrement(s_class().c_str());
120 #endif
121  }
122 protected:
123  base_camera(const base_camera& a_from)
124  :parent(a_from)
125  ,znear(a_from.znear)
126  ,zfar(a_from.zfar)
127  ,position(a_from.position)
128  ,orientation(a_from.orientation)
129  ,dx(a_from.dx)
130  ,da(a_from.da)
131  ,ds(a_from.ds)
132  ,focal(a_from.focal)
133  {
134 #ifdef TOOLS_MEM
135  mem::increment(s_class().c_str());
136 #endif
137  add_fields();
138  }
140  parent::operator=(a_from);
141  znear = a_from.znear;
142  zfar = a_from.zfar;
143  position = a_from.position;
144  orientation = a_from.orientation;
145  dx = a_from.dx;
146  da = a_from.da;
147  ds = a_from.ds;
148  focal = a_from.focal;
149  m_lrbt.set_value(0,0,0,0);
150  return *this;
151  }
152 protected: //operators:
153  bool operator==(const base_camera& a_from) const{
154  if(znear!=a_from.znear) return false;
155  if(zfar!=a_from.zfar) return false;
156  if(position!=a_from.position) return false;
157  if(orientation!=a_from.orientation) return false;
158  //we do not test dx,da,ds.
159  return true;
160  }
161  //bool operator!=(const base_camera& a_from) const {
162  // return !operator==(a_from);
163  //}
164 public:
165  void direction(vec3f& a_dir) const {
166  orientation.value().mul_vec(vec3f(0,0,-1),a_dir);
167  }
168 
169  void rotate_around_direction(float a_delta) {
170  //vec3f dir;
171  //orientation.value().mul_vec(vec3f(0,0,-1),dir);
172  //orientation.value(rotf(dir,a_delta) * orientation.value());
173  orientation.value(rotf(vec3f(0,0,-1),a_delta) * orientation.value());
174  }
175 
176  void rotate_around_z(float a_delta) {
177  //vec3f z;
178  //orientation.value().mul_vec(vec3f(0,0,1),z);
179  //orientation.value(rotf(z,a_delta) * orientation.value());
180  orientation.value(rotf(vec3f(0,0,1),a_delta) * orientation.value());
181  }
182 
183  void rotate_around_up(float a_delta){
184  vec3f up;
185  orientation.value().mul_vec(vec3f(0,1,0),up);
186  //orientation.value(rotf(up,a_delta) * orientation.value());
187  // must be the below so that rot-cam works for exlib/cbk/[astro,cfitsio] astro setup.
188  // (astro setup change camera orientation).
189  orientation.value(orientation.value() * rotf(up,a_delta));
190  }
191 
192  void rotate_around_x(float a_delta){
193  orientation.value(rotf(vec3f(1,0,0),a_delta) * orientation.value());
194  }
195 
196  void rotate_around_x_at_focal(float a_delta){
197  //from coin SoGuiExaminerViewerP::rotXWheelMotion.
198  vec3f dir;
199  orientation.value().mul_vec(vec3f(0,0,-1),dir);
200  vec3f focalpoint = position.value() + focal * dir;
201  orientation.value(rotf(vec3f(1,0,0),a_delta) * orientation.value());
202  orientation.value().mul_vec(vec3f(0,0,-1),dir);
203  position = focalpoint - focal * dir;
204  }
205 
206  void rotate_around_y_at_focal(float a_delta){
207  //from coin SoGuiExaminerViewerP::rotYWheelMotion.
208  vec3f dir;
209  orientation.value().mul_vec(vec3f(0,0,-1),dir);
210  vec3f focalpoint = position.value() + focal * dir;
211  orientation.value(rotf(vec3f(0,1,0),a_delta) * orientation.value());
212  orientation.value().mul_vec(vec3f(0,0,-1),dir);
213  position = focalpoint - focal * dir;
214  }
215 
216  void rotate_around_z_at_focal(float a_delta){
217  //from coin SoGuiExaminerViewerP::rotYWheelMotion.
218  vec3f dir;
219  orientation.value().mul_vec(vec3f(0,0,-1),dir);
220  vec3f focalpoint = position.value() + focal * dir;
221  orientation.value(rotf(vec3f(0,0,1),a_delta) * orientation.value());
222  orientation.value().mul_vec(vec3f(0,0,-1),dir);
223  position = focalpoint - focal * dir;
224  }
225 
226  void rotate_to_dir(const vec3f& a_dir) {
227  //rotate around up so that a_dir is in (dir,up) plane
228 
229  //NOTE : it is the invert of orientation which is used
230  // in projection matrix.
231 
232  {vec3f dir;
233  orientation.value().mul_vec(vec3f(0,0,-1),dir);
234  vec3f up;
235  orientation.value().mul_vec(vec3f(0,1,0),up);
236  vec3f side;dir.cross(up,side);
237  vec3f v = side * (side.dot(a_dir)) + dir * (dir.dot(a_dir));
238  if(v.normalize()) orientation.value(orientation.value()*rotf(dir,v));}
239 
240  //rotate around dir^up so that a_dir matches dir.
241  {vec3f dir;
242  orientation.value().mul_vec(vec3f(0,0,-1),dir);
243  orientation.value(orientation.value()*rotf(dir,a_dir));}
244 
245 /*
246  //check that dir is on a_dir :
247  {vec3f dir;
248  orientation.value().mul_vec(vec3f(0,0,-1),dir);
249  float cos_angle; //it should be 1
250  if(!dir.cos_angle(a_dir,cos_angle)) {
251  ::printf("debug : can't get angle\n");
252  return;
253  }
254  ::printf("debug : cos_angle %g\n",cos_angle);}
255 */
256  }
257 
258  void pane_to(float a_x,float a_y,float a_z){
259  //translate in view plane so that (a_x,a_y,a_z) is on direction.
260 
261  vec3f dir;
262  orientation.value().mul_vec(vec3f(0,0,-1),dir);
263  vec3f up;
264  orientation.value().mul_vec(vec3f(0,1,0),up);
265  vec3f side;dir.cross(up,side);
266 
267  vec3f d(a_x,a_y,a_z);
268  d.subtract(position.value());
269 
270  vec3f pos = position.value() + side * (side.dot(d)) + up * (up.dot(d));
271  position.value(pos);
272  }
273 
274  void translate_along_side(float a_delta){
275  vec3f dir;
276  orientation.value().mul_vec(vec3f(0,0,-1),dir);
277  vec3f up;
278  orientation.value().mul_vec(vec3f(0,1,0),up);
279  vec3f side;dir.cross(up,side);
280  vec3f pos = position.value() + side * a_delta;
281  position.value(pos);
282  }
283  void translate_along_up(float a_delta){
284  vec3f dir;
285  orientation.value().mul_vec(vec3f(0,0,-1),dir);
286  vec3f up;
287  orientation.value().mul_vec(vec3f(0,1,0),up);
288  vec3f pos = position.value() + up * a_delta;
289  position.value(pos);
290  }
291  void translate_along_dir(float a_delta){
292  vec3f dir;
293  orientation.value().mul_vec(vec3f(0,0,-1),dir);
294  vec3f pos = position.value() + dir * a_delta;
295  position.value(pos);
296  }
297 
298  bool look_at(const vec3f& a_dir,const vec3f& a_up) {
299  vec3f z = -a_dir;
300  vec3f y = a_up;
301  vec3f x;y.cross(z,x);
302 
303  // recompute y to create a valid coordinate system
304  z.cross(x,y);
305 
306  // normalize x and y to create an orthonormal coord system
307  if(!x.normalize()) return false;
308  if(!y.normalize()) return false;
309  if(!z.normalize()) return false;
310 
311  // create a rotation matrix
312  mat4f rot;
313  rot.set_identity();
314  rot.set_value(0,0,x[0]);
315  rot.set_value(1,0,x[1]);
316  rot.set_value(2,0,x[2]);
317 
318  rot.set_value(0,1,y[0]);
319  rot.set_value(1,1,y[1]);
320  rot.set_value(2,1,y[2]);
321 
322  rot.set_value(0,2,z[0]);
323  rot.set_value(1,2,z[1]);
324  rot.set_value(2,2,z[2]);
325 
326  orientation.value().set_value(rot);
327  return true;
328  }
329 
330  //NOTE : print is a Python keyword.
331  void dump(std::ostream& a_out) {
332  a_out << " znear " << znear.value() << std::endl;
333  a_out << " zfar " << zfar.value() << std::endl;
334  vec3f& pos = position.value();
335  a_out << " pos " << pos[0] << " " << pos[1] << " " << pos[2] << std::endl;
336  //FIXME : dump orientation.
337  }
338 
339  bool is_type_ortho() const {return type()==camera_ortho?true:false;}
340 
341  bool height_at_focal(float& a_h) const {
342  if(is_type_ortho()) {
343  a_h = near_height();
344  } else {
345  if(!znear.value()) {a_h = near_height();return false;}
346  a_h = focal.value()*near_height()/znear.value();
347  }
348  return true;
349  }
350 
351  void astro_orientation(float a_ra,float a_dec/*,const vec3f& a_center*/) {
352  // a_ra, a_dec are in decimal degrees.
353 
354  // Camera default point toward -z with up along +y and +x at right.
355 
356  // Arrange so that camera points toward x with up along +z :
357  rotf r(vec3f::s_y(),-fhalf_pi());
358  r *= rotf(vec3f::s_x(),fhalf_pi());
359  // Now -y is at right.
360 
361  // Then rotate it so that it points toward given (ra,dec) by keeping up upward +z direction.
362  r *= rotf(vec3f::s_y(),-a_dec*fdeg2rad());
363  r *= rotf(vec3f::s_z(),a_ra*fdeg2rad());
364  orientation = r;
365 
366 /*
367  position = a_center*0.99f;
368  znear = 0.1f;
369  zfar = 200.0f;
370  focal = (a_center-position).length();
371 */
372 /*
373  position = vec3f(0,0,0);
374  znear = 1.0f;
375  zfar = 2000.0f; //2*sky_radius.
376  focal = a_center.length();
377  da = 0.017f/100; //1/100 of a degree
378 */
379  }
380 
381  bool update_motion(int a_move) {
382  float _dx = dx;
383  float _da = da;
384  float _ds = ds;
385 
386  if(a_move==move_rotate_right) { //should match camera_yaw().
387  rotate_around_up(_da);
388  return true;
389  }
390  if(a_move==move_rotate_left) {
391  rotate_around_up(-_da);
392  return true;
393  }
394 
395  if(a_move==move_rotate_up) { //should match camera_pitch().
396  rotate_around_x(_da);
397  return true;
398  }
399  if(a_move==move_rotate_down) {
400  rotate_around_x(-_da);
401  return true;
402  }
403 
404  if(a_move==move_roll_plus) { //should match camera_roll().
405  rotate_around_direction(-_da); //direction = -z, then the minus.
406  return true;
407  }
408  if(a_move==move_roll_minus) {
410  return true;
411  }
412 
413  if(a_move==move_translate_right) {
415  return true;
416  }
417  if(a_move==move_translate_left) {
418  translate_along_side(-_dx);
419  return true;
420  }
421 
422  if(a_move==move_up) {
423  translate_along_up(_dx);
424  return true;
425  }
426  if(a_move==move_down) {
427  translate_along_up(-_dx);
428  return true;
429  }
430  if(a_move==move_forward) {
431  translate_along_dir(_dx);
432  return true;
433  }
434  if(a_move==move_backward) {
435  translate_along_dir(-_dx);
436  return true;
437  }
438  if(a_move==move_zoom_in) {
439  zoom(_ds);
440  return true;
441  }
442  if(a_move==move_zoom_out) {
443  zoom(1.0f/_ds);
444  return true;
445  }
446 
447  if(a_move==move_rotate_around_focal_right) { //yaw around focal.
449  return true;
450  }
451  if(a_move==move_rotate_around_focal_left) {
453  return true;
454  }
455  if(a_move==move_rotate_around_focal_up) { //pitch around focal.
457  return true;
458  }
459  if(a_move==move_rotate_around_focal_down) {
461  return true;
462  }
463  if(a_move==move_roll_around_focal_plus) {
465  return true;
466  }
467  if(a_move==move_roll_around_focal_minus) {
469  return true;
470  }
471 
472  return false;
473  }
474 protected:
475  void update_sg(std::ostream& a_out) {
476 
477  {const vec4f& v = m_lrbt.value();
478  float l = v[0];
479  float r = v[1];
480  float b = v[2];
481  float t = v[3];
482  float n = znear.value();
483  float f = zfar.value();
484  if(is_type_ortho()) {
485  m_proj.set_ortho(l,r,b,t,n,f);
486  } else {
487  m_proj.set_frustum(l,r,b,t,n,f);
488  }}
489 
490  if(orientation.value().quat()!=id_orientation()) //OPTIMIZATION
491  {rotf rinv;
492  if(orientation.value().inverse(rinv)) {
493  mat4f mtx;
494  rinv.value(mtx);
495  m_proj.mul_mtx(mtx,m_tmp);
496  } else {
497  a_out << "update_sg :"
498  << " get orientation inverse failed."
499  << std::endl;
500  }}
501 
503  -position.value()[1],
504  -position.value()[2]);
505  }
506 
507  void _mult_matrix(matrix_action& a_action) {
508  float l,r,b,t;
509  get_lrbt(a_action.ww(),a_action.wh(),l,r,b,t);
510  m_lrbt.set_value(l,r,b,t);
511 
512  if(touched()||m_lrbt.touched()) {
513  update_sg(a_action.out());
514  reset_touched();
516  }
517 
518  a_action.projection_matrix().mul_mtx(m_proj,m_tmp);
519  }
520 
521  void set_state(matrix_action& a_action) {
522  state& _state = a_action.state();
523  _state.m_camera_ortho = is_type_ortho();
524  _state.m_camera_znear = znear;
525  _state.m_camera_zfar = zfar;
526  _state.m_camera_position = position.value();
528  //_state.m_camera_near_height = near_height();
529  _state.m_camera_lrbt = m_lrbt.value();
530  _state.m_proj = a_action.projection_matrix();
531  }
532 
533 #if defined(TOOLS_MEM) && !defined(TOOLS_MEM_ATEXIT)
534  static const vec4<float>& id_orientation() {static const vec4<float> s_v(0,0,0,1,false);return s_v;}
535 #else
536  static const vec4<float>& id_orientation() {static const vec4<float> s_v(0,0,0,1);return s_v;}
537 #endif
538 
539 protected:
540  //OPTIMIZATION :
543  float m_tmp[16];
544 };
545 
546 }}
547 
548 #endif
tools::sg::base_camera::rotate_around_z_at_focal
void rotate_around_z_at_focal(float a_delta)
Definition: base_camera:216
sf_vec4f
tools::sg::move_rotate_around_focal_down
@ move_rotate_around_focal_down
Definition: enums:129
tools::fdeg2rad
float fdeg2rad()
Definition: mathf:18
tools::sg::base_camera::rotate_around_up
void rotate_around_up(float a_delta)
Definition: base_camera:183
node
tools::sg::base_camera::id_orientation
static const vec4< float > & id_orientation()
Definition: base_camera:536
tools::sg::base_camera::orientation
sf_rotf orientation
Definition: base_camera:33
tools::sg::move_roll_minus
@ move_roll_minus
Definition: enums:116
tools::sg::base_camera::dump
void dump(std::ostream &a_out)
Definition: base_camera:331
tools::sg::base_camera::update_motion
bool update_motion(int a_move)
Definition: base_camera:381
tools::sg::state
Definition: state:25
tools::sg::base_camera::pane_to
void pane_to(float a_x, float a_y, float a_z)
Definition: base_camera:258
tools::rotf
Definition: rotf:16
tools::sg::move_roll_around_focal_minus
@ move_roll_around_focal_minus
Definition: enums:131
tools::sg::matrix_action::model_matrix
mat4f & model_matrix()
Definition: matrix_action:73
tools::sg::event_action
Definition: event_action:14
tools::sg::base_camera::position
sf_vec3f position
Definition: base_camera:29
pick_action
tools::sg::base_camera::_mult_matrix
void _mult_matrix(matrix_action &a_action)
Definition: base_camera:507
tools::vec3< float >::s_z
static const vec3< float > & s_z()
Definition: vec3:307
tools::qrot::mul_vec
void mul_vec(const VEC3 &a_in, VEC3 &a_out) const
Definition: qrot:297
render_action
tools::sg::move_rotate_around_focal_left
@ move_rotate_around_focal_left
Definition: enums:127
tools::sg::camera_type
camera_type
Definition: enums:167
tools::sg::field::reset_touched
void reset_touched()
Definition: field:61
tools::sg::win_action::ww
unsigned int ww() const
Definition: win_action:34
tools::sg::state::m_camera_znear
float m_camera_znear
Definition: state:273
tools::sg::node
Definition: node:28
tools::sg::sf_vec3f
Definition: sf_vec3f:14
tools::sg::base_camera::rotate_around_direction
void rotate_around_direction(float a_delta)
Definition: base_camera:169
tools::sg::win_action::wh
unsigned int wh() const
Definition: win_action:35
tools::mat4::set_frustum
void set_frustum(const T &a_l, const T &a_r, const T &a_b, const T &a_t, const T &a_n, const T &a_f)
Definition: mat4:97
tools::sg::base_camera::type
virtual camera_type type() const =0
tools::mat4::mul_translate
void mul_translate(const T &a_x, const T &a_y, const T &a_z)
Definition: mat4:272
tools::sg::base_camera::m_lrbt
sf_vec4f m_lrbt
Definition: base_camera:541
event_action
tools::sg::base_camera::direction
void direction(vec3f &a_dir) const
Definition: base_camera:165
tools::sg::state::m_camera_lrbt
vec4f m_camera_lrbt
Definition: state:278
tools::sg::matrix_action
Definition: matrix_action:15
tools::sg::base_camera::rotate_around_x_at_focal
void rotate_around_x_at_focal(float a_delta)
Definition: base_camera:196
tools::sg::base_camera::near_height
virtual float near_height() const =0
tools::sg::base_camera::translate_along_up
void translate_along_up(float a_delta)
Definition: base_camera:283
tools::qrot::quat
const VEC4 & quat() const
Definition: qrot:366
tools::sg::base_camera::ds
sf< float > ds
Definition: base_camera:38
tools::sg::move_roll_plus
@ move_roll_plus
Definition: enums:115
tools::sg::move_backward
@ move_backward
Definition: enums:123
tools::sg::desc_fields
Definition: field_desc:148
tools::sg::base_camera::rotate_around_y_at_focal
void rotate_around_y_at_focal(float a_delta)
Definition: base_camera:206
tools::sg::field::touched
bool touched() const
Definition: field:60
tools::sg::pick_action
Definition: pick_action:59
tools::sg::base_camera::height_at_focal
bool height_at_focal(float &a_h) const
Definition: base_camera:341
tools::sg::base_camera::zfar
sf< float > zfar
Definition: base_camera:28
tools::sg::move_translate_right
@ move_translate_right
Definition: enums:118
tools::sg::state::m_camera_orientation
rotf m_camera_orientation
Definition: state:276
tools::vec3< float >::s_y
static const vec3< float > & s_y()
Definition: vec3:306
sf_vec3f
tools::sg::base_camera::m_tmp
float m_tmp[16]
Definition: base_camera:543
tools::sg::base_camera::operator==
bool operator==(const base_camera &a_from) const
Definition: base_camera:153
tools::sg::base_camera::get_lrbt
virtual void get_lrbt(unsigned int, unsigned int, float &, float &, float &, float &)=0
tools::sg::state::m_camera_ortho
bool m_camera_ortho
Definition: state:272
tools::sg::base_camera::operator=
base_camera & operator=(const base_camera &a_from)
Definition: base_camera:139
TOOLS_HEADER
#define TOOLS_HEADER(a__class, a__sclass, a__parent)
Definition: HEADER:10
tools::sg::base_camera::astro_orientation
void astro_orientation(float a_ra, float a_dec)
Definition: base_camera:351
tools::sg::move_rotate_down
@ move_rotate_down
Definition: enums:114
tools::sg::base_camera::dx
sf< float > dx
Definition: base_camera:36
tools::sg::move_roll_around_focal_plus
@ move_roll_around_focal_plus
Definition: enums:130
tools::vec3::subtract
void subtract(const vec3 &a_v)
Definition: vec3:187
tools::sg::base_camera::m_proj
mat4f m_proj
Definition: base_camera:542
tools::sg::base_camera::zoom
virtual void zoom(float)=0
tools::sg::render_action::load_proj_matrix
virtual void load_proj_matrix(const mat4f &)=0
tools::mat4::set_ortho
void set_ortho(const T &a_l, const T &a_r, const T &a_b, const T &a_t, const T &a_n, const T &a_f)
Definition: mat4:64
tools::vec3f
Definition: vec3f:13
tools::sg::render_action
Definition: render_action:24
tools::sg::base_camera::is_type_ortho
bool is_type_ortho() const
Definition: base_camera:339
tools::sg::base_camera::rotate_around_z
void rotate_around_z(float a_delta)
Definition: base_camera:176
tools::sg::base_camera::node_desc_fields
virtual const desc_fields & node_desc_fields() const
Definition: base_camera:41
tools::sg::state::m_camera_zfar
float m_camera_zfar
Definition: state:274
tools::sg::sf_rotf
Definition: sf_rotf:16
tools::vec3::cross
void cross(const vec3< T > &aV, vec3< T > &a_value) const
Definition: vec3:131
tools::sg::base_camera::rotate_to_dir
void rotate_to_dir(const vec3f &a_dir)
Definition: base_camera:226
visible_action
tools::sg::base_camera::da
sf< float > da
Definition: base_camera:37
tools::sg::move_translate_left
@ move_translate_left
Definition: enums:119
tools::sg::base_camera::translate_along_side
void translate_along_side(float a_delta)
Definition: base_camera:274
tools::sg::base_camera::rotate_around_x
void rotate_around_x(float a_delta)
Definition: base_camera:192
tools::sg::camera_ortho
@ camera_ortho
Definition: enums:168
tools::sg::get_matrix_action
Definition: get_matrix_action:17
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::sg::base_camera::focal
sf< float > focal
Definition: base_camera:39
tools::sg::base_camera::event
virtual void event(event_action &a_action)
Definition: base_camera:87
tools::sg::state::m_proj
mat4f m_proj
Definition: state:244
tools::rotf::set_value
bool set_value(const vec3f &a_from, const vec3f &a_to)
Definition: rotf:42
tools::sg::node::add_field
void add_field(field *a_field)
Definition: node:128
tools::sg::base_camera::look_at
bool look_at(const vec3f &a_dir, const vec3f &a_up)
Definition: base_camera:298
tools::sg::move_forward
@ move_forward
Definition: enums:122
tools::sg::move_up
@ move_up
Definition: enums:120
tools::sg::base_camera::~base_camera
virtual ~base_camera()
Definition: base_camera:117
tools::fhalf_pi
float fhalf_pi()
Definition: mathf:13
tools::sg::move_zoom_out
@ move_zoom_out
Definition: enums:125
enums
tools::vec3< float >::s_x
static const vec3< float > & s_x()
Definition: vec3:305
tools::rotf::value
bool value(vec3f &a_from, float &a_a) const
Definition: rotf:48
tools::mat4f
Definition: mat4f:12
tools::sg::base_camera::render
virtual void render(render_action &a_action)
Definition: base_camera:74
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::sg::move_rotate_around_focal_right
@ move_rotate_around_focal_right
Definition: enums:126
tools::sg::sf_vec4f::set_value
void set_value(float a_0, float a_1, float a_2, float a_3)
Definition: sf_vec4f:31
tools::sg::move_rotate_left
@ move_rotate_left
Definition: enums:112
sf_rotf
tools::sg::base_camera::base_camera
base_camera(const base_camera &a_from)
Definition: base_camera:123
tools::sg::render_action::load_model_matrix
virtual void load_model_matrix(const mat4f &)=0
tools::sg::state::m_camera_position
vec3f m_camera_position
Definition: state:275
tools::sg::move_rotate_right
@ move_rotate_right
Definition: enums:111
tools::sg::bsf::value
T & value()
Definition: bsf:98
tools::sg::action::out
std::ostream & out() const
Definition: action:51
tools::sg::base_camera
Definition: base_camera:24
tools::sg::base_camera::set_state
void set_state(matrix_action &a_action)
Definition: base_camera:521
tools::sg::sf_vec4f
Definition: sf_vec4f:15
tools::sg::base_camera::update_sg
void update_sg(std::ostream &a_out)
Definition: base_camera:475
tools::sg::move_rotate_around_focal_up
@ move_rotate_around_focal_up
Definition: enums:128
tools::vec3f::normalize
float normalize()
Definition: vec3f:74
tools::sg::base_camera::translate_along_dir
void translate_along_dir(float a_delta)
Definition: base_camera:291
tools::qrot::inverse
bool inverse(qrot &a_r) const
Definition: qrot:92
tools::sg::base_camera::znear
sf< float > znear
Definition: base_camera:27
tools::sg::base_camera::base_camera
base_camera()
Definition: base_camera:100
tools::vec4< float >
tools::sg::states::state
const sg::state & state() const
Definition: states:76
tools::sg::visible_action
Definition: visible_action:12
tools::sg::base_camera::is_visible
virtual void is_visible(visible_action &a_action)
Definition: base_camera:95
tools::sg::move_rotate_up
@ move_rotate_up
Definition: enums:113
tools::sg::node::touched
virtual bool touched()
Definition: node:96
tools::sg::matrix_action::projection_matrix
mat4f & projection_matrix()
Definition: matrix_action:72
tools::sg::move_down
@ move_down
Definition: enums:121
tools::sg::sf< float >
tools::vec4f
Definition: vec4f:13
tools::sg::move_zoom_in
@ move_zoom_in
Definition: enums:124
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71
tools::sg::base_camera::pick
virtual void pick(pick_action &a_action)
Definition: base_camera:83
tools::sg::node::reset_touched
virtual void reset_touched()
Definition: node:102
tools::sg::base_camera::get_matrix
virtual void get_matrix(get_matrix_action &a_action)
Definition: base_camera:91
tools::vec3::dot
T dot(const vec3 &aV) const
Definition: vec3:125