2019-07-10 13:31:21 -04:00
|
|
|
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#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)
|
|
|
|
|
{
|
|
|
|
|
const FOctreeElementId* ElementId = GetObjectsNavOctreeId(NodeOwner);
|
2019-07-16 05:52:45 -04:00
|
|
|
if (ElementId != nullptr && ensure(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
|
|
|
|
|
FNavigationOctreeElement& ElementData = NavOctree->GetElementById(*ElementId);
|
|
|
|
|
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
|
|
|
|
|
{
|
2019-07-16 05:52:45 -04:00
|
|
|
const FOctreeElementId* ElementId = GetObjectsNavOctreeId(Object);
|
2019-07-10 13:31:21 -04:00
|
|
|
|
2019-07-16 05:52:45 -04:00
|
|
|
if (ElementId != nullptr && ensure(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));
|
|
|
|
|
}
|