Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51a71f27e9 | ||
|
|
d27e5a2676 | ||
|
|
f67c761341 | ||
|
|
e63279a692 | ||
|
|
a05fdaa63e | ||
|
|
ed457e3539 | ||
|
|
fc1fc600d9 | ||
|
|
68fa3ae13c | ||
|
|
19f9af6c29 | ||
|
|
3ce40cf763 |
@@ -494,6 +494,7 @@ set(viewer_SOURCE_FILES
|
|||||||
llwlparamset.cpp
|
llwlparamset.cpp
|
||||||
llworld.cpp
|
llworld.cpp
|
||||||
llworldmap.cpp
|
llworldmap.cpp
|
||||||
|
llworldmipmap.cpp
|
||||||
llmapresponders.cpp
|
llmapresponders.cpp
|
||||||
llworldmapview.cpp
|
llworldmapview.cpp
|
||||||
llxmlrpctransaction.cpp
|
llxmlrpctransaction.cpp
|
||||||
@@ -968,6 +969,7 @@ set(viewer_HEADER_FILES
|
|||||||
llwlparamset.h
|
llwlparamset.h
|
||||||
llworld.h
|
llworld.h
|
||||||
llworldmap.h
|
llworldmap.h
|
||||||
|
llworldmipmap.h
|
||||||
llmapresponders.h
|
llmapresponders.h
|
||||||
llworldmapview.h
|
llworldmapview.h
|
||||||
llxmlrpctransaction.h
|
llxmlrpctransaction.h
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -39,25 +39,24 @@
|
|||||||
#include "lleventpoll.h"
|
#include "lleventpoll.h"
|
||||||
#include "llagent.h"
|
#include "llagent.h"
|
||||||
//mk
|
//mk
|
||||||
|
#include "llappviewer.h"
|
||||||
#include "llfloaterteleporthistory.h"
|
#include "llfloaterteleporthistory.h"
|
||||||
#include "llfloaterworldmap.h"
|
#include "llfloaterworldmap.h"
|
||||||
#include "lltimer.h"
|
#include "lltimer.h"
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
#include "llurldispatcher.h"
|
#include "llurldispatcher.h"
|
||||||
#include "llurlsimstring.h"
|
#include "llurlsimstring.h"
|
||||||
#include "llviewercontrol.h" // gSavedSettings
|
#include "llviewercontrol.h"
|
||||||
#include "llviewerwindow.h"
|
#include "llviewerwindow.h"
|
||||||
#include "llweb.h"
|
#include "llweb.h"
|
||||||
|
|
||||||
#include "apr_time.h"
|
|
||||||
|
|
||||||
// globals
|
// globals
|
||||||
LLFloaterTeleportHistory* gFloaterTeleportHistory;
|
LLFloaterTeleportHistory* gFloaterTeleportHistory;
|
||||||
|
|
||||||
LLFloaterTeleportHistory::LLFloaterTeleportHistory()
|
LLFloaterTeleportHistory::LLFloaterTeleportHistory()
|
||||||
: LLFloater(std::string("teleporthistory")),
|
: LLFloater(std::string("teleporthistory")),
|
||||||
mPlacesList(NULL),
|
mPlacesList(NULL),
|
||||||
id(0)
|
mID(0)
|
||||||
{
|
{
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_teleport_history.xml", NULL);
|
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_teleport_history.xml", NULL);
|
||||||
}
|
}
|
||||||
@@ -71,7 +70,7 @@ LLFloaterTeleportHistory::~LLFloaterTeleportHistory()
|
|||||||
void LLFloaterTeleportHistory::onFocusReceived()
|
void LLFloaterTeleportHistory::onFocusReceived()
|
||||||
{
|
{
|
||||||
// take care to enable or disable buttons depending on the selection in the places list
|
// take care to enable or disable buttons depending on the selection in the places list
|
||||||
if(mPlacesList->getFirstSelected())
|
if (mPlacesList->getFirstSelected())
|
||||||
{
|
{
|
||||||
setButtonsEnabled(TRUE);
|
setButtonsEnabled(TRUE);
|
||||||
}
|
}
|
||||||
@@ -86,7 +85,7 @@ BOOL LLFloaterTeleportHistory::postBuild()
|
|||||||
{
|
{
|
||||||
// make sure the cached pointer to the scroll list is valid
|
// make sure the cached pointer to the scroll list is valid
|
||||||
mPlacesList=getChild<LLScrollListCtrl>("places_list");
|
mPlacesList=getChild<LLScrollListCtrl>("places_list");
|
||||||
if(!mPlacesList)
|
if (!mPlacesList)
|
||||||
{
|
{
|
||||||
llwarns << "coud not get pointer to places list" << llendl;
|
llwarns << "coud not get pointer to places list" << llendl;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -102,7 +101,7 @@ BOOL LLFloaterTeleportHistory::postBuild()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterTeleportHistory::addEntry(std::string regionName, S16 x, S16 y, S16 z)
|
void LLFloaterTeleportHistory::addPendingEntry(std::string regionName, S16 x, S16 y, S16 z)
|
||||||
{
|
{
|
||||||
#ifdef LL_RRINTERFACE_H //MK
|
#ifdef LL_RRINTERFACE_H //MK
|
||||||
if (gRRenabled && gAgent.mRRInterface.mContainsShowloc)
|
if (gRRenabled && gAgent.mRRInterface.mContainsShowloc)
|
||||||
@@ -110,51 +109,79 @@ void LLFloaterTeleportHistory::addEntry(std::string regionName, S16 x, S16 y, S1
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif //mk
|
#endif //mk
|
||||||
// only if the cached scroll list pointer is valid
|
|
||||||
if(mPlacesList)
|
// Set pending entry timestamp
|
||||||
|
U32 utc_time;
|
||||||
|
utc_time = time_corrected();
|
||||||
|
struct tm* internal_time;
|
||||||
|
internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);
|
||||||
|
// check if we are in daylight savings time
|
||||||
|
std::string timeZone = " PST";
|
||||||
|
if (gPacificDaylightTime)
|
||||||
{
|
{
|
||||||
// prepare display of position
|
timeZone = " PDT";
|
||||||
std::string position=llformat("%d, %d, %d", x, y, z);
|
}
|
||||||
// prepare simstring for later parsing
|
#ifdef LOCALIZED_TIME
|
||||||
std::string simString = regionName + llformat("/%d/%d/%d", x, y, z);
|
timeStructToFormattedString(internal_time, gSavedSettings.getString("LongTimeFormat"), mPendingTimeString);
|
||||||
simString = LLWeb::escapeURL(simString);
|
mPendingTimeString += timeZone;
|
||||||
|
#else
|
||||||
|
mPendingTimeString = llformat("%02d:%02d:%02d", internal_time->tm_hour, internal_time->tm_min, internal_time->tm_sec) + timeZone;
|
||||||
|
#endif
|
||||||
|
|
||||||
// check if we are in daylight savings time
|
// Set pending region name
|
||||||
std::string timeZone = "PST";
|
mPendingRegionName = regionName;
|
||||||
if(is_daylight_savings()) timeZone = "PDT";
|
|
||||||
|
|
||||||
// do all time related stuff as closely together as possible, because every other operation
|
// Set pending position
|
||||||
// might change the internal tm* buffer
|
mPendingPosition = llformat("%d, %d, %d", x, y, z);
|
||||||
struct tm* internal_time;
|
|
||||||
internal_time = utc_to_pacific_time(time_corrected(), is_daylight_savings());
|
|
||||||
std::string timeString=llformat("%02d:%02d:%02d ", internal_time->tm_hour, internal_time->tm_min, internal_time->tm_sec)+timeZone;
|
|
||||||
|
|
||||||
|
// prepare simstring for later parsing
|
||||||
|
mPendingSimString = regionName + llformat("/%d/%d/%d", x, y, z);
|
||||||
|
mPendingSimString = LLWeb::escapeURL(mPendingSimString);
|
||||||
|
|
||||||
|
// Prepare the SLURL
|
||||||
|
mPendingSLURL = LLURLDispatcher::buildSLURL(regionName, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLFloaterTeleportHistory::addEntry(std::string parcelName)
|
||||||
|
{
|
||||||
|
if (mPendingRegionName.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only if the cached scroll list pointer is valid
|
||||||
|
if (mPlacesList)
|
||||||
|
{
|
||||||
// build the list entry
|
// build the list entry
|
||||||
LLSD value;
|
LLSD value;
|
||||||
value["id"] = id;
|
value["id"] = mID;
|
||||||
value["columns"][0]["column"] = "region";
|
value["columns"][LIST_PARCEL]["column"] = "parcel";
|
||||||
value["columns"][0]["value"] = regionName;
|
value["columns"][LIST_PARCEL]["value"] = parcelName;
|
||||||
value["columns"][1]["column"] = "position";
|
value["columns"][LIST_REGION]["column"] = "region";
|
||||||
value["columns"][1]["value"] = position;
|
value["columns"][LIST_REGION]["value"] = mPendingRegionName;
|
||||||
value["columns"][2]["column"] = "visited";
|
value["columns"][LIST_POSITION]["column"] = "position";
|
||||||
value["columns"][2]["value"] = timeString;
|
value["columns"][LIST_POSITION]["value"] = mPendingPosition;
|
||||||
|
value["columns"][LIST_VISITED]["column"] = "visited";
|
||||||
|
value["columns"][LIST_VISITED]["value"] = mPendingTimeString;
|
||||||
|
|
||||||
// these columns are hidden and serve as data storage for simstring and SLURL
|
// these columns are hidden and serve as data storage for simstring and SLURL
|
||||||
value["columns"][3]["column"] = "slurl";
|
value["columns"][LIST_SLURL]["column"] = "slurl";
|
||||||
value["columns"][3]["value"] = LLURLDispatcher::buildSLURL(regionName, x, y, z);
|
value["columns"][LIST_SLURL]["value"] = mPendingSLURL;
|
||||||
value["columns"][4]["column"] = "simstring";
|
value["columns"][LIST_SIMSTRING]["column"] = "simstring";
|
||||||
value["columns"][4]["value"] = simString;
|
value["columns"][LIST_SIMSTRING]["value"] = mPendingSimString;
|
||||||
|
|
||||||
// add the new list entry on top of the list, deselect all and disable the buttons
|
// add the new list entry on top of the list, deselect all and disable the buttons
|
||||||
mPlacesList->addElement(value, ADD_TOP);
|
mPlacesList->addElement(value, ADD_TOP);
|
||||||
mPlacesList->deselectAllItems(TRUE);
|
mPlacesList->deselectAllItems(TRUE);
|
||||||
setButtonsEnabled(FALSE);
|
setButtonsEnabled(FALSE);
|
||||||
id++;
|
mID++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llwarns << "pointer to places list is NULL" << llendl;
|
llwarns << "pointer to places list is NULL" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mPendingRegionName.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterTeleportHistory::setButtonsEnabled(BOOL on)
|
void LLFloaterTeleportHistory::setButtonsEnabled(BOOL on)
|
||||||
@@ -185,7 +212,7 @@ void LLFloaterTeleportHistory::onPlacesSelected(LLUICtrl* /* ctrl */, void* data
|
|||||||
LLFloaterTeleportHistory* self = (LLFloaterTeleportHistory*) data;
|
LLFloaterTeleportHistory* self = (LLFloaterTeleportHistory*) data;
|
||||||
|
|
||||||
// on selection change check if we need to enable or disable buttons
|
// on selection change check if we need to enable or disable buttons
|
||||||
if(self->mPlacesList->getFirstSelected())
|
if (self->mPlacesList->getFirstSelected())
|
||||||
{
|
{
|
||||||
self->setButtonsEnabled(TRUE);
|
self->setButtonsEnabled(TRUE);
|
||||||
}
|
}
|
||||||
@@ -201,7 +228,7 @@ void LLFloaterTeleportHistory::onTeleport(void* data)
|
|||||||
LLFloaterTeleportHistory* self = (LLFloaterTeleportHistory*) data;
|
LLFloaterTeleportHistory* self = (LLFloaterTeleportHistory*) data;
|
||||||
|
|
||||||
// build secondlife::/app link from simstring for instant teleport to destination
|
// build secondlife::/app link from simstring for instant teleport to destination
|
||||||
std::string slapp="secondlife:///app/teleport/" + self->mPlacesList->getFirstSelected()->getColumn(4)->getValue().asString();
|
std::string slapp = "secondlife:///app/teleport/" + self->mPlacesList->getFirstSelected()->getColumn(LIST_SIMSTRING)->getValue().asString();
|
||||||
LLMediaCtrl* web = NULL;
|
LLMediaCtrl* web = NULL;
|
||||||
LLURLDispatcher::dispatch(slapp, web, TRUE);
|
LLURLDispatcher::dispatch(slapp, web, TRUE);
|
||||||
}
|
}
|
||||||
@@ -212,7 +239,7 @@ void LLFloaterTeleportHistory::onShowOnMap(void* data)
|
|||||||
LLFloaterTeleportHistory* self = (LLFloaterTeleportHistory*) data;
|
LLFloaterTeleportHistory* self = (LLFloaterTeleportHistory*) data;
|
||||||
|
|
||||||
// get simstring from selected entry and parse it for its components
|
// get simstring from selected entry and parse it for its components
|
||||||
std::string simString = self->mPlacesList->getFirstSelected()->getColumn(4)->getValue().asString();
|
std::string simString = self->mPlacesList->getFirstSelected()->getColumn(LIST_SIMSTRING)->getValue().asString();
|
||||||
std::string region = "";
|
std::string region = "";
|
||||||
S32 x = 128;
|
S32 x = 128;
|
||||||
S32 y = 128;
|
S32 y = 128;
|
||||||
@@ -231,6 +258,6 @@ void LLFloaterTeleportHistory::onCopySLURL(void* data)
|
|||||||
LLFloaterTeleportHistory* self = (LLFloaterTeleportHistory*) data;
|
LLFloaterTeleportHistory* self = (LLFloaterTeleportHistory*) data;
|
||||||
|
|
||||||
// get SLURL of the selected entry and copy it to the clipboard
|
// get SLURL of the selected entry and copy it to the clipboard
|
||||||
std::string SLURL=self->mPlacesList->getFirstSelected()->getColumn(3)->getValue().asString();
|
std::string SLURL = self->mPlacesList->getFirstSelected()->getColumn(LIST_SLURL)->getValue().asString();
|
||||||
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(SLURL));
|
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(SLURL));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,39 +45,54 @@
|
|||||||
|
|
||||||
class LLFloaterTeleportHistory : public LLFloater
|
class LLFloaterTeleportHistory : public LLFloater
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLFloaterTeleportHistory();
|
LLFloaterTeleportHistory();
|
||||||
virtual ~LLFloaterTeleportHistory();
|
virtual ~LLFloaterTeleportHistory();
|
||||||
|
|
||||||
/// @brief: reimplemented to check for selection changes in the places list scrolllist
|
/// @brief: reimplemented to check for selection changes in the places list scrolllist
|
||||||
virtual void onFocusReceived();
|
virtual void onFocusReceived();
|
||||||
|
|
||||||
/// @brief: reimplemented to make the menu toggle work
|
/// @brief: reimplemented to make the menu toggle work
|
||||||
virtual void onClose(bool app_quitting);
|
virtual void onClose(bool app_quitting);
|
||||||
|
|
||||||
/// @brief: reimplemented to prevent this floater from closing while the viewer is shutting down
|
/// @brief: reimplemented to prevent this floater from closing while the viewer is shutting down
|
||||||
virtual BOOL canClose();
|
virtual BOOL canClose();
|
||||||
|
|
||||||
BOOL postBuild();
|
BOOL postBuild();
|
||||||
|
|
||||||
/// @brief: adds a teleport destination to the list of visited places
|
/// @brief: adds the pending teleport destination
|
||||||
void addEntry(std::string regionName, S16 x, S16 y, S16 z);
|
void addPendingEntry(std::string regionName, S16 x, S16 y, S16 z);
|
||||||
|
/// @brief: adds the destination to the list of visited places
|
||||||
|
void addEntry(std::string parcelName);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
static void onPlacesSelected(LLUICtrl* ctrl, void* data);
|
enum HISTORY_COLUMN_ORDER
|
||||||
static void onTeleport(void* data);
|
{
|
||||||
static void onShowOnMap(void* data);
|
LIST_PARCEL,
|
||||||
static void onCopySLURL(void* data);
|
LIST_REGION,
|
||||||
|
LIST_POSITION,
|
||||||
|
LIST_VISITED,
|
||||||
|
LIST_SLURL,
|
||||||
|
LIST_SIMSTRING
|
||||||
|
};
|
||||||
|
|
||||||
/// @brief: enables or disables the "Teleport", "Show On Map" and "Copy To SLURL" buttons **/
|
static void onPlacesSelected(LLUICtrl* ctrl, void* data);
|
||||||
void setButtonsEnabled(BOOL on);
|
static void onTeleport(void* data);
|
||||||
|
static void onShowOnMap(void* data);
|
||||||
|
static void onCopySLURL(void* data);
|
||||||
|
|
||||||
LLScrollListCtrl* mPlacesList;
|
/// @brief: enables or disables the "Teleport", "Show On Map" and "Copy To SLURL" buttons **/
|
||||||
|
void setButtonsEnabled(BOOL on);
|
||||||
|
|
||||||
S32 id;
|
LLScrollListCtrl* mPlacesList;
|
||||||
|
|
||||||
/// @brief: to see if this was the first time setVisible() was called (at program startup)
|
S32 mID;
|
||||||
BOOL firstRun;
|
|
||||||
|
std::string mPendingRegionName;
|
||||||
|
std::string mPendingPosition;
|
||||||
|
std::string mPendingSimString;
|
||||||
|
std::string mPendingTimeString;
|
||||||
|
std::string mPendingSLURL;
|
||||||
};
|
};
|
||||||
|
|
||||||
// globals
|
// globals
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ LLFloaterWorldMap::LLFloaterWorldMap()
|
|||||||
{
|
{
|
||||||
LLCallbackMap::map_t factory_map;
|
LLCallbackMap::map_t factory_map;
|
||||||
factory_map["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL);
|
factory_map["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL);
|
||||||
factory_map["terrain_mapview"] = LLCallbackMap(createWorldMapView, NULL);
|
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", &factory_map);
|
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", &factory_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,30 +178,15 @@ void* LLFloaterWorldMap::createWorldMapView(void* data)
|
|||||||
|
|
||||||
BOOL LLFloaterWorldMap::postBuild()
|
BOOL LLFloaterWorldMap::postBuild()
|
||||||
{
|
{
|
||||||
mTabs = getChild<LLTabContainer>("maptab");
|
|
||||||
if (!mTabs) return FALSE;
|
|
||||||
|
|
||||||
LLPanel *panel;
|
|
||||||
|
|
||||||
panel = mTabs->getChild<LLPanel>("objects_mapview");
|
|
||||||
if (panel)
|
|
||||||
{
|
|
||||||
mTabs->setTabChangeCallback(panel, onCommitBackground);
|
|
||||||
mTabs->setTabUserData(panel, this);
|
|
||||||
}
|
|
||||||
panel = mTabs->getChild<LLPanel>("terrain_mapview");
|
|
||||||
if (panel)
|
|
||||||
{
|
|
||||||
mTabs->setTabChangeCallback(panel, onCommitBackground);
|
|
||||||
mTabs->setTabUserData(panel, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following callback syncs the worlmap tabs with the images.
|
// The following callback syncs the worlmap tabs with the images.
|
||||||
// Commented out since it was crashing when LLWorldMap became a singleton.
|
// Commented out since it was crashing when LLWorldMap became a singleton.
|
||||||
// We should be fine without it but override the onOpen method and put it
|
// We should be fine without it but override the onOpen method and put it
|
||||||
// there if it turns out to be needed. -MG
|
// there if it turns out to be needed. -MG
|
||||||
//
|
//
|
||||||
//onCommitBackground((void*)this, false);
|
//onCommitBackground((void*)this, false);
|
||||||
|
|
||||||
|
mPanel = getChild<LLPanel>("objects_mapview");
|
||||||
|
|
||||||
childSetCommitCallback("friend combo", onAvatarComboCommit, this);
|
childSetCommitCallback("friend combo", onAvatarComboCommit, this);
|
||||||
|
|
||||||
@@ -263,7 +247,7 @@ BOOL LLFloaterWorldMap::postBuild()
|
|||||||
LLFloaterWorldMap::~LLFloaterWorldMap()
|
LLFloaterWorldMap::~LLFloaterWorldMap()
|
||||||
{
|
{
|
||||||
// All cleaned up by LLView destructor
|
// All cleaned up by LLView destructor
|
||||||
mTabs = NULL;
|
mPanel = NULL;
|
||||||
|
|
||||||
// Inventory deletes all observers on shutdown
|
// Inventory deletes all observers on shutdown
|
||||||
mInventory = NULL;
|
mInventory = NULL;
|
||||||
@@ -296,7 +280,7 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target)
|
|||||||
gFloaterWorldMap->open(); /* Flawfinder: ignore */
|
gFloaterWorldMap->open(); /* Flawfinder: ignore */
|
||||||
|
|
||||||
LLWorldMapView* map_panel;
|
LLWorldMapView* map_panel;
|
||||||
map_panel = (LLWorldMapView*)gFloaterWorldMap->mTabs->getCurrentPanel();
|
map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel;
|
||||||
map_panel->clearLastClick();
|
map_panel->clearLastClick();
|
||||||
|
|
||||||
if (!was_visible)
|
if (!was_visible)
|
||||||
@@ -314,9 +298,8 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target)
|
|||||||
// Reload any maps that may have changed
|
// Reload any maps that may have changed
|
||||||
LLWorldMap::getInstance()->clearSimFlags();
|
LLWorldMap::getInstance()->clearSimFlags();
|
||||||
|
|
||||||
const S32 panel_num = gFloaterWorldMap->mTabs->getCurrentPanelIndex();
|
|
||||||
const bool request_from_sim = true;
|
const bool request_from_sim = true;
|
||||||
LLWorldMap::getInstance()->setCurrentLayer(panel_num, request_from_sim);
|
LLWorldMap::getInstance()->setCurrentLayer(0, request_from_sim);
|
||||||
|
|
||||||
// We may already have a bounding box for the regions of the world,
|
// We may already have a bounding box for the regions of the world,
|
||||||
// so use that to adjust the view.
|
// so use that to adjust the view.
|
||||||
@@ -1033,9 +1016,7 @@ void LLFloaterWorldMap::adjustZoomSliderBounds()
|
|||||||
world_height_regions++;
|
world_height_regions++;
|
||||||
|
|
||||||
// Find how much space we have to display the world
|
// Find how much space we have to display the world
|
||||||
LLWorldMapView* map_panel;
|
LLRect view_rect = mPanel->getRect();
|
||||||
map_panel = (LLWorldMapView*)mTabs->getCurrentPanel();
|
|
||||||
LLRect view_rect = map_panel->getRect();
|
|
||||||
|
|
||||||
// View size in pixels
|
// View size in pixels
|
||||||
S32 view_width = view_rect.getWidth();
|
S32 view_width = view_rect.getWidth();
|
||||||
@@ -1084,7 +1065,7 @@ void LLFloaterWorldMap::onPanBtn( void* userdata )
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLWorldMapView* map_panel;
|
LLWorldMapView* map_panel;
|
||||||
map_panel = (LLWorldMapView*)gFloaterWorldMap->mTabs->getCurrentPanel();
|
map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel;
|
||||||
map_panel->translatePan( pan_x, pan_y );
|
map_panel->translatePan( pan_x, pan_y );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1566,17 +1547,6 @@ void LLFloaterWorldMap::flyToAvatar()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
void LLFloaterWorldMap::onCommitBackground(void* userdata, bool from_click)
|
|
||||||
{
|
|
||||||
LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata;
|
|
||||||
|
|
||||||
// Find my index
|
|
||||||
S32 index = self->mTabs->getCurrentPanelIndex();
|
|
||||||
|
|
||||||
LLWorldMap::getInstance()->setCurrentLayer(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLFloaterWorldMap::updateSims(bool found_null_sim)
|
void LLFloaterWorldMap::updateSims(bool found_null_sim)
|
||||||
{
|
{
|
||||||
if (mCompletingRegionName == "")
|
if (mCompletingRegionName == "")
|
||||||
|
|||||||
@@ -123,8 +123,6 @@ protected:
|
|||||||
static void onAvatarComboPrearrange( LLUICtrl* ctrl, void* data );
|
static void onAvatarComboPrearrange( LLUICtrl* ctrl, void* data );
|
||||||
static void onAvatarComboCommit( LLUICtrl* ctrl, void* data );
|
static void onAvatarComboCommit( LLUICtrl* ctrl, void* data );
|
||||||
|
|
||||||
static void onCommitBackground(void* data, bool from_click);
|
|
||||||
|
|
||||||
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 );
|
||||||
|
|
||||||
@@ -162,8 +160,8 @@ protected:
|
|||||||
void cacheLandmarkPosition();
|
void cacheLandmarkPosition();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LLTabContainer* mTabs;
|
LLPanel* mPanel; // Panel displaying the map
|
||||||
|
|
||||||
// Sets sMapScale, in pixels per region
|
// Sets sMapScale, in pixels per region
|
||||||
F32 mCurZoomVal;
|
F32 mCurZoomVal;
|
||||||
LLFrameTimer mZoomTimer;
|
LLFrameTimer mZoomTimer;
|
||||||
|
|||||||
@@ -3748,7 +3748,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add teleport destination to the list of visited places
|
// add teleport destination to the list of visited places
|
||||||
gFloaterTeleportHistory->addEntry(regionp->getName(),(S16)agent_pos.mV[0],(S16)agent_pos.mV[1],(S16)agent_pos.mV[2]);
|
gFloaterTeleportHistory->addPendingEntry(regionp->getName(), (S16)agent_pos.mV[VX], (S16)agent_pos.mV[VY], (S16)agent_pos.mV[VZ]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2778,11 +2778,11 @@ LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& ass
|
|||||||
for( ; it != end; ++it)
|
for( ; it != end; ++it)
|
||||||
{
|
{
|
||||||
LLInventoryObject* obj = *it;
|
LLInventoryObject* obj = *it;
|
||||||
if(obj->getType() != LLAssetType::AT_CATEGORY)
|
if (obj && obj->getType() != LLAssetType::AT_CATEGORY && obj->getType() != LLAssetType::AT_NONE)
|
||||||
{
|
{
|
||||||
// *FIX: gank-ass down cast!
|
// *FIX: gank-ass down cast!
|
||||||
item = (LLViewerInventoryItem*)obj;
|
item = (LLViewerInventoryItem*)obj;
|
||||||
if(item->getAssetUUID() == asset_id)
|
if (item && item->getAssetUUID() == asset_id)
|
||||||
{
|
{
|
||||||
rv = item;
|
rv = item;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#include "llfloatergroups.h"
|
#include "llfloatergroups.h"
|
||||||
//#include "llfloaterhtml.h"
|
//#include "llfloaterhtml.h"
|
||||||
#include "llfloatersellland.h"
|
#include "llfloatersellland.h"
|
||||||
|
#include "llfloaterteleporthistory.h"
|
||||||
#include "llfloatertools.h"
|
#include "llfloatertools.h"
|
||||||
#include "llnotify.h"
|
#include "llnotify.h"
|
||||||
#include "llparcelselection.h"
|
#include "llparcelselection.h"
|
||||||
@@ -1518,6 +1519,9 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add any pending entry to the TP history now that we got the *new* parcel name.
|
||||||
|
gFloaterTeleportHistory->addEntry(LLViewerParcelMgr::getInstance()->getAgentParcelName());
|
||||||
|
|
||||||
// Handle updating selections, if necessary.
|
// Handle updating selections, if necessary.
|
||||||
if (sequence_id == SELECTED_PARCEL_SEQ_ID)
|
if (sequence_id == SELECTED_PARCEL_SEQ_ID)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1949,6 +1949,7 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info)
|
|||||||
LLVector3 scale(1.f, aspect, 1.f);
|
LLVector3 scale(1.f, aspect, 1.f);
|
||||||
mScreenp->setScale(scale);
|
mScreenp->setScale(scale);
|
||||||
mScreenp->setWorldPosition(LLVector3::zero);
|
mScreenp->setWorldPosition(LLVector3::zero);
|
||||||
|
mScreenp->mUpdateXform = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ void LLWorldMap::eraseItems()
|
|||||||
|
|
||||||
void LLWorldMap::clearImageRefs()
|
void LLWorldMap::clearImageRefs()
|
||||||
{
|
{
|
||||||
|
mWorldMipmap.reset();
|
||||||
|
|
||||||
for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
|
for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
|
||||||
{
|
{
|
||||||
LLSimInfo* info = (*it).second;
|
LLSimInfo* info = (*it).second;
|
||||||
@@ -231,6 +233,12 @@ void LLWorldMap::clearSimFlags()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLWorldMap::equalizeBoostLevels()
|
||||||
|
{
|
||||||
|
mWorldMipmap.equalizeBoostLevels();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LLSimInfo* LLWorldMap::simInfoFromPosGlobal(const LLVector3d& pos_global)
|
LLSimInfo* LLWorldMap::simInfoFromPosGlobal(const LLVector3d& pos_global)
|
||||||
{
|
{
|
||||||
U64 handle = to_region_handle(pos_global);
|
U64 handle = to_region_handle(pos_global);
|
||||||
@@ -294,6 +302,7 @@ bool LLWorldMap::simNameFromPosGlobal(const LLVector3d& pos_global, std::string
|
|||||||
|
|
||||||
void LLWorldMap::setCurrentLayer(S32 layer, bool request_layer)
|
void LLWorldMap::setCurrentLayer(S32 layer, bool request_layer)
|
||||||
{
|
{
|
||||||
|
//TODO: we only have 1 layer -SG
|
||||||
mCurrentMap = layer;
|
mCurrentMap = layer;
|
||||||
if (!mMapLoaded[layer] || request_layer)
|
if (!mMapLoaded[layer] || request_layer)
|
||||||
{
|
{
|
||||||
@@ -1070,3 +1079,19 @@ void LLWorldMap::updateTelehubCoverage()
|
|||||||
mTelehubCoverageMap[index] *= mNeighborMap[index];
|
mTelehubCoverageMap[index] *= mNeighborMap[index];
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drop priority of all images being fetched by the map
|
||||||
|
void LLWorldMap::dropImagePriorities()
|
||||||
|
{
|
||||||
|
// Drop the download of tiles priority to nil
|
||||||
|
mWorldMipmap.dropBoostLevels();
|
||||||
|
// Same for the "land for sale" tiles per region
|
||||||
|
for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it)
|
||||||
|
{
|
||||||
|
LLSimInfo* info = it->second;
|
||||||
|
if (!info->mOverlayImage.isNull())
|
||||||
|
{
|
||||||
|
info->mOverlayImage->setBoostLevel(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "v3dmath.h"
|
#include "v3dmath.h"
|
||||||
#include "llframetimer.h"
|
#include "llframetimer.h"
|
||||||
#include "llmapimagetype.h"
|
#include "llmapimagetype.h"
|
||||||
|
#include "llworldmipmap.h"
|
||||||
#include "lluuid.h"
|
#include "lluuid.h"
|
||||||
#include "llmemory.h"
|
#include "llmemory.h"
|
||||||
#include "llviewerimage.h"
|
#include "llviewerimage.h"
|
||||||
@@ -133,6 +134,9 @@ public:
|
|||||||
// Clears the flags indicating that we've received sim infos
|
// Clears the flags indicating that we've received sim infos
|
||||||
// Causes a re-request of the sim info without erasing extisting info
|
// Causes a re-request of the sim info without erasing extisting info
|
||||||
void clearSimFlags();
|
void clearSimFlags();
|
||||||
|
|
||||||
|
// Drops the priority of the images being fetched
|
||||||
|
void dropImagePriorities();
|
||||||
|
|
||||||
// Returns simulator information, or NULL if out of range
|
// Returns simulator information, or NULL if out of range
|
||||||
LLSimInfo* simInfoFromHandle(const U64 handle);
|
LLSimInfo* simInfoFromHandle(const U64 handle);
|
||||||
@@ -183,6 +187,13 @@ public:
|
|||||||
// Bounds of the world, in meters
|
// Bounds of the world, in meters
|
||||||
U32 getWorldWidth() const;
|
U32 getWorldWidth() const;
|
||||||
U32 getWorldHeight() const;
|
U32 getWorldHeight() const;
|
||||||
|
|
||||||
|
// World Mipmap delegation: currently used when drawing the mipmap
|
||||||
|
void equalizeBoostLevels();
|
||||||
|
LLPointer<LLViewerImage> getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load = true) {
|
||||||
|
return mWorldMipmap.getObjectsTile(grid_x, grid_y, level, load);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Map from region-handle to simulator info
|
// Map from region-handle to simulator info
|
||||||
typedef std::map<U64, LLSimInfo*> sim_info_map_t;
|
typedef std::map<U64, LLSimInfo*> sim_info_map_t;
|
||||||
@@ -224,6 +235,9 @@ public:
|
|||||||
S32 mNeighborMapHeight;
|
S32 mNeighborMapHeight;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
LLWorldMipmap mWorldMipmap;
|
||||||
|
|
||||||
LLTimer mRequestTimer;
|
LLTimer mRequestTimer;
|
||||||
|
|
||||||
// search for named region for url processing
|
// search for named region for url processing
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -87,6 +87,7 @@ 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 drawGenericItems(const LLWorldMap::item_info_list_t& items, LLUIImagePtr image);
|
void drawGenericItems(const LLWorldMap::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);
|
||||||
@@ -94,6 +95,8 @@ public:
|
|||||||
void drawAgents();
|
void drawAgents();
|
||||||
void drawEvents();
|
void drawEvents();
|
||||||
void drawFrustum();
|
void drawFrustum();
|
||||||
|
void drawMipmap(S32 width, S32 height);
|
||||||
|
bool drawMipmapLevel(S32 width, S32 height, S32 level, bool load = true);
|
||||||
|
|
||||||
static void cleanupTextures();
|
static void cleanupTextures();
|
||||||
|
|
||||||
@@ -173,6 +176,7 @@ public:
|
|||||||
static F32 sTargetPanY; // in pixels
|
static F32 sTargetPanY; // in pixels
|
||||||
static S32 sTrackingArrowX;
|
static S32 sTrackingArrowX;
|
||||||
static S32 sTrackingArrowY;
|
static S32 sTrackingArrowY;
|
||||||
|
static bool sVisibleTilesLoaded;
|
||||||
|
|
||||||
// Are we mid-pan from a user drag?
|
// Are we mid-pan from a user drag?
|
||||||
BOOL mPanning;
|
BOOL mPanning;
|
||||||
|
|||||||
274
indra/newview/llworldmipmap.cpp
Normal file
274
indra/newview/llworldmipmap.cpp
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
/**
|
||||||
|
* @file llworldmipmap.cpp
|
||||||
|
* @brief Data storage for the S3 mipmap of the entire world.
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003-2009, Linden Research, Inc.
|
||||||
|
*
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||||
|
* to you under the terms of the GNU General Public License, version 2.0
|
||||||
|
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||||
|
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||||
|
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||||
|
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||||
|
*
|
||||||
|
* There are special exceptions to the terms and conditions of the GPL as
|
||||||
|
* it is applied to this Source Code. View the full text of the exception
|
||||||
|
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||||
|
* online at
|
||||||
|
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||||
|
*
|
||||||
|
* By copying, modifying or distributing this software, you acknowledge
|
||||||
|
* that you have read and understood your obligations described above,
|
||||||
|
* and agree to abide by those obligations.
|
||||||
|
*
|
||||||
|
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||||
|
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||||
|
* COMPLETENESS OR PERFORMANCE.
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "llviewerprecompiledheaders.h"
|
||||||
|
|
||||||
|
#include "llworldmipmap.h"
|
||||||
|
|
||||||
|
#include "llviewercontrol.h"
|
||||||
|
#include "llviewerimagelist.h"
|
||||||
|
#include "math.h" // log()
|
||||||
|
|
||||||
|
// Turn this on to output tile stats in the standard output
|
||||||
|
#define DEBUG_TILES_STAT 0
|
||||||
|
|
||||||
|
LLWorldMipmap::LLWorldMipmap() :
|
||||||
|
mCurrentLevel(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LLWorldMipmap::~LLWorldMipmap()
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete all sublevel maps and clean them
|
||||||
|
void LLWorldMipmap::reset()
|
||||||
|
{
|
||||||
|
for (int level = 0; level < MAP_LEVELS; level++)
|
||||||
|
{
|
||||||
|
mWorldObjectsMipMap[level].clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method should be called before each use of the mipmap (typically, before each draw), so that to let
|
||||||
|
// the boost level of unused tiles to drop to 0 (BOOST_NONE).
|
||||||
|
// Tiles that are accessed have had their boost level pushed to BOOST_MAP_VISIBLE so we can identify them.
|
||||||
|
// The result of this strategy is that if a tile is not used during 2 consecutive loops, its boost level drops to 0.
|
||||||
|
void LLWorldMipmap::equalizeBoostLevels()
|
||||||
|
{
|
||||||
|
#if DEBUG_TILES_STAT
|
||||||
|
S32 nb_missing = 0;
|
||||||
|
S32 nb_tiles = 0;
|
||||||
|
S32 nb_visible = 0;
|
||||||
|
#endif // DEBUG_TILES_STAT
|
||||||
|
// For each level
|
||||||
|
for (S32 level = 0; level < MAP_LEVELS; level++)
|
||||||
|
{
|
||||||
|
sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level];
|
||||||
|
// For each tile
|
||||||
|
for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
|
||||||
|
{
|
||||||
|
LLPointer<LLViewerImage> img = iter->second;
|
||||||
|
S32 current_boost_level = img->getBoostLevel();
|
||||||
|
if (current_boost_level == LLViewerImageBoostLevel::BOOST_MAP_VISIBLE)
|
||||||
|
{
|
||||||
|
// If level was BOOST_MAP_VISIBLE, the tile has been used in the last draw so keep it high
|
||||||
|
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If level was BOOST_MAP only (or anything else...), the tile wasn't used in the last draw
|
||||||
|
// so we drop its boost level to BOOST_NONE.
|
||||||
|
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_NONE);
|
||||||
|
}
|
||||||
|
#if DEBUG_TILES_STAT
|
||||||
|
// Increment some stats if compile option on
|
||||||
|
nb_tiles++;
|
||||||
|
if (current_boost_level == LLViewerImageBoostLevel::BOOST_MAP_VISIBLE)
|
||||||
|
{
|
||||||
|
nb_visible++;
|
||||||
|
}
|
||||||
|
if (img->isMissingAsset())
|
||||||
|
{
|
||||||
|
nb_missing++;
|
||||||
|
}
|
||||||
|
#endif // DEBUG_TILES_STAT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if DEBUG_TILES_STAT
|
||||||
|
LL_INFOS("World Map") << "LLWorldMipmap tile stats : total requested = " << nb_tiles << ", visible = " << nb_visible << ", missing = " << nb_missing << LL_ENDL;
|
||||||
|
#endif // DEBUG_TILES_STAT
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method should be used when the mipmap is not actively used for a while, e.g., the map UI is hidden
|
||||||
|
void LLWorldMipmap::dropBoostLevels()
|
||||||
|
{
|
||||||
|
// For each level
|
||||||
|
for (S32 level = 0; level < MAP_LEVELS; level++)
|
||||||
|
{
|
||||||
|
sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level];
|
||||||
|
// For each tile
|
||||||
|
for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
|
||||||
|
{
|
||||||
|
LLPointer<LLViewerImage> img = iter->second;
|
||||||
|
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_NONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLPointer<LLViewerImage> LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load)
|
||||||
|
{
|
||||||
|
// Check the input data
|
||||||
|
llassert(level <= MAP_LEVELS);
|
||||||
|
llassert(level >= 1);
|
||||||
|
|
||||||
|
// If the *loading* level changed, cleared the new level from "missed" tiles
|
||||||
|
// so that we get a chance to reload them
|
||||||
|
if (load && (level != mCurrentLevel))
|
||||||
|
{
|
||||||
|
cleanMissedTilesFromLevel(level);
|
||||||
|
mCurrentLevel = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the region handle
|
||||||
|
U64 handle = convertGridToHandle(grid_x, grid_y);
|
||||||
|
|
||||||
|
// Check if the image is around already
|
||||||
|
sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
|
||||||
|
sublevel_tiles_t::iterator found = level_mipmap.find(handle);
|
||||||
|
|
||||||
|
// If not there and load on, go load it
|
||||||
|
if (found == level_mipmap.end())
|
||||||
|
{
|
||||||
|
if (load)
|
||||||
|
{
|
||||||
|
// Load it
|
||||||
|
LLPointer<LLViewerImage> img = loadObjectsTile(grid_x, grid_y, level);
|
||||||
|
// Insert the image in the map
|
||||||
|
level_mipmap.insert(sublevel_tiles_t::value_type( handle, img ));
|
||||||
|
// Find the element again in the map (it's there now...)
|
||||||
|
found = level_mipmap.find(handle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Return with NULL if not found and we're not trying to load
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the image pointer and check if this asset is missing
|
||||||
|
LLPointer<LLViewerImage> img = found->second;
|
||||||
|
if (img->isMissingAsset())
|
||||||
|
{
|
||||||
|
// Return NULL if asset missing
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Boost the tile level so to mark it's in use *if* load on
|
||||||
|
if (load)
|
||||||
|
{
|
||||||
|
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP_VISIBLE);
|
||||||
|
}
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLPointer<LLViewerImage> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 grid_y, S32 level)
|
||||||
|
{
|
||||||
|
// Get the grid coordinates
|
||||||
|
std::string imageurl = gSavedSettings.getString("MapServerURL") + llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y);
|
||||||
|
|
||||||
|
// DO NOT COMMIT!! DEBUG ONLY!!!
|
||||||
|
// Use a local jpeg for every tile to test map speed without S3 access
|
||||||
|
//imageurl = "file://C:\\Develop\\mapserver-distribute-3\\indra\\build-vc80\\mapserver\\relwithdebinfo\\regions\\00995\\01001\\region-995-1001-prims.jpg";
|
||||||
|
// END DEBUG
|
||||||
|
//LL_INFOS("World Map") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL;
|
||||||
|
|
||||||
|
LLPointer<LLViewerImage> img = gImageList.getImageFromUrl(imageurl);
|
||||||
|
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP);
|
||||||
|
|
||||||
|
// Return the smart pointer
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method is used to clean up a level from tiles marked as "missing".
|
||||||
|
// The idea is to allow tiles that have been improperly marked missing to be reloaded when retraversing the level again.
|
||||||
|
// When zooming in and out rapidly, some tiles are never properly loaded and, eventually marked missing.
|
||||||
|
// This creates "blue" areas in a subresolution that never got a chance to reload if we don't clean up the level.
|
||||||
|
void LLWorldMipmap::cleanMissedTilesFromLevel(S32 level)
|
||||||
|
{
|
||||||
|
// Check the input data
|
||||||
|
llassert(level <= MAP_LEVELS);
|
||||||
|
llassert(level >= 0);
|
||||||
|
|
||||||
|
// This happens when the object is first initialized
|
||||||
|
if (level == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate through the subresolution level and suppress the tiles that are marked as missing
|
||||||
|
// Note: erasing in a map while iterating through it is bug prone. Using a postfix increment is mandatory here.
|
||||||
|
sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
|
||||||
|
sublevel_tiles_t::iterator it = level_mipmap.begin();
|
||||||
|
while (it != level_mipmap.end())
|
||||||
|
{
|
||||||
|
LLPointer<LLViewerImage> img = it->second;
|
||||||
|
if (img->isMissingAsset())
|
||||||
|
{
|
||||||
|
level_mipmap.erase(it++);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static methods
|
||||||
|
// Compute the level in the world mipmap (between 1 and MAP_LEVELS, as in the URL) given the scale (size of a sim in screen pixels)
|
||||||
|
S32 LLWorldMipmap::scaleToLevel(F32 scale)
|
||||||
|
{
|
||||||
|
// If scale really small, picks up the higest level there is (lowest resolution)
|
||||||
|
if (scale <= F32_MIN)
|
||||||
|
return MAP_LEVELS;
|
||||||
|
// Compute the power of two resolution level knowing the base level
|
||||||
|
S32 level = llfloor((log(REGION_WIDTH_METERS/scale)/log(2.0f)) + 1.0f);
|
||||||
|
// Check bounds and return the value
|
||||||
|
if (level > MAP_LEVELS)
|
||||||
|
return MAP_LEVELS;
|
||||||
|
else if (level < 1)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert world coordinates to mipmap grid coordinates at a given level (between 1 and MAP_LEVELS)
|
||||||
|
void LLWorldMipmap::globalToMipmap(F64 global_x, F64 global_y, S32 level, U32* grid_x, U32* grid_y)
|
||||||
|
{
|
||||||
|
// Check the input data
|
||||||
|
llassert(level <= MAP_LEVELS);
|
||||||
|
llassert(level >= 1);
|
||||||
|
|
||||||
|
// Convert world coordinates into grid coordinates
|
||||||
|
*grid_x = lltrunc(global_x/REGION_WIDTH_METERS);
|
||||||
|
*grid_y = lltrunc(global_y/REGION_WIDTH_METERS);
|
||||||
|
// Compute the valid grid coordinates at that level of the mipmap
|
||||||
|
S32 regions_in_tile = 1 << (level - 1);
|
||||||
|
*grid_x = *grid_x - (*grid_x % regions_in_tile);
|
||||||
|
*grid_y = *grid_y - (*grid_y % regions_in_tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
100
indra/newview/llworldmipmap.h
Normal file
100
indra/newview/llworldmipmap.h
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
/**
|
||||||
|
* @file llworldmipmap.h
|
||||||
|
* @brief Data storage for the S3 mipmap of the entire world.
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003-2009, Linden Research, Inc.
|
||||||
|
*
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||||
|
* to you under the terms of the GNU General Public License, version 2.0
|
||||||
|
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||||
|
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||||
|
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||||
|
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||||
|
*
|
||||||
|
* There are special exceptions to the terms and conditions of the GPL as
|
||||||
|
* it is applied to this Source Code. View the full text of the exception
|
||||||
|
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||||
|
* online at
|
||||||
|
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||||
|
*
|
||||||
|
* By copying, modifying or distributing this software, you acknowledge
|
||||||
|
* that you have read and understood your obligations described above,
|
||||||
|
* and agree to abide by those obligations.
|
||||||
|
*
|
||||||
|
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||||
|
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||||
|
* COMPLETENESS OR PERFORMANCE.
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_LLWORLDMIPMAP_H
|
||||||
|
#define LL_LLWORLDMIPMAP_H
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include "llmemory.h" // LLPointer
|
||||||
|
#include "indra_constants.h" // REGION_WIDTH_UNITS
|
||||||
|
#include "llregionhandle.h" // to_region_handle()
|
||||||
|
|
||||||
|
class LLViewerImage;
|
||||||
|
|
||||||
|
// LLWorldMipmap : Mipmap handling of all the tiles used to render the world at any resolution.
|
||||||
|
// This class provides a clean structured access to the hierarchy of tiles stored in the
|
||||||
|
// Amazon S3 repository and abstracts its directory/file structure.
|
||||||
|
// The interface of this class though still assumes that the caller knows the general level/tiles
|
||||||
|
// structure (at least, that it exists...) but doesn't requite the caller to know the details of it.
|
||||||
|
// IOW, you need to know that rendering levels exists as well as grid coordinates for regions,
|
||||||
|
// but you can ignore where those tiles are located, how to get them, etc...
|
||||||
|
// The class API gives you back LLPointer<LLViewerImage> per tile.
|
||||||
|
|
||||||
|
// See llworldmipmapview.cpp for the implementation of a class who knows how to render an LLWorldMipmap.
|
||||||
|
|
||||||
|
// Implementation notes:
|
||||||
|
// - On the S3 servers, the tiles are rendered in 2 flavors: Objects and Terrain.
|
||||||
|
// - For the moment, LLWorldMipmap implements access only to the Objects tiles.
|
||||||
|
class LLWorldMipmap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Parameters of the mipmap
|
||||||
|
static const S32 MAP_LEVELS = 8; // Number of subresolution levels computed by the mapserver
|
||||||
|
static const S32 MAP_TILE_SIZE = 256; // Width in pixels of the tiles computed by the mapserver
|
||||||
|
|
||||||
|
LLWorldMipmap();
|
||||||
|
~LLWorldMipmap();
|
||||||
|
|
||||||
|
// Clear up the maps and release all image handles
|
||||||
|
void reset();
|
||||||
|
// Manage the boost levels between loops (typically draw() loops)
|
||||||
|
void equalizeBoostLevels();
|
||||||
|
// Drop the boost levels to none (used when hiding the map)
|
||||||
|
void dropBoostLevels();
|
||||||
|
// Get the tile smart pointer, does the loading if necessary
|
||||||
|
LLPointer<LLViewerImage> getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load = true);
|
||||||
|
|
||||||
|
// Helper functions: those are here as they depend solely on the topology of the mipmap though they don't access it
|
||||||
|
// Convert sim scale (given in sim width in display pixels) into a mipmap level
|
||||||
|
static S32 scaleToLevel(F32 scale);
|
||||||
|
// Convert world coordinates to mipmap grid coordinates at a given level
|
||||||
|
static void globalToMipmap(F64 global_x, F64 global_y, S32 level, U32* grid_x, U32* grid_y);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Get a handle (key) from grid coordinates
|
||||||
|
U64 convertGridToHandle(U32 grid_x, U32 grid_y) { return to_region_handle(grid_x * REGION_WIDTH_UNITS, grid_y * REGION_WIDTH_UNITS); }
|
||||||
|
// Load the relevant tile from S3
|
||||||
|
LLPointer<LLViewerImage> loadObjectsTile(U32 grid_x, U32 grid_y, S32 level);
|
||||||
|
// Clear a level from its "missing" tiles
|
||||||
|
void cleanMissedTilesFromLevel(S32 level);
|
||||||
|
|
||||||
|
// The mipmap is organized by resolution level (MAP_LEVELS of them). Each resolution level is an std::map
|
||||||
|
// using a region_handle as a key and storing a smart pointer to the image as a value.
|
||||||
|
typedef std::map<U64, LLPointer<LLViewerImage> > sublevel_tiles_t;
|
||||||
|
sublevel_tiles_t mWorldObjectsMipMap[MAP_LEVELS];
|
||||||
|
// sublevel_tiles_t mWorldTerrainMipMap[MAP_LEVELS];
|
||||||
|
|
||||||
|
S32 mCurrentLevel; // The level last accessed by a getObjectsTile()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LL_LLWORLDMIPMAP_H
|
||||||
@@ -1,46 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||||
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="false"
|
<floater name="teleporthistory" title="Teleport History" rect_control="FloaterTeleportHistoryRect"
|
||||||
min_width="470" min_height="250" width="470" height="250" name="teleporthistory"
|
can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
|
||||||
rect_control="FloaterTeleportHistoryRect" title="Teleport History">
|
min_width="550" min_height="150" width="550" height="200">
|
||||||
<tab_container label="TPlistTabs" bottom="40" height="185" left="5" mouse_opaque="false" name="tplisttabs"
|
<scroll_list name="places_list" can_resize="true" multi_select="false"
|
||||||
tab_min_width="50" tab_position="top" width="460" bg_opaque_color="0,0,0,0.0">
|
background_visible="true" draw_border="true" draw_stripes="true" draw_heading="true"
|
||||||
<panel border="true" bottom="-185" follows="left|top|right|bottom" height="185"
|
height="150" width="530" bottom_delta="-170" top="10" left="10" follows="left|top|right|bottom">
|
||||||
label="Teleported into" left="2" mouse_opaque="true" name="TP-in" width="455">
|
<column name="parcel" label="Parcel" dynamicwidth="true" />
|
||||||
<scroll_list background_visible="true" draw_border="true" draw_stripes="true"
|
<column name="region" label="Region" width="150" />
|
||||||
draw_heading="true" follows="left|top|right|bottom" left="2" top="5" width="450"
|
<column name="position" label="Position" width="90" />
|
||||||
height="175" bottom_delta="-177" multi_select="false" name="places_list_in">
|
<column name="visited" label="Visited" width="110" />
|
||||||
<column dynamicwidth="true" label="Region" name="region" />
|
<!--Hidden fields, used as storage for prebuilt strings, please keep at width 0-->
|
||||||
<column dynamicwidth="true" label="Position" name="position" />
|
<column name="slurl" label="" width="0" />
|
||||||
<column dynamicwidth="true" label="Visited" name="visited" />
|
<column name="simstring" label="" width="0" />
|
||||||
<!--Hidden fields, used as storage for prebuilt strings, please keep at width 0-->
|
</scroll_list>
|
||||||
<column width="0" label="SLURL" name="slurl" />
|
<button name="teleport" label="Teleport" tool_tip="Teleport to selected location"
|
||||||
<column width="0" label="Sim String" name="simstring" />
|
enabled="false" mouse_opaque="true" font="SansSerif" halign="center"
|
||||||
</scroll_list>
|
height="20" width="90" bottom_delta="-24" left="10" follows="left|bottom"
|
||||||
</panel>
|
/>
|
||||||
<panel border="true" bottom="-185" follows="left|top|right|bottom" height="185"
|
<button name="show_on_map" label="Show on map" tool_tip="Center map on selected location."
|
||||||
label="Teleported out of" left="2" mouse_opaque="true" name="TP-out" width="455">
|
enabled="false" mouse_opaque="true" font="SansSerif" halign="center"
|
||||||
<scroll_list background_visible="true" draw_border="true" draw_stripes="true"
|
height="20" width="125" bottom_delta="0" left_delta="100" follows="left|bottom"
|
||||||
draw_heading="true" follows="left|top|right|bottom" left="2" top="5" width="450"
|
/>
|
||||||
height="175" bottom_delta="-177" multi_select="false" name="places_list_out">
|
<button name="copy_slurl" label="Copy SLURL to clipboard" tool_tip="Copy selected location as SLURL."
|
||||||
<column dynamicwidth="true" label="Region" name="region" />
|
enabled="false" mouse_opaque="true" font="SansSerif" halign="center"
|
||||||
<column dynamicwidth="true" label="Position" name="position" />
|
height="20" width="180" bottom_delta="0" left_delta="135" follows="left|bottom"
|
||||||
<column dynamicwidth="true" label="Visited" name="visited" />
|
/>
|
||||||
<!--Hidden fields, used as storage for prebuilt strings, please keep at width 0-->
|
</floater>
|
||||||
<column width="0" label="SLURL" name="slurl" />
|
|
||||||
<column width="0" label="Sim String" name="simstring" />
|
|
||||||
</scroll_list>
|
|
||||||
</panel>
|
|
||||||
</tab_container>
|
|
||||||
<button
|
|
||||||
bottom_delta="-24" enabled="false" follows="left|bottom" font="SansSerif" halign="center"
|
|
||||||
width="90" height="20" label="Teleport" label_selected="Teleport"
|
|
||||||
left="10" mouse_opaque="true" name="teleport" tool_tip="Teleport to selected location" />
|
|
||||||
<button bottom_delta="0" enabled="false" follows="left|bottom" font="SansSerif" halign="center"
|
|
||||||
height="20" label="Show On Map" label_selected="Show On Map"
|
|
||||||
left_delta="100" mouse_opaque="true" name="show_on_map"
|
|
||||||
tool_tip="Center map on this location" width="125" />
|
|
||||||
<button bottom_delta="0" enabled="false" follows="bottom|right" font="SansSerif"
|
|
||||||
height="20" label="Copy SLURL to clipboard" left="-230" name="copy_slurl"
|
|
||||||
tool_tip="Copies current location as SLURL to be used on the web."
|
|
||||||
width="222" />
|
|
||||||
</floater>
|
|
||||||
|
|||||||
@@ -2,13 +2,8 @@
|
|||||||
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
|
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
|
||||||
height="711" min_height="520" min_width="410" name="worldmap"
|
height="711" min_height="520" min_width="410" name="worldmap"
|
||||||
rect_control="FloaterWorldMapRect2" title="World Map" width="1243">
|
rect_control="FloaterWorldMapRect2" title="World Map" width="1243">
|
||||||
<tab_container bottom="-701" follows="left|top|right|bottom" height="681" left="15"
|
<panel bottom="-701" follows="left|top|right|bottom" height="681"
|
||||||
mouse_opaque="false" name="maptab" tab_position="top" width="995">
|
left="15" mouse_opaque="true" name="objects_mapview" width="995" />
|
||||||
<panel bottom="-680" follows="left|top|right|bottom" height="664" label="Objects"
|
|
||||||
left="1" mouse_opaque="true" name="objects_mapview" width="993" />
|
|
||||||
<panel bottom="-680" follows="left|top|right|bottom" height="664" label="Terrain"
|
|
||||||
left="1" mouse_opaque="true" name="terrain_mapview" width="993" />
|
|
||||||
</tab_container>
|
|
||||||
<icon bottom="-50" color="1, 1, 1, 1" follows="top|right" height="16"
|
<icon bottom="-50" color="1, 1, 1, 1" follows="top|right" height="16"
|
||||||
image_name="map_avatar_16.tga" left="1013" mouse_opaque="true" name="self"
|
image_name="map_avatar_16.tga" left="1013" mouse_opaque="true" name="self"
|
||||||
width="16" />
|
width="16" />
|
||||||
|
|||||||
Reference in New Issue
Block a user