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