Use nodeMask... lets ignore the previous attempt

pull/3236/head
Sam Hellawell 5 months ago committed by uramer
parent de4d97826a
commit ae0660db0a

@ -1051,6 +1051,7 @@ namespace MWRender
RenderingManager::RayResult getIntersectionResult(osgUtil::LineSegmentIntersector* intersector, RenderingManager::RayResult getIntersectionResult(osgUtil::LineSegmentIntersector* intersector,
const osg::ref_ptr<osgUtil::IntersectionVisitor>& visitor, std::span<const MWWorld::Ptr> ignoreList = {}) const osg::ref_ptr<osgUtil::IntersectionVisitor>& visitor, std::span<const MWWorld::Ptr> ignoreList = {})
{ {
constexpr auto nonObjectWorldMask = Mask_Terrain | Mask_Water;
RenderingManager::RayResult result; RenderingManager::RayResult result;
result.mHit = false; result.mHit = false;
result.mRatio = 0; result.mRatio = 0;
@ -1065,10 +1066,9 @@ namespace MWRender
for (osg::NodePath::const_iterator it = intersection.nodePath.begin(); it != intersection.nodePath.end(); for (osg::NodePath::const_iterator it = intersection.nodePath.begin(); it != intersection.nodePath.end();
++it) ++it)
{ {
// Terrain doesnt contain any user data ptrs or flags, so we have to check the name const auto& nodeMask = (*it)->getNodeMask();
// TODO: better solution for this that could also be used for water and other world pieces with flags
if (!hitNonObjectWorld) if (!hitNonObjectWorld)
hitNonObjectWorld = (*it)->getName() == std::string_view("Terrain Root"); hitNonObjectWorld = nodeMask & nonObjectWorldMask;
osg::UserDataContainer* userDataContainer = (*it)->getUserDataContainer(); osg::UserDataContainer* userDataContainer = (*it)->getUserDataContainer();
if (!userDataContainer) if (!userDataContainer)

Loading…
Cancel
Save