Large update to the worldmap. Essentially, v3 merge, and reimplemented legacy tile drawing and opensim-specific changes. Also added a diagnostic view.

This commit is contained in:
Shyotl
2012-11-24 11:21:29 -06:00
parent adebc36bc7
commit 5e6ed2dc9f
19 changed files with 2039 additions and 2244 deletions

View File

@@ -542,6 +542,7 @@ set(viewer_SOURCE_FILES
llwlparamset.cpp
llworld.cpp
llworldmap.cpp
llworldmapmessage.cpp
llworldmipmap.cpp
llworldmapview.cpp
llxmlrpctransaction.cpp
@@ -1050,6 +1051,7 @@ set(viewer_HEADER_FILES
llwlparamset.h
llworld.h
llworldmap.h
llworldmapmessage.h
llworldmipmap.h
llworldmapview.h
llxmlrpctransaction.h

View File

@@ -77,6 +77,7 @@
#include "llvoavatarself.h"
#include "llworld.h"
#include "llworldmap.h"
#include "llworldmapmessage.h"
//Misc non-standard includes
#include "llurldispatcher.h"
@@ -3688,7 +3689,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
(F32)(pos_global.mdV[VY] - region_origin.mdV[VY]),
(F32)(pos_global.mdV[VZ]));
pos_local += offset;
teleportRequest(info->getHandle(), pos_local);
teleportRequest(handle, pos_local);
}
else if(regionp &&
teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])))
@@ -3737,10 +3738,6 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global)
mbTeleportKeepsLookAt = true;
gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction
U64 region_handle = to_region_handle(pos_global);
LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle);
if(simInfo)
region_handle = simInfo->getHandle();
LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
teleportRequest(region_handle, pos_local, getTeleportKeepsLookAt());
}
@@ -4180,7 +4177,7 @@ void LLAgent::showLureDestination(const std::string fromname, const int global_x
{
U16 grid_x = (U16)(global_x / REGION_WIDTH_UNITS);
U16 grid_y = (U16)(global_y / REGION_WIDTH_UNITS);
LLWorldMap::getInstance()->sendMapBlockRequest(grid_x, grid_y, grid_x, grid_y, true); //Will call onFoundLureDestination on response
LLWorldMapMessage::getInstance()->sendMapBlockRequest(grid_x, grid_y, grid_x, grid_y, true); //Will call onFoundLureDestination on response
}
}

View File

@@ -504,7 +504,7 @@ static void settings_to_globals()
gAllowIdleAFK = gSavedSettings.getBOOL("AllowIdleAFK");
gAllowTapTapHoldRun = gSavedSettings.getBOOL("AllowTapTapHoldRun");
gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale");
LLWorldMapView::sMapScale = llmax(.1f,gSavedSettings.getF32("MapScale"));
LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips");
}

File diff suppressed because it is too large Load Diff

View File

@@ -111,29 +111,26 @@ public:
// teleport to the tracked item, if there is one
void teleport();
void onChangeMaturity();
protected:
static void onPanBtn( void* userdata );
static void onGoHome(void* data);
protected:
void onGoHome();
static void onLandmarkComboPrearrange( LLUICtrl* ctrl, void* data );
static void onLandmarkComboCommit( LLUICtrl* ctrl, void* data );
void onLandmarkComboCommit();
static void onAvatarComboPrearrange( LLUICtrl* ctrl, void* data );
static void onAvatarComboCommit( LLUICtrl* ctrl, void* data );
void onAvatarComboCommit();
static void onComboTextEntry( LLLineEditor* ctrl, void* data );
static void onSearchTextEntry( LLLineEditor* ctrl, void* data );
static void onClearBtn(void*);
static void onFlyBtn(void*);
static void onClickTeleportBtn(void*);
static void onShowTargetBtn(void*);
static void onShowAgentBtn(void*);
static void onCopySLURL(void*);
static void onCheckEvents(LLUICtrl* ctrl, void*);
void onClearBtn();
void onClickTeleportBtn();
static void onClickTeleportBtn_static(void* data) {((LLFloaterWorldMap*)data)->onClickTeleportBtn();};
void onShowTargetBtn();
void onShowAgentBtn();
void onCopySLURL();
void centerOnTarget(BOOL animate);
void updateLocation();
@@ -142,7 +139,6 @@ protected:
void fly();
void buildLandmarkIDLists();
static void onGoToLandmarkDialog(S32 option,void* userdata);
void flyToLandmark();
void teleportToLandmark();
void setLandmarkVisited();
@@ -152,24 +148,28 @@ protected:
void teleportToAvatar();
void updateSearchEnabled();
void onLocationFocusChanged( LLFocusableElement* focus );
static void onLocationCommit( void* userdata );
static void onCommitLocation( LLUICtrl* ctrl, void* userdata );
static void onCommitSearchResult( LLUICtrl* ctrl, void* userdata );
void onLocationFocusChanged( LLFocusableElement* ctrl );
void onLocationCommit();
void onCoordinatesCommit();
void onCommitSearchResult();
void cacheLandmarkPosition();
protected:
LLPanel* mPanel; // Panel displaying the map
private:
LLPanel* mPanel; // Panel displaying the map
// Sets sMapScale, in pixels per region
F32 mCurZoomVal;
F32 mCurZoomValInterpolationStart; // Used during mZoomTimer interpolation.
LLFrameTimer mZoomTimer;
// update display of teleport destination coordinates - pos is in global coordinates
void updateTeleportCoordsDisplay( const LLVector3d& pos );
// enable/disable teleport destination coordinates
void enableTeleportCoordsDisplay( bool enabled );
LLDynamicArray<LLUUID> mLandmarkAssetIDList;
LLDynamicArray<LLUUID> mLandmarkItemIDList;
BOOL mHasLandmarkPosition;
static const LLUUID sHomeID;
@@ -178,9 +178,12 @@ protected:
LLFriendObserver* mFriendObserver;
std::string mCompletingRegionName;
// Local position from trackURL() request, used to select final
// position once region lookup complete.
LLVector3 mCompletingRegionPos;
std::string mLastRegionName;
BOOL mWaitingForTracker;
BOOL mExactMatch;
BOOL mIsClosing;
BOOL mSetToUserPosition;
@@ -190,6 +193,10 @@ protected:
std::string mTrackedSimName;
std::string mTrackedAvatarName;
std::string mSLURL;
LLCtrlListInterface * mListFriendCombo;
LLCtrlListInterface * mListLandmarkCombo;
LLCtrlListInterface * mListSearchResults;
};
extern LLFloaterWorldMap* gFloaterWorldMap;

View File

@@ -38,6 +38,8 @@
#include "llviewertexturelist.h"
#include "llworldmap.h"
#include "llagent.h"
#include "llworldmapmessage.h"
#include "llsdserialize.h"
//virtual
void LLMapLayerResponder::result(const LLSD& result)
@@ -45,22 +47,19 @@ void LLMapLayerResponder::result(const LLSD& result)
llinfos << "LLMapLayerResponder::result from capabilities" << llendl;
S32 agent_flags = result["AgentData"]["Flags"];
if (agent_flags != LLWorldMap::getInstance()->mCurrentMap)
U32 layer = flagsToLayer(agent_flags);
if (layer != SIM_LAYER_COMPOSITE)
{
llwarns << "Invalid or out of date map image type returned!" << llendl;
return;
}
LLUUID image_id;
//U32 left, right, top, bottom;
LLWorldMap::getInstance()->mMapLayers[agent_flags].clear();
bool use_web_map_tiles = LLWorldMap::useWebMapTiles();
LLWorldMap::getInstance()->mMapLayers.clear();
LLSD::array_const_iterator iter;
BOOL adjust = FALSE;
for(iter = result["LayerData"].beginArray(); iter != result["LayerData"].endArray(); ++iter)
{
const LLSD& layer_data = *iter;
@@ -74,146 +73,12 @@ void LLMapLayerResponder::result(const LLSD& result)
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 = LLViewerTextureManager::getFetchedTexture(new_layer.LayerImageID);
// }
new_layer.LayerImage = LLViewerTextureManager::getFetchedTexture(new_layer.LayerImageID);
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),
U32(x_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getWidth()),
U32(y_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getHeight())) || adjust;
LLWorldMap::getInstance()->mMapLayers[agent_flags].push_back(new_layer);
LLWorldMap::getInstance()->mMapLayers.push_back(new_layer);
}
LLWorldMap::getInstance()->mMapLoaded[agent_flags] = TRUE;
if(adjust) gFloaterWorldMap->adjustZoomSliderBounds();
/*
U32 agent_flags;
msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags);
if (agent_flags < 0 || agent_flags >= MAP_SIM_IMAGE_TYPES)
{
llwarns << "Invalid map image type returned! " << agent_flags << llendl;
return;
}
*/
bool found_null_sim = false;
adjust = FALSE;
if (result.has("MapBlocks"))
{
const LLSD& map_blocks = result["MapBlocks"];
for (iter = map_blocks.beginArray(); iter != map_blocks.endArray(); ++iter)
{
const LLSD& map_block = *iter;
S32 x_regions = map_block["X"];
S32 y_regions = map_block["Y"];
S32 x_size = map_block["SizeX"];
S32 y_size = map_block["SizeY"];
std::string name = map_block["Name"];
S32 access = map_block["Access"];
S32 region_flags = map_block["RegionFlags"];
S32 water_height = map_block["WaterHeight"];
LLUUID image_id = map_block["MapImageID"];
U32 x_meters = x_regions * REGION_WIDTH_UNITS;
U32 y_meters = y_regions * REGION_WIDTH_UNITS;
if (access == 255)
{
// This region doesn't exist
if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation &&
LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters &&
LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 &&
LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters &&
LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256)
{
// We were tracking this location, but it doesn't exist
LLWorldMap::getInstance()->mInvalidLocation = TRUE;
}
found_null_sim = true;
}
else
{
adjust = LLWorldMap::getInstance()->extendAABB(x_meters,
y_meters,
x_meters+REGION_WIDTH_UNITS,
y_meters+REGION_WIDTH_UNITS) || adjust;
U64 handle = to_region_handle(x_meters, y_meters);
// llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl;
LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
if (siminfo == NULL)
{
siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle);
}
siminfo->setName( name );
siminfo->setAccess( access ); /*Flawfinder: ignore*/
siminfo->setRegionFlags( region_flags );
siminfo->setWaterHeight( (F32) water_height );
siminfo->setMapImageID( image_id, agent_flags );
siminfo->setSize((U16)x_size, (U16)y_size);
if (use_web_map_tiles)
{
siminfo->mCurrentImage = LLWorldMap::loadObjectsTile((U32)x_regions, (U32)y_regions);
}
else
{
siminfo->mCurrentImage = LLViewerTextureManager::getFetchedTexture(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap]);
}
siminfo->mCurrentImage->setAddressMode(LLTexUnit::TAM_CLAMP);
gGL.getTexUnit(0)->bind(siminfo->mCurrentImage.get());
if (siminfo->mMapImageID[2].notNull())
{
siminfo->mOverlayImage = LLViewerTextureManager::getFetchedTexture(siminfo->mMapImageID[2]);
}
else
{
siminfo->mOverlayImage = NULL;
}
if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation &&
LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters &&
LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 &&
LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters &&
LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256)
{
if (siminfo->isDown())
{
// We were tracking this location, but it doesn't exist
LLWorldMap::getInstance()->mInvalidLocation = true;
}
else
{
// We were tracking this location, and it does exist
bool is_tracking_dbl = LLWorldMap::getInstance()->mIsTrackingDoubleClick == TRUE;
gFloaterWorldMap->trackLocation(LLWorldMap::getInstance()->mUnknownLocation);
if (is_tracking_dbl)
{
LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
gAgent.teleportViaLocation( pos_global );
}
}
}
}
}
}
if(adjust) gFloaterWorldMap->adjustZoomSliderBounds();
gFloaterWorldMap->updateSims(found_null_sim);
LLWorldMap::getInstance()->mMapLoaded = true;
}

View File

@@ -190,6 +190,7 @@
#include "llwind.h"
#include "llworld.h"
#include "llworldmap.h"
#include "llworldmapmessage.h"
#include "llxfermanager.h"
#include "pipeline.h"
#include "llappviewer.h"
@@ -3392,8 +3393,8 @@ void register_viewer_callbacks(LLMessageSystem* msg)
msg->setHandlerFunc("AvatarPickerReply", LLFloaterAvatarPicker::processAvatarPickerReply);
msg->setHandlerFunc("MapLayerReply", LLWorldMap::processMapLayerReply);
msg->setHandlerFunc("MapBlockReply", LLWorldMap::processMapBlockReply);
msg->setHandlerFunc("MapItemReply", LLWorldMap::processMapItemReply);
msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply);
msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply);
msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply);
msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);

View File

@@ -81,7 +81,7 @@ public:
// these are static so that they can be used a callbacks
static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; }
static BOOL isTracking(void*) { return (BOOL) instance()->mTrackingStatus; }
static BOOL isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; }
static void stopTracking(void*);
static void clearFocus();

View File

@@ -45,6 +45,7 @@
#include "llurlsimstring.h"
#include "llweb.h"
#include "llworldmap.h"
#include "llworldmapmessage.h"
// library includes
#include "llsd.h"
@@ -243,7 +244,7 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mous
url_displayp->setName(region_name);
// Request a region handle by name
LLWorldMap::getInstance()->sendNamedRegionRequest(region_name,
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
LLURLDispatcherImpl::regionNameCallback,
url,
false); // don't teleport
@@ -282,7 +283,7 @@ void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::strin
LLVector3d global_pos = from_region_handle(region_handle) + LLVector3d(local_pos);
U64 new_region_handle = to_region_handle(global_pos);
LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle,
LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle,
LLURLDispatcherImpl::regionHandleCallback,
url, teleport);
}
@@ -401,7 +402,7 @@ public:
{
url += tokens[i].asString() + "/";
}
LLWorldMap::getInstance()->sendNamedRegionRequest(region_name,
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
LLURLDispatcherImpl::regionHandleCallback,
url,
true); // teleport

View File

@@ -3596,7 +3596,6 @@ void set_god_level(U8 god_level)
// God mode changes region visibility
LLWorldMap::getInstance()->reset();
LLWorldMap::getInstance()->setCurrentLayer(0);
// inventory in items may change in god mode
gObjectList.dirtyAllObjectInventory();

File diff suppressed because it is too large Load Diff

View File

@@ -51,39 +51,80 @@
class LLMessageSystem;
// Description of objects like hubs, events, land for sale, people and more (TBD).
// Note: we don't store a "type" in there so we need to store instances of this class in
// well known objects (i.e. list of objects which type is "well known").
class LLItemInfo
{
public:
LLItemInfo(F32 global_x, F32 global_y, const std::string& name, LLUUID id, S32 extra = 0, S32 extra2 = 0);
LLItemInfo(F32 global_x, F32 global_y, const std::string& name, LLUUID id);
// Setters
void setTooltip(const std::string& tooltip) { mToolTip = tooltip; }
void setElevation(F64 z) { mPosGlobal.mdV[VZ] = z; }
void setCount(S32 count) { mCount = count; }
// void setSelected(bool selected) { mSelected = selected; }
// void setColor(LLColor4 color) { mColor = color; }
// Accessors
const LLVector3d& getGlobalPosition() const { return mPosGlobal; }
const std::string& getName() const { return mName; }
const std::string& getToolTip() const { return mToolTip; }
const LLUUID& getUUID() const { return mID; }
U64 getRegionHandle() const { return mRegionHandle; }
S32 getCount() const { return mCount; }
U64 getRegionHandle() const { return to_region_handle(mPosGlobal); } // Build the handle on the fly
bool isName(const std::string& name) const { return (mName == name); } // True if name same as item's name
// bool isSelected() const { return mSelected; }
private:
std::string mName;
std::string mToolTip;
LLVector3d mPosGlobal;
LLUUID mID;
U64 mRegionHandle;
public: //public for now.. non-standard.
BOOL mSelected;
S32 mExtra;
S32 mExtra2;
std::string mName; // Name of the individual item
std::string mToolTip; // Tooltip : typically, something to be displayed to the user when selecting this item
LLVector3d mPosGlobal; // Global world position
LLUUID mID; // UUID of the item
S32 mCount; // Number of elements in item (e.g. people count)
// Currently not used but might prove useful one day so we comment out
// bool mSelected; // Selected or not: updated by the viewer UI, not the simulator or asset DB
// LLColor4 mColor; // Color of the item
};
#define MAP_SIM_IMAGE_TYPES 3
// 0 - Prim
// 1 - Terrain Only
// 2 - Overlay: Land For Sale
//Layer types that we intend to support.
enum sim_layer_type
{
SIM_LAYER_BEGIN,
SIM_LAYER_COMPOSITE=0, //Legacy terrain+prim texture provided in MapBlockReply message.
SIM_LAYER_OVERLAY, //The land-for-sale overlay texture provided in MapBlockReply message.
SIM_LAYER_COUNT
};
//The MapBlockRequest message 'layerflags' don't match the order of the sim_layer_type, so a few
//simple inline functions have been provided to convert between sim_layer_type and layerflag.
inline U32 layerToFlags(sim_layer_type layer)
{
static U32 flags[SIM_LAYER_COUNT] = {0,2};
return flags[layer];
}
inline U32 flagsToLayer(U32 flags)
{
//We only want the low two bytes, so mask out the rest.
if((flags & 0xFFFF) == 0)
return SIM_LAYER_COMPOSITE;
else if((flags & 0xFFFF) == 2)
return SIM_LAYER_OVERLAY;
else
return U32_MAX;
}
// Info per region
// Such records are stored in a global map hold by the LLWorldMap and indexed by region handles.
// To avoid creating too many of them, they are requested in "blocks" corresponding to areas covered by the screen.
// Unfortunately, when the screen covers the whole world (zoomed out), that can translate in requesting info for
// every sim on the grid... Not good...
// To avoid this, the code implements a cut-off threshold for overlay graphics and, therefore, all LLSimInfo.
// In other words, when zooming out too much, we simply stop requesting LLSimInfo and
// LLItemInfo and just display the map tiles.
// As they are stored in different structures (LLSimInfo and LLWorldMipmap), this strategy is now workable.
class LLSimInfo
{
public:
@@ -96,17 +137,17 @@ public:
LLVector3 getLocalPos(LLVector3d global_pos) const;
void clearImage(); // Clears the reference to the Land for sale image for that region
void dropImagePriority(); // Drops the boost level of the Land for sale image for that region
LLPointer<LLViewerFetchedTexture> getLandForSaleImage(); // Get the overlay image, fetch it if necessary
void dropImagePriority(sim_layer_type layer = SIM_LAYER_COUNT); // Drops the boost level of the Land for sale image for that region
void updateAgentCount(F64 time); // Send an item request for agent count on that region if time's up
// Setters
void setName(std::string& name) { mName = name; }
void setSize(U16 sizeX, U16 sizeY) { mSizeX = sizeX; mSizeY = sizeY; }
void setAccess (U8 accesscode) { mAccess = accesscode; }
void setAccess (U32 accesscode) { mAccess = accesscode; }
void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; }
void setWaterHeight (F32 water_height) { mWaterHeight = water_height; }
void setSize(U16 sizeX, U16 sizeY) { mSizeX = sizeX; mSizeY = sizeY; }
void setAlpha(F32 alpha) { mAlpha = alpha; }
void setLandForSaleImage (LLUUID image_id);
void setMapImageID (const LLUUID& id, const U8 &layer) { mMapImageID[layer] = id; }
// Accessors
@@ -115,43 +156,73 @@ public:
const U32 getRegionFlags() const { return mRegionFlags; }
const std::string getAccessString() const { return LLViewerRegion::accessToString((U8)mAccess); }
const U8 getAccess() const { return mAccess; }
const S32 getAgentCount() const; // Compute the total agents count
LLPointer<LLViewerFetchedTexture> getLandForSaleImage(); // Get the overlay image, fetch it if necessary
const F32 getWaterHeight() const { return mWaterHeight; }
const F32 getAlpha() const { return mAlpha; }
const U64 getHandle() const { return mHandle; }
const U16 getSizeX() const { return mSizeX; }
const U16 getSizeY() const { return mSizeY; }
bool isName(const std::string& name) const;
bool isDown() { return (mAccess == SIM_ACCESS_DOWN); }
bool isPG() { return (mAccess <= SIM_ACCESS_PG); }
bool isAdult() { return (mAccess == SIM_ACCESS_ADULT); }
// Debug only
void dump() const; // Print the region info to the standard output
// Items lists handling
typedef std::vector<LLItemInfo> item_info_list_t;
void clearItems();
void insertTeleHub(const LLItemInfo& item) { mTelehubs.push_back(item); }
void insertInfoHub(const LLItemInfo& item) { mInfohubs.push_back(item); }
void insertPGEvent(const LLItemInfo& item) { mPGEvents.push_back(item); }
void insertMatureEvent(const LLItemInfo& item) { mMatureEvents.push_back(item); }
void insertAdultEvent(const LLItemInfo& item) { mAdultEvents.push_back(item); }
void insertLandForSale(const LLItemInfo& item) { mLandForSale.push_back(item); }
void insertLandForSaleAdult(const LLItemInfo& item) { mLandForSaleAdult.push_back(item); }
void insertAgentLocation(const LLItemInfo& item);
const LLSimInfo::item_info_list_t& getTeleHub() const { return mTelehubs; }
const LLSimInfo::item_info_list_t& getInfoHub() const { return mInfohubs; }
const LLSimInfo::item_info_list_t& getPGEvent() const { return mPGEvents; }
const LLSimInfo::item_info_list_t& getMatureEvent() const { return mMatureEvents; }
const LLSimInfo::item_info_list_t& getAdultEvent() const { return mAdultEvents; }
const LLSimInfo::item_info_list_t& getLandForSale() const { return mLandForSale; }
const LLSimInfo::item_info_list_t& getLandForSaleAdult() const { return mLandForSaleAdult; }
const LLSimInfo::item_info_list_t& getAgentLocation() const { return mAgentLocations; }
private:
U64 mHandle;
std::string mName;
F64 mAgentsUpdateTime; // Time stamp giving the last time the agents information was requested for that region
bool mFirstAgentRequest; // Init agent request flag
U8 mAccess;
U32 mAccess; // Down/up and maturity rating of the region
U32 mRegionFlags;
F32 mWaterHeight;
U16 mSizeX;
U16 mSizeY;
F32 mAlpha;
public:
BOOL mShowAgentLocations; // are agents visible?
// Image ID for the current overlay mode.
LLUUID mMapImageID[MAP_SIM_IMAGE_TYPES];
// Hold a reference to the currently displayed image.
LLPointer<LLViewerFetchedTexture> mCurrentImage;
LLPointer<LLViewerFetchedTexture> mOverlayImage;
// Handling the "land for sale / land for auction" overlay image
LLUUID mMapImageID[SIM_LAYER_COUNT]; // Image ID of the overlay image
LLPointer<LLViewerFetchedTexture> mLayerImage[SIM_LAYER_COUNT];
// Items for this region
// Those are data received through item requests (as opposed to block requests for the rest of the data)
item_info_list_t mTelehubs; // List of tele hubs in the region
item_info_list_t mInfohubs; // List of info hubs in the region
item_info_list_t mPGEvents; // List of PG events in the region
item_info_list_t mMatureEvents; // List of Mature events in the region
item_info_list_t mAdultEvents; // List of Adult events in the region (AO)
item_info_list_t mLandForSale; // List of Land for sales in the region
item_info_list_t mLandForSaleAdult; // List of Adult Land for sales in the region (AO)
item_info_list_t mAgentLocations; // List of agents in the region
};
#define MAP_BLOCK_RES 256
struct LLWorldMapLayer
{
BOOL LayerDefined;
@@ -162,6 +233,11 @@ struct LLWorldMapLayer
LLWorldMapLayer() : LayerDefined(FALSE) { }
};
// We request region data on the world by "blocks" of (MAP_BLOCK_SIZE x MAP_BLOCK_SIZE) regions
// This is to reduce the number of requests to the asset DB and get things in big "blocks"
const S32 MAP_MAX_SIZE = 2048;
const S32 MAP_BLOCK_SIZE = 4;
const S32 MAP_BLOCK_RES = (MAP_MAX_SIZE / MAP_BLOCK_SIZE);
class LLWorldMap : public LLSingleton<LLWorldMap>
{
@@ -175,135 +251,103 @@ public:
// clears the list
void reset();
// clear the visible items
void eraseItems();
// Removes references to cached images
void clearImageRefs();
// Clears the flags indicating that we've received sim infos
// Causes a re-request of the sim info without erasing extisting info
void clearSimFlags();
// Drops the priority of the images being fetched
void dropImagePriorities();
void clearImageRefs(); // Clears the image references
void dropImagePriorities(); // Drops the priority of the images being fetched
void reloadItems(bool force = false); // Reload the items (people, hub, etc...)
// Region Map access
typedef std::map<U64, LLSimInfo*> sim_info_map_t;
const LLWorldMap::sim_info_map_t& getRegionMap() const { return mSimInfoMap; }
// Returns simulator information, or NULL if out of range
void updateRegions(S32 x0, S32 y0, S32 x1, S32 y1); // Requests region info for a rectangle of regions (in grid coordinates)
// Insert a region and items in the map global instance
// Note: x_world and y_world in world coordinates (meters)
static bool insertRegion(U32 x_world, U32 y_world, U32 x_size, U32 y_size, U32 agent_flags, std::string& name, LLUUID& image_id, U32 accesscode, U32 region_flags);
static bool insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2);
// Get info on sims (region) : note that those methods only search the range of loaded sims (the one that are being browsed)
// *not* the entire world. So a NULL return does not mean a down or unexisting region, just an out of range region.
LLSimInfo* simInfoFromHandle(const U64 handle);
// Returns simulator information, or NULL if out of range
LLSimInfo* simInfoFromPosGlobal(const LLVector3d& pos_global);
// Returns simulator information for named sim, or NULL if non-existent
LLSimInfo* simInfoFromName(const std::string& sim_name);
// Gets simulator name for a global position, returns true if it was found
bool simNameFromPosGlobal(const LLVector3d& pos_global, std::string& outSimName );
// Sets the current layer
void setCurrentLayer(S32 layer, bool request_layer = false);
void sendMapLayerRequest();
void sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent = false);
void sendNamedRegionRequest(std::string region_name);
void sendNamedRegionRequest(std::string region_name,
url_callback_t callback,
const std::string& callback_url,
bool teleport);
void sendHandleRegionRequest(U64 region_handle,
url_callback_t callback,
const std::string& callback_url,
bool teleport);
void sendItemRequest(U32 type, U64 handle = 0);
static void processMapLayerReply(LLMessageSystem*, void**);
static void processMapBlockReply(LLMessageSystem*, void**);
static void processMapItemReply(LLMessageSystem*, void**);
static void gotMapServerURL(bool flag) { sGotMapURL = flag; }
static bool useWebMapTiles();
static LLPointer<LLViewerFetchedTexture> loadObjectsTile(U32 grid_x, U32 grid_y);
void dump();
// Extend the bounding box of the list of simulators. Returns true
// if the extents changed.
BOOL extendAABB(U32 x_min, U32 y_min, U32 x_max, U32 y_max);
// Track handling
void cancelTracking() { mIsTrackingLocation = false; mIsTrackingFound = false; mIsInvalidLocation = false; mIsTrackingDoubleClick = false; mIsTrackingCommit = false; }
// build coverage maps for telehub region visualization
void updateTelehubCoverage();
BOOL coveredByTelehub(LLSimInfo* infop);
void setTracking(const LLVector3d& loc) { mIsTrackingLocation = true; mTrackingLocation = loc; mIsTrackingFound = false; mIsInvalidLocation = false; mIsTrackingDoubleClick = false; mIsTrackingCommit = false;}
void setTrackingInvalid() { mIsTrackingFound = true; mIsInvalidLocation = true; }
void setTrackingValid() { mIsTrackingFound = true; mIsInvalidLocation = false; }
void setTrackingDoubleClick() { mIsTrackingDoubleClick = true; }
void setTrackingCommit() { mIsTrackingCommit = true; }
bool isTracking() { return mIsTrackingLocation; }
bool isTrackingValidLocation() { return mIsTrackingFound && !mIsInvalidLocation; }
bool isTrackingInvalidLocation() { return mIsTrackingFound && mIsInvalidLocation; }
bool isTrackingDoubleClick() { return mIsTrackingDoubleClick; }
bool isTrackingCommit() { return mIsTrackingCommit; }
bool isTrackingInRectangle(F64 x0, F64 y0, F64 x1, F64 y1);
LLVector3d getTrackedPositionGlobal() const { return mTrackingLocation; }
std::vector<LLWorldMapLayer>::iterator getMapLayerBegin() { return mMapLayers.begin(); }
std::vector<LLWorldMapLayer>::iterator getMapLayerEnd() { return mMapLayers.end(); }
std::map<U32, std::vector<bool> >::const_iterator findMapBlock(U32 layer, U32 x, U32 y) const
{ return LLWorldMap::instance().mMapBlockMap[layer].find((x<<16)|y); }
std::map<U32, std::vector<bool> >::const_iterator getMapBlockEnd(U32 layer) const
{ return LLWorldMap::instance().mMapBlockMap[layer].end(); }
// Bounds of the world, in meters
U32 getWorldWidth() const;
U32 getWorldHeight() const;
// World Mipmap delegation: currently used when drawing the mipmap
void equalizeBoostLevels();
LLPointer<LLViewerFetchedTexture> getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load = true) { return mWorldMipmap.getObjectsTile(grid_x, grid_y, level, load); }
static void processMapLayerReply(LLMessageSystem*, void**);
private:
bool clearItems(bool force = false); // Clears the item lists
void clearSimFlags(); // Clears the block flags indicating that we've already requested region infos
// Create a region record corresponding to the handle, insert it in the region map and returns a pointer
LLSimInfo* createSimInfoFromHandle(const U64 handle);
// Map from region-handle to simulator info
sim_info_map_t mSimInfoMap;
public:
// Request legacy background layers.
void sendMapLayerRequest();
BOOL mIsTrackingUnknownLocation, mInvalidLocation, mIsTrackingDoubleClick, mIsTrackingCommit;
LLVector3d mUnknownLocation;
bool mRequestLandForSale;
typedef std::vector<LLItemInfo> item_info_list_t;
item_info_list_t mTelehubs;
item_info_list_t mInfohubs;
item_info_list_t mPGEvents;
item_info_list_t mMatureEvents;
item_info_list_t mAdultEvents;
item_info_list_t mLandForSale;
item_info_list_t mLandForSaleAdult;
std::map<U64,S32> mNumAgents;
typedef std::map<U64, item_info_list_t> agent_list_map_t;
agent_list_map_t mAgentLocationsMap;
std::vector<LLWorldMapLayer> mMapLayers[MAP_SIM_IMAGE_TYPES];
BOOL mMapLoaded[MAP_SIM_IMAGE_TYPES];
BOOL * mMapBlockLoaded[MAP_SIM_IMAGE_TYPES];
S32 mCurrentMap;
// AABB of the list of simulators
U32 mMinX;
U32 mMaxX;
U32 mMinY;
U32 mMaxY;
U8* mNeighborMap;
U8* mTelehubCoverageMap;
S32 mNeighborMapWidth;
S32 mNeighborMapHeight;
std::vector<LLWorldMapLayer> mMapLayers;
bool mMapLoaded;
private:
LLWorldMipmap mWorldMipmap;
// The World is divided in "blocks" of (MAP_BLOCK_SIZE x MAP_BLOCK_SIZE) regions that get requested at once.
// This boolean table avoids "blocks" to be requested multiple times.
// Issue: Not sure this scheme is foolproof though as I've seen
// cases where a block is never retrieved and, because of this boolean being set, never re-requested
//bool * mMapBlockLoaded[MAP_SIM_IMAGE_TYPES]; // Telling us if the block of regions has been requested or not
std::map<U32, std::vector<bool> > mMapBlockMap[SIM_LAYER_COUNT];
// Track location data : used while there's nothing tracked yet by LLTracker
bool mIsTrackingLocation; // True when we're tracking a point
bool mIsTrackingFound; // True when the tracking position has been found, valid or not
bool mIsInvalidLocation; // The region is down or the location does not correspond to an existing region
bool mIsTrackingDoubleClick; // User double clicked to set the location (i.e. teleport when found please...)
bool mIsTrackingCommit; // User used the search or landmark fields to set the location
LLVector3d mTrackingLocation; // World global position being tracked
// General grid items request timing flags (used for events,hubs and land for sale)
LLTimer mRequestTimer;
// search for named region for url processing
std::string mSLURLRegionName;
U64 mSLURLRegionHandle;
std::string mSLURL;
url_callback_t mSLURLCallback;
bool mSLURLTeleport;
bool mFirstRequest;
static bool sGotMapURL;
};

View File

@@ -0,0 +1,301 @@
/**
* @file llworldmapmessage.cpp
* @brief Handling of the messages to the DB made by and for the world map.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llworldmapmessage.h"
#include "message.h"
#include "llworldmap.h"
#include "llagent.h"
#include "llfloaterworldmap.h"
const U32 LAYER_FLAG = 2;
//---------------------------------------------------------------------------
// World Map Message Handling
//---------------------------------------------------------------------------
LLWorldMapMessage::LLWorldMapMessage() :
mSLURLRegionName(),
mSLURLRegionHandle(0),
mSLURL(),
mSLURLCallback(0),
mSLURLTeleport(false)
{
}
LLWorldMapMessage::~LLWorldMapMessage()
{
}
void LLWorldMapMessage::sendItemRequest(U32 type, U64 handle)
{
//LL_INFOS("World Map") << "Send item request : type = " << type << LL_ENDL;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_MapItemRequest);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG);
msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
msg->nextBlockFast(_PREHASH_RequestData);
msg->addU32Fast(_PREHASH_ItemType, type);
msg->addU64Fast(_PREHASH_RegionHandle, handle); // If zero, filled in on sim
gAgent.sendReliableMessage();
}
void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name)
{
//LL_INFOS("World Map") << "LLWorldMap::sendNamedRegionRequest()" << LL_ENDL;
LLMessageSystem* msg = gMessageSystem;
// Request for layer
msg->newMessageFast(_PREHASH_MapNameRequest);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addU32Fast(_PREHASH_Flags, LAYER_FLAG);
msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
msg->nextBlockFast(_PREHASH_NameData);
msg->addStringFast(_PREHASH_Name, region_name);
gAgent.sendReliableMessage();
}
void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name,
url_callback_t callback,
const std::string& callback_url,
bool teleport) // immediately teleport when result returned
{
//LL_INFOS("World Map") << "LLWorldMap::sendNamedRegionRequest()" << LL_ENDL;
mSLURLRegionName = region_name;
mSLURLRegionHandle = 0;
mSLURL = callback_url;
mSLURLCallback = callback;
mSLURLTeleport = teleport;
sendNamedRegionRequest(region_name);
}
void LLWorldMapMessage::sendHandleRegionRequest(U64 region_handle,
url_callback_t callback,
const std::string& callback_url,
bool teleport) // immediately teleport when result returned
{
//LL_INFOS("World Map") << "LLWorldMap::sendHandleRegionRequest()" << LL_ENDL;
mSLURLRegionName.clear();
mSLURLRegionHandle = region_handle;
mSLURL = callback_url;
mSLURLCallback = callback;
mSLURLTeleport = teleport;
U32 global_x;
U32 global_y;
from_region_handle(region_handle, &global_x, &global_y);
U16 grid_x = (U16)(global_x / REGION_WIDTH_UNITS);
U16 grid_y = (U16)(global_y / REGION_WIDTH_UNITS);
sendMapBlockRequest(grid_x, grid_y, grid_x, grid_y, true, LAYER_FLAG);
}
// public
void LLWorldMapMessage::sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent, S32 layer)
{
//LL_INFOS("World Map") << "LLWorldMap::sendMapBlockRequest()" << ", min = (" << min_x << ", " << min_y << "), max = (" << max_x << ", " << max_y << "), nonexistent = " << return_nonexistent << LL_ENDL;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_MapBlockRequest);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
U32 flags = layer;
flags |= (return_nonexistent ? 0x10000 : 0);
msg->addU32Fast(_PREHASH_Flags, flags);
msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim
msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim
msg->nextBlockFast(_PREHASH_PositionData);
msg->addU16Fast(_PREHASH_MinX, min_x);
msg->addU16Fast(_PREHASH_MinY, min_y);
msg->addU16Fast(_PREHASH_MaxX, max_x);
msg->addU16Fast(_PREHASH_MaxY, max_y);
gAgent.sendReliableMessage();
}
// public static
void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**)
{
U32 agent_flags;
msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags);
U32 layer = flagsToLayer(agent_flags);
if (layer >= SIM_LAYER_COUNT)
{
llwarns << "Invalid map image type returned! layer = " << agent_flags << llendl;
return;
}
S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data);
//LL_INFOS("World Map") << "LLWorldMap::processMapBlockReply(), num_blocks = " << num_blocks << LL_ENDL;
bool found_null_sim = false;
for (S32 block=0; block<num_blocks; ++block)
{
U16 x_regions;
U16 y_regions;
U16 x_size = 256;
U16 y_size = 256;
std::string name;
U8 accesscode;
U32 region_flags;
// U8 water_height;
// U8 agents;
LLUUID image_id;
msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block);
msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block);
msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block);
msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block);
msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block);
// msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block);
// msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block);
msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block);
if(msg->getNumberOfBlocksFast(_PREHASH_Size) > 0)
{
msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeX, x_size, block);
msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeY, y_size, block);
}
if(x_size == 0 || (x_size % 16) != 0|| (y_size % 16) != 0)
{
x_size = 256;
y_size = 256;
}
U32 x_world = (U32)(x_regions) * REGION_WIDTH_UNITS;
U32 y_world = (U32)(y_regions) * REGION_WIDTH_UNITS;
// name shouldn't be empty, see EXT-4568
//llassert(!name.empty());
//Opensim bug. BlockRequest can return sims without names, with an accesscode that isn't 255.
// skip if this has happened.
if(name.empty() && accesscode != 255)
continue;
// Insert that region in the world map, if failure, flag it as a "null_sim"
if (!(LLWorldMap::getInstance()->insertRegion(x_world, y_world, x_size, y_size, agent_flags, name, image_id, (U32)accesscode, region_flags)))
{
found_null_sim = true;
}
// If we hit a valid tracking location, do what needs to be done app level wise
if (LLWorldMap::getInstance()->isTrackingValidLocation())
{
LLVector3d pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal();
if (LLWorldMap::getInstance()->isTrackingDoubleClick())
{
// Teleport if the user double clicked
gAgent.teleportViaLocation(pos_global);
}
// Update the "real" tracker information
gFloaterWorldMap->trackLocation(pos_global);
}
// Handle the SLURL callback if any
url_callback_t callback = LLWorldMapMessage::getInstance()->mSLURLCallback;
if(callback != NULL)
{
U64 handle = to_region_handle(x_world, y_world);
// Check if we reached the requested region
if ((LLStringUtil::compareInsensitive(LLWorldMapMessage::getInstance()->mSLURLRegionName, name)==0)
|| (LLWorldMapMessage::getInstance()->mSLURLRegionHandle == handle))
{
LLWorldMapMessage::getInstance()->mSLURLCallback = NULL;
LLWorldMapMessage::getInstance()->mSLURLRegionName.clear();
LLWorldMapMessage::getInstance()->mSLURLRegionHandle = 0;
callback(handle, LLWorldMapMessage::getInstance()->mSLURL, image_id, LLWorldMapMessage::getInstance()->mSLURLTeleport);
}
}
if( gAgent.mPendingLure &&
(U16)(gAgent.mPendingLure->mPosGlobal.mdV[0] / REGION_WIDTH_UNITS) == x_regions &&
(U16)(gAgent.mPendingLure->mPosGlobal.mdV[1] / REGION_WIDTH_UNITS) == y_regions )
{
gAgent.onFoundLureDestination();
}
}
// Tell the UI to update itself
gFloaterWorldMap->updateSims(found_null_sim);
}
// public static
void LLWorldMapMessage::processMapItemReply(LLMessageSystem* msg, void**)
{
//LL_INFOS("World Map") << "LLWorldMap::processMapItemReply()" << LL_ENDL;
U32 type;
msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ItemType, type);
S32 num_blocks = msg->getNumberOfBlocks("Data");
for (S32 block=0; block<num_blocks; ++block)
{
U32 X, Y;
std::string name;
S32 extra, extra2;
LLUUID uuid;
msg->getU32Fast(_PREHASH_Data, _PREHASH_X, X, block);
msg->getU32Fast(_PREHASH_Data, _PREHASH_Y, Y, block);
msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block);
msg->getUUIDFast(_PREHASH_Data, _PREHASH_ID, uuid, block);
msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra, extra, block);
msg->getS32Fast(_PREHASH_Data, _PREHASH_Extra2, extra2, block);
LLWorldMap::getInstance()->insertItem(X, Y, name, uuid, type, extra, extra2);
}
}
void LLWorldMapMessage::handleSLURL(std::string& name, U32 x_world, U32 y_world, LLUUID image_id)
{
// Handle the SLURL callback if any
url_callback_t callback = LLWorldMapMessage::getInstance()->mSLURLCallback;
if(callback != NULL)
{
U64 handle = to_region_handle(x_world, y_world);
// Check if we reached the requested region
if ((LLStringUtil::compareInsensitive(LLWorldMapMessage::getInstance()->mSLURLRegionName, name)==0)
|| (LLWorldMapMessage::getInstance()->mSLURLRegionHandle == handle))
{
LLWorldMapMessage::getInstance()->mSLURLCallback = NULL;
LLWorldMapMessage::getInstance()->mSLURLRegionName.clear();
LLWorldMapMessage::getInstance()->mSLURLRegionHandle = 0;
callback(handle, LLWorldMapMessage::getInstance()->mSLURL, image_id, LLWorldMapMessage::getInstance()->mSLURLTeleport);
}
}
}

View File

@@ -0,0 +1,79 @@
/**
* @file llworldmapmessage.h
* @brief Handling of the messages to the DB made by and for the world map.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLWORLDMAPMESSAGE_H
#define LL_LLWORLDMAPMESSAGE_H
// Handling of messages (send and process) as well as SLURL callback if necessary
class LLMessageSystem;
class LLWorldMapMessage : public LLSingleton<LLWorldMapMessage>
{
public:
typedef boost::function<void(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)>
url_callback_t;
LLWorldMapMessage();
~LLWorldMapMessage();
// Process incoming answers to map stuff requests
static void processMapBlockReply(LLMessageSystem*, void**);
static void processMapItemReply(LLMessageSystem*, void**);
// Request data for all regions in a rectangular area. Coordinates in grids (i.e. meters / 256).
void sendMapBlockRequest(U16 min_x, U16 min_y, U16 max_x, U16 max_y, bool return_nonexistent, S32 layer = 2);
// Various methods to request LLSimInfo data to the simulator and asset DB
void sendNamedRegionRequest(std::string region_name);
void sendNamedRegionRequest(std::string region_name,
url_callback_t callback,
const std::string& callback_url,
bool teleport);
void sendHandleRegionRequest(U64 region_handle,
url_callback_t callback,
const std::string& callback_url,
bool teleport);
// Request item data for regions
// Note: the handle works *only* when requesting agent count (type = MAP_ITEM_AGENT_LOCATIONS). In that case,
// the request will actually be transitting through the spaceserver (all that is done on the sim).
// All other values of type do create a global grid request to the asset DB. So no need to try to get, say,
// the events for one particular region. For such a request, the handle is ignored.
void sendItemRequest(U32 type, U64 handle = 0);
void handleSLURL(std::string& name, U32 x_world, U32 y_world, LLUUID image_id);
private:
// Search for region (by name or handle) for SLURL processing and teleport
// None of this relies explicitly on the LLWorldMap instance so better handle it here
std::string mSLURLRegionName;
U64 mSLURLRegionHandle;
std::string mSLURL;
url_callback_t mSLURLCallback;
bool mSLURLTeleport;
};
#endif // LL_LLWORLDMAPMESSAGE_H

File diff suppressed because it is too large Load Diff

View File

@@ -86,16 +86,17 @@ public:
LLVector3d viewPosToGlobal(S32 x,S32 y);
virtual void draw();
void drawTiles(S32 width, S32 height);
void drawGenericItems(const LLWorldMap::item_info_list_t& items, LLUIImagePtr image);
void drawLegacyBackgroundLayers(S32 width, S32 height); //draw legacy background 'layer' tiles. Only available on official grids, I believe.
F32 drawLegacySimTile(LLSimInfo& sim_info, S32 left, S32 top, S32 right, S32 bottom); //draw legacy sim texture (provided in MapBlockReply message).
void drawGenericItems(const LLSimInfo::item_info_list_t& items, LLUIImagePtr image);
void drawGenericItem(const LLItemInfo& item, LLUIImagePtr image);
void drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color = LLColor4::white);
void drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color);
void drawAgents();
void drawEvents();
void drawItems();
void drawFrustum();
void drawMipmap(S32 width, S32 height);
bool drawMipmapLevel(S32 width, S32 height, S32 level, bool load = true);
bool drawMipmapLevel(S32 width, S32 height, S32 level, bool load = true);
static void cleanupTextures();
@@ -119,7 +120,7 @@ public:
S32 overlap );
static void drawAvatar( F32 x_pixels,
F32 y_pixels,
LLColor4 color,
const LLColor4& color,
F32 relative_z = 0.f,
F32 dot_radius = 3.f);
static void drawIconName(F32 x_pixels,
@@ -132,9 +133,7 @@ public:
static void clearLastClick() { sHandledLastClick = FALSE; }
// if the view changes, download additional sim info as needed
// return value is number of blocks newly requested.
U32 updateBlock(S32 block_x, S32 block_y);
U32 updateVisibleBlocks();
void updateVisibleBlocks();
protected:
void setDirectionPos( LLTextBox* text_box, F32 rotation );
@@ -161,8 +160,6 @@ public:
static LLUIImagePtr sForSaleImage;
static LLUIImagePtr sForSaleAdultImage;
static F32 sThresholdA;
static F32 sThresholdB;
static F32 sPixelsPerMeter; // world meters to map pixels
static F32 sMapScale; // scale = size of a region in pixels
@@ -202,6 +199,9 @@ public:
handle_list_t mVisibleRegions; // set every frame
static std::map<std::string,std::string> sStringsMap;
private:
void drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right);
};
#endif

View File

@@ -78,7 +78,7 @@ void LLWorldMipmap::equalizeBoostLevels()
// For each tile
for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
{
LLPointer<LLViewerTexture> img = iter->second;
LLPointer<LLViewerFetchedTexture> img = iter->second;
S32 current_boost_level = img->getBoostLevel();
if (current_boost_level == LLViewerTexture::BOOST_MAP_VISIBLE)
{
@@ -120,7 +120,7 @@ void LLWorldMipmap::dropBoostLevels()
// For each tile
for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
{
LLPointer<LLViewerTexture> img = iter->second;
LLPointer<LLViewerFetchedTexture> img = iter->second;
img->setBoostLevel(LLViewerTexture::BOOST_NONE);
}
}
@@ -195,7 +195,7 @@ LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32
// END DEBUG
//LL_INFOS("World Map") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL;
LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl);
LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
img->setBoostLevel(LLViewerTexture::BOOST_MAP);
// Return the smart pointer
@@ -224,7 +224,7 @@ void LLWorldMipmap::cleanMissedTilesFromLevel(S32 level)
sublevel_tiles_t::iterator it = level_mipmap.begin();
while (it != level_mipmap.end())
{
LLPointer<LLViewerTexture> img = it->second;
LLPointer<LLViewerFetchedTexture> img = it->second;
if (img->isMissingAsset())
{
level_mipmap.erase(it++);

View File

@@ -172,7 +172,7 @@
tool_tip="Copies current location as SLURL to be used on the web."
width="222" />
<slider bottom="-697" can_edit_text="false" decimal_digits="3" follows="right|bottom"
height="16" increment="0.2" initial_val="48.5029" label="Zoom" left="-230"
height="16" increment="0.2" initial_val="-2" label="Zoom" left="-230"
max_val="0" min_val="-8" mouse_opaque="true" name="zoom slider"
show_text="false" value="48.5029" width="222" />
</floater>

View File

@@ -123,6 +123,7 @@
<!-- Indicates something is being loaded. Maybe should be merged with RetrievingData -->
<string name="LoadingData">Loading...</string>
<string name="InvalidLocation">Invalid Location</string>
<!-- namecache -->