From 581de7c7b8025c48e585c1af80e060af94aca328 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 5 Mar 2012 17:20:35 -0800 Subject: PATH-205,PATH-304: More work to handle downloading of out-of-date navmeshes. --- indra/newview/llpathfindingnavmeshzone.cpp | 230 +++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 indra/newview/llpathfindingnavmeshzone.cpp (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp new file mode 100644 index 0000000000..986acfa3e8 --- /dev/null +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -0,0 +1,230 @@ +/** + * @file llpathfindingnavmeshzone.cpp + * @author William Todd Stinson + * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsd.h" +#include "lluuid.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshzone.h" +#include "llpathfindingmanager.h" +#include "llviewercontrol.h" + +#include "LLPathingLib.h" + +#include +#include + +#define CENTER_REGION 99 + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() + : mNavMeshLocations(), + mNavMeshZoneSignal(), + mNavMeshSlot() +{ +} + +LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone() +{ +} + +LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback) +{ + return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); +} + +void LLPathfindingNavMeshZone::setCurrentRegionAsCenter() +{ + llassert(LLPathingLib::getInstance() != NULL); + LLPathingLib::getInstance()->cleanupResidual(); + mNavMeshLocations.clear(); + LLViewerRegion *currentRegion = gAgent.getRegion(); + const LLUUID ¤tRegionUUID = currentRegion->getRegionID(); + NavMeshLocation centerNavMesh(currentRegionUUID, CENTER_REGION); + mNavMeshLocations.insert(std::pair(currentRegionUUID, centerNavMesh)); +} + +void LLPathfindingNavMeshZone::refresh() +{ + LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance(); + if (!mNavMeshSlot.connected()) + { + pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4)); + } + + pathfindingManagerInstance->requestGetNavMeshForCurrentRegion(); +} + +void LLPathfindingNavMeshZone::disable() +{ + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } + + llassert(LLPathingLib::getInstance() != NULL); + LLPathingLib::getInstance()->cleanupResidual(); + + mNavMeshLocations.clear(); +} + +void LLPathfindingNavMeshZone::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +{ + NavMeshLocations::iterator navMeshIter = mNavMeshLocations.find(pRegionUUID); + if (navMeshIter != mNavMeshLocations.end()) + { + navMeshIter->second.handleNavMesh(pNavMeshRequestStatus, pRegionUUID, pNavMeshVersion, pNavMeshData); + updateStatus(); + } +} + +void LLPathfindingNavMeshZone::updateStatus() +{ + bool hasRequestUnknown = false; + bool hasRequestStarted = false; + bool hasRequestCompleted = false; + bool hasRequestNotEnabled = false; + bool hasRequestError = false; + + for (NavMeshLocations::iterator navMeshIter = mNavMeshLocations.begin(); + navMeshIter != mNavMeshLocations.end(); ++navMeshIter) + { + switch (navMeshIter->second.getRequestStatus()) + { + case LLPathfindingNavMesh::kNavMeshRequestUnknown : + hasRequestUnknown = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestStarted : + hasRequestStarted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestCompleted : + hasRequestCompleted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNotEnabled : + hasRequestNotEnabled = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestError : + hasRequestError = true; + break; + default : + hasRequestError = true; + llassert(0); + break; + } + } + + ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; + if (hasRequestNotEnabled) + { + zoneRequestStatus = kNavMeshZoneRequestNotEnabled; + } + else if (hasRequestError) + { + zoneRequestStatus = kNavMeshZoneRequestError; + } + else if (hasRequestStarted) + { + zoneRequestStatus = kNavMeshZoneRequestStarted; + } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; + llassert(0); + } + else if (hasRequestCompleted) + { + zoneRequestStatus = kNavMeshZoneRequestCompleted; + LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); + } + else + { + zoneRequestStatus = kNavMeshZoneRequestError; + llassert(0); + } + + mNavMeshZoneSignal(zoneRequestStatus); +} + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone::NavMeshLocation +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection) + : mRegionUUID(pRegionUUID), + mDirection(pDirection), + mHasNavMesh(false), + mNavMeshVersion(0U), + mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown) +{ +} + +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const NavMeshLocation &other) + : mRegionUUID(other.mRegionUUID), + mDirection(other.mDirection), + mHasNavMesh(other.mHasNavMesh), + mNavMeshVersion(other.mNavMeshVersion), + mRequestStatus(other.mRequestStatus) +{ +} + +LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() +{ +} + +void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +{ + llassert(mRegionUUID == pRegionUUID); + mRequestStatus = pNavMeshRequestStatus; + if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion))) + { + llassert(!pNavMeshData.empty()); + mHasNavMesh = true; + mNavMeshVersion = pNavMeshVersion; + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + } +} + +LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const +{ + return mRequestStatus; +} + +LLPathfindingNavMeshZone::NavMeshLocation &LLPathfindingNavMeshZone::NavMeshLocation::operator =(const NavMeshLocation &other) +{ + mRegionUUID = other.mRegionUUID; + mDirection = other.mDirection; + mHasNavMesh = other.mHasNavMesh; + mNavMeshVersion = other.mNavMeshVersion; + mRequestStatus = other.mRequestStatus; + + return (*this); +} -- cgit v1.2.3 From 8ad01dd79a2c215895017475bcfd62808f8893be Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 5 Mar 2012 17:55:33 -0800 Subject: Wrapping all cases of LLPathingLib::getInstance in null pointer checks. --- indra/newview/llpathfindingnavmeshzone.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 986acfa3e8..8fa6fc3c8b 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -65,7 +65,10 @@ LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::register void LLPathfindingNavMeshZone::setCurrentRegionAsCenter() { llassert(LLPathingLib::getInstance() != NULL); - LLPathingLib::getInstance()->cleanupResidual(); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->cleanupResidual(); + } mNavMeshLocations.clear(); LLViewerRegion *currentRegion = gAgent.getRegion(); const LLUUID ¤tRegionUUID = currentRegion->getRegionID(); @@ -91,8 +94,10 @@ void LLPathfindingNavMeshZone::disable() mNavMeshSlot.disconnect(); } - llassert(LLPathingLib::getInstance() != NULL); - LLPathingLib::getInstance()->cleanupResidual(); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->cleanupResidual(); + } mNavMeshLocations.clear(); } @@ -163,7 +168,11 @@ void LLPathfindingNavMeshZone::updateStatus() else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; - LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); + } } else { @@ -209,7 +218,11 @@ void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMe llassert(!pNavMeshData.empty()); mHasNavMesh = true; mNavMeshVersion = pNavMeshVersion; - LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + } } } -- cgit v1.2.3 From 6c9561c882cf0d5bb0cb547852e95daec19f559c Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 6 Mar 2012 15:57:28 -0800 Subject: Storing the slots for the registered signal listeners. Before, this was creating the artifact of crashing the Viewer on the second close of the pathfinding console. --- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 8fa6fc3c8b..c6b9c6c338 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -81,7 +81,7 @@ void LLPathfindingNavMeshZone::refresh() LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance(); if (!mNavMeshSlot.connected()) { - pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4)); + mNavMeshSlot = pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4)); } pathfindingManagerInstance->requestGetNavMeshForCurrentRegion(); -- cgit v1.2.3 From a0c626fe411336871505c2c414143ae4b2f73259 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 6 Mar 2012 18:40:37 -0800 Subject: PATH-205,PATH-304: More work to handle downloading of out-of-date navmeshes. --- indra/newview/llpathfindingnavmeshzone.cpp | 194 ++++++++++++++++++++--------- 1 file changed, 134 insertions(+), 60 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index c6b9c6c338..7b9ac913c9 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -38,7 +38,9 @@ #include "LLPathingLib.h" #include -#include +#include + +#include #define CENTER_REGION 99 @@ -47,9 +49,8 @@ //--------------------------------------------------------------------------- LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() - : mNavMeshLocations(), - mNavMeshZoneSignal(), - mNavMeshSlot() + : mNavMeshLocationPtrs(), + mNavMeshZoneSignal() { } @@ -62,56 +63,68 @@ LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::register return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); } -void LLPathfindingNavMeshZone::setCurrentRegionAsCenter() +void LLPathfindingNavMeshZone::initialize() { llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->cleanupResidual(); } - mNavMeshLocations.clear(); - LLViewerRegion *currentRegion = gAgent.getRegion(); - const LLUUID ¤tRegionUUID = currentRegion->getRegionID(); - NavMeshLocation centerNavMesh(currentRegionUUID, CENTER_REGION); - mNavMeshLocations.insert(std::pair(currentRegionUUID, centerNavMesh)); + 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::refresh() +void LLPathfindingNavMeshZone::enable() { - LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance(); - if (!mNavMeshSlot.connected()) + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - mNavMeshSlot = pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4)); + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->enable(); } - - pathfindingManagerInstance->requestGetNavMeshForCurrentRegion(); } void LLPathfindingNavMeshZone::disable() { - if (mNavMeshSlot.connected()) + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - mNavMeshSlot.disconnect(); + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->disable(); } - +#if 0 + llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->cleanupResidual(); } - - mNavMeshLocations.clear(); +#endif } -void LLPathfindingNavMeshZone::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +void LLPathfindingNavMeshZone::refresh() { - NavMeshLocations::iterator navMeshIter = mNavMeshLocations.find(pRegionUUID); - if (navMeshIter != mNavMeshLocations.end()) + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - navMeshIter->second.handleNavMesh(pNavMeshRequestStatus, pRegionUUID, pNavMeshVersion, pNavMeshData); - updateStatus(); + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->refresh(); } } +void LLPathfindingNavMeshZone::handleNavMeshLocation() +{ + updateStatus(); +} + void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; @@ -120,10 +133,11 @@ void LLPathfindingNavMeshZone::updateStatus() bool hasRequestNotEnabled = false; bool hasRequestError = false; - for (NavMeshLocations::iterator navMeshIter = mNavMeshLocations.begin(); - navMeshIter != mNavMeshLocations.end(); ++navMeshIter) + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - switch (navMeshIter->second.getRequestStatus()) + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + switch (navMeshLocationPtr->getRequestStatus()) { case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; @@ -148,23 +162,14 @@ void LLPathfindingNavMeshZone::updateStatus() } ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; - if (hasRequestNotEnabled) + if (hasRequestStarted) { - zoneRequestStatus = kNavMeshZoneRequestNotEnabled; + zoneRequestStatus = kNavMeshZoneRequestStarted; } else if (hasRequestError) { zoneRequestStatus = kNavMeshZoneRequestError; } - else if (hasRequestStarted) - { - zoneRequestStatus = kNavMeshZoneRequestStarted; - } - else if (hasRequestUnknown) - { - zoneRequestStatus = kNavMeshZoneRequestUnknown; - llassert(0); - } else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; @@ -174,6 +179,14 @@ void LLPathfindingNavMeshZone::updateStatus() LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); } } + else if (hasRequestNotEnabled) + { + zoneRequestStatus = kNavMeshZoneRequestNotEnabled; + } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; + } else { zoneRequestStatus = kNavMeshZoneRequestError; @@ -187,26 +200,62 @@ void LLPathfindingNavMeshZone::updateStatus() // LLPathfindingNavMeshZone::NavMeshLocation //--------------------------------------------------------------------------- -LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection) - : mRegionUUID(pRegionUUID), - mDirection(pDirection), +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback) + : mDirection(pDirection), + mRegionUUID(), mHasNavMesh(false), mNavMeshVersion(0U), - mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown) + mLocationCallback(pLocationCallback), + mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), + mNavMeshSlot() { } -LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const NavMeshLocation &other) - : mRegionUUID(other.mRegionUUID), - mDirection(other.mDirection), - mHasNavMesh(other.mHasNavMesh), - mNavMeshVersion(other.mNavMeshVersion), - mRequestStatus(other.mRequestStatus) +LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() { } -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::kNavMeshRequestUnknown, 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) @@ -224,20 +273,45 @@ void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMe LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); } } + mLocationCallback(); } -LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const +void LLPathfindingNavMeshZone::NavMeshLocation::clear() { - return mRequestStatus; + mHasNavMesh = false; + mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } } -LLPathfindingNavMeshZone::NavMeshLocation &LLPathfindingNavMeshZone::NavMeshLocation::operator =(const NavMeshLocation &other) +LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const { - mRegionUUID = other.mRegionUUID; - mDirection = other.mDirection; - mHasNavMesh = other.mHasNavMesh; - mNavMeshVersion = other.mNavMeshVersion; - mRequestStatus = other.mRequestStatus; + 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 availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); + if ( foundElem != availableRegions.end() ) + { + std::vector neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; + } + } + } - return (*this); + return region; } -- cgit v1.2.3 From a7944f17bec66e7c0f066ab3b6196cc2233b1ca7 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 7 Mar 2012 14:39:27 -0800 Subject: PATH-205,PATh-304: Fixing a crash issue with loading multiple navmeshes during the second refresh. --- indra/newview/llpathfindingnavmeshzone.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 7b9ac913c9..983b88fe05 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -65,11 +65,6 @@ LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::register void LLPathfindingNavMeshZone::initialize() { - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->cleanupResidual(); - } mNavMeshLocationPtrs.clear(); NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); @@ -101,17 +96,16 @@ void LLPathfindingNavMeshZone::disable() NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; navMeshLocationPtr->disable(); } -#if 0 +} + +void LLPathfindingNavMeshZone::refresh() +{ llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->cleanupResidual(); } -#endif -} -void LLPathfindingNavMeshZone::refresh() -{ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { @@ -170,6 +164,10 @@ void LLPathfindingNavMeshZone::updateStatus() { zoneRequestStatus = kNavMeshZoneRequestError; } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; + } else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; @@ -183,10 +181,6 @@ void LLPathfindingNavMeshZone::updateStatus() { zoneRequestStatus = kNavMeshZoneRequestNotEnabled; } - else if (hasRequestUnknown) - { - zoneRequestStatus = kNavMeshZoneRequestUnknown; - } else { zoneRequestStatus = kNavMeshZoneRequestError; @@ -239,7 +233,7 @@ void LLPathfindingNavMeshZone::NavMeshLocation::refresh() { llassert(mRegionUUID.isNull()); LLSD::Binary nullData; - handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestUnknown, mRegionUUID, 0U, nullData); + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, mRegionUUID, 0U, nullData); } else { -- cgit v1.2.3 From f578181af9cbe3277374578c27487e2e72956079 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 8 Mar 2012 12:34:11 -0800 Subject: PATH-304: Adding functionality to handle the reloading of out-of-date navmeshes. --- indra/newview/llpathfindingnavmeshzone.cpp | 58 +++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 983b88fe05..3767834655 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -67,6 +67,24 @@ void LLPathfindingNavMeshZone::initialize() { mNavMeshLocationPtrs.clear(); +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; + std::vector availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + std::vector neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + for (std::vector::const_iterator statusIter = availableRegions.begin(); + statusIter != availableRegions.end(); ++statusIter) + { + LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; + llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; + } + } + +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); mNavMeshLocationPtrs.push_back(centerNavMeshPtr); @@ -122,20 +140,30 @@ void LLPathfindingNavMeshZone::handleNavMeshLocation() void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; + bool hasRequestNeedsUpdate = false; bool hasRequestStarted = false; bool hasRequestCompleted = false; bool hasRequestNotEnabled = false; bool hasRequestError = false; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE switch (navMeshLocationPtr->getRequestStatus()) { case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; break; + case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : + hasRequestNeedsUpdate = true; + break; case LLPathfindingNavMesh::kNavMeshRequestStarted : hasRequestStarted = true; break; @@ -156,34 +184,62 @@ void LLPathfindingNavMeshZone::updateStatus() } ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; - if (hasRequestStarted) + if (hasRequestNeedsUpdate) + { + zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestStarted) { zoneRequestStatus = kNavMeshZoneRequestStarted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestError) { zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestUnknown) { zoneRequestStatus = kNavMeshZoneRequestUnknown; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); } +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestNotEnabled) { zoneRequestStatus = kNavMeshZoneRequestNotEnabled; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else { zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(0); } -- cgit v1.2.3 From b3197fc12e41bc60e3510d840c67ef98816c3ae8 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 12 Mar 2012 18:48:40 -0700 Subject: PATH-304: Making the navmesh version information work for both Premium Wilderness regions (old pathfinding simulator build with missing capabilities) as well as the new pathfinding simulator builds with the version services. --- indra/newview/llpathfindingnavmeshzone.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 3767834655..83238ec869 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -311,10 +311,15 @@ LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLoc 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))) + if (pNavMeshRequestStatus != LLPathfindingNavMesh::kNavMeshRequestCompleted) + { + mRequestStatus = pNavMeshRequestStatus; + mLocationCallback(); + } + else if (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion)) { llassert(!pNavMeshData.empty()); + mRequestStatus = pNavMeshRequestStatus; mHasNavMesh = true; mNavMeshVersion = pNavMeshVersion; llassert(LLPathingLib::getInstance() != NULL); @@ -322,8 +327,8 @@ void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMe { LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); } + mLocationCallback(); } - mLocationCallback(); } void LLPathfindingNavMeshZone::NavMeshLocation::clear() -- cgit v1.2.3 From c990cc71ce124059a072c7778ac962253bacb199 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 12 Mar 2012 19:18:19 -0700 Subject: PATH-304: Adding an extra state for the pathfinding console to report that the status of the navmesh is being checked. --- indra/newview/llpathfindingnavmeshzone.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 83238ec869..8e558c3b00 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -140,6 +140,7 @@ void LLPathfindingNavMeshZone::handleNavMeshLocation() void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; + bool hasRequestChecking = false; bool hasRequestNeedsUpdate = false; bool hasRequestStarted = false; bool hasRequestCompleted = false; @@ -161,6 +162,9 @@ void LLPathfindingNavMeshZone::updateStatus() case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; break; + case LLPathfindingNavMesh::kNavMeshRequestChecking : + hasRequestChecking = true; + break; case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : hasRequestNeedsUpdate = true; break; @@ -189,6 +193,13 @@ void LLPathfindingNavMeshZone::updateStatus() zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestChecking) + { + zoneRequestStatus = kNavMeshZoneRequestChecking; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestStarted) -- cgit v1.2.3 From d4fb7c99febf07b4eb7f3a9d2eab485e356d1439 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 14 Mar 2012 14:09:36 -0700 Subject: PATH-302: Adding in status reporting for the simulator navmesh status. Separating the viewer status messaging from the simulator status. --- indra/newview/llpathfindingnavmeshzone.cpp | 130 +++++++++++++++++++++++------ 1 file changed, 106 insertions(+), 24 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 8e558c3b00..f871204454 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -50,6 +50,7 @@ LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() : mNavMeshLocationPtrs(), + mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), mNavMeshZoneSignal() { } @@ -132,6 +133,71 @@ void LLPathfindingNavMeshZone::refresh() } } +LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const +{ + bool hasPending = false; + bool hasBuilding = false; + bool hasComplete = false; + bool hasRepending = false; + + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + + switch (navMeshLocationPtr->getNavMeshStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + hasPending = true; + break; + case LLPathfindingNavMeshStatus::kBuilding : + hasBuilding = true; + break; + case LLPathfindingNavMeshStatus::kComplete : + hasComplete = true; + break; + case LLPathfindingNavMeshStatus::kRepending : + hasRepending = true; + break; + default : + hasPending = true; + llassert(0); + break; + } + } + + ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; + if (hasRepending || (hasPending && hasBuilding)) + { + zoneStatus = kNavMeshZonePendingAndBuilding; + } + else if (hasComplete) + { + if (hasPending) + { + zoneStatus = kNavMeshZoneSomePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneSomeBuilding; + } + else + { + zoneStatus = kNavMeshZoneComplete; + } + } + else if (hasPending) + { + zoneStatus = kNavMeshZonePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneBuilding; + } + + return zoneStatus; +} + void LLPathfindingNavMeshZone::handleNavMeshLocation() { updateStatus(); @@ -150,10 +216,10 @@ void LLPathfindingNavMeshZone::updateStatus() #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE @@ -226,14 +292,6 @@ void LLPathfindingNavMeshZone::updateStatus() else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); - } #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE @@ -254,7 +312,24 @@ void LLPathfindingNavMeshZone::updateStatus() llassert(0); } - mNavMeshZoneSignal(zoneRequestStatus); + if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && + (zoneRequestStatus == kNavMeshZoneRequestCompleted)) + { +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); + } +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + + mNavMeshZoneRequestStatus = zoneRequestStatus; + mNavMeshZoneSignal(mNavMeshZoneRequestStatus); } //--------------------------------------------------------------------------- @@ -266,6 +341,7 @@ LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navme mRegionUUID(), mHasNavMesh(false), mNavMeshVersion(0U), + mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), mLocationCallback(pLocationCallback), mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), mNavMeshSlot() @@ -288,7 +364,7 @@ void LLPathfindingNavMeshZone::NavMeshLocation::enable() else { mRegionUUID = region->getRegionID(); - mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3, _4)); + mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3)); } } @@ -299,8 +375,9 @@ void LLPathfindingNavMeshZone::NavMeshLocation::refresh() if (region == NULL) { llassert(mRegionUUID.isNull()); + LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); LLSD::Binary nullData; - handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, mRegionUUID, 0U, nullData); + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); } else { @@ -319,33 +396,38 @@ LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLoc return mRequestStatus; } -void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const { - llassert(mRegionUUID == pRegionUUID); - if (pNavMeshRequestStatus != LLPathfindingNavMesh::kNavMeshRequestCompleted) - { - mRequestStatus = pNavMeshRequestStatus; - mLocationCallback(); - } - else if (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion)) + return mNavMeshStatus; +} + +void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData) +{ + llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); + + if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && + (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) { llassert(!pNavMeshData.empty()); - mRequestStatus = pNavMeshRequestStatus; mHasNavMesh = true; - mNavMeshVersion = pNavMeshVersion; + mNavMeshVersion = pNavMeshStatus.getVersion(); llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); } - mLocationCallback(); } + + mRequestStatus = pNavMeshRequestStatus; + mNavMeshStatus = pNavMeshStatus.getStatus(); + mLocationCallback(); } void LLPathfindingNavMeshZone::NavMeshLocation::clear() { mHasNavMesh = false; mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; + mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; if (mNavMeshSlot.connected()) { mNavMeshSlot.disconnect(); -- cgit v1.2.3 From cc49d9d1a7c07f8e931c84752f030619b0eeb608 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 9 Apr 2012 15:48:13 -0400 Subject: Fix for path-506. Removed usevbo flag from stitchnavmesh api --- indra/newview/llpathfindingnavmeshzone.cpp | 930 ++++++++++++++--------------- 1 file changed, 465 insertions(+), 465 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index f871204454..4f8ca39987 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -1,465 +1,465 @@ -/** - * @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 -#include - -#include - -#define CENTER_REGION 99 - -//--------------------------------------------------------------------------- -// LLPathfindingNavMeshZone -//--------------------------------------------------------------------------- - -LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() - : mNavMeshLocationPtrs(), - mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), - mNavMeshZoneSignal() -{ -} - -LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone() -{ -} - -LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback) -{ - return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); -} - -void LLPathfindingNavMeshZone::initialize() -{ - mNavMeshLocationPtrs.clear(); - -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - LLViewerRegion *currentRegion = gAgent.getRegion(); - if (currentRegion != NULL) - { - llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; - std::vector availableRegions; - currentRegion->getNeighboringRegionsStatus( availableRegions ); - std::vector neighborRegionsPtrs; - currentRegion->getNeighboringRegions( neighborRegionsPtrs ); - for (std::vector::const_iterator statusIter = availableRegions.begin(); - statusIter != availableRegions.end(); ++statusIter) - { - LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; - llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; - } - } - -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - 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(); - } -} - -LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const -{ - bool hasPending = false; - bool hasBuilding = false; - bool hasComplete = false; - bool hasRepending = false; - - for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - - switch (navMeshLocationPtr->getNavMeshStatus()) - { - case LLPathfindingNavMeshStatus::kPending : - hasPending = true; - break; - case LLPathfindingNavMeshStatus::kBuilding : - hasBuilding = true; - break; - case LLPathfindingNavMeshStatus::kComplete : - hasComplete = true; - break; - case LLPathfindingNavMeshStatus::kRepending : - hasRepending = true; - break; - default : - hasPending = true; - llassert(0); - break; - } - } - - ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; - if (hasRepending || (hasPending && hasBuilding)) - { - zoneStatus = kNavMeshZonePendingAndBuilding; - } - else if (hasComplete) - { - if (hasPending) - { - zoneStatus = kNavMeshZoneSomePending; - } - else if (hasBuilding) - { - zoneStatus = kNavMeshZoneSomeBuilding; - } - else - { - zoneStatus = kNavMeshZoneComplete; - } - } - else if (hasPending) - { - zoneStatus = kNavMeshZonePending; - } - else if (hasBuilding) - { - zoneStatus = kNavMeshZoneBuilding; - } - - return zoneStatus; -} - -void LLPathfindingNavMeshZone::handleNavMeshLocation() -{ - updateStatus(); -} - -void LLPathfindingNavMeshZone::updateStatus() -{ - bool hasRequestUnknown = false; - bool hasRequestChecking = false; - bool hasRequestNeedsUpdate = false; - bool hasRequestStarted = false; - bool hasRequestCompleted = false; - bool hasRequestNotEnabled = false; - bool hasRequestError = false; - -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - switch (navMeshLocationPtr->getRequestStatus()) - { - case LLPathfindingNavMesh::kNavMeshRequestUnknown : - hasRequestUnknown = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestChecking : - hasRequestChecking = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : - hasRequestNeedsUpdate = 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 (hasRequestNeedsUpdate) - { - zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestChecking) - { - zoneRequestStatus = kNavMeshZoneRequestChecking; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestStarted) - { - zoneRequestStatus = kNavMeshZoneRequestStarted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestError) - { - zoneRequestStatus = kNavMeshZoneRequestError; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestUnknown) - { - zoneRequestStatus = kNavMeshZoneRequestUnknown; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestCompleted) - { - zoneRequestStatus = kNavMeshZoneRequestCompleted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestNotEnabled) - { - zoneRequestStatus = kNavMeshZoneRequestNotEnabled; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else - { - zoneRequestStatus = kNavMeshZoneRequestError; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - llassert(0); - } - - if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && - (zoneRequestStatus == kNavMeshZoneRequestCompleted)) - { -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); - } -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - - mNavMeshZoneRequestStatus = zoneRequestStatus; - mNavMeshZoneSignal(mNavMeshZoneRequestStatus); -} - -//--------------------------------------------------------------------------- -// LLPathfindingNavMeshZone::NavMeshLocation -//--------------------------------------------------------------------------- - -LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback) - : mDirection(pDirection), - mRegionUUID(), - mHasNavMesh(false), - mNavMeshVersion(0U), - mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), - 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)); - } -} - -void LLPathfindingNavMeshZone::NavMeshLocation::refresh() -{ - LLViewerRegion *region = getRegion(); - - if (region == NULL) - { - llassert(mRegionUUID.isNull()); - LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); - LLSD::Binary nullData; - handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); - } - else - { - llassert(mRegionUUID == region->getRegionID()); - LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region); - } -} - -void LLPathfindingNavMeshZone::NavMeshLocation::disable() -{ - clear(); -} - -LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const -{ - return mRequestStatus; -} - -LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const -{ - return mNavMeshStatus; -} - -void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData) -{ - llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); - - if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && - (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) - { - llassert(!pNavMeshData.empty()); - mHasNavMesh = true; - mNavMeshVersion = pNavMeshStatus.getVersion(); - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); - } - } - - mRequestStatus = pNavMeshRequestStatus; - mNavMeshStatus = pNavMeshStatus.getStatus(); - mLocationCallback(); -} - -void LLPathfindingNavMeshZone::NavMeshLocation::clear() -{ - mHasNavMesh = false; - mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; - mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; - 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 availableRegions; - currentRegion->getNeighboringRegionsStatus( availableRegions ); - //Is the desired region in the available list - std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); - if ( foundElem != availableRegions.end() ) - { - std::vector neighborRegionsPtrs; - currentRegion->getNeighboringRegions( neighborRegionsPtrs ); - region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; - } - } - } - - return region; -} +/** + * @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 +#include + +#include + +#define CENTER_REGION 99 + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() + : mNavMeshLocationPtrs(), + mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), + mNavMeshZoneSignal() +{ +} + +LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone() +{ +} + +LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback) +{ + return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); +} + +void LLPathfindingNavMeshZone::initialize() +{ + mNavMeshLocationPtrs.clear(); + +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; + std::vector availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + std::vector neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + for (std::vector::const_iterator statusIter = availableRegions.begin(); + statusIter != availableRegions.end(); ++statusIter) + { + LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; + llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; + } + } + +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + 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(); + } +} + +LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const +{ + bool hasPending = false; + bool hasBuilding = false; + bool hasComplete = false; + bool hasRepending = false; + + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + + switch (navMeshLocationPtr->getNavMeshStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + hasPending = true; + break; + case LLPathfindingNavMeshStatus::kBuilding : + hasBuilding = true; + break; + case LLPathfindingNavMeshStatus::kComplete : + hasComplete = true; + break; + case LLPathfindingNavMeshStatus::kRepending : + hasRepending = true; + break; + default : + hasPending = true; + llassert(0); + break; + } + } + + ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; + if (hasRepending || (hasPending && hasBuilding)) + { + zoneStatus = kNavMeshZonePendingAndBuilding; + } + else if (hasComplete) + { + if (hasPending) + { + zoneStatus = kNavMeshZoneSomePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneSomeBuilding; + } + else + { + zoneStatus = kNavMeshZoneComplete; + } + } + else if (hasPending) + { + zoneStatus = kNavMeshZonePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneBuilding; + } + + return zoneStatus; +} + +void LLPathfindingNavMeshZone::handleNavMeshLocation() +{ + updateStatus(); +} + +void LLPathfindingNavMeshZone::updateStatus() +{ + bool hasRequestUnknown = false; + bool hasRequestChecking = false; + bool hasRequestNeedsUpdate = false; + bool hasRequestStarted = false; + bool hasRequestCompleted = false; + bool hasRequestNotEnabled = false; + bool hasRequestError = false; + +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + switch (navMeshLocationPtr->getRequestStatus()) + { + case LLPathfindingNavMesh::kNavMeshRequestUnknown : + hasRequestUnknown = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestChecking : + hasRequestChecking = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : + hasRequestNeedsUpdate = 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 (hasRequestNeedsUpdate) + { + zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestChecking) + { + zoneRequestStatus = kNavMeshZoneRequestChecking; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestStarted) + { + zoneRequestStatus = kNavMeshZoneRequestStarted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestError) + { + zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestCompleted) + { + zoneRequestStatus = kNavMeshZoneRequestCompleted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestNotEnabled) + { + zoneRequestStatus = kNavMeshZoneRequestNotEnabled; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else + { + zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(0); + } + + if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && + (zoneRequestStatus == kNavMeshZoneRequestCompleted)) + { +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->stitchNavMeshes(); + } +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + + mNavMeshZoneRequestStatus = zoneRequestStatus; + mNavMeshZoneSignal(mNavMeshZoneRequestStatus); +} + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone::NavMeshLocation +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback) + : mDirection(pDirection), + mRegionUUID(), + mHasNavMesh(false), + mNavMeshVersion(0U), + mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), + 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)); + } +} + +void LLPathfindingNavMeshZone::NavMeshLocation::refresh() +{ + LLViewerRegion *region = getRegion(); + + if (region == NULL) + { + llassert(mRegionUUID.isNull()); + LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); + LLSD::Binary nullData; + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); + } + else + { + llassert(mRegionUUID == region->getRegionID()); + LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region); + } +} + +void LLPathfindingNavMeshZone::NavMeshLocation::disable() +{ + clear(); +} + +LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const +{ + return mRequestStatus; +} + +LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const +{ + return mNavMeshStatus; +} + +void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData) +{ + llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); + + if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && + (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) + { + llassert(!pNavMeshData.empty()); + mHasNavMesh = true; + mNavMeshVersion = pNavMeshStatus.getVersion(); + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + } + } + + mRequestStatus = pNavMeshRequestStatus; + mNavMeshStatus = pNavMeshStatus.getStatus(); + mLocationCallback(); +} + +void LLPathfindingNavMeshZone::NavMeshLocation::clear() +{ + mHasNavMesh = false; + mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; + mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; + 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 availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); + if ( foundElem != availableRegions.end() ) + { + std::vector neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; + } + } + } + + return region; +} -- cgit v1.2.3 From 1cdef4903daea1622923550b1328b659a594b029 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 18 Apr 2012 16:03:33 -0700 Subject: Updating to the latest llphysicextensions pre-built package with the now lowercased version of the header file names. --- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 4f8ca39987..9c7b493701 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -35,7 +35,7 @@ #include "llpathfindingmanager.h" #include "llviewercontrol.h" -#include "LLPathingLib.h" +#include "llpathinglib.h" #include #include -- cgit v1.2.3 From a72034fa42ebaf7e2f56c4a8cb0f445f12d22fe4 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 24 Apr 2012 19:23:20 -0700 Subject: PATH-580: BUGFIX Adding functionality to detect when the region's capabilities have not yet been loading and deferring requests for the navmesh query until the capabilities are fully loaded. --- indra/newview/llpathfindingnavmeshzone.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 9c7b493701..f7872f6e29 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -206,6 +206,7 @@ void LLPathfindingNavMeshZone::handleNavMeshLocation() void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; + bool hasRequestWaiting = false; bool hasRequestChecking = false; bool hasRequestNeedsUpdate = false; bool hasRequestStarted = false; @@ -228,6 +229,9 @@ void LLPathfindingNavMeshZone::updateStatus() case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; break; + case LLPathfindingNavMesh::kNavMeshRequestWaiting : + hasRequestWaiting = true; + break; case LLPathfindingNavMesh::kNavMeshRequestChecking : hasRequestChecking = true; break; @@ -254,7 +258,14 @@ void LLPathfindingNavMeshZone::updateStatus() } ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; - if (hasRequestNeedsUpdate) + if (hasRequestWaiting) + { + zoneRequestStatus = kNavMeshZoneRequestWaiting; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is WAITING" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestNeedsUpdate) { zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE -- cgit v1.2.3 From b1013ca76072531340779919d55a1a4f628989e5 Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 22 May 2012 14:59:00 -0400 Subject: Fix for path-648: shapes are now positioned correctly in neighboring regions. Renamed api to better reflect it's purpose --- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index f7872f6e29..816c94e25e 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -332,7 +332,7 @@ void LLPathfindingNavMeshZone::updateStatus() llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { - LLPathingLib::getInstance()->stitchNavMeshes(); + LLPathingLib::getInstance()->processNavMeshData(); } #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; -- cgit v1.2.3 From b59a82fc8ea5a23a886d3eb5d3c27b7c1d97d8d6 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 18 Jun 2012 17:21:42 -0700 Subject: PATH-705: Creating a path to pull in the state of the current region navmesh without downloading the navmesh binary. --- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 816c94e25e..69c76c9407 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -393,7 +393,7 @@ void LLPathfindingNavMeshZone::NavMeshLocation::refresh() else { llassert(mRegionUUID == region->getRegionID()); - LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region); + LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region, false); } } -- cgit v1.2.3 From 7cc44fb7fe40706e2017343d76ed226f477dad8d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 22 Jun 2012 18:15:56 -0700 Subject: PATH-759: Removing XXX_STINSON_DEBUG_NAVMESH_ZONE ifdefs. --- indra/newview/llpathfindingnavmeshzone.cpp | 57 ------------------------------ 1 file changed, 57 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 69c76c9407..d8670062e9 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -68,24 +68,6 @@ void LLPathfindingNavMeshZone::initialize() { mNavMeshLocationPtrs.clear(); -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - LLViewerRegion *currentRegion = gAgent.getRegion(); - if (currentRegion != NULL) - { - llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; - std::vector availableRegions; - currentRegion->getNeighboringRegionsStatus( availableRegions ); - std::vector neighborRegionsPtrs; - currentRegion->getNeighboringRegions( neighborRegionsPtrs ); - for (std::vector::const_iterator statusIter = availableRegions.begin(); - statusIter != availableRegions.end(); ++statusIter) - { - LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; - llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; - } - } - -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); mNavMeshLocationPtrs.push_back(centerNavMeshPtr); @@ -214,16 +196,10 @@ void LLPathfindingNavMeshZone::updateStatus() bool hasRequestNotEnabled = false; bool hasRequestError = false; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE switch (navMeshLocationPtr->getRequestStatus()) { case LLPathfindingNavMesh::kNavMeshRequestUnknown : @@ -261,82 +237,49 @@ void LLPathfindingNavMeshZone::updateStatus() if (hasRequestWaiting) { zoneRequestStatus = kNavMeshZoneRequestWaiting; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is WAITING" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestNeedsUpdate) { zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestChecking) { zoneRequestStatus = kNavMeshZoneRequestChecking; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestStarted) { zoneRequestStatus = kNavMeshZoneRequestStarted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestError) { zoneRequestStatus = kNavMeshZoneRequestError; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestUnknown) { zoneRequestStatus = kNavMeshZoneRequestUnknown; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestNotEnabled) { zoneRequestStatus = kNavMeshZoneRequestNotEnabled; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else { zoneRequestStatus = kNavMeshZoneRequestError; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(0); } if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && (zoneRequestStatus == kNavMeshZoneRequestCompleted)) { -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->processNavMeshData(); } -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } mNavMeshZoneRequestStatus = zoneRequestStatus; -- cgit v1.2.3 From 2cd321eaa9b9b9872318ce3977acd9a2f782872f Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 26 Jun 2012 14:09:07 -0700 Subject: Updating the pathfinding-specific settings with appropriate comments and an unified naming scheme. --- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index d8670062e9..ee81762792 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -71,7 +71,7 @@ void LLPathfindingNavMeshZone::initialize() NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); mNavMeshLocationPtrs.push_back(centerNavMeshPtr); - U32 neighborRegionDir = gSavedSettings.getU32("RetrieveNeighboringRegion"); + U32 neighborRegionDir = gSavedSettings.getU32("PathfindingRetrieveNeighboringRegion"); if (neighborRegionDir != CENTER_REGION) { NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); -- cgit v1.2.3 From 78910cf3016fc55eaf8214640b348df0f8bcdeda Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 26 Jun 2012 18:04:19 -0700 Subject: Updating the header licensing comments. --- indra/newview/llpathfindingnavmeshzone.cpp | 55 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 26 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index ee81762792..0298eedfef 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -1,37 +1,40 @@ /** - * @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$ - */ +* @file llpathfindingnavmeshzone.cpp +* @brief Implementation of llpathfindingnavmeshzone +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, 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 "llpathfindingnavmeshzone.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" -- cgit v1.2.3 From 685a672b74550ca0dbf8a816257c84c9c44fd34d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 28 Jun 2012 15:37:55 -0700 Subject: Cleaning up new files in preparation for merge into viewer-release. --- indra/newview/llpathfindingnavmeshzone.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 0298eedfef..e190dbba65 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -30,20 +30,22 @@ #include "llpathfindingnavmeshzone.h" -#include "llsd.h" -#include "lluuid.h" -#include "llagent.h" -#include "llviewerregion.h" -#include "llpathfindingnavmesh.h" -#include "llpathfindingmanager.h" -#include "llviewercontrol.h" - -#include "llpathinglib.h" - -#include #include #include +#include +#include +#include + +#include "llagent.h" +#include "llpathfindingmanager.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" +#include "llpathinglib.h" +#include "llsd.h" +#include "lluuid.h" +#include "llviewercontrol.h" +#include "llviewerregion.h" #define CENTER_REGION 99 @@ -104,7 +106,6 @@ void LLPathfindingNavMeshZone::disable() void LLPathfindingNavMeshZone::refresh() { - llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->cleanupResidual(); -- cgit v1.2.3