Added NodeVisitor::INTERSECTION_VISITOR VisitorType

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14395 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-07-31 18:29:31 +00:00
parent 899e359cdb
commit e979f76156
7 changed files with 17 additions and 9 deletions

View File

@@ -82,7 +82,8 @@ class OSG_EXPORT NodeVisitor : public virtual Object
UPDATE_VISITOR, UPDATE_VISITOR,
EVENT_VISITOR, EVENT_VISITOR,
COLLECT_OCCLUDER_VISITOR, COLLECT_OCCLUDER_VISITOR,
CULL_VISITOR CULL_VISITOR,
INTERSECTION_VISITOR
}; };
NodeVisitor(TraversalMode tm=TRAVERSE_NONE); NodeVisitor(TraversalMode tm=TRAVERSE_NONE);

View File

@@ -114,8 +114,13 @@ void Widget::updateFocus(osg::NodeVisitor& nv)
if (checkWithinWidget) if (checkWithinWidget)
{ {
#if 0
osgUtil::LineSegmentIntersector::Intersections intersections; osgUtil::LineSegmentIntersector::Intersections intersections;
bool withinWidget = aa->computeIntersections(*ea, nv.getNodePath(), intersections); bool withinWidget = aa->computeIntersections(*ea, nv.getNodePath(), intersections);
#else
Intersections intersections;
bool withinWidget = computeIntersections( ev, ea, intersections);
#endif
_hasEventFocus = withinWidget; _hasEventFocus = withinWidget;
} }
@@ -227,7 +232,8 @@ void Widget::traverseImplementation(osg::NodeVisitor& nv)
osg::Group::traverse(nv); osg::Group::traverse(nv);
} }
} }
else if (_visible || (nv.getVisitorType()!=osg::NodeVisitor::UPDATE_VISITOR && nv.getVisitorType()!=osg::NodeVisitor::CULL_VISITOR)) else if (_visible ||
(nv.getVisitorType()!=osg::NodeVisitor::UPDATE_VISITOR && nv.getVisitorType()!=osg::NodeVisitor::CULL_VISITOR && nv.getVisitorType()!=osg::NodeVisitor::INTERSECTION_VISITOR) )
{ {
GraphicsSubgraphMap::iterator itr = _graphicsSubgraphMap.begin(); GraphicsSubgraphMap::iterator itr = _graphicsSubgraphMap.begin();
while(itr!= _graphicsSubgraphMap.end() && itr->first<=0) while(itr!= _graphicsSubgraphMap.end() && itr->first<=0)

View File

@@ -45,7 +45,7 @@ inline int EQUAL_F(float a, float b)
CullVisitor::CullVisitor(): CullVisitor::CullVisitor():
NodeVisitor(CULL_VISITOR,TRAVERSE_ACTIVE_CHILDREN), osg::NodeVisitor(CULL_VISITOR,TRAVERSE_ACTIVE_CHILDREN),
_currentStateGraph(NULL), _currentStateGraph(NULL),
_currentRenderBin(NULL), _currentRenderBin(NULL),
_traversalNumber(0), _traversalNumber(0),

View File

@@ -179,7 +179,8 @@ void IntersectVisitor::IntersectState::addLineSegment(osg::LineSegment* seg)
} }
IntersectVisitor::IntersectVisitor() IntersectVisitor::IntersectVisitor():
osg::NodeVisitor(osg::NodeVisitor::INTERSECTION_VISITOR, osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN)
{ {
// override the default node visitor mode. // override the default node visitor mode.

View File

@@ -151,11 +151,9 @@ bool IntersectorGroup::containsIntersections()
// IntersectionVisitor // IntersectionVisitor
// //
IntersectionVisitor::IntersectionVisitor(Intersector* intersector, ReadCallback* readCallback) IntersectionVisitor::IntersectionVisitor(Intersector* intersector, ReadCallback* readCallback):
osg::NodeVisitor(osg::NodeVisitor::INTERSECTION_VISITOR, osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN)
{ {
// override the default node visitor mode.
setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
_useKdTreesWhenAvailable = true; _useKdTreesWhenAvailable = true;
_dummyTraversal = false; _dummyTraversal = false;

View File

@@ -15,7 +15,8 @@
using namespace osg; using namespace osg;
using namespace osgUtil; using namespace osgUtil;
UpdateVisitor::UpdateVisitor():NodeVisitor(UPDATE_VISITOR,TRAVERSE_ALL_CHILDREN) UpdateVisitor::UpdateVisitor():
osg::NodeVisitor(osg::NodeVisitor::UPDATE_VISITOR, osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
{ {
} }

View File

@@ -24,6 +24,7 @@ REGISTER_OBJECT_WRAPPER( NodeVistor,
ADD_ENUM_VALUE( EVENT_VISITOR ); ADD_ENUM_VALUE( EVENT_VISITOR );
ADD_ENUM_VALUE( COLLECT_OCCLUDER_VISITOR ); ADD_ENUM_VALUE( COLLECT_OCCLUDER_VISITOR );
ADD_ENUM_VALUE( CULL_VISITOR ); ADD_ENUM_VALUE( CULL_VISITOR );
ADD_ENUM_VALUE( INTERSECTION_VISITOR );
END_ENUM_SERIALIZER(); END_ENUM_SERIALIZER();
ADD_UINT_SERIALIZER(TraversalMask, 0xffffffff); ADD_UINT_SERIALIZER(TraversalMask, 0xffffffff);