forked from teamnwah/openmw-tes3coop
Avoid duplicate code
This commit is contained in:
parent
538209b0a2
commit
8014f37879
1 changed files with 8 additions and 12 deletions
|
@ -1722,26 +1722,22 @@ namespace MWWorld
|
|||
{
|
||||
maxDistance += mRendering->getCameraDistance();
|
||||
MWWorld::Ptr facedObject;
|
||||
MWRender::RenderingManager::RayResult rayToObject;
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
{
|
||||
float x, y;
|
||||
MWBase::Environment::get().getWindowManager()->getMousePosition(x, y);
|
||||
MWRender::RenderingManager::RayResult rayToObject = mRendering->castCameraToViewportRay(x, y, maxDistance, ignorePlayer);
|
||||
facedObject = rayToObject.mHitObject;
|
||||
if (!facedObject.isEmpty())
|
||||
distance = rayToObject.mRatio * maxDistance;
|
||||
return facedObject;
|
||||
rayToObject = mRendering->castCameraToViewportRay(x, y, maxDistance, ignorePlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
MWRender::RenderingManager::RayResult rayToObject = mRendering->castCameraToViewportRay(0.5f, 0.5f, maxDistance, ignorePlayer);
|
||||
rayToObject = mRendering->castCameraToViewportRay(0.5f, 0.5f, maxDistance, ignorePlayer);
|
||||
|
||||
facedObject = rayToObject.mHitObject;
|
||||
if (!facedObject.isEmpty())
|
||||
distance = rayToObject.mRatio * maxDistance;
|
||||
return facedObject;
|
||||
}
|
||||
}
|
||||
|
||||
bool World::isCellExterior() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue