Cleanup, externalize mask used to pick center

openmw-39
Aesylwinn 9 years ago
parent a4cc891383
commit 99e9017242

@ -12,8 +12,6 @@
#include <osgUtil/LineSegmentIntersector>
#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);

@ -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;

@ -167,6 +167,7 @@ SceneWidget::SceneWidget(boost::shared_ptr<Resource::ResourceSystem> resourceSys
, mCurrentCamControl(mFreeCamControl.get())
, mCamPositionSet(false)
{
mOrbitCamControl->setPickingMask(Mask_Reference | Mask_Terrain);
selectNavigationMode("free");
// we handle lighting manually

Loading…
Cancel
Save