1 // viewmgr.hxx -- class for managing all the views in the flightgear world.
3 // Written by Curtis Olson, started October 2000.
5 // Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 # error This library requires C++
33 #include <simgear/compiler.h>
34 #include <simgear/structure/subsystem_mgr.hxx>
47 // Define a structure containing view information
48 class FGViewMgr : public SGSubsystem
61 virtual void unbind ();
62 virtual void update (double dt);
63 virtual void reinit ();
66 inline int size() const { return views.size(); }
67 inline int get_current() const { return current; }
68 inline FGViewer *get_current_view() {
69 if ( current < (int)views.size() ) {
70 return views[current];
75 inline const FGViewer *get_current_view() const {
76 if ( current < (int)views.size() ) {
77 return views[current];
82 inline FGViewer *get_view( int i ) {
83 if ( i < 0 ) { i = 0; }
84 if ( i >= (int)views.size() ) { i = views.size() - 1; }
87 inline const FGViewer *get_view( int i ) const {
88 if ( i < 0 ) { i = 0; }
89 if ( i >= (int)views.size() ) { i = views.size() - 1; }
92 inline FGViewer *next_view() {
94 if ( current >= (int)views.size() ) {
98 return views[current];
100 inline FGViewer *prev_view() {
103 current = views.size() - 1;
105 return views[current];
109 inline void clear() { views.clear(); }
110 inline void set_view( const int v ) { current = v; }
111 inline void add_view( FGViewer * v ) {
115 // copies current offset settings to current-view path...
116 void copyToCurrent ();
125 // callbacks in manager to access viewer methods
126 double getViewHeadingOffset_deg () const;
127 void setViewHeadingOffset_deg (double offset);
128 double getViewGoalHeadingOffset_deg () const;
129 void setViewGoalHeadingOffset_deg (double offset);
130 double getViewPitchOffset_deg () const;
131 void setViewPitchOffset_deg (double tilt);
132 double getGoalViewPitchOffset_deg () const;
133 void setGoalViewRollOffset_deg (double tilt);
134 double getViewRollOffset_deg () const;
135 void setViewRollOffset_deg (double tilt);
136 double getGoalViewRollOffset_deg () const;
137 void setGoalViewPitchOffset_deg (double tilt);
138 double getViewXOffset_m () const;
139 void setViewXOffset_m (double x);
140 double getViewYOffset_m () const;
141 void setViewYOffset_m (double y);
142 double getViewZOffset_m () const;
143 void setViewZOffset_m (double z);
144 double getViewTargetXOffset_m () const;
145 void setViewTargetXOffset_m (double x);
146 double getViewTargetYOffset_m () const;
147 void setViewTargetYOffset_m (double y);
148 double getViewTargetZOffset_m () const;
149 void setViewTargetZOffset_m (double z);
150 double getFOV_deg () const;
151 void setFOV_deg (double fov);
152 double getARM_deg () const; // Aspect Ratio Multiplier
153 void setARM_deg (double fov);
154 double getNear_m () const;
155 void setNear_m (double near_m);
156 void setViewAxisLong (double axis);
157 void setViewAxisLat (double axis);
158 int getView () const;
159 void setView (int newview);
161 typedef vector < FGViewer * > viewer_list;
169 #endif // _VIEWMGR_HXX