restored global map

actorid
scrawl 12 years ago
parent 35b5fdab5d
commit a29919d02d

@ -191,6 +191,20 @@ void LocalMap::render(const float x, const float y,
mCellCamera->setFarClipDistance(0); // infinite
mCellCamera->setOrthoWindow(xw, yw);
mCellCamera->setPosition(Vector3(x, zhigh+100000, y));
// disable fog (only necessary for fixed function, the shader based
// materials already do this through local_map material configuration)
float oldFogStart = mRendering->getScene()->getFogStart();
float oldFogEnd = mRendering->getScene()->getFogEnd();
Ogre::ColourValue oldFogColour = mRendering->getScene()->getFogColour();
mRendering->getScene()->setFog(FOG_NONE);
// set up lighting
Ogre::ColourValue oldAmbient = mRendering->getScene()->getAmbientLight();
mRendering->getScene()->setAmbientLight(Ogre::ColourValue(0.3, 0.3, 0.3));
mRenderingManager->disableLights(true);
mLight->setVisible(true);
TexturePtr tex;
// try loading from memory
@ -216,8 +230,6 @@ void LocalMap::render(const float x, const float y,
RenderTarget* rtt = tex->getBuffer()->getRenderTarget();
mCameraSettings[rtt] = Vector3(x, zhigh+100000, y);
rtt->setAutoUpdated(false);
Viewport* vp = rtt->addViewport(mCellCamera);
vp->setOverlaysEnabled(false);
@ -228,8 +240,7 @@ void LocalMap::render(const float x, const float y,
// use fallback techniques without shadows and without mrt
vp->setMaterialScheme("local_map");
rtt->setAutoUpdated(true);
rtt->addListener(this);
rtt->update();
// create "fog of war" texture
TexturePtr tex2 = TextureManager::getSingleton().createManual(
@ -260,36 +271,12 @@ void LocalMap::render(const float x, const float y,
//rtt->writeContentsToFile("./" + texture + ".jpg");
}
}
}
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);
mOldAmbient = mRendering->getScene()->getAmbientLight();
mRendering->getScene()->setAmbientLight(Ogre::ColourValue(0.3, 0.3, 0.3));
mCellCamera->setPosition(mCameraSettings[evt.source]);
mRenderingManager->disableLights(true);
mLight->setVisible(true);
evt.source->setAutoUpdated(false);
}
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);
mRendering->getScene()->setAmbientLight(mOldAmbient);
mRendering->getScene()->setFog(FOG_LINEAR, oldFogColour, 0, oldFogStart, oldFogEnd);
mRendering->getScene()->setAmbientLight(oldAmbient);
}
void LocalMap::getInteriorMapPosition (Ogre::Vector2 pos, float& nX, float& nY, int& x, int& y)

@ -5,7 +5,6 @@
#include <OgreAxisAlignedBox.h>
#include <OgreColourValue.h>
#include <OgreRenderTargetListener.h>
namespace MWWorld
{
@ -19,7 +18,7 @@ namespace MWRender
///
/// \brief Local map rendering
///
class LocalMap : public Ogre::RenderTargetListener
class LocalMap
{
public:
LocalMap(OEngine::Render::OgreRenderer*, MWRender::RenderingManager* rendering);
@ -71,9 +70,6 @@ namespace MWRender
*/
bool isPositionExplored (float nX, float nY, int x, int y, bool interior);
void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
private:
OEngine::Render::OgreRenderer* mRendering;
MWRender::RenderingManager* mRenderingManager;
@ -122,11 +118,6 @@ namespace MWRender
Ogre::AxisAlignedBox mBounds;
std::string mInteriorName;
Ogre::ColourValue mOldFogClr;
Ogre::ColourValue mOldAmbient;
float mOldFogStart;
float mOldFogEnd;
// maps texture name to according camera settings
std::map<Ogre::RenderTarget*, Ogre::Vector3> mCameraSettings;
};

Loading…
Cancel
Save