2019-12-26 14:45:42 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2019-07-10 13:31:21 -04:00
|
|
|
|
|
|
|
|
#include "NavigationOctreeController.h"
|
|
|
|
|
#include "AI/Navigation/NavRelevantInterface.h"
|
|
|
|
|
#include "NavigationSystem.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
// FNavigationOctreeController
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
void FNavigationOctreeController::Reset()
|
|
|
|
|
{
|
|
|
|
|
if (NavOctree.IsValid())
|
|
|
|
|
{
|
|
|
|
|
NavOctree->Destroy();
|
|
|
|
|
NavOctree = NULL;
|
|
|
|
|
}
|
|
|
|
|
PendingOctreeUpdates.Empty(32);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FNavigationOctreeController::SetNavigableGeometryStoringMode(FNavigationOctree::ENavGeometryStoringMode NavGeometryMode)
|
|
|
|
|
{
|
|
|
|
|
check(NavOctree.IsValid());
|
|
|
|
|
NavOctree->SetNavigableGeometryStoringMode(NavGeometryMode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FNavigationOctreeController::GetNavOctreeElementData(const UObject& NodeOwner, int32& DirtyFlags, FBox& DirtyBounds)
|
|
|
|
|
{
|
2020-04-21 23:23:12 -04:00
|
|
|
const FOctreeElementId2* ElementId = GetObjectsNavOctreeId(NodeOwner);
|
2019-08-28 20:52:49 -04:00
|
|
|
if (ElementId != nullptr && IsValidElement(*ElementId))
|
2019-07-10 13:31:21 -04:00
|
|
|
{
|
2019-07-16 05:52:45 -04:00
|
|
|
// mark area occupied by given actor as dirty
|
2020-04-14 16:59:52 -04:00
|
|
|
const FNavigationOctreeElement& ElementData = NavOctree->GetElementById(*ElementId);
|
2019-07-16 05:52:45 -04:00
|
|
|
DirtyFlags = ElementData.Data->GetDirtyFlag();
|
|
|
|
|
DirtyBounds = ElementData.Bounds.GetBox();
|
|
|
|
|
return true;
|
2019-07-10 13:31:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FNavigationRelevantData* FNavigationOctreeController::GetDataForObject(const UObject& Object) const
|
|
|
|
|
{
|
2020-04-21 23:23:12 -04:00
|
|
|
const FOctreeElementId2* ElementId = GetObjectsNavOctreeId(Object);
|
2019-07-10 13:31:21 -04:00
|
|
|
|
2019-08-28 20:52:49 -04:00
|
|
|
if (ElementId != nullptr && IsValidElement(*ElementId))
|
2019-07-10 13:31:21 -04:00
|
|
|
{
|
2019-07-16 05:52:45 -04:00
|
|
|
return NavOctree->GetDataForID(*ElementId);
|
2019-07-10 13:31:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FNavigationRelevantData* FNavigationOctreeController::GetMutableDataForObject(const UObject& Object)
|
|
|
|
|
{
|
|
|
|
|
return const_cast<FNavigationRelevantData*>(GetDataForObject(Object));
|
|
|
|
|
}
|