]> git.mxchange.org Git - flightgear.git/blob - src/Scenery/scenery.hxx
ignore resets for now because every z/Z key press would trigger a call to NOAA. We...
[flightgear.git] / src / Scenery / scenery.hxx
1 // scenery.hxx -- data structures and routines for managing scenery.
2 //
3 // Written by Curtis Olson, started May 1997.
4 //
5 // Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
6 //
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.
11 //
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.
16 //
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.
20 //
21 // $Id$
22
23
24 #ifndef _SCENERY_HXX
25 #define _SCENERY_HXX
26
27
28 #ifndef __cplusplus                                                          
29 # error This library requires C++
30 #endif                                   
31
32
33 #include <plib/sg.h>
34 #include <plib/ssg.h>
35
36 #include <simgear/structure/subsystem_mgr.hxx>
37 #include <simgear/math/point3d.hxx>
38
39
40 // Define a structure containing global scenery parameters
41 class FGScenery : public SGSubsystem {
42     // center of current scenery chunk
43     Point3D center;
44
45     // next center of current scenery chunk
46     Point3D next_center;
47
48     // angle of sun relative to current local horizontal
49     double sun_angle;
50
51     // elevation of terrain at our current lat/lon (based on the
52     // actual drawn polygons)
53     double cur_elev;
54
55     // the distance (radius) from the center of the earth to the
56     // current scenery elevation point
57     double cur_radius;
58
59     // unit normal at point used to determine current elevation
60     sgdVec3 cur_normal;
61
62     // SSG scene graph
63     ssgRoot *scene_graph;
64     ssgBranch *terrain_branch;
65     ssgRoot *gnd_lights_root;
66     ssgRoot *vasi_lights_root;
67     ssgRoot *rwy_lights_root;
68     ssgRoot *taxi_lights_root;
69     ssgBranch *models_branch;
70     ssgBranch *aircraft_branch;
71
72 public:
73
74     FGScenery();
75     ~FGScenery();
76
77     // Implementation of SGSubsystem.
78     void init ();
79     void bind ();
80     void unbind ();
81     void update (double dt);
82
83     inline double get_cur_elev() const { return cur_elev; }
84     inline void set_cur_elev( double e ) { cur_elev = e; }
85
86     inline Point3D get_center() const { return center; }
87     inline void set_center( Point3D p ) { center = p; }
88
89     inline Point3D get_next_center() const { return next_center; }
90     inline void set_next_center( Point3D p ) { next_center = p; }
91
92     inline void set_cur_radius( double r ) { cur_radius = r; }
93     inline void set_cur_normal( sgdVec3 n ) { sgdCopyVec3( cur_normal, n ); }
94
95     inline ssgRoot *get_scene_graph () const { return scene_graph; }
96     inline void set_scene_graph (ssgRoot * s) { scene_graph = s; }
97
98     inline ssgBranch *get_terrain_branch () const { return terrain_branch; }
99     inline void set_terrain_branch (ssgBranch * t) { terrain_branch = t; }
100
101     inline ssgRoot *get_gnd_lights_root () const {
102         return gnd_lights_root;
103     }
104     inline void set_gnd_lights_root (ssgRoot *r) {
105         gnd_lights_root = r;
106     }
107
108     inline ssgRoot *get_vasi_lights_root () const {
109         return vasi_lights_root;
110     }
111     inline void set_vasi_lights_root (ssgRoot *r) {
112         vasi_lights_root = r;
113     }
114
115     inline ssgRoot *get_rwy_lights_root () const {
116         return rwy_lights_root;
117     }
118     inline void set_rwy_lights_root (ssgRoot *r) {
119         rwy_lights_root = r;
120     }
121
122     inline ssgRoot *get_taxi_lights_root () const {
123         return taxi_lights_root;
124     }
125     inline void set_taxi_lights_root (ssgRoot *r) {
126         taxi_lights_root = r;
127     }
128
129     inline ssgBranch *get_models_branch () const {
130         return models_branch;
131     }
132     inline void set_models_branch (ssgBranch *t) {
133         models_branch = t;
134     }
135
136     inline ssgBranch *get_aircraft_branch () const {
137         return aircraft_branch;
138     }
139     inline void set_aircraft_branch (ssgBranch *t) {
140         aircraft_branch = t;
141     }
142 };
143
144
145 #endif // _SCENERY_HXX
146
147