From efa2ec21ff8cf2bdcb7017613a3b21e8c4d3e737 Mon Sep 17 00:00:00 2001 From: Aesylwinn Date: Sat, 2 Apr 2016 13:14:46 -0400 Subject: [PATCH] Cleanup, no need to inherit and override osg::ComputeBoundsVisitor --- apps/opencs/view/render/cameracontroller.cpp | 27 -------------------- apps/opencs/view/render/cameracontroller.hpp | 16 ------------ apps/opencs/view/render/scenewidget.cpp | 6 +++-- 3 files changed, 4 insertions(+), 45 deletions(-) diff --git a/apps/opencs/view/render/cameracontroller.cpp b/apps/opencs/view/render/cameracontroller.cpp index d3e1fa53b..eb0515c28 100644 --- a/apps/opencs/view/render/cameracontroller.cpp +++ b/apps/opencs/view/render/cameracontroller.cpp @@ -572,31 +572,4 @@ namespace CSVRender getCamera()->setViewMatrixAsLookAt(mCenter + offset, mCenter, up); } - - CameraComputeBoundsVisitor::CameraComputeBoundsVisitor(unsigned int mask) - : mMask(mask) - { - } - - unsigned int CameraComputeBoundsVisitor::getMask() const - { - return mMask; - } - - void CameraComputeBoundsVisitor::setMask(unsigned int value) - { - mMask = value; - } - - void CameraComputeBoundsVisitor::apply(osg::Drawable& drawable) - { - if (drawable.getNodeMask() & mMask) - ComputeBoundsVisitor::apply(drawable); - } - - void CameraComputeBoundsVisitor::apply(osg::Transform& transform) - { - if (transform.getNodeMask() & mMask) - ComputeBoundsVisitor::apply(transform); - } } diff --git a/apps/opencs/view/render/cameracontroller.hpp b/apps/opencs/view/render/cameracontroller.hpp index fefa3a422..97a5ef2b2 100644 --- a/apps/opencs/view/render/cameracontroller.hpp +++ b/apps/opencs/view/render/cameracontroller.hpp @@ -4,7 +4,6 @@ #include #include -#include #include #include @@ -145,21 +144,6 @@ namespace CSVRender double mOrbitSpeed; double mOrbitSpeedMult; }; - - class CameraComputeBoundsVisitor : public osg::ComputeBoundsVisitor - { - public: - CameraComputeBoundsVisitor(unsigned int mask); - - unsigned int getMask() const; - void setMask(unsigned int mask); - - void apply(osg::Drawable& drawable); - void apply(osg::Transform& transform); - - private: - unsigned int mMask; - }; } #endif diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index 051559922..0ca495031 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -314,8 +315,9 @@ void SceneWidget::update(double dt) } else { - CameraComputeBoundsVisitor boundsVisitor(Mask_Reference | Mask_Terrain); + osg::ComputeBoundsVisitor boundsVisitor; osg::BoundingBox &boundingBox(boundsVisitor.getBoundingBox()); + boundsVisitor.setNodeMaskOverride(Mask_Reference | Mask_Terrain); mRootNode->accept(boundsVisitor); @@ -323,7 +325,7 @@ void SceneWidget::update(double dt) if (!boundingBox.valid()) { boundsVisitor.reset(); - boundsVisitor.setMask(~0); + boundsVisitor.setNodeMaskOverride(~0); mRootNode->accept(boundsVisitor); }