1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:29:55 +00:00

New setting "third person camera distance"

This commit is contained in:
Petr Mikheev 2020-06-23 20:05:22 +02:00
parent 46db69a349
commit 280862f58b
5 changed files with 24 additions and 6 deletions

View file

@ -3,6 +3,7 @@
#include <osg/Camera>
#include <components/sceneutil/positionattitudetransform.hpp>
#include <components/settings/settings.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
@ -56,7 +57,7 @@ namespace MWRender
mFurthest(800.f),
mIsNearest(false),
mHeight(124.f),
mBaseCameraDistance(192.f),
mBaseCameraDistance(Settings::Manager::getFloat("third person camera distance", "Camera")),
mVanityToggleQueued(false),
mVanityToggleQueuedValue(false),
mViewModeToggleQueued(false),
@ -380,7 +381,7 @@ namespace MWRender
return mCameraDistance;
}
void Camera::setBaseCameraDistance(float dist, bool adjust)
void Camera::updateBaseCameraDistance(float dist, bool adjust)
{
if(mFirstPersonView && !mPreviewMode && !mVanity.enabled)
return;
@ -407,7 +408,10 @@ namespace MWRender
if (mVanity.enabled || mPreviewMode)
mPreviewCam.offset = dist;
else if (!mFirstPersonView)
{
mBaseCameraDistance = dist;
Settings::Manager::setFloat("third person camera distance", "Camera", dist);
}
setCameraDistance();
}

View file

@ -119,7 +119,7 @@ namespace MWRender
/// Set base camera distance for current mode. Don't work on 1st person view.
/// \param adjust Indicates should distance be adjusted or set.
void setBaseCameraDistance(float dist, bool adjust = false);
void updateBaseCameraDistance(float dist, bool adjust = false);
/// Set camera distance for current mode. Don't work on 1st person view.
/// \param adjust Indicates should distance be adjusted or set.

View file

@ -1340,7 +1340,7 @@ namespace MWRender
if(mCamera->isNearest() && dist > 0.f)
mCamera->toggleViewMode();
else if (override)
mCamera->setBaseCameraDistance(-dist / 120.f * 10, adjust);
mCamera->updateBaseCameraDistance(-dist / 120.f * 10, adjust);
else
mCamera->setCameraDistance(-dist / 120.f * 10, adjust);
}
@ -1348,7 +1348,7 @@ namespace MWRender
{
mCamera->toggleViewMode();
if (override)
mCamera->setBaseCameraDistance(0.f, false);
mCamera->updateBaseCameraDistance(0.f, false);
else
mCamera->setCameraDistance(0.f, false);
}
@ -1397,7 +1397,7 @@ namespace MWRender
void RenderingManager::changeVanityModeScale(float factor)
{
if(mCamera->isVanityOrPreviewModeEnabled())
mCamera->setBaseCameraDistance(-factor/120.f*10, true);
mCamera->updateBaseCameraDistance(-factor/120.f*10, true);
}
void RenderingManager::overrideFieldOfView(float val)

View file

@ -114,6 +114,17 @@ while small values can result in the hands not being visible.
This setting can only be configured by editing the settings configuration file.
third person camera distance
----------------------------
:Type: floating point
:Range: 30-800
:Default: 192.0
Distance from the camera to the character in third person mode.
This setting can be changed in game using "Zoom In" / "Zoom Out" controls.
view over shoulder
------------------

View file

@ -33,6 +33,9 @@ field of view = 60.0
# Best to leave this at the default since vanilla assets are not complete enough to adapt to high FoV's. Too low FoV would clip the hands off screen.
first person field of view = 60.0
# Distance from the camera to the character in third person mode.
third person camera distance = 192
# If enabled then third person camera is positioned above character's shoulder and crosshair is visible.
view over shoulder = false