From a47de06492b2c671ec3b344f53be97b39d6aa107 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 23 Dec 2014 01:54:37 +0100 Subject: [PATCH] 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. --- apps/openmw/mwrender/globalmap.cpp | 6 ++++-- apps/openmw/mwrender/localmap.cpp | 5 +++-- apps/openmw/mwrender/localmap.hpp | 2 +- files/settings-default.cfg | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp index fd8b91936..5546c401b 100644 --- a/apps/openmw/mwrender/globalmap.cpp +++ b/apps/openmw/mwrender/globalmap.cpp @@ -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; xgetBuffer()->blit(mRenderTexture->getBuffer()); diff --git a/apps/openmw/mwrender/localmap.hpp b/apps/openmw/mwrender/localmap.hpp index 4c60cbb11..7cfa38814 100644 --- a/apps/openmw/mwrender/localmap.hpp +++ b/apps/openmw/mwrender/localmap.hpp @@ -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; diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 7566994e2..658c2da6d 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -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