diff options
author | prep <none@none> | 2012-01-24 16:09:26 -0500 |
---|---|---|
committer | prep <none@none> | 2012-01-24 16:09:26 -0500 |
commit | d4c0c127b62499b72745de7f9df135ec0286cc13 (patch) | |
tree | 8bacac91a776d382cc904344ff8f853ddeaf2232 /indra/newview | |
parent | 3b4d841ee254186d881490cfadbdfbac6dcdf6ad (diff) |
WIP: path-118
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.h | 3 | ||||
-rw-r--r-- | indra/newview/llnavmeshstation.cpp | 94 | ||||
-rw-r--r-- | indra/newview/llnavmeshstation.h | 9 | ||||
-rw-r--r-- | indra/newview/llsurface.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llsurface.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewerregion.h | 1 |
9 files changed, 74 insertions, 112 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 314bd790dd..bff87cea95 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1517,8 +1517,8 @@ if (WINDOWS) PROPERTIES # *TODO -reenable this once we get server usage sorted out #LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:\"__tcmalloc\"" - LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc /FORCE:MULTIPLE" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO /FORCE:MULTIPLE" + LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc " + LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" LINK_FLAGS_RELEASE "/FORCE:MULTIPLE" ) if(USE_PRECOMPILED_HEADERS) diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 63b863937e..8556127051 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -54,6 +54,8 @@ #define XUI_CHARACTER_TYPE_C 3
#define XUI_CHARACTER_TYPE_D 4
+const int CURRENT_REGION = 99;
+const int MAX_OBSERVERS = 10;
//---------------------------------------------------------------------------
// LLFloaterPathfindingConsole
//---------------------------------------------------------------------------
@@ -333,10 +335,12 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mTerrainMaterialA(NULL),
mTerrainMaterialB(NULL),
mTerrainMaterialC(NULL),
- mTerrainMaterialD(NULL),
- mNavMeshDownloadObserver()
+ mTerrainMaterialD(NULL)
{
- mNavMeshDownloadObserver.setPathfindingConsole(this);
+ for (int i=0;i<MAX_OBSERVERS;++i)
+ {
+ mNavMeshDownloadObserver[i].setPathfindingConsole(this);
+ }
}
LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole()
@@ -365,23 +369,41 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) }
else
{
+ mCurrentMDO = 0;
//make sure the region is essentially enabled for navmesh support
std::string capability = "RetrieveNavMeshSrc";
- std::string url = gAgent.getRegion()->getCapability( capability );
- if ( !url.empty() )
- {
- std::string str = getString("navmesh_fetch_inprogress");
- mPathfindingStatus->setText((LLStringExplicit)str);
- LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url );
- LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver.getObserverHandle() );
- }
- else
+
+ //prep# neighboring navmesh support proto
+ LLViewerRegion* pCurrentRegion = gAgent.getRegion();
+ std::vector<LLViewerRegion*> regions;
+ regions.push_back( pCurrentRegion );
+ //pCurrentRegion->getNeighboringRegions( regions );
+
+ std::vector<int> shift;
+ shift.push_back( CURRENT_REGION );
+ //pCurrentRegion->getNeighboringRegionsStatus( shift );
+
+ int regionCnt = regions.size();
+ for ( int i=0; i<regionCnt; ++i )
{
- 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;
+ std::string url = regions[i]->getCapability( capability );
+
+ if ( !url.empty() )
+ {
+ llinfos<<"Region has required caps of type ["<<capability<<"]"<<llendl;
+ LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url );
+ int dir = shift[i];
+ LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir );
+ ++mCurrentMDO;
+ }
+ else
+ {
+ 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;
+ }
}
}
}
diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 7d8369c806..ed63a669ea 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -141,7 +141,8 @@ private: LLLineEditor *mTerrainMaterialC;
LLLineEditor *mTerrainMaterialD;
- LLNavMeshDownloadObserver mNavMeshDownloadObserver;
+ LLNavMeshDownloadObserver mNavMeshDownloadObserver[10];
+ int mCurrentMDO;
//Container that is populated and subsequently submitted to the LLPathingSystem for processing
LLPathingLib::PathingPacket mPathData;
diff --git a/indra/newview/llnavmeshstation.cpp b/indra/newview/llnavmeshstation.cpp index 48f54649f8..6f6ebc184a 100644 --- a/indra/newview/llnavmeshstation.cpp +++ b/indra/newview/llnavmeshstation.cpp @@ -31,68 +31,20 @@ #include "llagent.h" #include "llviewerregion.h" #include "llsdutil.h" -#include "llfloaterpathfindingconsole.h" - //=============================================================================== LLNavMeshStation::LLNavMeshStation() { } - -//=============================================================================== -class LLNavMeshUploadResponder : public LLCurl::Responder -{ -public: - LLNavMeshUploadResponder( const LLHandle<LLNavMeshObserver>& observer_handle ) - : mObserverHandle( observer_handle ) - { - } - - void clearPendingRequests ( void ) - { - } - - void error( U32 statusNum, const std::string& reason ) - { - //statusNum; - llwarns << "Transport error "<<reason<<llendl; - } - - void result( const LLSD& content ) - { - llinfos<<"Content received"<<llendl; - //TODO# some sanity checking - if ( content.has("error") ) - { - llwarns << "Error on fetched data"<< llendl; - } - else - { - LLNavMeshObserver* pObserver = mObserverHandle.get(); - if ( pObserver ) - { - llinfos<<"Do something immensely important w/content"<<llendl; - //pObserver->execute(); - } - } - } - -private: - //Observer handle - LLHandle<LLNavMeshObserver> mObserverHandle; -}; //=============================================================================== class LLNavMeshDownloadResponder : public LLCurl::Responder { public: - LLNavMeshDownloadResponder( const LLHandle<LLNavMeshDownloadObserver>& observer_handle ) + LLNavMeshDownloadResponder( const LLHandle<LLNavMeshDownloadObserver>& observer_handle, int dir ) : mObserverHandle( observer_handle ) + , mDir( dir ) { } - void clearPendingRequests ( void ) - { - } - void error( U32 statusNum, const std::string& reason ) { //statusNum; @@ -101,11 +53,11 @@ public: void result( const LLSD& content ) { - //TODO# some sanity checking + 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; + //llinfos<<"LLsd buffer on error"<<ll_pretty_print_sd(content)<<llendl; } else { @@ -116,13 +68,11 @@ public: if ( content.has("navmesh_data") ) { const LLSD::Binary& stuff = content["navmesh_data"].asBinary(); - LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD( stuff ); - pObserver->getPathfindingConsole()->setHasNavMeshReceived(); + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD( stuff, mDir ); } else { llwarns<<"no mesh data "<<llendl; - pObserver->getPathfindingConsole()->setHasNoNavMesh(); } } } @@ -131,38 +81,10 @@ public: private: //Observer handle LLHandle<LLNavMeshDownloadObserver> mObserverHandle; + int mDir; }; - -//=============================================================================== -bool LLNavMeshStation::postNavMeshToServer( LLSD& data, const LLHandle<LLNavMeshObserver>& observerHandle ) -{ - mCurlRequest = new LLCurlRequest(); - - if ( mNavMeshUploadURL.empty() ) - { - llinfos << "Unable to upload navmesh because of missing URL" << llendl; - } - else - { - LLCurlRequest::headers_t headers; - mCurlRequest->post( mNavMeshUploadURL, headers, data, - new LLNavMeshUploadResponder(/*this, data,*/ observerHandle ) ); - do - { - mCurlRequest->process(); - //sleep for 10ms to prevent eating a whole core - apr_sleep(10000); - } while ( mCurlRequest->getQueued() > 0 ); - } - - delete mCurlRequest; - - mCurlRequest = NULL; - - return true; -} //=============================================================================== -void LLNavMeshStation::downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle ) +void LLNavMeshStation::downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle, int dir ) { if ( mNavMeshDownloadURL.empty() ) { @@ -173,7 +95,7 @@ void LLNavMeshStation::downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObser LLSD data; data["agent_id"] = gAgent.getID(); data["region_id"] = gAgent.getRegion()->getRegionID(); - LLHTTPClient::post(mNavMeshDownloadURL, data, new LLNavMeshDownloadResponder( observerHandle ) ); + LLHTTPClient::post(mNavMeshDownloadURL, data, new LLNavMeshDownloadResponder( observerHandle, dir ) ); } } //=============================================================================== diff --git a/indra/newview/llnavmeshstation.h b/indra/newview/llnavmeshstation.h index 566f6d2d8d..c8e23513eb 100644 --- a/indra/newview/llnavmeshstation.h +++ b/indra/newview/llnavmeshstation.h @@ -47,14 +47,11 @@ protected: LLRootHandle<LLNavMeshObserver> mObserverHandle; }; //=============================================================================== -//prep#TODO# determine if a name change is needed? class LLNavMeshDownloadObserver { public: //Ctor - LLNavMeshDownloadObserver() - : mPathfindingConsole(NULL) - { mObserverHandle.bind(this); } + LLNavMeshDownloadObserver() { mObserverHandle.bind(this); } //Dtor virtual ~LLNavMeshDownloadObserver() {} //Accessor for the observers handle @@ -78,8 +75,10 @@ public: 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 ); + void downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle, int dir ); protected: //Curl object to facilitate posts to server diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 66df7dae3e..65393cc168 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -346,6 +346,19 @@ void LLSurface::getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegio } } + +void LLSurface::getNeighboringRegionsStatus( std::vector<S32>& regions ) +{ + S32 i; + for (i = 0; i < 8; i++) + { + if ( mNeighbors[i] != NULL ) + { + regions.push_back( i ); + } + } +} + void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) { S32 i; diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index a4ef4fe2de..8052fb0d18 100644 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -142,6 +142,7 @@ public: friend std::ostream& operator<<(std::ostream &s, const LLSurface &S); void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions ); + void getNeighboringRegionsStatus( std::vector<S32>& regions ); public: // Number of grid points on one side of a region, including +1 buffer for diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 800e394b16..cc4cac4202 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1796,7 +1796,10 @@ void LLViewerRegion::getNeighboringRegions( std::vector<LLViewerRegion*>& unique { mImpl->mLandp->getNeighboringRegions( uniqueRegions ); } - +void LLViewerRegion::getNeighboringRegionsStatus( std::vector<S32>& regions ) +{ + mImpl->mLandp->getNeighboringRegionsStatus( regions ); +} void LLViewerRegion::showReleaseNotes() { std::string url = this->getCapability("ServerReleaseNotes"); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index c483c6ef52..6004165b0e 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -325,6 +325,7 @@ public: bool objectsCrossParcel(const std::vector<LLBBox>& boxes) const; void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions ); + void getNeighboringRegionsStatus( std::vector<S32>& regions ); public: struct CompareDistance |