Merge remote-tracking branch 'scrawl/master'

pull/37/head
Marc Zinnschlag 12 years ago
commit d396785008

@ -296,6 +296,7 @@ namespace MWBase
virtual bool toggleVanityMode(bool enable, bool force) = 0; virtual bool toggleVanityMode(bool enable, bool force) = 0;
virtual void allowVanityMode(bool allow) = 0; virtual void allowVanityMode(bool allow) = 0;
virtual void togglePlayerLooking(bool enable) = 0; virtual void togglePlayerLooking(bool enable) = 0;
virtual void changeVanityModeScale(float factor) = 0;
virtual void renderPlayer() = 0; virtual void renderPlayer() = 0;

@ -548,6 +548,9 @@ namespace MWInput
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
world->rotateObject(world->getPlayer().getPlayer(), -y, 0.f, x, true); world->rotateObject(world->getPlayer().getPlayer(), -y, 0.f, x, true);
if (arg.state.Z.rel)
MWBase::Environment::get().getWorld()->changeVanityModeScale(arg.state.Z.rel);
} }
return true; return true;

@ -271,6 +271,8 @@ namespace MWRender
v.z = 800.f; v.z = 800.f;
} else if (v.z < 10.f) { } else if (v.z < 10.f) {
v.z = 10.f; v.z = 10.f;
} else if (override && v.z < 50.f) {
v.z = 50.f;
} }
mCamera->setPosition(v); mCamera->setPosition(v);
@ -362,4 +364,9 @@ namespace MWRender
mCameraNode->setPosition(0.f, 0.f, mHeight); mCameraNode->setPosition(0.f, 0.f, mHeight);
} }
} }
bool Player::isVanityOrPreviewModeEnabled()
{
return mPreviewMode || mVanity.enabled;
}
} }

@ -110,6 +110,8 @@ namespace MWRender
void getSightAngles(float &pitch, float &yaw); void getSightAngles(float &pitch, float &yaw);
void togglePlayerLooking(bool enable); void togglePlayerLooking(bool enable);
bool isVanityOrPreviewModeEnabled();
}; };
} }

@ -83,6 +83,11 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
mPlayer->togglePlayerLooking(enable); mPlayer->togglePlayerLooking(enable);
} }
void changeVanityModeScale(float factor) {
if (mPlayer->isVanityOrPreviewModeEnabled())
mPlayer->setCameraDistance(-factor/120.f*10, true, true);
}
void getPlayerData(Ogre::Vector3 &eyepos, float &pitch, float &yaw); void getPlayerData(Ogre::Vector3 &eyepos, float &pitch, float &yaw);
void attachCameraTo(const MWWorld::Ptr &ptr); void attachCameraTo(const MWWorld::Ptr &ptr);

@ -339,6 +339,10 @@ namespace MWWorld
mRendering->togglePlayerLooking(enable); mRendering->togglePlayerLooking(enable);
} }
virtual void changeVanityModeScale(float factor) {
mRendering->changeVanityModeScale(factor);
}
virtual void renderPlayer(); virtual void renderPlayer();
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering); virtual void setupExternalRendering (MWRender::ExternalRendering& rendering);

@ -24,7 +24,8 @@ namespace Render
vp->setBackgroundColour(Ogre::ColourValue(0, 0, 0, 0)); vp->setBackgroundColour(Ogre::ColourValue(0, 0, 0, 0));
vp->setShadowsEnabled(false); vp->setShadowsEnabled(false);
vp->setMaterialScheme("selectionbuffer"); vp->setMaterialScheme("selectionbuffer");
vp->setVisibilityMask (visibilityFlags); if (visibilityFlags != 0)
vp->setVisibilityMask (visibilityFlags);
mRenderTarget->setActive(true); mRenderTarget->setActive(true);
mRenderTarget->setAutoUpdated (false); mRenderTarget->setAutoUpdated (false);

Loading…
Cancel
Save