Files
UnrealEngineUWP/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectHashGrid.cpp
bryan sefcik 50d4fac9e0 Updated ../Engine/Plugins/... to inline gen.cpp files
Before:
3548 unity files
Total CPU Time: 47343.578125 s
Total time in Parallel executor: 494.60 seconds

After:
3445 unity files
Total CPU Time: 46044.671875 s
Total time in Parallel executor: 468.51 seconds

#jira
#preflight 63336159b20e73a098b7f24f

[CL 22218213 by bryan sefcik in ue5-main branch]
2022-09-28 01:06:15 -04:00

39 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SmartObjectHashGrid.h"
#include "DebugRenderSceneProxy.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(SmartObjectHashGrid)
FInstancedStruct USmartObjectHashGrid::Add(const FSmartObjectHandle Handle, const FBox& Bounds)
{
FSmartObjectHashGridEntryData GridEntryData;
GridEntryData.CellLoc = HashGrid.Add(Handle, Bounds);
return FInstancedStruct::Make(GridEntryData);
}
void USmartObjectHashGrid::Remove(const FSmartObjectHandle Handle, const FStructView& EntryData)
{
FSmartObjectHashGridEntryData& GridEntryData = EntryData.GetMutable<FSmartObjectHashGridEntryData>();
HashGrid.Remove(Handle, GridEntryData.CellLoc);
GridEntryData.CellLoc = {};
}
void USmartObjectHashGrid::Find(const FBox& QueryBox, TArray<FSmartObjectHandle>& OutResults)
{
HashGrid.QuerySmall(QueryBox, OutResults);
}
#if UE_ENABLE_DEBUG_DRAWING
void USmartObjectHashGrid::Draw(FDebugRenderSceneProxy* DebugProxy)
{
const TSet<FSmartObjectHashGrid2D::FCell>& AllCells = HashGrid.GetCells();
for (auto It(AllCells.CreateConstIterator()); It; ++It)
{
FBox CellBounds = HashGrid.CalcCellBounds(FSmartObjectHashGrid2D::FCellLocation(It->X, It->Y, It->Level));
DebugProxy->Boxes.Emplace(CellBounds, GColorList.GetFColorByIndex(It->Level));
}
}
#endif //UE_ENABLE_DEBUG_DRAWING