mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 19:45:35 +00:00
Fixes #275: force updating exterior cell maps even if already in cache
This commit is contained in:
parent
54a893994a
commit
2bc2684a66
3 changed files with 14 additions and 3 deletions
|
@ -168,7 +168,10 @@ void LocalMap::requestMap(MWWorld::CellStore* cell, float zMin, float zMax)
|
||||||
|
|
||||||
mCameraPosNode->setPosition(Vector3(0,0,0));
|
mCameraPosNode->setPosition(Vector3(0,0,0));
|
||||||
|
|
||||||
render((x+0.5)*sSize, (y+0.5)*sSize, zMin, zMax, sSize, sSize, name);
|
// Note: using force=true for exterior cell maps.
|
||||||
|
// They must be updated even if they were visited before, because the set of surrounding active cells might be different
|
||||||
|
// (and objects in a different cell can "bleed" into another cell's map if they cross the border)
|
||||||
|
render((x+0.5)*sSize, (y+0.5)*sSize, zMin, zMax, sSize, sSize, name, true);
|
||||||
|
|
||||||
if (mBuffers.find(name) == mBuffers.end())
|
if (mBuffers.find(name) == mBuffers.end())
|
||||||
{
|
{
|
||||||
|
@ -371,7 +374,7 @@ void LocalMap::loadFogOfWar (const std::string& texturePrefix, ESM::FogTexture&
|
||||||
|
|
||||||
void LocalMap::render(const float x, const float y,
|
void LocalMap::render(const float x, const float y,
|
||||||
const float zlow, const float zhigh,
|
const float zlow, const float zhigh,
|
||||||
const float xw, const float yw, const std::string& texture)
|
const float xw, const float yw, const std::string& texture, bool force)
|
||||||
{
|
{
|
||||||
mCellCamera->setFarClipDistance( (zhigh-zlow) + 2000 );
|
mCellCamera->setFarClipDistance( (zhigh-zlow) + 2000 );
|
||||||
mCellCamera->setNearClipDistance(50);
|
mCellCamera->setNearClipDistance(50);
|
||||||
|
@ -410,6 +413,11 @@ void LocalMap::render(const float x, const float y,
|
||||||
PF_R8G8B8);
|
PF_R8G8B8);
|
||||||
tex->getBuffer()->blit(mRenderTexture->getBuffer());
|
tex->getBuffer()->blit(mRenderTexture->getBuffer());
|
||||||
}
|
}
|
||||||
|
else if (force)
|
||||||
|
{
|
||||||
|
mRenderTarget->update();
|
||||||
|
tex->getBuffer()->blit(mRenderTexture->getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
mRenderingManager->enableLights(true);
|
mRenderingManager->enableLights(true);
|
||||||
mLight->setVisible(false);
|
mLight->setVisible(false);
|
||||||
|
|
|
@ -106,10 +106,11 @@ namespace MWRender
|
||||||
float mAngle;
|
float mAngle;
|
||||||
const Ogre::Vector2 rotatePoint(const Ogre::Vector2& p, const Ogre::Vector2& c, const float angle);
|
const Ogre::Vector2 rotatePoint(const Ogre::Vector2& p, const Ogre::Vector2& c, const float angle);
|
||||||
|
|
||||||
|
/// @param force Always render, even if we already have a cached map
|
||||||
void render(const float x, const float y,
|
void render(const float x, const float y,
|
||||||
const float zlow, const float zhigh,
|
const float zlow, const float zhigh,
|
||||||
const float xw, const float yw,
|
const float xw, const float yw,
|
||||||
const std::string& texture);
|
const std::string& texture, bool force=false);
|
||||||
|
|
||||||
// Creates a fog of war texture and initializes it to full black
|
// Creates a fog of war texture and initializes it to full black
|
||||||
void createFogOfWar(const std::string& texturePrefix);
|
void createFogOfWar(const std::string& texturePrefix);
|
||||||
|
|
|
@ -89,6 +89,8 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
if (mNeedMapUpdate)
|
if (mNeedMapUpdate)
|
||||||
{
|
{
|
||||||
|
// Note: exterior cell maps must be updated, even if they were visited before, because the set of surrounding cells might be different
|
||||||
|
// (and objects in a different cell can "bleed" into another cells map if they cross the border)
|
||||||
for (CellStoreCollection::iterator active = mActiveCells.begin(); active!=mActiveCells.end(); ++active)
|
for (CellStoreCollection::iterator active = mActiveCells.begin(); active!=mActiveCells.end(); ++active)
|
||||||
mRendering.requestMap(*active);
|
mRendering.requestMap(*active);
|
||||||
mNeedMapUpdate = false;
|
mNeedMapUpdate = false;
|
||||||
|
|
Loading…
Reference in a new issue