]> git.mxchange.org Git - flightgear.git/blob - src/Main/viewer_rph.hxx
Added FGScript.{cpp,h}
[flightgear.git] / src / Main / viewer_rph.hxx
1 // viewer_rph.hxx -- class for managing a Roll/Pitch/Heading viewer in
2 //                   the flightgear world.
3 //
4 // Written by Curtis Olson, started August 1997.
5 //                          overhaul started October 2000.
6 //
7 // Copyright (C) 1997 - 2000  Curtis L. Olson  - curt@flightgear.org
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 //
23 // $Id$
24
25
26 #ifndef _VIEWER_RPH_HXX
27 #define _VIEWER_RPH_HXX
28
29
30 #ifndef __cplusplus                                                          
31 # error This library requires C++
32 #endif                                   
33
34
35 #include "viewer.hxx"
36
37
38 // Define a structure containing view information
39 class FGViewerRPH: public FGViewer {
40
41 private:
42
43     // view orientation (roll, pitch, heading)
44     sgVec3 rph;
45
46     // up vector for the view (usually point straight up through the
47     // top of the aircraft
48     sgVec3 view_up;
49
50     // the vector pointing straight out the nose of the aircraft
51     sgVec3 view_forward;
52
53     // Transformation matrix for the view direction offset relative to
54     // the AIRCRAFT matrix
55     sgMat4 VIEW_OFFSET;
56
57     // sg versions of our friendly matrices
58     sgMat4 LOCAL, TRANS, LARC_TO_SSG;
59
60     // Update the view volume, position, and orientation
61     void update();
62
63 public:
64
65     // Constructor
66     FGViewerRPH( void );
67
68     // Destructor
69     ~FGViewerRPH( void );
70
71     // Initialize a view class
72     void init( void );
73
74     //////////////////////////////////////////////////////////////////////
75     // setter functions
76     //////////////////////////////////////////////////////////////////////
77     inline void set_rph( double r, double p, double h ) {
78         // data should be in radians
79         set_dirty();
80         sgSetVec3( rph, r, p, h );
81     }
82
83     //////////////////////////////////////////////////////////////////////
84     // accessor functions
85     //////////////////////////////////////////////////////////////////////
86     inline float *get_rph() { return rph; }
87     inline float *get_view_forward() { return view_forward; }
88     inline float *get_view_up() { return view_up; }
89
90     //////////////////////////////////////////////////////////////////////
91     // derived values accessor functions
92     //////////////////////////////////////////////////////////////////////
93 };
94
95
96 #endif // _VIEWER_RPH_HXX