diff --git a/include/osgSim/ElevationSlice b/include/osgSim/ElevationSlice index bb7bde227..7290cf8ef 100644 --- a/include/osgSim/ElevationSlice +++ b/include/osgSim/ElevationSlice @@ -58,10 +58,10 @@ class OSGSIM_EXPORT ElevationSlice * Note, if the topmost node is a CoordinateSystemNode then the input points are assumed to be geocentric, * with the up vector defined by the EllipsoidModel attached to the CoordinateSystemNode. * If the topmost node is not a CoordinateSystemNode then a local coordinates frame is assumed, with a local up vector. */ - void computeIntersections(osg::Node* scene); + void computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask=0xffffffff); /** Compute the vertical distance between the specified scene graph and a single HAT point. .*/ - static Vec3dList computeElevationSlice(osg::Node* scene, const osg::Vec3d& startPoint, const osg::Vec3d& endPoint); + static Vec3dList computeElevationSlice(osg::Node* scene, const osg::Vec3d& startPoint, const osg::Vec3d& endPoint, osg::Node::NodeMask traversalMask=0xffffffff); /** Clear the database cache.*/ diff --git a/include/osgSim/HeightAboveTerrain b/include/osgSim/HeightAboveTerrain index 39b77b155..bd3f41548 100644 --- a/include/osgSim/HeightAboveTerrain +++ b/include/osgSim/HeightAboveTerrain @@ -62,10 +62,10 @@ class OSGSIM_EXPORT HeightAboveTerrain * Note, if the topmost node is a CoordinateSystemNode then the input points are assumed to be geocentric, * with the up vector defined by the EllipsoidModel attached to the CoordinateSystemNode. * If the topmost node is not a CoordinateSystemNode then a local coordinates frame is assumed, with a local up vector. */ - void computeIntersections(osg::Node* scene); + void computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask=0xffffffff); /** Compute the vertical distance between the specified scene graph and a single HAT point. .*/ - static double computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point); + static double computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, osg::Node::NodeMask traversalMask=0xffffffff); /** Clear the database cache.*/ diff --git a/include/osgSim/LineOfSight b/include/osgSim/LineOfSight index e82247edc..a15c6cf0e 100644 --- a/include/osgSim/LineOfSight +++ b/include/osgSim/LineOfSight @@ -79,10 +79,10 @@ class OSGSIM_EXPORT LineOfSight /** Compute the LOS intersections with the specified scene graph. * The results are all stored in the form of Intersections list, one per LOS test.*/ - void computeIntersections(osg::Node* scene); + void computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask=0xffffffff); /** Compute the intersection between the specified scene graph and a single LOS start,end pair. Returns an IntersectionList, of all the points intersected.*/ - static Intersections computeIntersections(osg::Node* scene, const osg::Vec3d& start, const osg::Vec3d& end); + static Intersections computeIntersections(osg::Node* scene, const osg::Vec3d& start, const osg::Vec3d& end, osg::Node::NodeMask traversalMask=0xffffffff); /** Clear the database cache.*/ diff --git a/src/osgSim/ElevationSlice.cpp b/src/osgSim/ElevationSlice.cpp index f9b56624d..c796517f3 100644 --- a/src/osgSim/ElevationSlice.cpp +++ b/src/osgSim/ElevationSlice.cpp @@ -1162,7 +1162,7 @@ ElevationSlice::ElevationSlice() setDatabaseCacheReadCallback(new DatabaseCacheReadCallback); } -void ElevationSlice::computeIntersections(osg::Node* scene) +void ElevationSlice::computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask) { osg::CoordinateSystemNode* csn = dynamic_cast(scene); osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0; @@ -1231,6 +1231,7 @@ void ElevationSlice::computeIntersections(osg::Node* scene) intersector->setEllipsoidModel(em); _intersectionVisitor.reset(); + _intersectionVisitor.setTraversalMask(traversalMask); _intersectionVisitor.setIntersector( intersector.get() ); scene->accept(_intersectionVisitor); @@ -1420,12 +1421,12 @@ void ElevationSlice::computeIntersections(osg::Node* scene) } -ElevationSlice::Vec3dList ElevationSlice::computeElevationSlice(osg::Node* scene, const osg::Vec3d& startPoint, const osg::Vec3d& endPoint) +ElevationSlice::Vec3dList ElevationSlice::computeElevationSlice(osg::Node* scene, const osg::Vec3d& startPoint, const osg::Vec3d& endPoint, osg::Node::NodeMask traversalMask) { ElevationSlice es; es.setStartPoint(startPoint); es.setEndPoint(endPoint); - es.computeIntersections(scene); + es.computeIntersections(scene, traversalMask); return es.getIntersections(); } diff --git a/src/osgSim/HeightAboveTerrain.cpp b/src/osgSim/HeightAboveTerrain.cpp index 37ac2e865..967cbbd41 100644 --- a/src/osgSim/HeightAboveTerrain.cpp +++ b/src/osgSim/HeightAboveTerrain.cpp @@ -38,7 +38,7 @@ unsigned int HeightAboveTerrain::addPoint(const osg::Vec3d& point) return index; } -void HeightAboveTerrain::computeIntersections(osg::Node* scene) +void HeightAboveTerrain::computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask) { osg::CoordinateSystemNode* csn = dynamic_cast(scene); osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0; @@ -82,6 +82,7 @@ void HeightAboveTerrain::computeIntersections(osg::Node* scene) } _intersectionVisitor.reset(); + _intersectionVisitor.setTraversalMask(traversalMask); _intersectionVisitor.setIntersector( intersectorGroup.get() ); scene->accept(_intersectionVisitor); @@ -107,11 +108,11 @@ void HeightAboveTerrain::computeIntersections(osg::Node* scene) } -double HeightAboveTerrain::computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point) +double HeightAboveTerrain::computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, osg::Node::NodeMask traversalMask) { HeightAboveTerrain hat; unsigned int index = hat.addPoint(point); - hat.computeIntersections(scene); + hat.computeIntersections(scene, traversalMask); return hat.getHeightAboveTerrain(index); } diff --git a/src/osgSim/LineOfSight.cpp b/src/osgSim/LineOfSight.cpp index aca733627..62efc4de2 100644 --- a/src/osgSim/LineOfSight.cpp +++ b/src/osgSim/LineOfSight.cpp @@ -104,7 +104,7 @@ unsigned int LineOfSight::addLOS(const osg::Vec3d& start, const osg::Vec3d& end) return index; } -void LineOfSight::computeIntersections(osg::Node* scene) +void LineOfSight::computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask) { osg::ref_ptr intersectorGroup = new osgUtil::IntersectorGroup(); @@ -117,6 +117,7 @@ void LineOfSight::computeIntersections(osg::Node* scene) } _intersectionVisitor.reset(); + _intersectionVisitor.setTraversalMask(traversalMask); _intersectionVisitor.setIntersector( intersectorGroup.get() ); scene->accept(_intersectionVisitor); @@ -147,11 +148,11 @@ void LineOfSight::computeIntersections(osg::Node* scene) } -LineOfSight::Intersections LineOfSight::computeIntersections(osg::Node* scene, const osg::Vec3d& start, const osg::Vec3d& end) +LineOfSight::Intersections LineOfSight::computeIntersections(osg::Node* scene, const osg::Vec3d& start, const osg::Vec3d& end, osg::Node::NodeMask traversalMask) { LineOfSight los; unsigned int index = los.addLOS(start,end); - los.computeIntersections(scene); + los.computeIntersections(scene, traversalMask); return los.getIntersections(index); }