From 81d1e16d7b728dd48909464c176c224be2437bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Garc=C3=ADa=20Li=C3=B1=C3=A1n?= Date: Mon, 20 May 2019 22:51:40 +0200 Subject: [PATCH] Compositor: Removed intersection checking This is now responsibility of the CameraGroup. --- simgear/scene/viewer/Compositor.cxx | 45 ----------------------------- simgear/scene/viewer/Compositor.hxx | 4 --- 2 files changed, 49 deletions(-) diff --git a/simgear/scene/viewer/Compositor.cxx b/simgear/scene/viewer/Compositor.cxx index 8d3bd9b7..964e387d 100644 --- a/simgear/scene/viewer/Compositor.cxx +++ b/simgear/scene/viewer/Compositor.cxx @@ -202,51 +202,6 @@ Compositor::resized() } } -bool -Compositor::computeIntersection( - const osg::Vec2d& windowPos, - osgUtil::LineSegmentIntersector::Intersections& intersections) -{ - using osgUtil::Intersector; - using osgUtil::LineSegmentIntersector; - - osg::Camera *camera = getPass(0)->camera; - const osg::Viewport* viewport = camera->getViewport(); - SGRect viewportRect(viewport->x(), viewport->y(), - viewport->x() + viewport->width() - 1.0, - viewport->y() + viewport->height()- 1.0); - - double epsilon = 0.5; - if (!viewportRect.contains(windowPos.x(), windowPos.y(), epsilon)) - return false; - - osg::Vec4d start(windowPos.x(), windowPos.y(), 0.0, 1.0); - osg::Vec4d end(windowPos.x(), windowPos.y(), 1.0, 1.0); - osg::Matrix windowMat = viewport->computeWindowMatrix(); - osg::Matrix startPtMat = osg::Matrix::inverse(camera->getProjectionMatrix() - * windowMat); - osg::Matrix endPtMat = startPtMat; // no far camera - - start = start * startPtMat; - start /= start.w(); - end = end * endPtMat; - end /= end.w(); - osg::ref_ptr picker - = new LineSegmentIntersector(Intersector::VIEW, - osg::Vec3d(start.x(), start.y(), start.z()), - osg::Vec3d(end.x(), end.y(), end.z())); - osgUtil::IntersectionVisitor iv(picker.get()); - iv.setTraversalMask( simgear::PICK_BIT ); - - const_cast(camera)->accept(iv); - if (picker->containsIntersections()) { - intersections = picker->getIntersections(); - return true; - } - - return false; -} - void Compositor::addBuffer(const std::string &name, Buffer *buffer) { diff --git a/simgear/scene/viewer/Compositor.hxx b/simgear/scene/viewer/Compositor.hxx index 63be4e8b..f2d0cc75 100644 --- a/simgear/scene/viewer/Compositor.hxx +++ b/simgear/scene/viewer/Compositor.hxx @@ -93,10 +93,6 @@ public: void resized(); - bool computeIntersection( - const osg::Vec2d& windowPos, - osgUtil::LineSegmentIntersector::Intersections& intersections); - osg::View *getView() const { return _view; } osg::GraphicsContext *getGraphicsContext() const { return _gc; }