forked from mirror/openmw-tes3mp
Raytest mask fix (Fixes #2984)
This commit is contained in:
parent
b9b154a015
commit
93f4d31cf9
1 changed files with 16 additions and 22 deletions
|
@ -588,23 +588,27 @@ namespace MWRender
|
|||
|
||||
}
|
||||
|
||||
osg::ref_ptr<osgUtil::IntersectionVisitor> createIntersectionVisitor(osgUtil::Intersector* intersector, bool ignorePlayer, bool ignoreActors)
|
||||
{
|
||||
osg::ref_ptr<osgUtil::IntersectionVisitor> intersectionVisitor( new osgUtil::IntersectionVisitor(intersector));
|
||||
int mask = intersectionVisitor->getTraversalMask();
|
||||
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;
|
||||
}
|
||||
|
||||
RenderingManager::RayResult RenderingManager::castRay(const osg::Vec3f& origin, const osg::Vec3f& dest, bool ignorePlayer, bool ignoreActors)
|
||||
{
|
||||
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector (new osgUtil::LineSegmentIntersector(osgUtil::LineSegmentIntersector::MODEL,
|
||||
origin, dest));
|
||||
intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::LIMIT_NEAREST);
|
||||
|
||||
osgUtil::IntersectionVisitor intersectionVisitor(intersector);
|
||||
int mask = intersectionVisitor.getTraversalMask();
|
||||
mask &= ~(Mask_RenderToTexture|Mask_Sky|Mask_Debug|Mask_Effect|Mask_Water);
|
||||
if (ignorePlayer)
|
||||
mask &= ~(Mask_Player);
|
||||
if (ignoreActors)
|
||||
mask &= ~(Mask_Actor|Mask_Player);
|
||||
|
||||
intersectionVisitor.setTraversalMask(mask);
|
||||
|
||||
mRootNode->accept(intersectionVisitor);
|
||||
mRootNode->accept(*createIntersectionVisitor(intersector, ignorePlayer, ignoreActors));
|
||||
|
||||
return getIntersectionResult(intersector);
|
||||
}
|
||||
|
@ -623,17 +627,7 @@ namespace MWRender
|
|||
intersector->setEnd(end);
|
||||
intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::LIMIT_NEAREST);
|
||||
|
||||
osgUtil::IntersectionVisitor intersectionVisitor(intersector);
|
||||
int mask = intersectionVisitor.getTraversalMask();
|
||||
mask &= ~(Mask_RenderToTexture|Mask_Sky|Mask_Debug|Mask_Effect|Mask_Water);
|
||||
if (ignorePlayer)
|
||||
mask &= ~(Mask_Player);
|
||||
if (ignoreActors)
|
||||
mask &= ~(Mask_Actor|Mask_Player);
|
||||
|
||||
intersectionVisitor.setTraversalMask(mask);
|
||||
|
||||
mViewer->getCamera()->accept(intersectionVisitor);
|
||||
mViewer->getCamera()->accept(*createIntersectionVisitor(intersector, ignorePlayer, ignoreActors));
|
||||
|
||||
return getIntersectionResult(intersector);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue