[OpenSim] Optimize the minimap region tile matrix implementation

This commit is contained in:
Lirusaito
2015-01-10 16:29:23 -05:00
parent bf3947dcc5
commit 03e9db98e6
3 changed files with 5 additions and 6 deletions

View File

@@ -360,7 +360,7 @@ void LLNetMap::draw()
const F32 local_right(local_left + mScale);
const F32 local_bottom(bottom + y*mScale);
const F32 local_top(local_bottom + mScale);
LLViewerTexture* pRegionImage = tiles[x][y];
LLViewerTexture* pRegionImage = tiles[x*scaled_width+y];
if (pRegionImage && pRegionImage->hasGLTexture())
{
gGL.getTexUnit(0)->bind(pRegionImage);

View File

@@ -434,8 +434,7 @@ LLViewerRegion::~LLViewerRegion()
// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3)
for (tex_matrix_t::iterator i = mWorldMapTiles.begin(), iend = mWorldMapTiles.end(); i != iend; ++i)
for (std::vector<LLPointer<LLViewerTexture> >::iterator it = (*i).begin(), itend = (*i).end(); it != itend; ++it)
(*it)->setBoostLevel(LLViewerTexture::BOOST_NONE);
(*i)->setBoostLevel(LLViewerTexture::BOOST_NONE);
// [/SL:KB]
}
@@ -1114,17 +1113,17 @@ const LLViewerRegion::tex_matrix_t& LLViewerRegion::getWorldMapTiles() const
std::string strImgURL = (simOverrideMap.empty() ? gSavedSettings.getString("MapServerURL") : simOverrideMap) + "map-1-";
U32 totalX(getWidth()/REGION_WIDTH_U32);
if (!totalX) ++totalX; // If this region is too small, still get an image.
mWorldMapTiles.resize(totalX);
/* TODO: Nonsquare regions?
U32 totalY(getLength()/REGION_WIDTH_U32);
if (!totalY) ++totalY; // If this region is too small, still get an image.
*/
const U32 totalY(totalX);
mWorldMapTiles.reserve(totalX*totalY);
for (U32 x = 0; x != totalX; ++x)
for (U32 y = 0; y != totalY; ++y)
{
LLPointer<LLViewerTexture> tex(LLViewerTextureManager::getFetchedTextureFromUrl(strImgURL+llformat("%d-%d-objects.jpg", gridX + x, gridY + y), TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
mWorldMapTiles[x].push_back(tex);
mWorldMapTiles.push_back(tex);
tex->setBoostLevel(LLViewerTexture::BOOST_MAP);
}
}

View File

@@ -160,7 +160,7 @@ public:
// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0)
bool isAlive() const; // can become false if circuit disconnects
typedef std::vector<std::vector<LLPointer<LLViewerTexture> > > tex_matrix_t;
typedef std::vector<LLPointer<LLViewerTexture> > tex_matrix_t;
const tex_matrix_t& getWorldMapTiles() const;
// [/SL:KB]