void FNavigationOctree::AppendToNode(const FOctreeElementId& Id, INavRelevantInterface* NavElement, const FBox& Bounds, FNavigationOctreeElement& Element) { FNavigationOctreeElement OrgData = GetElementById(Id); Element = OrgData; Element.Bounds = Bounds + OrgData.Bounds.GetBox(); if (NavElement) { SCOPE_CYCLE_COUNTER(STAT_Navigation_GatheringNavigationModifiersSync); NavElement->GetNavigationData(*Element.Data); } // shrink arrays before counting memory // it will be reallocated when adding to octree and RemoveNode will have different value returned by GetAllocatedSize() Element.Shrink(); const int32 OrgElementMemory = OrgData.GetAllocatedSize(); const int32 NewElementMemory = Element.GetAllocatedSize(); const int32 MemoryDelta = NewElementMemory - OrgElementMemory; NodesMemory += MemoryDelta; INC_MEMORY_STAT_BY(STAT_Navigation_CollisionTreeMemory, MemoryDelta); RemoveElement(Id); AddElement(Element); }
void FNavigationOctree::AddNode(UObject* ElementOb, INavRelevantInterface* NavElement, const FBox& Bounds, FNavigationOctreeElement& Data) { Data.Owner = ElementOb; Data.Bounds = Bounds; UActorComponent* ActorComp = Cast<UActorComponent>(ElementOb); if (bGatherGeometry && ActorComp) { ComponentExportDelegate.ExecuteIfBound(ActorComp, Data.Data); } if (NavElement) { SCOPE_CYCLE_COUNTER(STAT_Navigation_GatheringNavigationModifiersSync); NavElement->GetNavigationData(Data.Data); } // shrink arrays before counting memory // it will be reallocated when adding to octree and RemoveNode will have different value returned by GetAllocatedSize() Data.Shrink(); const int32 ElementMemory = Data.GetAllocatedSize(); NodesMemory += ElementMemory; INC_MEMORY_STAT_BY(STAT_Navigation_CollisionTreeMemory, ElementMemory); AddElement(Data); }
void FNavigationOctree::AddNode(FNavigationOctreeElement& Data) { #if NAVOCTREE_CONTAINS_COLLISION_DATA const int32 ElementMemory = Data.GetAllocatedSize(); NodesMemory += ElementMemory; INC_MEMORY_STAT_BY(STAT_Navigation_CollisionTreeMemory, ElementMemory); #endif AddElement(Data); }
void FNavigationOctree::AddNode(UObject* ElementOb, INavRelevantInterface* NavElement, const FBox& Bounds, FNavigationOctreeElement& Element) { // we assume NavElement is ElementOb already cast Element.Bounds = Bounds; if (NavElement) { const ENavDataGatheringMode GatheringMode = NavElement->GetGeometryGatheringMode(); bool bDoInstantGathering = ((GatheringMode == ENavDataGatheringMode::Default && DefaultGeometryGatheringMode == ENavDataGatheringMode::Instant) || GatheringMode == ENavDataGatheringMode::Instant); if (bGatherGeometry) { UActorComponent* ActorComp = Cast<UActorComponent>(ElementOb); if (ActorComp) { if (bDoInstantGathering) { ComponentExportDelegate.ExecuteIfBound(ActorComp, *Element.Data); } else { Element.Data->bPendingLazyGeometryGathering = true; Element.Data->bSupportsGatheringGeometrySlices = NavElement && NavElement->SupportsGatheringGeometrySlices(); } } } SCOPE_CYCLE_COUNTER(STAT_Navigation_GatheringNavigationModifiersSync); if (bDoInstantGathering) { NavElement->GetNavigationData(*Element.Data); } else { Element.Data->bPendingLazyModifiersGathering = true; } } // shrink arrays before counting memory // it will be reallocated when adding to octree and RemoveNode will have different value returned by GetAllocatedSize() Element.Shrink(); const int32 ElementMemory = Element.GetAllocatedSize(); NodesMemory += ElementMemory; INC_MEMORY_STAT_BY(STAT_Navigation_CollisionTreeMemory, ElementMemory); AddElement(Element); }