Graphite  Version 3
An experimental 3D geometry processing program
transform3d.h
Go to the documentation of this file.
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 
38 #ifndef H_OGF_SCENE_GRAPH_GFX_TRANSFORMS_TRANSFORM3D_H
39 #define H_OGF_SCENE_GRAPH_GFX_TRANSFORMS_TRANSFORM3D_H
40 
41 #include <OGF/scene_graph_gfx/common/common.h>
42 #include <OGF/gom/types/node.h>
44 
50 namespace OGF {
51 
52 //_________________________________________________________
53 
54 
58  gom_class SCENE_GRAPH_GFX_API Transform3d : public Object {
59  public:
64 
68  ~Transform3d() override;
69 
70 
71  gom_properties:
76  const vec3& get_look_at() const {
77  return look_at_;
78  }
79 
84  void set_look_at(const vec3& value) {
85  look_at_ = value;
86  update_matrix();
87  }
88 
94  const vec3& get_u() const {
95  return u_;
96  }
97 
103  void set_u(const vec3& value) {
104  u_ = value;
105  update_matrix();
106  }
107 
113  const vec3& get_v() const {
114  return v_;
115  }
116 
122  void set_v(const vec3& value) {
123  v_ = value;
124  update_matrix();
125  }
126 
132  const vec3& get_w() const {
133  return w_;
134  }
135 
141  void set_w(const vec3& value) {
142  w_ = value;
143  update_matrix();
144  }
145 
153  double get_delta_location() const {
154  return delta_location_;
155  }
156 
164  void set_delta_location(double value) {
165  delta_location_ = value;
166  }
167 
175  double get_delta_angle() const {
176  return delta_angle_;
177  }
178 
186  void set_delta_angle(double value) {
187  delta_angle_ = value;
188  }
189 
194  double get_zoom() const {
195  return zoom_;
196  }
197 
202  void set_zoom(double value) {
203  zoom_ = value ;
204  update_matrix() ;
205  }
206 
212  double get_delta_zoom() const {
213  return delta_zoom_;
214  }
215 
221  void set_delta_zoom(double value) {
222  delta_zoom_ = value;
223  }
224 
230  const mat4& get_matrix() const {
231  return matrix_;
232  }
233 
240  void set_matrix(const mat4& value) {
241  matrix_ = value;
242  }
243 
250  const mat4& get_rotation_matrix() const ;
251 
258  void set_rotation_matrix(const mat4& value) ;
259 
265  const vec3& get_default_look_at() const {
266  return default_look_at_;
267  }
268 
274  void set_default_look_at(const vec3& value) {
275  default_look_at_ = value;
276  }
277 
283  const vec3& get_default_u() const {
284  return default_u_;
285  }
286 
292  void set_default_u(const vec3& value) {
293  default_u_ = value;
294  }
295 
301  const vec3& get_default_v() const {
302  return default_v_;
303  }
304 
310  void set_default_v(const vec3& value) {
311  default_v_ = value;
312  }
313 
319  const vec3& get_default_w() const {
320  return default_w_;
321  }
322 
328  void set_default_w(const vec3& value) {
329  default_w_ = value;
330  }
331 
337  double get_default_zoom() const {
338  return default_zoom_;
339  }
340 
346  void set_default_zoom(double value) {
347  default_zoom_ = value;
348  }
349 
350  gom_slots:
355  void reset() ;
356 
362  void move_left(double value = 1.0) ;
363 
369  void move_right(double value = 1.0) ;
370 
376  void move_up(double value = 1.0) ;
377 
383  void move_down(double value = 1.0) ;
384 
390  void move_forward(double value = 1.0) ;
391 
397  void move_backward(double value = 1.0) ;
398 
405  void turn_left(double value = 1.0) ;
406 
413  void turn_right(double value = 1.0) ;
414 
422  void tilt_up(double value = 1.0) ;
423 
431  void tilt_down(double value = 1.0) ;
432 
439  void tilt_left(double value = 1.0) ;
440 
447  void tilt_right(double value = 1.0) ;
448 
457  void translate(const vec3& value) ;
458 
464  void rotate(const mat4& value) ;
465 
471  void zoom_in(double value = 1.0) ;
472 
478  void zoom_out(double value = 1.0) ;
479 
485  void zoom_mult(double value = 1.0) ;
486 
487  gom_signals:
494  void value_changed(const mat4& value) ;
495 
502  void rotation_changed(const mat4& value) ;
503 
504  protected:
510  void update_matrix(bool send_signal = true) ;
511 
512  private:
513  vec3 look_at_ ;
514  vec3 u_ ;
515  vec3 v_ ;
516  vec3 w_ ;
517 
518  vec3 default_look_at_ ;
519  vec3 default_u_ ;
520  vec3 default_v_ ;
521  vec3 default_w_ ;
522  double default_zoom_ ;
523 
524  double delta_location_ ;
525  double delta_angle_ ;
526  double zoom_ ;
527  double delta_zoom_ ;
528  mat4 matrix_ ;
529  } ;
530 
531 //_________________________________________________________
532 
533 }
534 #endif
Base class for all objects in the GOM system.
Definition: object.h:65
Controls a 3d transform by different means.
Definition: transform3d.h:58
void move_up(double value=1.0)
translates to the up, along the v vector.
Transform3d()
Transform3d constructor.
void tilt_left(double value=1.0)
Tilt towards the left.
const vec3 & get_u() const
Gets the u vector.
Definition: transform3d.h:94
void rotation_changed(const mat4 &value)
A signal that is triggered each time the rotational component of the transform changes.
void set_u(const vec3 &value)
Sets the u vector.
Definition: transform3d.h:103
double get_zoom() const
Gets the zooming factor.
Definition: transform3d.h:194
void set_default_zoom(double value)
Sets the default zoom factor.
Definition: transform3d.h:346
void rotate(const mat4 &value)
Applies a rotation.
void update_matrix(bool send_signal=true)
Updates the matrix representation of the transform.
void set_delta_zoom(double value)
Sets the increment for zooming.
Definition: transform3d.h:221
double get_delta_angle() const
Gets the increment for angle changes.
Definition: transform3d.h:175
const vec3 & get_w() const
Gets the w vector.
Definition: transform3d.h:132
const vec3 & get_default_look_at() const
Gets the default origin.
Definition: transform3d.h:265
void zoom_mult(double value=1.0)
Applies a scaling to the current zoom.
const vec3 & get_default_u() const
Gets the default u vector.
Definition: transform3d.h:283
void turn_right(double value=1.0)
Turn to the right.
void set_default_v(const vec3 &value)
Sets the default v vector.
Definition: transform3d.h:310
const vec3 & get_v() const
Gets the v vector.
Definition: transform3d.h:113
void set_matrix(const mat4 &value)
Sets the current transform.
Definition: transform3d.h:240
void tilt_right(double value=1.0)
Tilt towards the right.
void move_backward(double value=1.0)
translates to the back, along the w vector.
void move_down(double value=1.0)
translates to the bottom, along the v vector.
const mat4 & get_rotation_matrix() const
Gets the rotational part of the current transform.
void set_default_w(const vec3 &value)
Sets the default w vector.
Definition: transform3d.h:328
const mat4 & get_matrix() const
Gets the current transform.
Definition: transform3d.h:230
void move_forward(double value=1.0)
translates to the front, along the w vector.
double get_default_zoom() const
Gets the default zoom factor.
Definition: transform3d.h:337
const vec3 & get_default_v() const
Gets the default v vector.
Definition: transform3d.h:301
void set_w(const vec3 &value)
Sets the w vector.
Definition: transform3d.h:141
void turn_left(double value=1.0)
Turn to the left.
void zoom_out(double value=1.0)
Zooms out.
~Transform3d() override
Transform3d destructor.
void zoom_in(double value=1.0)
Zooms in.
void set_look_at(const vec3 &value)
Sets the origin.
Definition: transform3d.h:84
void tilt_down(double value=1.0)
Tilt towards the bottom.
const vec3 & get_default_w() const
Gets the default w vector.
Definition: transform3d.h:319
void translate(const vec3 &value)
Applies a translation.
void set_zoom(double value)
Sets the zooming factor.
Definition: transform3d.h:202
void set_default_u(const vec3 &value)
Sets the default u vector.
Definition: transform3d.h:292
double get_delta_zoom() const
Gets the increment for zooming.
Definition: transform3d.h:212
void move_right(double value=1.0)
translates to the right, along the u vector.
void set_rotation_matrix(const mat4 &value)
Sets the rotational part of the current transform.
void set_default_look_at(const vec3 &value)
Sets the default origin.
Definition: transform3d.h:274
void set_delta_location(double value)
Sets the increment for position changes.
Definition: transform3d.h:164
void set_delta_angle(double value)
Sets the increment for angle changes.
Definition: transform3d.h:186
void move_left(double value=1.0)
translates to the left, along the u vector.
double get_delta_location() const
Gets the increment for position changes.
Definition: transform3d.h:153
void set_v(const vec3 &value)
Sets the v vector.
Definition: transform3d.h:122
void tilt_up(double value=1.0)
Tilt towards the up.
Global Graphite namespace.
Definition: common.h:76
The base class for all composite objects in the GOM system.
Simple geometric objects and manipulations.