Hello,
I am struggling to use TConstElementBoxIterator
My Octree declaration:
struct FVertex //Struct for the element
{
public:
int32 ID;
FVector A;
FVector B;
//Functions:
FVertex()
{
A = FVector(0);
B = FVector(0);
}
FVertex(FVector a, FVector b) : A(a), B(b) {}
FBoxCenterAndExtent EdgeGetBoundingBox() const //C++ wtf again !?
{
FBox box = FBox(ForceInit);
box += A;
box += B;
return FBoxCenterAndExtent(box);
}
};
struct FVertexOctreeSemantics
{
enum { MaxElementsPerLeaf = 16 };
enum { MinInclusiveElementsPerNode = 7 };
enum { MaxNodeDepth = 12 };
typedef TInlineAllocator<MaxElementsPerLeaf> ElementAllocator;
FORCEINLINE static FBoxCenterAndExtent GetBoundingBox(const FVertex* Element)
{
return Element->EdgeGetBoundingBox();
}
FORCEINLINE static bool AreElementsEqual(const FVertex* A, const FVertex* B)
{
return A == B;
}
//Ignored for now.
FORCEINLINE static void SetElementId(const FVertex* Element, int32 Id) { /*Element.ID = Id; */}
};
typedef TOctree<FVertex*, FVertexOctreeSemantics> FEdgeTree;
FVector Extents = FVector(Range);
const FBoxCenterAndExtent OverLapBox = FBoxCenterAndExtent(Center, Extents);
FEdgeTree::TConstElementBoxIterator iter = FEdgeTree::TConstElementBoxIterator<FEdgeTree::DefaultStackAllocator>(m_edgeTree.Get(), OverLapBox);
But C++ don’t love me
Error:
1>C:\Users\Roma\Documents\Unreal Projects\NordicWarriors\Source\NordicWarriors\Navigation\NavEdgeQuerry.cpp(34): error C2955: 'TOctree::TConstElementBoxIterator': use of class template requires template argument list 1> c:\program files\epic games\ue_4.16\engine\source\runtime\engine\public\GenericOctree.h(564): note: see declaration of 'TOctree::TConstElementBoxIterator' 1>C:\Users\Roma\Documents\Unreal Projects\NordicWarriors\Source\NordicWarriors\Navigation\NavEdgeQuerry.cpp(34): error C2440: '': cannot convert from 'initializer list' to 'TOctree::TConstElementBoxIterator::DefaultStackAllocator>' 1> C:\Users\Roma\Documents\Unreal Projects\NordicWarriors\Source\NordicWarriors\Navigation\NavEdgeQuerry.cpp(34): note: No constructor could take the source type, or constructor overload resolution was ambiguous 1>C:\Users\Roma\Documents\Unreal Projects\NordicWarriors\Source\NordicWarriors\Navigation\NavEdgeQuerry.cpp(34): error C2512: 'TOctree::TConstElementBoxIterator': no appropriate default constructor available