]> git.mxchange.org Git - flightgear.git/blob - src/Scenery/scenery.hxx
Added static port system and a new altimeter model connected to it.
[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/math/point3d.hxx>
37
38 #include <Main/fgfs.hxx>
39
40
41 // Define a structure containing global scenery parameters
42 class FGScenery : public FGSubsystem {
43     // center of current scenery chunk
44     Point3D center;
45
46     // next center of current scenery chunk
47     Point3D next_center;
48
49     // angle of sun relative to current local horizontal
50     double sun_angle;
51
52     // elevation of terrain at our current lat/lon (based on the
53     // actual drawn polygons)
54     double cur_elev;
55
56     // the distance (radius) from the center of the earth to the
57     // current scenery elevation point
58     double cur_radius;
59
60     // unit normal at point used to determine current elevation
61     sgdVec3 cur_normal;
62
63     // SSG scene graph
64     ssgRoot * scene_graph;
65     ssgBranch * terrain_branch;
66     ssgBranch * gnd_lights_branch;
67     ssgBranch * rwy_lights_branch;
68     ssgBranch * models_branch;
69     ssgBranch * aircraft_branch;
70
71     ssgRoot *lighting;
72
73 public:
74
75     FGScenery();
76     ~FGScenery();
77
78     // Implementation of FGSubsystem.
79     void init ();
80     void bind ();
81     void unbind ();
82     void update (double dt);
83
84     inline double get_cur_elev() const { return cur_elev; }
85     inline void set_cur_elev( double e ) { cur_elev = e; }
86
87     inline Point3D get_center() const { return center; }
88     inline void set_center( Point3D p ) { center = p; }
89
90     inline Point3D get_next_center() const { return next_center; }
91     inline void set_next_center( Point3D p ) { next_center = p; }
92
93     inline void set_cur_radius( double r ) { cur_radius = r; }
94     inline void set_cur_normal( sgdVec3 n ) { sgdCopyVec3( cur_normal, n ); }
95
96     inline ssgRoot * get_scene_graph () const { return scene_graph; }
97     inline void set_scene_graph (ssgRoot * s) { scene_graph = s; }
98
99     inline ssgBranch * get_terrain_branch () const { return terrain_branch; }
100     inline void set_terrain_branch (ssgBranch * t) { terrain_branch = t; }
101
102     inline ssgBranch * get_gnd_lights_branch () const {
103       return gnd_lights_branch;
104     }
105     inline void set_gnd_lights_branch (ssgBranch * t) {
106       gnd_lights_branch = t;
107     }
108
109     inline ssgBranch * get_rwy_lights_branch () const {
110       return rwy_lights_branch;
111     }
112     inline void set_rwy_lights_branch (ssgBranch * t) {
113       rwy_lights_branch = t;
114     }
115
116     inline ssgBranch * get_models_branch () const {
117       return models_branch;
118     }
119     inline void set_models_branch (ssgBranch * t) {
120       models_branch = t;
121     }
122
123     inline ssgBranch * get_aircraft_branch () const {
124       return aircraft_branch;
125     }
126     inline void set_aircraft_branch (ssgBranch * t) {
127       aircraft_branch = t;
128     }
129
130     inline ssgRoot * get_lighting () const { return lighting; }
131     inline void set_lighting (ssgRoot *l) { lighting = l; }
132 };
133
134
135 #endif // _SCENERY_HXX
136
137