1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:23:53 +00:00

Make local map resolution configurable and use lower default value

This seems to be the resolution the original engine is using. The change also significantly reduces cell loading time.
This commit is contained in:
scrawl 2014-12-23 01:54:37 +01:00
parent 7f0d71f8f4
commit a47de06492
4 changed files with 10 additions and 5 deletions

View file

@ -209,8 +209,10 @@ namespace MWRender
if (!localMapTexture.isNull())
{
int mapWidth = localMapTexture->getWidth();
int mapHeight = localMapTexture->getHeight();
mOverlayTexture->load();
mOverlayTexture->getBuffer()->blit(localMapTexture->getBuffer(), Ogre::Image::Box(0,0,512,512),
mOverlayTexture->getBuffer()->blit(localMapTexture->getBuffer(), Ogre::Image::Box(0,0,mapWidth,mapHeight),
Ogre::Image::Box(originX,originY,originX+mCellSize,originY+mCellSize));
Ogre::Image backup;
@ -218,7 +220,7 @@ namespace MWRender
data.resize(mCellSize*mCellSize*4, 0);
backup.loadDynamicImage(&data[0], mCellSize, mCellSize, Ogre::PF_A8B8G8R8);
localMapTexture->getBuffer()->blitToMemory(Ogre::Image::Box(0,0,512,512), backup.getPixelBox());
localMapTexture->getBuffer()->blitToMemory(Ogre::Image::Box(0,0,mapWidth,mapHeight), backup.getPixelBox());
for (int x=0; x<mCellSize; ++x)
for (int y=0; y<mCellSize; ++y)

View file

@ -27,6 +27,7 @@ using namespace Ogre;
LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManager* rendering)
: mInterior(false)
, mAngle(0.f)
, mMapResolution(Settings::Manager::getInt("local map resolution", "Map"))
{
mRendering = rend;
mRenderingManager = rendering;
@ -50,7 +51,7 @@ LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManag
"localmap/rtt",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
TEX_TYPE_2D,
sMapResolution, sMapResolution,
mMapResolution, mMapResolution,
0,
PF_R8G8B8,
TU_RENDERTARGET);
@ -413,7 +414,7 @@ void LocalMap::render(const float x, const float y,
texture,
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
TEX_TYPE_2D,
sMapResolution, sMapResolution,
mMapResolution, mMapResolution,
0,
PF_R8G8B8);
tex->getBuffer()->blit(mRenderTexture->getBuffer());

View file

@ -87,7 +87,7 @@ namespace MWRender
OEngine::Render::OgreRenderer* mRendering;
MWRender::RenderingManager* mRenderingManager;
static const int sMapResolution = 512;
int mMapResolution;
// the dynamic texture is a bottleneck, so don't set this too high
static const int sFogOfWarResolution = 32;

View file

@ -115,6 +115,8 @@ use static geometry = true
# Adjusts the scale of the global map
global map cell size = 18
local map resolution = 256
[Viewing distance]
# Limit the rendering distance of small objects
limit small object distance = false