You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb trivial #preflight 62322b8c6e25767a218d46b0 #ROBOMERGE-AUTHOR: yoan.stamant #ROBOMERGE-SOURCE: CL 19410090 via CL 19412659 via CL 19426193 via CL 19426309 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v930-19419903) [CL 19429514 by yoan stamant in ue5-main branch]
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SmartObjectHashGrid.h"
|
|
#include "DebugRenderSceneProxy.h"
|
|
|
|
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
|