mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-01 19:19:39 +00:00
Merge branch 'third_person_fix' into 'master'
Minor fixes for 'view over shoulder' See merge request OpenMW/openmw!265
This commit is contained in:
commit
c3b581131d
3 changed files with 14 additions and 0 deletions
|
@ -66,6 +66,7 @@ namespace MWRender
|
||||||
mFocalPointCurrentOffset(osg::Vec2d()),
|
mFocalPointCurrentOffset(osg::Vec2d()),
|
||||||
mFocalPointTargetOffset(osg::Vec2d()),
|
mFocalPointTargetOffset(osg::Vec2d()),
|
||||||
mFocalPointTransitionSpeedCoef(1.f),
|
mFocalPointTransitionSpeedCoef(1.f),
|
||||||
|
mSkipFocalPointTransition(true),
|
||||||
mPreviousTransitionInfluence(0.f),
|
mPreviousTransitionInfluence(0.f),
|
||||||
mSmoothedSpeed(0.f),
|
mSmoothedSpeed(0.f),
|
||||||
mZoomOutWhenMoveCoef(Settings::Manager::getFloat("zoom out when move coef", "Camera")),
|
mZoomOutWhenMoveCoef(Settings::Manager::getFloat("zoom out when move coef", "Camera")),
|
||||||
|
@ -220,6 +221,7 @@ namespace MWRender
|
||||||
updateFocalPointOffset(duration);
|
updateFocalPointOffset(duration);
|
||||||
|
|
||||||
float speed = mTrackingPtr.getClass().getSpeed(mTrackingPtr);
|
float speed = mTrackingPtr.getClass().getSpeed(mTrackingPtr);
|
||||||
|
speed /= (1.f + speed / 500.f);
|
||||||
float maxDelta = 300.f * duration;
|
float maxDelta = 300.f * duration;
|
||||||
mSmoothedSpeed += osg::clampBetween(speed - mSmoothedSpeed, -maxDelta, maxDelta);
|
mSmoothedSpeed += osg::clampBetween(speed - mSmoothedSpeed, -maxDelta, maxDelta);
|
||||||
|
|
||||||
|
@ -238,6 +240,14 @@ namespace MWRender
|
||||||
if (duration <= 0)
|
if (duration <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (mSkipFocalPointTransition)
|
||||||
|
{
|
||||||
|
mSkipFocalPointTransition = false;
|
||||||
|
mPreviousExtraOffset = osg::Vec2d();
|
||||||
|
mPreviousTransitionInfluence = 0.f;
|
||||||
|
mFocalPointCurrentOffset = mFocalPointTargetOffset;
|
||||||
|
}
|
||||||
|
|
||||||
osg::Vec2d oldOffset = mFocalPointCurrentOffset;
|
osg::Vec2d oldOffset = mFocalPointCurrentOffset;
|
||||||
|
|
||||||
if (mPreviousTransitionInfluence > 0)
|
if (mPreviousTransitionInfluence > 0)
|
||||||
|
|
|
@ -60,6 +60,7 @@ namespace MWRender
|
||||||
osg::Vec2d mFocalPointCurrentOffset;
|
osg::Vec2d mFocalPointCurrentOffset;
|
||||||
osg::Vec2d mFocalPointTargetOffset;
|
osg::Vec2d mFocalPointTargetOffset;
|
||||||
float mFocalPointTransitionSpeedCoef;
|
float mFocalPointTransitionSpeedCoef;
|
||||||
|
bool mSkipFocalPointTransition;
|
||||||
|
|
||||||
// This fields are used to make focal point transition smooth if previous transition was not finished.
|
// This fields are used to make focal point transition smooth if previous transition was not finished.
|
||||||
float mPreviousTransitionInfluence;
|
float mPreviousTransitionInfluence;
|
||||||
|
@ -85,6 +86,7 @@ namespace MWRender
|
||||||
|
|
||||||
void setFocalPointTransitionSpeed(float v) { mFocalPointTransitionSpeedCoef = v; }
|
void setFocalPointTransitionSpeed(float v) { mFocalPointTransitionSpeedCoef = v; }
|
||||||
void setFocalPointTargetOffset(osg::Vec2d v);
|
void setFocalPointTargetOffset(osg::Vec2d v);
|
||||||
|
void skipFocalPointTransition() { mSkipFocalPointTransition = true; }
|
||||||
void enableDynamicCameraDistance(bool v) { mDynamicCameraDistanceEnabled = v; }
|
void enableDynamicCameraDistance(bool v) { mDynamicCameraDistanceEnabled = v; }
|
||||||
void enableCrosshairInThirdPersonMode(bool v) { mShowCrosshairInThirdPersonMode = v; }
|
void enableCrosshairInThirdPersonMode(bool v) { mShowCrosshairInThirdPersonMode = v; }
|
||||||
|
|
||||||
|
|
|
@ -945,6 +945,7 @@ namespace MWWorld
|
||||||
removeContainerScripts(getPlayerPtr());
|
removeContainerScripts(getPlayerPtr());
|
||||||
mWorldScene->changeToInteriorCell(cellName, position, adjustPlayerPos, changeEvent);
|
mWorldScene->changeToInteriorCell(cellName, position, adjustPlayerPos, changeEvent);
|
||||||
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
|
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
|
||||||
|
mRendering->getCamera()->skipFocalPointTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::changeToExteriorCell (const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
void World::changeToExteriorCell (const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||||
|
@ -960,6 +961,7 @@ namespace MWWorld
|
||||||
removeContainerScripts(getPlayerPtr());
|
removeContainerScripts(getPlayerPtr());
|
||||||
mWorldScene->changeToExteriorCell(position, adjustPlayerPos, changeEvent);
|
mWorldScene->changeToExteriorCell(position, adjustPlayerPos, changeEvent);
|
||||||
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
|
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
|
||||||
|
mRendering->getCamera()->skipFocalPointTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
void World::changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||||
|
|
Loading…
Reference in a new issue