From: frohlich Date: Mon, 20 Nov 2006 18:15:34 +0000 (+0000) Subject: Modified Files: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4dd1267beacd9963f78a00421da044c96912e820;p=simgear.git Modified Files: SGUpdateVisitor.hxx: Store some view imformation in the update visitor. --- diff --git a/simgear/scene/util/SGUpdateVisitor.hxx b/simgear/scene/util/SGUpdateVisitor.hxx index 4f3a0f49..1de39583 100644 --- a/simgear/scene/util/SGUpdateVisitor.hxx +++ b/simgear/scene/util/SGUpdateVisitor.hxx @@ -25,14 +25,67 @@ #include #include -#include - 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