Changed to using Node::accept() to handled children of Geode/Billboard to enable scene graphs with non drawables as children

This commit is contained in:
Robert Osfield 2020-11-10 15:26:21 +00:00
parent 21bb0e1a0c
commit 324750fded

View File

@ -234,9 +234,9 @@ void IntersectionVisitor::apply(osg::Geode& geode)
// OSG_NOTICE<<"inside apply(Geode&)"<<std::endl; // OSG_NOTICE<<"inside apply(Geode&)"<<std::endl;
for(unsigned int i=0; i<geode.getNumDrawables(); ++i) for(unsigned int i=0; i<geode.getNumChildren(); ++i)
{ {
intersect( geode.getDrawable(i) ); geode.getChild(i)->accept(*this);
} }
leave(); leave();
@ -250,7 +250,7 @@ void IntersectionVisitor::apply(osg::Billboard& billboard)
// IntersectVisitor doesn't have getEyeLocal(), can we use NodeVisitor::getEyePoint()? // IntersectVisitor doesn't have getEyeLocal(), can we use NodeVisitor::getEyePoint()?
osg::Vec3 eye_local = getEyePoint(); osg::Vec3 eye_local = getEyePoint();
for(unsigned int i = 0; i < billboard.getNumDrawables(); i++ ) for(unsigned int i = 0; i < billboard.getNumChildren(); i++ )
{ {
const osg::Vec3& pos = billboard.getPosition(i); const osg::Vec3& pos = billboard.getPosition(i);
osg::ref_ptr<osg::RefMatrix> billboard_matrix = new osg::RefMatrix; osg::ref_ptr<osg::RefMatrix> billboard_matrix = new osg::RefMatrix;
@ -269,7 +269,7 @@ void IntersectionVisitor::apply(osg::Billboard& billboard)
// now push an new intersector clone transform to the new local coordinates // now push an new intersector clone transform to the new local coordinates
push_clone(); push_clone();
intersect( billboard.getDrawable(i) ); billboard.getChild(i)->accept(*this);
// now push an new intersector clone transform to the new local coordinates // now push an new intersector clone transform to the new local coordinates
pop_clone(); pop_clone();