From: frohlich Date: Sun, 3 Dec 2006 16:46:23 +0000 (+0000) Subject: Modified Files: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8b3b0def03bfff58afe8e24a39eef1c6882bc6fa;p=simgear.git Modified Files: SGUpdateVisitor.hxx: Include light information. --- diff --git a/simgear/scene/util/SGUpdateVisitor.hxx b/simgear/scene/util/SGUpdateVisitor.hxx index 1de39583..68f8ecdb 100644 --- a/simgear/scene/util/SGUpdateVisitor.hxx +++ b/simgear/scene/util/SGUpdateVisitor.hxx @@ -25,11 +25,16 @@ #include #include +#include "simgear/math/SGMath.hxx" + class SGUpdateVisitor : public osgUtil::UpdateVisitor { public: SGUpdateVisitor() { - setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); + // Need to traverse all children, else some LOD nodes do not get updated + // Note that the broad number of updates is not done due to + // the update callback in the global position node. + setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN); } void setViewData(const SGVec3d& globalEyePos, const SGQuatd& globalViewOrientation) @@ -73,6 +78,24 @@ public: { return mHorizLocalEast; } const SGVec3d& getHorizLocalDown() const { return mHorizLocalDown; } + + void setLight(const SGVec3f& direction, const SGVec4f& ambient, + const SGVec4f& diffuse, const SGVec4f& specular) + { + mLightDirection = direction; + mAmbientLight = ambient; + mDiffuseLight = diffuse; + } + + const SGVec3f& getLightDirection() const + { return mLightDirection; } + const SGVec4f& getAmbientLight() const + { return mAmbientLight; } + const SGVec4f& getDiffuseLight() const + { return mDiffuseLight; } + const SGVec4f& getSpecularLight() const + { return mSpecularLight; } + private: SGGeod mGlobalGeodEyePos; SGVec3d mGlobalEyePos; @@ -86,6 +109,11 @@ private: double mVisibility; double mSqrVisibility; + + SGVec3f mLightDirection; + SGVec4f mAmbientLight; + SGVec4f mDiffuseLight; + SGVec4f mSpecularLight; }; #endif