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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 #include <simgear/compiler.h>
30 #include <simgear/structure/subsystem_mgr.hxx>
31 #include <simgear/math/SGMath.hxx>
36 typedef SGSharedPtr<FGViewer> FGViewerPtr;
38 // Define a structure containing view information
39 class FGViewMgr : public SGSubsystem
52 virtual void unbind ();
53 virtual void update (double dt);
54 virtual void reinit ();
57 inline int size() const { return views.size(); }
58 inline int get_current() const { return current; }
60 FGViewer *get_current_view();
61 const FGViewer *get_current_view() const;
63 FGViewer *get_view( int i );
64 const FGViewer *get_view( int i ) const;
66 FGViewer *next_view();
67 FGViewer *prev_view();
71 inline void set_view( const int v ) { current = v; }
72 void add_view( FGViewer * v );
74 // copies current offset settings to current-view path...
75 void copyToCurrent ();
84 // callbacks in manager to access viewer methods
85 double getViewHeadingOffset_deg () const;
86 void setViewHeadingOffset_deg (double offset);
87 double getViewGoalHeadingOffset_deg () const;
88 void setViewGoalHeadingOffset_deg (double offset);
89 double getViewPitchOffset_deg () const;
90 void setViewPitchOffset_deg (double tilt);
91 double getGoalViewPitchOffset_deg () const;
92 void setGoalViewRollOffset_deg (double tilt);
93 double getViewRollOffset_deg () const;
94 void setViewRollOffset_deg (double tilt);
95 double getGoalViewRollOffset_deg () const;
96 void setGoalViewPitchOffset_deg (double tilt);
97 double getViewXOffset_m () const;
98 void setViewXOffset_m (double x);
99 double getViewYOffset_m () const;
100 void setViewYOffset_m (double y);
101 double getViewZOffset_m () const;
102 void setViewZOffset_m (double z);
103 double getViewTargetXOffset_m () const;
104 void setViewTargetXOffset_m (double x);
105 double getViewTargetYOffset_m () const;
106 void setViewTargetYOffset_m (double y);
107 double getViewTargetZOffset_m () const;
108 void setViewTargetZOffset_m (double z);
109 double getFOV_deg () const;
110 void setFOV_deg (double fov);
111 double getARM_deg () const; // Aspect Ratio Multiplier
112 void setARM_deg (double fov);
113 double getNear_m () const;
114 void setNear_m (double near_m);
115 void setViewAxisLong (double axis);
116 void setViewAxisLat (double axis);
117 int getView () const;
118 void setView (int newview);
119 bool stationary () const;
121 SGPropertyNode_ptr view_number;
122 vector<SGPropertyNode_ptr> config_list;
123 typedef std::vector<FGViewerPtr> viewer_list;
125 SGVec3d abs_viewer_position;
134 #endif // _VIEWMGR_HXX