From 3c36214993ea0971fa167629a997fe2cda2a2049 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Mon, 13 Sep 2010 20:47:57 +0200 Subject: Henri Beauchamp: use http map if possible. Fixes broken map in SL + http map possible for OS --- linden/indra/newview/app_settings/settings.xml | 22 ++++++++ linden/indra/newview/llfloaterworldmap.cpp | 4 +- linden/indra/newview/llfloaterworldmap.h | 9 +--- linden/indra/newview/llmapresponders.cpp | 29 ++++++++--- linden/indra/newview/llmapresponders.h | 2 +- linden/indra/newview/llstartup.cpp | 11 +++- linden/indra/newview/llviewermenu.cpp | 3 ++ linden/indra/newview/llworldmap.cpp | 60 +++++++++++++++++++--- linden/indra/newview/llworldmap.h | 8 +++ linden/indra/newview/llworldmapview.cpp | 70 +++++++++++++++----------- linden/indra/newview/llworldmapview.h | 7 ++- 11 files changed, 169 insertions(+), 56 deletions(-) diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index ca44a2f..acdb0a6 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -6912,6 +6912,28 @@ Value 20.0 + MapServerURL + + Comment + World map URL template for locating map tiles + Persist + 0 + Type + String + Value + http://map.secondlife.com.s3.amazonaws.com/ + + UseWebMapTiles + + Comment + Use web map tiles whenever possible + Persist + 1 + Type + Boolean + Value + 1 + MapOverlayIndex Comment diff --git a/linden/indra/newview/llfloaterworldmap.cpp b/linden/indra/newview/llfloaterworldmap.cpp index 4f678c5..781cf4d 100644 --- a/linden/indra/newview/llfloaterworldmap.cpp +++ b/linden/indra/newview/llfloaterworldmap.cpp @@ -247,8 +247,8 @@ BOOL LLFloaterWorldMap::postBuild() childSetAction("Clear", onClearBtn, this); childSetAction("copy_slurl", onCopySLURL, this); - mCurZoomVal = log(gMapScale)/log(2.f); - childSetValue("zoom slider", gMapScale); + mCurZoomVal = log(LLWorldMapView::sMapScale)/log(2.f); + childSetValue("zoom slider", LLWorldMapView::sMapScale); setDefaultBtn(NULL); diff --git a/linden/indra/newview/llfloaterworldmap.h b/linden/indra/newview/llfloaterworldmap.h index 2153921..83345ed 100644 --- a/linden/indra/newview/llfloaterworldmap.h +++ b/linden/indra/newview/llfloaterworldmap.h @@ -68,8 +68,6 @@ public: static void toggle(void*); static void hide(void*); - static void addServer(const std::string& server); - /*virtual*/ void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE ); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); @@ -103,7 +101,6 @@ public: void clearLocationSelection(BOOL clear_ui = FALSE); void clearAvatarSelection(BOOL clear_ui = FALSE); void clearLandmarkSelection(BOOL clear_ui = FALSE); - void clearGridSelection(BOOL clear_ui = FALSE); // Adjust the maximally zoomed out limit of the zoom slider so you can // see the whole world, plus a little. @@ -118,9 +115,8 @@ public: protected: static void onPanBtn( void* userdata ); - static void onGridManager(void* data); - static void onGoHome(void* data); + static void onLandmarkComboPrearrange( LLUICtrl* ctrl, void* data ); static void onLandmarkComboCommit( LLUICtrl* ctrl, void* data ); @@ -162,14 +158,13 @@ protected: static void onLocationCommit( void* userdata ); static void onCommitLocation( LLUICtrl* ctrl, void* userdata ); static void onCommitSearchResult( LLUICtrl* ctrl, void* userdata ); - static void onSelectServer(LLUICtrl*, void* userdata); void cacheLandmarkPosition(); protected: LLTabContainer* mTabs; - // Sets gMapScale, in pixels per region + // Sets sMapScale, in pixels per region F32 mCurZoomVal; LLFrameTimer mZoomTimer; diff --git a/linden/indra/newview/llmapresponders.cpp b/linden/indra/newview/llmapresponders.cpp index 140f390..9d974f2 100644 --- a/linden/indra/newview/llmapresponders.cpp +++ b/linden/indra/newview/llmapresponders.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2006&license=viewergpl$ * - * Copyright (c) 2006-2009, Linden Research, Inc. + * Copyright (c) 2006-2010, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -57,6 +57,8 @@ void LLMapLayerResponder::result(const LLSD& result) LLWorldMap::getInstance()->mMapLayers[agent_flags].clear(); + bool use_web_map_tiles = LLWorldMap::useWebMapTiles(); + LLSD::array_const_iterator iter; BOOL adjust = FALSE; for(iter = result["LayerData"].beginArray(); iter != result["LayerData"].endArray(); ++iter) @@ -65,16 +67,24 @@ void LLMapLayerResponder::result(const LLSD& result) LLWorldMapLayer new_layer; new_layer.LayerDefined = TRUE; - new_layer.LayerImageID = layer_data["ImageID"]; - new_layer.LayerImage = gImageList.getImage(new_layer.LayerImageID, MIPMAP_TRUE, FALSE); - gGL.getTexUnit(0)->bind(new_layer.LayerImage.get()); - new_layer.LayerImage->setAddressMode(LLTexUnit::TAM_CLAMP); new_layer.LayerExtents.mLeft = layer_data["Left"]; new_layer.LayerExtents.mRight = layer_data["Right"]; new_layer.LayerExtents.mBottom = layer_data["Bottom"]; new_layer.LayerExtents.mTop = layer_data["Top"]; + new_layer.LayerImageID = layer_data["ImageID"]; +// if (use_web_map_tiles) +// { +// new_layer.LayerImage = LLWorldMap::loadObjectsTile((U32)new_layer.LayerExtents.mLeft, (U32)new_layer.LayerExtents.mBottom); // no good... Maybe using of level 2 and higher web maps ? +// } +// else +// { + new_layer.LayerImage = gImageList.getImage(new_layer.LayerImageID, MIPMAP_TRUE, FALSE); +// } + gGL.getTexUnit(0)->bind(new_layer.LayerImage.get()); + new_layer.LayerImage->setAddressMode(LLTexUnit::TAM_CLAMP); + F32 x_meters = F32(new_layer.LayerExtents.mLeft*REGION_WIDTH_UNITS); F32 y_meters = F32(new_layer.LayerExtents.mBottom*REGION_WIDTH_UNITS); adjust = LLWorldMap::getInstance()->extendAABB(U32(x_meters), U32(y_meters), @@ -163,7 +173,14 @@ void LLMapLayerResponder::result(const LLSD& result) siminfo->mRegionFlags = region_flags; siminfo->mWaterHeight = (F32) water_height; siminfo->mMapImageID[agent_flags] = image_id; - siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); + if (use_web_map_tiles) + { + siminfo->mCurrentImage = LLWorldMap::loadObjectsTile((U32)x_regions, (U32)y_regions); + } + else + { + siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); + } siminfo->mCurrentImage->setAddressMode(LLTexUnit::TAM_CLAMP); gGL.getTexUnit(0)->bind(siminfo->mCurrentImage.get()); diff --git a/linden/indra/newview/llmapresponders.h b/linden/indra/newview/llmapresponders.h index 8fb1fb0..b6fb8e5 100644 --- a/linden/indra/newview/llmapresponders.h +++ b/linden/indra/newview/llmapresponders.h @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2006&license=viewergpl$ * - * Copyright (c) 2006-2009, Linden Research, Inc. + * Copyright (c) 2006-2010, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 0464e99..a3fde55 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -1108,6 +1108,7 @@ bool idle_startup() requested_options.push_back("buddy-list"); requested_options.push_back("ui-config"); #endif + requested_options.push_back("map-server-url"); requested_options.push_back("tutorial_setting"); requested_options.push_back("login-flags"); requested_options.push_back("global-textures"); @@ -1750,7 +1751,15 @@ bool idle_startup() LLStartUp::setShouldAutoLogin(false); show_connect_box = true; } - + + std::string map_server_url = LLUserAuth::getInstance()->getResponse("map-server-url"); + if(!map_server_url.empty()) + { + gSavedSettings.setString("MapServerURL", map_server_url); + //llwarns << "MapServerURL" << map_server_url << llendl; + } + // else llwarns << "MapServerURL empty"<< llendl; + // Pass the user information to the voice chat server interface. gVoiceClient->userAuthorized(firstname, lastname, gAgentID); } diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 2484b94..3ac59b4 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -841,6 +841,9 @@ void init_client_menu(LLMenuGL* menu) menu->append(new LLMenuItemCallGL("Clear Group Cache", LLGroupMgr::debugClearAllGroups)); + + menu->append(new LLMenuItemCheckGL("Use Web Map Tiles", menu_toggle_control, NULL, menu_check_control, (void*)"UseWebMapTiles")); + menu->appendSeparator(); sub_menu = new LLMenuGL("Rendering"); diff --git a/linden/indra/newview/llworldmap.cpp b/linden/indra/newview/llworldmap.cpp index 908cd87..c6242f6 100644 --- a/linden/indra/newview/llworldmap.cpp +++ b/linden/indra/newview/llworldmap.cpp @@ -37,6 +37,7 @@ #include "llregionhandle.h" #include "message.h" + #include "llappviewer.h" // for gPacificDaylightTime #include "llagent.h" #include "llmapresponders.h" @@ -46,9 +47,8 @@ #include "llviewerimagelist.h" #include "llviewerregion.h" #include "llregionflags.h" - -#include "hippoGridManager.h" - + #include "hippoGridManager.h" +bool LLWorldMap::sGotMapURL = false; const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // 10 minutes // For DEV-17507, do lazy image loading in llworldmapview.cpp instead, @@ -86,6 +86,11 @@ LLSimInfo::LLSimInfo() } +LLVector3d LLSimInfo::getGlobalOrigin() const +{ + return from_region_handle(mHandle); +} + LLVector3d LLSimInfo::getGlobalPos(LLVector3 local_pos) const { LLVector3d pos = from_region_handle(mHandle); @@ -514,16 +519,13 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) LLWorldMap::getInstance()->mMapLayers[agent_flags].clear(); +// bool use_web_map_tiles = useWebMapTiles(); BOOL adjust = FALSE; for (S32 block=0; blockgetUUIDFast(_PREHASH_LayerData, _PREHASH_ImageID, new_layer.LayerImageID, block); - new_layer.LayerImage = gImageList.getImage(new_layer.LayerImageID, MIPMAP_TRUE, FALSE); - - gGL.getTexUnit(0)->bind(new_layer.LayerImage.get()); - new_layer.LayerImage->setAddressMode(LLTexUnit::TAM_CLAMP); U32 left, right, top, bottom; msg->getU32Fast(_PREHASH_LayerData, _PREHASH_Left, left, block); @@ -531,6 +533,18 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) msg->getU32Fast(_PREHASH_LayerData, _PREHASH_Top, top, block); msg->getU32Fast(_PREHASH_LayerData, _PREHASH_Bottom, bottom, block); +// if (use_web_map_tiles) +// { +// new_layer.LayerImage = loadObjectsTile(left, bottom); // no good... Maybe using of level 2 and higher web maps ? +// } +// else +// { + new_layer.LayerImage = gImageList.getImage(new_layer.LayerImageID, MIPMAP_TRUE, FALSE); +// } + + gGL.getTexUnit(0)->bind(new_layer.LayerImage.get()); + new_layer.LayerImage->setAddressMode(LLTexUnit::TAM_CLAMP); + new_layer.LayerExtents.mLeft = left; new_layer.LayerExtents.mRight = right; new_layer.LayerExtents.mBottom = bottom; @@ -550,6 +564,26 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) } // public static +bool LLWorldMap::useWebMapTiles() +{ + return gSavedSettings.getBOOL("UseWebMapTiles") && + (( gHippoGridManager->getConnectedGrid()->isSecondLife() || sGotMapURL) && LLWorldMap::getInstance()->mCurrentMap == 0); +} + +// public static +LLPointer LLWorldMap::loadObjectsTile(U32 grid_x, U32 grid_y) +{ + // Get the grid coordinates + std::string imageurl = gSavedSettings.getString("MapServerURL") + llformat("map-%d-%d-%d-objects.jpg", 1, grid_x, grid_y); + + LLPointer img = gImageList.getImageFromUrl(imageurl); + img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP); + + // Return the smart pointer + return img; +} + +// public static void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) { U32 agent_flags; @@ -565,6 +599,9 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) bool found_null_sim = false; +#ifdef IMMEDIATE_IMAGE_LOAD + bool use_web_map_tiles = useWebMapTiles(); +#endif BOOL adjust = FALSE; for (S32 block=0; blockmMapImageID[agent_flags] = image_id; #ifdef IMMEDIATE_IMAGE_LOAD - siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); + if (use_web_map_tiles) + { + siminfo->mCurrentImage = loadObjectsTile((U32)x_regions, (U32)y_regions); + } + else + { + siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); + } gGL.getTexUnit(0)->bind(siminfo->mCurrentImage.get()); siminfo->mCurrentImage->setAddressMode(LLTexUnit::TAM_CLAMP); #endif diff --git a/linden/indra/newview/llworldmap.h b/linden/indra/newview/llworldmap.h index 6ce66ff..b7089f3 100644 --- a/linden/indra/newview/llworldmap.h +++ b/linden/indra/newview/llworldmap.h @@ -76,6 +76,8 @@ public: LLSimInfo(); LLVector3d getGlobalPos(LLVector3 local_pos) const; + // Get the world coordinates of the SW corner of that region + LLVector3d getGlobalOrigin() const; public: U64 mHandle; @@ -164,6 +166,10 @@ public: static void processMapBlockReply(LLMessageSystem*, void**); static void processMapItemReply(LLMessageSystem*, void**); + static void gotMapServerURL(bool flag) { sGotMapURL = flag; } + static bool useWebMapTiles(); + static LLPointer loadObjectsTile(U32 grid_x, U32 grid_y); + void dump(); // Extend the bounding box of the list of simulators. Returns true @@ -226,6 +232,8 @@ private: std::string mSLURL; url_callback_t mSLURLCallback; bool mSLURLTeleport; + + static bool sGotMapURL; }; #endif diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp index 2e28d18..26604c3 100644 --- a/linden/indra/newview/llworldmapview.cpp +++ b/linden/indra/newview/llworldmapview.cpp @@ -50,7 +50,6 @@ #include "llfloatermap.h" #include "llfloaterworldmap.h" #include "llfocusmgr.h" -//#include "llmutelist.h" info not being sent #include "lltextbox.h" #include "lltextureview.h" #include "lltracker.h" @@ -103,6 +102,7 @@ F32 LLWorldMapView::sTargetPanY = 0.f; S32 LLWorldMapView::sTrackingArrowX = 0; S32 LLWorldMapView::sTrackingArrowY = 0; F32 LLWorldMapView::sPixelsPerMeter = 1.f; +F32 LLWorldMapView::sMapScale = 128.f; F32 CONE_SIZE = 0.6f; std::map LLWorldMapView::sStringsMap; @@ -179,7 +179,7 @@ LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect ) mMouseDownY( 0 ), mSelectIDStart(0) { - sPixelsPerMeter = gMapScale / REGION_WIDTH_METERS; + sPixelsPerMeter = sMapScale / REGION_WIDTH_METERS; clearLastClick(); const S32 DIR_WIDTH = 10; @@ -240,14 +240,14 @@ void LLWorldMapView::cleanupTextures() // static void LLWorldMapView::setScale( F32 scale ) { - if (scale != gMapScale) + if (scale != sMapScale) { - F32 old_scale = gMapScale; + F32 old_scale = sMapScale; - gMapScale = scale; - if (gMapScale == 0.f) + sMapScale = scale; + if (sMapScale == 0.f) { - gMapScale = 0.1f; + sMapScale = 0.1f; } F32 ratio = (scale / old_scale); @@ -256,7 +256,7 @@ void LLWorldMapView::setScale( F32 scale ) sTargetPanX = sPanX; sTargetPanY = sPanY; - sPixelsPerMeter = gMapScale / REGION_WIDTH_METERS; + sPixelsPerMeter = sMapScale / REGION_WIDTH_METERS; } } @@ -354,11 +354,11 @@ void LLWorldMapView::draw() // Find x and y position relative to camera's center. LLVector3d rel_region_pos = origin_global - camera_global; - F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * gMapScale; - F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * gMapScale; + F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * sMapScale; + F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * sMapScale; - F32 pix_width = gMapScale*(layer->LayerExtents.getWidth() + 1); - F32 pix_height = gMapScale*(layer->LayerExtents.getHeight() + 1); + F32 pix_width = sMapScale*(layer->LayerExtents.getWidth() + 1); + F32 pix_height = sMapScale*(layer->LayerExtents.getHeight() + 1); // When the view isn't panned, 0,0 = center of rectangle F32 bottom = sPanY + half_height + relative_y; @@ -439,6 +439,8 @@ void LLWorldMapView::draw() const S32 MIN_REQUEST_PER_TICK = 1; S32 textures_requested_this_tick = 0; + bool use_web_map_tiles = LLWorldMap::useWebMapTiles(); + for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { @@ -448,7 +450,7 @@ void LLWorldMapView::draw() LLViewerImage* simimage = info->mCurrentImage; LLViewerImage* overlayimage = info->mOverlayImage; - if (gMapScale < SIM_MAP_SCALE) + if (sMapScale < SIM_MAP_SCALE) { if (simimage != NULL) simimage->setBoostLevel(0); if (overlayimage != NULL) overlayimage->setBoostLevel(0); @@ -460,14 +462,14 @@ void LLWorldMapView::draw() // Find x and y position relative to camera's center. LLVector3d rel_region_pos = origin_global - camera_global; - F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * gMapScale; - F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * gMapScale; + F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * sMapScale; + F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * sMapScale; // When the view isn't panned, 0,0 = center of rectangle F32 bottom = sPanY + half_height + relative_y; F32 left = sPanX + half_width + relative_x; - F32 top = bottom + gMapScale ; - F32 right = left + gMapScale ; + F32 top = bottom + sMapScale ; + F32 right = left + sMapScale ; // Switch to world map texture (if available for this region) if either: // 1. Tiles are zoomed out small enough, or @@ -478,10 +480,10 @@ void LLWorldMapView::draw() map_scale_cutoff = SIM_NULL_MAP_SCALE; } - info->mShowAgentLocations = (gMapScale >= SIM_MAP_AGENT_SCALE); + info->mShowAgentLocations = (sMapScale >= SIM_MAP_AGENT_SCALE); bool sim_visible = - (gMapScale >= map_scale_cutoff) && + (sMapScale >= map_scale_cutoff) && (simimage != NULL) && (simimage->getHasGLTexture()); @@ -521,7 +523,15 @@ void LLWorldMapView::draw() (textures_requested_this_tick < MAX_REQUEST_PER_TICK))) { textures_requested_this_tick++; - info->mCurrentImage = gImageList.getImage(info->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); + if (use_web_map_tiles) + { + LLVector3d region_pos = info->getGlobalOrigin(); + info->mCurrentImage = LLWorldMap::loadObjectsTile((U32)(region_pos.mdV[VX] / REGION_WIDTH_UNITS), (U32)(region_pos.mdV[VY] / REGION_WIDTH_UNITS)); + } + else + { + info->mCurrentImage = gImageList.getImage(info->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); + } info->mCurrentImage->setAddressMode(LLTexUnit::TAM_CLAMP); simimage = info->mCurrentImage; gGL.getTexUnit(0)->bind(simimage); @@ -554,7 +564,7 @@ void LLWorldMapView::draw() center_global.mdV[VX] += 128.0; center_global.mdV[VY] += 128.0; - S32 draw_size = llround(gMapScale); + S32 draw_size = llround(sMapScale); if (simimage != NULL) { simimage->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP); @@ -670,10 +680,10 @@ void LLWorldMapView::draw() LLFontGL* font = LLFontGL::getFontSansSerifSmall(); std::string mesg; - if (gMapScale < sThresholdA) + if (sMapScale < sThresholdA) { } - else if (gMapScale < sThresholdB) + else if (sMapScale < sThresholdB) { // mesg = llformat( info->mAgents); } @@ -772,13 +782,13 @@ void LLWorldMapView::draw() gGL.setSceneBlendType(LLRender::BT_ALPHA); // Infohubs - if (gSavedSettings.getBOOL("MapShowInfohubs")) //(gMapScale >= sThresholdB) + if (gSavedSettings.getBOOL("MapShowInfohubs")) //(sMapScale >= sThresholdB) { drawGenericItems(LLWorldMap::getInstance()->mInfohubs, sInfohubImage); } // Telehubs - if (gSavedSettings.getBOOL("MapShowTelehubs")) //(gMapScale >= sThresholdB) + if (gSavedSettings.getBOOL("MapShowTelehubs")) //(sMapScale >= sThresholdB) { drawGenericItems(LLWorldMap::getInstance()->mTelehubs, sTelehubImage); } @@ -950,7 +960,7 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i void LLWorldMapView::drawAgents() { - F32 agents_scale = (gMapScale * 0.9f) / 256.f; + F32 agents_scale = (sMapScale * 0.9f) / 256.f; LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); /*LLColor4 friend_color = gColors.getColor( "MapFriend" ); @@ -1090,7 +1100,7 @@ void LLWorldMapView::drawEvents() void LLWorldMapView::drawFrustum() { // Draw frustum - F32 meters_to_pixels = gMapScale/ REGION_WIDTH_METERS; + F32 meters_to_pixels = sMapScale/ REGION_WIDTH_METERS; F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); F32 far_clip_meters = LLViewerCamera::getInstance()->getFar(); @@ -1219,7 +1229,7 @@ LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y ) LLVector3 pos_local( (F32)x, (F32)y, 0.f ); - pos_local *= ( REGION_WIDTH_METERS / gMapScale ); + pos_local *= ( REGION_WIDTH_METERS / sMapScale ); LLVector3d pos_global; pos_global.setVec( pos_local ); @@ -1853,7 +1863,7 @@ U32 LLWorldMapView::updateBlock(S32 block_x, S32 block_y) U32 LLWorldMapView::updateVisibleBlocks() { - if (gMapScale < SIM_MAP_SCALE) + if (sMapScale < SIM_MAP_SCALE) { // We don't care what is loaded if we're zoomed out return 0; @@ -1861,7 +1871,7 @@ U32 LLWorldMapView::updateVisibleBlocks() LLVector3d camera_global = gAgent.getCameraPositionGlobal(); - F32 pixels_per_region = gMapScale; + F32 pixels_per_region = sMapScale; const S32 width = getRect().getWidth(); const S32 height = getRect().getHeight(); // Convert pan to sim coordinates diff --git a/linden/indra/newview/llworldmapview.h b/linden/indra/newview/llworldmapview.h index 3245838..4814767 100644 --- a/linden/indra/newview/llworldmapview.h +++ b/linden/indra/newview/llworldmapview.h @@ -30,7 +30,10 @@ * $/LicenseInfo$ */ -// Global map of the world. +// View of the global map of the world + +// The data (model) for the global map (a singleton, unique to the application instance) is +// in LLWorldMap and is typically accessed using LLWorldMap::getInstance() #ifndef LL_LLWORLDMAPVIEW_H #define LL_LLWORLDMAPVIEW_H @@ -161,6 +164,8 @@ public: static F32 sThresholdB; static F32 sPixelsPerMeter; // world meters to map pixels + static F32 sMapScale; // scale = size of a region in pixels + BOOL mItemPicked; static F32 sPanX; // in pixels -- cgit v1.1