Nebula
Loading...
Searching...
No Matches
Util::OccupancyQuadTree Class Reference

#include <occupancyquadtree.h>

Classes

struct  Node

Public Member Functions

 OccupancyQuadTree ()
 constructor
 ~OccupancyQuadTree ()
 destructor
void Setup (uint textureSize, uint maxSize, uint minSize)
 setup with a world size and a biggest allocation size
Math::uint2 Allocate (uint size)
 allocate a region, return region
bool Deallocate (const Math::uint2 coord, uint size)
 deallocate region
bool IsOccupied (const Math::uint2 coord, uint size)
 check if region is alloced
void Clear ()
 Clear the tree.
const Util::FixedArray< Util::FixedArray< Node > > & GetTopLevelNodes ()

Private Member Functions

bool RecursiveAllocate (Node *node, uint size, Math::uint2 &outCoord)
 recursively traverse tree to allocate node from tree
bool RecursiveDeallocate (Node *node, Math::uint2 coord, uint size)
 recursively traverse tree and deallocate
bool RecursiveSearch (Node *node, Math::uint2 coord, uint size)
 recursively traverse tree and find if allocated

Private Attributes

Memory::ArenaAllocator< sizeof(Node) *64 > allocator
Util::FixedArray< Util::FixedArray< Node > > topLevelNodes
uint minSize

Constructor & Destructor Documentation

◆ OccupancyQuadTree()

Util::OccupancyQuadTree::OccupancyQuadTree ( )
inline

constructor

◆ ~OccupancyQuadTree()

Util::OccupancyQuadTree::~OccupancyQuadTree ( )
inline

destructor

Member Function Documentation

◆ Allocate()

Math::uint2 Util::OccupancyQuadTree::Allocate ( uint size)
inline

allocate a region, return region

◆ Clear()

void Util::OccupancyQuadTree::Clear ( )
inline

Clear the tree.

◆ Deallocate()

bool Util::OccupancyQuadTree::Deallocate ( const Math::uint2 coord,
uint size )
inline

deallocate region

◆ GetTopLevelNodes()

const Util::FixedArray< Util::FixedArray< Node > > & Util::OccupancyQuadTree::GetTopLevelNodes ( )

◆ IsOccupied()

bool Util::OccupancyQuadTree::IsOccupied ( const Math::uint2 coord,
uint size )
inline

check if region is alloced

◆ RecursiveAllocate()

bool Util::OccupancyQuadTree::RecursiveAllocate ( OccupancyQuadTree::Node * node,
uint size,
Math::uint2 & outCoord )
inlineprivate

recursively traverse tree to allocate node from tree

◆ RecursiveDeallocate()

bool Util::OccupancyQuadTree::RecursiveDeallocate ( Node * node,
Math::uint2 coord,
uint size )
inlineprivate

recursively traverse tree and deallocate

◆ RecursiveSearch()

bool Util::OccupancyQuadTree::RecursiveSearch ( Node * node,
Math::uint2 coord,
uint size )
inlineprivate

recursively traverse tree and find if allocated

◆ Setup()

void Util::OccupancyQuadTree::Setup ( uint textureSize,
uint maxSize,
uint minSize )
inline

setup with a world size and a biggest allocation size

Member Data Documentation

◆ allocator

Memory::ArenaAllocator<sizeof(Node) * 64> Util::OccupancyQuadTree::allocator
private

◆ minSize

uint Util::OccupancyQuadTree::minSize
private

◆ topLevelNodes

Util::FixedArray<Util::FixedArray<Node> > Util::OccupancyQuadTree::topLevelNodes
private

The documentation for this class was generated from the following file: