aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llworldmapview.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:11 -0500
committerJacek Antonelli2008-08-15 23:45:11 -0500
commit215f423cbe18fe9ca14a26caef918d303bad28ff (patch)
tree0743442b286216cc8e19aa487c26f4e9345ffd64 /linden/indra/newview/llworldmapview.cpp
parentSecond Life viewer sources 1.18.3.5-RC (diff)
downloadmeta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.zip
meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.gz
meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.bz2
meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.xz
Second Life viewer sources 1.18.4.0-RC
Diffstat (limited to 'linden/indra/newview/llworldmapview.cpp')
-rw-r--r--linden/indra/newview/llworldmapview.cpp431
1 files changed, 155 insertions, 276 deletions
diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp
index 0c98305..08d8aad 100644
--- a/linden/indra/newview/llworldmapview.cpp
+++ b/linden/indra/newview/llworldmapview.cpp
@@ -2,6 +2,8 @@
2 * @file llworldmapview.cpp 2 * @file llworldmapview.cpp
3 * @brief LLWorldMapView class implementation 3 * @brief LLWorldMapView class implementation
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 7 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#include "llviewerprecompiledheaders.h" 32#include "llviewerprecompiledheaders.h"
@@ -52,6 +55,7 @@
52#include "llviewercamera.h" 55#include "llviewercamera.h"
53#include "llviewerimage.h" 56#include "llviewerimage.h"
54#include "llviewerimagelist.h" 57#include "llviewerimagelist.h"
58#include "llviewermenu.h"
55#include "llviewerparceloverlay.h" 59#include "llviewerparceloverlay.h"
56#include "llviewerregion.h" 60#include "llviewerregion.h"
57#include "llviewerwindow.h" 61#include "llviewerwindow.h"
@@ -69,6 +73,8 @@ BOOL LLWorldMapView::sHandledLastClick = FALSE;
69LLPointer<LLViewerImage> LLWorldMapView::sAvatarYouSmallImage = NULL; 73LLPointer<LLViewerImage> LLWorldMapView::sAvatarYouSmallImage = NULL;
70LLPointer<LLViewerImage> LLWorldMapView::sAvatarSmallImage = NULL; 74LLPointer<LLViewerImage> LLWorldMapView::sAvatarSmallImage = NULL;
71LLPointer<LLViewerImage> LLWorldMapView::sAvatarLargeImage = NULL; 75LLPointer<LLViewerImage> LLWorldMapView::sAvatarLargeImage = NULL;
76LLPointer<LLViewerImage> LLWorldMapView::sAvatarAboveImage = NULL;
77LLPointer<LLViewerImage> LLWorldMapView::sAvatarBelowImage = NULL;
72 78
73LLPointer<LLViewerImage> LLWorldMapView::sTelehubImage = NULL; 79LLPointer<LLViewerImage> LLWorldMapView::sTelehubImage = NULL;
74LLPointer<LLViewerImage> LLWorldMapView::sInfohubImage = NULL; 80LLPointer<LLViewerImage> LLWorldMapView::sInfohubImage = NULL;
@@ -107,6 +113,12 @@ void LLWorldMapView::initClass()
107 image_id.set( gViewerArt.getString("map_avatar_16.tga") ); 113 image_id.set( gViewerArt.getString("map_avatar_16.tga") );
108 sAvatarLargeImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); 114 sAvatarLargeImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE);
109 115
116 image_id.set( gViewerArt.getString("map_avatar_above_8.tga") );
117 sAvatarAboveImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE);
118
119 image_id.set( gViewerArt.getString("map_avatar_below_8.tga") );
120 sAvatarBelowImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE);
121
110 image_id.set( gViewerArt.getString("map_home.tga") ); 122 image_id.set( gViewerArt.getString("map_home.tga") );
111 sHomeImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); 123 sHomeImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
112 124
@@ -147,6 +159,8 @@ void LLWorldMapView::cleanupClass()
147 sAvatarYouSmallImage = NULL; 159 sAvatarYouSmallImage = NULL;
148 sAvatarSmallImage = NULL; 160 sAvatarSmallImage = NULL;
149 sAvatarLargeImage = NULL; 161 sAvatarLargeImage = NULL;
162 sAvatarAboveImage = NULL;
163 sAvatarBelowImage = NULL;
150 sTelehubImage = NULL; 164 sTelehubImage = NULL;
151 sInfohubImage = NULL; 165 sInfohubImage = NULL;
152 sHomeImage = NULL; 166 sHomeImage = NULL;
@@ -274,18 +288,16 @@ void LLWorldMapView::setPan( S32 x, S32 y, BOOL snap )
274 288
275 289
276/////////////////////////////////////////////////////////////////////////////////// 290///////////////////////////////////////////////////////////////////////////////////
291// HELPERS
277 292
278// dumb helper function
279BOOL is_agent_in_region(LLViewerRegion* region, LLSimInfo* info) 293BOOL is_agent_in_region(LLViewerRegion* region, LLSimInfo* info)
280{ 294{
281 if((region && info) 295 return ((region && info) && (info->mName == region->getName()));
282 && (info->mName == region->getName()))
283 {
284 return TRUE;
285 }
286 return FALSE;
287} 296}
288 297
298
299///////////////////////////////////////////////////////////////////////////////////
300
289void LLWorldMapView::draw() 301void LLWorldMapView::draw()
290{ 302{
291 if (!getVisible() || !gWorldPointer) 303 if (!getVisible() || !gWorldPointer)
@@ -303,9 +315,6 @@ void LLWorldMapView::draw()
303 sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); 315 sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(0.1f));
304 sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); 316 sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f));
305 317
306 LLVector3d pos_global;
307 LLVector3 pos_map;
308
309 const S32 width = mRect.getWidth(); 318 const S32 width = mRect.getWidth();
310 const S32 height = mRect.getHeight(); 319 const S32 height = mRect.getHeight();
311 const S32 half_width = width / 2; 320 const S32 half_width = width / 2;
@@ -685,56 +694,24 @@ void LLWorldMapView::draw()
685 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 694 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
686 695
687 // Infohubs 696 // Infohubs
688 // Draw under avatar so you can find yourself.
689 if (gSavedSettings.getBOOL("MapShowInfohubs")) //(gMapScale >= sThresholdB) 697 if (gSavedSettings.getBOOL("MapShowInfohubs")) //(gMapScale >= sThresholdB)
690 { 698 {
691 S32 infohub_icon_size = (S32)sInfohubImage->getWidth(); 699 drawGenericItems(gWorldMap->mInfohubs, sInfohubImage);
692 for (U32 infohub=0; infohub<gWorldMap->mInfohubs.size(); ++infohub)
693 {
694 LLItemInfo *infohub_info = &gWorldMap->mInfohubs[infohub];
695
696 pos_map = globalPosToView(infohub_info->mPosGlobal);
697 gl_draw_image(llround(pos_map.mV[VX])-infohub_icon_size/2,
698 llround(pos_map.mV[VY])-infohub_icon_size/2,
699 sInfohubImage,
700 LLColor4::white);
701 }
702 } 700 }
703 701
704 // Telehubs 702 // Telehubs
705 // Draw under avatar so you can find yourself.
706 if (gSavedSettings.getBOOL("MapShowTelehubs")) //(gMapScale >= sThresholdB) 703 if (gSavedSettings.getBOOL("MapShowTelehubs")) //(gMapScale >= sThresholdB)
707 { 704 {
708 S32 telehub_icon_size = (S32)sTelehubImage->getWidth(); 705 drawGenericItems(gWorldMap->mTelehubs, sTelehubImage);
709 for (U32 telehub=0; telehub<gWorldMap->mTelehubs.size(); ++telehub)
710 {
711 LLItemInfo *telehub_info = &gWorldMap->mTelehubs[telehub];
712
713 pos_map = globalPosToView(telehub_info->mPosGlobal);
714 gl_draw_image(llround(pos_map.mV[VX])-telehub_icon_size/2,
715 llround(pos_map.mV[VY])-telehub_icon_size/2,
716 sTelehubImage,
717 LLColor4::white);
718 }
719 } 706 }
720 707
721 // Home 708 // Home Sweet Home
722 // Always Draw 709 LLVector3d home;
723 if (1) //(gMapScale >= sThresholdB) 710 if (gAgent.getHomePosGlobal(&home))
724 { 711 {
725 S32 home_icon_size = (S32)sHomeImage->getWidth(); 712 drawImage(home, sHomeImage);
726 if (gAgent.getHomePosGlobal(&pos_global))
727 {
728 pos_map = globalPosToView(pos_global);
729 gl_draw_image(llround(pos_map.mV[VX])-home_icon_size/2,
730 llround(pos_map.mV[VY])-home_icon_size/2,
731 sHomeImage,
732 LLColor4::white);
733 }
734 } 713 }
735 714
736 // Draw all these under the avatar, so you can find yourself
737
738 if (gSavedSettings.getBOOL("MapShowLandForSale")) 715 if (gSavedSettings.getBOOL("MapShowLandForSale"))
739 { 716 {
740 drawGenericItems(gWorldMap->mLandForSale, sForSaleImage); 717 drawGenericItems(gWorldMap->mLandForSale, sForSaleImage);
@@ -755,15 +732,11 @@ void LLWorldMapView::draw()
755 drawEvents(); 732 drawEvents();
756 } 733 }
757 734
758 // Your avatar. 735 // Now draw your avatar after all that other stuff.
759 // Draw avatar position, always, and underneath other avatars 736 LLVector3d pos_global = gAgent.getPositionGlobal();
760 pos_global = gAgent.getPositionGlobal(); 737 drawImage(pos_global, sAvatarLargeImage);
761 pos_map = globalPosToView(pos_global);
762 gl_draw_image(llround(pos_map.mV[VX])-8,
763 llround(pos_map.mV[VY])-8,
764 sAvatarLargeImage,
765 LLColor4::white);
766 738
739 LLVector3 pos_map = globalPosToView(pos_global);
767 if (!pointInView(llround(pos_map.mV[VX]), llround(pos_map.mV[VY]))) 740 if (!pointInView(llround(pos_map.mV[VX]), llround(pos_map.mV[VY])))
768 { 741 {
769 drawTracking(pos_global, 742 drawTracking(pos_global,
@@ -774,17 +747,16 @@ void LLWorldMapView::draw()
774 llround(LLFontGL::sSansSerifSmall->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking 747 llround(LLFontGL::sSansSerifSmall->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking
775 } 748 }
776 749
750 // Show your viewing angle
777 drawFrustum(); 751 drawFrustum();
778 752
779 // Draw icons for the avatars in each region. 753 // Draw icons for the avatars in each region.
780 // Draw after avatar so you can see nearby people. 754 // Drawn after your avatar so you can see nearby people.
781 if (gSavedSettings.getBOOL("MapShowPeople")) 755 if (gSavedSettings.getBOOL("MapShowPeople"))
782 { 756 {
783 drawAgents(); 757 drawAgents();
784 } 758 }
785 759
786 //-----------------------------------------------------------------------
787
788 // Always draw tracking information 760 // Always draw tracking information
789 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); 761 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
790 if ( LLTracker::TRACKING_AVATAR == tracking_status ) 762 if ( LLTracker::TRACKING_AVATAR == tracking_status )
@@ -828,7 +800,8 @@ void LLWorldMapView::draw()
828 LLView::draw(); 800 LLView::draw();
829 801
830 updateVisibleBlocks(); 802 updateVisibleBlocks();
831} 803} // end draw()
804
832 805
833//virtual 806//virtual
834void LLWorldMapView::setVisible(BOOL visible) 807void LLWorldMapView::setVisible(BOOL visible)
@@ -868,29 +841,40 @@ void LLWorldMapView::drawGenericItems(const LLWorldMap::item_info_list_t& items,
868 LLWorldMap::item_info_list_t::const_iterator e; 841 LLWorldMap::item_info_list_t::const_iterator e;
869 for (e = items.begin(); e != items.end(); ++e) 842 for (e = items.begin(); e != items.end(); ++e)
870 { 843 {
871 const LLItemInfo& info = *e; 844 drawGenericItem(*e, image);
872
873 drawGenericItem(info, image);
874 } 845 }
875} 846}
876 847
877void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLPointer<LLViewerImage> image) 848void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLPointer<LLViewerImage> image)
878{ 849{
879 S32 half_width = image->getWidth()/2; 850 drawImage(item.mPosGlobal, image);
880 S32 half_height = image->getHeight()/2;
881
882 LLVector3 pos_map = globalPosToView( item.mPosGlobal );
883 gl_draw_image(llround(pos_map.mV[VX]) - half_width,
884 llround(pos_map.mV[VY]) - half_height,
885 image,
886 LLColor4::white);
887} 851}
888 852
889void LLWorldMapView::drawAgents() 853
854void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, const LLColor4& color)
890{ 855{
891 //S32 half_width = sPopularImage->getWidth()/2; 856 LLVector3 pos_map = globalPosToView( global_pos );
892 //S32 half_height = sPopularImage->getHeight()/2; 857 gl_draw_image(llround(pos_map.mV[VX] - image->getWidth() /2.f),
858 llround(pos_map.mV[VY] - image->getHeight()/2.f),
859 image,
860 color);
861}
893 862
863void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, U32 count, F32 offset, const LLColor4& color)
864{
865 LLVector3 pos_map = globalPosToView( global_pos );
866 for(U32 i=0; i<count; i++)
867 {
868 gl_draw_image(llround(pos_map.mV[VX] - image->getWidth() /2.f),
869 llround(pos_map.mV[VY] - image->getHeight()/2.f + i*offset),
870 image,
871 color);
872 }
873}
874
875
876void LLWorldMapView::drawAgents()
877{
894 F32 agents_scale = (gMapScale * 0.9f) / 256.f; 878 F32 agents_scale = (gMapScale * 0.9f) / 256.f;
895 879
896 for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) 880 for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
@@ -901,32 +885,20 @@ void LLWorldMapView::drawAgents()
901 { 885 {
902 continue; 886 continue;
903 } 887 }
904 LLWorldMap::agent_list_map_t::iterator countsiter = gWorldMap->mAgentLocationsMap.find(handle); 888 LLWorldMap::agent_list_map_t::iterator counts_iter = gWorldMap->mAgentLocationsMap.find(handle);
905 if (siminfo && siminfo->mShowAgentLocations && countsiter != gWorldMap->mAgentLocationsMap.end()) 889 if (siminfo && siminfo->mShowAgentLocations && counts_iter != gWorldMap->mAgentLocationsMap.end())
906 { 890 {
907 // Show Individual agents 891 // Show Individual agents (or little stacks where real agents are)
908 LLWorldMap::item_info_list_t& agentcounts = countsiter->second; 892 LLWorldMap::item_info_list_t& agentcounts = counts_iter->second;
909 S32 sim_agent_count = 0; 893 S32 sim_agent_count = 0;
910 for (LLWorldMap::item_info_list_t::iterator iter = agentcounts.begin(); 894 for (LLWorldMap::item_info_list_t::iterator iter = agentcounts.begin();
911 iter != agentcounts.end(); ++iter) 895 iter != agentcounts.end(); ++iter)
912 { 896 {
913 const LLItemInfo& info = *iter; 897 const LLItemInfo& info = *iter;
914 LLVector3 pos_map = globalPosToView( info.mPosGlobal );
915 S32 agent_count = info.mExtra; 898 S32 agent_count = info.mExtra;
916 if (agent_count > 0) 899 // Here's how we'd choose the color if info.mID were available but it's not being sent:
917 { 900 //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? gFriendMapColor : gAvatarMapColor;
918 sim_agent_count += agent_count; 901 drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, gAvatarMapColor);
919 F32 y = 0;
920 for (S32 cur_agent = 0; cur_agent < agent_count; cur_agent++)
921 {
922 gl_draw_image(llround(pos_map.mV[VX]) - 4,
923 llround(pos_map.mV[VY] + y) - 4,
924 sAvatarSmallImage,
925 LLColor4::white );
926 // move up a bit
927 y += 3.f;
928 }
929 }
930 } 902 }
931 gWorldMap->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim 903 gWorldMap->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim
932 } 904 }
@@ -936,24 +908,12 @@ void LLWorldMapView::drawAgents()
936 S32 num_agents = gWorldMap->mNumAgents[handle]; 908 S32 num_agents = gWorldMap->mNumAgents[handle];
937 if (num_agents > 0) 909 if (num_agents > 0)
938 { 910 {
939 LLVector3d region_pos = from_region_handle(handle); 911 LLVector3d region_center = from_region_handle(handle);
940 region_pos[VX] += REGION_WIDTH_METERS * .5f; 912 region_center[VX] += REGION_WIDTH_METERS / 2;
941 region_pos[VY] += REGION_WIDTH_METERS * .5f; 913 region_center[VY] += REGION_WIDTH_METERS / 2;
942 LLVector3 pos_map = globalPosToView(region_pos);
943 // Reduce the stack size as you zoom out - always display at lease one agent where there is one or more 914 // Reduce the stack size as you zoom out - always display at lease one agent where there is one or more
944 S32 agent_count = (S32)(((num_agents-1) * agents_scale + (num_agents-1) * 0.1f)+.1f) + 1; 915 S32 agent_count = (S32)(((num_agents-1) * agents_scale + (num_agents-1) * 0.1f)+.1f) + 1;
945 S32 y = 0; 916 drawImageStack(region_center, sAvatarSmallImage, agent_count, 3.f, gAvatarMapColor);
946 S32 cur_agent;
947 for (cur_agent = 0; cur_agent < agent_count; cur_agent++)
948 {
949 gl_draw_image(
950 llround(pos_map.mV[VX]) - 4,
951 llround(pos_map.mV[VY]) + y - 4,
952 sAvatarSmallImage,
953 LLColor4::white );
954 // move up a bit
955 y += 3;
956 }
957 } 917 }
958 } 918 }
959 } 919 }
@@ -962,95 +922,46 @@ void LLWorldMapView::drawAgents()
962 922
963void LLWorldMapView::drawEvents() 923void LLWorldMapView::drawEvents()
964{ 924{
965 BOOL show_mature = gSavedSettings.getBOOL("ShowMatureEvents"); 925 BOOL show_mature = gSavedSettings.getBOOL("ShowMatureEvents");
966 926
967 // Non-selected events 927 // First the non-selected events
968 // Draw under avatar so you can find yourself. 928 LLWorldMap::item_info_list_t::const_iterator e;
969 LLWorldMap::item_info_list_t::const_iterator e; 929 for (e = gWorldMap->mPGEvents.begin(); e != gWorldMap->mPGEvents.end(); ++e)
970 for (e = gWorldMap->mPGEvents.begin(); e != gWorldMap->mPGEvents.end(); ++e) 930 {
971 { 931 if (!e->mSelected)
972 const LLItemInfo& event = *e; 932 {
973 933 drawGenericItem(*e, sEventImage);
974 // Draw, but without relative-Z icons 934 }
975 if (!event.mSelected) 935 }
976 { 936 if (show_mature)
977 LLVector3 pos_map = globalPosToView( event.mPosGlobal ); 937 {
978 gl_draw_image(llround(pos_map.mV[VX]) - sEventImage->getWidth()/2, 938 for (e = gWorldMap->mMatureEvents.begin(); e != gWorldMap->mMatureEvents.end(); ++e)
979 llround(pos_map.mV[VY]) - sEventImage->getHeight()/2, 939 {
980 sEventImage, 940 if (!e->mSelected)
981 LLColor4::white); 941 {
982 } 942 drawGenericItem(*e, sEventMatureImage);
983 } 943 }
984 if (show_mature) 944 }
985 { 945 }
986 for (e = gWorldMap->mMatureEvents.begin(); e != gWorldMap->mMatureEvents.end(); ++e) 946
987 { 947 // Then the selected events
988 const LLItemInfo& event = *e; 948 for (e = gWorldMap->mPGEvents.begin(); e != gWorldMap->mPGEvents.end(); ++e)
989 949 {
990 // Draw, but without relative-Z icons 950 if (e->mSelected)
991 if (!event.mSelected) 951 {
992 { 952 drawGenericItem(*e, sEventImage);
993 LLVector3 pos_map = globalPosToView( event.mPosGlobal ); 953 }
994 gl_draw_image(llround(pos_map.mV[VX]) - sEventMatureImage->getWidth()/2, 954 }
995 llround(pos_map.mV[VY]) - sEventMatureImage->getHeight()/2, 955 if (show_mature)
996 sEventMatureImage, 956 {
997 LLColor4::white); 957 for (e = gWorldMap->mMatureEvents.begin(); e != gWorldMap->mMatureEvents.end(); ++e)
998 } 958 {
999 } 959 if (e->mSelected)
1000 } 960 {
1001 961 drawGenericItem(*e, sEventMatureImage);
1002 // Selected events 962 }
1003 // Draw under avatar so you can find yourself. 963 }
1004 for (e = gWorldMap->mPGEvents.begin(); e != gWorldMap->mPGEvents.end(); ++e) 964 }
1005 {
1006 const LLItemInfo& event = *e;
1007
1008 // Draw, but without relative-Z icons
1009 if (event.mSelected)
1010 {
1011 LLVector3 pos_map = globalPosToView( event.mPosGlobal );
1012 gl_draw_image(llround(pos_map.mV[VX]) - sEventImage->getWidth()/2,
1013 llround(pos_map.mV[VY]) - sEventImage->getHeight()/2,
1014 sEventImage,
1015 LLColor4::white);
1016
1017 //drawIconName(
1018 // pos_map.mV[VX],
1019 // pos_map.mV[VY],
1020 // gEventColor,
1021 // event.mToolTip.c_str(),
1022 // event.mName.c_str() );
1023 }
1024 }
1025 if (show_mature)
1026 {
1027 for (e = gWorldMap->mMatureEvents.begin(); e != gWorldMap->mMatureEvents.end(); ++e)
1028 {
1029 const LLItemInfo& event = *e;
1030
1031 // Draw, but without relative-Z icons
1032 if (event.mSelected)
1033 {
1034 LLVector3 pos_map = globalPosToView( event.mPosGlobal );
1035 gl_draw_image(llround(pos_map.mV[VX]) - sEventMatureImage->getWidth()/2,
1036 llround(pos_map.mV[VY]) - sEventMatureImage->getHeight()/2,
1037 sEventMatureImage,
1038 LLColor4::white);
1039
1040 //drawIconName(
1041 // pos_map.mV[VX],
1042 // pos_map.mV[VY],
1043 // gEventColor,
1044 // event.mToolTip.c_str(),
1045 // event.mName.c_str() );
1046 }
1047 }
1048 }
1049}
1050
1051void LLWorldMapView::drawDots()
1052{
1053
1054} 965}
1055 966
1056 967
@@ -1143,11 +1054,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
1143 } 1054 }
1144 else 1055 else
1145 { 1056 {
1146 // Draw, but without relative Z 1057 drawImage(pos_global, sTrackCircleImage, color);
1147 gl_draw_image(x - sTrackCircleImage->getWidth()/2,
1148 y - sTrackCircleImage->getHeight()/2,
1149 sTrackCircleImage,
1150 color);
1151 } 1058 }
1152 1059
1153 // clamp text position to on-screen 1060 // clamp text position to on-screen
@@ -1271,50 +1178,38 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_
1271 1178
1272// Pass relative Z of 0 to draw at same level. 1179// Pass relative Z of 0 to draw at same level.
1273// static 1180// static
1274void LLWorldMapView::drawAvatar(F32 x_pixels, 1181static void drawDot(F32 x_pixels, F32 y_pixels,
1275 F32 y_pixels, 1182 const LLColor4& color,
1276 const LLColor4& color, 1183 F32 relative_z,
1277 F32 relative_z, 1184 F32 dot_radius,
1278 F32 dot_radius) 1185 LLPointer<LLViewerImage> dot_image)
1279{ 1186{
1280 F32 left = x_pixels - dot_radius;
1281 F32 right = x_pixels + dot_radius;
1282 F32 center = (left + right) * 0.5f;
1283 F32 top = y_pixels + dot_radius;
1284 F32 bottom = y_pixels - dot_radius;
1285
1286 const F32 HEIGHT_THRESHOLD = 7.f; 1187 const F32 HEIGHT_THRESHOLD = 7.f;
1287 1188
1288 if (relative_z > HEIGHT_THRESHOLD) 1189 if(-HEIGHT_THRESHOLD <= relative_z && relative_z <= HEIGHT_THRESHOLD)
1289 {
1290 LLGLSNoTexture gls_no_texture;
1291 glColor4fv( color.mV );
1292 LLUI::setLineWidth(1.5f);
1293 glBegin( GL_LINES );
1294 glVertex2f(left, top);
1295 glVertex2f(right, top);
1296 glVertex2f(center, top);
1297 glVertex2f(center, bottom);
1298 glEnd();
1299 LLUI::setLineWidth(1.0f);
1300 }
1301 else if (relative_z > -HEIGHT_THRESHOLD)
1302 { 1190 {
1303 gl_draw_image( llround(x_pixels) - sAvatarSmallImage->getWidth()/2, 1191 gl_draw_image( llround(x_pixels) - dot_image->getWidth()/2,
1304 llround(y_pixels) - sAvatarSmallImage->getHeight()/2, 1192 llround(y_pixels) - dot_image->getHeight()/2,
1305 sAvatarSmallImage, 1193 dot_image,
1306 color); 1194 color);
1307 } 1195 }
1308 else 1196 else
1309 { 1197 {
1198 F32 left = x_pixels - dot_radius;
1199 F32 right = x_pixels + dot_radius;
1200 F32 center = (left + right) * 0.5f;
1201 F32 top = y_pixels + dot_radius;
1202 F32 bottom = y_pixels - dot_radius;
1203
1310 LLGLSNoTexture gls_no_texture; 1204 LLGLSNoTexture gls_no_texture;
1311 glColor4fv( color.mV ); 1205 glColor4fv( color.mV );
1312 LLUI::setLineWidth(1.5f); 1206 LLUI::setLineWidth(1.5f);
1207 F32 h_bar = relative_z > HEIGHT_THRESHOLD ? top : bottom; // horizontal bar Y
1313 glBegin( GL_LINES ); 1208 glBegin( GL_LINES );
1209 glVertex2f(left, h_bar);
1210 glVertex2f(right, h_bar);
1314 glVertex2f(center, top); 1211 glVertex2f(center, top);
1315 glVertex2f(center, bottom); 1212 glVertex2f(center, bottom);
1316 glVertex2f(left, bottom);
1317 glVertex2f(right, bottom);
1318 glEnd(); 1213 glEnd();
1319 LLUI::setLineWidth(1.0f); 1214 LLUI::setLineWidth(1.0f);
1320 } 1215 }
@@ -1322,53 +1217,37 @@ void LLWorldMapView::drawAvatar(F32 x_pixels,
1322 1217
1323// Pass relative Z of 0 to draw at same level. 1218// Pass relative Z of 0 to draw at same level.
1324// static 1219// static
1220void LLWorldMapView::drawAvatar(F32 x_pixels,
1221 F32 y_pixels,
1222 const LLColor4& color,
1223 F32 relative_z,
1224 F32 dot_radius)
1225{
1226 const F32 HEIGHT_THRESHOLD = 7.f;
1227 LLViewerImage* dot_image = sAvatarSmallImage;
1228 if(relative_z < -HEIGHT_THRESHOLD)
1229 {
1230 dot_image = sAvatarBelowImage;
1231 }
1232 else if(relative_z > HEIGHT_THRESHOLD)
1233 {
1234 dot_image = sAvatarAboveImage;
1235 }
1236 gl_draw_image(
1237 llround(x_pixels) - dot_image->getWidth()/2,
1238 llround(y_pixels) - dot_image->getHeight()/2,
1239 dot_image, color);
1240}
1241
1242// Pass relative Z of 0 to draw at same level.
1243// static
1325void LLWorldMapView::drawTrackingDot( F32 x_pixels, 1244void LLWorldMapView::drawTrackingDot( F32 x_pixels,
1326 F32 y_pixels, 1245 F32 y_pixels,
1327 const LLColor4& color, 1246 const LLColor4& color,
1328 F32 relative_z, 1247 F32 relative_z,
1329 F32 dot_radius) 1248 F32 dot_radius)
1330{ 1249{
1331 F32 left = x_pixels - dot_radius; 1250 drawDot(x_pixels, y_pixels, color, relative_z, dot_radius, sTrackCircleImage);
1332 F32 right = x_pixels + dot_radius;
1333 F32 center = (left + right) * 0.5f;
1334 F32 top = y_pixels + dot_radius;
1335 F32 bottom = y_pixels - dot_radius;
1336
1337 const F32 HEIGHT_THRESHOLD = 7.f;
1338
1339 if (relative_z > HEIGHT_THRESHOLD)
1340 {
1341 LLGLSNoTexture gls_no_texture;
1342 glColor4fv( color.mV );
1343 LLUI::setLineWidth(1.5f);
1344 glBegin( GL_LINES );
1345 glVertex2f(left, top);
1346 glVertex2f(right, top);
1347 glVertex2f(center, top);
1348 glVertex2f(center, bottom);
1349 glEnd();
1350 LLUI::setLineWidth(1.0f);
1351 }
1352 else if (relative_z > -HEIGHT_THRESHOLD)
1353 {
1354 gl_draw_image( llround(x_pixels) - sAvatarSmallImage->getWidth()/2,
1355 llround(y_pixels) - sAvatarSmallImage->getHeight()/2,
1356 sTrackCircleImage,
1357 color);
1358 }
1359 else
1360 {
1361 LLGLSNoTexture gls_no_texture;
1362 glColor4fv( color.mV );
1363 LLUI::setLineWidth(1.5f);
1364 glBegin( GL_LINES );
1365 glVertex2f(center, top);
1366 glVertex2f(center, bottom);
1367 glVertex2f(left, bottom);
1368 glVertex2f(right, bottom);
1369 glEnd();
1370 LLUI::setLineWidth(1.0f);
1371 }
1372} 1251}
1373 1252
1374 1253