]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/placement.cxx
pass SGReaderWriterXMLOptions to effects
[simgear.git] / simgear / scene / model / placement.cxx
index 2a3f0d4357ae58e6539b8d3ce363e4ce445f4540..cd38181e212c611cee2ab8fb53a9921f0f697ca2 100644 (file)
@@ -7,13 +7,10 @@
 #include <simgear_config.h>
 #endif
 
-#include <simgear/compiler.h>
-
-#include <simgear/scene/util/SGSceneUserData.hxx>
-#include <simgear/scene/util/SGUpdateVisitor.hxx>
-
 #include "placement.hxx"
 
+#include <simgear/compiler.h>
+#include <simgear/scene/util/SGSceneUserData.hxx>
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -26,7 +23,7 @@ SGModelPlacement::SGModelPlacement () :
     _pitch_deg(0),
     _heading_deg(0),
     _selector(new osg::Switch),
-    _transform(new SGPlacementTransform)
+    _transform(new osg::PositionAttitudeTransform)
 {
 }
 
@@ -49,13 +46,17 @@ SGModelPlacement::update()
 {
   // The cartesian position
   SGVec3d position = SGVec3d::fromGeod(_position);
+  _transform->setPosition(toOsg(position));
 
   // The orientation, composed from the horizontal local orientation and the
   // orientation wrt the horizontal local frame
   SGQuatd orient = SGQuatd::fromLonLat(_position);
+  orient *= SGQuatd::fromYawPitchRollDeg(_heading_deg, _pitch_deg, _roll_deg);
+  // Convert to the scenegraph orientation where we just rotate around
+  // the y axis 180 degrees.
   orient *= SGQuatd::fromRealImag(0, SGVec3d(0, 1, 0));
-  orient *= SGQuatd::fromYawPitchRollDeg(-_heading_deg, _pitch_deg, -_roll_deg);
-  _transform->setTransform(position, orient);
+
+  _transform->setAttitude(toOsg(orient));
 }
 
 bool