1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-20 16:41:33 +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()) if (!localMapTexture.isNull())
{ {
int mapWidth = localMapTexture->getWidth();
int mapHeight = localMapTexture->getHeight();
mOverlayTexture->load(); 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::Box(originX,originY,originX+mCellSize,originY+mCellSize));
Ogre::Image backup; Ogre::Image backup;
@ -218,7 +220,7 @@ namespace MWRender
data.resize(mCellSize*mCellSize*4, 0); data.resize(mCellSize*mCellSize*4, 0);
backup.loadDynamicImage(&data[0], mCellSize, mCellSize, Ogre::PF_A8B8G8R8); 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 x=0; x<mCellSize; ++x)
for (int y=0; y<mCellSize; ++y) 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) LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManager* rendering)
: mInterior(false) : mInterior(false)
, mAngle(0.f) , mAngle(0.f)
, mMapResolution(Settings::Manager::getInt("local map resolution", "Map"))
{ {
mRendering = rend; mRendering = rend;
mRenderingManager = rendering; mRenderingManager = rendering;
@ -50,7 +51,7 @@ LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManag
"localmap/rtt", "localmap/rtt",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
TEX_TYPE_2D, TEX_TYPE_2D,
sMapResolution, sMapResolution, mMapResolution, mMapResolution,
0, 0,
PF_R8G8B8, PF_R8G8B8,
TU_RENDERTARGET); TU_RENDERTARGET);
@ -413,7 +414,7 @@ void LocalMap::render(const float x, const float y,
texture, texture,
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
TEX_TYPE_2D, TEX_TYPE_2D,
sMapResolution, sMapResolution, mMapResolution, mMapResolution,
0, 0,
PF_R8G8B8); PF_R8G8B8);
tex->getBuffer()->blit(mRenderTexture->getBuffer()); tex->getBuffer()->blit(mRenderTexture->getBuffer());

View file

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

View file

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