forked from teamnwah/openmw-tes3coop
Change variable to mRatio and initialize it
This commit is contained in:
parent
e25e698978
commit
538209b0a2
3 changed files with 6 additions and 6 deletions
|
@ -668,6 +668,7 @@ namespace MWRender
|
|||
{
|
||||
RenderingManager::RayResult result;
|
||||
result.mHit = false;
|
||||
result.mRatio = 0;
|
||||
if (intersector->containsIntersections())
|
||||
{
|
||||
result.mHit = true;
|
||||
|
@ -675,6 +676,7 @@ namespace MWRender
|
|||
|
||||
result.mHitPointWorld = intersection.getWorldIntersectPoint();
|
||||
result.mHitNormalWorld = intersection.getWorldIntersectNormal();
|
||||
result.mRatio = intersection.ratio;
|
||||
|
||||
PtrHolder* ptrHolder = NULL;
|
||||
for (osg::NodePath::const_iterator it = intersection.nodePath.begin(); it != intersection.nodePath.end(); ++it)
|
||||
|
@ -738,9 +740,7 @@ namespace MWRender
|
|||
|
||||
mViewer->getCamera()->accept(*createIntersectionVisitor(intersector, ignorePlayer, ignoreActors));
|
||||
|
||||
RayResult result = getIntersectionResult(intersector);
|
||||
result.mDistanceToFirstIntersection = maxDistance * intersector->getFirstIntersection().ratio;
|
||||
return result;
|
||||
return getIntersectionResult(intersector);
|
||||
}
|
||||
|
||||
void RenderingManager::updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &updated)
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace MWRender
|
|||
osg::Vec3f mHitNormalWorld;
|
||||
osg::Vec3f mHitPointWorld;
|
||||
MWWorld::Ptr mHitObject;
|
||||
float mDistanceToFirstIntersection;
|
||||
float mRatio;
|
||||
};
|
||||
|
||||
RayResult castRay(const osg::Vec3f& origin, const osg::Vec3f& dest, bool ignorePlayer, bool ignoreActors=false);
|
||||
|
|
|
@ -1730,7 +1730,7 @@ namespace MWWorld
|
|||
MWRender::RenderingManager::RayResult rayToObject = mRendering->castCameraToViewportRay(x, y, maxDistance, ignorePlayer);
|
||||
facedObject = rayToObject.mHitObject;
|
||||
if (!facedObject.isEmpty())
|
||||
distance = rayToObject.mDistanceToFirstIntersection;
|
||||
distance = rayToObject.mRatio * maxDistance;
|
||||
return facedObject;
|
||||
}
|
||||
else
|
||||
|
@ -1738,7 +1738,7 @@ namespace MWWorld
|
|||
MWRender::RenderingManager::RayResult rayToObject = mRendering->castCameraToViewportRay(0.5f, 0.5f, maxDistance, ignorePlayer);
|
||||
facedObject = rayToObject.mHitObject;
|
||||
if (!facedObject.isEmpty())
|
||||
distance = rayToObject.mDistanceToFirstIntersection;
|
||||
distance = rayToObject.mRatio * maxDistance;
|
||||
return facedObject;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue