00001
00032 #include "llviewerprecompiledheaders.h"
00033
00034
00035 #include "llcoord.h"
00036 #include "lldarray.h"
00037 #include "llfontgl.h"
00038 #include "llgl.h"
00039 #include "llinventory.h"
00040 #include "llmemory.h"
00041 #include "llstring.h"
00042 #include "lluuid.h"
00043 #include "v3math.h"
00044 #include "v3dmath.h"
00045 #include "v4color.h"
00046
00047
00048 #include "viewer.h"
00049 #include "lltracker.h"
00050 #include "llagent.h"
00051 #include "llcallingcard.h"
00052 #include "llcolorscheme.h"
00053 #include "llcylinder.h"
00054 #include "llfloaterworldmap.h"
00055 #include "llhudtext.h"
00056 #include "llhudview.h"
00057 #include "llinventorymodel.h"
00058 #include "lllandmarklist.h"
00059 #include "llsky.h"
00060 #include "llui.h"
00061 #include "llviewercamera.h"
00062 #include "llviewerinventory.h"
00063 #include "llworld.h"
00064 #include "llworldmapview.h"
00065
00066 const F32 DESTINATION_REACHED_RADIUS = 3.0f;
00067 const F32 DESTINATION_VISITED_RADIUS = 6.0f;
00068
00069
00070
00071 const F32 DESTINATION_UNVISITED_RADIUS = 12.0f;
00072
00073 const S32 ARROW_OFF_RADIUS_SQRD = 100;
00074
00075 const S32 HUD_ARROW_SIZE = 32;
00076
00077
00078 LLTracker *LLTracker::sTrackerp = NULL;
00079 BOOL LLTracker::sCheesyBeacon = FALSE;
00080
00081 LLTracker::LLTracker()
00082 : mTrackingStatus(TRACKING_NOTHING),
00083 mTrackingLocationType(LOCATION_NOTHING),
00084 mHUDArrowCenterX(0),
00085 mHUDArrowCenterY(0),
00086 mToolTip( "" ),
00087 mTrackedLandmarkName(""),
00088 mHasReachedLandmark(FALSE),
00089 mHasLandmarkPosition(FALSE),
00090 mLandmarkHasBeenVisited(FALSE),
00091 mTrackedLocationName( "" ),
00092 mIsTrackingLocation(FALSE)
00093 { }
00094
00095
00096 LLTracker::~LLTracker()
00097 {
00098 purgeBeaconText();
00099 }
00100
00101
00102
00103 void LLTracker::stopTracking(void* userdata)
00104 {
00105 BOOL clear_ui = ((BOOL)(intptr_t)userdata);
00106 instance()->stopTrackingAll(clear_ui);
00107 }
00108
00109
00110
00111 void LLTracker::drawHUDArrow()
00112 {
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 switch (getTrackingStatus())
00123 {
00124 case TRACKING_AVATAR:
00125
00126 if(LLAvatarTracker::instance().haveTrackingInfo())
00127 {
00128 instance()->drawMarker( LLAvatarTracker::instance().getGlobalPos(), gTrackColor );
00129 }
00130 break;
00131
00132 case TRACKING_LANDMARK:
00133 instance()->drawMarker( getTrackedPositionGlobal(), gTrackColor );
00134 break;
00135
00136 case TRACKING_LOCATION:
00137 if (!gWorldp)
00138 {
00139 break;
00140 }
00141
00142 #if 0
00143
00144 instance()->mTrackedPositionGlobal.mdV[VZ] =
00145 0.9f * instance()->mTrackedPositionGlobal.mdV[VZ]
00146 + 0.1f * (gWorldp->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f);
00147 #endif
00148 instance()->mTrackedPositionGlobal.mdV[VZ] = llclamp((F32)instance()->mTrackedPositionGlobal.mdV[VZ], gWorldp->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f, (F32)instance()->getTrackedPositionGlobal().mdV[VZ]);
00149 instance()->drawMarker( getTrackedPositionGlobal(), gTrackColor );
00150 break;
00151
00152 default:
00153 break;
00154 }
00155 }
00156
00157
00158
00159 void LLTracker::render3D()
00160 {
00161 if (!gFloaterWorldMap)
00162 {
00163 return;
00164 }
00165
00166
00167 if( instance()->mIsTrackingLocation )
00168 {
00169 if (!instance()->mBeaconText)
00170 {
00171 instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
00172 instance()->mBeaconText->setDoFade(FALSE);
00173 }
00174
00175 LLVector3d pos_global = instance()->mTrackedPositionGlobal;
00176
00177
00178 F32 dist = gFloaterWorldMap->getDistanceToDestination(pos_global, 0.5f);
00179 if (dist < DESTINATION_REACHED_RADIUS)
00180 {
00181 instance()->stopTrackingLocation();
00182 }
00183 else
00184 {
00185 renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor,
00186 instance()->mBeaconText, instance()->mTrackedLocationName );
00187 }
00188 }
00189
00190
00191 else if( !instance()->mTrackedLandmarkAssetID.isNull() )
00192 {
00193 if (!instance()->mBeaconText)
00194 {
00195 instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
00196 instance()->mBeaconText->setDoFade(FALSE);
00197 }
00198
00199 if (instance()->mHasLandmarkPosition)
00200 {
00201 F32 dist = gFloaterWorldMap->getDistanceToDestination(instance()->mTrackedPositionGlobal, 1.0f);
00202
00203 if ( !instance()->mLandmarkHasBeenVisited
00204 && dist < DESTINATION_VISITED_RADIUS )
00205 {
00206
00207 instance()->setLandmarkVisited();
00208 }
00209
00210 if ( !instance()->mHasReachedLandmark
00211 && dist < DESTINATION_REACHED_RADIUS )
00212 {
00213
00214 instance()->stopTrackingLandmark();
00215 }
00216 else
00217 {
00218 if ( instance()->mHasReachedLandmark
00219 && dist > DESTINATION_UNVISITED_RADIUS )
00220 {
00221
00222
00223
00224
00225 instance()->mHasReachedLandmark = FALSE;
00226 }
00227 renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor,
00228 instance()->mBeaconText, instance()->mTrackedLandmarkName );
00229 }
00230 }
00231 else
00232 {
00233
00234 instance()->cacheLandmarkPosition();
00235 }
00236 }
00237 else
00238 {
00239
00240 LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
00241 if(av_tracker.haveTrackingInfo())
00242 {
00243 if (!instance()->mBeaconText)
00244 {
00245 instance()->mBeaconText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
00246 instance()->mBeaconText->setDoFade(FALSE);
00247 }
00248
00249 F32 dist = gFloaterWorldMap->getDistanceToDestination(instance()->mTrackedPositionGlobal, 0.0f);
00250 if (dist < DESTINATION_REACHED_RADIUS)
00251 {
00252 instance()->stopTrackingAvatar();
00253 }
00254 else
00255 {
00256 renderBeacon( av_tracker.getGlobalPos(), gTrackColor,
00257 instance()->mBeaconText, av_tracker.getName() );
00258 }
00259 }
00260 else
00261 {
00262 BOOL stop_tracking = FALSE;
00263 const LLUUID& avatar_id = av_tracker.getAvatarID();
00264 if(avatar_id.isNull())
00265 {
00266 stop_tracking = TRUE;
00267 }
00268 else
00269 {
00270 const LLRelationship* buddy = av_tracker.getBuddyInfo(avatar_id);
00271 if(buddy && !buddy->isOnline() && !gAgent.isGodlike())
00272 {
00273 stop_tracking = TRUE;
00274 }
00275 if(!buddy && !gAgent.isGodlike())
00276 {
00277 stop_tracking = TRUE;
00278 }
00279 }
00280 if(stop_tracking)
00281 {
00282 instance()->stopTrackingAvatar();
00283 }
00284 }
00285 }
00286 }
00287
00288
00289
00290 void LLTracker::trackAvatar( const LLUUID& avatar_id, const LLString& name )
00291 {
00292 instance()->stopTrackingLandmark();
00293 instance()->stopTrackingLocation();
00294
00295 LLAvatarTracker::instance().track( avatar_id, name );
00296 instance()->mTrackingStatus = TRACKING_AVATAR;
00297 instance()->mLabel = name;
00298 }
00299
00300
00301
00302 void LLTracker::trackLandmark( const LLUUID& asset_id, const LLUUID& item_id, const LLString& name)
00303 {
00304 instance()->stopTrackingAvatar();
00305 instance()->stopTrackingLocation();
00306
00307 instance()->mTrackedLandmarkAssetID = asset_id;
00308 instance()->mTrackedLandmarkItemID = item_id;
00309 instance()->mTrackedLandmarkName = name;
00310 instance()->cacheLandmarkPosition();
00311 instance()->mTrackingStatus = TRACKING_LANDMARK;
00312 instance()->mLabel = name;
00313 }
00314
00315
00316
00317 void LLTracker::trackLocation(const LLVector3d& pos_global, const LLString& full_name, const LLString& tooltip, ETrackingLocationType location_type)
00318 {
00319 instance()->stopTrackingAvatar();
00320 instance()->stopTrackingLandmark();
00321
00322 instance()->mTrackedPositionGlobal = pos_global;
00323 instance()->mTrackedLocationName = full_name;
00324 instance()->mIsTrackingLocation = TRUE;
00325 instance()->mTrackingStatus = TRACKING_LOCATION;
00326 instance()->mTrackingLocationType = location_type;
00327 instance()->mLabel = full_name;
00328 instance()->mToolTip = tooltip;
00329 }
00330
00331
00332
00333 BOOL LLTracker::handleMouseDown(S32 x, S32 y)
00334 {
00335 BOOL eat_mouse_click = FALSE;
00336
00337 S32 dist_sqrd = (x - instance()->mHUDArrowCenterX) * (x - instance()->mHUDArrowCenterX) +
00338 (y - instance()->mHUDArrowCenterY) * (y - instance()->mHUDArrowCenterY);
00339 if (dist_sqrd < ARROW_OFF_RADIUS_SQRD)
00340 {
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350 if (getTrackingStatus())
00351 {
00352 instance()->stopTrackingAll();
00353 eat_mouse_click = TRUE;
00354 }
00355 }
00356 return eat_mouse_click;
00357 }
00358
00359
00360
00361 LLVector3d LLTracker::getTrackedPositionGlobal()
00362 {
00363 LLVector3d pos_global;
00364 switch (getTrackingStatus())
00365 {
00366 case TRACKING_AVATAR:
00367 {
00368 LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
00369 if (av_tracker.haveTrackingInfo())
00370 {
00371 pos_global = av_tracker.getGlobalPos(); }
00372 break;
00373 }
00374 case TRACKING_LANDMARK:
00375 if( instance()->mHasLandmarkPosition )
00376 {
00377 pos_global = instance()->mTrackedPositionGlobal;
00378 }
00379 break;
00380 case TRACKING_LOCATION:
00381 pos_global = instance()->mTrackedPositionGlobal;
00382 break;
00383 default:
00384 break;
00385 }
00386 return pos_global;
00387 }
00388
00389
00390
00391 BOOL LLTracker::hasLandmarkPosition()
00392 {
00393 if (!instance()->mHasLandmarkPosition)
00394 {
00395
00396 instance()->cacheLandmarkPosition();
00397 }
00398 return instance()->mHasLandmarkPosition;
00399 }
00400
00401
00402
00403 const LLString& LLTracker::getTrackedLocationName()
00404 {
00405 return instance()->mTrackedLocationName;
00406 }
00407
00408 F32 pulse_func(F32 t, F32 z)
00409 {
00410 if (!LLTracker::sCheesyBeacon)
00411 {
00412 return 0.f;
00413 }
00414
00415 t *= 3.14159f;
00416 z -= t*64.f - 256.f;
00417
00418 F32 a = cosf(z*3.14159/512.f)*10.0f;
00419 a = llmax(a, 9.9f);
00420 a -= 9.9f;
00421 a *= 10.f;
00422 return a;
00423 }
00424
00425 void draw_shockwave(F32 center_z, F32 t, S32 steps, LLColor4 color)
00426 {
00427 if (!LLTracker::sCheesyBeacon)
00428 {
00429 return;
00430 }
00431
00432 t *= 0.6284f/3.14159f;
00433
00434 t -= (F32) (S32) t;
00435
00436 t = llmax(t, 0.5f);
00437 t -= 0.5f;
00438 t *= 2.0f;
00439
00440 F32 radius = t*16536.f;
00441
00442
00443 F32 delta = F_TWO_PI / steps;
00444 F32 sin_delta = sin( delta );
00445 F32 cos_delta = cos( delta );
00446 F32 x = radius;
00447 F32 y = 0.f;
00448
00449 LLColor4 ccol = LLColor4(1,1,1,(1.f-t)*0.25f);
00450 glBegin(GL_TRIANGLE_FAN);
00451 glColor4fv(ccol.mV);
00452 glVertex3f(0.f, 0.f, center_z);
00453
00454 steps += 1;
00455
00456 color.mV[3] = (1.f-t*t);
00457
00458 glColor4fv(color.mV);
00459 while( steps-- )
00460 {
00461
00462 glVertex3f( x, y, center_z );
00463 F32 x_new = x * cos_delta - y * sin_delta;
00464 y = x * sin_delta + y * cos_delta;
00465 x = x_new;
00466 }
00467 glEnd();
00468 }
00469
00470
00471
00472 void LLTracker::renderBeacon(LLVector3d pos_global,
00473 const LLColor4& color,
00474 LLHUDText* hud_textp,
00475 const std::string& label )
00476 {
00477 sCheesyBeacon = gSavedSettings.getBOOL("CheesyBeacon");
00478 LLVector3d to_vec = pos_global - gAgent.getCameraPositionGlobal();
00479
00480 F32 dist = (F32)to_vec.magVec();
00481 F32 color_frac = 1.f;
00482 if (dist > 0.99f * gCamera->getFar())
00483 {
00484 color_frac = 0.4f;
00485
00486 }
00487 else
00488 {
00489 color_frac = 1.f - 0.6f*(dist/gCamera->getFar());
00490 }
00491
00492 LLColor4 fogged_color = color_frac * color + (1 - color_frac)*gSky.getFogColor();
00493
00494 F32 FADE_DIST = 3.f;
00495 fogged_color.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST));
00496
00497 LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(pos_global);
00498
00499 LLGLSTracker gls_tracker;
00500 LLGLDisable cull_face(GL_CULL_FACE);
00501 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
00502
00503
00504 glMatrixMode(GL_MODELVIEW);
00505 glPushMatrix();
00506 glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
00507
00508 draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color);
00509
00510
00511 glColor4fv(fogged_color.mV);
00512 const U32 BEACON_VERTS = 256;
00513 const F32 step = 1024.0f/BEACON_VERTS;
00514
00515 LLVector3 x_axis = gCamera->getLeftAxis();
00516 F32 t = gRenderStartTime.getElapsedTimeF32();
00517 F32 dr = dist/gCamera->getFar();
00518
00519 for (U32 i = 0; i < BEACON_VERTS; i++)
00520 {
00521 F32 x = x_axis.mV[0];
00522 F32 y = x_axis.mV[1];
00523
00524 F32 z = i * step;
00525 F32 z_next = (i+1)*step;
00526
00527 F32 a = pulse_func(t, z);
00528 F32 an = pulse_func(t, z_next);
00529
00530 LLColor4 c_col = fogged_color + LLColor4(a,a,a,a);
00531 LLColor4 col_next = fogged_color + LLColor4(an,an,an,an);
00532 LLColor4 col_edge = fogged_color * LLColor4(a,a,a,0.0f);
00533 LLColor4 col_edge_next = fogged_color * LLColor4(an,an,an,0.0f);
00534
00535 a *= 2.f;
00536 a += 1.0f+dr;
00537
00538 an *= 2.f;
00539 an += 1.0f+dr;
00540
00541 glBegin(GL_TRIANGLE_STRIP);
00542 glColor4fv(col_edge.mV);
00543 glVertex3f(-x*a, -y*a, z);
00544 glColor4fv(col_edge_next.mV);
00545 glVertex3f(-x*an, -y*an, z_next);
00546
00547 glColor4fv(c_col.mV);
00548 glVertex3f(0, 0, z);
00549 glColor4fv(col_next.mV);
00550 glVertex3f(0, 0, z_next);
00551
00552 glColor4fv(col_edge.mV);
00553 glVertex3f(x*a,y*a,z);
00554 glColor4fv(col_edge_next.mV);
00555 glVertex3f(x*an,y*an,z_next);
00556
00557 glEnd();
00558 }
00559
00560
00561 glPopMatrix();
00562
00563 char text[1024];
00564 snprintf(text, sizeof(text), "%.0f m", to_vec.magVec());
00565
00566 LLWString wstr;
00567 wstr += utf8str_to_wstring(label);
00568 wstr += '\n';
00569 wstr += utf8str_to_wstring(text);
00570
00571 hud_textp->setFont(LLFontGL::sSansSerif);
00572 hud_textp->setZCompare(FALSE);
00573 hud_textp->setColor(LLColor4(1.f, 1.f, 1.f, llmax(0.2f, llmin(1.f,(dist-FADE_DIST)/FADE_DIST))));
00574
00575 hud_textp->setString(wstr);
00576 hud_textp->setVertAlignment(LLHUDText::ALIGN_VERT_CENTER);
00577 hud_textp->setPositionAgent(pos_agent);
00578 }
00579
00580
00581 void LLTracker::stopTrackingAll(BOOL clear_ui)
00582 {
00583 switch (mTrackingStatus)
00584 {
00585 case TRACKING_AVATAR :
00586 stopTrackingAvatar(clear_ui);
00587 break;
00588 case TRACKING_LANDMARK :
00589 stopTrackingLandmark(clear_ui);
00590 break;
00591 case TRACKING_LOCATION :
00592 stopTrackingLocation(clear_ui);
00593 break;
00594 default:
00595 mTrackingStatus = TRACKING_NOTHING;
00596 break;
00597 }
00598 }
00599
00600
00601 void LLTracker::stopTrackingAvatar(BOOL clear_ui)
00602 {
00603 LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
00604 if( !av_tracker.getAvatarID().isNull() )
00605 {
00606 av_tracker.untrack( av_tracker.getAvatarID() );
00607 }
00608
00609 purgeBeaconText();
00610 gFloaterWorldMap->clearAvatarSelection(clear_ui);
00611 mTrackingStatus = TRACKING_NOTHING;
00612 }
00613
00614
00615 void LLTracker::stopTrackingLandmark(BOOL clear_ui)
00616 {
00617 purgeBeaconText();
00618 mTrackedLandmarkAssetID.setNull();
00619 mTrackedLandmarkItemID.setNull();
00620 mTrackedLandmarkName.assign("");
00621 mTrackedPositionGlobal.zeroVec();
00622 mHasLandmarkPosition = FALSE;
00623 mHasReachedLandmark = FALSE;
00624 mLandmarkHasBeenVisited = TRUE;
00625 gFloaterWorldMap->clearLandmarkSelection(clear_ui);
00626 mTrackingStatus = TRACKING_NOTHING;
00627 }
00628
00629
00630 void LLTracker::stopTrackingLocation(BOOL clear_ui)
00631 {
00632 purgeBeaconText();
00633 mTrackedLocationName.assign("");
00634 mIsTrackingLocation = FALSE;
00635 mTrackedPositionGlobal.zeroVec();
00636 gFloaterWorldMap->clearLocationSelection(clear_ui);
00637 mTrackingStatus = TRACKING_NOTHING;
00638 mTrackingLocationType = LOCATION_NOTHING;
00639 }
00640
00641
00642 void LLTracker::drawMarker(const LLVector3d& pos_global, const LLColor4& color)
00643 {
00644 if (!gCamera)
00645 {
00646 return;
00647 }
00648
00649
00650 LLVector3 pos_local = gAgent.getPosAgentFromGlobal(pos_global);
00651
00652
00653 LLCoordGL screen;
00654 S32 x = 0;
00655 S32 y = 0;
00656 const BOOL CLAMP = TRUE;
00657
00658 if (gCamera->projectPosAgentToScreen(pos_local, screen, CLAMP)
00659 || gCamera->projectPosAgentToScreenEdge(pos_local, screen) )
00660 {
00661 gHUDView->screenPointToLocal(screen.mX, screen.mY, &x, &y);
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672 LLRect rect = gHUDView->getRect();
00673 S32 x_center = lltrunc(0.5f * (F32)rect.getWidth());
00674 S32 y_center = lltrunc(0.5f * (F32)rect.getHeight());
00675 x = x - x_center;
00676 y = y - y_center;
00677 F32 dist = sqrt((F32)(x*x + y*y));
00678 S32 half_arrow_size = lltrunc(0.5f * HUD_ARROW_SIZE);
00679 if (dist > 0.f)
00680 {
00681 const F32 ARROW_ELLIPSE_RADIUS_X = 2 * HUD_ARROW_SIZE;
00682 const F32 ARROW_ELLIPSE_RADIUS_Y = HUD_ARROW_SIZE;
00683
00684
00685 F32 x_target = (F32)(x + x_center) - (ARROW_ELLIPSE_RADIUS_X * ((F32)x / dist) );
00686 F32 y_target = (F32)(y + y_center) - (ARROW_ELLIPSE_RADIUS_Y * ((F32)y / dist) );
00687
00688
00689 F32 x_clamped = llclamp( x_target, (F32)half_arrow_size, (F32)(rect.getWidth() - half_arrow_size));
00690 F32 y_clamped = llclamp( y_target, (F32)half_arrow_size, (F32)(rect.getHeight() - half_arrow_size));
00691
00692 F32 slope = (F32)(y) / (F32)(x);
00693 F32 window_ratio = (F32)(rect.getHeight() - HUD_ARROW_SIZE) / (F32)(rect.getWidth() - HUD_ARROW_SIZE);
00694
00695
00696
00697 if (llabs(slope) > window_ratio)
00698 {
00699 if (y_clamped != (F32)y_target)
00700 {
00701
00702 x_clamped = (y_clamped - (F32)y_center) / slope + (F32)x_center;
00703 }
00704 }
00705 else if (x_clamped != (F32)x_target)
00706 {
00707
00708 y_clamped = (x_clamped - (F32)x_center) * slope + (F32)y_center;
00709 }
00710 mHUDArrowCenterX = lltrunc(x_clamped);
00711 mHUDArrowCenterY = lltrunc(y_clamped);
00712 }
00713 else
00714 {
00715
00716 x = mHUDArrowCenterX - x_center;
00717 y = mHUDArrowCenterY - y_center;
00718 }
00719
00720 F32 angle = atan2( (F32)y, (F32)x );
00721
00722 gl_draw_scaled_rotated_image(mHUDArrowCenterX - half_arrow_size,
00723 mHUDArrowCenterY - half_arrow_size,
00724 HUD_ARROW_SIZE, HUD_ARROW_SIZE,
00725 RAD_TO_DEG * angle,
00726 LLWorldMapView::sTrackArrowImage,
00727 color);
00728 }
00729 }
00730
00731
00732 void LLTracker::setLandmarkVisited()
00733 {
00734
00735 if (!mTrackedLandmarkItemID.isNull())
00736 {
00737 LLInventoryItem* i = gInventory.getItem( mTrackedLandmarkItemID );
00738 LLViewerInventoryItem* item = (LLViewerInventoryItem*)i;
00739 if ( item
00740 && !(item->getFlags()&LLInventoryItem::II_FLAGS_LANDMARK_VISITED))
00741 {
00742 U32 flags = item->getFlags();
00743 flags |= LLInventoryItem::II_FLAGS_LANDMARK_VISITED;
00744 item->setFlags(flags);
00745 LLMessageSystem* msg = gMessageSystem;
00746 msg->newMessage("ChangeInventoryItemFlags");
00747 msg->nextBlock("AgentData");
00748 msg->addUUID("AgentID", gAgent.getID());
00749 msg->addUUID("SessionID", gAgent.getSessionID());
00750 msg->nextBlock("InventoryData");
00751 msg->addUUID("ItemID", mTrackedLandmarkItemID);
00752 msg->addU32("Flags", flags);
00753 gAgent.sendReliableMessage();
00754
00755 LLInventoryModel::LLCategoryUpdate up(item->getParentUUID(), 0);
00756 gInventory.accountForUpdate(up);
00757
00758
00759 gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item->getUUID());
00760 gInventory.notifyObservers();
00761 }
00762 }
00763 }
00764
00765
00766 void LLTracker::cacheLandmarkPosition()
00767 {
00768
00769
00770 BOOL found_landmark = FALSE;
00771 if( mTrackedLandmarkAssetID == LLFloaterWorldMap::getHomeID())
00772 {
00773 LLVector3d pos_global;
00774 if ( gAgent.getHomePosGlobal( &mTrackedPositionGlobal ))
00775 {
00776 found_landmark = TRUE;
00777 }
00778 else
00779 {
00780 llwarns << "LLTracker couldn't find home pos" << llendl;
00781 mTrackedLandmarkAssetID.setNull();
00782 mTrackedLandmarkItemID.setNull();
00783 }
00784 }
00785 else
00786 {
00787 LLLandmark* landmark = gLandmarkList.getAsset(mTrackedLandmarkAssetID);
00788 if(landmark && landmark->getGlobalPos(mTrackedPositionGlobal))
00789 {
00790 found_landmark = TRUE;
00791
00792
00793 mLandmarkHasBeenVisited = FALSE;
00794 LLInventoryItem* item = gInventory.getItem(mTrackedLandmarkItemID);
00795 if ( item
00796 && item->getFlags()&LLInventoryItem::II_FLAGS_LANDMARK_VISITED)
00797 {
00798 mLandmarkHasBeenVisited = TRUE;
00799 }
00800 }
00801 }
00802 if ( found_landmark && gFloaterWorldMap )
00803 {
00804 mHasReachedLandmark = FALSE;
00805 F32 dist = gFloaterWorldMap->getDistanceToDestination(mTrackedPositionGlobal, 1.0f);
00806 if ( dist < DESTINATION_UNVISITED_RADIUS )
00807 {
00808 mHasReachedLandmark = TRUE;
00809 }
00810 mHasLandmarkPosition = TRUE;
00811 }
00812 mHasLandmarkPosition = found_landmark;
00813 }
00814
00815
00816 void LLTracker::purgeBeaconText()
00817 {
00818 if(!mBeaconText.isNull())
00819 {
00820 mBeaconText->markDead();
00821 mBeaconText = NULL;
00822 }
00823 }
00824