Added initial interface for computing intersections between sphere segments
and terrain.
This commit is contained in:
@@ -323,7 +323,7 @@ int main(int argc, char **argv)
|
||||
|
||||
// tell the overlay node to continously update its overlay texture
|
||||
// as we know we'll be tracking a moving target.
|
||||
// overlayNode->setContinousUpdate(true);
|
||||
overlayNode->setContinousUpdate(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -272,6 +272,16 @@ void build_world(osg::Group *root)
|
||||
root->addChild(ss.get());
|
||||
}
|
||||
|
||||
osgSim::SphereSegment::LineList lines = ss->computeIntersection(terrainGeode.get(), osg::Matrixd::identity());
|
||||
if (!lines.empty())
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"We've found intersections!!!!"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"No intersections found"<<std::endl;
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
||||
|
||||
@@ -285,6 +295,8 @@ void build_world(osg::Group *root)
|
||||
overlayNode->addChild(terrainGeode.get());
|
||||
|
||||
root->addChild(overlayNode);
|
||||
|
||||
|
||||
#else
|
||||
root->addChild(terrainGeode);
|
||||
#endif
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Matrixd>
|
||||
#include <osg/BlendFunc>
|
||||
|
||||
namespace osgSim{
|
||||
@@ -226,6 +227,12 @@ public:
|
||||
void setAllColors(const osg::Vec4& c);
|
||||
|
||||
META_Node(osgSim, SphereSegment);
|
||||
|
||||
/** A list of vertex arrays representing a list of lines.*/
|
||||
typedef std::vector< osg::ref_ptr<osg::Vec3Array> > LineList;
|
||||
|
||||
/** Compute the interesection lines between specified geometry and this sphere segment.*/
|
||||
LineList computeIntersection(osg::Node* subgraph, const osg::Matrixd& transform);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -960,3 +960,10 @@ void SphereSegment::setAllColors(const osg::Vec4& c)
|
||||
setEdgeLineColor(c);
|
||||
setSideColor(c);
|
||||
}
|
||||
|
||||
SphereSegment::LineList SphereSegment::computeIntersection(osg::Node* subgraph, const osg::Matrixd& transform)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Creating line intersection between sphere segment and subgraph."<<std::endl;
|
||||
SphereSegment::LineList lines;
|
||||
return lines;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user