WIP: path-118
parent
3b4d841ee2
commit
d4c0c127b6
|
|
@ -140,6 +140,10 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
#ifdef LL_LIBRARY_INCLUDE
|
||||
void ref();
|
||||
void unref();
|
||||
#else
|
||||
void ref()
|
||||
{
|
||||
if (mPointer)
|
||||
|
|
@ -162,7 +166,7 @@ protected:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
protected:
|
||||
Type* mPointer;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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() )
|
||||
|
||||
//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_fetch_inprogress");
|
||||
mPathfindingStatus->setText((LLStringExplicit)str);
|
||||
LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url );
|
||||
LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver.getObserverHandle() );
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -31,26 +31,20 @@
|
|||
#include "llagent.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llfloaterpathfindingconsole.h"
|
||||
|
||||
//===============================================================================
|
||||
LLNavMeshStation::LLNavMeshStation()
|
||||
{
|
||||
}
|
||||
|
||||
//===============================================================================
|
||||
class LLNavMeshUploadResponder : public LLCurl::Responder
|
||||
class LLNavMeshDownloadResponder : public LLCurl::Responder
|
||||
{
|
||||
public:
|
||||
LLNavMeshUploadResponder( const LLHandle<LLNavMeshObserver>& 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;
|
||||
|
|
@ -60,52 +54,10 @@ public:
|
|||
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 )
|
||||
: 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 )
|
||||
{
|
||||
//TODO# some sanity checking
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
//===============================================================================
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue