Added support for traversal mask into ElevationSlice, HeightAboveTerrain and LineOfSight classes
This commit is contained in:
@@ -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.*/
|
||||
|
||||
@@ -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.*/
|
||||
|
||||
@@ -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.*/
|
||||
|
||||
@@ -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<osg::CoordinateSystemNode*>(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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<osg::CoordinateSystemNode*>(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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<osgUtil::IntersectorGroup> 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user