From d4c0c127b62499b72745de7f9df135ec0286cc13 Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 24 Jan 2012 16:09:26 -0500 Subject: WIP: path-118 --- indra/newview/CMakeLists.txt | 4 +- indra/newview/llfloaterpathfindingconsole.cpp | 56 +++++++++++----- indra/newview/llfloaterpathfindingconsole.h | 3 +- indra/newview/llnavmeshstation.cpp | 94 +++------------------------ indra/newview/llnavmeshstation.h | 9 ++- indra/newview/llsurface.cpp | 13 ++++ indra/newview/llsurface.h | 1 + indra/newview/llviewerregion.cpp | 5 +- indra/newview/llviewerregion.h | 1 + 9 files changed, 74 insertions(+), 112 deletions(-) (limited to 'indra/newview') 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;igetCapability( 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 regions; + regions.push_back( pCurrentRegion ); + //pCurrentRegion->getNeighboringRegions( regions ); + + std::vector shift; + shift.push_back( CURRENT_REGION ); + //pCurrentRegion->getNeighboringRegionsStatus( shift ); + + int regionCnt = regions.size(); + for ( int i=0; isetText((LLStringExplicit)str, styleParams); - llinfos<<"Region has does not required caps of type ["<getCapability( capability ); + + if ( !url.empty() ) + { + llinfos<<"Region has required caps of type ["<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 ["<& observer_handle ) - : mObserverHandle( observer_handle ) - { - } - - void clearPendingRequests ( void ) - { - } - - void error( U32 statusNum, const std::string& reason ) - { - //statusNum; - llwarns << "Transport error "<execute(); - } - } - } - -private: - //Observer handle - LLHandle mObserverHandle; -}; //=============================================================================== class LLNavMeshDownloadResponder : public LLCurl::Responder { public: - LLNavMeshDownloadResponder( const LLHandle& observer_handle ) + LLNavMeshDownloadResponder( const LLHandle& 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"<extractNavMeshSrcFromLLSD( stuff ); - pObserver->getPathfindingConsole()->setHasNavMeshReceived(); + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD( stuff, mDir ); } else { llwarns<<"no mesh data "<getPathfindingConsole()->setHasNoNavMesh(); } } } @@ -131,38 +81,10 @@ public: private: //Observer handle LLHandle mObserverHandle; + int mDir; }; - -//=============================================================================== -bool LLNavMeshStation::postNavMeshToServer( LLSD& data, const LLHandle& 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& observerHandle ) +void LLNavMeshStation::downloadNavMeshSrc( const LLHandle& observerHandle, int dir ) { if ( mNavMeshDownloadURL.empty() ) { @@ -173,7 +95,7 @@ void LLNavMeshStation::downloadNavMeshSrc( const LLHandlegetRegionID(); - 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 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& observerHandle ); + void downloadNavMeshSrc( const LLHandle& 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& uniqueRegio } } + +void LLSurface::getNeighboringRegionsStatus( std::vector& 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& uniqueRegions ); + void getNeighboringRegionsStatus( std::vector& 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& unique { mImpl->mLandp->getNeighboringRegions( uniqueRegions ); } - +void LLViewerRegion::getNeighboringRegionsStatus( std::vector& 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& boxes) const; void getNeighboringRegions( std::vector& uniqueRegions ); + void getNeighboringRegionsStatus( std::vector& regions ); public: struct CompareDistance -- cgit v1.2.3