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:
@@ -542,6 +542,7 @@ set(viewer_SOURCE_FILES
|
|||||||
llwlparamset.cpp
|
llwlparamset.cpp
|
||||||
llworld.cpp
|
llworld.cpp
|
||||||
llworldmap.cpp
|
llworldmap.cpp
|
||||||
|
llworldmapmessage.cpp
|
||||||
llworldmipmap.cpp
|
llworldmipmap.cpp
|
||||||
llworldmapview.cpp
|
llworldmapview.cpp
|
||||||
llxmlrpctransaction.cpp
|
llxmlrpctransaction.cpp
|
||||||
@@ -1050,6 +1051,7 @@ set(viewer_HEADER_FILES
|
|||||||
llwlparamset.h
|
llwlparamset.h
|
||||||
llworld.h
|
llworld.h
|
||||||
llworldmap.h
|
llworldmap.h
|
||||||
|
llworldmapmessage.h
|
||||||
llworldmipmap.h
|
llworldmipmap.h
|
||||||
llworldmapview.h
|
llworldmapview.h
|
||||||
llxmlrpctransaction.h
|
llxmlrpctransaction.h
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
#include "llvoavatarself.h"
|
#include "llvoavatarself.h"
|
||||||
#include "llworld.h"
|
#include "llworld.h"
|
||||||
#include "llworldmap.h"
|
#include "llworldmap.h"
|
||||||
|
#include "llworldmapmessage.h"
|
||||||
|
|
||||||
//Misc non-standard includes
|
//Misc non-standard includes
|
||||||
#include "llurldispatcher.h"
|
#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[VY] - region_origin.mdV[VY]),
|
||||||
(F32)(pos_global.mdV[VZ]));
|
(F32)(pos_global.mdV[VZ]));
|
||||||
pos_local += offset;
|
pos_local += offset;
|
||||||
teleportRequest(info->getHandle(), pos_local);
|
teleportRequest(handle, pos_local);
|
||||||
}
|
}
|
||||||
else if(regionp &&
|
else if(regionp &&
|
||||||
teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])))
|
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;
|
mbTeleportKeepsLookAt = true;
|
||||||
gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction
|
gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction
|
||||||
U64 region_handle = to_region_handle(pos_global);
|
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));
|
LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
|
||||||
teleportRequest(region_handle, pos_local, getTeleportKeepsLookAt());
|
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_x = (U16)(global_x / REGION_WIDTH_UNITS);
|
||||||
U16 grid_y = (U16)(global_y / 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ static void settings_to_globals()
|
|||||||
gAllowIdleAFK = gSavedSettings.getBOOL("AllowIdleAFK");
|
gAllowIdleAFK = gSavedSettings.getBOOL("AllowIdleAFK");
|
||||||
gAllowTapTapHoldRun = gSavedSettings.getBOOL("AllowTapTapHoldRun");
|
gAllowTapTapHoldRun = gSavedSettings.getBOOL("AllowTapTapHoldRun");
|
||||||
gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
|
gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
|
||||||
LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale");
|
LLWorldMapView::sMapScale = llmax(.1f,gSavedSettings.getF32("MapScale"));
|
||||||
LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips");
|
LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -111,29 +111,26 @@ public:
|
|||||||
|
|
||||||
// teleport to the tracked item, if there is one
|
// teleport to the tracked item, if there is one
|
||||||
void teleport();
|
void teleport();
|
||||||
|
void onChangeMaturity();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void onPanBtn( void* userdata );
|
void onGoHome();
|
||||||
|
|
||||||
static void onGoHome(void* data);
|
|
||||||
|
|
||||||
static void onLandmarkComboPrearrange( LLUICtrl* ctrl, void* data );
|
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 onAvatarComboPrearrange( LLUICtrl* ctrl, void* data );
|
||||||
static void onAvatarComboCommit( LLUICtrl* ctrl, void* data );
|
void onAvatarComboCommit();
|
||||||
|
|
||||||
static void onComboTextEntry( LLLineEditor* ctrl, void* data );
|
static void onComboTextEntry( LLLineEditor* ctrl, void* data );
|
||||||
static void onSearchTextEntry( LLLineEditor* ctrl, void* data );
|
static void onSearchTextEntry( LLLineEditor* ctrl, void* data );
|
||||||
|
|
||||||
static void onClearBtn(void*);
|
void onClearBtn();
|
||||||
static void onFlyBtn(void*);
|
void onClickTeleportBtn();
|
||||||
static void onClickTeleportBtn(void*);
|
static void onClickTeleportBtn_static(void* data) {((LLFloaterWorldMap*)data)->onClickTeleportBtn();};
|
||||||
static void onShowTargetBtn(void*);
|
void onShowTargetBtn();
|
||||||
static void onShowAgentBtn(void*);
|
void onShowAgentBtn();
|
||||||
static void onCopySLURL(void*);
|
void onCopySLURL();
|
||||||
|
|
||||||
static void onCheckEvents(LLUICtrl* ctrl, void*);
|
|
||||||
|
|
||||||
void centerOnTarget(BOOL animate);
|
void centerOnTarget(BOOL animate);
|
||||||
void updateLocation();
|
void updateLocation();
|
||||||
@@ -142,7 +139,6 @@ protected:
|
|||||||
void fly();
|
void fly();
|
||||||
|
|
||||||
void buildLandmarkIDLists();
|
void buildLandmarkIDLists();
|
||||||
static void onGoToLandmarkDialog(S32 option,void* userdata);
|
|
||||||
void flyToLandmark();
|
void flyToLandmark();
|
||||||
void teleportToLandmark();
|
void teleportToLandmark();
|
||||||
void setLandmarkVisited();
|
void setLandmarkVisited();
|
||||||
@@ -152,24 +148,28 @@ protected:
|
|||||||
void teleportToAvatar();
|
void teleportToAvatar();
|
||||||
|
|
||||||
void updateSearchEnabled();
|
void updateSearchEnabled();
|
||||||
void onLocationFocusChanged( LLFocusableElement* focus );
|
void onLocationFocusChanged( LLFocusableElement* ctrl );
|
||||||
static void onLocationCommit( void* userdata );
|
void onLocationCommit();
|
||||||
static void onCommitLocation( LLUICtrl* ctrl, void* userdata );
|
void onCoordinatesCommit();
|
||||||
static void onCommitSearchResult( LLUICtrl* ctrl, void* userdata );
|
void onCommitSearchResult();
|
||||||
|
|
||||||
void cacheLandmarkPosition();
|
void cacheLandmarkPosition();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
LLPanel* mPanel; // Panel displaying the map
|
LLPanel* mPanel; // Panel displaying the map
|
||||||
|
|
||||||
// Sets sMapScale, in pixels per region
|
// Sets sMapScale, in pixels per region
|
||||||
F32 mCurZoomVal;
|
F32 mCurZoomVal;
|
||||||
F32 mCurZoomValInterpolationStart; // Used during mZoomTimer interpolation.
|
|
||||||
LLFrameTimer mZoomTimer;
|
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> mLandmarkAssetIDList;
|
||||||
LLDynamicArray<LLUUID> mLandmarkItemIDList;
|
LLDynamicArray<LLUUID> mLandmarkItemIDList;
|
||||||
BOOL mHasLandmarkPosition;
|
|
||||||
|
|
||||||
static const LLUUID sHomeID;
|
static const LLUUID sHomeID;
|
||||||
|
|
||||||
@@ -178,9 +178,12 @@ protected:
|
|||||||
LLFriendObserver* mFriendObserver;
|
LLFriendObserver* mFriendObserver;
|
||||||
|
|
||||||
std::string mCompletingRegionName;
|
std::string mCompletingRegionName;
|
||||||
|
// Local position from trackURL() request, used to select final
|
||||||
|
// position once region lookup complete.
|
||||||
|
LLVector3 mCompletingRegionPos;
|
||||||
|
|
||||||
std::string mLastRegionName;
|
std::string mLastRegionName;
|
||||||
BOOL mWaitingForTracker;
|
BOOL mWaitingForTracker;
|
||||||
BOOL mExactMatch;
|
|
||||||
|
|
||||||
BOOL mIsClosing;
|
BOOL mIsClosing;
|
||||||
BOOL mSetToUserPosition;
|
BOOL mSetToUserPosition;
|
||||||
@@ -190,6 +193,10 @@ protected:
|
|||||||
std::string mTrackedSimName;
|
std::string mTrackedSimName;
|
||||||
std::string mTrackedAvatarName;
|
std::string mTrackedAvatarName;
|
||||||
std::string mSLURL;
|
std::string mSLURL;
|
||||||
|
|
||||||
|
LLCtrlListInterface * mListFriendCombo;
|
||||||
|
LLCtrlListInterface * mListLandmarkCombo;
|
||||||
|
LLCtrlListInterface * mListSearchResults;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LLFloaterWorldMap* gFloaterWorldMap;
|
extern LLFloaterWorldMap* gFloaterWorldMap;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include "llviewertexturelist.h"
|
#include "llviewertexturelist.h"
|
||||||
#include "llworldmap.h"
|
#include "llworldmap.h"
|
||||||
#include "llagent.h"
|
#include "llagent.h"
|
||||||
|
#include "llworldmapmessage.h"
|
||||||
|
#include "llsdserialize.h"
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
void LLMapLayerResponder::result(const LLSD& result)
|
void LLMapLayerResponder::result(const LLSD& result)
|
||||||
@@ -45,22 +47,19 @@ void LLMapLayerResponder::result(const LLSD& result)
|
|||||||
llinfos << "LLMapLayerResponder::result from capabilities" << llendl;
|
llinfos << "LLMapLayerResponder::result from capabilities" << llendl;
|
||||||
|
|
||||||
S32 agent_flags = result["AgentData"]["Flags"];
|
S32 agent_flags = result["AgentData"]["Flags"];
|
||||||
|
U32 layer = flagsToLayer(agent_flags);
|
||||||
|
|
||||||
if (agent_flags != LLWorldMap::getInstance()->mCurrentMap)
|
if (layer != SIM_LAYER_COMPOSITE)
|
||||||
{
|
{
|
||||||
llwarns << "Invalid or out of date map image type returned!" << llendl;
|
llwarns << "Invalid or out of date map image type returned!" << llendl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLUUID image_id;
|
LLUUID image_id;
|
||||||
//U32 left, right, top, bottom;
|
|
||||||
|
|
||||||
LLWorldMap::getInstance()->mMapLayers[agent_flags].clear();
|
LLWorldMap::getInstance()->mMapLayers.clear();
|
||||||
|
|
||||||
bool use_web_map_tiles = LLWorldMap::useWebMapTiles();
|
|
||||||
|
|
||||||
LLSD::array_const_iterator iter;
|
LLSD::array_const_iterator iter;
|
||||||
BOOL adjust = FALSE;
|
|
||||||
for(iter = result["LayerData"].beginArray(); iter != result["LayerData"].endArray(); ++iter)
|
for(iter = result["LayerData"].beginArray(); iter != result["LayerData"].endArray(); ++iter)
|
||||||
{
|
{
|
||||||
const LLSD& layer_data = *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.LayerExtents.mTop = layer_data["Top"];
|
||||||
|
|
||||||
new_layer.LayerImageID = layer_data["ImageID"];
|
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());
|
gGL.getTexUnit(0)->bind(new_layer.LayerImage.get());
|
||||||
new_layer.LayerImage->setAddressMode(LLTexUnit::TAM_CLAMP);
|
new_layer.LayerImage->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||||
|
|
||||||
F32 x_meters = F32(new_layer.LayerExtents.mLeft*REGION_WIDTH_UNITS);
|
LLWorldMap::getInstance()->mMapLayers.push_back(new_layer);
|
||||||
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()->mMapLoaded = true;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,6 +190,7 @@
|
|||||||
#include "llwind.h"
|
#include "llwind.h"
|
||||||
#include "llworld.h"
|
#include "llworld.h"
|
||||||
#include "llworldmap.h"
|
#include "llworldmap.h"
|
||||||
|
#include "llworldmapmessage.h"
|
||||||
#include "llxfermanager.h"
|
#include "llxfermanager.h"
|
||||||
#include "pipeline.h"
|
#include "pipeline.h"
|
||||||
#include "llappviewer.h"
|
#include "llappviewer.h"
|
||||||
@@ -3392,8 +3393,8 @@ void register_viewer_callbacks(LLMessageSystem* msg)
|
|||||||
msg->setHandlerFunc("AvatarPickerReply", LLFloaterAvatarPicker::processAvatarPickerReply);
|
msg->setHandlerFunc("AvatarPickerReply", LLFloaterAvatarPicker::processAvatarPickerReply);
|
||||||
|
|
||||||
msg->setHandlerFunc("MapLayerReply", LLWorldMap::processMapLayerReply);
|
msg->setHandlerFunc("MapLayerReply", LLWorldMap::processMapLayerReply);
|
||||||
msg->setHandlerFunc("MapBlockReply", LLWorldMap::processMapBlockReply);
|
msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply);
|
||||||
msg->setHandlerFunc("MapItemReply", LLWorldMap::processMapItemReply);
|
msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply);
|
||||||
|
|
||||||
msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply);
|
msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply);
|
||||||
msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
|
msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
// these are static so that they can be used a callbacks
|
// these are static so that they can be used a callbacks
|
||||||
static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
|
static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
|
||||||
static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; }
|
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 stopTracking(void*);
|
||||||
static void clearFocus();
|
static void clearFocus();
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#include "llurlsimstring.h"
|
#include "llurlsimstring.h"
|
||||||
#include "llweb.h"
|
#include "llweb.h"
|
||||||
#include "llworldmap.h"
|
#include "llworldmap.h"
|
||||||
|
#include "llworldmapmessage.h"
|
||||||
|
|
||||||
// library includes
|
// library includes
|
||||||
#include "llsd.h"
|
#include "llsd.h"
|
||||||
@@ -243,7 +244,7 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mous
|
|||||||
url_displayp->setName(region_name);
|
url_displayp->setName(region_name);
|
||||||
|
|
||||||
// Request a region handle by name
|
// Request a region handle by name
|
||||||
LLWorldMap::getInstance()->sendNamedRegionRequest(region_name,
|
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
|
||||||
LLURLDispatcherImpl::regionNameCallback,
|
LLURLDispatcherImpl::regionNameCallback,
|
||||||
url,
|
url,
|
||||||
false); // don't teleport
|
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);
|
LLVector3d global_pos = from_region_handle(region_handle) + LLVector3d(local_pos);
|
||||||
|
|
||||||
U64 new_region_handle = to_region_handle(global_pos);
|
U64 new_region_handle = to_region_handle(global_pos);
|
||||||
LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle,
|
LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle,
|
||||||
LLURLDispatcherImpl::regionHandleCallback,
|
LLURLDispatcherImpl::regionHandleCallback,
|
||||||
url, teleport);
|
url, teleport);
|
||||||
}
|
}
|
||||||
@@ -401,7 +402,7 @@ public:
|
|||||||
{
|
{
|
||||||
url += tokens[i].asString() + "/";
|
url += tokens[i].asString() + "/";
|
||||||
}
|
}
|
||||||
LLWorldMap::getInstance()->sendNamedRegionRequest(region_name,
|
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
|
||||||
LLURLDispatcherImpl::regionHandleCallback,
|
LLURLDispatcherImpl::regionHandleCallback,
|
||||||
url,
|
url,
|
||||||
true); // teleport
|
true); // teleport
|
||||||
|
|||||||
@@ -3596,7 +3596,6 @@ void set_god_level(U8 god_level)
|
|||||||
|
|
||||||
// God mode changes region visibility
|
// God mode changes region visibility
|
||||||
LLWorldMap::getInstance()->reset();
|
LLWorldMap::getInstance()->reset();
|
||||||
LLWorldMap::getInstance()->setCurrentLayer(0);
|
|
||||||
|
|
||||||
// inventory in items may change in god mode
|
// inventory in items may change in god mode
|
||||||
gObjectList.dirtyAllObjectInventory();
|
gObjectList.dirtyAllObjectInventory();
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -51,39 +51,80 @@
|
|||||||
|
|
||||||
class LLMessageSystem;
|
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
|
class LLItemInfo
|
||||||
{
|
{
|
||||||
public:
|
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
|
// Setters
|
||||||
void setTooltip(const std::string& tooltip) { mToolTip = tooltip; }
|
void setTooltip(const std::string& tooltip) { mToolTip = tooltip; }
|
||||||
void setElevation(F64 z) { mPosGlobal.mdV[VZ] = z; }
|
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
|
// Accessors
|
||||||
const LLVector3d& getGlobalPosition() const { return mPosGlobal; }
|
const LLVector3d& getGlobalPosition() const { return mPosGlobal; }
|
||||||
const std::string& getName() const { return mName; }
|
const std::string& getName() const { return mName; }
|
||||||
const std::string& getToolTip() const { return mToolTip; }
|
const std::string& getToolTip() const { return mToolTip; }
|
||||||
const LLUUID& getUUID() const { return mID; }
|
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 isName(const std::string& name) const { return (mName == name); } // True if name same as item's name
|
||||||
|
// bool isSelected() const { return mSelected; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string mName;
|
std::string mName; // Name of the individual item
|
||||||
std::string mToolTip;
|
std::string mToolTip; // Tooltip : typically, something to be displayed to the user when selecting this item
|
||||||
LLVector3d mPosGlobal;
|
LLVector3d mPosGlobal; // Global world position
|
||||||
LLUUID mID;
|
LLUUID mID; // UUID of the item
|
||||||
U64 mRegionHandle;
|
S32 mCount; // Number of elements in item (e.g. people count)
|
||||||
public: //public for now.. non-standard.
|
// Currently not used but might prove useful one day so we comment out
|
||||||
BOOL mSelected;
|
// bool mSelected; // Selected or not: updated by the viewer UI, not the simulator or asset DB
|
||||||
S32 mExtra;
|
// LLColor4 mColor; // Color of the item
|
||||||
S32 mExtra2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAP_SIM_IMAGE_TYPES 3
|
//Layer types that we intend to support.
|
||||||
// 0 - Prim
|
enum sim_layer_type
|
||||||
// 1 - Terrain Only
|
{
|
||||||
// 2 - Overlay: Land For Sale
|
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
|
class LLSimInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -96,17 +137,17 @@ public:
|
|||||||
LLVector3 getLocalPos(LLVector3d global_pos) const;
|
LLVector3 getLocalPos(LLVector3d global_pos) const;
|
||||||
|
|
||||||
void clearImage(); // Clears the reference to the Land for sale image for that region
|
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
|
void dropImagePriority(sim_layer_type layer = SIM_LAYER_COUNT); // 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 updateAgentCount(F64 time); // Send an item request for agent count on that region if time's up
|
void updateAgentCount(F64 time); // Send an item request for agent count on that region if time's up
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
void setName(std::string& name) { mName = name; }
|
void setName(std::string& name) { mName = name; }
|
||||||
void setSize(U16 sizeX, U16 sizeY) { mSizeX = sizeX; mSizeY = sizeY; }
|
void setAccess (U32 accesscode) { mAccess = accesscode; }
|
||||||
void setAccess (U8 accesscode) { mAccess = accesscode; }
|
|
||||||
void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; }
|
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 setAlpha(F32 alpha) { mAlpha = alpha; }
|
||||||
|
|
||||||
|
void setLandForSaleImage (LLUUID image_id);
|
||||||
void setMapImageID (const LLUUID& id, const U8 &layer) { mMapImageID[layer] = id; }
|
void setMapImageID (const LLUUID& id, const U8 &layer) { mMapImageID[layer] = id; }
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
@@ -115,43 +156,73 @@ public:
|
|||||||
const U32 getRegionFlags() const { return mRegionFlags; }
|
const U32 getRegionFlags() const { return mRegionFlags; }
|
||||||
const std::string getAccessString() const { return LLViewerRegion::accessToString((U8)mAccess); }
|
const std::string getAccessString() const { return LLViewerRegion::accessToString((U8)mAccess); }
|
||||||
const U8 getAccess() const { return 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 F32 getAlpha() const { return mAlpha; }
|
||||||
const U64 getHandle() const { return mHandle; }
|
|
||||||
const U16 getSizeX() const { return mSizeX; }
|
const U16 getSizeX() const { return mSizeX; }
|
||||||
const U16 getSizeY() const { return mSizeY; }
|
const U16 getSizeY() const { return mSizeY; }
|
||||||
bool isName(const std::string& name) const;
|
bool isName(const std::string& name) const;
|
||||||
bool isDown() { return (mAccess == SIM_ACCESS_DOWN); }
|
bool isDown() { return (mAccess == SIM_ACCESS_DOWN); }
|
||||||
bool isPG() { return (mAccess <= SIM_ACCESS_PG); }
|
bool isPG() { return (mAccess <= SIM_ACCESS_PG); }
|
||||||
bool isAdult() { return (mAccess == SIM_ACCESS_ADULT); }
|
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:
|
private:
|
||||||
U64 mHandle;
|
U64 mHandle;
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
F64 mAgentsUpdateTime; // Time stamp giving the last time the agents information was requested for that region
|
F64 mAgentsUpdateTime; // Time stamp giving the last time the agents information was requested for that region
|
||||||
bool mFirstAgentRequest; // Init agent request flag
|
bool mFirstAgentRequest; // Init agent request flag
|
||||||
U8 mAccess;
|
|
||||||
|
U32 mAccess; // Down/up and maturity rating of the region
|
||||||
U32 mRegionFlags;
|
U32 mRegionFlags;
|
||||||
F32 mWaterHeight;
|
|
||||||
U16 mSizeX;
|
U16 mSizeX;
|
||||||
U16 mSizeY;
|
U16 mSizeY;
|
||||||
|
|
||||||
F32 mAlpha;
|
F32 mAlpha;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BOOL mShowAgentLocations; // are agents visible?
|
// 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];
|
||||||
|
|
||||||
// Image ID for the current overlay mode.
|
// Items for this region
|
||||||
LLUUID mMapImageID[MAP_SIM_IMAGE_TYPES];
|
// 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
|
||||||
// Hold a reference to the currently displayed image.
|
item_info_list_t mInfohubs; // List of info hubs in the region
|
||||||
LLPointer<LLViewerFetchedTexture> mCurrentImage;
|
item_info_list_t mPGEvents; // List of PG events in the region
|
||||||
LLPointer<LLViewerFetchedTexture> mOverlayImage;
|
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
|
struct LLWorldMapLayer
|
||||||
{
|
{
|
||||||
BOOL LayerDefined;
|
BOOL LayerDefined;
|
||||||
@@ -162,6 +233,11 @@ struct LLWorldMapLayer
|
|||||||
LLWorldMapLayer() : LayerDefined(FALSE) { }
|
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>
|
class LLWorldMap : public LLSingleton<LLWorldMap>
|
||||||
{
|
{
|
||||||
@@ -175,78 +251,67 @@ public:
|
|||||||
// clears the list
|
// clears the list
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
// clear the visible items
|
void clearImageRefs(); // Clears the image references
|
||||||
void eraseItems();
|
void dropImagePriorities(); // Drops the priority of the images being fetched
|
||||||
|
void reloadItems(bool force = false); // Reload the items (people, hub, etc...)
|
||||||
// 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();
|
|
||||||
|
|
||||||
// Region Map access
|
// Region Map access
|
||||||
typedef std::map<U64, LLSimInfo*> sim_info_map_t;
|
typedef std::map<U64, LLSimInfo*> sim_info_map_t;
|
||||||
const LLWorldMap::sim_info_map_t& getRegionMap() const { return mSimInfoMap; }
|
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);
|
LLSimInfo* simInfoFromHandle(const U64 handle);
|
||||||
|
|
||||||
// Returns simulator information, or NULL if out of range
|
|
||||||
LLSimInfo* simInfoFromPosGlobal(const LLVector3d& pos_global);
|
LLSimInfo* simInfoFromPosGlobal(const LLVector3d& pos_global);
|
||||||
|
|
||||||
// Returns simulator information for named sim, or NULL if non-existent
|
|
||||||
LLSimInfo* simInfoFromName(const std::string& sim_name);
|
LLSimInfo* simInfoFromName(const std::string& sim_name);
|
||||||
|
|
||||||
// Gets simulator name for a global position, returns true if it was found
|
// Gets simulator name for a global position, returns true if it was found
|
||||||
bool simNameFromPosGlobal(const LLVector3d& pos_global, std::string& outSimName );
|
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 void gotMapServerURL(bool flag) { sGotMapURL = flag; }
|
||||||
static bool useWebMapTiles();
|
static bool useWebMapTiles();
|
||||||
static LLPointer<LLViewerFetchedTexture> loadObjectsTile(U32 grid_x, U32 grid_y);
|
|
||||||
|
|
||||||
void dump();
|
void dump();
|
||||||
|
|
||||||
// Extend the bounding box of the list of simulators. Returns true
|
// Track handling
|
||||||
// if the extents changed.
|
void cancelTracking() { mIsTrackingLocation = false; mIsTrackingFound = false; mIsInvalidLocation = false; mIsTrackingDoubleClick = false; mIsTrackingCommit = false; }
|
||||||
BOOL extendAABB(U32 x_min, U32 y_min, U32 x_max, U32 y_max);
|
|
||||||
|
|
||||||
// build coverage maps for telehub region visualization
|
void setTracking(const LLVector3d& loc) { mIsTrackingLocation = true; mTrackingLocation = loc; mIsTrackingFound = false; mIsInvalidLocation = false; mIsTrackingDoubleClick = false; mIsTrackingCommit = false;}
|
||||||
void updateTelehubCoverage();
|
void setTrackingInvalid() { mIsTrackingFound = true; mIsInvalidLocation = true; }
|
||||||
BOOL coveredByTelehub(LLSimInfo* infop);
|
void setTrackingValid() { mIsTrackingFound = true; mIsInvalidLocation = false; }
|
||||||
|
void setTrackingDoubleClick() { mIsTrackingDoubleClick = true; }
|
||||||
|
void setTrackingCommit() { mIsTrackingCommit = true; }
|
||||||
|
|
||||||
// Bounds of the world, in meters
|
bool isTracking() { return mIsTrackingLocation; }
|
||||||
U32 getWorldWidth() const;
|
bool isTrackingValidLocation() { return mIsTrackingFound && !mIsInvalidLocation; }
|
||||||
U32 getWorldHeight() const;
|
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(); }
|
||||||
|
|
||||||
// World Mipmap delegation: currently used when drawing the mipmap
|
// World Mipmap delegation: currently used when drawing the mipmap
|
||||||
void equalizeBoostLevels();
|
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); }
|
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:
|
private:
|
||||||
bool clearItems(bool force = false); // Clears the item lists
|
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
|
// Create a region record corresponding to the handle, insert it in the region map and returns a pointer
|
||||||
LLSimInfo* createSimInfoFromHandle(const U64 handle);
|
LLSimInfo* createSimInfoFromHandle(const U64 handle);
|
||||||
@@ -254,55 +319,34 @@ private:
|
|||||||
// Map from region-handle to simulator info
|
// Map from region-handle to simulator info
|
||||||
sim_info_map_t mSimInfoMap;
|
sim_info_map_t mSimInfoMap;
|
||||||
|
|
||||||
public:
|
// Request legacy background layers.
|
||||||
|
void sendMapLayerRequest();
|
||||||
|
|
||||||
BOOL mIsTrackingUnknownLocation, mInvalidLocation, mIsTrackingDoubleClick, mIsTrackingCommit;
|
std::vector<LLWorldMapLayer> mMapLayers;
|
||||||
LLVector3d mUnknownLocation;
|
bool mMapLoaded;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
LLWorldMipmap mWorldMipmap;
|
LLWorldMipmap mWorldMipmap;
|
||||||
|
|
||||||
LLTimer mRequestTimer;
|
// 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];
|
||||||
|
|
||||||
// search for named region for url processing
|
// Track location data : used while there's nothing tracked yet by LLTracker
|
||||||
std::string mSLURLRegionName;
|
bool mIsTrackingLocation; // True when we're tracking a point
|
||||||
U64 mSLURLRegionHandle;
|
bool mIsTrackingFound; // True when the tracking position has been found, valid or not
|
||||||
std::string mSLURL;
|
bool mIsInvalidLocation; // The region is down or the location does not correspond to an existing region
|
||||||
url_callback_t mSLURLCallback;
|
bool mIsTrackingDoubleClick; // User double clicked to set the location (i.e. teleport when found please...)
|
||||||
bool mSLURLTeleport;
|
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;
|
||||||
|
bool mFirstRequest;
|
||||||
|
|
||||||
static bool sGotMapURL;
|
static bool sGotMapURL;
|
||||||
};
|
};
|
||||||
|
|||||||
301
indra/newview/llworldmapmessage.cpp
Normal file
301
indra/newview/llworldmapmessage.cpp
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
79
indra/newview/llworldmapmessage.h
Normal file
79
indra/newview/llworldmapmessage.h
Normal 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
@@ -86,13 +86,14 @@ public:
|
|||||||
LLVector3d viewPosToGlobal(S32 x,S32 y);
|
LLVector3d viewPosToGlobal(S32 x,S32 y);
|
||||||
|
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawTiles(S32 width, S32 height);
|
void drawLegacyBackgroundLayers(S32 width, S32 height); //draw legacy background 'layer' tiles. Only available on official grids, I believe.
|
||||||
void drawGenericItems(const LLWorldMap::item_info_list_t& items, LLUIImagePtr image);
|
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 drawGenericItem(const LLItemInfo& item, LLUIImagePtr image);
|
||||||
void drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color = LLColor4::white);
|
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 drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color);
|
||||||
void drawAgents();
|
void drawAgents();
|
||||||
void drawEvents();
|
void drawItems();
|
||||||
void drawFrustum();
|
void drawFrustum();
|
||||||
void drawMipmap(S32 width, S32 height);
|
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);
|
||||||
@@ -119,7 +120,7 @@ public:
|
|||||||
S32 overlap );
|
S32 overlap );
|
||||||
static void drawAvatar( F32 x_pixels,
|
static void drawAvatar( F32 x_pixels,
|
||||||
F32 y_pixels,
|
F32 y_pixels,
|
||||||
LLColor4 color,
|
const LLColor4& color,
|
||||||
F32 relative_z = 0.f,
|
F32 relative_z = 0.f,
|
||||||
F32 dot_radius = 3.f);
|
F32 dot_radius = 3.f);
|
||||||
static void drawIconName(F32 x_pixels,
|
static void drawIconName(F32 x_pixels,
|
||||||
@@ -132,9 +133,7 @@ public:
|
|||||||
static void clearLastClick() { sHandledLastClick = FALSE; }
|
static void clearLastClick() { sHandledLastClick = FALSE; }
|
||||||
|
|
||||||
// if the view changes, download additional sim info as needed
|
// if the view changes, download additional sim info as needed
|
||||||
// return value is number of blocks newly requested.
|
void updateVisibleBlocks();
|
||||||
U32 updateBlock(S32 block_x, S32 block_y);
|
|
||||||
U32 updateVisibleBlocks();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDirectionPos( LLTextBox* text_box, F32 rotation );
|
void setDirectionPos( LLTextBox* text_box, F32 rotation );
|
||||||
@@ -161,8 +160,6 @@ public:
|
|||||||
static LLUIImagePtr sForSaleImage;
|
static LLUIImagePtr sForSaleImage;
|
||||||
static LLUIImagePtr sForSaleAdultImage;
|
static LLUIImagePtr sForSaleAdultImage;
|
||||||
|
|
||||||
static F32 sThresholdA;
|
|
||||||
static F32 sThresholdB;
|
|
||||||
static F32 sPixelsPerMeter; // world meters to map pixels
|
static F32 sPixelsPerMeter; // world meters to map pixels
|
||||||
|
|
||||||
static F32 sMapScale; // scale = size of a region in pixels
|
static F32 sMapScale; // scale = size of a region in pixels
|
||||||
@@ -202,6 +199,9 @@ public:
|
|||||||
handle_list_t mVisibleRegions; // set every frame
|
handle_list_t mVisibleRegions; // set every frame
|
||||||
|
|
||||||
static std::map<std::string,std::string> sStringsMap;
|
static std::map<std::string,std::string> sStringsMap;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void LLWorldMipmap::equalizeBoostLevels()
|
|||||||
// For each tile
|
// For each tile
|
||||||
for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
|
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();
|
S32 current_boost_level = img->getBoostLevel();
|
||||||
if (current_boost_level == LLViewerTexture::BOOST_MAP_VISIBLE)
|
if (current_boost_level == LLViewerTexture::BOOST_MAP_VISIBLE)
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,7 @@ void LLWorldMipmap::dropBoostLevels()
|
|||||||
// For each tile
|
// For each tile
|
||||||
for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
|
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);
|
img->setBoostLevel(LLViewerTexture::BOOST_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32
|
|||||||
// END DEBUG
|
// END DEBUG
|
||||||
//LL_INFOS("World Map") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL;
|
//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);
|
img->setBoostLevel(LLViewerTexture::BOOST_MAP);
|
||||||
|
|
||||||
// Return the smart pointer
|
// Return the smart pointer
|
||||||
@@ -224,7 +224,7 @@ void LLWorldMipmap::cleanMissedTilesFromLevel(S32 level)
|
|||||||
sublevel_tiles_t::iterator it = level_mipmap.begin();
|
sublevel_tiles_t::iterator it = level_mipmap.begin();
|
||||||
while (it != level_mipmap.end())
|
while (it != level_mipmap.end())
|
||||||
{
|
{
|
||||||
LLPointer<LLViewerTexture> img = it->second;
|
LLPointer<LLViewerFetchedTexture> img = it->second;
|
||||||
if (img->isMissingAsset())
|
if (img->isMissingAsset())
|
||||||
{
|
{
|
||||||
level_mipmap.erase(it++);
|
level_mipmap.erase(it++);
|
||||||
|
|||||||
@@ -172,7 +172,7 @@
|
|||||||
tool_tip="Copies current location as SLURL to be used on the web."
|
tool_tip="Copies current location as SLURL to be used on the web."
|
||||||
width="222" />
|
width="222" />
|
||||||
<slider bottom="-697" can_edit_text="false" decimal_digits="3" follows="right|bottom"
|
<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"
|
max_val="0" min_val="-8" mouse_opaque="true" name="zoom slider"
|
||||||
show_text="false" value="48.5029" width="222" />
|
show_text="false" value="48.5029" width="222" />
|
||||||
</floater>
|
</floater>
|
||||||
|
|||||||
@@ -123,6 +123,7 @@
|
|||||||
|
|
||||||
<!-- Indicates something is being loaded. Maybe should be merged with RetrievingData -->
|
<!-- Indicates something is being loaded. Maybe should be merged with RetrievingData -->
|
||||||
<string name="LoadingData">Loading...</string>
|
<string name="LoadingData">Loading...</string>
|
||||||
|
<string name="InvalidLocation">Invalid Location</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- namecache -->
|
<!-- namecache -->
|
||||||
|
|||||||
Reference in New Issue
Block a user