summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorTodd Stinson <stinson@lindenlab.com>2012-03-05 17:20:35 -0800
committerTodd Stinson <stinson@lindenlab.com>2012-03-05 17:20:35 -0800
commit581de7c7b8025c48e585c1af80e060af94aca328 (patch)
treed74607d3a789a46a55fb3fbfe3e655e7dbb95fb3 /indra/newview
parent58af94e02ff11b878850a758f5b9e4ffb251ddf3 (diff)
PATH-205,PATH-304: More work to handle downloading of out-of-date navmeshes.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llfloaterpathfindingconsole.cpp114
-rw-r--r--indra/newview/llfloaterpathfindingconsole.h77
-rw-r--r--indra/newview/llpathfindingnavmesh.cpp6
-rw-r--r--indra/newview/llpathfindingnavmesh.h3
-rw-r--r--indra/newview/llpathfindingnavmeshzone.cpp230
-rw-r--r--indra/newview/llpathfindingnavmeshzone.h99
-rw-r--r--indra/newview/skins/default/xui/en/floater_pathfinding_console.xml3
8 files changed, 396 insertions, 138 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index c5eac457fd..44cb23b648 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -421,6 +421,7 @@ set(viewer_SOURCE_FILES
llpathfindinglinksetlist.cpp
llpathfindingmanager.cpp
llpathfindingnavmesh.cpp
+ llpathfindingnavmeshzone.cpp
llphysicsmotion.cpp
llphysicsshapebuilderutil.cpp
llplacesinventorybridge.cpp
@@ -975,6 +976,7 @@ set(viewer_HEADER_FILES
llpathfindinglinksetlist.h
llpathfindingmanager.h
llpathfindingnavmesh.h
+ llpathfindingnavmeshzone.h
llphysicsmotion.h
llphysicsshapebuilderutil.h
llplacesinventorybridge.h
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp
index 02f2bf8d72..094f7749c1 100644
--- a/indra/newview/llfloaterpathfindingconsole.cpp
+++ b/indra/newview/llfloaterpathfindingconsole.cpp
@@ -46,7 +46,7 @@
#include "llviewerwindow.h"
#include "llviewercamera.h"
#include "llviewercontrol.h"
-#include "llpathfindingnavmesh.h"
+#include "llpathfindingnavmeshzone.h"
#include "llpathfindingmanager.h"
#include "LLPathingLib.h"
@@ -64,9 +64,6 @@
#define XUI_TEST_TAB_INDEX 1
-const int CURRENT_REGION = 99;
-const int MAX_OBSERVERS = 10;
-
LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHandle;
//---------------------------------------------------------------------------
@@ -165,16 +162,17 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey)
if ( LLPathingLib::getInstance() == NULL )
{
setConsoleState(kConsoleStateLibraryNotImplemented);
- llwarns <<"Errror: cannout find pathing library implementation."<<llendl;
+ llwarns <<"Errror: cannot find pathing library implementation."<<llendl;
}
else
{
- LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance();
- if (!mNavMeshSlot.connected())
+ if (!mNavMeshZoneSlot.connected())
{
- pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLFloaterPathfindingConsole::onNavMeshDownloadCB, this, _1, _2, _3, _4));
+ mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1));
}
- pathfindingManagerInstance->requestGetNavMeshForCurrentRegion();
+
+ mNavMeshZone.setCurrentRegionAsCenter();
+ mNavMeshZone.refresh();
#if 0
LLPathingLib::getInstance()->cleanupResidual();
@@ -262,12 +260,13 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting)
mAgentStateSlot.disconnect();
}
- if (mNavMeshSlot.connected())
+ if (mNavMeshZoneSlot.connected())
{
- mNavMeshSlot.disconnect();
+ mNavMeshZoneSlot.disconnect();
}
- clearNavMesh();
+ //mNavMeshZone.disable();
+
LLFloater::onClose(pIsAppQuitting);
setHeartBeat( false );
setConsoleState(kConsoleStateUnknown);
@@ -516,26 +515,6 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType
mCharacterTypeRadioGroup->setValue(radioGroupValue);
}
-#if 0
-void LLFloaterPathfindingConsole::setHasNavMeshReceived()
-{
- std::string str = getString("navmesh_fetch_complete_available");
- mPathfindingStatus->setText((LLStringExplicit)str);
- //check to see if all regions are done loading and they are then stitch the navmeshes together
- --mNavMeshCnt;
- if ( mNavMeshCnt == 0 )
- {
- LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") );
- }
-}
-
-void LLFloaterPathfindingConsole::setHasNoNavMesh()
-{
- std::string str = getString("navmesh_fetch_complete_none");
- mPathfindingStatus->setText((LLStringExplicit)str);
-}
-#endif
-
LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
: LLFloater(pSeed),
mSelfHandle(),
@@ -561,27 +540,16 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
mCharacterTypeRadioGroup(NULL),
mPathTestingStatus(NULL),
mClearPathButton(NULL),
- mNavMeshSlot(),
+ mNavMeshZoneSlot(),
+ mNavMeshZone(),
mAgentStateSlot(),
mConsoleState(kConsoleStateUnknown),
- mHasNavMesh(false),
- mNavMeshRegionVersion(0U),
- mNavMeshRegionUUID(),
-#if 0
- mNavMeshCnt(0),
- mNeighboringRegion( CURRENT_REGION ),
-#endif
+ mPathData(),
mHasStartPoint(false),
mHasEndPoint(false),
mHeartBeat( false )
{
mSelfHandle.bind(this);
-#if 0
- for (int i=0;i<MAX_OBSERVERS;++i)
- {
- mNavMeshDownloadObserver[i].setPathfindingConsole(this);
- }
-#endif
}
LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole()
@@ -705,57 +673,30 @@ void LLFloaterPathfindingConsole::onClearPathClicked()
updatePathTestStatus();
}
-void LLFloaterPathfindingConsole::onNavMeshDownloadCB(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData)
+void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus)
{
-
- switch (pNavMeshRequestStatus)
+ switch (pNavMeshZoneRequestStatus)
{
- case LLPathfindingNavMesh::kNavMeshRequestStarted :
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted :
setConsoleState(kConsoleStateDownloading);
break;
- case LLPathfindingNavMesh::kNavMeshRequestCompleted :
- updateNavMesh(pRegionUUID, pNavMeshVersion, pNavMeshData);
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted :
setConsoleState(kConsoleStateHasNavMesh);
break;
- case LLPathfindingNavMesh::kNavMeshRequestNotEnabled :
- clearNavMesh();
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled :
setConsoleState(kConsoleStateRegionNotEnabled);
break;
- case LLPathfindingNavMesh::kNavMeshRequestMessageError :
- clearNavMesh();
- setConsoleState(kConsoleStateDownloadError);
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestError :
+ setConsoleState(kConsoleStateError);
break;
- case LLPathfindingNavMesh::kNavMeshRequestFormatError :
- clearNavMesh();
- setConsoleState(kConsoleStateNavMeshError);
- break;
- case LLPathfindingNavMesh::kNavMeshRequestUnknown :
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown :
default:
- clearNavMesh();
setConsoleState(kConsoleStateUnknown);
llassert(0);
break;
}
}
-void LLFloaterPathfindingConsole::updateNavMesh(const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData)
-{
- if (!mHasNavMesh || (mNavMeshRegionUUID != pRegionUUID) || (mNavMeshRegionVersion != pNavMeshVersion))
- {
- llassert(!pNavMeshData.empty());
- mHasNavMesh = true;
- mNavMeshRegionUUID = pRegionUUID;
- mNavMeshRegionVersion = pNavMeshVersion;
- LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, CURRENT_REGION);
- }
-}
-
-void LLFloaterPathfindingConsole::clearNavMesh()
-{
- mHasNavMesh = false;
- LLPathingLib::getInstance()->cleanupResidual();
-}
-
void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState)
{
setAgentState(pAgentState);
@@ -792,8 +733,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState()
mHasEndPoint = false;
break;
case kConsoleStateDownloading :
- case kConsoleStateDownloadError :
- case kConsoleStateNavMeshError :
+ case kConsoleStateError :
mShowNavMeshCheckBox->setEnabled(FALSE);
mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
mShowWalkablesCheckBox->setEnabled(FALSE);
@@ -861,12 +801,8 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState()
case kConsoleStateHasNavMeshDownloading :
statusText = getString("navmesh_status_has_navmesh_downloading");
break;
- case kConsoleStateDownloadError :
- statusText = getString("navmesh_status_download_error");
- styleParams.color = warningColor;
- break;
- case kConsoleStateNavMeshError :
- statusText = getString("navmesh_status_navmesh_error");
+ case kConsoleStateError :
+ statusText = getString("navmesh_status_error");
styleParams.color = warningColor;
break;
default :
diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h
index 237d4216bb..b1886fb716 100644
--- a/indra/newview/llfloaterpathfindingconsole.h
+++ b/indra/newview/llfloaterpathfindingconsole.h
@@ -32,7 +32,7 @@
#include "llhandle.h"
#include "LLPathingLib.h"
#include "llpathfindingmanager.h"
-#include "llpathfindingnavmesh.h"
+#include "llpathfindingnavmeshzone.h"
class LLSD;
class LLPanel;
@@ -123,8 +123,7 @@ private:
kConsoleStateDownloading,
kConsoleStateHasNavMesh,
kConsoleStateHasNavMeshDownloading,
- kConsoleStateDownloadError,
- kConsoleStateNavMeshError
+ kConsoleStateError
} EConsoleState;
// Does its own instance management, so clients not allowed
@@ -141,12 +140,10 @@ private:
void onFreezeClicked();
void onViewEditLinksetClicked();
void onClearPathClicked();
- void onNavMeshDownloadCB(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData);
+ void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus);
void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState);
void setConsoleState(EConsoleState pConsoleState);
- void updateNavMesh(const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData);
- void clearNavMesh();
void updateControlsOnConsoleState();
void updateStatusOnConsoleState();
@@ -158,48 +155,44 @@ private:
void resetShapeRenderFlags() { mShapeRenderFlags = 0; }
void setShapeRenderFlag( LLPathingLib::LLShapeType type ) { mShapeRenderFlags |= (1<<type); }
- LLRootHandle<LLFloaterPathfindingConsole> mSelfHandle;
- LLCheckBoxCtrl *mShowNavMeshCheckBox;
- LLComboBox *mShowNavMeshWalkabilityComboBox;
- LLCheckBoxCtrl *mShowWalkablesCheckBox;
- LLCheckBoxCtrl *mShowStaticObstaclesCheckBox;
- LLCheckBoxCtrl *mShowMaterialVolumesCheckBox;
- LLCheckBoxCtrl *mShowExclusionVolumesCheckBox;
- LLCheckBoxCtrl *mShowWorldCheckBox;
- LLTextBase *mPathfindingStatus;
- LLButton *mViewCharactersButton;
- LLTabContainer *mEditTestTabContainer;
- LLPanel *mEditTab;
- LLPanel *mTestTab;
- LLTextBase *mUnfreezeLabel;
- LLButton *mUnfreezeButton;
- LLTextBase *mLinksetsLabel;
- LLButton *mLinksetsButton;
- LLTextBase *mFreezeLabel;
- LLButton *mFreezeButton;
- LLSliderCtrl *mCharacterWidthSlider;
- LLRadioGroup *mCharacterTypeRadioGroup;
- LLTextBase *mPathTestingStatus;
- LLButton *mClearPathButton;
- LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
- LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
- EConsoleState mConsoleState;
- bool mHasNavMesh;
- U32 mNavMeshRegionVersion;
- LLUUID mNavMeshRegionUUID;
-
-#if 0
- LLNavMeshDownloadObserver mNavMeshDownloadObserver[10];
- int mCurrentMDO;
- int mNavMeshCnt;
- U32 mNeighboringRegion;
-#endif
+ LLRootHandle<LLFloaterPathfindingConsole> mSelfHandle;
+ LLCheckBoxCtrl *mShowNavMeshCheckBox;
+ LLComboBox *mShowNavMeshWalkabilityComboBox;
+ LLCheckBoxCtrl *mShowWalkablesCheckBox;
+ LLCheckBoxCtrl *mShowStaticObstaclesCheckBox;
+ LLCheckBoxCtrl *mShowMaterialVolumesCheckBox;
+ LLCheckBoxCtrl *mShowExclusionVolumesCheckBox;
+ LLCheckBoxCtrl *mShowWorldCheckBox;
+ LLTextBase *mPathfindingStatus;
+ LLButton *mViewCharactersButton;
+ LLTabContainer *mEditTestTabContainer;
+ LLPanel *mEditTab;
+ LLPanel *mTestTab;
+ LLTextBase *mUnfreezeLabel;
+ LLButton *mUnfreezeButton;
+ LLTextBase *mLinksetsLabel;
+ LLButton *mLinksetsButton;
+ LLTextBase *mFreezeLabel;
+ LLButton *mFreezeButton;
+ LLSliderCtrl *mCharacterWidthSlider;
+ LLRadioGroup *mCharacterTypeRadioGroup;
+ LLTextBase *mPathTestingStatus;
+ LLButton *mClearPathButton;
+
+
+ LLPathfindingNavMeshZone::navmesh_zone_slot_t mNavMeshZoneSlot;
+ LLPathfindingNavMeshZone mNavMeshZone;
+ LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
+
+ EConsoleState mConsoleState;
+
//Container that is populated and subsequently submitted to the LLPathingSystem for processing
LLPathingLib::PathingPacket mPathData;
bool mHasStartPoint;
bool mHasEndPoint;
U32 mShapeRenderFlags;
bool mHeartBeat;
+
static LLHandle<LLFloaterPathfindingConsole> sInstanceHandle;
};
diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp
index fd1a498e3b..469972efa9 100644
--- a/indra/newview/llpathfindingnavmesh.cpp
+++ b/indra/newview/llpathfindingnavmesh.cpp
@@ -87,7 +87,7 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes
if ( !valid )
{
llwarns << "Unable to decompress the navmesh llsd." << llendl;
- setRequestStatus(kNavMeshRequestFormatError);
+ setRequestStatus(kNavMeshRequestError);
}
else
{
@@ -104,7 +104,7 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes
else
{
llwarns << "No mesh data received" << llendl;
- setRequestStatus(kNavMeshRequestMessageError);
+ setRequestStatus(kNavMeshRequestError);
}
}
}
@@ -122,7 +122,7 @@ void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pR
mNavMeshData.clear();
if (mNavMeshVersion == pNavMeshVersion)
{
- setRequestStatus(kNavMeshRequestMessageError);
+ setRequestStatus(kNavMeshRequestError);
}
}
diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h
index 1f033e15c7..26ef21f90e 100644
--- a/indra/newview/llpathfindingnavmesh.h
+++ b/indra/newview/llpathfindingnavmesh.h
@@ -50,8 +50,7 @@ public:
kNavMeshRequestStarted,
kNavMeshRequestCompleted,
kNavMeshRequestNotEnabled,
- kNavMeshRequestMessageError,
- kNavMeshRequestFormatError
+ kNavMeshRequestError
} ENavMeshRequestStatus;
typedef boost::function<void (ENavMeshRequestStatus, const LLUUID &, U32, const LLSD::Binary &)> navmesh_callback_t;
diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp
new file mode 100644
index 0000000000..986acfa3e8
--- /dev/null
+++ b/indra/newview/llpathfindingnavmeshzone.cpp
@@ -0,0 +1,230 @@
+/**
+ * @file llpathfindingnavmeshzone.cpp
+ * @author William Todd Stinson
+ * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region.
+ *
+ * $LicenseInfo:firstyear=2002&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 "llsd.h"
+#include "lluuid.h"
+#include "llagent.h"
+#include "llviewerregion.h"
+#include "llpathfindingnavmesh.h"
+#include "llpathfindingnavmeshzone.h"
+#include "llpathfindingmanager.h"
+#include "llviewercontrol.h"
+
+#include "LLPathingLib.h"
+
+#include <string>
+#include <map>
+
+#define CENTER_REGION 99
+
+//---------------------------------------------------------------------------
+// LLPathfindingNavMeshZone
+//---------------------------------------------------------------------------
+
+LLPathfindingNavMeshZone::LLPathfindingNavMeshZone()
+ : mNavMeshLocations(),
+ mNavMeshZoneSignal(),
+ mNavMeshSlot()
+{
+}
+
+LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone()
+{
+}
+
+LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback)
+{
+ return mNavMeshZoneSignal.connect(pNavMeshZoneCallback);
+}
+
+void LLPathfindingNavMeshZone::setCurrentRegionAsCenter()
+{
+ llassert(LLPathingLib::getInstance() != NULL);
+ LLPathingLib::getInstance()->cleanupResidual();
+ mNavMeshLocations.clear();
+ LLViewerRegion *currentRegion = gAgent.getRegion();
+ const LLUUID &currentRegionUUID = currentRegion->getRegionID();
+ NavMeshLocation centerNavMesh(currentRegionUUID, CENTER_REGION);
+ mNavMeshLocations.insert(std::pair<LLUUID, NavMeshLocation>(currentRegionUUID, centerNavMesh));
+}
+
+void LLPathfindingNavMeshZone::refresh()
+{
+ LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance();
+ if (!mNavMeshSlot.connected())
+ {
+ pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4));
+ }
+
+ pathfindingManagerInstance->requestGetNavMeshForCurrentRegion();
+}
+
+void LLPathfindingNavMeshZone::disable()
+{
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
+
+ llassert(LLPathingLib::getInstance() != NULL);
+ LLPathingLib::getInstance()->cleanupResidual();
+
+ mNavMeshLocations.clear();
+}
+
+void LLPathfindingNavMeshZone::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData)
+{
+ NavMeshLocations::iterator navMeshIter = mNavMeshLocations.find(pRegionUUID);
+ if (navMeshIter != mNavMeshLocations.end())
+ {
+ navMeshIter->second.handleNavMesh(pNavMeshRequestStatus, pRegionUUID, pNavMeshVersion, pNavMeshData);
+ updateStatus();
+ }
+}
+
+void LLPathfindingNavMeshZone::updateStatus()
+{
+ bool hasRequestUnknown = false;
+ bool hasRequestStarted = false;
+ bool hasRequestCompleted = false;
+ bool hasRequestNotEnabled = false;
+ bool hasRequestError = false;
+
+ for (NavMeshLocations::iterator navMeshIter = mNavMeshLocations.begin();
+ navMeshIter != mNavMeshLocations.end(); ++navMeshIter)
+ {
+ switch (navMeshIter->second.getRequestStatus())
+ {
+ case LLPathfindingNavMesh::kNavMeshRequestUnknown :
+ hasRequestUnknown = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestStarted :
+ hasRequestStarted = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestCompleted :
+ hasRequestCompleted = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestNotEnabled :
+ hasRequestNotEnabled = true;
+ break;
+ case LLPathfindingNavMesh::kNavMeshRequestError :
+ hasRequestError = true;
+ break;
+ default :
+ hasRequestError = true;
+ llassert(0);
+ break;
+ }
+ }
+
+ ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown;
+ if (hasRequestNotEnabled)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestNotEnabled;
+ }
+ else if (hasRequestError)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestError;
+ }
+ else if (hasRequestStarted)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestStarted;
+ }
+ else if (hasRequestUnknown)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestUnknown;
+ llassert(0);
+ }
+ else if (hasRequestCompleted)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestCompleted;
+ LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") );
+ }
+ else
+ {
+ zoneRequestStatus = kNavMeshZoneRequestError;
+ llassert(0);
+ }
+
+ mNavMeshZoneSignal(zoneRequestStatus);
+}
+
+//---------------------------------------------------------------------------
+// LLPathfindingNavMeshZone::NavMeshLocation
+//---------------------------------------------------------------------------
+
+LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection)
+ : mRegionUUID(pRegionUUID),
+ mDirection(pDirection),
+ mHasNavMesh(false),
+ mNavMeshVersion(0U),
+ mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown)
+{
+}
+
+LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const NavMeshLocation &other)
+ : mRegionUUID(other.mRegionUUID),
+ mDirection(other.mDirection),
+ mHasNavMesh(other.mHasNavMesh),
+ mNavMeshVersion(other.mNavMeshVersion),
+ mRequestStatus(other.mRequestStatus)
+{
+}
+
+LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation()
+{
+}
+
+void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData)
+{
+ llassert(mRegionUUID == pRegionUUID);
+ mRequestStatus = pNavMeshRequestStatus;
+ if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion)))
+ {
+ llassert(!pNavMeshData.empty());
+ mHasNavMesh = true;
+ mNavMeshVersion = pNavMeshVersion;
+ LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection);
+ }
+}
+
+LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const
+{
+ return mRequestStatus;
+}
+
+LLPathfindingNavMeshZone::NavMeshLocation &LLPathfindingNavMeshZone::NavMeshLocation::operator =(const NavMeshLocation &other)
+{
+ mRegionUUID = other.mRegionUUID;
+ mDirection = other.mDirection;
+ mHasNavMesh = other.mHasNavMesh;
+ mNavMeshVersion = other.mNavMeshVersion;
+ mRequestStatus = other.mRequestStatus;
+
+ return (*this);
+}
diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h
new file mode 100644
index 0000000000..9d1139de32
--- /dev/null
+++ b/indra/newview/llpathfindingnavmeshzone.h
@@ -0,0 +1,99 @@
+/**
+ * @file llpathfindingnavmeshzone.h
+ * @author William Todd Stinson
+ * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region.
+ *
+ * $LicenseInfo:firstyear=2002&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_LLPATHFINDINGNAVMESHZONE_H
+#define LL_LLPATHFINDINGNAVMESHZONE_H
+
+#include "llsd.h"
+#include "lluuid.h"
+#include "llpathfindingnavmesh.h"
+
+#include <map>
+
+#include <boost/function.hpp>
+#include <boost/signals2.hpp>
+
+class LLPathfindingNavMeshZone
+{
+public:
+ typedef enum {
+ kNavMeshZoneRequestUnknown,
+ kNavMeshZoneRequestStarted,
+ kNavMeshZoneRequestCompleted,
+ kNavMeshZoneRequestNotEnabled,
+ kNavMeshZoneRequestError
+ } ENavMeshZoneRequestStatus;
+
+ typedef boost::function<void (ENavMeshZoneRequestStatus)> navmesh_zone_callback_t;
+ typedef boost::signals2::signal<void (ENavMeshZoneRequestStatus)> navmesh_zone_signal_t;
+ typedef boost::signals2::connection navmesh_zone_slot_t;
+
+ LLPathfindingNavMeshZone();
+ virtual ~LLPathfindingNavMeshZone();
+
+ navmesh_zone_slot_t registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback);
+ void setCurrentRegionAsCenter();
+ void refresh();
+ void disable();
+
+ void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData);
+
+protected:
+
+private:
+ class NavMeshLocation
+ {
+ public:
+ NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection);
+ NavMeshLocation(const NavMeshLocation &other);
+ virtual ~NavMeshLocation();
+
+ void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData);
+ LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const;
+
+ NavMeshLocation &operator =(const NavMeshLocation &other);
+
+ protected:
+
+ private:
+ LLUUID mRegionUUID;
+ S32 mDirection;
+ bool mHasNavMesh;
+ U32 mNavMeshVersion;
+ LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus;
+ };
+
+ typedef std::map<LLUUID, NavMeshLocation> NavMeshLocations;
+
+ void updateStatus();
+
+ NavMeshLocations mNavMeshLocations;
+ navmesh_zone_signal_t mNavMeshZoneSignal;
+ LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
+};
+
+#endif // LL_LLPATHFINDINGNAVMESHZONE_H
diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml
index 5577083303..6c97af2878 100644
--- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml
+++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml
@@ -17,8 +17,7 @@
<floater.string name="navmesh_status_downloading">Downloading the navmesh ...</floater.string>
<floater.string name="navmesh_status_has_navmesh">Navmesh received.</floater.string>
<floater.string name="navmesh_status_has_navmesh_downloading">Downloading the latest navmesh ...</floater.string>
- <floater.string name="navmesh_status_download_error">Unable to download navmesh successfully.</floater.string>
- <floater.string name="navmesh_status_navmesh_error">Unable to understand data format of the navmesh.</floater.string>
+ <floater.string name="navmesh_status_error">Unable to download navmesh successfully.</floater.string>
<floater.string name="pathing_choose_start_and_end_points">Please choose start and end points.</floater.string>
<floater.string name="pathing_choose_start_point">Please choose start point.</floater.string>
<floater.string name="pathing_choose_end_point">Please choose end point.</floater.string>