mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 15:15:31 +00:00
Merge remote-tracking branch 'swick/viewmodetransission'
This commit is contained in:
commit
90ab7b2bf5
3 changed files with 42 additions and 7 deletions
|
@ -25,7 +25,11 @@ namespace MWRender
|
||||||
mHeight(128.f),
|
mHeight(128.f),
|
||||||
mCameraDistance(300.f),
|
mCameraDistance(300.f),
|
||||||
mDistanceAdjusted(false),
|
mDistanceAdjusted(false),
|
||||||
mAnimation(NULL)
|
mAnimation(NULL),
|
||||||
|
mNearest(30.f),
|
||||||
|
mFurthest(800.f),
|
||||||
|
mIsNearest(false),
|
||||||
|
mIsFurthest(false)
|
||||||
{
|
{
|
||||||
mVanity.enabled = false;
|
mVanity.enabled = false;
|
||||||
mVanity.allowed = true;
|
mVanity.allowed = true;
|
||||||
|
@ -232,16 +236,21 @@ namespace MWRender
|
||||||
if(mFirstPersonView && !mPreviewMode && !mVanity.enabled)
|
if(mFirstPersonView && !mPreviewMode && !mVanity.enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mIsFurthest = false;
|
||||||
|
mIsNearest = false;
|
||||||
|
|
||||||
Ogre::Vector3 v(0.f, 0.f, dist);
|
Ogre::Vector3 v(0.f, 0.f, dist);
|
||||||
if (adjust) {
|
if (adjust) {
|
||||||
v += mCamera->getPosition();
|
v += mCamera->getPosition();
|
||||||
}
|
}
|
||||||
if (v.z > 800.f) {
|
if (v.z >= mFurthest) {
|
||||||
v.z = 800.f;
|
v.z = mFurthest;
|
||||||
} else if (v.z < 10.f) {
|
mIsFurthest = true;
|
||||||
|
} else if (!override && v.z < 10.f) {
|
||||||
v.z = 10.f;
|
v.z = 10.f;
|
||||||
} else if (override && v.z < 50.f) {
|
} else if (override && v.z <= mNearest) {
|
||||||
v.z = 50.f;
|
v.z = mNearest;
|
||||||
|
mIsNearest = true;
|
||||||
}
|
}
|
||||||
mCamera->setPosition(v);
|
mCamera->setPosition(v);
|
||||||
|
|
||||||
|
@ -320,4 +329,14 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
return mPreviewMode || mVanity.enabled;
|
return mPreviewMode || mVanity.enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Camera::isNearest()
|
||||||
|
{
|
||||||
|
return mIsNearest;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Camera::isFurthest()
|
||||||
|
{
|
||||||
|
return mIsFurthest;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,10 @@ namespace MWRender
|
||||||
bool mFirstPersonView;
|
bool mFirstPersonView;
|
||||||
bool mPreviewMode;
|
bool mPreviewMode;
|
||||||
bool mFreeLook;
|
bool mFreeLook;
|
||||||
|
float mNearest;
|
||||||
|
float mFurthest;
|
||||||
|
bool mIsNearest;
|
||||||
|
bool mIsFurthest;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled, allowed;
|
bool enabled, allowed;
|
||||||
|
@ -99,6 +103,10 @@ namespace MWRender
|
||||||
void togglePlayerLooking(bool enable);
|
void togglePlayerLooking(bool enable);
|
||||||
|
|
||||||
bool isVanityOrPreviewModeEnabled();
|
bool isVanityOrPreviewModeEnabled();
|
||||||
|
|
||||||
|
bool isNearest();
|
||||||
|
|
||||||
|
bool isFurthest();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -903,7 +903,15 @@ void RenderingManager::setCameraDistance(float dist, bool adjust, bool override)
|
||||||
{
|
{
|
||||||
if(!mCamera->isVanityOrPreviewModeEnabled() && !mCamera->isFirstPerson())
|
if(!mCamera->isVanityOrPreviewModeEnabled() && !mCamera->isFirstPerson())
|
||||||
{
|
{
|
||||||
mCamera->setCameraDistance(-dist / 120.f * 10, adjust, override);
|
if(mCamera->isNearest() && dist > 0.f)
|
||||||
|
mCamera->toggleViewMode();
|
||||||
|
else
|
||||||
|
mCamera->setCameraDistance(-dist / 120.f * 10, adjust, override);
|
||||||
|
}
|
||||||
|
else if(mCamera->isFirstPerson() && dist < 0.f)
|
||||||
|
{
|
||||||
|
mCamera->toggleViewMode();
|
||||||
|
mCamera->setCameraDistance(0.f, false, override);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue