mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Prefer Intersector::PROJECTION over Intersector::WINDOW
This commit is contained in:
parent
14b143231c
commit
576d5111a5
@ -269,7 +269,11 @@ namespace MWRender
|
||||
|
||||
int InventoryPreview::getSlotSelected (int posX, int posY)
|
||||
{
|
||||
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector (new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, posX, posY));
|
||||
float projX = (posX / mCamera->getViewport()->width()) * 2 - 1.f;
|
||||
float projY = (posY / mCamera->getViewport()->height()) * 2 - 1.f;
|
||||
// With Intersector::WINDOW, the intersection ratios are slightly inaccurate. TODO: investigate
|
||||
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector (new osgUtil::LineSegmentIntersector(osgUtil::Intersector::PROJECTION, projX, projY));
|
||||
|
||||
intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::LIMIT_NEAREST);
|
||||
osgUtil::IntersectionVisitor visitor(intersector);
|
||||
visitor.setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
|
||||
|
Loading…
x
Reference in New Issue
Block a user