diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/CMakeLists.txt | 6 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingbasic.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 333 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.h | 84 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llnavmeshstation.cpp | 134 | ||||
-rw-r--r-- | indra/newview/llnavmeshstation.h | 101 | ||||
-rw-r--r-- | indra/newview/llpathfindingmanager.cpp | 131 | ||||
-rw-r--r-- | indra/newview/llpathfindingmanager.h | 27 | ||||
-rw-r--r-- | indra/newview/llpathfindingnavmesh.cpp | 133 | ||||
-rw-r--r-- | indra/newview/llpathfindingnavmesh.h | 85 | ||||
-rw-r--r-- | indra/newview/llpathfindingnavmeshzone.cpp | 311 | ||||
-rw-r--r-- | indra/newview/llpathfindingnavmeshzone.h | 109 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_console.xml | 13 |
14 files changed, 1029 insertions, 442 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5223eead35..44cb23b648 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -333,7 +333,6 @@ set(viewer_SOURCE_FILES llnameeditor.cpp llnamelistctrl.cpp llnavigationbar.cpp - llnavmeshstation.cpp llnearbychat.cpp llnearbychatbar.cpp llnearbychathandler.cpp @@ -421,6 +420,8 @@ set(viewer_SOURCE_FILES llpathfindinglinkset.cpp llpathfindinglinksetlist.cpp llpathfindingmanager.cpp + llpathfindingnavmesh.cpp + llpathfindingnavmeshzone.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp llplacesinventorybridge.cpp @@ -898,7 +899,6 @@ set(viewer_HEADER_FILES llnameeditor.h llnamelistctrl.h llnavigationbar.h - llnavmeshstation.h llnearbychat.h llnearbychatbar.h llnearbychathandler.h @@ -975,6 +975,8 @@ set(viewer_HEADER_FILES llpathfindinglinkset.h llpathfindinglinksetlist.h llpathfindingmanager.h + llpathfindingnavmesh.h + llpathfindingnavmeshzone.h llphysicsmotion.h llphysicsshapebuilderutil.h llplacesinventorybridge.h diff --git a/indra/newview/llfloaterpathfindingbasic.cpp b/indra/newview/llfloaterpathfindingbasic.cpp index 04d830632d..d1103088ab 100644 --- a/indra/newview/llfloaterpathfindingbasic.cpp +++ b/indra/newview/llfloaterpathfindingbasic.cpp @@ -66,7 +66,7 @@ void LLFloaterPathfindingBasic::onOpen(const LLSD& pKey) if (!mAgentStateSlot.connected())
{
- mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateSignal(boost::bind(&LLFloaterPathfindingBasic::onAgentStateCB, this, _1));
+ mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingBasic::onAgentStateCB, this, _1));
}
setAgentState(LLPathfindingManager::getInstance()->getAgentState());
}
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 5ac79668d2..6824e629c9 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -33,6 +33,7 @@ #include "llsd.h"
#include "llhandle.h"
#include "llagent.h"
+#include "llpanel.h"
#include "llbutton.h"
#include "llradiogroup.h"
#include "llsliderctrl.h"
@@ -40,12 +41,12 @@ #include "lltextbase.h"
#include "lltabcontainer.h"
#include "llcombobox.h"
-#include "llnavmeshstation.h"
#include "llfloaterreg.h"
#include "llviewerregion.h"
#include "llviewerwindow.h"
#include "llviewercamera.h"
#include "llviewercontrol.h"
+#include "llpathfindingnavmeshzone.h"
#include "llpathfindingmanager.h"
#include "LLPathingLib.h"
@@ -63,9 +64,6 @@ #define XUI_TEST_TAB_INDEX 1
-const int CURRENT_REGION = 99;
-const int MAX_OBSERVERS = 10;
-
LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHandle;
//---------------------------------------------------------------------------
@@ -104,6 +102,12 @@ BOOL LLFloaterPathfindingConsole::postBuild() mEditTestTabContainer = findChild<LLTabContainer>("edit_test_tab_container");
llassert(mEditTestTabContainer != NULL);
+ mEditTab = findChild<LLPanel>("edit_panel");
+ llassert(mEditTab != NULL);
+
+ mTestTab = findChild<LLPanel>("test_panel");
+ llassert(mTestTab != NULL);
+
mUnfreezeLabel = findChild<LLTextBase>("unfreeze_label");
llassert(mUnfreezeLabel != NULL);
@@ -157,87 +161,27 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) }
if ( LLPathingLib::getInstance() == NULL )
{
- std::string str = getString("navmesh_library_not_implemented");
- LLStyle::Params styleParams;
- styleParams.color = LLUIColorTable::instance().getColor("DrYellow");
- mPathfindingStatus->setText((LLStringExplicit)str, styleParams);
- llwarns <<"Errror: cannout find pathing library implementation."<<llendl;
+ setConsoleState(kConsoleStateLibraryNotImplemented);
+ llwarns <<"Errror: cannot find pathing library implementation."<<llendl;
}
else
{
- 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() )
+ if (!mNavMeshZoneSlot.connected())
{
- shiftDirections.clear();regions.clear();
- regions.push_back( pCurrentRegion );
- shiftDirections.push_back( CURRENT_REGION );
+ mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1));
}
- int regionCnt = regions.size();
- mNavMeshCnt = regionCnt;
+ mNavMeshZone.initialize();
- 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;
- }
- }
+ mNavMeshZone.enable();
+ mNavMeshZone.refresh();
}
if (!mAgentStateSlot.connected())
{
- LLPathfindingManager::getInstance()->registerAgentStateSignal(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1));
+ mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1));
}
+
setAgentState(LLPathfindingManager::getInstance()->getAgentState());
updatePathTestStatus();
}
@@ -248,9 +192,20 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) {
mAgentStateSlot.disconnect();
}
- if ( LLPathingLib::getInstance() ) { LLPathingLib::getInstance()->cleanupResidual(); }
+
+ if (mNavMeshZoneSlot.connected())
+ {
+ mNavMeshZoneSlot.disconnect();
+ }
+
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ mNavMeshZone.disable();
+ }
+
LLFloater::onClose(pIsAppQuitting);
setHeartBeat( false );
+ setConsoleState(kConsoleStateUnknown);
}
BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down)
@@ -496,24 +451,6 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType mCharacterTypeRadioGroup->setValue(radioGroupValue);
}
-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);
-}
-
LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
: LLFloater(pSeed),
mSelfHandle(),
@@ -527,6 +464,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathfindingStatus(NULL),
mViewCharactersButton(NULL),
mEditTestTabContainer(NULL),
+ mEditTab(NULL),
+ mTestTab(NULL),
mUnfreezeLabel(NULL),
mUnfreezeButton(NULL),
mLinksetsLabel(NULL),
@@ -537,38 +476,22 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mCharacterTypeRadioGroup(NULL),
mPathTestingStatus(NULL),
mClearPathButton(NULL),
+ mNavMeshZoneSlot(),
+ mNavMeshZone(),
mAgentStateSlot(),
- mNavMeshCnt(0),
+ mConsoleState(kConsoleStateUnknown),
+ mPathData(),
mHasStartPoint(false),
mHasEndPoint(false),
- mNeighboringRegion( CURRENT_REGION ),
mHeartBeat( false )
{
mSelfHandle.bind(this);
-
- for (int i=0;i<MAX_OBSERVERS;++i)
- {
- mNavMeshDownloadObserver[i].setPathfindingConsole(this);
- }
}
LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole()
{
}
-std::string LLFloaterPathfindingConsole::getCurrentRegionCapabilityURL() const
-{
- std::string capURL("");
-
- LLViewerRegion *region = gAgent.getRegion();
- if (region != NULL)
- {
- capURL = region->getCapability("RetrieveNavMeshSrc");
- }
-
- return capURL;
-}
-
void LLFloaterPathfindingConsole::onShowWalkabilitySet()
{
switch (getRenderHeatmapType())
@@ -686,17 +609,51 @@ void LLFloaterPathfindingConsole::onClearPathClicked() updatePathTestStatus();
}
+void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus)
+{
+ switch (pNavMeshZoneRequestStatus)
+ {
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown :
+ setConsoleState(kConsoleStateUnknown);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted :
+ setConsoleState(kConsoleStateDownloading);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted :
+ setConsoleState(kConsoleStateHasNavMesh);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled :
+ setConsoleState(kConsoleStateRegionNotEnabled);
+ break;
+ case LLPathfindingNavMeshZone::kNavMeshZoneRequestError :
+ setConsoleState(kConsoleStateError);
+ break;
+ default:
+ setConsoleState(kConsoleStateUnknown);
+ llassert(0);
+ break;
+ }
+}
+
void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState)
{
setAgentState(pAgentState);
}
-void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState)
+void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState)
{
- switch (pAgentState)
+ mConsoleState = pConsoleState;
+ updateControlsOnConsoleState();
+ updateStatusOnConsoleState();
+}
+
+void LLFloaterPathfindingConsole::updateControlsOnConsoleState()
+{
+ switch (mConsoleState)
{
- case LLPathfindingManager::kAgentStateUnknown :
- case LLPathfindingManager::kAgentStateNotEnabled :
+ case kConsoleStateUnknown :
+ case kConsoleStateLibraryNotImplemented :
+ case kConsoleStateRegionNotEnabled :
mShowNavMeshCheckBox->setEnabled(FALSE);
mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
mShowWalkablesCheckBox->setEnabled(FALSE);
@@ -705,16 +662,34 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat mShowExclusionVolumesCheckBox->setEnabled(FALSE);
mShowWorldCheckBox->setEnabled(FALSE);
mViewCharactersButton->setEnabled(FALSE);
- mEditTestTabContainer->setEnabled(FALSE);
+ mEditTestTabContainer->selectTab(0);
+ mTestTab->setEnabled(FALSE);
mCharacterWidthSlider->setEnabled(FALSE);
mCharacterTypeRadioGroup->setEnabled(FALSE);
mClearPathButton->setEnabled(FALSE);
-
+ mHasStartPoint = false;
+ mHasEndPoint = false;
+ break;
+ case kConsoleStateDownloading :
+ case kConsoleStateError :
+ mShowNavMeshCheckBox->setEnabled(FALSE);
+ mShowNavMeshWalkabilityComboBox->setEnabled(FALSE);
+ mShowWalkablesCheckBox->setEnabled(FALSE);
+ mShowStaticObstaclesCheckBox->setEnabled(FALSE);
+ mShowMaterialVolumesCheckBox->setEnabled(FALSE);
+ mShowExclusionVolumesCheckBox->setEnabled(FALSE);
+ mShowWorldCheckBox->setEnabled(FALSE);
+ mViewCharactersButton->setEnabled(TRUE);
mEditTestTabContainer->selectTab(0);
+ mTestTab->setEnabled(FALSE);
+ mCharacterWidthSlider->setEnabled(FALSE);
+ mCharacterTypeRadioGroup->setEnabled(FALSE);
+ mClearPathButton->setEnabled(FALSE);
mHasStartPoint = false;
mHasEndPoint = false;
break;
- default :
+ case kConsoleStateHasNavMesh :
+ case kConsoleStateHasNavMeshDownloading :
mShowNavMeshCheckBox->setEnabled(TRUE);
mShowNavMeshWalkabilityComboBox->setEnabled(TRUE);
mShowWalkablesCheckBox->setEnabled(TRUE);
@@ -723,17 +698,67 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat mShowExclusionVolumesCheckBox->setEnabled(TRUE);
mShowWorldCheckBox->setEnabled(TRUE);
mViewCharactersButton->setEnabled(TRUE);
- mEditTestTabContainer->setEnabled(TRUE);
+ mTestTab->setEnabled(TRUE);
mCharacterWidthSlider->setEnabled(TRUE);
mCharacterTypeRadioGroup->setEnabled(TRUE);
mClearPathButton->setEnabled(TRUE);
+ mTestTab->setEnabled(TRUE);
+ break;
+ default :
+ llassert(0);
+ break;
+ }
+}
+
+void LLFloaterPathfindingConsole::updateStatusOnConsoleState()
+{
+ static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow");
+
+ std::string statusText("");
+ LLStyle::Params styleParams;
+
+ switch (mConsoleState)
+ {
+ case kConsoleStateUnknown :
+ statusText = getString("navmesh_status_unknown");
+ break;
+ case kConsoleStateLibraryNotImplemented :
+ statusText = getString("navmesh_status_library_not_implemented");
+ styleParams.color = warningColor;
+ break;
+ case kConsoleStateRegionNotEnabled :
+ statusText = getString("navmesh_status_region_not_enabled");
+ styleParams.color = warningColor;
+ break;
+ case kConsoleStateDownloading :
+ statusText = getString("navmesh_status_downloading");
+ break;
+ case kConsoleStateHasNavMesh :
+ statusText = getString("navmesh_status_has_navmesh");
+ break;
+ case kConsoleStateHasNavMeshDownloading :
+ statusText = getString("navmesh_status_has_navmesh_downloading");
+ break;
+ case kConsoleStateError :
+ statusText = getString("navmesh_status_error");
+ styleParams.color = warningColor;
+ break;
+ default :
+ statusText = getString("navmesh_status_unknown");
+ llassert(0);
break;
}
+ mPathfindingStatus->setText((LLStringExplicit)statusText, styleParams);
+}
+
+void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState)
+{
switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState())
{
case LLPathfindingManager::kAgentStateUnknown :
case LLPathfindingManager::kAgentStateNotEnabled :
+ mEditTab->setEnabled(FALSE);
mUnfreezeLabel->setEnabled(FALSE);
mUnfreezeButton->setEnabled(FALSE);
mLinksetsLabel->setEnabled(FALSE);
@@ -742,6 +767,7 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat mFreezeButton->setEnabled(FALSE);
break;
case LLPathfindingManager::kAgentStateFrozen :
+ mEditTab->setEnabled(TRUE);
mUnfreezeLabel->setEnabled(TRUE);
mUnfreezeButton->setEnabled(TRUE);
mLinksetsLabel->setEnabled(FALSE);
@@ -750,6 +776,7 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat mFreezeButton->setEnabled(FALSE);
break;
case LLPathfindingManager::kAgentStateUnfrozen :
+ mEditTab->setEnabled(TRUE);
mUnfreezeLabel->setEnabled(FALSE);
mUnfreezeButton->setEnabled(FALSE);
mLinksetsLabel->setEnabled(TRUE);
@@ -803,36 +830,36 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() }
-BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const -{ - if ( isRenderWalkables() || isRenderStaticObstacles() || - isRenderMaterialVolumes() || isRenderExclusionVolumes() ) - { - return true; - } - - return false; -} - -U32 LLFloaterPathfindingConsole::getRenderShapeFlags() -{ - resetShapeRenderFlags(); - - if ( isRenderWalkables() ) - { - setShapeRenderFlag( LLPathingLib::LLST_WalkableObjects ); - } - if ( isRenderStaticObstacles() ) - { - setShapeRenderFlag( LLPathingLib::LLST_ObstacleObjects ); - } - if ( isRenderMaterialVolumes() ) - { - setShapeRenderFlag( LLPathingLib::LLST_MaterialPhantoms ); - } - if ( isRenderExclusionVolumes() ) - { - setShapeRenderFlag( LLPathingLib::LLST_ExclusionPhantoms ); - } - return mShapeRenderFlags; -} +BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const
+{
+ if ( isRenderWalkables() || isRenderStaticObstacles() ||
+ isRenderMaterialVolumes() || isRenderExclusionVolumes() )
+ {
+ return true;
+ }
+
+ return false;
+}
+
+U32 LLFloaterPathfindingConsole::getRenderShapeFlags()
+{
+ resetShapeRenderFlags();
+
+ if ( isRenderWalkables() )
+ {
+ setShapeRenderFlag( LLPathingLib::LLST_WalkableObjects );
+ }
+ if ( isRenderStaticObstacles() )
+ {
+ setShapeRenderFlag( LLPathingLib::LLST_ObstacleObjects );
+ }
+ if ( isRenderMaterialVolumes() )
+ {
+ setShapeRenderFlag( LLPathingLib::LLST_MaterialPhantoms );
+ }
+ if ( isRenderExclusionVolumes() )
+ {
+ setShapeRenderFlag( LLPathingLib::LLST_ExclusionPhantoms );
+ }
+ return mShapeRenderFlags;
+}
diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 34a68ebed1..b1886fb716 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -30,11 +30,12 @@ #include "llfloater.h" #include "llhandle.h" -#include "llnavmeshstation.h" #include "LLPathingLib.h" #include "llpathfindingmanager.h" +#include "llpathfindingnavmeshzone.h" class LLSD; +class LLPanel; class LLRadioGroup; class LLSliderCtrl; class LLLineEditor; @@ -108,22 +109,28 @@ public: ECharacterType getCharacterType() const; void setCharacterType(ECharacterType pCharacterType); - void setHasNavMeshReceived(); - void setHasNoNavMesh(); - bool getHeartBeat() const { return mHeartBeat;} void setHeartBeat( bool state ) { mHeartBeat=state; } protected: private: + typedef enum + { + kConsoleStateUnknown, + kConsoleStateLibraryNotImplemented, + kConsoleStateRegionNotEnabled, + kConsoleStateDownloading, + kConsoleStateHasNavMesh, + kConsoleStateHasNavMeshDownloading, + kConsoleStateError + } EConsoleState; + // Does its own instance management, so clients not allowed // to allocate or destroy. LLFloaterPathfindingConsole(const LLSD& pSeed); virtual ~LLFloaterPathfindingConsole(); - std::string getCurrentRegionCapabilityURL() const; - void onShowWalkabilitySet(); void onShowWorldToggle(); void onCharacterWidthSet(); @@ -133,8 +140,14 @@ private: void onFreezeClicked(); void onViewEditLinksetClicked(); void onClearPathClicked(); + void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus); void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState); + void setConsoleState(EConsoleState pConsoleState); + + void updateControlsOnConsoleState(); + void updateStatusOnConsoleState(); + void setAgentState(LLPathfindingManager::EAgentState pAgentState); void generatePath(); @@ -142,39 +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; - LLTextBase *mUnfreezeLabel; - LLButton *mUnfreezeButton; - LLTextBase *mLinksetsLabel; - LLButton *mLinksetsButton; - LLTextBase *mFreezeLabel; - LLButton *mFreezeButton; - LLSliderCtrl *mCharacterWidthSlider; - LLRadioGroup *mCharacterTypeRadioGroup; - LLTextBase *mPathTestingStatus; - LLButton *mClearPathButton; - LLPathfindingManager::agent_state_slot_t mAgentStateSlot; - - LLNavMeshDownloadObserver mNavMeshDownloadObserver[10]; - int mCurrentMDO; - int mNavMeshCnt; - U32 mNeighboringRegion; + 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/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index f17cd3c6b8..af2024021b 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -211,7 +211,7 @@ void LLFloaterPathfindingLinksets::onOpen(const LLSD& pKey) if (!mAgentStateSlot.connected())
{
- LLPathfindingManager::getInstance()->registerAgentStateSignal(boost::bind(&LLFloaterPathfindingLinksets::onAgentStateCB, this, _1));
+ mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingLinksets::onAgentStateCB, this, _1));
}
if (!mSelectionUpdateSlot.connected())
diff --git a/indra/newview/llnavmeshstation.cpp b/indra/newview/llnavmeshstation.cpp deleted file mode 100644 index 54a945e562..0000000000 --- a/indra/newview/llnavmeshstation.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/** - * @file llnavmeshstation.cpp - * @brief - * - * $LicenseInfo:firstyear=2005&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 "llnavmeshstation.h" -#include "llcurl.h" -#include "LLPathingLib.h" -#include "llagent.h" -#include "llviewerregion.h" -#include "llsdutil.h" -#include "llfloaterpathfindingconsole.h" -#include "llsdserialize.h" -//=============================================================================== -LLNavMeshStation::LLNavMeshStation() -{ -} -//=============================================================================== -class LLNavMeshDownloadResponder : public LLCurl::Responder -{ -public: - LLNavMeshDownloadResponder( const LLHandle<LLNavMeshDownloadObserver>& observer_handle, int dir ) - : mObserverHandle( observer_handle ) - , mDir( dir ) - { - } - - void error( U32 statusNum, const std::string& reason ) - { - llwarns << "Transport error "<<reason<<llendl; - } - - void result( const LLSD& content ) - { - llinfos<<"Content received"<<llendl; - if ( content.has("error") ) - { - llwarns << "Error on fetched data"<< llendl; - //llinfos<<"LLsd buffer on error"<<ll_pretty_print_sd(content)<<llendl; - } - else - { - LLNavMeshDownloadObserver* pObserver = mObserverHandle.get(); - if ( pObserver ) - { - if ( content.has("navmesh_data") ) - { - const std::vector<U8>& value = content["navmesh_data"].asBinary();
- unsigned int binSize = value.size();
- U8* pBinBuffer = new U8[binSize];
- memcpy( &pBinBuffer[0], &value[0], binSize );
- std::string newStr((char*) pBinBuffer, binSize );
- std::istringstream streamdecomp( newStr );
- unsigned int decompBinSize = 0;
- bool valid = false;
- if ( pBinBuffer )
- {
- delete [] pBinBuffer ;
- }
- U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
- if ( !valid )
- {
- if ( pUncompressedNavMeshContainer )
- {
- free( pUncompressedNavMeshContainer );
- }
- llwarns << "Unable to decompress the navmesh llsd." << llendl;
- pObserver->getPathfindingConsole()->setHasNoNavMesh();
- return;
- }
- else
- {
- if ( pUncompressedNavMeshContainer )
- {
- std::vector<U8> lsd;
- lsd.resize( decompBinSize );
- memcpy( &lsd[0], &pUncompressedNavMeshContainer[0], decompBinSize );
- LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD( lsd, mDir );
- pObserver->getPathfindingConsole()->setHasNavMeshReceived();
- free( pUncompressedNavMeshContainer );
- }
- } - } - else - { - llwarns<<"No mesh data received"<<llendl; - pObserver->getPathfindingConsole()->setHasNoNavMesh(); - } - } - } -} -private: - //Observer handle - LLHandle<LLNavMeshDownloadObserver> mObserverHandle; - int mDir; -}; -//=============================================================================== -void LLNavMeshStation::downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle, int dir ) -{ - if ( mNavMeshDownloadURL.empty() ) - { - llinfos << "Unable to upload navmesh because of missing URL" << llendl; - } - else - { - LLSD data; - data["agent_id"] = gAgent.getID(); - data["region_id"] = gAgent.getRegion()->getRegionID(); - LLHTTPClient::post(mNavMeshDownloadURL, data, new LLNavMeshDownloadResponder( observerHandle, dir ) ); - } -} -//=============================================================================== diff --git a/indra/newview/llnavmeshstation.h b/indra/newview/llnavmeshstation.h deleted file mode 100644 index 72bf725688..0000000000 --- a/indra/newview/llnavmeshstation.h +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @file llnavmeshstation.h - * @brief Client-side navmesh support - * - * $LicenseInfo:firstyear=2001&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_NAV_MESH_STATION_H -#define LL_NAV_MESH_STATION_H - -//=============================================================================== -#include "llhandle.h" -//=============================================================================== -class LLCurlRequest; -class LLFloaterPathfindingConsole; -//=============================================================================== -class LLNavMeshObserver -{ -public: - //Ctor - LLNavMeshObserver() - : mPathfindingConsole(NULL) - { mObserverHandle.bind(this); } - //Dtor - virtual ~LLNavMeshObserver() {} - //Accessor for the observers handle - const LLHandle<LLNavMeshObserver>& getObserverHandle() const { return mObserverHandle; } - LLFloaterPathfindingConsole *getPathfindingConsole() {return mPathfindingConsole;} - void setPathfindingConsole(LLFloaterPathfindingConsole *pPathfindingConsole) {mPathfindingConsole = pPathfindingConsole;} - -protected: - LLRootHandle<LLNavMeshObserver> mObserverHandle; - LLFloaterPathfindingConsole *mPathfindingConsole; -}; -//=============================================================================== -class LLNavMeshDownloadObserver -{ -public: - //Ctor - LLNavMeshDownloadObserver() { mObserverHandle.bind(this); } - //Dtor - virtual ~LLNavMeshDownloadObserver() {} - //Accessor for the observers handle - const LLHandle<LLNavMeshDownloadObserver>& getObserverHandle() const { return mObserverHandle; } - LLFloaterPathfindingConsole *getPathfindingConsole() {return mPathfindingConsole;} - void setPathfindingConsole(LLFloaterPathfindingConsole *pPathfindingConsole) {mPathfindingConsole = pPathfindingConsole;} - -protected: - LLRootHandle<LLNavMeshDownloadObserver> mObserverHandle; - LLFloaterPathfindingConsole *mPathfindingConsole; -}; -//=============================================================================== -class LLNavMeshStation : public LLSingleton<LLNavMeshStation> -{ -public: - //Ctor - LLNavMeshStation(); - //Facilitates the posting of a prepopulated llsd block to an existing url - bool postNavMeshToServer( LLSD& data, const LLHandle<LLNavMeshObserver>& observerHandle ); - //Setter for the navmesh upload url - void setNavMeshUploadURL( std::string& url ) { mNavMeshUploadURL = url; } - //Setter for the navmesh download url - void setNavMeshDownloadURL( std::string& url ) { mNavMeshDownloadURL = url; } - //Callback to handle the requested src data for this regions navmesh src - static void processNavMeshSrc( LLMessageSystem* msg, void** ); - //Initiate download of the navmesh source from the server - void downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle, int dir ); - -protected: - //Curl object to facilitate posts to server - LLCurlRequest* mCurlRequest; - //Maximum time in seconds to execute an uploading request. - S32 mMeshUploadTimeOut ; - //URL used for uploading viewer generated navmesh - std::string mNavMeshUploadURL; - //URL used for download the src data for a navmesh - std::string mNavMeshDownloadURL; - -}; -//=============================================================================== -#endif //LL_NAV_MESH_STATION_H - diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index a59dda74ac..cba0501ad2 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -33,6 +33,7 @@ #include "llhttpclient.h"
#include "llagent.h"
#include "llviewerregion.h"
+#include "llpathfindingnavmesh.h"
#include "llpathfindinglinkset.h"
#include "llpathfindinglinksetlist.h"
@@ -49,6 +50,27 @@ #define CAP_SERVICE_TERRAIN_LINKSETS "TerrainNavMeshProperties"
//---------------------------------------------------------------------------
+// NavMeshResponder
+//---------------------------------------------------------------------------
+
+class NavMeshResponder : public LLHTTPClient::Responder
+{
+public:
+ NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr);
+ virtual ~NavMeshResponder();
+
+ virtual void result(const LLSD &pContent);
+ virtual void error(U32 pStatus, const std::string& pReason);
+
+protected:
+
+private:
+ std::string mCapabilityURL;
+ U32 mNavMeshVersion;
+ LLPathfindingNavMeshPtr mNavMeshPtr;
+};
+
+//---------------------------------------------------------------------------
// AgentStateResponder
//---------------------------------------------------------------------------
@@ -153,6 +175,8 @@ private: LLPathfindingManager::LLPathfindingManager()
: LLSingleton<LLPathfindingManager>(),
+ mNavMeshMap(),
+ mNavMeshVersionXXX(0),
mAgentStateSignal(),
mAgentState(kAgentStateUnknown),
mLastKnownNonErrorAgentState(kAgentStateUnknown)
@@ -180,7 +204,46 @@ bool LLPathfindingManager::isAllowViewTerrainProperties() const return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate()));
}
-LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateSignal(agent_state_callback_t pAgentStateCallback)
+LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback)
+{
+ LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
+ return navMeshPtr->registerNavMeshListener(pNavMeshCallback);
+}
+
+void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion)
+{
+ LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
+
+ if (navMeshPtr->hasNavMeshVersion(mNavMeshVersionXXX))
+ {
+ navMeshPtr->handleRefresh();
+ }
+ else
+ {
+ if (pRegion == NULL)
+ {
+ navMeshPtr->handleNavMeshNotEnabled();
+ }
+ else
+ {
+ std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion);
+ if (navMeshURL.empty())
+ {
+ navMeshPtr->handleNavMeshNotEnabled();
+ }
+ else
+ {
+ navMeshPtr->handleNavMeshStart(mNavMeshVersionXXX);
+ LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, mNavMeshVersionXXX, navMeshPtr);
+
+ LLSD postData;
+ LLHTTPClient::post(navMeshURL, postData, responder);
+ }
+ }
+ }
+}
+
+LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback)
{
return mAgentStateSignal.connect(pAgentStateCallback);
}
@@ -305,6 +368,30 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestSetLin return status;
}
+LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion)
+{
+
+ LLUUID regionUUID;
+ if (pRegion != NULL)
+ {
+ regionUUID = pRegion->getRegionID();
+ }
+
+ LLPathfindingNavMeshPtr navMeshPtr;
+ NavMeshMap::iterator navMeshIter = mNavMeshMap.find(regionUUID);
+ if (navMeshIter == mNavMeshMap.end())
+ {
+ navMeshPtr = LLPathfindingNavMeshPtr(new LLPathfindingNavMesh(regionUUID));
+ mNavMeshMap.insert(std::pair<LLUUID, LLPathfindingNavMeshPtr>(regionUUID, navMeshPtr));
+ }
+ else
+ {
+ navMeshPtr = navMeshIter->second;
+ }
+
+ return navMeshPtr;
+}
+
bool LLPathfindingManager::isValidAgentState(EAgentState pAgentState)
{
return ((pAgentState == kAgentStateFrozen) || (pAgentState == kAgentStateUnfrozen));
@@ -378,6 +465,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);
@@ -395,18 +487,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;
@@ -418,6 +514,31 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const }
//---------------------------------------------------------------------------
+// NavMeshResponder
+//---------------------------------------------------------------------------
+
+NavMeshResponder::NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr)
+ : mCapabilityURL(pCapabilityURL),
+ mNavMeshVersion(pNavMeshVersion),
+ mNavMeshPtr(pNavMeshPtr)
+{
+}
+
+NavMeshResponder::~NavMeshResponder()
+{
+}
+
+void NavMeshResponder::result(const LLSD &pContent)
+{
+ mNavMeshPtr->handleNavMeshResult(pContent, mNavMeshVersion);
+}
+
+void NavMeshResponder::error(U32 pStatus, const std::string& pReason)
+{
+ mNavMeshPtr->handleNavMeshError(pStatus, pReason, mCapabilityURL, mNavMeshVersion);
+}
+
+//---------------------------------------------------------------------------
// AgentStateResponder
//---------------------------------------------------------------------------
diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 9a6bbb81b9..eb8704e308 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -28,15 +28,18 @@ #ifndef LL_LLPATHFINDINGMANAGER_H
#define LL_LLPATHFINDINGMANAGER_H
+#include "llsingleton.h"
+#include "lluuid.h"
+#include "llpathfindingnavmesh.h"
+#include "llpathfindinglinkset.h"
+#include "llpathfindinglinksetlist.h"
+
#include <string>
+#include <map>
#include <boost/function.hpp>
#include <boost/signals2.hpp>
-#include "llsingleton.h"
-#include "llpathfindinglinkset.h"
-#include "llpathfindinglinksetlist.h"
-
class LLFloater;
class LLViewerRegion;
@@ -44,6 +47,8 @@ class LLPathfindingManager : public LLSingleton<LLPathfindingManager> {
friend class AgentStateResponder;
public:
+ typedef std::map<LLUUID, LLPathfindingNavMeshPtr> NavMeshMap;
+
typedef enum {
kAgentStateUnknown,
kAgentStateFrozen,
@@ -73,7 +78,10 @@ public: bool isAllowAlterPermanent();
bool isAllowViewTerrainProperties() const;
- agent_state_slot_t registerAgentStateSignal(agent_state_callback_t pAgentStateCallback);
+ 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();
EAgentState getLastKnownNonErrorAgentState() const;
void requestSetAgentState(EAgentState pAgentState);
@@ -84,6 +92,8 @@ public: protected:
private:
+ LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion);
+
static bool isValidAgentState(EAgentState pAgentState);
void requestGetAgentState();
@@ -92,13 +102,18 @@ 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 getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const;
+ std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const;
LLViewerRegion *getCurrentRegion() const;
+ NavMeshMap mNavMeshMap;
+ U32 mNavMeshVersionXXX; // XXX stinson 03/02/2012 : a hacky way of doing versions for now
+
agent_state_signal_t mAgentStateSignal;
EAgentState mAgentState;
EAgentState mLastKnownNonErrorAgentState;
diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp new file mode 100644 index 0000000000..469972efa9 --- /dev/null +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -0,0 +1,133 @@ +/**
+ * @file llpathfindingnavmesh.cpp
+ * @author William Todd Stinson
+ * @brief A class for representing the navmesh of a pathfinding 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 "lluuid.h"
+#include "llpathfindingnavmesh.h"
+#include "llsdserialize.h"
+
+#include <string>
+
+//---------------------------------------------------------------------------
+// LLPathfindingNavMesh
+//---------------------------------------------------------------------------
+
+LLPathfindingNavMesh::LLPathfindingNavMesh(const LLUUID &pRegionUUID)
+ : mRegionUUID(pRegionUUID),
+ mNavMeshRequestStatus(kNavMeshRequestUnknown),
+ mNavMeshSignal(),
+ mNavMeshData(),
+ mNavMeshVersion(0U)
+{
+}
+
+LLPathfindingNavMesh::~LLPathfindingNavMesh()
+{
+}
+
+LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListener(navmesh_callback_t pNavMeshCallback)
+{
+ return mNavMeshSignal.connect(pNavMeshCallback);
+}
+
+bool LLPathfindingNavMesh::hasNavMeshVersion(U32 pNavMeshVersion) const
+{
+ return (((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted)) && (mNavMeshVersion == pNavMeshVersion));
+}
+
+void LLPathfindingNavMesh::handleRefresh()
+{
+ mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData);
+}
+
+void LLPathfindingNavMesh::handleNavMeshStart(U32 pNavMeshVersion)
+{
+ mNavMeshVersion = pNavMeshVersion;
+ setRequestStatus(kNavMeshRequestStarted);
+}
+
+void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion)
+{
+ llassert(mNavMeshVersion == pNavMeshVersion);
+ if (mNavMeshVersion == pNavMeshVersion)
+ {
+ if ( pContent.has("navmesh_data") )
+ {
+ const LLSD::Binary &value = pContent["navmesh_data"].asBinary();
+ unsigned int binSize = value.size();
+ std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
+ std::istringstream streamdecomp( newStr );
+ unsigned int decompBinSize = 0;
+ bool valid = false;
+ U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
+ if ( !valid )
+ {
+ llwarns << "Unable to decompress the navmesh llsd." << llendl;
+ setRequestStatus(kNavMeshRequestError);
+ }
+ else
+ {
+ llassert(pUncompressedNavMeshContainer);
+ mNavMeshData.resize( decompBinSize );
+ memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize );
+ setRequestStatus(kNavMeshRequestCompleted);
+ }
+ if ( pUncompressedNavMeshContainer )
+ {
+ free( pUncompressedNavMeshContainer );
+ }
+ }
+ else
+ {
+ llwarns << "No mesh data received" << llendl;
+ setRequestStatus(kNavMeshRequestError);
+ }
+ }
+}
+
+void LLPathfindingNavMesh::handleNavMeshNotEnabled()
+{
+ mNavMeshData.clear();
+ setRequestStatus(kNavMeshRequestNotEnabled);
+}
+
+void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion)
+{
+ llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl;
+ llassert(mNavMeshVersion == pNavMeshVersion);
+ mNavMeshData.clear();
+ if (mNavMeshVersion == pNavMeshVersion)
+ {
+ setRequestStatus(kNavMeshRequestError);
+ }
+}
+
+void LLPathfindingNavMesh::setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus)
+{
+ mNavMeshRequestStatus = pNavMeshRequestStatus;
+ mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData);
+}
diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h new file mode 100644 index 0000000000..26ef21f90e --- /dev/null +++ b/indra/newview/llpathfindingnavmesh.h @@ -0,0 +1,85 @@ +/**
+ * @file llpathfindingnavmesh.h
+ * @author William Todd Stinson
+ * @brief A class for representing the navmesh of a pathfinding 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_LLPATHFINDINGNAVMESH_H
+#define LL_LLPATHFINDINGNAVMESH_H
+
+#include "llsd.h"
+#include "lluuid.h"
+
+#include <string>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/function.hpp>
+#include <boost/signals2.hpp>
+
+class LLSD;
+class LLPathfindingNavMesh;
+
+typedef boost::shared_ptr<LLPathfindingNavMesh> LLPathfindingNavMeshPtr;
+
+class LLPathfindingNavMesh
+{
+public:
+ typedef enum {
+ kNavMeshRequestUnknown,
+ kNavMeshRequestStarted,
+ kNavMeshRequestCompleted,
+ kNavMeshRequestNotEnabled,
+ kNavMeshRequestError
+ } ENavMeshRequestStatus;
+
+ typedef boost::function<void (ENavMeshRequestStatus, const LLUUID &, U32, const LLSD::Binary &)> navmesh_callback_t;
+ typedef boost::signals2::signal<void (ENavMeshRequestStatus, const LLUUID &, U32, const LLSD::Binary &)> navmesh_signal_t;
+ typedef boost::signals2::connection navmesh_slot_t;
+
+ LLPathfindingNavMesh(const LLUUID &pRegionUUID);
+ virtual ~LLPathfindingNavMesh();
+
+ navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback);
+
+ bool hasNavMeshVersion(U32 pNavMeshVersion) const;
+
+ void handleRefresh();
+ void handleNavMeshStart(U32 pNavMeshVersion);
+ void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion);
+ void handleNavMeshNotEnabled();
+ void handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion);
+
+protected:
+
+private:
+ void setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus);
+
+ LLUUID mRegionUUID;
+ ENavMeshRequestStatus mNavMeshRequestStatus;
+ navmesh_signal_t mNavMeshSignal;
+ LLSD::Binary mNavMeshData;
+ U32 mNavMeshVersion;
+};
+
+#endif // LL_LLPATHFINDINGNAVMESH_H
diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp new file mode 100644 index 0000000000..983b88fe05 --- /dev/null +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -0,0 +1,311 @@ +/**
+ * @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 <vector>
+
+#include <boost/bind.hpp>
+
+#define CENTER_REGION 99
+
+//---------------------------------------------------------------------------
+// LLPathfindingNavMeshZone
+//---------------------------------------------------------------------------
+
+LLPathfindingNavMeshZone::LLPathfindingNavMeshZone()
+ : mNavMeshLocationPtrs(),
+ mNavMeshZoneSignal()
+{
+}
+
+LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone()
+{
+}
+
+LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback)
+{
+ return mNavMeshZoneSignal.connect(pNavMeshZoneCallback);
+}
+
+void LLPathfindingNavMeshZone::initialize()
+{
+ 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::enable()
+{
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->enable();
+ }
+}
+
+void LLPathfindingNavMeshZone::disable()
+{
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->disable();
+ }
+}
+
+void LLPathfindingNavMeshZone::refresh()
+{
+ llassert(LLPathingLib::getInstance() != NULL);
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->cleanupResidual();
+ }
+
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ navMeshLocationPtr->refresh();
+ }
+}
+
+void LLPathfindingNavMeshZone::handleNavMeshLocation()
+{
+ updateStatus();
+}
+
+void LLPathfindingNavMeshZone::updateStatus()
+{
+ bool hasRequestUnknown = false;
+ bool hasRequestStarted = false;
+ bool hasRequestCompleted = false;
+ bool hasRequestNotEnabled = false;
+ bool hasRequestError = false;
+
+ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin();
+ navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter)
+ {
+ NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter;
+ switch (navMeshLocationPtr->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 (hasRequestStarted)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestStarted;
+ }
+ else if (hasRequestError)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestError;
+ }
+ else if (hasRequestUnknown)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestUnknown;
+ }
+ else if (hasRequestCompleted)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestCompleted;
+ llassert(LLPathingLib::getInstance() != NULL);
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") );
+ }
+ }
+ else if (hasRequestNotEnabled)
+ {
+ zoneRequestStatus = kNavMeshZoneRequestNotEnabled;
+ }
+ else
+ {
+ zoneRequestStatus = kNavMeshZoneRequestError;
+ llassert(0);
+ }
+
+ mNavMeshZoneSignal(zoneRequestStatus);
+}
+
+//---------------------------------------------------------------------------
+// LLPathfindingNavMeshZone::NavMeshLocation
+//---------------------------------------------------------------------------
+
+LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback)
+ : mDirection(pDirection),
+ mRegionUUID(),
+ mHasNavMesh(false),
+ mNavMeshVersion(0U),
+ mLocationCallback(pLocationCallback),
+ mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown),
+ mNavMeshSlot()
+{
+}
+
+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::kNavMeshRequestNotEnabled, 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)
+{
+ llassert(mRegionUUID == pRegionUUID);
+ mRequestStatus = pNavMeshRequestStatus;
+ if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion)))
+ {
+ llassert(!pNavMeshData.empty());
+ mHasNavMesh = true;
+ mNavMeshVersion = pNavMeshVersion;
+ llassert(LLPathingLib::getInstance() != NULL);
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection);
+ }
+ }
+ mLocationCallback();
+}
+
+void LLPathfindingNavMeshZone::NavMeshLocation::clear()
+{
+ mHasNavMesh = false;
+ mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown;
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
+}
+
+LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const
+{
+ 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 region;
+}
diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h new file mode 100644 index 0000000000..8489b5899b --- /dev/null +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -0,0 +1,109 @@ +/**
+ * @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 <vector>
+
+#include <boost/shared_ptr.hpp>
+#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 initialize();
+
+ void enable();
+ void disable();
+ void refresh();
+
+protected:
+
+private:
+ typedef boost::function<void (void)> navmesh_location_callback_t;
+ class NavMeshLocation
+ {
+ public:
+ NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback);
+ virtual ~NavMeshLocation();
+
+ void enable();
+ void refresh();
+ void disable();
+
+ LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const;
+
+ protected:
+
+ private:
+ 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 boost::shared_ptr<NavMeshLocation> NavMeshLocationPtr;
+ typedef std::vector<NavMeshLocationPtr> NavMeshLocationPtrs;
+
+ void handleNavMeshLocation();
+ void updateStatus();
+
+ NavMeshLocationPtrs mNavMeshLocationPtrs;
+ navmesh_zone_signal_t mNavMeshZoneSignal;
+};
+
+#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 b608e513d5..6c97af2878 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -11,12 +11,13 @@ single_instance="true" title="Pathfinding edit / test" width="456"> - <floater.string name="navmesh_fetch_initial"></floater.string> - <floater.string name="navmesh_fetch_inprogress">Downloading the navmesh ...</floater.string> - <floater.string name="navmesh_fetch_complete_available">Navmesh received.</floater.string> - <floater.string name="navmesh_fetch_complete_none">No navmesh for region.</floater.string> - <floater.string name="navmesh_region_not_enabled">This region is not enabled for pathfinding.</floater.string> - <floater.string name="navmesh_library_not_implemented">Cannot find pathing library implementation.</floater.string> + <floater.string name="navmesh_status_unknown"></floater.string> + <floater.string name="navmesh_status_library_not_implemented">Cannot find pathing library implementation.</floater.string> + <floater.string name="navmesh_status_region_not_enabled">This region is not enabled for pathfinding.</floater.string> + <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_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> |