]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/placement.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / model / placement.hxx
index 8130c4905f6a6ba04f489b5715a573f5eaf38e06..ebcf67cf4071bf91c858fd1bc43383a895f13b09 100644 (file)
 # error This library requires C++
 #endif
 
-#include <plib/sg.h>
-#include <plib/ssg.h>
-
-#include <simgear/math/point3d.hxx>
-#include <simgear/props/props.hxx>
-
-
-// Don't pull in the headers, since we don't need them here.
-class SGLocation;
-class ssgPlacementTransform;
+#include <osg/ref_ptr>
+#include <osg/Node>
+#include <osg/Switch>
+#include <osg/PositionAttitudeTransform>
 
+#include <simgear/math/SGMath.hxx>
 
 // Has anyone done anything *really* stupid, like making min and max macros?
 #ifdef min
@@ -46,25 +41,19 @@ public:
   SGModelPlacement ();
   virtual ~SGModelPlacement ();
 
-  virtual void SGModelPlacement::init( ssgBranch * model );
-
+  virtual void init( osg::Node* model );
+  void clear();
+  void add( osg::Node* model );
+  
   virtual void update();
 
-  virtual ssgEntity * getSceneGraph () { return (ssgEntity *)_selector; }
-
-  virtual SGLocation * getSGLocation () { return _location; }
+  virtual osg::Node* getSceneGraph () { return _selector.get(); }
 
   virtual bool getVisible () const;
   virtual void setVisible (bool visible);
 
-  virtual double getLongitudeDeg () const { return _lon_deg; }
-  virtual double getLatitudeDeg () const { return _lat_deg; }
-  virtual double getElevationFt () const { return _elev_ft; }
-
-  virtual void setLongitudeDeg (double lon_deg);
-  virtual void setLatitudeDeg (double lat_deg);
-  virtual void setElevationFt (double elev_ft);
-  virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
+  void setPosition(const SGGeod& position);
+  const SGGeod& getPosition() const { return _position; }
 
   virtual double getRollDeg () const { return _roll_deg; }
   virtual double getPitchDeg () const { return _pitch_deg; }
@@ -75,27 +64,23 @@ public:
   virtual void setHeadingDeg (double heading_deg);
   virtual void setOrientation (double roll_deg, double pitch_deg,
                                double heading_deg);
-  
-  ssgPlacementTransform * getTransform(void)
-  { return _position; }
+  void setOrientation(const SGQuatd& orientation);
 
+  void setReferenceTime(const double& referenceTime);
+  void setBodyLinearVelocity(const SGVec3d& velocity);
+  void setBodyAngularVelocity(const SGVec3d& velocity);
+  
 private:
-
                                 // Geodetic position
-  double _lon_deg;
-  double _lat_deg;
-  double _elev_ft;
+  SGGeod _position;
 
                                 // Orientation
   double _roll_deg;
   double _pitch_deg;
   double _heading_deg;
 
-  ssgSelector * _selector;
-  ssgPlacementTransform * _position;
-
-                                // Location
-  SGLocation * _location;
+  osg::ref_ptr<osg::Switch> _selector;
+  osg::ref_ptr<osg::PositionAttitudeTransform> _transform;
 };
 
 #endif // _SG_PLACEMENT_HXX