class GUICulling

Object that maintains a list of GUI elements visible within a certain area.

Public

Constructors

GUICulling

GUICulling(const TArrayView<GUIElement *> &elements, float maximumQuadTreeSize = 5.0E+4F)

Builds a quad-tree from provided child elements and their current relative positions and size.

elements
Elements to register into the quad-tree.
maximumQuadTreeSize
Maximum allowed bounds of the internal quad tree.

Methods

RebuildQuadTree

void RebuildQuadTree(const TArrayView<GUIElement *> &elements)

Recreates the internal quad-tree and adds all the provided elements.

The elements should be the same as currently in the quad-tree.

UpdateVisibleElements

void UpdateVisibleElements(const Area2 &bounds)

Traverses the built oct-tree and tags all elements within the provided bounds as visible, and the remainder as invisible.

RegisterElement

void RegisterElement(GUIElement *element)

Sets up necessary information for culling the provided element.

Should be called on every element added to the layout, if culling is enabled.

UnregisterElement

void UnregisterElement(GUIElement *element)

Removes the element from culling related data structures.

Should be called before the element is removed from the layout, if culling is enabled.

ClearElements

void ClearElements()

Clears quad-tree IDs and culling flags from all the child elements.

GetVisibleElements

const TInlineArray<GUIElement *, 4> &GetVisibleElements() const

Returns currently visible elements.

Private

Fields

mCullingQueryIndex

u8 mCullingQueryIndex

mQuadTree

UPtr<GUIElementQuadTree> mQuadTree

mNonCulledElements

UnorderedMap<GUIElement *, GUIElementCullInformation> mNonCulledElements

mVisibleElements

TInlineArray<GUIElement *, 4> mVisibleElements

mMaximumQuadTreeSize

float mMaximumQuadTreeSize