1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 04:36:41 +00:00

Use nodeMask... lets ignore the previous attempt

This commit is contained in:
Sam Hellawell 2024-07-31 00:30:06 +01:00 committed by uramer
parent de4d97826a
commit ae0660db0a

View file

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