]> git.mxchange.org Git - simgear.git/commitdiff
Modified Files:
authorfrohlich <frohlich>
Mon, 20 Nov 2006 18:15:34 +0000 (18:15 +0000)
committerfrohlich <frohlich>
Mon, 20 Nov 2006 18:15:34 +0000 (18:15 +0000)
SGUpdateVisitor.hxx: Store some view imformation in the
update visitor.

simgear/scene/util/SGUpdateVisitor.hxx

index 4f3a0f49f325f19a75fd7dfe380ecd111e02434e..1de395831c799e0b1895736e8bbb16835d7654df 100644 (file)
 #include <osg/NodeVisitor>
 #include <osgUtil/UpdateVisitor>
 
-#include <osg/io_utils>
-
 class SGUpdateVisitor : public osgUtil::UpdateVisitor {
 public:
   SGUpdateVisitor()
   {
     setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
   }
+  void setViewData(const SGVec3d& globalEyePos,
+                   const SGQuatd& globalViewOrientation)
+  {
+    mGlobalGeodEyePos = SGGeod::fromCart(globalEyePos);
+    mGlobalEyePos = globalEyePos;
+    mGlobalViewOr = globalViewOrientation;
+    mGlobalHorizLocalOr = SGQuatd::fromLonLat(mGlobalGeodEyePos);
+    mHorizLocalNorth = mGlobalHorizLocalOr.backTransform(SGVec3d(1, 0, 0));
+    mHorizLocalEast = mGlobalHorizLocalOr.backTransform(SGVec3d(0, 1, 0));
+    mHorizLocalDown = mGlobalHorizLocalOr.backTransform(SGVec3d(0, 0, 1));
+  }
+
+  void setSceneryCenter(const SGVec3d& sceneryCenter)
+  {
+    mSceneryCenter = sceneryCenter;
+  }
+
+  void setVisibility(double visibility)
+  {
+    mVisibility = visibility;
+    mSqrVisibility = visibility*visibility;
+  }
+
+  double getVisibility() const
+  { return mVisibility; }
+  double getSqrVisibility() const
+  { return mSqrVisibility; }
+
+  const SGVec3d& getGlobalEyePos() const
+  { return mGlobalEyePos; }
+  const SGGeod& getGeodEyePos() const
+  { return mGlobalGeodEyePos; }
+  const SGQuatd& getGlobalViewOr() const
+  { return mGlobalViewOr; }
+  const SGQuatd& getGlobalHorizLocalOr() const
+  { return mGlobalViewOr; }
+  const SGVec3d& getHorizLocalNorth() const
+  { return mHorizLocalNorth; }
+  const SGVec3d& getHorizLocalEast() const
+  { return mHorizLocalEast; }
+  const SGVec3d& getHorizLocalDown() const
+  { return mHorizLocalDown; }
+private:
+  SGGeod mGlobalGeodEyePos;
+  SGVec3d mGlobalEyePos;
+  SGQuatd mGlobalViewOr;
+  SGQuatd mGlobalHorizLocalOr;
+  SGVec3d mHorizLocalNorth;
+  SGVec3d mHorizLocalEast;
+  SGVec3d mHorizLocalDown;
+
+  SGVec3d mSceneryCenter;
+
+  double mVisibility;
+  double mSqrVisibility;
 };
 
 #endif