Replaced osgUtil::IntersectVisitor usage with osgUtil::InteresectionVisitor

This commit is contained in:
Robert Osfield
2018-04-20 14:32:34 +01:00
parent 8de8af6850
commit 709194c88c
15 changed files with 23 additions and 27 deletions

View File

@@ -16,9 +16,7 @@
* THE SOFTWARE.
*/
/* osgpick sample
* demonstrate use of osgUtil/PickVisitor for picking in a HUD or
* in a 3d scene,
/* osgpick sample - Mouse picking in a 3d scene,
*/
#include <osgUtil/Optimizer>

View File

@@ -21,7 +21,6 @@
#include <osg/BoundingSphere>
#include <osg/MatrixTransform>
#include <osgUtil/SceneView>
#include <osgUtil/IntersectVisitor>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIActionAdapter>

View File

@@ -29,9 +29,9 @@
namespace osgUtil {
/** Deprecated */
class OSGUTIL_EXPORT Hit
{
/** Deprecated */
public:
Hit();
@@ -200,7 +200,7 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
osg::Vec3 _pseudoEyePoint;
};
/** Picking intersection visitor specialises the IntersectVistor to allow more convenient handling of mouse picking.*/
/** Deprecated Use LineSegmentIntersector/IntersectionVisitor or View::computeIntersections(..).*/
class OSGUTIL_EXPORT PickVisitor : public osgUtil::IntersectVisitor
{
public:

View File

@@ -16,6 +16,7 @@
#include <osgManipulator/Command>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Material>

View File

@@ -16,6 +16,7 @@
#include <osgManipulator/Command>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Material>

View File

@@ -16,6 +16,7 @@
#include <osgManipulator/Command>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/Material>

View File

@@ -16,6 +16,7 @@
#include <osgManipulator/Command>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/Material>

View File

@@ -14,9 +14,8 @@
#include <osgManipulator/ScaleAxisDragger>
#include <osg/ShapeDrawable>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/Geode>
#include <osg/Quat>
using namespace osgManipulator;

View File

@@ -16,6 +16,7 @@
#include <osgManipulator/AntiSquish>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/Quat>

View File

@@ -15,9 +15,8 @@
#include <osgManipulator/TrackballDragger>
#include <osgManipulator/AntiSquish>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/PolygonMode>
#include <osg/CullFace>
#include <osg/Quat>

View File

@@ -16,6 +16,7 @@
#include <osgManipulator/Command>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/Material>

View File

@@ -16,6 +16,7 @@
#include <osgManipulator/Command>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/Material>

View File

@@ -14,10 +14,8 @@
#include <osgManipulator/TranslateAxisDragger>
#include <osg/ShapeDrawable>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/Quat>
#include <osg/Geode>
using namespace osgManipulator;

View File

@@ -15,6 +15,7 @@
#include <osgManipulator/TranslatePlaneDragger>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/Quat>

View File

@@ -14,7 +14,7 @@
#include <osgSim/VisibilityGroup>
#include <osgUtil/CullVisitor>
#include <osgUtil/IntersectVisitor>
#include <osgUtil/LineSegmentIntersector>
using namespace osgSim;
using namespace osg;
@@ -55,26 +55,21 @@ void VisibilityGroup::traverse(osg::NodeVisitor& nv)
osg::Vec3 seg = center - eye;
// perform the intersection using the given mask
osgUtil::IntersectVisitor iv;
osg::ref_ptr<osg::LineSegment> lineseg = new osg::LineSegment;
lineseg->set(eye, center);
iv.addLineSegment(lineseg.get());
osg::ref_ptr<osgUtil::LineSegmentIntersector> lineseg = new osgUtil::LineSegmentIntersector(eye, center);
osgUtil::IntersectionVisitor iv(lineseg.get());
iv.setTraversalMask(_volumeIntersectionMask);
if(_visibilityVolume.valid())
_visibilityVolume->accept(iv);
// now examine the hit record
if(iv.hits())
if(lineseg->containsIntersections())
{
osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(lineseg.get());
if(!hitList.empty()) // we actually hit something
{
// OSG_INFO << "Hit obstruction"<< std::endl;
osg::Vec3 normal = hitList.front().getWorldIntersectNormal();
if((normal*seg) > 0.f ) // we are inside
Group::traverse(nv);
}
osgUtil::LineSegmentIntersector::Intersection intersection = lineseg->getFirstIntersection();
osg::Vec3 normal = intersection.getWorldIntersectNormal();
if((normal*seg) > 0.f ) // we are inside
Group::traverse(nv);
}
}
else