1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 19:23:52 +00:00

fix map positions

This commit is contained in:
scrawl 2013-02-03 20:06:03 +01:00
parent a44dfcd2ac
commit 5cc8af0f14
4 changed files with 25 additions and 14 deletions

View file

@ -150,7 +150,7 @@ namespace MWGui
if (!mFirstLoad)
{
mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName());
//mRectangle->setVisible(true);
mRectangle->setVisible(true);
}
for (unsigned int i = 0; i<chain->getNumCompositors(); ++i)

View file

@ -187,15 +187,6 @@ void LocalMap::render(const float x, const float y,
const float zlow, const float zhigh,
const float xw, const float yw, const std::string& texture)
{
// disable fog (only necessary for fixed function, the shader based
// materials already do this through local_map material configuration)
const float fStart = mRendering->getScene()->getFogStart();
const float fEnd = mRendering->getScene()->getFogEnd();
const ColourValue& clr = mRendering->getScene()->getFogColour();
mRendering->getScene()->setFog(FOG_NONE);
// make everything visible
mCameraNode->setPosition(Vector3(x, zhigh+100000, y));
//mCellCamera->setFarClipDistance( (zhigh-zlow) * 1.1 );
mCellCamera->setFarClipDistance(0); // infinite
@ -224,6 +215,9 @@ void LocalMap::render(const float x, const float y,
TU_RENDERTARGET);
RenderTarget* rtt = tex->getBuffer()->getRenderTarget();
mCameraSettings[rtt] = Vector3(x, zhigh+100000, y);
rtt->setAutoUpdated(false);
Viewport* vp = rtt->addViewport(mCellCamera);
vp->setOverlaysEnabled(false);
@ -266,13 +260,19 @@ void LocalMap::render(const float x, const float y,
//rtt->writeContentsToFile("./" + texture + ".jpg");
}
}
// re-enable fog
mRendering->getScene()->setFog(FOG_LINEAR, clr, 0, fStart, fEnd);
}
void LocalMap::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt)
{
// disable fog (only necessary for fixed function, the shader based
// materials already do this through local_map material configuration)
mOldFogStart = mRendering->getScene()->getFogStart();
mOldFogEnd = mRendering->getScene()->getFogEnd();
mOldFogClr = mRendering->getScene()->getFogColour();
mRendering->getScene()->setFog(FOG_NONE);
mCellCamera->setPosition(mCameraSettings[evt.source]);
mRenderingManager->disableLights(true);
mLight->setVisible(true);
evt.source->setAutoUpdated(false);
@ -283,6 +283,9 @@ void LocalMap::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt)
mRenderingManager->enableLights(true);
mLight->setVisible(false);
evt.source->removeListener(this);
// re-enable fog
mRendering->getScene()->setFog(FOG_LINEAR, mOldFogClr, 0, mOldFogStart, mOldFogEnd);
}
void LocalMap::getInteriorMapPosition (Ogre::Vector2 pos, float& nX, float& nY, int& x, int& y)

View file

@ -4,6 +4,7 @@
#include <openengine/ogre/renderer.hpp>
#include <OgreAxisAlignedBox.h>
#include <OgreColourValue.h>
#include <OgreRenderTargetListener.h>
namespace MWWorld
@ -120,6 +121,13 @@ namespace MWRender
int mCellX, mCellY;
Ogre::AxisAlignedBox mBounds;
std::string mInteriorName;
Ogre::ColourValue mOldFogClr;
float mOldFogStart;
float mOldFogEnd;
// maps texture name to according camera settings
std::map<Ogre::RenderTarget*, Ogre::Vector3> mCameraSettings;
};
}

View file

@ -401,7 +401,7 @@ void Water::update(float dt, Ogre::Vector3 player)
mRendering->getSkyManager ()->setGlareEnabled (!mIsUnderwater);
//if (player.y <= mTop)
if (player.y <= mTop)
{
mSimulation->addImpulse(Ogre::Vector2(player.x, player.z));
}