Skip to content
Snippets Groups Projects
Commit a4759de1 authored by ¡Cinder! ㊝'s avatar ¡Cinder! ㊝ :speech_balloon:
Browse files

ALCH-267 - Thanks Liru and Shyotl. :)

parent 2c2ec832
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include "llsurface.h" #include "llsurface.h"
#include "llviewercamera.h" #include "llviewercamera.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewernetwork.h"
#include "llviewertexture.h" #include "llviewertexture.h"
#include "llviewertexturelist.h" #include "llviewertexturelist.h"
#include "llviewermenu.h" #include "llviewermenu.h"
...@@ -259,24 +258,34 @@ void LLNetMap::draw() ...@@ -259,24 +258,34 @@ void LLNetMap::draw()
// <alchemy> // <alchemy>
if (use_world_map_image && LLGridManager::getInstance()->isInSecondlife()) if (use_world_map_image)
{ {
LLViewerTexture* img = regionp->getMapImage(); const LLViewerRegion::tex_matrix_t& tiles(regionp->getWorldMapTiles());
if (img && img->hasGLTexture()) for (S32 i(0), scaled_width(real_width / region_width), square_width(scaled_width * scaled_width);
i < square_width; ++i)
{ {
gGL.getTexUnit(0)->bind(img); const F32 y(i / scaled_width);
gGL.begin(LLRender::QUADS); const F32 x(i - y * scaled_width);
gGL.texCoord2f(0.f, 1.f); const F32 local_left(left + x * mScale);
gGL.vertex2f(left, top); const F32 local_right(local_left + mScale);
gGL.texCoord2f(0.f, 0.f); const F32 local_bottom(bottom + y * mScale);
gGL.vertex2f(left, bottom); const F32 local_top(local_bottom + mScale);
gGL.texCoord2f(1.f, 0.f); LLViewerTexture* img = tiles[x * scaled_width + y];
gGL.vertex2f(right, bottom); if (img && img->hasGLTexture())
gGL.texCoord2f(1.f, 1.f); {
gGL.vertex2f(right, top); gGL.getTexUnit(0)->bind(img);
gGL.end(); gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
img->setBoostLevel(LLGLTexture::BOOST_MAP_VISIBLE); gGL.vertex2f(local_left, local_top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(local_left, local_bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(local_right, local_bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(local_right, local_top);
gGL.end();
img->setBoostLevel(LLViewerTexture::BOOST_MAP_VISIBLE);
}
} }
} }
else else
......
...@@ -541,6 +541,9 @@ LLViewerRegion::~LLViewerRegion() ...@@ -541,6 +541,9 @@ LLViewerRegion::~LLViewerRegion()
delete mImpl; delete mImpl;
mImpl = NULL; mImpl = NULL;
for (LLPointer<LLViewerTexture> tile : mWorldMapTiles)
tile->setBoostLevel(LLViewerTexture::BOOST_NONE);
} }
LLEventPump& LLViewerRegion::getCapAPI() const LLEventPump& LLViewerRegion::getCapAPI() const
...@@ -3418,6 +3421,33 @@ void LLViewerRegion::setGodnames() ...@@ -3418,6 +3421,33 @@ void LLViewerRegion::setGodnames()
} }
} }
const LLViewerRegion::tex_matrix_t& LLViewerRegion::getWorldMapTiles() const
{
if (mWorldMapTiles.empty())
{
U32 gridX, gridY;
grid_from_region_handle(mHandle, &gridX, &gridY);
U32 totalX(getWidth() / REGION_WIDTH_U32);
if (!totalX) ++totalX; // If this region is too small, still get an image.
// *TODO: Non-square 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)
{
const std::string map_url = getMapServerURL().append(llformat("map-1-%d-%d-objects.jpg", gridX + x, gridY + y));
LL_WARNS() << "WOO! " << map_url << LL_ENDL;
LLPointer<LLViewerTexture> tex(LLViewerTextureManager::getFetchedTextureFromUrl(map_url, FTT_MAP_TILE, TRUE,
LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
mWorldMapTiles.push_back(tex);
tex->setBoostLevel(LLViewerTexture::BOOST_MAP);
}
}
return mWorldMapTiles;
}
LLViewerTexture* LLViewerRegion::getMapImage() LLViewerTexture* LLViewerRegion::getMapImage()
{ {
if (mMapImage.isNull()) if (mMapImage.isNull())
......
...@@ -411,7 +411,10 @@ public: ...@@ -411,7 +411,10 @@ public:
/// "God names" surname and full account names map /// "God names" surname and full account names map
std::set<std::string> getGods() const { return mGodNames; }; std::set<std::string> getGods() const { return mGodNames; };
//@} //@}
typedef std::vector<LLPointer<LLViewerTexture> > tex_matrix_t;
const tex_matrix_t& getWorldMapTiles() const;
LLViewerTexture* getMapImage(); // <alchemy/> LLViewerTexture* getMapImage(); // <alchemy/>
private: private:
...@@ -576,8 +579,9 @@ private: ...@@ -576,8 +579,9 @@ private:
LLFrameTimer mMaterialsCapThrottleTimer; LLFrameTimer mMaterialsCapThrottleTimer;
LLFrameTimer mRenderInfoRequestTimer; LLFrameTimer mRenderInfoRequestTimer;
mutable tex_matrix_t mWorldMapTiles;
LLPointer<LLViewerTexture> mMapImage; // <alchemy/> LLPointer<LLViewerTexture> mMapImage; // <alchemy/>
std::set<std::string> mGodNames; std::set<std::string> mGodNames;
}; };
inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment