Fix intersections with Rig/MorphGeometry, was caused by an issue in the LineSegmentIntersector not respecting the cullingActive flag of a drawable.

This commit is contained in:
scrawl 2017-09-03 16:02:40 +02:00
parent 7441f80e4c
commit 2e58024f1c
4 changed files with 14 additions and 4 deletions

View file

@ -82,14 +82,17 @@ void MorphGeometry::accept(osg::NodeVisitor &nv)
if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
cull(&nv);
else if (nv.getVisitorType() == osg::NodeVisitor::INTERSECTION_VISITOR)
nv.apply(*getGeometry(mLastFrameNumber));
else
nv.apply(*this);
nv.popFromNodePath();
}
void MorphGeometry::accept(osg::PrimitiveFunctor& func) const
{
getGeometry(mLastFrameNumber)->accept(func);
}
osg::BoundingBox MorphGeometry::computeBoundingBox() const
{
bool anyMorphTarget = false;

View file

@ -57,6 +57,8 @@ namespace SceneUtil
osg::ref_ptr<osg::Geometry> getSourceGeometry() const;
virtual void accept(osg::NodeVisitor &nv);
virtual bool supports(const osg::PrimitiveFunctor&) const { return true; }
virtual void accept(osg::PrimitiveFunctor&) const;
virtual osg::BoundingBox computeBoundingBox() const;

View file

@ -318,14 +318,17 @@ void RigGeometry::accept(osg::NodeVisitor &nv)
cull(&nv);
else if (nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
updateBounds(&nv);
else if (nv.getVisitorType() == osg::NodeVisitor::INTERSECTION_VISITOR)
nv.apply(*getGeometry(mLastFrameNumber));
else
nv.apply(*this);
nv.popFromNodePath();
}
void RigGeometry::accept(osg::PrimitiveFunctor& func) const
{
getGeometry(mLastFrameNumber)->accept(func);
}
osg::Geometry* RigGeometry::getGeometry(unsigned int frame) const
{
return mGeometry[frame%2].get();

View file

@ -48,6 +48,8 @@ namespace SceneUtil
osg::ref_ptr<osg::Geometry> getSourceGeometry();
virtual void accept(osg::NodeVisitor &nv);
virtual bool supports(const osg::PrimitiveFunctor&) const { return true; }
virtual void accept(osg::PrimitiveFunctor&) const;
private:
void cull(osg::NodeVisitor* nv);