]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/placement.hxx
- better error message when submodel loading failed
[simgear.git] / simgear / scene / 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 <plib/sg.h>
15 #include <plib/ssg.h>
16
17 #include <simgear/math/point3d.hxx>
18 #include <simgear/props/props.hxx>
19 #include <simgear/structure/ssgSharedPtr.hxx>
20
21
22 // Don't pull in the headers, since we don't need them here.
23 class SGLocation;
24 class ssgPlacementTransform;
25
26
27 // Has anyone done anything *really* stupid, like making min and max macros?
28 #ifdef min
29 #undef min
30 #endif
31 #ifdef max
32 #undef max
33 #endif
34
35
36 ////////////////////////////////////////////////////////////////////////
37 // Model placement.
38 ////////////////////////////////////////////////////////////////////////
39
40 /**
41  * A wrapper for a model with a definite placement.
42  */
43 class SGModelPlacement
44 {
45 public:
46
47   SGModelPlacement ();
48   virtual ~SGModelPlacement ();
49
50   virtual void init( ssgBranch * model );
51
52   virtual void update();
53
54   virtual ssgEntity * getSceneGraph () { return (ssgEntity *)_selector; }
55
56   virtual SGLocation * getSGLocation () { return _location; }
57
58   virtual bool getVisible () const;
59   virtual void setVisible (bool visible);
60
61   virtual double getLongitudeDeg () const { return _lon_deg; }
62   virtual double getLatitudeDeg () const { return _lat_deg; }
63   virtual double getElevationFt () const { return _elev_ft; }
64
65   virtual void setLongitudeDeg (double lon_deg);
66   virtual void setLatitudeDeg (double lat_deg);
67   virtual void setElevationFt (double elev_ft);
68   virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
69
70   virtual double getRollDeg () const { return _roll_deg; }
71   virtual double getPitchDeg () const { return _pitch_deg; }
72   virtual double getHeadingDeg () const { return _heading_deg; }
73
74   virtual void setRollDeg (double roll_deg);
75   virtual void setPitchDeg (double pitch_deg);
76   virtual void setHeadingDeg (double heading_deg);
77   virtual void setOrientation (double roll_deg, double pitch_deg,
78                                double heading_deg);
79   
80   ssgPlacementTransform * getTransform(void)
81   { return _position; }
82
83 private:
84
85                                 // Geodetic position
86   double _lon_deg;
87   double _lat_deg;
88   double _elev_ft;
89
90                                 // Orientation
91   double _roll_deg;
92   double _pitch_deg;
93   double _heading_deg;
94
95   ssgSharedPtr<ssgSelector> _selector;
96   ssgSharedPtr<ssgPlacementTransform> _position;
97
98                                 // Location
99   SGLocation * _location;
100 };
101
102 #endif // _SG_PLACEMENT_HXX