diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 73 | ||||
-rw-r--r-- | indra/newview/llpathfindingmanager.cpp | 39 | ||||
-rw-r--r-- | indra/newview/llpathfindingmanager.h | 8 | ||||
-rw-r--r-- | indra/newview/llpathfindingnavmeshzone.cpp | 194 | ||||
-rw-r--r-- | indra/newview/llpathfindingnavmeshzone.h | 40 |
5 files changed, 190 insertions, 164 deletions
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f2404dcb6b..fe5c6b8d44 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -171,77 +171,10 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1));
}
- mNavMeshZone.setCurrentRegionAsCenter();
- mNavMeshZone.refresh();
-#if 0
- LLPathingLib::getInstance()->cleanupResidual();
-
- mCurrentMDO = 0;
- mNavMeshCnt = 0;
-
- //make sure the region is essentially enabled for navmesh support
- std::string capability = "RetrieveNavMeshSrc";
-
- LLViewerRegion* pCurrentRegion = gAgent.getRegion();
- std::vector<LLViewerRegion*> regions;
- regions.push_back( pCurrentRegion );
- std::vector<int> shiftDirections;
- shiftDirections.push_back( CURRENT_REGION );
-
- mNeighboringRegion = gSavedSettings.getU32("RetrieveNeighboringRegion");
- if ( mNeighboringRegion != CURRENT_REGION )
- {
- //User wants to pull in a neighboring region
- std::vector<S32> availableRegions;
- pCurrentRegion->getNeighboringRegionsStatus( availableRegions );
- //Is the desired region in the available list
- std::vector<S32>::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mNeighboringRegion);
- if ( foundElem != availableRegions.end() )
- {
- LLViewerRegion* pCurrentRegion = gAgent.getRegion();
- std::vector<LLViewerRegion*> regionPtrs;
- pCurrentRegion->getNeighboringRegions( regionPtrs );
- regions.push_back( regionPtrs[mNeighboringRegion] );
- shiftDirections.push_back( mNeighboringRegion );
- }
- }
-
-
- //If the navmesh shift ops and the total region counts do not match - use the current region, only.
- if ( shiftDirections.size() != regions.size() )
- {
- shiftDirections.clear();regions.clear();
- regions.push_back( pCurrentRegion );
- shiftDirections.push_back( CURRENT_REGION );
- }
+ mNavMeshZone.initialize();
- int regionCnt = regions.size();
- mNavMeshCnt = regionCnt;
-
- for ( int i=0; i<regionCnt; ++i )
- {
- std::string url = regions[i]->getCapability( capability );
-
- if ( !url.empty() )
- {
- std::string str = getString("navmesh_fetch_inprogress");
- mPathfindingStatus->setText((LLStringExplicit)str);
- LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url );
- int dir = shiftDirections[i];
- LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir );
- ++mCurrentMDO;
- }
- else
- {
- --mNavMeshCnt;
- std::string str = getString("navmesh_region_not_enabled");
- LLStyle::Params styleParams;
- styleParams.color = LLUIColorTable::instance().getColor("DrYellow");
- mPathfindingStatus->setText((LLStringExplicit)str, styleParams);
- llinfos<<"Region has does not required caps of type ["<<capability<<"]"<<llendl;
- }
- }
-#endif
+ mNavMeshZone.enable();
+ mNavMeshZone.refresh();
}
if (!mAgentStateSlot.connected())
diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 7fbf9ba62c..8597498a76 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -204,15 +204,15 @@ bool LLPathfindingManager::isAllowViewTerrainProperties() const return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate()));
}
-LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForCurrentRegion(LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback)
+LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback)
{
- LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForCurrentRegion();
+ LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
return navMeshPtr->registerNavMeshListener(pNavMeshCallback);
}
-void LLPathfindingManager::requestGetNavMeshForCurrentRegion()
+void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion)
{
- LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForCurrentRegion();
+ LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
if (navMeshPtr->hasNavMeshVersion(mNavMeshVersionXXX))
{
@@ -220,14 +220,13 @@ void LLPathfindingManager::requestGetNavMeshForCurrentRegion() }
else
{
- LLViewerRegion *region = getCurrentRegion();
- if (region == NULL)
+ if (pRegion == NULL)
{
navMeshPtr->handleNavMeshNotEnabled();
}
else
{
- std::string navMeshURL = getRetrieveNavMeshURLForCurrentRegion();
+ std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion);
if (navMeshURL.empty())
{
navMeshPtr->handleNavMeshNotEnabled();
@@ -239,7 +238,7 @@ void LLPathfindingManager::requestGetNavMeshForCurrentRegion() LLSD postData;
postData["agent_id"] = gAgent.getID();
- postData["region_id"] = region->getRegionID();
+ postData["region_id"] = pRegion->getRegionID();
LLHTTPClient::post(navMeshURL, postData, responder);
}
}
@@ -371,14 +370,13 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestSetLin return status;
}
-LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForCurrentRegion()
+LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion)
{
LLUUID regionUUID;
- LLViewerRegion *region = getCurrentRegion();
- if (region != NULL)
+ if (pRegion != NULL)
{
- regionUUID = region->getRegionID();
+ regionUUID = pRegion->getRegionID();
}
LLPathfindingNavMeshPtr navMeshPtr;
@@ -469,6 +467,11 @@ std::string LLPathfindingManager::getRetrieveNavMeshURLForCurrentRegion() const return getCapabilityURLForCurrentRegion(CAP_SERVICE_RETRIEVE_NAVMESH);
}
+std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const
+{
+ return getCapabilityURLForRegion(pRegion, CAP_SERVICE_RETRIEVE_NAVMESH);
+}
+
std::string LLPathfindingManager::getAgentStateURLForCurrentRegion() const
{
return getCapabilityURLForCurrentRegion(CAP_SERVICE_AGENT_STATE);
@@ -486,18 +489,22 @@ std::string LLPathfindingManager::getTerrainLinksetsURLForCurrentRegion() const std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const
{
+ return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName);
+}
+
+std::string LLPathfindingManager::getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const
+{
std::string capabilityURL("");
- LLViewerRegion* region = getCurrentRegion();
- if (region != NULL)
+ if (pRegion != NULL)
{
- capabilityURL = region->getCapability(pCapabilityName);
+ capabilityURL = pRegion->getCapability(pCapabilityName);
}
if (capabilityURL.empty())
{
llwarns << "cannot find capability '" << pCapabilityName << "' for current region '"
- << ((region != NULL) ? region->getName() : "<null>") << "'" << llendl;
+ << ((pRegion != NULL) ? pRegion->getName() : "<null>") << "'" << llendl;
}
return capabilityURL;
diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index f034ddb9ea..eb8704e308 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -78,8 +78,8 @@ public: bool isAllowAlterPermanent();
bool isAllowViewTerrainProperties() const;
- LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForCurrentRegion(LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback);
- void requestGetNavMeshForCurrentRegion();
+ LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback);
+ void requestGetNavMeshForRegion(LLViewerRegion *pRegion);
agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback);
EAgentState getAgentState();
@@ -92,7 +92,7 @@ public: protected:
private:
- LLPathfindingNavMeshPtr getNavMeshForCurrentRegion();
+ LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion);
static bool isValidAgentState(EAgentState pAgentState);
@@ -102,11 +102,13 @@ private: void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL);
std::string getRetrieveNavMeshURLForCurrentRegion() const;
+ std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const;
std::string getAgentStateURLForCurrentRegion() const;
std::string getObjectLinksetsURLForCurrentRegion() const;
std::string getTerrainLinksetsURLForCurrentRegion() const;
std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const;
+ std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const;
LLViewerRegion *getCurrentRegion() const;
NavMeshMap mNavMeshMap;
diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index c6b9c6c338..7b9ac913c9 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -38,7 +38,9 @@ #include "LLPathingLib.h"
#include <string>
-#include <map>
+#include <vector>
+
+#include <boost/bind.hpp>
#define CENTER_REGION 99
@@ -47,9 +49,8 @@ //---------------------------------------------------------------------------
LLPathfindingNavMeshZone::LLPathfindingNavMeshZone()
- : mNavMeshLocations(),
- mNavMeshZoneSignal(),
- mNavMeshSlot()
+ : mNavMeshLocationPtrs(),
+ mNavMeshZoneSignal()
{
}
@@ -62,56 +63,68 @@ LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::register return mNavMeshZoneSignal.connect(pNavMeshZoneCallback);
}
-void LLPathfindingNavMeshZone::setCurrentRegionAsCenter()
+void LLPathfindingNavMeshZone::initialize()
{
llassert(LLPathingLib::getInstance() != NULL);
if (LLPathingLib::getInstance() != NULL)
{
LLPathingLib::getInstance()->cleanupResidual();
}
- mNavMeshLocations.clear();
- LLViewerRegion *currentRegion = gAgent.getRegion();
- const LLUUID ¤tRegionUUID = currentRegion->getRegionID();
- NavMeshLocation centerNavMesh(currentRegionUUID, CENTER_REGION);
- mNavMeshLocations.insert(std::pair<LLUUID, NavMeshLocation>(currentRegionUUID, centerNavMesh));
+ mNavMeshLocationPtrs.clear();
+
+ NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this)));
+ mNavMeshLocationPtrs.push_back(centerNavMeshPtr);
+
+ U32 neighborRegionDir = gSavedSettings.getU32("RetrieveNeighboringRegion");
+ if (neighborRegionDir != CENTER_REGION)
+ {
+ NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this)));
+ mNavMeshLocationPtrs.push_back(neighborNavMeshPtr);
+ }
}
-void LLPathfindingNavMeshZone::refresh()
+void LLPathfindingNavMeshZone::enable()
{
- LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance();
- if (!mNavMeshSlot.connected())
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
{
- mNavMeshSlot = pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4));
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->enable();
}
-
- pathfindingManagerInstance->requestGetNavMeshForCurrentRegion();
}
void LLPathfindingNavMeshZone::disable()
{
- if (mNavMeshSlot.connected())
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
{
- mNavMeshSlot.disconnect();
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->disable();
}
-
+#if 0
+ llassert(LLPathingLib::getInstance() != NULL);
if (LLPathingLib::getInstance() != NULL)
{
LLPathingLib::getInstance()->cleanupResidual();
}
-
- mNavMeshLocations.clear();
+#endif
}
-void LLPathfindingNavMeshZone::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData)
+void LLPathfindingNavMeshZone::refresh()
{
- NavMeshLocations::iterator navMeshIter = mNavMeshLocations.find(pRegionUUID);
- if (navMeshIter != mNavMeshLocations.end())
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
{
- navMeshIter->second.handleNavMesh(pNavMeshRequestStatus, pRegionUUID, pNavMeshVersion, pNavMeshData);
- updateStatus();
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->refresh();
}
}
+void LLPathfindingNavMeshZone::handleNavMeshLocation()
+{
+ updateStatus();
+}
+
void LLPathfindingNavMeshZone::updateStatus()
{
bool hasRequestUnknown = false;
@@ -120,10 +133,11 @@ void LLPathfindingNavMeshZone::updateStatus() bool hasRequestNotEnabled = false;
bool hasRequestError = false;
- for (NavMeshLocations::iterator navMeshIter = mNavMeshLocations.begin();
- navMeshIter != mNavMeshLocations.end(); ++navMeshIter)
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
{
- switch (navMeshIter->second.getRequestStatus())
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ switch (navMeshLocationPtr->getRequestStatus())
{
case LLPathfindingNavMesh::kNavMeshRequestUnknown :
hasRequestUnknown = true;
@@ -148,23 +162,14 @@ void LLPathfindingNavMeshZone::updateStatus() }
ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown;
- if (hasRequestNotEnabled)
+ if (hasRequestStarted)
{
- zoneRequestStatus = kNavMeshZoneRequestNotEnabled;
+ zoneRequestStatus = kNavMeshZoneRequestStarted;
}
else if (hasRequestError)
{
zoneRequestStatus = kNavMeshZoneRequestError;
}
- else if (hasRequestStarted)
- {
- zoneRequestStatus = kNavMeshZoneRequestStarted;
- }
- else if (hasRequestUnknown)
- {
- zoneRequestStatus = kNavMeshZoneRequestUnknown;
- llassert(0);
- }
else if (hasRequestCompleted)
{
zoneRequestStatus = kNavMeshZoneRequestCompleted;
@@ -174,6 +179,14 @@ void LLPathfindingNavMeshZone::updateStatus() LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") );
}
}
+ else if (hasRequestNotEnabled)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestNotEnabled;
+ }
+ else if (hasRequestUnknown)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestUnknown;
+ }
else
{
zoneRequestStatus = kNavMeshZoneRequestError;
@@ -187,26 +200,62 @@ void LLPathfindingNavMeshZone::updateStatus() // LLPathfindingNavMeshZone::NavMeshLocation
//---------------------------------------------------------------------------
-LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection)
- : mRegionUUID(pRegionUUID),
- mDirection(pDirection),
+LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback)
+ : mDirection(pDirection),
+ mRegionUUID(),
mHasNavMesh(false),
mNavMeshVersion(0U),
- mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown)
+ mLocationCallback(pLocationCallback),
+ mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown),
+ mNavMeshSlot()
{
}
-LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const NavMeshLocation &other)
- : mRegionUUID(other.mRegionUUID),
- mDirection(other.mDirection),
- mHasNavMesh(other.mHasNavMesh),
- mNavMeshVersion(other.mNavMeshVersion),
- mRequestStatus(other.mRequestStatus)
+LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation()
{
}
-LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation()
+void LLPathfindingNavMeshZone::NavMeshLocation::enable()
{
+ clear();
+
+ LLViewerRegion *region = getRegion();
+ if (region == NULL)
+ {
+ mRegionUUID.setNull();
+ }
+ else
+ {
+ mRegionUUID = region->getRegionID();
+ mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3, _4));
+ }
+}
+
+void LLPathfindingNavMeshZone::NavMeshLocation::refresh()
+{
+ LLViewerRegion *region = getRegion();
+
+ if (region == NULL)
+ {
+ llassert(mRegionUUID.isNull());
+ LLSD::Binary nullData;
+ handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestUnknown, mRegionUUID, 0U, nullData);
+ }
+ else
+ {
+ llassert(mRegionUUID == region->getRegionID());
+ LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region);
+ }
+}
+
+void LLPathfindingNavMeshZone::NavMeshLocation::disable()
+{
+ clear();
+}
+
+LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const
+{
+ return mRequestStatus;
}
void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData)
@@ -224,20 +273,45 @@ void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMe LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection);
}
}
+ mLocationCallback();
}
-LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const
+void LLPathfindingNavMeshZone::NavMeshLocation::clear()
{
- return mRequestStatus;
+ mHasNavMesh = false;
+ mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown;
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
}
-LLPathfindingNavMeshZone::NavMeshLocation &LLPathfindingNavMeshZone::NavMeshLocation::operator =(const NavMeshLocation &other)
+LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const
{
- mRegionUUID = other.mRegionUUID;
- mDirection = other.mDirection;
- mHasNavMesh = other.mHasNavMesh;
- mNavMeshVersion = other.mNavMeshVersion;
- mRequestStatus = other.mRequestStatus;
+ LLViewerRegion *region = NULL;
+
+ LLViewerRegion *currentRegion = gAgent.getRegion();
+ if (currentRegion != NULL)
+ {
+ if (mDirection == CENTER_REGION)
+ {
+ region = currentRegion;
+ }
+ else
+ {
+ //User wants to pull in a neighboring region
+ std::vector<S32> availableRegions;
+ currentRegion->getNeighboringRegionsStatus( availableRegions );
+ //Is the desired region in the available list
+ std::vector<S32>::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection);
+ if ( foundElem != availableRegions.end() )
+ {
+ std::vector<LLViewerRegion*> neighborRegionsPtrs;
+ currentRegion->getNeighboringRegions( neighborRegionsPtrs );
+ region = neighborRegionsPtrs[foundElem - availableRegions.begin()];
+ }
+ }
+ }
- return (*this);
+ return region;
}
diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 9d1139de32..8489b5899b 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -32,8 +32,9 @@ #include "lluuid.h"
#include "llpathfindingnavmesh.h"
-#include <map>
+#include <vector>
+#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <boost/signals2.hpp>
@@ -56,44 +57,53 @@ public: virtual ~LLPathfindingNavMeshZone();
navmesh_zone_slot_t registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback);
- void setCurrentRegionAsCenter();
- void refresh();
- void disable();
+ void initialize();
- void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData);
+ void enable();
+ void disable();
+ void refresh();
protected:
private:
+ typedef boost::function<void (void)> navmesh_location_callback_t;
class NavMeshLocation
{
public:
- NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection);
- NavMeshLocation(const NavMeshLocation &other);
+ NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback);
virtual ~NavMeshLocation();
- void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData);
- LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const;
+ void enable();
+ void refresh();
+ void disable();
- NavMeshLocation &operator =(const NavMeshLocation &other);
+ LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const;
protected:
private:
- LLUUID mRegionUUID;
+ void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData);
+
+ void clear();
+ LLViewerRegion *getRegion() const;
+
S32 mDirection;
+ LLUUID mRegionUUID;
bool mHasNavMesh;
U32 mNavMeshVersion;
+ navmesh_location_callback_t mLocationCallback;
LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus;
+ LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
};
- typedef std::map<LLUUID, NavMeshLocation> NavMeshLocations;
+ typedef boost::shared_ptr<NavMeshLocation> NavMeshLocationPtr;
+ typedef std::vector<NavMeshLocationPtr> NavMeshLocationPtrs;
+ void handleNavMeshLocation();
void updateStatus();
- NavMeshLocations mNavMeshLocations;
- navmesh_zone_signal_t mNavMeshZoneSignal;
- LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
+ NavMeshLocationPtrs mNavMeshLocationPtrs;
+ navmesh_zone_signal_t mNavMeshZoneSignal;
};
#endif // LL_LLPATHFINDINGNAVMESHZONE_H
|