|
|
|
@ -730,18 +730,23 @@ namespace MWRender
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<osgUtil::IntersectionVisitor> createIntersectionVisitor(osgUtil::Intersector* intersector, bool ignorePlayer, bool ignoreActors)
|
|
|
|
|
osg::ref_ptr<osgUtil::IntersectionVisitor> RenderingManager::getIntersectionVisitor(osgUtil::Intersector *intersector, bool ignorePlayer, bool ignoreActors)
|
|
|
|
|
{
|
|
|
|
|
osg::ref_ptr<osgUtil::IntersectionVisitor> intersectionVisitor( new osgUtil::IntersectionVisitor(intersector));
|
|
|
|
|
int mask = intersectionVisitor->getTraversalMask();
|
|
|
|
|
if (!mIntersectionVisitor)
|
|
|
|
|
mIntersectionVisitor = new osgUtil::IntersectionVisitor;
|
|
|
|
|
|
|
|
|
|
mIntersectionVisitor->setTraversalNumber(mViewer->getFrameStamp()->getFrameNumber());
|
|
|
|
|
mIntersectionVisitor->setIntersector(intersector);
|
|
|
|
|
|
|
|
|
|
int mask = ~0;
|
|
|
|
|
mask &= ~(Mask_RenderToTexture|Mask_Sky|Mask_Debug|Mask_Effect|Mask_Water|Mask_SimpleWater);
|
|
|
|
|
if (ignorePlayer)
|
|
|
|
|
mask &= ~(Mask_Player);
|
|
|
|
|
if (ignoreActors)
|
|
|
|
|
mask &= ~(Mask_Actor|Mask_Player);
|
|
|
|
|
|
|
|
|
|
intersectionVisitor->setTraversalMask(mask);
|
|
|
|
|
return intersectionVisitor;
|
|
|
|
|
mIntersectionVisitor->setTraversalMask(mask);
|
|
|
|
|
return mIntersectionVisitor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RenderingManager::RayResult RenderingManager::castRay(const osg::Vec3f& origin, const osg::Vec3f& dest, bool ignorePlayer, bool ignoreActors)
|
|
|
|
@ -750,7 +755,7 @@ namespace MWRender
|
|
|
|
|
origin, dest));
|
|
|
|
|
intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::LIMIT_NEAREST);
|
|
|
|
|
|
|
|
|
|
mRootNode->accept(*createIntersectionVisitor(intersector, ignorePlayer, ignoreActors));
|
|
|
|
|
mRootNode->accept(*getIntersectionVisitor(intersector, ignorePlayer, ignoreActors));
|
|
|
|
|
|
|
|
|
|
return getIntersectionResult(intersector);
|
|
|
|
|
}
|
|
|
|
@ -769,7 +774,7 @@ namespace MWRender
|
|
|
|
|
intersector->setEnd(end);
|
|
|
|
|
intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::LIMIT_NEAREST);
|
|
|
|
|
|
|
|
|
|
mViewer->getCamera()->accept(*createIntersectionVisitor(intersector, ignorePlayer, ignoreActors));
|
|
|
|
|
mViewer->getCamera()->accept(*getIntersectionVisitor(intersector, ignorePlayer, ignoreActors));
|
|
|
|
|
|
|
|
|
|
return getIntersectionResult(intersector);
|
|
|
|
|
}
|
|
|
|
|