]> git.mxchange.org Git - flightgear.git/blob - src/Model/placement.hxx
Working at unraveling and breaking dependencies inside of src/Model.
[flightgear.git] / src / Model / placement.hxx
1 // placement.hxx - manage the placment of a 3D model.
2 // Written by David Megginson, started 2002.
3 //
4 // This file is in the Public Domain, and comes with no warranty.
5
6
7 #ifndef _SG_PLACEMENT_HXX
8 #define _SG_PLACEMENT_HXX 1
9
10 #ifndef __cplusplus
11 # error This library requires C++
12 #endif
13
14 #include <vector>
15
16 SG_USING_STD(vector);
17
18 #include <plib/sg.h>
19 #include <plib/ssg.h>
20
21 #include <simgear/math/point3d.hxx>
22 #include <simgear/props/props.hxx>
23
24
25 // Don't pull in the headers, since we don't need them here.
26 class FGLocation;
27
28
29 // Has anyone done anything *really* stupid, like making min and max macros?
30 #ifdef min
31 #undef min
32 #endif
33 #ifdef max
34 #undef max
35 #endif
36
37
38 ////////////////////////////////////////////////////////////////////////
39 // Model placement.
40 ////////////////////////////////////////////////////////////////////////
41
42 /**
43  * A wrapper for a model with a definite placement.
44  */
45 class FGModelPlacement
46 {
47 public:
48
49   FGModelPlacement ();
50   virtual ~FGModelPlacement ();
51
52     virtual void FGModelPlacement::init( ssgBranch * model );
53   /* virtual void init( const string &fg_root,
54                      const string &path,
55                      SGPropertyNode *prop_root,
56                      double sim_time_sec, int dummy ); */
57   virtual void update( const Point3D scenery_center );
58
59   virtual ssgEntity * getSceneGraph () { return (ssgEntity *)_selector; }
60
61   virtual FGLocation * getFGLocation () { return _location; }
62
63   virtual bool getVisible () const;
64   virtual void setVisible (bool visible);
65
66   virtual double getLongitudeDeg () const { return _lon_deg; }
67   virtual double getLatitudeDeg () const { return _lat_deg; }
68   virtual double getElevationFt () const { return _elev_ft; }
69
70   virtual void setLongitudeDeg (double lon_deg);
71   virtual void setLatitudeDeg (double lat_deg);
72   virtual void setElevationFt (double elev_ft);
73   virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
74
75   virtual double getRollDeg () const { return _roll_deg; }
76   virtual double getPitchDeg () const { return _pitch_deg; }
77   virtual double getHeadingDeg () const { return _heading_deg; }
78
79   virtual void setRollDeg (double roll_deg);
80   virtual void setPitchDeg (double pitch_deg);
81   virtual void setHeadingDeg (double heading_deg);
82   virtual void setOrientation (double roll_deg, double pitch_deg,
83                                double heading_deg);
84   
85   // Addition by Diarmuid Tyson for Multiplayer Support
86   // Allows multiplayer to get players position transform
87   virtual const sgVec4 *get_POS() { return POS; }
88
89 private:
90
91                                 // Geodetic position
92   double _lon_deg;
93   double _lat_deg;
94   double _elev_ft;
95
96                                 // Orientation
97   double _roll_deg;
98   double _pitch_deg;
99   double _heading_deg;
100
101   ssgSelector * _selector;
102   ssgTransform * _position;
103
104                                 // Location
105   FGLocation * _location;
106
107
108   // Addition by Diarmuid Tyson for Multiplayer Support
109   // Moved from update method
110   // POS for transformation Matrix
111   sgMat4 POS;
112
113 };
114
115 #endif // _SG_PLACEMENT_HXX