diff --git a/apps/opencs/view/render/cameracontroller.cpp b/apps/opencs/view/render/cameracontroller.cpp index 57c87ecb3..3967c983d 100644 --- a/apps/opencs/view/render/cameracontroller.cpp +++ b/apps/opencs/view/render/cameracontroller.cpp @@ -12,8 +12,6 @@ #include -#include "mask.hpp" - namespace CSVRender { @@ -361,6 +359,7 @@ namespace CSVRender , mDown(false) , mRollLeft(false) , mRollRight(false) + , mPickingMask(~0) , mCenter(0,0,0) , mDistance(0) , mOrbitSpeed(osg::PI / 4) @@ -378,6 +377,11 @@ namespace CSVRender return mOrbitSpeedMult; } + unsigned int OrbitCameraController::getPickingMask() const + { + return mPickingMask; + } + void OrbitCameraController::setOrbitSpeed(double value) { mOrbitSpeed = value; @@ -388,6 +392,11 @@ namespace CSVRender mOrbitSpeedMult = value; } + void OrbitCameraController::setPickingMask(unsigned int value) + { + mPickingMask = value; + } + bool OrbitCameraController::handleKeyEvent(QKeyEvent* event, bool pressed) { if (!isActive()) @@ -523,7 +532,7 @@ namespace CSVRender intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::LIMIT_NEAREST); osgUtil::IntersectionVisitor visitor(intersector); - visitor.setTraversalMask(Mask_Reference | Mask_Terrain); + visitor.setTraversalMask(mPickingMask); getCamera()->accept(visitor); diff --git a/apps/opencs/view/render/cameracontroller.hpp b/apps/opencs/view/render/cameracontroller.hpp index bec76dd43..7c1f96e15 100644 --- a/apps/opencs/view/render/cameracontroller.hpp +++ b/apps/opencs/view/render/cameracontroller.hpp @@ -115,9 +115,11 @@ namespace CSVRender double getOrbitSpeed() const; double getOrbitSpeedMultiplier() const; + unsigned int getPickingMask() const; void setOrbitSpeed(double value); void setOrbitSpeedMultiplier(double value); + void setPickingMask(unsigned int value); bool handleKeyEvent(QKeyEvent* event, bool pressed); bool handleMouseMoveEvent(std::string mode, int x, int y); @@ -138,6 +140,7 @@ namespace CSVRender bool mInitialized; bool mFast, mLeft, mRight, mUp, mDown, mRollLeft, mRollRight; + unsigned int mPickingMask; osg::Vec3d mCenter; double mDistance; diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index 9923d6ef0..fea29effd 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -167,6 +167,7 @@ SceneWidget::SceneWidget(boost::shared_ptr resourceSys , mCurrentCamControl(mFreeCamControl.get()) , mCamPositionSet(false) { + mOrbitCamControl->setPickingMask(Mask_Reference | Mask_Terrain); selectNavigationMode("free"); // we handle lighting manually