aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llworldmapview.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llworldmapview.cpp70
1 files changed, 40 insertions, 30 deletions
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 @@
50#include "llfloatermap.h" 50#include "llfloatermap.h"
51#include "llfloaterworldmap.h" 51#include "llfloaterworldmap.h"
52#include "llfocusmgr.h" 52#include "llfocusmgr.h"
53//#include "llmutelist.h" info not being sent
54#include "lltextbox.h" 53#include "lltextbox.h"
55#include "lltextureview.h" 54#include "lltextureview.h"
56#include "lltracker.h" 55#include "lltracker.h"
@@ -103,6 +102,7 @@ F32 LLWorldMapView::sTargetPanY = 0.f;
103S32 LLWorldMapView::sTrackingArrowX = 0; 102S32 LLWorldMapView::sTrackingArrowX = 0;
104S32 LLWorldMapView::sTrackingArrowY = 0; 103S32 LLWorldMapView::sTrackingArrowY = 0;
105F32 LLWorldMapView::sPixelsPerMeter = 1.f; 104F32 LLWorldMapView::sPixelsPerMeter = 1.f;
105F32 LLWorldMapView::sMapScale = 128.f;
106F32 CONE_SIZE = 0.6f; 106F32 CONE_SIZE = 0.6f;
107 107
108std::map<std::string,std::string> LLWorldMapView::sStringsMap; 108std::map<std::string,std::string> LLWorldMapView::sStringsMap;
@@ -179,7 +179,7 @@ LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect )
179 mMouseDownY( 0 ), 179 mMouseDownY( 0 ),
180 mSelectIDStart(0) 180 mSelectIDStart(0)
181{ 181{
182 sPixelsPerMeter = gMapScale / REGION_WIDTH_METERS; 182 sPixelsPerMeter = sMapScale / REGION_WIDTH_METERS;
183 clearLastClick(); 183 clearLastClick();
184 184
185 const S32 DIR_WIDTH = 10; 185 const S32 DIR_WIDTH = 10;
@@ -240,14 +240,14 @@ void LLWorldMapView::cleanupTextures()
240// static 240// static
241void LLWorldMapView::setScale( F32 scale ) 241void LLWorldMapView::setScale( F32 scale )
242{ 242{
243 if (scale != gMapScale) 243 if (scale != sMapScale)
244 { 244 {
245 F32 old_scale = gMapScale; 245 F32 old_scale = sMapScale;
246 246
247 gMapScale = scale; 247 sMapScale = scale;
248 if (gMapScale == 0.f) 248 if (sMapScale == 0.f)
249 { 249 {
250 gMapScale = 0.1f; 250 sMapScale = 0.1f;
251 } 251 }
252 252
253 F32 ratio = (scale / old_scale); 253 F32 ratio = (scale / old_scale);
@@ -256,7 +256,7 @@ void LLWorldMapView::setScale( F32 scale )
256 sTargetPanX = sPanX; 256 sTargetPanX = sPanX;
257 sTargetPanY = sPanY; 257 sTargetPanY = sPanY;
258 258
259 sPixelsPerMeter = gMapScale / REGION_WIDTH_METERS; 259 sPixelsPerMeter = sMapScale / REGION_WIDTH_METERS;
260 } 260 }
261} 261}
262 262
@@ -354,11 +354,11 @@ void LLWorldMapView::draw()
354 354
355 // Find x and y position relative to camera's center. 355 // Find x and y position relative to camera's center.
356 LLVector3d rel_region_pos = origin_global - camera_global; 356 LLVector3d rel_region_pos = origin_global - camera_global;
357 F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * gMapScale; 357 F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * sMapScale;
358 F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * gMapScale; 358 F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * sMapScale;
359 359
360 F32 pix_width = gMapScale*(layer->LayerExtents.getWidth() + 1); 360 F32 pix_width = sMapScale*(layer->LayerExtents.getWidth() + 1);
361 F32 pix_height = gMapScale*(layer->LayerExtents.getHeight() + 1); 361 F32 pix_height = sMapScale*(layer->LayerExtents.getHeight() + 1);
362 362
363 // When the view isn't panned, 0,0 = center of rectangle 363 // When the view isn't panned, 0,0 = center of rectangle
364 F32 bottom = sPanY + half_height + relative_y; 364 F32 bottom = sPanY + half_height + relative_y;
@@ -439,6 +439,8 @@ void LLWorldMapView::draw()
439 const S32 MIN_REQUEST_PER_TICK = 1; 439 const S32 MIN_REQUEST_PER_TICK = 1;
440 S32 textures_requested_this_tick = 0; 440 S32 textures_requested_this_tick = 0;
441 441
442 bool use_web_map_tiles = LLWorldMap::useWebMapTiles();
443
442 for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); 444 for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin();
443 it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) 445 it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
444 { 446 {
@@ -448,7 +450,7 @@ void LLWorldMapView::draw()
448 LLViewerImage* simimage = info->mCurrentImage; 450 LLViewerImage* simimage = info->mCurrentImage;
449 LLViewerImage* overlayimage = info->mOverlayImage; 451 LLViewerImage* overlayimage = info->mOverlayImage;
450 452
451 if (gMapScale < SIM_MAP_SCALE) 453 if (sMapScale < SIM_MAP_SCALE)
452 { 454 {
453 if (simimage != NULL) simimage->setBoostLevel(0); 455 if (simimage != NULL) simimage->setBoostLevel(0);
454 if (overlayimage != NULL) overlayimage->setBoostLevel(0); 456 if (overlayimage != NULL) overlayimage->setBoostLevel(0);
@@ -460,14 +462,14 @@ void LLWorldMapView::draw()
460 462
461 // Find x and y position relative to camera's center. 463 // Find x and y position relative to camera's center.
462 LLVector3d rel_region_pos = origin_global - camera_global; 464 LLVector3d rel_region_pos = origin_global - camera_global;
463 F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * gMapScale; 465 F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * sMapScale;
464 F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * gMapScale; 466 F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * sMapScale;
465 467
466 // When the view isn't panned, 0,0 = center of rectangle 468 // When the view isn't panned, 0,0 = center of rectangle
467 F32 bottom = sPanY + half_height + relative_y; 469 F32 bottom = sPanY + half_height + relative_y;
468 F32 left = sPanX + half_width + relative_x; 470 F32 left = sPanX + half_width + relative_x;
469 F32 top = bottom + gMapScale ; 471 F32 top = bottom + sMapScale ;
470 F32 right = left + gMapScale ; 472 F32 right = left + sMapScale ;
471 473
472 // Switch to world map texture (if available for this region) if either: 474 // Switch to world map texture (if available for this region) if either:
473 // 1. Tiles are zoomed out small enough, or 475 // 1. Tiles are zoomed out small enough, or
@@ -478,10 +480,10 @@ void LLWorldMapView::draw()
478 map_scale_cutoff = SIM_NULL_MAP_SCALE; 480 map_scale_cutoff = SIM_NULL_MAP_SCALE;
479 } 481 }
480 482
481 info->mShowAgentLocations = (gMapScale >= SIM_MAP_AGENT_SCALE); 483 info->mShowAgentLocations = (sMapScale >= SIM_MAP_AGENT_SCALE);
482 484
483 bool sim_visible = 485 bool sim_visible =
484 (gMapScale >= map_scale_cutoff) && 486 (sMapScale >= map_scale_cutoff) &&
485 (simimage != NULL) && 487 (simimage != NULL) &&
486 (simimage->getHasGLTexture()); 488 (simimage->getHasGLTexture());
487 489
@@ -521,7 +523,15 @@ void LLWorldMapView::draw()
521 (textures_requested_this_tick < MAX_REQUEST_PER_TICK))) 523 (textures_requested_this_tick < MAX_REQUEST_PER_TICK)))
522 { 524 {
523 textures_requested_this_tick++; 525 textures_requested_this_tick++;
524 info->mCurrentImage = gImageList.getImage(info->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); 526 if (use_web_map_tiles)
527 {
528 LLVector3d region_pos = info->getGlobalOrigin();
529 info->mCurrentImage = LLWorldMap::loadObjectsTile((U32)(region_pos.mdV[VX] / REGION_WIDTH_UNITS), (U32)(region_pos.mdV[VY] / REGION_WIDTH_UNITS));
530 }
531 else
532 {
533 info->mCurrentImage = gImageList.getImage(info->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE);
534 }
525 info->mCurrentImage->setAddressMode(LLTexUnit::TAM_CLAMP); 535 info->mCurrentImage->setAddressMode(LLTexUnit::TAM_CLAMP);
526 simimage = info->mCurrentImage; 536 simimage = info->mCurrentImage;
527 gGL.getTexUnit(0)->bind(simimage); 537 gGL.getTexUnit(0)->bind(simimage);
@@ -554,7 +564,7 @@ void LLWorldMapView::draw()
554 center_global.mdV[VX] += 128.0; 564 center_global.mdV[VX] += 128.0;
555 center_global.mdV[VY] += 128.0; 565 center_global.mdV[VY] += 128.0;
556 566
557 S32 draw_size = llround(gMapScale); 567 S32 draw_size = llround(sMapScale);
558 if (simimage != NULL) 568 if (simimage != NULL)
559 { 569 {
560 simimage->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP); 570 simimage->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP);
@@ -670,10 +680,10 @@ void LLWorldMapView::draw()
670 LLFontGL* font = LLFontGL::getFontSansSerifSmall(); 680 LLFontGL* font = LLFontGL::getFontSansSerifSmall();
671 681
672 std::string mesg; 682 std::string mesg;
673 if (gMapScale < sThresholdA) 683 if (sMapScale < sThresholdA)
674 { 684 {
675 } 685 }
676 else if (gMapScale < sThresholdB) 686 else if (sMapScale < sThresholdB)
677 { 687 {
678 // mesg = llformat( info->mAgents); 688 // mesg = llformat( info->mAgents);
679 } 689 }
@@ -772,13 +782,13 @@ void LLWorldMapView::draw()
772 gGL.setSceneBlendType(LLRender::BT_ALPHA); 782 gGL.setSceneBlendType(LLRender::BT_ALPHA);
773 783
774 // Infohubs 784 // Infohubs
775 if (gSavedSettings.getBOOL("MapShowInfohubs")) //(gMapScale >= sThresholdB) 785 if (gSavedSettings.getBOOL("MapShowInfohubs")) //(sMapScale >= sThresholdB)
776 { 786 {
777 drawGenericItems(LLWorldMap::getInstance()->mInfohubs, sInfohubImage); 787 drawGenericItems(LLWorldMap::getInstance()->mInfohubs, sInfohubImage);
778 } 788 }
779 789
780 // Telehubs 790 // Telehubs
781 if (gSavedSettings.getBOOL("MapShowTelehubs")) //(gMapScale >= sThresholdB) 791 if (gSavedSettings.getBOOL("MapShowTelehubs")) //(sMapScale >= sThresholdB)
782 { 792 {
783 drawGenericItems(LLWorldMap::getInstance()->mTelehubs, sTelehubImage); 793 drawGenericItems(LLWorldMap::getInstance()->mTelehubs, sTelehubImage);
784 } 794 }
@@ -950,7 +960,7 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i
950 960
951void LLWorldMapView::drawAgents() 961void LLWorldMapView::drawAgents()
952{ 962{
953 F32 agents_scale = (gMapScale * 0.9f) / 256.f; 963 F32 agents_scale = (sMapScale * 0.9f) / 256.f;
954 964
955 LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); 965 LLColor4 avatar_color = gColors.getColor( "MapAvatar" );
956 /*LLColor4 friend_color = gColors.getColor( "MapFriend" ); 966 /*LLColor4 friend_color = gColors.getColor( "MapFriend" );
@@ -1090,7 +1100,7 @@ void LLWorldMapView::drawEvents()
1090void LLWorldMapView::drawFrustum() 1100void LLWorldMapView::drawFrustum()
1091{ 1101{
1092 // Draw frustum 1102 // Draw frustum
1093 F32 meters_to_pixels = gMapScale/ REGION_WIDTH_METERS; 1103 F32 meters_to_pixels = sMapScale/ REGION_WIDTH_METERS;
1094 1104
1095 F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); 1105 F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
1096 F32 far_clip_meters = LLViewerCamera::getInstance()->getFar(); 1106 F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
@@ -1219,7 +1229,7 @@ LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y )
1219 1229
1220 LLVector3 pos_local( (F32)x, (F32)y, 0.f ); 1230 LLVector3 pos_local( (F32)x, (F32)y, 0.f );
1221 1231
1222 pos_local *= ( REGION_WIDTH_METERS / gMapScale ); 1232 pos_local *= ( REGION_WIDTH_METERS / sMapScale );
1223 1233
1224 LLVector3d pos_global; 1234 LLVector3d pos_global;
1225 pos_global.setVec( pos_local ); 1235 pos_global.setVec( pos_local );
@@ -1853,7 +1863,7 @@ U32 LLWorldMapView::updateBlock(S32 block_x, S32 block_y)
1853 1863
1854U32 LLWorldMapView::updateVisibleBlocks() 1864U32 LLWorldMapView::updateVisibleBlocks()
1855{ 1865{
1856 if (gMapScale < SIM_MAP_SCALE) 1866 if (sMapScale < SIM_MAP_SCALE)
1857 { 1867 {
1858 // We don't care what is loaded if we're zoomed out 1868 // We don't care what is loaded if we're zoomed out
1859 return 0; 1869 return 0;
@@ -1861,7 +1871,7 @@ U32 LLWorldMapView::updateVisibleBlocks()
1861 1871
1862 LLVector3d camera_global = gAgent.getCameraPositionGlobal(); 1872 LLVector3d camera_global = gAgent.getCameraPositionGlobal();
1863 1873
1864 F32 pixels_per_region = gMapScale; 1874 F32 pixels_per_region = sMapScale;
1865 const S32 width = getRect().getWidth(); 1875 const S32 width = getRect().getWidth();
1866 const S32 height = getRect().getHeight(); 1876 const S32 height = getRect().getHeight();
1867 // Convert pan to sim coordinates 1877 // Convert pan to sim coordinates