SCM Library
Spherical Cube Map rendering library
 All Classes Files Functions Variables Friends Pages
scm-step.hpp
1 // Copyright (C) 2011-2012 Robert Kooima
2 //
3 // LIBSCM is free software; you can redistribute it and/or modify it under the
4 // terms of the GNU General Public License as published by the Free Software
5 // Foundation; either version 2 of the License, or (at your option) any later
6 // version.
7 //
8 // This program is distributed in the hope that it will be useful, but WITH-
9 // OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 // more details.
12 
13 #ifndef SCM_STEP_HPP
14 #define SCM_STEP_HPP
15 
16 #include <string>
17 #include <vector>
18 
19 //------------------------------------------------------------------------------
20 
31 
32 class scm_step
33 {
34 public:
35 
38 
39  scm_step();
40  scm_step(const scm_step *a);
41  scm_step(const scm_step *a,
42  const scm_step *b, double t);
43  scm_step(const scm_step *a,
44  const scm_step *b,
45  const scm_step *c,
46  const scm_step *d, double t);
47  scm_step(const double *t,
48  const double *r,
49  const double *l);
50 
54 
55  void set_name (const std::string& s);
56  void set_foreground (const std::string& s);
57  void set_background (const std::string& s);
58 
59  void set_orientation(const double *);
60  void set_position (const double *);
61  void set_light (const double *);
62 
63  void set_speed (double s);
64  void set_distance (double r);
65  void set_tension (double t);
66  void set_bias (double b);
67  void set_zoom (double z);
68 
72 
73  const std::string& get_name() const { return name; }
74  const std::string& get_foreground() const { return foreground; }
75  const std::string& get_background() const { return background; }
76 
77  void get_orientation(double *) const;
78  void get_position (double *) const;
79  void get_light (double *) const;
80 
81  double get_speed() const { return speed; }
82  double get_distance() const { return distance; }
83  double get_tension() const { return tension; }
84  double get_bias() const { return bias; }
85  double get_zoom() const { return zoom; }
86 
90 
91  void get_matrix (double *) const;
92  void get_up (double *) const;
93  void get_right (double *) const;
94  void get_forward (double *) const;
95 
96  void set_pitch(double);
97  void set_matrix(const double *);
98 
99  void transform_orientation(const double *);
100  void transform_position (const double *);
101  void transform_light (const double *);
102 
104 
105  friend double operator-(const scm_step&, const scm_step&);
106 
107 private:
108 
109  std::string name;
110  std::string foreground;
111  std::string background;
112 
113  double orientation[4];
114  double position[3];
115  double light[3];
116  double speed;
117  double distance;
118  double tension;
119  double bias;
120  double zoom;
121 };
122 
123 typedef std::vector<scm_step *> scm_step_v;
124 typedef std::vector<scm_step *>::iterator scm_step_i;
125 typedef std::vector<scm_step *>::const_iterator scm_step_c;
126 
127 //------------------------------------------------------------------------------
128 
129 #endif
void set_zoom(double z)
Set the camera zoom.
Definition: scm-step.cpp:316
void transform_light(const double *)
Transform the current light direction.
Definition: scm-step.cpp:449
void get_orientation(double *) const
Return the orientation quaternion.
Definition: scm-step.cpp:223
void set_pitch(double)
Reorient the view to the given pitch in radians.
Definition: scm-step.cpp:372
void set_speed(double s)
Set the speed of the Hermitian interpolation.
Definition: scm-step.cpp:295
An scm_step defines a view configuration.
Definition: scm-step.hpp:32
void set_light(const double *)
Set the light direction vector.
Definition: scm-step.cpp:281
void get_up(double *) const
Return the Y axis of the matrix form of the orientation quaternion, thus giving the view up vector...
Definition: scm-step.cpp:346
void set_name(const std::string &s)
Set the name of the step.
Definition: scm-step.cpp:246
void transform_position(const double *)
Transform the current camera position.
Definition: scm-step.cpp:437
scm_step()
Initialize a new SCM viewer state using default values.
Definition: scm-step.cpp:48
void set_matrix(const double *)
Set the camera position and orientation using the given view matrix.
Definition: scm-step.cpp:408
void transform_orientation(const double *)
Transform the current camera orientation.
Definition: scm-step.cpp:422
void set_foreground(const std::string &s)
Set the name of the foreground scene.
Definition: scm-step.cpp:253
void get_light(double *) const
Return the light direction vector.
Definition: scm-step.cpp:237
void set_orientation(const double *)
Set the orientation quaternion.
Definition: scm-step.cpp:267
void set_background(const std::string &s)
Set the name of the background scene.
Definition: scm-step.cpp:260
void set_tension(double t)
Set the tension of the Hermitian interpolation.
Definition: scm-step.cpp:302
void get_forward(double *) const
Return the negated Z axis of the matrix form of the orientation quaternion, thus giving the view forw...
Definition: scm-step.cpp:362
void set_bias(double b)
Set the bias of the Hermitian interpolation.
Definition: scm-step.cpp:309
void set_distance(double r)
Set the distance of the camera from the center of the sphere.
Definition: scm-step.cpp:288
friend double operator-(const scm_step &, const scm_step &)
Return the linear distance between two steps.
Definition: scm-step.cpp:461
void set_position(const double *)
Set the position vector.
Definition: scm-step.cpp:274
void get_matrix(double *) const
Return the view transformation matrix.
Definition: scm-step.cpp:325
void get_right(double *) const
Return the X axis of the matrix form of the orientation quaternion, thus giving the view right vector...
Definition: scm-step.cpp:354
void get_position(double *) const
Return the position vector.
Definition: scm-step.cpp:230