Added basic PolytopeIntersector functionality based on checking vertices against

polytopes.
This commit is contained in:
Robert Osfield
2006-11-02 15:50:04 +00:00
parent c3643a738c
commit 7d12b85632
2 changed files with 106 additions and 54 deletions

View File

@@ -564,9 +564,18 @@ void PolytopeIntersector::intersect(osgUtil::IntersectionVisitor& iv, osg::Drawa
{
if ( !_polytope.contains( drawable->getBound() ) ) return;
osg::Geometry* geometry = drawable->asGeometry();
osg::Vec3Array* vertices = geometry ? dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray()) : 0;
if (vertices)
{
if (!_polytope.contains(*vertices)) return;
}
Intersection hit;
hit.nodePath = iv.getNodePath();
hit.drawable = drawable;
insertIntersection(hit);
}
@@ -736,11 +745,11 @@ void IntersectionVisitor::reset()
void IntersectionVisitor::apply(osg::Node& node)
{
osg::notify(osg::NOTICE)<<"apply(Node&)"<<std::endl;
// osg::notify(osg::NOTICE)<<"apply(Node&)"<<std::endl;
if (!enter(node)) return;
osg::notify(osg::NOTICE)<<"inside apply(Node&)"<<std::endl;
// osg::notify(osg::NOTICE)<<"inside apply(Node&)"<<std::endl;
traverse(node);