mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 20:29:57 +00:00
New setting "third person camera distance"
This commit is contained in:
parent
46db69a349
commit
280862f58b
5 changed files with 24 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include <osg/Camera>
|
#include <osg/Camera>
|
||||||
|
|
||||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -56,7 +57,7 @@ namespace MWRender
|
||||||
mFurthest(800.f),
|
mFurthest(800.f),
|
||||||
mIsNearest(false),
|
mIsNearest(false),
|
||||||
mHeight(124.f),
|
mHeight(124.f),
|
||||||
mBaseCameraDistance(192.f),
|
mBaseCameraDistance(Settings::Manager::getFloat("third person camera distance", "Camera")),
|
||||||
mVanityToggleQueued(false),
|
mVanityToggleQueued(false),
|
||||||
mVanityToggleQueuedValue(false),
|
mVanityToggleQueuedValue(false),
|
||||||
mViewModeToggleQueued(false),
|
mViewModeToggleQueued(false),
|
||||||
|
@ -380,7 +381,7 @@ namespace MWRender
|
||||||
return mCameraDistance;
|
return mCameraDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setBaseCameraDistance(float dist, bool adjust)
|
void Camera::updateBaseCameraDistance(float dist, bool adjust)
|
||||||
{
|
{
|
||||||
if(mFirstPersonView && !mPreviewMode && !mVanity.enabled)
|
if(mFirstPersonView && !mPreviewMode && !mVanity.enabled)
|
||||||
return;
|
return;
|
||||||
|
@ -407,7 +408,10 @@ namespace MWRender
|
||||||
if (mVanity.enabled || mPreviewMode)
|
if (mVanity.enabled || mPreviewMode)
|
||||||
mPreviewCam.offset = dist;
|
mPreviewCam.offset = dist;
|
||||||
else if (!mFirstPersonView)
|
else if (!mFirstPersonView)
|
||||||
|
{
|
||||||
mBaseCameraDistance = dist;
|
mBaseCameraDistance = dist;
|
||||||
|
Settings::Manager::setFloat("third person camera distance", "Camera", dist);
|
||||||
|
}
|
||||||
setCameraDistance();
|
setCameraDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace MWRender
|
||||||
|
|
||||||
/// Set base camera distance for current mode. Don't work on 1st person view.
|
/// Set base camera distance for current mode. Don't work on 1st person view.
|
||||||
/// \param adjust Indicates should distance be adjusted or set.
|
/// \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.
|
/// Set camera distance for current mode. Don't work on 1st person view.
|
||||||
/// \param adjust Indicates should distance be adjusted or set.
|
/// \param adjust Indicates should distance be adjusted or set.
|
||||||
|
|
|
@ -1340,7 +1340,7 @@ namespace MWRender
|
||||||
if(mCamera->isNearest() && dist > 0.f)
|
if(mCamera->isNearest() && dist > 0.f)
|
||||||
mCamera->toggleViewMode();
|
mCamera->toggleViewMode();
|
||||||
else if (override)
|
else if (override)
|
||||||
mCamera->setBaseCameraDistance(-dist / 120.f * 10, adjust);
|
mCamera->updateBaseCameraDistance(-dist / 120.f * 10, adjust);
|
||||||
else
|
else
|
||||||
mCamera->setCameraDistance(-dist / 120.f * 10, adjust);
|
mCamera->setCameraDistance(-dist / 120.f * 10, adjust);
|
||||||
}
|
}
|
||||||
|
@ -1348,7 +1348,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
mCamera->toggleViewMode();
|
mCamera->toggleViewMode();
|
||||||
if (override)
|
if (override)
|
||||||
mCamera->setBaseCameraDistance(0.f, false);
|
mCamera->updateBaseCameraDistance(0.f, false);
|
||||||
else
|
else
|
||||||
mCamera->setCameraDistance(0.f, false);
|
mCamera->setCameraDistance(0.f, false);
|
||||||
}
|
}
|
||||||
|
@ -1397,7 +1397,7 @@ namespace MWRender
|
||||||
void RenderingManager::changeVanityModeScale(float factor)
|
void RenderingManager::changeVanityModeScale(float factor)
|
||||||
{
|
{
|
||||||
if(mCamera->isVanityOrPreviewModeEnabled())
|
if(mCamera->isVanityOrPreviewModeEnabled())
|
||||||
mCamera->setBaseCameraDistance(-factor/120.f*10, true);
|
mCamera->updateBaseCameraDistance(-factor/120.f*10, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::overrideFieldOfView(float val)
|
void RenderingManager::overrideFieldOfView(float val)
|
||||||
|
|
|
@ -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.
|
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 over shoulder
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -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.
|
# 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
|
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.
|
# If enabled then third person camera is positioned above character's shoulder and crosshair is visible.
|
||||||
view over shoulder = false
|
view over shoulder = false
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue