]> git.mxchange.org Git - flightgear.git/blob - src/Scenery/scenery.hxx
Make it optional whether a dialog can be dragged or not.
[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  - http://www.flightgear.org/~curt
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 #include <list>
33
34 #include <plib/sg.h>
35
36 #include <simgear/compiler.h>
37 #include <simgear/structure/subsystem_mgr.hxx>
38 #include <simgear/math/point3d.hxx>
39
40 SG_USING_STD(list);
41
42 class ssgRoot;
43 class ssgBranch;
44 class ssgPlacementTransform;
45
46
47 // Define a structure containing global scenery parameters
48 class FGScenery : public SGSubsystem {
49     // center of current scenery chunk
50     Point3D center;
51
52     // next center of current scenery chunk
53     Point3D next_center;
54
55     // angle of sun relative to current local horizontal
56     double sun_angle;
57
58     // elevation of terrain at our current lat/lon (based on the
59     // actual drawn polygons)
60     double cur_elev;
61
62     // the distance (radius) from the center of the earth to the
63     // current scenery elevation point
64     double cur_radius;
65
66     // unit normal at point used to determine current elevation
67     sgdVec3 cur_normal;
68
69     // SSG scene graph
70     ssgRoot *scene_graph;
71     ssgBranch *terrain_branch;
72     ssgRoot *gnd_lights_root;
73     ssgRoot *vasi_lights_root;
74     ssgRoot *rwy_lights_root;
75     ssgRoot *taxi_lights_root;
76     ssgBranch *models_branch;
77     ssgBranch *aircraft_branch;
78
79     // list of all placement transform, used to move the scenery center on the fly.
80     typedef list<ssgPlacementTransform*> placement_list_type;
81     placement_list_type _placement_list;
82
83 public:
84
85     FGScenery();
86     ~FGScenery();
87
88     // Implementation of SGSubsystem.
89     void init ();
90     void bind ();
91     void unbind ();
92     void update (double dt);
93
94     inline double get_cur_elev() const { return cur_elev; }
95     inline void set_cur_elev( double e ) { cur_elev = e; }
96
97     inline Point3D get_center() const { return center; }
98     void set_center( Point3D p );
99
100     inline Point3D get_next_center() const { return next_center; }
101     inline void set_next_center( Point3D p ) { next_center = p; }
102
103     inline void set_cur_radius( double r ) { cur_radius = r; }
104     inline void set_cur_normal( sgdVec3 n ) { sgdCopyVec3( cur_normal, n ); }
105
106     inline ssgRoot *get_scene_graph () const { return scene_graph; }
107     inline void set_scene_graph (ssgRoot * s) { scene_graph = s; }
108
109     inline ssgBranch *get_terrain_branch () const { return terrain_branch; }
110     inline void set_terrain_branch (ssgBranch * t) { terrain_branch = t; }
111
112     inline ssgRoot *get_gnd_lights_root () const {
113         return gnd_lights_root;
114     }
115     inline void set_gnd_lights_root (ssgRoot *r) {
116         gnd_lights_root = r;
117     }
118
119     inline ssgRoot *get_vasi_lights_root () const {
120         return vasi_lights_root;
121     }
122     inline void set_vasi_lights_root (ssgRoot *r) {
123         vasi_lights_root = r;
124     }
125
126     inline ssgRoot *get_rwy_lights_root () const {
127         return rwy_lights_root;
128     }
129     inline void set_rwy_lights_root (ssgRoot *r) {
130         rwy_lights_root = r;
131     }
132
133     inline ssgRoot *get_taxi_lights_root () const {
134         return taxi_lights_root;
135     }
136     inline void set_taxi_lights_root (ssgRoot *r) {
137         taxi_lights_root = r;
138     }
139
140     inline ssgBranch *get_models_branch () const {
141         return models_branch;
142     }
143     inline void set_models_branch (ssgBranch *t) {
144         models_branch = t;
145     }
146
147     inline ssgBranch *get_aircraft_branch () const {
148         return aircraft_branch;
149     }
150     inline void set_aircraft_branch (ssgBranch *t) {
151         aircraft_branch = t;
152     }
153
154     void register_placement_transform(ssgPlacementTransform *trans);
155     void unregister_placement_transform(ssgPlacementTransform *trans);
156 };
157
158
159 #endif // _SCENERY_HXX
160
161