You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #ROBOMERGE-SOURCE: CL 7249172 via CL 7262694 #ROBOMERGE-BOT: (v369-7254125) [CL 7262757 by mieszko zielinski in Main branch]
57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "NavigationDirtyAreasController.h"
|
|
#include "NavigationData.h"
|
|
|
|
//----------------------------------------------------------------------//
|
|
// FNavigationDirtyAreasController
|
|
//----------------------------------------------------------------------//
|
|
FNavigationDirtyAreasController::FNavigationDirtyAreasController()
|
|
: bCanAccumulateDirtyAreas(true)
|
|
#if !UE_BUILD_SHIPPING
|
|
, bDirtyAreasReportedWhileAccumulationLocked(false)
|
|
#endif // !UE_BUILD_SHIPPING
|
|
{
|
|
|
|
}
|
|
|
|
void FNavigationDirtyAreasController::Tick(const float DeltaSeconds, const TArray<ANavigationData*>& NavDataSet, bool bForceRebuilding)
|
|
{
|
|
DirtyAreasUpdateTime += DeltaSeconds;
|
|
const bool bCanRebuildNow = bForceRebuilding || (DirtyAreasUpdateFreq != 0.f && DirtyAreasUpdateTime >= (1.0f / DirtyAreasUpdateFreq));
|
|
|
|
if (DirtyAreas.Num() > 0 && bCanRebuildNow)
|
|
{
|
|
for (ANavigationData* NavData : NavDataSet)
|
|
{
|
|
if (NavData)
|
|
{
|
|
NavData->RebuildDirtyAreas(DirtyAreas);
|
|
}
|
|
}
|
|
|
|
DirtyAreasUpdateTime = 0.f;
|
|
DirtyAreas.Reset();
|
|
}
|
|
}
|
|
|
|
void FNavigationDirtyAreasController::AddArea(const FBox& NewArea, int32 Flags)
|
|
{
|
|
if (Flags > 0 && bCanAccumulateDirtyAreas && NewArea.IsValid)
|
|
{
|
|
DirtyAreas.Add(FNavigationDirtyArea(NewArea, Flags));
|
|
}
|
|
#if !UE_BUILD_SHIPPING
|
|
bDirtyAreasReportedWhileAccumulationLocked = bDirtyAreasReportedWhileAccumulationLocked || (Flags > 0 && !bCanAccumulateDirtyAreas);
|
|
#endif // !UE_BUILD_SHIPPING
|
|
}
|
|
|
|
void FNavigationDirtyAreasController::Reset()
|
|
{
|
|
// discard all pending dirty areas, we are going to rebuild navmesh anyway
|
|
DirtyAreas.Reset();
|
|
#if !UE_BUILD_SHIPPING
|
|
bDirtyAreasReportedWhileAccumulationLocked = false;
|
|
#endif // !UE_BUILD_SHIPPING
|
|
}
|