Files
UnrealEngineUWP/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectOctree.cpp
yoan stamant 04214fbc78 [SmartObject] allow custom definitions (FSmartObjectSlotDefinitionData) and transient state data (FSmartObjectSlotStateData) per slot using MassEntity
+ replaced all methods Describe by LexToString
+ unified naming from "*ID" to *Handle
#preflight 61e85d121000e8c59a78c886
#rb mikko.mononen

#ROBOMERGE-AUTHOR: yoan.stamant
#ROBOMERGE-SOURCE: CL 18662203 in //UE5/Release-5.0/... via CL 18662234 via CL 18662264
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v900-18638592)

[CL 18662291 by yoan stamant in ue5-main branch]
2022-01-19 14:16:16 -05:00

59 lines
1.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SmartObjectOctree.h"
//----------------------------------------------------------------------//
// FSmartObjectOctreeElement
//----------------------------------------------------------------------//
FSmartObjectOctreeElement::FSmartObjectOctreeElement(const FBoxCenterAndExtent& InBounds, const FSmartObjectHandle& InSmartObjectHandle, const FSmartObjectOctreeIDSharedRef& InSharedOctreeID)
: Bounds(InBounds)
, SmartObjectHandle(InSmartObjectHandle)
, SharedOctreeID(InSharedOctreeID)
{
}
//----------------------------------------------------------------------//
// FSmartObjectOctree
//----------------------------------------------------------------------//
FSmartObjectOctree::FSmartObjectOctree()
: FSmartObjectOctree(FVector::ZeroVector, 0)
{
}
FSmartObjectOctree::FSmartObjectOctree(const FVector& Origin, float Radius)
: TOctree2<FSmartObjectOctreeElement, FSmartObjectOctreeSemantics>(Origin, Radius)
{
}
FSmartObjectOctree::~FSmartObjectOctree()
{
}
void FSmartObjectOctree::AddNode(const FBoxCenterAndExtent& Bounds, const FSmartObjectHandle& SmartObjectHandle, const FSmartObjectOctreeIDSharedRef& SharedOctreeID)
{
AddElement(FSmartObjectOctreeElement(Bounds, SmartObjectHandle, SharedOctreeID));
}
void FSmartObjectOctree::UpdateNode(const FOctreeElementId2& Id, const FBox& NewBounds)
{
FSmartObjectOctreeElement ElementCopy = GetElementById(Id);
RemoveElement(Id);
ElementCopy.Bounds = NewBounds;
AddElement(ElementCopy);
}
void FSmartObjectOctree::RemoveNode(const FOctreeElementId2& Id)
{
RemoveElement(Id);
}
//----------------------------------------------------------------------//
// FSmartObjectOctreeSemantics
//----------------------------------------------------------------------//
void FSmartObjectOctreeSemantics::SetElementId(const FSmartObjectOctreeElement& Element, FOctreeElementId2 Id)
{
Element.SharedOctreeID->ID = Id;
}