TOctree2

An octree.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/GenericOctree.h

Include

#include "Math/GenericOctree.h"

Syntax

template<typename ElementType, typename OctreeSemantics>
class TOctree2

Remarks

An octree.

Constructors

Name Description

Public function

TOctree2()

DO NOT USE. This constructor is for internal usage only for hot-reload purposes.

Public function

TOctree2

(
    const FVector& InOrigin,
    FVector::FReal InExtent
)

Initialization constructor.

Functions

Name Description

Public function

void

 

AddElement

(
    typename TCallTraits< ElementType >...
)

Adds an element to the octree.

Public function

void

 

ApplyOffset

(
    const FVector& InOffset,
    bool bGlobalOctree
)

Apply an arbitrary offset to all elements in the tree InOffset - offset to apply bGlobalOctree - hint that this octree is used as a boundless global volume, so only content will be shifted but not origin of the octree

Public function

void

 

Destroy()

This function resets the octree to empty.

Public function Const

void

 

DumpStats()

Writes stats for the octree to the log.

Public function Const

void

 

FindAllElements

(
    const IterateAllElementsFunc& Func
)

This function will call the passed in function for all elements in the Octree in node by node in no specified order.

Public function Const

void

 

FindElementsWithBoundsTest

(
    const FBoxCenterAndExtent& BoxBoun...,
    const IterateBoundsFunc& Func
)

This function will traverse the Octree using a fast box-box intersection this should be the preferred way of traversing the tree.

Public function Const

void

 

FindElementsWithPredicate

(
    const PredicateFunc& Predicate,
    const IterateFunc& Func
)

This function will traverse the Octree starting from the root in depth first order and the predicate can be used to implement custom culling for each node.

Public function Const

void

 

FindFirstElementWithBoundsTest

(
    const FBoxCenterAndExtent& BoxBoun...,
    const IterateBoundsFunc& Func
)

This function will traverse the Octree using a fast box-box intersection and aborts traversal as soon as the Element function returns false.

Public function Const

void

 

FindNearbyElements

(
    const FVector& Position,
    const IterateBoundsFunc& Func
)

This function will traverse the Octree using a tryint to find nearby nodes that contain any elements.

Public function Const

void

 

FindNodesWithPredicate

(
    const PredicateFunc& Predicate,
    const IterateFunc& Func
)

This function will traverse the Octree starting from the root in depth first order and the predicate can be used to implement custom culling for each node.

Public function Const

const Elemen...

 

GetElementById

(
    FOctreeElementId2 ElementId
)

Accesses an octree element by ID.

Public function

ElementType ...

 

GetElementById

(
    FOctreeElementId2 ElementId
)

Accesses an octree element by ID.

Public function Const

TArrayView< ...

 

GetElementsForNode

(
    FNodeIndex NodeIndex
)

Return all elements for a given node.

Public function Const

FReal

 

GetNodeLevelExtent

(
    int32 Level
)

Public function Const

int32

 

GetNumNodes()

Public function Const

FBoxCenterAn...

 

GetRootBounds()

Public function Const

SIZE_T

 

GetSizeBytes()

Public function Const

bool

 

IsValidElementId

(
    FOctreeElementId2 ElementId
)

Check if a FOctreeElementId2 is valid.

Public function

void

 

RemoveElement

(
    FOctreeElementId2 ElementId
)

Removes an element from the octree.

Protected function

void

 

SetElementId

(
    const ElementType& Element,
    FOctreeElementId2 Id
)

Redirects SetElementId call to the proper implementation

Public function

void

 

ShrinkElements()

Typedefs

Name

Description

ElementArrayType

FNodeIndex

FReal