|
|
@ -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;
|
|
|
@ -1061,9 +1062,14 @@ namespace MWRender
|
|
|
|
auto test = [&](const osgUtil::LineSegmentIntersector::Intersection& intersection) {
|
|
|
|
auto test = [&](const osgUtil::LineSegmentIntersector::Intersection& intersection) {
|
|
|
|
PtrHolder* ptrHolder = nullptr;
|
|
|
|
PtrHolder* ptrHolder = nullptr;
|
|
|
|
std::vector<RefnumMarker*> refnumMarkers;
|
|
|
|
std::vector<RefnumMarker*> refnumMarkers;
|
|
|
|
|
|
|
|
bool hitNonObjectWorld = false;
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
const auto& nodeMask = (*it)->getNodeMask();
|
|
|
|
|
|
|
|
if (!hitNonObjectWorld)
|
|
|
|
|
|
|
|
hitNonObjectWorld = nodeMask & nonObjectWorldMask;
|
|
|
|
|
|
|
|
|
|
|
|
osg::UserDataContainer* userDataContainer = (*it)->getUserDataContainer();
|
|
|
|
osg::UserDataContainer* userDataContainer = (*it)->getUserDataContainer();
|
|
|
|
if (!userDataContainer)
|
|
|
|
if (!userDataContainer)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -1109,7 +1115,7 @@ namespace MWRender
|
|
|
|
vertexCounter += refnumMarkers[i]->mNumVertices;
|
|
|
|
vertexCounter += refnumMarkers[i]->mNumVertices;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!result.mHitObject.isEmpty() || result.mHitRefnum.isSet())
|
|
|
|
if (!result.mHitObject.isEmpty() || result.mHitRefnum.isSet() || hitNonObjectWorld)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result.mHit = true;
|
|
|
|
result.mHit = true;
|
|
|
|
result.mHitPointWorld = intersection.getWorldIntersectPoint();
|
|
|
|
result.mHitPointWorld = intersection.getWorldIntersectPoint();
|
|
|
|